Skip to content

applyRepositoryExportDelta

applyRepositoryExportDelta(base, delta, formats): Map<string, { wref: string; durableId: string; version: number; active: true; data: Record<string, unknown>; kind: "thing"; shapes: string[]; collections?: object[]; about?: { wref: string; v?: number; durableId: string; }; affirmed?: object[]; } | { wref: string; durableId: string; version: number; active: true; data: Record<string, unknown>; kind: "shape"; shapes: string[]; retracted?: true; } | { wref: string; durableId: string; version: number; kind: "thing" | "shape"; active: false; }>

Fold a delta export onto a base: active rows upsert, and tombstones remove. Rows fold by durableId, and from format 6 a Shape row folds by (durableId, version) — a delta that revises a Shape keeps every earlier version decodable, and a Shape tombstone (the Shape was removed) drops every version of it. Pure — neither argument is mutated — and order-dependent within each argument, so the last row for a key wins.

A format-6 delta onto a format-5 base (or the reverse) is refused: the two key a Shape differently, and the base lacks the Shape versions the delta’s pins assume. Take one fresh full export instead.

RepositoryExportRows

RepositoryExportRows

RepositoryExportDeltaFormats

Map<string, { wref: string; durableId: string; version: number; active: true; data: Record<string, unknown>; kind: "thing"; shapes: string[]; collections?: object[]; about?: { wref: string; v?: number; durableId: string; }; affirmed?: object[]; } | { wref: string; durableId: string; version: number; active: true; data: Record<string, unknown>; kind: "shape"; shapes: string[]; retracted?: true; } | { wref: string; durableId: string; version: number; kind: "thing" | "shape"; active: false; }>