@altopelago/aeon-tonic 0.9.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.
package/README.md ADDED
@@ -0,0 +1,95 @@
1
+ # @altopelago/aeon-tonic
2
+
3
+ AES-in materialization boundary scaffold.
4
+
5
+ This package currently exposes a minimal `materialize()` API.
6
+ At the moment it passes AES through unchanged and preserves the optional annotation stream when present.
7
+ It does not yet build a materialized `document`.
8
+
9
+ ## Quick Start
10
+
11
+ ```ts
12
+ import { materialize } from '@altopelago/aeon-tonic';
13
+
14
+ const result = materialize({
15
+ aes: [],
16
+ });
17
+
18
+ console.log(result.aes);
19
+ ```
20
+
21
+ ## Current Behavior
22
+
23
+ - returns the input `aes` unchanged
24
+ - preserves `annotations` when provided
25
+ - does not currently populate `document`
26
+ - does not currently populate `meta` unless future phases add materialization diagnostics
27
+
28
+ ## When To Use This Package
29
+
30
+ Use `@altopelago/aeon-tonic` only if you want the explicit materialization boundary package surface.
31
+
32
+ If you need:
33
+
34
+ - compile-only behavior, use `@altopelago/aeon-core`
35
+ - validation over AES, use `@altopelago/aeos-core`
36
+ - an orchestrated end-to-end runtime, use `@altopelago/aeon-runtime`
37
+
38
+ ## API
39
+
40
+ ```ts
41
+ import type { AssignmentEvent } from '@altopelago/aeon-aes';
42
+ import type { AnnotationRecord } from '@altopelago/aeon-annotation-stream';
43
+
44
+ export interface TonicInput {
45
+ aes: readonly AssignmentEvent[];
46
+ annotations?: readonly AnnotationRecord[];
47
+ }
48
+
49
+ export interface TonicResult {
50
+ aes: readonly AssignmentEvent[];
51
+ annotations?: readonly AnnotationRecord[];
52
+ document?: unknown;
53
+ meta?: {
54
+ errors?: readonly { message: string; code?: string }[];
55
+ warnings?: readonly { message: string; code?: string }[];
56
+ };
57
+ }
58
+ ```
59
+
60
+ ```ts
61
+ export function materialize(input: TonicInput): TonicResult;
62
+ ```
63
+
64
+ ## Annotation contract
65
+
66
+ - `annotations` is an optional parallel channel and may be absent.
67
+ - Annotation records are non-authoritative metadata and MUST NOT change AES semantics.
68
+ - Materialization behavior MUST remain deterministic whether `annotations` is present or omitted.
69
+
70
+ ## Current Example Output
71
+
72
+ ```json
73
+ {
74
+ "aes": [
75
+ {
76
+ "path": { "segments": [{ "type": "root" }, { "type": "member", "key": "a" }] },
77
+ "key": "a",
78
+ "value": { "type": "NumberLiteral", "raw": "1", "value": "1" },
79
+ "span": { "start": { "line": 1, "column": 1, "offset": 0 }, "end": { "line": 1, "column": 6, "offset": 5 } }
80
+ }
81
+ ],
82
+ "annotations": [
83
+ {
84
+ "kind": "doc",
85
+ "form": "line",
86
+ "raw": "//# docs",
87
+ "span": {
88
+ "start": { "line": 1, "column": 1, "offset": 0 },
89
+ "end": { "line": 1, "column": 9, "offset": 8 }
90
+ },
91
+ "target": { "kind": "path", "path": "$.a" }
92
+ }
93
+ ]
94
+ }
95
+ ```
@@ -0,0 +1,3 @@
1
+ export * from './tonic.js';
2
+ export * from './matter.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export * from './tonic.js';
2
+ export * from './matter.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC"}
@@ -0,0 +1,87 @@
1
+ import { type AssignmentEvent } from '@altopelago/aeon-aes';
2
+ import type { AnnotationRecord } from '@altopelago/aeon-annotation-stream';
3
+ import type { TonicInput } from './tonic.js';
4
+ export type MatterKind = 'object' | 'list' | 'scalar' | 'reference' | 'node';
5
+ export type MatterSpan = AssignmentEvent['span'];
6
+ export interface MatterAnnotation {
7
+ readonly kind: AnnotationRecord['kind'];
8
+ readonly form: AnnotationRecord['form'];
9
+ readonly raw: string;
10
+ readonly target: AnnotationRecord['target'];
11
+ readonly subtype?: AnnotationRecord['subtype'];
12
+ }
13
+ export interface MatterReferenceValue {
14
+ readonly __aeonRef: string;
15
+ }
16
+ export type MatterScalarValue = string | number | boolean | null;
17
+ export type MatterInput = MatterScalarValue | MatterReferenceValue | {
18
+ readonly [key: string]: MatterInput;
19
+ } | readonly MatterInput[];
20
+ export interface MatterNode {
21
+ readonly kind: MatterKind;
22
+ readonly address: string;
23
+ readonly parent: MatterAnyNode | null;
24
+ readonly span: MatterSpan | undefined;
25
+ annotations(): readonly MatterAnnotation[];
26
+ inspect(): string;
27
+ remove(): void;
28
+ }
29
+ export interface MatterObject extends MatterNode {
30
+ readonly kind: 'object';
31
+ keys(): readonly string[];
32
+ entries(): readonly [string, MatterAnyNode][];
33
+ get(key: string): MatterAnyNode | undefined;
34
+ set(key: string, value: MatterInput): MatterAnyNode;
35
+ delete(key: string): void;
36
+ }
37
+ export interface MatterList extends MatterNode {
38
+ readonly kind: 'list';
39
+ length(): number;
40
+ items(): readonly MatterAnyNode[];
41
+ get(index: number): MatterAnyNode | undefined;
42
+ set(index: number, value: MatterInput): MatterAnyNode;
43
+ append(value: MatterInput): MatterAnyNode;
44
+ insert(index: number, value: MatterInput): MatterAnyNode;
45
+ delete(index: number): void;
46
+ }
47
+ export interface MatterScalar extends MatterNode {
48
+ readonly kind: 'scalar';
49
+ get(): MatterScalarValue;
50
+ set(value: MatterScalarValue): MatterScalar;
51
+ }
52
+ export interface MatterReference extends MatterNode {
53
+ readonly kind: 'reference';
54
+ target(): string;
55
+ }
56
+ export interface MatterElementNode extends MatterNode {
57
+ readonly kind: 'node';
58
+ tag(): string;
59
+ attributes(): ReadonlyMap<string, MatterScalarValue>;
60
+ children(): readonly MatterAnyNode[];
61
+ }
62
+ export type MatterAnyNode = MatterObject | MatterList | MatterScalar | MatterReference | MatterElementNode;
63
+ export interface AeonMatter {
64
+ readonly root: MatterObject | MatterList;
65
+ at(address: string): MatterAnyNode | undefined;
66
+ has(address: string): boolean;
67
+ inspect(address?: string): string;
68
+ serialize(): string;
69
+ toSchema(): unknown;
70
+ }
71
+ export interface MatterTonicResult {
72
+ readonly aes: readonly AssignmentEvent[];
73
+ readonly annotations?: readonly AnnotationRecord[];
74
+ readonly document?: AeonMatter;
75
+ readonly meta?: {
76
+ readonly errors?: readonly {
77
+ readonly message: string;
78
+ readonly code?: string;
79
+ }[];
80
+ readonly warnings?: readonly {
81
+ readonly message: string;
82
+ readonly code?: string;
83
+ }[];
84
+ };
85
+ }
86
+ export declare function materializeMatter(input: TonicInput): MatterTonicResult;
87
+ //# sourceMappingURL=matter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"matter.d.ts","sourceRoot":"","sources":["../src/matter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,WAAW,GAAG,MAAM,CAAC;AAC7E,MAAM,MAAM,UAAU,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;AAEjD,MAAM,WAAW,gBAAgB;IAC7B,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACxC,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACxC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAC5C,QAAQ,CAAC,OAAO,CAAC,EAAE,gBAAgB,CAAC,SAAS,CAAC,CAAC;CAClD;AAED,MAAM,WAAW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,MAAM,WAAW,iBAAiB;IAC9B,QAAQ,CAAC,GAAG,EAAE,SAAS,eAAe,EAAE,CAAC;IACzC,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACnD,QAAQ,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC;IAC/B,QAAQ,CAAC,IAAI,CAAC,EAAE;QACZ,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS;YAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;QAClF,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS;YAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;KACvF,CAAC;CACL;AAmUD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,UAAU,GAAG,iBAAiB,CA2CtE"}
package/dist/matter.js ADDED
@@ -0,0 +1,544 @@
1
+ import { formatPath } from '@altopelago/aeon-aes';
2
+ class BaseMatterNode {
3
+ owner;
4
+ span;
5
+ _address = '$';
6
+ _parent = null;
7
+ constructor(owner, span = undefined) {
8
+ this.owner = owner;
9
+ this.span = span;
10
+ }
11
+ get address() {
12
+ return this._address;
13
+ }
14
+ get parent() {
15
+ return this._parent;
16
+ }
17
+ setAddress(address) {
18
+ this._address = address;
19
+ }
20
+ setParent(parent) {
21
+ this._parent = parent;
22
+ }
23
+ annotations() {
24
+ return this.owner.annotationMap.get(this.address) ?? [];
25
+ }
26
+ inspect() {
27
+ return `${this.kind} ${this.address} = ${serializeNode(this)}`;
28
+ }
29
+ remove() {
30
+ if (!this.parent) {
31
+ throw new Error('Cannot remove root node.');
32
+ }
33
+ this.owner.removeNode(this);
34
+ }
35
+ }
36
+ class MatterObjectNode extends BaseMatterNode {
37
+ kind = 'object';
38
+ fields = new Map();
39
+ keys() {
40
+ return [...this.fields.keys()];
41
+ }
42
+ entries() {
43
+ return [...this.fields.entries()];
44
+ }
45
+ get(key) {
46
+ return this.fields.get(key);
47
+ }
48
+ set(key, value) {
49
+ const node = this.owner.createInputNode(value);
50
+ node.setParent(this);
51
+ this.fields.set(key, node);
52
+ this.owner.reindex();
53
+ return node;
54
+ }
55
+ delete(key) {
56
+ if (this.fields.delete(key)) {
57
+ this.owner.reindex();
58
+ }
59
+ }
60
+ attach(key, node) {
61
+ node.setParent(this);
62
+ this.fields.set(key, node);
63
+ }
64
+ detachNode(target) {
65
+ for (const [key, value] of this.fields) {
66
+ if (value === target) {
67
+ this.fields.delete(key);
68
+ return true;
69
+ }
70
+ }
71
+ return false;
72
+ }
73
+ }
74
+ class MatterListNode extends BaseMatterNode {
75
+ kind = 'list';
76
+ elements = [];
77
+ length() {
78
+ return this.elements.length;
79
+ }
80
+ items() {
81
+ return [...this.elements];
82
+ }
83
+ get(index) {
84
+ return this.elements[index];
85
+ }
86
+ set(index, value) {
87
+ if (!Number.isInteger(index) || index < 0 || index >= this.elements.length) {
88
+ throw new Error(`List index out of range: ${index}`);
89
+ }
90
+ const node = this.owner.createInputNode(value);
91
+ node.setParent(this);
92
+ this.elements[index] = node;
93
+ this.owner.reindex();
94
+ return node;
95
+ }
96
+ append(value) {
97
+ const node = this.owner.createInputNode(value);
98
+ node.setParent(this);
99
+ this.elements.push(node);
100
+ this.owner.reindex();
101
+ return node;
102
+ }
103
+ insert(index, value) {
104
+ if (!Number.isInteger(index) || index < 0 || index > this.elements.length) {
105
+ throw new Error(`List index out of range: ${index}`);
106
+ }
107
+ const node = this.owner.createInputNode(value);
108
+ node.setParent(this);
109
+ this.elements.splice(index, 0, node);
110
+ this.owner.reindex();
111
+ return node;
112
+ }
113
+ delete(index) {
114
+ if (!Number.isInteger(index) || index < 0 || index >= this.elements.length) {
115
+ throw new Error(`List index out of range: ${index}`);
116
+ }
117
+ this.elements.splice(index, 1);
118
+ this.owner.reindex();
119
+ }
120
+ attach(node) {
121
+ node.setParent(this);
122
+ this.elements.push(node);
123
+ }
124
+ detachNode(target) {
125
+ const index = this.elements.indexOf(target);
126
+ if (index < 0)
127
+ return false;
128
+ this.elements.splice(index, 1);
129
+ return true;
130
+ }
131
+ }
132
+ class MatterScalarNode extends BaseMatterNode {
133
+ value;
134
+ kind = 'scalar';
135
+ constructor(owner, value, span) {
136
+ super(owner, span);
137
+ this.value = value;
138
+ }
139
+ get() {
140
+ return this.value;
141
+ }
142
+ set(value) {
143
+ this.value = value;
144
+ this.owner.reindex();
145
+ return this;
146
+ }
147
+ }
148
+ class MatterReferenceNode extends BaseMatterNode {
149
+ refTarget;
150
+ kind = 'reference';
151
+ constructor(owner, refTarget, span) {
152
+ super(owner, span);
153
+ this.refTarget = refTarget;
154
+ }
155
+ target() {
156
+ return this.refTarget;
157
+ }
158
+ }
159
+ class MatterElementRuntimeNode extends BaseMatterNode {
160
+ tagName;
161
+ kind = 'node';
162
+ attrs = new Map();
163
+ childNodes = [];
164
+ constructor(owner, tagName, span) {
165
+ super(owner, span);
166
+ this.tagName = tagName;
167
+ }
168
+ tag() {
169
+ return this.tagName;
170
+ }
171
+ attributes() {
172
+ return this.attrs;
173
+ }
174
+ children() {
175
+ return [...this.childNodes];
176
+ }
177
+ setAttribute(key, value) {
178
+ this.attrs.set(key, value);
179
+ }
180
+ appendChild(node) {
181
+ node.setParent(this);
182
+ this.childNodes.push(node);
183
+ }
184
+ detachNode(target) {
185
+ const index = this.childNodes.indexOf(target);
186
+ if (index < 0)
187
+ return false;
188
+ this.childNodes.splice(index, 1);
189
+ return true;
190
+ }
191
+ }
192
+ class AeonMatterDocument {
193
+ root;
194
+ annotationMap;
195
+ nodesByAddress = new Map();
196
+ constructor(root, annotationMap) {
197
+ this.root = root;
198
+ this.annotationMap = annotationMap;
199
+ this.reindex();
200
+ }
201
+ at(address) {
202
+ return this.nodesByAddress.get(address);
203
+ }
204
+ has(address) {
205
+ return this.nodesByAddress.has(address);
206
+ }
207
+ inspect(address) {
208
+ const node = address ? this.at(address) : this.root;
209
+ if (!node) {
210
+ throw new Error(`Unknown matter address: ${address}`);
211
+ }
212
+ return node.inspect();
213
+ }
214
+ serialize() {
215
+ if (this.root.kind === 'object') {
216
+ return serializeRootObject(this.root);
217
+ }
218
+ return serializeNode(this.root);
219
+ }
220
+ toSchema() {
221
+ return deriveSchema(this.root);
222
+ }
223
+ removeNode(node) {
224
+ const parent = node.parent;
225
+ if (!parent) {
226
+ throw new Error('Cannot remove root node.');
227
+ }
228
+ if (parent instanceof MatterObjectNode) {
229
+ parent.detachNode(node);
230
+ }
231
+ else if (parent instanceof MatterListNode) {
232
+ parent.detachNode(node);
233
+ }
234
+ else if (parent instanceof MatterElementRuntimeNode) {
235
+ parent.detachNode(node);
236
+ }
237
+ this.reindex();
238
+ }
239
+ createInputNode(value) {
240
+ if (Array.isArray(value)) {
241
+ const list = new MatterListNode(this);
242
+ for (const entry of value) {
243
+ list.attach(this.createInputNode(entry));
244
+ }
245
+ return list;
246
+ }
247
+ if (isReferenceValue(value)) {
248
+ return new MatterReferenceNode(this, value.__aeonRef);
249
+ }
250
+ if (value === null || typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
251
+ return new MatterScalarNode(this, value);
252
+ }
253
+ const objectNode = new MatterObjectNode(this);
254
+ for (const [key, child] of Object.entries(value)) {
255
+ objectNode.attach(key, this.createInputNode(child));
256
+ }
257
+ return objectNode;
258
+ }
259
+ reindex() {
260
+ this.nodesByAddress.clear();
261
+ assignAddresses(this.root, '$', this.nodesByAddress);
262
+ }
263
+ }
264
+ export function materializeMatter(input) {
265
+ const errors = [];
266
+ const warnings = [];
267
+ const annotationMap = buildAnnotationMap(input.annotations);
268
+ const topLevel = input.aes.filter((event) => event.path.segments.length === 2 && event.path.segments[0]?.type === 'root');
269
+ const root = new MatterObjectNode(undefined);
270
+ const document = new AeonMatterDocument(root, annotationMap);
271
+ root.owner = document;
272
+ for (const event of topLevel) {
273
+ const segment = event.path.segments[1];
274
+ if (!segment || segment.type !== 'member') {
275
+ errors.push({
276
+ code: 'MATTER_UNSUPPORTED_ROOT',
277
+ message: `Unsupported top-level path for AEON Matter: ${formatPath(event.path)}`,
278
+ });
279
+ continue;
280
+ }
281
+ const node = valueToMatterNode(document, event.value, errors);
282
+ if (node) {
283
+ root.attach(segment.key, node);
284
+ }
285
+ }
286
+ if (errors.length > 0) {
287
+ return {
288
+ aes: input.aes,
289
+ ...(input.annotations ? { annotations: input.annotations } : {}),
290
+ meta: {
291
+ errors,
292
+ ...(warnings.length > 0 ? { warnings } : {}),
293
+ },
294
+ };
295
+ }
296
+ document.reindex();
297
+ return {
298
+ aes: input.aes,
299
+ ...(input.annotations ? { annotations: input.annotations } : {}),
300
+ document,
301
+ ...(warnings.length > 0 ? { meta: { warnings } } : {}),
302
+ };
303
+ }
304
+ function valueToMatterNode(owner, value, errors) {
305
+ switch (value.type) {
306
+ case 'TypedValue':
307
+ return valueToMatterNode(owner, value.value, errors);
308
+ case 'StringLiteral':
309
+ return new MatterScalarNode(owner, value.value, value.span);
310
+ case 'NumberLiteral':
311
+ return new MatterScalarNode(owner, parseNumericString(value.value), value.span);
312
+ case 'InfinityLiteral':
313
+ case 'NaNLiteral':
314
+ return new MatterScalarNode(owner, value.value, value.span);
315
+ case 'NullLiteral':
316
+ return new MatterScalarNode(owner, value.mode === 'reserved' && value.value === 'none' ? null : value.raw, value.span);
317
+ case 'BooleanLiteral':
318
+ return new MatterScalarNode(owner, value.value, value.span);
319
+ case 'ToggleLiteral':
320
+ return new MatterScalarNode(owner, value.value === 'yes' || value.value === 'on', value.span);
321
+ case 'HexLiteral':
322
+ case 'RadixLiteral':
323
+ case 'EncodingLiteral':
324
+ case 'SeparatorLiteral':
325
+ case 'DateLiteral':
326
+ case 'DateTimeLiteral':
327
+ case 'TimeLiteral':
328
+ return new MatterScalarNode(owner, value.value, value.span);
329
+ case 'CloneReference':
330
+ case 'PointerReference':
331
+ return new MatterReferenceNode(owner, formatReference(value.path, value.type === 'PointerReference'), value.span);
332
+ case 'ObjectNode': {
333
+ const objectNode = new MatterObjectNode(owner, value.span);
334
+ for (const binding of value.bindings) {
335
+ const childNode = valueToMatterNode(owner, binding.value, errors);
336
+ if (childNode) {
337
+ objectNode.attach(binding.key, childNode);
338
+ }
339
+ }
340
+ return objectNode;
341
+ }
342
+ case 'ListNode': {
343
+ const listNode = new MatterListNode(owner, value.span);
344
+ for (const element of value.elements) {
345
+ const childNode = valueToMatterNode(owner, element, errors);
346
+ if (childNode) {
347
+ listNode.attach(childNode);
348
+ }
349
+ }
350
+ return listNode;
351
+ }
352
+ case 'NodeLiteral': {
353
+ const node = new MatterElementRuntimeNode(owner, value.tag, value.span);
354
+ for (const attribute of value.attributes) {
355
+ for (const [key, entry] of attribute.entries) {
356
+ const attrValue = scalarValueFromValue(entry.value);
357
+ if (attrValue !== undefined) {
358
+ node.setAttribute(key, attrValue);
359
+ }
360
+ }
361
+ }
362
+ for (const child of value.children) {
363
+ const childNode = valueToMatterNode(owner, child, errors);
364
+ if (childNode) {
365
+ node.appendChild(childNode);
366
+ }
367
+ }
368
+ return node;
369
+ }
370
+ case 'TupleLiteral':
371
+ errors.push({
372
+ code: 'MATTER_UNSUPPORTED_TUPLE',
373
+ message: 'AEON Matter v1 does not support tuple runtime semantics.',
374
+ });
375
+ return null;
376
+ default: {
377
+ const exhaustive = value;
378
+ return exhaustive;
379
+ }
380
+ }
381
+ }
382
+ function buildAnnotationMap(annotations) {
383
+ const map = new Map();
384
+ for (const record of annotations ?? []) {
385
+ if (record.target.kind !== 'path')
386
+ continue;
387
+ const bucket = map.get(record.target.path) ?? [];
388
+ bucket.push({
389
+ kind: record.kind,
390
+ form: record.form,
391
+ raw: record.raw,
392
+ target: record.target,
393
+ ...(record.subtype ? { subtype: record.subtype } : {}),
394
+ });
395
+ map.set(record.target.path, bucket);
396
+ }
397
+ return map;
398
+ }
399
+ function assignAddresses(node, address, registry) {
400
+ node.setAddress(address);
401
+ registry.set(address, node);
402
+ if (node.kind === 'object') {
403
+ for (const [key, child] of node.entries()) {
404
+ assignAddresses(child, `${address}.${formatMemberKey(key)}`, registry);
405
+ }
406
+ return;
407
+ }
408
+ if (node.kind === 'list') {
409
+ node.items().forEach((child, index) => {
410
+ assignAddresses(child, `${address}[${index}]`, registry);
411
+ });
412
+ return;
413
+ }
414
+ if (node.kind === 'node') {
415
+ node.children().forEach((child, index) => {
416
+ assignAddresses(child, `${address}.$children[${index}]`, registry);
417
+ });
418
+ }
419
+ }
420
+ function serializeRootObject(node) {
421
+ return node.entries()
422
+ .map(([key, value]) => `${serializeKey(key)} = ${serializeNode(value)}`)
423
+ .join('\n');
424
+ }
425
+ function serializeNode(node) {
426
+ switch (node.kind) {
427
+ case 'object':
428
+ return `{ ${node.entries().map(([key, value]) => `${serializeKey(key)} = ${serializeNode(value)}`).join(', ')} }`;
429
+ case 'list':
430
+ return `[${node.items().map((entry) => serializeNode(entry)).join(', ')}]`;
431
+ case 'scalar': {
432
+ const value = node.get();
433
+ if (typeof value === 'string')
434
+ return JSON.stringify(value);
435
+ if (value === null)
436
+ return 'null';
437
+ return String(value);
438
+ }
439
+ case 'reference':
440
+ return node.target();
441
+ case 'node': {
442
+ const attrs = [...node.attributes().entries()]
443
+ .map(([key, value]) => `${serializeKey(key)} = ${serializeScalarValue(value)}`)
444
+ .join(', ');
445
+ const children = node.children().map((entry) => serializeNode(entry)).join(', ');
446
+ const attrPart = attrs.length > 0 ? `@{${attrs}}` : '';
447
+ const childPart = children.length > 0 ? `(${children})` : '';
448
+ return `<${node.tag()}${attrPart}${childPart}>`;
449
+ }
450
+ }
451
+ }
452
+ function deriveSchema(node) {
453
+ switch (node.kind) {
454
+ case 'object':
455
+ return {
456
+ type: 'object',
457
+ properties: Object.fromEntries(node.entries().map(([key, value]) => [key, deriveSchema(value)])),
458
+ };
459
+ case 'list':
460
+ return {
461
+ type: 'list',
462
+ elements: node.items().map((item) => deriveSchema(item)),
463
+ };
464
+ case 'scalar': {
465
+ const value = node.get();
466
+ return { type: value === null ? 'null' : typeof value };
467
+ }
468
+ case 'reference':
469
+ return { type: 'reference' };
470
+ case 'node':
471
+ return {
472
+ type: 'node',
473
+ tag: node.tag(),
474
+ attributes: Object.fromEntries(node.attributes()),
475
+ children: node.children().map((item) => deriveSchema(item)),
476
+ };
477
+ }
478
+ }
479
+ function parseNumericString(value) {
480
+ const parsed = Number(value.replaceAll('_', ''));
481
+ return Number.isFinite(parsed) ? parsed : Number.NaN;
482
+ }
483
+ function formatReference(path, pointer) {
484
+ const prefix = pointer ? '~>' : '~';
485
+ const body = path.map((segment, index) => {
486
+ if (typeof segment === 'string') {
487
+ return index === 0 ? segment : `.${segment}`;
488
+ }
489
+ if (typeof segment === 'number') {
490
+ return `[${segment}]`;
491
+ }
492
+ return `@${segment.key}`;
493
+ }).join('');
494
+ return `${prefix}${body}`;
495
+ }
496
+ function formatMemberKey(key) {
497
+ return /^[A-Za-z_][A-Za-z0-9_]*$/.test(key) ? key : `["${escapeString(key)}"]`;
498
+ }
499
+ function serializeKey(key) {
500
+ return /^[A-Za-z_][A-Za-z0-9_]*$/.test(key) ? key : JSON.stringify(key);
501
+ }
502
+ function serializeScalarValue(value) {
503
+ if (typeof value === 'string')
504
+ return JSON.stringify(value);
505
+ if (value === null)
506
+ return 'null';
507
+ return String(value);
508
+ }
509
+ function escapeString(value) {
510
+ return value.replaceAll('\\', '\\\\').replaceAll('"', '\\"');
511
+ }
512
+ function isReferenceValue(value) {
513
+ return typeof value === 'object' && value !== null && !Array.isArray(value) && '__aeonRef' in value;
514
+ }
515
+ function scalarValueFromValue(value) {
516
+ switch (value.type) {
517
+ case 'TypedValue':
518
+ return scalarValueFromValue(value.value);
519
+ case 'StringLiteral':
520
+ return value.value;
521
+ case 'NumberLiteral':
522
+ return parseNumericString(value.value);
523
+ case 'InfinityLiteral':
524
+ case 'NaNLiteral':
525
+ return value.value;
526
+ case 'NullLiteral':
527
+ return value.mode === 'reserved' && value.value === 'none' ? null : value.raw;
528
+ case 'BooleanLiteral':
529
+ return value.value;
530
+ case 'ToggleLiteral':
531
+ return value.value === 'yes' || value.value === 'on';
532
+ case 'HexLiteral':
533
+ case 'RadixLiteral':
534
+ case 'EncodingLiteral':
535
+ case 'SeparatorLiteral':
536
+ case 'DateLiteral':
537
+ case 'DateTimeLiteral':
538
+ case 'TimeLiteral':
539
+ return value.value;
540
+ default:
541
+ return undefined;
542
+ }
543
+ }
544
+ //# sourceMappingURL=matter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"matter.js","sourceRoot":"","sources":["../src/matter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAwB,MAAM,sBAAsB,CAAC;AAoGxE,MAAe,cAAc;IAKd;IACS;IALZ,QAAQ,GAAG,GAAG,CAAC;IACf,OAAO,GAAyB,IAAI,CAAC;IAE7C,YACW,KAAyB,EAChB,OAA+B,SAAS;QADjD,UAAK,GAAL,KAAK,CAAoB;QAChB,SAAI,GAAJ,IAAI,CAAoC;IACxD,CAAC;IAIL,IAAI,OAAO;QACP,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAED,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,UAAU,CAAC,OAAe;QACtB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC5B,CAAC;IAED,SAAS,CAAC,MAA4B;QAClC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IAC1B,CAAC;IAED,WAAW;QACP,OAAO,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;IAC5D,CAAC;IAED,OAAO;QACH,OAAO,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,OAAO,MAAM,aAAa,CAAC,IAAgC,CAAC,EAAE,CAAC;IAC/F,CAAC;IAED,MAAM;QACF,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,C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AAa;YACd,OAAO,KAAK,CAAC,IAAI,KAAK,UAAU,IAAI,KAAK,CAAC,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC;QAClF,KAAK,gBAAgB;YACjB,OAAO,KAAK,CAAC,KAAK,CAAC;QACvB,KAAK,eAAe;YAChB,OAAO,KAAK,CAAC,KAAK,KAAK,KAAK,IAAI,KAAK,CAAC,KAAK,KAAK,IAAI,CAAC;QACzD,KAAK,YAAY,CAAC;QAClB,KAAK,cAAc,CAAC;QACpB,KAAK,iBAAiB,CAAC;QACvB,KAAK,kBAAkB,CAAC;QACxB,KAAK,aAAa,CAAC;QACnB,KAAK,iBAAiB,CAAC;QACvB,KAAK,aAAa;YACd,OAAO,KAAK,CAAC,KAAK,CAAC;QACvB;YACI,OAAO,SAAS,CAAC;IACzB,CAAC;AACL,CAAC"}
@@ -0,0 +1,23 @@
1
+ import type { AssignmentEvent } from '@altopelago/aeon-aes';
2
+ import type { AnnotationRecord } from '@altopelago/aeon-annotation-stream';
3
+ export interface TonicInput {
4
+ readonly aes: readonly AssignmentEvent[];
5
+ readonly annotations?: readonly AnnotationRecord[];
6
+ }
7
+ export interface TonicResult {
8
+ readonly aes: readonly AssignmentEvent[];
9
+ readonly annotations?: readonly AnnotationRecord[];
10
+ readonly document?: unknown;
11
+ readonly meta?: {
12
+ readonly errors?: readonly {
13
+ readonly message: string;
14
+ readonly code?: string;
15
+ }[];
16
+ readonly warnings?: readonly {
17
+ readonly message: string;
18
+ readonly code?: string;
19
+ }[];
20
+ };
21
+ }
22
+ export declare function materialize(input: TonicInput): TonicResult;
23
+ //# sourceMappingURL=tonic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tonic.d.ts","sourceRoot":"","sources":["../src/tonic.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAE3E,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,GAAG,EAAE,SAAS,eAAe,EAAE,CAAC;IACzC,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,gBAAgB,EAAE,CAAC;CACpD;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,GAAG,EAAE,SAAS,eAAe,EAAE,CAAC;IACzC,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACnD,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,IAAI,CAAC,EAAE;QACd,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS;YAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;QAClF,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS;YAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;KACrF,CAAC;CACH;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,WAAW,CAQ1D"}
package/dist/tonic.js ADDED
@@ -0,0 +1,10 @@
1
+ export function materialize(input) {
2
+ const result = {
3
+ aes: input.aes,
4
+ };
5
+ if (input.annotations) {
6
+ result.annotations = input.annotations;
7
+ }
8
+ return result;
9
+ }
10
+ //# sourceMappingURL=tonic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tonic.js","sourceRoot":"","sources":["../src/tonic.ts"],"names":[],"mappings":"AAkBA,MAAM,UAAU,WAAW,CAAC,KAAiB;IAC3C,MAAM,MAAM,GAAgB;QAC1B,GAAG,EAAE,KAAK,CAAC,GAAG;KACf,CAAC;IACF,IAAI,KAAK,CAAC,WAAW,EAAE,CAAC;QACrB,MAAuD,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;IAC3F,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@altopelago/aeon-tonic",
3
+ "version": "0.9.0",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.js"
11
+ }
12
+ },
13
+ "files": [
14
+ "dist",
15
+ "!dist/**/*.test.d.ts",
16
+ "!dist/**/*.test.d.ts.map",
17
+ "!dist/**/*.test.js",
18
+ "!dist/**/*.test.js.map"
19
+ ],
20
+ "dependencies": {
21
+ "@altopelago/aeon-annotation-stream": "0.9.0",
22
+ "@altopelago/aeon-aes": "0.9.0"
23
+ },
24
+ "scripts": {
25
+ "build": "tsc -p tsconfig.json",
26
+ "test": "node --test dist/*.test.js",
27
+ "clean": "rm -rf dist",
28
+ "typecheck": "tsc -p tsconfig.json --noEmit"
29
+ }
30
+ }