doxum 0.1.2 → 0.1.3

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 (48) hide show
  1. package/README.md +59 -27
  2. package/dist/{contract-DGkZcTiP.d.cts → contract-BsY1XLiG.d.ts} +2 -1
  3. package/dist/{contract-Dh3az8aN.d.ts → contract-D8kjdfqT.d.cts} +2 -1
  4. package/dist/{access-5D4KKFm7.js → dependency-C5_R1tvQ.js} +40 -262
  5. package/dist/dependency-C5_R1tvQ.js.map +1 -0
  6. package/dist/{access-z56fVqZ2.cjs → dependency-Dfzs3khk.cjs} +62 -344
  7. package/dist/dependency-Dfzs3khk.cjs.map +1 -0
  8. package/dist/driver-CNxqMVFH.cjs +69 -0
  9. package/dist/driver-CNxqMVFH.cjs.map +1 -0
  10. package/dist/driver-CbzfW5MR.js +46 -0
  11. package/dist/driver-CbzfW5MR.js.map +1 -0
  12. package/dist/index.cjs +2636 -46
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.cts +1 -1
  15. package/dist/index.d.ts +1 -1
  16. package/dist/index.js +2594 -4
  17. package/dist/index.js.map +1 -1
  18. package/dist/integration.cjs +2 -3
  19. package/dist/integration.cjs.map +1 -1
  20. package/dist/integration.d.cts +1 -1
  21. package/dist/integration.d.ts +1 -1
  22. package/dist/integration.js +1 -2
  23. package/dist/integration.js.map +1 -1
  24. package/dist/local-sync.cjs +154 -329
  25. package/dist/local-sync.cjs.map +1 -1
  26. package/dist/local-sync.d.cts +17 -22
  27. package/dist/local-sync.d.ts +17 -22
  28. package/dist/local-sync.js +149 -326
  29. package/dist/local-sync.js.map +1 -1
  30. package/dist/ownership-B-VAPcce.js +242 -0
  31. package/dist/ownership-B-VAPcce.js.map +1 -0
  32. package/dist/ownership-CU-9DKJQ.cjs +301 -0
  33. package/dist/ownership-CU-9DKJQ.cjs.map +1 -0
  34. package/package.json +1 -1
  35. package/skills/doxum-runtime/references/guide.en.md +52 -1
  36. package/skills/doxum-runtime/references/guide.zh-CN.md +46 -1
  37. package/skills/doxum-runtime/references/invariants.en.md +14 -4
  38. package/skills/doxum-runtime/references/invariants.zh-CN.md +1 -1
  39. package/dist/access-5D4KKFm7.js.map +0 -1
  40. package/dist/access-z56fVqZ2.cjs.map +0 -1
  41. package/dist/dependency-BRn1TRDi.js +0 -20
  42. package/dist/dependency-BRn1TRDi.js.map +0 -1
  43. package/dist/dependency-DmQXyj7q.cjs +0 -25
  44. package/dist/dependency-DmQXyj7q.cjs.map +0 -1
  45. package/dist/readable-B8E3FMq6.cjs +0 -2614
  46. package/dist/readable-B8E3FMq6.cjs.map +0 -1
  47. package/dist/readable-CIj02gIj.js +0 -2579
  48. package/dist/readable-CIj02gIj.js.map +0 -1
@@ -10,6 +10,7 @@ var __exportAll = (all, no_symbols) => {
10
10
  return target;
11
11
  };
12
12
  //#endregion
13
+ const require_ownership = require("./ownership-CU-9DKJQ.cjs");
13
14
  //#region core/src/schema.ts
14
15
  const node = (value) => Object.freeze(value);
15
16
  const field = () => node({ kind: "field" });
@@ -69,186 +70,6 @@ const schema = (shape) => {
69
70
  return Object.freeze(result);
70
71
  };
71
72
  //#endregion
72
- //#region core/src/profile.ts
73
- const active = { current: void 0 };
74
- const profile = {
75
- clone: {
76
- call: () => {
77
- const value = active.current;
78
- if (value) value.clone.calls += 1;
79
- },
80
- node: (reason) => {
81
- const value = active.current;
82
- if (!value) return;
83
- value.clone.nodes[reason] += 1;
84
- },
85
- container: () => {
86
- const value = active.current;
87
- if (value) value.clone.containers += 1;
88
- },
89
- deepEqual: () => {
90
- const value = active.current;
91
- if (value) value.clone.deepEqual.calls += 1;
92
- },
93
- deepEqualContainer: () => {
94
- const value = active.current;
95
- if (value) value.clone.deepEqual.containers += 1;
96
- },
97
- initialDocument: () => {
98
- const value = active.current;
99
- if (value) value.clone.documents.initial += 1;
100
- }
101
- },
102
- mutation: {
103
- normalized: () => {
104
- const value = active.current;
105
- if (value) value.mutation.normalized += 1;
106
- },
107
- executed: () => {
108
- const value = active.current;
109
- if (value) value.mutation.executed += 1;
110
- },
111
- inverse: () => {
112
- const value = active.current;
113
- if (value) value.mutation.inverseCreated += 1;
114
- }
115
- },
116
- batch: {
117
- operation: () => {
118
- const value = active.current;
119
- if (value) value.batch.operations += 1;
120
- },
121
- entry: (amount = 1) => {
122
- const value = active.current;
123
- if (value) value.batch.entries += amount;
124
- },
125
- collectionResolved: () => {
126
- const value = active.current;
127
- if (value) value.batch.collectionsResolved += 1;
128
- },
129
- journalRecord: () => {
130
- const value = active.current;
131
- if (value) value.batch.journalRecords += 1;
132
- },
133
- rejected: () => {
134
- const value = active.current;
135
- if (value) value.batch.rejected += 1;
136
- },
137
- inverse: () => {
138
- const value = active.current;
139
- if (value) value.batch.inverseOperations += 1;
140
- },
141
- payloadTransferred: () => {
142
- const value = active.current;
143
- if (value) value.batch.payloadTransferred += 1;
144
- },
145
- payloadSnapshot: () => {
146
- const value = active.current;
147
- if (value) value.batch.payloadSnapshots += 1;
148
- }
149
- },
150
- journal: {
151
- subject: () => {
152
- const value = active.current;
153
- if (value) value.journal.subjects += 1;
154
- },
155
- comparison: () => {
156
- const value = active.current;
157
- if (value) value.journal.comparisons += 1;
158
- },
159
- absorbed: () => {
160
- const value = active.current;
161
- if (value) value.journal.absorbed += 1;
162
- },
163
- orderSnapshot: (items) => {
164
- const value = active.current;
165
- if (!value) return;
166
- value.journal.orderSnapshots += 1;
167
- value.journal.orderItems += items;
168
- }
169
- },
170
- address: {
171
- schemaStep: () => {
172
- const value = active.current;
173
- if (value) value.address.schemaSteps += 1;
174
- },
175
- documentStep: () => {
176
- const value = active.current;
177
- if (value) value.address.documentSteps += 1;
178
- },
179
- arrayCopied: () => {
180
- const value = active.current;
181
- if (value) value.address.arraysCopied += 1;
182
- },
183
- prefixComparison: () => {
184
- const value = active.current;
185
- if (value) value.address.prefixComparisons += 1;
186
- },
187
- segmentCompared: () => {
188
- const value = active.current;
189
- if (value) value.address.segmentsCompared += 1;
190
- }
191
- },
192
- impact: { affects: () => {
193
- const value = active.current;
194
- if (value) value.impact.affectsChecks += 1;
195
- } },
196
- reader: {
197
- session: () => {
198
- const value = active.current;
199
- if (value) value.reader.sessions += 1;
200
- },
201
- lookup: () => {
202
- const value = active.current;
203
- if (value) value.reader.nodeLookups += 1;
204
- },
205
- collectionIds: (amount = 1) => {
206
- const value = active.current;
207
- if (value) value.reader.collectionIds += amount;
208
- },
209
- structuralSnapshot: () => {
210
- const value = active.current;
211
- if (value) value.reader.structuralSnapshots += 1;
212
- }
213
- },
214
- collectionView: {
215
- mapped: () => {
216
- const value = active.current;
217
- if (value) value.collectionView.mappedItems += 1;
218
- },
219
- idsScanned: (amount = 1) => {
220
- const value = active.current;
221
- if (value) value.collectionView.idsScanned += amount;
222
- },
223
- arrayCopied: () => {
224
- const value = active.current;
225
- if (value) value.collectionView.arraysCopied += 1;
226
- }
227
- },
228
- materialized: {
229
- updated: () => {
230
- const value = active.current;
231
- if (value) value.materialized.updated += 1;
232
- },
233
- skipped: () => {
234
- const value = active.current;
235
- if (value) value.materialized.skipped += 1;
236
- },
237
- rebuilt: () => {
238
- const value = active.current;
239
- if (value) value.materialized.rebuilt += 1;
240
- },
241
- sourceChanged: () => {
242
- const value = active.current;
243
- if (value) value.materialized.sourceChanges += 1;
244
- },
245
- notification: () => {
246
- const value = active.current;
247
- if (value) value.materialized.notifications += 1;
248
- }
249
- }
250
- };
251
- //#endregion
252
73
  //#region core/src/address.ts
253
74
  const registries = /* @__PURE__ */ new WeakMap();
254
75
  const registryNode = () => ({ static: /* @__PURE__ */ new Map() });
@@ -268,14 +89,14 @@ const hashText = (value, seed) => {
268
89
  return hash >>> 0;
269
90
  };
270
91
  const appendAddressHash = (hash, segment) => hashText(segment, hashText("/", hash));
271
- const isRecord$1 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
92
+ const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
272
93
  const unwrap = (node) => {
273
94
  let current = node;
274
95
  while (current?.kind === "single") current = current.value;
275
96
  return current;
276
97
  };
277
98
  const variantNode = (node, value) => {
278
- const tag = isRecord$1(value) && typeof value[node.tag] === "string" ? value[node.tag] : void 0;
99
+ const tag = isRecord(value) && typeof value[node.tag] === "string" ? value[node.tag] : void 0;
279
100
  return node.variants[String(tag ?? Object.keys(node.variants)[0] ?? "")];
280
101
  };
281
102
  const schemaRoot$1 = (schema) => ({
@@ -316,8 +137,8 @@ const pathFor = (schema, address, document) => {
316
137
  let node = schemaRoot$1(schema);
317
138
  let value = document;
318
139
  for (const segment of address) {
319
- profile.address.schemaStep();
320
- profile.address.documentStep();
140
+ require_ownership.profile.address.schemaStep();
141
+ require_ownership.profile.address.documentStep();
321
142
  const resolved = step(node, value, segment);
322
143
  if (!resolved.node) return void 0;
323
144
  trie = resolved.dynamic ? trie.dynamic ??= registryNode() : (() => {
@@ -336,7 +157,7 @@ const pathFor = (schema, address, document) => {
336
157
  const resolveAddress = (schema, address, document) => {
337
158
  if (!Array.isArray(address)) return void 0;
338
159
  for (const segment of address) if (typeof segment !== "string") return void 0;
339
- profile.address.arrayCopied();
160
+ require_ownership.profile.address.arrayCopied();
340
161
  const owned = Object.freeze(address.slice());
341
162
  const path = pathFor(schema, owned, document);
342
163
  return path === void 0 ? void 0 : {
@@ -355,8 +176,8 @@ const nodeAt = (schema, address, document) => {
355
176
  return unwrap(node);
356
177
  };
357
178
  const readSegment = (value, segment) => {
358
- if (!isRecord$1(value) && !Array.isArray(value)) return void 0;
359
- if (isRecord$1(value) && "byId" in value && isRecord$1(value.byId)) {
179
+ if (!isRecord(value) && !Array.isArray(value)) return void 0;
180
+ if (isRecord(value) && "byId" in value && isRecord(value.byId)) {
360
181
  const entity = value.byId[segment];
361
182
  if (entity !== void 0 || Object.prototype.hasOwnProperty.call(value.byId, segment)) return entity;
362
183
  }
@@ -378,8 +199,8 @@ const resolveLocated = (schema, root, address) => {
378
199
  let collection;
379
200
  let addressHash = 2166136261;
380
201
  for (let index = 0; index < address.length - 1; index += 1) {
381
- profile.address.schemaStep();
382
- profile.address.documentStep();
202
+ require_ownership.profile.address.schemaStep();
203
+ require_ownership.profile.address.documentStep();
383
204
  const resolved = step(node, current, address[index]);
384
205
  if (!resolved.node) return void 0;
385
206
  if (node?.kind === "table" || node?.kind === "map") collection = {
@@ -393,11 +214,11 @@ const resolveLocated = (schema, root, address) => {
393
214
  current = readSegment(current, address[index]);
394
215
  if (!node) return void 0;
395
216
  }
396
- profile.address.schemaStep();
397
- profile.address.documentStep();
217
+ require_ownership.profile.address.schemaStep();
218
+ require_ownership.profile.address.documentStep();
398
219
  const last = address[address.length - 1];
399
220
  const resolved = step(node, current, last);
400
- if (!resolved.node || !isRecord$1(current) && !Array.isArray(current)) return void 0;
221
+ if (!resolved.node || !isRecord(current) && !Array.isArray(current)) return void 0;
401
222
  if (node?.kind === "table" || node?.kind === "map") collection = {
402
223
  address: address.slice(0, -1),
403
224
  addressHash,
@@ -405,7 +226,7 @@ const resolveLocated = (schema, root, address) => {
405
226
  ...collection ? { parent: collection } : {}
406
227
  };
407
228
  addressHash = appendAddressHash(addressHash, last);
408
- if (isRecord$1(current) && "byId" in current && isRecord$1(current.byId) && last in current.byId) return {
229
+ if (isRecord(current) && "byId" in current && isRecord(current.byId) && last in current.byId) return {
409
230
  addressHash,
410
231
  node: resolved.node,
411
232
  parent: current.byId,
@@ -426,9 +247,9 @@ const locate = (root, address) => {
426
247
  if (address.length === 0) return void 0;
427
248
  let current = root;
428
249
  for (let index = 0; index < address.length - 1; index += 1) current = readSegment(current, address[index]);
429
- if (!isRecord$1(current) && !Array.isArray(current)) return void 0;
250
+ if (!isRecord(current) && !Array.isArray(current)) return void 0;
430
251
  const last = address[address.length - 1];
431
- if (isRecord$1(current) && "byId" in current && isRecord$1(current.byId) && last in current.byId) return {
252
+ if (isRecord(current) && "byId" in current && isRecord(current.byId) && last in current.byId) return {
432
253
  parent: current.byId,
433
254
  key: last,
434
255
  value: current.byId[last]
@@ -446,10 +267,10 @@ const set = (root, address, value) => {
446
267
  return true;
447
268
  };
448
269
  const contains = (parent, child) => {
449
- profile.address.prefixComparison();
270
+ require_ownership.profile.address.prefixComparison();
450
271
  if (parent.length > child.length) return false;
451
272
  for (let index = 0; index < parent.length; index += 1) {
452
- profile.address.segmentCompared();
273
+ require_ownership.profile.address.segmentCompared();
453
274
  if (parent[index] !== child[index]) return false;
454
275
  }
455
276
  return true;
@@ -486,65 +307,6 @@ const same = (left, right) => {
486
307
  };
487
308
  const bucket = (target) => address(target)[0];
488
309
  //#endregion
489
- //#region core/src/value/ownership.ts
490
- const stablePayloads = /* @__PURE__ */ new WeakSet();
491
- const markStablePayload = (value) => {
492
- if (Array.isArray(value) || isPlainObject(value)) stablePayloads.add(value);
493
- return value;
494
- };
495
- const isStablePayload = (value) => (Array.isArray(value) || isPlainObject(value)) && stablePayloads.has(value);
496
- const isPlainObject = (value) => {
497
- if (value === null || typeof value !== "object") return false;
498
- const prototype = Object.getPrototypeOf(value);
499
- return prototype === Object.prototype || prototype === null;
500
- };
501
- const countCloneReason = (reason) => {
502
- if (reason) profile.clone.node(reason);
503
- };
504
- const cloneValue = (value, reason) => {
505
- profile.clone.call();
506
- countCloneReason(reason);
507
- if (Array.isArray(value)) {
508
- profile.clone.container();
509
- const result = new Array(value.length);
510
- for (let index = 0; index < value.length; index += 1) result[index] = cloneValue(value[index], reason);
511
- return reason === "commit" || reason === "inverse" || reason === "snapshot" ? markStablePayload(Object.freeze(result)) : result;
512
- }
513
- if (isPlainObject(value)) {
514
- profile.clone.container();
515
- const result = Object.create(Object.getPrototypeOf(value));
516
- for (const key in value) if (Object.prototype.hasOwnProperty.call(value, key)) result[key] = cloneValue(value[key], reason);
517
- return reason === "commit" || reason === "inverse" || reason === "snapshot" ? markStablePayload(Object.freeze(result)) : result;
518
- }
519
- return value;
520
- };
521
- const ownPayload = (value, reason = "canonical") => Array.isArray(value) || isPlainObject(value) ? cloneValue(value, reason) : value;
522
- const transferPayload = (value) => {
523
- profile.batch.payloadTransferred();
524
- return value;
525
- };
526
- const snapshotPayload = (value, reason = "commit") => (profile.batch.payloadSnapshot(), ownPayload(value, reason));
527
- const deepEqual = (left, right) => {
528
- profile.clone.deepEqual();
529
- if (Object.is(left, right)) return true;
530
- if (Array.isArray(left) && Array.isArray(right)) {
531
- profile.clone.deepEqualContainer();
532
- if (left.length !== right.length) return false;
533
- for (let index = 0; index < left.length; index += 1) if (!deepEqual(left[index], right[index])) return false;
534
- return true;
535
- }
536
- if (isPlainObject(left) && isPlainObject(right)) {
537
- profile.clone.deepEqualContainer();
538
- const leftKeys = Object.keys(left);
539
- if (leftKeys.length !== Object.keys(right).length) return false;
540
- for (const key of leftKeys) if (!Object.prototype.hasOwnProperty.call(right, key) || !deepEqual(left[key], right[key])) return false;
541
- return true;
542
- }
543
- return false;
544
- };
545
- const sameStructuralValue = (left, right) => Object.is(left, right) || (Array.isArray(left) || isPlainObject(left)) && deepEqual(left, right);
546
- const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
547
- //#endregion
548
310
  //#region core/src/access/reader.ts
549
311
  const schemaRoot = (schema) => object(schema.shape);
550
312
  const assertActive = (context) => {
@@ -552,7 +314,7 @@ const assertActive = (context) => {
552
314
  };
553
315
  const readAt = (context, address) => {
554
316
  assertActive(context);
555
- profile.reader.lookup();
317
+ require_ownership.profile.reader.lookup();
556
318
  return read(context.root(), address);
557
319
  };
558
320
  const collectValue = (context, address) => {
@@ -576,15 +338,15 @@ const readerFor = (node, context, address = []) => {
576
338
  } };
577
339
  if (node.kind === "dict" || node.kind === "record") return { get: () => {
578
340
  collectValue(context, address);
579
- profile.reader.structuralSnapshot();
580
- return cloneValue(readAt(context, address), "reader");
341
+ require_ownership.profile.reader.structuralSnapshot();
342
+ return require_ownership.cloneValue(readAt(context, address), "reader");
581
343
  } };
582
344
  if (node.kind === "list") return {
583
345
  values: () => {
584
346
  collectValue(context, address);
585
347
  const value = readAt(context, address);
586
- profile.reader.structuralSnapshot();
587
- return cloneValue(Array.isArray(value) ? value : [], "reader");
348
+ require_ownership.profile.reader.structuralSnapshot();
349
+ return require_ownership.cloneValue(Array.isArray(value) ? value : [], "reader");
588
350
  },
589
351
  length: () => {
590
352
  collectValue(context, address);
@@ -594,38 +356,38 @@ const readerFor = (node, context, address = []) => {
594
356
  at: (index) => {
595
357
  collectValue(context, address);
596
358
  const value = readAt(context, address);
597
- profile.reader.structuralSnapshot();
598
- return cloneValue(Array.isArray(value) ? value[index] : void 0, "reader");
359
+ require_ownership.profile.reader.structuralSnapshot();
360
+ return require_ownership.cloneValue(Array.isArray(value) ? value[index] : void 0, "reader");
599
361
  }
600
362
  };
601
363
  if (node.kind === "tree") return {
602
364
  rootId: () => {
603
365
  collectValue(context, address);
604
366
  const value = readAt(context, address);
605
- return isRecord(value) && typeof value.rootId === "string" ? value.rootId : void 0;
367
+ return require_ownership.isRecord(value) && typeof value.rootId === "string" ? value.rootId : void 0;
606
368
  },
607
369
  has: (id) => {
608
370
  collectValue(context, address);
609
371
  const value = readAt(context, address);
610
- return isRecord(value) && isRecord(value.nodes) && Object.prototype.hasOwnProperty.call(value.nodes, id);
372
+ return require_ownership.isRecord(value) && require_ownership.isRecord(value.nodes) && Object.prototype.hasOwnProperty.call(value.nodes, id);
611
373
  },
612
374
  value: (id) => {
613
375
  collectValue(context, address);
614
376
  const value = readAt(context, address);
615
- profile.reader.structuralSnapshot();
616
- return cloneValue(isRecord(value) && isRecord(value.nodes) && isRecord(value.nodes[id]) ? value.nodes[id].value : void 0, "reader");
377
+ require_ownership.profile.reader.structuralSnapshot();
378
+ return require_ownership.cloneValue(require_ownership.isRecord(value) && require_ownership.isRecord(value.nodes) && require_ownership.isRecord(value.nodes[id]) ? value.nodes[id].value : void 0, "reader");
617
379
  },
618
380
  parent: (id) => {
619
381
  collectValue(context, address);
620
382
  const value = readAt(context, address);
621
- const entry = isRecord(value) && isRecord(value.nodes) ? value.nodes[id] : void 0;
622
- return isRecord(entry) && typeof entry.parentId === "string" ? entry.parentId : void 0;
383
+ const entry = require_ownership.isRecord(value) && require_ownership.isRecord(value.nodes) ? value.nodes[id] : void 0;
384
+ return require_ownership.isRecord(entry) && typeof entry.parentId === "string" ? entry.parentId : void 0;
623
385
  },
624
386
  children: (id) => {
625
387
  collectValue(context, address);
626
388
  const value = readAt(context, address);
627
- const entry = isRecord(value) && isRecord(value.nodes) ? value.nodes[id] : void 0;
628
- return isRecord(entry) && Array.isArray(entry.children) ? [...entry.children] : [];
389
+ const entry = require_ownership.isRecord(value) && require_ownership.isRecord(value.nodes) ? value.nodes[id] : void 0;
390
+ return require_ownership.isRecord(entry) && Array.isArray(entry.children) ? [...entry.children] : [];
629
391
  }
630
392
  };
631
393
  if (node.kind === "table" || node.kind === "map") {
@@ -634,21 +396,21 @@ const readerFor = (node, context, address = []) => {
634
396
  ids: () => {
635
397
  collectCollection(context, address);
636
398
  const value = readAt(context, address);
637
- const ids = node.kind === "table" && isRecord(value) && Array.isArray(value.ids) ? [...value.ids] : isRecord(value) ? Object.keys(value) : [];
638
- profile.reader.collectionIds(ids.length);
399
+ const ids = node.kind === "table" && require_ownership.isRecord(value) && Array.isArray(value.ids) ? [...value.ids] : require_ownership.isRecord(value) ? Object.keys(value) : [];
400
+ require_ownership.profile.reader.collectionIds(ids.length);
639
401
  return ids;
640
402
  },
641
403
  has: (id) => {
642
404
  collectCollection(context, address, id);
643
405
  const value = readAt(context, address);
644
- const byId = node.kind === "table" && isRecord(value) && isRecord(value.byId) ? value.byId : value;
645
- return isRecord(byId) && Object.prototype.hasOwnProperty.call(byId, id);
406
+ const byId = node.kind === "table" && require_ownership.isRecord(value) && require_ownership.isRecord(value.byId) ? value.byId : value;
407
+ return require_ownership.isRecord(byId) && Object.prototype.hasOwnProperty.call(byId, id);
646
408
  },
647
409
  get: (id) => {
648
410
  collectCollection(context, address, id);
649
411
  const value = readAt(context, address);
650
- const byId = node.kind === "table" && isRecord(value) && isRecord(value.byId) ? value.byId : value;
651
- if (!isRecord(byId) || !Object.prototype.hasOwnProperty.call(byId, id)) return void 0;
412
+ const byId = node.kind === "table" && require_ownership.isRecord(value) && require_ownership.isRecord(value.byId) ? value.byId : value;
413
+ if (!require_ownership.isRecord(byId) || !Object.prototype.hasOwnProperty.call(byId, id)) return void 0;
652
414
  const cached = items?.get(id);
653
415
  if (cached) return cached;
654
416
  const reader = readerFor(node.value, context, [...address, id]);
@@ -661,7 +423,7 @@ const readerFor = (node, context, address = []) => {
661
423
  if (node.kind === "variant") return new Proxy({}, { get: (_target, property) => {
662
424
  if (typeof property === "symbol") return void 0;
663
425
  const value = readAt(context, address);
664
- const tag = isRecord(value) && typeof value[node.tag] === "string" ? String(value[node.tag]) : void 0;
426
+ const tag = require_ownership.isRecord(value) && typeof value[node.tag] === "string" ? String(value[node.tag]) : void 0;
665
427
  const child = (tag ? node.variants[tag] : void 0)?.shape[property];
666
428
  return child ? readerFor(child, context, [...address, property]) : void 0;
667
429
  } });
@@ -678,7 +440,7 @@ const readerFor = (node, context, address = []) => {
678
440
  } });
679
441
  };
680
442
  const documentReader = (schema, root, active, dependencies) => {
681
- profile.reader.session();
443
+ require_ownership.profile.reader.session();
682
444
  return readerFor(schemaRoot(schema), {
683
445
  root,
684
446
  active,
@@ -724,6 +486,22 @@ const readWith = (runtime, run, dependencies) => {
724
486
  }
725
487
  };
726
488
  //#endregion
489
+ //#region core/src/access/dependency.ts
490
+ const createDependencyTracker = () => {
491
+ const targets = [];
492
+ return {
493
+ record: (value) => {
494
+ if (!targets.some((entry) => same(entry, value))) targets.push(value);
495
+ },
496
+ clear: () => {
497
+ targets.length = 0;
498
+ },
499
+ size: () => targets.length,
500
+ some: (test) => targets.some(test),
501
+ snapshot: () => Object.freeze(targets.slice())
502
+ };
503
+ };
504
+ //#endregion
727
505
  Object.defineProperty(exports, "DocumentDisposedError", {
728
506
  enumerable: true,
729
507
  get: function() {
@@ -766,28 +544,22 @@ Object.defineProperty(exports, "bucket", {
766
544
  return bucket;
767
545
  }
768
546
  });
769
- Object.defineProperty(exports, "cloneValue", {
770
- enumerable: true,
771
- get: function() {
772
- return cloneValue;
773
- }
774
- });
775
547
  Object.defineProperty(exports, "contains", {
776
548
  enumerable: true,
777
549
  get: function() {
778
550
  return contains;
779
551
  }
780
552
  });
781
- Object.defineProperty(exports, "debugKey", {
553
+ Object.defineProperty(exports, "createDependencyTracker", {
782
554
  enumerable: true,
783
555
  get: function() {
784
- return debugKey;
556
+ return createDependencyTracker;
785
557
  }
786
558
  });
787
- Object.defineProperty(exports, "deepEqual", {
559
+ Object.defineProperty(exports, "debugKey", {
788
560
  enumerable: true,
789
561
  get: function() {
790
- return deepEqual;
562
+ return debugKey;
791
563
  }
792
564
  });
793
565
  Object.defineProperty(exports, "dict", {
@@ -826,24 +598,6 @@ Object.defineProperty(exports, "impact_target_exports", {
826
598
  return impact_target_exports;
827
599
  }
828
600
  });
829
- Object.defineProperty(exports, "isPlainObject", {
830
- enumerable: true,
831
- get: function() {
832
- return isPlainObject;
833
- }
834
- });
835
- Object.defineProperty(exports, "isRecord", {
836
- enumerable: true,
837
- get: function() {
838
- return isRecord;
839
- }
840
- });
841
- Object.defineProperty(exports, "isStablePayload", {
842
- enumerable: true,
843
- get: function() {
844
- return isStablePayload;
845
- }
846
- });
847
601
  Object.defineProperty(exports, "list", {
848
602
  enumerable: true,
849
603
  get: function() {
@@ -886,18 +640,6 @@ Object.defineProperty(exports, "overlaps", {
886
640
  return overlaps;
887
641
  }
888
642
  });
889
- Object.defineProperty(exports, "ownPayload", {
890
- enumerable: true,
891
- get: function() {
892
- return ownPayload;
893
- }
894
- });
895
- Object.defineProperty(exports, "profile", {
896
- enumerable: true,
897
- get: function() {
898
- return profile;
899
- }
900
- });
901
643
  Object.defineProperty(exports, "read", {
902
644
  enumerable: true,
903
645
  get: function() {
@@ -934,18 +676,6 @@ Object.defineProperty(exports, "resolveLocated", {
934
676
  return resolveLocated;
935
677
  }
936
678
  });
937
- Object.defineProperty(exports, "same", {
938
- enumerable: true,
939
- get: function() {
940
- return same;
941
- }
942
- });
943
- Object.defineProperty(exports, "sameStructuralValue", {
944
- enumerable: true,
945
- get: function() {
946
- return sameStructuralValue;
947
- }
948
- });
949
679
  Object.defineProperty(exports, "schema", {
950
680
  enumerable: true,
951
681
  get: function() {
@@ -970,24 +700,12 @@ Object.defineProperty(exports, "single", {
970
700
  return single;
971
701
  }
972
702
  });
973
- Object.defineProperty(exports, "snapshotPayload", {
974
- enumerable: true,
975
- get: function() {
976
- return snapshotPayload;
977
- }
978
- });
979
703
  Object.defineProperty(exports, "table", {
980
704
  enumerable: true,
981
705
  get: function() {
982
706
  return table;
983
707
  }
984
708
  });
985
- Object.defineProperty(exports, "transferPayload", {
986
- enumerable: true,
987
- get: function() {
988
- return transferPayload;
989
- }
990
- });
991
709
  Object.defineProperty(exports, "tree", {
992
710
  enumerable: true,
993
711
  get: function() {
@@ -1001,4 +719,4 @@ Object.defineProperty(exports, "variant", {
1001
719
  }
1002
720
  });
1003
721
 
1004
- //# sourceMappingURL=access-z56fVqZ2.cjs.map
722
+ //# sourceMappingURL=dependency-Dfzs3khk.cjs.map