createSyncPlan
function createSyncPlan(options: CreateSyncPlanOptions): TransferPlan;Defined in: src/sync/createSyncPlan.ts:109
Builds a TransferPlan that reconciles two remote subtrees.
Plan steps are derived from a RemoteTreeDiff; the function does not perform
any I/O. Direction, delete policy, and conflict policy control which entries
become executable transfers and which become skip steps.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options | CreateSyncPlanOptions | Inputs and policies that shape the plan. |
Returns
Section titled “Returns”Transfer plan ready for createTransferJobsFromPlan or queue execution.
Throws
Section titled “Throws”ConfigurationError When conflictPolicy: "error" encounters a conflict.
Example
Section titled “Example”import { createSyncPlan, diffRemoteTrees, summarizeTransferPlan,} from "@zero-transfer/sdk";
const diff = await diffRemoteTrees( srcSession.fs, "/dist", dstSession.fs, "/releases/current",);
const plan = createSyncPlan({ id: "release-mirror", diff, source: { provider: "sftp", rootPath: "/dist" }, destination: { provider: "s3", rootPath: "/releases/current" }, deletePolicy: "mirror", conflictPolicy: "overwrite",});
console.table(summarizeTransferPlan(plan));