runSource
function runSource<C>(source: TroveSource<C>, options?: RunOptions<C>): Promise<RunResult>;Run a source’s sync against a built ctx and collect/validate the result.
This is the harness the CLI drives for trove source dev / trove source test: it builds the SourceContext from { config, cursor }, runs
sync(ctx), normalizes a bare-array return, validates every document’s
required fields (clear, indexed errors), and dedups by id. Errors thrown by
sync itself propagate unchanged so the CLI can report a failed run exactly as
the Mac app would.
Type Parameters
Section titled “Type Parameters”| Type Parameter | Default type | Description |
|---|---|---|
C | Record<string, unknown> | The shape of the source’s typed ctx.config preferences. |
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
source | TroveSource<C> | The source whose sync to run. |
options | RunOptions<C> | The { config, cursor } spec plus test injection points. |
Returns
Section titled “Returns”Promise<RunResult>
The validated, deduped RunResult.
Throws
Section titled “Throws”If sync throws, returns a malformed value, or a document fails validation.