@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,52 +0,0 @@
1
- "use strict";
2
- /**
3
- * Base codec emitter: `AnQst.Type.int32Array` encoder.
4
- * Emits the visible `Int32Array` view window as standalone raw-byte base93 while
5
- * preserving signed bit patterns and portable `QByteArray` interop on the C++ side.
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.encoder = exports.encoderEmitter = exports.descriptor = void 0;
9
- const comments_1 = require("../shared/comments");
10
- exports.descriptor = {
11
- codecId: "binary-int32Array",
12
- specPath: "RefinedSpecs/Codecs/Binary_int32Array_Codec.md",
13
- tsType: "Int32Array",
14
- cppType: "QByteArray",
15
- wireCategory: "binary",
16
- strategySummary: "Base93-encode the raw bytes of the visible Int32Array view; decode reconstructs a concrete Int32Array, while C++ interoperates through the same QByteArray raw-byte payload."
17
- };
18
- const TS_FN = "encodeBinaryInt32ArrayStandalone";
19
- const CPP_FN = "encodeBinaryInt32ArrayStandalone";
20
- exports.encoderEmitter = {
21
- descriptor: exports.descriptor,
22
- emitTsEncoder() {
23
- return [
24
- (0, comments_1.emitStrategyComment)("AnQst Int32Array encoder (raw-byte base93)", [
25
- "Encodes only the active Int32Array view window via byteOffset/byteLength so subviews do not leak adjacent backing-buffer bytes.",
26
- "Signed values are transported as their raw stored bytes with no reinterpretation, normalization, or byte swapping.",
27
- "Wire bytes remain portable because the C++ side consumes and emits the same QByteArray byte sequence."
28
- ]),
29
- `function ${TS_FN}(value) {`,
30
- " const bytes = new Uint8Array(value.buffer, value.byteOffset, value.byteLength);",
31
- " return base93Encode(bytes);",
32
- "}"
33
- ].join("\n");
34
- },
35
- emitCppEncoder() {
36
- return [
37
- (0, comments_1.emitStrategyComment)("AnQst Int32Array encoder (QByteArray raw bytes)", [
38
- "Host-side integration passes Int32Array storage as QByteArray so the byte transport stays identical across TypeScript and C++.",
39
- "No sign conversion or endianness adjustment is applied; the stored bytes are forwarded unchanged into base93.",
40
- "Uses an explicit copy so portable test shims only need QByteArray::constData() and QByteArray::size()."
41
- ]),
42
- `inline std::string ${CPP_FN}(const QByteArray& value) {`,
43
- " std::vector<std::uint8_t> bytes(static_cast<std::size_t>(value.size()));",
44
- " if (!bytes.empty()) {",
45
- " std::memcpy(bytes.data(), value.constData(), bytes.size());",
46
- " }",
47
- " return base93Encode(bytes);",
48
- "}"
49
- ].join("\n");
50
- }
51
- };
52
- exports.encoder = exports.encoderEmitter;
@@ -1,38 +0,0 @@
1
- "use strict";
2
- /**
3
- * Base codec emitter (decode): base93 blob → TypeScript `Int8Array`, C++ `QByteArray`.
4
- * Reconstructs raw bytes with base93Decode, then reinterprets the backing buffer as Int8Array.
5
- * The wire format is identical to the buffer and typedArray binary codecs.
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.binaryInt8ArrayDecoderEmitter = exports.descriptor = void 0;
9
- const comments_1 = require("../shared/comments");
10
- const encoder_1 = require("./encoder");
11
- Object.defineProperty(exports, "descriptor", { enumerable: true, get: function () { return encoder_1.descriptor; } });
12
- const strategyComment = (0, comments_1.emitStrategyComment)("Base codec emitter (decode): AnQst.Type.int8Array / QByteArray", [
13
- "Decodes base93 into raw bytes, then reconstructs Int8Array with new Int8Array(bytes.buffer).",
14
- "Preserves signed byte patterns because the underlying bytes are transported unchanged.",
15
- "C++ side rebuilds a QByteArray from the decoded byte vector using the same wire contract."
16
- ]);
17
- exports.binaryInt8ArrayDecoderEmitter = {
18
- descriptor: encoder_1.descriptor,
19
- emitTsDecoder() {
20
- return `${strategyComment}
21
-
22
- function decodeAnQstBinaryInt8Array(encoded) {
23
- const bytes = base93Decode(encoded);
24
- return new Int8Array(bytes.buffer);
25
- }`;
26
- },
27
- emitCppDecoder() {
28
- return `${strategyComment}
29
-
30
- inline QByteArray decodeAnQstBinaryInt8Array(const std::string& encoded) {
31
- const std::vector<std::uint8_t> bytes = base93Decode(encoded);
32
- return QByteArray(
33
- reinterpret_cast<const char*>(bytes.data()),
34
- static_cast<int>(bytes.size())
35
- );
36
- }`;
37
- }
38
- };
@@ -1,44 +0,0 @@
1
- "use strict";
2
- /**
3
- * Base codec emitter (encode): AnQst.Type.int8Array ↔ TypeScript `Int8Array`, C++ `QByteArray`.
4
- * Serializes the raw bytes of the Int8Array view with base93, preserving byteOffset/byteLength.
5
- * Wire format matches the buffer and typedArray binary codecs; only the TS view type differs.
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.binaryInt8ArrayEncoderEmitter = exports.descriptor = void 0;
9
- const comments_1 = require("../shared/comments");
10
- exports.descriptor = {
11
- codecId: "AnQst.Type.int8Array",
12
- specPath: "RefinedSpecs/Codecs/Binary_int8Array_Codec.md",
13
- tsType: "Int8Array",
14
- cppType: "QByteArray",
15
- wireCategory: "binary",
16
- strategySummary: "Serialize the raw bytes of the Int8Array view as base93, respecting byteOffset/byteLength and preserving signed byte bit patterns."
17
- };
18
- const strategyComment = (0, comments_1.emitStrategyComment)("Base codec emitter (encode): AnQst.Type.int8Array / QByteArray", [
19
- "Views Int8Array as Uint8Array over the same buffer slice so only the active view bytes are emitted.",
20
- "Uses the shared base93 binary transport contract; signed byte interpretation is irrelevant on the wire.",
21
- "C++ side mirrors this as raw QByteArray bytes encoded with the same base93 algorithm."
22
- ]);
23
- exports.binaryInt8ArrayEncoderEmitter = {
24
- descriptor: exports.descriptor,
25
- emitTsEncoder() {
26
- return `${strategyComment}
27
-
28
- function encodeAnQstBinaryInt8Array(value) {
29
- const bytes = new Uint8Array(value.buffer, value.byteOffset, value.byteLength);
30
- return base93Encode(bytes);
31
- }`;
32
- },
33
- emitCppEncoder() {
34
- return `${strategyComment}
35
-
36
- inline std::string encodeAnQstBinaryInt8Array(const QByteArray& value) {
37
- const auto* begin = reinterpret_cast<const std::uint8_t*>(value.constData());
38
- return base93Encode(std::vector<std::uint8_t>(
39
- begin,
40
- begin + static_cast<std::size_t>(value.size())
41
- ));
42
- }`;
43
- }
44
- };
@@ -1,33 +0,0 @@
1
- "use strict";
2
- /**
3
- * Base codec emitter: `AnQst.Type.typedArray` decoder.
4
- * Decoding requires a concrete TypedArray constructor because abstract `TypedArray`
5
- * alone does not identify element width or the runtime view type to reconstruct.
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.decoderEmitter = exports.descriptor = void 0;
9
- const comments_1 = require("../shared/comments");
10
- const rawbytes_1 = require("../shared/rawbytes");
11
- const encoder_1 = require("./encoder");
12
- Object.defineProperty(exports, "descriptor", { enumerable: true, get: function () { return encoder_1.descriptor; } });
13
- const TS_FN = "decodeBinaryTypedArrayStandalone";
14
- const CPP_FN = "decodeBinaryTypedArrayStandalone";
15
- const strategyComment = (0, comments_1.emitStrategyComment)("Base codec emitter (decode): AnQst.Type.typedArray / QByteArray", [
16
- "Base93-decodes the standalone raw-byte payload back to a Uint8Array of bytes.",
17
- "The emitted TypeScript API requires a concrete typed-array constructor because abstract TypedArray is insufficient to reconstruct element width and view type.",
18
- "C++ rebuilds QByteArray directly because the backend mapping remains raw bytes."
19
- ]);
20
- exports.decoderEmitter = {
21
- descriptor: encoder_1.descriptor,
22
- emitTsDecoder() {
23
- return `${strategyComment}
24
-
25
- function ${TS_FN}(encoded, typedArrayCtor) {
26
- const bytes = base93Decode(encoded);
27
- return new typedArrayCtor(bytes.buffer);
28
- }`;
29
- },
30
- emitCppDecoder() {
31
- return `${strategyComment}\n\n${(0, rawbytes_1.emitCppRawByteStandaloneDecoder)(CPP_FN, "QByteArray(reinterpret_cast<const char*>(bytes.data()), static_cast<int>(bytes.size()))")}`;
32
- }
33
- };
@@ -1,34 +0,0 @@
1
- "use strict";
2
- /**
3
- * Base codec emitter: `AnQst.Type.typedArray` encoder.
4
- * Emits the active TypedArray view window as standalone base93 raw bytes.
5
- * The wire bytes match `buffer`; only the TypeScript domain type is a typed-array view.
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.encoderEmitter = exports.descriptor = void 0;
9
- const comments_1 = require("../shared/comments");
10
- const rawbytes_1 = require("../shared/rawbytes");
11
- exports.descriptor = {
12
- codecId: "binary-typedArray",
13
- specPath: "RefinedSpecs/Codecs/Binary_typedArray_Codec.md",
14
- tsType: "TypedArray",
15
- cppType: "QByteArray",
16
- wireCategory: "binary",
17
- strategySummary: "Encode the raw bytes of the active TypedArray view as standalone base93, preserving byteOffset/byteLength; decode requires a concrete typed-array constructor."
18
- };
19
- const TS_FN = "encodeBinaryTypedArrayStandalone";
20
- const CPP_FN = "encodeBinaryTypedArrayStandalone";
21
- const strategyComment = (0, comments_1.emitStrategyComment)("Base codec emitter (encode): AnQst.Type.typedArray / QByteArray", [
22
- "Wraps the incoming TypedArray view as Uint8Array(value.buffer, value.byteOffset, value.byteLength) so only the visible bytes are emitted.",
23
- "Wire format is identical to the buffer codec: one standalone base93 string carrying raw bytes.",
24
- "C++ treats QByteArray as an opaque byte buffer and copies its bytes into the shared base93 encoder."
25
- ]);
26
- exports.encoderEmitter = {
27
- descriptor: exports.descriptor,
28
- emitTsEncoder() {
29
- return `${strategyComment}\n\n${(0, rawbytes_1.emitTsRawByteStandaloneEncoder)(TS_FN, "new Uint8Array(value.buffer, value.byteOffset, value.byteLength)")}`;
30
- },
31
- emitCppEncoder() {
32
- return `${strategyComment}\n\n${(0, rawbytes_1.emitCppRawByteStandaloneEncoder)(CPP_FN, "std::vector<std::uint8_t>(reinterpret_cast<const std::uint8_t*>(value.constData()), reinterpret_cast<const std::uint8_t*>(value.constData()) + static_cast<std::size_t>(value.size()))")}`;
33
- }
34
- };
@@ -1,46 +0,0 @@
1
- "use strict";
2
- /**
3
- * AnQstGen base-type codec emitter for `binary-uint16Array`.
4
- * Decoder consumes one base93 string of raw bytes and reconstructs a concrete `Uint16Array`.
5
- * Multi-byte element byte order is preserved exactly as transmitted; no byte swapping is introduced.
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.decoder = exports.descriptor = void 0;
9
- const comments_1 = require("../shared/comments");
10
- const encoder_1 = require("./encoder");
11
- Object.defineProperty(exports, "descriptor", { enumerable: true, get: function () { return encoder_1.descriptor; } });
12
- const TS_FN = "decodeBinaryUint16ArrayStandalone";
13
- const CPP_FN = "decodeBinaryUint16ArrayStandalone";
14
- exports.decoder = {
15
- descriptor: encoder_1.descriptor,
16
- emitTsDecoder() {
17
- return [
18
- (0, comments_1.emitStrategyComment)("AnQst Uint16Array decoder (raw-byte base93)", [
19
- "Decodes base93 to bytes, then constructs a concrete Uint16Array over the decoded buffer.",
20
- "Rejected odd decoded byte counts indicate corrupted wire data because Uint16Array elements require 2 bytes each."
21
- ]),
22
- `function ${TS_FN}(encoded) {`,
23
- " const bytes = base93Decode(encoded);",
24
- " if ((bytes.byteLength & 1) !== 0) {",
25
- " throw new RangeError(\"Decoded Uint16Array byte length must be divisible by 2.\");",
26
- " }",
27
- " return new Uint16Array(bytes.buffer);",
28
- "}"
29
- ].join("\n");
30
- },
31
- emitCppDecoder() {
32
- return [
33
- (0, comments_1.emitStrategyComment)("AnQst Uint16Array decoder (QByteArray raw bytes)", [
34
- "C++ receives the raw bytes as QByteArray; element interpretation stays outside the byte-transport codec.",
35
- "Portable tests may supply a lightweight QByteArray shim with a (const char*, int) constructor."
36
- ]),
37
- `inline QByteArray ${CPP_FN}(const std::string& encoded) {`,
38
- " const std::vector<std::uint8_t> bytes = base93Decode(encoded);",
39
- " return QByteArray(",
40
- " reinterpret_cast<const char*>(bytes.data()),",
41
- " static_cast<int>(bytes.size())",
42
- " );",
43
- "}"
44
- ].join("\n");
45
- }
46
- };
@@ -1,49 +0,0 @@
1
- "use strict";
2
- /**
3
- * AnQstGen base-type codec emitter for `binary-uint16Array`.
4
- * Wire form is one base93 string carrying the raw bytes of a `Uint16Array` view.
5
- * The TypeScript path must respect `byteOffset`/`byteLength`; the C++ path keeps the spec-facing `QByteArray` signature.
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: "binary-uint16Array",
12
- specPath: "RefinedSpecs/Codecs/Binary_uint16Array_Codec.md",
13
- tsType: "Uint16Array",
14
- cppType: "QByteArray",
15
- wireCategory: "binary",
16
- strategySummary: "Base93-encode the raw bytes of the Uint16Array view (respecting byteOffset/byteLength); C++ receives the same raw bytes in QByteArray."
17
- };
18
- const TS_FN = "encodeBinaryUint16ArrayStandalone";
19
- const CPP_FN = "encodeBinaryUint16ArrayStandalone";
20
- exports.encoder = {
21
- descriptor: exports.descriptor,
22
- emitTsEncoder() {
23
- return [
24
- (0, comments_1.emitStrategyComment)("AnQst Uint16Array encoder (raw-byte base93)", [
25
- "Reads only the concrete view window via byteOffset/byteLength, so subviews do not leak adjacent buffer bytes.",
26
- "Preserves platform-native endianness by forwarding the raw stored bytes unchanged into base93."
27
- ]),
28
- `function ${TS_FN}(value) {`,
29
- " const bytes = new Uint8Array(value.buffer, value.byteOffset, value.byteLength);",
30
- " return base93Encode(bytes);",
31
- "}"
32
- ].join("\n");
33
- },
34
- emitCppEncoder() {
35
- return [
36
- (0, comments_1.emitStrategyComment)("AnQst Uint16Array encoder (QByteArray raw bytes)", [
37
- "Host-side integration passes the raw typed-array bytes as QByteArray; portable tests can provide a minimal QByteArray shim.",
38
- "No byte swapping is performed; the QByteArray contents are forwarded as-is into base93."
39
- ]),
40
- `inline std::string ${CPP_FN}(const QByteArray& value) {`,
41
- " std::vector<std::uint8_t> bytes(static_cast<std::size_t>(value.size()));",
42
- " if (!bytes.empty()) {",
43
- " std::memcpy(bytes.data(), value.constData(), bytes.size());",
44
- " }",
45
- " return base93Encode(bytes);",
46
- "}"
47
- ].join("\n");
48
- }
49
- };
@@ -1,46 +0,0 @@
1
- "use strict";
2
- /**
3
- * AnQstGen base-type codec emitter for `binary-uint32Array`.
4
- * Decoder consumes one base93 string of raw bytes and reconstructs a concrete `Uint32Array`.
5
- * Multi-byte element byte order is preserved exactly as transmitted; no byte swapping is introduced.
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.decoder = exports.descriptor = void 0;
9
- const comments_1 = require("../shared/comments");
10
- const encoder_1 = require("./encoder");
11
- Object.defineProperty(exports, "descriptor", { enumerable: true, get: function () { return encoder_1.descriptor; } });
12
- const TS_FN = "decodeBinaryUint32ArrayStandalone";
13
- const CPP_FN = "decodeBinaryUint32ArrayStandalone";
14
- exports.decoder = {
15
- descriptor: encoder_1.descriptor,
16
- emitTsDecoder() {
17
- return [
18
- (0, comments_1.emitStrategyComment)("AnQst Uint32Array decoder (raw-byte base93)", [
19
- "Decodes base93 to bytes, then constructs a concrete Uint32Array over the decoded buffer.",
20
- "Rejected non-multiple-of-4 decoded byte counts indicate corrupted wire data because Uint32Array elements require 4 bytes each."
21
- ]),
22
- `function ${TS_FN}(encoded) {`,
23
- " const bytes = base93Decode(encoded);",
24
- " if ((bytes.byteLength & 3) !== 0) {",
25
- ' throw new RangeError("Decoded Uint32Array byte length must be divisible by 4.");',
26
- " }",
27
- " return new Uint32Array(bytes.buffer);",
28
- "}"
29
- ].join("\n");
30
- },
31
- emitCppDecoder() {
32
- return [
33
- (0, comments_1.emitStrategyComment)("AnQst Uint32Array decoder (QByteArray raw bytes)", [
34
- "C++ receives the raw bytes as QByteArray; element interpretation stays outside the byte-transport codec.",
35
- "Portable tests may supply a lightweight QByteArray shim with a (const char*, int) constructor."
36
- ]),
37
- `inline QByteArray ${CPP_FN}(const std::string& encoded) {`,
38
- " const std::vector<std::uint8_t> bytes = base93Decode(encoded);",
39
- " return QByteArray(",
40
- " reinterpret_cast<const char*>(bytes.data()),",
41
- " static_cast<int>(bytes.size())",
42
- " );",
43
- "}"
44
- ].join("\n");
45
- }
46
- };
@@ -1,49 +0,0 @@
1
- "use strict";
2
- /**
3
- * AnQstGen base-type codec emitter for `binary-uint32Array`.
4
- * Wire form is one base93 string carrying the raw bytes of a `Uint32Array` view.
5
- * The TypeScript path must respect `byteOffset`/`byteLength`; the C++ path keeps the spec-facing `QByteArray` signature.
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: "binary-uint32Array",
12
- specPath: "RefinedSpecs/Codecs/Binary_uint32Array_Codec.md",
13
- tsType: "Uint32Array",
14
- cppType: "QByteArray",
15
- wireCategory: "binary",
16
- strategySummary: "Base93-encode the raw bytes of the Uint32Array view (respecting byteOffset/byteLength); C++ receives the same raw bytes in QByteArray."
17
- };
18
- const TS_FN = "encodeBinaryUint32ArrayStandalone";
19
- const CPP_FN = "encodeBinaryUint32ArrayStandalone";
20
- exports.encoder = {
21
- descriptor: exports.descriptor,
22
- emitTsEncoder() {
23
- return [
24
- (0, comments_1.emitStrategyComment)("AnQst Uint32Array encoder (raw-byte base93)", [
25
- "Reads only the concrete view window via byteOffset/byteLength, so subviews do not leak adjacent buffer bytes.",
26
- "Preserves platform-native endianness by forwarding the raw stored bytes unchanged into base93."
27
- ]),
28
- `function ${TS_FN}(value) {`,
29
- " const bytes = new Uint8Array(value.buffer, value.byteOffset, value.byteLength);",
30
- " return base93Encode(bytes);",
31
- "}"
32
- ].join("\n");
33
- },
34
- emitCppEncoder() {
35
- return [
36
- (0, comments_1.emitStrategyComment)("AnQst Uint32Array encoder (QByteArray raw bytes)", [
37
- "Host-side integration passes the raw typed-array bytes as QByteArray; portable tests can provide a minimal QByteArray shim.",
38
- "No byte swapping is performed; the QByteArray contents are forwarded as-is into base93."
39
- ]),
40
- `inline std::string ${CPP_FN}(const QByteArray& value) {`,
41
- " std::vector<std::uint8_t> bytes(static_cast<std::size_t>(value.size()));",
42
- " if (!bytes.empty()) {",
43
- " std::memcpy(bytes.data(), value.constData(), bytes.size());",
44
- " }",
45
- " return base93Encode(bytes);",
46
- "}"
47
- ].join("\n");
48
- }
49
- };
@@ -1,28 +0,0 @@
1
- "use strict";
2
- /**
3
- * Base codec emitter: `AnQst.Type.uint8Array` decoder.
4
- * Reconstructs the standalone raw-byte base93 payload directly as a concrete `Uint8Array`
5
- * and mirrors the QByteArray interop contract used by the buffer codec.
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.decoderEmitter = exports.descriptor = void 0;
9
- const comments_1 = require("../shared/comments");
10
- const rawbytes_1 = require("../shared/rawbytes");
11
- const encoder_1 = require("./encoder");
12
- Object.defineProperty(exports, "descriptor", { enumerable: true, get: function () { return encoder_1.descriptor; } });
13
- const TS_FN = "decodeBinaryUint8ArrayStandalone";
14
- const CPP_FN = "decodeBinaryUint8ArrayStandalone";
15
- const strategyComment = (0, comments_1.emitStrategyComment)("Base codec emitter (decode): AnQst.Type.uint8Array / QByteArray", [
16
- "Base93-decodes the standalone wire payload back to raw bytes with no structural wrapper.",
17
- "TypeScript returns the Uint8Array produced by base93Decode directly; no ArrayBuffer extraction or reinterpretation.",
18
- "C++ rebuilds a QByteArray from the decoded bytes for symmetry with the buffer codec's QByteArray mapping."
19
- ]);
20
- exports.decoderEmitter = {
21
- descriptor: encoder_1.descriptor,
22
- emitTsDecoder() {
23
- return `${strategyComment}\n\n${(0, rawbytes_1.emitTsRawByteStandaloneDecoder)(TS_FN, "bytes")}`;
24
- },
25
- emitCppDecoder() {
26
- return `${strategyComment}\n\n${(0, rawbytes_1.emitCppRawByteStandaloneDecoder)(CPP_FN, "QByteArray(reinterpret_cast<const char*>(bytes.data()), static_cast<int>(bytes.size()))")}`;
27
- }
28
- };
@@ -1,34 +0,0 @@
1
- "use strict";
2
- /**
3
- * Base codec emitter: `AnQst.Type.uint8Array` encoder.
4
- * Emits standalone raw-byte base93 for concrete `Uint8Array` values and mirrors the
5
- * same wire contract as `AnQst.Type.buffer`, but keeps the TypeScript domain type concrete.
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.encoderEmitter = exports.descriptor = void 0;
9
- const comments_1 = require("../shared/comments");
10
- const rawbytes_1 = require("../shared/rawbytes");
11
- exports.descriptor = {
12
- codecId: "binary-uint8Array",
13
- specPath: "RefinedSpecs/Codecs/Binary_uint8Array_Codec.md",
14
- tsType: "Uint8Array",
15
- cppType: "QByteArray",
16
- wireCategory: "binary",
17
- strategySummary: "Encode the concrete Uint8Array byte view as standalone base93 raw bytes; preserves offset views by encoding only the visible window."
18
- };
19
- const TS_FN = "encodeBinaryUint8ArrayStandalone";
20
- const CPP_FN = "encodeBinaryUint8ArrayStandalone";
21
- const strategyComment = (0, comments_1.emitStrategyComment)("Base codec emitter (encode): AnQst.Type.uint8Array / QByteArray", [
22
- "Standalone wire is the standard raw-byte base93 string used for AnQst binary codecs.",
23
- "TypeScript re-wraps the incoming Uint8Array with its byteOffset/byteLength so subarray views encode only the visible bytes.",
24
- "C++ treats QByteArray as an opaque byte buffer and copies its bytes into the shared base93 encoder."
25
- ]);
26
- exports.encoderEmitter = {
27
- descriptor: exports.descriptor,
28
- emitTsEncoder() {
29
- return `${strategyComment}\n\n${(0, rawbytes_1.emitTsRawByteStandaloneEncoder)(TS_FN, "new Uint8Array(value.buffer, value.byteOffset, value.byteLength)")}`;
30
- },
31
- emitCppEncoder() {
32
- return `${strategyComment}\n\n${(0, rawbytes_1.emitCppRawByteStandaloneEncoder)(CPP_FN, "std::vector<std::uint8_t>(reinterpret_cast<const std::uint8_t*>(value.constData()), reinterpret_cast<const std::uint8_t*>(value.constData()) + static_cast<std::size_t>(value.size()))")}`;
33
- }
34
- };
@@ -1,34 +0,0 @@
1
- "use strict";
2
- /**
3
- * Boolean wire codec (decoder side)
4
- *
5
- * Strategy:
6
- * - Read the raw JSON-safe wire strings `"0"` / `"1"` directly.
7
- * - `"1"` → true; anything else → false (no JavaScript truthiness for non-boolean inputs).
8
- * - C++ compares the incoming string to `"1"`.
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.decoder = exports.descriptor = void 0;
12
- const encoder_1 = require("./encoder");
13
- Object.defineProperty(exports, "descriptor", { enumerable: true, get: function () { return encoder_1.descriptor; } });
14
- const TS_DECODE_FN = "decodeBoolean";
15
- const CPP_DECODE_FN = "decodeBoolean";
16
- function emitTsDecoderSource() {
17
- return `function ${TS_DECODE_FN}(encoded) {
18
- return encoded === "1";
19
- }`;
20
- }
21
- function emitCppDecoderSource() {
22
- return `inline bool ${CPP_DECODE_FN}(const std::string& encoded) {
23
- return encoded == "1";
24
- }`;
25
- }
26
- exports.decoder = {
27
- descriptor: encoder_1.descriptor,
28
- emitTsDecoder() {
29
- return emitTsDecoderSource();
30
- },
31
- emitCppDecoder() {
32
- return emitCppDecoderSource();
33
- }
34
- };
@@ -1,40 +0,0 @@
1
- "use strict";
2
- /**
3
- * Boolean wire codec (encoder side)
4
- *
5
- * Strategy:
6
- * - Map `false`/`true` to the raw JSON-safe strings `"0"` / `"1"`.
7
- * - Avoid byte packing and base93 overhead for a two-state value that already fits in one character.
8
- * - Emitted helpers produce wire strings directly.
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.encoder = exports.descriptor = void 0;
12
- const TS_ENCODE_FN = "encodeBoolean";
13
- const CPP_ENCODE_FN = "encodeBoolean";
14
- exports.descriptor = {
15
- codecId: "boolean",
16
- specPath: "RefinedSpecs/Codecs/Boolean_boolean_Codec.md",
17
- tsType: "boolean",
18
- cppType: "bool",
19
- wireCategory: "string",
20
- strategySummary: 'Single-character wire strings "0"/"1" for false/true; not JSON boolean; no bit packing.'
21
- };
22
- function emitTsEncoderSource() {
23
- return `function ${TS_ENCODE_FN}(value) {
24
- return value ? "1" : "0";
25
- }`;
26
- }
27
- function emitCppEncoderSource() {
28
- return `inline std::string ${CPP_ENCODE_FN}(bool value) {
29
- return value ? "1" : "0";
30
- }`;
31
- }
32
- exports.encoder = {
33
- descriptor: exports.descriptor,
34
- emitTsEncoder() {
35
- return emitTsEncoderSource();
36
- },
37
- emitCppEncoder() {
38
- return emitCppEncoderSource();
39
- }
40
- };
@@ -1,43 +0,0 @@
1
- "use strict";
2
- /**
3
- * AnQst base-type codec emitter: AnQst.Type.json (dynamic JSON object).
4
- *
5
- * Wire: parsed JSON Object is the domain value — identity decode, same as AnQst.Type.object
6
- * on the TS side. C++ decode maps QJsonValue → QJsonObject via toObject() without QVariantMap.
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.decoder = exports.descriptor = void 0;
10
- const comments_1 = require("../shared/comments");
11
- exports.descriptor = {
12
- codecId: "AnQst.Type.json",
13
- specPath: "RefinedSpecs/Codecs/Dynamic_json_Codec.md",
14
- tsType: "object",
15
- cppType: "QJsonObject",
16
- wireCategory: "dynamic",
17
- strategySummary: "Pass-through JSON Object on the wire (same as object); C++ domain is QJsonObject with direct QJsonValue interop (encode wrap, decode toObject)."
18
- };
19
- function emitTsDecoderSource(functionName = "decodeDynamicJson") {
20
- const comment = (0, comments_1.emitStrategyComment)("AnQst.Type.json — TypeScript decode (identity)", [
21
- "The JSON Object from the wire is the domain value; no per-field transform.",
22
- "Applies where the spec names AnQst.Type.json; wire shape matches AnQst.Type.object."
23
- ]);
24
- return `${comment}
25
- function ${functionName}(wire) {
26
- return wire;
27
- }`;
28
- }
29
- function emitCppDecoderSource(functionName = "decodeDynamicJsonFromJsonValue") {
30
- const comment = (0, comments_1.emitStrategyComment)("AnQst.Type.json — C++ decode (QJsonValue → QJsonObject)", [
31
- "Direct toObject() into QJsonObject — contrast AnQst.Type.object QVariantMap decode path.",
32
- "Thin QJsonObject-oriented helper; Qt headers required to compile."
33
- ]);
34
- return `${comment}
35
- inline QJsonObject ${functionName}(const QJsonValue& value) {
36
- return value.toObject();
37
- }`;
38
- }
39
- exports.decoder = {
40
- descriptor: exports.descriptor,
41
- emitTsDecoder: () => emitTsDecoderSource(),
42
- emitCppDecoder: () => emitCppDecoderSource()
43
- };
@@ -1,45 +0,0 @@
1
- "use strict";
2
- /**
3
- * AnQst base-type codec emitter: AnQst.Type.json (dynamic JSON object).
4
- *
5
- * Wire: identical to AnQst.Type.object — a native JSON Object, pass-through for
6
- * JSON.stringify / JSON.parse. Distinct only in descriptor and C++ mapping (QJsonObject
7
- * and direct QJsonValue interop, no QVariantMap). See Dynamic_json_Codec.md.
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.encoder = exports.descriptor = void 0;
11
- const comments_1 = require("../shared/comments");
12
- exports.descriptor = {
13
- codecId: "AnQst.Type.json",
14
- specPath: "RefinedSpecs/Codecs/Dynamic_json_Codec.md",
15
- tsType: "object",
16
- cppType: "QJsonObject",
17
- wireCategory: "dynamic",
18
- strategySummary: "Pass-through JSON Object on the wire (same as object); C++ domain is QJsonObject with direct QJsonValue interop (encode wrap, decode toObject)."
19
- };
20
- function emitTsEncoderSource(functionName = "encodeDynamicJson") {
21
- const comment = (0, comments_1.emitStrategyComment)("AnQst.Type.json — TypeScript encode (identity on wire payload)", [
22
- "Same wire behavior as AnQst.Type.object; distinct type metadata selects QJsonObject in generated C++.",
23
- "The domain object is emitted as-is; JSON.stringify supplies JSON Object syntax.",
24
- "Values must be JSON-serializable; non-JSON-native values fail at stringify time."
25
- ]);
26
- return `${comment}
27
- function ${functionName}(value) {
28
- return value;
29
- }`;
30
- }
31
- function emitCppEncoderSource(functionName = "encodeDynamicJsonToJsonValue") {
32
- const comment = (0, comments_1.emitStrategyComment)("AnQst.Type.json — C++ encode (QJsonObject → QJsonValue)", [
33
- "QJsonObject is JSON-native in Qt; wrap directly for placement in QJsonValue — no QVariantMap hop.",
34
- "Use only for explicit AnQst.Type.json; requires Qt JSON types in the translation unit."
35
- ]);
36
- return `${comment}
37
- inline QJsonValue ${functionName}(const QJsonObject& jsonObj) {
38
- return QJsonValue(jsonObj);
39
- }`;
40
- }
41
- exports.encoder = {
42
- descriptor: exports.descriptor,
43
- emitTsEncoder: () => emitTsEncoderSource(),
44
- emitCppEncoder: () => emitCppEncoderSource()
45
- };