@altopelago/sansa 0.9.1 → 0.10.1

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.
@@ -0,0 +1,571 @@
1
+ telex.aes=1
2
+
3
+ path=$.consent
4
+ kind=ToggleLiteral
5
+ datatype=toggle
6
+ value=yes
7
+
8
+ path=$.fallbackConsent
9
+ kind=ToggleLiteral
10
+ datatype=toggle
11
+ value=on
12
+
13
+ path=$.target
14
+ kind=NumberLiteral
15
+ datatype=number
16
+ value=7
17
+
18
+ path=$.targetClone
19
+ kind=CloneReference
20
+ datatype=number
21
+ value=$.target
22
+
23
+ path=$.targetPointer
24
+ kind=PointerReference
25
+ datatype=number
26
+ value=$.target
27
+
28
+ path=$.types
29
+ kind=ObjectNode
30
+ datatype=object
31
+
32
+ path=$.types.color
33
+ kind=HexLiteral
34
+ datatype=hex
35
+ value=ff00aa
36
+
37
+ path=$.types.colorCopy
38
+ kind=HexLiteral
39
+ datatype=hex
40
+ value=ff00aa
41
+
42
+ path=$.types.mask
43
+ kind=RadixLiteral
44
+ datatype=radix[16]
45
+ value=ff00aa
46
+
47
+ path=$.types.octal
48
+ kind=RadixLiteral
49
+ datatype=radix8
50
+ value=70
51
+
52
+ path=$.types.payload
53
+ kind=EncodingLiteral
54
+ datatype=encoding
55
+ value=QmFzZTY0IQ==
56
+
57
+ path=$.types.version
58
+ kind=SeparatorLiteral
59
+ datatype=sep["."]
60
+ value=0.11.0
61
+
62
+ path=$.types.released
63
+ kind=DateLiteral
64
+ datatype=date
65
+ value=2026-07-25
66
+
67
+ path=$.types.window
68
+ kind=TimeLiteral
69
+ datatype=time
70
+ value=09:30:00Z
71
+
72
+ path=$.types.stamp
73
+ kind=DateTimeLiteral
74
+ datatype=datetime
75
+ value=2026-07-25T09:30:00Z
76
+
77
+ path=$.types.zone
78
+ kind=WTCDateTimeLiteral
79
+ datatype=wtc
80
+ value=2026-07-25T09:30:00Z&Australia/Melbourne
81
+
82
+ path=$.types.count
83
+ kind=NumberLiteral
84
+ datatype=int32
85
+ value=2
86
+
87
+ path=$.types.capacity
88
+ kind=NumberLiteral
89
+ datatype=uint64
90
+ value=8
91
+
92
+ path=$.types.ratio
93
+ kind=NumberLiteral
94
+ datatype=float64
95
+ value=2.5
96
+
97
+ path=$.types.aliasNumber
98
+ kind=NumberLiteral
99
+ datatype=n
100
+ value=9
101
+
102
+ path=$.types.approved
103
+ kind=BooleanLiteral
104
+ datatype=bool
105
+ value=true
106
+
107
+ path=$.types.note
108
+ kind=StringLiteral
109
+ datatype=trimtick
110
+ value=hello trimtick
111
+
112
+ path=$.types.summary
113
+ kind=StringLiteral
114
+ datatype=prose
115
+ value=hello prose
116
+
117
+ path=$.types.payloadBase64
118
+ kind=EncodingLiteral
119
+ datatype=base64
120
+ value=QmFzZTY0IQ==
121
+
122
+ path=$.types.payloadEmbed
123
+ kind=EncodingLiteral
124
+ datatype=embed
125
+ value=QmFzZTY0IQ==
126
+
127
+ path=$.types.payloadInline
128
+ kind=EncodingLiteral
129
+ datatype=inline
130
+ value=QmFzZTY0IQ==
131
+
132
+ path=$.types.semver
133
+ kind=SeparatorLiteral
134
+ datatype=kadot
135
+ value=3.14.15
136
+
137
+ path=$.types.selector
138
+ kind=SansaAddressLiteral
139
+ datatype=sansa
140
+ value=$.inventory.items.*.sku
141
+
142
+ path=$.inventory
143
+ kind=ObjectNode
144
+ datatype=object
145
+
146
+ path=$.inventory.items
147
+ kind=ListNode
148
+ datatype=list<object>
149
+
150
+ path=$.inventory.items[0]
151
+ kind=ObjectNode
152
+ datatype=object
153
+
154
+ path=$.inventory.items[0].@.lane
155
+ kind=StringLiteral
156
+ datatype=string
157
+ value=primary
158
+
159
+ path=$.inventory.items[0].sku
160
+ kind=StringLiteral
161
+ datatype=string
162
+ value=A-100
163
+
164
+ path=$.inventory.items[0].sku.@.origin
165
+ kind=StringLiteral
166
+ datatype=string
167
+ value=catalog
168
+
169
+ path=$.inventory.items[0].name
170
+ kind=StringLiteral
171
+ datatype=string
172
+ value=Adapter
173
+
174
+ path=$.inventory.items[0].category
175
+ kind=StringLiteral
176
+ datatype=string
177
+ value=hardware
178
+
179
+ path=$.inventory.items[0].status
180
+ kind=NullLiteral
181
+ datatype=null<string>
182
+ value=notSet
183
+
184
+ path=$.inventory.items[0].metric
185
+ kind=NumberLiteral
186
+ datatype=number
187
+ value=10
188
+
189
+ path=$.inventory.items[0].qty
190
+ kind=NumberLiteral
191
+ datatype=number
192
+ value=1
193
+
194
+ path=$.inventory.items[0].active
195
+ kind=BooleanLiteral
196
+ datatype=boolean
197
+ value=true
198
+
199
+ path=$.inventory.items[0].roles
200
+ kind=ListNode
201
+ datatype=list<string>
202
+
203
+ path=$.inventory.items[0].roles[0]
204
+ kind=StringLiteral
205
+ value=admin
206
+
207
+ path=$.inventory.items[0].roles[1]
208
+ kind=StringLiteral
209
+ value=user
210
+
211
+ path=$.inventory.items[1]
212
+ kind=ObjectNode
213
+ datatype=object
214
+
215
+ path=$.inventory.items[1].@.lane
216
+ kind=StringLiteral
217
+ datatype=string
218
+ value=primary
219
+
220
+ path=$.inventory.items[1].sku
221
+ kind=StringLiteral
222
+ datatype=string
223
+ value=B-200
224
+
225
+ path=$.inventory.items[1].sku.@.origin
226
+ kind=StringLiteral
227
+ datatype=string
228
+ value=catalog
229
+
230
+ path=$.inventory.items[1].name
231
+ kind=StringLiteral
232
+ datatype=string
233
+ value=Bracket
234
+
235
+ path=$.inventory.items[1].category
236
+ kind=StringLiteral
237
+ datatype=string
238
+ value=hardware
239
+
240
+ path=$.inventory.items[1].status
241
+ kind=StringLiteral
242
+ datatype=string
243
+ value=active
244
+
245
+ path=$.inventory.items[1].id
246
+ kind=StringLiteral
247
+ datatype=string
248
+ value=4
249
+
250
+ path=$.inventory.items[1].qty
251
+ kind=NumberLiteral
252
+ datatype=number
253
+ value=4
254
+
255
+ path=$.inventory.items[1].active
256
+ kind=BooleanLiteral
257
+ datatype=boolean
258
+ value=true
259
+
260
+ path=$.inventory.items[1].roles
261
+ kind=ListNode
262
+ datatype=list<string>
263
+
264
+ path=$.inventory.items[1].roles[0]
265
+ kind=StringLiteral
266
+ value=user
267
+
268
+ path=$.inventory.items[2]
269
+ kind=ObjectNode
270
+ datatype=object
271
+
272
+ path=$.inventory.items[2].@.lane
273
+ kind=StringLiteral
274
+ datatype=string
275
+ value=overflow
276
+
277
+ path=$.inventory.items[2].sku
278
+ kind=StringLiteral
279
+ datatype=string
280
+ value=C-300
281
+
282
+ path=$.inventory.items[2].sku.@.origin
283
+ kind=StringLiteral
284
+ datatype=string
285
+ value=manual
286
+
287
+ path=$.inventory.items[2].name
288
+ kind=StringLiteral
289
+ datatype=string
290
+ value=Coupler
291
+
292
+ path=$.inventory.items[2].category
293
+ kind=StringLiteral
294
+ datatype=string
295
+ value=hardware
296
+
297
+ path=$.inventory.items[2].metric
298
+ kind=NaNLiteral
299
+ datatype=nan<number>
300
+ value=NaN
301
+
302
+ path=$.inventory.items[2].qty
303
+ kind=NumberLiteral
304
+ datatype=number
305
+ value=8
306
+
307
+ path=$.inventory.items[2].active
308
+ kind=BooleanLiteral
309
+ datatype=boolean
310
+ value=false
311
+
312
+ path=$.inventory.items[2].roles
313
+ kind=ListNode
314
+ datatype=list<string>
315
+
316
+ path=$.inventory.items[3]
317
+ kind=ObjectNode
318
+ datatype=object
319
+
320
+ path=$.inventory.items[3].@.lane
321
+ kind=StringLiteral
322
+ datatype=string
323
+ value=overflow
324
+
325
+ path=$.inventory.items[3].sku
326
+ kind=StringLiteral
327
+ datatype=string
328
+ value=D-250
329
+
330
+ path=$.inventory.items[3].sku.@.origin
331
+ kind=StringLiteral
332
+ datatype=string
333
+ value=catalog
334
+
335
+ path=$.inventory.items[3].name
336
+ kind=StringLiteral
337
+ datatype=string
338
+ value=Driver
339
+
340
+ path=$.inventory.items[3].category
341
+ kind=StringLiteral
342
+ datatype=string
343
+ value=tooling
344
+
345
+ path=$.inventory.items[3].status
346
+ kind=NullLiteral
347
+ datatype=null<string>
348
+ value=notApplicable
349
+
350
+ path=$.inventory.items[3].id
351
+ kind=NumberLiteral
352
+ datatype=number
353
+ value=3
354
+
355
+ path=$.inventory.items[3].ceiling
356
+ kind=InfinityLiteral
357
+ datatype=infinity<number>
358
+ value=Infinity
359
+
360
+ path=$.inventory.items[3].qty
361
+ kind=NumberLiteral
362
+ datatype=number
363
+ value=4
364
+
365
+ path=$.inventory.items[3].active
366
+ kind=BooleanLiteral
367
+ datatype=boolean
368
+ value=false
369
+
370
+ path=$.inventory.items[3].roles
371
+ kind=ListNode
372
+ datatype=list<string>
373
+
374
+ path=$.inventory.items[3].roles[0]
375
+ kind=StringLiteral
376
+ value=admin
377
+
378
+ path=$.inventory.items[3].roles[1]
379
+ kind=StringLiteral
380
+ value=admin
381
+
382
+ path=$.inventory.categoryLabels
383
+ kind=ObjectNode
384
+ datatype=object
385
+
386
+ path=$.inventory.categoryLabels.hardware
387
+ kind=StringLiteral
388
+ datatype=string
389
+ value=Hardware
390
+
391
+ path=$.inventory.categoryLabels.tooling
392
+ kind=StringLiteral
393
+ datatype=string
394
+ value=Tooling
395
+
396
+ path=$.table
397
+ kind=ObjectNode
398
+ datatype=object
399
+
400
+ path=$.table.header
401
+ kind=ListNode
402
+ datatype=list<string>
403
+
404
+ path=$.table.header[0]
405
+ kind=StringLiteral
406
+ value=name
407
+
408
+ path=$.table.header[1]
409
+ kind=StringLiteral
410
+ value=age
411
+
412
+ path=$.table.duplicateHeader
413
+ kind=ListNode
414
+ datatype=list<string>
415
+
416
+ path=$.table.duplicateHeader[0]
417
+ kind=StringLiteral
418
+ value=name
419
+
420
+ path=$.table.duplicateHeader[1]
421
+ kind=StringLiteral
422
+ value=name
423
+
424
+ path=$.table.content
425
+ kind=ListNode
426
+ datatype=list
427
+
428
+ path=$.table.content[0]
429
+ kind=TupleLiteral
430
+
431
+ path=$.table.content[0][0]
432
+ kind=StringLiteral
433
+ value=Bob
434
+
435
+ path=$.table.content[0][1]
436
+ kind=NumberLiteral
437
+ value=22
438
+
439
+ path=$.table.content[1]
440
+ kind=TupleLiteral
441
+
442
+ path=$.table.content[1][0]
443
+ kind=StringLiteral
444
+ value=Alice
445
+
446
+ path=$.table.content[1][1]
447
+ kind=NumberLiteral
448
+ value=31
449
+
450
+ path=$.containers
451
+ kind=ObjectNode
452
+ datatype=object
453
+
454
+ path=$.containers.record
455
+ kind=ObjectNode
456
+ datatype=obj
457
+
458
+ path=$.containers.record.id
459
+ kind=NumberLiteral
460
+ datatype=number
461
+ value=1
462
+
463
+ path=$.containers.packet
464
+ kind=ObjectNode
465
+ datatype=envelope
466
+
467
+ path=$.containers.packet.ok
468
+ kind=BooleanLiteral
469
+ datatype=boolean
470
+ value=true
471
+
472
+ path=$.containers.compact
473
+ kind=ObjectNode
474
+ datatype=o
475
+
476
+ path=$.containers.compact.ok
477
+ kind=BooleanLiteral
478
+ datatype=boolean
479
+ value=true
480
+
481
+ path=$.containers.series
482
+ kind=ListNode
483
+ datatype=list<number>
484
+
485
+ path=$.containers.series[0]
486
+ kind=NumberLiteral
487
+ value=1
488
+
489
+ path=$.containers.series[1]
490
+ kind=NumberLiteral
491
+ value=2
492
+
493
+ path=$.containers.pair
494
+ kind=TupleLiteral
495
+ datatype=tuple
496
+
497
+ path=$.containers.pair[0]
498
+ kind=StringLiteral
499
+ value=x
500
+
501
+ path=$.containers.pair[1]
502
+ kind=NumberLiteral
503
+ value=1
504
+
505
+ path=$.containers.nodeValue
506
+ kind=NodeLiteral
507
+ datatype=node
508
+
509
+ path=$.containers.nodeValue[0]
510
+ kind=NodeHead
511
+ value=tag
512
+
513
+ path=$.containers.nodeValue[0][0]
514
+ kind=StringLiteral
515
+ value=hello
516
+
517
+ path=$.labels
518
+ kind=ListNode
519
+ datatype=list<object>
520
+
521
+ path=$.labels[0]
522
+ kind=ObjectNode
523
+
524
+ path=$.labels[0].value
525
+ kind=StringLiteral
526
+ datatype=string
527
+ value=zebre
528
+
529
+ path=$.labels[1]
530
+ kind=ObjectNode
531
+
532
+ path=$.labels[1].value
533
+ kind=StringLiteral
534
+ datatype=string
535
+ value=éclair
536
+
537
+ path=$.labels[2]
538
+ kind=ObjectNode
539
+
540
+ path=$.labels[2].value
541
+ kind=StringLiteral
542
+ datatype=string
543
+ value=adapter
544
+
545
+ path=$.parts
546
+ kind=ListNode
547
+ datatype=list<object>
548
+
549
+ path=$.parts[0]
550
+ kind=ObjectNode
551
+
552
+ path=$.parts[0].value
553
+ kind=StringLiteral
554
+ datatype=string
555
+ value=part-10
556
+
557
+ path=$.parts[1]
558
+ kind=ObjectNode
559
+
560
+ path=$.parts[1].value
561
+ kind=StringLiteral
562
+ datatype=string
563
+ value=part-2
564
+
565
+ path=$.parts[2]
566
+ kind=ObjectNode
567
+
568
+ path=$.parts[2].value
569
+ kind=StringLiteral
570
+ datatype=string
571
+ value=part-1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altopelago/sansa",
3
- "version": "0.9.1",
3
+ "version": "0.10.1",
4
4
  "description": "Semantic Address NameSpace Abstraction parser, resolver, and query toolkit.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -32,8 +32,8 @@ if (!['text', 'json'].includes(format)) {
32
32
  console.error(`SANSA Instruction tool error: unsupported --format '${format}'. Expected 'text' or 'json'.`);
33
33
  process.exit(2);
34
34
  }
35
- if (args.target !== undefined && !['aeon', 'json', 'json-compatible'].includes(args.target)) {
36
- console.error(`SANSA Instruction tool error: unsupported --target '${args.target}'. Expected 'aeon', 'json', or 'json-compatible'.`);
35
+ if (args.target !== undefined && !['aeon', 'json', 'json-compatible', 'telex', 'telex.aes'].includes(args.target)) {
36
+ console.error(`SANSA Instruction tool error: unsupported --target '${args.target}'. Expected 'aeon', 'json', 'json-compatible', 'telex', or 'telex.aes'.`);
37
37
  process.exit(2);
38
38
  }
39
39
  if (args.target !== undefined && mode !== 'plan') {
@@ -415,7 +415,7 @@ Options:
415
415
  Defaults to fixtures/query-inventory.json.
416
416
  --fixture-kind <kind> Force fixture kind: json or aeon.
417
417
  --mode <mode> parse, lower, or plan. Defaults to lower.
418
- --target <target> Validate plan target surface: aeon, json, or json-compatible.
418
+ --target <target> Validate plan target: aeon, json, json-compatible, telex, or telex.aes.
419
419
  Only available with --mode plan.
420
420
  --format <format> text or json. Defaults to text.
421
421
  -h, --help Show this help.
@@ -92,6 +92,7 @@ function handleMutateApi(request, response) {
92
92
  }
93
93
 
94
94
  const result = await runMutationForWorkbench({
95
+ sourceKind: payload.sourceKind === 'telex' ? 'telex' : 'aeon',
95
96
  source: String(payload.source ?? ''),
96
97
  requestSource: String(payload.requestSource ?? ''),
97
98
  requestKind: payload.requestKind === 'instruction' ? 'instruction' : 'structured',
@@ -134,7 +135,7 @@ function handleQueryApi(request, response) {
134
135
  const result = action === 'parse'
135
136
  ? parseQueryForWorkbench(String(payload.query ?? ''))
136
137
  : await evaluateQueryForWorkbench({
137
- sourceKind: payload.sourceKind === 'json' ? 'json' : 'aeon',
138
+ sourceKind: ['json', 'telex'].includes(payload.sourceKind) ? payload.sourceKind : 'aeon',
138
139
  source: String(payload.source ?? ''),
139
140
  query: String(payload.query ?? ''),
140
141
  paramsSource: String(payload.paramsSource ?? ''),
package/scripts/query.mjs CHANGED
@@ -3,7 +3,7 @@ import { readFileSync } from 'node:fs';
3
3
  import { dirname, resolve } from 'node:path';
4
4
  import { fileURLToPath } from 'node:url';
5
5
  import { evaluateQuery, parseQuery } from '../src/index.js';
6
- import { namespaceFromAeonSource } from '../tools/query-web/runtime.mjs';
6
+ import { namespaceFromAeonSource, namespaceFromTelexSource } from '../tools/query-web/runtime.mjs';
7
7
 
8
8
  const here = dirname(fileURLToPath(import.meta.url));
9
9
  const root = resolve(here, '..');
@@ -202,9 +202,12 @@ async function readNamespaceFixture(path, explicitKind) {
202
202
  }
203
203
  }
204
204
 
205
- const result = await namespaceFromAeonSource(source);
205
+ const result = kind === 'telex'
206
+ ? await namespaceFromTelexSource(source)
207
+ : await namespaceFromAeonSource(source);
206
208
  if (!result.ok) {
207
- console.error(`SANSA Query tool error: could not compile AEON fixture '${path}':`);
209
+ const description = kind === 'telex' ? 'load Telex fixture' : 'compile AEON fixture';
210
+ console.error(`SANSA Query tool error: could not ${description} '${path}':`);
208
211
  console.error(result.text);
209
212
  return { ok: false };
210
213
  }
@@ -213,13 +216,14 @@ async function readNamespaceFixture(path, explicitKind) {
213
216
 
214
217
  function inferFixtureKind(path, explicitKind) {
215
218
  if (explicitKind !== undefined) {
216
- if (explicitKind === 'json' || explicitKind === 'aeon') return explicitKind;
217
- console.error(`SANSA Query tool error: unsupported --fixture-kind '${explicitKind}'. Expected 'json' or 'aeon'.`);
219
+ if (['json', 'aeon', 'telex'].includes(explicitKind)) return explicitKind;
220
+ console.error(`SANSA Query tool error: unsupported --fixture-kind '${explicitKind}'. Expected 'json', 'aeon', or 'telex'.`);
218
221
  process.exit(2);
219
222
  }
220
223
  if (path.endsWith('.json')) return 'json';
224
+ if (path.endsWith('.telex.aes')) return 'telex';
221
225
  if (path.endsWith('.aeon')) return 'aeon';
222
- console.error(`SANSA Query tool error: could not infer fixture kind from '${path}'. Use --fixture-kind json or --fixture-kind aeon.`);
226
+ console.error(`SANSA Query tool error: could not infer fixture kind from '${path}'. Use --fixture-kind json, aeon, or telex.`);
223
227
  process.exit(2);
224
228
  }
225
229
 
@@ -466,7 +470,7 @@ function renderAeonValue(value, metadata, fieldMetadata) {
466
470
  if (metadata?.kind === 'radix') return `%${value}`;
467
471
  if (metadata?.kind === 'encoding') return `&${value}`;
468
472
  if (metadata?.kind === 'separator') return `^${value}`;
469
- if (['date', 'time', 'datetime', 'zrut'].includes(metadata?.kind)) return String(value);
473
+ if (['date', 'time', 'datetime', 'wtc'].includes(metadata?.kind)) return String(value);
470
474
  if (metadata?.kind === 'sansaAddress' || metadata?.kind === 'sansa') {
471
475
  return value?.canonical ?? value?.address?.canonical ?? value?.address ?? String(value);
472
476
  }
@@ -582,14 +586,15 @@ function printHelp() {
582
586
  Usage:
583
587
  npm run query -- --query "from $.inventory.items.*\\nselect .sku"
584
588
  npm run query -- --query-file query.sansaq --fixture fixture.aeon
589
+ npm run query -- --query-file query.sansaq --fixture fixture.telex.aes
585
590
  npm run query -- --query-file query.sansaq --fixture fixture.json
586
591
  npm run query -- --mode parse --query "from $.inventory.items.*\\nselect .sku"
587
592
 
588
593
  Options:
589
594
  -q, --query <source> Query source.
590
595
  --query-file <path> Read query source from a file.
591
- -f, --fixture <path> AEON or JSON namespace fixture. Defaults to fixtures/query-inventory.json.
592
- --fixture-kind <kind> Force fixture kind: aeon or json. Inferred from extension by default.
596
+ -f, --fixture <path> AEON, Telex, or JSON namespace fixture. Defaults to fixtures/query-inventory.json.
597
+ --fixture-kind <kind> Force fixture kind: aeon, telex, or json. Inferred from extension by default.
593
598
  --params <json> Mount JSON params at $.<"params">.
594
599
  --params-file <path> Read JSON params and mount them at $.<"params">.
595
600
  --mode <mode> evaluate or parse. Defaults to evaluate.