@dusted/anqst 1.5.0 → 1.5.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.
Files changed (80) hide show
  1. package/dist/src/app.js +31 -9
  2. package/dist/src/base93.js +0 -72
  3. package/dist/src/boundary-codec-analysis.js +468 -0
  4. package/dist/src/boundary-codec-leaves.js +602 -0
  5. package/dist/src/boundary-codec-model.js +77 -0
  6. package/dist/src/boundary-codec-plan.js +522 -0
  7. package/dist/src/boundary-codec-render.js +1738 -0
  8. package/dist/src/boundary-codecs.js +174 -0
  9. package/dist/src/emit.js +580 -90
  10. package/dist/src/program.js +1 -1
  11. package/package.json +2 -2
  12. package/dist/src/codecgenerators/basecodecemitters/bigint-qint64/decoder.js +0 -35
  13. package/dist/src/codecgenerators/basecodecemitters/bigint-qint64/encoder.js +0 -36
  14. package/dist/src/codecgenerators/basecodecemitters/bigint-quint64/decoder.js +0 -26
  15. package/dist/src/codecgenerators/basecodecemitters/bigint-quint64/encoder.js +0 -38
  16. package/dist/src/codecgenerators/basecodecemitters/binary-blob/decoder.js +0 -28
  17. package/dist/src/codecgenerators/basecodecemitters/binary-blob/encoder.js +0 -34
  18. package/dist/src/codecgenerators/basecodecemitters/binary-buffer/decoder.js +0 -29
  19. package/dist/src/codecgenerators/basecodecemitters/binary-buffer/encoder.js +0 -36
  20. package/dist/src/codecgenerators/basecodecemitters/binary-float32Array/decoder.js +0 -46
  21. package/dist/src/codecgenerators/basecodecemitters/binary-float32Array/encoder.js +0 -49
  22. package/dist/src/codecgenerators/basecodecemitters/binary-float64Array/decoder.js +0 -46
  23. package/dist/src/codecgenerators/basecodecemitters/binary-float64Array/encoder.js +0 -47
  24. package/dist/src/codecgenerators/basecodecemitters/binary-int16Array/decoder.js +0 -46
  25. package/dist/src/codecgenerators/basecodecemitters/binary-int16Array/encoder.js +0 -49
  26. package/dist/src/codecgenerators/basecodecemitters/binary-int32Array/decoder.js +0 -50
  27. package/dist/src/codecgenerators/basecodecemitters/binary-int32Array/encoder.js +0 -52
  28. package/dist/src/codecgenerators/basecodecemitters/binary-int8Array/decoder.js +0 -38
  29. package/dist/src/codecgenerators/basecodecemitters/binary-int8Array/encoder.js +0 -44
  30. package/dist/src/codecgenerators/basecodecemitters/binary-typedArray/decoder.js +0 -33
  31. package/dist/src/codecgenerators/basecodecemitters/binary-typedArray/encoder.js +0 -34
  32. package/dist/src/codecgenerators/basecodecemitters/binary-uint16Array/decoder.js +0 -46
  33. package/dist/src/codecgenerators/basecodecemitters/binary-uint16Array/encoder.js +0 -49
  34. package/dist/src/codecgenerators/basecodecemitters/binary-uint32Array/decoder.js +0 -46
  35. package/dist/src/codecgenerators/basecodecemitters/binary-uint32Array/encoder.js +0 -49
  36. package/dist/src/codecgenerators/basecodecemitters/binary-uint8Array/decoder.js +0 -28
  37. package/dist/src/codecgenerators/basecodecemitters/binary-uint8Array/encoder.js +0 -34
  38. package/dist/src/codecgenerators/basecodecemitters/boolean/decoder.js +0 -34
  39. package/dist/src/codecgenerators/basecodecemitters/boolean/encoder.js +0 -40
  40. package/dist/src/codecgenerators/basecodecemitters/dynamic-json/decoder.js +0 -43
  41. package/dist/src/codecgenerators/basecodecemitters/dynamic-json/encoder.js +0 -45
  42. package/dist/src/codecgenerators/basecodecemitters/dynamic-object/decoder.js +0 -44
  43. package/dist/src/codecgenerators/basecodecemitters/dynamic-object/encoder.js +0 -46
  44. package/dist/src/codecgenerators/basecodecemitters/integer-int16/decoder.js +0 -32
  45. package/dist/src/codecgenerators/basecodecemitters/integer-int16/encoder.js +0 -43
  46. package/dist/src/codecgenerators/basecodecemitters/integer-int32/decoder.js +0 -26
  47. package/dist/src/codecgenerators/basecodecemitters/integer-int32/encoder.js +0 -37
  48. package/dist/src/codecgenerators/basecodecemitters/integer-int8/decoder.js +0 -26
  49. package/dist/src/codecgenerators/basecodecemitters/integer-int8/encoder.js +0 -37
  50. package/dist/src/codecgenerators/basecodecemitters/integer-qint16/decoder.js +0 -36
  51. package/dist/src/codecgenerators/basecodecemitters/integer-qint16/encoder.js +0 -36
  52. package/dist/src/codecgenerators/basecodecemitters/integer-qint32/decoder.js +0 -25
  53. package/dist/src/codecgenerators/basecodecemitters/integer-qint32/encoder.js +0 -36
  54. package/dist/src/codecgenerators/basecodecemitters/integer-qint8/decoder.js +0 -36
  55. package/dist/src/codecgenerators/basecodecemitters/integer-qint8/encoder.js +0 -36
  56. package/dist/src/codecgenerators/basecodecemitters/integer-quint16/decoder.js +0 -26
  57. package/dist/src/codecgenerators/basecodecemitters/integer-quint16/encoder.js +0 -38
  58. package/dist/src/codecgenerators/basecodecemitters/integer-quint32/decoder.js +0 -27
  59. package/dist/src/codecgenerators/basecodecemitters/integer-quint32/encoder.js +0 -39
  60. package/dist/src/codecgenerators/basecodecemitters/integer-quint8/decoder.js +0 -26
  61. package/dist/src/codecgenerators/basecodecemitters/integer-quint8/encoder.js +0 -38
  62. package/dist/src/codecgenerators/basecodecemitters/integer-uint16/decoder.js +0 -30
  63. package/dist/src/codecgenerators/basecodecemitters/integer-uint16/encoder.js +0 -42
  64. package/dist/src/codecgenerators/basecodecemitters/integer-uint32/decoder.js +0 -31
  65. package/dist/src/codecgenerators/basecodecemitters/integer-uint32/encoder.js +0 -43
  66. package/dist/src/codecgenerators/basecodecemitters/integer-uint8/decoder.js +0 -30
  67. package/dist/src/codecgenerators/basecodecemitters/integer-uint8/encoder.js +0 -40
  68. package/dist/src/codecgenerators/basecodecemitters/number/decoder.js +0 -26
  69. package/dist/src/codecgenerators/basecodecemitters/number/encoder.js +0 -38
  70. package/dist/src/codecgenerators/basecodecemitters/shared/comments.js +0 -13
  71. package/dist/src/codecgenerators/basecodecemitters/shared/contracts.js +0 -2
  72. package/dist/src/codecgenerators/basecodecemitters/shared/fixedwidth.js +0 -53
  73. package/dist/src/codecgenerators/basecodecemitters/shared/index.js +0 -21
  74. package/dist/src/codecgenerators/basecodecemitters/shared/positionalBase93.js +0 -48
  75. package/dist/src/codecgenerators/basecodecemitters/shared/rawbytes.js +0 -30
  76. package/dist/src/codecgenerators/basecodecemitters/string/decoder.js +0 -43
  77. package/dist/src/codecgenerators/basecodecemitters/string/encoder.js +0 -43
  78. package/dist/src/codecgenerators/basecodecemitters/stringArray/decoder.js +0 -80
  79. package/dist/src/codecgenerators/basecodecemitters/stringArray/encoder.js +0 -57
  80. package/dist/src/structured-top-level-codecs.js +0 -1305
@@ -1,26 +0,0 @@
1
- "use strict";
2
- /**
3
- * Base codec emitter (decode): base93 blob → TypeScript `number`, C++ `quint8`.
4
- * Reconstructs the single unsigned byte from a 2-character base93 payload.
5
- * See RefinedSpecs/Codecs/Integer_quint8_Codec.md.
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.decoderEmitter = exports.descriptor = void 0;
9
- const comments_1 = require("../shared/comments");
10
- const fixedwidth_1 = require("../shared/fixedwidth");
11
- const encoder_1 = require("./encoder");
12
- Object.defineProperty(exports, "descriptor", { enumerable: true, get: function () { return encoder_1.descriptor; } });
13
- const strategyComment = (0, comments_1.emitStrategyComment)("Base codec emitter (decode): AnQst.Type.quint8 / quint8", [
14
- "Decodes base93 to one byte, then reads Uint8Array[0] in TypeScript or quint8 in C++.",
15
- "Standalone payloads are fixed-width and therefore always 2 base93 characters for valid quint8 values.",
16
- "Portable interoperability is direct because the byte itself is already the decoded unsigned 8-bit value."
17
- ]);
18
- exports.decoderEmitter = {
19
- descriptor: encoder_1.descriptor,
20
- emitTsDecoder() {
21
- return `${strategyComment}\n\n${(0, fixedwidth_1.emitTsFixedWidthStandaloneDecoder)("decodeQuint8Standalone", encoder_1.descriptor.fixedWidth)}`;
22
- },
23
- emitCppDecoder() {
24
- return `${strategyComment}\n\n${(0, fixedwidth_1.emitCppFixedWidthStandaloneDecoder)("decodeQuint8Standalone", encoder_1.descriptor.fixedWidth)}`;
25
- }
26
- };
@@ -1,38 +0,0 @@
1
- "use strict";
2
- /**
3
- * Base codec emitter (encode): AnQst.Type.quint8 ↔ TypeScript `number`, C++ `quint8`.
4
- * Standalone wire shape is one 2-character base93 string carrying exactly 1 byte.
5
- * See RefinedSpecs/Codecs/Integer_quint8_Codec.md.
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.encoderEmitter = exports.descriptor = void 0;
9
- const comments_1 = require("../shared/comments");
10
- const fixedwidth_1 = require("../shared/fixedwidth");
11
- const FIXED_WIDTH = {
12
- byteWidth: 1,
13
- tsViewCtor: "Uint8Array",
14
- cppType: "quint8"
15
- };
16
- exports.descriptor = {
17
- codecId: "integer-quint8",
18
- specPath: "RefinedSpecs/Codecs/Integer_quint8_Codec.md",
19
- tsType: "number",
20
- cppType: "quint8",
21
- wireCategory: "fixed-width-scalar",
22
- strategySummary: "Unsigned 8-bit scalar: write the low 8 bits via Uint8Array/quint8, then base93-encode the single byte to a 2-character standalone string.",
23
- fixedWidth: FIXED_WIDTH
24
- };
25
- const strategyComment = (0, comments_1.emitStrategyComment)("Base codec emitter (encode): AnQst.Type.quint8 / quint8", [
26
- "Uses Uint8Array[0] so TypeScript follows the quint8 prose for 1-byte unsigned truncation/wrapping.",
27
- "Emits exactly 2 base93 characters for the standalone wire payload.",
28
- "C++ encoder memcpy-copies the single quint8 byte, matching the TypeScript wire byte-for-byte."
29
- ]);
30
- exports.encoderEmitter = {
31
- descriptor: exports.descriptor,
32
- emitTsEncoder() {
33
- return `${strategyComment}\n\n${(0, fixedwidth_1.emitTsFixedWidthStandaloneEncoder)("encodeQuint8Standalone", FIXED_WIDTH)}`;
34
- },
35
- emitCppEncoder() {
36
- return `${strategyComment}\n\n${(0, fixedwidth_1.emitCppFixedWidthStandaloneEncoder)("encodeQuint8Standalone", FIXED_WIDTH)}`;
37
- }
38
- };
@@ -1,30 +0,0 @@
1
- "use strict";
2
- /**
3
- * Base codec emitter (decode): base93 blob -> TypeScript `number`, C++ `uint16_t`.
4
- *
5
- * This reverses the standalone `uint16` encoder by decoding 3 base93 characters
6
- * to 2 bytes and reading them through `Uint16Array` / `uint16_t`. The wire
7
- * contract is intentionally identical to `quint16`, while descriptor identity
8
- * remains distinct for downstream code generation and C++ type selection.
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.decoderEmitter = exports.descriptor = void 0;
12
- const comments_1 = require("../shared/comments");
13
- const fixedwidth_1 = require("../shared/fixedwidth");
14
- const encoder_1 = require("./encoder");
15
- Object.defineProperty(exports, "descriptor", { enumerable: true, get: function () { return encoder_1.descriptor; } });
16
- const fixedWidth = encoder_1.descriptor.fixedWidth;
17
- const strategyComment = (0, comments_1.emitStrategyComment)("Base codec emitter (decode): AnQst.Type.uint16 / uint16_t", [
18
- "Base93-decodes the standalone payload to 2 bytes, then reads them through Uint16Array or uint16_t.",
19
- "Returns the JavaScript number represented by the unsigned 16-bit host-endian byte pair.",
20
- "Accepts the same 3-character wires as quint16 because the byte-level wire format is deliberately identical."
21
- ]);
22
- exports.decoderEmitter = {
23
- descriptor: encoder_1.descriptor,
24
- emitTsDecoder() {
25
- return `${strategyComment}\n\n${(0, fixedwidth_1.emitTsFixedWidthStandaloneDecoder)("decodeUint16Standalone", fixedWidth)}`;
26
- },
27
- emitCppDecoder() {
28
- return `${strategyComment}\n\n${(0, fixedwidth_1.emitCppFixedWidthStandaloneDecoder)("decodeUint16Standalone", fixedWidth)}`;
29
- }
30
- };
@@ -1,42 +0,0 @@
1
- "use strict";
2
- /**
3
- * Base codec emitter (encode): `AnQst.Type.uint16` -> TypeScript `number`, C++ `uint16_t`.
4
- *
5
- * This codec is wire-identical to `AnQst.Type.quint16`: a fixed-width unsigned
6
- * 16-bit scalar written through `Uint16Array`, preserving the platform-native
7
- * 2-byte layout before base93-encoding it to a 3-character standalone string.
8
- * The distinction is preserved only in descriptor metadata and emitted C++
9
- * mapping (`uint16_t` instead of `quint16`).
10
- */
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.encoderEmitter = exports.descriptor = void 0;
13
- const comments_1 = require("../shared/comments");
14
- const fixedwidth_1 = require("../shared/fixedwidth");
15
- const fixedWidth = {
16
- byteWidth: 2,
17
- tsViewCtor: "Uint16Array",
18
- cppType: "uint16_t"
19
- };
20
- exports.descriptor = {
21
- codecId: "AnQst.Type.uint16",
22
- specPath: "RefinedSpecs/Codecs/Integer_uint16_Codec.md",
23
- tsType: "number",
24
- cppType: "uint16_t",
25
- wireCategory: "fixed-width-scalar",
26
- strategySummary: "Wire-identical to quint16: 2-byte unsigned scalar via Uint16Array / memcpy into uint16_t, base93-encoded as a 3-character standalone string.",
27
- fixedWidth
28
- };
29
- const strategyComment = (0, comments_1.emitStrategyComment)("Base codec emitter (encode): AnQst.Type.uint16 / uint16_t", [
30
- "Uses Uint16Array so TypeScript follows the uint16/quint16 prose for unsigned 16-bit host-endian bytes.",
31
- "Emits exactly 3 base93 characters because the standalone payload is always 2 bytes wide.",
32
- "C++ encoder memcpy-copies uint16_t into the same 2-byte payload, keeping the wire identical to quint16."
33
- ]);
34
- exports.encoderEmitter = {
35
- descriptor: exports.descriptor,
36
- emitTsEncoder() {
37
- return `${strategyComment}\n\n${(0, fixedwidth_1.emitTsFixedWidthStandaloneEncoder)("encodeUint16Standalone", fixedWidth)}`;
38
- },
39
- emitCppEncoder() {
40
- return `${strategyComment}\n\n${(0, fixedwidth_1.emitCppFixedWidthStandaloneEncoder)("encodeUint16Standalone", fixedWidth)}`;
41
- }
42
- };
@@ -1,31 +0,0 @@
1
- "use strict";
2
- /**
3
- * Base codec emitter (decode): base93 blob -> TypeScript `number`, C++ `uint32_t`.
4
- *
5
- * This reverses the standalone `uint32` encoder by decoding 5 base93 characters
6
- * to 4 bytes and reading them through `Uint32Array` / `uint32_t`. The wire
7
- * contract is intentionally identical to `quint32`, while descriptor identity
8
- * remains distinct for downstream code generation and C++ type selection.
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.decoder = exports.decoderEmitter = exports.descriptor = void 0;
12
- const comments_1 = require("../shared/comments");
13
- const fixedwidth_1 = require("../shared/fixedwidth");
14
- const encoder_1 = require("./encoder");
15
- Object.defineProperty(exports, "descriptor", { enumerable: true, get: function () { return encoder_1.descriptor; } });
16
- const fixedWidth = encoder_1.descriptor.fixedWidth;
17
- const strategyComment = (0, comments_1.emitStrategyComment)("Base codec emitter (decode): AnQst.Type.uint32 / uint32_t", [
18
- "Base93-decodes the standalone payload to 4 bytes, then reads them through Uint32Array or uint32_t.",
19
- "Returns the JavaScript number represented by the unsigned 32-bit host-endian byte sequence.",
20
- "Accepts the same 5-character wires as quint32 because the byte-level wire format is deliberately identical."
21
- ]);
22
- exports.decoderEmitter = {
23
- descriptor: encoder_1.descriptor,
24
- emitTsDecoder() {
25
- return `${strategyComment}\n\n${(0, fixedwidth_1.emitTsFixedWidthStandaloneDecoder)("decodeUint32Standalone", fixedWidth)}`;
26
- },
27
- emitCppDecoder() {
28
- return `${strategyComment}\n\n${(0, fixedwidth_1.emitCppFixedWidthStandaloneDecoder)("decodeUint32Standalone", fixedWidth)}`;
29
- }
30
- };
31
- exports.decoder = exports.decoderEmitter;
@@ -1,43 +0,0 @@
1
- "use strict";
2
- /**
3
- * Base codec emitter (encode): `AnQst.Type.uint32` -> TypeScript `number`, C++ `uint32_t`.
4
- *
5
- * This codec is wire-identical to `AnQst.Type.quint32`: a fixed-width unsigned
6
- * 32-bit scalar written through `Uint32Array`, preserving the platform-native
7
- * 4-byte layout before base93-encoding it to a 5-character standalone string.
8
- * The distinction is preserved only in descriptor metadata and emitted C++
9
- * mapping (`uint32_t` instead of `quint32`).
10
- */
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.encoder = exports.encoderEmitter = exports.descriptor = void 0;
13
- const comments_1 = require("../shared/comments");
14
- const fixedwidth_1 = require("../shared/fixedwidth");
15
- const fixedWidth = {
16
- byteWidth: 4,
17
- tsViewCtor: "Uint32Array",
18
- cppType: "uint32_t"
19
- };
20
- exports.descriptor = {
21
- codecId: "AnQst.Type.uint32",
22
- specPath: "RefinedSpecs/Codecs/Integer_uint32_Codec.md",
23
- tsType: "number",
24
- cppType: "uint32_t",
25
- wireCategory: "fixed-width-scalar",
26
- strategySummary: "Wire-identical to quint32: 4-byte unsigned scalar via Uint32Array / memcpy into uint32_t, base93-encoded as a 5-character standalone string.",
27
- fixedWidth
28
- };
29
- const strategyComment = (0, comments_1.emitStrategyComment)("Base codec emitter (encode): AnQst.Type.uint32 / uint32_t", [
30
- "Uses Uint32Array so TypeScript follows the uint32/quint32 prose for unsigned 32-bit host-endian bytes.",
31
- "Emits exactly 5 base93 characters because the standalone payload is always 4 bytes wide.",
32
- "C++ encoder memcpy-copies uint32_t into the same 4-byte payload, keeping the wire identical to quint32."
33
- ]);
34
- exports.encoderEmitter = {
35
- descriptor: exports.descriptor,
36
- emitTsEncoder() {
37
- return `${strategyComment}\n\n${(0, fixedwidth_1.emitTsFixedWidthStandaloneEncoder)("encodeUint32Standalone", fixedWidth)}`;
38
- },
39
- emitCppEncoder() {
40
- return `${strategyComment}\n\n${(0, fixedwidth_1.emitCppFixedWidthStandaloneEncoder)("encodeUint32Standalone", fixedWidth)}`;
41
- }
42
- };
43
- exports.encoder = exports.encoderEmitter;
@@ -1,30 +0,0 @@
1
- "use strict";
2
- /**
3
- * Base codec emitter (decode): base93 blob -> TypeScript `number`, C++ `uint8_t`.
4
- *
5
- * This reverses the standalone `uint8` encoder by decoding 2 base93 characters
6
- * to one byte and reading that byte through `Uint8Array` / `uint8_t`. The wire
7
- * contract is identical to `quint8`, while the descriptor keeps the `uint8_t`
8
- * identity for downstream code generation.
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.decoder = exports.descriptor = void 0;
12
- const comments_1 = require("../shared/comments");
13
- const fixedwidth_1 = require("../shared/fixedwidth");
14
- const encoder_1 = require("./encoder");
15
- Object.defineProperty(exports, "descriptor", { enumerable: true, get: function () { return encoder_1.descriptor; } });
16
- const fixedWidth = encoder_1.descriptor.fixedWidth;
17
- const strategyComment = (0, comments_1.emitStrategyComment)("Base codec emitter (decode): AnQst.Type.uint8 / uint8_t", [
18
- "Base93-decodes the standalone payload to one byte, then reads it through Uint8Array or uint8_t.",
19
- "Returns a JS number in the unsigned 0-255 domain described by the uint8 spec.",
20
- "Accepts the same 2-character wire strings as quint8 because the wire format is intentionally identical."
21
- ]);
22
- exports.decoder = {
23
- descriptor: encoder_1.descriptor,
24
- emitTsDecoder() {
25
- return `${strategyComment}\n\n${(0, fixedwidth_1.emitTsFixedWidthStandaloneDecoder)("decodeUint8Standalone", fixedWidth)}`;
26
- },
27
- emitCppDecoder() {
28
- return `${strategyComment}\n\n${(0, fixedwidth_1.emitCppFixedWidthStandaloneDecoder)("decodeUint8Standalone", fixedWidth)}`;
29
- }
30
- };
@@ -1,40 +0,0 @@
1
- "use strict";
2
- /**
3
- * Base codec emitter (encode): `AnQst.Type.uint8` -> TypeScript `number`, C++ `uint8_t`.
4
- *
5
- * This codec is wire-identical to `AnQst.Type.quint8`: a single unsigned byte
6
- * encoded as a 2-character base93 string. The distinction is preserved only in
7
- * descriptor metadata and the emitted C++ type mapping (`uint8_t` vs `quint8`).
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.encoder = exports.descriptor = void 0;
11
- const comments_1 = require("../shared/comments");
12
- const fixedwidth_1 = require("../shared/fixedwidth");
13
- const fixedWidth = {
14
- byteWidth: 1,
15
- tsViewCtor: "Uint8Array",
16
- cppType: "uint8_t"
17
- };
18
- exports.descriptor = {
19
- codecId: "AnQst.Type.uint8",
20
- specPath: "RefinedSpecs/Codecs/Integer_uint8_Codec.md",
21
- tsType: "number",
22
- cppType: "uint8_t",
23
- wireCategory: "fixed-width-scalar",
24
- strategySummary: "Single unsigned byte via Uint8Array / memcpy into uint8_t, base93 standalone string (2 chars); wire-identical to quint8 but descriptor/C++ mapping remain distinct.",
25
- fixedWidth
26
- };
27
- const strategyComment = (0, comments_1.emitStrategyComment)("Base codec emitter (encode): AnQst.Type.uint8 / uint8_t", [
28
- "Uses Uint8Array for the 1-byte unsigned representation on the TS side.",
29
- "Uses std::memcpy into uint8_t on the C++ side for the same single-byte payload.",
30
- "Produces the same 2-character base93 wire form as quint8; only descriptor and C++ typedef mapping differ."
31
- ]);
32
- exports.encoder = {
33
- descriptor: exports.descriptor,
34
- emitTsEncoder() {
35
- return `${strategyComment}\n\n${(0, fixedwidth_1.emitTsFixedWidthStandaloneEncoder)("encodeUint8Standalone", fixedWidth)}`;
36
- },
37
- emitCppEncoder() {
38
- return `${strategyComment}\n\n${(0, fixedwidth_1.emitCppFixedWidthStandaloneEncoder)("encodeUint8Standalone", fixedWidth)}`;
39
- }
40
- };
@@ -1,26 +0,0 @@
1
- "use strict";
2
- /**
3
- * Base codec emitter (decode): base93 blob → TypeScript `number`, C++ `double`.
4
- * Reconstructs IEEE 754 binary64 from eight decoded bytes (platform-native order).
5
- * See RefinedSpecs/Codecs/Number_number_Codec.md and AnQst-Opaque-Wire-Contract.md §6.4.
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.numberDecoderEmitter = exports.descriptor = void 0;
9
- const comments_1 = require("../shared/comments");
10
- const fixedwidth_1 = require("../shared/fixedwidth");
11
- const encoder_1 = require("./encoder");
12
- Object.defineProperty(exports, "descriptor", { enumerable: true, get: function () { return encoder_1.descriptor; } });
13
- const strategyComment = (0, comments_1.emitStrategyComment)("Base codec emitter (decode): AnQst.Type.number / double", [
14
- "Decodes base93 to bytes, then Float64Array (TS) or std::memcpy (C++).",
15
- "Expects base93Decode in scope; standalone payloads are exactly 10 characters.",
16
- "Round-trips all IEEE special values and distinct NaN payloads when produced by the encoder."
17
- ]);
18
- exports.numberDecoderEmitter = {
19
- descriptor: encoder_1.descriptor,
20
- emitTsDecoder() {
21
- return `${strategyComment}\n\n${(0, fixedwidth_1.emitTsFixedWidthStandaloneDecoder)("decodeAnQstNumber", encoder_1.descriptor.fixedWidth)}`;
22
- },
23
- emitCppDecoder() {
24
- return `${strategyComment}\n\n${(0, fixedwidth_1.emitCppFixedWidthStandaloneDecoder)("decodeAnQstNumber", encoder_1.descriptor.fixedWidth)}`;
25
- }
26
- };
@@ -1,38 +0,0 @@
1
- "use strict";
2
- /**
3
- * Base codec emitter (encode): AnQst.Type.number ↔ TypeScript `number`, C++ `double`.
4
- * Standalone wire shape is one base93 string of length 10 (8 IEEE 754 binary64 bytes).
5
- * See RefinedSpecs/Codecs/Number_number_Codec.md and AnQst-Codec-Design-Principles.md §4.
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.numberEncoderEmitter = exports.descriptor = void 0;
9
- const comments_1 = require("../shared/comments");
10
- const fixedwidth_1 = require("../shared/fixedwidth");
11
- const fixedWidth = {
12
- byteWidth: 8,
13
- tsViewCtor: "Float64Array",
14
- cppType: "double"
15
- };
16
- exports.descriptor = {
17
- codecId: "AnQst.Type.number",
18
- specPath: "RefinedSpecs/Codecs/Number_number_Codec.md",
19
- tsType: "number",
20
- cppType: "double",
21
- wireCategory: "fixed-width-scalar",
22
- strategySummary: "IEEE 754 binary64: 8 platform-native bytes packed via base93 (10 characters standalone).",
23
- fixedWidth
24
- };
25
- const strategyComment = (0, comments_1.emitStrategyComment)("Base codec emitter (encode): AnQst.Type.number / double", [
26
- "Uses Float64Array (TS) or std::memcpy (C++) for platform-native IEEE 754 bytes.",
27
- "Emits base93 via shared fixed-width standalone helper (expects base93Encode in scope).",
28
- "Preserves all bit patterns including ±0, NaN, ±Infinity, subnormals."
29
- ]);
30
- exports.numberEncoderEmitter = {
31
- descriptor: exports.descriptor,
32
- emitTsEncoder() {
33
- return `${strategyComment}\n\n${(0, fixedwidth_1.emitTsFixedWidthStandaloneEncoder)("encodeAnQstNumber", fixedWidth)}`;
34
- },
35
- emitCppEncoder() {
36
- return `${strategyComment}\n\n${(0, fixedwidth_1.emitCppFixedWidthStandaloneEncoder)("encodeAnQstNumber", fixedWidth)}`;
37
- }
38
- };
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.emitStrategyComment = emitStrategyComment;
4
- function emitStrategyComment(title, bullets) {
5
- const lines = [
6
- "/**",
7
- ` * ${title}`,
8
- " *",
9
- ...bullets.map((bullet) => ` * - ${bullet}`),
10
- " */"
11
- ];
12
- return lines.join("\n");
13
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,53 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.emitTsFixedWidthStandaloneEncoder = emitTsFixedWidthStandaloneEncoder;
4
- exports.emitTsFixedWidthStandaloneDecoder = emitTsFixedWidthStandaloneDecoder;
5
- exports.emitCppFixedWidthStandaloneEncoder = emitCppFixedWidthStandaloneEncoder;
6
- exports.emitCppFixedWidthStandaloneDecoder = emitCppFixedWidthStandaloneDecoder;
7
- function tsScalarBufferInit(descriptor, valueExpr) {
8
- return [
9
- `const buf = new ArrayBuffer(${descriptor.byteWidth});`,
10
- `new ${descriptor.tsViewCtor}(buf)[0] = ${valueExpr};`,
11
- "const bytes = new Uint8Array(buf);"
12
- ];
13
- }
14
- function tsScalarBufferRead(descriptor, bytesExpr) {
15
- return [
16
- `const buf = new ArrayBuffer(${descriptor.byteWidth});`,
17
- `new Uint8Array(buf).set(${bytesExpr});`,
18
- `return new ${descriptor.tsViewCtor}(buf)[0];`
19
- ];
20
- }
21
- function emitTsFixedWidthStandaloneEncoder(functionName, descriptor, valueExpr = "value") {
22
- const lines = [
23
- `function ${functionName}(value) {`,
24
- ...tsScalarBufferInit(descriptor, valueExpr).map((line) => ` ${line}`),
25
- " return base93Encode(bytes);",
26
- "}"
27
- ];
28
- return lines.join("\n");
29
- }
30
- function emitTsFixedWidthStandaloneDecoder(functionName, descriptor) {
31
- const lines = [
32
- `function ${functionName}(encoded) {`,
33
- " const bytes = base93Decode(encoded);",
34
- ...tsScalarBufferRead(descriptor, "bytes").map((line) => ` ${line}`),
35
- "}"
36
- ];
37
- return lines.join("\n");
38
- }
39
- function emitCppFixedWidthStandaloneEncoder(functionName, descriptor) {
40
- return `inline std::string ${functionName}(const ${descriptor.cppType}& value) {
41
- std::array<std::uint8_t, ${descriptor.byteWidth}> bytes{};
42
- std::memcpy(bytes.data(), &value, ${descriptor.byteWidth});
43
- return base93Encode(std::vector<std::uint8_t>(bytes.begin(), bytes.end()));
44
- }`;
45
- }
46
- function emitCppFixedWidthStandaloneDecoder(functionName, descriptor) {
47
- return `inline ${descriptor.cppType} ${functionName}(const std::string& encoded) {
48
- const std::vector<std::uint8_t> bytes = base93Decode(encoded);
49
- ${descriptor.cppType} value{};
50
- std::memcpy(&value, bytes.data(), ${descriptor.byteWidth});
51
- return value;
52
- }`;
53
- }
@@ -1,21 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./comments"), exports);
18
- __exportStar(require("./contracts"), exports);
19
- __exportStar(require("./fixedwidth"), exports);
20
- __exportStar(require("./positionalBase93"), exports);
21
- __exportStar(require("./rawbytes"), exports);
@@ -1,48 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.emitPositionalBase93CountEncoder = emitPositionalBase93CountEncoder;
4
- exports.emitPositionalBase93CountDecoder = emitPositionalBase93CountDecoder;
5
- exports.emitPositionalBase93CountCppFunctions = emitPositionalBase93CountCppFunctions;
6
- const base93_1 = require("../../../base93");
7
- function emitPositionalBase93CountEncoder(functionName = "encodeBase93Count") {
8
- return `function ${functionName}(value) {
9
- var A = "${base93_1.BASE93_ALPHABET}", v = value >>> 0, out = "";
10
- if (v === 0) return A[0];
11
- while (v > 0) {
12
- out = A[v % 93] + out;
13
- v = (v / 93) | 0;
14
- }
15
- return out;
16
- }`;
17
- }
18
- function emitPositionalBase93CountDecoder(functionName = "decodeBase93Count") {
19
- return `function ${functionName}(value) {
20
- var n = value.length, acc = 0, i, c;
21
- for (i = 0; i < n; i++) {
22
- c = value.charCodeAt(i);
23
- acc = acc * 93 + c - 32 - (c > 34) - (c > 92);
24
- }
25
- return acc >>> 0;
26
- }`;
27
- }
28
- function emitPositionalBase93CountCppFunctions() {
29
- return `inline std::string encodeBase93Count(std::uint32_t value) {
30
- static constexpr char A[] = "${base93_1.BASE93_ALPHABET}";
31
- if (value == 0u) return std::string(1, A[0]);
32
- std::string out;
33
- while (value > 0u) {
34
- out.insert(out.begin(), A[value % 93u]);
35
- value /= 93u;
36
- }
37
- return out;
38
- }
39
-
40
- inline std::uint32_t decodeBase93Count(const std::string& value) {
41
- std::uint32_t acc = 0;
42
- for (char c : value) {
43
- const unsigned char uc = static_cast<unsigned char>(c);
44
- acc = acc * 93u + static_cast<std::uint32_t>(uc - 32 - (uc > 34) - (uc > 92));
45
- }
46
- return acc;
47
- }`;
48
- }
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.emitTsRawByteStandaloneEncoder = emitTsRawByteStandaloneEncoder;
4
- exports.emitTsRawByteStandaloneDecoder = emitTsRawByteStandaloneDecoder;
5
- exports.emitCppRawByteStandaloneEncoder = emitCppRawByteStandaloneEncoder;
6
- exports.emitCppRawByteStandaloneDecoder = emitCppRawByteStandaloneDecoder;
7
- function emitTsRawByteStandaloneEncoder(functionName, valueToBytesExpr) {
8
- return `function ${functionName}(value) {
9
- const bytes = ${valueToBytesExpr};
10
- return base93Encode(bytes);
11
- }`;
12
- }
13
- function emitTsRawByteStandaloneDecoder(functionName, bytesToValueExpr) {
14
- return `function ${functionName}(encoded) {
15
- const bytes = base93Decode(encoded);
16
- return ${bytesToValueExpr};
17
- }`;
18
- }
19
- function emitCppRawByteStandaloneEncoder(functionName, valueToBytesExpr) {
20
- return `inline std::string ${functionName}(const QByteArray& value) {
21
- const std::vector<std::uint8_t> bytes = ${valueToBytesExpr};
22
- return base93Encode(bytes);
23
- }`;
24
- }
25
- function emitCppRawByteStandaloneDecoder(functionName, bytesToValueExpr) {
26
- return `inline QByteArray ${functionName}(const std::string& encoded) {
27
- const std::vector<std::uint8_t> bytes = base93Decode(encoded);
28
- return ${bytesToValueExpr};
29
- }`;
30
- }
@@ -1,43 +0,0 @@
1
- "use strict";
2
- /**
3
- * AnQstGen base-type codec emitter for `AnQst.Type.string`.
4
- * Decoder is leaf identity: the JSON string value is the domain string. See RefinedSpecs/Codecs/String_string_Codec.md.
5
- * C++ integration uses QVariant::toString() / QJsonValue::toString(); portable stubs below use std::string for tests without Qt.
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.decoder = exports.descriptor = void 0;
9
- const comments_1 = require("../shared/comments");
10
- exports.descriptor = {
11
- codecId: "string",
12
- specPath: "RefinedSpecs/Codecs/String_string_Codec.md",
13
- tsType: "string",
14
- cppType: "QString",
15
- wireCategory: "string",
16
- strategySummary: "Native JSON string; leaf identity encode/decode; no base93."
17
- };
18
- const TS_FN = "decodeAnqstBase_string";
19
- const CPP_FN = "decodeAnqstBase_string";
20
- exports.decoder = {
21
- descriptor: exports.descriptor,
22
- emitTsDecoder() {
23
- return [
24
- (0, comments_1.emitStrategyComment)("AnQst string decoder (identity)", [
25
- "Interprets the wire JSON string as the domain value; no transform.",
26
- "No base93 decode path for string positions."
27
- ]),
28
- `function ${TS_FN}(wire) {`,
29
- " return wire;",
30
- "}"
31
- ].join("\n");
32
- },
33
- emitCppDecoder() {
34
- return [
35
- (0, comments_1.emitStrategyComment)("AnQst string decoder (identity, portable stub)", [
36
- "QString via QJsonValue::toString() at integration; std::string passthrough here for generator tests without Qt."
37
- ]),
38
- `inline std::string ${CPP_FN}(const std::string& wire) {`,
39
- " return wire;",
40
- "}"
41
- ].join("\n");
42
- }
43
- };
@@ -1,43 +0,0 @@
1
- "use strict";
2
- /**
3
- * AnQstGen base-type codec emitter for `AnQst.Type.string`.
4
- * Wire form is a native JSON string (no base93). See RefinedSpecs/Codecs/String_string_Codec.md.
5
- * Integration codegen maps the C++ domain type to QString / QJsonValue; standalone C++ snippets here use std::string so unit tests compile without Qt.
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.encoder = exports.descriptor = void 0;
9
- const comments_1 = require("../shared/comments");
10
- exports.descriptor = {
11
- codecId: "string",
12
- specPath: "RefinedSpecs/Codecs/String_string_Codec.md",
13
- tsType: "string",
14
- cppType: "QString",
15
- wireCategory: "string",
16
- strategySummary: "Native JSON string; leaf identity encode/decode; no base93."
17
- };
18
- const TS_FN = "encodeAnqstBase_string";
19
- const CPP_FN = "encodeAnqstBase_string";
20
- exports.encoder = {
21
- descriptor: exports.descriptor,
22
- emitTsEncoder() {
23
- return [
24
- (0, comments_1.emitStrategyComment)("AnQst string encoder (identity)", [
25
- "Emits the domain string unchanged for placement in JSON (native string on the wire).",
26
- "No base93; JSON serializers handle escaping of quotes, backslashes, and controls."
27
- ]),
28
- `function ${TS_FN}(value) {`,
29
- " return value;",
30
- "}"
31
- ].join("\n");
32
- },
33
- emitCppEncoder() {
34
- return [
35
- (0, comments_1.emitStrategyComment)("AnQst string encoder (identity, portable stub)", [
36
- "QString / QJsonValue(value) at widget integration; std::string here for generator tests without Qt."
37
- ]),
38
- `inline std::string ${CPP_FN}(const std::string& value) {`,
39
- " return value;",
40
- "}"
41
- ].join("\n");
42
- }
43
- };