collectChanges MethodProtected @beta

Reads the source changes for the changeset ranges being processed. Override to supply changes from another source, such as a precomputed cache, instead of downloading and reading changesets.

An override can supply some ranges itself and pass the rest to super.collectChanges(). Pass the same changedInstanceIds to every call and handle the ranges in order, so that changes to the same instance in different ranges combine correctly. Use addChangeRecord to add each supplied change. See Supplying source changes for the full contract and an example.

collectChanges(ranges: ReadonlyArray<>, changedInstanceIds: ChangedInstanceIds = ...): Promise<CollectedChanges>

@returns The changed instance IDs to export and the records used to find the targets of deleted instances. See CollectedChanges for what the result must include.

@note The default implementation downloads the changesets, reads them with ChangesetReader, and returns one deletion batch per range.

@note Not called when the exporter already has changed instance IDs, for example when changedInstanceIds is passed in argsForProcessChanges. The transformer then still downloads and reads the changesets to find deletion records.

Parameter Type Description
ranges ReadonlyArray<> Ordered, inclusive [first, last] changeset index ranges. They already exclude changesets
that must be skipped, such as those pushed by a previous synchronization in the other direction, so an
override must cover exactly these ranges.
changedInstanceIds ChangedInstanceIds Receives the changes read from the ranges. Defaults to a new, empty instance.

Returns - Promise<CollectedChanges>

The changed instance IDs to export and the records used to find the targets of deleted instances. See CollectedChanges for what the result must include.

Defined in

Last Updated: 29 October, 2026