doxum 0.1.9 → 0.1.10

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.
Files changed (33) hide show
  1. package/README.md +34 -18
  2. package/dist/{contract-BNStLbSE.d.ts → contract-CeAnEPBA.d.ts} +31 -14
  3. package/dist/{contract-CIU5FCC1.d.cts → contract-DtGVSXSK.d.cts} +31 -14
  4. package/dist/index.cjs +2 -2
  5. package/dist/index.d.cts +3 -3
  6. package/dist/index.d.ts +3 -3
  7. package/dist/index.js +2 -2
  8. package/dist/{integration-C87tjRop.cjs → integration-BKgGuodm.cjs} +2 -2
  9. package/dist/{integration-C87tjRop.cjs.map → integration-BKgGuodm.cjs.map} +1 -1
  10. package/dist/{integration-D5XCBLJ8.js → integration-VTZ3ICsO.js} +2 -2
  11. package/dist/{integration-D5XCBLJ8.js.map → integration-VTZ3ICsO.js.map} +1 -1
  12. package/dist/integration.cjs +2 -2
  13. package/dist/integration.d.cts +2 -2
  14. package/dist/integration.d.ts +2 -2
  15. package/dist/integration.js +2 -2
  16. package/dist/local-sync.d.cts +1 -1
  17. package/dist/local-sync.d.ts +1 -1
  18. package/dist/react.cjs +2 -2
  19. package/dist/react.js +2 -2
  20. package/dist/{store-cp5CpfCy.d.ts → store-Bs0C0rNd.d.ts} +2 -2
  21. package/dist/{store-CD0KdGsq.d.cts → store-CJuwJl_K.d.cts} +2 -2
  22. package/dist/{store-D7QH6Rzw.js → store-DHFXfWSz.js} +90 -47
  23. package/dist/store-DHFXfWSz.js.map +1 -0
  24. package/dist/{store-1Uob0Ghk.cjs → store-DU2u-qFH.cjs} +95 -52
  25. package/dist/store-DU2u-qFH.cjs.map +1 -0
  26. package/package.json +1 -1
  27. package/skills/doxum-runtime/SKILL.md +3 -1
  28. package/skills/doxum-runtime/references/guide.en.md +18 -14
  29. package/skills/doxum-runtime/references/guide.zh-CN.md +16 -13
  30. package/skills/doxum-runtime/references/patterns.en.md +6 -6
  31. package/skills/doxum-runtime/references/patterns.zh-CN.md +6 -6
  32. package/dist/store-1Uob0Ghk.cjs.map +0 -1
  33. package/dist/store-D7QH6Rzw.js.map +0 -1
package/README.md CHANGED
@@ -23,10 +23,10 @@ const document = createDocument({
23
23
  });
24
24
 
25
25
  document.update(draft => {
26
- const task = draft.tasks.a;
26
+ const task = draft.tasks.get('a');
27
27
  if (task) task.done = true;
28
- draft.tasks.b = { title: 'Review', done: false };
29
- delete draft.tasks.a;
28
+ draft.tasks.put('b', { title: 'Review', done: false });
29
+ draft.tasks.remove('a');
30
30
  return { warnings: [] };
31
31
  });
32
32
  ```
@@ -97,11 +97,14 @@ capabilities while retaining selection, subscription and projection support.
97
97
 
98
98
  ## Containers And Parsing
99
99
 
100
- - `map(field(...))`, `map(object(...))`, `map(variant(...))` use key indexing,
101
- assignment and deletion. Absent differs from present `undefined`.
102
- - `table(object(...))` retains `{ ids, byId }` data and `get/has/ids/create/remove/move`.
103
- - `list(field(...), { keyOf })` retains a plain array and `get/has/ids/insert/set/remove/move/replace`.
104
- - `tree(field(...))` retains `{ rootId?, nodes }` and explicit topology methods.
100
+ - `map(field(...))`, `map(object(...))`, `map(variant(...))` expose
101
+ `get/has/ids/put/remove/replace`. `put` is an upsert; removing a missing key is a no-op.
102
+ - `table(object(...))` retains `{ ids, byId }` data and exposes
103
+ `get/has/ids/create/remove/move/replace`.
104
+ - `list(field(...), { keyOf })` retains a plain array and exposes
105
+ `get/has/ids/insert/remove/move/replace`.
106
+ - `tree(field(...))` retains `{ rootId?, nodes }` and exposes topology reads plus
107
+ `insert/remove/move/replace`.
105
108
  - `variant(tag, branches)` has a readonly discriminant and whole-value branch replacement.
106
109
  - `optional(node)` permits absence for fields, variants, maps, lists and trees.
107
110
 
@@ -113,22 +116,35 @@ Doxum; it does not detect validator mutation or conversion. `parse(model, unknow
113
116
  validates and copies schema structure while sharing readonly payloads. Strict parsing
114
117
  requires validators for atomic fields; typed in-memory fields can omit them.
115
118
 
116
- For replacements containing nested collection tools, use `assign(scope, key, value)`:
119
+ Collection `replace` has two forms: `replace(id, value)` replaces one existing
120
+ table/list/tree member without changing order or topology, while `replace(value)`
121
+ replaces the entire map/table/list/tree. Use top-level `replace(parent, key, value)`
122
+ when replacing an object or variant member whose draft type exposes collection tools:
117
123
 
118
124
  ```ts
119
- import { assign, table } from 'doxum';
120
- const boardModel = object({ entries: map(object({ rows: table(task) })) });
121
- const board = createDocument({ schema: boardModel, initial: { entries: {} } });
125
+ import { replace, table, variant } from 'doxum';
126
+ const boardModel = object({
127
+ entries: map(object({ rows: table(task) })),
128
+ view: variant('kind', {
129
+ empty: object({}),
130
+ tasks: object({ rows: table(task) }),
131
+ }),
132
+ });
133
+ const board = createDocument({
134
+ schema: boardModel,
135
+ initial: { entries: {}, view: { kind: 'empty' } },
136
+ });
122
137
  board.update(draft => {
123
- assign(draft.entries, 'a', { rows: { ids: [], byId: {} } });
138
+ draft.entries.put('a', { rows: { ids: [], byId: {} } });
139
+ replace(draft, 'view', { kind: 'tasks', rows: { ids: [], byId: {} } });
124
140
  });
125
141
  ```
126
142
 
127
- TypeScript cannot give a mapped property a draft read type and a different plain
128
- data assignment type. `assign` checks the key and its `Infer` value and calls the
129
- same transaction write path. It is useful for complex map entries, variant
130
- replacement and initializing optional lists/trees. Ordinary assignments remain
131
- the common case. See [value boundaries](docs/value-boundaries.md).
143
+ Top-level `replace` checks the parent key and its plain `Infer` value, then enters the
144
+ same transaction write path. It is useful for variant replacement and initializing
145
+ optional collections. Map entries use `put`; collection-wide replacements use the
146
+ collection's own `replace`. Ordinary field and object-member assignments remain the
147
+ common case. See [value boundaries](docs/value-boundaries.md).
132
148
 
133
149
  ## Changes And History
134
150
 
@@ -243,24 +243,36 @@ declare const debugKey: (address: DocumentAddress) => string;
243
243
  //#endregion
244
244
  //#region core/src/access/scope.d.ts
245
245
  declare const scopeValue: unique symbol;
246
- type Scoped<N extends DocumentNode> = {
247
- readonly [scopeValue]?: Infer<N>;
246
+ type Scoped<N extends DocumentNode, W extends boolean, V = Infer<N>> = {
247
+ readonly [scopeValue]?: readonly [node: N, writable: W, value: V];
248
248
  };
249
249
  type ShapeAccess<S extends ObjectShape, W extends boolean> = W extends true ? { -readonly [K in keyof S]: Access<S[K], W> } : { readonly [K in keyof S]: Access<S[K], W> };
250
+ type MapAccess<K extends string, N extends ValueSchemaNode, W extends boolean> = {
251
+ get(id: K): Access<N, W> | undefined;
252
+ has(id: K): boolean;
253
+ ids(): readonly K[];
254
+ } & (W extends true ? {
255
+ put(id: K, value: Infer<N>): void;
256
+ remove(id: K): void;
257
+ replace(value: Readonly<Record<K, Infer<N>>>): void;
258
+ } : {});
250
259
  type TableAccess<K extends string, N extends ValueSchemaNode, W extends boolean> = {
251
260
  get(id: K): Access<N, W> | undefined;
252
261
  has(id: K): boolean;
253
262
  ids(): readonly K[];
254
263
  } & (W extends true ? {
255
- create(entries: {
256
- readonly id: K;
257
- readonly value: Infer<N>;
258
- } | readonly {
264
+ create(id: K, value: Infer<N>, anchor?: DocumentAnchor<K>): void;
265
+ create(entries: readonly {
259
266
  readonly id: K;
260
267
  readonly value: Infer<N>;
261
268
  }[], anchor?: DocumentAnchor<K>): void;
262
269
  remove(ids: K | readonly K[]): void;
263
270
  move(id: K, anchor?: DocumentAnchor<K>): void;
271
+ replace(value: {
272
+ readonly ids: readonly K[];
273
+ readonly byId: Readonly<Record<K, Infer<N>>>;
274
+ }): void;
275
+ replace(id: K, value: Infer<N>): void;
264
276
  } : {});
265
277
  type ListAccess<T, W extends boolean> = {
266
278
  get(key: string): ReadonlyValue<T> | undefined;
@@ -268,10 +280,10 @@ type ListAccess<T, W extends boolean> = {
268
280
  ids(): readonly string[];
269
281
  } & (W extends true ? {
270
282
  insert(value: ReadonlyValue<T>, anchor?: DocumentAnchor): void;
271
- set(key: string, value: ReadonlyValue<T>): void;
272
283
  remove(key: string): void;
273
284
  move(key: string, anchor?: DocumentAnchor): void;
274
285
  replace(value: readonly ReadonlyValue<T>[]): void;
286
+ replace(key: string, value: ReadonlyValue<T>): void;
275
287
  } : {});
276
288
  type TreeAccess<T, W extends boolean> = {
277
289
  rootId(): string | undefined;
@@ -281,23 +293,28 @@ type TreeAccess<T, W extends boolean> = {
281
293
  children(id: string): readonly string[] | undefined;
282
294
  } & (W extends true ? {
283
295
  insert(id: string, value: ReadonlyValue<T>, position?: TreePosition): void;
284
- set(id: string, value: ReadonlyValue<T>): void;
285
296
  move(id: string, position?: TreePosition): void;
286
297
  remove(id: string): void;
287
298
  replace(value: DocumentTreeValue<T>): void;
299
+ replace(id: string, value: ReadonlyValue<T>): void;
288
300
  } : {});
289
- type NodeAccess<N extends DocumentNode, W extends boolean> = N extends FieldNode<infer T, boolean> ? ReadonlyValue<T> : N extends ObjectNode<infer S> ? ShapeAccess<S, W> & Scoped<N> : N extends VariantNode<infer Tag, infer V> ? { [K in keyof V & string]: ShapeAccess<V[K]['shape'], W> & { readonly [P in Tag]: K } & Scoped<N> }[keyof V & string] : N extends MapNode<infer V, infer K> ? (W extends true ? { [P in K]: Access<V, W> | undefined } : { readonly [P in K]: Access<V, W> | undefined }) & Scoped<N> : N extends TableNode<infer V, infer K> ? TableAccess<K, V, W> & Scoped<N> : N extends ListNode<infer T> ? ListAccess<T, W> & Scoped<N> : N extends TreeNode<infer T> ? TreeAccess<T, W> & Scoped<N> : never;
301
+ type NodeAccess<N extends DocumentNode, W extends boolean> = N extends FieldNode<infer T, boolean> ? ReadonlyValue<T> : N extends ObjectNode<infer S> ? ShapeAccess<S, W> & Scoped<N, W> : N extends VariantNode<infer Tag, infer V> ? { [K in keyof V & string]: ShapeAccess<V[K]['shape'], W> & { readonly [P in Tag]: K } & Scoped<N, W, Extract<Infer<N>, Record<Tag, K>>> }[keyof V & string] : N extends MapNode<infer V, infer K> ? MapAccess<K, V, W> & Scoped<N, W> : N extends TableNode<infer V, infer K> ? TableAccess<K, V, W> & Scoped<N, W> : N extends ListNode<infer T> ? ListAccess<T, W> & Scoped<N, W> : N extends TreeNode<infer T> ? TreeAccess<T, W> & Scoped<N, W> : never;
290
302
  type Access<N extends DocumentNode, W extends boolean> = N extends {
291
303
  readonly optional: true;
292
304
  } ? NodeAccess<N, W> | undefined : NodeAccess<N, W>;
293
305
  type Read<N extends DocumentNode> = Access<N, false>;
294
306
  type Draft<N extends DocumentNode> = Access<N, true>;
295
307
  type Snapshot<T> = T extends {
296
- readonly [scopeValue]?: infer V;
308
+ readonly [scopeValue]?: readonly [DocumentNode, boolean, infer V];
297
309
  } ? V : ReadonlyValue<T>;
298
310
  declare const snapshot: <T>(value: T) => Snapshot<T>;
299
- /** TypeScript cannot express asymmetric index signatures for nested collection tools. */
300
- declare const assign: <T extends object, K extends keyof Snapshot<T>>(container: T, key: K, value: NoInfer<Snapshot<T>[K]>) => void;
311
+ /** Replace a member with its plain Infer value through the owning draft session. */
312
+ type ReplaceParentAccess = {
313
+ readonly [scopeValue]?: readonly [Extract<DocumentNode, {
314
+ readonly kind: 'object' | 'variant';
315
+ }>, true, unknown];
316
+ };
317
+ declare const replace: <T extends object & ReplaceParentAccess, K extends keyof Snapshot<T>>(container: T, key: K, value: NoInfer<Snapshot<T>[K]>) => void;
301
318
  /** Projection collection contexts use the same scoped access, with explicit collection tools. */
302
319
  type CollectionAccess<K extends string, N extends ValueSchemaNode> = TableAccess<K, N, false>;
303
320
  //#endregion
@@ -437,5 +454,5 @@ type DocumentRuntime<S extends ObjectNode> = DocumentReadable<S> & {
437
454
  dispose(): void;
438
455
  };
439
456
  //#endregion
440
- export { ObjectShape as $, debugKey as A, CollectionPath as B, CollectionAccess as C, snapshot as D, assign as E, ChangeSet as F, DocumentTreeNode as G, DocumentAnchor as H, MemberChange as I, ImpactTarget as J, DocumentTreeValue as K, ValueTransition as L, read as M, resolveAddress as N, AddressRef as O, Change as P, ObjectNode as Q, CollectionId as R, DocumentImpact as S, Read as T, DocumentListConfig as U, DocumentAddress as V, DocumentNode as W, ListNode as X, Infer as Y, MapNode as Z, Unsubscribe as _, ParseError as _t, DocumentDisposedError as a, TreeNode as at, MutationIssueCode as b, parse as bt, DocumentReentrancyError as c, VariantShape as ct, LocalHistory as d, map as dt, OptionalNode as et, ObserverError as f, object as ft, TransactionResult as g, variant as gt, TransactionRejected as h, tree as ht, DocumentDiagnostic as i, TableNode as it, overlaps as j, contains as k, DocumentRuntime as l, field as lt, Synchronous as m, table as mt, CommitSource as n, ReadonlyValue as nt, DocumentProblem as o, ValueSchemaNode as ot, OperationResult as p, optional as pt, FieldNode as q, DocumentCommit as r, SchemaPath as rt, DocumentReadable as s, VariantNode as st, CommitListener as t, PathPick as tt, HistoryState as u, list as ut, Readable as v, ParseIssue as vt, Draft as w, CollectionImpact as x, MutationIssue as y, Validator as yt, CollectionNode as z };
441
- //# sourceMappingURL=contract-BNStLbSE.d.ts.map
457
+ export { ObjectShape as $, debugKey as A, CollectionPath as B, CollectionAccess as C, snapshot as D, replace as E, ChangeSet as F, DocumentTreeNode as G, DocumentAnchor as H, MemberChange as I, ImpactTarget as J, DocumentTreeValue as K, ValueTransition as L, read as M, resolveAddress as N, AddressRef as O, Change as P, ObjectNode as Q, CollectionId as R, DocumentImpact as S, Read as T, DocumentListConfig as U, DocumentAddress as V, DocumentNode as W, ListNode as X, Infer as Y, MapNode as Z, Unsubscribe as _, ParseError as _t, DocumentDisposedError as a, TreeNode as at, MutationIssueCode as b, parse as bt, DocumentReentrancyError as c, VariantShape as ct, LocalHistory as d, map as dt, OptionalNode as et, ObserverError as f, object as ft, TransactionResult as g, variant as gt, TransactionRejected as h, tree as ht, DocumentDiagnostic as i, TableNode as it, overlaps as j, contains as k, DocumentRuntime as l, field as lt, Synchronous as m, table as mt, CommitSource as n, ReadonlyValue as nt, DocumentProblem as o, ValueSchemaNode as ot, OperationResult as p, optional as pt, FieldNode as q, DocumentCommit as r, SchemaPath as rt, DocumentReadable as s, VariantNode as st, CommitListener as t, PathPick as tt, HistoryState as u, list as ut, Readable as v, ParseIssue as vt, Draft as w, CollectionImpact as x, MutationIssue as y, Validator as yt, CollectionNode as z };
458
+ //# sourceMappingURL=contract-CeAnEPBA.d.ts.map
@@ -243,24 +243,36 @@ declare const debugKey: (address: DocumentAddress) => string;
243
243
  //#endregion
244
244
  //#region core/src/access/scope.d.ts
245
245
  declare const scopeValue: unique symbol;
246
- type Scoped<N extends DocumentNode> = {
247
- readonly [scopeValue]?: Infer<N>;
246
+ type Scoped<N extends DocumentNode, W extends boolean, V = Infer<N>> = {
247
+ readonly [scopeValue]?: readonly [node: N, writable: W, value: V];
248
248
  };
249
249
  type ShapeAccess<S extends ObjectShape, W extends boolean> = W extends true ? { -readonly [K in keyof S]: Access<S[K], W> } : { readonly [K in keyof S]: Access<S[K], W> };
250
+ type MapAccess<K extends string, N extends ValueSchemaNode, W extends boolean> = {
251
+ get(id: K): Access<N, W> | undefined;
252
+ has(id: K): boolean;
253
+ ids(): readonly K[];
254
+ } & (W extends true ? {
255
+ put(id: K, value: Infer<N>): void;
256
+ remove(id: K): void;
257
+ replace(value: Readonly<Record<K, Infer<N>>>): void;
258
+ } : {});
250
259
  type TableAccess<K extends string, N extends ValueSchemaNode, W extends boolean> = {
251
260
  get(id: K): Access<N, W> | undefined;
252
261
  has(id: K): boolean;
253
262
  ids(): readonly K[];
254
263
  } & (W extends true ? {
255
- create(entries: {
256
- readonly id: K;
257
- readonly value: Infer<N>;
258
- } | readonly {
264
+ create(id: K, value: Infer<N>, anchor?: DocumentAnchor<K>): void;
265
+ create(entries: readonly {
259
266
  readonly id: K;
260
267
  readonly value: Infer<N>;
261
268
  }[], anchor?: DocumentAnchor<K>): void;
262
269
  remove(ids: K | readonly K[]): void;
263
270
  move(id: K, anchor?: DocumentAnchor<K>): void;
271
+ replace(value: {
272
+ readonly ids: readonly K[];
273
+ readonly byId: Readonly<Record<K, Infer<N>>>;
274
+ }): void;
275
+ replace(id: K, value: Infer<N>): void;
264
276
  } : {});
265
277
  type ListAccess<T, W extends boolean> = {
266
278
  get(key: string): ReadonlyValue<T> | undefined;
@@ -268,10 +280,10 @@ type ListAccess<T, W extends boolean> = {
268
280
  ids(): readonly string[];
269
281
  } & (W extends true ? {
270
282
  insert(value: ReadonlyValue<T>, anchor?: DocumentAnchor): void;
271
- set(key: string, value: ReadonlyValue<T>): void;
272
283
  remove(key: string): void;
273
284
  move(key: string, anchor?: DocumentAnchor): void;
274
285
  replace(value: readonly ReadonlyValue<T>[]): void;
286
+ replace(key: string, value: ReadonlyValue<T>): void;
275
287
  } : {});
276
288
  type TreeAccess<T, W extends boolean> = {
277
289
  rootId(): string | undefined;
@@ -281,23 +293,28 @@ type TreeAccess<T, W extends boolean> = {
281
293
  children(id: string): readonly string[] | undefined;
282
294
  } & (W extends true ? {
283
295
  insert(id: string, value: ReadonlyValue<T>, position?: TreePosition): void;
284
- set(id: string, value: ReadonlyValue<T>): void;
285
296
  move(id: string, position?: TreePosition): void;
286
297
  remove(id: string): void;
287
298
  replace(value: DocumentTreeValue<T>): void;
299
+ replace(id: string, value: ReadonlyValue<T>): void;
288
300
  } : {});
289
- type NodeAccess<N extends DocumentNode, W extends boolean> = N extends FieldNode<infer T, boolean> ? ReadonlyValue<T> : N extends ObjectNode<infer S> ? ShapeAccess<S, W> & Scoped<N> : N extends VariantNode<infer Tag, infer V> ? { [K in keyof V & string]: ShapeAccess<V[K]['shape'], W> & { readonly [P in Tag]: K } & Scoped<N> }[keyof V & string] : N extends MapNode<infer V, infer K> ? (W extends true ? { [P in K]: Access<V, W> | undefined } : { readonly [P in K]: Access<V, W> | undefined }) & Scoped<N> : N extends TableNode<infer V, infer K> ? TableAccess<K, V, W> & Scoped<N> : N extends ListNode<infer T> ? ListAccess<T, W> & Scoped<N> : N extends TreeNode<infer T> ? TreeAccess<T, W> & Scoped<N> : never;
301
+ type NodeAccess<N extends DocumentNode, W extends boolean> = N extends FieldNode<infer T, boolean> ? ReadonlyValue<T> : N extends ObjectNode<infer S> ? ShapeAccess<S, W> & Scoped<N, W> : N extends VariantNode<infer Tag, infer V> ? { [K in keyof V & string]: ShapeAccess<V[K]['shape'], W> & { readonly [P in Tag]: K } & Scoped<N, W, Extract<Infer<N>, Record<Tag, K>>> }[keyof V & string] : N extends MapNode<infer V, infer K> ? MapAccess<K, V, W> & Scoped<N, W> : N extends TableNode<infer V, infer K> ? TableAccess<K, V, W> & Scoped<N, W> : N extends ListNode<infer T> ? ListAccess<T, W> & Scoped<N, W> : N extends TreeNode<infer T> ? TreeAccess<T, W> & Scoped<N, W> : never;
290
302
  type Access<N extends DocumentNode, W extends boolean> = N extends {
291
303
  readonly optional: true;
292
304
  } ? NodeAccess<N, W> | undefined : NodeAccess<N, W>;
293
305
  type Read<N extends DocumentNode> = Access<N, false>;
294
306
  type Draft<N extends DocumentNode> = Access<N, true>;
295
307
  type Snapshot<T> = T extends {
296
- readonly [scopeValue]?: infer V;
308
+ readonly [scopeValue]?: readonly [DocumentNode, boolean, infer V];
297
309
  } ? V : ReadonlyValue<T>;
298
310
  declare const snapshot: <T>(value: T) => Snapshot<T>;
299
- /** TypeScript cannot express asymmetric index signatures for nested collection tools. */
300
- declare const assign: <T extends object, K extends keyof Snapshot<T>>(container: T, key: K, value: NoInfer<Snapshot<T>[K]>) => void;
311
+ /** Replace a member with its plain Infer value through the owning draft session. */
312
+ type ReplaceParentAccess = {
313
+ readonly [scopeValue]?: readonly [Extract<DocumentNode, {
314
+ readonly kind: 'object' | 'variant';
315
+ }>, true, unknown];
316
+ };
317
+ declare const replace: <T extends object & ReplaceParentAccess, K extends keyof Snapshot<T>>(container: T, key: K, value: NoInfer<Snapshot<T>[K]>) => void;
301
318
  /** Projection collection contexts use the same scoped access, with explicit collection tools. */
302
319
  type CollectionAccess<K extends string, N extends ValueSchemaNode> = TableAccess<K, N, false>;
303
320
  //#endregion
@@ -437,5 +454,5 @@ type DocumentRuntime<S extends ObjectNode> = DocumentReadable<S> & {
437
454
  dispose(): void;
438
455
  };
439
456
  //#endregion
440
- export { ObjectShape as $, debugKey as A, CollectionPath as B, CollectionAccess as C, snapshot as D, assign as E, ChangeSet as F, DocumentTreeNode as G, DocumentAnchor as H, MemberChange as I, ImpactTarget as J, DocumentTreeValue as K, ValueTransition as L, read as M, resolveAddress as N, AddressRef as O, Change as P, ObjectNode as Q, CollectionId as R, DocumentImpact as S, Read as T, DocumentListConfig as U, DocumentAddress as V, DocumentNode as W, ListNode as X, Infer as Y, MapNode as Z, Unsubscribe as _, ParseError as _t, DocumentDisposedError as a, TreeNode as at, MutationIssueCode as b, parse as bt, DocumentReentrancyError as c, VariantShape as ct, LocalHistory as d, map as dt, OptionalNode as et, ObserverError as f, object as ft, TransactionResult as g, variant as gt, TransactionRejected as h, tree as ht, DocumentDiagnostic as i, TableNode as it, overlaps as j, contains as k, DocumentRuntime as l, field as lt, Synchronous as m, table as mt, CommitSource as n, ReadonlyValue as nt, DocumentProblem as o, ValueSchemaNode as ot, OperationResult as p, optional as pt, FieldNode as q, DocumentCommit as r, SchemaPath as rt, DocumentReadable as s, VariantNode as st, CommitListener as t, PathPick as tt, HistoryState as u, list as ut, Readable as v, ParseIssue as vt, Draft as w, CollectionImpact as x, MutationIssue as y, Validator as yt, CollectionNode as z };
441
- //# sourceMappingURL=contract-CIU5FCC1.d.cts.map
457
+ export { ObjectShape as $, debugKey as A, CollectionPath as B, CollectionAccess as C, snapshot as D, replace as E, ChangeSet as F, DocumentTreeNode as G, DocumentAnchor as H, MemberChange as I, ImpactTarget as J, DocumentTreeValue as K, ValueTransition as L, read as M, resolveAddress as N, AddressRef as O, Change as P, ObjectNode as Q, CollectionId as R, DocumentImpact as S, Read as T, DocumentListConfig as U, DocumentAddress as V, DocumentNode as W, ListNode as X, Infer as Y, MapNode as Z, Unsubscribe as _, ParseError as _t, DocumentDisposedError as a, TreeNode as at, MutationIssueCode as b, parse as bt, DocumentReentrancyError as c, VariantShape as ct, LocalHistory as d, map as dt, OptionalNode as et, ObserverError as f, object as ft, TransactionResult as g, variant as gt, TransactionRejected as h, tree as ht, DocumentDiagnostic as i, TableNode as it, overlaps as j, contains as k, DocumentRuntime as l, field as lt, Synchronous as m, table as mt, CommitSource as n, ReadonlyValue as nt, DocumentProblem as o, ValueSchemaNode as ot, OperationResult as p, optional as pt, FieldNode as q, DocumentCommit as r, SchemaPath as rt, DocumentReadable as s, VariantNode as st, CommitListener as t, PathPick as tt, HistoryState as u, list as ut, Readable as v, ParseIssue as vt, Draft as w, CollectionImpact as x, MutationIssue as y, Validator as yt, CollectionNode as z };
458
+ //# sourceMappingURL=contract-DtGVSXSK.d.cts.map
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_issue = require("./issue-DhrNdQNg.cjs");
3
- const require_store = require("./store-1Uob0Ghk.cjs");
3
+ const require_store = require("./store-DU2u-qFH.cjs");
4
4
  const require_driver = require("./driver-xOIkwrB8.cjs");
5
5
  //#region core/src/history.ts
6
6
  const createHistory = (input) => {
@@ -923,7 +923,6 @@ exports.ProjectionDisposedError = require_store.ProjectionDisposedError;
923
923
  exports.ProjectionError = require_store.ProjectionError;
924
924
  exports.TransactionRejected = require_store.TransactionRejected;
925
925
  exports.asReadable = asReadable;
926
- exports.assign = require_store.assign;
927
926
  exports.createDocument = createDocument;
928
927
  exports.createProjectionStore = require_store.createProjectionStore;
929
928
  exports.field = require_store.field;
@@ -934,6 +933,7 @@ exports.object = require_store.object;
934
933
  exports.optional = require_store.optional;
935
934
  exports.parse = require_store.parse;
936
935
  exports.project = require_store.project;
936
+ exports.replace = require_store.replace;
937
937
  exports.select = select;
938
938
  exports.snapshot = require_store.snapshot;
939
939
  exports.table = require_store.table;
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { $ as ObjectShape, D as snapshot, E as assign, F as ChangeSet, G as DocumentTreeNode, H as DocumentAnchor, I as MemberChange, K as DocumentTreeValue, L as ValueTransition, P as Change, Q as ObjectNode, S as DocumentImpact, T as Read, U as DocumentListConfig, V as DocumentAddress, W as DocumentNode, X as ListNode, Y as Infer, Z as MapNode, _ as Unsubscribe, _t as ParseError, a as DocumentDisposedError, at as TreeNode, b as MutationIssueCode, bt as parse, c as DocumentReentrancyError, ct as VariantShape, d as LocalHistory, dt as map, et as OptionalNode, f as ObserverError, ft as object, g as TransactionResult, gt as variant, h as TransactionRejected, ht as tree, i as DocumentDiagnostic, it as TableNode, l as DocumentRuntime, lt as field, mt as table, n as CommitSource, nt as ReadonlyValue, o as DocumentProblem, p as OperationResult, pt as optional, q as FieldNode, r as DocumentCommit, rt as SchemaPath, s as DocumentReadable, st as VariantNode, u as HistoryState, ut as list, v as Readable, vt as ParseIssue, w as Draft, x as CollectionImpact, y as MutationIssue, yt as Validator } from "./contract-CIU5FCC1.cjs";
2
- import { C as ProjectionDisposedError, S as project, _ as ProjectionSources, a as AdvancedCollectionSpec, b as ValueProjection, c as CollectionProjection, d as DocumentCollectionProjection, f as DocumentEvent, g as ProjectionEvents, h as Projection, i as AdvancedCollectionProcess, l as CollectionSource, m as InputProjection, n as createProjectionStore, o as AdvancedValueSpec, p as DocumentProjection, s as CollectionEvent, t as ProjectionStore, u as DocumentCollectionEvent, v as ProjectionValues, w as ProjectionError, x as input, y as ValueEvent } from "./store-CD0KdGsq.cjs";
1
+ import { $ as ObjectShape, D as snapshot, E as replace, F as ChangeSet, G as DocumentTreeNode, H as DocumentAnchor, I as MemberChange, K as DocumentTreeValue, L as ValueTransition, P as Change, Q as ObjectNode, S as DocumentImpact, T as Read, U as DocumentListConfig, V as DocumentAddress, W as DocumentNode, X as ListNode, Y as Infer, Z as MapNode, _ as Unsubscribe, _t as ParseError, a as DocumentDisposedError, at as TreeNode, b as MutationIssueCode, bt as parse, c as DocumentReentrancyError, ct as VariantShape, d as LocalHistory, dt as map, et as OptionalNode, f as ObserverError, ft as object, g as TransactionResult, gt as variant, h as TransactionRejected, ht as tree, i as DocumentDiagnostic, it as TableNode, l as DocumentRuntime, lt as field, mt as table, n as CommitSource, nt as ReadonlyValue, o as DocumentProblem, p as OperationResult, pt as optional, q as FieldNode, r as DocumentCommit, rt as SchemaPath, s as DocumentReadable, st as VariantNode, u as HistoryState, ut as list, v as Readable, vt as ParseIssue, w as Draft, x as CollectionImpact, y as MutationIssue, yt as Validator } from "./contract-DtGVSXSK.cjs";
2
+ import { C as ProjectionDisposedError, S as project, _ as ProjectionSources, a as AdvancedCollectionSpec, b as ValueProjection, c as CollectionProjection, d as DocumentCollectionProjection, f as DocumentEvent, g as ProjectionEvents, h as Projection, i as AdvancedCollectionProcess, l as CollectionSource, m as InputProjection, n as createProjectionStore, o as AdvancedValueSpec, p as DocumentProjection, s as CollectionEvent, t as ProjectionStore, u as DocumentCollectionEvent, v as ProjectionValues, w as ProjectionError, x as input, y as ValueEvent } from "./store-CJuwJl_K.cjs";
3
3
 
4
4
  //#region core/src/runtime.d.ts
5
5
  declare const createDocument: <S extends ObjectNode>(input: {
@@ -17,5 +17,5 @@ declare const asReadable: <TSchema extends ObjectNode>(runtime: DocumentRuntime<
17
17
  type DocumentSelector<TSchema extends ObjectNode, TResult> = (read: Read<TSchema>) => TResult;
18
18
  declare const select: <TSchema extends ObjectNode, TResult>(runtime: DocumentReadable<TSchema>, selector: DocumentSelector<TSchema, TResult>) => TResult;
19
19
  //#endregion
20
- export { type AdvancedCollectionProcess, type AdvancedCollectionSpec, type AdvancedValueSpec, type Change, type ChangeSet, type CollectionEvent, type CollectionImpact, type CollectionProjection, type CollectionSource, type CommitSource, type DocumentAddress, type DocumentAnchor, type DocumentCollectionEvent, type DocumentCollectionProjection, type DocumentCommit, type DocumentDiagnostic, DocumentDisposedError, type DocumentEvent, type DocumentImpact, type DocumentListConfig, type DocumentNode, type DocumentProblem, type DocumentProjection, type DocumentReadable, DocumentReentrancyError, type DocumentRuntime, type DocumentSelector, type DocumentTreeNode, type DocumentTreeValue, type Draft, type FieldNode, type HistoryState, type Infer, type InputProjection, type ListNode, type LocalHistory, type MapNode, type MemberChange, type MutationIssue, type MutationIssueCode, type ObjectNode, type ObjectShape, type ObserverError, type OperationResult, type OptionalNode, ParseError, type ParseIssue, type Projection, ProjectionDisposedError, ProjectionError, type ProjectionEvents, type ProjectionSources, type ProjectionStore, type ProjectionValues, type Read, type Readable, type ReadonlyValue, type SchemaPath, type TableNode, TransactionRejected, type TransactionResult, type TreeNode, type Unsubscribe, type Validator, type ValueEvent, type ValueProjection, type ValueTransition, type VariantNode, type VariantShape, asReadable, assign, createDocument, createProjectionStore, field, input, list, map, object, optional, parse, project, select, snapshot, table, tree, variant };
20
+ export { type AdvancedCollectionProcess, type AdvancedCollectionSpec, type AdvancedValueSpec, type Change, type ChangeSet, type CollectionEvent, type CollectionImpact, type CollectionProjection, type CollectionSource, type CommitSource, type DocumentAddress, type DocumentAnchor, type DocumentCollectionEvent, type DocumentCollectionProjection, type DocumentCommit, type DocumentDiagnostic, DocumentDisposedError, type DocumentEvent, type DocumentImpact, type DocumentListConfig, type DocumentNode, type DocumentProblem, type DocumentProjection, type DocumentReadable, DocumentReentrancyError, type DocumentRuntime, type DocumentSelector, type DocumentTreeNode, type DocumentTreeValue, type Draft, type FieldNode, type HistoryState, type Infer, type InputProjection, type ListNode, type LocalHistory, type MapNode, type MemberChange, type MutationIssue, type MutationIssueCode, type ObjectNode, type ObjectShape, type ObserverError, type OperationResult, type OptionalNode, ParseError, type ParseIssue, type Projection, ProjectionDisposedError, ProjectionError, type ProjectionEvents, type ProjectionSources, type ProjectionStore, type ProjectionValues, type Read, type Readable, type ReadonlyValue, type SchemaPath, type TableNode, TransactionRejected, type TransactionResult, type TreeNode, type Unsubscribe, type Validator, type ValueEvent, type ValueProjection, type ValueTransition, type VariantNode, type VariantShape, asReadable, createDocument, createProjectionStore, field, input, list, map, object, optional, parse, project, replace, select, snapshot, table, tree, variant };
21
21
  //# sourceMappingURL=index.d.cts.map
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { $ as ObjectShape, D as snapshot, E as assign, F as ChangeSet, G as DocumentTreeNode, H as DocumentAnchor, I as MemberChange, K as DocumentTreeValue, L as ValueTransition, P as Change, Q as ObjectNode, S as DocumentImpact, T as Read, U as DocumentListConfig, V as DocumentAddress, W as DocumentNode, X as ListNode, Y as Infer, Z as MapNode, _ as Unsubscribe, _t as ParseError, a as DocumentDisposedError, at as TreeNode, b as MutationIssueCode, bt as parse, c as DocumentReentrancyError, ct as VariantShape, d as LocalHistory, dt as map, et as OptionalNode, f as ObserverError, ft as object, g as TransactionResult, gt as variant, h as TransactionRejected, ht as tree, i as DocumentDiagnostic, it as TableNode, l as DocumentRuntime, lt as field, mt as table, n as CommitSource, nt as ReadonlyValue, o as DocumentProblem, p as OperationResult, pt as optional, q as FieldNode, r as DocumentCommit, rt as SchemaPath, s as DocumentReadable, st as VariantNode, u as HistoryState, ut as list, v as Readable, vt as ParseIssue, w as Draft, x as CollectionImpact, y as MutationIssue, yt as Validator } from "./contract-BNStLbSE.js";
2
- import { C as ProjectionDisposedError, S as project, _ as ProjectionSources, a as AdvancedCollectionSpec, b as ValueProjection, c as CollectionProjection, d as DocumentCollectionProjection, f as DocumentEvent, g as ProjectionEvents, h as Projection, i as AdvancedCollectionProcess, l as CollectionSource, m as InputProjection, n as createProjectionStore, o as AdvancedValueSpec, p as DocumentProjection, s as CollectionEvent, t as ProjectionStore, u as DocumentCollectionEvent, v as ProjectionValues, w as ProjectionError, x as input, y as ValueEvent } from "./store-cp5CpfCy.js";
1
+ import { $ as ObjectShape, D as snapshot, E as replace, F as ChangeSet, G as DocumentTreeNode, H as DocumentAnchor, I as MemberChange, K as DocumentTreeValue, L as ValueTransition, P as Change, Q as ObjectNode, S as DocumentImpact, T as Read, U as DocumentListConfig, V as DocumentAddress, W as DocumentNode, X as ListNode, Y as Infer, Z as MapNode, _ as Unsubscribe, _t as ParseError, a as DocumentDisposedError, at as TreeNode, b as MutationIssueCode, bt as parse, c as DocumentReentrancyError, ct as VariantShape, d as LocalHistory, dt as map, et as OptionalNode, f as ObserverError, ft as object, g as TransactionResult, gt as variant, h as TransactionRejected, ht as tree, i as DocumentDiagnostic, it as TableNode, l as DocumentRuntime, lt as field, mt as table, n as CommitSource, nt as ReadonlyValue, o as DocumentProblem, p as OperationResult, pt as optional, q as FieldNode, r as DocumentCommit, rt as SchemaPath, s as DocumentReadable, st as VariantNode, u as HistoryState, ut as list, v as Readable, vt as ParseIssue, w as Draft, x as CollectionImpact, y as MutationIssue, yt as Validator } from "./contract-CeAnEPBA.js";
2
+ import { C as ProjectionDisposedError, S as project, _ as ProjectionSources, a as AdvancedCollectionSpec, b as ValueProjection, c as CollectionProjection, d as DocumentCollectionProjection, f as DocumentEvent, g as ProjectionEvents, h as Projection, i as AdvancedCollectionProcess, l as CollectionSource, m as InputProjection, n as createProjectionStore, o as AdvancedValueSpec, p as DocumentProjection, s as CollectionEvent, t as ProjectionStore, u as DocumentCollectionEvent, v as ProjectionValues, w as ProjectionError, x as input, y as ValueEvent } from "./store-Bs0C0rNd.js";
3
3
 
4
4
  //#region core/src/runtime.d.ts
5
5
  declare const createDocument: <S extends ObjectNode>(input: {
@@ -17,5 +17,5 @@ declare const asReadable: <TSchema extends ObjectNode>(runtime: DocumentRuntime<
17
17
  type DocumentSelector<TSchema extends ObjectNode, TResult> = (read: Read<TSchema>) => TResult;
18
18
  declare const select: <TSchema extends ObjectNode, TResult>(runtime: DocumentReadable<TSchema>, selector: DocumentSelector<TSchema, TResult>) => TResult;
19
19
  //#endregion
20
- export { type AdvancedCollectionProcess, type AdvancedCollectionSpec, type AdvancedValueSpec, type Change, type ChangeSet, type CollectionEvent, type CollectionImpact, type CollectionProjection, type CollectionSource, type CommitSource, type DocumentAddress, type DocumentAnchor, type DocumentCollectionEvent, type DocumentCollectionProjection, type DocumentCommit, type DocumentDiagnostic, DocumentDisposedError, type DocumentEvent, type DocumentImpact, type DocumentListConfig, type DocumentNode, type DocumentProblem, type DocumentProjection, type DocumentReadable, DocumentReentrancyError, type DocumentRuntime, type DocumentSelector, type DocumentTreeNode, type DocumentTreeValue, type Draft, type FieldNode, type HistoryState, type Infer, type InputProjection, type ListNode, type LocalHistory, type MapNode, type MemberChange, type MutationIssue, type MutationIssueCode, type ObjectNode, type ObjectShape, type ObserverError, type OperationResult, type OptionalNode, ParseError, type ParseIssue, type Projection, ProjectionDisposedError, ProjectionError, type ProjectionEvents, type ProjectionSources, type ProjectionStore, type ProjectionValues, type Read, type Readable, type ReadonlyValue, type SchemaPath, type TableNode, TransactionRejected, type TransactionResult, type TreeNode, type Unsubscribe, type Validator, type ValueEvent, type ValueProjection, type ValueTransition, type VariantNode, type VariantShape, asReadable, assign, createDocument, createProjectionStore, field, input, list, map, object, optional, parse, project, select, snapshot, table, tree, variant };
20
+ export { type AdvancedCollectionProcess, type AdvancedCollectionSpec, type AdvancedValueSpec, type Change, type ChangeSet, type CollectionEvent, type CollectionImpact, type CollectionProjection, type CollectionSource, type CommitSource, type DocumentAddress, type DocumentAnchor, type DocumentCollectionEvent, type DocumentCollectionProjection, type DocumentCommit, type DocumentDiagnostic, DocumentDisposedError, type DocumentEvent, type DocumentImpact, type DocumentListConfig, type DocumentNode, type DocumentProblem, type DocumentProjection, type DocumentReadable, DocumentReentrancyError, type DocumentRuntime, type DocumentSelector, type DocumentTreeNode, type DocumentTreeValue, type Draft, type FieldNode, type HistoryState, type Infer, type InputProjection, type ListNode, type LocalHistory, type MapNode, type MemberChange, type MutationIssue, type MutationIssueCode, type ObjectNode, type ObjectShape, type ObserverError, type OperationResult, type OptionalNode, ParseError, type ParseIssue, type Projection, ProjectionDisposedError, ProjectionError, type ProjectionEvents, type ProjectionSources, type ProjectionStore, type ProjectionValues, type Read, type Readable, type ReadonlyValue, type SchemaPath, type TableNode, TransactionRejected, type TransactionResult, type TreeNode, type Unsubscribe, type Validator, type ValueEvent, type ValueProjection, type ValueTransition, type VariantNode, type VariantShape, asReadable, createDocument, createProjectionStore, field, input, list, map, object, optional, parse, project, replace, select, snapshot, table, tree, variant };
21
21
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { A as insert, D as equal, F as remove, L as profile, M as keys, N as matches, _ as resolveTreeContainer, a as compiledShape, c as debugKey, d as overlaps, f as read, g as resolveLocated, h as resolveContainer, i as AddressIndex, j as install, l as memberKey, n as fail, o as contains, p as resolveAddress, r as invalidValue, s as createAddressResolver, t as MutationRejected, v as resolveValue } from "./issue-DVaGQGeP.js";
2
- import { A as object, B as parse, C as assign, D as field, E as compilePath, F as ParseError, I as checkKey, L as checkValue, M as table, N as tree, O as list, P as variant, R as copyValue, T as snapshot, _ as readWith, a as input, b as TransactionRejected, c as createNotification, d as shareNotification, g as bindRuntimeAccess, h as accessOf, i as ProjectionError, j as optional, k as map, l as disposeNotification, m as subscribeTargets, o as project, p as subscribeRoot, r as ProjectionDisposedError, s as bindDocumentReadable, t as createProjectionStore, u as notify, v as DocumentDisposedError, w as createAccess, x as createImpact, y as DocumentReentrancyError, z as equalValue } from "./store-D7QH6Rzw.js";
2
+ import { A as object, B as parse, C as createAccess, D as field, E as compilePath, F as ParseError, I as checkKey, L as checkValue, M as table, N as tree, O as list, P as variant, R as copyValue, T as snapshot, _ as readWith, a as input, b as TransactionRejected, c as createNotification, d as shareNotification, g as bindRuntimeAccess, h as accessOf, i as ProjectionError, j as optional, k as map, l as disposeNotification, m as subscribeTargets, o as project, p as subscribeRoot, r as ProjectionDisposedError, s as bindDocumentReadable, t as createProjectionStore, u as notify, v as DocumentDisposedError, w as replace, x as createImpact, y as DocumentReentrancyError, z as equalValue } from "./store-DHFXfWSz.js";
3
3
  import { n as bindRuntimeDriver, o as decodeChanges, r as disposeRuntimeDriver, s as sealChanges, t as assertRuntimeWritable } from "./driver-BlR81Dqg.js";
4
4
  //#region core/src/history.ts
5
5
  const createHistory = (input) => {
@@ -915,6 +915,6 @@ const asReadable = (runtime) => {
915
915
  //#region core/src/projection/select.ts
916
916
  const select = (runtime, selector) => readWith(runtime, selector);
917
917
  //#endregion
918
- export { DocumentDisposedError, DocumentReentrancyError, ParseError, ProjectionDisposedError, ProjectionError, TransactionRejected, asReadable, assign, createDocument, createProjectionStore, field, input, list, map, object, optional, parse, project, select, snapshot, table, tree, variant };
918
+ export { DocumentDisposedError, DocumentReentrancyError, ParseError, ProjectionDisposedError, ProjectionError, TransactionRejected, asReadable, createDocument, createProjectionStore, field, input, list, map, object, optional, parse, project, replace, select, snapshot, table, tree, variant };
919
919
 
920
920
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- const require_store = require("./store-1Uob0Ghk.cjs");
1
+ const require_store = require("./store-DU2u-qFH.cjs");
2
2
  //#region core/src/access/dependency.ts
3
3
  const createDependencyTracker = () => {
4
4
  const targets = [];
@@ -27,4 +27,4 @@ Object.defineProperty(exports, "track", {
27
27
  }
28
28
  });
29
29
 
30
- //# sourceMappingURL=integration-C87tjRop.cjs.map
30
+ //# sourceMappingURL=integration-BKgGuodm.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"integration-C87tjRop.cjs","names":["readWith"],"sources":["../core/src/access/dependency.ts","../core/src/integration.ts"],"sourcesContent":["import type { ImpactTarget } from '../schema';\nimport * as impactTarget from '../impact-target';\n\nexport type DependencyTracker = {\n readonly record: (target: ImpactTarget<unknown>) => void;\n readonly snapshot: () => readonly ImpactTarget<unknown>[];\n};\n\nexport const createDependencyTracker = (): DependencyTracker => {\n const targets: ImpactTarget<unknown>[] = [];\n return {\n record: value => {\n if (!targets.some(entry => impactTarget.same(entry, value))) targets.push(value);\n },\n snapshot: () => Object.freeze(targets.slice()),\n };\n};\n","import type { ObjectNode, ImpactTarget } from './schema';\nimport type { Read } from './access/scope';\nimport type { DocumentReadable } from './runtime/contract';\nimport { createDependencyTracker } from './access/dependency';\nimport { readWith } from './runtime/access';\nexport { projectionStoreDebug } from './projection/store';\nexport type { AddressRef } from './address';\nexport { contains, debugKey, overlaps, read as readAddress, resolveAddress } from './address';\nexport { subscribeDependencies } from './runtime/notification';\nexport { same as sameTarget } from './impact-target';\nexport type { ImpactTarget } from './schema';\n\nexport type TrackedSelection<TValue> = {\n readonly value: TValue;\n readonly targets: readonly ImpactTarget<unknown>[];\n};\n\n// Framework adapters receive one immutable result instead of coordinating a\n// mutable collector with the reader's scoped lifetime themselves.\nexport const track = <TSchema extends ObjectNode, TValue>(\n runtime: DocumentReadable<TSchema>,\n selector: (read: Read<TSchema>) => TValue\n): TrackedSelection<TValue> => {\n const dependencies = createDependencyTracker();\n const value = readWith(runtime, selector, dependencies);\n return Object.freeze({ value, targets: dependencies.snapshot() });\n};\n"],"mappings":";;AAQA,MAAa,gCAAmD;CAC9D,MAAM,UAAmC,EAAE;AAC3C,QAAO;EACL,SAAQ,UAAS;AACf,OAAI,CAAC,QAAQ,MAAK,UAAA,cAAA,KAA2B,OAAO,MAAM,CAAC,CAAE,SAAQ,KAAK,MAAM;;EAElF,gBAAgB,OAAO,OAAO,QAAQ,OAAO,CAAC;EAC/C;;;;ACIH,MAAa,SACX,SACA,aAC6B;CAC7B,MAAM,eAAe,yBAAyB;CAC9C,MAAM,QAAQA,cAAAA,SAAS,SAAS,UAAU,aAAa;AACvD,QAAO,OAAO,OAAO;EAAE;EAAO,SAAS,aAAa,UAAU;EAAE,CAAC"}
1
+ {"version":3,"file":"integration-BKgGuodm.cjs","names":["readWith"],"sources":["../core/src/access/dependency.ts","../core/src/integration.ts"],"sourcesContent":["import type { ImpactTarget } from '../schema';\nimport * as impactTarget from '../impact-target';\n\nexport type DependencyTracker = {\n readonly record: (target: ImpactTarget<unknown>) => void;\n readonly snapshot: () => readonly ImpactTarget<unknown>[];\n};\n\nexport const createDependencyTracker = (): DependencyTracker => {\n const targets: ImpactTarget<unknown>[] = [];\n return {\n record: value => {\n if (!targets.some(entry => impactTarget.same(entry, value))) targets.push(value);\n },\n snapshot: () => Object.freeze(targets.slice()),\n };\n};\n","import type { ObjectNode, ImpactTarget } from './schema';\nimport type { Read } from './access/scope';\nimport type { DocumentReadable } from './runtime/contract';\nimport { createDependencyTracker } from './access/dependency';\nimport { readWith } from './runtime/access';\nexport { projectionStoreDebug } from './projection/store';\nexport type { AddressRef } from './address';\nexport { contains, debugKey, overlaps, read as readAddress, resolveAddress } from './address';\nexport { subscribeDependencies } from './runtime/notification';\nexport { same as sameTarget } from './impact-target';\nexport type { ImpactTarget } from './schema';\n\nexport type TrackedSelection<TValue> = {\n readonly value: TValue;\n readonly targets: readonly ImpactTarget<unknown>[];\n};\n\n// Framework adapters receive one immutable result instead of coordinating a\n// mutable collector with the reader's scoped lifetime themselves.\nexport const track = <TSchema extends ObjectNode, TValue>(\n runtime: DocumentReadable<TSchema>,\n selector: (read: Read<TSchema>) => TValue\n): TrackedSelection<TValue> => {\n const dependencies = createDependencyTracker();\n const value = readWith(runtime, selector, dependencies);\n return Object.freeze({ value, targets: dependencies.snapshot() });\n};\n"],"mappings":";;AAQA,MAAa,gCAAmD;CAC9D,MAAM,UAAmC,EAAE;AAC3C,QAAO;EACL,SAAQ,UAAS;AACf,OAAI,CAAC,QAAQ,MAAK,UAAA,cAAA,KAA2B,OAAO,MAAM,CAAC,CAAE,SAAQ,KAAK,MAAM;;EAElF,gBAAgB,OAAO,OAAO,QAAQ,OAAO,CAAC;EAC/C;;;;ACIH,MAAa,SACX,SACA,aAC6B;CAC7B,MAAM,eAAe,yBAAyB;CAC9C,MAAM,QAAQA,cAAAA,SAAS,SAAS,UAAU,aAAa;AACvD,QAAO,OAAO,OAAO;EAAE;EAAO,SAAS,aAAa,UAAU;EAAE,CAAC"}
@@ -1,4 +1,4 @@
1
- import { S as same, _ as readWith } from "./store-D7QH6Rzw.js";
1
+ import { S as same, _ as readWith } from "./store-DHFXfWSz.js";
2
2
  //#region core/src/access/dependency.ts
3
3
  const createDependencyTracker = () => {
4
4
  const targets = [];
@@ -22,4 +22,4 @@ const track = (runtime, selector) => {
22
22
  //#endregion
23
23
  export { track as t };
24
24
 
25
- //# sourceMappingURL=integration-D5XCBLJ8.js.map
25
+ //# sourceMappingURL=integration-VTZ3ICsO.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"integration-D5XCBLJ8.js","names":["impactTarget.same"],"sources":["../core/src/access/dependency.ts","../core/src/integration.ts"],"sourcesContent":["import type { ImpactTarget } from '../schema';\nimport * as impactTarget from '../impact-target';\n\nexport type DependencyTracker = {\n readonly record: (target: ImpactTarget<unknown>) => void;\n readonly snapshot: () => readonly ImpactTarget<unknown>[];\n};\n\nexport const createDependencyTracker = (): DependencyTracker => {\n const targets: ImpactTarget<unknown>[] = [];\n return {\n record: value => {\n if (!targets.some(entry => impactTarget.same(entry, value))) targets.push(value);\n },\n snapshot: () => Object.freeze(targets.slice()),\n };\n};\n","import type { ObjectNode, ImpactTarget } from './schema';\nimport type { Read } from './access/scope';\nimport type { DocumentReadable } from './runtime/contract';\nimport { createDependencyTracker } from './access/dependency';\nimport { readWith } from './runtime/access';\nexport { projectionStoreDebug } from './projection/store';\nexport type { AddressRef } from './address';\nexport { contains, debugKey, overlaps, read as readAddress, resolveAddress } from './address';\nexport { subscribeDependencies } from './runtime/notification';\nexport { same as sameTarget } from './impact-target';\nexport type { ImpactTarget } from './schema';\n\nexport type TrackedSelection<TValue> = {\n readonly value: TValue;\n readonly targets: readonly ImpactTarget<unknown>[];\n};\n\n// Framework adapters receive one immutable result instead of coordinating a\n// mutable collector with the reader's scoped lifetime themselves.\nexport const track = <TSchema extends ObjectNode, TValue>(\n runtime: DocumentReadable<TSchema>,\n selector: (read: Read<TSchema>) => TValue\n): TrackedSelection<TValue> => {\n const dependencies = createDependencyTracker();\n const value = readWith(runtime, selector, dependencies);\n return Object.freeze({ value, targets: dependencies.snapshot() });\n};\n"],"mappings":";;AAQA,MAAa,gCAAmD;CAC9D,MAAM,UAAmC,EAAE;AAC3C,QAAO;EACL,SAAQ,UAAS;AACf,OAAI,CAAC,QAAQ,MAAK,UAASA,KAAkB,OAAO,MAAM,CAAC,CAAE,SAAQ,KAAK,MAAM;;EAElF,gBAAgB,OAAO,OAAO,QAAQ,OAAO,CAAC;EAC/C;;;;ACIH,MAAa,SACX,SACA,aAC6B;CAC7B,MAAM,eAAe,yBAAyB;CAC9C,MAAM,QAAQ,SAAS,SAAS,UAAU,aAAa;AACvD,QAAO,OAAO,OAAO;EAAE;EAAO,SAAS,aAAa,UAAU;EAAE,CAAC"}
1
+ {"version":3,"file":"integration-VTZ3ICsO.js","names":["impactTarget.same"],"sources":["../core/src/access/dependency.ts","../core/src/integration.ts"],"sourcesContent":["import type { ImpactTarget } from '../schema';\nimport * as impactTarget from '../impact-target';\n\nexport type DependencyTracker = {\n readonly record: (target: ImpactTarget<unknown>) => void;\n readonly snapshot: () => readonly ImpactTarget<unknown>[];\n};\n\nexport const createDependencyTracker = (): DependencyTracker => {\n const targets: ImpactTarget<unknown>[] = [];\n return {\n record: value => {\n if (!targets.some(entry => impactTarget.same(entry, value))) targets.push(value);\n },\n snapshot: () => Object.freeze(targets.slice()),\n };\n};\n","import type { ObjectNode, ImpactTarget } from './schema';\nimport type { Read } from './access/scope';\nimport type { DocumentReadable } from './runtime/contract';\nimport { createDependencyTracker } from './access/dependency';\nimport { readWith } from './runtime/access';\nexport { projectionStoreDebug } from './projection/store';\nexport type { AddressRef } from './address';\nexport { contains, debugKey, overlaps, read as readAddress, resolveAddress } from './address';\nexport { subscribeDependencies } from './runtime/notification';\nexport { same as sameTarget } from './impact-target';\nexport type { ImpactTarget } from './schema';\n\nexport type TrackedSelection<TValue> = {\n readonly value: TValue;\n readonly targets: readonly ImpactTarget<unknown>[];\n};\n\n// Framework adapters receive one immutable result instead of coordinating a\n// mutable collector with the reader's scoped lifetime themselves.\nexport const track = <TSchema extends ObjectNode, TValue>(\n runtime: DocumentReadable<TSchema>,\n selector: (read: Read<TSchema>) => TValue\n): TrackedSelection<TValue> => {\n const dependencies = createDependencyTracker();\n const value = readWith(runtime, selector, dependencies);\n return Object.freeze({ value, targets: dependencies.snapshot() });\n};\n"],"mappings":";;AAQA,MAAa,gCAAmD;CAC9D,MAAM,UAAmC,EAAE;AAC3C,QAAO;EACL,SAAQ,UAAS;AACf,OAAI,CAAC,QAAQ,MAAK,UAASA,KAAkB,OAAO,MAAM,CAAC,CAAE,SAAQ,KAAK,MAAM;;EAElF,gBAAgB,OAAO,OAAO,QAAQ,OAAO,CAAC;EAC/C;;;;ACIH,MAAa,SACX,SACA,aAC6B;CAC7B,MAAM,eAAe,yBAAyB;CAC9C,MAAM,QAAQ,SAAS,SAAS,UAAU,aAAa;AACvD,QAAO,OAAO,OAAO;EAAE;EAAO,SAAS,aAAa,UAAU;EAAE,CAAC"}
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_issue = require("./issue-DhrNdQNg.cjs");
3
- const require_store = require("./store-1Uob0Ghk.cjs");
4
- const require_integration = require("./integration-C87tjRop.cjs");
3
+ const require_store = require("./store-DU2u-qFH.cjs");
4
+ const require_integration = require("./integration-BKgGuodm.cjs");
5
5
  exports.contains = require_issue.contains;
6
6
  exports.debugKey = require_issue.debugKey;
7
7
  exports.overlaps = require_issue.overlaps;
@@ -1,5 +1,5 @@
1
- import { A as debugKey, J as ImpactTarget, M as read, N as resolveAddress, O as AddressRef, Q as ObjectNode, T as Read, _ as Unsubscribe, j as overlaps, k as contains, s as DocumentReadable, t as CommitListener } from "./contract-CIU5FCC1.cjs";
2
- import { r as projectionStoreDebug } from "./store-CD0KdGsq.cjs";
1
+ import { A as debugKey, J as ImpactTarget, M as read, N as resolveAddress, O as AddressRef, Q as ObjectNode, T as Read, _ as Unsubscribe, j as overlaps, k as contains, s as DocumentReadable, t as CommitListener } from "./contract-DtGVSXSK.cjs";
2
+ import { r as projectionStoreDebug } from "./store-CJuwJl_K.cjs";
3
3
 
4
4
  //#region core/src/impact-target.d.ts
5
5
  declare const same: (left: ImpactTarget<unknown>, right: ImpactTarget<unknown>) => boolean;
@@ -1,5 +1,5 @@
1
- import { A as debugKey, J as ImpactTarget, M as read, N as resolveAddress, O as AddressRef, Q as ObjectNode, T as Read, _ as Unsubscribe, j as overlaps, k as contains, s as DocumentReadable, t as CommitListener } from "./contract-BNStLbSE.js";
2
- import { r as projectionStoreDebug } from "./store-cp5CpfCy.js";
1
+ import { A as debugKey, J as ImpactTarget, M as read, N as resolveAddress, O as AddressRef, Q as ObjectNode, T as Read, _ as Unsubscribe, j as overlaps, k as contains, s as DocumentReadable, t as CommitListener } from "./contract-CeAnEPBA.js";
2
+ import { r as projectionStoreDebug } from "./store-Bs0C0rNd.js";
3
3
 
4
4
  //#region core/src/impact-target.d.ts
5
5
  declare const same: (left: ImpactTarget<unknown>, right: ImpactTarget<unknown>) => boolean;
@@ -1,4 +1,4 @@
1
1
  import { c as debugKey, d as overlaps, f as read, o as contains, p as resolveAddress } from "./issue-DVaGQGeP.js";
2
- import { S as same, f as subscribeDependencies, n as projectionStoreDebug } from "./store-D7QH6Rzw.js";
3
- import { t as track } from "./integration-D5XCBLJ8.js";
2
+ import { S as same, f as subscribeDependencies, n as projectionStoreDebug } from "./store-DHFXfWSz.js";
3
+ import { t as track } from "./integration-VTZ3ICsO.js";
4
4
  export { contains, debugKey, overlaps, projectionStoreDebug, read as readAddress, resolveAddress, same as sameTarget, subscribeDependencies, track };
@@ -1,4 +1,4 @@
1
- import { Q as ObjectNode, l as DocumentRuntime, v as Readable } from "./contract-CIU5FCC1.cjs";
1
+ import { Q as ObjectNode, l as DocumentRuntime, v as Readable } from "./contract-DtGVSXSK.cjs";
2
2
 
3
3
  //#region core/src/local-sync/json.d.ts
4
4
  type JsonPrimitive = null | boolean | number | string;
@@ -1,4 +1,4 @@
1
- import { Q as ObjectNode, l as DocumentRuntime, v as Readable } from "./contract-BNStLbSE.js";
1
+ import { Q as ObjectNode, l as DocumentRuntime, v as Readable } from "./contract-CeAnEPBA.js";
2
2
 
3
3
  //#region core/src/local-sync/json.d.ts
4
4
  type JsonPrimitive = null | boolean | number | string;
package/dist/react.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_store = require("./store-1Uob0Ghk.cjs");
3
- const require_integration = require("./integration-C87tjRop.cjs");
2
+ const require_store = require("./store-DU2u-qFH.cjs");
3
+ const require_integration = require("./integration-BKgGuodm.cjs");
4
4
  let react = require("react");
5
5
  //#region react/src/hooks.ts
6
6
  const ProjectionContext = (0, react.createContext)(void 0);
package/dist/react.js CHANGED
@@ -1,5 +1,5 @@
1
- import { S as same, f as subscribeDependencies } from "./store-D7QH6Rzw.js";
2
- import { t as track } from "./integration-D5XCBLJ8.js";
1
+ import { S as same, f as subscribeDependencies } from "./store-DHFXfWSz.js";
2
+ import { t as track } from "./integration-VTZ3ICsO.js";
3
3
  import { createContext, useCallback, useContext, useMemo, useRef, useSyncExternalStore } from "react";
4
4
  //#region react/src/hooks.ts
5
5
  const ProjectionContext = createContext(void 0);
@@ -1,4 +1,4 @@
1
- import { B as CollectionPath, C as CollectionAccess, Q as ObjectNode, R as CollectionId, T as Read, _ as Unsubscribe, m as Synchronous, ot as ValueSchemaNode, r as DocumentCommit, rt as SchemaPath, s as DocumentReadable, tt as PathPick, v as Readable, x as CollectionImpact, z as CollectionNode } from "./contract-BNStLbSE.js";
1
+ import { B as CollectionPath, C as CollectionAccess, Q as ObjectNode, R as CollectionId, T as Read, _ as Unsubscribe, m as Synchronous, ot as ValueSchemaNode, r as DocumentCommit, rt as SchemaPath, s as DocumentReadable, tt as PathPick, v as Readable, x as CollectionImpact, z as CollectionNode } from "./contract-CeAnEPBA.js";
2
2
 
3
3
  //#region core/src/projection/contract.d.ts
4
4
  declare const sourceContext: unique symbol;
@@ -259,4 +259,4 @@ declare const createProjectionStore: (options: {
259
259
  }) => ProjectionStore;
260
260
  //#endregion
261
261
  export { ProjectionDisposedError as C, project as S, ProjectionSources as _, AdvancedCollectionSpec as a, ValueProjection as b, CollectionProjection as c, DocumentCollectionProjection as d, DocumentEvent as f, ProjectionEvents as g, Projection as h, AdvancedCollectionProcess as i, CollectionSource as l, InputProjection as m, createProjectionStore as n, AdvancedValueSpec as o, DocumentProjection as p, projectionStoreDebug as r, CollectionEvent as s, ProjectionStore as t, DocumentCollectionEvent as u, ProjectionValues as v, ProjectionError as w, input as x, ValueEvent as y };
262
- //# sourceMappingURL=store-cp5CpfCy.d.ts.map
262
+ //# sourceMappingURL=store-Bs0C0rNd.d.ts.map
@@ -1,4 +1,4 @@
1
- import { B as CollectionPath, C as CollectionAccess, Q as ObjectNode, R as CollectionId, T as Read, _ as Unsubscribe, m as Synchronous, ot as ValueSchemaNode, r as DocumentCommit, rt as SchemaPath, s as DocumentReadable, tt as PathPick, v as Readable, x as CollectionImpact, z as CollectionNode } from "./contract-CIU5FCC1.cjs";
1
+ import { B as CollectionPath, C as CollectionAccess, Q as ObjectNode, R as CollectionId, T as Read, _ as Unsubscribe, m as Synchronous, ot as ValueSchemaNode, r as DocumentCommit, rt as SchemaPath, s as DocumentReadable, tt as PathPick, v as Readable, x as CollectionImpact, z as CollectionNode } from "./contract-DtGVSXSK.cjs";
2
2
 
3
3
  //#region core/src/projection/contract.d.ts
4
4
  declare const sourceContext: unique symbol;
@@ -259,4 +259,4 @@ declare const createProjectionStore: (options: {
259
259
  }) => ProjectionStore;
260
260
  //#endregion
261
261
  export { ProjectionDisposedError as C, project as S, ProjectionSources as _, AdvancedCollectionSpec as a, ValueProjection as b, CollectionProjection as c, DocumentCollectionProjection as d, DocumentEvent as f, ProjectionEvents as g, Projection as h, AdvancedCollectionProcess as i, CollectionSource as l, InputProjection as m, createProjectionStore as n, AdvancedValueSpec as o, DocumentProjection as p, projectionStoreDebug as r, CollectionEvent as s, ProjectionStore as t, DocumentCollectionEvent as u, ProjectionValues as v, ProjectionError as w, input as x, ValueEvent as y };
262
- //# sourceMappingURL=store-CD0KdGsq.d.cts.map
262
+ //# sourceMappingURL=store-CJuwJl_K.d.cts.map