typia 13.1.19 → 13.2.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 (169) hide show
  1. package/lib/executable/FileSystemIdentity.d.ts +23 -0
  2. package/lib/executable/FileSystemIdentity.js +30 -0
  3. package/lib/executable/FileSystemIdentity.js.map +1 -1
  4. package/lib/executable/FileSystemIdentity.mjs +4 -0
  5. package/lib/executable/FileSystemIdentity.mjs.map +1 -1
  6. package/lib/executable/TypiaGenerateWizard.js +15 -9
  7. package/lib/executable/TypiaGenerateWizard.js.map +1 -1
  8. package/lib/executable/TypiaGenerateWizard.mjs +11 -7
  9. package/lib/executable/TypiaGenerateWizard.mjs.map +1 -1
  10. package/lib/internal/_ProtobufReader.d.ts +18 -3
  11. package/lib/internal/_ProtobufReader.js +39 -11
  12. package/lib/internal/_ProtobufReader.js.map +1 -1
  13. package/lib/internal/_ProtobufReader.mjs +37 -10
  14. package/lib/internal/_ProtobufReader.mjs.map +1 -1
  15. package/lib/internal/_jsonStringifyArray.d.ts +1 -0
  16. package/lib/internal/_jsonStringifyArray.js +48 -0
  17. package/lib/internal/_jsonStringifyArray.js.map +1 -0
  18. package/lib/internal/_jsonStringifyArray.mjs +40 -0
  19. package/lib/internal/_jsonStringifyArray.mjs.map +1 -0
  20. package/lib/internal/_jsonStringifyElement.d.ts +1 -0
  21. package/lib/internal/_jsonStringifyElement.js +23 -0
  22. package/lib/internal/_jsonStringifyElement.js.map +1 -0
  23. package/lib/internal/_jsonStringifyElement.mjs +23 -0
  24. package/lib/internal/_jsonStringifyElement.mjs.map +1 -0
  25. package/lib/internal/_jsonStringifyProperty.d.ts +1 -0
  26. package/lib/internal/_jsonStringifyProperty.js +31 -0
  27. package/lib/internal/_jsonStringifyProperty.js.map +1 -0
  28. package/lib/internal/_jsonStringifyProperty.mjs +31 -0
  29. package/lib/internal/_jsonStringifyProperty.mjs.map +1 -0
  30. package/lib/internal/_llmApplicationFinalize.js +1 -1
  31. package/lib/internal/_llmApplicationFinalize.js.map +1 -1
  32. package/lib/internal/_llmApplicationFinalize.mjs +1 -1
  33. package/lib/internal/_llmApplicationFinalize.mjs.map +1 -1
  34. package/lib/internal/_randomFormatByte.js +24 -1
  35. package/lib/internal/_randomFormatByte.js.map +1 -1
  36. package/lib/internal/_randomFormatByte.mjs +20 -2
  37. package/lib/internal/_randomFormatByte.mjs.map +1 -1
  38. package/lib/internal/_randomFormatDate.d.ts +3 -6
  39. package/lib/internal/_randomFormatDate.js +2 -10
  40. package/lib/internal/_randomFormatDate.js.map +1 -1
  41. package/lib/internal/_randomFormatDate.mjs +2 -6
  42. package/lib/internal/_randomFormatDate.mjs.map +1 -1
  43. package/lib/internal/_randomFormatDatetime.d.ts +3 -6
  44. package/lib/internal/_randomFormatDatetime.js +25 -8
  45. package/lib/internal/_randomFormatDatetime.js.map +1 -1
  46. package/lib/internal/_randomFormatDatetime.mjs +17 -7
  47. package/lib/internal/_randomFormatDatetime.mjs.map +1 -1
  48. package/lib/internal/_randomFormatDuration.js +23 -15
  49. package/lib/internal/_randomFormatDuration.js.map +1 -1
  50. package/lib/internal/_randomFormatDuration.mjs +23 -15
  51. package/lib/internal/_randomFormatDuration.mjs.map +1 -1
  52. package/lib/internal/_randomFormatIpv4.js +31 -1
  53. package/lib/internal/_randomFormatIpv4.js.map +1 -1
  54. package/lib/internal/_randomFormatIpv4.mjs +23 -2
  55. package/lib/internal/_randomFormatIpv4.mjs.map +1 -1
  56. package/lib/internal/_randomFormatIpv6.js +57 -1
  57. package/lib/internal/_randomFormatIpv6.js.map +1 -1
  58. package/lib/internal/_randomFormatIpv6.mjs +45 -2
  59. package/lib/internal/_randomFormatIpv6.mjs.map +1 -1
  60. package/lib/internal/_randomFormatJsonPointer.js +14 -2
  61. package/lib/internal/_randomFormatJsonPointer.js.map +1 -1
  62. package/lib/internal/_randomFormatJsonPointer.mjs +13 -3
  63. package/lib/internal/_randomFormatJsonPointer.mjs.map +1 -1
  64. package/lib/internal/_randomFormatRegex.js +14 -1
  65. package/lib/internal/_randomFormatRegex.js.map +1 -1
  66. package/lib/internal/_randomFormatRegex.mjs +14 -2
  67. package/lib/internal/_randomFormatRegex.mjs.map +1 -1
  68. package/lib/internal/_randomFormatRelativeJsonPointer.js +19 -5
  69. package/lib/internal/_randomFormatRelativeJsonPointer.js.map +1 -1
  70. package/lib/internal/_randomFormatRelativeJsonPointer.mjs +21 -6
  71. package/lib/internal/_randomFormatRelativeJsonPointer.mjs.map +1 -1
  72. package/lib/internal/_randomFormatTime.js +33 -7
  73. package/lib/internal/_randomFormatTime.js.map +1 -1
  74. package/lib/internal/_randomFormatTime.mjs +37 -5
  75. package/lib/internal/_randomFormatTime.mjs.map +1 -1
  76. package/lib/internal/_randomPattern.js.map +1 -1
  77. package/lib/internal/_randomPattern.mjs.map +1 -1
  78. package/lib/internal/_randomStringLength.d.ts +41 -10
  79. package/lib/internal/_randomStringLength.js +49 -13
  80. package/lib/internal/_randomStringLength.js.map +1 -1
  81. package/lib/internal/_randomStringLength.mjs +48 -13
  82. package/lib/internal/_randomStringLength.mjs.map +1 -1
  83. package/lib/internal/private/__notationRename.js.map +1 -1
  84. package/lib/internal/private/__notationRename.mjs.map +1 -1
  85. package/lib/internal/private/__randomComposition.d.ts +23 -0
  86. package/lib/internal/private/__randomComposition.js +48 -0
  87. package/lib/internal/private/__randomComposition.js.map +1 -0
  88. package/lib/internal/private/__randomComposition.mjs +54 -0
  89. package/lib/internal/private/__randomComposition.mjs.map +1 -0
  90. package/lib/internal/private/__randomEpoch.d.ts +19 -0
  91. package/lib/internal/private/__randomEpoch.js +31 -0
  92. package/lib/internal/private/__randomEpoch.js.map +1 -0
  93. package/lib/internal/private/__randomEpoch.mjs +28 -0
  94. package/lib/internal/private/__randomEpoch.mjs.map +1 -0
  95. package/native/cmd/ttsc-typia/build.go +3 -0
  96. package/native/cmd/ttsc-typia/callable_interface_function_semantics_transform_test.go +331 -0
  97. package/native/cmd/ttsc-typia/callable_type_literal_boundaries_transform_test.go +1184 -0
  98. package/native/cmd/ttsc-typia/compare_functional_union_membership_transform_test.go +434 -0
  99. package/native/cmd/ttsc-typia/compare_template_literal_union_transform_test.go +241 -0
  100. package/native/cmd/ttsc-typia/default_library_spoof_native_identity_transform_test.go +216 -0
  101. package/native/cmd/ttsc-typia/json_schema_dynamic_key_determinism_transform_test.go +246 -0
  102. package/native/cmd/ttsc-typia/json_stringify_contextual_undefined_transform_test.go +556 -0
  103. package/native/cmd/ttsc-typia/lib_replacement_native_identity_transform_test.go +277 -0
  104. package/native/cmd/ttsc-typia/native_named_intersection_union_transform_test.go +390 -0
  105. package/native/cmd/ttsc-typia/node_buffer_native_exports_is_transform_test.go +526 -0
  106. package/native/cmd/ttsc-typia/package_declaration_native_identity_is_transform_test.go +293 -0
  107. package/native/cmd/ttsc-typia/protobuf_diagnostic_code_transform_test.go +167 -0
  108. package/native/cmd/ttsc-typia/symbol_index_domain_transform_test.go +316 -0
  109. package/native/cmd/ttsc-typia/transform.go +23 -0
  110. package/native/cmd/ttsc-typia/transform_helpers_test.go +77 -2
  111. package/native/cmd/ttsc-typia/user_global_native_identity_transform_test.go +484 -0
  112. package/native/core/factories/ProtobufFactory.go +6 -1
  113. package/native/core/factories/internal/metadata/MetadataHelper.go +185 -30
  114. package/native/core/factories/internal/metadata/emplace_metadata_object.go +25 -0
  115. package/native/core/factories/internal/metadata/iterate_metadata_function.go +1 -1
  116. package/native/core/factories/internal/metadata/iterate_metadata_intersection.go +103 -23
  117. package/native/core/factories/internal/metadata/iterate_metadata_map.go +3 -7
  118. package/native/core/factories/internal/metadata/iterate_metadata_native.go +32 -14
  119. package/native/core/factories/internal/metadata/iterate_metadata_set.go +3 -7
  120. package/native/core/programmers/compare/CompareEqualProgrammer.go +27 -13
  121. package/native/core/programmers/helpers/FunctionProgrammer.go +6 -13
  122. package/native/core/programmers/helpers/StringifyJoinder.go +129 -50
  123. package/native/core/programmers/helpers/joiner_branch_coverage_test.go +116 -120
  124. package/native/core/programmers/iterate/iterate_check_coverage_test.go +76 -158
  125. package/native/core/programmers/iterate/iterate_utility_coverage_test.go +231 -270
  126. package/native/core/programmers/iterate/json_schema_object.go +49 -7
  127. package/native/core/programmers/iterate/json_schema_pattern_property_order_test.go +44 -0
  128. package/native/core/programmers/iterate/openapi_v3_downgrader.go +34 -1
  129. package/native/core/programmers/iterate/template_runtime_pattern.go +11 -0
  130. package/native/core/programmers/json/JsonStringifyProgrammer.go +47 -6
  131. package/native/core/programmers/llm/LlmApplicationProgrammer.go +9 -1
  132. package/native/core/programmers/protobuf/ProtobufMessageProgrammer.go +1 -1
  133. package/native/core/schemas/metadata/MetadataCollection.go +0 -9
  134. package/native/core/schemas/metadata/MetadataDefaultLibrary.go +81 -0
  135. package/native/core/schemas/metadata/MetadataObjectType.go +7 -18
  136. package/native/go.mod +4 -4
  137. package/native/transform/features/protobuf/ProtobufMessageTransformer.go +1 -1
  138. package/package.json +3 -7
  139. package/src/executable/FileSystemIdentity.ts +33 -0
  140. package/src/executable/TypiaGenerateWizard.ts +18 -12
  141. package/src/internal/_ProtobufReader.ts +40 -11
  142. package/src/internal/_jsonStringifyArray.ts +50 -0
  143. package/src/internal/_jsonStringifyElement.ts +19 -0
  144. package/src/internal/_jsonStringifyProperty.ts +30 -0
  145. package/src/internal/_llmApplicationFinalize.ts +6 -1
  146. package/src/internal/_randomFormatByte.ts +30 -3
  147. package/src/internal/_randomFormatDate.ts +4 -20
  148. package/src/internal/_randomFormatDatetime.ts +34 -20
  149. package/src/internal/_randomFormatDuration.ts +19 -4
  150. package/src/internal/_randomFormatIpv4.ts +43 -3
  151. package/src/internal/_randomFormatIpv6.ts +67 -3
  152. package/src/internal/_randomFormatJsonPointer.ts +23 -3
  153. package/src/internal/_randomFormatRegex.ts +21 -3
  154. package/src/internal/_randomFormatRelativeJsonPointer.ts +23 -10
  155. package/src/internal/_randomFormatTime.ts +45 -12
  156. package/src/internal/_randomPattern.ts +4 -1
  157. package/src/internal/_randomStringLength.ts +61 -17
  158. package/src/internal/private/__notationRename.ts +1 -4
  159. package/src/internal/private/__randomComposition.ts +50 -0
  160. package/src/internal/private/__randomEpoch.ts +34 -0
  161. package/native/adapter/visit.go +0 -173
  162. package/native/adapter/visit_property_chain_edges_test.go +0 -129
  163. package/native/core/programmers/helpers/disable_function_programmer_declare.go +0 -10
  164. package/native/core/programmers/iterate/check_union_array_like.go +0 -422
  165. package/native/core/programmers/iterate/prune_object_properties.go +0 -105
  166. package/native/core/programmers/iterate/stringify_dynamic_properties.go +0 -219
  167. package/native/core/programmers/iterate/stringify_native.go +0 -14
  168. package/native/core/programmers/iterate/stringify_regular_properties.go +0 -112
  169. package/native/core/schemas/metadata/MetadataApplication.go +0 -41
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_jsonStringifyArray.js","sourceRoot":"","sources":["../../src/internal/_jsonStringifyArray.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACI,MAAM,mBAAmB,GAAG,CACjC,QAAsB,EACtB,MAA0C,EAClC,EAAE;IACV,MAAM,MAAM,GAAW,IAAI,CAAC,GAAG,CAC7B,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,EAC7C,MAAM,CAAC,gBAAgB,CACxB,CAAC;IACF,IAAI,MAAM,GAAW,EAAE,CAAC;IACxB,KAAK,IAAI,CAAC,GAAW,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,GAAkB,QAAQ,CAAC,CAAC,CAAC,CAAC;QACxC,sEAAsE;QACtE,wEAAwE;QACxE,2EAA2E;QAC3E,2EAA2E;QAC3E,wEAAwE;QACxE,0DAA0D;QAC1D,4EAA4E;QAC5E,uCAAuC;QACvC,MAAM,IAAI,GACR,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACnD,MAAM,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACxE,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAxBW,QAAA,mBAAmB,GAAnB,mBAAmB,CAwB9B"}
@@ -0,0 +1,40 @@
1
+ //#region src/internal/_jsonStringifyArray.ts
2
+ /**
3
+ * Serializes the elements of an array the way ECMAScript `JSON.stringify` does.
4
+ *
5
+ * `SerializeJSONArray` walks index `0` to `LengthOfArrayLike(value) - 1` and
6
+ * writes `null` wherever the element serializes to `undefined`. Neither
7
+ * `Array.prototype.map` nor `Array.prototype.join` reproduces that:
8
+ *
9
+ * - `map` never visits a hole and leaves one behind, and `join` renders a hole as
10
+ * empty text, so a sparse array joined into malformed text such as `[,1]`. A
11
+ * hole exists at runtime whatever the element type declares, so this is not
12
+ * an `any` concern.
13
+ * - `join` renders a mapped `undefined` as empty text too, which is what an `any`
14
+ * or `unknown` element holding a function, a symbol, or a `toJSON` that
15
+ * returns nothing serializes to.
16
+ *
17
+ * The length is converted with `ToLength` and read once, which is both what
18
+ * `JSON.stringify` does and what `Array.prototype.every` - the traversal
19
+ * typia's own array checkers emit - does, so the checker and the serializer
20
+ * walk one index range rather than two that merely usually coincide.
21
+ *
22
+ * @param elements Array being serialized.
23
+ * @param mapper Serializer of one element, emitted by the transform.
24
+ * @returns Comma separated element text, without the enclosing brackets.
25
+ * @internal
26
+ */
27
+ const _jsonStringifyArray = (elements, mapper) => {
28
+ const length = Math.min(Math.max(Math.trunc(elements.length) || 0, 0), Number.MAX_SAFE_INTEGER);
29
+ let output = "";
30
+ for (let i = 0; i < length; ++i) {
31
+ const elem = elements[i];
32
+ const text = elem === void 0 ? void 0 : mapper(elem, i);
33
+ output += (i === 0 ? "" : ",") + (text === void 0 ? "null" : text);
34
+ }
35
+ return output;
36
+ };
37
+ //#endregion
38
+ export { _jsonStringifyArray };
39
+
40
+ //# sourceMappingURL=_jsonStringifyArray.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_jsonStringifyArray.mjs","names":[],"sources":["../../src/internal/_jsonStringifyArray.ts"],"sourcesContent":["/**\n * Serializes the elements of an array the way ECMAScript `JSON.stringify` does.\n *\n * `SerializeJSONArray` walks index `0` to `LengthOfArrayLike(value) - 1` and\n * writes `null` wherever the element serializes to `undefined`. Neither\n * `Array.prototype.map` nor `Array.prototype.join` reproduces that:\n *\n * - `map` never visits a hole and leaves one behind, and `join` renders a hole as\n * empty text, so a sparse array joined into malformed text such as `[,1]`. A\n * hole exists at runtime whatever the element type declares, so this is not\n * an `any` concern.\n * - `join` renders a mapped `undefined` as empty text too, which is what an `any`\n * or `unknown` element holding a function, a symbol, or a `toJSON` that\n * returns nothing serializes to.\n *\n * The length is converted with `ToLength` and read once, which is both what\n * `JSON.stringify` does and what `Array.prototype.every` - the traversal\n * typia's own array checkers emit - does, so the checker and the serializer\n * walk one index range rather than two that merely usually coincide.\n *\n * @param elements Array being serialized.\n * @param mapper Serializer of one element, emitted by the transform.\n * @returns Comma separated element text, without the enclosing brackets.\n * @internal\n */\nexport const _jsonStringifyArray = <T>(\n elements: ArrayLike<T>,\n mapper: (elem: T, index: number) => string,\n): string => {\n const length: number = Math.min(\n Math.max(Math.trunc(elements.length) || 0, 0),\n Number.MAX_SAFE_INTEGER,\n );\n let output: string = \"\";\n for (let i: number = 0; i < length; ++i) {\n const elem: T | undefined = elements[i];\n // A hole and an explicit `undefined` are answered without calling the\n // mapper, because the mapper is the element type's own serializer and a\n // typed one has no answer for a missing value. Everything else is answered\n // from the mapper's *result*: an element that is present but serializes to\n // nothing — a function, a symbol, or a `toJSON` returning nothing in an\n // `any` slot — is `null` in an array position, exactly as\n // SerializeJSONArray specifies, and testing the input instead would let its\n // text become the literal `undefined`.\n const text: string | undefined =\n elem === undefined ? undefined : mapper(elem, i);\n output += (i === 0 ? \"\" : \",\") + (text === undefined ? \"null\" : text);\n }\n return output;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,MAAa,uBACX,UACA,WACW;CACX,MAAM,SAAiB,KAAK,IAC1B,KAAK,IAAI,KAAK,MAAM,SAAS,MAAM,KAAK,GAAG,CAAC,GAC5C,OAAO,gBACT;CACA,IAAI,SAAiB;CACrB,KAAK,IAAI,IAAY,GAAG,IAAI,QAAQ,EAAE,GAAG;EACvC,MAAM,OAAsB,SAAS;EASrC,MAAM,OACJ,SAAS,KAAA,IAAY,KAAA,IAAY,OAAO,MAAM,CAAC;EACjD,WAAW,MAAM,IAAI,KAAK,QAAQ,SAAS,KAAA,IAAY,SAAS;CAClE;CACA,OAAO;AACT"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports._jsonStringifyElement = void 0;
4
+ /**
5
+ * Writes one array or tuple element the way ECMAScript `JSON.stringify` writes
6
+ * it.
7
+ *
8
+ * `SerializeJSONArray` writes `null` wherever an element serializes to
9
+ * `undefined`, because an array position cannot be omitted without shifting
10
+ * every element after it. A present value with no serialization — a function, a
11
+ * symbol, or a `toJSON` returning nothing — is therefore `null`, not the
12
+ * literal text `undefined` and not an empty slot.
13
+ *
14
+ * This is the fixed-position counterpart of `_jsonStringifyArray`, which
15
+ * answers the same question while walking an array's own index range.
16
+ *
17
+ * @param text Serialized element value, or `undefined` when it has none.
18
+ * @returns Element text, or `null` when the element has no serialization.
19
+ * @internal
20
+ */
21
+ const _jsonStringifyElement = (text) => text === undefined ? "null" : text;
22
+ exports._jsonStringifyElement = _jsonStringifyElement;
23
+ //# sourceMappingURL=_jsonStringifyElement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_jsonStringifyElement.js","sourceRoot":"","sources":["../../src/internal/_jsonStringifyElement.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;GAgBG;AACI,MAAM,qBAAqB,GAAG,CAAC,IAAwB,EAAU,EAAE,CACxE,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;AADxB,QAAA,qBAAqB,GAArB,qBAAqB,CACG"}
@@ -0,0 +1,23 @@
1
+ //#region src/internal/_jsonStringifyElement.ts
2
+ /**
3
+ * Writes one array or tuple element the way ECMAScript `JSON.stringify` writes
4
+ * it.
5
+ *
6
+ * `SerializeJSONArray` writes `null` wherever an element serializes to
7
+ * `undefined`, because an array position cannot be omitted without shifting
8
+ * every element after it. A present value with no serialization — a function, a
9
+ * symbol, or a `toJSON` returning nothing — is therefore `null`, not the
10
+ * literal text `undefined` and not an empty slot.
11
+ *
12
+ * This is the fixed-position counterpart of `_jsonStringifyArray`, which
13
+ * answers the same question while walking an array's own index range.
14
+ *
15
+ * @param text Serialized element value, or `undefined` when it has none.
16
+ * @returns Element text, or `null` when the element has no serialization.
17
+ * @internal
18
+ */
19
+ const _jsonStringifyElement = (text) => text === void 0 ? "null" : text;
20
+ //#endregion
21
+ export { _jsonStringifyElement };
22
+
23
+ //# sourceMappingURL=_jsonStringifyElement.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_jsonStringifyElement.mjs","names":[],"sources":["../../src/internal/_jsonStringifyElement.ts"],"sourcesContent":["/**\n * Writes one array or tuple element the way ECMAScript `JSON.stringify` writes\n * it.\n *\n * `SerializeJSONArray` writes `null` wherever an element serializes to\n * `undefined`, because an array position cannot be omitted without shifting\n * every element after it. A present value with no serialization — a function, a\n * symbol, or a `toJSON` returning nothing — is therefore `null`, not the\n * literal text `undefined` and not an empty slot.\n *\n * This is the fixed-position counterpart of `_jsonStringifyArray`, which\n * answers the same question while walking an array's own index range.\n *\n * @param text Serialized element value, or `undefined` when it has none.\n * @returns Element text, or `null` when the element has no serialization.\n * @internal\n */\nexport const _jsonStringifyElement = (text: string | undefined): string =>\n text === undefined ? \"null\" : text;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAiBA,MAAa,yBAAyB,SACpC,SAAS,KAAA,IAAY,SAAS"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports._jsonStringifyProperty = void 0;
4
+ /**
5
+ * Writes one object member the way ECMAScript `JSON.stringify` writes it.
6
+ *
7
+ * `SerializeJSONObject` serializes each member first and drops the member
8
+ * entirely when that result is `undefined`. Deciding omission from the _input_
9
+ * instead cannot reach the same answer: a symbol and a `toJSON` returning
10
+ * nothing are both present, non-`undefined`, non-function values whose
11
+ * serialization is `undefined`, so the member's text became the literal
12
+ * `"k":undefined` — output that is not JSON at all.
13
+ *
14
+ * The serialized text is passed in already evaluated, so the member's value is
15
+ * serialized exactly once. Testing the input and then serializing would
16
+ * evaluate a `toJSON` twice, and a `toJSON` is free to answer differently each
17
+ * call.
18
+ *
19
+ * The trailing separator belongs to the member because a dropped member must
20
+ * take its comma with it; `_jsonStringifyTail` removes the one that is left
21
+ * behind when the last written member is the one that dropped.
22
+ *
23
+ * @param head Quoted key and colon, emitted by the transform.
24
+ * @param text Serialized member value, or `undefined` when it has none.
25
+ * @param tail Separator following this member, empty for the last one.
26
+ * @returns Member text, or an empty string when the member is omitted.
27
+ * @internal
28
+ */
29
+ const _jsonStringifyProperty = (head, text, tail) => (text === undefined ? "" : head + text + tail);
30
+ exports._jsonStringifyProperty = _jsonStringifyProperty;
31
+ //# sourceMappingURL=_jsonStringifyProperty.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_jsonStringifyProperty.js","sourceRoot":"","sources":["../../src/internal/_jsonStringifyProperty.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACI,MAAM,sBAAsB,GAAG,CACpC,IAAY,EACZ,IAAwB,EACxB,IAAY,EACJ,EAAE,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;AAJ/C,QAAA,sBAAsB,GAAtB,sBAAsB,CAIyB"}
@@ -0,0 +1,31 @@
1
+ //#region src/internal/_jsonStringifyProperty.ts
2
+ /**
3
+ * Writes one object member the way ECMAScript `JSON.stringify` writes it.
4
+ *
5
+ * `SerializeJSONObject` serializes each member first and drops the member
6
+ * entirely when that result is `undefined`. Deciding omission from the _input_
7
+ * instead cannot reach the same answer: a symbol and a `toJSON` returning
8
+ * nothing are both present, non-`undefined`, non-function values whose
9
+ * serialization is `undefined`, so the member's text became the literal
10
+ * `"k":undefined` — output that is not JSON at all.
11
+ *
12
+ * The serialized text is passed in already evaluated, so the member's value is
13
+ * serialized exactly once. Testing the input and then serializing would
14
+ * evaluate a `toJSON` twice, and a `toJSON` is free to answer differently each
15
+ * call.
16
+ *
17
+ * The trailing separator belongs to the member because a dropped member must
18
+ * take its comma with it; `_jsonStringifyTail` removes the one that is left
19
+ * behind when the last written member is the one that dropped.
20
+ *
21
+ * @param head Quoted key and colon, emitted by the transform.
22
+ * @param text Serialized member value, or `undefined` when it has none.
23
+ * @param tail Separator following this member, empty for the last one.
24
+ * @returns Member text, or an empty string when the member is omitted.
25
+ * @internal
26
+ */
27
+ const _jsonStringifyProperty = (head, text, tail) => text === void 0 ? "" : head + text + tail;
28
+ //#endregion
29
+ export { _jsonStringifyProperty };
30
+
31
+ //# sourceMappingURL=_jsonStringifyProperty.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_jsonStringifyProperty.mjs","names":[],"sources":["../../src/internal/_jsonStringifyProperty.ts"],"sourcesContent":["/**\n * Writes one object member the way ECMAScript `JSON.stringify` writes it.\n *\n * `SerializeJSONObject` serializes each member first and drops the member\n * entirely when that result is `undefined`. Deciding omission from the _input_\n * instead cannot reach the same answer: a symbol and a `toJSON` returning\n * nothing are both present, non-`undefined`, non-function values whose\n * serialization is `undefined`, so the member's text became the literal\n * `\"k\":undefined` — output that is not JSON at all.\n *\n * The serialized text is passed in already evaluated, so the member's value is\n * serialized exactly once. Testing the input and then serializing would\n * evaluate a `toJSON` twice, and a `toJSON` is free to answer differently each\n * call.\n *\n * The trailing separator belongs to the member because a dropped member must\n * take its comma with it; `_jsonStringifyTail` removes the one that is left\n * behind when the last written member is the one that dropped.\n *\n * @param head Quoted key and colon, emitted by the transform.\n * @param text Serialized member value, or `undefined` when it has none.\n * @param tail Separator following this member, empty for the last one.\n * @returns Member text, or an empty string when the member is omitted.\n * @internal\n */\nexport const _jsonStringifyProperty = (\n head: string,\n text: string | undefined,\n tail: string,\n): string => (text === undefined ? \"\" : head + text + tail);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,MAAa,0BACX,MACA,MACA,SACY,SAAS,KAAA,IAAY,KAAK,OAAO,OAAO"}
@@ -2,6 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports._llmApplicationFinalize = void 0;
4
4
  const utils_1 = require("@typia/utils");
5
- const _llmApplicationFinalize = (app, config) => { var _a; return (Object.assign(Object.assign({}, app), { config: Object.assign(Object.assign({}, utils_1.LlmSchemaConverter.getConfig()), { validate: (_a = config === null || config === void 0 ? void 0 : config.validate) !== null && _a !== void 0 ? _a : null }), functions: app.functions.map((func) => { var _a; var _b; return (Object.assign(Object.assign({}, func), { parse: (input) => utils_1.LlmJson.parse(input, func.parameters), coerce: (input) => utils_1.LlmJson.coerce(input, func.parameters), validate: (_b = (_a = config === null || config === void 0 ? void 0 : config.validate) === null || _a === void 0 ? void 0 : _a[func.name]) !== null && _b !== void 0 ? _b : func.validate })); }) })); };
5
+ const _llmApplicationFinalize = (app, config) => { var _a; return (Object.assign(Object.assign({}, app), { config: Object.assign(Object.assign({}, utils_1.LlmSchemaConverter.getConfig(app.config)), { validate: (_a = config === null || config === void 0 ? void 0 : config.validate) !== null && _a !== void 0 ? _a : null }), functions: app.functions.map((func) => { var _a; var _b; return (Object.assign(Object.assign({}, func), { parse: (input) => utils_1.LlmJson.parse(input, func.parameters), coerce: (input) => utils_1.LlmJson.coerce(input, func.parameters), validate: (_b = (_a = config === null || config === void 0 ? void 0 : config.validate) === null || _a === void 0 ? void 0 : _a[func.name]) !== null && _b !== void 0 ? _b : func.validate })); }) })); };
6
6
  exports._llmApplicationFinalize = _llmApplicationFinalize;
7
7
  //# sourceMappingURL=_llmApplicationFinalize.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"_llmApplicationFinalize.js","sourceRoot":"","sources":["../../src/internal/_llmApplicationFinalize.ts"],"names":[],"mappings":";;;AACA,wCAA2D;AAEpD,MAAM,uBAAuB,GAAG,CACrC,GAAwC,EACxC,MAA2D,EACnC,EAAE,kBAAC,iCACxB,GAAG,KACN,MAAM,kCACD,0BAAkB,CAAC,SAAS,EAAE,KACjC,QAAQ,QAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,QAAQ,mCAAI,IAAI,KAEpC,SAAS,EAAE,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,0BAAC,iCAClC,IAAI,KACP,KAAK,EAAE,CAAC,KAAa,EAA6B,EAAE,CAClD,eAAO,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,EACvC,MAAM,EAAE,CAAC,KAAc,EAAW,EAAE,CAAC,eAAO,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,EAC3E,QAAQ,QAAE,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,QAAQ,0CAAG,IAAI,CAAC,IAAI,CAAC,mCAAI,IAAI,CAAC,QAAQ,IACxD,GAAA,CAAC,IACH,GAAA,CAAC;AAhBU,QAAA,uBAAuB,GAAvB,uBAAuB,CAgBjC"}
1
+ {"version":3,"file":"_llmApplicationFinalize.js","sourceRoot":"","sources":["../../src/internal/_llmApplicationFinalize.ts"],"names":[],"mappings":";;;AACA,wCAA2D;AAEpD,MAAM,uBAAuB,GAAG,CACrC,GAAwC,EACxC,MAA2D,EACnC,EAAE,kBAAC,iCACxB,GAAG,KACN,MAAM,kCAMD,0BAAkB,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,KAC3C,QAAQ,QAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,QAAQ,mCAAI,IAAI,KAEpC,SAAS,EAAE,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,0BAAC,iCAClC,IAAI,KACP,KAAK,EAAE,CAAC,KAAa,EAA6B,EAAE,CAClD,eAAO,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,EACvC,MAAM,EAAE,CAAC,KAAc,EAAW,EAAE,CAAC,eAAO,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,EAC3E,QAAQ,QAAE,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,QAAQ,0CAAG,IAAI,CAAC,IAAI,CAAC,mCAAI,IAAI,CAAC,QAAQ,IACxD,GAAA,CAAC,IACH,GAAA,CAAC;AArBU,QAAA,uBAAuB,GAAvB,uBAAuB,CAqBjC"}
@@ -3,7 +3,7 @@ import { LlmJson, LlmSchemaConverter } from "@typia/utils";
3
3
  const _llmApplicationFinalize = (app, config) => ({
4
4
  ...app,
5
5
  config: {
6
- ...LlmSchemaConverter.getConfig(),
6
+ ...LlmSchemaConverter.getConfig(app.config),
7
7
  validate: config?.validate ?? null
8
8
  },
9
9
  functions: app.functions.map((func) => ({
@@ -1 +1 @@
1
- {"version":3,"file":"_llmApplicationFinalize.mjs","names":[],"sources":["../../src/internal/_llmApplicationFinalize.ts"],"sourcesContent":["import { IJsonParseResult, ILlmApplication } from \"@typia/interface\";\nimport { LlmJson, LlmSchemaConverter } from \"@typia/utils\";\n\nexport const _llmApplicationFinalize = <Class extends object = any>(\n app: ILlmApplication.__IPrimitive<Class>,\n config?: Partial<Pick<ILlmApplication.IConfig, \"validate\">>,\n): ILlmApplication<Class> => ({\n ...app,\n config: {\n ...LlmSchemaConverter.getConfig(),\n validate: config?.validate ?? null,\n },\n functions: app.functions.map((func) => ({\n ...func,\n parse: (input: string): IJsonParseResult<unknown> =>\n LlmJson.parse(input, func.parameters),\n coerce: (input: unknown): unknown => LlmJson.coerce(input, func.parameters),\n validate: config?.validate?.[func.name] ?? func.validate,\n })),\n});\n"],"mappings":";;AAGA,MAAa,2BACX,KACA,YAC4B;CAC5B,GAAG;CACH,QAAQ;EACN,GAAG,mBAAmB,UAAU;EAChC,UAAU,QAAQ,YAAY;CAChC;CACA,WAAW,IAAI,UAAU,KAAK,UAAU;EACtC,GAAG;EACH,QAAQ,UACN,QAAQ,MAAM,OAAO,KAAK,UAAU;EACtC,SAAS,UAA4B,QAAQ,OAAO,OAAO,KAAK,UAAU;EAC1E,UAAU,QAAQ,WAAW,KAAK,SAAS,KAAK;CAClD,EAAE;AACJ"}
1
+ {"version":3,"file":"_llmApplicationFinalize.mjs","names":[],"sources":["../../src/internal/_llmApplicationFinalize.ts"],"sourcesContent":["import { IJsonParseResult, ILlmApplication } from \"@typia/interface\";\nimport { LlmJson, LlmSchemaConverter } from \"@typia/utils\";\n\nexport const _llmApplicationFinalize = <Class extends object = any>(\n app: ILlmApplication.__IPrimitive<Class>,\n config?: Partial<Pick<ILlmApplication.IConfig, \"validate\">>,\n): ILlmApplication<Class> => ({\n ...app,\n config: {\n // The schema configuration comes from the emitted application, which is\n // where the `Config` generic was resolved. Rebuilding it from the\n // converter's defaults reported `strict: false` for a strict build, and\n // `@typia/mcp` then inverted a strict output schema without strict, which\n // drops every constraint it carries as a description tag (issue #2293).\n ...LlmSchemaConverter.getConfig(app.config),\n validate: config?.validate ?? null,\n },\n functions: app.functions.map((func) => ({\n ...func,\n parse: (input: string): IJsonParseResult<unknown> =>\n LlmJson.parse(input, func.parameters),\n coerce: (input: unknown): unknown => LlmJson.coerce(input, func.parameters),\n validate: config?.validate?.[func.name] ?? func.validate,\n })),\n});\n"],"mappings":";;AAGA,MAAa,2BACX,KACA,YAC4B;CAC5B,GAAG;CACH,QAAQ;EAMN,GAAG,mBAAmB,UAAU,IAAI,MAAM;EAC1C,UAAU,QAAQ,YAAY;CAChC;CACA,WAAW,IAAI,UAAU,KAAK,UAAU;EACtC,GAAG;EACH,QAAQ,UACN,QAAQ,MAAM,OAAO,KAAK,UAAU;EACtC,SAAS,UAA4B,QAAQ,OAAO,OAAO,KAAK,UAAU;EAC1E,UAAU,QAAQ,WAAW,KAAK,SAAS,KAAK;CAClD,EAAE;AACJ"}
@@ -1,8 +1,31 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports._randomFormatByte = void 0;
4
+ const _randomString_1 = require("./_randomString");
4
5
  const _randomStringLength_1 = require("./_randomStringLength");
5
- const _randomFormatByte = (props) => (0, _randomStringLength_1._randomFormatLength)(props, () => FIXED);
6
+ const _randomFormatByte = (props) => {
7
+ if ((props === null || props === void 0 ? void 0 : props.minLength) === undefined && (props === null || props === void 0 ? void 0 : props.maxLength) === undefined)
8
+ return FIXED;
9
+ // Base64 encodes three bytes as four characters, so a valid length is always
10
+ // a multiple of four; the window is raised to the first multiple it contains
11
+ // and the draw steps by four from there. Every character `_randomString`
12
+ // emits is in the base64 alphabet, so the result needs no padding.
13
+ const window = (0, _randomStringLength_1._randomLengthWindow)(props, { minimum: 0, spread: 16 });
14
+ const low = Math.ceil(window.low / 4) * 4;
15
+ if (low > window.high)
16
+ throw new Error(_randomStringLength_1._RANDOM_LENGTH_ERROR);
17
+ const length = low +
18
+ 4 *
19
+ (0, _randomStringLength_1._randomLengthPick)({
20
+ low: 0,
21
+ high: Math.floor((window.high - low) / 4),
22
+ });
23
+ return (0, _randomString_1._randomString)({
24
+ type: "string",
25
+ minLength: length,
26
+ maxLength: length,
27
+ });
28
+ };
6
29
  exports._randomFormatByte = _randomFormatByte;
7
30
  const FIXED = "vt7ekz4lIoNTTS9sDQYdWKharxIFAR54+z/umIxSgUM=";
8
31
  //# sourceMappingURL=_randomFormatByte.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"_randomFormatByte.js","sourceRoot":"","sources":["../../src/internal/_randomFormatByte.ts"],"names":[],"mappings":";;;AAAA,+DAA2E;AAEpE,MAAM,iBAAiB,GAAG,CAAC,KAAqB,EAAU,EAAE,CACjE,IAAA,yCAAmB,EAAC,KAAK,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;AAD7B,QAAA,iBAAiB,GAAjB,iBAAiB,CACY;AAE1C,MAAM,KAAK,GAAG,8CAA8C,CAAC"}
1
+ {"version":3,"file":"_randomFormatByte.js","sourceRoot":"","sources":["../../src/internal/_randomFormatByte.ts"],"names":[],"mappings":";;;AAAA,mDAAgD;AAChD,+DAK+B;AAExB,MAAM,iBAAiB,GAAG,CAAC,KAAqB,EAAU,EAAE;IACjE,IAAI,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS,MAAK,SAAS,IAAI,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS,MAAK,SAAS;QAClE,OAAO,KAAK,CAAC;IACf,6EAA6E;IAC7E,6EAA6E;IAC7E,yEAAyE;IACzE,mEAAmE;IACnE,MAAM,MAAM,GAAG,IAAA,yCAAmB,EAAC,KAAK,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;IACtE,MAAM,GAAG,GAAW,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;IAClD,IAAI,GAAG,GAAG,MAAM,CAAC,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,0CAAoB,CAAC,CAAC;IAC7D,MAAM,MAAM,GACV,GAAG;QACH,CAAC;YACC,IAAA,uCAAiB,EAAC;gBAChB,GAAG,EAAE,CAAC;gBACN,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;aAC1C,CAAC,CAAC;IACP,OAAO,IAAA,6BAAa,EAAC;QACnB,IAAI,EAAE,QAAQ;QACd,SAAS,EAAE,MAAM;QACjB,SAAS,EAAE,MAAM;KAClB,CAAC,CAAC;AACL,CAAC,CAAC;AAtBW,QAAA,iBAAiB,GAAjB,iBAAiB,CAsB5B;AAEF,MAAM,KAAK,GAAG,8CAA8C,CAAC"}
@@ -1,6 +1,24 @@
1
- import { _randomFormatLength } from "./_randomStringLength.mjs";
1
+ import { _randomString } from "./_randomString.mjs";
2
+ import { _RANDOM_LENGTH_ERROR, _randomLengthPick, _randomLengthWindow } from "./_randomStringLength.mjs";
2
3
  //#region src/internal/_randomFormatByte.ts
3
- const _randomFormatByte = (props) => _randomFormatLength(props, () => FIXED);
4
+ const _randomFormatByte = (props) => {
5
+ if (props?.minLength === void 0 && props?.maxLength === void 0) return FIXED;
6
+ const window = _randomLengthWindow(props, {
7
+ minimum: 0,
8
+ spread: 16
9
+ });
10
+ const low = Math.ceil(window.low / 4) * 4;
11
+ if (low > window.high) throw new Error(_RANDOM_LENGTH_ERROR);
12
+ const length = low + 4 * _randomLengthPick({
13
+ low: 0,
14
+ high: Math.floor((window.high - low) / 4)
15
+ });
16
+ return _randomString({
17
+ type: "string",
18
+ minLength: length,
19
+ maxLength: length
20
+ });
21
+ };
4
22
  const FIXED = "vt7ekz4lIoNTTS9sDQYdWKharxIFAR54+z/umIxSgUM=";
5
23
  //#endregion
6
24
  export { _randomFormatByte };
@@ -1 +1 @@
1
- {"version":3,"file":"_randomFormatByte.mjs","names":[],"sources":["../../src/internal/_randomFormatByte.ts"],"sourcesContent":["import { _ILengthProps, _randomFormatLength } from \"./_randomStringLength\";\n\nexport const _randomFormatByte = (props?: _ILengthProps): string =>\n _randomFormatLength(props, () => FIXED);\n\nconst FIXED = \"vt7ekz4lIoNTTS9sDQYdWKharxIFAR54+z/umIxSgUM=\";\n"],"mappings":";;AAEA,MAAa,qBAAqB,UAChC,oBAAoB,aAAa,KAAK;AAExC,MAAM,QAAQ"}
1
+ {"version":3,"file":"_randomFormatByte.mjs","names":[],"sources":["../../src/internal/_randomFormatByte.ts"],"sourcesContent":["import { _randomString } from \"./_randomString\";\nimport {\n _ILengthProps,\n _RANDOM_LENGTH_ERROR,\n _randomLengthPick,\n _randomLengthWindow,\n} from \"./_randomStringLength\";\n\nexport const _randomFormatByte = (props?: _ILengthProps): string => {\n if (props?.minLength === undefined && props?.maxLength === undefined)\n return FIXED;\n // Base64 encodes three bytes as four characters, so a valid length is always\n // a multiple of four; the window is raised to the first multiple it contains\n // and the draw steps by four from there. Every character `_randomString`\n // emits is in the base64 alphabet, so the result needs no padding.\n const window = _randomLengthWindow(props, { minimum: 0, spread: 16 });\n const low: number = Math.ceil(window.low / 4) * 4;\n if (low > window.high) throw new Error(_RANDOM_LENGTH_ERROR);\n const length: number =\n low +\n 4 *\n _randomLengthPick({\n low: 0,\n high: Math.floor((window.high - low) / 4),\n });\n return _randomString({\n type: \"string\",\n minLength: length,\n maxLength: length,\n });\n};\n\nconst FIXED = \"vt7ekz4lIoNTTS9sDQYdWKharxIFAR54+z/umIxSgUM=\";\n"],"mappings":";;;AAQA,MAAa,qBAAqB,UAAkC;CAClE,IAAI,OAAO,cAAc,KAAA,KAAa,OAAO,cAAc,KAAA,GACzD,OAAO;CAKT,MAAM,SAAS,oBAAoB,OAAO;EAAE,SAAS;EAAG,QAAQ;CAAG,CAAC;CACpE,MAAM,MAAc,KAAK,KAAK,OAAO,MAAM,CAAC,IAAI;CAChD,IAAI,MAAM,OAAO,MAAM,MAAM,IAAI,MAAM,oBAAoB;CAC3D,MAAM,SACJ,MACA,IACE,kBAAkB;EAChB,KAAK;EACL,MAAM,KAAK,OAAO,OAAO,OAAO,OAAO,CAAC;CAC1C,CAAC;CACL,OAAO,cAAc;EACnB,MAAM;EACN,WAAW;EACX,WAAW;CACb,CAAC;AACH;AAEA,MAAM,QAAQ"}
@@ -1,6 +1,3 @@
1
- export declare const _randomFormatDate: (props?: {
2
- minimum?: number;
3
- maximum?: number;
4
- minLength?: number;
5
- maxLength?: number;
6
- }) => string;
1
+ import { _ILengthProps } from "./_randomStringLength";
2
+ import { __IEpochProps } from "./private/__randomEpoch";
3
+ export declare const _randomFormatDate: (props?: __IEpochProps & _ILengthProps) => string;
@@ -1,16 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports._randomFormatDate = void 0;
4
- const _randomInteger_1 = require("./_randomInteger");
5
4
  const _randomStringLength_1 = require("./_randomStringLength");
6
- const _randomFormatDate = (props) => (0, _randomStringLength_1._randomFormatLength)(props, () => { var _a, _b; return new Date((0, _randomInteger_1._randomInteger)({
7
- type: "integer",
8
- minimum: (_a = props === null || props === void 0 ? void 0 : props.minimum) !== null && _a !== void 0 ? _a : 0,
9
- maximum: ((_b = props === null || props === void 0 ? void 0 : props.maximum) !== null && _b !== void 0 ? _b : (props === null || props === void 0 ? void 0 : props.minimum) === undefined)
10
- ? Date.now()
11
- : props.minimum + 365 * 24 * 60 * 60 * 1000,
12
- }))
13
- .toISOString()
14
- .substring(0, 10); });
5
+ const __randomEpoch_1 = require("./private/__randomEpoch");
6
+ const _randomFormatDate = (props) => (0, _randomStringLength_1._randomFormatLength)(props, () => new Date((0, __randomEpoch_1.__randomEpoch)(props)).toISOString().substring(0, 10));
15
7
  exports._randomFormatDate = _randomFormatDate;
16
8
  //# sourceMappingURL=_randomFormatDate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"_randomFormatDate.js","sourceRoot":"","sources":["../../src/internal/_randomFormatDate.ts"],"names":[],"mappings":";;;AAAA,qDAAkD;AAClD,+DAA4D;AAErD,MAAM,iBAAiB,GAAG,CAAC,KAKjC,EAAE,EAAE,CACH,IAAA,yCAAmB,EAAC,KAAK,EAAE,GAAG,EAAE,sBAC9B,IAAI,IAAI,CACN,IAAA,+BAAc,EAAC;IACb,IAAI,EAAE,SAAS;IACf,OAAO,QAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,OAAO,mCAAI,CAAC;IAC5B,OAAO,EACL,OAAC,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,OAAO,mCAAI,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,OAAO,MAAK,SAAS,CAAC;QAC9C,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;QACZ,CAAC,CAAC,KAAK,CAAC,OAAO,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAK;CACjD,CAAC,CACH;KACE,WAAW,EAAE;KACb,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,GAAA,CACpB,CAAC;AAnBS,QAAA,iBAAiB,GAAjB,iBAAiB,CAmB1B"}
1
+ {"version":3,"file":"_randomFormatDate.js","sourceRoot":"","sources":["../../src/internal/_randomFormatDate.ts"],"names":[],"mappings":";;;AAAA,+DAA2E;AAC3E,2DAAuE;AAEhE,MAAM,iBAAiB,GAAG,CAAC,KAAqC,EAAE,EAAE,CACzE,IAAA,yCAAmB,EAAC,KAAK,EAAE,GAAG,EAAE,CAC9B,IAAI,IAAI,CAAC,IAAA,6BAAa,EAAC,KAAK,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAC9D,CAAC;AAHS,QAAA,iBAAiB,GAAjB,iBAAiB,CAG1B"}
@@ -1,11 +1,7 @@
1
- import { _randomInteger } from "./_randomInteger.mjs";
2
1
  import { _randomFormatLength } from "./_randomStringLength.mjs";
2
+ import { __randomEpoch } from "./private/__randomEpoch.mjs";
3
3
  //#region src/internal/_randomFormatDate.ts
4
- const _randomFormatDate = (props) => _randomFormatLength(props, () => new Date(_randomInteger({
5
- type: "integer",
6
- minimum: props?.minimum ?? 0,
7
- maximum: props?.maximum ?? props?.minimum === void 0 ? Date.now() : props.minimum + 365 * 24 * 60 * 60 * 1e3
8
- })).toISOString().substring(0, 10));
4
+ const _randomFormatDate = (props) => _randomFormatLength(props, () => new Date(__randomEpoch(props)).toISOString().substring(0, 10));
9
5
  //#endregion
10
6
  export { _randomFormatDate };
11
7
 
@@ -1 +1 @@
1
- {"version":3,"file":"_randomFormatDate.mjs","names":[],"sources":["../../src/internal/_randomFormatDate.ts"],"sourcesContent":["import { _randomInteger } from \"./_randomInteger\";\nimport { _randomFormatLength } from \"./_randomStringLength\";\n\nexport const _randomFormatDate = (props?: {\n minimum?: number;\n maximum?: number;\n minLength?: number;\n maxLength?: number;\n}) =>\n _randomFormatLength(props, () =>\n new Date(\n _randomInteger({\n type: \"integer\",\n minimum: props?.minimum ?? 0,\n maximum:\n (props?.maximum ?? props?.minimum === undefined)\n ? Date.now()\n : props.minimum + 365 * 24 * 60 * 60 * 1_000,\n }),\n )\n .toISOString()\n .substring(0, 10),\n );\n"],"mappings":";;;AAGA,MAAa,qBAAqB,UAMhC,oBAAoB,aAClB,IAAI,KACF,eAAe;CACb,MAAM;CACN,SAAS,OAAO,WAAW;CAC3B,SACG,OAAO,WAAW,OAAO,YAAY,KAAA,IAClC,KAAK,IAAI,IACT,MAAM,UAAU,MAAM,KAAK,KAAK,KAAK;AAC7C,CAAC,CACH,CAAC,CACE,YAAY,CAAC,CACb,UAAU,GAAG,EAAE,CACpB"}
1
+ {"version":3,"file":"_randomFormatDate.mjs","names":[],"sources":["../../src/internal/_randomFormatDate.ts"],"sourcesContent":["import { _ILengthProps, _randomFormatLength } from \"./_randomStringLength\";\nimport { __IEpochProps, __randomEpoch } from \"./private/__randomEpoch\";\n\nexport const _randomFormatDate = (props?: __IEpochProps & _ILengthProps) =>\n _randomFormatLength(props, () =>\n new Date(__randomEpoch(props)).toISOString().substring(0, 10),\n );\n"],"mappings":";;;AAGA,MAAa,qBAAqB,UAChC,oBAAoB,aAClB,IAAI,KAAK,cAAc,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,UAAU,GAAG,EAAE,CAC9D"}
@@ -1,6 +1,3 @@
1
- export declare const _randomFormatDatetime: (props?: {
2
- minimum?: number;
3
- maximum?: number;
4
- minLength?: number;
5
- maxLength?: number;
6
- }) => string;
1
+ import { _ILengthProps } from "./_randomStringLength";
2
+ import { __IEpochProps } from "./private/__randomEpoch";
3
+ export declare const _randomFormatDatetime: (props?: __IEpochProps & _ILengthProps) => string;
@@ -1,14 +1,31 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports._randomFormatDatetime = void 0;
4
- const _randomInteger_1 = require("./_randomInteger");
5
4
  const _randomStringLength_1 = require("./_randomStringLength");
6
- const _randomFormatDatetime = (props) => (0, _randomStringLength_1._randomFormatLength)(props, () => { var _a, _b; return new Date((0, _randomInteger_1._randomInteger)({
7
- type: "integer",
8
- minimum: (_a = props === null || props === void 0 ? void 0 : props.minimum) !== null && _a !== void 0 ? _a : 0,
9
- maximum: ((_b = props === null || props === void 0 ? void 0 : props.maximum) !== null && _b !== void 0 ? _b : (props === null || props === void 0 ? void 0 : props.minimum) === undefined)
10
- ? Date.now()
11
- : props.minimum + 365 * 24 * 60 * 60 * 1000,
12
- })).toISOString(); });
5
+ const __randomComposition_1 = require("./private/__randomComposition");
6
+ const __randomEpoch_1 = require("./private/__randomEpoch");
7
+ const _randomFormatDatetime = (props) => {
8
+ const instant = () => new Date((0, __randomEpoch_1.__randomEpoch)(props)).toISOString();
9
+ if ((props === null || props === void 0 ? void 0 : props.minLength) === undefined && (props === null || props === void 0 ? void 0 : props.maxLength) === undefined)
10
+ return instant();
11
+ // `YYYY-MM-DDTHH:MM:SS` plus `Z` is the shortest instant, and a fractional
12
+ // second grows it one digit at a time. Because that fraction needs both a dot
13
+ // and at least one digit, 21 is the single length between the two forms that
14
+ // no instant can have.
15
+ const window = (0, _randomStringLength_1._randomLengthWindow)(props, {
16
+ minimum: SECONDS + 1,
17
+ spread: 8,
18
+ });
19
+ let length = (0, _randomStringLength_1._randomLengthPick)(window);
20
+ if (length === SECONDS + 2)
21
+ length = window.high >= SECONDS + 3 ? SECONDS + 3 : SECONDS + 1;
22
+ if (length < window.low || length > window.high)
23
+ throw new Error(_randomStringLength_1._RANDOM_LENGTH_ERROR);
24
+ const base = instant().substring(0, SECONDS);
25
+ return length === SECONDS + 1
26
+ ? `${base}Z`
27
+ : `${base}.${(0, __randomComposition_1.__randomDigits)(length - SECONDS - 2)}Z`;
28
+ };
13
29
  exports._randomFormatDatetime = _randomFormatDatetime;
30
+ const SECONDS = "0000-00-00T00:00:00".length;
14
31
  //# sourceMappingURL=_randomFormatDatetime.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"_randomFormatDatetime.js","sourceRoot":"","sources":["../../src/internal/_randomFormatDatetime.ts"],"names":[],"mappings":";;;AAAA,qDAAkD;AAClD,+DAA4D;AAErD,MAAM,qBAAqB,GAAG,CAAC,KAKrC,EAAE,EAAE,CACH,IAAA,yCAAmB,EAAC,KAAK,EAAE,GAAG,EAAE,sBAC9B,IAAI,IAAI,CACN,IAAA,+BAAc,EAAC;IACb,IAAI,EAAE,SAAS;IACf,OAAO,QAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,OAAO,mCAAI,CAAC;IAC5B,OAAO,EACL,OAAC,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,OAAO,mCAAI,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,OAAO,MAAK,SAAS,CAAC;QAC9C,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;QACZ,CAAC,CAAC,KAAK,CAAC,OAAO,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAK;CACjD,CAAC,CACH,CAAC,WAAW,EAAE,GAAA,CAChB,CAAC;AAjBS,QAAA,qBAAqB,GAArB,qBAAqB,CAiB9B"}
1
+ {"version":3,"file":"_randomFormatDatetime.js","sourceRoot":"","sources":["../../src/internal/_randomFormatDatetime.ts"],"names":[],"mappings":";;;AAAA,+DAK+B;AAC/B,uEAA+D;AAC/D,2DAAuE;AAEhE,MAAM,qBAAqB,GAAG,CACnC,KAAqC,EACrC,EAAE;IACF,MAAM,OAAO,GAAG,GAAW,EAAE,CAAC,IAAI,IAAI,CAAC,IAAA,6BAAa,EAAC,KAAK,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IAC3E,IAAI,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS,MAAK,SAAS,IAAI,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS,MAAK,SAAS;QAClE,OAAO,OAAO,EAAE,CAAC;IACnB,2EAA2E;IAC3E,8EAA8E;IAC9E,6EAA6E;IAC7E,uBAAuB;IACvB,MAAM,MAAM,GAAG,IAAA,yCAAmB,EAAC,KAAK,EAAE;QACxC,OAAO,EAAE,OAAO,GAAG,CAAC;QACpB,MAAM,EAAE,CAAC;KACV,CAAC,CAAC;IACH,IAAI,MAAM,GAAW,IAAA,uCAAiB,EAAC,MAAM,CAAC,CAAC;IAC/C,IAAI,MAAM,KAAK,OAAO,GAAG,CAAC;QACxB,MAAM,GAAG,MAAM,CAAC,IAAI,IAAI,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC;IAClE,IAAI,MAAM,GAAG,MAAM,CAAC,GAAG,IAAI,MAAM,GAAG,MAAM,CAAC,IAAI;QAC7C,MAAM,IAAI,KAAK,CAAC,0CAAoB,CAAC,CAAC;IACxC,MAAM,IAAI,GAAW,OAAO,EAAE,CAAC,SAAS,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IACrD,OAAO,MAAM,KAAK,OAAO,GAAG,CAAC;QAC3B,CAAC,CAAC,GAAG,IAAI,GAAG;QACZ,CAAC,CAAC,GAAG,IAAI,IAAI,IAAA,oCAAc,EAAC,MAAM,GAAG,OAAO,GAAG,CAAC,CAAC,GAAG,CAAC;AACzD,CAAC,CAAC;AAvBW,QAAA,qBAAqB,GAArB,qBAAqB,CAuBhC;AAEF,MAAM,OAAO,GAAG,qBAAqB,CAAC,MAAM,CAAC"}
@@ -1,11 +1,21 @@
1
- import { _randomInteger } from "./_randomInteger.mjs";
2
- import { _randomFormatLength } from "./_randomStringLength.mjs";
1
+ import { _RANDOM_LENGTH_ERROR, _randomLengthPick, _randomLengthWindow } from "./_randomStringLength.mjs";
2
+ import { __randomEpoch } from "./private/__randomEpoch.mjs";
3
+ import { __randomDigits } from "./private/__randomComposition.mjs";
3
4
  //#region src/internal/_randomFormatDatetime.ts
4
- const _randomFormatDatetime = (props) => _randomFormatLength(props, () => new Date(_randomInteger({
5
- type: "integer",
6
- minimum: props?.minimum ?? 0,
7
- maximum: props?.maximum ?? props?.minimum === void 0 ? Date.now() : props.minimum + 365 * 24 * 60 * 60 * 1e3
8
- })).toISOString());
5
+ const _randomFormatDatetime = (props) => {
6
+ const instant = () => new Date(__randomEpoch(props)).toISOString();
7
+ if (props?.minLength === void 0 && props?.maxLength === void 0) return instant();
8
+ const window = _randomLengthWindow(props, {
9
+ minimum: SECONDS + 1,
10
+ spread: 8
11
+ });
12
+ let length = _randomLengthPick(window);
13
+ if (length === SECONDS + 2) length = window.high >= SECONDS + 3 ? SECONDS + 3 : SECONDS + 1;
14
+ if (length < window.low || length > window.high) throw new Error(_RANDOM_LENGTH_ERROR);
15
+ const base = instant().substring(0, SECONDS);
16
+ return length === SECONDS + 1 ? `${base}Z` : `${base}.${__randomDigits(length - SECONDS - 2)}Z`;
17
+ };
18
+ const SECONDS = 19;
9
19
  //#endregion
10
20
  export { _randomFormatDatetime };
11
21
 
@@ -1 +1 @@
1
- {"version":3,"file":"_randomFormatDatetime.mjs","names":[],"sources":["../../src/internal/_randomFormatDatetime.ts"],"sourcesContent":["import { _randomInteger } from \"./_randomInteger\";\nimport { _randomFormatLength } from \"./_randomStringLength\";\n\nexport const _randomFormatDatetime = (props?: {\n minimum?: number;\n maximum?: number;\n minLength?: number;\n maxLength?: number;\n}) =>\n _randomFormatLength(props, () =>\n new Date(\n _randomInteger({\n type: \"integer\",\n minimum: props?.minimum ?? 0,\n maximum:\n (props?.maximum ?? props?.minimum === undefined)\n ? Date.now()\n : props.minimum + 365 * 24 * 60 * 60 * 1_000,\n }),\n ).toISOString(),\n );\n"],"mappings":";;;AAGA,MAAa,yBAAyB,UAMpC,oBAAoB,aAClB,IAAI,KACF,eAAe;CACb,MAAM;CACN,SAAS,OAAO,WAAW;CAC3B,SACG,OAAO,WAAW,OAAO,YAAY,KAAA,IAClC,KAAK,IAAI,IACT,MAAM,UAAU,MAAM,KAAK,KAAK,KAAK;AAC7C,CAAC,CACH,CAAC,CAAC,YAAY,CAChB"}
1
+ {"version":3,"file":"_randomFormatDatetime.mjs","names":[],"sources":["../../src/internal/_randomFormatDatetime.ts"],"sourcesContent":["import {\n _ILengthProps,\n _RANDOM_LENGTH_ERROR,\n _randomLengthPick,\n _randomLengthWindow,\n} from \"./_randomStringLength\";\nimport { __randomDigits } from \"./private/__randomComposition\";\nimport { __IEpochProps, __randomEpoch } from \"./private/__randomEpoch\";\n\nexport const _randomFormatDatetime = (\n props?: __IEpochProps & _ILengthProps,\n) => {\n const instant = (): string => new Date(__randomEpoch(props)).toISOString();\n if (props?.minLength === undefined && props?.maxLength === undefined)\n return instant();\n // `YYYY-MM-DDTHH:MM:SS` plus `Z` is the shortest instant, and a fractional\n // second grows it one digit at a time. Because that fraction needs both a dot\n // and at least one digit, 21 is the single length between the two forms that\n // no instant can have.\n const window = _randomLengthWindow(props, {\n minimum: SECONDS + 1,\n spread: 8,\n });\n let length: number = _randomLengthPick(window);\n if (length === SECONDS + 2)\n length = window.high >= SECONDS + 3 ? SECONDS + 3 : SECONDS + 1;\n if (length < window.low || length > window.high)\n throw new Error(_RANDOM_LENGTH_ERROR);\n const base: string = instant().substring(0, SECONDS);\n return length === SECONDS + 1\n ? `${base}Z`\n : `${base}.${__randomDigits(length - SECONDS - 2)}Z`;\n};\n\nconst SECONDS = \"0000-00-00T00:00:00\".length;\n"],"mappings":";;;;AASA,MAAa,yBACX,UACG;CACH,MAAM,gBAAwB,IAAI,KAAK,cAAc,KAAK,CAAC,CAAC,CAAC,YAAY;CACzE,IAAI,OAAO,cAAc,KAAA,KAAa,OAAO,cAAc,KAAA,GACzD,OAAO,QAAQ;CAKjB,MAAM,SAAS,oBAAoB,OAAO;EACxC,SAAS,UAAU;EACnB,QAAQ;CACV,CAAC;CACD,IAAI,SAAiB,kBAAkB,MAAM;CAC7C,IAAI,WAAW,UAAU,GACvB,SAAS,OAAO,QAAQ,UAAU,IAAI,UAAU,IAAI,UAAU;CAChE,IAAI,SAAS,OAAO,OAAO,SAAS,OAAO,MACzC,MAAM,IAAI,MAAM,oBAAoB;CACtC,MAAM,OAAe,QAAQ,CAAC,CAAC,UAAU,GAAG,OAAO;CACnD,OAAO,WAAW,UAAU,IACxB,GAAG,KAAK,KACR,GAAG,KAAK,GAAG,eAAe,SAAS,UAAU,CAAC,EAAE;AACtD;AAEA,MAAM,UAAU"}
@@ -3,22 +3,30 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports._randomFormatDuration = void 0;
4
4
  const _randomInteger_1 = require("./_randomInteger");
5
5
  const _randomStringLength_1 = require("./_randomStringLength");
6
- const _randomFormatDuration = (props) => (0, _randomStringLength_1._randomFormatLength)(props, () => {
7
- const period = durate([
8
- ["Y", random(0, 100)],
9
- ["M", random(0, 12)],
10
- ["D", random(0, 31)],
11
- ]);
12
- const time = durate([
13
- ["H", random(0, 24)],
14
- ["M", random(0, 60)],
15
- ["S", random(0, 60)],
16
- ]);
17
- if (period.length + time.length === 0)
18
- return "PT0S";
19
- return `P${period}${time.length ? "T" : ""}${time}`;
20
- });
6
+ const __randomComposition_1 = require("./private/__randomComposition");
7
+ const _randomFormatDuration = (props) => {
8
+ if ((props === null || props === void 0 ? void 0 : props.minLength) === undefined && (props === null || props === void 0 ? void 0 : props.maxLength) === undefined) {
9
+ const period = durate([
10
+ ["Y", random(0, 100)],
11
+ ["M", random(0, 12)],
12
+ ["D", random(0, 31)],
13
+ ]);
14
+ const time = durate([
15
+ ["H", random(0, 24)],
16
+ ["M", random(0, 60)],
17
+ ["S", random(0, 60)],
18
+ ]);
19
+ if (period.length + time.length === 0)
20
+ return "PT0S";
21
+ return `P${period}${time.length ? "T" : ""}${time}`;
22
+ }
23
+ // A single designator carries an unbounded digit count, so `P<n>Y` expresses
24
+ // every length from three upward and `P1Y` is the shortest duration there is.
25
+ const length = (0, _randomStringLength_1._randomLengthPick)((0, _randomStringLength_1._randomLengthWindow)(props, { minimum: MINIMUM, spread: 6 }));
26
+ return `P${(0, __randomComposition_1.__randomNumeric)(length - MINIMUM + 1)}Y`;
27
+ };
21
28
  exports._randomFormatDuration = _randomFormatDuration;
29
+ const MINIMUM = "P1Y".length;
22
30
  const durate = (elements) => elements
23
31
  .filter(([_unit, value]) => value !== 0)
24
32
  .map(([unit, value]) => `${value}${unit}`)
@@ -1 +1 @@
1
- {"version":3,"file":"_randomFormatDuration.js","sourceRoot":"","sources":["../../src/internal/_randomFormatDuration.ts"],"names":[],"mappings":";;;AAAA,qDAAkD;AAClD,+DAA2E;AAEpE,MAAM,qBAAqB,GAAG,CAAC,KAAqB,EAAU,EAAE,CACrE,IAAA,yCAAmB,EAAC,KAAK,EAAE,GAAG,EAAE;IAC9B,MAAM,MAAM,GAAW,MAAM,CAAC;QAC5B,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QACrB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACpB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;KACrB,CAAC,CAAC;IACH,MAAM,IAAI,GAAW,MAAM,CAAC;QAC1B,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACpB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACpB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;KACrB,CAAC,CAAC;IACH,IAAI,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,MAAM,CAAC;IACrD,OAAO,IAAI,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC;AACtD,CAAC,CAAC,CAAC;AAdQ,QAAA,qBAAqB,GAArB,qBAAqB,CAc7B;AACL,MAAM,MAAM,GAAG,CAAC,QAA4B,EAAE,EAAE,CAC9C,QAAQ;KACL,MAAM,CAAC,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,CAAC,CAAC;KACvC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,GAAG,IAAI,EAAE,CAAC;KACzC,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,MAAM,MAAM,GAAG,CAAC,OAAe,EAAE,OAAe,EAAE,EAAE,CAClD,IAAA,+BAAc,EAAC;IACb,IAAI,EAAE,SAAS;IACf,OAAO;IACP,OAAO;CACR,CAAC,CAAC"}
1
+ {"version":3,"file":"_randomFormatDuration.js","sourceRoot":"","sources":["../../src/internal/_randomFormatDuration.ts"],"names":[],"mappings":";;;AAAA,qDAAkD;AAClD,+DAI+B;AAC/B,uEAAgE;AAEzD,MAAM,qBAAqB,GAAG,CAAC,KAAqB,EAAU,EAAE;IACrE,IAAI,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS,MAAK,SAAS,IAAI,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS,MAAK,SAAS,EAAE,CAAC;QACrE,MAAM,MAAM,GAAW,MAAM,CAAC;YAC5B,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;YACrB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACpB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;SACrB,CAAC,CAAC;QACH,MAAM,IAAI,GAAW,MAAM,CAAC;YAC1B,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACpB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACpB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;SACrB,CAAC,CAAC;QACH,IAAI,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,MAAM,CAAC;QACrD,OAAO,IAAI,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC;IACtD,CAAC;IACD,6EAA6E;IAC7E,8EAA8E;IAC9E,MAAM,MAAM,GAAW,IAAA,uCAAiB,EACtC,IAAA,yCAAmB,EAAC,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAC5D,CAAC;IACF,OAAO,IAAI,IAAA,qCAAe,EAAC,MAAM,GAAG,OAAO,GAAG,CAAC,CAAC,GAAG,CAAC;AACtD,CAAC,CAAC;AArBW,QAAA,qBAAqB,GAArB,qBAAqB,CAqBhC;AAEF,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC;AAE7B,MAAM,MAAM,GAAG,CAAC,QAA4B,EAAE,EAAE,CAC9C,QAAQ;KACL,MAAM,CAAC,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,CAAC,CAAC;KACvC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,GAAG,IAAI,EAAE,CAAC;KACzC,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,MAAM,MAAM,GAAG,CAAC,OAAe,EAAE,OAAe,EAAE,EAAE,CAClD,IAAA,+BAAc,EAAC;IACb,IAAI,EAAE,SAAS;IACf,OAAO;IACP,OAAO;CACR,CAAC,CAAC"}
@@ -1,20 +1,28 @@
1
1
  import { _randomInteger } from "./_randomInteger.mjs";
2
- import { _randomFormatLength } from "./_randomStringLength.mjs";
2
+ import { _randomLengthPick, _randomLengthWindow } from "./_randomStringLength.mjs";
3
+ import { __randomNumeric } from "./private/__randomComposition.mjs";
3
4
  //#region src/internal/_randomFormatDuration.ts
4
- const _randomFormatDuration = (props) => _randomFormatLength(props, () => {
5
- const period = durate([
6
- ["Y", random(0, 100)],
7
- ["M", random(0, 12)],
8
- ["D", random(0, 31)]
9
- ]);
10
- const time = durate([
11
- ["H", random(0, 24)],
12
- ["M", random(0, 60)],
13
- ["S", random(0, 60)]
14
- ]);
15
- if (period.length + time.length === 0) return "PT0S";
16
- return `P${period}${time.length ? "T" : ""}${time}`;
17
- });
5
+ const _randomFormatDuration = (props) => {
6
+ if (props?.minLength === void 0 && props?.maxLength === void 0) {
7
+ const period = durate([
8
+ ["Y", random(0, 100)],
9
+ ["M", random(0, 12)],
10
+ ["D", random(0, 31)]
11
+ ]);
12
+ const time = durate([
13
+ ["H", random(0, 24)],
14
+ ["M", random(0, 60)],
15
+ ["S", random(0, 60)]
16
+ ]);
17
+ if (period.length + time.length === 0) return "PT0S";
18
+ return `P${period}${time.length ? "T" : ""}${time}`;
19
+ }
20
+ return `P${__randomNumeric(_randomLengthPick(_randomLengthWindow(props, {
21
+ minimum: MINIMUM,
22
+ spread: 6
23
+ })) - MINIMUM + 1)}Y`;
24
+ };
25
+ const MINIMUM = 3;
18
26
  const durate = (elements) => elements.filter(([_unit, value]) => value !== 0).map(([unit, value]) => `${value}${unit}`).join("");
19
27
  const random = (minimum, maximum) => _randomInteger({
20
28
  type: "integer",
@@ -1 +1 @@
1
- {"version":3,"file":"_randomFormatDuration.mjs","names":[],"sources":["../../src/internal/_randomFormatDuration.ts"],"sourcesContent":["import { _randomInteger } from \"./_randomInteger\";\nimport { _ILengthProps, _randomFormatLength } from \"./_randomStringLength\";\n\nexport const _randomFormatDuration = (props?: _ILengthProps): string =>\n _randomFormatLength(props, () => {\n const period: string = durate([\n [\"Y\", random(0, 100)],\n [\"M\", random(0, 12)],\n [\"D\", random(0, 31)],\n ]);\n const time: string = durate([\n [\"H\", random(0, 24)],\n [\"M\", random(0, 60)],\n [\"S\", random(0, 60)],\n ]);\n if (period.length + time.length === 0) return \"PT0S\";\n return `P${period}${time.length ? \"T\" : \"\"}${time}`;\n });\nconst durate = (elements: [string, number][]) =>\n elements\n .filter(([_unit, value]) => value !== 0)\n .map(([unit, value]) => `${value}${unit}`)\n .join(\"\");\nconst random = (minimum: number, maximum: number) =>\n _randomInteger({\n type: \"integer\",\n minimum,\n maximum,\n });\n"],"mappings":";;;AAGA,MAAa,yBAAyB,UACpC,oBAAoB,aAAa;CAC/B,MAAM,SAAiB,OAAO;EAC5B,CAAC,KAAK,OAAO,GAAG,GAAG,CAAC;EACpB,CAAC,KAAK,OAAO,GAAG,EAAE,CAAC;EACnB,CAAC,KAAK,OAAO,GAAG,EAAE,CAAC;CACrB,CAAC;CACD,MAAM,OAAe,OAAO;EAC1B,CAAC,KAAK,OAAO,GAAG,EAAE,CAAC;EACnB,CAAC,KAAK,OAAO,GAAG,EAAE,CAAC;EACnB,CAAC,KAAK,OAAO,GAAG,EAAE,CAAC;CACrB,CAAC;CACD,IAAI,OAAO,SAAS,KAAK,WAAW,GAAG,OAAO;CAC9C,OAAO,IAAI,SAAS,KAAK,SAAS,MAAM,KAAK;AAC/C,CAAC;AACH,MAAM,UAAU,aACd,SACG,QAAQ,CAAC,OAAO,WAAW,UAAU,CAAC,CAAC,CACvC,KAAK,CAAC,MAAM,WAAW,GAAG,QAAQ,MAAM,CAAC,CACzC,KAAK,EAAE;AACZ,MAAM,UAAU,SAAiB,YAC/B,eAAe;CACb,MAAM;CACN;CACA;AACF,CAAC"}
1
+ {"version":3,"file":"_randomFormatDuration.mjs","names":[],"sources":["../../src/internal/_randomFormatDuration.ts"],"sourcesContent":["import { _randomInteger } from \"./_randomInteger\";\nimport {\n _ILengthProps,\n _randomLengthPick,\n _randomLengthWindow,\n} from \"./_randomStringLength\";\nimport { __randomNumeric } from \"./private/__randomComposition\";\n\nexport const _randomFormatDuration = (props?: _ILengthProps): string => {\n if (props?.minLength === undefined && props?.maxLength === undefined) {\n const period: string = durate([\n [\"Y\", random(0, 100)],\n [\"M\", random(0, 12)],\n [\"D\", random(0, 31)],\n ]);\n const time: string = durate([\n [\"H\", random(0, 24)],\n [\"M\", random(0, 60)],\n [\"S\", random(0, 60)],\n ]);\n if (period.length + time.length === 0) return \"PT0S\";\n return `P${period}${time.length ? \"T\" : \"\"}${time}`;\n }\n // A single designator carries an unbounded digit count, so `P<n>Y` expresses\n // every length from three upward and `P1Y` is the shortest duration there is.\n const length: number = _randomLengthPick(\n _randomLengthWindow(props, { minimum: MINIMUM, spread: 6 }),\n );\n return `P${__randomNumeric(length - MINIMUM + 1)}Y`;\n};\n\nconst MINIMUM = \"P1Y\".length;\n\nconst durate = (elements: [string, number][]) =>\n elements\n .filter(([_unit, value]) => value !== 0)\n .map(([unit, value]) => `${value}${unit}`)\n .join(\"\");\nconst random = (minimum: number, maximum: number) =>\n _randomInteger({\n type: \"integer\",\n minimum,\n maximum,\n });\n"],"mappings":";;;;AAQA,MAAa,yBAAyB,UAAkC;CACtE,IAAI,OAAO,cAAc,KAAA,KAAa,OAAO,cAAc,KAAA,GAAW;EACpE,MAAM,SAAiB,OAAO;GAC5B,CAAC,KAAK,OAAO,GAAG,GAAG,CAAC;GACpB,CAAC,KAAK,OAAO,GAAG,EAAE,CAAC;GACnB,CAAC,KAAK,OAAO,GAAG,EAAE,CAAC;EACrB,CAAC;EACD,MAAM,OAAe,OAAO;GAC1B,CAAC,KAAK,OAAO,GAAG,EAAE,CAAC;GACnB,CAAC,KAAK,OAAO,GAAG,EAAE,CAAC;GACnB,CAAC,KAAK,OAAO,GAAG,EAAE,CAAC;EACrB,CAAC;EACD,IAAI,OAAO,SAAS,KAAK,WAAW,GAAG,OAAO;EAC9C,OAAO,IAAI,SAAS,KAAK,SAAS,MAAM,KAAK;CAC/C;CAMA,OAAO,IAAI,gBAHY,kBACrB,oBAAoB,OAAO;EAAE,SAAS;EAAS,QAAQ;CAAE,CAAC,CAE5B,IAAI,UAAU,CAAC,EAAE;AACnD;AAEA,MAAM,UAAU;AAEhB,MAAM,UAAU,aACd,SACG,QAAQ,CAAC,OAAO,WAAW,UAAU,CAAC,CAAC,CACvC,KAAK,CAAC,MAAM,WAAW,GAAG,QAAQ,MAAM,CAAC,CACzC,KAAK,EAAE;AACZ,MAAM,UAAU,SAAiB,YAC/B,eAAe;CACb,MAAM;CACN;CACA;AACF,CAAC"}