doxum 0.1.1 → 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.
- package/README.md +77 -2
- package/dist/{contract-DwNiKioc.d.ts → contract-BsY1XLiG.d.ts} +64 -5
- package/dist/{contract-Otb5W6cQ.d.cts → contract-D8kjdfqT.d.cts} +64 -5
- package/dist/{dependency-BdEMyquf.js → dependency-C5_R1tvQ.js} +24 -263
- package/dist/dependency-C5_R1tvQ.js.map +1 -0
- package/dist/{dependency-DLcCvNKq.cjs → dependency-Dfzs3khk.cjs} +48 -341
- package/dist/dependency-Dfzs3khk.cjs.map +1 -0
- package/dist/driver-CNxqMVFH.cjs +69 -0
- package/dist/driver-CNxqMVFH.cjs.map +1 -0
- package/dist/driver-CbzfW5MR.js +46 -0
- package/dist/driver-CbzfW5MR.js.map +1 -0
- package/dist/index.cjs +428 -133
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -5
- package/dist/index.d.ts +8 -5
- package/dist/index.js +352 -61
- package/dist/index.js.map +1 -1
- package/dist/integration.cjs +1 -1
- package/dist/integration.cjs.map +1 -1
- package/dist/integration.d.cts +2 -2
- package/dist/integration.d.ts +2 -2
- package/dist/integration.js +1 -1
- package/dist/integration.js.map +1 -1
- package/dist/local-sync.cjs +485 -0
- package/dist/local-sync.cjs.map +1 -0
- package/dist/local-sync.d.cts +74 -0
- package/dist/local-sync.d.ts +74 -0
- package/dist/local-sync.js +476 -0
- package/dist/local-sync.js.map +1 -0
- package/dist/ownership-B-VAPcce.js +242 -0
- package/dist/ownership-B-VAPcce.js.map +1 -0
- package/dist/ownership-CU-9DKJQ.cjs +301 -0
- package/dist/ownership-CU-9DKJQ.cjs.map +1 -0
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js.map +1 -1
- package/package.json +14 -8
- package/skills/doxum-runtime/references/guide.en.md +60 -5
- package/skills/doxum-runtime/references/guide.zh-CN.md +48 -2
- package/skills/doxum-runtime/references/invariants.en.md +23 -8
- package/skills/doxum-runtime/references/invariants.zh-CN.md +2 -2
- package/dist/dependency-BdEMyquf.js.map +0 -1
- package/dist/dependency-DLcCvNKq.cjs.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
|
|
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
|
|
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
|
|
359
|
-
if (isRecord
|
|
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
|
|
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
|
|
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
|
|
250
|
+
if (!isRecord(current) && !Array.isArray(current)) return void 0;
|
|
430
251
|
const last = address[address.length - 1];
|
|
431
|
-
if (isRecord
|
|
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,66 +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" ? 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" ? 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 operationOwnsStructuralPayload = (operation) => operation.type === "variant.replace" || operation.type === "dict.replace" || operation.type === "entity.create" || operation.type === "list.insert" || operation.type === "list.replace" || operation.type === "tree.replace";
|
|
528
|
-
const deepEqual = (left, right) => {
|
|
529
|
-
profile.clone.deepEqual();
|
|
530
|
-
if (Object.is(left, right)) return true;
|
|
531
|
-
if (Array.isArray(left) && Array.isArray(right)) {
|
|
532
|
-
profile.clone.deepEqualContainer();
|
|
533
|
-
if (left.length !== right.length) return false;
|
|
534
|
-
for (let index = 0; index < left.length; index += 1) if (!deepEqual(left[index], right[index])) return false;
|
|
535
|
-
return true;
|
|
536
|
-
}
|
|
537
|
-
if (isPlainObject(left) && isPlainObject(right)) {
|
|
538
|
-
profile.clone.deepEqualContainer();
|
|
539
|
-
const leftKeys = Object.keys(left);
|
|
540
|
-
if (leftKeys.length !== Object.keys(right).length) return false;
|
|
541
|
-
for (const key of leftKeys) if (!Object.prototype.hasOwnProperty.call(right, key) || !deepEqual(left[key], right[key])) return false;
|
|
542
|
-
return true;
|
|
543
|
-
}
|
|
544
|
-
return false;
|
|
545
|
-
};
|
|
546
|
-
const sameStructuralValue = (left, right) => Object.is(left, right) || (Array.isArray(left) || isPlainObject(left)) && deepEqual(left, right);
|
|
547
|
-
const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
548
|
-
//#endregion
|
|
549
310
|
//#region core/src/access/reader.ts
|
|
550
311
|
const schemaRoot = (schema) => object(schema.shape);
|
|
551
312
|
const assertActive = (context) => {
|
|
@@ -553,7 +314,7 @@ const assertActive = (context) => {
|
|
|
553
314
|
};
|
|
554
315
|
const readAt = (context, address) => {
|
|
555
316
|
assertActive(context);
|
|
556
|
-
profile.reader.lookup();
|
|
317
|
+
require_ownership.profile.reader.lookup();
|
|
557
318
|
return read(context.root(), address);
|
|
558
319
|
};
|
|
559
320
|
const collectValue = (context, address) => {
|
|
@@ -577,15 +338,15 @@ const readerFor = (node, context, address = []) => {
|
|
|
577
338
|
} };
|
|
578
339
|
if (node.kind === "dict" || node.kind === "record") return { get: () => {
|
|
579
340
|
collectValue(context, address);
|
|
580
|
-
profile.reader.structuralSnapshot();
|
|
581
|
-
return cloneValue(readAt(context, address), "reader");
|
|
341
|
+
require_ownership.profile.reader.structuralSnapshot();
|
|
342
|
+
return require_ownership.cloneValue(readAt(context, address), "reader");
|
|
582
343
|
} };
|
|
583
344
|
if (node.kind === "list") return {
|
|
584
345
|
values: () => {
|
|
585
346
|
collectValue(context, address);
|
|
586
347
|
const value = readAt(context, address);
|
|
587
|
-
profile.reader.structuralSnapshot();
|
|
588
|
-
return cloneValue(Array.isArray(value) ? value : [], "reader");
|
|
348
|
+
require_ownership.profile.reader.structuralSnapshot();
|
|
349
|
+
return require_ownership.cloneValue(Array.isArray(value) ? value : [], "reader");
|
|
589
350
|
},
|
|
590
351
|
length: () => {
|
|
591
352
|
collectValue(context, address);
|
|
@@ -595,38 +356,38 @@ const readerFor = (node, context, address = []) => {
|
|
|
595
356
|
at: (index) => {
|
|
596
357
|
collectValue(context, address);
|
|
597
358
|
const value = readAt(context, address);
|
|
598
|
-
profile.reader.structuralSnapshot();
|
|
599
|
-
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");
|
|
600
361
|
}
|
|
601
362
|
};
|
|
602
363
|
if (node.kind === "tree") return {
|
|
603
364
|
rootId: () => {
|
|
604
365
|
collectValue(context, address);
|
|
605
366
|
const value = readAt(context, address);
|
|
606
|
-
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;
|
|
607
368
|
},
|
|
608
369
|
has: (id) => {
|
|
609
370
|
collectValue(context, address);
|
|
610
371
|
const value = readAt(context, address);
|
|
611
|
-
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);
|
|
612
373
|
},
|
|
613
374
|
value: (id) => {
|
|
614
375
|
collectValue(context, address);
|
|
615
376
|
const value = readAt(context, address);
|
|
616
|
-
profile.reader.structuralSnapshot();
|
|
617
|
-
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");
|
|
618
379
|
},
|
|
619
380
|
parent: (id) => {
|
|
620
381
|
collectValue(context, address);
|
|
621
382
|
const value = readAt(context, address);
|
|
622
|
-
const entry = isRecord(value) && isRecord(value.nodes) ? value.nodes[id] : void 0;
|
|
623
|
-
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;
|
|
624
385
|
},
|
|
625
386
|
children: (id) => {
|
|
626
387
|
collectValue(context, address);
|
|
627
388
|
const value = readAt(context, address);
|
|
628
|
-
const entry = isRecord(value) && isRecord(value.nodes) ? value.nodes[id] : void 0;
|
|
629
|
-
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] : [];
|
|
630
391
|
}
|
|
631
392
|
};
|
|
632
393
|
if (node.kind === "table" || node.kind === "map") {
|
|
@@ -635,21 +396,21 @@ const readerFor = (node, context, address = []) => {
|
|
|
635
396
|
ids: () => {
|
|
636
397
|
collectCollection(context, address);
|
|
637
398
|
const value = readAt(context, address);
|
|
638
|
-
const ids = node.kind === "table" && isRecord(value) && Array.isArray(value.ids) ? [...value.ids] : isRecord(value) ? Object.keys(value) : [];
|
|
639
|
-
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);
|
|
640
401
|
return ids;
|
|
641
402
|
},
|
|
642
403
|
has: (id) => {
|
|
643
404
|
collectCollection(context, address, id);
|
|
644
405
|
const value = readAt(context, address);
|
|
645
|
-
const byId = node.kind === "table" && isRecord(value) && isRecord(value.byId) ? value.byId : value;
|
|
646
|
-
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);
|
|
647
408
|
},
|
|
648
409
|
get: (id) => {
|
|
649
410
|
collectCollection(context, address, id);
|
|
650
411
|
const value = readAt(context, address);
|
|
651
|
-
const byId = node.kind === "table" && isRecord(value) && isRecord(value.byId) ? value.byId : value;
|
|
652
|
-
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;
|
|
653
414
|
const cached = items?.get(id);
|
|
654
415
|
if (cached) return cached;
|
|
655
416
|
const reader = readerFor(node.value, context, [...address, id]);
|
|
@@ -662,7 +423,7 @@ const readerFor = (node, context, address = []) => {
|
|
|
662
423
|
if (node.kind === "variant") return new Proxy({}, { get: (_target, property) => {
|
|
663
424
|
if (typeof property === "symbol") return void 0;
|
|
664
425
|
const value = readAt(context, address);
|
|
665
|
-
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;
|
|
666
427
|
const child = (tag ? node.variants[tag] : void 0)?.shape[property];
|
|
667
428
|
return child ? readerFor(child, context, [...address, property]) : void 0;
|
|
668
429
|
} });
|
|
@@ -679,7 +440,7 @@ const readerFor = (node, context, address = []) => {
|
|
|
679
440
|
} });
|
|
680
441
|
};
|
|
681
442
|
const documentReader = (schema, root, active, dependencies) => {
|
|
682
|
-
profile.reader.session();
|
|
443
|
+
require_ownership.profile.reader.session();
|
|
683
444
|
return readerFor(schemaRoot(schema), {
|
|
684
445
|
root,
|
|
685
446
|
active,
|
|
@@ -753,6 +514,12 @@ Object.defineProperty(exports, "DocumentReentrancyError", {
|
|
|
753
514
|
return DocumentReentrancyError;
|
|
754
515
|
}
|
|
755
516
|
});
|
|
517
|
+
Object.defineProperty(exports, "accessOf", {
|
|
518
|
+
enumerable: true,
|
|
519
|
+
get: function() {
|
|
520
|
+
return accessOf;
|
|
521
|
+
}
|
|
522
|
+
});
|
|
756
523
|
Object.defineProperty(exports, "address", {
|
|
757
524
|
enumerable: true,
|
|
758
525
|
get: function() {
|
|
@@ -777,12 +544,6 @@ Object.defineProperty(exports, "bucket", {
|
|
|
777
544
|
return bucket;
|
|
778
545
|
}
|
|
779
546
|
});
|
|
780
|
-
Object.defineProperty(exports, "cloneValue", {
|
|
781
|
-
enumerable: true,
|
|
782
|
-
get: function() {
|
|
783
|
-
return cloneValue;
|
|
784
|
-
}
|
|
785
|
-
});
|
|
786
547
|
Object.defineProperty(exports, "contains", {
|
|
787
548
|
enumerable: true,
|
|
788
549
|
get: function() {
|
|
@@ -801,12 +562,6 @@ Object.defineProperty(exports, "debugKey", {
|
|
|
801
562
|
return debugKey;
|
|
802
563
|
}
|
|
803
564
|
});
|
|
804
|
-
Object.defineProperty(exports, "deepEqual", {
|
|
805
|
-
enumerable: true,
|
|
806
|
-
get: function() {
|
|
807
|
-
return deepEqual;
|
|
808
|
-
}
|
|
809
|
-
});
|
|
810
565
|
Object.defineProperty(exports, "dict", {
|
|
811
566
|
enumerable: true,
|
|
812
567
|
get: function() {
|
|
@@ -843,18 +598,6 @@ Object.defineProperty(exports, "impact_target_exports", {
|
|
|
843
598
|
return impact_target_exports;
|
|
844
599
|
}
|
|
845
600
|
});
|
|
846
|
-
Object.defineProperty(exports, "isRecord", {
|
|
847
|
-
enumerable: true,
|
|
848
|
-
get: function() {
|
|
849
|
-
return isRecord;
|
|
850
|
-
}
|
|
851
|
-
});
|
|
852
|
-
Object.defineProperty(exports, "isStablePayload", {
|
|
853
|
-
enumerable: true,
|
|
854
|
-
get: function() {
|
|
855
|
-
return isStablePayload;
|
|
856
|
-
}
|
|
857
|
-
});
|
|
858
601
|
Object.defineProperty(exports, "list", {
|
|
859
602
|
enumerable: true,
|
|
860
603
|
get: function() {
|
|
@@ -885,12 +628,6 @@ Object.defineProperty(exports, "object", {
|
|
|
885
628
|
return object;
|
|
886
629
|
}
|
|
887
630
|
});
|
|
888
|
-
Object.defineProperty(exports, "operationOwnsStructuralPayload", {
|
|
889
|
-
enumerable: true,
|
|
890
|
-
get: function() {
|
|
891
|
-
return operationOwnsStructuralPayload;
|
|
892
|
-
}
|
|
893
|
-
});
|
|
894
631
|
Object.defineProperty(exports, "optional", {
|
|
895
632
|
enumerable: true,
|
|
896
633
|
get: function() {
|
|
@@ -903,18 +640,6 @@ Object.defineProperty(exports, "overlaps", {
|
|
|
903
640
|
return overlaps;
|
|
904
641
|
}
|
|
905
642
|
});
|
|
906
|
-
Object.defineProperty(exports, "ownPayload", {
|
|
907
|
-
enumerable: true,
|
|
908
|
-
get: function() {
|
|
909
|
-
return ownPayload;
|
|
910
|
-
}
|
|
911
|
-
});
|
|
912
|
-
Object.defineProperty(exports, "profile", {
|
|
913
|
-
enumerable: true,
|
|
914
|
-
get: function() {
|
|
915
|
-
return profile;
|
|
916
|
-
}
|
|
917
|
-
});
|
|
918
643
|
Object.defineProperty(exports, "read", {
|
|
919
644
|
enumerable: true,
|
|
920
645
|
get: function() {
|
|
@@ -951,12 +676,6 @@ Object.defineProperty(exports, "resolveLocated", {
|
|
|
951
676
|
return resolveLocated;
|
|
952
677
|
}
|
|
953
678
|
});
|
|
954
|
-
Object.defineProperty(exports, "sameStructuralValue", {
|
|
955
|
-
enumerable: true,
|
|
956
|
-
get: function() {
|
|
957
|
-
return sameStructuralValue;
|
|
958
|
-
}
|
|
959
|
-
});
|
|
960
679
|
Object.defineProperty(exports, "schema", {
|
|
961
680
|
enumerable: true,
|
|
962
681
|
get: function() {
|
|
@@ -981,24 +700,12 @@ Object.defineProperty(exports, "single", {
|
|
|
981
700
|
return single;
|
|
982
701
|
}
|
|
983
702
|
});
|
|
984
|
-
Object.defineProperty(exports, "snapshotPayload", {
|
|
985
|
-
enumerable: true,
|
|
986
|
-
get: function() {
|
|
987
|
-
return snapshotPayload;
|
|
988
|
-
}
|
|
989
|
-
});
|
|
990
703
|
Object.defineProperty(exports, "table", {
|
|
991
704
|
enumerable: true,
|
|
992
705
|
get: function() {
|
|
993
706
|
return table;
|
|
994
707
|
}
|
|
995
708
|
});
|
|
996
|
-
Object.defineProperty(exports, "transferPayload", {
|
|
997
|
-
enumerable: true,
|
|
998
|
-
get: function() {
|
|
999
|
-
return transferPayload;
|
|
1000
|
-
}
|
|
1001
|
-
});
|
|
1002
709
|
Object.defineProperty(exports, "tree", {
|
|
1003
710
|
enumerable: true,
|
|
1004
711
|
get: function() {
|
|
@@ -1012,4 +719,4 @@ Object.defineProperty(exports, "variant", {
|
|
|
1012
719
|
}
|
|
1013
720
|
});
|
|
1014
721
|
|
|
1015
|
-
//# sourceMappingURL=dependency-
|
|
722
|
+
//# sourceMappingURL=dependency-Dfzs3khk.cjs.map
|