Skip to content

createKeepShapesResolver

createKeepShapesResolver(read): (operations) => Promise<({ operation: "add"; name: string; shapes: string[]; data: unknown; affirmedTargets?: string[]; skipExisting?: boolean; kind?: undefined; shape?: undefined; } | { operation: "revise"; name: string; shapes: string[]; data: unknown; affirmedTargets?: string[]; expectedVersion?: number; leaseId?: string; kind?: undefined; shape?: undefined; } | { operation: "retract"; name: string; reason?: string; expectedVersion?: number; leaseId?: string; kind?: undefined; shape?: undefined; } | { operation: "reaffirm"; name: string; add?: string[]; remove?: string[]; expectedVersion?: number; leaseId?: string; kind?: undefined; shape?: undefined; } | { operation: "rename"; name: string; newName: string; kind?: undefined; shape?: undefined; } | { operation: "restore"; name: string; newName?: string; expectedVersion?: number; leaseId?: string; kind?: undefined; shape?: undefined; })[]>

Resolve keepShapes revises for the low-level client.stream.append, one chunk at a time and in submission order. read is the batch Thing read a keepShapes revise’s Shapes and version come from, e.g. (wrefs) => client.thing.getMany(org, repo, wrefs). Every operation is checked first; one that states its Shapes passes through.

keepShapes pins the version it read; a cross-process resubmit of the same submissionId can conflict; explicit shapes is the retry-safe form.

ThingShapesReader

(operations) => Promise<({ operation: "add"; name: string; shapes: string[]; data: unknown; affirmedTargets?: string[]; skipExisting?: boolean; kind?: undefined; shape?: undefined; } | { operation: "revise"; name: string; shapes: string[]; data: unknown; affirmedTargets?: string[]; expectedVersion?: number; leaseId?: string; kind?: undefined; shape?: undefined; } | { operation: "retract"; name: string; reason?: string; expectedVersion?: number; leaseId?: string; kind?: undefined; shape?: undefined; } | { operation: "reaffirm"; name: string; add?: string[]; remove?: string[]; expectedVersion?: number; leaseId?: string; kind?: undefined; shape?: undefined; } | { operation: "rename"; name: string; newName: string; kind?: undefined; shape?: undefined; } | { operation: "restore"; name: string; newName?: string; expectedVersion?: number; leaseId?: string; kind?: undefined; shape?: undefined; })[]>