@texaryn/core 0.13.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +8 -3
  3. package/dist/commands/handler.d.ts.map +1 -1
  4. package/dist/commands/handler.js +52 -4
  5. package/dist/commands/handler.js.map +1 -1
  6. package/dist/commands/types.d.ts +5 -1
  7. package/dist/commands/types.d.ts.map +1 -1
  8. package/dist/index.d.ts +6 -6
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +1 -1
  11. package/dist/index.js.map +1 -1
  12. package/dist/ir/compiler.js +1 -0
  13. package/dist/ir/compiler.js.map +1 -1
  14. package/dist/ir/index.d.ts +1 -1
  15. package/dist/ir/index.d.ts.map +1 -1
  16. package/dist/ir/index.js.map +1 -1
  17. package/dist/ir/runtime-state.d.ts +4 -0
  18. package/dist/ir/runtime-state.d.ts.map +1 -1
  19. package/dist/ir/types.d.ts +53 -5
  20. package/dist/ir/types.d.ts.map +1 -1
  21. package/dist/messages/english.d.ts +1 -1
  22. package/dist/messages/english.d.ts.map +1 -1
  23. package/dist/messages/english.js +10 -0
  24. package/dist/messages/english.js.map +1 -1
  25. package/dist/messages/index.d.ts +1 -1
  26. package/dist/messages/index.d.ts.map +1 -1
  27. package/dist/messages/index.js.map +1 -1
  28. package/dist/messages/types.d.ts +9 -0
  29. package/dist/messages/types.d.ts.map +1 -1
  30. package/dist/renderer/registry.d.ts +2 -1
  31. package/dist/renderer/registry.d.ts.map +1 -1
  32. package/dist/renderer/registry.js.map +1 -1
  33. package/dist/renderer/types.d.ts +7 -7
  34. package/dist/renderer/types.d.ts.map +1 -1
  35. package/dist/runtime/document-limits.d.ts +19 -0
  36. package/dist/runtime/document-limits.d.ts.map +1 -0
  37. package/dist/runtime/document-limits.js +170 -0
  38. package/dist/runtime/document-limits.js.map +1 -0
  39. package/dist/runtime/document-runtime-control.d.ts +18 -0
  40. package/dist/runtime/document-runtime-control.d.ts.map +1 -0
  41. package/dist/runtime/document-runtime-control.js +11 -0
  42. package/dist/runtime/document-runtime-control.js.map +1 -0
  43. package/dist/runtime/document-runtime.d.ts +7 -0
  44. package/dist/runtime/document-runtime.d.ts.map +1 -0
  45. package/dist/runtime/document-runtime.js +574 -0
  46. package/dist/runtime/document-runtime.js.map +1 -0
  47. package/dist/runtime/document-update-session.d.ts +3 -0
  48. package/dist/runtime/document-update-session.d.ts.map +1 -0
  49. package/dist/runtime/document-update-session.js +320 -0
  50. package/dist/runtime/document-update-session.js.map +1 -0
  51. package/dist/runtime/index.d.ts +4 -2
  52. package/dist/runtime/index.d.ts.map +1 -1
  53. package/dist/runtime/index.js +3 -1
  54. package/dist/runtime/index.js.map +1 -1
  55. package/dist/runtime/runtime.d.ts +4 -0
  56. package/dist/runtime/runtime.d.ts.map +1 -1
  57. package/dist/runtime/runtime.js +420 -21
  58. package/dist/runtime/runtime.js.map +1 -1
  59. package/dist/runtime/types.d.ts +94 -4
  60. package/dist/runtime/types.d.ts.map +1 -1
  61. package/dist/schema/index.d.ts +1 -1
  62. package/dist/schema/index.d.ts.map +1 -1
  63. package/dist/schema/port.d.ts +19 -1
  64. package/dist/schema/port.d.ts.map +1 -1
  65. package/dist/state/signal.d.ts +1 -0
  66. package/dist/state/signal.d.ts.map +1 -1
  67. package/dist/state/signal.js +47 -10
  68. package/dist/state/signal.js.map +1 -1
  69. package/dist/types.d.ts +4 -0
  70. package/dist/types.d.ts.map +1 -1
  71. package/package.json +1 -1
@@ -0,0 +1,574 @@
1
+ import { batch } from '../state/signal.js';
2
+ import { createStore } from '../state/store.js';
3
+ import { getAtPointer, parsePointer } from '../json-pointer.js';
4
+ import { assertDocumentNodeCount, assertDocumentTreeDepth, preflightJson, preflightJsonRoots, resolveDocumentRuntimeLimits, } from './document-limits.js';
5
+ import { registerDocumentRuntimeControl } from './document-runtime-control.js';
6
+ const objectPrototype = Object.prototype;
7
+ function isRecord(value) {
8
+ if (value === null || typeof value !== 'object' || Array.isArray(value))
9
+ return false;
10
+ const prototype = Object.getPrototypeOf(value);
11
+ return prototype === objectPrototype || prototype === null;
12
+ }
13
+ export function cloneJson(value, path, limits, work) {
14
+ preflightJson(value, path, limits, work);
15
+ return cloneJsonUnchecked(value, path, new Set());
16
+ }
17
+ function cloneJsonUnchecked(value, path, active) {
18
+ if (value === null || typeof value === 'string' || typeof value === 'boolean')
19
+ return value;
20
+ if (typeof value === 'number') {
21
+ if (!Number.isFinite(value))
22
+ throw new TypeError(`${path} must contain a finite number`);
23
+ return value;
24
+ }
25
+ if (typeof value !== 'object')
26
+ throw new TypeError(`${path} is not a JSON value`);
27
+ if (active.has(value))
28
+ throw new TypeError(`${path} contains a cycle`);
29
+ active.add(value);
30
+ try {
31
+ if (Array.isArray(value)) {
32
+ const keys = Reflect.ownKeys(value);
33
+ if (keys.some((key) => {
34
+ if (key === 'length')
35
+ return false;
36
+ if (typeof key !== 'string' || !/^(0|[1-9]\d*)$/.test(key))
37
+ return true;
38
+ const index = Number(key);
39
+ return !Number.isSafeInteger(index) || index >= value.length;
40
+ })) {
41
+ throw new TypeError(`${path} contains a non-JSON array property`);
42
+ }
43
+ const result = [];
44
+ for (let index = 0; index < value.length; index += 1) {
45
+ if (!Object.prototype.hasOwnProperty.call(value, index)) {
46
+ throw new TypeError(`${path}[${index}] is missing`);
47
+ }
48
+ const descriptor = Object.getOwnPropertyDescriptor(value, String(index));
49
+ if (!descriptor || !('value' in descriptor) || !descriptor.enumerable) {
50
+ throw new TypeError(`${path}[${index}] must be a JSON property`);
51
+ }
52
+ result.push(cloneJsonUnchecked(descriptor.value, `${path}[${index}]`, active));
53
+ }
54
+ return result;
55
+ }
56
+ if (!isRecord(value) ||
57
+ Reflect.ownKeys(value).some((key) => typeof key !== 'string') ||
58
+ Reflect.ownKeys(value).length !== Object.keys(value).length) {
59
+ throw new TypeError(`${path} must be a plain JSON object`);
60
+ }
61
+ const result = Object.create(null);
62
+ for (const key of Object.keys(value)) {
63
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
64
+ if (!descriptor || !('value' in descriptor) || !descriptor.enumerable) {
65
+ throw new TypeError(`${path}.${key} must be a JSON property`);
66
+ }
67
+ result[key] = cloneJsonUnchecked(descriptor.value, `${path}.${key}`, active);
68
+ }
69
+ return result;
70
+ }
71
+ finally {
72
+ active.delete(value);
73
+ }
74
+ }
75
+ function deepFreeze(value) {
76
+ if (value !== null && typeof value === 'object' && !Object.isFrozen(value)) {
77
+ for (const child of Object.values(value))
78
+ deepFreeze(child);
79
+ Object.freeze(value);
80
+ }
81
+ return value;
82
+ }
83
+ function fail(path, message) {
84
+ throw new TypeError(`${path} ${message}`);
85
+ }
86
+ function requiredString(record, key, path) {
87
+ const value = record[key];
88
+ if (typeof value !== 'string' || value.length === 0)
89
+ fail(`${path}.${key}`, 'must be a nonempty string');
90
+ return value;
91
+ }
92
+ function assertKeys(record, allowed, path) {
93
+ const allowedSet = new Set(allowed);
94
+ for (const key of Object.keys(record)) {
95
+ if (!allowedSet.has(key))
96
+ fail(`${path}.${key}`, 'is not supported');
97
+ }
98
+ }
99
+ function assertPointer(value, path) {
100
+ if (typeof value !== 'string' || (value !== '' && !value.startsWith('/'))) {
101
+ fail(path, 'must be a JSON Pointer');
102
+ }
103
+ if (/~(?![01])/.test(value))
104
+ fail(path, 'contains an invalid JSON Pointer escape');
105
+ try {
106
+ parsePointer(value);
107
+ }
108
+ catch {
109
+ fail(path, 'must be a JSON Pointer');
110
+ }
111
+ }
112
+ function validateAnnotations(value, path) {
113
+ if (!isRecord(value))
114
+ fail(path, 'must be an object');
115
+ assertKeys(value, ['title', 'description', 'readOnly', 'writeOnly', 'deprecated', 'examples', 'default'], path);
116
+ for (const key of ['title', 'description']) {
117
+ if (value[key] !== undefined && typeof value[key] !== 'string')
118
+ fail(`${path}.${key}`, 'must be a string');
119
+ }
120
+ for (const key of ['readOnly', 'writeOnly', 'deprecated']) {
121
+ if (value[key] !== undefined && typeof value[key] !== 'boolean')
122
+ fail(`${path}.${key}`, 'must be a boolean');
123
+ }
124
+ if (value.examples !== undefined && !Array.isArray(value.examples))
125
+ fail(`${path}.examples`, 'must be an array');
126
+ }
127
+ function validateDocument(value, limits) {
128
+ const snapshot = cloneJson(value, 'document', limits);
129
+ if (!isRecord(snapshot))
130
+ fail('document', 'must be an object');
131
+ assertKeys(snapshot, ['version', 'rootId', 'nodes'], 'document');
132
+ if (snapshot.version !== 2)
133
+ fail('document.version', 'must be 2');
134
+ const rootId = requiredString(snapshot, 'rootId', 'document');
135
+ if (!isRecord(snapshot.nodes))
136
+ fail('document.nodes', 'must be an object');
137
+ const inputNodes = snapshot.nodes;
138
+ assertDocumentNodeCount(inputNodes, limits);
139
+ const nodes = new Map();
140
+ const collectionIds = new Set();
141
+ for (const [mapKey, candidate] of Object.entries(inputNodes)) {
142
+ const path = `document.nodes.${mapKey}`;
143
+ if (!isRecord(candidate))
144
+ fail(path, 'must be an object');
145
+ const node = candidate;
146
+ if (requiredString(node, 'id', path) !== mapKey)
147
+ fail(`${path}.id`, 'must match its map key');
148
+ const type = requiredString(node, 'type', path);
149
+ const parentIdValue = node.parentId;
150
+ if (parentIdValue !== null && (typeof parentIdValue !== 'string' || parentIdValue.length === 0)) {
151
+ fail(`${path}.parentId`, 'must be null or a node ID');
152
+ }
153
+ validateAnnotations(node.annotations, `${path}.annotations`);
154
+ if (type === 'container') {
155
+ assertKeys(node, ['id', 'type', 'parentId', 'annotations', 'containerType', 'children'], path);
156
+ if (node.containerType !== 'group' && node.containerType !== 'layout') {
157
+ fail(`${path}.containerType`, 'must be group or layout');
158
+ }
159
+ if (!Array.isArray(node.children) || node.children.some((child) => typeof child !== 'string' || child.length === 0)) {
160
+ fail(`${path}.children`, 'must be an array of node IDs');
161
+ }
162
+ if (node.containerType === 'group') {
163
+ const title = node.annotations.title;
164
+ if (typeof title !== 'string' || title.trim().length === 0) {
165
+ fail(`${path}.annotations.title`, 'must provide the accessible group name');
166
+ }
167
+ }
168
+ nodes.set(mapKey, node);
169
+ continue;
170
+ }
171
+ if (type === 'text') {
172
+ assertKeys(node, ['id', 'type', 'parentId', 'annotations', 'content', 'textRole'], path);
173
+ if (typeof node.content !== 'string')
174
+ fail(`${path}.content`, 'must be a string');
175
+ if (node.textRole !== 'heading' && node.textRole !== 'paragraph' && node.textRole !== 'help') {
176
+ fail(`${path}.textRole`, 'is not supported by display documents');
177
+ }
178
+ nodes.set(mapKey, node);
179
+ continue;
180
+ }
181
+ if (type === 'action') {
182
+ assertKeys(node, ['id', 'type', 'parentId', 'annotations', 'actionType', 'label', 'actionArgs', 'buttonRole'], path);
183
+ requiredString(node, 'actionType', path);
184
+ requiredString(node, 'label', path);
185
+ if (node.buttonRole !== 'button')
186
+ fail(`${path}.buttonRole`, 'must be button');
187
+ nodes.set(mapKey, node);
188
+ continue;
189
+ }
190
+ if (type === 'list') {
191
+ assertKeys(node, ['id', 'type', 'parentId', 'annotations', 'collectionId', 'dataPointer', 'valuePointer', 'rowKeyPointer'], path);
192
+ const collectionId = requiredString(node, 'collectionId', path);
193
+ if (collectionIds.has(collectionId))
194
+ fail(`${path}.collectionId`, 'must be unique in the document');
195
+ collectionIds.add(collectionId);
196
+ assertPointer(node.dataPointer, `${path}.dataPointer`);
197
+ assertPointer(node.valuePointer, `${path}.valuePointer`);
198
+ if (node.rowKeyPointer !== undefined)
199
+ assertPointer(node.rowKeyPointer, `${path}.rowKeyPointer`);
200
+ nodes.set(mapKey, node);
201
+ continue;
202
+ }
203
+ if (type === 'table') {
204
+ assertKeys(node, ['id', 'type', 'parentId', 'annotations', 'collectionId', 'dataPointer', 'rowKeyPointer', 'columns'], path);
205
+ const collectionId = requiredString(node, 'collectionId', path);
206
+ if (collectionIds.has(collectionId))
207
+ fail(`${path}.collectionId`, 'must be unique in the document');
208
+ collectionIds.add(collectionId);
209
+ assertPointer(node.dataPointer, `${path}.dataPointer`);
210
+ if (node.rowKeyPointer !== undefined)
211
+ assertPointer(node.rowKeyPointer, `${path}.rowKeyPointer`);
212
+ if (!Array.isArray(node.columns))
213
+ fail(`${path}.columns`, 'must be an array');
214
+ const columnIds = new Set();
215
+ for (const [index, columnValue] of node.columns.entries()) {
216
+ const columnPath = `${path}.columns[${index}]`;
217
+ if (!isRecord(columnValue))
218
+ fail(columnPath, 'must be an object');
219
+ assertKeys(columnValue, ['id', 'label', 'valuePointer'], columnPath);
220
+ const columnId = requiredString(columnValue, 'id', columnPath);
221
+ if (columnIds.has(columnId))
222
+ fail(`${columnPath}.id`, 'must be unique within its table');
223
+ columnIds.add(columnId);
224
+ if (typeof columnValue.label !== 'string')
225
+ fail(`${columnPath}.label`, 'must be a string');
226
+ assertPointer(columnValue.valuePointer, `${columnPath}.valuePointer`);
227
+ }
228
+ nodes.set(mapKey, node);
229
+ continue;
230
+ }
231
+ fail(`${path}.type`, `has unsupported node kind ${type}`);
232
+ }
233
+ const root = nodes.get(rootId);
234
+ if (!root)
235
+ fail('document.rootId', 'does not name a node');
236
+ if (root.parentId !== null)
237
+ fail(`document.nodes.${rootId}.parentId`, 'must be null for the root');
238
+ const childOwners = new Map();
239
+ for (const [parentId, node] of nodes) {
240
+ if (node.type !== 'container')
241
+ continue;
242
+ const seenChildren = new Set();
243
+ for (const child of node.children) {
244
+ const childId = child;
245
+ if (seenChildren.has(childId))
246
+ fail(`document.nodes.${parentId}.children`, 'contains a duplicate child');
247
+ seenChildren.add(childId);
248
+ const childNode = nodes.get(childId);
249
+ if (!childNode)
250
+ fail(`document.nodes.${parentId}.children`, `references missing node ${childId}`);
251
+ if (childNode.parentId !== parentId)
252
+ fail(`document.nodes.${childId}.parentId`, 'does not agree with its parent children list');
253
+ if (childOwners.has(childId))
254
+ fail(`document.nodes.${childId}`, 'has more than one parent');
255
+ childOwners.set(childId, parentId);
256
+ }
257
+ }
258
+ assertDocumentTreeDepth(rootId, nodes, limits);
259
+ const reachable = new Set();
260
+ const pending = [rootId];
261
+ while (pending.length > 0) {
262
+ const nodeId = pending.pop();
263
+ if (reachable.has(nodeId))
264
+ continue;
265
+ reachable.add(nodeId);
266
+ const node = nodes.get(nodeId);
267
+ if (node?.type === 'container') {
268
+ for (const childId of node.children)
269
+ pending.push(childId);
270
+ }
271
+ }
272
+ if (reachable.size !== nodes.size)
273
+ fail('document.nodes', 'contains unreachable nodes');
274
+ for (const [nodeId, node] of nodes) {
275
+ if (nodeId !== rootId && !childOwners.has(nodeId))
276
+ fail(`document.nodes.${nodeId}`, 'has no parent');
277
+ }
278
+ return deepFreeze(snapshot);
279
+ }
280
+ function assertScalar(value, path) {
281
+ if (value === undefined || value === null)
282
+ return null;
283
+ if (typeof value === 'string' || typeof value === 'boolean')
284
+ return value;
285
+ if (typeof value === 'number' && Number.isFinite(value))
286
+ return value;
287
+ fail(path, 'must resolve to a scalar, null, or missing value');
288
+ }
289
+ function keyToken(value, path) {
290
+ if (typeof value === 'string')
291
+ return `s:${value}`;
292
+ if (typeof value === 'number' && Number.isFinite(value))
293
+ return `n:${String(value)}`;
294
+ fail(path, 'must resolve to a string or finite number');
295
+ }
296
+ function prepareCollections(document, data, limits) {
297
+ const result = [];
298
+ let totalRows = 0;
299
+ let totalCells = 0;
300
+ for (const candidate of Object.values(document.nodes)) {
301
+ if (candidate.type !== 'list' && candidate.type !== 'table')
302
+ continue;
303
+ const node = candidate;
304
+ const source = getAtPointer(data, node.dataPointer);
305
+ if (source === undefined) {
306
+ result.push({ node, rows: [] });
307
+ continue;
308
+ }
309
+ if (!Array.isArray(source))
310
+ fail(`collection ${node.collectionId}`, 'source must be an array when present');
311
+ if (source.length > limits.maxRowsPerCollection) {
312
+ fail(`collection ${node.collectionId}`, `exceeds the maximum row count of ${limits.maxRowsPerCollection}`);
313
+ }
314
+ totalRows += source.length;
315
+ if (totalRows > limits.maxCollectionRows) {
316
+ fail('collections', `exceed the maximum total row count of ${limits.maxCollectionRows}`);
317
+ }
318
+ if (node.type === 'table') {
319
+ totalCells += source.length * node.columns.length;
320
+ if (totalCells > limits.maxTableCells) {
321
+ fail('collections', `exceed the maximum table cell count of ${limits.maxTableCells}`);
322
+ }
323
+ }
324
+ const rows = [];
325
+ for (const [index, item] of source.entries()) {
326
+ const path = `collection ${node.collectionId}[${index}]`;
327
+ if (node.type === 'table' && !isRecord(item))
328
+ fail(path, 'must be an object for a table row');
329
+ const key = node.rowKeyPointer === undefined
330
+ ? undefined
331
+ : keyToken(getAtPointer(item, node.rowKeyPointer), `${path} row key`);
332
+ const value = node.type === 'list'
333
+ ? assertScalar(getAtPointer(item, node.valuePointer), `${path} list value`)
334
+ : null;
335
+ const cells = node.type === 'table'
336
+ ? node.columns.map((column) => assertScalar(getAtPointer(item, column.valuePointer), `${path} column ${column.id}`))
337
+ : [];
338
+ rows.push({ value, cells, key });
339
+ }
340
+ if (node.rowKeyPointer !== undefined) {
341
+ const keys = new Set();
342
+ for (const row of rows) {
343
+ if (row.key === undefined)
344
+ fail(`collection ${node.collectionId}`, 'row key is missing');
345
+ if (keys.has(row.key))
346
+ fail(`collection ${node.collectionId}`, `contains duplicate row key ${row.key}`);
347
+ keys.add(row.key);
348
+ }
349
+ }
350
+ result.push({ node, rows });
351
+ }
352
+ return result;
353
+ }
354
+ function freezeRows(rows) {
355
+ for (const row of rows) {
356
+ Object.freeze(row.cells);
357
+ Object.freeze(row);
358
+ }
359
+ return Object.freeze(rows);
360
+ }
361
+ function assertActionArgumentValidators(document, actions) {
362
+ for (const node of Object.values(document.nodes)) {
363
+ if (node.type !== 'action' || !Object.prototype.hasOwnProperty.call(node, 'actionArgs'))
364
+ continue;
365
+ const action = actions.get(node.actionType);
366
+ if (action && !action.validateArgs) {
367
+ throw new TypeError(`Action ${node.actionType} has arguments but no validateArgs registration`);
368
+ }
369
+ }
370
+ }
371
+ export function createDocumentRuntime(inputDocument, options = {}) {
372
+ const limits = resolveDocumentRuntimeLimits(options.limits);
373
+ const initialInputData = options.initialData === undefined ? {} : options.initialData;
374
+ preflightJsonRoots([
375
+ { value: inputDocument, path: 'document' },
376
+ { value: initialInputData, path: 'data' },
377
+ ], limits);
378
+ const initialData = deepFreeze(cloneJson(initialInputData, 'data', limits));
379
+ let document = validateDocument(inputDocument, limits);
380
+ let nextItemId = 0;
381
+ let identities = new Map();
382
+ let destroyed = false;
383
+ let mutationVersion = 0;
384
+ function makeSnapshot(nextDocument, data, previous, preserveUnkeyed) {
385
+ const prepared = prepareCollections(nextDocument, data, limits);
386
+ const nextIdentities = new Map();
387
+ const collectionRows = new Map();
388
+ let candidateItemId = nextItemId;
389
+ function newItemId() {
390
+ candidateItemId += 1;
391
+ return `document-item-${candidateItemId}`;
392
+ }
393
+ for (const { node, rows } of prepared) {
394
+ const previousIdentity = previous.get(node.collectionId);
395
+ const compatible = previousIdentity !== undefined &&
396
+ previousIdentity.dataPointer === node.dataPointer &&
397
+ previousIdentity.rowKeyPointer === node.rowKeyPointer;
398
+ const keyed = node.rowKeyPointer !== undefined;
399
+ const previousKeys = compatible && keyed ? previousIdentity.idsByKey : undefined;
400
+ const previousRows = compatible && !keyed && preserveUnkeyed ? previousIdentity.rowIds : undefined;
401
+ const idsByKey = keyed ? new Map() : undefined;
402
+ const ids = [];
403
+ const output = [];
404
+ rows.forEach((row, index) => {
405
+ let id;
406
+ if (row.key !== undefined) {
407
+ id = previousKeys?.get(row.key) ?? newItemId();
408
+ idsByKey.set(row.key, id);
409
+ }
410
+ else {
411
+ id = previousRows?.[index] ?? newItemId();
412
+ }
413
+ ids.push(id);
414
+ output.push({ id, value: row.value, cells: [...row.cells] });
415
+ });
416
+ nextIdentities.set(node.collectionId, {
417
+ dataPointer: node.dataPointer,
418
+ rowKeyPointer: node.rowKeyPointer,
419
+ idsByKey,
420
+ rowIds: ids,
421
+ });
422
+ collectionRows.set(node.id, freezeRows(output));
423
+ }
424
+ return { identities: nextIdentities, rows: collectionRows, nextItemId: candidateItemId };
425
+ }
426
+ const initialSnapshot = makeSnapshot(document, initialData, identities, false);
427
+ identities = new Map(initialSnapshot.identities);
428
+ nextItemId = initialSnapshot.nextItemId;
429
+ const documentStore = createStore(document);
430
+ const dataStore = createStore(initialData);
431
+ const collectionStores = new Map();
432
+ for (const [nodeId, rows] of initialSnapshot.rows)
433
+ collectionStores.set(nodeId, createStore(rows));
434
+ const actions = new Map();
435
+ for (const [name, action] of Object.entries(options.actions ?? {})) {
436
+ if (name.length === 0)
437
+ throw new TypeError('Action handlers must have nonempty names');
438
+ if (typeof action === 'function') {
439
+ actions.set(name, { handler: action });
440
+ continue;
441
+ }
442
+ if (!isRecord(action))
443
+ throw new TypeError(`Action ${name} must be a handler or registration object`);
444
+ assertKeys(action, ['handler', 'validateArgs'], `actions.${name}`);
445
+ if (typeof action.handler !== 'function')
446
+ throw new TypeError(`actions.${name}.handler must be a function`);
447
+ if (action.validateArgs !== undefined && typeof action.validateArgs !== 'function') {
448
+ throw new TypeError(`actions.${name}.validateArgs must be a function`);
449
+ }
450
+ actions.set(name, {
451
+ handler: action.handler,
452
+ validateArgs: action.validateArgs,
453
+ });
454
+ }
455
+ assertActionArgumentValidators(document, actions);
456
+ function assertActive() {
457
+ if (destroyed)
458
+ throw new Error('DocumentRuntime has been destroyed');
459
+ }
460
+ function publishCollections(snapshot) {
461
+ const nextStores = new Map();
462
+ for (const [nodeId, store] of collectionStores) {
463
+ if (!snapshot.rows.has(nodeId))
464
+ store.set(Object.freeze([]));
465
+ }
466
+ for (const [nodeId, rows] of snapshot.rows) {
467
+ const store = collectionStores.get(nodeId) ?? createStore(rows);
468
+ store.set(rows);
469
+ nextStores.set(nodeId, store);
470
+ }
471
+ collectionStores.clear();
472
+ for (const [nodeId, store] of nextStores)
473
+ collectionStores.set(nodeId, store);
474
+ }
475
+ function prepareSnapshot(inputDocumentValue, inputDataValue, preserveUnkeyed) {
476
+ preflightJsonRoots([
477
+ { value: inputDocumentValue, path: 'document' },
478
+ { value: inputDataValue, path: 'data' },
479
+ ], limits);
480
+ const nextDocument = validateDocument(inputDocumentValue, limits);
481
+ assertActionArgumentValidators(nextDocument, actions);
482
+ const nextData = deepFreeze(cloneJson(inputDataValue, 'data', limits));
483
+ const snapshot = makeSnapshot(nextDocument, nextData, identities, preserveUnkeyed);
484
+ return { document: nextDocument, data: nextData, collections: snapshot };
485
+ }
486
+ function commitSnapshot(prepared, publication, onCommit) {
487
+ batch(() => {
488
+ identities = new Map(prepared.collections.identities);
489
+ nextItemId = prepared.collections.nextItemId;
490
+ publishCollections(prepared.collections);
491
+ if (publication.document) {
492
+ document = prepared.document;
493
+ documentStore.set(prepared.document);
494
+ }
495
+ if (publication.data)
496
+ dataStore.set(prepared.data);
497
+ mutationVersion += 1;
498
+ onCommit?.({
499
+ document: documentStore.getSnapshot(),
500
+ data: dataStore.getSnapshot(),
501
+ mutationVersion,
502
+ });
503
+ });
504
+ }
505
+ const runtime = {
506
+ document: documentStore,
507
+ data: dataStore,
508
+ replaceDocument(input) {
509
+ assertActive();
510
+ const prepared = prepareSnapshot(input, dataStore.getSnapshot(), true);
511
+ commitSnapshot(prepared, { document: true, data: false });
512
+ },
513
+ setData(input) {
514
+ assertActive();
515
+ const prepared = prepareSnapshot(document, input, false);
516
+ commitSnapshot(prepared, { document: false, data: true });
517
+ },
518
+ replaceSnapshot(inputDocumentValue, inputDataValue) {
519
+ assertActive();
520
+ const prepared = prepareSnapshot(inputDocumentValue, inputDataValue, false);
521
+ commitSnapshot(prepared, { document: true, data: true });
522
+ },
523
+ getCollection(nodeId) {
524
+ return collectionStores.get(nodeId);
525
+ },
526
+ hasActionHandler(actionType) {
527
+ return actions.has(actionType);
528
+ },
529
+ async invokeAction(nodeId) {
530
+ assertActive();
531
+ const node = document.nodes[nodeId];
532
+ if (!node || node.type !== 'action')
533
+ throw new Error(`Node ${nodeId} is not a display action`);
534
+ const action = actions.get(node.actionType);
535
+ if (!action)
536
+ throw new Error(`No host action is registered for ${node.actionType}`);
537
+ const hasArgs = Object.prototype.hasOwnProperty.call(node, 'actionArgs');
538
+ let args;
539
+ if (action.validateArgs) {
540
+ const validatedArgs = action.validateArgs(hasArgs ? node.actionArgs : undefined);
541
+ args = validatedArgs === undefined
542
+ ? undefined
543
+ : deepFreeze(cloneJson(validatedArgs, 'actionArgs', limits));
544
+ }
545
+ else if (hasArgs) {
546
+ throw new TypeError(`Action ${node.actionType} does not accept arguments`);
547
+ }
548
+ const context = Object.freeze({
549
+ nodeId,
550
+ document,
551
+ data: dataStore.getSnapshot(),
552
+ });
553
+ await action.handler(args, context);
554
+ },
555
+ destroy() {
556
+ destroyed = true;
557
+ },
558
+ };
559
+ const control = {
560
+ limits,
561
+ getMutationVersion: () => mutationVersion,
562
+ replaceSnapshot(inputDocumentValue, inputDataValue, publication, onCommit) {
563
+ assertActive();
564
+ const prepared = prepareSnapshot(inputDocumentValue, inputDataValue, publication.preserveUnkeyed);
565
+ commitSnapshot(prepared, {
566
+ document: publication.publishDocument,
567
+ data: publication.publishData,
568
+ }, onCommit);
569
+ },
570
+ };
571
+ registerDocumentRuntimeControl(runtime, control);
572
+ return runtime;
573
+ }
574
+ //# sourceMappingURL=document-runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document-runtime.js","sourceRoot":"","sources":["../../src/runtime/document-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAE/C,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAgB/D,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,aAAa,EACb,kBAAkB,EAClB,4BAA4B,GAC7B,MAAM,sBAAsB,CAAA;AAG7B,OAAO,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAA;AA6B9E,MAAM,eAAe,GAAG,MAAM,CAAC,SAAS,CAAA;AAExC,SAAS,QAAQ,CAAC,KAAc;IAC9B,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC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AE,SAAS,CAAC,WAAW,EAAE;aAC9B,CAAC,CAAA;YACF,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QACrC,CAAC;QACD,OAAO;YACL,SAAS,GAAG,IAAI,CAAA;QAClB,CAAC;KACF,CAAA;IAED,MAAM,OAAO,GAA2B;QACtC,MAAM;QACN,kBAAkB,EAAE,GAAG,EAAE,CAAC,eAAe;QACzC,eAAe,CAAC,kBAAkB,EAAE,cAAc,EAAE,WAAW,EAAE,QAAQ;YACvE,YAAY,EAAE,CAAA;YACd,MAAM,QAAQ,GAAG,eAAe,CAAC,kBAAkB,EAAE,cAAc,EAAE,WAAW,CAAC,eAAe,CAAC,CAAA;YACjG,cAAc,CAAC,QAAQ,EAAE;gBACvB,QAAQ,EAAE,WAAW,CAAC,eAAe;gBACrC,IAAI,EAAE,WAAW,CAAC,WAAW;aAC9B,EAAE,QAAQ,CAAC,CAAA;QACd,CAAC;KACF,CAAA;IACD,8BAA8B,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IAChD,OAAO,OAAO,CAAA;AAChB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { DocumentRuntime, DocumentUpdateSession, DocumentUpdateSessionOptions } from './types.js';
2
+ export declare function createDocumentUpdateSession(runtime: DocumentRuntime, options: DocumentUpdateSessionOptions): DocumentUpdateSession;
3
+ //# sourceMappingURL=document-update-session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document-update-session.d.ts","sourceRoot":"","sources":["../../src/runtime/document-update-session.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,qBAAqB,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAA;AAuMtG,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,eAAe,EACxB,OAAO,EAAE,4BAA4B,GACpC,qBAAqB,CA2JvB"}