doxum 0.1.21 → 0.1.23

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 (72) hide show
  1. package/README.md +35 -7
  2. package/dist/{advanced-FgdTwu5b.d.ts → advanced-CLJCWkHa.d.cts} +3 -3
  3. package/dist/{advanced-COFJtWMT.js → advanced-CRNHfJBu.js} +482 -446
  4. package/dist/advanced-CRNHfJBu.js.map +1 -0
  5. package/dist/{advanced-BRL5pN0y.cjs → advanced-Cle5g3B4.cjs} +615 -459
  6. package/dist/advanced-Cle5g3B4.cjs.map +1 -0
  7. package/dist/{advanced-DfKc7TZR.d.cts → advanced-d6J61er9.d.ts} +3 -3
  8. package/dist/advanced.cjs +1 -1
  9. package/dist/advanced.d.cts +1 -1
  10. package/dist/advanced.d.ts +1 -1
  11. package/dist/advanced.js +1 -1
  12. package/dist/context-BcLKGfq8.cjs +149 -0
  13. package/dist/context-BcLKGfq8.cjs.map +1 -0
  14. package/dist/context-DFEaDUv5.js +84 -0
  15. package/dist/context-DFEaDUv5.js.map +1 -0
  16. package/dist/{contract-CdmDHRUq.d.cts → contract-SYJFP0lM.d.cts} +62 -88
  17. package/dist/{contract-KG5XnQZt.d.ts → contract-ULPQmiEs.d.ts} +62 -88
  18. package/dist/driver-BD3DQOW6.cjs +382 -0
  19. package/dist/driver-BD3DQOW6.cjs.map +1 -0
  20. package/dist/{driver-CLYJOGDQ.js → driver-yFfvDMX5.js} +155 -26
  21. package/dist/driver-yFfvDMX5.js.map +1 -0
  22. package/dist/index.cjs +2370 -406
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.cts +6 -5
  25. package/dist/index.d.ts +6 -5
  26. package/dist/index.js +2293 -330
  27. package/dist/index.js.map +1 -1
  28. package/dist/local-sync.cjs +5 -5
  29. package/dist/local-sync.cjs.map +1 -1
  30. package/dist/local-sync.d.cts +1 -1
  31. package/dist/local-sync.d.ts +1 -1
  32. package/dist/local-sync.js +2 -2
  33. package/dist/local-sync.js.map +1 -1
  34. package/dist/react.cjs +2 -69
  35. package/dist/react.cjs.map +1 -1
  36. package/dist/react.d.cts +0 -1
  37. package/dist/react.d.ts +1 -2
  38. package/dist/react.js +3 -70
  39. package/dist/react.js.map +1 -1
  40. package/package.json +1 -6
  41. package/skills/doxum-runtime/SKILL.md +7 -1
  42. package/skills/doxum-runtime/references/guide.en.md +17 -6
  43. package/skills/doxum-runtime/references/guide.zh-CN.md +15 -5
  44. package/skills/doxum-runtime/references/invariants.en.md +5 -3
  45. package/skills/doxum-runtime/references/invariants.zh-CN.md +4 -3
  46. package/skills/doxum-runtime/references/projections.en.md +5 -0
  47. package/skills/doxum-runtime/references/projections.zh-CN.md +5 -0
  48. package/dist/access-BeSV5ve-.js +0 -816
  49. package/dist/access-BeSV5ve-.js.map +0 -1
  50. package/dist/access-Bienf28h.cjs +0 -911
  51. package/dist/access-Bienf28h.cjs.map +0 -1
  52. package/dist/advanced-BRL5pN0y.cjs.map +0 -1
  53. package/dist/advanced-COFJtWMT.js.map +0 -1
  54. package/dist/driver-CLYJOGDQ.js.map +0 -1
  55. package/dist/driver-Djr3BVvo.cjs +0 -241
  56. package/dist/driver-Djr3BVvo.cjs.map +0 -1
  57. package/dist/integration-C4Isp8lJ.js +0 -26
  58. package/dist/integration-C4Isp8lJ.js.map +0 -1
  59. package/dist/integration-Z6MsfFI7.cjs +0 -31
  60. package/dist/integration-Z6MsfFI7.cjs.map +0 -1
  61. package/dist/integration.cjs +0 -12
  62. package/dist/integration.d.cts +0 -17
  63. package/dist/integration.d.ts +0 -17
  64. package/dist/integration.js +0 -4
  65. package/dist/issue-DjK1xp5K.cjs +0 -881
  66. package/dist/issue-DjK1xp5K.cjs.map +0 -1
  67. package/dist/issue-W0hT8u8D.js +0 -642
  68. package/dist/issue-W0hT8u8D.js.map +0 -1
  69. package/dist/notification-Bkjau6B6.js +0 -232
  70. package/dist/notification-Bkjau6B6.js.map +0 -1
  71. package/dist/notification-DJfouMEb.cjs +0 -309
  72. package/dist/notification-DJfouMEb.cjs.map +0 -1
@@ -1,5 +1,404 @@
1
- import { B as profile } from "./issue-W0hT8u8D.js";
2
- import { f as checkKey, t as accessOf } from "./access-BeSV5ve-.js";
1
+ import { c as validate, d as isRecord, n as contextOf, u as isPlainObject } from "./context-DFEaDUv5.js";
2
+ const profile = {
3
+ projection: (key, amount = 1) => {},
4
+ recorder: (key, amount = 1) => {},
5
+ access: (key) => {},
6
+ copy: {
7
+ structure: () => {},
8
+ treeNode: () => {},
9
+ shallowRecord: (items) => {}
10
+ },
11
+ equality: {
12
+ call: () => {},
13
+ container: () => {}
14
+ },
15
+ address: {
16
+ listIndex: (items) => {},
17
+ schemaStep: () => {},
18
+ documentStep: () => {},
19
+ prefixComparison: () => {},
20
+ segmentCompared: () => {}
21
+ },
22
+ impact: {
23
+ index: () => {},
24
+ affects: () => {}
25
+ },
26
+ collectionIndex: {
27
+ node: () => {},
28
+ build: (items) => {}
29
+ },
30
+ collectionView: {
31
+ mapped: () => {},
32
+ idsScanned: (amount = 1) => {},
33
+ arrayCopied: () => {}
34
+ },
35
+ materialized: {
36
+ updated: () => {},
37
+ rebuilt: () => {},
38
+ notification: () => {}
39
+ }
40
+ };
41
+ //#endregion
42
+ //#region core/src/order/sequence.ts
43
+ const length = (keys) => keys.length;
44
+ const keyAt = (keys, index) => Array.isArray(keys) ? keys[index] : keys.at(index);
45
+ const equal = (left, right) => {
46
+ profile.equality.call();
47
+ if (left === right) return true;
48
+ profile.equality.container();
49
+ if (left.length !== right.length) return false;
50
+ for (let index = 0; index < left.length; index++) if (left[index] !== keyAt(right, index)) return false;
51
+ return true;
52
+ };
53
+ const keys = (values, keyOf) => ({
54
+ length: values.length,
55
+ at: (index) => index >= 0 && index < values.length ? keyOf(values[index]) : void 0,
56
+ index: (key) => {
57
+ for (let index = 0; index < values.length; index += 1) if (keyOf(values[index]) === key) return index;
58
+ return -1;
59
+ }
60
+ });
61
+ const listIndexes = /* @__PURE__ */ new WeakMap();
62
+ const knownKeys = (values) => {
63
+ let positions;
64
+ return {
65
+ length: values.length,
66
+ at: (index) => values[index],
67
+ index: (key) => {
68
+ if (!positions) {
69
+ positions = /* @__PURE__ */ new Map();
70
+ for (let index = 0; index < values.length; index++) positions.set(values[index], index);
71
+ profile.address.listIndex(values.length);
72
+ }
73
+ return positions.get(key) ?? -1;
74
+ }
75
+ };
76
+ };
77
+ const cacheKnownKeys = (values, keyOf, order) => {
78
+ listIndexes.set(values, {
79
+ keyOf,
80
+ order: knownKeys(order)
81
+ });
82
+ };
83
+ /** Canonical lists keep their key positions until a structural write invalidates them. */
84
+ const indexedKeys = (values, keyOf) => {
85
+ const cached = listIndexes.get(values);
86
+ if (cached?.keyOf === keyOf) return cached.order;
87
+ let positions;
88
+ const order = {
89
+ length: values.length,
90
+ at: (index) => index >= 0 && index < values.length ? keyOf(values[index]) : void 0,
91
+ index: (key) => {
92
+ if (!positions) {
93
+ positions = /* @__PURE__ */ new Map();
94
+ for (let index = 0; index < values.length; index++) positions.set(keyOf(values[index]), index);
95
+ profile.address.listIndex(values.length);
96
+ }
97
+ return positions.get(key) ?? -1;
98
+ }
99
+ };
100
+ listIndexes.set(values, {
101
+ keyOf,
102
+ order
103
+ });
104
+ return order;
105
+ };
106
+ const toArray = (keys) => {
107
+ const result = new Array(length(keys));
108
+ for (let index = 0; index < result.length; index++) result[index] = keyAt(keys, index);
109
+ return result;
110
+ };
111
+ /** One operation-local list scan provides both stable keys and item association. */
112
+ const listSequence = (values, keyOf) => {
113
+ const current = indexedKeys(values, keyOf);
114
+ const order = new Array(values.length);
115
+ const byKey = /* @__PURE__ */ new Map();
116
+ for (let index = 0; index < values.length; index++) {
117
+ const key = current.at(index);
118
+ order[index] = key;
119
+ byKey.set(key, values[index]);
120
+ }
121
+ cacheKnownKeys(values, keyOf, order);
122
+ return {
123
+ order,
124
+ values: byKey
125
+ };
126
+ };
127
+ /** Structural sequence writes own invalidation, including rollback writes. */
128
+ const insert = (values, index, value) => {
129
+ values.splice(index, 0, value);
130
+ listIndexes.delete(values);
131
+ };
132
+ const remove = (values, index) => {
133
+ values.splice(index, 1);
134
+ listIndexes.delete(values);
135
+ };
136
+ /** Installs an exact string-key sequence such as table ids in one structural write. */
137
+ const installKeys = (values, order) => {
138
+ values.length = order.length;
139
+ for (let index = 0; index < order.length; index++) values[index] = order[index];
140
+ };
141
+ /** Installs a pre-resolved list sequence without running keyOf again. */
142
+ const installList = (values, keyOf, sequence, order) => {
143
+ values.length = order.length;
144
+ for (let index = 0; index < order.length; index++) values[index] = sequence.values.get(order[index]);
145
+ cacheKnownKeys(values, keyOf, order);
146
+ };
147
+ const install = (values, keyOf, order) => {
148
+ installList(values, keyOf, listSequence(values, keyOf), order);
149
+ };
150
+ const matches = (order, members) => {
151
+ if (order.length !== members.length) return false;
152
+ const ids = new Set(order);
153
+ return ids.size === order.length && members.every((id) => ids.has(id));
154
+ };
155
+ //#endregion
156
+ //#region core/src/schema/layout.ts
157
+ const compiledObjects = /* @__PURE__ */ new WeakMap();
158
+ const compiledEntries = /* @__PURE__ */ new WeakMap();
159
+ const objectBranch = (node, value) => {
160
+ if (node.kind === "object") return node;
161
+ if (node.kind !== "variant" || typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
162
+ const record = value;
163
+ const tag = typeof record[node.tag] === "string" ? record[node.tag] : void 0;
164
+ return node.variants[String(tag ?? Object.keys(node.variants)[0] ?? "")];
165
+ };
166
+ const compiledShape = (node, value) => {
167
+ const branch = objectBranch(node, value);
168
+ if (!branch) return void 0;
169
+ const shape = branch.shape;
170
+ let layout = compiledObjects.get(shape);
171
+ if (!layout) {
172
+ const members = /* @__PURE__ */ new Map();
173
+ for (const key of Object.keys(shape).sort()) {
174
+ profile.address.schemaStep();
175
+ members.set(key, {
176
+ kind: "fixed",
177
+ key,
178
+ node: shape[key],
179
+ field: shape[key].kind === "field",
180
+ slot: members.size
181
+ });
182
+ }
183
+ layout = {
184
+ kind: "fixed",
185
+ members
186
+ };
187
+ compiledObjects.set(shape, layout);
188
+ }
189
+ return layout;
190
+ };
191
+ const compiledLayout = (node, value) => {
192
+ if (node.kind !== "map" && node.kind !== "table" && node.kind !== "list") return compiledShape(node, value);
193
+ let layout = compiledEntries.get(node);
194
+ if (!layout) {
195
+ layout = {
196
+ kind: "dynamic",
197
+ entry: {
198
+ kind: "entry",
199
+ node: node.value,
200
+ field: node.value.kind === "field"
201
+ }
202
+ };
203
+ compiledEntries.set(node, layout);
204
+ }
205
+ return layout;
206
+ };
207
+ //#endregion
208
+ //#region core/src/schema/value.ts
209
+ var ParseError = class extends TypeError {
210
+ issues;
211
+ constructor(issue) {
212
+ super(`${issue.message} at ${JSON.stringify(issue.address)}`);
213
+ this.name = "ParseError";
214
+ this.issues = Object.freeze([Object.freeze({
215
+ ...issue,
216
+ address: Object.freeze([...issue.address])
217
+ })]);
218
+ }
219
+ };
220
+ const issue = (address, message, code = "invalid-value") => ({
221
+ address,
222
+ message,
223
+ code
224
+ });
225
+ const checkScalar = (validator, value, address, strict) => {
226
+ if (!validator) return strict ? issue(address, "A validator is required to parse an opaque value.", "missing-validator") : void 0;
227
+ try {
228
+ const result = typeof validator === "function" ? validator(value) : validator["~standard"].validate(value);
229
+ if (result && (typeof result === "object" || typeof result === "function") && "then" in result && typeof result.then === "function") return issue(address, "Validators must be synchronous.");
230
+ if (typeof validator !== "function") {
231
+ if (!isRecord(result)) return issue(address, "Malformed validator result.");
232
+ if (Array.isArray(result.issues)) {
233
+ const first = result.issues[0];
234
+ return issue([...address, ...(first?.path ?? []).map((part) => String(typeof part === "object" ? part.key : part))], first?.message ?? "Value validation failed.");
235
+ }
236
+ if (!Object.hasOwn(result, "value")) return issue(address, "Malformed validator result.");
237
+ }
238
+ return;
239
+ } catch (error) {
240
+ return issue(address, error instanceof Error ? error.message : "Value validation failed.");
241
+ }
242
+ };
243
+ const checkKey = (validator, value, address) => {
244
+ if (typeof value !== "string") return issue(address, "Collection keys must be strings.", "invalid-key");
245
+ const failure = checkScalar(validator, value, address, false);
246
+ return failure ? {
247
+ ...failure,
248
+ code: "invalid-key"
249
+ } : void 0;
250
+ };
251
+ const checkValue = (node, value, address = [], strict = false) => {
252
+ if (node.optional && value === void 0) return void 0;
253
+ if (node.kind === "field") return checkScalar(node.validator, value, address, strict);
254
+ if (node.kind === "object" || node.kind === "variant") {
255
+ if (!isPlainObject(value)) return issue(address, "Expected an object.");
256
+ if (node.kind === "variant") {
257
+ const tag = value[node.tag];
258
+ if (!Object.hasOwn(value, node.tag) || typeof tag !== "string" || !Object.hasOwn(node.variants, tag)) return issue([...address, node.tag], "Unknown variant tag.");
259
+ }
260
+ const { members } = compiledShape(node, value);
261
+ for (const key of Reflect.ownKeys(value)) {
262
+ if (node.kind === "variant" && key === node.tag) continue;
263
+ if (typeof key !== "string" || !members.has(key)) return issue([...address, String(key)], "Property is not declared in the object schema.");
264
+ }
265
+ for (const [key, member] of members) {
266
+ const child = member.node;
267
+ if (!Object.prototype.hasOwnProperty.call(value, key) && !child.optional) return issue([...address, key], "Required property is missing.");
268
+ const failure = checkValue(child, value[key], [...address, key], strict);
269
+ if (failure) return failure;
270
+ }
271
+ return;
272
+ }
273
+ if (node.kind === "table" || node.kind === "map") {
274
+ if (!isPlainObject(value)) return issue(address, "Expected a collection object.");
275
+ const entries = node.kind === "table" ? value.byId : value;
276
+ if (!isPlainObject(entries)) return issue(address, "Expected a byId object.");
277
+ if (node.kind === "table") {
278
+ if (!Array.isArray(value.ids) || value.ids.length !== Object.keys(entries).length) return issue(address, "Table ids and entries must agree.");
279
+ const seen = /* @__PURE__ */ new Set();
280
+ for (const id of value.ids) {
281
+ const failure = checkKey(node.key, id, address);
282
+ if (failure) return failure;
283
+ if (seen.has(id) || !Object.prototype.hasOwnProperty.call(entries, id)) return issue(address, "Table ids must be unique and reference existing entries.");
284
+ seen.add(id);
285
+ }
286
+ }
287
+ for (const id of Object.keys(entries)) {
288
+ const failure = checkKey(node.key, id, [...address, id]) ?? checkValue(node.value, entries[id], [...address, id], strict);
289
+ if (failure) return failure;
290
+ }
291
+ return;
292
+ }
293
+ if (node.kind === "list") {
294
+ if (!Array.isArray(value)) return issue(address, "Expected a list.");
295
+ const seen = /* @__PURE__ */ new Set();
296
+ const order = keys(value, node.keyOf);
297
+ for (let i = 0; i < value.length; i++) {
298
+ const failure = checkValue(node.value, value[i], [...address, String(i)], strict);
299
+ if (failure) return failure;
300
+ let key;
301
+ try {
302
+ key = order.at(i);
303
+ } catch {
304
+ return issue(address, "List keyOf failed.");
305
+ }
306
+ if (typeof key !== "string" || seen.has(key)) return issue(address, "List keys must be unique strings.", "invalid-key");
307
+ seen.add(key);
308
+ }
309
+ return;
310
+ }
311
+ if (!validate(value)) return issue(address, "Invalid tree structure.", "invalid-tree");
312
+ for (const id of Object.keys(value.nodes)) {
313
+ const failure = checkTreePayload(node.value, value.nodes[id], [...address, id], strict);
314
+ if (failure) return failure;
315
+ }
316
+ };
317
+ const checkTreePayload = (node, value, address, strict = false) => {
318
+ if (!isRecord(value)) return issue(address, "Invalid tree node.", "invalid-tree");
319
+ const present = Object.prototype.hasOwnProperty.call(value, "value");
320
+ if (!present && !node.optional) return issue(address, "Tree node value is required.");
321
+ return present ? checkValue(node, value.value, address, strict) : void 0;
322
+ };
323
+ const copyTreeNode = (value) => {
324
+ profile.copy.treeNode();
325
+ return {
326
+ ...value,
327
+ children: [...value.children]
328
+ };
329
+ };
330
+ const equalTreeNode = (left, right) => {
331
+ if (left === right) return true;
332
+ if (!left || !right) return false;
333
+ return left.parentId === right.parentId && equal(left.children, right.children) && Object.hasOwn(left, "value") === Object.hasOwn(right, "value") && Object.is(left.value, right.value);
334
+ };
335
+ /** Copy editable structure; atomic payloads retain their immutable ownership contract. */
336
+ const copyValue = (node, value) => {
337
+ if (value === void 0 || node.kind === "field") return value;
338
+ profile.copy.structure();
339
+ if ((node.kind === "object" || node.kind === "variant") && isRecord(value)) {
340
+ const result = Object.create(Object.getPrototypeOf(value));
341
+ const { members } = compiledShape(node, value);
342
+ for (const key of Object.getOwnPropertyNames(value)) Object.defineProperty(result, key, {
343
+ value: node.kind === "variant" && key === node.tag ? value[key] : copyValue(members.get(key).node, value[key]),
344
+ writable: true,
345
+ enumerable: Object.getOwnPropertyDescriptor(value, key)?.enumerable,
346
+ configurable: true
347
+ });
348
+ return result;
349
+ }
350
+ if ((node.kind === "table" || node.kind === "map") && isRecord(value)) {
351
+ const entries = node.kind === "table" ? value.byId : value;
352
+ const result = Object.fromEntries(Object.keys(entries).map((id) => [id, copyValue(node.value, entries[id])]));
353
+ return node.kind === "table" ? {
354
+ ids: [...value.ids],
355
+ byId: result
356
+ } : result;
357
+ }
358
+ if (node.kind === "list") return [...value];
359
+ if (node.kind === "tree" && isRecord(value)) {
360
+ const entries = value.nodes;
361
+ return {
362
+ ...value,
363
+ nodes: Object.fromEntries(Object.entries(entries).map(([id, n]) => [id, copyTreeNode(n)]))
364
+ };
365
+ }
366
+ return value;
367
+ };
368
+ const equalValue = (node, left, right) => {
369
+ if (Object.is(left, right)) return true;
370
+ if (node.kind === "field" || left === void 0 || right === void 0) return false;
371
+ if ((node.kind === "object" || node.kind === "variant") && isRecord(left) && isRecord(right)) {
372
+ if (node.kind === "variant" && left[node.tag] !== right[node.tag]) return false;
373
+ for (const [key, member] of compiledShape(node, left).members) {
374
+ if (Object.hasOwn(left, key) !== Object.hasOwn(right, key)) return false;
375
+ if (!equalValue(member.node, left[key], right[key])) return false;
376
+ }
377
+ return true;
378
+ }
379
+ if (node.kind === "list" && Array.isArray(left) && Array.isArray(right)) return left.length === right.length && left.every((v, i) => equalValue(node.value, v, right[i]));
380
+ if (node.kind === "table" && isRecord(left) && isRecord(right)) return equal(left.ids, right.ids) && equalValue({
381
+ kind: "map",
382
+ value: node.value
383
+ }, left.byId, right.byId);
384
+ if (node.kind === "tree" && isRecord(left) && isRecord(right)) {
385
+ if (left.rootId !== right.rootId) return false;
386
+ const a = left.nodes, b = right.nodes;
387
+ return Object.keys(a).length === Object.keys(b).length && Object.keys(a).every((id) => Object.hasOwn(b, id) && equalTreeNode(a[id], b[id]));
388
+ }
389
+ if (node.kind === "map" && isRecord(left) && isRecord(right)) {
390
+ const keys = Object.keys(left);
391
+ return keys.length === Object.keys(right).length && keys.every((key) => Object.hasOwn(right, key) && equalValue(node.value, left[key], right[key]));
392
+ }
393
+ return false;
394
+ };
395
+ const parse = (node, input) => {
396
+ const valueNode = node;
397
+ const failure = checkValue(valueNode, input, [], true);
398
+ if (failure) throw new ParseError(failure);
399
+ return copyValue(valueNode, input);
400
+ };
401
+ //#endregion
3
402
  //#region core/src/schema.ts
4
403
  const collectionEntryNode = (node) => node.kind === "map" || node.kind === "table" || node.kind === "list" ? node.value : void 0;
5
404
  const node = (value) => Object.freeze(value);
@@ -44,14 +443,25 @@ const list = (value, config) => node({
44
443
  keyOf: config.keyOf,
45
444
  value
46
445
  });
47
- const tree = (value) => node({
446
+ const tree = (value) => Object.freeze({
48
447
  kind: "tree",
49
448
  value
50
449
  });
51
450
  const paths = /* @__PURE__ */ new WeakMap();
52
- const pathProxy = (nodes, address, owner) => {
451
+ const pathProxy = (nodes, address, owner, treeSelection) => {
53
452
  const proxy = new Proxy({}, { get: (_target, property) => {
54
453
  if (typeof property !== "string") return void 0;
454
+ const trees = nodes.every((node) => node.kind === "tree");
455
+ if (!treeSelection && trees && property === "rootId") return pathProxy(nodes, address, owner, { kind: "root" });
456
+ if (!treeSelection && trees && property === "nodes") return pathProxy(nodes, address, owner, { kind: "nodes" });
457
+ if (treeSelection?.kind === "nodes" && property === "item") return (id) => {
458
+ if (typeof id !== "string") throw new TypeError("Tree node keys must be strings.");
459
+ return pathProxy(nodes, address, owner, {
460
+ kind: "node",
461
+ id
462
+ });
463
+ };
464
+ if (treeSelection) throw new TypeError(`Invalid tree path segment: ${property}`);
55
465
  if (nodes.every((node) => collectionEntryNode(node) !== void 0) && property === "item") return (id) => {
56
466
  if (typeof id !== "string") throw new TypeError("Collection keys must be strings.");
57
467
  for (const node of nodes) if (node.kind === "table" || node.kind === "map") {
@@ -72,7 +482,8 @@ const pathProxy = (nodes, address, owner) => {
72
482
  paths.set(proxy, {
73
483
  nodes,
74
484
  address,
75
- owner
485
+ owner,
486
+ ...treeSelection ? { tree: treeSelection } : {}
76
487
  });
77
488
  return proxy;
78
489
  };
@@ -81,15 +492,55 @@ const compilePath = (owner, kind, pick) => {
81
492
  const value = pick(pathProxy([owner], [], scope));
82
493
  const selected = typeof value === "object" && value !== null ? paths.get(value) : void 0;
83
494
  if (!selected || selected.owner !== scope) throw new TypeError("Selector must return a path from its callback.");
84
- const collection = selected.nodes.every((node) => collectionEntryNode(node) !== void 0);
85
- if (kind === "collection" && !collection) throw new TypeError("Collection selectors require a map, table or list path.");
495
+ const collection = selected.tree?.kind === "nodes" || selected.nodes.every((node) => collectionEntryNode(node) !== void 0);
496
+ if (kind === "collection" && !collection) throw new TypeError("Collection selectors require a map, table, list or tree nodes path.");
86
497
  return Object.freeze({
87
498
  kind: kind === "auto" ? collection ? "collection" : "value" : kind,
88
499
  schema: owner,
89
- address: Object.freeze([...selected.address])
500
+ address: Object.freeze([...selected.address]),
501
+ ...selected.tree ? { tree: Object.freeze({ ...selected.tree }) } : {}
90
502
  });
91
503
  };
92
504
  //#endregion
505
+ //#region core/src/projection/collection/view.ts
506
+ const mapRead = (value) => ({
507
+ get: (key) => value.get(key),
508
+ has: (key) => value.has(key),
509
+ ids: () => Object.freeze([...value.keys()])
510
+ });
511
+ /** Immutable map-like view over a CollectionRead. */
512
+ const collectionView = (read) => {
513
+ const ids = read.ids();
514
+ const entries = function* () {
515
+ for (const key of ids) yield [key, read.get(key)];
516
+ };
517
+ const values = function* () {
518
+ for (const key of ids) yield read.get(key);
519
+ };
520
+ const view = {
521
+ get: (key) => read.get(key),
522
+ has: (key) => read.has(key),
523
+ get size() {
524
+ return ids.length;
525
+ },
526
+ keys: () => ids[Symbol.iterator](),
527
+ values,
528
+ entries,
529
+ forEach: (callback, thisArg) => {
530
+ for (const key of ids) callback.call(thisArg, read.get(key), key, view);
531
+ },
532
+ [Symbol.iterator]: entries
533
+ };
534
+ return Object.freeze(view);
535
+ };
536
+ /** Eager durable view used when a processor result may retain its dependency value. */
537
+ const snapshotCollectionView = (read) => {
538
+ const ids = read.ids();
539
+ const values = /* @__PURE__ */ new Map();
540
+ for (const key of ids) values.set(key, read.get(key));
541
+ return collectionView(mapRead(values));
542
+ };
543
+ //#endregion
93
544
  //#region core/src/projection/contract.ts
94
545
  var ProjectionError = class extends Error {
95
546
  constructor(phase, identity, revisions, cause) {
@@ -107,7 +558,7 @@ var ProjectionDisposedError = class extends Error {
107
558
  }
108
559
  };
109
560
  //#endregion
110
- //#region core/src/projection/scheduler.ts
561
+ //#region core/src/projection/graph/scheduler.ts
111
562
  const createScheduler = (onError) => {
112
563
  let disposed = false;
113
564
  let depth = 0;
@@ -443,408 +894,6 @@ const assertScope = (active) => {
443
894
  if (!active()) throw new Error("Projection reader or writer is no longer active.");
444
895
  };
445
896
  //#endregion
446
- //#region core/src/projection/collection-output.ts
447
- const height = (node) => node?.height ?? 0;
448
- const makeTreeNode = (key, value, left, right) => Object.freeze({
449
- key,
450
- value,
451
- left,
452
- right,
453
- height: Math.max(height(left), height(right)) + 1
454
- });
455
- const rotateLeft = (node) => {
456
- const right = node.right;
457
- return makeTreeNode(right.key, right.value, makeTreeNode(node.key, node.value, node.left, right.left), right.right);
458
- };
459
- const rotateRight = (node) => {
460
- const left = node.left;
461
- return makeTreeNode(left.key, left.value, left.left, makeTreeNode(node.key, node.value, left.right, node.right));
462
- };
463
- const rebalance = (node) => {
464
- const balance = height(node.left) - height(node.right);
465
- if (balance > 1) {
466
- if (height(node.left.left) < height(node.left.right)) return rotateRight(makeTreeNode(node.key, node.value, rotateLeft(node.left), node.right));
467
- return rotateRight(node);
468
- }
469
- if (balance < -1) {
470
- if (height(node.right.right) < height(node.right.left)) return rotateLeft(makeTreeNode(node.key, node.value, node.left, rotateRight(node.right)));
471
- return rotateLeft(node);
472
- }
473
- return node;
474
- };
475
- const treeSet = (node, key, value) => {
476
- if (!node) return makeTreeNode(key, value);
477
- if (key === node.key) return makeTreeNode(key, value, node.left, node.right);
478
- if (key < node.key) return rebalance(makeTreeNode(node.key, node.value, treeSet(node.left, key, value), node.right));
479
- return rebalance(makeTreeNode(node.key, node.value, node.left, treeSet(node.right, key, value)));
480
- };
481
- const treeMin = (node) => node.left ? treeMin(node.left) : node;
482
- const treeRemove = (node, key) => {
483
- if (!node) return void 0;
484
- if (key < node.key) return rebalance(makeTreeNode(node.key, node.value, treeRemove(node.left, key), node.right));
485
- if (key > node.key) return rebalance(makeTreeNode(node.key, node.value, node.left, treeRemove(node.right, key)));
486
- if (!node.left) return node.right;
487
- if (!node.right) return node.left;
488
- const next = treeMin(node.right);
489
- return rebalance(makeTreeNode(next.key, next.value, node.left, treeRemove(node.right, next.key)));
490
- };
491
- const treeGet = (node, key) => {
492
- let current = node;
493
- while (current) {
494
- if (key === current.key) return current.value;
495
- current = key < current.key ? current.left : current.right;
496
- }
497
- };
498
- const treeHas = (node, key) => {
499
- let current = node;
500
- while (current) {
501
- if (key === current.key) return true;
502
- current = key < current.key ? current.left : current.right;
503
- }
504
- return false;
505
- };
506
- const treeFromSorted = (entries, start = 0, end = entries.length) => {
507
- if (start >= end) return void 0;
508
- const middle = start + end >> 1;
509
- const [key, value] = entries[middle];
510
- return makeTreeNode(key, value, treeFromSorted(entries, start, middle), treeFromSorted(entries, middle + 1, end));
511
- };
512
- /** Owns staged keyed intent, exact transitions and the persistent published lookup. */
513
- const createCollectionOutput = () => {
514
- const values = /* @__PURE__ */ new Map();
515
- let ids = Object.freeze([]);
516
- let staged = /* @__PURE__ */ new Map();
517
- let nextIds = ids;
518
- let change;
519
- let initialized = false;
520
- let reset = false;
521
- let revision = 0;
522
- let publishedRoot;
523
- let explicitOrder;
524
- let cleared = false;
525
- const listeners = /* @__PURE__ */ new Set();
526
- const hasNext = (key) => staged.has(key) ? staged.get(key).present : !cleared && values.has(key);
527
- const getNext = (key) => {
528
- const entry = staged.get(key);
529
- return entry ? entry.present ? entry.value : void 0 : cleared ? void 0 : values.get(key);
530
- };
531
- const deriveIds = () => {
532
- const result = cleared ? [] : ids.filter(hasNext);
533
- for (const [key, entry] of staged) if (entry.present && (cleared || !values.has(key))) result.push(key);
534
- return result;
535
- };
536
- const begin = (active, initialize) => {
537
- staged = /* @__PURE__ */ new Map();
538
- nextIds = ids;
539
- change = void 0;
540
- explicitOrder = void 0;
541
- cleared = initialize;
542
- reset = initialize;
543
- const read = (next) => ({
544
- get: (key) => {
545
- assertScope(active);
546
- return next ? getNext(key) : values.get(key);
547
- },
548
- has: (key) => {
549
- assertScope(active);
550
- return next ? hasNext(key) : values.has(key);
551
- },
552
- ids: () => {
553
- assertScope(active);
554
- return next ? Object.freeze(explicitOrder ? [...explicitOrder] : [...deriveIds()]) : ids;
555
- }
556
- });
557
- return {
558
- previous: read(false),
559
- next: read(true),
560
- output: {
561
- set: (key, value) => {
562
- assertScope(active);
563
- if (typeof key !== "string") throw new TypeError("Projection keys must be strings.");
564
- staged.set(key, {
565
- present: true,
566
- value
567
- });
568
- },
569
- remove: (key) => {
570
- assertScope(active);
571
- staged.set(key, { present: false });
572
- },
573
- order: (order) => {
574
- assertScope(active);
575
- explicitOrder = Object.freeze([...order]);
576
- }
577
- }
578
- };
579
- };
580
- const seal = (nextReset, isEqual) => {
581
- if (cleared) {
582
- for (const key of values.keys()) if (!staged.has(key)) staged.set(key, { present: false });
583
- }
584
- profile.projection("touchedKeys", staged.size);
585
- const added = /* @__PURE__ */ new Set();
586
- const removed = /* @__PURE__ */ new Set();
587
- const updated = /* @__PURE__ */ new Set();
588
- for (const [key, entry] of staged) {
589
- const existed = values.has(key);
590
- if (entry.present) {
591
- if (!existed) added.add(key);
592
- else if (!isEqual(values.get(key), entry.value)) updated.add(key);
593
- else if (!nextReset) staged.delete(key);
594
- } else if (existed) removed.add(key);
595
- else staged.delete(key);
596
- }
597
- if (explicitOrder || added.size || removed.size) {
598
- const order = explicitOrder ?? [...ids.filter((key) => !removed.has(key)), ...added];
599
- if (new Set(order).size !== order.length || order.length !== values.size + added.size - removed.size || order.some((key) => !hasNext(key))) throw new TypeError("Projection order must contain every key exactly once.");
600
- nextIds = ids.length === order.length && ids.every((key, index) => key === order[index]) ? ids : Object.freeze([...order]);
601
- } else nextIds = ids;
602
- const changedKeys = new Set([
603
- ...added,
604
- ...removed,
605
- ...updated
606
- ]);
607
- profile.projection("changedKeys", changedKeys.size);
608
- const addedEntries = [];
609
- const updatedEntries = [];
610
- const removedEntries = [];
611
- for (const key of changedKeys) {
612
- const beforePresent = values.has(key);
613
- const afterPresent = hasNext(key);
614
- if (beforePresent === afterPresent) {
615
- if (!beforePresent || isEqual(values.get(key), getNext(key))) continue;
616
- }
617
- if (!beforePresent) addedEntries.push({
618
- key,
619
- after: getNext(key)
620
- });
621
- else if (!afterPresent) removedEntries.push({
622
- key,
623
- before: values.get(key)
624
- });
625
- else updatedEntries.push({
626
- key,
627
- before: values.get(key),
628
- after: getNext(key)
629
- });
630
- }
631
- const orderChanged = nextIds !== ids;
632
- if (nextReset) change = Object.freeze({ kind: "reset" });
633
- else if (addedEntries.length || updatedEntries.length || removedEntries.length || orderChanged) {
634
- let commonOrderChanged = false;
635
- if (orderChanged) {
636
- const before = ids.filter((key) => !removed.has(key));
637
- const after = nextIds.filter((key) => !added.has(key));
638
- commonOrderChanged = before.some((key, index) => after[index] !== key);
639
- }
640
- change = Object.freeze({
641
- kind: "incremental",
642
- added: Object.freeze(addedEntries),
643
- updated: Object.freeze(updatedEntries),
644
- removed: Object.freeze(removedEntries),
645
- ...commonOrderChanged ? { order: Object.freeze({
646
- before: Object.freeze([...ids]),
647
- after: Object.freeze([...nextIds])
648
- }) } : {}
649
- });
650
- }
651
- reset = nextReset;
652
- return change !== void 0;
653
- };
654
- const context = (active, cause) => Object.freeze({
655
- kind: "collection",
656
- read: {
657
- get: (key) => {
658
- assertScope(active);
659
- return getNext(key);
660
- },
661
- has: (key) => {
662
- assertScope(active);
663
- return hasNext(key);
664
- },
665
- ids: () => {
666
- assertScope(active);
667
- return nextIds;
668
- }
669
- },
670
- change,
671
- revision,
672
- reset,
673
- cause
674
- });
675
- const current = (check) => {
676
- const root = publishedRoot;
677
- const publishedIds = ids;
678
- return Object.freeze({
679
- get: (key) => {
680
- check();
681
- return treeGet(root, key);
682
- },
683
- has: (key) => {
684
- check();
685
- return treeHas(root, key);
686
- },
687
- ids: () => {
688
- check();
689
- return publishedIds;
690
- }
691
- });
692
- };
693
- return {
694
- begin,
695
- seal,
696
- context,
697
- current,
698
- revision: () => revision,
699
- reset: () => reset,
700
- publish: () => {
701
- if (change) if (change.kind === "reset") {
702
- const entries = [];
703
- for (const [key, entry] of staged) if (entry.present) entries.push([key, entry.value]);
704
- entries.sort(([left], [right]) => left < right ? -1 : left > right ? 1 : 0);
705
- publishedRoot = treeFromSorted(entries);
706
- } else for (const [key, entry] of staged) publishedRoot = entry.present ? treeSet(publishedRoot, key, entry.value) : treeRemove(publishedRoot, key);
707
- for (const [key, entry] of staged) if (entry.present) values.set(key, entry.value);
708
- else values.delete(key);
709
- if (change && initialized) revision++;
710
- ids = nextIds;
711
- initialized = true;
712
- },
713
- emit: (call) => {
714
- const resetEvent = Object.freeze({ kind: "reset" });
715
- Array.from(listeners).forEach((listener) => call(() => listener(change ?? resetEvent)));
716
- },
717
- clear: () => {
718
- staged.clear();
719
- nextIds = ids;
720
- change = void 0;
721
- reset = false;
722
- explicitOrder = void 0;
723
- cleared = false;
724
- },
725
- release: () => {
726
- values.clear();
727
- staged.clear();
728
- publishedRoot = void 0;
729
- listeners.clear();
730
- ids = nextIds = Object.freeze([]);
731
- change = void 0;
732
- initialized = false;
733
- revision = 0;
734
- reset = false;
735
- explicitOrder = void 0;
736
- cleared = false;
737
- },
738
- subscribe: (listener) => listeners.add(listener),
739
- unsubscribe: (listener) => listeners.delete(listener)
740
- };
741
- };
742
- const mapRead = (value) => ({
743
- get: (key) => value.get(key),
744
- has: (key) => value.has(key),
745
- ids: () => Object.freeze([...value.keys()])
746
- });
747
- /** Immutable map-like view over a CollectionRead. */
748
- const collectionView = (read) => {
749
- const ids = read.ids();
750
- const entries = function* () {
751
- for (const key of ids) yield [key, read.get(key)];
752
- };
753
- const values = function* () {
754
- for (const key of ids) yield read.get(key);
755
- };
756
- const view = {
757
- get: (key) => read.get(key),
758
- has: (key) => read.has(key),
759
- get size() {
760
- return ids.length;
761
- },
762
- keys: () => ids[Symbol.iterator](),
763
- values,
764
- entries,
765
- forEach: (callback, thisArg) => {
766
- for (const key of ids) callback.call(thisArg, read.get(key), key, view);
767
- },
768
- [Symbol.iterator]: entries
769
- };
770
- return Object.freeze(view);
771
- };
772
- /** Eager durable view used when a processor result may retain its dependency value. */
773
- const snapshotCollectionView = (read) => {
774
- const ids = read.ids();
775
- const values = /* @__PURE__ */ new Map();
776
- for (const key of ids) values.set(key, read.get(key));
777
- return collectionView(mapRead(values));
778
- };
779
- /**
780
- * The one source-to-CollectionChange kernel. Candidate keys only narrow value work;
781
- * exact membership/value/order semantics remain owned here.
782
- */
783
- const stageCollectionRead = (state, read, active, options) => {
784
- const evaluation = state.begin(active, options.reset);
785
- if (options.reset) {
786
- const ids = read.ids();
787
- profile.collectionView.idsScanned(ids.length);
788
- for (const key of ids) {
789
- profile.collectionView.mapped();
790
- evaluation.output.set(key, read.get(key));
791
- }
792
- evaluation.output.order(ids);
793
- } else {
794
- const previous = state.current(() => void 0);
795
- const keys = options.candidates ? [...new Set(options.candidates)] : [...new Set([...previous.ids(), ...read.ids()])];
796
- if (!options.candidates) profile.collectionView.idsScanned(keys.length);
797
- for (const key of keys) if (read.has(key)) {
798
- profile.collectionView.mapped();
799
- evaluation.output.set(key, read.get(key));
800
- } else evaluation.output.remove(key);
801
- if (options.orderMayChange || !options.candidates) {
802
- const ids = read.ids();
803
- if (options.candidates) profile.collectionView.idsScanned(ids.length);
804
- evaluation.output.order(ids);
805
- }
806
- }
807
- return state.seal(options.reset, options.isEqual ?? Object.is);
808
- };
809
- /** Exact net transition between two published map-like snapshots. */
810
- const collectionChangeBetween = (previous, current, isEqual = Object.is) => {
811
- const added = [];
812
- const removed = [];
813
- const updated = [];
814
- for (const [key, before] of previous) if (!current.has(key)) removed.push({
815
- key,
816
- before
817
- });
818
- else {
819
- const after = current.get(key);
820
- if (!isEqual(before, after)) updated.push({
821
- key,
822
- before,
823
- after
824
- });
825
- }
826
- for (const [key, after] of current) if (!previous.has(key)) added.push({
827
- key,
828
- after
829
- });
830
- const beforeKeys = new Set(previous.keys());
831
- const afterKeys = new Set(current.keys());
832
- const beforeCommon = [...previous.keys()].filter((key) => afterKeys.has(key));
833
- const afterCommon = [...current.keys()].filter((key) => beforeKeys.has(key));
834
- const orderChanged = beforeCommon.some((key, index) => afterCommon[index] !== key);
835
- if (!added.length && !removed.length && !updated.length && !orderChanged) return void 0;
836
- return Object.freeze({
837
- kind: "incremental",
838
- added: Object.freeze(added),
839
- updated: Object.freeze(updated),
840
- removed: Object.freeze(removed),
841
- ...orderChanged ? { order: Object.freeze({
842
- before: Object.freeze([...previous.keys()]),
843
- after: Object.freeze([...current.keys()])
844
- }) } : {}
845
- });
846
- };
847
- //#endregion
848
897
  //#region core/src/projection/definition.ts
849
898
  const projections = /* @__PURE__ */ new WeakMap();
850
899
  const defineRef = (producer, output) => {
@@ -945,27 +994,18 @@ function observe(source, selector) {
945
994
  equality: Object.is
946
995
  });
947
996
  const document = source;
948
- if (!selector) return defineSource({
949
- kind: "document-value",
950
- document
951
- }, {
997
+ const state = contextOf(document).state;
998
+ const selected = selector ? compilePath(state.schema, "auto", selector) : Object.freeze({
952
999
  kind: "value",
953
- equality: Object.is
1000
+ schema: state.schema,
1001
+ address: Object.freeze([])
954
1002
  });
955
- const selected = compilePath(accessOf(document).schema, "auto", selector);
956
- return selected.kind === "collection" ? defineSource({
957
- kind: "document-collection",
958
- document,
959
- selector: selected
960
- }, {
961
- kind: "collection",
962
- equality: Object.is
963
- }) : defineSource({
964
- kind: "document-value",
1003
+ return defineSource({
1004
+ kind: "document",
965
1005
  document,
966
1006
  selector: selected
967
1007
  }, {
968
- kind: "value",
1008
+ kind: selected.kind,
969
1009
  equality: Object.is
970
1010
  });
971
1011
  }
@@ -1065,25 +1105,23 @@ function createIncrementalCollection(dependencies, processor) {
1065
1105
  });
1066
1106
  return projection;
1067
1107
  }
1068
- const groupOutputMetadata = /* @__PURE__ */ new WeakMap();
1069
- const isPlainGroupNamespace = (value) => value !== null && typeof value === "object" && !groupOutputMetadata.has(value) && !Array.isArray(value) && (Object.getPrototypeOf(value) === Object.prototype || Object.getPrototypeOf(value) === null);
1070
- const compileGroupShape = (value, path, declaredOutputs, used, outputs) => {
1108
+ const isPlainGroupNamespace = (value, metadata) => isPlainObject(value) && !metadata.has(value);
1109
+ const compileGroupShape = (value, path, metadata, used, outputs) => {
1071
1110
  if (value !== null && typeof value === "object") {
1072
- const metadata = groupOutputMetadata.get(value);
1073
- if (metadata) {
1074
- if (!declaredOutputs.has(value)) throw new TypeError("Incremental group outputs must be declared by this group.");
1111
+ const output = metadata.get(value);
1112
+ if (output) {
1075
1113
  if (used.has(value)) throw new TypeError("An incremental group output cannot be reused.");
1076
1114
  used.add(value);
1077
1115
  const index = outputs.length;
1078
1116
  outputs.push({
1079
- kind: metadata.kind,
1080
- equality: metadata.equality,
1117
+ kind: output.kind,
1118
+ equality: output.equality,
1081
1119
  path: Object.freeze([...path])
1082
1120
  });
1083
1121
  return index;
1084
1122
  }
1085
1123
  }
1086
- if (!isPlainGroupNamespace(value)) throw new TypeError("Incremental group outputs must be a static object tree.");
1124
+ if (!isPlainGroupNamespace(value, metadata)) throw new TypeError("Incremental group outputs must be a static object tree.");
1087
1125
  for (const key of Reflect.ownKeys(value)) {
1088
1126
  if (typeof key !== "string") throw new TypeError("Incremental group output names must be strings.");
1089
1127
  if (!Object.prototype.propertyIsEnumerable.call(value, key)) throw new TypeError("Incremental group namespaces must contain enumerable properties.");
@@ -1095,7 +1133,7 @@ const compileGroupShape = (value, path, declaredOutputs, used, outputs) => {
1095
1133
  if (key === "__proto__" || key === "prototype" || key === "constructor") throw new TypeError(`Invalid incremental group output name: ${key}`);
1096
1134
  const descriptor = Object.getOwnPropertyDescriptor(value, key);
1097
1135
  if (!descriptor || !("value" in descriptor)) throw new TypeError("Incremental group namespaces cannot contain accessors.");
1098
- result[key] = compileGroupShape(descriptor.value, [...path, key], declaredOutputs, used, outputs);
1136
+ result[key] = compileGroupShape(descriptor.value, [...path, key], metadata, used, outputs);
1099
1137
  }
1100
1138
  return Object.freeze(result);
1101
1139
  };
@@ -1124,26 +1162,24 @@ function createIncrementalGroup(dependencies, defineOutputs, processor) {
1124
1162
  if (typeof defineOutputs !== "function") throw new TypeError("Incremental group outputs must be declared by a callback.");
1125
1163
  if (typeof processor !== "function") throw new TypeError("Incremental group processor must be a function.");
1126
1164
  let active = true;
1127
- const declaredOutputs = /* @__PURE__ */ new Set();
1165
+ const metadata = /* @__PURE__ */ new Map();
1128
1166
  const declared = defineOutputs({
1129
1167
  collection: (equality = Object.is) => {
1130
1168
  if (!active) throw new TypeError("Incremental group output declarations are synchronous.");
1131
1169
  const descriptor = Object.freeze({});
1132
- groupOutputMetadata.set(descriptor, {
1170
+ metadata.set(descriptor, {
1133
1171
  kind: "collection",
1134
1172
  equality
1135
1173
  });
1136
- declaredOutputs.add(descriptor);
1137
1174
  return descriptor;
1138
1175
  },
1139
1176
  value: (equality = Object.is) => {
1140
1177
  if (!active) throw new TypeError("Incremental group output declarations are synchronous.");
1141
1178
  const descriptor = Object.freeze({});
1142
- groupOutputMetadata.set(descriptor, {
1179
+ metadata.set(descriptor, {
1143
1180
  kind: "value",
1144
1181
  equality
1145
1182
  });
1146
- declaredOutputs.add(descriptor);
1147
1183
  return descriptor;
1148
1184
  }
1149
1185
  });
@@ -1151,9 +1187,9 @@ function createIncrementalGroup(dependencies, defineOutputs, processor) {
1151
1187
  active = false;
1152
1188
  const outputs = [];
1153
1189
  const used = /* @__PURE__ */ new Set();
1154
- const shape = compileGroupShape(declared, [], declaredOutputs, used, outputs);
1190
+ const shape = compileGroupShape(declared, [], metadata, used, outputs);
1155
1191
  if (typeof shape === "number") throw new TypeError("Incremental group declarations must return an output namespace.");
1156
- if (used.size === 0 || used.size !== declaredOutputs.size) throw new TypeError("Every incremental group output must be returned by the declaration.");
1192
+ if (used.size === 0 || used.size !== metadata.size) throw new TypeError("Every incremental group output must be returned by the declaration.");
1157
1193
  return hydrateGroupShape(shape, defineProcessor({
1158
1194
  dependencies,
1159
1195
  outputs,
@@ -1183,6 +1219,6 @@ const incremental = Object.assign(createIncrementalValue, {
1183
1219
  group: createIncrementalGroup
1184
1220
  });
1185
1221
  //#endregion
1186
- export { list as C, table as D, optional as E, tree as O, field as S, object as T, createScheduler as _, observe as a, collectionEntryNode as b, projectionRef as c, createCollectionOutput as d, mapRead as f, assertSynchronous as g, assertScope as h, isProjection as i, variant as k, collectionChangeBetween as l, stageCollectionRead as m, derive as n, ownProjection as o, snapshotCollectionView as p, input as r, producerOf as s, incremental as t, collectionView as u, ProjectionDisposedError as v, map as w, compilePath as x, ProjectionError as y };
1222
+ export { checkValue as A, insert as B, optional as C, ParseError as D, variant as E, parse as F, listSequence as G, installKeys as H, compiledLayout as I, toArray as J, matches as K, compiledShape as L, copyValue as M, equalTreeNode as N, checkKey as O, equalValue as P, equal as R, object as S, tree as T, installList as U, install as V, keys as W, profile as Y, collectionEntryNode as _, observe as a, list as b, projectionRef as c, createScheduler as d, ProjectionDisposedError as f, snapshotCollectionView as g, mapRead as h, isProjection as i, copyTreeNode as j, checkTreePayload as k, assertScope as l, collectionView as m, derive as n, ownProjection as o, ProjectionError as p, remove as q, input as r, producerOf as s, incremental as t, assertSynchronous as u, compilePath as v, table as w, map as x, field as y, indexedKeys as z };
1187
1223
 
1188
- //# sourceMappingURL=advanced-COFJtWMT.js.map
1224
+ //# sourceMappingURL=advanced-CRNHfJBu.js.map