typia 15.0.0 → 15.0.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 (110) hide show
  1. package/lib/http.d.ts +49 -24
  2. package/lib/http.js.map +1 -1
  3. package/lib/http.mjs.map +1 -1
  4. package/lib/internal/_httpFormDataReadBigint.js +7 -5
  5. package/lib/internal/_httpFormDataReadBigint.js.map +1 -1
  6. package/lib/internal/_httpFormDataReadBigint.mjs +1 -1
  7. package/lib/internal/_httpFormDataReadBigint.mjs.map +1 -1
  8. package/lib/internal/_httpFormDataReadBoolean.js +12 -10
  9. package/lib/internal/_httpFormDataReadBoolean.js.map +1 -1
  10. package/lib/internal/_httpFormDataReadBoolean.mjs +1 -1
  11. package/lib/internal/_httpFormDataReadBoolean.mjs.map +1 -1
  12. package/lib/internal/_httpFormDataReadNumber.js +7 -5
  13. package/lib/internal/_httpFormDataReadNumber.js.map +1 -1
  14. package/lib/internal/_httpFormDataReadNumber.mjs +1 -1
  15. package/lib/internal/_httpFormDataReadNumber.mjs.map +1 -1
  16. package/lib/internal/_httpFormDataReadString.d.ts +9 -1
  17. package/lib/internal/_httpFormDataReadString.js +10 -2
  18. package/lib/internal/_httpFormDataReadString.js.map +1 -1
  19. package/lib/internal/_httpFormDataReadString.mjs +9 -1
  20. package/lib/internal/_httpFormDataReadString.mjs.map +1 -1
  21. package/lib/internal/_httpHeaderReadBigint.js +5 -1
  22. package/lib/internal/_httpHeaderReadBigint.js.map +1 -1
  23. package/lib/internal/_httpHeaderReadBigint.mjs +2 -1
  24. package/lib/internal/_httpHeaderReadBigint.mjs.map +1 -1
  25. package/lib/internal/_httpHeaderReadNumber.js +5 -1
  26. package/lib/internal/_httpHeaderReadNumber.js.map +1 -1
  27. package/lib/internal/_httpHeaderReadNumber.mjs +2 -1
  28. package/lib/internal/_httpHeaderReadNumber.mjs.map +1 -1
  29. package/lib/internal/_httpParameterReadBigint.js +4 -0
  30. package/lib/internal/_httpParameterReadBigint.js.map +1 -1
  31. package/lib/internal/_httpParameterReadBigint.mjs +1 -0
  32. package/lib/internal/_httpParameterReadBigint.mjs.map +1 -1
  33. package/lib/internal/_httpParameterReadNumber.js +4 -0
  34. package/lib/internal/_httpParameterReadNumber.js.map +1 -1
  35. package/lib/internal/_httpParameterReadNumber.mjs +1 -0
  36. package/lib/internal/_httpParameterReadNumber.mjs.map +1 -1
  37. package/lib/internal/_httpParameterReadString.d.ts +9 -1
  38. package/lib/internal/_httpParameterReadString.js +9 -1
  39. package/lib/internal/_httpParameterReadString.js.map +1 -1
  40. package/lib/internal/_httpParameterReadString.mjs +9 -1
  41. package/lib/internal/_httpParameterReadString.mjs.map +1 -1
  42. package/lib/internal/_httpQueryReadBigint.js +8 -1
  43. package/lib/internal/_httpQueryReadBigint.js.map +1 -1
  44. package/lib/internal/_httpQueryReadBigint.mjs +1 -1
  45. package/lib/internal/_httpQueryReadBigint.mjs.map +1 -1
  46. package/lib/internal/_httpQueryReadBoolean.js +4 -1
  47. package/lib/internal/_httpQueryReadBoolean.js.map +1 -1
  48. package/lib/internal/_httpQueryReadBoolean.mjs +1 -1
  49. package/lib/internal/_httpQueryReadBoolean.mjs.map +1 -1
  50. package/lib/internal/_httpQueryReadNumber.js +8 -1
  51. package/lib/internal/_httpQueryReadNumber.js.map +1 -1
  52. package/lib/internal/_httpQueryReadNumber.mjs +1 -1
  53. package/lib/internal/_httpQueryReadNumber.mjs.map +1 -1
  54. package/lib/internal/_httpQueryReadString.d.ts +9 -1
  55. package/lib/internal/_httpQueryReadString.js +9 -1
  56. package/lib/internal/_httpQueryReadString.js.map +1 -1
  57. package/lib/internal/_httpQueryReadString.mjs +9 -1
  58. package/lib/internal/_httpQueryReadString.mjs.map +1 -1
  59. package/lib/internal/_randomBigint.d.ts +12 -1
  60. package/lib/internal/_randomBigint.js +90 -2
  61. package/lib/internal/_randomBigint.js.map +1 -1
  62. package/lib/internal/_randomBigint.mjs +70 -2
  63. package/lib/internal/_randomBigint.mjs.map +1 -1
  64. package/lib/internal/_randomInteger.js +21 -12
  65. package/lib/internal/_randomInteger.js.map +1 -1
  66. package/lib/internal/_randomInteger.mjs +21 -16
  67. package/lib/internal/_randomInteger.mjs.map +1 -1
  68. package/lib/internal/_randomNumber.js +19 -10
  69. package/lib/internal/_randomNumber.js.map +1 -1
  70. package/lib/internal/_randomNumber.mjs +19 -14
  71. package/lib/internal/_randomNumber.mjs.map +1 -1
  72. package/native/cmd/ttsc-typia/llm_evaluation_rejects_invalid_probability_test.go +9 -0
  73. package/native/cmd/ttsc-typia/random_recursive_min_items_diagnostic_test.go +18 -1
  74. package/native/core/factories/ExpressionFactory.go +16 -1
  75. package/native/core/factories/MetadataCommentTagFactory.go +177 -29
  76. package/native/core/factories/expression_factory_number_spells_non_finite_values_test.go +69 -0
  77. package/native/core/factories/metadata_comment_tag_factory_holds_bigint_tags_exact_test.go +168 -0
  78. package/native/core/factories/metadata_comment_tag_factory_reads_javascript_numbers_test.go +158 -0
  79. package/native/core/programmers/functional/FunctionalAssertParametersProgrammer.go +1 -3
  80. package/native/core/programmers/functional/FunctionalIsParametersProgrammer.go +107 -9
  81. package/native/core/programmers/functional/FunctionalValidateParametersProgrammer.go +1 -3
  82. package/native/core/programmers/http/HttpFormDataProgrammer.go +41 -2
  83. package/native/core/programmers/http/HttpHeadersProgrammer.go +56 -4
  84. package/native/core/programmers/http/HttpParameterProgrammer.go +1 -3
  85. package/native/core/programmers/http/HttpQueryProgrammer.go +26 -43
  86. package/native/core/programmers/iterate/json_schema_jsDocTags.go +10 -3
  87. package/native/core/programmers/iterate/json_schema_jsdoc_tags_cast_reads_javascript_numbers_test.go +64 -0
  88. package/native/core/programmers/llm/LlmEvaluationProgrammer.go +6 -2
  89. package/native/core/programmers/llm/LlmSchemaProgrammer.go +34 -4
  90. package/native/core/utils/NumberUtil.go +195 -0
  91. package/native/core/utils/number_util_rational_keeps_written_value_test.go +62 -0
  92. package/native/core/utils/number_util_reads_javascript_number_grammar_test.go +147 -0
  93. package/package.json +3 -3
  94. package/src/http.ts +61 -34
  95. package/src/internal/_httpFormDataReadBigint.ts +3 -1
  96. package/src/internal/_httpFormDataReadBoolean.ts +3 -1
  97. package/src/internal/_httpFormDataReadNumber.ts +3 -1
  98. package/src/internal/_httpFormDataReadString.ts +10 -1
  99. package/src/internal/_httpHeaderReadBigint.ts +6 -1
  100. package/src/internal/_httpHeaderReadNumber.ts +6 -1
  101. package/src/internal/_httpParameterReadBigint.ts +3 -0
  102. package/src/internal/_httpParameterReadNumber.ts +3 -0
  103. package/src/internal/_httpParameterReadString.ts +12 -2
  104. package/src/internal/_httpQueryReadBigint.ts +7 -1
  105. package/src/internal/_httpQueryReadBoolean.ts +3 -1
  106. package/src/internal/_httpQueryReadNumber.ts +7 -1
  107. package/src/internal/_httpQueryReadString.ts +10 -1
  108. package/src/internal/_randomBigint.ts +111 -3
  109. package/src/internal/_randomInteger.ts +31 -16
  110. package/src/internal/_randomNumber.ts +23 -12
@@ -1 +1 @@
1
- {"version":3,"file":"_httpHeaderReadBigint.mjs","names":[],"sources":["../../src/internal/_httpHeaderReadBigint.ts"],"sourcesContent":["export const _httpHeaderReadBigint = (value: string | undefined) =>\n value !== undefined ? toBigint(value) : undefined;\n\nconst toBigint = (str: string): bigint | string => {\n try {\n return BigInt(str);\n } catch {\n return str;\n }\n};\n"],"mappings":";AAAA,MAAa,yBAAyB,UACpC,UAAU,KAAA,IAAY,SAAS,KAAK,IAAI,KAAA;AAE1C,MAAM,YAAY,QAAiC;CACjD,IAAI;EACF,OAAO,OAAO,GAAG;CACnB,QAAQ;EACN,OAAO;CACT;AACF"}
1
+ {"version":3,"file":"_httpHeaderReadBigint.mjs","names":[],"sources":["../../src/internal/_httpHeaderReadBigint.ts"],"sourcesContent":["export const _httpHeaderReadBigint = (value: string | undefined) =>\n // A blank header, or a blank element of a header list, is absent: `BigInt(\"\")`\n // is 0n, which let validators accept an empty header as a real zero (#2448).\n value !== undefined && isBlank(value) === false ? toBigint(value) : undefined;\n\nconst isBlank = (value: string): boolean =>\n typeof value === \"string\" && value.trim().length === 0;\n\nconst toBigint = (str: string): bigint | string => {\n try {\n return BigInt(str);\n } catch {\n return str;\n }\n};\n"],"mappings":";AAAA,MAAa,yBAAyB,UAGpC,UAAU,KAAA,KAAa,QAAQ,KAAK,MAAM,QAAQ,SAAS,KAAK,IAAI,KAAA;AAEtE,MAAM,WAAW,UACf,OAAO,UAAU,YAAY,MAAM,KAAK,CAAC,CAAC,WAAW;AAEvD,MAAM,YAAY,QAAiC;CACjD,IAAI;EACF,OAAO,OAAO,GAAG;CACnB,QAAQ;EACN,OAAO;CACT;AACF"}
@@ -1,8 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports._httpHeaderReadNumber = void 0;
4
- const _httpHeaderReadNumber = (value) => value !== undefined ? toNumber(value) : undefined;
4
+ const _httpHeaderReadNumber = (value) =>
5
+ // A blank header, or a blank element of a header list, is absent: `Number("")`
6
+ // is 0, which let validators accept an empty header as a real zero (#2448).
7
+ value !== undefined && isBlank(value) === false ? toNumber(value) : undefined;
5
8
  exports._httpHeaderReadNumber = _httpHeaderReadNumber;
9
+ const isBlank = (value) => typeof value === "string" && value.trim().length === 0;
6
10
  const toNumber = (str) => {
7
11
  const value = Number(str);
8
12
  return isNaN(value) ? str : value;
@@ -1 +1 @@
1
- {"version":3,"file":"_httpHeaderReadNumber.js","sourceRoot":"","sources":["../../src/internal/_httpHeaderReadNumber.ts"],"names":[],"mappings":";;;AAAO,MAAM,qBAAqB,GAAG,CAAC,KAAyB,EAAE,EAAE,CACjE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AADvC,QAAA,qBAAqB,GAArB,qBAAqB,CACkB;AAEpD,MAAM,QAAQ,GAAG,CAAC,GAAW,EAAmB,EAAE;IAChD,MAAM,KAAK,GAAW,MAAM,CAAC,GAAG,CAAC,CAAC;IAClC,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC;AACpC,CAAC,CAAC"}
1
+ {"version":3,"file":"_httpHeaderReadNumber.js","sourceRoot":"","sources":["../../src/internal/_httpHeaderReadNumber.ts"],"names":[],"mappings":";;;AAAO,MAAM,qBAAqB,GAAG,CAAC,KAAyB,EAAE,EAAE;AACjE,+EAA+E;AAC/E,4EAA4E;AAC5E,KAAK,KAAK,SAAS,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAHnE,QAAA,qBAAqB,GAArB,qBAAqB,CAG8C;AAEhF,MAAM,OAAO,GAAG,CAAC,KAAa,EAAW,EAAE,CACzC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,CAAC;AAEzD,MAAM,QAAQ,GAAG,CAAC,GAAW,EAAmB,EAAE;IAChD,MAAM,KAAK,GAAW,MAAM,CAAC,GAAG,CAAC,CAAC;IAClC,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC;AACpC,CAAC,CAAC"}
@@ -1,5 +1,6 @@
1
1
  //#region src/internal/_httpHeaderReadNumber.ts
2
- const _httpHeaderReadNumber = (value) => value !== void 0 ? toNumber(value) : void 0;
2
+ const _httpHeaderReadNumber = (value) => value !== void 0 && isBlank(value) === false ? toNumber(value) : void 0;
3
+ const isBlank = (value) => typeof value === "string" && value.trim().length === 0;
3
4
  const toNumber = (str) => {
4
5
  const value = Number(str);
5
6
  return isNaN(value) ? str : value;
@@ -1 +1 @@
1
- {"version":3,"file":"_httpHeaderReadNumber.mjs","names":[],"sources":["../../src/internal/_httpHeaderReadNumber.ts"],"sourcesContent":["export const _httpHeaderReadNumber = (value: string | undefined) =>\n value !== undefined ? toNumber(value) : undefined;\n\nconst toNumber = (str: string): number | string => {\n const value: number = Number(str);\n return isNaN(value) ? str : value;\n};\n"],"mappings":";AAAA,MAAa,yBAAyB,UACpC,UAAU,KAAA,IAAY,SAAS,KAAK,IAAI,KAAA;AAE1C,MAAM,YAAY,QAAiC;CACjD,MAAM,QAAgB,OAAO,GAAG;CAChC,OAAO,MAAM,KAAK,IAAI,MAAM;AAC9B"}
1
+ {"version":3,"file":"_httpHeaderReadNumber.mjs","names":[],"sources":["../../src/internal/_httpHeaderReadNumber.ts"],"sourcesContent":["export const _httpHeaderReadNumber = (value: string | undefined) =>\n // A blank header, or a blank element of a header list, is absent: `Number(\"\")`\n // is 0, which let validators accept an empty header as a real zero (#2448).\n value !== undefined && isBlank(value) === false ? toNumber(value) : undefined;\n\nconst isBlank = (value: string): boolean =>\n typeof value === \"string\" && value.trim().length === 0;\n\nconst toNumber = (str: string): number | string => {\n const value: number = Number(str);\n return isNaN(value) ? str : value;\n};\n"],"mappings":";AAAA,MAAa,yBAAyB,UAGpC,UAAU,KAAA,KAAa,QAAQ,KAAK,MAAM,QAAQ,SAAS,KAAK,IAAI,KAAA;AAEtE,MAAM,WAAW,UACf,OAAO,UAAU,YAAY,MAAM,KAAK,CAAC,CAAC,WAAW;AAEvD,MAAM,YAAY,QAAiC;CACjD,MAAM,QAAgB,OAAO,GAAG;CAChC,OAAO,MAAM,KAAK,IAAI,MAAM;AAC9B"}
@@ -4,6 +4,10 @@ exports._httpParameterReadBigint = void 0;
4
4
  const _httpParameterReadBigint = (value) => value !== "null" ? toBigint(value) : null;
5
5
  exports._httpParameterReadBigint = _httpParameterReadBigint;
6
6
  const toBigint = (str) => {
7
+ // Blank text stays text, so the assertion rejects it: `BigInt(" ")` is 0n,
8
+ // which read a blank path segment as a real zero (#2448).
9
+ if (str.trim().length === 0)
10
+ return str;
7
11
  try {
8
12
  return BigInt(str);
9
13
  }
@@ -1 +1 @@
1
- {"version":3,"file":"_httpParameterReadBigint.js","sourceRoot":"","sources":["../../src/internal/_httpParameterReadBigint.ts"],"names":[],"mappings":";;;AAAO,MAAM,wBAAwB,GAAG,CAAC,KAAa,EAAE,EAAE,CACxD,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAD/B,QAAA,wBAAwB,GAAxB,wBAAwB,CACO;AAE5C,MAAM,QAAQ,GAAG,CAAC,GAAW,EAAmB,EAAE;IAChD,IAAI,CAAC;QACH,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;IACrB,CAAC;eAAO,CAAC;QACP,OAAO,GAAG,CAAC;IACb,CAAC;AACH,CAAC,CAAC"}
1
+ {"version":3,"file":"_httpParameterReadBigint.js","sourceRoot":"","sources":["../../src/internal/_httpParameterReadBigint.ts"],"names":[],"mappings":";;;AAAO,MAAM,wBAAwB,GAAG,CAAC,KAAa,EAAE,EAAE,CACxD,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAD/B,QAAA,wBAAwB,GAAxB,wBAAwB,CACO;AAE5C,MAAM,QAAQ,GAAG,CAAC,GAAW,EAAmB,EAAE;IAChD,2EAA2E;IAC3E,0DAA0D;IAC1D,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,GAAG,CAAC;IACxC,IAAI,CAAC;QACH,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;IACrB,CAAC;eAAO,CAAC;QACP,OAAO,GAAG,CAAC;IACb,CAAC;AACH,CAAC,CAAC"}
@@ -1,6 +1,7 @@
1
1
  //#region src/internal/_httpParameterReadBigint.ts
2
2
  const _httpParameterReadBigint = (value) => value !== "null" ? toBigint(value) : null;
3
3
  const toBigint = (str) => {
4
+ if (str.trim().length === 0) return str;
4
5
  try {
5
6
  return BigInt(str);
6
7
  } catch {
@@ -1 +1 @@
1
- {"version":3,"file":"_httpParameterReadBigint.mjs","names":[],"sources":["../../src/internal/_httpParameterReadBigint.ts"],"sourcesContent":["export const _httpParameterReadBigint = (value: string) =>\n value !== \"null\" ? toBigint(value) : null;\n\nconst toBigint = (str: string): bigint | string => {\n try {\n return BigInt(str);\n } catch {\n return str;\n }\n};\n"],"mappings":";AAAA,MAAa,4BAA4B,UACvC,UAAU,SAAS,SAAS,KAAK,IAAI;AAEvC,MAAM,YAAY,QAAiC;CACjD,IAAI;EACF,OAAO,OAAO,GAAG;CACnB,QAAQ;EACN,OAAO;CACT;AACF"}
1
+ {"version":3,"file":"_httpParameterReadBigint.mjs","names":[],"sources":["../../src/internal/_httpParameterReadBigint.ts"],"sourcesContent":["export const _httpParameterReadBigint = (value: string) =>\n value !== \"null\" ? toBigint(value) : null;\n\nconst toBigint = (str: string): bigint | string => {\n // Blank text stays text, so the assertion rejects it: `BigInt(\" \")` is 0n,\n // which read a blank path segment as a real zero (#2448).\n if (str.trim().length === 0) return str;\n try {\n return BigInt(str);\n } catch {\n return str;\n }\n};\n"],"mappings":";AAAA,MAAa,4BAA4B,UACvC,UAAU,SAAS,SAAS,KAAK,IAAI;AAEvC,MAAM,YAAY,QAAiC;CAGjD,IAAI,IAAI,KAAK,CAAC,CAAC,WAAW,GAAG,OAAO;CACpC,IAAI;EACF,OAAO,OAAO,GAAG;CACnB,QAAQ;EACN,OAAO;CACT;AACF"}
@@ -4,6 +4,10 @@ exports._httpParameterReadNumber = void 0;
4
4
  const _httpParameterReadNumber = (value) => value !== "null" ? toNumber(value) : null;
5
5
  exports._httpParameterReadNumber = _httpParameterReadNumber;
6
6
  const toNumber = (str) => {
7
+ // Blank text stays text, so the assertion rejects it: `Number(" ")` is 0,
8
+ // which read a blank path segment as a real zero (#2448).
9
+ if (str.trim().length === 0)
10
+ return str;
7
11
  const value = Number(str);
8
12
  return isNaN(value) ? str : value;
9
13
  };
@@ -1 +1 @@
1
- {"version":3,"file":"_httpParameterReadNumber.js","sourceRoot":"","sources":["../../src/internal/_httpParameterReadNumber.ts"],"names":[],"mappings":";;;AAAO,MAAM,wBAAwB,GAAG,CAAC,KAAa,EAAE,EAAE,CACxD,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAD/B,QAAA,wBAAwB,GAAxB,wBAAwB,CACO;AAE5C,MAAM,QAAQ,GAAG,CAAC,GAAW,EAAmB,EAAE;IAChD,MAAM,KAAK,GAAW,MAAM,CAAC,GAAG,CAAC,CAAC;IAClC,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC;AACpC,CAAC,CAAC"}
1
+ {"version":3,"file":"_httpParameterReadNumber.js","sourceRoot":"","sources":["../../src/internal/_httpParameterReadNumber.ts"],"names":[],"mappings":";;;AAAO,MAAM,wBAAwB,GAAG,CAAC,KAAa,EAAE,EAAE,CACxD,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAD/B,QAAA,wBAAwB,GAAxB,wBAAwB,CACO;AAE5C,MAAM,QAAQ,GAAG,CAAC,GAAW,EAAmB,EAAE;IAChD,0EAA0E;IAC1E,0DAA0D;IAC1D,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,GAAG,CAAC;IACxC,MAAM,KAAK,GAAW,MAAM,CAAC,GAAG,CAAC,CAAC;IAClC,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC;AACpC,CAAC,CAAC"}
@@ -1,6 +1,7 @@
1
1
  //#region src/internal/_httpParameterReadNumber.ts
2
2
  const _httpParameterReadNumber = (value) => value !== "null" ? toNumber(value) : null;
3
3
  const toNumber = (str) => {
4
+ if (str.trim().length === 0) return str;
4
5
  const value = Number(str);
5
6
  return isNaN(value) ? str : value;
6
7
  };
@@ -1 +1 @@
1
- {"version":3,"file":"_httpParameterReadNumber.mjs","names":[],"sources":["../../src/internal/_httpParameterReadNumber.ts"],"sourcesContent":["export const _httpParameterReadNumber = (value: string) =>\n value !== \"null\" ? toNumber(value) : null;\n\nconst toNumber = (str: string): number | string => {\n const value: number = Number(str);\n return isNaN(value) ? str : value;\n};\n"],"mappings":";AAAA,MAAa,4BAA4B,UACvC,UAAU,SAAS,SAAS,KAAK,IAAI;AAEvC,MAAM,YAAY,QAAiC;CACjD,MAAM,QAAgB,OAAO,GAAG;CAChC,OAAO,MAAM,KAAK,IAAI,MAAM;AAC9B"}
1
+ {"version":3,"file":"_httpParameterReadNumber.mjs","names":[],"sources":["../../src/internal/_httpParameterReadNumber.ts"],"sourcesContent":["export const _httpParameterReadNumber = (value: string) =>\n value !== \"null\" ? toNumber(value) : null;\n\nconst toNumber = (str: string): number | string => {\n // Blank text stays text, so the assertion rejects it: `Number(\" \")` is 0,\n // which read a blank path segment as a real zero (#2448).\n if (str.trim().length === 0) return str;\n const value: number = Number(str);\n return isNaN(value) ? str : value;\n};\n"],"mappings":";AAAA,MAAa,4BAA4B,UACvC,UAAU,SAAS,SAAS,KAAK,IAAI;AAEvC,MAAM,YAAY,QAAiC;CAGjD,IAAI,IAAI,KAAK,CAAC,CAAC,WAAW,GAAG,OAAO;CACpC,MAAM,QAAgB,OAAO,GAAG;CAChC,OAAO,MAAM,KAAK,IAAI,MAAM;AAC9B"}
@@ -1 +1,9 @@
1
- export declare const _httpParameterReadString: (value: string) => string | null;
1
+ /**
2
+ * Reads one path parameter as a string.
3
+ *
4
+ * The text `"null"` spells `null` only where the parameter's type admits
5
+ * `null`; elsewhere it is the string `"null"` (#2450). The emitter passes
6
+ * `false` for a string whose type does not admit `null` and omits the argument
7
+ * otherwise, so code emitted before the parameter existed keeps its reading.
8
+ */
9
+ export declare const _httpParameterReadString: (value: string, nullable?: boolean) => string | null;
@@ -1,6 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports._httpParameterReadString = void 0;
4
- const _httpParameterReadString = (value) => value !== "null" ? value : null;
4
+ /**
5
+ * Reads one path parameter as a string.
6
+ *
7
+ * The text `"null"` spells `null` only where the parameter's type admits
8
+ * `null`; elsewhere it is the string `"null"` (#2450). The emitter passes
9
+ * `false` for a string whose type does not admit `null` and omits the argument
10
+ * otherwise, so code emitted before the parameter existed keeps its reading.
11
+ */
12
+ const _httpParameterReadString = (value, nullable = true) => (nullable === true && value === "null" ? null : value);
5
13
  exports._httpParameterReadString = _httpParameterReadString;
6
14
  //# sourceMappingURL=_httpParameterReadString.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"_httpParameterReadString.js","sourceRoot":"","sources":["../../src/internal/_httpParameterReadString.ts"],"names":[],"mappings":";;;AAAO,MAAM,wBAAwB,GAAG,CAAC,KAAa,EAAE,EAAE,CACxD,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;AADrB,QAAA,wBAAwB,GAAxB,wBAAwB,CACH"}
1
+ {"version":3,"file":"_httpParameterReadString.js","sourceRoot":"","sources":["../../src/internal/_httpParameterReadString.ts"],"names":[],"mappings":";;;AAAA;;;;;;;GAOG;AACI,MAAM,wBAAwB,GAAG,CACtC,KAAa,EACb,QAAQ,GAAY,IAAI,EACxB,EAAE,CAAC,CAAC,QAAQ,KAAK,IAAI,IAAI,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAH/C,QAAA,wBAAwB,GAAxB,wBAAwB,CAGuB"}
@@ -1,5 +1,13 @@
1
1
  //#region src/internal/_httpParameterReadString.ts
2
- const _httpParameterReadString = (value) => value !== "null" ? value : null;
2
+ /**
3
+ * Reads one path parameter as a string.
4
+ *
5
+ * The text `"null"` spells `null` only where the parameter's type admits
6
+ * `null`; elsewhere it is the string `"null"` (#2450). The emitter passes
7
+ * `false` for a string whose type does not admit `null` and omits the argument
8
+ * otherwise, so code emitted before the parameter existed keeps its reading.
9
+ */
10
+ const _httpParameterReadString = (value, nullable = true) => nullable === true && value === "null" ? null : value;
3
11
  //#endregion
4
12
  export { _httpParameterReadString };
5
13
 
@@ -1 +1 @@
1
- {"version":3,"file":"_httpParameterReadString.mjs","names":[],"sources":["../../src/internal/_httpParameterReadString.ts"],"sourcesContent":["export const _httpParameterReadString = (value: string) =>\n value !== \"null\" ? value : null;\n"],"mappings":";AAAA,MAAa,4BAA4B,UACvC,UAAU,SAAS,QAAQ"}
1
+ {"version":3,"file":"_httpParameterReadString.mjs","names":[],"sources":["../../src/internal/_httpParameterReadString.ts"],"sourcesContent":["/**\n * Reads one path parameter as a string.\n *\n * The text `\"null\"` spells `null` only where the parameter's type admits\n * `null`; elsewhere it is the string `\"null\"` (#2450). The emitter passes\n * `false` for a string whose type does not admit `null` and omits the argument\n * otherwise, so code emitted before the parameter existed keeps its reading.\n */\nexport const _httpParameterReadString = (\n value: string,\n nullable: boolean = true,\n) => (nullable === true && value === \"null\" ? null : value);\n"],"mappings":";;;;;;;;;AAQA,MAAa,4BACX,OACA,WAAoB,SAChB,aAAa,QAAQ,UAAU,SAAS,OAAO"}
@@ -1,7 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports._httpQueryReadBigint = void 0;
4
- const _httpQueryReadBigint = (str) => !!(str === null || str === void 0 ? void 0 : str.length) ? (str === "null" ? null : toBigint(str)) : undefined;
4
+ const _httpQueryReadBigint = (str) =>
5
+ // Blank text is absent, as the empty string always was: `BigInt(" ")` is 0n,
6
+ // which would read a whitespace value as a real zero (#2448).
7
+ typeof str === "string" && str.trim().length !== 0
8
+ ? str === "null"
9
+ ? null
10
+ : toBigint(str)
11
+ : undefined;
5
12
  exports._httpQueryReadBigint = _httpQueryReadBigint;
6
13
  const toBigint = (str) => {
7
14
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"_httpQueryReadBigint.js","sourceRoot":"","sources":["../../src/internal/_httpQueryReadBigint.ts"],"names":[],"mappings":";;;AAAO,MAAM,oBAAoB,GAAG,CAClC,GAAkB,EACS,EAAE,CAC7B,CAAC,EAAC,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,MAAM,CAAA,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAE,QAAQ,CAAC,GAAG,CAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAHlE,QAAA,oBAAoB,GAApB,oBAAoB,CAG8C;AAE/E,MAAM,QAAQ,GAAG,CAAC,GAAW,EAAmB,EAAE;IAChD,IAAI,CAAC;QACH,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;IACrB,CAAC;eAAO,CAAC;QACP,OAAO,GAAG,CAAC;IACb,CAAC;AACH,CAAC,CAAC"}
1
+ {"version":3,"file":"_httpQueryReadBigint.js","sourceRoot":"","sources":["../../src/internal/_httpQueryReadBigint.ts"],"names":[],"mappings":";;;AAAO,MAAM,oBAAoB,GAAG,CAClC,GAAkB,EACS,EAAE;AAC7B,6EAA6E;AAC7E,8DAA8D;AAC9D,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC;IAChD,CAAC,CAAC,GAAG,KAAK,MAAM;QACd,CAAC,CAAC,IAAI;QACN,CAAC,CAAE,QAAQ,CAAC,GAAG,CAAS;IAC1B,CAAC,CAAC,SAAS,CAAC;AATH,QAAA,oBAAoB,GAApB,oBAAoB,CASjB;AAEhB,MAAM,QAAQ,GAAG,CAAC,GAAW,EAAmB,EAAE;IAChD,IAAI,CAAC;QACH,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;IACrB,CAAC;eAAO,CAAC;QACP,OAAO,GAAG,CAAC;IACb,CAAC;AACH,CAAC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  //#region src/internal/_httpQueryReadBigint.ts
2
- const _httpQueryReadBigint = (str) => !!str?.length ? str === "null" ? null : toBigint(str) : void 0;
2
+ const _httpQueryReadBigint = (str) => typeof str === "string" && str.trim().length !== 0 ? str === "null" ? null : toBigint(str) : void 0;
3
3
  const toBigint = (str) => {
4
4
  try {
5
5
  return BigInt(str);
@@ -1 +1 @@
1
- {"version":3,"file":"_httpQueryReadBigint.mjs","names":[],"sources":["../../src/internal/_httpQueryReadBigint.ts"],"sourcesContent":["export const _httpQueryReadBigint = (\n str: string | null,\n): bigint | null | undefined =>\n !!str?.length ? (str === \"null\" ? null : (toBigint(str) as any)) : undefined;\n\nconst toBigint = (str: string): bigint | string => {\n try {\n return BigInt(str);\n } catch {\n return str;\n }\n};\n"],"mappings":";AAAA,MAAa,wBACX,QAEA,CAAC,CAAC,KAAK,SAAU,QAAQ,SAAS,OAAQ,SAAS,GAAG,IAAa,KAAA;AAErE,MAAM,YAAY,QAAiC;CACjD,IAAI;EACF,OAAO,OAAO,GAAG;CACnB,QAAQ;EACN,OAAO;CACT;AACF"}
1
+ {"version":3,"file":"_httpQueryReadBigint.mjs","names":[],"sources":["../../src/internal/_httpQueryReadBigint.ts"],"sourcesContent":["export const _httpQueryReadBigint = (\n str: string | null,\n): bigint | null | undefined =>\n // Blank text is absent, as the empty string always was: `BigInt(\" \")` is 0n,\n // which would read a whitespace value as a real zero (#2448).\n typeof str === \"string\" && str.trim().length !== 0\n ? str === \"null\"\n ? null\n : (toBigint(str) as any)\n : undefined;\n\nconst toBigint = (str: string): bigint | string => {\n try {\n return BigInt(str);\n } catch {\n return str;\n }\n};\n"],"mappings":";AAAA,MAAa,wBACX,QAIA,OAAO,QAAQ,YAAY,IAAI,KAAK,CAAC,CAAC,WAAW,IAC7C,QAAQ,SACN,OACC,SAAS,GAAG,IACf,KAAA;AAEN,MAAM,YAAY,QAAiC;CACjD,IAAI;EACF,OAAO,OAAO,GAAG;CACnB,QAAQ;EACN,OAAO;CACT;AACF"}
@@ -1,7 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports._httpQueryReadBoolean = void 0;
4
- const _httpQueryReadBoolean = (str) => str === null
4
+ const _httpQueryReadBoolean = (str) =>
5
+ // `undefined` is as absent as `null`, which the contract returns; a
6
+ // stand-in reader that answers `undefined` must not throw on `.length`.
7
+ str === null || str === undefined
5
8
  ? undefined
6
9
  : str === "null"
7
10
  ? null
@@ -1 +1 @@
1
- {"version":3,"file":"_httpQueryReadBoolean.js","sourceRoot":"","sources":["../../src/internal/_httpQueryReadBoolean.ts"],"names":[],"mappings":";;;AAAO,MAAM,qBAAqB,GAAG,CACnC,GAAkB,EACU,EAAE,CAC9B,GAAG,KAAK,IAAI;IACV,CAAC,CAAC,SAAS;IACX,CAAC,CAAC,GAAG,KAAK,MAAM;QACd,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,GAAG,CAAC,MAAM,KAAK,CAAC;YAChB,CAAC,CAAC,IAAI;YACN,CAAC,CAAC,GAAG,KAAK,MAAM,IAAI,GAAG,KAAK,GAAG;gBAC7B,CAAC,CAAC,IAAI;gBACN,CAAC,CAAC,GAAG,KAAK,OAAO,IAAI,GAAG,KAAK,GAAG;oBAC9B,CAAC,CAAC,KAAK;oBACP,CAAC,CAAE,GAAW,CAAC,CAAC,aAAa;AAb5B,QAAA,qBAAqB,GAArB,qBAAqB,CAaP"}
1
+ {"version":3,"file":"_httpQueryReadBoolean.js","sourceRoot":"","sources":["../../src/internal/_httpQueryReadBoolean.ts"],"names":[],"mappings":";;;AAAO,MAAM,qBAAqB,GAAG,CACnC,GAAkB,EACU,EAAE;AAC9B,oEAAoE;AACpE,wEAAwE;AACxE,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS;IAC/B,CAAC,CAAC,SAAS;IACX,CAAC,CAAC,GAAG,KAAK,MAAM;QACd,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,GAAG,CAAC,MAAM,KAAK,CAAC;YAChB,CAAC,CAAC,IAAI;YACN,CAAC,CAAC,GAAG,KAAK,MAAM,IAAI,GAAG,KAAK,GAAG;gBAC7B,CAAC,CAAC,IAAI;gBACN,CAAC,CAAC,GAAG,KAAK,OAAO,IAAI,GAAG,KAAK,GAAG;oBAC9B,CAAC,CAAC,KAAK;oBACP,CAAC,CAAE,GAAW,CAAC,CAAC,aAAa;AAf5B,QAAA,qBAAqB,GAArB,qBAAqB,CAeP"}
@@ -1,5 +1,5 @@
1
1
  //#region src/internal/_httpQueryReadBoolean.ts
2
- const _httpQueryReadBoolean = (str) => str === null ? void 0 : str === "null" ? null : str.length === 0 ? true : str === "true" || str === "1" ? true : str === "false" || str === "0" ? false : str;
2
+ const _httpQueryReadBoolean = (str) => str === null || str === void 0 ? void 0 : str === "null" ? null : str.length === 0 ? true : str === "true" || str === "1" ? true : str === "false" || str === "0" ? false : str;
3
3
  //#endregion
4
4
  export { _httpQueryReadBoolean };
5
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"_httpQueryReadBoolean.mjs","names":[],"sources":["../../src/internal/_httpQueryReadBoolean.ts"],"sourcesContent":["export const _httpQueryReadBoolean = (\n str: string | null,\n): boolean | null | undefined =>\n str === null\n ? undefined\n : str === \"null\"\n ? null\n : str.length === 0\n ? true\n : str === \"true\" || str === \"1\"\n ? true\n : str === \"false\" || str === \"0\"\n ? false\n : (str as any); // wrong type\n"],"mappings":";AAAA,MAAa,yBACX,QAEA,QAAQ,OACJ,KAAA,IACA,QAAQ,SACN,OACA,IAAI,WAAW,IACb,OACA,QAAQ,UAAU,QAAQ,MACxB,OACA,QAAQ,WAAW,QAAQ,MACzB,QACC"}
1
+ {"version":3,"file":"_httpQueryReadBoolean.mjs","names":[],"sources":["../../src/internal/_httpQueryReadBoolean.ts"],"sourcesContent":["export const _httpQueryReadBoolean = (\n str: string | null,\n): boolean | null | undefined =>\n // `undefined` is as absent as `null`, which the contract returns; a\n // stand-in reader that answers `undefined` must not throw on `.length`.\n str === null || str === undefined\n ? undefined\n : str === \"null\"\n ? null\n : str.length === 0\n ? true\n : str === \"true\" || str === \"1\"\n ? true\n : str === \"false\" || str === \"0\"\n ? false\n : (str as any); // wrong type\n"],"mappings":";AAAA,MAAa,yBACX,QAIA,QAAQ,QAAQ,QAAQ,KAAA,IACpB,KAAA,IACA,QAAQ,SACN,OACA,IAAI,WAAW,IACb,OACA,QAAQ,UAAU,QAAQ,MACxB,OACA,QAAQ,WAAW,QAAQ,MACzB,QACC"}
@@ -1,7 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports._httpQueryReadNumber = void 0;
4
- const _httpQueryReadNumber = (str) => !!(str === null || str === void 0 ? void 0 : str.length) ? (str === "null" ? null : toNumber(str)) : undefined;
4
+ const _httpQueryReadNumber = (str) =>
5
+ // Blank text is absent, as the empty string always was: `Number(" ")` is 0,
6
+ // which would read a whitespace value as a real zero (#2448).
7
+ typeof str === "string" && str.trim().length !== 0
8
+ ? str === "null"
9
+ ? null
10
+ : toNumber(str)
11
+ : undefined;
5
12
  exports._httpQueryReadNumber = _httpQueryReadNumber;
6
13
  const toNumber = (str) => {
7
14
  const value = Number(str);
@@ -1 +1 @@
1
- {"version":3,"file":"_httpQueryReadNumber.js","sourceRoot":"","sources":["../../src/internal/_httpQueryReadNumber.ts"],"names":[],"mappings":";;;AAAO,MAAM,oBAAoB,GAAG,CAClC,GAAkB,EACS,EAAE,CAC7B,CAAC,EAAC,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,MAAM,CAAA,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAE,QAAQ,CAAC,GAAG,CAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAHlE,QAAA,oBAAoB,GAApB,oBAAoB,CAG8C;AAE/E,MAAM,QAAQ,GAAG,CAAC,GAAW,EAAmB,EAAE;IAChD,MAAM,KAAK,GAAW,MAAM,CAAC,GAAG,CAAC,CAAC;IAClC,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC;AACpC,CAAC,CAAC"}
1
+ {"version":3,"file":"_httpQueryReadNumber.js","sourceRoot":"","sources":["../../src/internal/_httpQueryReadNumber.ts"],"names":[],"mappings":";;;AAAO,MAAM,oBAAoB,GAAG,CAClC,GAAkB,EACS,EAAE;AAC7B,4EAA4E;AAC5E,8DAA8D;AAC9D,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC;IAChD,CAAC,CAAC,GAAG,KAAK,MAAM;QACd,CAAC,CAAC,IAAI;QACN,CAAC,CAAE,QAAQ,CAAC,GAAG,CAAS;IAC1B,CAAC,CAAC,SAAS,CAAC;AATH,QAAA,oBAAoB,GAApB,oBAAoB,CASjB;AAEhB,MAAM,QAAQ,GAAG,CAAC,GAAW,EAAmB,EAAE;IAChD,MAAM,KAAK,GAAW,MAAM,CAAC,GAAG,CAAC,CAAC;IAClC,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC;AACpC,CAAC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  //#region src/internal/_httpQueryReadNumber.ts
2
- const _httpQueryReadNumber = (str) => !!str?.length ? str === "null" ? null : toNumber(str) : void 0;
2
+ const _httpQueryReadNumber = (str) => typeof str === "string" && str.trim().length !== 0 ? str === "null" ? null : toNumber(str) : void 0;
3
3
  const toNumber = (str) => {
4
4
  const value = Number(str);
5
5
  return isNaN(value) ? str : value;
@@ -1 +1 @@
1
- {"version":3,"file":"_httpQueryReadNumber.mjs","names":[],"sources":["../../src/internal/_httpQueryReadNumber.ts"],"sourcesContent":["export const _httpQueryReadNumber = (\n str: string | null,\n): number | null | undefined =>\n !!str?.length ? (str === \"null\" ? null : (toNumber(str) as any)) : undefined;\n\nconst toNumber = (str: string): number | string => {\n const value: number = Number(str);\n return isNaN(value) ? str : value;\n};\n"],"mappings":";AAAA,MAAa,wBACX,QAEA,CAAC,CAAC,KAAK,SAAU,QAAQ,SAAS,OAAQ,SAAS,GAAG,IAAa,KAAA;AAErE,MAAM,YAAY,QAAiC;CACjD,MAAM,QAAgB,OAAO,GAAG;CAChC,OAAO,MAAM,KAAK,IAAI,MAAM;AAC9B"}
1
+ {"version":3,"file":"_httpQueryReadNumber.mjs","names":[],"sources":["../../src/internal/_httpQueryReadNumber.ts"],"sourcesContent":["export const _httpQueryReadNumber = (\n str: string | null,\n): number | null | undefined =>\n // Blank text is absent, as the empty string always was: `Number(\" \")` is 0,\n // which would read a whitespace value as a real zero (#2448).\n typeof str === \"string\" && str.trim().length !== 0\n ? str === \"null\"\n ? null\n : (toNumber(str) as any)\n : undefined;\n\nconst toNumber = (str: string): number | string => {\n const value: number = Number(str);\n return isNaN(value) ? str : value;\n};\n"],"mappings":";AAAA,MAAa,wBACX,QAIA,OAAO,QAAQ,YAAY,IAAI,KAAK,CAAC,CAAC,WAAW,IAC7C,QAAQ,SACN,OACC,SAAS,GAAG,IACf,KAAA;AAEN,MAAM,YAAY,QAAiC;CACjD,MAAM,QAAgB,OAAO,GAAG;CAChC,OAAO,MAAM,KAAK,IAAI,MAAM;AAC9B"}
@@ -1 +1,9 @@
1
- export declare const _httpQueryReadString: (str: string | null) => string | null | undefined;
1
+ /**
2
+ * Reads one query value as a string.
3
+ *
4
+ * The text `"null"` spells `null` only where the property's type admits `null`;
5
+ * elsewhere it is the string `"null"` (#2450). The emitter passes `false` for a
6
+ * string whose type does not admit `null` and omits the argument otherwise, so
7
+ * code emitted before the parameter existed keeps its reading.
8
+ */
9
+ export declare const _httpQueryReadString: (str: string | null, nullable?: boolean) => string | null | undefined;
@@ -1,6 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports._httpQueryReadString = void 0;
4
- const _httpQueryReadString = (str) => str === null ? undefined : str === "null" ? null : str;
4
+ /**
5
+ * Reads one query value as a string.
6
+ *
7
+ * The text `"null"` spells `null` only where the property's type admits `null`;
8
+ * elsewhere it is the string `"null"` (#2450). The emitter passes `false` for a
9
+ * string whose type does not admit `null` and omits the argument otherwise, so
10
+ * code emitted before the parameter existed keeps its reading.
11
+ */
12
+ const _httpQueryReadString = (str, nullable = true) => str === null ? undefined : nullable === true && str === "null" ? null : str;
5
13
  exports._httpQueryReadString = _httpQueryReadString;
6
14
  //# sourceMappingURL=_httpQueryReadString.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"_httpQueryReadString.js","sourceRoot":"","sources":["../../src/internal/_httpQueryReadString.ts"],"names":[],"mappings":";;;AAAO,MAAM,oBAAoB,GAAG,CAClC,GAAkB,EACS,EAAE,CAC7B,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC;AAH5C,QAAA,oBAAoB,GAApB,oBAAoB,CAGwB"}
1
+ {"version":3,"file":"_httpQueryReadString.js","sourceRoot":"","sources":["../../src/internal/_httpQueryReadString.ts"],"names":[],"mappings":";;;AAAA;;;;;;;GAOG;AACI,MAAM,oBAAoB,GAAG,CAClC,GAAkB,EAClB,QAAQ,GAAY,IAAI,EACG,EAAE,CAC7B,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,KAAK,IAAI,IAAI,GAAG,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC;AAJjE,QAAA,oBAAoB,GAApB,oBAAoB,CAI6C"}
@@ -1,5 +1,13 @@
1
1
  //#region src/internal/_httpQueryReadString.ts
2
- const _httpQueryReadString = (str) => str === null ? void 0 : str === "null" ? null : str;
2
+ /**
3
+ * Reads one query value as a string.
4
+ *
5
+ * The text `"null"` spells `null` only where the property's type admits `null`;
6
+ * elsewhere it is the string `"null"` (#2450). The emitter passes `false` for a
7
+ * string whose type does not admit `null` and omits the argument otherwise, so
8
+ * code emitted before the parameter existed keeps its reading.
9
+ */
10
+ const _httpQueryReadString = (str, nullable = true) => str === null ? void 0 : nullable === true && str === "null" ? null : str;
3
11
  //#endregion
4
12
  export { _httpQueryReadString };
5
13
 
@@ -1 +1 @@
1
- {"version":3,"file":"_httpQueryReadString.mjs","names":[],"sources":["../../src/internal/_httpQueryReadString.ts"],"sourcesContent":["export const _httpQueryReadString = (\n str: string | null,\n): string | null | undefined =>\n str === null ? undefined : str === \"null\" ? null : str;\n"],"mappings":";AAAA,MAAa,wBACX,QAEA,QAAQ,OAAO,KAAA,IAAY,QAAQ,SAAS,OAAO"}
1
+ {"version":3,"file":"_httpQueryReadString.mjs","names":[],"sources":["../../src/internal/_httpQueryReadString.ts"],"sourcesContent":["/**\n * Reads one query value as a string.\n *\n * The text `\"null\"` spells `null` only where the property's type admits `null`;\n * elsewhere it is the string `\"null\"` (#2450). The emitter passes `false` for a\n * string whose type does not admit `null` and omits the argument otherwise, so\n * code emitted before the parameter existed keeps its reading.\n */\nexport const _httpQueryReadString = (\n str: string | null,\n nullable: boolean = true,\n): string | null | undefined =>\n str === null ? undefined : nullable === true && str === \"null\" ? null : str;\n"],"mappings":";;;;;;;;;AAQA,MAAa,wBACX,KACA,WAAoB,SAEpB,QAAQ,OAAO,KAAA,IAAY,aAAa,QAAQ,QAAQ,SAAS,OAAO"}
@@ -1,2 +1,13 @@
1
1
  import { OpenApi } from "@typia/interface";
2
- export declare const _randomBigint: (props: OpenApi.IJsonSchema.IInteger) => bigint;
2
+ /**
3
+ * Generates a random `bigint` satisfying an integer schema.
4
+ *
5
+ * The schema carries its bounds and step as numbers, but the value is a
6
+ * `bigint`, so the draw runs on integers. Drawing through doubles rounded every
7
+ * value past 2^53, and it checked `multipleOf` against a double's shortest
8
+ * decimal text rather than the integer `BigInt` makes of it, so `random`
9
+ * returned values the validator rejects, or gave up on a range that holds one
10
+ * (#2457). An integral bound or step is read as the integer the double holds,
11
+ * which is the integer the validator compares with.
12
+ */
13
+ export declare const _randomBigint: (schema: OpenApi.IJsonSchema.IInteger) => bigint;
@@ -1,7 +1,95 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports._randomBigint = void 0;
4
- const _randomInteger_1 = require("./_randomInteger");
5
- const _randomBigint = (props) => BigInt((0, _randomInteger_1._randomInteger)(props));
4
+ const _decimal_1 = require("./_decimal");
5
+ /**
6
+ * Generates a random `bigint` satisfying an integer schema.
7
+ *
8
+ * The schema carries its bounds and step as numbers, but the value is a
9
+ * `bigint`, so the draw runs on integers. Drawing through doubles rounded every
10
+ * value past 2^53, and it checked `multipleOf` against a double's shortest
11
+ * decimal text rather than the integer `BigInt` makes of it, so `random`
12
+ * returned values the validator rejects, or gave up on a range that holds one
13
+ * (#2457). An integral bound or step is read as the integer the double holds,
14
+ * which is the integer the validator compares with.
15
+ */
16
+ const _randomBigint = (schema) => {
17
+ const lower = boundary(schema.minimum, schema.exclusiveMinimum, "lower");
18
+ const upper = boundary(schema.maximum, schema.exclusiveMaximum, "upper");
19
+ const minimum = lower !== null && lower !== void 0 ? lower : (upper === null ? BigInt(0) : upper - BigInt(100));
20
+ const maximum = upper !== null && upper !== void 0 ? upper : (lower === null ? BigInt(100) : lower + BigInt(100));
21
+ if (minimum > maximum)
22
+ throw new Error("Minimum value is greater than maximum value.");
23
+ if (schema.multipleOf === undefined)
24
+ return between(minimum, maximum);
25
+ const step = integerStep(schema.multipleOf);
26
+ if (step === null || step <= BigInt(0))
27
+ throw new Error("The multipleOf value must be a positive finite number.");
28
+ const first = ceilDivide(minimum, step);
29
+ const last = floorDivide(maximum, step);
30
+ if (first > last)
31
+ throw new Error("The range does not contain a multipleOf value.");
32
+ return between(first, last) * step;
33
+ };
6
34
  exports._randomBigint = _randomBigint;
35
+ /**
36
+ * Reads one side's inclusive integer bound.
37
+ *
38
+ * `-Infinity` below or `Infinity` above excludes no integer, so it is no bound
39
+ * at all; `Infinity` below or `-Infinity` above excludes every integer.
40
+ */
41
+ const boundary = (inclusive, exclusive, side) => {
42
+ const candidates = [];
43
+ for (const [value, open] of [
44
+ [inclusive, false],
45
+ [exclusive, true],
46
+ ]) {
47
+ if (value === undefined)
48
+ continue;
49
+ if (Number.isFinite(value) === false) {
50
+ if (value === (side === "lower" ? -Infinity : Infinity))
51
+ continue;
52
+ throw new Error("Numeric range has no finite value.");
53
+ }
54
+ candidates.push(side === "lower"
55
+ ? open
56
+ ? BigInt(Math.floor(value)) + BigInt(1)
57
+ : BigInt(Math.ceil(value))
58
+ : open
59
+ ? BigInt(Math.ceil(value)) - BigInt(1)
60
+ : BigInt(Math.floor(value)));
61
+ }
62
+ if (candidates.length === 0)
63
+ return null;
64
+ return candidates.reduce((x, y) => side === "lower" ? (x > y ? x : y) : x < y ? x : y);
65
+ };
66
+ /**
67
+ * The smallest positive integer a `multipleOf` divides.
68
+ *
69
+ * An integral step is the integer its double holds; a fractional one, such as
70
+ * `1.5`, steps by its smallest integer multiple (`3`).
71
+ */
72
+ const integerStep = (multipleOf) => {
73
+ var _a;
74
+ var _b;
75
+ if (Number.isFinite(multipleOf) === false)
76
+ return null;
77
+ if (Number.isInteger(multipleOf))
78
+ return BigInt(multipleOf);
79
+ return (_b = (_a = (0, _decimal_1._decimalIntegerStep)(multipleOf)) === null || _a === void 0 ? void 0 : _a.coefficient) !== null && _b !== void 0 ? _b : null;
80
+ };
81
+ const ceilDivide = (x, y) => {
82
+ const quotient = x / y;
83
+ return x % y > BigInt(0) ? quotient + BigInt(1) : quotient;
84
+ };
85
+ const floorDivide = (x, y) => {
86
+ const quotient = x / y;
87
+ return x % y < BigInt(0) ? quotient - BigInt(1) : quotient;
88
+ };
89
+ /** Draws an integer in `[minimum, maximum]`, scaling one 53-bit sample. */
90
+ const between = (minimum, maximum) => {
91
+ const scale = BigInt(1) << BigInt(53);
92
+ const sample = BigInt(Math.min(Number(scale - BigInt(1)), Math.floor(Math.max(0, Math.random()) * Number(scale))));
93
+ return minimum + ((maximum - minimum + BigInt(1)) * sample) / scale;
94
+ };
7
95
  //# sourceMappingURL=_randomBigint.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"_randomBigint.js","sourceRoot":"","sources":["../../src/internal/_randomBigint.ts"],"names":[],"mappings":";;;AAEA,qDAAkD;AAE3C,MAAM,aAAa,GAAG,CAAC,KAAmC,EAAU,EAAE,CAC3E,MAAM,CAAC,IAAA,+BAAc,EAAC,KAAK,CAAC,CAAC,CAAC;AADnB,QAAA,aAAa,GAAb,aAAa,CACM"}
1
+ {"version":3,"file":"_randomBigint.js","sourceRoot":"","sources":["../../src/internal/_randomBigint.ts"],"names":[],"mappings":";;;AAEA,yCAAiD;AAEjD;;;;;;;;;;GAUG;AACI,MAAM,aAAa,GAAG,CAAC,MAAoC,EAAU,EAAE;IAC5E,MAAM,KAAK,GAAkB,QAAQ,CACnC,MAAM,CAAC,OAAO,EACd,MAAM,CAAC,gBAAgB,EACvB,OAAO,CACR,CAAC;IACF,MAAM,KAAK,GAAkB,QAAQ,CACnC,MAAM,CAAC,OAAO,EACd,MAAM,CAAC,gBAAgB,EACvB,OAAO,CACR,CAAC;IACF,MAAM,OAAO,GACX,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9D,MAAM,OAAO,GACX,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IAChE,IAAI,OAAO,GAAG,OAAO;QACnB,MAAM,IAAI,KA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AAS,EAAU,EAAE;IAClD,MAAM,QAAQ,GAAW,CAAC,GAAG,CAAC,CAAC;IAC/B,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;AAC7D,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,CAAS,EAAE,CAAS,EAAU,EAAE;IACnD,MAAM,QAAQ,GAAW,CAAC,GAAG,CAAC,CAAC;IAC/B,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;AAC7D,CAAC,CAAC;AAEF,2EAA2E;AAC3E,MAAM,OAAO,GAAG,CAAC,OAAe,EAAE,OAAe,EAAU,EAAE;IAC3D,MAAM,KAAK,GAAW,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,EAAE,CAAC,CAAC;IAC9C,MAAM,MAAM,GAAW,MAAM,CAC3B,IAAI,CAAC,GAAG,CACN,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,EACzB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CACvD,CACF,CAAC;IACF,OAAO,OAAO,GAAG,CAAC,CAAC,OAAO,GAAG,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,KAAK,CAAC;AACtE,CAAC,CAAC"}
@@ -1,6 +1,74 @@
1
- import { _randomInteger } from "./_randomInteger.mjs";
1
+ import { _decimalIntegerStep } from "./_decimal.mjs";
2
2
  //#region src/internal/_randomBigint.ts
3
- const _randomBigint = (props) => BigInt(_randomInteger(props));
3
+ /**
4
+ * Generates a random `bigint` satisfying an integer schema.
5
+ *
6
+ * The schema carries its bounds and step as numbers, but the value is a
7
+ * `bigint`, so the draw runs on integers. Drawing through doubles rounded every
8
+ * value past 2^53, and it checked `multipleOf` against a double's shortest
9
+ * decimal text rather than the integer `BigInt` makes of it, so `random`
10
+ * returned values the validator rejects, or gave up on a range that holds one
11
+ * (#2457). An integral bound or step is read as the integer the double holds,
12
+ * which is the integer the validator compares with.
13
+ */
14
+ const _randomBigint = (schema) => {
15
+ const lower = boundary(schema.minimum, schema.exclusiveMinimum, "lower");
16
+ const upper = boundary(schema.maximum, schema.exclusiveMaximum, "upper");
17
+ const minimum = lower ?? (upper === null ? BigInt(0) : upper - BigInt(100));
18
+ const maximum = upper ?? (lower === null ? BigInt(100) : lower + BigInt(100));
19
+ if (minimum > maximum) throw new Error("Minimum value is greater than maximum value.");
20
+ if (schema.multipleOf === void 0) return between(minimum, maximum);
21
+ const step = integerStep(schema.multipleOf);
22
+ if (step === null || step <= BigInt(0)) throw new Error("The multipleOf value must be a positive finite number.");
23
+ const first = ceilDivide(minimum, step);
24
+ const last = floorDivide(maximum, step);
25
+ if (first > last) throw new Error("The range does not contain a multipleOf value.");
26
+ return between(first, last) * step;
27
+ };
28
+ /**
29
+ * Reads one side's inclusive integer bound.
30
+ *
31
+ * `-Infinity` below or `Infinity` above excludes no integer, so it is no bound
32
+ * at all; `Infinity` below or `-Infinity` above excludes every integer.
33
+ */
34
+ const boundary = (inclusive, exclusive, side) => {
35
+ const candidates = [];
36
+ for (const [value, open] of [[inclusive, false], [exclusive, true]]) {
37
+ if (value === void 0) continue;
38
+ if (Number.isFinite(value) === false) {
39
+ if (value === (side === "lower" ? -Infinity : Infinity)) continue;
40
+ throw new Error("Numeric range has no finite value.");
41
+ }
42
+ candidates.push(side === "lower" ? open ? BigInt(Math.floor(value)) + BigInt(1) : BigInt(Math.ceil(value)) : open ? BigInt(Math.ceil(value)) - BigInt(1) : BigInt(Math.floor(value)));
43
+ }
44
+ if (candidates.length === 0) return null;
45
+ return candidates.reduce((x, y) => side === "lower" ? x > y ? x : y : x < y ? x : y);
46
+ };
47
+ /**
48
+ * The smallest positive integer a `multipleOf` divides.
49
+ *
50
+ * An integral step is the integer its double holds; a fractional one, such as
51
+ * `1.5`, steps by its smallest integer multiple (`3`).
52
+ */
53
+ const integerStep = (multipleOf) => {
54
+ if (Number.isFinite(multipleOf) === false) return null;
55
+ if (Number.isInteger(multipleOf)) return BigInt(multipleOf);
56
+ return _decimalIntegerStep(multipleOf)?.coefficient ?? null;
57
+ };
58
+ const ceilDivide = (x, y) => {
59
+ const quotient = x / y;
60
+ return x % y > BigInt(0) ? quotient + BigInt(1) : quotient;
61
+ };
62
+ const floorDivide = (x, y) => {
63
+ const quotient = x / y;
64
+ return x % y < BigInt(0) ? quotient - BigInt(1) : quotient;
65
+ };
66
+ /** Draws an integer in `[minimum, maximum]`, scaling one 53-bit sample. */
67
+ const between = (minimum, maximum) => {
68
+ const scale = BigInt(1) << BigInt(53);
69
+ const sample = BigInt(Math.min(Number(scale - BigInt(1)), Math.floor(Math.max(0, Math.random()) * Number(scale))));
70
+ return minimum + (maximum - minimum + BigInt(1)) * sample / scale;
71
+ };
4
72
  //#endregion
5
73
  export { _randomBigint };
6
74
 
@@ -1 +1 @@
1
- {"version":3,"file":"_randomBigint.mjs","names":[],"sources":["../../src/internal/_randomBigint.ts"],"sourcesContent":["import { OpenApi } from \"@typia/interface\";\n\nimport { _randomInteger } from \"./_randomInteger\";\n\nexport const _randomBigint = (props: OpenApi.IJsonSchema.IInteger): bigint =>\n BigInt(_randomInteger(props));\n"],"mappings":";;AAIA,MAAa,iBAAiB,UAC5B,OAAO,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"_randomBigint.mjs","names":[],"sources":["../../src/internal/_randomBigint.ts"],"sourcesContent":["import { OpenApi } from \"@typia/interface\";\n\nimport { _decimalIntegerStep } from \"./_decimal\";\n\n/**\n * Generates a random `bigint` satisfying an integer schema.\n *\n * The schema carries its bounds and step as numbers, but the value is a\n * `bigint`, so the draw runs on integers. Drawing through doubles rounded every\n * value past 2^53, and it checked `multipleOf` against a double's shortest\n * decimal text rather than the integer `BigInt` makes of it, so `random`\n * returned values the validator rejects, or gave up on a range that holds one\n * (#2457). An integral bound or step is read as the integer the double holds,\n * which is the integer the validator compares with.\n */\nexport const _randomBigint = (schema: OpenApi.IJsonSchema.IInteger): bigint => {\n const lower: bigint | null = boundary(\n schema.minimum,\n schema.exclusiveMinimum,\n \"lower\",\n );\n const upper: bigint | null = boundary(\n schema.maximum,\n schema.exclusiveMaximum,\n \"upper\",\n );\n const minimum: bigint =\n lower ?? (upper === null ? BigInt(0) : upper - BigInt(100));\n const maximum: bigint =\n upper ?? (lower === null ? BigInt(100) : lower + BigInt(100));\n if (minimum > maximum)\n throw new Error(\"Minimum value is greater than maximum value.\");\n if (schema.multipleOf === undefined) return between(minimum, maximum);\n\n const step: bigint | null = integerStep(schema.multipleOf);\n if (step === null || step <= BigInt(0))\n throw new Error(\"The multipleOf value must be a positive finite number.\");\n const first: bigint = ceilDivide(minimum, step);\n const last: bigint = floorDivide(maximum, step);\n if (first > last)\n throw new Error(\"The range does not contain a multipleOf value.\");\n return between(first, last) * step;\n};\n\n/**\n * Reads one side's inclusive integer bound.\n *\n * `-Infinity` below or `Infinity` above excludes no integer, so it is no bound\n * at all; `Infinity` below or `-Infinity` above excludes every integer.\n */\nconst boundary = (\n inclusive: number | undefined,\n exclusive: number | undefined,\n side: \"lower\" | \"upper\",\n): bigint | null => {\n const candidates: bigint[] = [];\n for (const [value, open] of [\n [inclusive, false],\n [exclusive, true],\n ] as const) {\n if (value === undefined) continue;\n if (Number.isFinite(value) === false) {\n if (value === (side === \"lower\" ? -Infinity : Infinity)) continue;\n throw new Error(\"Numeric range has no finite value.\");\n }\n candidates.push(\n side === \"lower\"\n ? open\n ? BigInt(Math.floor(value)) + BigInt(1)\n : BigInt(Math.ceil(value))\n : open\n ? BigInt(Math.ceil(value)) - BigInt(1)\n : BigInt(Math.floor(value)),\n );\n }\n if (candidates.length === 0) return null;\n return candidates.reduce((x, y) =>\n side === \"lower\" ? (x > y ? x : y) : x < y ? x : y,\n );\n};\n\n/**\n * The smallest positive integer a `multipleOf` divides.\n *\n * An integral step is the integer its double holds; a fractional one, such as\n * `1.5`, steps by its smallest integer multiple (`3`).\n */\nconst integerStep = (multipleOf: number): bigint | null => {\n if (Number.isFinite(multipleOf) === false) return null;\n if (Number.isInteger(multipleOf)) return BigInt(multipleOf);\n return _decimalIntegerStep(multipleOf)?.coefficient ?? null;\n};\n\nconst ceilDivide = (x: bigint, y: bigint): bigint => {\n const quotient: bigint = x / y;\n return x % y > BigInt(0) ? quotient + BigInt(1) : quotient;\n};\n\nconst floorDivide = (x: bigint, y: bigint): bigint => {\n const quotient: bigint = x / y;\n return x % y < BigInt(0) ? quotient - BigInt(1) : quotient;\n};\n\n/** Draws an integer in `[minimum, maximum]`, scaling one 53-bit sample. */\nconst between = (minimum: bigint, maximum: bigint): bigint => {\n const scale: bigint = BigInt(1) << BigInt(53);\n const sample: bigint = BigInt(\n Math.min(\n Number(scale - BigInt(1)),\n Math.floor(Math.max(0, Math.random()) * Number(scale)),\n ),\n );\n return minimum + ((maximum - minimum + BigInt(1)) * sample) / scale;\n};\n"],"mappings":";;;;;;;;;;;;;AAeA,MAAa,iBAAiB,WAAiD;CAC7E,MAAM,QAAuB,SAC3B,OAAO,SACP,OAAO,kBACP,OACF;CACA,MAAM,QAAuB,SAC3B,OAAO,SACP,OAAO,kBACP,OACF;CACA,MAAM,UACJ,UAAU,UAAU,OAAO,OAAO,CAAC,IAAI,QAAQ,OAAO,GAAG;CAC3D,MAAM,UACJ,UAAU,UAAU,OAAO,OAAO,GAAG,IAAI,QAAQ,OAAO,GAAG;CAC7D,IAAI,UAAU,SACZ,MAAM,IAAI,MAAM,8CAA8C;CAChE,IAAI,OAAO,eAAe,KAAA,GAAW,OAAO,QAAQ,SAAS,OAAO;CAEpE,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