import type { BaselineStorage, PullConflictPolicy, PushConflictPolicy } from "./baseline.js"; import type { ApplyResult, KindRef, RecipeKind, SyncContext } from "./kind.js"; import { type RecipePlan } from "./plan.js"; /** `what-if` prints the plan and writes nothing; `apply` converges. */ export type SyncMode = "what-if" | "apply"; export interface PushOptions { mode: SyncMode; /** * Include `delete` changes. Off by default — `push` is additive, so a * recipe omitting an element does not remove it from the remote. */ prune?: boolean; /** * How to resolve three-way merge conflicts (tenant disagrees with * both baseline and recipe). The kind must opt in by consulting * `ctx.baselineStorage` during `plan()`; kinds without baseline * support ignore this. Default behaviour when omitted is the kind's * choice — content recipes default to `"error"`; brief / campaign * kinds default to `"cms-wins"` (Sitecore AI is the source-of-truth * for author edits). */ conflictPolicy?: PushConflictPolicy; /** * Backing store for per-recipe baselines. When set, the engine * forwards it through `ctx.baselineStorage` so the kind's `plan()` * can read the last-applied state for three-way classification, and * the kind's `apply()` can write a fresh baseline after a successful * write. Omitting it leaves the kind in two-way diff mode (every * tenant divergence reads as `recipe-change`). */ baselineStorage?: BaselineStorage; } export interface PullOptions { /** * Conflict policy when the recipe-on-disk (or in-DB, in the * orchestrator case) disagrees with both the tenant and the * baseline. Mirrors `PushOptions.conflictPolicy` but with `tenant-wins` * in place of `cms-wins` since pull writes into the recipe side. * Pure-read pulls (no recipe to merge against) ignore this. */ conflictPolicy?: PullConflictPolicy; /** See `PushOptions.baselineStorage`. */ baselineStorage?: BaselineStorage; } export interface PushOutcome { /** The plan that was computed (deletes filtered out unless `prune`). */ plan: RecipePlan; /** The apply result — `null` under `what-if` or for a no-op plan. */ result: ApplyResult | null; } /** * Capture live remote state as a recipe (`sync pull`). The optional * `options` arg threads baseline + conflict-policy plumbing through * the kind's `readCurrent`; pure two-way pulls can omit it. */ export declare const syncPull: (kind: RecipeKind, ref: KindRef, ctx: SyncContext, options?: PullOptions) => Promise; /** Compute the plan to converge `ref` onto `desired` (`sync diff`). */ export declare const syncDiff: (kind: RecipeKind, desired: T, ref: KindRef, ctx: SyncContext) => Promise; /** * Converge `ref` onto `desired` (`sync push`). Honors the write gate: * `what-if` returns the plan without calling `apply`, and a no-op plan * short-circuits the same way. */ export declare const syncPush: (kind: RecipeKind, desired: T, ref: KindRef, ctx: SyncContext, options: PushOptions) => Promise;