json-patch-to-crdt 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -324,6 +324,16 @@ type ValidatePatchResult = {
324
324
  ok: false;
325
325
  error: ApplyError;
326
326
  };
327
+ /**
328
+ * Merge strategy applied when two non-empty array sequences share no element lineage.
329
+ *
330
+ * - `"reject"` – abort the merge and return a `LINEAGE_MISMATCH` error (default).
331
+ * - `"atomic-replace"` – replace the losing array entirely with the one that has
332
+ * the higher representative dot (causal last-write-wins at the array level).
333
+ * - `"unsafe-union"` – union all elements from both sequences without any lineage
334
+ * check. Element ordering may be non-deterministic across peers.
335
+ */
336
+ type UnrelatedArraysStrategy = "reject" | "atomic-replace" | "unsafe-union";
327
337
  /** Options for `mergeState`. */
328
338
  type MergeStateOptions = {
329
339
  /**
@@ -332,16 +342,30 @@ type MergeStateOptions = {
332
342
  */
333
343
  actor?: ActorId;
334
344
  /**
335
- * Require array sequences to share element lineage before merging.
336
- * Defaults to `true`.
345
+ * Strategy for merging unrelated (non-overlapping) non-empty array sequences.
346
+ * Defaults to `"reject"`.
347
+ */
348
+ unrelatedArrays?: UnrelatedArraysStrategy;
349
+ /**
350
+ * @deprecated Use `unrelatedArrays` instead.
351
+ * When `true`, behaves like `unrelatedArrays: "reject"`.
352
+ * When `false`, behaves like `unrelatedArrays: "unsafe-union"`.
353
+ * Ignored when `unrelatedArrays` is also provided.
337
354
  */
338
355
  requireSharedOrigin?: boolean;
339
356
  };
340
357
  /** Options for `mergeDoc`. */
341
358
  type MergeDocOptions = {
342
359
  /**
343
- * Require array sequences to share element lineage before merging.
344
- * Defaults to `true`.
360
+ * Strategy for merging unrelated (non-overlapping) non-empty array sequences.
361
+ * Defaults to `"reject"`.
362
+ */
363
+ unrelatedArrays?: UnrelatedArraysStrategy;
364
+ /**
365
+ * @deprecated Use `unrelatedArrays` instead.
366
+ * When `true`, behaves like `unrelatedArrays: "reject"`.
367
+ * When `false`, behaves like `unrelatedArrays: "unsafe-union"`.
368
+ * Ignored when `unrelatedArrays` is also provided.
345
369
  */
346
370
  requireSharedOrigin?: boolean;
347
371
  };
@@ -655,7 +679,7 @@ declare function tryMergeDoc(a: Doc, b: Doc, options?: MergeDocOptions): TryMerg
655
679
  * The merged clock keeps a stable actor identity:
656
680
  * - defaults to the actor from the first argument (`a`)
657
681
  * - can be overridden via `options.actor`
658
- * - optional `options.requireSharedOrigin` controls merge lineage checks
682
+ * - optional `options.unrelatedArrays` controls the merge strategy for non-overlapping sequences
659
683
  *
660
684
  * The merged counter is lifted to the highest counter already observed for
661
685
  * that actor across both input clocks and the merged document dots.
@@ -718,4 +742,4 @@ declare class TraversalDepthError extends Error {
718
742
  constructor(depth: number, maxDepth?: number);
719
743
  }
720
744
  //#endregion
721
- export { Clock as $, cloneClock as A, SerializedClock as At, forkState as B, TryDeserializeDocResult as Bt, diffJsonPatch as C, ObjEntry as Ct, stableJsonValueKey as D, ROOT_KEY as Dt, parseJsonPointer as E, PatchSemantics as Et, PatchError as F, TombstoneCompactionOptions as Ft, validateJsonPatch as G, VersionVector as Gt, tryApplyPatch as H, TryMergeDocResult as Ht, applyPatch as I, TombstoneCompactionStats as It, ApplyPatchAsActorOptions as J, ActorId as K, applyPatchAsActor as L, TryApplyPatchAsActorResult as Lt, nextDotForActor as M, SerializedNode as Mt, observeDot as N, SerializedRgaElem as Nt, stringifyJsonPointer as O, RgaElem as Ot, JsonValueValidationError as P, SerializedState as Pt, ApplyResult as Q, applyPatchInPlace as R, TryApplyPatchInPlaceResult as Rt, compileJsonPatchToIntent as S, Node as St, jsonEquals as T, PatchErrorReason as Tt, tryApplyPatchAsActor as U, TryMergeStateResult as Ut, toJson as V, TryDeserializeStateResult as Vt, tryApplyPatchInPlace as W, ValidatePatchResult as Wt, ApplyPatchInPlaceOptions as X, ApplyPatchAsActorResult as Y, ApplyPatchOptions as Z, serializeDoc as _, JsonValidationMode as _t, intersectVersionVectors as a, DeserializeErrorReason as at, tryDeserializeState as b, MergeDocOptions as bt, versionVectorCovers as c, Doc as ct, mergeState as d, ForkStateOptions as dt, CompactDocTombstonesResult as et, tryMergeDoc as f, IntentOp as ft, deserializeState as g, JsonPrimitive as gt, deserializeDoc as h, JsonPatchToCrdtOptions as ht, compactStateTombstones as i, CreateStateOptions as it, createClock as j, SerializedDoc as jt, ClockValidationError as k, RgaSeq as kt, MergeError as l, Dot as lt, DeserializeError as m, JsonPatchOp as mt, TraversalDepthError as n, CompilePatchOptions as nt, mergeVersionVectors as o, DeserializeFailure as ot, tryMergeState as p, JsonPatch as pt, ApplyError as q, compactDocTombstones as r, CrdtState as rt, observedVersionVector as s, DiffOptions as st, MAX_TRAVERSAL_DEPTH as t, CompactStateTombstonesResult as tt, mergeDoc as u, ElemId as ut, serializeState as v, JsonValue as vt, getAtJson as w, ObjNode as wt, PatchCompileError as x, MergeStateOptions as xt, tryDeserializeDoc as y, LwwReg as yt, createState as z, TryApplyPatchResult as zt };
745
+ export { Clock as $, cloneClock as A, SerializedClock as At, forkState as B, TryDeserializeDocResult as Bt, diffJsonPatch as C, ObjEntry as Ct, stableJsonValueKey as D, ROOT_KEY as Dt, parseJsonPointer as E, PatchSemantics as Et, PatchError as F, TombstoneCompactionOptions as Ft, validateJsonPatch as G, ValidatePatchResult as Gt, tryApplyPatch as H, TryMergeDocResult as Ht, applyPatch as I, TombstoneCompactionStats as It, ApplyPatchAsActorOptions as J, ActorId as K, VersionVector as Kt, applyPatchAsActor as L, TryApplyPatchAsActorResult as Lt, nextDotForActor as M, SerializedNode as Mt, observeDot as N, SerializedRgaElem as Nt, stringifyJsonPointer as O, RgaElem as Ot, JsonValueValidationError as P, SerializedState as Pt, ApplyResult as Q, applyPatchInPlace as R, TryApplyPatchInPlaceResult as Rt, compileJsonPatchToIntent as S, Node as St, jsonEquals as T, PatchErrorReason as Tt, tryApplyPatchAsActor as U, TryMergeStateResult as Ut, toJson as V, TryDeserializeStateResult as Vt, tryApplyPatchInPlace as W, UnrelatedArraysStrategy as Wt, ApplyPatchInPlaceOptions as X, ApplyPatchAsActorResult as Y, ApplyPatchOptions as Z, serializeDoc as _, JsonValidationMode as _t, intersectVersionVectors as a, DeserializeErrorReason as at, tryDeserializeState as b, MergeDocOptions as bt, versionVectorCovers as c, Doc as ct, mergeState as d, ForkStateOptions as dt, CompactDocTombstonesResult as et, tryMergeDoc as f, IntentOp as ft, deserializeState as g, JsonPrimitive as gt, deserializeDoc as h, JsonPatchToCrdtOptions as ht, compactStateTombstones as i, CreateStateOptions as it, createClock as j, SerializedDoc as jt, ClockValidationError as k, RgaSeq as kt, MergeError as l, Dot as lt, DeserializeError as m, JsonPatchOp as mt, TraversalDepthError as n, CompilePatchOptions as nt, mergeVersionVectors as o, DeserializeFailure as ot, tryMergeState as p, JsonPatch as pt, ApplyError as q, compactDocTombstones as r, CrdtState as rt, observedVersionVector as s, DiffOptions as st, MAX_TRAVERSAL_DEPTH as t, CompactStateTombstonesResult as tt, mergeDoc as u, ElemId as ut, serializeState as v, JsonValue as vt, getAtJson as w, ObjNode as wt, PatchCompileError as x, MergeStateOptions as xt, tryDeserializeDoc as y, LwwReg as yt, createState as z, TryApplyPatchResult as zt };
@@ -324,6 +324,16 @@ type ValidatePatchResult = {
324
324
  ok: false;
325
325
  error: ApplyError;
326
326
  };
327
+ /**
328
+ * Merge strategy applied when two non-empty array sequences share no element lineage.
329
+ *
330
+ * - `"reject"` – abort the merge and return a `LINEAGE_MISMATCH` error (default).
331
+ * - `"atomic-replace"` – replace the losing array entirely with the one that has
332
+ * the higher representative dot (causal last-write-wins at the array level).
333
+ * - `"unsafe-union"` – union all elements from both sequences without any lineage
334
+ * check. Element ordering may be non-deterministic across peers.
335
+ */
336
+ type UnrelatedArraysStrategy = "reject" | "atomic-replace" | "unsafe-union";
327
337
  /** Options for `mergeState`. */
328
338
  type MergeStateOptions = {
329
339
  /**
@@ -332,16 +342,30 @@ type MergeStateOptions = {
332
342
  */
333
343
  actor?: ActorId;
334
344
  /**
335
- * Require array sequences to share element lineage before merging.
336
- * Defaults to `true`.
345
+ * Strategy for merging unrelated (non-overlapping) non-empty array sequences.
346
+ * Defaults to `"reject"`.
347
+ */
348
+ unrelatedArrays?: UnrelatedArraysStrategy;
349
+ /**
350
+ * @deprecated Use `unrelatedArrays` instead.
351
+ * When `true`, behaves like `unrelatedArrays: "reject"`.
352
+ * When `false`, behaves like `unrelatedArrays: "unsafe-union"`.
353
+ * Ignored when `unrelatedArrays` is also provided.
337
354
  */
338
355
  requireSharedOrigin?: boolean;
339
356
  };
340
357
  /** Options for `mergeDoc`. */
341
358
  type MergeDocOptions = {
342
359
  /**
343
- * Require array sequences to share element lineage before merging.
344
- * Defaults to `true`.
360
+ * Strategy for merging unrelated (non-overlapping) non-empty array sequences.
361
+ * Defaults to `"reject"`.
362
+ */
363
+ unrelatedArrays?: UnrelatedArraysStrategy;
364
+ /**
365
+ * @deprecated Use `unrelatedArrays` instead.
366
+ * When `true`, behaves like `unrelatedArrays: "reject"`.
367
+ * When `false`, behaves like `unrelatedArrays: "unsafe-union"`.
368
+ * Ignored when `unrelatedArrays` is also provided.
345
369
  */
346
370
  requireSharedOrigin?: boolean;
347
371
  };
@@ -655,7 +679,7 @@ declare function tryMergeDoc(a: Doc, b: Doc, options?: MergeDocOptions): TryMerg
655
679
  * The merged clock keeps a stable actor identity:
656
680
  * - defaults to the actor from the first argument (`a`)
657
681
  * - can be overridden via `options.actor`
658
- * - optional `options.requireSharedOrigin` controls merge lineage checks
682
+ * - optional `options.unrelatedArrays` controls the merge strategy for non-overlapping sequences
659
683
  *
660
684
  * The merged counter is lifted to the highest counter already observed for
661
685
  * that actor across both input clocks and the merged document dots.
@@ -718,4 +742,4 @@ declare class TraversalDepthError extends Error {
718
742
  constructor(depth: number, maxDepth?: number);
719
743
  }
720
744
  //#endregion
721
- export { Clock as $, cloneClock as A, SerializedClock as At, forkState as B, TryDeserializeDocResult as Bt, diffJsonPatch as C, ObjEntry as Ct, stableJsonValueKey as D, ROOT_KEY as Dt, parseJsonPointer as E, PatchSemantics as Et, PatchError as F, TombstoneCompactionOptions as Ft, validateJsonPatch as G, VersionVector as Gt, tryApplyPatch as H, TryMergeDocResult as Ht, applyPatch as I, TombstoneCompactionStats as It, ApplyPatchAsActorOptions as J, ActorId as K, applyPatchAsActor as L, TryApplyPatchAsActorResult as Lt, nextDotForActor as M, SerializedNode as Mt, observeDot as N, SerializedRgaElem as Nt, stringifyJsonPointer as O, RgaElem as Ot, JsonValueValidationError as P, SerializedState as Pt, ApplyResult as Q, applyPatchInPlace as R, TryApplyPatchInPlaceResult as Rt, compileJsonPatchToIntent as S, Node as St, jsonEquals as T, PatchErrorReason as Tt, tryApplyPatchAsActor as U, TryMergeStateResult as Ut, toJson as V, TryDeserializeStateResult as Vt, tryApplyPatchInPlace as W, ValidatePatchResult as Wt, ApplyPatchInPlaceOptions as X, ApplyPatchAsActorResult as Y, ApplyPatchOptions as Z, serializeDoc as _, JsonValidationMode as _t, intersectVersionVectors as a, DeserializeErrorReason as at, tryDeserializeState as b, MergeDocOptions as bt, versionVectorCovers as c, Doc as ct, mergeState as d, ForkStateOptions as dt, CompactDocTombstonesResult as et, tryMergeDoc as f, IntentOp as ft, deserializeState as g, JsonPrimitive as gt, deserializeDoc as h, JsonPatchToCrdtOptions as ht, compactStateTombstones as i, CreateStateOptions as it, createClock as j, SerializedDoc as jt, ClockValidationError as k, RgaSeq as kt, MergeError as l, Dot as lt, DeserializeError as m, JsonPatchOp as mt, TraversalDepthError as n, CompilePatchOptions as nt, mergeVersionVectors as o, DeserializeFailure as ot, tryMergeState as p, JsonPatch as pt, ApplyError as q, compactDocTombstones as r, CrdtState as rt, observedVersionVector as s, DiffOptions as st, MAX_TRAVERSAL_DEPTH as t, CompactStateTombstonesResult as tt, mergeDoc as u, ElemId as ut, serializeState as v, JsonValue as vt, getAtJson as w, ObjNode as wt, PatchCompileError as x, MergeStateOptions as xt, tryDeserializeDoc as y, LwwReg as yt, createState as z, TryApplyPatchResult as zt };
745
+ export { Clock as $, cloneClock as A, SerializedClock as At, forkState as B, TryDeserializeDocResult as Bt, diffJsonPatch as C, ObjEntry as Ct, stableJsonValueKey as D, ROOT_KEY as Dt, parseJsonPointer as E, PatchSemantics as Et, PatchError as F, TombstoneCompactionOptions as Ft, validateJsonPatch as G, ValidatePatchResult as Gt, tryApplyPatch as H, TryMergeDocResult as Ht, applyPatch as I, TombstoneCompactionStats as It, ApplyPatchAsActorOptions as J, ActorId as K, VersionVector as Kt, applyPatchAsActor as L, TryApplyPatchAsActorResult as Lt, nextDotForActor as M, SerializedNode as Mt, observeDot as N, SerializedRgaElem as Nt, stringifyJsonPointer as O, RgaElem as Ot, JsonValueValidationError as P, SerializedState as Pt, ApplyResult as Q, applyPatchInPlace as R, TryApplyPatchInPlaceResult as Rt, compileJsonPatchToIntent as S, Node as St, jsonEquals as T, PatchErrorReason as Tt, tryApplyPatchAsActor as U, TryMergeStateResult as Ut, toJson as V, TryDeserializeStateResult as Vt, tryApplyPatchInPlace as W, UnrelatedArraysStrategy as Wt, ApplyPatchInPlaceOptions as X, ApplyPatchAsActorResult as Y, ApplyPatchOptions as Z, serializeDoc as _, JsonValidationMode as _t, intersectVersionVectors as a, DeserializeErrorReason as at, tryDeserializeState as b, MergeDocOptions as bt, versionVectorCovers as c, Doc as ct, mergeState as d, ForkStateOptions as dt, CompactDocTombstonesResult as et, tryMergeDoc as f, IntentOp as ft, deserializeState as g, JsonPrimitive as gt, deserializeDoc as h, JsonPatchToCrdtOptions as ht, compactStateTombstones as i, CreateStateOptions as it, createClock as j, SerializedDoc as jt, ClockValidationError as k, RgaSeq as kt, MergeError as l, Dot as lt, DeserializeError as m, JsonPatchOp as mt, TraversalDepthError as n, CompilePatchOptions as nt, mergeVersionVectors as o, DeserializeFailure as ot, tryMergeState as p, JsonPatch as pt, ApplyError as q, compactDocTombstones as r, CrdtState as rt, observedVersionVector as s, DiffOptions as st, MAX_TRAVERSAL_DEPTH as t, CompactStateTombstonesResult as tt, mergeDoc as u, ElemId as ut, serializeState as v, JsonValue as vt, getAtJson as w, ObjNode as wt, PatchCompileError as x, MergeStateOptions as xt, tryDeserializeDoc as y, LwwReg as yt, createState as z, TryApplyPatchResult as zt };
package/dist/index.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { B as forkState, C as diffJsonPatch, Et as PatchSemantics, F as PatchError, Ft as TombstoneCompactionOptions, G as validateJsonPatch, H as tryApplyPatch, I as applyPatch, It as TombstoneCompactionStats, K as ActorId, P as JsonValueValidationError, Pt as SerializedState, R as applyPatchInPlace, Rt as TryApplyPatchInPlaceResult, Tt as PatchErrorReason, Ut as TryMergeStateResult, V as toJson, Vt as TryDeserializeStateResult, W as tryApplyPatchInPlace, Wt as ValidatePatchResult, X as ApplyPatchInPlaceOptions, Z as ApplyPatchOptions, _t as JsonValidationMode, a as intersectVersionVectors, at as DeserializeErrorReason, b as tryDeserializeState, c as versionVectorCovers, d as mergeState, dt as ForkStateOptions, g as deserializeState, gt as JsonPrimitive, i as compactStateTombstones, it as CreateStateOptions, k as ClockValidationError, l as MergeError, m as DeserializeError, mt as JsonPatchOp, n as TraversalDepthError, o as mergeVersionVectors, ot as DeserializeFailure, p as tryMergeState, pt as JsonPatch, q as ApplyError, rt as CrdtState, s as observedVersionVector, st as DiffOptions, t as MAX_TRAVERSAL_DEPTH, tt as CompactStateTombstonesResult, v as serializeState, vt as JsonValue, xt as MergeStateOptions, z as createState, zt as TryApplyPatchResult } from "./depth-CpJSyZE5.mjs";
2
- export { type ActorId, type ApplyError, type ApplyPatchInPlaceOptions, type ApplyPatchOptions, ClockValidationError, type CompactStateTombstonesResult, type CrdtState, type CreateStateOptions, DeserializeError, type DeserializeErrorReason, type DeserializeFailure, type DiffOptions, type ForkStateOptions, type JsonPatch, type JsonPatchOp, type JsonPrimitive, type JsonValidationMode, type JsonValue, JsonValueValidationError, MAX_TRAVERSAL_DEPTH, MergeError, type MergeStateOptions, PatchError, type PatchErrorReason, type PatchSemantics, type SerializedState, type TombstoneCompactionOptions, type TombstoneCompactionStats, TraversalDepthError, type TryApplyPatchInPlaceResult, type TryApplyPatchResult, type TryDeserializeStateResult, type TryMergeStateResult, type ValidatePatchResult, applyPatch, applyPatchInPlace, compactStateTombstones, createState, deserializeState, diffJsonPatch, forkState, intersectVersionVectors, mergeState, mergeVersionVectors, observedVersionVector, serializeState, toJson, tryApplyPatch, tryApplyPatchInPlace, tryDeserializeState, tryMergeState, validateJsonPatch, versionVectorCovers };
1
+ import { B as forkState, C as diffJsonPatch, Et as PatchSemantics, F as PatchError, Ft as TombstoneCompactionOptions, G as validateJsonPatch, Gt as ValidatePatchResult, H as tryApplyPatch, I as applyPatch, It as TombstoneCompactionStats, K as ActorId, P as JsonValueValidationError, Pt as SerializedState, R as applyPatchInPlace, Rt as TryApplyPatchInPlaceResult, Tt as PatchErrorReason, Ut as TryMergeStateResult, V as toJson, Vt as TryDeserializeStateResult, W as tryApplyPatchInPlace, Wt as UnrelatedArraysStrategy, X as ApplyPatchInPlaceOptions, Z as ApplyPatchOptions, _t as JsonValidationMode, a as intersectVersionVectors, at as DeserializeErrorReason, b as tryDeserializeState, c as versionVectorCovers, d as mergeState, dt as ForkStateOptions, g as deserializeState, gt as JsonPrimitive, i as compactStateTombstones, it as CreateStateOptions, k as ClockValidationError, l as MergeError, m as DeserializeError, mt as JsonPatchOp, n as TraversalDepthError, o as mergeVersionVectors, ot as DeserializeFailure, p as tryMergeState, pt as JsonPatch, q as ApplyError, rt as CrdtState, s as observedVersionVector, st as DiffOptions, t as MAX_TRAVERSAL_DEPTH, tt as CompactStateTombstonesResult, v as serializeState, vt as JsonValue, xt as MergeStateOptions, z as createState, zt as TryApplyPatchResult } from "./depth-CM1kCxhm.mjs";
2
+ export { type ActorId, type ApplyError, type ApplyPatchInPlaceOptions, type ApplyPatchOptions, ClockValidationError, type CompactStateTombstonesResult, type CrdtState, type CreateStateOptions, DeserializeError, type DeserializeErrorReason, type DeserializeFailure, type DiffOptions, type ForkStateOptions, type JsonPatch, type JsonPatchOp, type JsonPrimitive, type JsonValidationMode, type JsonValue, JsonValueValidationError, MAX_TRAVERSAL_DEPTH, MergeError, type MergeStateOptions, PatchError, type PatchErrorReason, type PatchSemantics, type SerializedState, type TombstoneCompactionOptions, type TombstoneCompactionStats, TraversalDepthError, type TryApplyPatchInPlaceResult, type TryApplyPatchResult, type TryDeserializeStateResult, type TryMergeStateResult, type UnrelatedArraysStrategy, type ValidatePatchResult, applyPatch, applyPatchInPlace, compactStateTombstones, createState, deserializeState, diffJsonPatch, forkState, intersectVersionVectors, mergeState, mergeVersionVectors, observedVersionVector, serializeState, toJson, tryApplyPatch, tryApplyPatchInPlace, tryDeserializeState, tryMergeState, validateJsonPatch, versionVectorCovers };
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { B as forkState, C as diffJsonPatch, Et as PatchSemantics, F as PatchError, Ft as TombstoneCompactionOptions, G as validateJsonPatch, H as tryApplyPatch, I as applyPatch, It as TombstoneCompactionStats, K as ActorId, P as JsonValueValidationError, Pt as SerializedState, R as applyPatchInPlace, Rt as TryApplyPatchInPlaceResult, Tt as PatchErrorReason, Ut as TryMergeStateResult, V as toJson, Vt as TryDeserializeStateResult, W as tryApplyPatchInPlace, Wt as ValidatePatchResult, X as ApplyPatchInPlaceOptions, Z as ApplyPatchOptions, _t as JsonValidationMode, a as intersectVersionVectors, at as DeserializeErrorReason, b as tryDeserializeState, c as versionVectorCovers, d as mergeState, dt as ForkStateOptions, g as deserializeState, gt as JsonPrimitive, i as compactStateTombstones, it as CreateStateOptions, k as ClockValidationError, l as MergeError, m as DeserializeError, mt as JsonPatchOp, n as TraversalDepthError, o as mergeVersionVectors, ot as DeserializeFailure, p as tryMergeState, pt as JsonPatch, q as ApplyError, rt as CrdtState, s as observedVersionVector, st as DiffOptions, t as MAX_TRAVERSAL_DEPTH, tt as CompactStateTombstonesResult, v as serializeState, vt as JsonValue, xt as MergeStateOptions, z as createState, zt as TryApplyPatchResult } from "./depth-D88VeWb-.js";
2
- export { type ActorId, type ApplyError, type ApplyPatchInPlaceOptions, type ApplyPatchOptions, ClockValidationError, type CompactStateTombstonesResult, type CrdtState, type CreateStateOptions, DeserializeError, type DeserializeErrorReason, type DeserializeFailure, type DiffOptions, type ForkStateOptions, type JsonPatch, type JsonPatchOp, type JsonPrimitive, type JsonValidationMode, type JsonValue, JsonValueValidationError, MAX_TRAVERSAL_DEPTH, MergeError, type MergeStateOptions, PatchError, type PatchErrorReason, type PatchSemantics, type SerializedState, type TombstoneCompactionOptions, type TombstoneCompactionStats, TraversalDepthError, type TryApplyPatchInPlaceResult, type TryApplyPatchResult, type TryDeserializeStateResult, type TryMergeStateResult, type ValidatePatchResult, applyPatch, applyPatchInPlace, compactStateTombstones, createState, deserializeState, diffJsonPatch, forkState, intersectVersionVectors, mergeState, mergeVersionVectors, observedVersionVector, serializeState, toJson, tryApplyPatch, tryApplyPatchInPlace, tryDeserializeState, tryMergeState, validateJsonPatch, versionVectorCovers };
1
+ import { B as forkState, C as diffJsonPatch, Et as PatchSemantics, F as PatchError, Ft as TombstoneCompactionOptions, G as validateJsonPatch, Gt as ValidatePatchResult, H as tryApplyPatch, I as applyPatch, It as TombstoneCompactionStats, K as ActorId, P as JsonValueValidationError, Pt as SerializedState, R as applyPatchInPlace, Rt as TryApplyPatchInPlaceResult, Tt as PatchErrorReason, Ut as TryMergeStateResult, V as toJson, Vt as TryDeserializeStateResult, W as tryApplyPatchInPlace, Wt as UnrelatedArraysStrategy, X as ApplyPatchInPlaceOptions, Z as ApplyPatchOptions, _t as JsonValidationMode, a as intersectVersionVectors, at as DeserializeErrorReason, b as tryDeserializeState, c as versionVectorCovers, d as mergeState, dt as ForkStateOptions, g as deserializeState, gt as JsonPrimitive, i as compactStateTombstones, it as CreateStateOptions, k as ClockValidationError, l as MergeError, m as DeserializeError, mt as JsonPatchOp, n as TraversalDepthError, o as mergeVersionVectors, ot as DeserializeFailure, p as tryMergeState, pt as JsonPatch, q as ApplyError, rt as CrdtState, s as observedVersionVector, st as DiffOptions, t as MAX_TRAVERSAL_DEPTH, tt as CompactStateTombstonesResult, v as serializeState, vt as JsonValue, xt as MergeStateOptions, z as createState, zt as TryApplyPatchResult } from "./depth-NbZ6Giq9.js";
2
+ export { type ActorId, type ApplyError, type ApplyPatchInPlaceOptions, type ApplyPatchOptions, ClockValidationError, type CompactStateTombstonesResult, type CrdtState, type CreateStateOptions, DeserializeError, type DeserializeErrorReason, type DeserializeFailure, type DiffOptions, type ForkStateOptions, type JsonPatch, type JsonPatchOp, type JsonPrimitive, type JsonValidationMode, type JsonValue, JsonValueValidationError, MAX_TRAVERSAL_DEPTH, MergeError, type MergeStateOptions, PatchError, type PatchErrorReason, type PatchSemantics, type SerializedState, type TombstoneCompactionOptions, type TombstoneCompactionStats, TraversalDepthError, type TryApplyPatchInPlaceResult, type TryApplyPatchResult, type TryDeserializeStateResult, type TryMergeStateResult, type UnrelatedArraysStrategy, type ValidatePatchResult, applyPatch, applyPatchInPlace, compactStateTombstones, createState, deserializeState, diffJsonPatch, forkState, intersectVersionVectors, mergeState, mergeVersionVectors, observedVersionVector, serializeState, toJson, tryApplyPatch, tryApplyPatchInPlace, tryDeserializeState, tryMergeState, validateJsonPatch, versionVectorCovers };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_compact = require('./compact-CXfvMNCT.js');
2
+ const require_compact = require('./compact-CDvajUfn.js');
3
3
 
4
4
  exports.ClockValidationError = require_compact.ClockValidationError;
5
5
  exports.DeserializeError = require_compact.DeserializeError;
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { Ct as TraversalDepthError, G as JsonValueValidationError, R as diffJsonPatch, S as tryApplyPatch, St as MAX_TRAVERSAL_DEPTH, T as validateJsonPatch, a as mergeState, b as forkState, bt as observedVersionVector, c as DeserializeError, f as serializeState, g as applyPatch, h as PatchError, m as tryDeserializeState, n as compactStateTombstones, pt as ClockValidationError, r as MergeError, s as tryMergeState, u as deserializeState, v as applyPatchInPlace, vt as intersectVersionVectors, w as tryApplyPatchInPlace, x as toJson, xt as versionVectorCovers, y as createState, yt as mergeVersionVectors } from "./compact-BcwxBNx_.mjs";
1
+ import { Ct as TraversalDepthError, G as JsonValueValidationError, R as diffJsonPatch, S as tryApplyPatch, St as MAX_TRAVERSAL_DEPTH, T as validateJsonPatch, a as mergeState, b as forkState, bt as observedVersionVector, c as DeserializeError, f as serializeState, g as applyPatch, h as PatchError, m as tryDeserializeState, n as compactStateTombstones, pt as ClockValidationError, r as MergeError, s as tryMergeState, u as deserializeState, v as applyPatchInPlace, vt as intersectVersionVectors, w as tryApplyPatchInPlace, x as toJson, xt as versionVectorCovers, y as createState, yt as mergeVersionVectors } from "./compact-Dj0BYeY5.mjs";
2
2
 
3
3
  export { ClockValidationError, DeserializeError, JsonValueValidationError, MAX_TRAVERSAL_DEPTH, MergeError, PatchError, TraversalDepthError, applyPatch, applyPatchInPlace, compactStateTombstones, createState, deserializeState, diffJsonPatch, forkState, intersectVersionVectors, mergeState, mergeVersionVectors, observedVersionVector, serializeState, toJson, tryApplyPatch, tryApplyPatchInPlace, tryDeserializeState, tryMergeState, validateJsonPatch, versionVectorCovers };
@@ -1,4 +1,4 @@
1
- import { $ as Clock, A as cloneClock, At as SerializedClock, B as forkState, Bt as TryDeserializeDocResult, C as diffJsonPatch, Ct as ObjEntry, D as stableJsonValueKey, Dt as ROOT_KEY, E as parseJsonPointer, Et as PatchSemantics, F as PatchError, Ft as TombstoneCompactionOptions, G as validateJsonPatch, Gt as VersionVector, H as tryApplyPatch, Ht as TryMergeDocResult, I as applyPatch, It as TombstoneCompactionStats, J as ApplyPatchAsActorOptions, K as ActorId, L as applyPatchAsActor, Lt as TryApplyPatchAsActorResult, M as nextDotForActor, Mt as SerializedNode, N as observeDot, Nt as SerializedRgaElem, O as stringifyJsonPointer, Ot as RgaElem, P as JsonValueValidationError, Pt as SerializedState, Q as ApplyResult, R as applyPatchInPlace, Rt as TryApplyPatchInPlaceResult, S as compileJsonPatchToIntent, St as Node, T as jsonEquals, Tt as PatchErrorReason, U as tryApplyPatchAsActor, Ut as TryMergeStateResult, V as toJson, Vt as TryDeserializeStateResult, W as tryApplyPatchInPlace, Wt as ValidatePatchResult, X as ApplyPatchInPlaceOptions, Y as ApplyPatchAsActorResult, Z as ApplyPatchOptions, _ as serializeDoc, _t as JsonValidationMode, a as intersectVersionVectors, at as DeserializeErrorReason, b as tryDeserializeState, bt as MergeDocOptions, c as versionVectorCovers, ct as Doc, d as mergeState, dt as ForkStateOptions, et as CompactDocTombstonesResult, f as tryMergeDoc, ft as IntentOp, g as deserializeState, gt as JsonPrimitive, h as deserializeDoc, ht as JsonPatchToCrdtOptions, i as compactStateTombstones, it as CreateStateOptions, j as createClock, jt as SerializedDoc, k as ClockValidationError, kt as RgaSeq, l as MergeError, lt as Dot, m as DeserializeError, mt as JsonPatchOp, n as TraversalDepthError, nt as CompilePatchOptions, o as mergeVersionVectors, ot as DeserializeFailure, p as tryMergeState, pt as JsonPatch, q as ApplyError, r as compactDocTombstones, rt as CrdtState, s as observedVersionVector, st as DiffOptions, t as MAX_TRAVERSAL_DEPTH, tt as CompactStateTombstonesResult, u as mergeDoc, ut as ElemId, v as serializeState, vt as JsonValue, w as getAtJson, wt as ObjNode, x as PatchCompileError, xt as MergeStateOptions, y as tryDeserializeDoc, yt as LwwReg, z as createState, zt as TryApplyPatchResult } from "./depth-CpJSyZE5.mjs";
1
+ import { $ as Clock, A as cloneClock, At as SerializedClock, B as forkState, Bt as TryDeserializeDocResult, C as diffJsonPatch, Ct as ObjEntry, D as stableJsonValueKey, Dt as ROOT_KEY, E as parseJsonPointer, Et as PatchSemantics, F as PatchError, Ft as TombstoneCompactionOptions, G as validateJsonPatch, Gt as ValidatePatchResult, H as tryApplyPatch, Ht as TryMergeDocResult, I as applyPatch, It as TombstoneCompactionStats, J as ApplyPatchAsActorOptions, K as ActorId, Kt as VersionVector, L as applyPatchAsActor, Lt as TryApplyPatchAsActorResult, M as nextDotForActor, Mt as SerializedNode, N as observeDot, Nt as SerializedRgaElem, O as stringifyJsonPointer, Ot as RgaElem, P as JsonValueValidationError, Pt as SerializedState, Q as ApplyResult, R as applyPatchInPlace, Rt as TryApplyPatchInPlaceResult, S as compileJsonPatchToIntent, St as Node, T as jsonEquals, Tt as PatchErrorReason, U as tryApplyPatchAsActor, Ut as TryMergeStateResult, V as toJson, Vt as TryDeserializeStateResult, W as tryApplyPatchInPlace, Wt as UnrelatedArraysStrategy, X as ApplyPatchInPlaceOptions, Y as ApplyPatchAsActorResult, Z as ApplyPatchOptions, _ as serializeDoc, _t as JsonValidationMode, a as intersectVersionVectors, at as DeserializeErrorReason, b as tryDeserializeState, bt as MergeDocOptions, c as versionVectorCovers, ct as Doc, d as mergeState, dt as ForkStateOptions, et as CompactDocTombstonesResult, f as tryMergeDoc, ft as IntentOp, g as deserializeState, gt as JsonPrimitive, h as deserializeDoc, ht as JsonPatchToCrdtOptions, i as compactStateTombstones, it as CreateStateOptions, j as createClock, jt as SerializedDoc, k as ClockValidationError, kt as RgaSeq, l as MergeError, lt as Dot, m as DeserializeError, mt as JsonPatchOp, n as TraversalDepthError, nt as CompilePatchOptions, o as mergeVersionVectors, ot as DeserializeFailure, p as tryMergeState, pt as JsonPatch, q as ApplyError, r as compactDocTombstones, rt as CrdtState, s as observedVersionVector, st as DiffOptions, t as MAX_TRAVERSAL_DEPTH, tt as CompactStateTombstonesResult, u as mergeDoc, ut as ElemId, v as serializeState, vt as JsonValue, w as getAtJson, wt as ObjNode, x as PatchCompileError, xt as MergeStateOptions, y as tryDeserializeDoc, yt as LwwReg, z as createState, zt as TryApplyPatchResult } from "./depth-CM1kCxhm.mjs";
2
2
 
3
3
  //#region src/doc.d.ts
4
4
  /**
@@ -9,8 +9,15 @@ import { $ as Clock, A as cloneClock, At as SerializedClock, B as forkState, Bt
9
9
  */
10
10
  declare function docFromJson(value: JsonValue, nextDot: () => Dot): Doc;
11
11
  /**
12
- * Legacy: create a doc using a single dot with counter offsets for array children.
13
- * Prefer `docFromJson(value, nextDot)` to ensure unique dots per node.
12
+ * Legacy helper for tests and fixtures that seeds an entire document from one dot.
13
+ *
14
+ * It reuses that dot for object entries and synthesizes array child counters from the
15
+ * same seed, which can produce low-quality causal metadata and unrealistic sequence
16
+ * identities in production CRDT state.
17
+ *
18
+ * Prefer `docFromJson(value, nextDot)` so every node receives a fresh unique dot.
19
+ *
20
+ * @deprecated Use `docFromJson(value, nextDot)` for production documents.
14
21
  */
15
22
  declare function docFromJsonWithDot(value: JsonValue, dot: Dot): Doc;
16
23
  /** Deep-clone a CRDT document. The clone is fully independent of the original. */
@@ -128,4 +135,4 @@ declare function rgaCompactTombstones(seq: RgaSeq, isStable: (dot: Dot) => boole
128
135
  declare function rgaIdAtIndex(seq: RgaSeq, index: number): ElemId | undefined;
129
136
  declare function rgaPrevForInsertAtIndex(seq: RgaSeq, index: number): ElemId;
130
137
  //#endregion
131
- export { ActorId, ApplyError, type ApplyPatchAsActorOptions, type ApplyPatchAsActorResult, ApplyPatchInPlaceOptions, ApplyPatchOptions, type ApplyResult, type Clock, ClockValidationError, type CompactDocTombstonesResult, type CompactStateTombstonesResult, type CompilePatchOptions, CrdtState, CreateStateOptions, DeserializeError, DeserializeErrorReason, type DeserializeFailure, DiffOptions, type Doc, type Dot, type ElemId, ForkStateOptions, HEAD, type IntentOp, JsonPatch, JsonPatchOp, type JsonPatchToCrdtOptions, JsonPrimitive, JsonValidationMode, JsonValue, JsonValueValidationError, type LwwReg, MAX_TRAVERSAL_DEPTH, type MergeDocOptions, MergeError, MergeStateOptions, type Node, type ObjEntry, type ObjNode, PatchCompileError, PatchError, PatchErrorReason, PatchSemantics, ROOT_KEY, type RgaElem, type RgaSeq, type RgaValidationIssue, type RgaValidationResult, type SerializedClock, type SerializedDoc, type SerializedNode, type SerializedRgaElem, SerializedState, type TombstoneCompactionOptions, type TombstoneCompactionStats, TraversalDepthError, type TryApplyPatchAsActorResult, TryApplyPatchInPlaceResult, TryApplyPatchResult, type TryDeserializeDocResult, TryDeserializeStateResult, type TryMergeDocResult, TryMergeStateResult, ValidatePatchResult, type VersionVector, applyIntentsToCrdt, applyPatch, applyPatchAsActor, applyPatchInPlace, cloneClock, cloneDoc, compactDocTombstones, compactStateTombstones, compareDot, compileJsonPatchToIntent, crdtNodesToJsonPatch, crdtToFullReplace, crdtToJsonPatch, createClock, createState, deserializeDoc, deserializeState, diffJsonPatch, docFromJson, docFromJsonWithDot, dotToElemId, forkState, getAtJson, intersectVersionVectors, jsonEquals, jsonPatchToCrdt, jsonPatchToCrdtSafe, lwwSet, materialize, mergeDoc, mergeState, mergeVersionVectors, newObj, newReg, newSeq, nextDotForActor, objCompactTombstones, objRemove, objSet, observeDot, observedVersionVector, parseJsonPointer, rgaCompactTombstones, rgaDelete, rgaIdAtIndex, rgaInsertAfter, rgaInsertAfterChecked, rgaLinearizeIds, rgaPrevForInsertAtIndex, serializeDoc, serializeState, stableJsonValueKey, stringifyJsonPointer, toJson, tryApplyPatch, tryApplyPatchAsActor, tryApplyPatchInPlace, tryDeserializeDoc, tryDeserializeState, tryJsonPatchToCrdt, tryMergeDoc, tryMergeState, validateJsonPatch, validateRgaSeq, versionVectorCovers, vvHasDot, vvMerge };
138
+ export { ActorId, ApplyError, type ApplyPatchAsActorOptions, type ApplyPatchAsActorResult, ApplyPatchInPlaceOptions, ApplyPatchOptions, type ApplyResult, type Clock, ClockValidationError, type CompactDocTombstonesResult, type CompactStateTombstonesResult, type CompilePatchOptions, CrdtState, CreateStateOptions, DeserializeError, DeserializeErrorReason, type DeserializeFailure, DiffOptions, type Doc, type Dot, type ElemId, ForkStateOptions, HEAD, type IntentOp, JsonPatch, JsonPatchOp, type JsonPatchToCrdtOptions, JsonPrimitive, JsonValidationMode, JsonValue, JsonValueValidationError, type LwwReg, MAX_TRAVERSAL_DEPTH, type MergeDocOptions, MergeError, MergeStateOptions, type Node, type ObjEntry, type ObjNode, PatchCompileError, PatchError, PatchErrorReason, PatchSemantics, ROOT_KEY, type RgaElem, type RgaSeq, type RgaValidationIssue, type RgaValidationResult, type SerializedClock, type SerializedDoc, type SerializedNode, type SerializedRgaElem, SerializedState, type TombstoneCompactionOptions, type TombstoneCompactionStats, TraversalDepthError, type TryApplyPatchAsActorResult, TryApplyPatchInPlaceResult, TryApplyPatchResult, type TryDeserializeDocResult, TryDeserializeStateResult, type TryMergeDocResult, TryMergeStateResult, type UnrelatedArraysStrategy, ValidatePatchResult, type VersionVector, applyIntentsToCrdt, applyPatch, applyPatchAsActor, applyPatchInPlace, cloneClock, cloneDoc, compactDocTombstones, compactStateTombstones, compareDot, compileJsonPatchToIntent, crdtNodesToJsonPatch, crdtToFullReplace, crdtToJsonPatch, createClock, createState, deserializeDoc, deserializeState, diffJsonPatch, docFromJson, docFromJsonWithDot, dotToElemId, forkState, getAtJson, intersectVersionVectors, jsonEquals, jsonPatchToCrdt, jsonPatchToCrdtSafe, lwwSet, materialize, mergeDoc, mergeState, mergeVersionVectors, newObj, newReg, newSeq, nextDotForActor, objCompactTombstones, objRemove, objSet, observeDot, observedVersionVector, parseJsonPointer, rgaCompactTombstones, rgaDelete, rgaIdAtIndex, rgaInsertAfter, rgaInsertAfterChecked, rgaLinearizeIds, rgaPrevForInsertAtIndex, serializeDoc, serializeState, stableJsonValueKey, stringifyJsonPointer, toJson, tryApplyPatch, tryApplyPatchAsActor, tryApplyPatchInPlace, tryDeserializeDoc, tryDeserializeState, tryJsonPatchToCrdt, tryMergeDoc, tryMergeState, validateJsonPatch, validateRgaSeq, versionVectorCovers, vvHasDot, vvMerge };
@@ -1,4 +1,4 @@
1
- import { $ as Clock, A as cloneClock, At as SerializedClock, B as forkState, Bt as TryDeserializeDocResult, C as diffJsonPatch, Ct as ObjEntry, D as stableJsonValueKey, Dt as ROOT_KEY, E as parseJsonPointer, Et as PatchSemantics, F as PatchError, Ft as TombstoneCompactionOptions, G as validateJsonPatch, Gt as VersionVector, H as tryApplyPatch, Ht as TryMergeDocResult, I as applyPatch, It as TombstoneCompactionStats, J as ApplyPatchAsActorOptions, K as ActorId, L as applyPatchAsActor, Lt as TryApplyPatchAsActorResult, M as nextDotForActor, Mt as SerializedNode, N as observeDot, Nt as SerializedRgaElem, O as stringifyJsonPointer, Ot as RgaElem, P as JsonValueValidationError, Pt as SerializedState, Q as ApplyResult, R as applyPatchInPlace, Rt as TryApplyPatchInPlaceResult, S as compileJsonPatchToIntent, St as Node, T as jsonEquals, Tt as PatchErrorReason, U as tryApplyPatchAsActor, Ut as TryMergeStateResult, V as toJson, Vt as TryDeserializeStateResult, W as tryApplyPatchInPlace, Wt as ValidatePatchResult, X as ApplyPatchInPlaceOptions, Y as ApplyPatchAsActorResult, Z as ApplyPatchOptions, _ as serializeDoc, _t as JsonValidationMode, a as intersectVersionVectors, at as DeserializeErrorReason, b as tryDeserializeState, bt as MergeDocOptions, c as versionVectorCovers, ct as Doc, d as mergeState, dt as ForkStateOptions, et as CompactDocTombstonesResult, f as tryMergeDoc, ft as IntentOp, g as deserializeState, gt as JsonPrimitive, h as deserializeDoc, ht as JsonPatchToCrdtOptions, i as compactStateTombstones, it as CreateStateOptions, j as createClock, jt as SerializedDoc, k as ClockValidationError, kt as RgaSeq, l as MergeError, lt as Dot, m as DeserializeError, mt as JsonPatchOp, n as TraversalDepthError, nt as CompilePatchOptions, o as mergeVersionVectors, ot as DeserializeFailure, p as tryMergeState, pt as JsonPatch, q as ApplyError, r as compactDocTombstones, rt as CrdtState, s as observedVersionVector, st as DiffOptions, t as MAX_TRAVERSAL_DEPTH, tt as CompactStateTombstonesResult, u as mergeDoc, ut as ElemId, v as serializeState, vt as JsonValue, w as getAtJson, wt as ObjNode, x as PatchCompileError, xt as MergeStateOptions, y as tryDeserializeDoc, yt as LwwReg, z as createState, zt as TryApplyPatchResult } from "./depth-D88VeWb-.js";
1
+ import { $ as Clock, A as cloneClock, At as SerializedClock, B as forkState, Bt as TryDeserializeDocResult, C as diffJsonPatch, Ct as ObjEntry, D as stableJsonValueKey, Dt as ROOT_KEY, E as parseJsonPointer, Et as PatchSemantics, F as PatchError, Ft as TombstoneCompactionOptions, G as validateJsonPatch, Gt as ValidatePatchResult, H as tryApplyPatch, Ht as TryMergeDocResult, I as applyPatch, It as TombstoneCompactionStats, J as ApplyPatchAsActorOptions, K as ActorId, Kt as VersionVector, L as applyPatchAsActor, Lt as TryApplyPatchAsActorResult, M as nextDotForActor, Mt as SerializedNode, N as observeDot, Nt as SerializedRgaElem, O as stringifyJsonPointer, Ot as RgaElem, P as JsonValueValidationError, Pt as SerializedState, Q as ApplyResult, R as applyPatchInPlace, Rt as TryApplyPatchInPlaceResult, S as compileJsonPatchToIntent, St as Node, T as jsonEquals, Tt as PatchErrorReason, U as tryApplyPatchAsActor, Ut as TryMergeStateResult, V as toJson, Vt as TryDeserializeStateResult, W as tryApplyPatchInPlace, Wt as UnrelatedArraysStrategy, X as ApplyPatchInPlaceOptions, Y as ApplyPatchAsActorResult, Z as ApplyPatchOptions, _ as serializeDoc, _t as JsonValidationMode, a as intersectVersionVectors, at as DeserializeErrorReason, b as tryDeserializeState, bt as MergeDocOptions, c as versionVectorCovers, ct as Doc, d as mergeState, dt as ForkStateOptions, et as CompactDocTombstonesResult, f as tryMergeDoc, ft as IntentOp, g as deserializeState, gt as JsonPrimitive, h as deserializeDoc, ht as JsonPatchToCrdtOptions, i as compactStateTombstones, it as CreateStateOptions, j as createClock, jt as SerializedDoc, k as ClockValidationError, kt as RgaSeq, l as MergeError, lt as Dot, m as DeserializeError, mt as JsonPatchOp, n as TraversalDepthError, nt as CompilePatchOptions, o as mergeVersionVectors, ot as DeserializeFailure, p as tryMergeState, pt as JsonPatch, q as ApplyError, r as compactDocTombstones, rt as CrdtState, s as observedVersionVector, st as DiffOptions, t as MAX_TRAVERSAL_DEPTH, tt as CompactStateTombstonesResult, u as mergeDoc, ut as ElemId, v as serializeState, vt as JsonValue, w as getAtJson, wt as ObjNode, x as PatchCompileError, xt as MergeStateOptions, y as tryDeserializeDoc, yt as LwwReg, z as createState, zt as TryApplyPatchResult } from "./depth-NbZ6Giq9.js";
2
2
 
3
3
  //#region src/doc.d.ts
4
4
  /**
@@ -9,8 +9,15 @@ import { $ as Clock, A as cloneClock, At as SerializedClock, B as forkState, Bt
9
9
  */
10
10
  declare function docFromJson(value: JsonValue, nextDot: () => Dot): Doc;
11
11
  /**
12
- * Legacy: create a doc using a single dot with counter offsets for array children.
13
- * Prefer `docFromJson(value, nextDot)` to ensure unique dots per node.
12
+ * Legacy helper for tests and fixtures that seeds an entire document from one dot.
13
+ *
14
+ * It reuses that dot for object entries and synthesizes array child counters from the
15
+ * same seed, which can produce low-quality causal metadata and unrealistic sequence
16
+ * identities in production CRDT state.
17
+ *
18
+ * Prefer `docFromJson(value, nextDot)` so every node receives a fresh unique dot.
19
+ *
20
+ * @deprecated Use `docFromJson(value, nextDot)` for production documents.
14
21
  */
15
22
  declare function docFromJsonWithDot(value: JsonValue, dot: Dot): Doc;
16
23
  /** Deep-clone a CRDT document. The clone is fully independent of the original. */
@@ -128,4 +135,4 @@ declare function rgaCompactTombstones(seq: RgaSeq, isStable: (dot: Dot) => boole
128
135
  declare function rgaIdAtIndex(seq: RgaSeq, index: number): ElemId | undefined;
129
136
  declare function rgaPrevForInsertAtIndex(seq: RgaSeq, index: number): ElemId;
130
137
  //#endregion
131
- export { ActorId, ApplyError, type ApplyPatchAsActorOptions, type ApplyPatchAsActorResult, ApplyPatchInPlaceOptions, ApplyPatchOptions, type ApplyResult, type Clock, ClockValidationError, type CompactDocTombstonesResult, type CompactStateTombstonesResult, type CompilePatchOptions, CrdtState, CreateStateOptions, DeserializeError, DeserializeErrorReason, type DeserializeFailure, DiffOptions, type Doc, type Dot, type ElemId, ForkStateOptions, HEAD, type IntentOp, JsonPatch, JsonPatchOp, type JsonPatchToCrdtOptions, JsonPrimitive, JsonValidationMode, JsonValue, JsonValueValidationError, type LwwReg, MAX_TRAVERSAL_DEPTH, type MergeDocOptions, MergeError, MergeStateOptions, type Node, type ObjEntry, type ObjNode, PatchCompileError, PatchError, PatchErrorReason, PatchSemantics, ROOT_KEY, type RgaElem, type RgaSeq, type RgaValidationIssue, type RgaValidationResult, type SerializedClock, type SerializedDoc, type SerializedNode, type SerializedRgaElem, SerializedState, type TombstoneCompactionOptions, type TombstoneCompactionStats, TraversalDepthError, type TryApplyPatchAsActorResult, TryApplyPatchInPlaceResult, TryApplyPatchResult, type TryDeserializeDocResult, TryDeserializeStateResult, type TryMergeDocResult, TryMergeStateResult, ValidatePatchResult, type VersionVector, applyIntentsToCrdt, applyPatch, applyPatchAsActor, applyPatchInPlace, cloneClock, cloneDoc, compactDocTombstones, compactStateTombstones, compareDot, compileJsonPatchToIntent, crdtNodesToJsonPatch, crdtToFullReplace, crdtToJsonPatch, createClock, createState, deserializeDoc, deserializeState, diffJsonPatch, docFromJson, docFromJsonWithDot, dotToElemId, forkState, getAtJson, intersectVersionVectors, jsonEquals, jsonPatchToCrdt, jsonPatchToCrdtSafe, lwwSet, materialize, mergeDoc, mergeState, mergeVersionVectors, newObj, newReg, newSeq, nextDotForActor, objCompactTombstones, objRemove, objSet, observeDot, observedVersionVector, parseJsonPointer, rgaCompactTombstones, rgaDelete, rgaIdAtIndex, rgaInsertAfter, rgaInsertAfterChecked, rgaLinearizeIds, rgaPrevForInsertAtIndex, serializeDoc, serializeState, stableJsonValueKey, stringifyJsonPointer, toJson, tryApplyPatch, tryApplyPatchAsActor, tryApplyPatchInPlace, tryDeserializeDoc, tryDeserializeState, tryJsonPatchToCrdt, tryMergeDoc, tryMergeState, validateJsonPatch, validateRgaSeq, versionVectorCovers, vvHasDot, vvMerge };
138
+ export { ActorId, ApplyError, type ApplyPatchAsActorOptions, type ApplyPatchAsActorResult, ApplyPatchInPlaceOptions, ApplyPatchOptions, type ApplyResult, type Clock, ClockValidationError, type CompactDocTombstonesResult, type CompactStateTombstonesResult, type CompilePatchOptions, CrdtState, CreateStateOptions, DeserializeError, DeserializeErrorReason, type DeserializeFailure, DiffOptions, type Doc, type Dot, type ElemId, ForkStateOptions, HEAD, type IntentOp, JsonPatch, JsonPatchOp, type JsonPatchToCrdtOptions, JsonPrimitive, JsonValidationMode, JsonValue, JsonValueValidationError, type LwwReg, MAX_TRAVERSAL_DEPTH, type MergeDocOptions, MergeError, MergeStateOptions, type Node, type ObjEntry, type ObjNode, PatchCompileError, PatchError, PatchErrorReason, PatchSemantics, ROOT_KEY, type RgaElem, type RgaSeq, type RgaValidationIssue, type RgaValidationResult, type SerializedClock, type SerializedDoc, type SerializedNode, type SerializedRgaElem, SerializedState, type TombstoneCompactionOptions, type TombstoneCompactionStats, TraversalDepthError, type TryApplyPatchAsActorResult, TryApplyPatchInPlaceResult, TryApplyPatchResult, type TryDeserializeDocResult, TryDeserializeStateResult, type TryMergeDocResult, TryMergeStateResult, type UnrelatedArraysStrategy, ValidatePatchResult, type VersionVector, applyIntentsToCrdt, applyPatch, applyPatchAsActor, applyPatchInPlace, cloneClock, cloneDoc, compactDocTombstones, compactStateTombstones, compareDot, compileJsonPatchToIntent, crdtNodesToJsonPatch, crdtToFullReplace, crdtToJsonPatch, createClock, createState, deserializeDoc, deserializeState, diffJsonPatch, docFromJson, docFromJsonWithDot, dotToElemId, forkState, getAtJson, intersectVersionVectors, jsonEquals, jsonPatchToCrdt, jsonPatchToCrdtSafe, lwwSet, materialize, mergeDoc, mergeState, mergeVersionVectors, newObj, newReg, newSeq, nextDotForActor, objCompactTombstones, objRemove, objSet, observeDot, observedVersionVector, parseJsonPointer, rgaCompactTombstones, rgaDelete, rgaIdAtIndex, rgaInsertAfter, rgaInsertAfterChecked, rgaLinearizeIds, rgaPrevForInsertAtIndex, serializeDoc, serializeState, stableJsonValueKey, stringifyJsonPointer, toJson, tryApplyPatch, tryApplyPatchAsActor, tryApplyPatchInPlace, tryDeserializeDoc, tryDeserializeState, tryJsonPatchToCrdt, tryMergeDoc, tryMergeState, validateJsonPatch, validateRgaSeq, versionVectorCovers, vvHasDot, vvMerge };
package/dist/internals.js CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_compact = require('./compact-CXfvMNCT.js');
2
+ const require_compact = require('./compact-CDvajUfn.js');
3
3
 
4
4
  exports.ClockValidationError = require_compact.ClockValidationError;
5
5
  exports.DeserializeError = require_compact.DeserializeError;
@@ -1,3 +1,3 @@
1
- import { $ as materialize, A as crdtToJsonPatch, B as jsonEquals, C as tryApplyPatchAsActor, Ct as TraversalDepthError, D as cloneDoc, E as applyIntentsToCrdt, F as tryJsonPatchToCrdt, G as JsonValueValidationError, H as stableJsonValueKey, I as PatchCompileError, J as newReg, K as lwwSet, L as compileJsonPatchToIntent, M as docFromJsonWithDot, N as jsonPatchToCrdt, O as crdtNodesToJsonPatch, P as jsonPatchToCrdtSafe, Q as objSet, R as diffJsonPatch, S as tryApplyPatch, St as MAX_TRAVERSAL_DEPTH, T as validateJsonPatch, U as stringifyJsonPointer, V as parseJsonPointer, W as ROOT_KEY, X as objCompactTombstones, Y as newSeq, Z as objRemove, _ as applyPatchAsActor, _t as observeDot, a as mergeState, at as rgaInsertAfterChecked, b as forkState, bt as observedVersionVector, c as DeserializeError, ct as validateRgaSeq, d as serializeDoc, dt as vvHasDot, et as HEAD, f as serializeState, ft as vvMerge, g as applyPatch, gt as nextDotForActor, h as PatchError, ht as createClock, i as mergeDoc, it as rgaInsertAfter, j as docFromJson, k as crdtToFullReplace, l as deserializeDoc, lt as compareDot, m as tryDeserializeState, mt as cloneClock, n as compactStateTombstones, nt as rgaDelete, o as tryMergeDoc, ot as rgaLinearizeIds, p as tryDeserializeDoc, pt as ClockValidationError, q as newObj, r as MergeError, rt as rgaIdAtIndex, s as tryMergeState, st as rgaPrevForInsertAtIndex, t as compactDocTombstones, tt as rgaCompactTombstones, u as deserializeState, ut as dotToElemId, v as applyPatchInPlace, vt as intersectVersionVectors, w as tryApplyPatchInPlace, x as toJson, xt as versionVectorCovers, y as createState, yt as mergeVersionVectors, z as getAtJson } from "./compact-BcwxBNx_.mjs";
1
+ import { $ as materialize, A as crdtToJsonPatch, B as jsonEquals, C as tryApplyPatchAsActor, Ct as TraversalDepthError, D as cloneDoc, E as applyIntentsToCrdt, F as tryJsonPatchToCrdt, G as JsonValueValidationError, H as stableJsonValueKey, I as PatchCompileError, J as newReg, K as lwwSet, L as compileJsonPatchToIntent, M as docFromJsonWithDot, N as jsonPatchToCrdt, O as crdtNodesToJsonPatch, P as jsonPatchToCrdtSafe, Q as objSet, R as diffJsonPatch, S as tryApplyPatch, St as MAX_TRAVERSAL_DEPTH, T as validateJsonPatch, U as stringifyJsonPointer, V as parseJsonPointer, W as ROOT_KEY, X as objCompactTombstones, Y as newSeq, Z as objRemove, _ as applyPatchAsActor, _t as observeDot, a as mergeState, at as rgaInsertAfterChecked, b as forkState, bt as observedVersionVector, c as DeserializeError, ct as validateRgaSeq, d as serializeDoc, dt as vvHasDot, et as HEAD, f as serializeState, ft as vvMerge, g as applyPatch, gt as nextDotForActor, h as PatchError, ht as createClock, i as mergeDoc, it as rgaInsertAfter, j as docFromJson, k as crdtToFullReplace, l as deserializeDoc, lt as compareDot, m as tryDeserializeState, mt as cloneClock, n as compactStateTombstones, nt as rgaDelete, o as tryMergeDoc, ot as rgaLinearizeIds, p as tryDeserializeDoc, pt as ClockValidationError, q as newObj, r as MergeError, rt as rgaIdAtIndex, s as tryMergeState, st as rgaPrevForInsertAtIndex, t as compactDocTombstones, tt as rgaCompactTombstones, u as deserializeState, ut as dotToElemId, v as applyPatchInPlace, vt as intersectVersionVectors, w as tryApplyPatchInPlace, x as toJson, xt as versionVectorCovers, y as createState, yt as mergeVersionVectors, z as getAtJson } from "./compact-Dj0BYeY5.mjs";
2
2
 
3
3
  export { ClockValidationError, DeserializeError, HEAD, JsonValueValidationError, MAX_TRAVERSAL_DEPTH, MergeError, PatchCompileError, PatchError, ROOT_KEY, TraversalDepthError, applyIntentsToCrdt, applyPatch, applyPatchAsActor, applyPatchInPlace, cloneClock, cloneDoc, compactDocTombstones, compactStateTombstones, compareDot, compileJsonPatchToIntent, crdtNodesToJsonPatch, crdtToFullReplace, crdtToJsonPatch, createClock, createState, deserializeDoc, deserializeState, diffJsonPatch, docFromJson, docFromJsonWithDot, dotToElemId, forkState, getAtJson, intersectVersionVectors, jsonEquals, jsonPatchToCrdt, jsonPatchToCrdtSafe, lwwSet, materialize, mergeDoc, mergeState, mergeVersionVectors, newObj, newReg, newSeq, nextDotForActor, objCompactTombstones, objRemove, objSet, observeDot, observedVersionVector, parseJsonPointer, rgaCompactTombstones, rgaDelete, rgaIdAtIndex, rgaInsertAfter, rgaInsertAfterChecked, rgaLinearizeIds, rgaPrevForInsertAtIndex, serializeDoc, serializeState, stableJsonValueKey, stringifyJsonPointer, toJson, tryApplyPatch, tryApplyPatchAsActor, tryApplyPatchInPlace, tryDeserializeDoc, tryDeserializeState, tryJsonPatchToCrdt, tryMergeDoc, tryMergeState, validateJsonPatch, validateRgaSeq, versionVectorCovers, vvHasDot, vvMerge };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "json-patch-to-crdt",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Convert JSON Patch (RFC 6902) to and from a CRDT-friendly representation.",
5
5
  "keywords": [
6
6
  "crdt",