doxum 0.1.23 → 0.1.26
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 +208 -102
- package/dist/advanced.cjs +237 -2
- package/dist/advanced.cjs.map +1 -0
- package/dist/advanced.d.cts +90 -2
- package/dist/advanced.d.ts +90 -2
- package/dist/advanced.js +236 -1
- package/dist/advanced.js.map +1 -0
- package/dist/{contract-ULPQmiEs.d.ts → contract-CNR6BS75.d.cts} +216 -30
- package/dist/{contract-SYJFP0lM.d.cts → contract-COgxO5sv.d.ts} +216 -30
- package/dist/definition-CDOuvb5C.d.cts +111 -0
- package/dist/definition-xgk3YNBp.d.ts +111 -0
- package/dist/{driver-yFfvDMX5.js → driver-B5vdPohL.js} +59 -3
- package/dist/driver-B5vdPohL.js.map +1 -0
- package/dist/{driver-BD3DQOW6.cjs → driver-BL91gn7_.cjs} +107 -9
- package/dist/driver-BL91gn7_.cjs.map +1 -0
- package/dist/index.cjs +1637 -703
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +65 -33
- package/dist/index.d.ts +65 -33
- package/dist/index.js +1432 -497
- package/dist/index.js.map +1 -1
- package/dist/local-sync.cjs +69 -103
- package/dist/local-sync.cjs.map +1 -1
- package/dist/local-sync.d.cts +14 -26
- package/dist/local-sync.d.ts +14 -26
- package/dist/local-sync.js +68 -96
- package/dist/local-sync.js.map +1 -1
- package/dist/react.cjs +4 -5
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +6 -8
- package/dist/react.d.ts +6 -8
- package/dist/react.js +4 -5
- package/dist/react.js.map +1 -1
- package/dist/record-B2yRhYsc.js +28 -0
- package/dist/record-B2yRhYsc.js.map +1 -0
- package/dist/record-ChYUi8PP.cjs +45 -0
- package/dist/record-ChYUi8PP.cjs.map +1 -0
- package/dist/scheduler--137L3j-.js +500 -0
- package/dist/scheduler--137L3j-.js.map +1 -0
- package/dist/scheduler-D4VthaaK.cjs +589 -0
- package/dist/scheduler-D4VthaaK.cjs.map +1 -0
- package/package.json +6 -3
- package/skills/doxum-runtime/SKILL.md +32 -7
- package/skills/doxum-runtime/agents/openai.yaml +1 -1
- package/skills/doxum-runtime/references/api.en.md +249 -0
- package/skills/doxum-runtime/references/api.zh-CN.md +242 -0
- package/skills/doxum-runtime/references/guide.en.md +18 -8
- package/skills/doxum-runtime/references/guide.zh-CN.md +14 -6
- package/skills/doxum-runtime/references/invariants.en.md +29 -5
- package/skills/doxum-runtime/references/invariants.zh-CN.md +24 -6
- package/skills/doxum-runtime/references/patterns.en.md +78 -18
- package/skills/doxum-runtime/references/patterns.zh-CN.md +76 -18
- package/skills/doxum-runtime/references/projections.en.md +209 -119
- package/skills/doxum-runtime/references/projections.zh-CN.md +200 -101
- package/dist/advanced-CLJCWkHa.d.cts +0 -176
- package/dist/advanced-CRNHfJBu.js +0 -1224
- package/dist/advanced-CRNHfJBu.js.map +0 -1
- package/dist/advanced-Cle5g3B4.cjs +0 -1517
- package/dist/advanced-Cle5g3B4.cjs.map +0 -1
- package/dist/advanced-d6J61er9.d.ts +0 -176
- package/dist/context-BcLKGfq8.cjs +0 -149
- package/dist/context-BcLKGfq8.cjs.map +0 -1
- package/dist/context-DFEaDUv5.js +0 -84
- package/dist/context-DFEaDUv5.js.map +0 -1
- package/dist/driver-BD3DQOW6.cjs.map +0 -1
- package/dist/driver-yFfvDMX5.js.map +0 -1
|
@@ -1,1517 +0,0 @@
|
|
|
1
|
-
const require_context = require("./context-BcLKGfq8.cjs");
|
|
2
|
-
const profile = {
|
|
3
|
-
projection: (key, amount = 1) => {},
|
|
4
|
-
recorder: (key, amount = 1) => {},
|
|
5
|
-
access: (key) => {},
|
|
6
|
-
copy: {
|
|
7
|
-
structure: () => {},
|
|
8
|
-
treeNode: () => {},
|
|
9
|
-
shallowRecord: (items) => {}
|
|
10
|
-
},
|
|
11
|
-
equality: {
|
|
12
|
-
call: () => {},
|
|
13
|
-
container: () => {}
|
|
14
|
-
},
|
|
15
|
-
address: {
|
|
16
|
-
listIndex: (items) => {},
|
|
17
|
-
schemaStep: () => {},
|
|
18
|
-
documentStep: () => {},
|
|
19
|
-
prefixComparison: () => {},
|
|
20
|
-
segmentCompared: () => {}
|
|
21
|
-
},
|
|
22
|
-
impact: {
|
|
23
|
-
index: () => {},
|
|
24
|
-
affects: () => {}
|
|
25
|
-
},
|
|
26
|
-
collectionIndex: {
|
|
27
|
-
node: () => {},
|
|
28
|
-
build: (items) => {}
|
|
29
|
-
},
|
|
30
|
-
collectionView: {
|
|
31
|
-
mapped: () => {},
|
|
32
|
-
idsScanned: (amount = 1) => {},
|
|
33
|
-
arrayCopied: () => {}
|
|
34
|
-
},
|
|
35
|
-
materialized: {
|
|
36
|
-
updated: () => {},
|
|
37
|
-
rebuilt: () => {},
|
|
38
|
-
notification: () => {}
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
//#endregion
|
|
42
|
-
//#region core/src/order/sequence.ts
|
|
43
|
-
const length = (keys) => keys.length;
|
|
44
|
-
const keyAt = (keys, index) => Array.isArray(keys) ? keys[index] : keys.at(index);
|
|
45
|
-
const equal = (left, right) => {
|
|
46
|
-
profile.equality.call();
|
|
47
|
-
if (left === right) return true;
|
|
48
|
-
profile.equality.container();
|
|
49
|
-
if (left.length !== right.length) return false;
|
|
50
|
-
for (let index = 0; index < left.length; index++) if (left[index] !== keyAt(right, index)) return false;
|
|
51
|
-
return true;
|
|
52
|
-
};
|
|
53
|
-
const keys = (values, keyOf) => ({
|
|
54
|
-
length: values.length,
|
|
55
|
-
at: (index) => index >= 0 && index < values.length ? keyOf(values[index]) : void 0,
|
|
56
|
-
index: (key) => {
|
|
57
|
-
for (let index = 0; index < values.length; index += 1) if (keyOf(values[index]) === key) return index;
|
|
58
|
-
return -1;
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
const listIndexes = /* @__PURE__ */ new WeakMap();
|
|
62
|
-
const knownKeys = (values) => {
|
|
63
|
-
let positions;
|
|
64
|
-
return {
|
|
65
|
-
length: values.length,
|
|
66
|
-
at: (index) => values[index],
|
|
67
|
-
index: (key) => {
|
|
68
|
-
if (!positions) {
|
|
69
|
-
positions = /* @__PURE__ */ new Map();
|
|
70
|
-
for (let index = 0; index < values.length; index++) positions.set(values[index], index);
|
|
71
|
-
profile.address.listIndex(values.length);
|
|
72
|
-
}
|
|
73
|
-
return positions.get(key) ?? -1;
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
};
|
|
77
|
-
const cacheKnownKeys = (values, keyOf, order) => {
|
|
78
|
-
listIndexes.set(values, {
|
|
79
|
-
keyOf,
|
|
80
|
-
order: knownKeys(order)
|
|
81
|
-
});
|
|
82
|
-
};
|
|
83
|
-
/** Canonical lists keep their key positions until a structural write invalidates them. */
|
|
84
|
-
const indexedKeys = (values, keyOf) => {
|
|
85
|
-
const cached = listIndexes.get(values);
|
|
86
|
-
if (cached?.keyOf === keyOf) return cached.order;
|
|
87
|
-
let positions;
|
|
88
|
-
const order = {
|
|
89
|
-
length: values.length,
|
|
90
|
-
at: (index) => index >= 0 && index < values.length ? keyOf(values[index]) : void 0,
|
|
91
|
-
index: (key) => {
|
|
92
|
-
if (!positions) {
|
|
93
|
-
positions = /* @__PURE__ */ new Map();
|
|
94
|
-
for (let index = 0; index < values.length; index++) positions.set(keyOf(values[index]), index);
|
|
95
|
-
profile.address.listIndex(values.length);
|
|
96
|
-
}
|
|
97
|
-
return positions.get(key) ?? -1;
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
listIndexes.set(values, {
|
|
101
|
-
keyOf,
|
|
102
|
-
order
|
|
103
|
-
});
|
|
104
|
-
return order;
|
|
105
|
-
};
|
|
106
|
-
const toArray = (keys) => {
|
|
107
|
-
const result = new Array(length(keys));
|
|
108
|
-
for (let index = 0; index < result.length; index++) result[index] = keyAt(keys, index);
|
|
109
|
-
return result;
|
|
110
|
-
};
|
|
111
|
-
/** One operation-local list scan provides both stable keys and item association. */
|
|
112
|
-
const listSequence = (values, keyOf) => {
|
|
113
|
-
const current = indexedKeys(values, keyOf);
|
|
114
|
-
const order = new Array(values.length);
|
|
115
|
-
const byKey = /* @__PURE__ */ new Map();
|
|
116
|
-
for (let index = 0; index < values.length; index++) {
|
|
117
|
-
const key = current.at(index);
|
|
118
|
-
order[index] = key;
|
|
119
|
-
byKey.set(key, values[index]);
|
|
120
|
-
}
|
|
121
|
-
cacheKnownKeys(values, keyOf, order);
|
|
122
|
-
return {
|
|
123
|
-
order,
|
|
124
|
-
values: byKey
|
|
125
|
-
};
|
|
126
|
-
};
|
|
127
|
-
/** Structural sequence writes own invalidation, including rollback writes. */
|
|
128
|
-
const insert = (values, index, value) => {
|
|
129
|
-
values.splice(index, 0, value);
|
|
130
|
-
listIndexes.delete(values);
|
|
131
|
-
};
|
|
132
|
-
const remove = (values, index) => {
|
|
133
|
-
values.splice(index, 1);
|
|
134
|
-
listIndexes.delete(values);
|
|
135
|
-
};
|
|
136
|
-
/** Installs an exact string-key sequence such as table ids in one structural write. */
|
|
137
|
-
const installKeys = (values, order) => {
|
|
138
|
-
values.length = order.length;
|
|
139
|
-
for (let index = 0; index < order.length; index++) values[index] = order[index];
|
|
140
|
-
};
|
|
141
|
-
/** Installs a pre-resolved list sequence without running keyOf again. */
|
|
142
|
-
const installList = (values, keyOf, sequence, order) => {
|
|
143
|
-
values.length = order.length;
|
|
144
|
-
for (let index = 0; index < order.length; index++) values[index] = sequence.values.get(order[index]);
|
|
145
|
-
cacheKnownKeys(values, keyOf, order);
|
|
146
|
-
};
|
|
147
|
-
const install = (values, keyOf, order) => {
|
|
148
|
-
installList(values, keyOf, listSequence(values, keyOf), order);
|
|
149
|
-
};
|
|
150
|
-
const matches = (order, members) => {
|
|
151
|
-
if (order.length !== members.length) return false;
|
|
152
|
-
const ids = new Set(order);
|
|
153
|
-
return ids.size === order.length && members.every((id) => ids.has(id));
|
|
154
|
-
};
|
|
155
|
-
//#endregion
|
|
156
|
-
//#region core/src/schema/layout.ts
|
|
157
|
-
const compiledObjects = /* @__PURE__ */ new WeakMap();
|
|
158
|
-
const compiledEntries = /* @__PURE__ */ new WeakMap();
|
|
159
|
-
const objectBranch = (node, value) => {
|
|
160
|
-
if (node.kind === "object") return node;
|
|
161
|
-
if (node.kind !== "variant" || typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
|
|
162
|
-
const record = value;
|
|
163
|
-
const tag = typeof record[node.tag] === "string" ? record[node.tag] : void 0;
|
|
164
|
-
return node.variants[String(tag ?? Object.keys(node.variants)[0] ?? "")];
|
|
165
|
-
};
|
|
166
|
-
const compiledShape = (node, value) => {
|
|
167
|
-
const branch = objectBranch(node, value);
|
|
168
|
-
if (!branch) return void 0;
|
|
169
|
-
const shape = branch.shape;
|
|
170
|
-
let layout = compiledObjects.get(shape);
|
|
171
|
-
if (!layout) {
|
|
172
|
-
const members = /* @__PURE__ */ new Map();
|
|
173
|
-
for (const key of Object.keys(shape).sort()) {
|
|
174
|
-
profile.address.schemaStep();
|
|
175
|
-
members.set(key, {
|
|
176
|
-
kind: "fixed",
|
|
177
|
-
key,
|
|
178
|
-
node: shape[key],
|
|
179
|
-
field: shape[key].kind === "field",
|
|
180
|
-
slot: members.size
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
layout = {
|
|
184
|
-
kind: "fixed",
|
|
185
|
-
members
|
|
186
|
-
};
|
|
187
|
-
compiledObjects.set(shape, layout);
|
|
188
|
-
}
|
|
189
|
-
return layout;
|
|
190
|
-
};
|
|
191
|
-
const compiledLayout = (node, value) => {
|
|
192
|
-
if (node.kind !== "map" && node.kind !== "table" && node.kind !== "list") return compiledShape(node, value);
|
|
193
|
-
let layout = compiledEntries.get(node);
|
|
194
|
-
if (!layout) {
|
|
195
|
-
layout = {
|
|
196
|
-
kind: "dynamic",
|
|
197
|
-
entry: {
|
|
198
|
-
kind: "entry",
|
|
199
|
-
node: node.value,
|
|
200
|
-
field: node.value.kind === "field"
|
|
201
|
-
}
|
|
202
|
-
};
|
|
203
|
-
compiledEntries.set(node, layout);
|
|
204
|
-
}
|
|
205
|
-
return layout;
|
|
206
|
-
};
|
|
207
|
-
//#endregion
|
|
208
|
-
//#region core/src/schema/value.ts
|
|
209
|
-
var ParseError = class extends TypeError {
|
|
210
|
-
issues;
|
|
211
|
-
constructor(issue) {
|
|
212
|
-
super(`${issue.message} at ${JSON.stringify(issue.address)}`);
|
|
213
|
-
this.name = "ParseError";
|
|
214
|
-
this.issues = Object.freeze([Object.freeze({
|
|
215
|
-
...issue,
|
|
216
|
-
address: Object.freeze([...issue.address])
|
|
217
|
-
})]);
|
|
218
|
-
}
|
|
219
|
-
};
|
|
220
|
-
const issue = (address, message, code = "invalid-value") => ({
|
|
221
|
-
address,
|
|
222
|
-
message,
|
|
223
|
-
code
|
|
224
|
-
});
|
|
225
|
-
const checkScalar = (validator, value, address, strict) => {
|
|
226
|
-
if (!validator) return strict ? issue(address, "A validator is required to parse an opaque value.", "missing-validator") : void 0;
|
|
227
|
-
try {
|
|
228
|
-
const result = typeof validator === "function" ? validator(value) : validator["~standard"].validate(value);
|
|
229
|
-
if (result && (typeof result === "object" || typeof result === "function") && "then" in result && typeof result.then === "function") return issue(address, "Validators must be synchronous.");
|
|
230
|
-
if (typeof validator !== "function") {
|
|
231
|
-
if (!require_context.isRecord(result)) return issue(address, "Malformed validator result.");
|
|
232
|
-
if (Array.isArray(result.issues)) {
|
|
233
|
-
const first = result.issues[0];
|
|
234
|
-
return issue([...address, ...(first?.path ?? []).map((part) => String(typeof part === "object" ? part.key : part))], first?.message ?? "Value validation failed.");
|
|
235
|
-
}
|
|
236
|
-
if (!Object.hasOwn(result, "value")) return issue(address, "Malformed validator result.");
|
|
237
|
-
}
|
|
238
|
-
return;
|
|
239
|
-
} catch (error) {
|
|
240
|
-
return issue(address, error instanceof Error ? error.message : "Value validation failed.");
|
|
241
|
-
}
|
|
242
|
-
};
|
|
243
|
-
const checkKey = (validator, value, address) => {
|
|
244
|
-
if (typeof value !== "string") return issue(address, "Collection keys must be strings.", "invalid-key");
|
|
245
|
-
const failure = checkScalar(validator, value, address, false);
|
|
246
|
-
return failure ? {
|
|
247
|
-
...failure,
|
|
248
|
-
code: "invalid-key"
|
|
249
|
-
} : void 0;
|
|
250
|
-
};
|
|
251
|
-
const checkValue = (node, value, address = [], strict = false) => {
|
|
252
|
-
if (node.optional && value === void 0) return void 0;
|
|
253
|
-
if (node.kind === "field") return checkScalar(node.validator, value, address, strict);
|
|
254
|
-
if (node.kind === "object" || node.kind === "variant") {
|
|
255
|
-
if (!require_context.isPlainObject(value)) return issue(address, "Expected an object.");
|
|
256
|
-
if (node.kind === "variant") {
|
|
257
|
-
const tag = value[node.tag];
|
|
258
|
-
if (!Object.hasOwn(value, node.tag) || typeof tag !== "string" || !Object.hasOwn(node.variants, tag)) return issue([...address, node.tag], "Unknown variant tag.");
|
|
259
|
-
}
|
|
260
|
-
const { members } = compiledShape(node, value);
|
|
261
|
-
for (const key of Reflect.ownKeys(value)) {
|
|
262
|
-
if (node.kind === "variant" && key === node.tag) continue;
|
|
263
|
-
if (typeof key !== "string" || !members.has(key)) return issue([...address, String(key)], "Property is not declared in the object schema.");
|
|
264
|
-
}
|
|
265
|
-
for (const [key, member] of members) {
|
|
266
|
-
const child = member.node;
|
|
267
|
-
if (!Object.prototype.hasOwnProperty.call(value, key) && !child.optional) return issue([...address, key], "Required property is missing.");
|
|
268
|
-
const failure = checkValue(child, value[key], [...address, key], strict);
|
|
269
|
-
if (failure) return failure;
|
|
270
|
-
}
|
|
271
|
-
return;
|
|
272
|
-
}
|
|
273
|
-
if (node.kind === "table" || node.kind === "map") {
|
|
274
|
-
if (!require_context.isPlainObject(value)) return issue(address, "Expected a collection object.");
|
|
275
|
-
const entries = node.kind === "table" ? value.byId : value;
|
|
276
|
-
if (!require_context.isPlainObject(entries)) return issue(address, "Expected a byId object.");
|
|
277
|
-
if (node.kind === "table") {
|
|
278
|
-
if (!Array.isArray(value.ids) || value.ids.length !== Object.keys(entries).length) return issue(address, "Table ids and entries must agree.");
|
|
279
|
-
const seen = /* @__PURE__ */ new Set();
|
|
280
|
-
for (const id of value.ids) {
|
|
281
|
-
const failure = checkKey(node.key, id, address);
|
|
282
|
-
if (failure) return failure;
|
|
283
|
-
if (seen.has(id) || !Object.prototype.hasOwnProperty.call(entries, id)) return issue(address, "Table ids must be unique and reference existing entries.");
|
|
284
|
-
seen.add(id);
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
for (const id of Object.keys(entries)) {
|
|
288
|
-
const failure = checkKey(node.key, id, [...address, id]) ?? checkValue(node.value, entries[id], [...address, id], strict);
|
|
289
|
-
if (failure) return failure;
|
|
290
|
-
}
|
|
291
|
-
return;
|
|
292
|
-
}
|
|
293
|
-
if (node.kind === "list") {
|
|
294
|
-
if (!Array.isArray(value)) return issue(address, "Expected a list.");
|
|
295
|
-
const seen = /* @__PURE__ */ new Set();
|
|
296
|
-
const order = keys(value, node.keyOf);
|
|
297
|
-
for (let i = 0; i < value.length; i++) {
|
|
298
|
-
const failure = checkValue(node.value, value[i], [...address, String(i)], strict);
|
|
299
|
-
if (failure) return failure;
|
|
300
|
-
let key;
|
|
301
|
-
try {
|
|
302
|
-
key = order.at(i);
|
|
303
|
-
} catch {
|
|
304
|
-
return issue(address, "List keyOf failed.");
|
|
305
|
-
}
|
|
306
|
-
if (typeof key !== "string" || seen.has(key)) return issue(address, "List keys must be unique strings.", "invalid-key");
|
|
307
|
-
seen.add(key);
|
|
308
|
-
}
|
|
309
|
-
return;
|
|
310
|
-
}
|
|
311
|
-
if (!require_context.validate(value)) return issue(address, "Invalid tree structure.", "invalid-tree");
|
|
312
|
-
for (const id of Object.keys(value.nodes)) {
|
|
313
|
-
const failure = checkTreePayload(node.value, value.nodes[id], [...address, id], strict);
|
|
314
|
-
if (failure) return failure;
|
|
315
|
-
}
|
|
316
|
-
};
|
|
317
|
-
const checkTreePayload = (node, value, address, strict = false) => {
|
|
318
|
-
if (!require_context.isRecord(value)) return issue(address, "Invalid tree node.", "invalid-tree");
|
|
319
|
-
const present = Object.prototype.hasOwnProperty.call(value, "value");
|
|
320
|
-
if (!present && !node.optional) return issue(address, "Tree node value is required.");
|
|
321
|
-
return present ? checkValue(node, value.value, address, strict) : void 0;
|
|
322
|
-
};
|
|
323
|
-
const copyTreeNode = (value) => {
|
|
324
|
-
profile.copy.treeNode();
|
|
325
|
-
return {
|
|
326
|
-
...value,
|
|
327
|
-
children: [...value.children]
|
|
328
|
-
};
|
|
329
|
-
};
|
|
330
|
-
const equalTreeNode = (left, right) => {
|
|
331
|
-
if (left === right) return true;
|
|
332
|
-
if (!left || !right) return false;
|
|
333
|
-
return left.parentId === right.parentId && equal(left.children, right.children) && Object.hasOwn(left, "value") === Object.hasOwn(right, "value") && Object.is(left.value, right.value);
|
|
334
|
-
};
|
|
335
|
-
/** Copy editable structure; atomic payloads retain their immutable ownership contract. */
|
|
336
|
-
const copyValue = (node, value) => {
|
|
337
|
-
if (value === void 0 || node.kind === "field") return value;
|
|
338
|
-
profile.copy.structure();
|
|
339
|
-
if ((node.kind === "object" || node.kind === "variant") && require_context.isRecord(value)) {
|
|
340
|
-
const result = Object.create(Object.getPrototypeOf(value));
|
|
341
|
-
const { members } = compiledShape(node, value);
|
|
342
|
-
for (const key of Object.getOwnPropertyNames(value)) Object.defineProperty(result, key, {
|
|
343
|
-
value: node.kind === "variant" && key === node.tag ? value[key] : copyValue(members.get(key).node, value[key]),
|
|
344
|
-
writable: true,
|
|
345
|
-
enumerable: Object.getOwnPropertyDescriptor(value, key)?.enumerable,
|
|
346
|
-
configurable: true
|
|
347
|
-
});
|
|
348
|
-
return result;
|
|
349
|
-
}
|
|
350
|
-
if ((node.kind === "table" || node.kind === "map") && require_context.isRecord(value)) {
|
|
351
|
-
const entries = node.kind === "table" ? value.byId : value;
|
|
352
|
-
const result = Object.fromEntries(Object.keys(entries).map((id) => [id, copyValue(node.value, entries[id])]));
|
|
353
|
-
return node.kind === "table" ? {
|
|
354
|
-
ids: [...value.ids],
|
|
355
|
-
byId: result
|
|
356
|
-
} : result;
|
|
357
|
-
}
|
|
358
|
-
if (node.kind === "list") return [...value];
|
|
359
|
-
if (node.kind === "tree" && require_context.isRecord(value)) {
|
|
360
|
-
const entries = value.nodes;
|
|
361
|
-
return {
|
|
362
|
-
...value,
|
|
363
|
-
nodes: Object.fromEntries(Object.entries(entries).map(([id, n]) => [id, copyTreeNode(n)]))
|
|
364
|
-
};
|
|
365
|
-
}
|
|
366
|
-
return value;
|
|
367
|
-
};
|
|
368
|
-
const equalValue = (node, left, right) => {
|
|
369
|
-
if (Object.is(left, right)) return true;
|
|
370
|
-
if (node.kind === "field" || left === void 0 || right === void 0) return false;
|
|
371
|
-
if ((node.kind === "object" || node.kind === "variant") && require_context.isRecord(left) && require_context.isRecord(right)) {
|
|
372
|
-
if (node.kind === "variant" && left[node.tag] !== right[node.tag]) return false;
|
|
373
|
-
for (const [key, member] of compiledShape(node, left).members) {
|
|
374
|
-
if (Object.hasOwn(left, key) !== Object.hasOwn(right, key)) return false;
|
|
375
|
-
if (!equalValue(member.node, left[key], right[key])) return false;
|
|
376
|
-
}
|
|
377
|
-
return true;
|
|
378
|
-
}
|
|
379
|
-
if (node.kind === "list" && Array.isArray(left) && Array.isArray(right)) return left.length === right.length && left.every((v, i) => equalValue(node.value, v, right[i]));
|
|
380
|
-
if (node.kind === "table" && require_context.isRecord(left) && require_context.isRecord(right)) return equal(left.ids, right.ids) && equalValue({
|
|
381
|
-
kind: "map",
|
|
382
|
-
value: node.value
|
|
383
|
-
}, left.byId, right.byId);
|
|
384
|
-
if (node.kind === "tree" && require_context.isRecord(left) && require_context.isRecord(right)) {
|
|
385
|
-
if (left.rootId !== right.rootId) return false;
|
|
386
|
-
const a = left.nodes, b = right.nodes;
|
|
387
|
-
return Object.keys(a).length === Object.keys(b).length && Object.keys(a).every((id) => Object.hasOwn(b, id) && equalTreeNode(a[id], b[id]));
|
|
388
|
-
}
|
|
389
|
-
if (node.kind === "map" && require_context.isRecord(left) && require_context.isRecord(right)) {
|
|
390
|
-
const keys = Object.keys(left);
|
|
391
|
-
return keys.length === Object.keys(right).length && keys.every((key) => Object.hasOwn(right, key) && equalValue(node.value, left[key], right[key]));
|
|
392
|
-
}
|
|
393
|
-
return false;
|
|
394
|
-
};
|
|
395
|
-
const parse = (node, input) => {
|
|
396
|
-
const valueNode = node;
|
|
397
|
-
const failure = checkValue(valueNode, input, [], true);
|
|
398
|
-
if (failure) throw new ParseError(failure);
|
|
399
|
-
return copyValue(valueNode, input);
|
|
400
|
-
};
|
|
401
|
-
//#endregion
|
|
402
|
-
//#region core/src/schema.ts
|
|
403
|
-
const collectionEntryNode = (node) => node.kind === "map" || node.kind === "table" || node.kind === "list" ? node.value : void 0;
|
|
404
|
-
const node = (value) => Object.freeze(value);
|
|
405
|
-
const field = (validator) => node({
|
|
406
|
-
kind: "field",
|
|
407
|
-
...validator ? { validator } : {}
|
|
408
|
-
});
|
|
409
|
-
const optional = (value) => {
|
|
410
|
-
if (![
|
|
411
|
-
"field",
|
|
412
|
-
"variant",
|
|
413
|
-
"map",
|
|
414
|
-
"list",
|
|
415
|
-
"tree"
|
|
416
|
-
].includes(value.kind)) throw new TypeError("Only field, variant, map, list and tree nodes support optional presence.");
|
|
417
|
-
return node({
|
|
418
|
-
...value,
|
|
419
|
-
optional: true
|
|
420
|
-
});
|
|
421
|
-
};
|
|
422
|
-
const object = (shape) => node({
|
|
423
|
-
kind: "object",
|
|
424
|
-
shape: Object.freeze({ ...shape })
|
|
425
|
-
});
|
|
426
|
-
const variant = (tag, variants) => node({
|
|
427
|
-
kind: "variant",
|
|
428
|
-
tag,
|
|
429
|
-
variants: Object.freeze({ ...variants })
|
|
430
|
-
});
|
|
431
|
-
const table = (value, options) => node({
|
|
432
|
-
kind: "table",
|
|
433
|
-
value,
|
|
434
|
-
...options
|
|
435
|
-
});
|
|
436
|
-
const map = (value, options) => node({
|
|
437
|
-
kind: "map",
|
|
438
|
-
value,
|
|
439
|
-
...options
|
|
440
|
-
});
|
|
441
|
-
const list = (value, config) => node({
|
|
442
|
-
kind: "list",
|
|
443
|
-
keyOf: config.keyOf,
|
|
444
|
-
value
|
|
445
|
-
});
|
|
446
|
-
const tree = (value) => Object.freeze({
|
|
447
|
-
kind: "tree",
|
|
448
|
-
value
|
|
449
|
-
});
|
|
450
|
-
const paths = /* @__PURE__ */ new WeakMap();
|
|
451
|
-
const pathProxy = (nodes, address, owner, treeSelection) => {
|
|
452
|
-
const proxy = new Proxy({}, { get: (_target, property) => {
|
|
453
|
-
if (typeof property !== "string") return void 0;
|
|
454
|
-
const trees = nodes.every((node) => node.kind === "tree");
|
|
455
|
-
if (!treeSelection && trees && property === "rootId") return pathProxy(nodes, address, owner, { kind: "root" });
|
|
456
|
-
if (!treeSelection && trees && property === "nodes") return pathProxy(nodes, address, owner, { kind: "nodes" });
|
|
457
|
-
if (treeSelection?.kind === "nodes" && property === "item") return (id) => {
|
|
458
|
-
if (typeof id !== "string") throw new TypeError("Tree node keys must be strings.");
|
|
459
|
-
return pathProxy(nodes, address, owner, {
|
|
460
|
-
kind: "node",
|
|
461
|
-
id
|
|
462
|
-
});
|
|
463
|
-
};
|
|
464
|
-
if (treeSelection) throw new TypeError(`Invalid tree path segment: ${property}`);
|
|
465
|
-
if (nodes.every((node) => collectionEntryNode(node) !== void 0) && property === "item") return (id) => {
|
|
466
|
-
if (typeof id !== "string") throw new TypeError("Collection keys must be strings.");
|
|
467
|
-
for (const node of nodes) if (node.kind === "table" || node.kind === "map") {
|
|
468
|
-
const invalid = checkKey(node.key, id, [...address, id]);
|
|
469
|
-
if (invalid) throw new TypeError(invalid.message);
|
|
470
|
-
}
|
|
471
|
-
return pathProxy(nodes.map((node) => collectionEntryNode(node)), [...address, id], owner);
|
|
472
|
-
};
|
|
473
|
-
const children = nodes.flatMap((node) => {
|
|
474
|
-
if (node.kind === "object") return Object.hasOwn(node.shape, property) ? [node.shape[property]] : [];
|
|
475
|
-
if (node.kind !== "variant") return [];
|
|
476
|
-
if (property === node.tag) return [field()];
|
|
477
|
-
return Object.values(node.variants).flatMap((branch) => Object.hasOwn(branch.shape, property) ? [branch.shape[property]] : []);
|
|
478
|
-
});
|
|
479
|
-
if (!children.length) throw new TypeError(`Invalid schema path segment: ${property}`);
|
|
480
|
-
return pathProxy(children, [...address, property], owner);
|
|
481
|
-
} });
|
|
482
|
-
paths.set(proxy, {
|
|
483
|
-
nodes,
|
|
484
|
-
address,
|
|
485
|
-
owner,
|
|
486
|
-
...treeSelection ? { tree: treeSelection } : {}
|
|
487
|
-
});
|
|
488
|
-
return proxy;
|
|
489
|
-
};
|
|
490
|
-
const compilePath = (owner, kind, pick) => {
|
|
491
|
-
const scope = {};
|
|
492
|
-
const value = pick(pathProxy([owner], [], scope));
|
|
493
|
-
const selected = typeof value === "object" && value !== null ? paths.get(value) : void 0;
|
|
494
|
-
if (!selected || selected.owner !== scope) throw new TypeError("Selector must return a path from its callback.");
|
|
495
|
-
const collection = selected.tree?.kind === "nodes" || selected.nodes.every((node) => collectionEntryNode(node) !== void 0);
|
|
496
|
-
if (kind === "collection" && !collection) throw new TypeError("Collection selectors require a map, table, list or tree nodes path.");
|
|
497
|
-
return Object.freeze({
|
|
498
|
-
kind: kind === "auto" ? collection ? "collection" : "value" : kind,
|
|
499
|
-
schema: owner,
|
|
500
|
-
address: Object.freeze([...selected.address]),
|
|
501
|
-
...selected.tree ? { tree: Object.freeze({ ...selected.tree }) } : {}
|
|
502
|
-
});
|
|
503
|
-
};
|
|
504
|
-
//#endregion
|
|
505
|
-
//#region core/src/projection/collection/view.ts
|
|
506
|
-
const mapRead = (value) => ({
|
|
507
|
-
get: (key) => value.get(key),
|
|
508
|
-
has: (key) => value.has(key),
|
|
509
|
-
ids: () => Object.freeze([...value.keys()])
|
|
510
|
-
});
|
|
511
|
-
/** Immutable map-like view over a CollectionRead. */
|
|
512
|
-
const collectionView = (read) => {
|
|
513
|
-
const ids = read.ids();
|
|
514
|
-
const entries = function* () {
|
|
515
|
-
for (const key of ids) yield [key, read.get(key)];
|
|
516
|
-
};
|
|
517
|
-
const values = function* () {
|
|
518
|
-
for (const key of ids) yield read.get(key);
|
|
519
|
-
};
|
|
520
|
-
const view = {
|
|
521
|
-
get: (key) => read.get(key),
|
|
522
|
-
has: (key) => read.has(key),
|
|
523
|
-
get size() {
|
|
524
|
-
return ids.length;
|
|
525
|
-
},
|
|
526
|
-
keys: () => ids[Symbol.iterator](),
|
|
527
|
-
values,
|
|
528
|
-
entries,
|
|
529
|
-
forEach: (callback, thisArg) => {
|
|
530
|
-
for (const key of ids) callback.call(thisArg, read.get(key), key, view);
|
|
531
|
-
},
|
|
532
|
-
[Symbol.iterator]: entries
|
|
533
|
-
};
|
|
534
|
-
return Object.freeze(view);
|
|
535
|
-
};
|
|
536
|
-
/** Eager durable view used when a processor result may retain its dependency value. */
|
|
537
|
-
const snapshotCollectionView = (read) => {
|
|
538
|
-
const ids = read.ids();
|
|
539
|
-
const values = /* @__PURE__ */ new Map();
|
|
540
|
-
for (const key of ids) values.set(key, read.get(key));
|
|
541
|
-
return collectionView(mapRead(values));
|
|
542
|
-
};
|
|
543
|
-
//#endregion
|
|
544
|
-
//#region core/src/projection/contract.ts
|
|
545
|
-
var ProjectionError = class extends Error {
|
|
546
|
-
constructor(phase, identity, revisions, cause) {
|
|
547
|
-
super(`Projection ${phase} failed: ${identity}`, { cause });
|
|
548
|
-
this.phase = phase;
|
|
549
|
-
this.identity = identity;
|
|
550
|
-
this.revisions = revisions;
|
|
551
|
-
this.name = "ProjectionError";
|
|
552
|
-
}
|
|
553
|
-
};
|
|
554
|
-
var ProjectionDisposedError = class extends Error {
|
|
555
|
-
constructor() {
|
|
556
|
-
super("Projection has been disposed.");
|
|
557
|
-
this.name = "ProjectionDisposedError";
|
|
558
|
-
}
|
|
559
|
-
};
|
|
560
|
-
//#endregion
|
|
561
|
-
//#region core/src/projection/graph/scheduler.ts
|
|
562
|
-
const createScheduler = (onError) => {
|
|
563
|
-
let disposed = false;
|
|
564
|
-
let depth = 0;
|
|
565
|
-
let batchSequence = 0;
|
|
566
|
-
let activeBatch;
|
|
567
|
-
let phase = "idle";
|
|
568
|
-
let sequence = 0;
|
|
569
|
-
const sources = /* @__PURE__ */ new Set();
|
|
570
|
-
const processors = /* @__PURE__ */ new Set();
|
|
571
|
-
const pendingSources = /* @__PURE__ */ new Set();
|
|
572
|
-
const heap = [];
|
|
573
|
-
const queued = /* @__PURE__ */ new Set();
|
|
574
|
-
const completed = /* @__PURE__ */ new Set();
|
|
575
|
-
const emissions = /* @__PURE__ */ new Set();
|
|
576
|
-
const errors = [];
|
|
577
|
-
let reportingFailures = [];
|
|
578
|
-
const guards = /* @__PURE__ */ new Set();
|
|
579
|
-
const cleanups = /* @__PURE__ */ new Set();
|
|
580
|
-
const assertActive = () => {
|
|
581
|
-
if (disposed) throw new ProjectionDisposedError();
|
|
582
|
-
};
|
|
583
|
-
const assertIdle = () => {
|
|
584
|
-
assertActive();
|
|
585
|
-
if (phase !== "idle") throw new Error("Projection cannot be re-entered during processing or notification.");
|
|
586
|
-
};
|
|
587
|
-
const lock = (value) => guards.forEach((guard) => guard(value));
|
|
588
|
-
const enqueue = (processor) => {
|
|
589
|
-
if (processor.disposed || queued.has(processor)) return;
|
|
590
|
-
queued.add(processor);
|
|
591
|
-
profile.projection("scheduledNodes");
|
|
592
|
-
let index = heap.length;
|
|
593
|
-
heap.push(processor);
|
|
594
|
-
while (index > 0) {
|
|
595
|
-
const parent = index - 1 >> 1;
|
|
596
|
-
if (heap[parent].order < processor.order) break;
|
|
597
|
-
heap[index] = heap[parent];
|
|
598
|
-
index = parent;
|
|
599
|
-
}
|
|
600
|
-
heap[index] = processor;
|
|
601
|
-
};
|
|
602
|
-
const pop = () => {
|
|
603
|
-
const first = heap[0];
|
|
604
|
-
const last = heap.pop();
|
|
605
|
-
if (heap.length) {
|
|
606
|
-
let index = 0;
|
|
607
|
-
while (index * 2 + 1 < heap.length) {
|
|
608
|
-
let child = index * 2 + 1;
|
|
609
|
-
if (child + 1 < heap.length && heap[child + 1].order < heap[child].order) child++;
|
|
610
|
-
if (last.order < heap[child].order) break;
|
|
611
|
-
heap[index] = heap[child];
|
|
612
|
-
index = child;
|
|
613
|
-
}
|
|
614
|
-
heap[index] = last;
|
|
615
|
-
}
|
|
616
|
-
return first;
|
|
617
|
-
};
|
|
618
|
-
const revisionsOf = (producer) => producer.kind === "processor" ? producer.dependencies.map((output) => output.revision()) : producer.outputs.map((output) => output.revision());
|
|
619
|
-
const errorFor = (producer, cause, kind = producer.kind === "source" ? "source" : "processor") => new ProjectionError(kind, producer.name, revisionsOf(producer), cause);
|
|
620
|
-
const capture = (source) => {
|
|
621
|
-
if (disposed) return;
|
|
622
|
-
if (phase !== "idle") {
|
|
623
|
-
source.fault = errorFor(source, /* @__PURE__ */ new Error("Source changed while projection was running."), "source");
|
|
624
|
-
errors.push(source.fault);
|
|
625
|
-
throw source.fault;
|
|
626
|
-
}
|
|
627
|
-
pendingSources.add(source);
|
|
628
|
-
profile.projection("sourceEvents");
|
|
629
|
-
if (source.fault) errors.push(source.fault);
|
|
630
|
-
};
|
|
631
|
-
const settleCause = () => {
|
|
632
|
-
if (activeBatch?.cause !== void 0) return activeBatch.cause;
|
|
633
|
-
for (const source of pendingSources) {
|
|
634
|
-
const cause = source.pendingCause();
|
|
635
|
-
if (cause !== void 0) return cause;
|
|
636
|
-
}
|
|
637
|
-
};
|
|
638
|
-
const settle = () => {
|
|
639
|
-
if (disposed || depth || phase !== "idle") return;
|
|
640
|
-
phase = "compute";
|
|
641
|
-
lock(true);
|
|
642
|
-
const cause = settleCause();
|
|
643
|
-
try {
|
|
644
|
-
for (const source of pendingSources) {
|
|
645
|
-
if (source.disposed) continue;
|
|
646
|
-
const wasFaulted = source.fault !== void 0;
|
|
647
|
-
let changed = false;
|
|
648
|
-
let force = false;
|
|
649
|
-
if (!source.fault || source.recovering()) try {
|
|
650
|
-
const prepared = source.prepare(cause);
|
|
651
|
-
changed = prepared.changed;
|
|
652
|
-
force = prepared.force;
|
|
653
|
-
source.fault = void 0;
|
|
654
|
-
} catch (failure) {
|
|
655
|
-
source.fault = errorFor(source, failure, "source");
|
|
656
|
-
errors.push(source.fault);
|
|
657
|
-
}
|
|
658
|
-
const recovered = wasFaulted && !source.fault;
|
|
659
|
-
if (changed) source.publish();
|
|
660
|
-
if (source.fault || changed || force || recovered) {
|
|
661
|
-
const output = source.outputs[0];
|
|
662
|
-
emissions.add(output);
|
|
663
|
-
output.consumers.forEach(enqueue);
|
|
664
|
-
}
|
|
665
|
-
}
|
|
666
|
-
while (heap.length) {
|
|
667
|
-
const processor = pop();
|
|
668
|
-
if (processor.disposed) continue;
|
|
669
|
-
const wasFaulted = processor.fault !== void 0;
|
|
670
|
-
profile.projection("processedNodes");
|
|
671
|
-
let changedOutputs = Object.freeze([]);
|
|
672
|
-
const blocked = processor.dependencies.find((output) => output.owner.fault || output.owner.disposed);
|
|
673
|
-
if (blocked) processor.fault = errorFor(processor, blocked.owner.fault ?? new ProjectionDisposedError(), "blocked");
|
|
674
|
-
else {
|
|
675
|
-
const reset = wasFaulted || processor.dependencies.some((output) => output.reset());
|
|
676
|
-
try {
|
|
677
|
-
changedOutputs = processor.evaluate(reset, cause);
|
|
678
|
-
const dependencyFailure = processor.dependencies.find((output) => output.owner.fault)?.owner.fault;
|
|
679
|
-
if (dependencyFailure) throw dependencyFailure;
|
|
680
|
-
processor.fault = void 0;
|
|
681
|
-
} catch (failure) {
|
|
682
|
-
const error = errorFor(processor, failure);
|
|
683
|
-
processor.fault = error;
|
|
684
|
-
if (!reset) try {
|
|
685
|
-
changedOutputs = processor.evaluate(true, cause);
|
|
686
|
-
const dependencyFailure = processor.dependencies.find((output) => output.owner.fault)?.owner.fault;
|
|
687
|
-
if (dependencyFailure) throw dependencyFailure;
|
|
688
|
-
processor.fault = void 0;
|
|
689
|
-
errors.push(error);
|
|
690
|
-
} catch (rebuildFailure) {
|
|
691
|
-
processor.fault = errorFor(processor, rebuildFailure);
|
|
692
|
-
errors.push(processor.fault);
|
|
693
|
-
}
|
|
694
|
-
else errors.push(error);
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
completed.add(processor);
|
|
698
|
-
const recovered = wasFaulted && !processor.fault;
|
|
699
|
-
if (processor.fault) processor.outputs.forEach((output) => {
|
|
700
|
-
emissions.add(output);
|
|
701
|
-
output.consumers.forEach(enqueue);
|
|
702
|
-
});
|
|
703
|
-
else {
|
|
704
|
-
if (changedOutputs.length) {
|
|
705
|
-
processor.publish();
|
|
706
|
-
changedOutputs.forEach((output) => emissions.add(output));
|
|
707
|
-
}
|
|
708
|
-
(recovered ? processor.outputs : changedOutputs).forEach((output) => output.consumers.forEach(enqueue));
|
|
709
|
-
}
|
|
710
|
-
if (processor.fault || changedOutputs.length) profile.projection("publishedNodes");
|
|
711
|
-
}
|
|
712
|
-
} finally {
|
|
713
|
-
lock(false);
|
|
714
|
-
phase = "idle";
|
|
715
|
-
}
|
|
716
|
-
};
|
|
717
|
-
const flush = () => {
|
|
718
|
-
if (disposed || depth) return [];
|
|
719
|
-
if (pendingSources.size || completed.size) profile.projection("flushes");
|
|
720
|
-
phase = "notify";
|
|
721
|
-
lock(true);
|
|
722
|
-
const reportFailures = [];
|
|
723
|
-
try {
|
|
724
|
-
emissions.forEach((output) => output.emit((listener) => {
|
|
725
|
-
try {
|
|
726
|
-
listener();
|
|
727
|
-
} catch (cause) {
|
|
728
|
-
errors.push(errorFor(output.owner, cause, "listener"));
|
|
729
|
-
}
|
|
730
|
-
}));
|
|
731
|
-
for (const error of errors.slice()) try {
|
|
732
|
-
onError(error);
|
|
733
|
-
} catch (cause) {
|
|
734
|
-
reportFailures.push(cause);
|
|
735
|
-
}
|
|
736
|
-
return Object.freeze([...errors.map((error) => Object.freeze({
|
|
737
|
-
phase: error.phase === "listener" ? "listener" : "processor",
|
|
738
|
-
error
|
|
739
|
-
})), ...reportFailures.map((error) => Object.freeze({
|
|
740
|
-
phase: "listener",
|
|
741
|
-
error
|
|
742
|
-
}))]);
|
|
743
|
-
} finally {
|
|
744
|
-
pendingSources.forEach((source) => source.clear());
|
|
745
|
-
completed.forEach((processor) => processor.clear());
|
|
746
|
-
pendingSources.clear();
|
|
747
|
-
queued.clear();
|
|
748
|
-
completed.clear();
|
|
749
|
-
emissions.clear();
|
|
750
|
-
errors.length = 0;
|
|
751
|
-
reportingFailures = reportFailures;
|
|
752
|
-
lock(false);
|
|
753
|
-
phase = "idle";
|
|
754
|
-
}
|
|
755
|
-
};
|
|
756
|
-
const run = () => {
|
|
757
|
-
settle();
|
|
758
|
-
const result = flush();
|
|
759
|
-
const failures = reportingFailures;
|
|
760
|
-
reportingFailures = [];
|
|
761
|
-
if (failures.length) throw new AggregateError(failures, "Projection error reporter failed.");
|
|
762
|
-
return result;
|
|
763
|
-
};
|
|
764
|
-
const batch = (optionsOrCallback, maybeCallback) => {
|
|
765
|
-
assertIdle();
|
|
766
|
-
const options = typeof optionsOrCallback === "function" ? void 0 : optionsOrCallback;
|
|
767
|
-
const callback = typeof optionsOrCallback === "function" ? optionsOrCallback : maybeCallback;
|
|
768
|
-
if (!callback) throw new TypeError("Projection batch requires a callback.");
|
|
769
|
-
if (depth === 0) activeBatch = Object.freeze({
|
|
770
|
-
id: ++batchSequence,
|
|
771
|
-
...options?.cause === void 0 ? {} : { cause: options.cause }
|
|
772
|
-
});
|
|
773
|
-
depth++;
|
|
774
|
-
let failed = false;
|
|
775
|
-
try {
|
|
776
|
-
const value = callback();
|
|
777
|
-
assertSynchronous(value);
|
|
778
|
-
return value;
|
|
779
|
-
} catch (error) {
|
|
780
|
-
failed = true;
|
|
781
|
-
throw error;
|
|
782
|
-
} finally {
|
|
783
|
-
depth--;
|
|
784
|
-
if (!depth) try {
|
|
785
|
-
if (failed) try {
|
|
786
|
-
run();
|
|
787
|
-
} catch {}
|
|
788
|
-
else run();
|
|
789
|
-
} finally {
|
|
790
|
-
activeBatch = void 0;
|
|
791
|
-
}
|
|
792
|
-
}
|
|
793
|
-
};
|
|
794
|
-
const releaseProducer = (producer) => {
|
|
795
|
-
assertIdle();
|
|
796
|
-
if (producer.outputs.some((output) => output.consumers.size)) throw new Error("Projection producer is still used by another processor.");
|
|
797
|
-
producer.disposed = true;
|
|
798
|
-
if (producer.kind === "processor") {
|
|
799
|
-
producer.dependencies.forEach((output) => output.consumers.delete(producer));
|
|
800
|
-
processors.delete(producer);
|
|
801
|
-
queued.delete(producer);
|
|
802
|
-
completed.delete(producer);
|
|
803
|
-
} else {
|
|
804
|
-
sources.delete(producer);
|
|
805
|
-
pendingSources.delete(producer);
|
|
806
|
-
}
|
|
807
|
-
producer.release();
|
|
808
|
-
producer.clear();
|
|
809
|
-
producer.outputs.forEach((output) => emissions.delete(output));
|
|
810
|
-
};
|
|
811
|
-
return {
|
|
812
|
-
assertActive,
|
|
813
|
-
assertIdle,
|
|
814
|
-
capture,
|
|
815
|
-
settle,
|
|
816
|
-
flush,
|
|
817
|
-
run,
|
|
818
|
-
guards,
|
|
819
|
-
cleanups,
|
|
820
|
-
get active() {
|
|
821
|
-
return !disposed;
|
|
822
|
-
},
|
|
823
|
-
addSource(source) {
|
|
824
|
-
assertIdle();
|
|
825
|
-
sources.add(source);
|
|
826
|
-
},
|
|
827
|
-
addProcessor(processor) {
|
|
828
|
-
assertIdle();
|
|
829
|
-
processors.add(processor);
|
|
830
|
-
processor.dependencies.forEach((output) => output.consumers.add(processor));
|
|
831
|
-
},
|
|
832
|
-
releaseProducer,
|
|
833
|
-
order: () => sequence++,
|
|
834
|
-
initialize(callback) {
|
|
835
|
-
assertIdle();
|
|
836
|
-
phase = "compute";
|
|
837
|
-
lock(true);
|
|
838
|
-
try {
|
|
839
|
-
return callback();
|
|
840
|
-
} finally {
|
|
841
|
-
lock(false);
|
|
842
|
-
phase = "idle";
|
|
843
|
-
}
|
|
844
|
-
},
|
|
845
|
-
batch,
|
|
846
|
-
batchContext: () => activeBatch,
|
|
847
|
-
dispose() {
|
|
848
|
-
if (disposed) return;
|
|
849
|
-
assertIdle();
|
|
850
|
-
disposed = true;
|
|
851
|
-
const failures = [];
|
|
852
|
-
cleanups.forEach((cleanup) => {
|
|
853
|
-
try {
|
|
854
|
-
cleanup();
|
|
855
|
-
} catch (error) {
|
|
856
|
-
failures.push(error);
|
|
857
|
-
}
|
|
858
|
-
});
|
|
859
|
-
cleanups.clear();
|
|
860
|
-
processors.forEach((processor) => {
|
|
861
|
-
processor.disposed = true;
|
|
862
|
-
try {
|
|
863
|
-
processor.release();
|
|
864
|
-
} catch (error) {
|
|
865
|
-
failures.push(error);
|
|
866
|
-
}
|
|
867
|
-
});
|
|
868
|
-
sources.forEach((source) => {
|
|
869
|
-
source.disposed = true;
|
|
870
|
-
try {
|
|
871
|
-
source.release();
|
|
872
|
-
} catch (error) {
|
|
873
|
-
failures.push(error);
|
|
874
|
-
}
|
|
875
|
-
});
|
|
876
|
-
processors.clear();
|
|
877
|
-
sources.clear();
|
|
878
|
-
pendingSources.clear();
|
|
879
|
-
heap.length = 0;
|
|
880
|
-
queued.clear();
|
|
881
|
-
completed.clear();
|
|
882
|
-
emissions.clear();
|
|
883
|
-
guards.clear();
|
|
884
|
-
errors.length = 0;
|
|
885
|
-
reportingFailures = [];
|
|
886
|
-
if (failures.length) throw new AggregateError(failures, "Projection cleanup failed.");
|
|
887
|
-
}
|
|
888
|
-
};
|
|
889
|
-
};
|
|
890
|
-
const assertSynchronous = (value) => {
|
|
891
|
-
if (value != null && (typeof value === "object" || typeof value === "function") && "then" in value && typeof value.then === "function") throw new TypeError("Projection callbacks must be synchronous.");
|
|
892
|
-
};
|
|
893
|
-
const assertScope = (active) => {
|
|
894
|
-
if (!active()) throw new Error("Projection reader or writer is no longer active.");
|
|
895
|
-
};
|
|
896
|
-
//#endregion
|
|
897
|
-
//#region core/src/projection/definition.ts
|
|
898
|
-
const projections = /* @__PURE__ */ new WeakMap();
|
|
899
|
-
const defineRef = (producer, output) => {
|
|
900
|
-
const handle = Object.freeze({});
|
|
901
|
-
projections.set(handle, Object.freeze({
|
|
902
|
-
producer,
|
|
903
|
-
output
|
|
904
|
-
}));
|
|
905
|
-
return handle;
|
|
906
|
-
};
|
|
907
|
-
const projectionRef = (projection) => {
|
|
908
|
-
const ref = projections.get(projection);
|
|
909
|
-
if (!ref) throw new TypeError("Unknown projection definition.");
|
|
910
|
-
return ref;
|
|
911
|
-
};
|
|
912
|
-
const producerOf = (projection) => projectionRef(projection).producer;
|
|
913
|
-
const isProjection = (value) => value !== null && typeof value === "object" && projections.has(value);
|
|
914
|
-
const ownProjection = (projection, owner) => {
|
|
915
|
-
const producer = producerOf(projection);
|
|
916
|
-
if (producer.owner !== void 0 && producer.owner !== owner) throw new TypeError("Projection producer already belongs to another scope.");
|
|
917
|
-
if (producer.kind === "processor") for (const dependency of producer.dependencies) {
|
|
918
|
-
const dependencyOwner = producerOf(dependency).owner;
|
|
919
|
-
if (dependencyOwner !== void 0 && dependencyOwner !== owner) throw new TypeError("A scope cannot depend on another scope.");
|
|
920
|
-
}
|
|
921
|
-
producer.owner = owner;
|
|
922
|
-
return projection;
|
|
923
|
-
};
|
|
924
|
-
const freezeOutput = (output) => Object.freeze({
|
|
925
|
-
kind: output.kind,
|
|
926
|
-
equality: output.equality,
|
|
927
|
-
...output.path ? { path: Object.freeze([...output.path]) } : {}
|
|
928
|
-
});
|
|
929
|
-
const defineProcessor = (definition) => {
|
|
930
|
-
if (!Array.isArray(definition.dependencies)) throw new TypeError("Projection dependencies must be an array.");
|
|
931
|
-
definition.dependencies.forEach(projectionRef);
|
|
932
|
-
if (!definition.outputs.length) throw new TypeError("Projection processor requires an output.");
|
|
933
|
-
const producer = {
|
|
934
|
-
kind: "processor",
|
|
935
|
-
dependencies: Object.freeze([...definition.dependencies]),
|
|
936
|
-
outputs: Object.freeze(definition.outputs.map(freezeOutput)),
|
|
937
|
-
create: definition.create,
|
|
938
|
-
...definition.name ? { name: definition.name } : {}
|
|
939
|
-
};
|
|
940
|
-
return Object.freeze(producer.outputs.map((_, output) => defineRef(producer, output)));
|
|
941
|
-
};
|
|
942
|
-
const defineSource = (source, output) => {
|
|
943
|
-
return defineRef({
|
|
944
|
-
kind: "source",
|
|
945
|
-
source,
|
|
946
|
-
output: freezeOutput(output)
|
|
947
|
-
}, 0);
|
|
948
|
-
};
|
|
949
|
-
const sourceValue = (source) => source.kind === "value" ? source.value : snapshotCollectionView(source.read);
|
|
950
|
-
const valueInput = (initial, equality = Object.is) => defineSource({
|
|
951
|
-
kind: "value-input",
|
|
952
|
-
initial,
|
|
953
|
-
equality
|
|
954
|
-
}, {
|
|
955
|
-
kind: "value",
|
|
956
|
-
equality
|
|
957
|
-
});
|
|
958
|
-
const collectionInput = (initial = /* @__PURE__ */ new Map()) => {
|
|
959
|
-
const entries = /* @__PURE__ */ new Map();
|
|
960
|
-
for (const [key, value] of initial) {
|
|
961
|
-
if (typeof key !== "string") throw new TypeError("Projection keys must be strings.");
|
|
962
|
-
entries.set(key, value);
|
|
963
|
-
}
|
|
964
|
-
return defineSource({
|
|
965
|
-
kind: "collection-input",
|
|
966
|
-
initial: entries
|
|
967
|
-
}, {
|
|
968
|
-
kind: "collection",
|
|
969
|
-
equality: Object.is
|
|
970
|
-
});
|
|
971
|
-
};
|
|
972
|
-
const input = Object.assign(valueInput, { collection: collectionInput });
|
|
973
|
-
function observe(source, selector) {
|
|
974
|
-
if (isExternalSource(source)) return source.kind === "collection" ? defineSource({
|
|
975
|
-
kind: "external-collection",
|
|
976
|
-
source
|
|
977
|
-
}, {
|
|
978
|
-
kind: "collection",
|
|
979
|
-
equality: Object.is
|
|
980
|
-
}) : defineSource({
|
|
981
|
-
kind: "external-value",
|
|
982
|
-
source,
|
|
983
|
-
equality: Object.is
|
|
984
|
-
}, {
|
|
985
|
-
kind: "value",
|
|
986
|
-
equality: Object.is
|
|
987
|
-
});
|
|
988
|
-
if ("current" in source && typeof source.current === "function") return defineSource({
|
|
989
|
-
kind: "readable",
|
|
990
|
-
readable: source,
|
|
991
|
-
equality: Object.is
|
|
992
|
-
}, {
|
|
993
|
-
kind: "value",
|
|
994
|
-
equality: Object.is
|
|
995
|
-
});
|
|
996
|
-
const document = source;
|
|
997
|
-
const state = require_context.contextOf(document).state;
|
|
998
|
-
const selected = selector ? compilePath(state.schema, "auto", selector) : Object.freeze({
|
|
999
|
-
kind: "value",
|
|
1000
|
-
schema: state.schema,
|
|
1001
|
-
address: Object.freeze([])
|
|
1002
|
-
});
|
|
1003
|
-
return defineSource({
|
|
1004
|
-
kind: "document",
|
|
1005
|
-
document,
|
|
1006
|
-
selector: selected
|
|
1007
|
-
}, {
|
|
1008
|
-
kind: selected.kind,
|
|
1009
|
-
equality: Object.is
|
|
1010
|
-
});
|
|
1011
|
-
}
|
|
1012
|
-
const isExternalSource = (source) => {
|
|
1013
|
-
if (!source || typeof source !== "object") return false;
|
|
1014
|
-
const candidate = source;
|
|
1015
|
-
return (candidate.kind === "value" || candidate.kind === "collection") && typeof candidate.current === "function" && typeof candidate.revision === "function" && typeof candidate.subscribe === "function";
|
|
1016
|
-
};
|
|
1017
|
-
function derive(dependencies, compute, equality = Object.is) {
|
|
1018
|
-
const [projection] = defineProcessor({
|
|
1019
|
-
dependencies,
|
|
1020
|
-
outputs: [{
|
|
1021
|
-
kind: "value",
|
|
1022
|
-
equality
|
|
1023
|
-
}],
|
|
1024
|
-
create: () => ({ evaluate: (evaluation) => {
|
|
1025
|
-
const output = evaluation.outputs[0];
|
|
1026
|
-
if (output.kind !== "value") throw new Error("derive requires a value output.");
|
|
1027
|
-
const next = compute(...evaluation.sources.map(sourceValue));
|
|
1028
|
-
assertSynchronous(next);
|
|
1029
|
-
output.output.set(next);
|
|
1030
|
-
} })
|
|
1031
|
-
});
|
|
1032
|
-
return projection;
|
|
1033
|
-
}
|
|
1034
|
-
//#endregion
|
|
1035
|
-
//#region core/src/projection/advanced.ts
|
|
1036
|
-
const resetCollectionChange = Object.freeze({ kind: "reset" });
|
|
1037
|
-
const isRebuild = (value) => value !== null && typeof value === "object" && value.kind === "rebuild";
|
|
1038
|
-
const publicValue = (source) => source.kind === "value" ? source.value : collectionView(source.read);
|
|
1039
|
-
const publicInputs = (sources, reset) => ({
|
|
1040
|
-
values: Object.freeze(sources.map(publicValue)),
|
|
1041
|
-
changes: Object.freeze(sources.map((source) => source.kind === "collection" ? reset ? resetCollectionChange : source.change : void 0))
|
|
1042
|
-
});
|
|
1043
|
-
const validateDependencies = (dependencies) => {
|
|
1044
|
-
if (!Array.isArray(dependencies)) throw new TypeError("Incremental dependencies must be projections.");
|
|
1045
|
-
dependencies.forEach(projectionRef);
|
|
1046
|
-
};
|
|
1047
|
-
function createIncrementalValue(dependencies, processor) {
|
|
1048
|
-
validateDependencies(dependencies);
|
|
1049
|
-
const [projection] = defineProcessor({
|
|
1050
|
-
dependencies,
|
|
1051
|
-
outputs: [{
|
|
1052
|
-
kind: "value",
|
|
1053
|
-
equality: Object.is
|
|
1054
|
-
}],
|
|
1055
|
-
create: () => {
|
|
1056
|
-
const state = Object.create(null);
|
|
1057
|
-
return { evaluate: (evaluation) => {
|
|
1058
|
-
const output = evaluation.outputs[0];
|
|
1059
|
-
if (output.kind !== "value") throw new Error("Incremental value output is invalid.");
|
|
1060
|
-
const publicInput = publicInputs(evaluation.sources, evaluation.reset);
|
|
1061
|
-
const result = processor({
|
|
1062
|
-
sources: publicInput.values,
|
|
1063
|
-
changes: publicInput.changes,
|
|
1064
|
-
previous: output.previous,
|
|
1065
|
-
reset: evaluation.reset,
|
|
1066
|
-
cause: evaluation.cause,
|
|
1067
|
-
state
|
|
1068
|
-
});
|
|
1069
|
-
assertSynchronous(result);
|
|
1070
|
-
if (isRebuild(result)) return result;
|
|
1071
|
-
output.output.set(result);
|
|
1072
|
-
} };
|
|
1073
|
-
}
|
|
1074
|
-
});
|
|
1075
|
-
return projection;
|
|
1076
|
-
}
|
|
1077
|
-
function createIncrementalCollection(dependencies, processor) {
|
|
1078
|
-
validateDependencies(dependencies);
|
|
1079
|
-
const [projection] = defineProcessor({
|
|
1080
|
-
dependencies,
|
|
1081
|
-
outputs: [{
|
|
1082
|
-
kind: "collection",
|
|
1083
|
-
equality: Object.is
|
|
1084
|
-
}],
|
|
1085
|
-
create: () => {
|
|
1086
|
-
const state = Object.create(null);
|
|
1087
|
-
return { evaluate: (evaluation) => {
|
|
1088
|
-
const output = evaluation.outputs[0];
|
|
1089
|
-
if (output.kind !== "collection") throw new Error("Incremental collection output is invalid.");
|
|
1090
|
-
const publicInput = publicInputs(evaluation.sources, evaluation.reset);
|
|
1091
|
-
const result = processor({
|
|
1092
|
-
sources: publicInput.values,
|
|
1093
|
-
changes: publicInput.changes,
|
|
1094
|
-
previous: output.previous,
|
|
1095
|
-
next: output.next,
|
|
1096
|
-
reset: evaluation.reset,
|
|
1097
|
-
cause: evaluation.cause,
|
|
1098
|
-
state,
|
|
1099
|
-
output: output.output
|
|
1100
|
-
});
|
|
1101
|
-
assertSynchronous(result);
|
|
1102
|
-
return isRebuild(result) ? result : void 0;
|
|
1103
|
-
} };
|
|
1104
|
-
}
|
|
1105
|
-
});
|
|
1106
|
-
return projection;
|
|
1107
|
-
}
|
|
1108
|
-
const isPlainGroupNamespace = (value, metadata) => require_context.isPlainObject(value) && !metadata.has(value);
|
|
1109
|
-
const compileGroupShape = (value, path, metadata, used, outputs) => {
|
|
1110
|
-
if (value !== null && typeof value === "object") {
|
|
1111
|
-
const output = metadata.get(value);
|
|
1112
|
-
if (output) {
|
|
1113
|
-
if (used.has(value)) throw new TypeError("An incremental group output cannot be reused.");
|
|
1114
|
-
used.add(value);
|
|
1115
|
-
const index = outputs.length;
|
|
1116
|
-
outputs.push({
|
|
1117
|
-
kind: output.kind,
|
|
1118
|
-
equality: output.equality,
|
|
1119
|
-
path: Object.freeze([...path])
|
|
1120
|
-
});
|
|
1121
|
-
return index;
|
|
1122
|
-
}
|
|
1123
|
-
}
|
|
1124
|
-
if (!isPlainGroupNamespace(value, metadata)) throw new TypeError("Incremental group outputs must be a static object tree.");
|
|
1125
|
-
for (const key of Reflect.ownKeys(value)) {
|
|
1126
|
-
if (typeof key !== "string") throw new TypeError("Incremental group output names must be strings.");
|
|
1127
|
-
if (!Object.prototype.propertyIsEnumerable.call(value, key)) throw new TypeError("Incremental group namespaces must contain enumerable properties.");
|
|
1128
|
-
}
|
|
1129
|
-
const keys = Object.keys(value);
|
|
1130
|
-
if (!keys.length) throw new TypeError("Incremental group namespaces cannot be empty.");
|
|
1131
|
-
const result = Object.create(null);
|
|
1132
|
-
for (const key of keys) {
|
|
1133
|
-
if (key === "__proto__" || key === "prototype" || key === "constructor") throw new TypeError(`Invalid incremental group output name: ${key}`);
|
|
1134
|
-
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
1135
|
-
if (!descriptor || !("value" in descriptor)) throw new TypeError("Incremental group namespaces cannot contain accessors.");
|
|
1136
|
-
result[key] = compileGroupShape(descriptor.value, [...path, key], metadata, used, outputs);
|
|
1137
|
-
}
|
|
1138
|
-
return Object.freeze(result);
|
|
1139
|
-
};
|
|
1140
|
-
const hydrateGroupShape = (shape, values) => {
|
|
1141
|
-
if (typeof shape === "number") return values[shape];
|
|
1142
|
-
const result = {};
|
|
1143
|
-
for (const [key, child] of Object.entries(shape)) result[key] = hydrateGroupShape(child, values);
|
|
1144
|
-
return Object.freeze(result);
|
|
1145
|
-
};
|
|
1146
|
-
const hydrateGroupReads = (shape, outputs, next) => {
|
|
1147
|
-
if (typeof shape === "number") {
|
|
1148
|
-
const output = outputs[shape];
|
|
1149
|
-
return next && output.kind === "value" ? output.next() : next ? output.next : output.previous;
|
|
1150
|
-
}
|
|
1151
|
-
const result = {};
|
|
1152
|
-
for (const [key, child] of Object.entries(shape)) if (typeof child === "number" && next && outputs[child].kind === "value") Object.defineProperty(result, key, {
|
|
1153
|
-
enumerable: true,
|
|
1154
|
-
configurable: false,
|
|
1155
|
-
get: () => outputs[child].next()
|
|
1156
|
-
});
|
|
1157
|
-
else result[key] = hydrateGroupReads(child, outputs, next);
|
|
1158
|
-
return Object.freeze(result);
|
|
1159
|
-
};
|
|
1160
|
-
function createIncrementalGroup(dependencies, defineOutputs, processor) {
|
|
1161
|
-
validateDependencies(dependencies);
|
|
1162
|
-
if (typeof defineOutputs !== "function") throw new TypeError("Incremental group outputs must be declared by a callback.");
|
|
1163
|
-
if (typeof processor !== "function") throw new TypeError("Incremental group processor must be a function.");
|
|
1164
|
-
let active = true;
|
|
1165
|
-
const metadata = /* @__PURE__ */ new Map();
|
|
1166
|
-
const declared = defineOutputs({
|
|
1167
|
-
collection: (equality = Object.is) => {
|
|
1168
|
-
if (!active) throw new TypeError("Incremental group output declarations are synchronous.");
|
|
1169
|
-
const descriptor = Object.freeze({});
|
|
1170
|
-
metadata.set(descriptor, {
|
|
1171
|
-
kind: "collection",
|
|
1172
|
-
equality
|
|
1173
|
-
});
|
|
1174
|
-
return descriptor;
|
|
1175
|
-
},
|
|
1176
|
-
value: (equality = Object.is) => {
|
|
1177
|
-
if (!active) throw new TypeError("Incremental group output declarations are synchronous.");
|
|
1178
|
-
const descriptor = Object.freeze({});
|
|
1179
|
-
metadata.set(descriptor, {
|
|
1180
|
-
kind: "value",
|
|
1181
|
-
equality
|
|
1182
|
-
});
|
|
1183
|
-
return descriptor;
|
|
1184
|
-
}
|
|
1185
|
-
});
|
|
1186
|
-
assertSynchronous(declared);
|
|
1187
|
-
active = false;
|
|
1188
|
-
const outputs = [];
|
|
1189
|
-
const used = /* @__PURE__ */ new Set();
|
|
1190
|
-
const shape = compileGroupShape(declared, [], metadata, used, outputs);
|
|
1191
|
-
if (typeof shape === "number") throw new TypeError("Incremental group declarations must return an output namespace.");
|
|
1192
|
-
if (used.size === 0 || used.size !== metadata.size) throw new TypeError("Every incremental group output must be returned by the declaration.");
|
|
1193
|
-
return hydrateGroupShape(shape, defineProcessor({
|
|
1194
|
-
dependencies,
|
|
1195
|
-
outputs,
|
|
1196
|
-
create: () => {
|
|
1197
|
-
const state = Object.create(null);
|
|
1198
|
-
return { evaluate: (evaluation) => {
|
|
1199
|
-
const publicInput = publicInputs(evaluation.sources, evaluation.reset);
|
|
1200
|
-
const result = processor({
|
|
1201
|
-
sources: publicInput.values,
|
|
1202
|
-
changes: publicInput.changes,
|
|
1203
|
-
previous: hydrateGroupReads(shape, evaluation.outputs, false),
|
|
1204
|
-
next: hydrateGroupReads(shape, evaluation.outputs, true),
|
|
1205
|
-
outputs: hydrateGroupShape(shape, evaluation.outputs.map((output) => output.output)),
|
|
1206
|
-
reset: evaluation.reset,
|
|
1207
|
-
cause: evaluation.cause,
|
|
1208
|
-
state
|
|
1209
|
-
});
|
|
1210
|
-
assertSynchronous(result);
|
|
1211
|
-
return isRebuild(result) ? result : void 0;
|
|
1212
|
-
} };
|
|
1213
|
-
},
|
|
1214
|
-
name: `processor-group:${outputs.map((output) => output.path?.join(".") ?? "").join(",")}`
|
|
1215
|
-
}));
|
|
1216
|
-
}
|
|
1217
|
-
const incremental = Object.assign(createIncrementalValue, {
|
|
1218
|
-
collection: createIncrementalCollection,
|
|
1219
|
-
group: createIncrementalGroup
|
|
1220
|
-
});
|
|
1221
|
-
//#endregion
|
|
1222
|
-
Object.defineProperty(exports, "ParseError", {
|
|
1223
|
-
enumerable: true,
|
|
1224
|
-
get: function() {
|
|
1225
|
-
return ParseError;
|
|
1226
|
-
}
|
|
1227
|
-
});
|
|
1228
|
-
Object.defineProperty(exports, "ProjectionDisposedError", {
|
|
1229
|
-
enumerable: true,
|
|
1230
|
-
get: function() {
|
|
1231
|
-
return ProjectionDisposedError;
|
|
1232
|
-
}
|
|
1233
|
-
});
|
|
1234
|
-
Object.defineProperty(exports, "ProjectionError", {
|
|
1235
|
-
enumerable: true,
|
|
1236
|
-
get: function() {
|
|
1237
|
-
return ProjectionError;
|
|
1238
|
-
}
|
|
1239
|
-
});
|
|
1240
|
-
Object.defineProperty(exports, "assertScope", {
|
|
1241
|
-
enumerable: true,
|
|
1242
|
-
get: function() {
|
|
1243
|
-
return assertScope;
|
|
1244
|
-
}
|
|
1245
|
-
});
|
|
1246
|
-
Object.defineProperty(exports, "assertSynchronous", {
|
|
1247
|
-
enumerable: true,
|
|
1248
|
-
get: function() {
|
|
1249
|
-
return assertSynchronous;
|
|
1250
|
-
}
|
|
1251
|
-
});
|
|
1252
|
-
Object.defineProperty(exports, "checkKey", {
|
|
1253
|
-
enumerable: true,
|
|
1254
|
-
get: function() {
|
|
1255
|
-
return checkKey;
|
|
1256
|
-
}
|
|
1257
|
-
});
|
|
1258
|
-
Object.defineProperty(exports, "checkTreePayload", {
|
|
1259
|
-
enumerable: true,
|
|
1260
|
-
get: function() {
|
|
1261
|
-
return checkTreePayload;
|
|
1262
|
-
}
|
|
1263
|
-
});
|
|
1264
|
-
Object.defineProperty(exports, "checkValue", {
|
|
1265
|
-
enumerable: true,
|
|
1266
|
-
get: function() {
|
|
1267
|
-
return checkValue;
|
|
1268
|
-
}
|
|
1269
|
-
});
|
|
1270
|
-
Object.defineProperty(exports, "collectionEntryNode", {
|
|
1271
|
-
enumerable: true,
|
|
1272
|
-
get: function() {
|
|
1273
|
-
return collectionEntryNode;
|
|
1274
|
-
}
|
|
1275
|
-
});
|
|
1276
|
-
Object.defineProperty(exports, "collectionView", {
|
|
1277
|
-
enumerable: true,
|
|
1278
|
-
get: function() {
|
|
1279
|
-
return collectionView;
|
|
1280
|
-
}
|
|
1281
|
-
});
|
|
1282
|
-
Object.defineProperty(exports, "compilePath", {
|
|
1283
|
-
enumerable: true,
|
|
1284
|
-
get: function() {
|
|
1285
|
-
return compilePath;
|
|
1286
|
-
}
|
|
1287
|
-
});
|
|
1288
|
-
Object.defineProperty(exports, "compiledLayout", {
|
|
1289
|
-
enumerable: true,
|
|
1290
|
-
get: function() {
|
|
1291
|
-
return compiledLayout;
|
|
1292
|
-
}
|
|
1293
|
-
});
|
|
1294
|
-
Object.defineProperty(exports, "compiledShape", {
|
|
1295
|
-
enumerable: true,
|
|
1296
|
-
get: function() {
|
|
1297
|
-
return compiledShape;
|
|
1298
|
-
}
|
|
1299
|
-
});
|
|
1300
|
-
Object.defineProperty(exports, "copyTreeNode", {
|
|
1301
|
-
enumerable: true,
|
|
1302
|
-
get: function() {
|
|
1303
|
-
return copyTreeNode;
|
|
1304
|
-
}
|
|
1305
|
-
});
|
|
1306
|
-
Object.defineProperty(exports, "copyValue", {
|
|
1307
|
-
enumerable: true,
|
|
1308
|
-
get: function() {
|
|
1309
|
-
return copyValue;
|
|
1310
|
-
}
|
|
1311
|
-
});
|
|
1312
|
-
Object.defineProperty(exports, "createScheduler", {
|
|
1313
|
-
enumerable: true,
|
|
1314
|
-
get: function() {
|
|
1315
|
-
return createScheduler;
|
|
1316
|
-
}
|
|
1317
|
-
});
|
|
1318
|
-
Object.defineProperty(exports, "derive", {
|
|
1319
|
-
enumerable: true,
|
|
1320
|
-
get: function() {
|
|
1321
|
-
return derive;
|
|
1322
|
-
}
|
|
1323
|
-
});
|
|
1324
|
-
Object.defineProperty(exports, "equal", {
|
|
1325
|
-
enumerable: true,
|
|
1326
|
-
get: function() {
|
|
1327
|
-
return equal;
|
|
1328
|
-
}
|
|
1329
|
-
});
|
|
1330
|
-
Object.defineProperty(exports, "equalTreeNode", {
|
|
1331
|
-
enumerable: true,
|
|
1332
|
-
get: function() {
|
|
1333
|
-
return equalTreeNode;
|
|
1334
|
-
}
|
|
1335
|
-
});
|
|
1336
|
-
Object.defineProperty(exports, "equalValue", {
|
|
1337
|
-
enumerable: true,
|
|
1338
|
-
get: function() {
|
|
1339
|
-
return equalValue;
|
|
1340
|
-
}
|
|
1341
|
-
});
|
|
1342
|
-
Object.defineProperty(exports, "field", {
|
|
1343
|
-
enumerable: true,
|
|
1344
|
-
get: function() {
|
|
1345
|
-
return field;
|
|
1346
|
-
}
|
|
1347
|
-
});
|
|
1348
|
-
Object.defineProperty(exports, "incremental", {
|
|
1349
|
-
enumerable: true,
|
|
1350
|
-
get: function() {
|
|
1351
|
-
return incremental;
|
|
1352
|
-
}
|
|
1353
|
-
});
|
|
1354
|
-
Object.defineProperty(exports, "indexedKeys", {
|
|
1355
|
-
enumerable: true,
|
|
1356
|
-
get: function() {
|
|
1357
|
-
return indexedKeys;
|
|
1358
|
-
}
|
|
1359
|
-
});
|
|
1360
|
-
Object.defineProperty(exports, "input", {
|
|
1361
|
-
enumerable: true,
|
|
1362
|
-
get: function() {
|
|
1363
|
-
return input;
|
|
1364
|
-
}
|
|
1365
|
-
});
|
|
1366
|
-
Object.defineProperty(exports, "insert", {
|
|
1367
|
-
enumerable: true,
|
|
1368
|
-
get: function() {
|
|
1369
|
-
return insert;
|
|
1370
|
-
}
|
|
1371
|
-
});
|
|
1372
|
-
Object.defineProperty(exports, "install", {
|
|
1373
|
-
enumerable: true,
|
|
1374
|
-
get: function() {
|
|
1375
|
-
return install;
|
|
1376
|
-
}
|
|
1377
|
-
});
|
|
1378
|
-
Object.defineProperty(exports, "installKeys", {
|
|
1379
|
-
enumerable: true,
|
|
1380
|
-
get: function() {
|
|
1381
|
-
return installKeys;
|
|
1382
|
-
}
|
|
1383
|
-
});
|
|
1384
|
-
Object.defineProperty(exports, "installList", {
|
|
1385
|
-
enumerable: true,
|
|
1386
|
-
get: function() {
|
|
1387
|
-
return installList;
|
|
1388
|
-
}
|
|
1389
|
-
});
|
|
1390
|
-
Object.defineProperty(exports, "isProjection", {
|
|
1391
|
-
enumerable: true,
|
|
1392
|
-
get: function() {
|
|
1393
|
-
return isProjection;
|
|
1394
|
-
}
|
|
1395
|
-
});
|
|
1396
|
-
Object.defineProperty(exports, "keys", {
|
|
1397
|
-
enumerable: true,
|
|
1398
|
-
get: function() {
|
|
1399
|
-
return keys;
|
|
1400
|
-
}
|
|
1401
|
-
});
|
|
1402
|
-
Object.defineProperty(exports, "list", {
|
|
1403
|
-
enumerable: true,
|
|
1404
|
-
get: function() {
|
|
1405
|
-
return list;
|
|
1406
|
-
}
|
|
1407
|
-
});
|
|
1408
|
-
Object.defineProperty(exports, "listSequence", {
|
|
1409
|
-
enumerable: true,
|
|
1410
|
-
get: function() {
|
|
1411
|
-
return listSequence;
|
|
1412
|
-
}
|
|
1413
|
-
});
|
|
1414
|
-
Object.defineProperty(exports, "map", {
|
|
1415
|
-
enumerable: true,
|
|
1416
|
-
get: function() {
|
|
1417
|
-
return map;
|
|
1418
|
-
}
|
|
1419
|
-
});
|
|
1420
|
-
Object.defineProperty(exports, "mapRead", {
|
|
1421
|
-
enumerable: true,
|
|
1422
|
-
get: function() {
|
|
1423
|
-
return mapRead;
|
|
1424
|
-
}
|
|
1425
|
-
});
|
|
1426
|
-
Object.defineProperty(exports, "matches", {
|
|
1427
|
-
enumerable: true,
|
|
1428
|
-
get: function() {
|
|
1429
|
-
return matches;
|
|
1430
|
-
}
|
|
1431
|
-
});
|
|
1432
|
-
Object.defineProperty(exports, "object", {
|
|
1433
|
-
enumerable: true,
|
|
1434
|
-
get: function() {
|
|
1435
|
-
return object;
|
|
1436
|
-
}
|
|
1437
|
-
});
|
|
1438
|
-
Object.defineProperty(exports, "observe", {
|
|
1439
|
-
enumerable: true,
|
|
1440
|
-
get: function() {
|
|
1441
|
-
return observe;
|
|
1442
|
-
}
|
|
1443
|
-
});
|
|
1444
|
-
Object.defineProperty(exports, "optional", {
|
|
1445
|
-
enumerable: true,
|
|
1446
|
-
get: function() {
|
|
1447
|
-
return optional;
|
|
1448
|
-
}
|
|
1449
|
-
});
|
|
1450
|
-
Object.defineProperty(exports, "ownProjection", {
|
|
1451
|
-
enumerable: true,
|
|
1452
|
-
get: function() {
|
|
1453
|
-
return ownProjection;
|
|
1454
|
-
}
|
|
1455
|
-
});
|
|
1456
|
-
Object.defineProperty(exports, "parse", {
|
|
1457
|
-
enumerable: true,
|
|
1458
|
-
get: function() {
|
|
1459
|
-
return parse;
|
|
1460
|
-
}
|
|
1461
|
-
});
|
|
1462
|
-
Object.defineProperty(exports, "producerOf", {
|
|
1463
|
-
enumerable: true,
|
|
1464
|
-
get: function() {
|
|
1465
|
-
return producerOf;
|
|
1466
|
-
}
|
|
1467
|
-
});
|
|
1468
|
-
Object.defineProperty(exports, "profile", {
|
|
1469
|
-
enumerable: true,
|
|
1470
|
-
get: function() {
|
|
1471
|
-
return profile;
|
|
1472
|
-
}
|
|
1473
|
-
});
|
|
1474
|
-
Object.defineProperty(exports, "projectionRef", {
|
|
1475
|
-
enumerable: true,
|
|
1476
|
-
get: function() {
|
|
1477
|
-
return projectionRef;
|
|
1478
|
-
}
|
|
1479
|
-
});
|
|
1480
|
-
Object.defineProperty(exports, "remove", {
|
|
1481
|
-
enumerable: true,
|
|
1482
|
-
get: function() {
|
|
1483
|
-
return remove;
|
|
1484
|
-
}
|
|
1485
|
-
});
|
|
1486
|
-
Object.defineProperty(exports, "snapshotCollectionView", {
|
|
1487
|
-
enumerable: true,
|
|
1488
|
-
get: function() {
|
|
1489
|
-
return snapshotCollectionView;
|
|
1490
|
-
}
|
|
1491
|
-
});
|
|
1492
|
-
Object.defineProperty(exports, "table", {
|
|
1493
|
-
enumerable: true,
|
|
1494
|
-
get: function() {
|
|
1495
|
-
return table;
|
|
1496
|
-
}
|
|
1497
|
-
});
|
|
1498
|
-
Object.defineProperty(exports, "toArray", {
|
|
1499
|
-
enumerable: true,
|
|
1500
|
-
get: function() {
|
|
1501
|
-
return toArray;
|
|
1502
|
-
}
|
|
1503
|
-
});
|
|
1504
|
-
Object.defineProperty(exports, "tree", {
|
|
1505
|
-
enumerable: true,
|
|
1506
|
-
get: function() {
|
|
1507
|
-
return tree;
|
|
1508
|
-
}
|
|
1509
|
-
});
|
|
1510
|
-
Object.defineProperty(exports, "variant", {
|
|
1511
|
-
enumerable: true,
|
|
1512
|
-
get: function() {
|
|
1513
|
-
return variant;
|
|
1514
|
-
}
|
|
1515
|
-
});
|
|
1516
|
-
|
|
1517
|
-
//# sourceMappingURL=advanced-Cle5g3B4.cjs.map
|