Skip to content
Shapemetry

@huukhanhnguyen/model / schema/commandRegistry

schema/commandRegistry

ApplyDelta

ApplyDelta = { added: string[]; kept: number; moved: string[]; removed: string[]; replaced: string[]; }

What one collection's applyDocument pass did. Keys are identity values.

added

added: string[]

kept

kept: number

Present in both and structurally identical: left completely alone.

moved

moved: string[]

Same entry, different position. Order matters inside a fold.

removed

removed: string[]

replaced

replaced: string[]

Present in both, but the entry's JSON differed — replaced whole.


ApplyReport

ApplyReport = { inverses: LaneEditCall[]; lanes: Partial<Record<LaneName, ApplyDelta>>; objects: ApplyDelta; parameters: ApplyDelta; }

Result of Model.applyDocument — per-lane deltas plus inverses.

inverses

inverses: LaneEditCall[]

Every inverse produced, oldest first — replay in reverse to undo.

lanes

lanes: Partial<Record<LaneName, ApplyDelta>>

objects

objects: ApplyDelta

parameters

parameters: ApplyDelta


LaneEditCall

LaneEditCall = { args: [LaneName, LaneEntry, number]; fn: "laneInsert"; } | { args: [LaneName, string]; fn: "laneRemove"; } | { args: [LaneName, string, number]; fn: "laneMove"; } | { args: [LaneName, string, string, unknown]; fn: "laneSetField"; } | { args: [LaneName, string, string, string | undefined]; fn: "laneSetArg"; } | { args: [LaneName, string, (Operation | Group)[], LaneEditField?]; fn: "laneSetOps"; } | { args: [LaneName, string, LaneEntry]; fn: "laneReplace"; } | { args: [ModelSettings | undefined]; fn: "settingsSet"; }

A serializable description of a lane edit — the inverse every function below returns, and the unit applyLaneEdit replays (S2 D2's command log).

Last updated: 📖 2 min readEdit on GitHub