typia 13.2.0 → 13.3.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 (92) hide show
  1. package/lib/http.d.ts +3 -3
  2. package/lib/http.js.map +1 -1
  3. package/lib/http.mjs.map +1 -1
  4. package/lib/internal/_assertGuard.js +13 -3
  5. package/lib/internal/_assertGuard.js.map +1 -1
  6. package/lib/internal/_assertGuard.mjs +4 -2
  7. package/lib/internal/_assertGuard.mjs.map +1 -1
  8. package/lib/internal/_isFormatIdnHostname.js +5 -1
  9. package/lib/internal/_isFormatIdnHostname.js.map +1 -1
  10. package/lib/internal/_isFormatIdnHostname.mjs +1 -1
  11. package/lib/internal/_isFormatIdnHostname.mjs.map +1 -1
  12. package/lib/internal/_isFormatTime.js +19 -2
  13. package/lib/internal/_isFormatTime.js.map +1 -1
  14. package/lib/internal/_isFormatTime.mjs +9 -2
  15. package/lib/internal/_isFormatTime.mjs.map +1 -1
  16. package/lib/internal/_randomArray.js +37 -4
  17. package/lib/internal/_randomArray.js.map +1 -1
  18. package/lib/internal/_randomArray.mjs +16 -3
  19. package/lib/internal/_randomArray.mjs.map +1 -1
  20. package/lib/internal/_randomFormatByte.js +15 -12
  21. package/lib/internal/_randomFormatByte.js.map +1 -1
  22. package/lib/internal/_randomFormatByte.mjs +11 -10
  23. package/lib/internal/_randomFormatByte.mjs.map +1 -1
  24. package/lib/internal/_randomFormatDatetime.mjs +1 -1
  25. package/lib/internal/_randomFormatHostname.d.ts +2 -2
  26. package/lib/internal/_randomFormatHostname.js +2 -2
  27. package/lib/internal/_randomFormatHostname.mjs +2 -2
  28. package/lib/internal/_randomFormatHostname.mjs.map +1 -1
  29. package/lib/internal/_randomFormatIdnHostname.js +9 -10
  30. package/lib/internal/_randomFormatIdnHostname.js.map +1 -1
  31. package/lib/internal/_randomFormatIdnHostname.mjs +3 -4
  32. package/lib/internal/_randomFormatIdnHostname.mjs.map +1 -1
  33. package/lib/internal/_randomFormatRegex.js +4 -4
  34. package/lib/internal/_randomFormatRegex.js.map +1 -1
  35. package/lib/internal/_randomFormatRegex.mjs +1 -2
  36. package/lib/internal/_randomFormatRegex.mjs.map +1 -1
  37. package/lib/internal/_randomFormatTime.js +15 -10
  38. package/lib/internal/_randomFormatTime.js.map +1 -1
  39. package/lib/internal/_randomFormatTime.mjs +6 -3
  40. package/lib/internal/_randomFormatTime.mjs.map +1 -1
  41. package/lib/internal/private/__randomComposition.d.ts +8 -0
  42. package/lib/internal/private/__randomComposition.js +21 -1
  43. package/lib/internal/private/__randomComposition.js.map +1 -1
  44. package/lib/internal/private/__randomComposition.mjs +18 -1
  45. package/lib/internal/private/__randomComposition.mjs.map +1 -1
  46. package/lib/json.d.ts +2 -2
  47. package/lib/json.js.map +1 -1
  48. package/lib/json.mjs.map +1 -1
  49. package/lib/module.d.ts +28 -13
  50. package/lib/module.js.map +1 -1
  51. package/lib/module.mjs.map +1 -1
  52. package/lib/notations.d.ts +4 -4
  53. package/lib/notations.js.map +1 -1
  54. package/lib/notations.mjs.map +1 -1
  55. package/lib/plain.d.ts +3 -3
  56. package/lib/plain.js.map +1 -1
  57. package/lib/plain.mjs.map +1 -1
  58. package/lib/protobuf.d.ts +2 -2
  59. package/lib/protobuf.js.map +1 -1
  60. package/lib/protobuf.mjs.map +1 -1
  61. package/native/cmd/ttsc-typia/assert_guard_factory_contract_test.go +17 -4
  62. package/native/cmd/ttsc-typia/create_assert_error_factory_arity_test.go +309 -0
  63. package/native/cmd/ttsc-typia/local_function_named_like_typia_operation_transform_test.go +185 -0
  64. package/native/cmd/ttsc-typia/recursive_conditional_alias_name_transform_test.go +307 -0
  65. package/native/cmd/ttsc-typia/shadowed_typia_module_declaration_diagnostic_test.go +152 -0
  66. package/native/cmd/ttsc-typia/template_literal_type_tags_transform_test.go +1 -3
  67. package/native/cmd/ttsc-typia/transform_helpers_test.go +92 -26
  68. package/native/core/factories/FormatCheatSheet.go +2 -2
  69. package/native/core/factories/MetadataCommentTagFactory.go +26 -11
  70. package/native/core/factories/factory_utility_coverage_test.go +896 -907
  71. package/native/core/factories/internal/metadata/MetadataHelper.go +5 -28
  72. package/native/core/factories/metadata_comment_tag_factory_coverage_test.go +2 -2
  73. package/native/core/programmers/RandomProgrammer.go +5 -2
  74. package/native/core/schemas/metadata/MetadataCollection.go +47 -5
  75. package/native/transform/CallExpressionTransformer.go +167 -0
  76. package/package.json +3 -3
  77. package/src/http.ts +18 -4
  78. package/src/internal/_assertGuard.ts +13 -2
  79. package/src/internal/_isFormatIdnHostname.ts +5 -1
  80. package/src/internal/_isFormatTime.ts +19 -2
  81. package/src/internal/_randomArray.ts +42 -6
  82. package/src/internal/_randomFormatByte.ts +17 -12
  83. package/src/internal/_randomFormatHostname.ts +2 -2
  84. package/src/internal/_randomFormatIdnHostname.ts +8 -9
  85. package/src/internal/_randomFormatRegex.ts +4 -6
  86. package/src/internal/_randomFormatTime.ts +15 -10
  87. package/src/internal/private/__randomComposition.ts +24 -0
  88. package/src/json.ts +16 -4
  89. package/src/module.ts +56 -22
  90. package/src/notations.ts +16 -4
  91. package/src/plain.ts +12 -3
  92. package/src/protobuf.ts +16 -4
package/lib/http.d.ts CHANGED
@@ -403,7 +403,7 @@ export declare function createAssertFormData(errorFactory?: undefined | ((props:
403
403
  * {@link TypeGuardError.IProps}
404
404
  * @returns Reusable decoder function
405
405
  */
406
- export declare function createAssertFormData<T extends object>(errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error)): (input: FormData) => T;
406
+ export declare function createAssertFormData<T extends object>(errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error)): (input: FormData, errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error)) => T;
407
407
  /**
408
408
  * Creates reusable {@link isFormData} function.
409
409
  *
@@ -463,7 +463,7 @@ export declare function createAssertQuery(errorFactory?: undefined | ((props: Ty
463
463
  * {@link TypeGuardError.IProps}
464
464
  * @returns Reusable decoder function
465
465
  */
466
- export declare function createAssertQuery<T extends object>(errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error)): (input: string | IReadableURLSearchParams) => T;
466
+ export declare function createAssertQuery<T extends object>(errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error)): (input: string | IReadableURLSearchParams, errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error)) => T;
467
467
  /**
468
468
  * Creates reusable {@link isQuery} function.
469
469
  *
@@ -523,7 +523,7 @@ export declare function createAssertHeaders(errorFactory?: undefined | ((props:
523
523
  * {@link TypeGuardError.IProps}
524
524
  * @returns Reusable decoder function
525
525
  */
526
- export declare function createAssertHeaders<T extends object>(errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error)): (input: Record<string, string | string[] | undefined>) => T;
526
+ export declare function createAssertHeaders<T extends object>(errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error)): (input: Record<string, string | string[] | undefined>, errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error)) => T;
527
527
  /**
528
528
  * Creates reusable {@link isHeaders} function.
529
529
  *
package/lib/http.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,gGAA6F;AAuC7F,gBAAgB;AAChB;IACE,IAAA,6DAA6B,EAAC,eAAe,CAAC,CAAC;AACjD,CAAC;AAmCD,gBAAgB;AAChB;IACE,IAAA,6DAA6B,EAAC,qBAAqB,CAAC,CAAC;AACvD,CAAC;AA+BD,gBAAgB;AAChB;IACE,IAAA,6DAA6B,EAAC,iBAAiB,CAAC,CAAC;AACnD,CAAC;AAgCD,gBAAgB;AAChB;IACE,IAAA,6DAA6B,EAAC,uBAAuB,CAAC,CAAC;AACzD,CAAC;AAkCD,gBAAgB;AAChB;IACE,IAAA,6DAA6B,EAAC,YAAY,CAAC,CAAC;AAC9C,CAAC;AAmCD,gBAAgB;AAChB;IACE,IAAA,6DAA6B,EAAC,kBAAkB,CAAC,CAAC;AACpD,CAAC;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;AAC9D,CAAC;AAoBD,gBAAgB;AAChB;IAGE,IAAA,6DAA6B,EAAC,sBAAsB,CAAC,CAAC;AACxD,CAAC"}
package/lib/http.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"http.mjs","names":[],"sources":["../src/http.ts"],"sourcesContent":["import {\n Atomic,\n IReadableURLSearchParams,\n IValidation,\n Resolved,\n} from \"@typia/interface\";\n\nimport { TypeGuardError } from \"./TypeGuardError\";\nimport { NoTransformConfigurationError } from \"./transformers/NoTransformConfigurationError\";\n\n/* ===========================================================\n HTTP\n - FORM-DATA\n - QUERY\n - HEADERS\n - PARAMETER\n - FACTORY FUNCTIONS\n==============================================================\n FORM-DATA\n----------------------------------------------------------- */\n/**\n * Decodes `FormData` into type `T`.\n *\n * Parses a `FormData` instance with automatic type casting. Properties typed as\n * `boolean` or `Blob` are cast to expected types during decoding.\n *\n * Type `T` constraints:\n *\n * 1. Must be an object type\n * 2. No dynamic properties allowed\n * 3. Only `boolean`, `bigint`, `number`, `string`, `Blob`, `File` or their array\n * types allowed\n * 4. No union types allowed\n *\n * Does not validate the decoded value. For validation, use:\n *\n * - {@link assertFormData} — Throws on type mismatch\n * - {@link isFormData} — Returns `null` on type mismatch\n * - {@link validateFormData} — Returns detailed validation errors\n *\n * @template T Target object type\n * @param input FormData instance to decode\n * @returns Decoded object of type `T`\n * @danger You must configure the generic argument `T`\n */\nexport function formData<T extends object>(input: FormData): Resolved<T>;\n\n/** @internal */\nexport function formData(): never {\n NoTransformConfigurationError(\"http.formData\");\n}\n\n/**\n * Decodes `FormData` into type `T` with assertion.\n *\n * Parses a `FormData` instance with automatic type casting, then validates the\n * result via {@link assert}. Throws {@link TypeGuardError} on mismatch.\n *\n * Type `T` constraints:\n *\n * 1. Must be an object type\n * 2. No dynamic properties allowed\n * 3. Only `boolean`, `bigint`, `number`, `string`, `Blob`, `File` or their array\n * types allowed\n * 4. No union types allowed\n *\n * Related functions:\n *\n * - {@link formData} — No validation\n * - {@link isFormData} — Returns `null` instead of throwing\n * - {@link validateFormData} — Returns detailed validation errors\n *\n * @template T Target object type\n * @param input FormData instance to decode\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns Decoded object of type `T`\n * @throws {TypeGuardError} When decoded value doesn't conform to type `T`\n * @danger You must configure the generic argument `T`\n */\nexport function assertFormData<T extends object>(\n input: FormData,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): Resolved<T>;\n\n/** @internal */\nexport function assertFormData(): never {\n NoTransformConfigurationError(\"http.assertFormData\");\n}\n\n/**\n * Decodes `FormData` into type `T` with type checking.\n *\n * Parses a `FormData` instance with automatic type casting, then validates the\n * result via {@link is}. Returns `null` on type mismatch.\n *\n * Type `T` constraints:\n *\n * 1. Must be an object type\n * 2. No dynamic properties allowed\n * 3. Only `boolean`, `bigint`, `number`, `string`, `Blob`, `File` or their array\n * types allowed\n * 4. No union types allowed\n *\n * Related functions:\n *\n * - {@link formData} — No validation\n * - {@link assertFormData} — Throws instead of returning `null`\n * - {@link validateFormData} — Returns detailed validation errors\n *\n * @template T Target object type\n * @param input FormData instance to decode\n * @returns Decoded object of type `T`, or `null` if invalid\n * @danger You must configure the generic argument `T`\n */\nexport function isFormData<T extends object>(\n input: FormData,\n): Resolved<T> | null;\n\n/** @internal */\nexport function isFormData(): never {\n NoTransformConfigurationError(\"http.isFormData\");\n}\n\n/**\n * Decodes `FormData` into type `T` with validation.\n *\n * Parses a `FormData` instance with automatic type casting, then validates the\n * result via {@link validate}. Returns {@link IValidation.IFailure} with all\n * errors on mismatch, or {@link IValidation.ISuccess} with decoded value.\n *\n * Type `T` constraints:\n *\n * 1. Must be an object type\n * 2. No dynamic properties allowed\n * 3. Only `boolean`, `bigint`, `number`, `string`, `Blob`, `File` or their array\n * types allowed\n * 4. No union types allowed\n *\n * Related functions:\n *\n * - {@link formData} — No validation\n * - {@link assertFormData} — Throws on first error\n * - {@link isFormData} — Returns `null` instead of error details\n *\n * @template T Target object type\n * @param input FormData instance to decode\n * @returns Validation result containing decoded value or errors\n * @danger You must configure the generic argument `T`\n */\nexport function validateFormData<T extends object>(\n input: FormData,\n): IValidation<Resolved<T>>;\n\n/** @internal */\nexport function validateFormData(): never {\n NoTransformConfigurationError(\"http.validateFormData\");\n}\n\n/* -----------------------------------------------------------\n QUERY\n----------------------------------------------------------- */\n/**\n * Decodes URL query string into type `T`.\n *\n * Parses a query string or `URLSearchParams` instance with automatic type\n * casting. Properties typed as `boolean` or `number` are cast to expected types\n * during decoding.\n *\n * Type `T` constraints:\n *\n * 1. Must be an object type\n * 2. No dynamic properties allowed\n * 3. Only `boolean`, `bigint`, `number`, `string` or their array types allowed\n * 4. No union types allowed\n *\n * Does not validate the decoded value. For validation, use:\n *\n * - {@link assertQuery} — Throws on type mismatch\n * - {@link isQuery} — Returns `null` on type mismatch\n * - {@link validateQuery} — Returns detailed validation errors\n *\n * @template T Target object type\n * @param input Query string or URLSearchParams instance\n * @returns Decoded object of type `T`\n * @danger You must configure the generic argument `T`\n */\nexport function query<T extends object>(\n input: string | IReadableURLSearchParams,\n): Resolved<T>;\n\n/** @internal */\nexport function query(): never {\n NoTransformConfigurationError(\"http.query\");\n}\n\n/**\n * Decodes URL query string into type `T` with assertion.\n *\n * Parses a query string or `URLSearchParams` instance with automatic type\n * casting, then validates the result via {@link assert}. Throws\n * {@link TypeGuardError} on mismatch.\n *\n * Type `T` constraints:\n *\n * 1. Must be an object type\n * 2. No dynamic properties allowed\n * 3. Only `boolean`, `bigint`, `number`, `string` or their array types allowed\n * 4. No union types allowed\n *\n * Related functions:\n *\n * - {@link query} — No validation\n * - {@link isQuery} — Returns `null` instead of throwing\n * - {@link validateQuery} — Returns detailed validation errors\n *\n * @template T Target object type\n * @param input Query string or URLSearchParams instance\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns Decoded object of type `T`\n * @throws {TypeGuardError} When decoded value doesn't conform to type `T`\n * @danger You must configure the generic argument `T`\n */\nexport function assertQuery<T extends object>(\n input: string | IReadableURLSearchParams,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): Resolved<T>;\n\n/** @internal */\nexport function assertQuery(): never {\n NoTransformConfigurationError(\"http.assertQuery\");\n}\n\n/**\n * Decodes URL query string into type `T` with type checking.\n *\n * Parses a query string or `URLSearchParams` instance with automatic type\n * casting, then validates the result via {@link is}. Returns `null` on type\n * mismatch.\n *\n * Type `T` constraints:\n *\n * 1. Must be an object type\n * 2. No dynamic properties allowed\n * 3. Only `boolean`, `bigint`, `number`, `string` or their array types allowed\n * 4. No union types allowed\n *\n * Related functions:\n *\n * - {@link query} — No validation\n * - {@link assertQuery} — Throws instead of returning `null`\n * - {@link validateQuery} — Returns detailed validation errors\n *\n * @template T Target object type\n * @param input Query string or URLSearchParams instance\n * @returns Decoded object of type `T`, or `null` if invalid\n * @danger You must configure the generic argument `T`\n */\nexport function isQuery<T extends object>(\n input: string | IReadableURLSearchParams,\n): Resolved<T> | null;\n\n/** @internal */\nexport function isQuery(): never {\n NoTransformConfigurationError(\"http.isQuery\");\n}\n\n/**\n * Decodes URL query string into type `T` with validation.\n *\n * Parses a query string or `URLSearchParams` instance with automatic type\n * casting, then validates the result via {@link validate}. Returns\n * {@link IValidation.IFailure} with all errors on mismatch, or\n * {@link IValidation.ISuccess} with decoded value.\n *\n * Type `T` constraints:\n *\n * 1. Must be an object type\n * 2. No dynamic properties allowed\n * 3. Only `boolean`, `bigint`, `number`, `string` or their array types allowed\n * 4. No union types allowed\n *\n * Related functions:\n *\n * - {@link query} — No validation\n * - {@link assertQuery} — Throws on first error\n * - {@link isQuery} — Returns `null` instead of error details\n *\n * @template T Target object type\n * @param input Query string or URLSearchParams instance\n * @returns Validation result containing decoded value or errors\n * @danger You must configure the generic argument `T`\n */\nexport function validateQuery<T extends object>(\n input: string | IReadableURLSearchParams,\n): IValidation<Resolved<T>>;\n\n/** @internal */\nexport function validateQuery(): never {\n NoTransformConfigurationError(\"http.validateQuery\");\n}\n\n/* -----------------------------------------------------------\n HEADERS\n----------------------------------------------------------- */\n/**\n * Decodes HTTP headers into type `T`.\n *\n * Parses HTTP headers object with automatic type casting. Properties typed as\n * `boolean` or `number` are cast to expected types during decoding. Compatible\n * with Express and Fastify request headers.\n *\n * Type `T` constraints:\n *\n * 1. Must be an object type\n * 2. No dynamic properties allowed\n * 3. Property keys must be lowercase\n * 4. Property values cannot be `null` (but `undefined` is allowed)\n * 5. Only `boolean`, `bigint`, `number`, `string` or their array types allowed\n * 6. No union types allowed\n * 7. Property `set-cookie` must be array type\n * 8. These properties cannot be array type: `age`, `authorization`,\n * `content-length`, `content-type`, `etag`, `expires`, `from`, `host`,\n * `if-modified-since`, `if-unmodified-since`, `last-modified`, `location`,\n * `max-forwards`, `proxy-authorization`, `referer`, `retry-after`, `server`,\n * `user-agent`\n *\n * Does not validate the decoded value. For validation, use:\n *\n * - {@link assertHeaders} — Throws on type mismatch\n * - {@link isHeaders} — Returns `null` on type mismatch\n * - {@link validateHeaders} — Returns detailed validation errors\n *\n * @template T Target object type\n * @param input Headers object from HTTP request\n * @returns Decoded object of type `T`\n * @danger You must configure the generic argument `T`\n */\nexport function headers<T extends object>(\n input: Record<string, string | string[] | undefined>,\n): Resolved<T>;\n\n/** @internal */\nexport function headers(): never {\n NoTransformConfigurationError(\"http.headers\");\n}\n\n/**\n * Decodes HTTP headers into type `T` with assertion.\n *\n * Parses HTTP headers object with automatic type casting, then validates the\n * result via {@link assert}. Throws {@link TypeGuardError} on mismatch.\n * Compatible with Express and Fastify request headers.\n *\n * Type `T` constraints:\n *\n * 1. Must be an object type\n * 2. No dynamic properties allowed\n * 3. Property keys must be lowercase\n * 4. Property values cannot be `null` (but `undefined` is allowed)\n * 5. Only `boolean`, `bigint`, `number`, `string` or their array types allowed\n * 6. No union types allowed\n * 7. Property `set-cookie` must be array type\n * 8. These properties cannot be array type: `age`, `authorization`,\n * `content-length`, `content-type`, `etag`, `expires`, `from`, `host`,\n * `if-modified-since`, `if-unmodified-since`, `last-modified`, `location`,\n * `max-forwards`, `proxy-authorization`, `referer`, `retry-after`, `server`,\n * `user-agent`\n *\n * Related functions:\n *\n * - {@link headers} — No validation\n * - {@link isHeaders} — Returns `null` instead of throwing\n * - {@link validateHeaders} — Returns detailed validation errors\n *\n * @template T Target object type\n * @param input Headers object from HTTP request\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns Decoded object of type `T`\n * @throws {TypeGuardError} When decoded value doesn't conform to type `T`\n * @danger You must configure the generic argument `T`\n */\nexport function assertHeaders<T extends object>(\n input: Record<string, string | string[] | undefined>,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): Resolved<T>;\n\n/** @internal */\nexport function assertHeaders(): never {\n NoTransformConfigurationError(\"http.assertHeaders\");\n}\n\n/**\n * Decodes HTTP headers into type `T` with type checking.\n *\n * Parses HTTP headers object with automatic type casting, then validates the\n * result via {@link is}. Returns `null` on type mismatch. Compatible with\n * Express and Fastify request headers.\n *\n * Type `T` constraints:\n *\n * 1. Must be an object type\n * 2. No dynamic properties allowed\n * 3. Property keys must be lowercase\n * 4. Property values cannot be `null` (but `undefined` is allowed)\n * 5. Only `boolean`, `bigint`, `number`, `string` or their array types allowed\n * 6. No union types allowed\n * 7. Property `set-cookie` must be array type\n * 8. These properties cannot be array type: `age`, `authorization`,\n * `content-length`, `content-type`, `etag`, `expires`, `from`, `host`,\n * `if-modified-since`, `if-unmodified-since`, `last-modified`, `location`,\n * `max-forwards`, `proxy-authorization`, `referer`, `retry-after`, `server`,\n * `user-agent`\n *\n * Related functions:\n *\n * - {@link headers} — No validation\n * - {@link assertHeaders} — Throws instead of returning `null`\n * - {@link validateHeaders} — Returns detailed validation errors\n *\n * @template T Target object type\n * @param input Headers object from HTTP request\n * @returns Decoded object of type `T`, or `null` if invalid\n * @danger You must configure the generic argument `T`\n */\nexport function isHeaders<T extends object>(\n input: Record<string, string | string[] | undefined>,\n): Resolved<T> | null;\n\n/** @internal */\nexport function isHeaders(): never {\n NoTransformConfigurationError(\"http.isHeaders\");\n}\n\n/**\n * Decodes HTTP headers into type `T` with validation.\n *\n * Parses HTTP headers object with automatic type casting, then validates the\n * result via {@link validate}. Returns {@link IValidation.IFailure} with all\n * errors on mismatch, or {@link IValidation.ISuccess} with decoded value.\n * Compatible with Express and Fastify request headers.\n *\n * Type `T` constraints:\n *\n * 1. Must be an object type\n * 2. No dynamic properties allowed\n * 3. Property keys must be lowercase\n * 4. Property values cannot be `null` (but `undefined` is allowed)\n * 5. Only `boolean`, `bigint`, `number`, `string` or their array types allowed\n * 6. No union types allowed\n * 7. Property `set-cookie` must be array type\n * 8. These properties cannot be array type: `age`, `authorization`,\n * `content-length`, `content-type`, `etag`, `expires`, `from`, `host`,\n * `if-modified-since`, `if-unmodified-since`, `last-modified`, `location`,\n * `max-forwards`, `proxy-authorization`, `referer`, `retry-after`, `server`,\n * `user-agent`\n *\n * Related functions:\n *\n * - {@link headers} — No validation\n * - {@link assertHeaders} — Throws on first error\n * - {@link isHeaders} — Returns `null` instead of error details\n *\n * @template T Target object type\n * @param input Headers object from HTTP request\n * @returns Validation result containing decoded value or errors\n * @danger You must configure the generic argument `T`\n */\nexport function validateHeaders<T extends object>(\n input: Record<string, string | string[] | undefined>,\n): IValidation<Resolved<T>>;\n\n/** @internal */\nexport function validateHeaders(): never {\n NoTransformConfigurationError(\"http.validateHeaders\");\n}\n\n/* -----------------------------------------------------------\n PARAMETER\n----------------------------------------------------------- */\n/**\n * Decodes URL path parameter into type `T`.\n *\n * Parses a path parameter string with automatic type casting. When type `T` is\n * `boolean` or `number`, casts the string value to the expected type. Also\n * performs type assertion via {@link assert}, throwing {@link TypeGuardError} on\n * mismatch.\n *\n * @template T Target atomic type (`boolean`, `bigint`, `number`, `string`, or\n * `null`)\n * @param input Path parameter string\n * @returns Decoded value of type `T`\n * @throws {TypeGuardError} When decoded value doesn't conform to type `T`\n * @danger You must configure the generic argument `T`\n */\nexport function parameter<T extends Atomic.Type | null>(\n input: string,\n): Resolved<T>;\n\n/** @internal */\nexport function parameter(): never {\n NoTransformConfigurationError(\"http.parameter\");\n}\n\n/* -----------------------------------------------------------\n FACTORY FUNCTIONS\n----------------------------------------------------------- */\n/**\n * Creates reusable {@link formData} function.\n *\n * @template T Target object type\n * @danger You must configure the generic argument `T`\n */\nexport function createFormData(): never;\n\n/**\n * Creates reusable {@link formData} function.\n *\n * @template T Target object type\n * @returns Reusable decoder function\n */\nexport function createFormData<T extends object>(): (input: FormData) => T;\n\n/** @internal */\nexport function createFormData<T>(): (input: FormData) => T {\n NoTransformConfigurationError(\"http.createFormData\");\n}\n\n/**\n * Creates reusable {@link assertFormData} function.\n *\n * @template T Target object type\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @danger You must configure the generic argument `T`\n */\nexport function createAssertFormData(\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): never;\n\n/**\n * Creates reusable {@link assertFormData} function.\n *\n * @template T Target object type\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns Reusable decoder function\n */\nexport function createAssertFormData<T extends object>(\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): (input: FormData) => T;\n\n/** @internal */\nexport function createAssertFormData<T>(): (input: FormData) => T {\n NoTransformConfigurationError(\"http.createAssertFormData\");\n}\n\n/**\n * Creates reusable {@link isFormData} function.\n *\n * @template T Target object type\n * @danger You must configure the generic argument `T`\n */\nexport function createIsFormData(): never;\n\n/**\n * Creates reusable {@link isFormData} function.\n *\n * @template T Target object type\n * @returns Reusable decoder function\n */\nexport function createIsFormData<T extends object>(): (\n input: FormData,\n) => T | null;\n\n/** @internal */\nexport function createIsFormData<T>(): (input: FormData) => T | null {\n NoTransformConfigurationError(\"http.createIsFormData\");\n}\n\n/**\n * Creates reusable {@link validateFormData} function.\n *\n * @template T Target object type\n * @danger You must configure the generic argument `T`\n */\nexport function createValidateFormData(): never;\n\n/**\n * Creates reusable {@link validateFormData} function.\n *\n * @template T Target object type\n * @returns Reusable decoder function\n */\nexport function createValidateFormData<T extends object>(): (\n input: FormData,\n) => IValidation<Resolved<T>>;\n\n/** @internal */\nexport function createValidateFormData<T>(): (\n input: FormData,\n) => IValidation<Resolved<T>> {\n NoTransformConfigurationError(\"http.createValidateFormData\");\n}\n\n/**\n * Creates reusable {@link query} function.\n *\n * @template T Target object type\n * @danger You must configure the generic argument `T`\n */\nexport function createQuery(): never;\n\n/**\n * Creates reusable {@link query} function.\n *\n * @template T Target object type\n * @returns Reusable decoder function\n */\nexport function createQuery<T extends object>(): (\n input: string | IReadableURLSearchParams,\n) => T;\n\n/** @internal */\nexport function createQuery<T>(): (\n input: string | IReadableURLSearchParams,\n) => T {\n NoTransformConfigurationError(\"http.createQuery\");\n}\n\n/**\n * Creates reusable {@link assertQuery} function.\n *\n * @template T Target object type\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @danger You must configure the generic argument `T`\n */\nexport function createAssertQuery(\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): never;\n\n/**\n * Creates reusable {@link assertQuery} function.\n *\n * @template T Target object type\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns Reusable decoder function\n */\nexport function createAssertQuery<T extends object>(\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): (input: string | IReadableURLSearchParams) => T;\n\n/** @internal */\nexport function createAssertQuery<T>(): (\n input: string | IReadableURLSearchParams,\n) => T {\n NoTransformConfigurationError(\"http.createAssertQuery\");\n}\n\n/**\n * Creates reusable {@link isQuery} function.\n *\n * @template T Target object type\n * @danger You must configure the generic argument `T`\n */\nexport function createIsQuery(): never;\n\n/**\n * Creates reusable {@link isQuery} function.\n *\n * @template T Target object type\n * @returns Reusable decoder function\n */\nexport function createIsQuery<T extends object>(): (\n input: string | IReadableURLSearchParams,\n) => T | null;\n\n/** @internal */\nexport function createIsQuery<T>(): (\n input: string | IReadableURLSearchParams,\n) => T | null {\n NoTransformConfigurationError(\"http.createIsQuery\");\n}\n\n/**\n * Creates reusable {@link validateQuery} function.\n *\n * @template T Target object type\n * @danger You must configure the generic argument `T`\n */\nexport function createValidateQuery(): never;\n\n/**\n * Creates reusable {@link validateQuery} function.\n *\n * @template T Target object type\n * @returns Reusable decoder function\n */\nexport function createValidateQuery<T extends object>(): (\n input: string | IReadableURLSearchParams,\n) => IValidation<Resolved<T>>;\n\n/** @internal */\nexport function createValidateQuery<T>(): (\n input: string | IReadableURLSearchParams,\n) => IValidation<Resolved<T>> {\n NoTransformConfigurationError(\"http.createValidateQuery\");\n}\n\n/**\n * Creates reusable {@link headers} function.\n *\n * @template T Target object type\n * @danger You must configure the generic argument `T`\n */\nexport function createHeaders(): never;\n\n/**\n * Creates reusable {@link headers} function.\n *\n * @template T Target object type\n * @returns Reusable decoder function\n */\nexport function createHeaders<T extends object>(): (\n input: Record<string, string | string[] | undefined>,\n) => T;\n\n/** @internal */\nexport function createHeaders<T>(): (\n input: Record<string, string | string[] | undefined>,\n) => T {\n NoTransformConfigurationError(\"http.createHeaders\");\n}\n\n/**\n * Creates reusable {@link assertHeaders} function.\n *\n * @template T Target object type\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @danger You must configure the generic argument `T`\n */\nexport function createAssertHeaders(\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): never;\n\n/**\n * Creates reusable {@link assertHeaders} function.\n *\n * @template T Target object type\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns Reusable decoder function\n */\nexport function createAssertHeaders<T extends object>(\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): (input: Record<string, string | string[] | undefined>) => T;\n\n/** @internal */\nexport function createAssertHeaders<T>(): (\n input: Record<string, string | string[] | undefined>,\n) => T {\n NoTransformConfigurationError(\"http.createAssertHeaders\");\n}\n\n/**\n * Creates reusable {@link isHeaders} function.\n *\n * @template T Target object type\n * @danger You must configure the generic argument `T`\n */\nexport function createIsHeaders(): never;\n\n/**\n * Creates reusable {@link isHeaders} function.\n *\n * @template T Target object type\n * @returns Reusable decoder function\n */\nexport function createIsHeaders<T extends object>(): (\n input: Record<string, string | string[] | undefined>,\n) => T | null;\n\n/** @internal */\nexport function createIsHeaders<T>(): (\n input: Record<string, string | string[] | undefined>,\n) => T | null {\n NoTransformConfigurationError(\"http.createIsHeaders\");\n}\n\n/**\n * Creates reusable {@link validateHeaders} function.\n *\n * @template T Target object type\n * @danger You must configure the generic argument `T`\n */\nexport function createValidateHeaders(): never;\n\n/**\n * Creates reusable {@link validateHeaders} function.\n *\n * @template T Target object type\n * @returns Reusable decoder function\n */\nexport function createValidateHeaders<T extends object>(): (\n input: Record<string, string | string[] | undefined>,\n) => IValidation<Resolved<T>>;\n\n/** @internal */\nexport function createValidateHeaders<T>(): (\n input: Record<string, string | string[] | undefined>,\n) => IValidation<Resolved<T>> {\n NoTransformConfigurationError(\"http.createValidateHeaders\");\n}\n\n/**\n * Creates reusable {@link parameter} function.\n *\n * @template T Target atomic type\n * @danger You must configure the generic argument `T`\n */\nexport function createParameter(): never;\n\n/**\n * Creates reusable {@link parameter} function.\n *\n * @template T Target atomic type\n * @returns Reusable decoder function\n */\nexport function createParameter<T extends Atomic.Type | null>(): (\n input: string,\n) => T;\n\n/** @internal */\nexport function createParameter<T extends Atomic.Type | null>(): (\n input: string,\n) => T {\n NoTransformConfigurationError(\"http.createParameter\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,SAAgB,WAAkB;CAChC,8BAA8B,eAAe;AAC/C;;AAoCA,SAAgB,iBAAwB;CACtC,8BAA8B,qBAAqB;AACrD;;AAgCA,SAAgB,aAAoB;CAClC,8BAA8B,iBAAiB;AACjD;;AAiCA,SAAgB,mBAA0B;CACxC,8BAA8B,uBAAuB;AACvD;;AAmCA,SAAgB,QAAe;CAC7B,8BAA8B,YAAY;AAC5C;;AAoCA,SAAgB,cAAqB;CACnC,8BAA8B,kBAAkB;AAClD;;AAgCA,SAAgB,UAAiB;CAC/B,8BAA8B,cAAc;AAC9C;;AAiCA,SAAgB,gBAAuB;CACrC,8BAA8B,oBAAoB;AACpD;;AA2CA,SAAgB,UAAiB;CAC/B,8BAA8B,cAAc;AAC9C;;AA4CA,SAAgB,gBAAuB;CACrC,8BAA8B,oBAAoB;AACpD;;AAwCA,SAAgB,YAAmB;CACjC,8BAA8B,gBAAgB;AAChD;;AAyCA,SAAgB,kBAAyB;CACvC,8BAA8B,sBAAsB;AACtD;;AAyBA,SAAgB,YAAmB;CACjC,8BAA8B,gBAAgB;AAChD;;AAsBA,SAAgB,iBAA4C;CAC1D,8BAA8B,qBAAqB;AACrD;;AA2BA,SAAgB,uBAAkD;CAChE,8BAA8B,2BAA2B;AAC3D;;AAqBA,SAAgB,mBAAqD;CACnE,8BAA8B,uBAAuB;AACvD;;AAqBA,SAAgB,yBAEc;CAC5B,8BAA8B,6BAA6B;AAC7D;;AAqBA,SAAgB,cAET;CACL,8BAA8B,kBAAkB;AAClD;;AA2BA,SAAgB,oBAET;CACL,8BAA8B,wBAAwB;AACxD;;AAqBA,SAAgB,gBAEF;CACZ,8BAA8B,oBAAoB;AACpD;;AAqBA,SAAgB,sBAEc;CAC5B,8BAA8B,0BAA0B;AAC1D;;AAqBA,SAAgB,gBAET;CACL,8BAA8B,oBAAoB;AACpD;;AA2BA,SAAgB,sBAET;CACL,8BAA8B,0BAA0B;AAC1D;;AAqBA,SAAgB,kBAEF;CACZ,8BAA8B,sBAAsB;AACtD;;AAqBA,SAAgB,wBAEc;CAC5B,8BAA8B,4BAA4B;AAC5D;;AAqBA,SAAgB,kBAET;CACL,8BAA8B,sBAAsB;AACtD"}
1
+ {"version":3,"file":"http.mjs","names":[],"sources":["../src/http.ts"],"sourcesContent":["import {\n Atomic,\n IReadableURLSearchParams,\n IValidation,\n Resolved,\n} from \"@typia/interface\";\n\nimport { TypeGuardError } from \"./TypeGuardError\";\nimport { NoTransformConfigurationError } from \"./transformers/NoTransformConfigurationError\";\n\n/* ===========================================================\n HTTP\n - FORM-DATA\n - QUERY\n - HEADERS\n - PARAMETER\n - FACTORY FUNCTIONS\n==============================================================\n FORM-DATA\n----------------------------------------------------------- */\n/**\n * Decodes `FormData` into type `T`.\n *\n * Parses a `FormData` instance with automatic type casting. Properties typed as\n * `boolean` or `Blob` are cast to expected types during decoding.\n *\n * Type `T` constraints:\n *\n * 1. Must be an object type\n * 2. No dynamic properties allowed\n * 3. Only `boolean`, `bigint`, `number`, `string`, `Blob`, `File` or their array\n * types allowed\n * 4. No union types allowed\n *\n * Does not validate the decoded value. For validation, use:\n *\n * - {@link assertFormData} — Throws on type mismatch\n * - {@link isFormData} — Returns `null` on type mismatch\n * - {@link validateFormData} — Returns detailed validation errors\n *\n * @template T Target object type\n * @param input FormData instance to decode\n * @returns Decoded object of type `T`\n * @danger You must configure the generic argument `T`\n */\nexport function formData<T extends object>(input: FormData): Resolved<T>;\n\n/** @internal */\nexport function formData(): never {\n NoTransformConfigurationError(\"http.formData\");\n}\n\n/**\n * Decodes `FormData` into type `T` with assertion.\n *\n * Parses a `FormData` instance with automatic type casting, then validates the\n * result via {@link assert}. Throws {@link TypeGuardError} on mismatch.\n *\n * Type `T` constraints:\n *\n * 1. Must be an object type\n * 2. No dynamic properties allowed\n * 3. Only `boolean`, `bigint`, `number`, `string`, `Blob`, `File` or their array\n * types allowed\n * 4. No union types allowed\n *\n * Related functions:\n *\n * - {@link formData} — No validation\n * - {@link isFormData} — Returns `null` instead of throwing\n * - {@link validateFormData} — Returns detailed validation errors\n *\n * @template T Target object type\n * @param input FormData instance to decode\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns Decoded object of type `T`\n * @throws {TypeGuardError} When decoded value doesn't conform to type `T`\n * @danger You must configure the generic argument `T`\n */\nexport function assertFormData<T extends object>(\n input: FormData,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): Resolved<T>;\n\n/** @internal */\nexport function assertFormData(): never {\n NoTransformConfigurationError(\"http.assertFormData\");\n}\n\n/**\n * Decodes `FormData` into type `T` with type checking.\n *\n * Parses a `FormData` instance with automatic type casting, then validates the\n * result via {@link is}. Returns `null` on type mismatch.\n *\n * Type `T` constraints:\n *\n * 1. Must be an object type\n * 2. No dynamic properties allowed\n * 3. Only `boolean`, `bigint`, `number`, `string`, `Blob`, `File` or their array\n * types allowed\n * 4. No union types allowed\n *\n * Related functions:\n *\n * - {@link formData} — No validation\n * - {@link assertFormData} — Throws instead of returning `null`\n * - {@link validateFormData} — Returns detailed validation errors\n *\n * @template T Target object type\n * @param input FormData instance to decode\n * @returns Decoded object of type `T`, or `null` if invalid\n * @danger You must configure the generic argument `T`\n */\nexport function isFormData<T extends object>(\n input: FormData,\n): Resolved<T> | null;\n\n/** @internal */\nexport function isFormData(): never {\n NoTransformConfigurationError(\"http.isFormData\");\n}\n\n/**\n * Decodes `FormData` into type `T` with validation.\n *\n * Parses a `FormData` instance with automatic type casting, then validates the\n * result via {@link validate}. Returns {@link IValidation.IFailure} with all\n * errors on mismatch, or {@link IValidation.ISuccess} with decoded value.\n *\n * Type `T` constraints:\n *\n * 1. Must be an object type\n * 2. No dynamic properties allowed\n * 3. Only `boolean`, `bigint`, `number`, `string`, `Blob`, `File` or their array\n * types allowed\n * 4. No union types allowed\n *\n * Related functions:\n *\n * - {@link formData} — No validation\n * - {@link assertFormData} — Throws on first error\n * - {@link isFormData} — Returns `null` instead of error details\n *\n * @template T Target object type\n * @param input FormData instance to decode\n * @returns Validation result containing decoded value or errors\n * @danger You must configure the generic argument `T`\n */\nexport function validateFormData<T extends object>(\n input: FormData,\n): IValidation<Resolved<T>>;\n\n/** @internal */\nexport function validateFormData(): never {\n NoTransformConfigurationError(\"http.validateFormData\");\n}\n\n/* -----------------------------------------------------------\n QUERY\n----------------------------------------------------------- */\n/**\n * Decodes URL query string into type `T`.\n *\n * Parses a query string or `URLSearchParams` instance with automatic type\n * casting. Properties typed as `boolean` or `number` are cast to expected types\n * during decoding.\n *\n * Type `T` constraints:\n *\n * 1. Must be an object type\n * 2. No dynamic properties allowed\n * 3. Only `boolean`, `bigint`, `number`, `string` or their array types allowed\n * 4. No union types allowed\n *\n * Does not validate the decoded value. For validation, use:\n *\n * - {@link assertQuery} — Throws on type mismatch\n * - {@link isQuery} — Returns `null` on type mismatch\n * - {@link validateQuery} — Returns detailed validation errors\n *\n * @template T Target object type\n * @param input Query string or URLSearchParams instance\n * @returns Decoded object of type `T`\n * @danger You must configure the generic argument `T`\n */\nexport function query<T extends object>(\n input: string | IReadableURLSearchParams,\n): Resolved<T>;\n\n/** @internal */\nexport function query(): never {\n NoTransformConfigurationError(\"http.query\");\n}\n\n/**\n * Decodes URL query string into type `T` with assertion.\n *\n * Parses a query string or `URLSearchParams` instance with automatic type\n * casting, then validates the result via {@link assert}. Throws\n * {@link TypeGuardError} on mismatch.\n *\n * Type `T` constraints:\n *\n * 1. Must be an object type\n * 2. No dynamic properties allowed\n * 3. Only `boolean`, `bigint`, `number`, `string` or their array types allowed\n * 4. No union types allowed\n *\n * Related functions:\n *\n * - {@link query} — No validation\n * - {@link isQuery} — Returns `null` instead of throwing\n * - {@link validateQuery} — Returns detailed validation errors\n *\n * @template T Target object type\n * @param input Query string or URLSearchParams instance\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns Decoded object of type `T`\n * @throws {TypeGuardError} When decoded value doesn't conform to type `T`\n * @danger You must configure the generic argument `T`\n */\nexport function assertQuery<T extends object>(\n input: string | IReadableURLSearchParams,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): Resolved<T>;\n\n/** @internal */\nexport function assertQuery(): never {\n NoTransformConfigurationError(\"http.assertQuery\");\n}\n\n/**\n * Decodes URL query string into type `T` with type checking.\n *\n * Parses a query string or `URLSearchParams` instance with automatic type\n * casting, then validates the result via {@link is}. Returns `null` on type\n * mismatch.\n *\n * Type `T` constraints:\n *\n * 1. Must be an object type\n * 2. No dynamic properties allowed\n * 3. Only `boolean`, `bigint`, `number`, `string` or their array types allowed\n * 4. No union types allowed\n *\n * Related functions:\n *\n * - {@link query} — No validation\n * - {@link assertQuery} — Throws instead of returning `null`\n * - {@link validateQuery} — Returns detailed validation errors\n *\n * @template T Target object type\n * @param input Query string or URLSearchParams instance\n * @returns Decoded object of type `T`, or `null` if invalid\n * @danger You must configure the generic argument `T`\n */\nexport function isQuery<T extends object>(\n input: string | IReadableURLSearchParams,\n): Resolved<T> | null;\n\n/** @internal */\nexport function isQuery(): never {\n NoTransformConfigurationError(\"http.isQuery\");\n}\n\n/**\n * Decodes URL query string into type `T` with validation.\n *\n * Parses a query string or `URLSearchParams` instance with automatic type\n * casting, then validates the result via {@link validate}. Returns\n * {@link IValidation.IFailure} with all errors on mismatch, or\n * {@link IValidation.ISuccess} with decoded value.\n *\n * Type `T` constraints:\n *\n * 1. Must be an object type\n * 2. No dynamic properties allowed\n * 3. Only `boolean`, `bigint`, `number`, `string` or their array types allowed\n * 4. No union types allowed\n *\n * Related functions:\n *\n * - {@link query} — No validation\n * - {@link assertQuery} — Throws on first error\n * - {@link isQuery} — Returns `null` instead of error details\n *\n * @template T Target object type\n * @param input Query string or URLSearchParams instance\n * @returns Validation result containing decoded value or errors\n * @danger You must configure the generic argument `T`\n */\nexport function validateQuery<T extends object>(\n input: string | IReadableURLSearchParams,\n): IValidation<Resolved<T>>;\n\n/** @internal */\nexport function validateQuery(): never {\n NoTransformConfigurationError(\"http.validateQuery\");\n}\n\n/* -----------------------------------------------------------\n HEADERS\n----------------------------------------------------------- */\n/**\n * Decodes HTTP headers into type `T`.\n *\n * Parses HTTP headers object with automatic type casting. Properties typed as\n * `boolean` or `number` are cast to expected types during decoding. Compatible\n * with Express and Fastify request headers.\n *\n * Type `T` constraints:\n *\n * 1. Must be an object type\n * 2. No dynamic properties allowed\n * 3. Property keys must be lowercase\n * 4. Property values cannot be `null` (but `undefined` is allowed)\n * 5. Only `boolean`, `bigint`, `number`, `string` or their array types allowed\n * 6. No union types allowed\n * 7. Property `set-cookie` must be array type\n * 8. These properties cannot be array type: `age`, `authorization`,\n * `content-length`, `content-type`, `etag`, `expires`, `from`, `host`,\n * `if-modified-since`, `if-unmodified-since`, `last-modified`, `location`,\n * `max-forwards`, `proxy-authorization`, `referer`, `retry-after`, `server`,\n * `user-agent`\n *\n * Does not validate the decoded value. For validation, use:\n *\n * - {@link assertHeaders} — Throws on type mismatch\n * - {@link isHeaders} — Returns `null` on type mismatch\n * - {@link validateHeaders} — Returns detailed validation errors\n *\n * @template T Target object type\n * @param input Headers object from HTTP request\n * @returns Decoded object of type `T`\n * @danger You must configure the generic argument `T`\n */\nexport function headers<T extends object>(\n input: Record<string, string | string[] | undefined>,\n): Resolved<T>;\n\n/** @internal */\nexport function headers(): never {\n NoTransformConfigurationError(\"http.headers\");\n}\n\n/**\n * Decodes HTTP headers into type `T` with assertion.\n *\n * Parses HTTP headers object with automatic type casting, then validates the\n * result via {@link assert}. Throws {@link TypeGuardError} on mismatch.\n * Compatible with Express and Fastify request headers.\n *\n * Type `T` constraints:\n *\n * 1. Must be an object type\n * 2. No dynamic properties allowed\n * 3. Property keys must be lowercase\n * 4. Property values cannot be `null` (but `undefined` is allowed)\n * 5. Only `boolean`, `bigint`, `number`, `string` or their array types allowed\n * 6. No union types allowed\n * 7. Property `set-cookie` must be array type\n * 8. These properties cannot be array type: `age`, `authorization`,\n * `content-length`, `content-type`, `etag`, `expires`, `from`, `host`,\n * `if-modified-since`, `if-unmodified-since`, `last-modified`, `location`,\n * `max-forwards`, `proxy-authorization`, `referer`, `retry-after`, `server`,\n * `user-agent`\n *\n * Related functions:\n *\n * - {@link headers} — No validation\n * - {@link isHeaders} — Returns `null` instead of throwing\n * - {@link validateHeaders} — Returns detailed validation errors\n *\n * @template T Target object type\n * @param input Headers object from HTTP request\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns Decoded object of type `T`\n * @throws {TypeGuardError} When decoded value doesn't conform to type `T`\n * @danger You must configure the generic argument `T`\n */\nexport function assertHeaders<T extends object>(\n input: Record<string, string | string[] | undefined>,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): Resolved<T>;\n\n/** @internal */\nexport function assertHeaders(): never {\n NoTransformConfigurationError(\"http.assertHeaders\");\n}\n\n/**\n * Decodes HTTP headers into type `T` with type checking.\n *\n * Parses HTTP headers object with automatic type casting, then validates the\n * result via {@link is}. Returns `null` on type mismatch. Compatible with\n * Express and Fastify request headers.\n *\n * Type `T` constraints:\n *\n * 1. Must be an object type\n * 2. No dynamic properties allowed\n * 3. Property keys must be lowercase\n * 4. Property values cannot be `null` (but `undefined` is allowed)\n * 5. Only `boolean`, `bigint`, `number`, `string` or their array types allowed\n * 6. No union types allowed\n * 7. Property `set-cookie` must be array type\n * 8. These properties cannot be array type: `age`, `authorization`,\n * `content-length`, `content-type`, `etag`, `expires`, `from`, `host`,\n * `if-modified-since`, `if-unmodified-since`, `last-modified`, `location`,\n * `max-forwards`, `proxy-authorization`, `referer`, `retry-after`, `server`,\n * `user-agent`\n *\n * Related functions:\n *\n * - {@link headers} — No validation\n * - {@link assertHeaders} — Throws instead of returning `null`\n * - {@link validateHeaders} — Returns detailed validation errors\n *\n * @template T Target object type\n * @param input Headers object from HTTP request\n * @returns Decoded object of type `T`, or `null` if invalid\n * @danger You must configure the generic argument `T`\n */\nexport function isHeaders<T extends object>(\n input: Record<string, string | string[] | undefined>,\n): Resolved<T> | null;\n\n/** @internal */\nexport function isHeaders(): never {\n NoTransformConfigurationError(\"http.isHeaders\");\n}\n\n/**\n * Decodes HTTP headers into type `T` with validation.\n *\n * Parses HTTP headers object with automatic type casting, then validates the\n * result via {@link validate}. Returns {@link IValidation.IFailure} with all\n * errors on mismatch, or {@link IValidation.ISuccess} with decoded value.\n * Compatible with Express and Fastify request headers.\n *\n * Type `T` constraints:\n *\n * 1. Must be an object type\n * 2. No dynamic properties allowed\n * 3. Property keys must be lowercase\n * 4. Property values cannot be `null` (but `undefined` is allowed)\n * 5. Only `boolean`, `bigint`, `number`, `string` or their array types allowed\n * 6. No union types allowed\n * 7. Property `set-cookie` must be array type\n * 8. These properties cannot be array type: `age`, `authorization`,\n * `content-length`, `content-type`, `etag`, `expires`, `from`, `host`,\n * `if-modified-since`, `if-unmodified-since`, `last-modified`, `location`,\n * `max-forwards`, `proxy-authorization`, `referer`, `retry-after`, `server`,\n * `user-agent`\n *\n * Related functions:\n *\n * - {@link headers} — No validation\n * - {@link assertHeaders} — Throws on first error\n * - {@link isHeaders} — Returns `null` instead of error details\n *\n * @template T Target object type\n * @param input Headers object from HTTP request\n * @returns Validation result containing decoded value or errors\n * @danger You must configure the generic argument `T`\n */\nexport function validateHeaders<T extends object>(\n input: Record<string, string | string[] | undefined>,\n): IValidation<Resolved<T>>;\n\n/** @internal */\nexport function validateHeaders(): never {\n NoTransformConfigurationError(\"http.validateHeaders\");\n}\n\n/* -----------------------------------------------------------\n PARAMETER\n----------------------------------------------------------- */\n/**\n * Decodes URL path parameter into type `T`.\n *\n * Parses a path parameter string with automatic type casting. When type `T` is\n * `boolean` or `number`, casts the string value to the expected type. Also\n * performs type assertion via {@link assert}, throwing {@link TypeGuardError} on\n * mismatch.\n *\n * @template T Target atomic type (`boolean`, `bigint`, `number`, `string`, or\n * `null`)\n * @param input Path parameter string\n * @returns Decoded value of type `T`\n * @throws {TypeGuardError} When decoded value doesn't conform to type `T`\n * @danger You must configure the generic argument `T`\n */\nexport function parameter<T extends Atomic.Type | null>(\n input: string,\n): Resolved<T>;\n\n/** @internal */\nexport function parameter(): never {\n NoTransformConfigurationError(\"http.parameter\");\n}\n\n/* -----------------------------------------------------------\n FACTORY FUNCTIONS\n----------------------------------------------------------- */\n/**\n * Creates reusable {@link formData} function.\n *\n * @template T Target object type\n * @danger You must configure the generic argument `T`\n */\nexport function createFormData(): never;\n\n/**\n * Creates reusable {@link formData} function.\n *\n * @template T Target object type\n * @returns Reusable decoder function\n */\nexport function createFormData<T extends object>(): (input: FormData) => T;\n\n/** @internal */\nexport function createFormData<T>(): (input: FormData) => T {\n NoTransformConfigurationError(\"http.createFormData\");\n}\n\n/**\n * Creates reusable {@link assertFormData} function.\n *\n * @template T Target object type\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @danger You must configure the generic argument `T`\n */\nexport function createAssertFormData(\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): never;\n\n/**\n * Creates reusable {@link assertFormData} function.\n *\n * @template T Target object type\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns Reusable decoder function\n */\nexport function createAssertFormData<T extends object>(\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): (\n input: FormData,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n) => T;\n\n/** @internal */\nexport function createAssertFormData<T>(): (\n input: FormData,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n) => T {\n NoTransformConfigurationError(\"http.createAssertFormData\");\n}\n\n/**\n * Creates reusable {@link isFormData} function.\n *\n * @template T Target object type\n * @danger You must configure the generic argument `T`\n */\nexport function createIsFormData(): never;\n\n/**\n * Creates reusable {@link isFormData} function.\n *\n * @template T Target object type\n * @returns Reusable decoder function\n */\nexport function createIsFormData<T extends object>(): (\n input: FormData,\n) => T | null;\n\n/** @internal */\nexport function createIsFormData<T>(): (input: FormData) => T | null {\n NoTransformConfigurationError(\"http.createIsFormData\");\n}\n\n/**\n * Creates reusable {@link validateFormData} function.\n *\n * @template T Target object type\n * @danger You must configure the generic argument `T`\n */\nexport function createValidateFormData(): never;\n\n/**\n * Creates reusable {@link validateFormData} function.\n *\n * @template T Target object type\n * @returns Reusable decoder function\n */\nexport function createValidateFormData<T extends object>(): (\n input: FormData,\n) => IValidation<Resolved<T>>;\n\n/** @internal */\nexport function createValidateFormData<T>(): (\n input: FormData,\n) => IValidation<Resolved<T>> {\n NoTransformConfigurationError(\"http.createValidateFormData\");\n}\n\n/**\n * Creates reusable {@link query} function.\n *\n * @template T Target object type\n * @danger You must configure the generic argument `T`\n */\nexport function createQuery(): never;\n\n/**\n * Creates reusable {@link query} function.\n *\n * @template T Target object type\n * @returns Reusable decoder function\n */\nexport function createQuery<T extends object>(): (\n input: string | IReadableURLSearchParams,\n) => T;\n\n/** @internal */\nexport function createQuery<T>(): (\n input: string | IReadableURLSearchParams,\n) => T {\n NoTransformConfigurationError(\"http.createQuery\");\n}\n\n/**\n * Creates reusable {@link assertQuery} function.\n *\n * @template T Target object type\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @danger You must configure the generic argument `T`\n */\nexport function createAssertQuery(\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): never;\n\n/**\n * Creates reusable {@link assertQuery} function.\n *\n * @template T Target object type\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns Reusable decoder function\n */\nexport function createAssertQuery<T extends object>(\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): (\n input: string | IReadableURLSearchParams,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n) => T;\n\n/** @internal */\nexport function createAssertQuery<T>(): (\n input: string | IReadableURLSearchParams,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n) => T {\n NoTransformConfigurationError(\"http.createAssertQuery\");\n}\n\n/**\n * Creates reusable {@link isQuery} function.\n *\n * @template T Target object type\n * @danger You must configure the generic argument `T`\n */\nexport function createIsQuery(): never;\n\n/**\n * Creates reusable {@link isQuery} function.\n *\n * @template T Target object type\n * @returns Reusable decoder function\n */\nexport function createIsQuery<T extends object>(): (\n input: string | IReadableURLSearchParams,\n) => T | null;\n\n/** @internal */\nexport function createIsQuery<T>(): (\n input: string | IReadableURLSearchParams,\n) => T | null {\n NoTransformConfigurationError(\"http.createIsQuery\");\n}\n\n/**\n * Creates reusable {@link validateQuery} function.\n *\n * @template T Target object type\n * @danger You must configure the generic argument `T`\n */\nexport function createValidateQuery(): never;\n\n/**\n * Creates reusable {@link validateQuery} function.\n *\n * @template T Target object type\n * @returns Reusable decoder function\n */\nexport function createValidateQuery<T extends object>(): (\n input: string | IReadableURLSearchParams,\n) => IValidation<Resolved<T>>;\n\n/** @internal */\nexport function createValidateQuery<T>(): (\n input: string | IReadableURLSearchParams,\n) => IValidation<Resolved<T>> {\n NoTransformConfigurationError(\"http.createValidateQuery\");\n}\n\n/**\n * Creates reusable {@link headers} function.\n *\n * @template T Target object type\n * @danger You must configure the generic argument `T`\n */\nexport function createHeaders(): never;\n\n/**\n * Creates reusable {@link headers} function.\n *\n * @template T Target object type\n * @returns Reusable decoder function\n */\nexport function createHeaders<T extends object>(): (\n input: Record<string, string | string[] | undefined>,\n) => T;\n\n/** @internal */\nexport function createHeaders<T>(): (\n input: Record<string, string | string[] | undefined>,\n) => T {\n NoTransformConfigurationError(\"http.createHeaders\");\n}\n\n/**\n * Creates reusable {@link assertHeaders} function.\n *\n * @template T Target object type\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @danger You must configure the generic argument `T`\n */\nexport function createAssertHeaders(\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): never;\n\n/**\n * Creates reusable {@link assertHeaders} function.\n *\n * @template T Target object type\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns Reusable decoder function\n */\nexport function createAssertHeaders<T extends object>(\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): (\n input: Record<string, string | string[] | undefined>,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n) => T;\n\n/** @internal */\nexport function createAssertHeaders<T>(): (\n input: Record<string, string | string[] | undefined>,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n) => T {\n NoTransformConfigurationError(\"http.createAssertHeaders\");\n}\n\n/**\n * Creates reusable {@link isHeaders} function.\n *\n * @template T Target object type\n * @danger You must configure the generic argument `T`\n */\nexport function createIsHeaders(): never;\n\n/**\n * Creates reusable {@link isHeaders} function.\n *\n * @template T Target object type\n * @returns Reusable decoder function\n */\nexport function createIsHeaders<T extends object>(): (\n input: Record<string, string | string[] | undefined>,\n) => T | null;\n\n/** @internal */\nexport function createIsHeaders<T>(): (\n input: Record<string, string | string[] | undefined>,\n) => T | null {\n NoTransformConfigurationError(\"http.createIsHeaders\");\n}\n\n/**\n * Creates reusable {@link validateHeaders} function.\n *\n * @template T Target object type\n * @danger You must configure the generic argument `T`\n */\nexport function createValidateHeaders(): never;\n\n/**\n * Creates reusable {@link validateHeaders} function.\n *\n * @template T Target object type\n * @returns Reusable decoder function\n */\nexport function createValidateHeaders<T extends object>(): (\n input: Record<string, string | string[] | undefined>,\n) => IValidation<Resolved<T>>;\n\n/** @internal */\nexport function createValidateHeaders<T>(): (\n input: Record<string, string | string[] | undefined>,\n) => IValidation<Resolved<T>> {\n NoTransformConfigurationError(\"http.createValidateHeaders\");\n}\n\n/**\n * Creates reusable {@link parameter} function.\n *\n * @template T Target atomic type\n * @danger You must configure the generic argument `T`\n */\nexport function createParameter(): never;\n\n/**\n * Creates reusable {@link parameter} function.\n *\n * @template T Target atomic type\n * @returns Reusable decoder function\n */\nexport function createParameter<T extends Atomic.Type | null>(): (\n input: string,\n) => T;\n\n/** @internal */\nexport function createParameter<T extends Atomic.Type | null>(): (\n input: string,\n) => T {\n NoTransformConfigurationError(\"http.createParameter\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,SAAgB,WAAkB;CAChC,8BAA8B,eAAe;AAC/C;;AAoCA,SAAgB,iBAAwB;CACtC,8BAA8B,qBAAqB;AACrD;;AAgCA,SAAgB,aAAoB;CAClC,8BAA8B,iBAAiB;AACjD;;AAiCA,SAAgB,mBAA0B;CACxC,8BAA8B,uBAAuB;AACvD;;AAmCA,SAAgB,QAAe;CAC7B,8BAA8B,YAAY;AAC5C;;AAoCA,SAAgB,cAAqB;CACnC,8BAA8B,kBAAkB;AAClD;;AAgCA,SAAgB,UAAiB;CAC/B,8BAA8B,cAAc;AAC9C;;AAiCA,SAAgB,gBAAuB;CACrC,8BAA8B,oBAAoB;AACpD;;AA2CA,SAAgB,UAAiB;CAC/B,8BAA8B,cAAc;AAC9C;;AA4CA,SAAgB,gBAAuB;CACrC,8BAA8B,oBAAoB;AACpD;;AAwCA,SAAgB,YAAmB;CACjC,8BAA8B,gBAAgB;AAChD;;AAyCA,SAAgB,kBAAyB;CACvC,8BAA8B,sBAAsB;AACtD;;AAyBA,SAAgB,YAAmB;CACjC,8BAA8B,gBAAgB;AAChD;;AAsBA,SAAgB,iBAA4C;CAC1D,8BAA8B,qBAAqB;AACrD;;AA8BA,SAAgB,uBAGT;CACL,8BAA8B,2BAA2B;AAC3D;;AAqBA,SAAgB,mBAAqD;CACnE,8BAA8B,uBAAuB;AACvD;;AAqBA,SAAgB,yBAEc;CAC5B,8BAA8B,6BAA6B;AAC7D;;AAqBA,SAAgB,cAET;CACL,8BAA8B,kBAAkB;AAClD;;AA8BA,SAAgB,oBAGT;CACL,8BAA8B,wBAAwB;AACxD;;AAqBA,SAAgB,gBAEF;CACZ,8BAA8B,oBAAoB;AACpD;;AAqBA,SAAgB,sBAEc;CAC5B,8BAA8B,0BAA0B;AAC1D;;AAqBA,SAAgB,gBAET;CACL,8BAA8B,oBAAoB;AACpD;;AA8BA,SAAgB,sBAGT;CACL,8BAA8B,0BAA0B;AAC1D;;AAqBA,SAAgB,kBAEF;CACZ,8BAA8B,sBAAsB;AACtD;;AAqBA,SAAgB,wBAEc;CAC5B,8BAA8B,4BAA4B;AAC5D;;AAqBA,SAAgB,kBAET;CACL,8BAA8B,sBAAsB;AACtD"}
@@ -4,10 +4,20 @@ exports._assertGuard = void 0;
4
4
  const TypeGuardError_1 = require("../TypeGuardError");
5
5
  const _assertGuard = (exceptionable, props, factory) => {
6
6
  if (exceptionable === true) {
7
- if (factory)
7
+ // `factory` arrives from the generated function's second parameter, which
8
+ // a pointwise hand-off fills with something that is not a factory at all:
9
+ // `rows.map(assertUser)` passes the element index. A truthiness test then
10
+ // called a number and reported `factory is not a function`, hiding the
11
+ // real assertion failure — and only for indices other than 0. Require a
12
+ // callable, and fall back to TypeGuardError for everything else.
13
+ //
14
+ // A create-time factory is the default of that same parameter, so a
15
+ // non-callable argument has already overridden it by the time this runs
16
+ // and cannot be recovered here. TypeGuardError still names the property
17
+ // that failed, which `factory is not a function` never did.
18
+ if (typeof factory === "function")
8
19
  throw factory(props);
9
- else
10
- throw new TypeGuardError_1.TypeGuardError(props);
20
+ throw new TypeGuardError_1.TypeGuardError(props);
11
21
  }
12
22
  return false;
13
23
  };
@@ -1 +1 @@
1
- {"version":3,"file":"_assertGuard.js","sourceRoot":"","sources":["../../src/internal/_assertGuard.ts"],"names":[],"mappings":";;;AAAA,sDAAmD;AAE5C,MAAM,YAAY,GAAG,CAC1B,aAAsB,EACtB,KAA4B,EAC5B,OAAiD,EAC1C,EAAE;IACT,IAAI,aAAa,KAAK,IAAI,EAAE,CAAC;QAC3B,IAAI,OAAO;YAAE,MAAM,OAAO,CAAC,KAAK,CAAC,CAAC;;YAC7B,MAAM,IAAI,+BAAc,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAVW,QAAA,YAAY,GAAZ,YAAY,CAUvB"}
1
+ {"version":3,"file":"_assertGuard.js","sourceRoot":"","sources":["../../src/internal/_assertGuard.ts"],"names":[],"mappings":";;;AAAA,sDAAmD;AAE5C,MAAM,YAAY,GAAG,CAC1B,aAAsB,EACtB,KAA4B,EAC5B,OAAiD,EAC1C,EAAE;IACT,IAAI,aAAa,KAAK,IAAI,EAAE,CAAC;QAC3B,0EAA0E;QAC1E,0EAA0E;QAC1E,0EAA0E;QAC1E,uEAAuE;QACvE,wEAAwE;QACxE,iEAAiE;QACjE,EAAE;QACF,oEAAoE;QACpE,wEAAwE;QACxE,wEAAwE;QACxE,4DAA4D;QAC5D,IAAI,OAAO,OAAO,KAAK,UAAU;YAAE,MAAM,OAAO,CAAC,KAAK,CAAC,CAAC;QACxD,MAAM,IAAI,+BAAc,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AArBW,QAAA,YAAY,GAAZ,YAAY,CAqBvB"}
@@ -1,8 +1,10 @@
1
1
  import { TypeGuardError } from "../TypeGuardError.mjs";
2
2
  //#region src/internal/_assertGuard.ts
3
3
  const _assertGuard = (exceptionable, props, factory) => {
4
- if (exceptionable === true) if (factory) throw factory(props);
5
- else throw new TypeGuardError(props);
4
+ if (exceptionable === true) {
5
+ if (typeof factory === "function") throw factory(props);
6
+ throw new TypeGuardError(props);
7
+ }
6
8
  return false;
7
9
  };
8
10
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"_assertGuard.mjs","names":[],"sources":["../../src/internal/_assertGuard.ts"],"sourcesContent":["import { TypeGuardError } from \"../TypeGuardError\";\n\nexport const _assertGuard = (\n exceptionable: boolean,\n props: TypeGuardError.IProps,\n factory?: (props: TypeGuardError.IProps) => Error,\n): false => {\n if (exceptionable === true) {\n if (factory) throw factory(props);\n else throw new TypeGuardError(props);\n }\n return false;\n};\n"],"mappings":";;AAEA,MAAa,gBACX,eACA,OACA,YACU;CACV,IAAI,kBAAkB,MACpB,IAAI,SAAS,MAAM,QAAQ,KAAK;MAC3B,MAAM,IAAI,eAAe,KAAK;CAErC,OAAO;AACT"}
1
+ {"version":3,"file":"_assertGuard.mjs","names":[],"sources":["../../src/internal/_assertGuard.ts"],"sourcesContent":["import { TypeGuardError } from \"../TypeGuardError\";\n\nexport const _assertGuard = (\n exceptionable: boolean,\n props: TypeGuardError.IProps,\n factory?: (props: TypeGuardError.IProps) => Error,\n): false => {\n if (exceptionable === true) {\n // `factory` arrives from the generated function's second parameter, which\n // a pointwise hand-off fills with something that is not a factory at all:\n // `rows.map(assertUser)` passes the element index. A truthiness test then\n // called a number and reported `factory is not a function`, hiding the\n // real assertion failure — and only for indices other than 0. Require a\n // callable, and fall back to TypeGuardError for everything else.\n //\n // A create-time factory is the default of that same parameter, so a\n // non-callable argument has already overridden it by the time this runs\n // and cannot be recovered here. TypeGuardError still names the property\n // that failed, which `factory is not a function` never did.\n if (typeof factory === \"function\") throw factory(props);\n throw new TypeGuardError(props);\n }\n return false;\n};\n"],"mappings":";;AAEA,MAAa,gBACX,eACA,OACA,YACU;CACV,IAAI,kBAAkB,MAAM;EAY1B,IAAI,OAAO,YAAY,YAAY,MAAM,QAAQ,KAAK;EACtD,MAAM,IAAI,eAAe,KAAK;CAChC;CACA,OAAO;AACT"}
@@ -3,5 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports._isFormatIdnHostname = void 0;
4
4
  const _isFormatIdnHostname = (str) => PATTERN.test(str);
5
5
  exports._isFormatIdnHostname = _isFormatIdnHostname;
6
- const PATTERN = /^([a-z0-9\u00a1-\uffff0-9]+(-[a-z0-9\u00a1-\uffff0-9]+)*\.)+[a-z\u00a1-\uffff]{2,}$/i;
6
+ // The ASCII `hostname` structure with the label character class extended by the
7
+ // non-ASCII range: every valid host name is a valid IDN host name, so this must
8
+ // accept a single label, a one-to-63-character label in any position, and a
9
+ // name up to 253 characters, exactly as `_isFormatHostname` does (issue #2317).
10
+ const PATTERN = /^(?=.{1,253}\.?$)[a-z0-9\u00a1-\uffff](?:[a-z0-9\u00a1-\uffff-]{0,61}[a-z0-9\u00a1-\uffff])?(?:\.[a-z0-9\u00a1-\uffff](?:[a-z0-9\u00a1-\uffff-]{0,61}[a-z0-9\u00a1-\uffff])?)*\.?$/i;
7
11
  //# sourceMappingURL=_isFormatIdnHostname.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"_isFormatIdnHostname.js","sourceRoot":"","sources":["../../src/internal/_isFormatIdnHostname.ts"],"names":[],"mappings":";;;AAAO,MAAM,oBAAoB,GAAG,CAAC,GAAW,EAAW,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAAnE,QAAA,oBAAoB,GAApB,oBAAoB,CAA+C;AAEhF,MAAM,OAAO,GACX,sFAAsF,CAAC"}
1
+ {"version":3,"file":"_isFormatIdnHostname.js","sourceRoot":"","sources":["../../src/internal/_isFormatIdnHostname.ts"],"names":[],"mappings":";;;AAAO,MAAM,oBAAoB,GAAG,CAAC,GAAW,EAAW,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAAnE,QAAA,oBAAoB,GAApB,oBAAoB,CAA+C;AAEhF,gFAAgF;AAChF,gFAAgF;AAChF,4EAA4E;AAC5E,gFAAgF;AAChF,MAAM,OAAO,GACX,qLAAqL,CAAC"}
@@ -1,6 +1,6 @@
1
1
  //#region src/internal/_isFormatIdnHostname.ts
2
2
  const _isFormatIdnHostname = (str) => PATTERN.test(str);
3
- const PATTERN = /^([a-z0-9\u00a1-\uffff0-9]+(-[a-z0-9\u00a1-\uffff0-9]+)*\.)+[a-z\u00a1-\uffff]{2,}$/i;
3
+ const PATTERN = /^(?=.{1,253}\.?$)[a-z0-9\u00a1-\uffff](?:[a-z0-9\u00a1-\uffff-]{0,61}[a-z0-9\u00a1-\uffff])?(?:\.[a-z0-9\u00a1-\uffff](?:[a-z0-9\u00a1-\uffff-]{0,61}[a-z0-9\u00a1-\uffff])?)*\.?$/i;
4
4
  //#endregion
5
5
  export { _isFormatIdnHostname };
6
6
 
@@ -1 +1 @@
1
- {"version":3,"file":"_isFormatIdnHostname.mjs","names":[],"sources":["../../src/internal/_isFormatIdnHostname.ts"],"sourcesContent":["export const _isFormatIdnHostname = (str: string): boolean => PATTERN.test(str);\n\nconst PATTERN =\n /^([a-z0-9\\u00a1-\\uffff0-9]+(-[a-z0-9\\u00a1-\\uffff0-9]+)*\\.)+[a-z\\u00a1-\\uffff]{2,}$/i;\n"],"mappings":";AAAA,MAAa,wBAAwB,QAAyB,QAAQ,KAAK,GAAG;AAE9E,MAAM,UACJ"}
1
+ {"version":3,"file":"_isFormatIdnHostname.mjs","names":[],"sources":["../../src/internal/_isFormatIdnHostname.ts"],"sourcesContent":["export const _isFormatIdnHostname = (str: string): boolean => PATTERN.test(str);\n\n// The ASCII `hostname` structure with the label character class extended by the\n// non-ASCII range: every valid host name is a valid IDN host name, so this must\n// accept a single label, a one-to-63-character label in any position, and a\n// name up to 253 characters, exactly as `_isFormatHostname` does (issue #2317).\nconst PATTERN =\n /^(?=.{1,253}\\.?$)[a-z0-9\\u00a1-\\uffff](?:[a-z0-9\\u00a1-\\uffff-]{0,61}[a-z0-9\\u00a1-\\uffff])?(?:\\.[a-z0-9\\u00a1-\\uffff](?:[a-z0-9\\u00a1-\\uffff-]{0,61}[a-z0-9\\u00a1-\\uffff])?)*\\.?$/i;\n"],"mappings":";AAAA,MAAa,wBAAwB,QAAyB,QAAQ,KAAK,GAAG;AAM9E,MAAM,UACJ"}
@@ -1,7 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports._isFormatTime = void 0;
4
- const _isFormatTime = (str) => PATTERN.test(str);
4
+ const _isFormatTime = (str) => {
5
+ const match = PATTERN.exec(str);
6
+ if (match === null)
7
+ return false;
8
+ if (match[3] !== "60")
9
+ return true;
10
+ // RFC 3339 admits `:60` only where a leap second is inserted, which is
11
+ // always 23:59:60 UTC. `date-time` decides that from the instant it can
12
+ // build; a clock carries no date, so it shifts itself by its own offset and
13
+ // asks the same question, wrapping the result back into the day.
14
+ const offset = match[4] === undefined
15
+ ? 0
16
+ : (match[4] === "+" ? 1 : -1) *
17
+ (Number(match[5]) * 60 + Number(match[6]));
18
+ const minutes = Number(match[1]) * 60 + Number(match[2]) - offset;
19
+ return ((minutes % DAY) + DAY) % DAY === DAY - 1;
20
+ };
5
21
  exports._isFormatTime = _isFormatTime;
6
- const PATTERN = /^([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](?:\.[0-9]{1,9})?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$/i;
22
+ const PATTERN = /^([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(?:\.[0-9]+)?(?:[Zz]|([+-])((?:[01][0-9]|2[0-3])):([0-5][0-9]))$/;
23
+ const DAY = 24 * 60;
7
24
  //# sourceMappingURL=_isFormatTime.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"_isFormatTime.js","sourceRoot":"","sources":["../../src/internal/_isFormatTime.ts"],"names":[],"mappings":";;;AAAO,MAAM,aAAa,GAAG,CAAC,GAAW,EAAW,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAA5D,QAAA,aAAa,GAAb,aAAa,CAA+C;AAEzE,MAAM,OAAO,GACX,mGAAmG,CAAC"}
1
+ {"version":3,"file":"_isFormatTime.js","sourceRoot":"","sources":["../../src/internal/_isFormatTime.ts"],"names":[],"mappings":";;;AAAO,MAAM,aAAa,GAAG,CAAC,GAAW,EAAW,EAAE;IACpD,MAAM,KAAK,GAA2B,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACxD,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IACjC,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAEnC,uEAAuE;IACvE,wEAAwE;IACxE,4EAA4E;IAC5E,iEAAiE;IACjE,MAAM,MAAM,GACV,KAAK,CAAC,CAAC,CAAC,KAAK,SAAS;QACpB,CAAC,CAAC,CAAC;QACH,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC3B,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACjD,MAAM,OAAO,GAAW,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;IAC1E,OAAO,CAAC,CAAC,OAAO,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,KAAK,GAAG,GAAG,CAAC,CAAC;AACnD,CAAC,CAAC;AAhBW,QAAA,aAAa,GAAb,aAAa,CAgBxB;AAEF,MAAM,OAAO,GACX,kHAAkH,CAAC;AACrH,MAAM,GAAG,GAAG,EAAE,GAAG,EAAE,CAAC"}
@@ -1,6 +1,13 @@
1
1
  //#region src/internal/_isFormatTime.ts
2
- const _isFormatTime = (str) => PATTERN.test(str);
3
- const PATTERN = /^([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](?:\.[0-9]{1,9})?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$/i;
2
+ const _isFormatTime = (str) => {
3
+ const match = PATTERN.exec(str);
4
+ if (match === null) return false;
5
+ if (match[3] !== "60") return true;
6
+ const offset = match[4] === void 0 ? 0 : (match[4] === "+" ? 1 : -1) * (Number(match[5]) * 60 + Number(match[6]));
7
+ return ((Number(match[1]) * 60 + Number(match[2]) - offset) % DAY + DAY) % DAY === DAY - 1;
8
+ };
9
+ const PATTERN = /^([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(?:\.[0-9]+)?(?:[Zz]|([+-])((?:[01][0-9]|2[0-3])):([0-5][0-9]))$/;
10
+ const DAY = 1440;
4
11
  //#endregion
5
12
  export { _isFormatTime };
6
13
 
@@ -1 +1 @@
1
- {"version":3,"file":"_isFormatTime.mjs","names":[],"sources":["../../src/internal/_isFormatTime.ts"],"sourcesContent":["export const _isFormatTime = (str: string): boolean => PATTERN.test(str);\n\nconst PATTERN =\n /^([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](?:\\.[0-9]{1,9})?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$/i;\n"],"mappings":";AAAA,MAAa,iBAAiB,QAAyB,QAAQ,KAAK,GAAG;AAEvE,MAAM,UACJ"}
1
+ {"version":3,"file":"_isFormatTime.mjs","names":[],"sources":["../../src/internal/_isFormatTime.ts"],"sourcesContent":["export const _isFormatTime = (str: string): boolean => {\n const match: RegExpExecArray | null = PATTERN.exec(str);\n if (match === null) return false;\n if (match[3] !== \"60\") return true;\n\n // RFC 3339 admits `:60` only where a leap second is inserted, which is\n // always 23:59:60 UTC. `date-time` decides that from the instant it can\n // build; a clock carries no date, so it shifts itself by its own offset and\n // asks the same question, wrapping the result back into the day.\n const offset: number =\n match[4] === undefined\n ? 0\n : (match[4] === \"+\" ? 1 : -1) *\n (Number(match[5]) * 60 + Number(match[6]));\n const minutes: number = Number(match[1]) * 60 + Number(match[2]) - offset;\n return ((minutes % DAY) + DAY) % DAY === DAY - 1;\n};\n\nconst PATTERN =\n /^([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(?:\\.[0-9]+)?(?:[Zz]|([+-])((?:[01][0-9]|2[0-3])):([0-5][0-9]))$/;\nconst DAY = 24 * 60;\n"],"mappings":";AAAA,MAAa,iBAAiB,QAAyB;CACrD,MAAM,QAAgC,QAAQ,KAAK,GAAG;CACtD,IAAI,UAAU,MAAM,OAAO;CAC3B,IAAI,MAAM,OAAO,MAAM,OAAO;CAM9B,MAAM,SACJ,MAAM,OAAO,KAAA,IACT,KACC,MAAM,OAAO,MAAM,IAAI,OACvB,OAAO,MAAM,EAAE,IAAI,KAAK,OAAO,MAAM,EAAE;CAE9C,SADwB,OAAO,MAAM,EAAE,IAAI,KAAK,OAAO,MAAM,EAAE,IAAI,UAChD,MAAO,OAAO,QAAQ,MAAM;AACjD;AAEA,MAAM,UACJ;AACF,MAAM,MAAM"}
@@ -6,6 +6,15 @@ const _randomInteger_1 = require("./_randomInteger");
6
6
  const DEFAULT_MIN_ITEMS = 1;
7
7
  const DEFAULT_RANGE = 5;
8
8
  const DEFAULT_RECURSIVE_RANGE = 2;
9
+ /**
10
+ * Consecutive duplicates that end a unique draw once its floor is satisfied.
11
+ *
12
+ * The worst case a domain can still hide is one value left among a handful:
13
+ * with one of four remaining, sixty-four misses in a row is a `0.75 ** 64`
14
+ * event, about one in a hundred million. Below the floor this limit does not
15
+ * apply at all, so it can never fail a request the domain could satisfy.
16
+ */
17
+ const STALE_LIMIT = 64;
9
18
  const _randomArray = (props) => {
10
19
  var _a, _b, _c;
11
20
  const defaultMinimum = props.recursive === true ? 0 : DEFAULT_MIN_ITEMS;
@@ -18,15 +27,39 @@ const _randomArray = (props) => {
18
27
  });
19
28
  if (props.uniqueItems !== true)
20
29
  return new Array(count).fill(null).map((_, i) => props.element(i, count));
30
+ // How many distinct values the element can take is not knowable from here --
31
+ // `element` is a closure over whatever the transform emitted, from `boolean`
32
+ // to a recursive object -- so the count above is a preference, not a
33
+ // contract. Draw until the budget says the domain has nothing new left, then
34
+ // keep what was reached.
35
+ //
36
+ // Failing on that budget instead is what made `Array<boolean> &
37
+ // UniqueItems` throw on two draws in three: `[true, false]` satisfies the
38
+ // declaration at every count, and a count of five is unreachable for a
39
+ // domain of two however many times it is redrawn. Only a result below the
40
+ // floor is a real failure, which is still the honest outcome for a window
41
+ // like `MinItems<3>` over a domain of two.
42
+ //
43
+ // Below the floor the whole budget is spent, because stopping early there
44
+ // would fail a request the domain can still satisfy. Above it every further
45
+ // attempt is only buying length, so a run of `STALE_LIMIT` duplicates is
46
+ // taken as the domain saying it has nothing left. Without that, each nesting
47
+ // level of a small-domain unique array multiplies the full budget into the
48
+ // level above it.
21
49
  const elements = [];
22
50
  const maximumAttempts = count * 100 + 1000;
23
- for (let attempts = 0; elements.length !== count; attempts++) {
24
- if (attempts === maximumAttempts)
25
- throw new Error("Unable to generate enough unique items; the element domain may be too small.");
51
+ let stale = 0;
52
+ for (let attempts = 0; elements.length !== count && attempts !== maximumAttempts; attempts++) {
26
53
  const candidate = props.element(elements.length, count);
27
- if (elements.every((element) => (0, _isUniqueItems_1._isUniqueItems)([element, candidate])))
54
+ if (elements.every((element) => (0, _isUniqueItems_1._isUniqueItems)([element, candidate]))) {
28
55
  elements.push(candidate);
56
+ stale = 0;
57
+ }
58
+ else if (elements.length >= minimum && ++stale === STALE_LIMIT)
59
+ break;
29
60
  }
61
+ if (elements.length < minimum)
62
+ throw new Error("Unable to generate enough unique items; the element domain may be too small.");
30
63
  return elements;
31
64
  };
32
65
  exports._randomArray = _randomArray;
@@ -1 +1 @@
1
- {"version":3,"file":"_randomArray.js","sourceRoot":"","sources":["../../src/internal/_randomArray.ts"],"names":[],"mappings":";;;AAEA,qDAAkD;AAClD,qDAAkD;AAElD,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAC5B,MAAM,aAAa,GAAG,CAAC,CAAC;AACxB,MAAM,uBAAuB,GAAG,CAAC,CAAC;AAE3B,MAAM,YAAY,GAAG,CAC1B,KAGC,EACD,EAAE;;IACF,MAAM,cAAc,GAClB,KAAK,CAAC,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC;IACnD,MAAM,OAAO,SACX,KAAK,CAAC,QAAQ,mCACd,IAAI,CAAC,GAAG,OAAC,KAAK,CAAC,QAAQ,mCAAI,cAAc,EAAE,cAAc,CAAC,CAAC;IAC7D,MAAM,KAAK,GAAW,IAAA,+BAAc,EAAC;QACnC,IAAI,EAAE,SAAS;QACf,OAAO;QACP,OAAO,QACL,KAAK,CAAC,QAAQ,mCACd,OAAO;YACL,CAAC,KAAK,CAAC,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,aAAa,CAAC;KACzE,CAAC,CAAC;IACH,IAAI,KAAK,CAAC,WAAW,KAAK,IAAI;QAC5B,OAAO,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,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,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;YACtE,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YACzB,KAAK,GAAG,CAAC,CAAC;QACZ,CAAC;aAAM,IAAI,QAAQ,CAAC,MAAM,IAAI,OAAO,IAAI,EAAE,KAAK,KAAK,WAAW;YAAE,MAAM;IAC1E,CAAC;IACD,IAAI,QAAQ,CAAC,MAAM,GAAG,OAAO;QAC3B,MAAM,IAAI,KAAK,CACb,8EAA8E,CAC/E,CAAC;IACJ,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AA3DW,QAAA,YAAY,GAAZ,YAAY,CA2DvB"}
@@ -4,6 +4,15 @@ import { _randomInteger } from "./_randomInteger.mjs";
4
4
  const DEFAULT_MIN_ITEMS = 1;
5
5
  const DEFAULT_RANGE = 5;
6
6
  const DEFAULT_RECURSIVE_RANGE = 2;
7
+ /**
8
+ * Consecutive duplicates that end a unique draw once its floor is satisfied.
9
+ *
10
+ * The worst case a domain can still hide is one value left among a handful:
11
+ * with one of four remaining, sixty-four misses in a row is a `0.75 ** 64`
12
+ * event, about one in a hundred million. Below the floor this limit does not
13
+ * apply at all, so it can never fail a request the domain could satisfy.
14
+ */
15
+ const STALE_LIMIT = 64;
7
16
  const _randomArray = (props) => {
8
17
  const defaultMinimum = props.recursive === true ? 0 : DEFAULT_MIN_ITEMS;
9
18
  const minimum = props.minItems ?? Math.min(props.maxItems ?? defaultMinimum, defaultMinimum);
@@ -15,11 +24,15 @@ const _randomArray = (props) => {
15
24
  if (props.uniqueItems !== true) return new Array(count).fill(null).map((_, i) => props.element(i, count));
16
25
  const elements = [];
17
26
  const maximumAttempts = count * 100 + 1e3;
18
- for (let attempts = 0; elements.length !== count; attempts++) {
19
- if (attempts === maximumAttempts) throw new Error("Unable to generate enough unique items; the element domain may be too small.");
27
+ let stale = 0;
28
+ for (let attempts = 0; elements.length !== count && attempts !== maximumAttempts; attempts++) {
20
29
  const candidate = props.element(elements.length, count);
21
- if (elements.every((element) => _isUniqueItems([element, candidate]))) elements.push(candidate);
30
+ if (elements.every((element) => _isUniqueItems([element, candidate]))) {
31
+ elements.push(candidate);
32
+ stale = 0;
33
+ } else if (elements.length >= minimum && ++stale === STALE_LIMIT) break;
22
34
  }
35
+ if (elements.length < minimum) throw new Error("Unable to generate enough unique items; the element domain may be too small.");
23
36
  return elements;
24
37
  };
25
38
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"_randomArray.mjs","names":[],"sources":["../../src/internal/_randomArray.ts"],"sourcesContent":["import type { OpenApi } from \"@typia/interface\";\n\nimport { _isUniqueItems } from \"./_isUniqueItems\";\nimport { _randomInteger } from \"./_randomInteger\";\n\nconst DEFAULT_MIN_ITEMS = 1;\nconst DEFAULT_RANGE = 5;\nconst DEFAULT_RECURSIVE_RANGE = 2;\n\nexport const _randomArray = <T>(\n props: Omit<OpenApi.IJsonSchema.IArray, \"items\"> & {\n element: (index: number, count: number) => T;\n recursive?: boolean;\n },\n) => {\n const defaultMinimum: number =\n props.recursive === true ? 0 : DEFAULT_MIN_ITEMS;\n const minimum: number =\n props.minItems ??\n Math.min(props.maxItems ?? defaultMinimum, defaultMinimum);\n const count: number = _randomInteger({\n type: \"integer\",\n minimum,\n maximum:\n props.maxItems ??\n minimum +\n (props.recursive === true ? DEFAULT_RECURSIVE_RANGE : DEFAULT_RANGE),\n });\n if (props.uniqueItems !== true)\n return new Array(count).fill(null).map((_, i) => props.element(i, count));\n const elements: T[] = [];\n const maximumAttempts: number = count * 100 + 1000;\n for (let attempts = 0; elements.length !== count; attempts++) {\n if (attempts === maximumAttempts)\n throw new Error(\n \"Unable to generate enough unique items; the element domain may be too small.\",\n );\n const candidate: T = props.element(elements.length, count);\n if (elements.every((element) => _isUniqueItems([element, candidate])))\n elements.push(candidate);\n }\n return elements;\n};\n"],"mappings":";;;AAKA,MAAM,oBAAoB;AAC1B,MAAM,gBAAgB;AACtB,MAAM,0BAA0B;AAEhC,MAAa,gBACX,UAIG;CACH,MAAM,iBACJ,MAAM,cAAc,OAAO,IAAI;CACjC,MAAM,UACJ,MAAM,YACN,KAAK,IAAI,MAAM,YAAY,gBAAgB,cAAc;CAC3D,MAAM,QAAgB,eAAe;EACnC,MAAM;EACN;EACA,SACE,MAAM,YACN,WACG,MAAM,cAAc,OAAO,0BAA0B;CAC5D,CAAC;CACD,IAAI,MAAM,gBAAgB,MACxB,OAAO,IAAI,MAAM,KAAK,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,GAAG,MAAM,MAAM,QAAQ,GAAG,KAAK,CAAC;CAC1E,MAAM,WAAgB,CAAC;CACvB,MAAM,kBAA0B,QAAQ,MAAM;CAC9C,KAAK,IAAI,WAAW,GAAG,SAAS,WAAW,OAAO,YAAY;EAC5D,IAAI,aAAa,iBACf,MAAM,IAAI,MACR,8EACF;EACF,MAAM,YAAe,MAAM,QAAQ,SAAS,QAAQ,KAAK;EACzD,IAAI,SAAS,OAAO,YAAY,eAAe,CAAC,SAAS,SAAS,CAAC,CAAC,GAClE,SAAS,KAAK,SAAS;CAC3B;CACA,OAAO;AACT"}
1
+ {"version":3,"file":"_randomArray.mjs","names":[],"sources":["../../src/internal/_randomArray.ts"],"sourcesContent":["import type { OpenApi } from \"@typia/interface\";\n\nimport { _isUniqueItems } from \"./_isUniqueItems\";\nimport { _randomInteger } from \"./_randomInteger\";\n\nconst DEFAULT_MIN_ITEMS = 1;\nconst DEFAULT_RANGE = 5;\nconst DEFAULT_RECURSIVE_RANGE = 2;\n\n/**\n * Consecutive duplicates that end a unique draw once its floor is satisfied.\n *\n * The worst case a domain can still hide is one value left among a handful:\n * with one of four remaining, sixty-four misses in a row is a `0.75 ** 64`\n * event, about one in a hundred million. Below the floor this limit does not\n * apply at all, so it can never fail a request the domain could satisfy.\n */\nconst STALE_LIMIT = 64;\n\nexport const _randomArray = <T>(\n props: Omit<OpenApi.IJsonSchema.IArray, \"items\"> & {\n element: (index: number, count: number) => T;\n recursive?: boolean;\n },\n) => {\n const defaultMinimum: number =\n props.recursive === true ? 0 : DEFAULT_MIN_ITEMS;\n const minimum: number =\n props.minItems ??\n Math.min(props.maxItems ?? defaultMinimum, defaultMinimum);\n const count: number = _randomInteger({\n type: \"integer\",\n minimum,\n maximum:\n props.maxItems ??\n minimum +\n (props.recursive === true ? DEFAULT_RECURSIVE_RANGE : DEFAULT_RANGE),\n });\n if (props.uniqueItems !== true)\n return new Array(count).fill(null).map((_, i) => props.element(i, count));\n // How many distinct values the element can take is not knowable from here --\n // `element` is a closure over whatever the transform emitted, from `boolean`\n // to a recursive object -- so the count above is a preference, not a\n // contract. Draw until the budget says the domain has nothing new left, then\n // keep what was reached.\n //\n // Failing on that budget instead is what made `Array<boolean> &\n // UniqueItems` throw on two draws in three: `[true, false]` satisfies the\n // declaration at every count, and a count of five is unreachable for a\n // domain of two however many times it is redrawn. Only a result below the\n // floor is a real failure, which is still the honest outcome for a window\n // like `MinItems<3>` over a domain of two.\n //\n // Below the floor the whole budget is spent, because stopping early there\n // would fail a request the domain can still satisfy. Above it every further\n // attempt is only buying length, so a run of `STALE_LIMIT` duplicates is\n // taken as the domain saying it has nothing left. Without that, each nesting\n // level of a small-domain unique array multiplies the full budget into the\n // level above it.\n const elements: T[] = [];\n const maximumAttempts: number = count * 100 + 1000;\n let stale: number = 0;\n for (\n let attempts = 0;\n elements.length !== count && attempts !== maximumAttempts;\n attempts++\n ) {\n const candidate: T = props.element(elements.length, count);\n if (elements.every((element) => _isUniqueItems([element, candidate]))) {\n elements.push(candidate);\n stale = 0;\n } else if (elements.length >= minimum && ++stale === STALE_LIMIT) break;\n }\n if (elements.length < minimum)\n throw new Error(\n \"Unable to generate enough unique items; the element domain may be too small.\",\n );\n return elements;\n};\n"],"mappings":";;;AAKA,MAAM,oBAAoB;AAC1B,MAAM,gBAAgB;AACtB,MAAM,0BAA0B;;;;;;;;;AAUhC,MAAM,cAAc;AAEpB,MAAa,gBACX,UAIG;CACH,MAAM,iBACJ,MAAM,cAAc,OAAO,IAAI;CACjC,MAAM,UACJ,MAAM,YACN,KAAK,IAAI,MAAM,YAAY,gBAAgB,cAAc;CAC3D,MAAM,QAAgB,eAAe;EACnC,MAAM;EACN;EACA,SACE,MAAM,YACN,WACG,MAAM,cAAc,OAAO,0BAA0B;CAC5D,CAAC;CACD,IAAI,MAAM,gBAAgB,MACxB,OAAO,IAAI,MAAM,KAAK,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,GAAG,MAAM,MAAM,QAAQ,GAAG,KAAK,CAAC;CAoB1E,MAAM,WAAgB,CAAC;CACvB,MAAM,kBAA0B,QAAQ,MAAM;CAC9C,IAAI,QAAgB;CACpB,KACE,IAAI,WAAW,GACf,SAAS,WAAW,SAAS,aAAa,iBAC1C,YACA;EACA,MAAM,YAAe,MAAM,QAAQ,SAAS,QAAQ,KAAK;EACzD,IAAI,SAAS,OAAO,YAAY,eAAe,CAAC,SAAS,SAAS,CAAC,CAAC,GAAG;GACrE,SAAS,KAAK,SAAS;GACvB,QAAQ;EACV,OAAO,IAAI,SAAS,UAAU,WAAW,EAAE,UAAU,aAAa;CACpE;CACA,IAAI,SAAS,SAAS,SACpB,MAAM,IAAI,MACR,8EACF;CACF,OAAO;AACT"}
@@ -1,15 +1,21 @@
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
+ const _randomInteger_1 = require("./_randomInteger");
5
5
  const _randomStringLength_1 = require("./_randomStringLength");
6
+ const __randomComposition_1 = require("./private/__randomComposition");
6
7
  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
8
  // 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.
9
+ // a multiple of four; an unconstrained draw spends between four and twelve
10
+ // groups, and a constrained one raises the window to the first multiple it
11
+ // contains and steps by four from there.
12
+ if ((props === null || props === void 0 ? void 0 : props.minLength) === undefined && (props === null || props === void 0 ? void 0 : props.maxLength) === undefined)
13
+ return (0, __randomComposition_1.__randomBase64)(4 *
14
+ (0, _randomInteger_1._randomInteger)({
15
+ type: "integer",
16
+ minimum: DEFAULT_GROUP_MIN,
17
+ maximum: DEFAULT_GROUP_MAX,
18
+ }));
13
19
  const window = (0, _randomStringLength_1._randomLengthWindow)(props, { minimum: 0, spread: 16 });
14
20
  const low = Math.ceil(window.low / 4) * 4;
15
21
  if (low > window.high)
@@ -20,12 +26,9 @@ const _randomFormatByte = (props) => {
20
26
  low: 0,
21
27
  high: Math.floor((window.high - low) / 4),
22
28
  });
23
- return (0, _randomString_1._randomString)({
24
- type: "string",
25
- minLength: length,
26
- maxLength: length,
27
- });
29
+ return (0, __randomComposition_1.__randomBase64)(length);
28
30
  };
29
31
  exports._randomFormatByte = _randomFormatByte;
30
- const FIXED = "vt7ekz4lIoNTTS9sDQYdWKharxIFAR54+z/umIxSgUM=";
32
+ const DEFAULT_GROUP_MIN = 4;
33
+ const DEFAULT_GROUP_MAX = 12;
31
34
  //# sourceMappingURL=_randomFormatByte.js.map
@@ -1 +1 @@
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,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O,EAAE,iBAAiB;aAC3B,CAAC,CACL,CAAC;IACJ,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,oCAAc,EAAC,MAAM,CAAC,CAAC;AAChC,CAAC,CAAC;AAzBW,QAAA,iBAAiB,GAAjB,iBAAiB,CAyB5B;AAEF,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAC5B,MAAM,iBAAiB,GAAG,EAAE,CAAC"}
@@ -1,25 +1,26 @@
1
- import { _randomString } from "./_randomString.mjs";
1
+ import { _randomInteger } from "./_randomInteger.mjs";
2
2
  import { _RANDOM_LENGTH_ERROR, _randomLengthPick, _randomLengthWindow } from "./_randomStringLength.mjs";
3
+ import { __randomBase64 } from "./private/__randomComposition.mjs";
3
4
  //#region src/internal/_randomFormatByte.ts
4
5
  const _randomFormatByte = (props) => {
5
- if (props?.minLength === void 0 && props?.maxLength === void 0) return FIXED;
6
+ if (props?.minLength === void 0 && props?.maxLength === void 0) return __randomBase64(4 * _randomInteger({
7
+ type: "integer",
8
+ minimum: DEFAULT_GROUP_MIN,
9
+ maximum: DEFAULT_GROUP_MAX
10
+ }));
6
11
  const window = _randomLengthWindow(props, {
7
12
  minimum: 0,
8
13
  spread: 16
9
14
  });
10
15
  const low = Math.ceil(window.low / 4) * 4;
11
16
  if (low > window.high) throw new Error(_RANDOM_LENGTH_ERROR);
12
- const length = low + 4 * _randomLengthPick({
17
+ return __randomBase64(low + 4 * _randomLengthPick({
13
18
  low: 0,
14
19
  high: Math.floor((window.high - low) / 4)
15
- });
16
- return _randomString({
17
- type: "string",
18
- minLength: length,
19
- maxLength: length
20
- });
20
+ }));
21
21
  };
22
- const FIXED = "vt7ekz4lIoNTTS9sDQYdWKharxIFAR54+z/umIxSgUM=";
22
+ const DEFAULT_GROUP_MIN = 4;
23
+ const DEFAULT_GROUP_MAX = 12;
23
24
  //#endregion
24
25
  export { _randomFormatByte };
25
26
 
@@ -1 +1 @@
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
+ {"version":3,"file":"_randomFormatByte.mjs","names":[],"sources":["../../src/internal/_randomFormatByte.ts"],"sourcesContent":["import { _randomInteger } from \"./_randomInteger\";\nimport {\n _ILengthProps,\n _RANDOM_LENGTH_ERROR,\n _randomLengthPick,\n _randomLengthWindow,\n} from \"./_randomStringLength\";\nimport { __randomBase64 } from \"./private/__randomComposition\";\n\nexport const _randomFormatByte = (props?: _ILengthProps): string => {\n // Base64 encodes three bytes as four characters, so a valid length is always\n // a multiple of four; an unconstrained draw spends between four and twelve\n // groups, and a constrained one raises the window to the first multiple it\n // contains and steps by four from there.\n if (props?.minLength === undefined && props?.maxLength === undefined)\n return __randomBase64(\n 4 *\n _randomInteger({\n type: \"integer\",\n minimum: DEFAULT_GROUP_MIN,\n maximum: DEFAULT_GROUP_MAX,\n }),\n );\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 __randomBase64(length);\n};\n\nconst DEFAULT_GROUP_MIN = 4;\nconst DEFAULT_GROUP_MAX = 12;\n"],"mappings":";;;;AASA,MAAa,qBAAqB,UAAkC;CAKlE,IAAI,OAAO,cAAc,KAAA,KAAa,OAAO,cAAc,KAAA,GACzD,OAAO,eACL,IACE,eAAe;EACb,MAAM;EACN,SAAS;EACT,SAAS;CACX,CAAC,CACL;CACF,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;CAQ3D,OAAO,eANL,MACA,IACE,kBAAkB;EAChB,KAAK;EACL,MAAM,KAAK,OAAO,OAAO,OAAO,OAAO,CAAC;CAC1C,CAAC,CACuB;AAC9B;AAEA,MAAM,oBAAoB;AAC1B,MAAM,oBAAoB"}
@@ -1,6 +1,6 @@
1
1
  import { _RANDOM_LENGTH_ERROR, _randomLengthPick, _randomLengthWindow } from "./_randomStringLength.mjs";
2
- import { __randomEpoch } from "./private/__randomEpoch.mjs";
3
2
  import { __randomDigits } from "./private/__randomComposition.mjs";
3
+ import { __randomEpoch } from "./private/__randomEpoch.mjs";
4
4
  //#region src/internal/_randomFormatDatetime.ts
5
5
  const _randomFormatDatetime = (props) => {
6
6
  const instant = () => new Date(__randomEpoch(props)).toISOString();
@@ -2,7 +2,7 @@ import { _ILengthProps } from "./_randomStringLength";
2
2
  export declare const _randomFormatHostname: (props?: _ILengthProps) => string;
3
3
  /**
4
4
  * Builds dot-joined hostname labels totaling exactly `length` characters, each
5
- * label within 63 chars. Shared with the idn-hostname generator, which reserves
6
- * a fixed `.<tld>` suffix and realizes the rest as these leading labels.
5
+ * label within 63 chars. Shared with the idn-hostname generator, which realizes
6
+ * its length the same way since #2317 gave the two formats one structure.
7
7
  */
8
8
  export declare const _randomHostnameLabels: (length: number) => string;
@@ -26,8 +26,8 @@ const pickLength = (props) => {
26
26
  };
27
27
  /**
28
28
  * Builds dot-joined hostname labels totaling exactly `length` characters, each
29
- * label within 63 chars. Shared with the idn-hostname generator, which reserves
30
- * a fixed `.<tld>` suffix and realizes the rest as these leading labels.
29
+ * label within 63 chars. Shared with the idn-hostname generator, which realizes
30
+ * its length the same way since #2317 gave the two formats one structure.
31
31
  */
32
32
  const _randomHostnameLabels = (length) => {
33
33
  const parts = [];