doxum 0.1.7 → 0.1.9
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 +217 -296
- package/dist/contract-BNStLbSE.d.ts +441 -0
- package/dist/contract-CIU5FCC1.d.cts +441 -0
- package/dist/driver-BlR81Dqg.js +200 -0
- package/dist/driver-BlR81Dqg.js.map +1 -0
- package/dist/driver-xOIkwrB8.cjs +241 -0
- package/dist/driver-xOIkwrB8.cjs.map +1 -0
- package/dist/index.cjs +666 -2222
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -20
- package/dist/index.d.ts +10 -18
- package/dist/index.js +634 -2189
- package/dist/index.js.map +1 -1
- package/dist/{integration-CZwCwFBS.cjs → integration-C87tjRop.cjs} +4 -9
- package/dist/integration-C87tjRop.cjs.map +1 -0
- package/dist/{integration-B56u1l9V.js → integration-D5XCBLJ8.js} +2 -7
- package/dist/integration-D5XCBLJ8.js.map +1 -0
- package/dist/integration.cjs +11 -11
- package/dist/integration.d.cts +10 -4
- package/dist/integration.d.ts +10 -4
- package/dist/integration.js +4 -3
- package/dist/issue-DVaGQGeP.js +576 -0
- package/dist/issue-DVaGQGeP.js.map +1 -0
- package/dist/issue-DhrNdQNg.cjs +797 -0
- package/dist/issue-DhrNdQNg.cjs.map +1 -0
- package/dist/local-sync.cjs +67 -39
- package/dist/local-sync.cjs.map +1 -1
- package/dist/local-sync.d.cts +10 -10
- package/dist/local-sync.d.ts +10 -10
- package/dist/local-sync.js +66 -38
- package/dist/local-sync.js.map +1 -1
- package/dist/react.cjs +23 -4
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +8 -3
- package/dist/react.d.ts +8 -3
- package/dist/react.js +21 -6
- package/dist/react.js.map +1 -1
- package/dist/store-1Uob0Ghk.cjs +2750 -0
- package/dist/store-1Uob0Ghk.cjs.map +1 -0
- package/dist/store-CD0KdGsq.d.cts +262 -0
- package/dist/store-D7QH6Rzw.js +2511 -0
- package/dist/store-D7QH6Rzw.js.map +1 -0
- package/dist/store-cp5CpfCy.d.ts +262 -0
- package/package.json +1 -1
- package/skills/doxum-runtime/SKILL.md +26 -44
- package/skills/doxum-runtime/references/guide.en.md +95 -359
- package/skills/doxum-runtime/references/guide.zh-CN.md +80 -285
- package/skills/doxum-runtime/references/invariants.en.md +42 -165
- package/skills/doxum-runtime/references/invariants.zh-CN.md +34 -97
- package/skills/doxum-runtime/references/patterns.en.md +73 -225
- package/skills/doxum-runtime/references/patterns.zh-CN.md +73 -179
- package/dist/chunk-pbuEa-1d.js +0 -13
- package/dist/contract-DNZ4D53r.d.ts +0 -563
- package/dist/contract-j3SLGAwh.d.cts +0 -563
- package/dist/driver-CNxqMVFH.cjs +0 -69
- package/dist/driver-CNxqMVFH.cjs.map +0 -1
- package/dist/driver-CbzfW5MR.js +0 -46
- package/dist/driver-CbzfW5MR.js.map +0 -1
- package/dist/integration-B56u1l9V.js.map +0 -1
- package/dist/integration-CZwCwFBS.cjs.map +0 -1
- package/dist/ownership-CY0nPXGF.cjs +0 -304
- package/dist/ownership-CY0nPXGF.cjs.map +0 -1
- package/dist/ownership-CduRygE7.js +0 -245
- package/dist/ownership-CduRygE7.js.map +0 -1
- package/dist/runtime-0mOFbe_H.cjs +0 -2439
- package/dist/runtime-0mOFbe_H.cjs.map +0 -1
- package/dist/runtime-B22tuj9A.d.cts +0 -150
- package/dist/runtime-BFmhzPpZ.d.ts +0 -150
- package/dist/runtime-DF1q9Gje.js +0 -2129
- package/dist/runtime-DF1q9Gje.js.map +0 -1
|
@@ -0,0 +1,576 @@
|
|
|
1
|
+
const profile = {
|
|
2
|
+
projection: (key, amount = 1) => {},
|
|
3
|
+
recorder: (key, amount = 1) => {},
|
|
4
|
+
access: (key) => {},
|
|
5
|
+
copy: { structure: () => {} },
|
|
6
|
+
equality: {
|
|
7
|
+
call: () => {},
|
|
8
|
+
container: () => {}
|
|
9
|
+
},
|
|
10
|
+
address: {
|
|
11
|
+
listIndex: (items) => {},
|
|
12
|
+
schemaStep: () => {},
|
|
13
|
+
documentStep: () => {},
|
|
14
|
+
arrayCopied: () => {},
|
|
15
|
+
prefixComparison: () => {},
|
|
16
|
+
segmentCompared: () => {}
|
|
17
|
+
},
|
|
18
|
+
impact: {
|
|
19
|
+
index: () => {},
|
|
20
|
+
affects: () => {}
|
|
21
|
+
},
|
|
22
|
+
collectionView: {
|
|
23
|
+
mapped: () => {},
|
|
24
|
+
idsScanned: (amount = 1) => {},
|
|
25
|
+
arrayCopied: () => {}
|
|
26
|
+
},
|
|
27
|
+
materialized: {
|
|
28
|
+
updated: () => {},
|
|
29
|
+
rebuilt: () => {},
|
|
30
|
+
notification: () => {}
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region core/src/mutation/anchor.ts
|
|
35
|
+
const equal = (left, right) => {
|
|
36
|
+
profile.equality.call();
|
|
37
|
+
if (left === right) return true;
|
|
38
|
+
profile.equality.container();
|
|
39
|
+
if (left.length !== right.length) return false;
|
|
40
|
+
for (let i = 0; i < left.length; i++) if (left[i] !== keyAt(right, i)) return false;
|
|
41
|
+
return true;
|
|
42
|
+
};
|
|
43
|
+
const length = (keys) => keys.length;
|
|
44
|
+
const keyAt = (keys, index) => Array.isArray(keys) ? keys[index] : keys.at(index);
|
|
45
|
+
const keyIndex = (keys, key) => Array.isArray(keys) ? keys.indexOf(key) : keys.index(key);
|
|
46
|
+
const keys = (values, keyOf) => ({
|
|
47
|
+
length: values.length,
|
|
48
|
+
at: (index) => index >= 0 && index < values.length ? keyOf(values[index]) : void 0,
|
|
49
|
+
index: (key) => {
|
|
50
|
+
for (let index = 0; index < values.length; index += 1) if (keyOf(values[index]) === key) return index;
|
|
51
|
+
return -1;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
const listIndexes = /* @__PURE__ */ new WeakMap();
|
|
55
|
+
/** Canonical lists keep their key positions until a structural write invalidates them. */
|
|
56
|
+
const indexedKeys = (values, keyOf) => {
|
|
57
|
+
const cached = listIndexes.get(values);
|
|
58
|
+
if (cached?.keyOf === keyOf) return cached.order;
|
|
59
|
+
let positions;
|
|
60
|
+
const order = {
|
|
61
|
+
length: values.length,
|
|
62
|
+
at: (index) => index >= 0 && index < values.length ? keyOf(values[index]) : void 0,
|
|
63
|
+
index: (key) => {
|
|
64
|
+
if (!positions) {
|
|
65
|
+
positions = /* @__PURE__ */ new Map();
|
|
66
|
+
for (let i = 0; i < values.length; i++) positions.set(keyOf(values[i]), i);
|
|
67
|
+
profile.address.listIndex(values.length);
|
|
68
|
+
}
|
|
69
|
+
return positions.get(key) ?? -1;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
listIndexes.set(values, {
|
|
73
|
+
keyOf,
|
|
74
|
+
order
|
|
75
|
+
});
|
|
76
|
+
return order;
|
|
77
|
+
};
|
|
78
|
+
/** Structural sequence writes own invalidation, including rollback writes. */
|
|
79
|
+
const insert = (values, index, value) => {
|
|
80
|
+
values.splice(index, 0, value);
|
|
81
|
+
listIndexes.delete(values);
|
|
82
|
+
};
|
|
83
|
+
const remove = (values, index) => {
|
|
84
|
+
values.splice(index, 1);
|
|
85
|
+
listIndexes.delete(values);
|
|
86
|
+
};
|
|
87
|
+
const move = (values, from, to) => {
|
|
88
|
+
const [value] = values.splice(from, 1);
|
|
89
|
+
values.splice(to, 0, value);
|
|
90
|
+
listIndexes.delete(values);
|
|
91
|
+
};
|
|
92
|
+
const install = (values, keyOf, order) => {
|
|
93
|
+
const byKey = /* @__PURE__ */ new Map();
|
|
94
|
+
for (const value of values) byKey.set(keyOf(value), value);
|
|
95
|
+
values.length = order.length;
|
|
96
|
+
for (let index = 0; index < order.length; index++) values[index] = byKey.get(order[index]);
|
|
97
|
+
listIndexes.delete(values);
|
|
98
|
+
};
|
|
99
|
+
const matches = (order, members) => {
|
|
100
|
+
if (order.length !== members.length) return false;
|
|
101
|
+
const ids = new Set(order);
|
|
102
|
+
return ids.size === order.length && members.every((id) => ids.has(id));
|
|
103
|
+
};
|
|
104
|
+
const index = (keys, anchor) => {
|
|
105
|
+
if (!anchor) return length(keys);
|
|
106
|
+
if ("at" in anchor) return anchor.at === "start" ? 0 : length(keys);
|
|
107
|
+
if ("before" in anchor) return keyIndex(keys, anchor.before);
|
|
108
|
+
return keyIndex(keys, anchor.after) + 1;
|
|
109
|
+
};
|
|
110
|
+
const valid = (keys, anchor) => {
|
|
111
|
+
if (!anchor) return true;
|
|
112
|
+
if (typeof anchor !== "object" || anchor === null) return false;
|
|
113
|
+
if (Number("at" in anchor) + Number("before" in anchor) + Number("after" in anchor) !== 1) return false;
|
|
114
|
+
if ("at" in anchor) return anchor.at === "start" || anchor.at === "end";
|
|
115
|
+
return keyIndex(keys, "before" in anchor ? anchor.before : anchor.after) >= 0;
|
|
116
|
+
};
|
|
117
|
+
const afterRemove = (keys, removedIndex, anchor) => {
|
|
118
|
+
const position = index(keys, anchor);
|
|
119
|
+
return position > removedIndex ? position - 1 : position;
|
|
120
|
+
};
|
|
121
|
+
//#endregion
|
|
122
|
+
//#region core/src/value/ownership.ts
|
|
123
|
+
const isPlainObject = (value) => {
|
|
124
|
+
if (value === null || typeof value !== "object") return false;
|
|
125
|
+
const prototype = Object.getPrototypeOf(value);
|
|
126
|
+
return prototype === Object.prototype || prototype === null;
|
|
127
|
+
};
|
|
128
|
+
const isRecord$1 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
129
|
+
//#endregion
|
|
130
|
+
//#region core/src/mutation/tree.ts
|
|
131
|
+
const node = (tree, id) => Object.hasOwn(tree.nodes, id) ? tree.nodes[id] : void 0;
|
|
132
|
+
const is = (value) => isRecord$1(value) && isRecord$1(value.nodes);
|
|
133
|
+
const validNode = (value) => {
|
|
134
|
+
if (!isRecord$1(value) || !Array.isArray(value.children)) return false;
|
|
135
|
+
if (value.parentId !== void 0 && typeof value.parentId !== "string") return false;
|
|
136
|
+
const children = /* @__PURE__ */ new Set();
|
|
137
|
+
for (const id of value.children) {
|
|
138
|
+
if (typeof id !== "string" || children.has(id)) return false;
|
|
139
|
+
children.add(id);
|
|
140
|
+
}
|
|
141
|
+
return true;
|
|
142
|
+
};
|
|
143
|
+
const contains$1 = (tree, id) => Object.hasOwn(tree.nodes, id);
|
|
144
|
+
const parent = (tree, id) => node(tree, id)?.parentId;
|
|
145
|
+
const children = (tree, id) => node(tree, id)?.children;
|
|
146
|
+
const validate = (value) => {
|
|
147
|
+
if (!is(value)) return false;
|
|
148
|
+
const ids = Object.keys(value.nodes);
|
|
149
|
+
if (ids.length === 0) return value.rootId === void 0;
|
|
150
|
+
if (typeof value.rootId !== "string" || !Object.hasOwn(value.nodes, value.rootId)) return false;
|
|
151
|
+
for (const id of ids) {
|
|
152
|
+
const entry = value.nodes[id];
|
|
153
|
+
if (!validNode(entry)) return false;
|
|
154
|
+
if (id === value.rootId) {
|
|
155
|
+
if (entry.parentId !== void 0) return false;
|
|
156
|
+
} else if (entry.parentId === void 0 || !Object.hasOwn(value.nodes, entry.parentId)) return false;
|
|
157
|
+
for (const child of entry.children) {
|
|
158
|
+
const childNode = value.nodes[child];
|
|
159
|
+
if (!childNode || childNode.parentId !== id) return false;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
const seen = /* @__PURE__ */ new Set();
|
|
163
|
+
const stack = [value.rootId];
|
|
164
|
+
while (stack.length) {
|
|
165
|
+
const id = stack.pop();
|
|
166
|
+
if (seen.has(id)) return false;
|
|
167
|
+
seen.add(id);
|
|
168
|
+
const entry = value.nodes[id];
|
|
169
|
+
if (!entry) return false;
|
|
170
|
+
for (const child of entry.children) stack.push(child);
|
|
171
|
+
}
|
|
172
|
+
return seen.size === ids.length;
|
|
173
|
+
};
|
|
174
|
+
//#endregion
|
|
175
|
+
//#region core/src/address.ts
|
|
176
|
+
const registries = /* @__PURE__ */ new WeakMap();
|
|
177
|
+
const registryNode = () => ({ static: /* @__PURE__ */ new Map() });
|
|
178
|
+
const registryFor = (schema) => {
|
|
179
|
+
const cached = registries.get(schema);
|
|
180
|
+
if (cached) return cached;
|
|
181
|
+
const registry = {
|
|
182
|
+
root: registryNode(),
|
|
183
|
+
nextPath: 0
|
|
184
|
+
};
|
|
185
|
+
registries.set(schema, registry);
|
|
186
|
+
return registry;
|
|
187
|
+
};
|
|
188
|
+
const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
189
|
+
const variantNode = (node, value) => {
|
|
190
|
+
const tag = isRecord(value) && typeof value[node.tag] === "string" ? value[node.tag] : void 0;
|
|
191
|
+
return node.variants[String(tag ?? Object.keys(node.variants)[0] ?? "")];
|
|
192
|
+
};
|
|
193
|
+
const step = (nodeInput, value, segment) => {
|
|
194
|
+
let node = nodeInput;
|
|
195
|
+
if (!node) return void 0;
|
|
196
|
+
if (node.kind === "variant") node = variantNode(node, value);
|
|
197
|
+
if (!node) return void 0;
|
|
198
|
+
if (node.kind === "object") return Object.hasOwn(node.shape, segment) ? node.shape[segment] : void 0;
|
|
199
|
+
if (node.kind === "table" || node.kind === "map") return node.value;
|
|
200
|
+
if (node.kind === "list") return node.value;
|
|
201
|
+
};
|
|
202
|
+
const pathFor = (schema, address, document) => {
|
|
203
|
+
const registry = registryFor(schema);
|
|
204
|
+
let trie = registry.root;
|
|
205
|
+
let node = schema;
|
|
206
|
+
let value = document;
|
|
207
|
+
for (const segment of address) {
|
|
208
|
+
profile.address.schemaStep();
|
|
209
|
+
profile.address.documentStep();
|
|
210
|
+
const resolved = step(node, value, segment);
|
|
211
|
+
if (!resolved) return void 0;
|
|
212
|
+
trie = node && (node.kind === "table" || node.kind === "map" || node.kind === "list" || node.kind === "tree") ? trie.dynamic ??= registryNode() : (() => {
|
|
213
|
+
const existing = trie.static.get(segment);
|
|
214
|
+
if (existing) return existing;
|
|
215
|
+
const created = registryNode();
|
|
216
|
+
trie.static.set(segment, created);
|
|
217
|
+
return created;
|
|
218
|
+
})();
|
|
219
|
+
value = readSegment(value, segment, node);
|
|
220
|
+
node = resolved;
|
|
221
|
+
}
|
|
222
|
+
if (trie.path === void 0) trie.path = registry.nextPath++;
|
|
223
|
+
return trie.path;
|
|
224
|
+
};
|
|
225
|
+
const resolveAddress = (schema, address, document) => {
|
|
226
|
+
if (!Array.isArray(address)) return void 0;
|
|
227
|
+
for (const segment of address) if (typeof segment !== "string") return void 0;
|
|
228
|
+
profile.address.arrayCopied();
|
|
229
|
+
const owned = Object.freeze(address.slice());
|
|
230
|
+
const path = pathFor(schema, owned, document);
|
|
231
|
+
return path === void 0 ? void 0 : {
|
|
232
|
+
path,
|
|
233
|
+
address: owned
|
|
234
|
+
};
|
|
235
|
+
};
|
|
236
|
+
const nodeAt = (schema, address, document) => {
|
|
237
|
+
let node = schema;
|
|
238
|
+
let value = document;
|
|
239
|
+
for (const segment of address) {
|
|
240
|
+
const resolved = step(node, value, segment);
|
|
241
|
+
value = readSegment(value, segment, node);
|
|
242
|
+
node = resolved;
|
|
243
|
+
if (!node) return void 0;
|
|
244
|
+
}
|
|
245
|
+
return node;
|
|
246
|
+
};
|
|
247
|
+
const readSegment = (value, segment, node) => {
|
|
248
|
+
if (!isRecord(value) && !Array.isArray(value)) return void 0;
|
|
249
|
+
if (node?.kind === "list" && Array.isArray(value)) return value[indexedKeys(value, node.keyOf).index(segment)];
|
|
250
|
+
if (node?.kind === "table" && isRecord(value) && isRecord(value.byId)) return Object.hasOwn(value.byId, segment) ? value.byId[segment] : void 0;
|
|
251
|
+
return Object.prototype.hasOwnProperty.call(value, segment) ? value[segment] : void 0;
|
|
252
|
+
};
|
|
253
|
+
const read = (root, address, schema) => {
|
|
254
|
+
let value = root;
|
|
255
|
+
let node = schema;
|
|
256
|
+
for (const segment of address) {
|
|
257
|
+
const next = step(node, value, segment);
|
|
258
|
+
value = readSegment(value, segment, node);
|
|
259
|
+
node = next;
|
|
260
|
+
if (value === void 0) return void 0;
|
|
261
|
+
}
|
|
262
|
+
return value;
|
|
263
|
+
};
|
|
264
|
+
const compiledObjects = /* @__PURE__ */ new WeakMap();
|
|
265
|
+
const compiledEntries = /* @__PURE__ */ new WeakMap();
|
|
266
|
+
const compiledShape = (node, value) => {
|
|
267
|
+
const branch = node.kind === "variant" ? variantNode(node, value) : node;
|
|
268
|
+
if (branch?.kind !== "object") return void 0;
|
|
269
|
+
const shape = branch.shape;
|
|
270
|
+
let layout = compiledObjects.get(shape);
|
|
271
|
+
if (!layout) {
|
|
272
|
+
const compiled = /* @__PURE__ */ new Map();
|
|
273
|
+
for (const key of Object.keys(shape).sort()) {
|
|
274
|
+
profile.address.schemaStep();
|
|
275
|
+
compiled.set(key, {
|
|
276
|
+
kind: "fixed",
|
|
277
|
+
key,
|
|
278
|
+
node: shape[key],
|
|
279
|
+
field: shape[key].kind === "field",
|
|
280
|
+
slot: compiled.size
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
layout = {
|
|
284
|
+
kind: "fixed",
|
|
285
|
+
members: compiled
|
|
286
|
+
};
|
|
287
|
+
compiledObjects.set(shape, layout);
|
|
288
|
+
}
|
|
289
|
+
return layout;
|
|
290
|
+
};
|
|
291
|
+
const resolveContainer = (owner, generation, at, node, value) => {
|
|
292
|
+
if (!node || !isRecord(value) && !Array.isArray(value)) return void 0;
|
|
293
|
+
const parent = node.kind === "table" && isRecord(value) ? value.byId : value;
|
|
294
|
+
if (!isRecord(parent) && !Array.isArray(parent)) return void 0;
|
|
295
|
+
if (node.kind === "tree") return void 0;
|
|
296
|
+
let layout;
|
|
297
|
+
if (node.kind === "map" || node.kind === "table" || node.kind === "list") {
|
|
298
|
+
let dynamic = compiledEntries.get(node);
|
|
299
|
+
if (!dynamic) {
|
|
300
|
+
dynamic = {
|
|
301
|
+
kind: "dynamic",
|
|
302
|
+
entry: {
|
|
303
|
+
kind: "entry",
|
|
304
|
+
node: node.value,
|
|
305
|
+
field: node.value.kind === "field"
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
compiledEntries.set(node, dynamic);
|
|
309
|
+
}
|
|
310
|
+
layout = dynamic;
|
|
311
|
+
} else {
|
|
312
|
+
const fixed = compiledShape(node, value);
|
|
313
|
+
if (!fixed) return void 0;
|
|
314
|
+
layout = fixed;
|
|
315
|
+
}
|
|
316
|
+
return {
|
|
317
|
+
owner,
|
|
318
|
+
generation,
|
|
319
|
+
at,
|
|
320
|
+
node,
|
|
321
|
+
parent,
|
|
322
|
+
value,
|
|
323
|
+
layout
|
|
324
|
+
};
|
|
325
|
+
};
|
|
326
|
+
const resolveTreeContainer = (owner, generation, at, node, value) => node?.kind === "tree" && is(value) ? {
|
|
327
|
+
owner,
|
|
328
|
+
generation,
|
|
329
|
+
at,
|
|
330
|
+
node,
|
|
331
|
+
value
|
|
332
|
+
} : void 0;
|
|
333
|
+
const memberKey = (container, key) => container.node.kind === "list" ? indexedKeys(container.parent, container.node.keyOf).index(key) : key;
|
|
334
|
+
/** One recent path per transaction; structural writes invalidate all retained locations. */
|
|
335
|
+
const createAddressResolver = (schema, root) => {
|
|
336
|
+
const prefix = [];
|
|
337
|
+
return {
|
|
338
|
+
container: (owner, generation, at) => {
|
|
339
|
+
if (!at.length) return resolveContainer(owner, generation, at, schema, root);
|
|
340
|
+
const location = resolveWithPrefix(schema, root, at, prefix);
|
|
341
|
+
if (!location || !Object.hasOwn(location.parent, location.key)) return void 0;
|
|
342
|
+
return resolveContainer(owner, generation, at, location.node, location.parent[location.key]);
|
|
343
|
+
},
|
|
344
|
+
invalidate: () => {
|
|
345
|
+
prefix.length = 0;
|
|
346
|
+
}
|
|
347
|
+
};
|
|
348
|
+
};
|
|
349
|
+
/** A subtree root is a value, not a fabricated member of an ObjectNode. */
|
|
350
|
+
const resolveValue = (schema, root, address, prefix) => {
|
|
351
|
+
if (!address.length) return {
|
|
352
|
+
node: schema,
|
|
353
|
+
value: root
|
|
354
|
+
};
|
|
355
|
+
const location = resolveWithPrefix(schema, root, address, prefix);
|
|
356
|
+
return location && {
|
|
357
|
+
node: location.node,
|
|
358
|
+
value: Object.hasOwn(location.parent, location.key) ? location.parent[location.key] : void 0
|
|
359
|
+
};
|
|
360
|
+
};
|
|
361
|
+
/** Resolves schema and document location in one address traversal. */
|
|
362
|
+
const resolveLocated = (schema, root, address) => resolveWithPrefix(schema, root, address);
|
|
363
|
+
const resolveWithPrefix = (schema, root, address, prefix) => {
|
|
364
|
+
if (address.length === 0) return void 0;
|
|
365
|
+
let node = schema;
|
|
366
|
+
let current = root;
|
|
367
|
+
let start = 0;
|
|
368
|
+
if (prefix) {
|
|
369
|
+
while (start < prefix.length && start < address.length - 1 && prefix[start].segment === address[start]) start++;
|
|
370
|
+
prefix.length = start;
|
|
371
|
+
if (start) {
|
|
372
|
+
const retained = prefix[start - 1];
|
|
373
|
+
node = retained.node;
|
|
374
|
+
current = retained.value;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
let cacheable = true;
|
|
378
|
+
for (let index = start; index < address.length - 1; index += 1) {
|
|
379
|
+
profile.address.schemaStep();
|
|
380
|
+
profile.address.documentStep();
|
|
381
|
+
const resolved = step(node, current, address[index]);
|
|
382
|
+
if (!resolved) return void 0;
|
|
383
|
+
if (node?.kind !== "object" && node?.kind !== "table" && node?.kind !== "map") cacheable = false;
|
|
384
|
+
current = readSegment(current, address[index], node);
|
|
385
|
+
node = resolved;
|
|
386
|
+
if (prefix && cacheable) prefix.push({
|
|
387
|
+
segment: address[index],
|
|
388
|
+
node: resolved,
|
|
389
|
+
value: current
|
|
390
|
+
});
|
|
391
|
+
if (!node) return void 0;
|
|
392
|
+
}
|
|
393
|
+
const last = address[address.length - 1];
|
|
394
|
+
return resolveChild(node, current, last);
|
|
395
|
+
};
|
|
396
|
+
/** Resolves one member from an already current schema/container pair. */
|
|
397
|
+
const resolveChild = (node, current, last) => {
|
|
398
|
+
profile.address.schemaStep();
|
|
399
|
+
profile.address.documentStep();
|
|
400
|
+
const resolved = step(node, current, last);
|
|
401
|
+
if (!resolved || !isRecord(current) && !Array.isArray(current)) return void 0;
|
|
402
|
+
if (node?.kind === "table" && isRecord(current) && isRecord(current.byId)) return {
|
|
403
|
+
node: resolved,
|
|
404
|
+
parent: current.byId,
|
|
405
|
+
key: last
|
|
406
|
+
};
|
|
407
|
+
return {
|
|
408
|
+
node: resolved,
|
|
409
|
+
parent: current,
|
|
410
|
+
key: node?.kind === "list" && Array.isArray(current) ? indexedKeys(current, node.keyOf).index(last) : last
|
|
411
|
+
};
|
|
412
|
+
};
|
|
413
|
+
const contains = (parent, child) => {
|
|
414
|
+
profile.address.prefixComparison();
|
|
415
|
+
if (parent.length > child.length) return false;
|
|
416
|
+
for (let index = 0; index < parent.length; index += 1) {
|
|
417
|
+
profile.address.segmentCompared();
|
|
418
|
+
if (parent[index] !== child[index]) return false;
|
|
419
|
+
}
|
|
420
|
+
return true;
|
|
421
|
+
};
|
|
422
|
+
const overlaps = (a, b) => contains(a, b) || contains(b, a);
|
|
423
|
+
const debugKey = (address) => {
|
|
424
|
+
let result = "";
|
|
425
|
+
for (let index = 0; index < address.length; index += 1) {
|
|
426
|
+
if (index > 0) result += "/";
|
|
427
|
+
result += address[index].replaceAll("~", "~~").replaceAll("/", "~/");
|
|
428
|
+
}
|
|
429
|
+
return result;
|
|
430
|
+
};
|
|
431
|
+
/** An index over canonical address segments, shared by impact and subscriptions. */
|
|
432
|
+
var AddressIndex = class {
|
|
433
|
+
root = {
|
|
434
|
+
children: /* @__PURE__ */ new Map(),
|
|
435
|
+
values: /* @__PURE__ */ new Set()
|
|
436
|
+
};
|
|
437
|
+
add(address, value, member) {
|
|
438
|
+
let node = this.root;
|
|
439
|
+
for (let i = 0; i < address.length + (member === void 0 ? 0 : 1); i++) {
|
|
440
|
+
const segment = i < address.length ? address[i] : member;
|
|
441
|
+
let child = node.children.get(segment);
|
|
442
|
+
if (!child) {
|
|
443
|
+
child = {
|
|
444
|
+
children: /* @__PURE__ */ new Map(),
|
|
445
|
+
values: /* @__PURE__ */ new Set()
|
|
446
|
+
};
|
|
447
|
+
node.children.set(segment, child);
|
|
448
|
+
}
|
|
449
|
+
node = child;
|
|
450
|
+
}
|
|
451
|
+
node.values.add(value);
|
|
452
|
+
}
|
|
453
|
+
delete(address, value) {
|
|
454
|
+
const parents = [];
|
|
455
|
+
let node = this.root;
|
|
456
|
+
for (const segment of address) {
|
|
457
|
+
const child = node.children.get(segment);
|
|
458
|
+
if (!child) return;
|
|
459
|
+
parents.push(node);
|
|
460
|
+
node = child;
|
|
461
|
+
}
|
|
462
|
+
node.values.delete(value);
|
|
463
|
+
for (let i = address.length - 1; i >= 0 && !node.values.size && !node.children.size; i--) {
|
|
464
|
+
node = parents[i];
|
|
465
|
+
node.children.delete(address[i]);
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
exact(address) {
|
|
469
|
+
let node = this.root;
|
|
470
|
+
for (const segment of address) {
|
|
471
|
+
const child = node.children.get(segment);
|
|
472
|
+
if (!child) return void 0;
|
|
473
|
+
node = child;
|
|
474
|
+
}
|
|
475
|
+
return node.values;
|
|
476
|
+
}
|
|
477
|
+
hasAncestor(address, strict = false) {
|
|
478
|
+
let node = this.root;
|
|
479
|
+
for (let i = 0; i < address.length; i++) {
|
|
480
|
+
if (node.values.size) return true;
|
|
481
|
+
const child = node.children.get(address[i]);
|
|
482
|
+
if (!child) return false;
|
|
483
|
+
node = child;
|
|
484
|
+
}
|
|
485
|
+
return !strict && node.values.size > 0;
|
|
486
|
+
}
|
|
487
|
+
someAncestor(address, predicate) {
|
|
488
|
+
let node = this.root;
|
|
489
|
+
for (let i = 0;; i++) {
|
|
490
|
+
for (const value of node.values) if (predicate(value)) return true;
|
|
491
|
+
if (i === address.length) return false;
|
|
492
|
+
const child = node.children.get(address[i]);
|
|
493
|
+
if (!child) return false;
|
|
494
|
+
node = child;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
overlaps(address) {
|
|
498
|
+
let node = this.root;
|
|
499
|
+
for (const segment of address) {
|
|
500
|
+
if (node.values.size) return true;
|
|
501
|
+
const child = node.children.get(segment);
|
|
502
|
+
if (!child) return false;
|
|
503
|
+
node = child;
|
|
504
|
+
}
|
|
505
|
+
return node.values.size > 0 || node.children.size > 0;
|
|
506
|
+
}
|
|
507
|
+
hasDescendant(address) {
|
|
508
|
+
let node = this.root;
|
|
509
|
+
for (const segment of address) {
|
|
510
|
+
const child = node.children.get(segment);
|
|
511
|
+
if (!child) return false;
|
|
512
|
+
node = child;
|
|
513
|
+
}
|
|
514
|
+
return node.values.size > 0 || node.children.size > 0;
|
|
515
|
+
}
|
|
516
|
+
query(visit, relation = "overlap") {
|
|
517
|
+
const visited = /* @__PURE__ */ new Set();
|
|
518
|
+
const subtrees = /* @__PURE__ */ new Set();
|
|
519
|
+
const values = (node) => {
|
|
520
|
+
if (visited.has(node)) return;
|
|
521
|
+
visited.add(node);
|
|
522
|
+
node.values.forEach(visit);
|
|
523
|
+
};
|
|
524
|
+
const descend = (current) => {
|
|
525
|
+
if (subtrees.has(current)) return;
|
|
526
|
+
subtrees.add(current);
|
|
527
|
+
values(current);
|
|
528
|
+
current.children.forEach(descend);
|
|
529
|
+
};
|
|
530
|
+
const terminal = (node) => relation === "ancestors" ? values(node) : descend(node);
|
|
531
|
+
return (address, members) => {
|
|
532
|
+
let node = this.root;
|
|
533
|
+
for (const segment of address) {
|
|
534
|
+
if (subtrees.has(node)) return;
|
|
535
|
+
if (relation !== "descendants") values(node);
|
|
536
|
+
const child = node.children.get(segment);
|
|
537
|
+
if (!child) return;
|
|
538
|
+
node = child;
|
|
539
|
+
}
|
|
540
|
+
if (!members) terminal(node);
|
|
541
|
+
else {
|
|
542
|
+
if (relation !== "descendants") values(node);
|
|
543
|
+
for (const member of members) {
|
|
544
|
+
const child = node.children.get(member.key);
|
|
545
|
+
if (child) terminal(child);
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
};
|
|
549
|
+
}
|
|
550
|
+
clear() {
|
|
551
|
+
this.root.values.clear();
|
|
552
|
+
this.root.children.clear();
|
|
553
|
+
}
|
|
554
|
+
};
|
|
555
|
+
//#endregion
|
|
556
|
+
//#region core/src/mutation/issue.ts
|
|
557
|
+
const at = (address, code, message) => Object.freeze({
|
|
558
|
+
source: "mutation",
|
|
559
|
+
code,
|
|
560
|
+
address: Object.freeze([...address]),
|
|
561
|
+
message
|
|
562
|
+
});
|
|
563
|
+
var MutationRejected = class extends Error {
|
|
564
|
+
constructor(issue) {
|
|
565
|
+
super(issue.message);
|
|
566
|
+
this.issue = issue;
|
|
567
|
+
}
|
|
568
|
+
};
|
|
569
|
+
const fail = (address, code, message) => {
|
|
570
|
+
throw new MutationRejected(at(address, code, message));
|
|
571
|
+
};
|
|
572
|
+
const invalidValue = (issue, address = issue.address) => fail(address, issue.code === "missing-validator" ? "invalid-value" : issue.code, issue.message);
|
|
573
|
+
//#endregion
|
|
574
|
+
export { insert as A, validate as C, equal as D, afterRemove as E, remove as F, valid as I, profile as L, keys as M, matches as N, index as O, move as P, validNode as S, isRecord$1 as T, resolveTreeContainer as _, compiledShape as a, contains$1 as b, debugKey as c, overlaps as d, read as f, resolveLocated as g, resolveContainer as h, AddressIndex as i, install as j, indexedKeys as k, memberKey as l, resolveChild as m, fail as n, contains as o, resolveAddress as p, invalidValue as r, createAddressResolver as s, MutationRejected as t, nodeAt as u, resolveValue as v, isPlainObject as w, parent as x, children as y };
|
|
575
|
+
|
|
576
|
+
//# sourceMappingURL=issue-DVaGQGeP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issue-DVaGQGeP.js","names":["isRecord","isRecord","contains","anchor.indexedKeys","isTree"],"sources":["../core/src/profile.ts","../core/src/mutation/anchor.ts","../core/src/value/ownership.ts","../core/src/mutation/tree.ts","../core/src/address.ts","../core/src/mutation/issue.ts"],"sourcesContent":["const counters = () => ({\n projection: {\n sourceEvents: 0,\n scheduledNodes: 0,\n processedNodes: 0,\n touchedKeys: 0,\n changedKeys: 0,\n publishedNodes: 0,\n flushes: 0,\n },\n copy: { structures: 0 },\n equality: { calls: 0, containers: 0 },\n recorder: {\n facts: 0,\n groups: 0,\n transitions: 0,\n absorbed: 0,\n orderSnapshots: 0,\n orderCaptures: 0,\n orderItems: 0,\n publishedOrderItems: 0,\n treeNodes: 0,\n sealed: 0,\n indexedGroups: 0,\n },\n access: { scopes: 0, proxies: 0, snapshots: 0, addresses: 0, resolutions: 0 },\n address: {\n schemaSteps: 0,\n documentSteps: 0,\n prefixComparisons: 0,\n segmentsCompared: 0,\n arraysCopied: 0,\n listIndexes: 0,\n listItems: 0,\n },\n impact: { affectsChecks: 0, indexes: 0 },\n collectionView: { mappedItems: 0, idsScanned: 0, arraysCopied: 0 },\n materialized: { updated: 0, rebuilt: 0, notifications: 0 },\n});\ntype Counters = ReturnType<typeof counters>;\ntype DeepReadonly<T> = { readonly [K in keyof T]: T[K] extends object ? DeepReadonly<T[K]> : T[K] };\nexport type ProfileSnapshot = DeepReadonly<Counters>;\nlet active: Counters | undefined;\nconst freeze = <T extends object>(value: T): DeepReadonly<T> => {\n Object.values(value).forEach(child => {\n if (child && typeof child === 'object') freeze(child);\n });\n return Object.freeze(value) as DeepReadonly<T>;\n};\nexport const profile = {\n projection: (key: keyof Counters['projection'], amount = 1) => {\n if (active) active.projection[key] += amount;\n },\n recorder: (key: keyof Counters['recorder'], amount = 1) => {\n if (active) active.recorder[key] += amount;\n },\n access: (key: keyof Counters['access']) => {\n if (active) active.access[key]++;\n },\n copy: {\n structure: () => {\n if (active) active.copy.structures++;\n },\n },\n equality: {\n call: () => {\n if (active) active.equality.calls++;\n },\n container: () => {\n if (active) active.equality.containers++;\n },\n },\n address: {\n listIndex: (items: number) => {\n if (active) {\n active.address.listIndexes++;\n active.address.listItems += items;\n }\n },\n schemaStep: () => {\n if (active) active.address.schemaSteps++;\n },\n documentStep: () => {\n if (active) active.address.documentSteps++;\n },\n arrayCopied: () => {\n if (active) active.address.arraysCopied++;\n },\n prefixComparison: () => {\n if (active) active.address.prefixComparisons++;\n },\n segmentCompared: () => {\n if (active) active.address.segmentsCompared++;\n },\n },\n impact: {\n index: () => {\n if (active) active.impact.indexes++;\n },\n affects: () => {\n if (active) active.impact.affectsChecks++;\n },\n },\n collectionView: {\n mapped: () => {\n if (active) active.collectionView.mappedItems++;\n },\n idsScanned: (amount = 1) => {\n if (active) active.collectionView.idsScanned += amount;\n },\n arrayCopied: () => {\n if (active) active.collectionView.arraysCopied++;\n },\n },\n materialized: {\n updated: () => {\n if (active) active.materialized.updated++;\n },\n rebuilt: () => {\n if (active) active.materialized.rebuilt++;\n },\n notification: () => {\n if (active) active.materialized.notifications++;\n },\n },\n};\nexport type ProfileSession = { snapshot(): ProfileSnapshot; stop(): ProfileSnapshot };\nexport const startProfile = (): ProfileSession => {\n if (active) throw new Error('A document profile session is already active.');\n const value = counters();\n active = value;\n const snapshot = () => freeze(structuredClone(value));\n return {\n snapshot,\n stop: () => {\n if (active === value) active = undefined;\n return snapshot();\n },\n };\n};\nexport const measureProfile = <T>(run: () => T): { value: T; profile: ProfileSnapshot } => {\n const session = startProfile();\n try {\n return { value: run(), profile: session.stop() };\n } finally {\n session.stop();\n }\n};\n","import type { DocumentAnchor } from '../schema';\nimport { profile } from '../profile';\n\nexport const equal = (left: readonly string[], right: Keys): boolean => {\n profile.equality.call();\n if (left === right) return true;\n profile.equality.container();\n if (left.length !== right.length) return false;\n for (let i = 0; i < left.length; i++) if (left[i] !== keyAt(right, i)) return false;\n return true;\n};\n\nexport type KeyOrder = {\n readonly length: number;\n readonly at: (index: number) => string | undefined;\n readonly index: (key: string) => number;\n};\n\ntype Keys = readonly string[] | KeyOrder;\n\nconst length = (keys: Keys): number => keys.length;\nconst keyAt = (keys: Keys, index: number): string | undefined =>\n Array.isArray(keys) ? keys[index] : keys.at(index);\nconst keyIndex = (keys: Keys, key: string): number =>\n Array.isArray(keys) ? keys.indexOf(key) : (keys as KeyOrder).index(key);\n\nexport const keys = (values: readonly unknown[], keyOf: (value: unknown) => string): KeyOrder => ({\n length: values.length,\n at: index => (index >= 0 && index < values.length ? keyOf(values[index]) : undefined),\n index: key => {\n for (let index = 0; index < values.length; index += 1)\n if (keyOf(values[index]) === key) return index;\n return -1;\n },\n});\n\nconst listIndexes = new WeakMap<\n readonly unknown[],\n { keyOf: (value: unknown) => string; order: KeyOrder }\n>();\n\n/** Canonical lists keep their key positions until a structural write invalidates them. */\nexport const indexedKeys = (\n values: readonly unknown[],\n keyOf: (value: unknown) => string\n): KeyOrder => {\n const cached = listIndexes.get(values);\n if (cached?.keyOf === keyOf) return cached.order;\n let positions: Map<string, number> | undefined;\n const order: KeyOrder = {\n length: values.length,\n at: index => (index >= 0 && index < values.length ? keyOf(values[index]) : undefined),\n index: key => {\n if (!positions) {\n positions = new Map();\n for (let i = 0; i < values.length; i++) positions.set(keyOf(values[i]), i);\n profile.address.listIndex(values.length);\n }\n return positions.get(key) ?? -1;\n },\n };\n listIndexes.set(values, { keyOf, order });\n return order;\n};\n\n/** Structural sequence writes own invalidation, including rollback writes. */\nexport const insert = (values: unknown[], index: number, value: unknown): void => {\n values.splice(index, 0, value);\n listIndexes.delete(values);\n};\n\nexport const remove = (values: unknown[], index: number): void => {\n values.splice(index, 1);\n listIndexes.delete(values);\n};\n\nexport const move = (values: unknown[], from: number, to: number): void => {\n const [value] = values.splice(from, 1);\n values.splice(to, 0, value);\n listIndexes.delete(values);\n};\n\nexport const install = (\n values: unknown[],\n keyOf: (value: unknown) => string,\n order: readonly string[]\n): void => {\n const byKey = new Map<string, unknown>();\n for (const value of values) byKey.set(keyOf(value), value);\n values.length = order.length;\n for (let index = 0; index < order.length; index++) values[index] = byKey.get(order[index]);\n listIndexes.delete(values);\n};\n\nexport const matches = (order: readonly string[], members: readonly string[]): boolean => {\n if (order.length !== members.length) return false;\n const ids = new Set(order);\n return ids.size === order.length && members.every(id => ids.has(id));\n};\n\nexport const index = (keys: Keys, anchor?: DocumentAnchor): number => {\n if (!anchor) return length(keys);\n if ('at' in anchor) return anchor.at === 'start' ? 0 : length(keys);\n if ('before' in anchor) return keyIndex(keys, anchor.before);\n return keyIndex(keys, anchor.after) + 1;\n};\n\nexport const at = (keys: Keys, position: number): DocumentAnchor =>\n position <= 0 ? { at: 'start' } : { after: keyAt(keys, position - 1) as string };\n\nexport const valid = (keys: Keys, anchor?: DocumentAnchor): boolean => {\n if (!anchor) return true;\n if (typeof anchor !== 'object' || anchor === null) return false;\n if (Number('at' in anchor) + Number('before' in anchor) + Number('after' in anchor) !== 1)\n return false;\n if ('at' in anchor) return anchor.at === 'start' || anchor.at === 'end';\n return keyIndex(keys, 'before' in anchor ? anchor.before : anchor.after) >= 0;\n};\n\nexport const afterRemove = (keys: Keys, removedIndex: number, anchor?: DocumentAnchor): number => {\n const position = index(keys, anchor);\n return position > removedIndex ? position - 1 : position;\n};\n\nexport const validPositions = (length: number, positions: readonly number[]): boolean => {\n let previous = -1;\n for (let index = 0; index < positions.length; index += 1) {\n const position = positions[index];\n if (\n !Number.isInteger(position) ||\n position < 0 ||\n position <= previous ||\n position > length + index\n )\n return false;\n previous = position;\n }\n return true;\n};\n\nexport const restore = (\n keys: string[],\n inserted: readonly string[],\n positions: readonly number[]\n): void => {\n const currentLength = keys.length;\n if (inserted.length !== positions.length || !validPositions(currentLength, positions))\n throw new Error('Ordered restore positions are invalid.');\n let readIndex = currentLength - 1;\n let insertedIndex = inserted.length - 1;\n keys.length = currentLength + inserted.length;\n for (let writeIndex = keys.length - 1; writeIndex >= 0; writeIndex -= 1) {\n if (insertedIndex >= 0 && positions[insertedIndex] === writeIndex) {\n keys[writeIndex] = inserted[insertedIndex];\n insertedIndex -= 1;\n } else {\n keys[writeIndex] = keys[readIndex];\n readIndex -= 1;\n }\n }\n};\n","export const isPlainObject = (value: unknown): value is Record<string, unknown> => {\n if (value === null || typeof value !== 'object') return false;\n const prototype = Object.getPrototypeOf(value);\n return prototype === Object.prototype || prototype === null;\n};\n\nexport const isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && value !== null && !Array.isArray(value);\n","import { isRecord } from '../value/ownership';\nexport type MutableTreeNode = { parentId?: string; children: string[]; value?: unknown };\nexport type MutableTree = { rootId?: string; nodes: Record<string, MutableTreeNode> };\nconst node = (tree: MutableTree, id: string) =>\n Object.hasOwn(tree.nodes, id) ? tree.nodes[id] : undefined;\nexport const is = (value: unknown): value is MutableTree =>\n isRecord(value) && isRecord(value.nodes);\n\nexport const validNode = (value: unknown): value is MutableTreeNode => {\n if (!isRecord(value) || !Array.isArray(value.children)) return false;\n if (value.parentId !== undefined && typeof value.parentId !== 'string') return false;\n const children = new Set<string>();\n for (const id of value.children) {\n if (typeof id !== 'string' || children.has(id)) return false;\n children.add(id);\n }\n return true;\n};\n\nexport const contains = (tree: MutableTree, id: string): boolean => Object.hasOwn(tree.nodes, id);\n\nexport const parent = (tree: MutableTree, id: string): string | undefined =>\n node(tree, id)?.parentId;\n\nexport const children = (tree: MutableTree, id: string): readonly string[] | undefined =>\n node(tree, id)?.children;\n\nexport const validate = (value: unknown): value is MutableTree => {\n if (!is(value)) return false;\n const ids = Object.keys(value.nodes);\n if (ids.length === 0) return value.rootId === undefined;\n if (typeof value.rootId !== 'string' || !Object.hasOwn(value.nodes, value.rootId)) return false;\n\n for (const id of ids) {\n const entry = value.nodes[id];\n if (!validNode(entry)) return false;\n if (id === value.rootId) {\n if (entry.parentId !== undefined) return false;\n } else if (entry.parentId === undefined || !Object.hasOwn(value.nodes, entry.parentId))\n return false;\n for (const child of entry.children) {\n const childNode = value.nodes[child];\n if (!childNode || childNode.parentId !== id) return false;\n }\n }\n\n const seen = new Set<string>();\n const stack = [value.rootId];\n while (stack.length) {\n const id = stack.pop() as string;\n if (seen.has(id)) return false;\n seen.add(id);\n const entry = value.nodes[id];\n if (!entry) return false;\n for (const child of entry.children) stack.push(child);\n }\n return seen.size === ids.length;\n};\n\nexport type TreePosition = { readonly parentId?: string; readonly index?: number };\n","import type { DocumentAddress, DocumentNode, ObjectNode, ObjectShape } from './schema';\nimport * as anchor from './mutation/anchor';\nimport { profile } from './profile';\nimport type { MutableTree } from './mutation/tree';\nimport { is as isTree } from './mutation/tree';\n\n/** The only resolved address representation used inside the runtime. */\nexport type AddressRef = {\n readonly path: number;\n readonly address: DocumentAddress;\n};\n\ntype RegistryNode = {\n readonly static: Map<string, RegistryNode>;\n dynamic?: RegistryNode;\n path?: number;\n};\n\ntype Registry = {\n readonly root: RegistryNode;\n nextPath: number;\n};\n\nconst registries = new WeakMap<object, Registry>();\nconst registryNode = (): RegistryNode => ({ static: new Map() });\nconst registryFor = (schema: ObjectNode): Registry => {\n const cached = registries.get(schema as object);\n if (cached) return cached;\n const registry: Registry = { root: registryNode(), nextPath: 0 };\n registries.set(schema as object, registry);\n return registry;\n};\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && value !== null && !Array.isArray(value);\n\nconst variantNode = (\n node: Extract<DocumentNode, { kind: 'variant' }>,\n value: unknown\n): DocumentNode | undefined => {\n const tag = isRecord(value) && typeof value[node.tag] === 'string' ? value[node.tag] : undefined;\n return node.variants[String(tag ?? Object.keys(node.variants)[0] ?? '')];\n};\n\nconst step = (\n nodeInput: DocumentNode | undefined,\n value: unknown,\n segment: string\n): DocumentNode | undefined => {\n let node = nodeInput;\n if (!node) return undefined;\n if (node.kind === 'variant') {\n node = variantNode(node, value);\n }\n if (!node) return undefined;\n if (node.kind === 'object')\n return Object.hasOwn(node.shape, segment) ? node.shape[segment] : undefined;\n if (node.kind === 'table' || node.kind === 'map') return node.value;\n // List items use stable keys; tree topology remains a structural unit.\n if (node.kind === 'list') return node.value;\n return undefined;\n};\n\nconst pathFor = (\n schema: ObjectNode,\n address: DocumentAddress,\n document?: unknown\n): number | undefined => {\n const registry = registryFor(schema);\n let trie = registry.root;\n let node: DocumentNode | undefined = schema;\n let value: unknown = document;\n for (const segment of address) {\n profile.address.schemaStep();\n profile.address.documentStep();\n const resolved = step(node, value, segment);\n if (!resolved) return undefined;\n const next =\n node &&\n (node.kind === 'table' || node.kind === 'map' || node.kind === 'list' || node.kind === 'tree')\n ? (trie.dynamic ??= registryNode())\n : (() => {\n const existing = trie.static.get(segment);\n if (existing) return existing;\n const created = registryNode();\n trie.static.set(segment, created);\n return created;\n })();\n trie = next;\n value = readSegment(value, segment, node);\n node = resolved;\n }\n if (trie.path === undefined) trie.path = registry.nextPath++;\n return trie.path;\n};\n\nexport const resolveAddress = (\n schema: ObjectNode,\n address: DocumentAddress,\n document?: unknown\n): AddressRef | undefined => {\n if (!Array.isArray(address)) return undefined;\n for (const segment of address) if (typeof segment !== 'string') return undefined;\n profile.address.arrayCopied();\n const owned = Object.freeze(address.slice()) as DocumentAddress;\n const path = pathFor(schema, owned, document);\n return path === undefined ? undefined : { path, address: owned };\n};\n\nexport const nodeAt = (\n schema: DocumentNode,\n address: DocumentAddress,\n document?: unknown\n): DocumentNode | undefined => {\n let node: DocumentNode | undefined = schema;\n let value = document;\n for (const segment of address) {\n const resolved = step(node, value, segment);\n value = readSegment(value, segment, node);\n node = resolved;\n if (!node) return undefined;\n }\n return node;\n};\n\nexport const readSegment = (value: unknown, segment: string, node?: DocumentNode): unknown => {\n if (!isRecord(value) && !Array.isArray(value)) return undefined;\n if (node?.kind === 'list' && Array.isArray(value))\n return value[anchor.indexedKeys(value, node.keyOf).index(segment)];\n if (node?.kind === 'table' && isRecord(value) && isRecord(value.byId)) {\n return Object.hasOwn(value.byId, segment) ? value.byId[segment] : undefined;\n }\n return Object.prototype.hasOwnProperty.call(value, segment)\n ? (value as Record<string, unknown>)[segment]\n : undefined;\n};\n\nexport const read = (root: unknown, address: DocumentAddress, schema: DocumentNode): unknown => {\n let value = root;\n let node: DocumentNode | undefined = schema;\n for (const segment of address) {\n const next = step(node, value, segment);\n value = readSegment(value, segment, node);\n node = next;\n if (value === undefined) return undefined;\n }\n return value;\n};\n\nexport type ResolvedAddress = {\n readonly parent: Record<string, unknown> | unknown[];\n readonly key: string | number;\n readonly node: DocumentNode;\n};\n\ntype MemberDefinition = {\n readonly node: DocumentNode;\n readonly field: boolean;\n};\nexport type FixedMember = MemberDefinition & {\n readonly kind: 'fixed';\n readonly key: string;\n readonly slot: number;\n};\ntype CollectionMember = MemberDefinition & { readonly kind: 'entry' };\nexport type CompiledMember = FixedMember | CollectionMember;\nexport type FixedLayout = {\n readonly kind: 'fixed';\n readonly members: ReadonlyMap<string, FixedMember>;\n};\ntype DynamicLayout = { readonly kind: 'dynamic'; readonly entry: CollectionMember };\nexport type MemberLayout = FixedLayout | DynamicLayout;\nconst compiledObjects = new WeakMap<object, FixedLayout>();\nconst compiledEntries = new WeakMap<DocumentNode, DynamicLayout>();\nexport const compiledShape = (node: DocumentNode, value: unknown): FixedLayout | undefined => {\n const branch = node.kind === 'variant' ? variantNode(node, value) : node;\n if (branch?.kind !== 'object') return undefined;\n const shape: ObjectShape = branch.shape;\n let layout = compiledObjects.get(shape);\n if (!layout) {\n const compiled = new Map<string, FixedMember>();\n for (const key of Object.keys(shape).sort()) {\n profile.address.schemaStep();\n compiled.set(key, {\n kind: 'fixed',\n key,\n node: shape[key],\n field: shape[key].kind === 'field',\n slot: compiled.size,\n });\n }\n layout = { kind: 'fixed', members: compiled };\n compiledObjects.set(shape, layout);\n }\n return layout;\n};\n\n/** Immutable location facts, valid only for the resolving session generation. */\nexport type ResolvedContainer = {\n readonly owner: object;\n readonly generation: number;\n readonly at: DocumentAddress;\n readonly node: Exclude<DocumentNode, { kind: 'tree' }>;\n readonly parent: Record<string, unknown> | unknown[];\n readonly value: unknown;\n readonly layout: MemberLayout;\n};\nexport type ResolvedTreeContainer = {\n readonly owner: object;\n readonly generation: number;\n readonly at: DocumentAddress;\n readonly node: Extract<DocumentNode, { kind: 'tree' }>;\n readonly value: MutableTree;\n};\nexport const resolveContainer = (\n owner: object,\n generation: number,\n at: DocumentAddress,\n node: DocumentNode | undefined,\n value: unknown\n): ResolvedContainer | undefined => {\n if (!node || (!isRecord(value) && !Array.isArray(value))) return undefined;\n const parent = node.kind === 'table' && isRecord(value) ? value.byId : value;\n if (!isRecord(parent) && !Array.isArray(parent)) return undefined;\n if (node.kind === 'tree') return undefined;\n let layout: MemberLayout;\n if (node.kind === 'map' || node.kind === 'table' || node.kind === 'list') {\n let dynamic = compiledEntries.get(node);\n if (!dynamic) {\n dynamic = {\n kind: 'dynamic',\n entry: { kind: 'entry', node: node.value, field: node.value.kind === 'field' },\n };\n compiledEntries.set(node, dynamic);\n }\n layout = dynamic;\n } else {\n const fixed = compiledShape(node, value);\n if (!fixed) return undefined;\n layout = fixed;\n }\n return { owner, generation, at, node, parent, value, layout };\n};\nexport const resolveTreeContainer = (\n owner: object,\n generation: number,\n at: DocumentAddress,\n node: DocumentNode | undefined,\n value: unknown\n): ResolvedTreeContainer | undefined =>\n node?.kind === 'tree' && isTree(value) ? { owner, generation, at, node, value } : undefined;\nexport const memberKey = (\n container: { readonly node: DocumentNode; readonly parent: Record<string, unknown> | unknown[] },\n key: string\n): string | number =>\n container.node.kind === 'list'\n ? anchor.indexedKeys(container.parent as unknown[], container.node.keyOf).index(key)\n : key;\n\ntype ResolutionPrefix = {\n segment: string;\n node: DocumentNode;\n value: unknown;\n};\n\n/** One recent path per transaction; structural writes invalidate all retained locations. */\nexport const createAddressResolver = (schema: DocumentNode, root: unknown) => {\n const prefix: ResolutionPrefix[] = [];\n return {\n container: (owner: object, generation: number, at: DocumentAddress) => {\n if (!at.length) return resolveContainer(owner, generation, at, schema, root);\n const location = resolveWithPrefix(schema, root, at, prefix);\n if (!location || !Object.hasOwn(location.parent, location.key)) return undefined;\n return resolveContainer(\n owner,\n generation,\n at,\n location.node,\n (location.parent as Record<string | number, unknown>)[location.key]\n );\n },\n invalidate: () => {\n prefix.length = 0;\n },\n };\n};\n\n/** A subtree root is a value, not a fabricated member of an ObjectNode. */\nexport const resolveValue = (\n schema: DocumentNode,\n root: unknown,\n address: DocumentAddress,\n prefix?: ResolutionPrefix[]\n): { node: DocumentNode; value: unknown } | undefined => {\n if (!address.length) return { node: schema, value: root };\n const location = resolveWithPrefix(schema, root, address, prefix);\n return (\n location && {\n node: location.node,\n value: Object.hasOwn(location.parent, location.key)\n ? (location.parent as Record<string | number, unknown>)[location.key]\n : undefined,\n }\n );\n};\n\n/** Resolves schema and document location in one address traversal. */\nexport const resolveLocated = (\n schema: DocumentNode,\n root: unknown,\n address: DocumentAddress\n): ResolvedAddress | undefined => resolveWithPrefix(schema, root, address);\n\nconst resolveWithPrefix = (\n schema: DocumentNode,\n root: unknown,\n address: DocumentAddress,\n prefix?: ResolutionPrefix[]\n): ResolvedAddress | undefined => {\n if (address.length === 0) return undefined;\n let node: DocumentNode | undefined = schema;\n let current: unknown = root;\n let start = 0;\n if (prefix) {\n while (\n start < prefix.length &&\n start < address.length - 1 &&\n prefix[start].segment === address[start]\n )\n start++;\n prefix.length = start;\n if (start) {\n const retained = prefix[start - 1];\n node = retained.node;\n current = retained.value;\n }\n }\n let cacheable = true;\n for (let index = start; index < address.length - 1; index += 1) {\n profile.address.schemaStep();\n profile.address.documentStep();\n const resolved = step(node, current, address[index]);\n if (!resolved) return undefined;\n if (node?.kind !== 'object' && node?.kind !== 'table' && node?.kind !== 'map')\n cacheable = false;\n current = readSegment(current, address[index], node);\n node = resolved;\n if (prefix && cacheable)\n prefix.push({\n segment: address[index],\n node: resolved,\n value: current,\n });\n if (!node) return undefined;\n }\n const last = address[address.length - 1];\n return resolveChild(node, current, last);\n};\n\n/** Resolves one member from an already current schema/container pair. */\nexport const resolveChild = (\n node: DocumentNode | undefined,\n current: unknown,\n last: string\n): ResolvedAddress | undefined => {\n profile.address.schemaStep();\n profile.address.documentStep();\n const resolved = step(node, current, last);\n if (!resolved || (!isRecord(current) && !Array.isArray(current))) return undefined;\n if (node?.kind === 'table' && isRecord(current) && isRecord(current.byId))\n return {\n node: resolved,\n parent: current.byId,\n key: last,\n };\n return {\n node: resolved,\n parent: current,\n key:\n node?.kind === 'list' && Array.isArray(current)\n ? anchor.indexedKeys(current, node.keyOf).index(last)\n : last,\n };\n};\n\nexport const contains = (parent: DocumentAddress, child: DocumentAddress): boolean => {\n profile.address.prefixComparison();\n if (parent.length > child.length) return false;\n for (let index = 0; index < parent.length; index += 1) {\n profile.address.segmentCompared();\n if (parent[index] !== child[index]) return false;\n }\n return true;\n};\n\nexport const overlaps = (a: DocumentAddress, b: DocumentAddress): boolean =>\n contains(a, b) || contains(b, a);\n\nexport const debugKey = (address: DocumentAddress): string => {\n let result = '';\n for (let index = 0; index < address.length; index += 1) {\n if (index > 0) result += '/';\n result += address[index].replaceAll('~', '~~').replaceAll('/', '~/');\n }\n return result;\n};\n\nexport const same = (a: AddressRef, b: AddressRef): boolean => {\n if (a.path !== b.path || a.address.length !== b.address.length) return false;\n for (let index = 0; index < a.address.length; index += 1) {\n profile.address.segmentCompared();\n if (a.address[index] !== b.address[index]) return false;\n }\n return true;\n};\n\nexport type { DocumentAddress } from './schema';\n\ntype AddressIndexNode<T> = {\n readonly children: Map<string, AddressIndexNode<T>>;\n readonly values: Set<T>;\n};\n\n/** An index over canonical address segments, shared by impact and subscriptions. */\nexport class AddressIndex<T> {\n private readonly root: AddressIndexNode<T> = { children: new Map(), values: new Set() };\n\n add(address: DocumentAddress, value: T, member?: string): void {\n let node = this.root;\n for (let i = 0; i < address.length + (member === undefined ? 0 : 1); i++) {\n const segment = i < address.length ? address[i] : member!;\n let child = node.children.get(segment);\n if (!child) {\n child = { children: new Map(), values: new Set() };\n node.children.set(segment, child);\n }\n node = child;\n }\n node.values.add(value);\n }\n\n delete(address: DocumentAddress, value: T): void {\n const parents: AddressIndexNode<T>[] = [];\n let node = this.root;\n for (const segment of address) {\n const child = node.children.get(segment);\n if (!child) return;\n parents.push(node);\n node = child;\n }\n node.values.delete(value);\n for (let i = address.length - 1; i >= 0 && !node.values.size && !node.children.size; i--) {\n node = parents[i];\n node.children.delete(address[i]);\n }\n }\n\n exact(address: DocumentAddress): ReadonlySet<T> | undefined {\n let node = this.root;\n for (const segment of address) {\n const child = node.children.get(segment);\n if (!child) return undefined;\n node = child;\n }\n return node.values;\n }\n\n hasAncestor(address: DocumentAddress, strict = false): boolean {\n let node = this.root;\n for (let i = 0; i < address.length; i++) {\n if (node.values.size) return true;\n const child = node.children.get(address[i]);\n if (!child) return false;\n node = child;\n }\n return !strict && node.values.size > 0;\n }\n\n someAncestor(address: DocumentAddress, predicate: (value: T) => boolean): boolean {\n let node = this.root;\n for (let i = 0; ; i++) {\n for (const value of node.values) if (predicate(value)) return true;\n if (i === address.length) return false;\n const child = node.children.get(address[i]);\n if (!child) return false;\n node = child;\n }\n }\n\n overlaps(address: DocumentAddress): boolean {\n let node = this.root;\n for (const segment of address) {\n if (node.values.size) return true;\n const child = node.children.get(segment);\n if (!child) return false;\n node = child;\n }\n return node.values.size > 0 || node.children.size > 0;\n }\n\n hasDescendant(address: DocumentAddress): boolean {\n let node = this.root;\n for (const segment of address) {\n const child = node.children.get(segment);\n if (!child) return false;\n node = child;\n }\n return node.values.size > 0 || node.children.size > 0;\n }\n\n query(\n visit: (value: T) => void,\n relation: 'overlap' | 'ancestors' | 'descendants' = 'overlap'\n ): (address: DocumentAddress, members?: readonly { readonly key: string }[]) => void {\n const visited = new Set<AddressIndexNode<T>>();\n const subtrees = new Set<AddressIndexNode<T>>();\n const values = (node: AddressIndexNode<T>) => {\n if (visited.has(node)) return;\n visited.add(node);\n node.values.forEach(visit);\n };\n const descend = (current: AddressIndexNode<T>): void => {\n if (subtrees.has(current)) return;\n subtrees.add(current);\n values(current);\n current.children.forEach(descend);\n };\n const terminal = (node: AddressIndexNode<T>) =>\n relation === 'ancestors' ? values(node) : descend(node);\n return (address, members) => {\n let node = this.root;\n for (const segment of address) {\n if (subtrees.has(node)) return;\n if (relation !== 'descendants') values(node);\n const child = node.children.get(segment);\n if (!child) return;\n node = child;\n }\n if (!members) terminal(node);\n else {\n if (relation !== 'descendants') values(node);\n for (const member of members) {\n const child = node.children.get(member.key);\n if (child) terminal(child);\n }\n }\n };\n }\n\n clear(): void {\n this.root.values.clear();\n this.root.children.clear();\n }\n}\n","import type { DocumentAddress } from '../schema';\nimport type { ParseIssue } from '../schema-value';\n\nexport type MutationIssueCode =\n | 'invalid-address'\n | 'invalid-value'\n | 'invalid-key'\n | 'invalid-changes'\n | 'baseline-mismatch'\n | 'required-field'\n | 'invalid-anchor'\n | 'duplicate-entity'\n | 'missing-entity'\n | 'invalid-collection'\n | 'invalid-list-keys'\n | 'invalid-list-key'\n | 'duplicate-list-item'\n | 'missing-list-item'\n | 'invalid-tree'\n | 'duplicate-tree-node'\n | 'missing-tree-parent'\n | 'invalid-tree-index'\n | 'missing-tree-node'\n | 'tree-cycle';\nexport type MutationIssue = {\n readonly source: 'mutation';\n readonly code: MutationIssueCode;\n readonly address: DocumentAddress;\n readonly message: string;\n};\nexport const at = (\n address: DocumentAddress,\n code: MutationIssueCode,\n message: string\n): MutationIssue =>\n Object.freeze({ source: 'mutation', code, address: Object.freeze([...address]), message });\nexport class MutationRejected extends Error {\n constructor(readonly issue: MutationIssue) {\n super(issue.message);\n }\n}\nexport const fail = (address: DocumentAddress, code: MutationIssueCode, message: string): never => {\n throw new MutationRejected(at(address, code, message));\n};\n\nexport const invalidValue = (issue: ParseIssue, address = issue.address): never =>\n fail(address, issue.code === 'missing-validator' ? 'invalid-value' : issue.code, issue.message);\n"],"mappings":"AAiDA,MAAa,UAAU;CACrB,aAAa,KAAmC,SAAS,MAAM;CAG/D,WAAW,KAAiC,SAAS,MAAM;CAG3D,SAAS,QAAkC;CAG3C,MAAM,EACJ,iBAAiB,IAGlB;CACD,UAAU;EACR,YAAY;EAGZ,iBAAiB;EAGlB;CACD,SAAS;EACP,YAAY,UAAkB;EAM9B,kBAAkB;EAGlB,oBAAoB;EAGpB,mBAAmB;EAGnB,wBAAwB;EAGxB,uBAAuB;EAGxB;CACD,QAAQ;EACN,aAAa;EAGb,eAAe;EAGhB;CACD,gBAAgB;EACd,cAAc;EAGd,aAAa,SAAS,MAAM;EAG5B,mBAAmB;EAGpB;CACD,cAAc;EACZ,eAAe;EAGf,eAAe;EAGf,oBAAoB;EAGrB;CACF;;;AC1HD,MAAa,SAAS,MAAyB,UAAyB;AACtE,SAAQ,S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