@dusted/anqst 1.0.0 → 1.5.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 (76) hide show
  1. package/README.md +15 -0
  2. package/dist/src/app.js +103 -77
  3. package/dist/src/base93.js +124 -0
  4. package/dist/src/build-stamp.js +1 -1
  5. package/dist/src/codecgenerators/basecodecemitters/bigint-qint64/decoder.js +35 -0
  6. package/dist/src/codecgenerators/basecodecemitters/bigint-qint64/encoder.js +36 -0
  7. package/dist/src/codecgenerators/basecodecemitters/bigint-quint64/decoder.js +26 -0
  8. package/dist/src/codecgenerators/basecodecemitters/bigint-quint64/encoder.js +38 -0
  9. package/dist/src/codecgenerators/basecodecemitters/binary-blob/decoder.js +28 -0
  10. package/dist/src/codecgenerators/basecodecemitters/binary-blob/encoder.js +34 -0
  11. package/dist/src/codecgenerators/basecodecemitters/binary-buffer/decoder.js +29 -0
  12. package/dist/src/codecgenerators/basecodecemitters/binary-buffer/encoder.js +36 -0
  13. package/dist/src/codecgenerators/basecodecemitters/binary-float32Array/decoder.js +46 -0
  14. package/dist/src/codecgenerators/basecodecemitters/binary-float32Array/encoder.js +49 -0
  15. package/dist/src/codecgenerators/basecodecemitters/binary-float64Array/decoder.js +46 -0
  16. package/dist/src/codecgenerators/basecodecemitters/binary-float64Array/encoder.js +47 -0
  17. package/dist/src/codecgenerators/basecodecemitters/binary-int16Array/decoder.js +46 -0
  18. package/dist/src/codecgenerators/basecodecemitters/binary-int16Array/encoder.js +49 -0
  19. package/dist/src/codecgenerators/basecodecemitters/binary-int32Array/decoder.js +50 -0
  20. package/dist/src/codecgenerators/basecodecemitters/binary-int32Array/encoder.js +52 -0
  21. package/dist/src/codecgenerators/basecodecemitters/binary-int8Array/decoder.js +38 -0
  22. package/dist/src/codecgenerators/basecodecemitters/binary-int8Array/encoder.js +44 -0
  23. package/dist/src/codecgenerators/basecodecemitters/binary-typedArray/decoder.js +33 -0
  24. package/dist/src/codecgenerators/basecodecemitters/binary-typedArray/encoder.js +34 -0
  25. package/dist/src/codecgenerators/basecodecemitters/binary-uint16Array/decoder.js +46 -0
  26. package/dist/src/codecgenerators/basecodecemitters/binary-uint16Array/encoder.js +49 -0
  27. package/dist/src/codecgenerators/basecodecemitters/binary-uint32Array/decoder.js +46 -0
  28. package/dist/src/codecgenerators/basecodecemitters/binary-uint32Array/encoder.js +49 -0
  29. package/dist/src/codecgenerators/basecodecemitters/binary-uint8Array/decoder.js +28 -0
  30. package/dist/src/codecgenerators/basecodecemitters/binary-uint8Array/encoder.js +34 -0
  31. package/dist/src/codecgenerators/basecodecemitters/boolean/decoder.js +34 -0
  32. package/dist/src/codecgenerators/basecodecemitters/boolean/encoder.js +40 -0
  33. package/dist/src/codecgenerators/basecodecemitters/dynamic-json/decoder.js +43 -0
  34. package/dist/src/codecgenerators/basecodecemitters/dynamic-json/encoder.js +45 -0
  35. package/dist/src/codecgenerators/basecodecemitters/dynamic-object/decoder.js +44 -0
  36. package/dist/src/codecgenerators/basecodecemitters/dynamic-object/encoder.js +46 -0
  37. package/dist/src/codecgenerators/basecodecemitters/integer-int16/decoder.js +32 -0
  38. package/dist/src/codecgenerators/basecodecemitters/integer-int16/encoder.js +43 -0
  39. package/dist/src/codecgenerators/basecodecemitters/integer-int32/decoder.js +26 -0
  40. package/dist/src/codecgenerators/basecodecemitters/integer-int32/encoder.js +37 -0
  41. package/dist/src/codecgenerators/basecodecemitters/integer-int8/decoder.js +26 -0
  42. package/dist/src/codecgenerators/basecodecemitters/integer-int8/encoder.js +37 -0
  43. package/dist/src/codecgenerators/basecodecemitters/integer-qint16/decoder.js +36 -0
  44. package/dist/src/codecgenerators/basecodecemitters/integer-qint16/encoder.js +36 -0
  45. package/dist/src/codecgenerators/basecodecemitters/integer-qint32/decoder.js +25 -0
  46. package/dist/src/codecgenerators/basecodecemitters/integer-qint32/encoder.js +36 -0
  47. package/dist/src/codecgenerators/basecodecemitters/integer-qint8/decoder.js +36 -0
  48. package/dist/src/codecgenerators/basecodecemitters/integer-qint8/encoder.js +36 -0
  49. package/dist/src/codecgenerators/basecodecemitters/integer-quint16/decoder.js +26 -0
  50. package/dist/src/codecgenerators/basecodecemitters/integer-quint16/encoder.js +38 -0
  51. package/dist/src/codecgenerators/basecodecemitters/integer-quint32/decoder.js +27 -0
  52. package/dist/src/codecgenerators/basecodecemitters/integer-quint32/encoder.js +39 -0
  53. package/dist/src/codecgenerators/basecodecemitters/integer-quint8/decoder.js +26 -0
  54. package/dist/src/codecgenerators/basecodecemitters/integer-quint8/encoder.js +38 -0
  55. package/dist/src/codecgenerators/basecodecemitters/integer-uint16/decoder.js +30 -0
  56. package/dist/src/codecgenerators/basecodecemitters/integer-uint16/encoder.js +42 -0
  57. package/dist/src/codecgenerators/basecodecemitters/integer-uint32/decoder.js +31 -0
  58. package/dist/src/codecgenerators/basecodecemitters/integer-uint32/encoder.js +43 -0
  59. package/dist/src/codecgenerators/basecodecemitters/integer-uint8/decoder.js +30 -0
  60. package/dist/src/codecgenerators/basecodecemitters/integer-uint8/encoder.js +40 -0
  61. package/dist/src/codecgenerators/basecodecemitters/number/decoder.js +26 -0
  62. package/dist/src/codecgenerators/basecodecemitters/number/encoder.js +38 -0
  63. package/dist/src/codecgenerators/basecodecemitters/shared/comments.js +13 -0
  64. package/dist/src/codecgenerators/basecodecemitters/shared/contracts.js +2 -0
  65. package/dist/src/codecgenerators/basecodecemitters/shared/fixedwidth.js +53 -0
  66. package/dist/src/codecgenerators/basecodecemitters/shared/index.js +21 -0
  67. package/dist/src/codecgenerators/basecodecemitters/shared/positionalBase93.js +48 -0
  68. package/dist/src/codecgenerators/basecodecemitters/shared/rawbytes.js +30 -0
  69. package/dist/src/codecgenerators/basecodecemitters/string/decoder.js +43 -0
  70. package/dist/src/codecgenerators/basecodecemitters/string/encoder.js +43 -0
  71. package/dist/src/codecgenerators/basecodecemitters/stringArray/decoder.js +80 -0
  72. package/dist/src/codecgenerators/basecodecemitters/stringArray/encoder.js +57 -0
  73. package/dist/src/emit.js +760 -120
  74. package/dist/src/structured-top-level-codecs.js +1305 -0
  75. package/package.json +2 -3
  76. package/spec/AnQst-Spec-DSL.d.ts +15 -8
@@ -0,0 +1,46 @@
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
+ };
@@ -0,0 +1,49 @@
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
+ };
@@ -0,0 +1,28 @@
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
+ };
@@ -0,0 +1,34 @@
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
+ };
@@ -0,0 +1,34 @@
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
+ };
@@ -0,0 +1,40 @@
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
+ };
@@ -0,0 +1,43 @@
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
+ };
@@ -0,0 +1,45 @@
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
+ };
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ /**
3
+ * AnQst base-type codec emitter: AnQst.Type.object (dynamic object).
4
+ *
5
+ * Wire: parsed JSON Object is the domain value — identity decode. Same scope rules as the
6
+ * encoder: only for explicitly declared dynamic object types in the spec, never as a generic
7
+ * fallback for unknown static shapes.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.decoder = exports.descriptor = void 0;
11
+ const comments_1 = require("../shared/comments");
12
+ exports.descriptor = {
13
+ codecId: "AnQst.Type.object",
14
+ specPath: "RefinedSpecs/Codecs/Dynamic_object_Codec.md",
15
+ tsType: "object",
16
+ cppType: "QVariantMap",
17
+ wireCategory: "dynamic",
18
+ strategySummary: "Pass-through JSON Object on the wire for explicitly dynamic AnQst.Type.object only; no base93, no flattening."
19
+ };
20
+ function emitTsDecoderSource(functionName = "decodeDynamicObject") {
21
+ const comment = (0, comments_1.emitStrategyComment)("AnQst.Type.object — TypeScript decode (identity)", [
22
+ "The JSON Object already parsed from the wire is the domain value; no per-field transform.",
23
+ "Applies only where the spec names AnQst.Type.object as the field or root type."
24
+ ]);
25
+ return `${comment}
26
+ function ${functionName}(value) {
27
+ return value;
28
+ }`;
29
+ }
30
+ function emitCppDecoderSource(functionName = "decodeDynamicObjectFromJsonObject") {
31
+ const comment = (0, comments_1.emitStrategyComment)("AnQst.Type.object — C++ decode (QJsonObject → QVariantMap)", [
32
+ "Caller obtains QJsonObject from QJsonValue::toObject(); this helper maps to QVariantMap.",
33
+ "Thin QVariantMap-oriented helper; Qt headers required to compile."
34
+ ]);
35
+ return `${comment}
36
+ inline QVariantMap ${functionName}(const QJsonObject& obj) {
37
+ return obj.toVariantMap();
38
+ }`;
39
+ }
40
+ exports.decoder = {
41
+ descriptor: exports.descriptor,
42
+ emitTsDecoder: () => emitTsDecoderSource(),
43
+ emitCppDecoder: () => emitCppDecoderSource()
44
+ };
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ /**
3
+ * AnQst base-type codec emitter: AnQst.Type.object (dynamic object).
4
+ *
5
+ * Wire: the value is a native JSON object with no transformation — pass-through for
6
+ * JSON.stringify / JSON.parse. This path applies only where the spec explicitly declares
7
+ * AnQst.Type.object (or AnQst.Type.json for the sibling codec); it is never a fallback for
8
+ * statically typed fields. Contents must be JSON-native (see Dynamic_object_Codec.md).
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.encoder = exports.descriptor = void 0;
12
+ const comments_1 = require("../shared/comments");
13
+ exports.descriptor = {
14
+ codecId: "AnQst.Type.object",
15
+ specPath: "RefinedSpecs/Codecs/Dynamic_object_Codec.md",
16
+ tsType: "object",
17
+ cppType: "QVariantMap",
18
+ wireCategory: "dynamic",
19
+ strategySummary: "Pass-through JSON Object on the wire for explicitly dynamic AnQst.Type.object only; no base93, no flattening."
20
+ };
21
+ function emitTsEncoderSource(functionName = "encodeDynamicObject") {
22
+ const comment = (0, comments_1.emitStrategyComment)("AnQst.Type.object — TypeScript encode (identity on wire payload)", [
23
+ "The domain object is emitted as-is; the surrounding codec / JSON.stringify supplies JSON Object syntax.",
24
+ "Reserved for spec-declared dynamic object fields or standalone dynamic payloads — not for static struct shapes.",
25
+ "Values must be JSON-serializable; non-JSON-native values fail at stringify time."
26
+ ]);
27
+ return `${comment}
28
+ function ${functionName}(value) {
29
+ return value;
30
+ }`;
31
+ }
32
+ function emitCppEncoderSource(functionName = "encodeDynamicObjectToJsonObject") {
33
+ const comment = (0, comments_1.emitStrategyComment)("AnQst.Type.object — C++ encode (QVariantMap → QJsonObject)", [
34
+ "Qt maps the domain QVariantMap to QJsonObject for JSON emission via QJsonObject::fromVariantMap.",
35
+ "Use only for explicit AnQst.Type.object; requires Qt JSON types in the translation unit."
36
+ ]);
37
+ return `${comment}
38
+ inline QJsonObject ${functionName}(const QVariantMap& map) {
39
+ return QJsonObject::fromVariantMap(map);
40
+ }`;
41
+ }
42
+ exports.encoder = {
43
+ descriptor: exports.descriptor,
44
+ emitTsEncoder: () => emitTsEncoderSource(),
45
+ emitCppEncoder: () => emitCppEncoderSource()
46
+ };
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ /**
3
+ * Base codec emitter: `AnQst.Type.int16` standalone decoder.
4
+ *
5
+ * Decoding mirrors `AnQst.Type.qint16`: base93 expands to 2 bytes, then
6
+ * `Int16Array` reconstructs the signed 16-bit two's complement value in native
7
+ * byte order. Descriptor identity remains separate so generated C++ binds to
8
+ * `int16_t`, not Qt's `qint16`.
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 FIXED_WIDTH = encoder_1.descriptor.fixedWidth;
17
+ const TS_FN = "decodeInt16Standalone";
18
+ const CPP_FN = "decodeInt16Standalone";
19
+ const STRATEGY_COMMENT = (0, comments_1.emitStrategyComment)("Base codec emitter (decode): AnQst.Type.int16 / int16_t", [
20
+ "Base93 decodes to exactly 2 bytes, then Int16Array reconstructs the signed 16-bit value in TypeScript.",
21
+ "The standalone wire remains the same 3-character payload used by qint16.",
22
+ "C++ decodes into int16_t with memcpy so the descriptor maps to the standard typedef, not qint16."
23
+ ]);
24
+ exports.decoderEmitter = {
25
+ descriptor: encoder_1.descriptor,
26
+ emitTsDecoder() {
27
+ return `${STRATEGY_COMMENT}\n\n${(0, fixedwidth_1.emitTsFixedWidthStandaloneDecoder)(TS_FN, FIXED_WIDTH)}`;
28
+ },
29
+ emitCppDecoder() {
30
+ return `${STRATEGY_COMMENT}\n\n${(0, fixedwidth_1.emitCppFixedWidthStandaloneDecoder)(CPP_FN, FIXED_WIDTH)}`;
31
+ }
32
+ };
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ /**
3
+ * Base codec emitter: `AnQst.Type.int16` standalone encoder.
4
+ *
5
+ * This codec is wire-identical to `AnQst.Type.qint16`: it writes the signed
6
+ * 16-bit two's complement value through `Int16Array`, then base93-encodes the
7
+ * resulting 2 native-order bytes as a 3-character standalone string. The
8
+ * descriptor stays distinct so generated C++ uses standard `int16_t`.
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.encoderEmitter = exports.descriptor = void 0;
12
+ const comments_1 = require("../shared/comments");
13
+ const fixedwidth_1 = require("../shared/fixedwidth");
14
+ const FIXED_WIDTH = {
15
+ byteWidth: 2,
16
+ tsViewCtor: "Int16Array",
17
+ cppType: "int16_t"
18
+ };
19
+ exports.descriptor = {
20
+ codecId: "integer-int16",
21
+ specPath: "RefinedSpecs/Codecs/Integer_int16_Codec.md",
22
+ tsType: "number",
23
+ cppType: "int16_t",
24
+ wireCategory: "fixed-width-scalar",
25
+ strategySummary: "Wire-identical to qint16: serialize signed 16-bit two's complement via Int16Array / int16_t, then base93-encode the 2-byte standalone payload to 3 characters.",
26
+ fixedWidth: FIXED_WIDTH
27
+ };
28
+ const TS_FN = "encodeInt16Standalone";
29
+ const CPP_FN = "encodeInt16Standalone";
30
+ const STRATEGY_COMMENT = (0, comments_1.emitStrategyComment)("Base codec emitter (encode): AnQst.Type.int16 / int16_t", [
31
+ "Wire-identical to qint16: TypeScript writes the signed 16-bit payload through Int16Array.",
32
+ "Standalone payload width is fixed at 2 bytes, which base93 encodes to exactly 3 characters.",
33
+ "C++ mirrors the same native-order bytes with memcpy into int16_t rather than Qt's qint16 typedef."
34
+ ]);
35
+ exports.encoderEmitter = {
36
+ descriptor: exports.descriptor,
37
+ emitTsEncoder() {
38
+ return `${STRATEGY_COMMENT}\n\n${(0, fixedwidth_1.emitTsFixedWidthStandaloneEncoder)(TS_FN, FIXED_WIDTH)}`;
39
+ },
40
+ emitCppEncoder() {
41
+ return `${STRATEGY_COMMENT}\n\n${(0, fixedwidth_1.emitCppFixedWidthStandaloneEncoder)(CPP_FN, FIXED_WIDTH)}`;
42
+ }
43
+ };
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ /**
3
+ * Base codec emitter: `AnQst.Type.int32` standalone decoder.
4
+ *
5
+ * Decodes the same 5-character base93 wire used by `AnQst.Type.qint32`, then
6
+ * reconstructs the signed 32-bit two's complement value through `Int32Array`.
7
+ * Descriptor identity remains distinct so generated C++ uses `int32_t`, not
8
+ * Qt's `qint32`, even though the wire bytes are identical.
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.decoderEmitter = exports.descriptor = void 0;
12
+ const fixedwidth_1 = require("../shared/fixedwidth");
13
+ const encoder_1 = require("./encoder");
14
+ Object.defineProperty(exports, "descriptor", { enumerable: true, get: function () { return encoder_1.descriptor; } });
15
+ const FIXED_WIDTH = encoder_1.descriptor.fixedWidth;
16
+ const TS_FN = "decodeInt32Standalone";
17
+ const CPP_FN = "decodeInt32Standalone";
18
+ exports.decoderEmitter = {
19
+ descriptor: encoder_1.descriptor,
20
+ emitTsDecoder() {
21
+ return (0, fixedwidth_1.emitTsFixedWidthStandaloneDecoder)(TS_FN, FIXED_WIDTH);
22
+ },
23
+ emitCppDecoder() {
24
+ return (0, fixedwidth_1.emitCppFixedWidthStandaloneDecoder)(CPP_FN, FIXED_WIDTH);
25
+ }
26
+ };
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ /**
3
+ * Base codec emitter: `AnQst.Type.int32` standalone encoder.
4
+ *
5
+ * Wire behavior is intentionally identical to `AnQst.Type.qint32`: serialize
6
+ * one signed 32-bit two's complement word via `Int32Array`, then base93-encode
7
+ * those 4 bytes into a 5-character standalone string. The distinction lives
8
+ * only in descriptor identity and C++ mapping: this codec targets `int32_t`.
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.encoderEmitter = exports.descriptor = void 0;
12
+ const fixedwidth_1 = require("../shared/fixedwidth");
13
+ const FIXED_WIDTH = {
14
+ byteWidth: 4,
15
+ tsViewCtor: "Int32Array",
16
+ cppType: "int32_t"
17
+ };
18
+ exports.descriptor = {
19
+ codecId: "integer-int32",
20
+ specPath: "RefinedSpecs/Codecs/Integer_int32_Codec.md",
21
+ tsType: "number",
22
+ cppType: "int32_t",
23
+ wireCategory: "fixed-width-scalar",
24
+ strategySummary: "Wire-identical to qint32: serialize int32_t as 4-byte signed two's complement (Int32Array / C++ memcpy), then base93-encode to a standalone 5-character JSON string.",
25
+ fixedWidth: FIXED_WIDTH
26
+ };
27
+ const TS_FN = "encodeInt32Standalone";
28
+ const CPP_FN = "encodeInt32Standalone";
29
+ exports.encoderEmitter = {
30
+ descriptor: exports.descriptor,
31
+ emitTsEncoder() {
32
+ return (0, fixedwidth_1.emitTsFixedWidthStandaloneEncoder)(TS_FN, FIXED_WIDTH);
33
+ },
34
+ emitCppEncoder() {
35
+ return (0, fixedwidth_1.emitCppFixedWidthStandaloneEncoder)(CPP_FN, FIXED_WIDTH);
36
+ }
37
+ };
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ /**
3
+ * Base codec emitter: `AnQst.Type.int8` standalone decoder.
4
+ *
5
+ * Decodes the same 2-character base93 wire used by `AnQst.Type.qint8`, then
6
+ * reconstructs the signed 8-bit two's complement value through `Int8Array`.
7
+ * Descriptor identity remains distinct so generated C++ uses `int8_t`, not Qt's
8
+ * `qint8`, even though the wire bytes are identical.
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.decoderEmitter = exports.descriptor = void 0;
12
+ const fixedwidth_1 = require("../shared/fixedwidth");
13
+ const encoder_1 = require("./encoder");
14
+ Object.defineProperty(exports, "descriptor", { enumerable: true, get: function () { return encoder_1.descriptor; } });
15
+ const fixedWidth = encoder_1.descriptor.fixedWidth;
16
+ const TS_FN = "decodeInt8Standalone";
17
+ const CPP_FN = "decodeInt8Standalone";
18
+ exports.decoderEmitter = {
19
+ descriptor: encoder_1.descriptor,
20
+ emitTsDecoder() {
21
+ return (0, fixedwidth_1.emitTsFixedWidthStandaloneDecoder)(TS_FN, fixedWidth);
22
+ },
23
+ emitCppDecoder() {
24
+ return (0, fixedwidth_1.emitCppFixedWidthStandaloneDecoder)(CPP_FN, fixedWidth);
25
+ }
26
+ };
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ /**
3
+ * Base codec emitter: `AnQst.Type.int8` standalone encoder.
4
+ *
5
+ * Wire behavior is intentionally identical to `AnQst.Type.qint8`: serialize one
6
+ * signed 8-bit two's complement byte via `Int8Array`, then base93-encode that
7
+ * single byte into a 2-character standalone string. The distinction lives only
8
+ * in descriptor identity and C++ mapping: this codec targets standard `int8_t`.
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.encoderEmitter = exports.descriptor = void 0;
12
+ const fixedwidth_1 = require("../shared/fixedwidth");
13
+ const fixedWidth = {
14
+ byteWidth: 1,
15
+ tsViewCtor: "Int8Array",
16
+ cppType: "int8_t"
17
+ };
18
+ exports.descriptor = {
19
+ codecId: "integer-int8",
20
+ specPath: "RefinedSpecs/Codecs/Integer_int8_Codec.md",
21
+ tsType: "number",
22
+ cppType: "int8_t",
23
+ wireCategory: "fixed-width-scalar",
24
+ strategySummary: "Wire-identical to qint8: one signed two's complement byte via Int8Array / int8_t, base93-encoded as a 2-character standalone string.",
25
+ fixedWidth
26
+ };
27
+ const TS_FN = "encodeInt8Standalone";
28
+ const CPP_FN = "encodeInt8Standalone";
29
+ exports.encoderEmitter = {
30
+ descriptor: exports.descriptor,
31
+ emitTsEncoder() {
32
+ return (0, fixedwidth_1.emitTsFixedWidthStandaloneEncoder)(TS_FN, fixedWidth);
33
+ },
34
+ emitCppEncoder() {
35
+ return (0, fixedwidth_1.emitCppFixedWidthStandaloneEncoder)(CPP_FN, fixedWidth);
36
+ }
37
+ };