@dusted/anqst 1.5.0 → 1.6.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 (84) hide show
  1. package/README.md +45 -4
  2. package/dist/src/app.js +78 -24
  3. package/dist/src/base93.js +0 -72
  4. package/dist/src/boundary-codec-analysis.js +468 -0
  5. package/dist/src/boundary-codec-leaves.js +602 -0
  6. package/dist/src/boundary-codec-model.js +77 -0
  7. package/dist/src/boundary-codec-plan.js +522 -0
  8. package/dist/src/boundary-codec-render.js +1738 -0
  9. package/dist/src/boundary-codecs.js +174 -0
  10. package/dist/src/emit.js +1960 -207
  11. package/dist/src/layout.js +9 -3
  12. package/dist/src/program.js +1 -1
  13. package/dist/src/project.js +3 -3
  14. package/package.json +2 -2
  15. package/spec/AnQst-Spec-DSL.d.ts +22 -24
  16. package/dist/src/codecgenerators/basecodecemitters/bigint-qint64/decoder.js +0 -35
  17. package/dist/src/codecgenerators/basecodecemitters/bigint-qint64/encoder.js +0 -36
  18. package/dist/src/codecgenerators/basecodecemitters/bigint-quint64/decoder.js +0 -26
  19. package/dist/src/codecgenerators/basecodecemitters/bigint-quint64/encoder.js +0 -38
  20. package/dist/src/codecgenerators/basecodecemitters/binary-blob/decoder.js +0 -28
  21. package/dist/src/codecgenerators/basecodecemitters/binary-blob/encoder.js +0 -34
  22. package/dist/src/codecgenerators/basecodecemitters/binary-buffer/decoder.js +0 -29
  23. package/dist/src/codecgenerators/basecodecemitters/binary-buffer/encoder.js +0 -36
  24. package/dist/src/codecgenerators/basecodecemitters/binary-float32Array/decoder.js +0 -46
  25. package/dist/src/codecgenerators/basecodecemitters/binary-float32Array/encoder.js +0 -49
  26. package/dist/src/codecgenerators/basecodecemitters/binary-float64Array/decoder.js +0 -46
  27. package/dist/src/codecgenerators/basecodecemitters/binary-float64Array/encoder.js +0 -47
  28. package/dist/src/codecgenerators/basecodecemitters/binary-int16Array/decoder.js +0 -46
  29. package/dist/src/codecgenerators/basecodecemitters/binary-int16Array/encoder.js +0 -49
  30. package/dist/src/codecgenerators/basecodecemitters/binary-int32Array/decoder.js +0 -50
  31. package/dist/src/codecgenerators/basecodecemitters/binary-int32Array/encoder.js +0 -52
  32. package/dist/src/codecgenerators/basecodecemitters/binary-int8Array/decoder.js +0 -38
  33. package/dist/src/codecgenerators/basecodecemitters/binary-int8Array/encoder.js +0 -44
  34. package/dist/src/codecgenerators/basecodecemitters/binary-typedArray/decoder.js +0 -33
  35. package/dist/src/codecgenerators/basecodecemitters/binary-typedArray/encoder.js +0 -34
  36. package/dist/src/codecgenerators/basecodecemitters/binary-uint16Array/decoder.js +0 -46
  37. package/dist/src/codecgenerators/basecodecemitters/binary-uint16Array/encoder.js +0 -49
  38. package/dist/src/codecgenerators/basecodecemitters/binary-uint32Array/decoder.js +0 -46
  39. package/dist/src/codecgenerators/basecodecemitters/binary-uint32Array/encoder.js +0 -49
  40. package/dist/src/codecgenerators/basecodecemitters/binary-uint8Array/decoder.js +0 -28
  41. package/dist/src/codecgenerators/basecodecemitters/binary-uint8Array/encoder.js +0 -34
  42. package/dist/src/codecgenerators/basecodecemitters/boolean/decoder.js +0 -34
  43. package/dist/src/codecgenerators/basecodecemitters/boolean/encoder.js +0 -40
  44. package/dist/src/codecgenerators/basecodecemitters/dynamic-json/decoder.js +0 -43
  45. package/dist/src/codecgenerators/basecodecemitters/dynamic-json/encoder.js +0 -45
  46. package/dist/src/codecgenerators/basecodecemitters/dynamic-object/decoder.js +0 -44
  47. package/dist/src/codecgenerators/basecodecemitters/dynamic-object/encoder.js +0 -46
  48. package/dist/src/codecgenerators/basecodecemitters/integer-int16/decoder.js +0 -32
  49. package/dist/src/codecgenerators/basecodecemitters/integer-int16/encoder.js +0 -43
  50. package/dist/src/codecgenerators/basecodecemitters/integer-int32/decoder.js +0 -26
  51. package/dist/src/codecgenerators/basecodecemitters/integer-int32/encoder.js +0 -37
  52. package/dist/src/codecgenerators/basecodecemitters/integer-int8/decoder.js +0 -26
  53. package/dist/src/codecgenerators/basecodecemitters/integer-int8/encoder.js +0 -37
  54. package/dist/src/codecgenerators/basecodecemitters/integer-qint16/decoder.js +0 -36
  55. package/dist/src/codecgenerators/basecodecemitters/integer-qint16/encoder.js +0 -36
  56. package/dist/src/codecgenerators/basecodecemitters/integer-qint32/decoder.js +0 -25
  57. package/dist/src/codecgenerators/basecodecemitters/integer-qint32/encoder.js +0 -36
  58. package/dist/src/codecgenerators/basecodecemitters/integer-qint8/decoder.js +0 -36
  59. package/dist/src/codecgenerators/basecodecemitters/integer-qint8/encoder.js +0 -36
  60. package/dist/src/codecgenerators/basecodecemitters/integer-quint16/decoder.js +0 -26
  61. package/dist/src/codecgenerators/basecodecemitters/integer-quint16/encoder.js +0 -38
  62. package/dist/src/codecgenerators/basecodecemitters/integer-quint32/decoder.js +0 -27
  63. package/dist/src/codecgenerators/basecodecemitters/integer-quint32/encoder.js +0 -39
  64. package/dist/src/codecgenerators/basecodecemitters/integer-quint8/decoder.js +0 -26
  65. package/dist/src/codecgenerators/basecodecemitters/integer-quint8/encoder.js +0 -38
  66. package/dist/src/codecgenerators/basecodecemitters/integer-uint16/decoder.js +0 -30
  67. package/dist/src/codecgenerators/basecodecemitters/integer-uint16/encoder.js +0 -42
  68. package/dist/src/codecgenerators/basecodecemitters/integer-uint32/decoder.js +0 -31
  69. package/dist/src/codecgenerators/basecodecemitters/integer-uint32/encoder.js +0 -43
  70. package/dist/src/codecgenerators/basecodecemitters/integer-uint8/decoder.js +0 -30
  71. package/dist/src/codecgenerators/basecodecemitters/integer-uint8/encoder.js +0 -40
  72. package/dist/src/codecgenerators/basecodecemitters/number/decoder.js +0 -26
  73. package/dist/src/codecgenerators/basecodecemitters/number/encoder.js +0 -38
  74. package/dist/src/codecgenerators/basecodecemitters/shared/comments.js +0 -13
  75. package/dist/src/codecgenerators/basecodecemitters/shared/contracts.js +0 -2
  76. package/dist/src/codecgenerators/basecodecemitters/shared/fixedwidth.js +0 -53
  77. package/dist/src/codecgenerators/basecodecemitters/shared/index.js +0 -21
  78. package/dist/src/codecgenerators/basecodecemitters/shared/positionalBase93.js +0 -48
  79. package/dist/src/codecgenerators/basecodecemitters/shared/rawbytes.js +0 -30
  80. package/dist/src/codecgenerators/basecodecemitters/string/decoder.js +0 -43
  81. package/dist/src/codecgenerators/basecodecemitters/string/encoder.js +0 -43
  82. package/dist/src/codecgenerators/basecodecemitters/stringArray/decoder.js +0 -80
  83. package/dist/src/codecgenerators/basecodecemitters/stringArray/encoder.js +0 -57
  84. package/dist/src/structured-top-level-codecs.js +0 -1305
@@ -0,0 +1,602 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveLeafCapability = resolveLeafCapability;
4
+ function leafCapability(descriptor) {
5
+ return descriptor;
6
+ }
7
+ const LEAF_CAPABILITIES = new Map([
8
+ [
9
+ "string",
10
+ leafCapability({
11
+ key: "string",
12
+ logicalKind: "string",
13
+ region: "string",
14
+ fixedByteWidth: null,
15
+ mayConsumeTail: true,
16
+ mayGroupSharedRegion: true,
17
+ supportedPackings: ["text-packed"],
18
+ requiresCountMetadata: false,
19
+ targetMaterialization: {
20
+ tsTypeText: "string",
21
+ cppTypeTextHint: "QString",
22
+ requiresDecodeAllocation: false,
23
+ ownership: "value"
24
+ }
25
+ })
26
+ ],
27
+ [
28
+ "boolean",
29
+ leafCapability({
30
+ key: "boolean",
31
+ logicalKind: "boolean",
32
+ region: "blob",
33
+ fixedByteWidth: 1,
34
+ mayConsumeTail: false,
35
+ mayGroupSharedRegion: true,
36
+ supportedPackings: ["bit-packed", "byte-packed", "text-packed"],
37
+ requiresCountMetadata: false,
38
+ targetMaterialization: {
39
+ tsTypeText: "boolean",
40
+ cppTypeTextHint: "bool",
41
+ requiresDecodeAllocation: false,
42
+ ownership: "value"
43
+ }
44
+ })
45
+ ],
46
+ [
47
+ "number",
48
+ leafCapability({
49
+ key: "number",
50
+ logicalKind: "number",
51
+ region: "blob",
52
+ fixedByteWidth: 8,
53
+ mayConsumeTail: false,
54
+ mayGroupSharedRegion: true,
55
+ supportedPackings: ["byte-packed"],
56
+ requiresCountMetadata: false,
57
+ targetMaterialization: {
58
+ tsTypeText: "number",
59
+ cppTypeTextHint: "double",
60
+ requiresDecodeAllocation: false,
61
+ ownership: "value"
62
+ }
63
+ })
64
+ ],
65
+ [
66
+ "qint64",
67
+ leafCapability({
68
+ key: "qint64",
69
+ logicalKind: "signed-64-bit-integer",
70
+ region: "blob",
71
+ fixedByteWidth: 8,
72
+ mayConsumeTail: false,
73
+ mayGroupSharedRegion: true,
74
+ supportedPackings: ["byte-packed"],
75
+ requiresCountMetadata: false,
76
+ targetMaterialization: {
77
+ tsTypeText: "bigint",
78
+ cppTypeTextHint: "qint64",
79
+ requiresDecodeAllocation: false,
80
+ ownership: "value"
81
+ }
82
+ })
83
+ ],
84
+ [
85
+ "quint64",
86
+ leafCapability({
87
+ key: "quint64",
88
+ logicalKind: "unsigned-64-bit-integer",
89
+ region: "blob",
90
+ fixedByteWidth: 8,
91
+ mayConsumeTail: false,
92
+ mayGroupSharedRegion: true,
93
+ supportedPackings: ["byte-packed"],
94
+ requiresCountMetadata: false,
95
+ targetMaterialization: {
96
+ tsTypeText: "bigint",
97
+ cppTypeTextHint: "quint64",
98
+ requiresDecodeAllocation: false,
99
+ ownership: "value"
100
+ }
101
+ })
102
+ ],
103
+ [
104
+ "qint32",
105
+ leafCapability({
106
+ key: "qint32",
107
+ logicalKind: "signed-32-bit-integer",
108
+ region: "blob",
109
+ fixedByteWidth: 4,
110
+ mayConsumeTail: false,
111
+ mayGroupSharedRegion: true,
112
+ supportedPackings: ["byte-packed"],
113
+ requiresCountMetadata: false,
114
+ targetMaterialization: {
115
+ tsTypeText: "number",
116
+ cppTypeTextHint: "qint32",
117
+ requiresDecodeAllocation: false,
118
+ ownership: "value"
119
+ }
120
+ })
121
+ ],
122
+ [
123
+ "quint32",
124
+ leafCapability({
125
+ key: "quint32",
126
+ logicalKind: "unsigned-32-bit-integer",
127
+ region: "blob",
128
+ fixedByteWidth: 4,
129
+ mayConsumeTail: false,
130
+ mayGroupSharedRegion: true,
131
+ supportedPackings: ["byte-packed"],
132
+ requiresCountMetadata: false,
133
+ targetMaterialization: {
134
+ tsTypeText: "number",
135
+ cppTypeTextHint: "quint32",
136
+ requiresDecodeAllocation: false,
137
+ ownership: "value"
138
+ }
139
+ })
140
+ ],
141
+ [
142
+ "qint16",
143
+ leafCapability({
144
+ key: "qint16",
145
+ logicalKind: "signed-16-bit-integer",
146
+ region: "blob",
147
+ fixedByteWidth: 2,
148
+ mayConsumeTail: false,
149
+ mayGroupSharedRegion: true,
150
+ supportedPackings: ["byte-packed"],
151
+ requiresCountMetadata: false,
152
+ targetMaterialization: {
153
+ tsTypeText: "number",
154
+ cppTypeTextHint: "qint16",
155
+ requiresDecodeAllocation: false,
156
+ ownership: "value"
157
+ }
158
+ })
159
+ ],
160
+ [
161
+ "quint16",
162
+ leafCapability({
163
+ key: "quint16",
164
+ logicalKind: "unsigned-16-bit-integer",
165
+ region: "blob",
166
+ fixedByteWidth: 2,
167
+ mayConsumeTail: false,
168
+ mayGroupSharedRegion: true,
169
+ supportedPackings: ["byte-packed"],
170
+ requiresCountMetadata: false,
171
+ targetMaterialization: {
172
+ tsTypeText: "number",
173
+ cppTypeTextHint: "quint16",
174
+ requiresDecodeAllocation: false,
175
+ ownership: "value"
176
+ }
177
+ })
178
+ ],
179
+ [
180
+ "qint8",
181
+ leafCapability({
182
+ key: "qint8",
183
+ logicalKind: "signed-8-bit-integer",
184
+ region: "blob",
185
+ fixedByteWidth: 1,
186
+ mayConsumeTail: false,
187
+ mayGroupSharedRegion: true,
188
+ supportedPackings: ["byte-packed"],
189
+ requiresCountMetadata: false,
190
+ targetMaterialization: {
191
+ tsTypeText: "number",
192
+ cppTypeTextHint: "qint8",
193
+ requiresDecodeAllocation: false,
194
+ ownership: "value"
195
+ }
196
+ })
197
+ ],
198
+ [
199
+ "quint8",
200
+ leafCapability({
201
+ key: "quint8",
202
+ logicalKind: "unsigned-8-bit-integer",
203
+ region: "blob",
204
+ fixedByteWidth: 1,
205
+ mayConsumeTail: false,
206
+ mayGroupSharedRegion: true,
207
+ supportedPackings: ["byte-packed"],
208
+ requiresCountMetadata: false,
209
+ targetMaterialization: {
210
+ tsTypeText: "number",
211
+ cppTypeTextHint: "quint8",
212
+ requiresDecodeAllocation: false,
213
+ ownership: "value"
214
+ }
215
+ })
216
+ ],
217
+ [
218
+ "int32",
219
+ leafCapability({
220
+ key: "int32",
221
+ logicalKind: "signed-32-bit-integer",
222
+ region: "blob",
223
+ fixedByteWidth: 4,
224
+ mayConsumeTail: false,
225
+ mayGroupSharedRegion: true,
226
+ supportedPackings: ["byte-packed"],
227
+ requiresCountMetadata: false,
228
+ targetMaterialization: {
229
+ tsTypeText: "number",
230
+ cppTypeTextHint: "int32_t",
231
+ requiresDecodeAllocation: false,
232
+ ownership: "value"
233
+ }
234
+ })
235
+ ],
236
+ [
237
+ "uint32",
238
+ leafCapability({
239
+ key: "uint32",
240
+ logicalKind: "unsigned-32-bit-integer",
241
+ region: "blob",
242
+ fixedByteWidth: 4,
243
+ mayConsumeTail: false,
244
+ mayGroupSharedRegion: true,
245
+ supportedPackings: ["byte-packed"],
246
+ requiresCountMetadata: false,
247
+ targetMaterialization: {
248
+ tsTypeText: "number",
249
+ cppTypeTextHint: "uint32_t",
250
+ requiresDecodeAllocation: false,
251
+ ownership: "value"
252
+ }
253
+ })
254
+ ],
255
+ [
256
+ "int16",
257
+ leafCapability({
258
+ key: "int16",
259
+ logicalKind: "signed-16-bit-integer",
260
+ region: "blob",
261
+ fixedByteWidth: 2,
262
+ mayConsumeTail: false,
263
+ mayGroupSharedRegion: true,
264
+ supportedPackings: ["byte-packed"],
265
+ requiresCountMetadata: false,
266
+ targetMaterialization: {
267
+ tsTypeText: "number",
268
+ cppTypeTextHint: "int16_t",
269
+ requiresDecodeAllocation: false,
270
+ ownership: "value"
271
+ }
272
+ })
273
+ ],
274
+ [
275
+ "uint16",
276
+ leafCapability({
277
+ key: "uint16",
278
+ logicalKind: "unsigned-16-bit-integer",
279
+ region: "blob",
280
+ fixedByteWidth: 2,
281
+ mayConsumeTail: false,
282
+ mayGroupSharedRegion: true,
283
+ supportedPackings: ["byte-packed"],
284
+ requiresCountMetadata: false,
285
+ targetMaterialization: {
286
+ tsTypeText: "number",
287
+ cppTypeTextHint: "uint16_t",
288
+ requiresDecodeAllocation: false,
289
+ ownership: "value"
290
+ }
291
+ })
292
+ ],
293
+ [
294
+ "int8",
295
+ leafCapability({
296
+ key: "int8",
297
+ logicalKind: "signed-8-bit-integer",
298
+ region: "blob",
299
+ fixedByteWidth: 1,
300
+ mayConsumeTail: false,
301
+ mayGroupSharedRegion: true,
302
+ supportedPackings: ["byte-packed"],
303
+ requiresCountMetadata: false,
304
+ targetMaterialization: {
305
+ tsTypeText: "number",
306
+ cppTypeTextHint: "int8_t",
307
+ requiresDecodeAllocation: false,
308
+ ownership: "value"
309
+ }
310
+ })
311
+ ],
312
+ [
313
+ "uint8",
314
+ leafCapability({
315
+ key: "uint8",
316
+ logicalKind: "unsigned-8-bit-integer",
317
+ region: "blob",
318
+ fixedByteWidth: 1,
319
+ mayConsumeTail: false,
320
+ mayGroupSharedRegion: true,
321
+ supportedPackings: ["byte-packed"],
322
+ requiresCountMetadata: false,
323
+ targetMaterialization: {
324
+ tsTypeText: "number",
325
+ cppTypeTextHint: "uint8_t",
326
+ requiresDecodeAllocation: false,
327
+ ownership: "value"
328
+ }
329
+ })
330
+ ],
331
+ [
332
+ "ArrayBuffer",
333
+ leafCapability({
334
+ key: "ArrayBuffer",
335
+ logicalKind: "binary-buffer",
336
+ region: "binary",
337
+ fixedByteWidth: null,
338
+ mayConsumeTail: true,
339
+ mayGroupSharedRegion: true,
340
+ supportedPackings: ["binary-packed"],
341
+ requiresCountMetadata: false,
342
+ targetMaterialization: {
343
+ tsTypeText: "ArrayBuffer",
344
+ cppTypeTextHint: "QByteArray",
345
+ requiresDecodeAllocation: true,
346
+ ownership: "copied-buffer"
347
+ }
348
+ })
349
+ ],
350
+ [
351
+ "Uint8Array",
352
+ leafCapability({
353
+ key: "Uint8Array",
354
+ logicalKind: "uint8-array",
355
+ region: "binary",
356
+ fixedByteWidth: null,
357
+ mayConsumeTail: true,
358
+ mayGroupSharedRegion: true,
359
+ supportedPackings: ["binary-packed"],
360
+ requiresCountMetadata: false,
361
+ targetMaterialization: {
362
+ tsTypeText: "Uint8Array",
363
+ cppTypeTextHint: "QByteArray",
364
+ requiresDecodeAllocation: true,
365
+ ownership: "copied-buffer"
366
+ }
367
+ })
368
+ ],
369
+ [
370
+ "Int8Array",
371
+ leafCapability({
372
+ key: "Int8Array",
373
+ logicalKind: "int8-array",
374
+ region: "binary",
375
+ fixedByteWidth: null,
376
+ mayConsumeTail: true,
377
+ mayGroupSharedRegion: true,
378
+ supportedPackings: ["binary-packed"],
379
+ requiresCountMetadata: false,
380
+ targetMaterialization: {
381
+ tsTypeText: "Int8Array",
382
+ cppTypeTextHint: "QByteArray",
383
+ requiresDecodeAllocation: true,
384
+ ownership: "copied-buffer"
385
+ }
386
+ })
387
+ ],
388
+ [
389
+ "Uint16Array",
390
+ leafCapability({
391
+ key: "Uint16Array",
392
+ logicalKind: "uint16-array",
393
+ region: "binary",
394
+ fixedByteWidth: null,
395
+ mayConsumeTail: true,
396
+ mayGroupSharedRegion: true,
397
+ supportedPackings: ["binary-packed"],
398
+ requiresCountMetadata: false,
399
+ targetMaterialization: {
400
+ tsTypeText: "Uint16Array",
401
+ cppTypeTextHint: "QByteArray",
402
+ requiresDecodeAllocation: true,
403
+ ownership: "copied-buffer"
404
+ }
405
+ })
406
+ ],
407
+ [
408
+ "Int16Array",
409
+ leafCapability({
410
+ key: "Int16Array",
411
+ logicalKind: "int16-array",
412
+ region: "binary",
413
+ fixedByteWidth: null,
414
+ mayConsumeTail: true,
415
+ mayGroupSharedRegion: true,
416
+ supportedPackings: ["binary-packed"],
417
+ requiresCountMetadata: false,
418
+ targetMaterialization: {
419
+ tsTypeText: "Int16Array",
420
+ cppTypeTextHint: "QByteArray",
421
+ requiresDecodeAllocation: true,
422
+ ownership: "copied-buffer"
423
+ }
424
+ })
425
+ ],
426
+ [
427
+ "Uint32Array",
428
+ leafCapability({
429
+ key: "Uint32Array",
430
+ logicalKind: "uint32-array",
431
+ region: "binary",
432
+ fixedByteWidth: null,
433
+ mayConsumeTail: true,
434
+ mayGroupSharedRegion: true,
435
+ supportedPackings: ["binary-packed"],
436
+ requiresCountMetadata: false,
437
+ targetMaterialization: {
438
+ tsTypeText: "Uint32Array",
439
+ cppTypeTextHint: "QByteArray",
440
+ requiresDecodeAllocation: true,
441
+ ownership: "copied-buffer"
442
+ }
443
+ })
444
+ ],
445
+ [
446
+ "Int32Array",
447
+ leafCapability({
448
+ key: "Int32Array",
449
+ logicalKind: "int32-array",
450
+ region: "binary",
451
+ fixedByteWidth: null,
452
+ mayConsumeTail: true,
453
+ mayGroupSharedRegion: true,
454
+ supportedPackings: ["binary-packed"],
455
+ requiresCountMetadata: false,
456
+ targetMaterialization: {
457
+ tsTypeText: "Int32Array",
458
+ cppTypeTextHint: "QByteArray",
459
+ requiresDecodeAllocation: true,
460
+ ownership: "copied-buffer"
461
+ }
462
+ })
463
+ ],
464
+ [
465
+ "Float32Array",
466
+ leafCapability({
467
+ key: "Float32Array",
468
+ logicalKind: "float32-array",
469
+ region: "binary",
470
+ fixedByteWidth: null,
471
+ mayConsumeTail: true,
472
+ mayGroupSharedRegion: true,
473
+ supportedPackings: ["binary-packed"],
474
+ requiresCountMetadata: false,
475
+ targetMaterialization: {
476
+ tsTypeText: "Float32Array",
477
+ cppTypeTextHint: "QByteArray",
478
+ requiresDecodeAllocation: true,
479
+ ownership: "copied-buffer"
480
+ }
481
+ })
482
+ ],
483
+ [
484
+ "Float64Array",
485
+ leafCapability({
486
+ key: "Float64Array",
487
+ logicalKind: "float64-array",
488
+ region: "binary",
489
+ fixedByteWidth: null,
490
+ mayConsumeTail: true,
491
+ mayGroupSharedRegion: true,
492
+ supportedPackings: ["binary-packed"],
493
+ requiresCountMetadata: false,
494
+ targetMaterialization: {
495
+ tsTypeText: "Float64Array",
496
+ cppTypeTextHint: "QByteArray",
497
+ requiresDecodeAllocation: true,
498
+ ownership: "copied-buffer"
499
+ }
500
+ })
501
+ ],
502
+ [
503
+ "dynamic",
504
+ leafCapability({
505
+ key: "dynamic",
506
+ logicalKind: "dynamic-json-object",
507
+ region: "dynamic",
508
+ fixedByteWidth: null,
509
+ mayConsumeTail: true,
510
+ mayGroupSharedRegion: true,
511
+ supportedPackings: ["dynamic"],
512
+ requiresCountMetadata: false,
513
+ targetMaterialization: {
514
+ tsTypeText: "object",
515
+ cppTypeTextHint: "QVariantMap",
516
+ requiresDecodeAllocation: true,
517
+ ownership: "dynamic"
518
+ }
519
+ })
520
+ ]
521
+ ]);
522
+ function lookupLeafCapability(key) {
523
+ return LEAF_CAPABILITIES.get(key) ?? null;
524
+ }
525
+ function resolveLeafCapability(rawText, name) {
526
+ const normalized = rawText.trim();
527
+ if (normalized === "string" || normalized === "AnQst.Type.string")
528
+ return lookupLeafCapability("string");
529
+ if (normalized === "boolean")
530
+ return lookupLeafCapability("boolean");
531
+ if (normalized === "number" || normalized === "AnQst.Type.number")
532
+ return lookupLeafCapability("number");
533
+ if (normalized === "bigint" || normalized === "AnQst.Type.qint64")
534
+ return lookupLeafCapability("qint64");
535
+ if (normalized === "AnQst.Type.quint64")
536
+ return lookupLeafCapability("quint64");
537
+ if (normalized === "AnQst.Type.qint32")
538
+ return lookupLeafCapability("qint32");
539
+ if (normalized === "AnQst.Type.quint32")
540
+ return lookupLeafCapability("quint32");
541
+ if (normalized === "AnQst.Type.qint16")
542
+ return lookupLeafCapability("qint16");
543
+ if (normalized === "AnQst.Type.quint16")
544
+ return lookupLeafCapability("quint16");
545
+ if (normalized === "AnQst.Type.qint8")
546
+ return lookupLeafCapability("qint8");
547
+ if (normalized === "AnQst.Type.quint8")
548
+ return lookupLeafCapability("quint8");
549
+ if (normalized === "AnQst.Type.int32")
550
+ return lookupLeafCapability("int32");
551
+ if (normalized === "AnQst.Type.uint32")
552
+ return lookupLeafCapability("uint32");
553
+ if (normalized === "AnQst.Type.int16")
554
+ return lookupLeafCapability("int16");
555
+ if (normalized === "AnQst.Type.uint16")
556
+ return lookupLeafCapability("uint16");
557
+ if (normalized === "AnQst.Type.int8")
558
+ return lookupLeafCapability("int8");
559
+ if (normalized === "AnQst.Type.uint8")
560
+ return lookupLeafCapability("uint8");
561
+ if (normalized === "AnQst.Type.object" || normalized === "AnQst.Type.json" || normalized === "object") {
562
+ return lookupLeafCapability("dynamic");
563
+ }
564
+ if (normalized === "AnQst.Type.buffer" || normalized === "AnQst.Type.blob" || normalized === "ArrayBuffer") {
565
+ return lookupLeafCapability("ArrayBuffer");
566
+ }
567
+ if (normalized === "AnQst.Type.typedArray" || normalized === "Uint8Array")
568
+ return lookupLeafCapability("Uint8Array");
569
+ if (normalized === "AnQst.Type.uint8Array")
570
+ return lookupLeafCapability("Uint8Array");
571
+ if (normalized === "AnQst.Type.int8Array")
572
+ return lookupLeafCapability("Int8Array");
573
+ if (normalized === "AnQst.Type.uint16Array")
574
+ return lookupLeafCapability("Uint16Array");
575
+ if (normalized === "AnQst.Type.int16Array")
576
+ return lookupLeafCapability("Int16Array");
577
+ if (normalized === "AnQst.Type.uint32Array")
578
+ return lookupLeafCapability("Uint32Array");
579
+ if (normalized === "AnQst.Type.int32Array")
580
+ return lookupLeafCapability("Int32Array");
581
+ if (normalized === "AnQst.Type.float32Array" || normalized === "Float32Array")
582
+ return lookupLeafCapability("Float32Array");
583
+ if (normalized === "AnQst.Type.float64Array" || normalized === "Float64Array")
584
+ return lookupLeafCapability("Float64Array");
585
+ if (name === "Uint8Array")
586
+ return lookupLeafCapability("Uint8Array");
587
+ if (name === "Int8Array")
588
+ return lookupLeafCapability("Int8Array");
589
+ if (name === "Uint16Array")
590
+ return lookupLeafCapability("Uint16Array");
591
+ if (name === "Int16Array")
592
+ return lookupLeafCapability("Int16Array");
593
+ if (name === "Uint32Array")
594
+ return lookupLeafCapability("Uint32Array");
595
+ if (name === "Int32Array")
596
+ return lookupLeafCapability("Int32Array");
597
+ if (name === "Float32Array")
598
+ return lookupLeafCapability("Float32Array");
599
+ if (name === "Float64Array")
600
+ return lookupLeafCapability("Float64Array");
601
+ return null;
602
+ }
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.stripAnQstType = stripAnQstType;
7
+ exports.parseTypeNodeFromText = parseTypeNodeFromText;
8
+ exports.parseTypeDeclNode = parseTypeDeclNode;
9
+ exports.qNameText = qNameText;
10
+ exports.sanitizeIdentifier = sanitizeIdentifier;
11
+ exports.codecSiteKey = codecSiteKey;
12
+ const typescript_1 = __importDefault(require("typescript"));
13
+ function stripAnQstType(typeText) {
14
+ return typeText
15
+ .replace(/\bAnQst\.Type\.stringArray\b/g, "string[]")
16
+ .replace(/\bAnQst\.Type\.string\b/g, "string")
17
+ .replace(/\bAnQst\.Type\.number\b/g, "number")
18
+ .replace(/\bAnQst\.Type\.qint64\b/g, "bigint")
19
+ .replace(/\bAnQst\.Type\.quint64\b/g, "bigint")
20
+ .replace(/\bAnQst\.Type\.qint32\b/g, "number")
21
+ .replace(/\bAnQst\.Type\.quint32\b/g, "number")
22
+ .replace(/\bAnQst\.Type\.qint16\b/g, "number")
23
+ .replace(/\bAnQst\.Type\.quint16\b/g, "number")
24
+ .replace(/\bAnQst\.Type\.qint8\b/g, "number")
25
+ .replace(/\bAnQst\.Type\.quint8\b/g, "number")
26
+ .replace(/\bAnQst\.Type\.int32\b/g, "number")
27
+ .replace(/\bAnQst\.Type\.uint32\b/g, "number")
28
+ .replace(/\bAnQst\.Type\.int16\b/g, "number")
29
+ .replace(/\bAnQst\.Type\.uint16\b/g, "number")
30
+ .replace(/\bAnQst\.Type\.int8\b/g, "number")
31
+ .replace(/\bAnQst\.Type\.uint8\b/g, "number")
32
+ .replace(/\bAnQst\.Type\.buffer\b/g, "ArrayBuffer")
33
+ .replace(/\bAnQst\.Type\.blob\b/g, "ArrayBuffer")
34
+ .replace(/\bAnQst\.Type\.typedArray\b/g, "Uint8Array")
35
+ .replace(/\bAnQst\.Type\.uint8Array\b/g, "Uint8Array")
36
+ .replace(/\bAnQst\.Type\.int8Array\b/g, "Int8Array")
37
+ .replace(/\bAnQst\.Type\.uint16Array\b/g, "Uint16Array")
38
+ .replace(/\bAnQst\.Type\.int16Array\b/g, "Int16Array")
39
+ .replace(/\bAnQst\.Type\.uint32Array\b/g, "Uint32Array")
40
+ .replace(/\bAnQst\.Type\.int32Array\b/g, "Int32Array")
41
+ .replace(/\bAnQst\.Type\.float32Array\b/g, "Float32Array")
42
+ .replace(/\bAnQst\.Type\.float64Array\b/g, "Float64Array")
43
+ .replace(/\bAnQst\.Type\.object\b/g, "object")
44
+ .replace(/\bAnQst\.Type\.json\b/g, "object");
45
+ }
46
+ function parseTypeNodeFromText(typeText) {
47
+ const source = typescript_1.default.createSourceFile("__inline__.ts", `type __X = ${typeText};`, typescript_1.default.ScriptTarget.Latest, true, typescript_1.default.ScriptKind.TS);
48
+ const stmt = source.statements.find(typescript_1.default.isTypeAliasDeclaration);
49
+ if (!stmt) {
50
+ throw new Error(`Unable to parse type text: ${typeText}`);
51
+ }
52
+ return stmt.type;
53
+ }
54
+ function parseTypeDeclNode(nodeText) {
55
+ const source = typescript_1.default.createSourceFile("__decl.ts", nodeText, typescript_1.default.ScriptTarget.Latest, true, typescript_1.default.ScriptKind.TS);
56
+ for (const stmt of source.statements) {
57
+ if (typescript_1.default.isInterfaceDeclaration(stmt) || typescript_1.default.isTypeAliasDeclaration(stmt)) {
58
+ return stmt;
59
+ }
60
+ }
61
+ return null;
62
+ }
63
+ function qNameText(name) {
64
+ if (typescript_1.default.isIdentifier(name))
65
+ return name.text;
66
+ return `${qNameText(name.left)}.${name.right.text}`;
67
+ }
68
+ function sanitizeIdentifier(value) {
69
+ const trimmed = value.replace(/[^A-Za-z0-9_]+/g, "_").replace(/_+/g, "_").replace(/^_+|_+$/g, "");
70
+ const withFallback = trimmed.length > 0 ? trimmed : "Codec";
71
+ return /^[0-9]/.test(withFallback) ? `T_${withFallback}` : withFallback;
72
+ }
73
+ function codecSiteKey(kind, serviceName, memberName, parameterName) {
74
+ return kind === "payload"
75
+ ? `${serviceName}::${memberName}::payload`
76
+ : `${serviceName}::${memberName}::param::${parameterName ?? ""}`;
77
+ }