typia 14.0.6 → 15.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/README.md +3 -0
  2. package/lib/http.d.ts +49 -24
  3. package/lib/http.js.map +1 -1
  4. package/lib/http.mjs.map +1 -1
  5. package/lib/internal/_createLlmEvaluation.d.ts +1 -0
  6. package/lib/internal/_createLlmEvaluation.js +486 -0
  7. package/lib/internal/_createLlmEvaluation.js.map +1 -0
  8. package/lib/internal/_createLlmEvaluation.mjs +382 -0
  9. package/lib/internal/_createLlmEvaluation.mjs.map +1 -0
  10. package/lib/internal/_httpFormDataReadBigint.js +7 -5
  11. package/lib/internal/_httpFormDataReadBigint.js.map +1 -1
  12. package/lib/internal/_httpFormDataReadBigint.mjs +1 -1
  13. package/lib/internal/_httpFormDataReadBigint.mjs.map +1 -1
  14. package/lib/internal/_httpFormDataReadBoolean.js +12 -10
  15. package/lib/internal/_httpFormDataReadBoolean.js.map +1 -1
  16. package/lib/internal/_httpFormDataReadBoolean.mjs +1 -1
  17. package/lib/internal/_httpFormDataReadBoolean.mjs.map +1 -1
  18. package/lib/internal/_httpFormDataReadNumber.js +7 -5
  19. package/lib/internal/_httpFormDataReadNumber.js.map +1 -1
  20. package/lib/internal/_httpFormDataReadNumber.mjs +1 -1
  21. package/lib/internal/_httpFormDataReadNumber.mjs.map +1 -1
  22. package/lib/internal/_httpFormDataReadString.d.ts +9 -1
  23. package/lib/internal/_httpFormDataReadString.js +10 -2
  24. package/lib/internal/_httpFormDataReadString.js.map +1 -1
  25. package/lib/internal/_httpFormDataReadString.mjs +9 -1
  26. package/lib/internal/_httpFormDataReadString.mjs.map +1 -1
  27. package/lib/internal/_httpHeaderReadBigint.js +5 -1
  28. package/lib/internal/_httpHeaderReadBigint.js.map +1 -1
  29. package/lib/internal/_httpHeaderReadBigint.mjs +2 -1
  30. package/lib/internal/_httpHeaderReadBigint.mjs.map +1 -1
  31. package/lib/internal/_httpHeaderReadNumber.js +5 -1
  32. package/lib/internal/_httpHeaderReadNumber.js.map +1 -1
  33. package/lib/internal/_httpHeaderReadNumber.mjs +2 -1
  34. package/lib/internal/_httpHeaderReadNumber.mjs.map +1 -1
  35. package/lib/internal/_httpParameterReadBigint.js +4 -0
  36. package/lib/internal/_httpParameterReadBigint.js.map +1 -1
  37. package/lib/internal/_httpParameterReadBigint.mjs +1 -0
  38. package/lib/internal/_httpParameterReadBigint.mjs.map +1 -1
  39. package/lib/internal/_httpParameterReadNumber.js +4 -0
  40. package/lib/internal/_httpParameterReadNumber.js.map +1 -1
  41. package/lib/internal/_httpParameterReadNumber.mjs +1 -0
  42. package/lib/internal/_httpParameterReadNumber.mjs.map +1 -1
  43. package/lib/internal/_httpParameterReadString.d.ts +9 -1
  44. package/lib/internal/_httpParameterReadString.js +9 -1
  45. package/lib/internal/_httpParameterReadString.js.map +1 -1
  46. package/lib/internal/_httpParameterReadString.mjs +9 -1
  47. package/lib/internal/_httpParameterReadString.mjs.map +1 -1
  48. package/lib/internal/_httpQueryReadBigint.js +8 -1
  49. package/lib/internal/_httpQueryReadBigint.js.map +1 -1
  50. package/lib/internal/_httpQueryReadBigint.mjs +1 -1
  51. package/lib/internal/_httpQueryReadBigint.mjs.map +1 -1
  52. package/lib/internal/_httpQueryReadBoolean.js +4 -1
  53. package/lib/internal/_httpQueryReadBoolean.js.map +1 -1
  54. package/lib/internal/_httpQueryReadBoolean.mjs +1 -1
  55. package/lib/internal/_httpQueryReadBoolean.mjs.map +1 -1
  56. package/lib/internal/_httpQueryReadNumber.js +8 -1
  57. package/lib/internal/_httpQueryReadNumber.js.map +1 -1
  58. package/lib/internal/_httpQueryReadNumber.mjs +1 -1
  59. package/lib/internal/_httpQueryReadNumber.mjs.map +1 -1
  60. package/lib/internal/_httpQueryReadString.d.ts +9 -1
  61. package/lib/internal/_httpQueryReadString.js +9 -1
  62. package/lib/internal/_httpQueryReadString.js.map +1 -1
  63. package/lib/internal/_httpQueryReadString.mjs +9 -1
  64. package/lib/internal/_httpQueryReadString.mjs.map +1 -1
  65. package/lib/internal/_randomBigint.d.ts +12 -1
  66. package/lib/internal/_randomBigint.js +90 -2
  67. package/lib/internal/_randomBigint.js.map +1 -1
  68. package/lib/internal/_randomBigint.mjs +70 -2
  69. package/lib/internal/_randomBigint.mjs.map +1 -1
  70. package/lib/internal/_randomInteger.js +21 -12
  71. package/lib/internal/_randomInteger.js.map +1 -1
  72. package/lib/internal/_randomInteger.mjs +21 -16
  73. package/lib/internal/_randomInteger.mjs.map +1 -1
  74. package/lib/internal/_randomNumber.js +19 -10
  75. package/lib/internal/_randomNumber.js.map +1 -1
  76. package/lib/internal/_randomNumber.mjs +19 -14
  77. package/lib/internal/_randomNumber.mjs.map +1 -1
  78. package/lib/internal/_stringLengthGte.d.ts +1 -0
  79. package/lib/internal/_stringLengthGte.js +14 -0
  80. package/lib/internal/_stringLengthGte.js.map +1 -0
  81. package/lib/internal/_stringLengthGte.mjs +11 -0
  82. package/lib/internal/_stringLengthGte.mjs.map +1 -0
  83. package/lib/internal/_stringLengthLte.d.ts +1 -0
  84. package/lib/internal/_stringLengthLte.js +14 -0
  85. package/lib/internal/_stringLengthLte.js.map +1 -0
  86. package/lib/internal/_stringLengthLte.mjs +11 -0
  87. package/lib/internal/_stringLengthLte.mjs.map +1 -0
  88. package/lib/llm.d.ts +54 -1
  89. package/lib/llm.js +5 -0
  90. package/lib/llm.js.map +1 -1
  91. package/lib/llm.mjs +6 -1
  92. package/lib/llm.mjs.map +1 -1
  93. package/lib/re-exports.d.ts +1 -1
  94. package/lib/re-exports.js.map +1 -1
  95. package/native/cmd/ttsc-typia/build.go +2 -0
  96. package/native/cmd/ttsc-typia/dynamic_key_tags_transform_test.go +1 -1
  97. package/native/cmd/ttsc-typia/llm_evaluation_accepts_property_probability_test.go +27 -0
  98. package/native/cmd/ttsc-typia/llm_evaluation_accepts_unselected_source_probability_test.go +26 -0
  99. package/native/cmd/ttsc-typia/llm_evaluation_complete_object_shape_test.go +96 -0
  100. package/native/cmd/ttsc-typia/llm_evaluation_ignores_declaration_probability_without_call_test.go +18 -0
  101. package/native/cmd/ttsc-typia/llm_evaluation_plan_emission_transform_test.go +90 -0
  102. package/native/cmd/ttsc-typia/llm_evaluation_program_scan_dependencies_test.go +69 -0
  103. package/native/cmd/ttsc-typia/llm_evaluation_rejects_alias_comment_test.go +44 -0
  104. package/native/cmd/ttsc-typia/llm_evaluation_rejects_alias_refinement_test.go +45 -0
  105. package/native/cmd/ttsc-typia/llm_evaluation_rejects_computed_method_probability_test.go +30 -0
  106. package/native/cmd/ttsc-typia/llm_evaluation_rejects_imported_declaration_probability_test.go +48 -0
  107. package/native/cmd/ttsc-typia/llm_evaluation_rejects_invalid_probability_test.go +208 -0
  108. package/native/cmd/ttsc-typia/llm_evaluation_rejects_refinements_test.go +94 -0
  109. package/native/cmd/ttsc-typia/llm_evaluation_rejects_undecidable_types_test.go +232 -0
  110. package/native/cmd/ttsc-typia/metadata_type_tag_sole_malformed_diagnostic_test.go +94 -0
  111. package/native/cmd/ttsc-typia/random_recursive_min_items_diagnostic_test.go +18 -1
  112. package/native/cmd/ttsc-typia/template_literal_type_tags_transform_test.go +3 -2
  113. package/native/cmd/ttsc-typia/transform.go +2 -0
  114. package/native/cmd/ttsc-typia/transform_helpers_test.go +17 -3
  115. package/native/core/context/ITypiaContext.go +4 -0
  116. package/native/core/factories/ExpressionFactory.go +16 -1
  117. package/native/core/factories/IdentifierFactory.go +10 -0
  118. package/native/core/factories/LiteralFactory.go +16 -0
  119. package/native/core/factories/MetadataCommentTagFactory.go +185 -35
  120. package/native/core/factories/MetadataTypeTagFactory.go +97 -24
  121. package/native/core/factories/MetadataTypeTagSchemaFactory.go +5 -0
  122. package/native/core/factories/expression_factory_number_spells_non_finite_values_test.go +69 -0
  123. package/native/core/factories/internal/metadata/IMetadataIteratorProps.go +6 -2
  124. package/native/core/factories/internal/metadata/emplace_metadata_object.go +49 -15
  125. package/native/core/factories/literal_factory_null_survives_objects_test.go +43 -0
  126. package/native/core/factories/metadata_comment_tag_factory_holds_bigint_tags_exact_test.go +168 -0
  127. package/native/core/factories/metadata_comment_tag_factory_reads_javascript_numbers_test.go +158 -0
  128. package/native/core/factories/metadata_comment_tag_factory_string_length_helpers_test.go +55 -0
  129. package/native/core/factories/metadata_type_tag_factory_reports_all_invalid_candidates_test.go +73 -0
  130. package/native/core/programmers/functional/FunctionalAssertParametersProgrammer.go +1 -3
  131. package/native/core/programmers/functional/FunctionalIsParametersProgrammer.go +107 -9
  132. package/native/core/programmers/functional/FunctionalValidateParametersProgrammer.go +1 -3
  133. package/native/core/programmers/http/HttpFormDataProgrammer.go +41 -2
  134. package/native/core/programmers/http/HttpHeadersProgrammer.go +56 -4
  135. package/native/core/programmers/http/HttpParameterProgrammer.go +1 -3
  136. package/native/core/programmers/http/HttpQueryProgrammer.go +26 -43
  137. package/native/core/programmers/iterate/json_schema_jsDocTags.go +10 -3
  138. package/native/core/programmers/iterate/json_schema_jsdoc_tags_cast_reads_javascript_numbers_test.go +64 -0
  139. package/native/core/programmers/llm/LlmApplicationProgrammer.go +1 -0
  140. package/native/core/programmers/llm/LlmEvaluationProgrammer.go +559 -0
  141. package/native/core/programmers/llm/LlmParametersProgrammer.go +6 -5
  142. package/native/core/programmers/llm/LlmReferenceDescription.go +113 -0
  143. package/native/core/programmers/llm/LlmSchemaProgrammer.go +34 -4
  144. package/native/core/programmers/llm/llm_reference_description_test.go +134 -0
  145. package/native/core/schemas/metadata/MetadataDependency.go +9 -0
  146. package/native/core/utils/NumberUtil.go +195 -0
  147. package/native/core/utils/number_util_rational_keeps_written_value_test.go +62 -0
  148. package/native/core/utils/number_util_reads_javascript_number_grammar_test.go +147 -0
  149. package/native/transform/CallExpressionTransformer.go +1 -0
  150. package/native/transform/FileTransformer.go +5 -0
  151. package/native/transform/features/llm/LlmEvaluationProbabilityDeclarations.go +94 -0
  152. package/native/transform/features/llm/LlmEvaluationProbabilityDeclarations_test.go +50 -0
  153. package/native/transform/features/llm/LlmEvaluationTransformer.go +59 -0
  154. package/native/transform/features/llm/LlmSchemaTransformer.go +14 -11
  155. package/native/transform/features/llm/llm_transformer_entry_coverage_test.go +29 -27
  156. package/package.json +3 -3
  157. package/src/http.ts +61 -34
  158. package/src/internal/_createLlmEvaluation.ts +678 -0
  159. package/src/internal/_httpFormDataReadBigint.ts +3 -1
  160. package/src/internal/_httpFormDataReadBoolean.ts +3 -1
  161. package/src/internal/_httpFormDataReadNumber.ts +3 -1
  162. package/src/internal/_httpFormDataReadString.ts +10 -1
  163. package/src/internal/_httpHeaderReadBigint.ts +6 -1
  164. package/src/internal/_httpHeaderReadNumber.ts +6 -1
  165. package/src/internal/_httpParameterReadBigint.ts +3 -0
  166. package/src/internal/_httpParameterReadNumber.ts +3 -0
  167. package/src/internal/_httpParameterReadString.ts +12 -2
  168. package/src/internal/_httpQueryReadBigint.ts +7 -1
  169. package/src/internal/_httpQueryReadBoolean.ts +3 -1
  170. package/src/internal/_httpQueryReadNumber.ts +7 -1
  171. package/src/internal/_httpQueryReadString.ts +10 -1
  172. package/src/internal/_randomBigint.ts +111 -3
  173. package/src/internal/_randomInteger.ts +31 -16
  174. package/src/internal/_randomNumber.ts +23 -12
  175. package/src/internal/_stringLengthGte.ts +6 -0
  176. package/src/internal/_stringLengthLte.ts +6 -0
  177. package/src/llm.ts +64 -0
  178. package/src/re-exports.ts +1 -0
package/README.md CHANGED
@@ -28,6 +28,8 @@ export namespace llm {
28
28
  // collection of function calling schemas + validators/parsers
29
29
  export function application<Class>(): ILlmApplication<Class>;
30
30
  export function structuredOutput<P>(): ILlmStructuredOutput;
31
+ // typed questions for evaluation models + checked answer decoder
32
+ export function evaluation<T>(): ILlmEvaluation<T>;
31
33
  // lenient json parser + type coercion
32
34
  export function parse<T>(str: string): T;
33
35
  }
@@ -146,6 +148,7 @@ Check out the document in the [website](https://typia.io/docs/):
146
148
  - LLM Function Calling Harness
147
149
  - [`application()` function](https://typia.io/docs/llm/application/)
148
150
  - [`structuredOutput()` function](https://typia.io/docs/llm/structuredOutput/)
151
+ - [`evaluation()` function](https://typia.io/docs/llm/evaluation/)
149
152
  - [`HttpLlm` module](https://typia.io/docs/llm/http/)
150
153
  - [`LlmJson` module](https://typia.io/docs/llm/json/)
151
154
  - Protocol Buffer
package/lib/http.d.ts CHANGED
@@ -4,7 +4,10 @@ import { TypeGuardError } from "./TypeGuardError";
4
4
  * Decodes `FormData` into type `T`.
5
5
  *
6
6
  * Parses a `FormData` instance with automatic type casting. Properties typed as
7
- * `boolean` or `Blob` are cast to expected types during decoding.
7
+ * `boolean`, `bigint`, or `number` are cast from their text, and `Blob` and
8
+ * `File` properties are read as given, except that the text `null` reads as
9
+ * `null`: as `undefined` instead for an optional single property whose type
10
+ * does not admit `null`, and always as `null` for an array element.
8
11
  *
9
12
  * Type `T` constraints:
10
13
  *
@@ -14,6 +17,11 @@ import { TypeGuardError } from "./TypeGuardError";
14
17
  * types allowed
15
18
  * 4. No union types allowed
16
19
  *
20
+ * An absent key decodes a required array to `[]`, a nullable one to `null`, and
21
+ * an optional one to `undefined`. A string property keeps the text `null`
22
+ * unless its type admits `null`, and a blank numeric value decodes to
23
+ * `undefined`.
24
+ *
17
25
  * Does not validate the decoded value. For validation, use:
18
26
  *
19
27
  * - {@link assertFormData} — Throws on type mismatch
@@ -112,8 +120,8 @@ export declare function validateFormData<T extends object>(input: FormData): IVa
112
120
  * Decodes URL query string into type `T`.
113
121
  *
114
122
  * Parses a query string or `URLSearchParams` instance with automatic type
115
- * casting. Properties typed as `boolean` or `number` are cast to expected types
116
- * during decoding.
123
+ * casting. Properties typed as `boolean`, `bigint`, or `number` are cast to
124
+ * expected types during decoding.
117
125
  *
118
126
  * Type `T` constraints:
119
127
  *
@@ -122,6 +130,12 @@ export declare function validateFormData<T extends object>(input: FormData): IVa
122
130
  * 3. Only `boolean`, `bigint`, `number`, `string` or their array types allowed
123
131
  * 4. No union types allowed
124
132
  *
133
+ * An absent key decodes a required array to `[]`, a nullable one to `null`, and
134
+ * an optional one to `undefined`, since a query string has no other spelling
135
+ * for an empty array. An absent required non-array property throws
136
+ * `Error("missing <key>")`. A string property keeps the text `null` unless its
137
+ * type admits `null`, and a blank numeric value decodes to `undefined`.
138
+ *
125
139
  * Does not validate the decoded value. For validation, use:
126
140
  *
127
141
  * - {@link assertQuery} — Throws on type mismatch
@@ -220,14 +234,15 @@ export declare function validateQuery<T extends object>(input: string | IReadabl
220
234
  * Decodes HTTP headers into type `T`.
221
235
  *
222
236
  * Parses HTTP headers object with automatic type casting. Properties typed as
223
- * `boolean` or `number` are cast to expected types during decoding. Compatible
224
- * with Express and Fastify request headers.
237
+ * `boolean`, `bigint`, or `number` are cast to expected types during decoding.
238
+ * Compatible with Express and Fastify request headers.
225
239
  *
226
240
  * Type `T` constraints:
227
241
  *
228
242
  * 1. Must be an object type
229
243
  * 2. No dynamic properties allowed
230
- * 3. Property keys must be lowercase
244
+ * 3. Property keys are read by their lowercase name; two keys that differ only by
245
+ * case are not allowed
231
246
  * 4. Property values cannot be `null` (but `undefined` is allowed)
232
247
  * 5. Only `boolean`, `bigint`, `number`, `string` or their array types allowed
233
248
  * 6. No union types allowed
@@ -238,6 +253,10 @@ export declare function validateQuery<T extends object>(input: string | IReadabl
238
253
  * `max-forwards`, `proxy-authorization`, `referer`, `retry-after`, `server`,
239
254
  * `user-agent`
240
255
  *
256
+ * An absent optional array header, or one given as an empty array, is omitted,
257
+ * and an absent required one decodes to `[]`. `set-cookie` values are never
258
+ * split. A blank numeric header decodes to `undefined`.
259
+ *
241
260
  * Does not validate the decoded value. For validation, use:
242
261
  *
243
262
  * - {@link assertHeaders} — Throws on type mismatch
@@ -261,7 +280,8 @@ export declare function headers<T extends object>(input: Record<string, string |
261
280
  *
262
281
  * 1. Must be an object type
263
282
  * 2. No dynamic properties allowed
264
- * 3. Property keys must be lowercase
283
+ * 3. Property keys are read by their lowercase name; two keys that differ only by
284
+ * case are not allowed
265
285
  * 4. Property values cannot be `null` (but `undefined` is allowed)
266
286
  * 5. Only `boolean`, `bigint`, `number`, `string` or their array types allowed
267
287
  * 6. No union types allowed
@@ -298,7 +318,8 @@ export declare function assertHeaders<T extends object>(input: Record<string, st
298
318
  *
299
319
  * 1. Must be an object type
300
320
  * 2. No dynamic properties allowed
301
- * 3. Property keys must be lowercase
321
+ * 3. Property keys are read by their lowercase name; two keys that differ only by
322
+ * case are not allowed
302
323
  * 4. Property values cannot be `null` (but `undefined` is allowed)
303
324
  * 5. Only `boolean`, `bigint`, `number`, `string` or their array types allowed
304
325
  * 6. No union types allowed
@@ -333,7 +354,8 @@ export declare function isHeaders<T extends object>(input: Record<string, string
333
354
  *
334
355
  * 1. Must be an object type
335
356
  * 2. No dynamic properties allowed
336
- * 3. Property keys must be lowercase
357
+ * 3. Property keys are read by their lowercase name; two keys that differ only by
358
+ * case are not allowed
337
359
  * 4. Property values cannot be `null` (but `undefined` is allowed)
338
360
  * 5. Only `boolean`, `bigint`, `number`, `string` or their array types allowed
339
361
  * 6. No union types allowed
@@ -360,12 +382,15 @@ export declare function validateHeaders<T extends object>(input: Record<string,
360
382
  * Decodes URL path parameter into type `T`.
361
383
  *
362
384
  * Parses a path parameter string with automatic type casting. When type `T` is
363
- * `boolean` or `number`, casts the string value to the expected type. Also
364
- * performs type assertion via {@link assert}, throwing {@link TypeGuardError} on
365
- * mismatch.
385
+ * `boolean`, `bigint`, or `number`, casts the string value to the expected
386
+ * type. Also performs type assertion via {@link assert}, throwing
387
+ * {@link TypeGuardError} on mismatch.
388
+ *
389
+ * A blank value is not a number, and a string parameter keeps the text `null`
390
+ * unless `T` admits `null`.
366
391
  *
367
- * @template T Target atomic type (`boolean`, `bigint`, `number`, `string`, or
368
- * `null`)
392
+ * @template T Target atomic type (`boolean`, `bigint`, `number`, or `string`),
393
+ * optionally with `null`
369
394
  * @param input Path parameter string
370
395
  * @returns Decoded value of type `T`
371
396
  * @throws {TypeGuardError} When decoded value doesn't conform to type `T`
@@ -385,7 +410,7 @@ export declare function createFormData(): never;
385
410
  * @template T Target object type
386
411
  * @returns Reusable decoder function
387
412
  */
388
- export declare function createFormData<T extends object>(): (input: FormData) => T;
413
+ export declare function createFormData<T extends object>(): (input: FormData) => Resolved<T>;
389
414
  /**
390
415
  * Creates reusable {@link assertFormData} function.
391
416
  *
@@ -403,7 +428,7 @@ export declare function createAssertFormData(errorFactory?: undefined | ((props:
403
428
  * {@link TypeGuardError.IProps}
404
429
  * @returns Reusable decoder function
405
430
  */
406
- export declare function createAssertFormData<T extends object>(errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error)): (input: FormData, errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error)) => T;
431
+ export declare function createAssertFormData<T extends object>(errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error)): (input: FormData, errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error)) => Resolved<T>;
407
432
  /**
408
433
  * Creates reusable {@link isFormData} function.
409
434
  *
@@ -417,7 +442,7 @@ export declare function createIsFormData(): never;
417
442
  * @template T Target object type
418
443
  * @returns Reusable decoder function
419
444
  */
420
- export declare function createIsFormData<T extends object>(): (input: FormData) => T | null;
445
+ export declare function createIsFormData<T extends object>(): (input: FormData) => Resolved<T> | null;
421
446
  /**
422
447
  * Creates reusable {@link validateFormData} function.
423
448
  *
@@ -445,7 +470,7 @@ export declare function createQuery(): never;
445
470
  * @template T Target object type
446
471
  * @returns Reusable decoder function
447
472
  */
448
- export declare function createQuery<T extends object>(): (input: string | IReadableURLSearchParams) => T;
473
+ export declare function createQuery<T extends object>(): (input: string | IReadableURLSearchParams) => Resolved<T>;
449
474
  /**
450
475
  * Creates reusable {@link assertQuery} function.
451
476
  *
@@ -463,7 +488,7 @@ export declare function createAssertQuery(errorFactory?: undefined | ((props: Ty
463
488
  * {@link TypeGuardError.IProps}
464
489
  * @returns Reusable decoder function
465
490
  */
466
- export declare function createAssertQuery<T extends object>(errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error)): (input: string | IReadableURLSearchParams, errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error)) => T;
491
+ export declare function createAssertQuery<T extends object>(errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error)): (input: string | IReadableURLSearchParams, errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error)) => Resolved<T>;
467
492
  /**
468
493
  * Creates reusable {@link isQuery} function.
469
494
  *
@@ -477,7 +502,7 @@ export declare function createIsQuery(): never;
477
502
  * @template T Target object type
478
503
  * @returns Reusable decoder function
479
504
  */
480
- export declare function createIsQuery<T extends object>(): (input: string | IReadableURLSearchParams) => T | null;
505
+ export declare function createIsQuery<T extends object>(): (input: string | IReadableURLSearchParams) => Resolved<T> | null;
481
506
  /**
482
507
  * Creates reusable {@link validateQuery} function.
483
508
  *
@@ -505,7 +530,7 @@ export declare function createHeaders(): never;
505
530
  * @template T Target object type
506
531
  * @returns Reusable decoder function
507
532
  */
508
- export declare function createHeaders<T extends object>(): (input: Record<string, string | string[] | undefined>) => T;
533
+ export declare function createHeaders<T extends object>(): (input: Record<string, string | string[] | undefined>) => Resolved<T>;
509
534
  /**
510
535
  * Creates reusable {@link assertHeaders} function.
511
536
  *
@@ -523,7 +548,7 @@ export declare function createAssertHeaders(errorFactory?: undefined | ((props:
523
548
  * {@link TypeGuardError.IProps}
524
549
  * @returns Reusable decoder function
525
550
  */
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;
551
+ 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)) => Resolved<T>;
527
552
  /**
528
553
  * Creates reusable {@link isHeaders} function.
529
554
  *
@@ -537,7 +562,7 @@ export declare function createIsHeaders(): never;
537
562
  * @template T Target object type
538
563
  * @returns Reusable decoder function
539
564
  */
540
- export declare function createIsHeaders<T extends object>(): (input: Record<string, string | string[] | undefined>) => T | null;
565
+ export declare function createIsHeaders<T extends object>(): (input: Record<string, string | string[] | undefined>) => Resolved<T> | null;
541
566
  /**
542
567
  * Creates reusable {@link validateHeaders} function.
543
568
  *
@@ -565,4 +590,4 @@ export declare function createParameter(): never;
565
590
  * @template T Target atomic type
566
591
  * @returns Reusable decoder function
567
592
  */
568
- export declare function createParameter<T extends Atomic.Type | null>(): (input: string) => T;
593
+ export declare function createParameter<T extends Atomic.Type | null>(): (input: string) => Resolved<T>;
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;AA+BD,gBAAgB;AAChB;IACE,IAAA,6DAA6B,EAAC,cAAc,CAAC,CAAC;AAChD,CAAC;AAgCD,gBAAgB;AAChB;IACE,IAAA,6DAA6B,EAAC,oBAAoB,CAAC,CAAC;AACtD,CAAC;AA0CD,gBAAgB;AAChB;IACE,IAAA,6DAA6B,EAAC,cAAc,CAAC,CAAC;AAChD,CAAC;AA2CD,gBAAgB;AAChB;IACE,IAAA,6DAA6B,EAAC,oBAAoB,CAAC,CAAC;AACtD,CAAC;AAuCD,gBAAgB;AAChB;IACE,IAAA,6DAA6B,EAAC,gBAAgB,CAAC,CAAC;AAClD,CAAC;AAwCD,gBAAgB;AAChB;IACE,IAAA,6DAA6B,EAAC,sBAAsB,CAAC,CAAC;AACxD,CAAC;AAwBD,gBAAgB;AAChB;IACE,IAAA,6DAA6B,EAAC,gBAAgB,CAAC,CAAC;AAClD,CAAC;AAqBD,gBAAgB;AAChB;IACE,IAAA,6DAA6B,EAAC,qBAAqB,CAAC,CAAC;AACvD,CAAC;AA6BD,gBAAgB;AAChB;IAIE,IAAA,6DAA6B,EAAC,2BAA2B,CAAC,CAAC;AAC7D,CAAC;AAoBD,gBAAgB;AAChB;IACE,IAAA,6DAA6B,EAAC,uBAAuB,CAAC,CAAC;AACzD,CAAC;AAoBD,gBAAgB;AAChB;IAGE,IAAA,6DAA6B,EAAC,6BAA6B,CAAC,CAAC;AAC/D,CAAC;AAoBD,gBAAgB;AAChB;IAGE,IAAA,6DAA6B,EAAC,kBAAkB,CAAC,CAAC;AACpD,CAAC;AA6BD,gBAAgB;AAChB;IAIE,IAAA,6DAA6B,EAAC,wBAAwB,CAAC,CAAC;AAC1D,CAAC;AAoBD,gBAAgB;AAChB;IAGE,IAAA,6DAA6B,EAAC,oBAAoB,CAAC,CAAC;AACtD,CAAC;AAoBD,gBAAgB;AAChB;IAGE,IAAA,6DAA6B,EAAC,0BAA0B,CAAC,CAAC;AAC5D,CAAC;AAoBD,gBAAgB;AAChB;IAGE,IAAA,6DAA6B,EAAC,oBAAoB,CAAC,CAAC;AACtD,CAAC;AA6BD,gBAAgB;AAChB;IAIE,IAAA,6DAA6B,EAAC,0BAA0B,CAAC,CAAC;AAC5D,CAAC;AAoBD,gBAAgB;AAChB;IAGE,IAAA,6DAA6B,EAAC,sBAAsB,CAAC,CAAC;AACxD,CAAC;AAoBD,gBAAgB;AAChB;IAGE,IAAA,6DAA6B,EAAC,4BAA4B,CAAC,CAAC;AAC9D,CAAC;AAoBD,gBAAgB;AAChB;IAGE,IAAA,6DAA6B,EAAC,sBAAsB,CAAC,CAAC;AACxD,CAAC"}
1
+ {"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,gGAA6F;AA+C7F,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;AAwCD,gBAAgB;AAChB;IACE,IAAA,6DAA6B,EAAC,YAAY,CAAC,CAAC;AAC9C,CAAC;AAmCD,gBAAgB;AAChB;IACE,IAAA,6DAA6B,EAAC,kBAAkB,CAAC,CAAC;AACpD,CAAC;AA+BD,gBAAgB;AAChB;IACE,IAAA,6DAA6B,EAAC,cAAc,CAAC,CAAC;AAChD,CAAC;AAgCD,gBAAgB;AAChB;IACE,IAAA,6DAA6B,EAAC,oBAAoB,CAAC,CAAC;AACtD,CAAC;AA+CD,gBAAgB;AAChB;IACE,IAAA,6DAA6B,EAAC,cAAc,CAAC,CAAC;AAChD,CAAC;AA4CD,gBAAgB;AAChB;IACE,IAAA,6DAA6B,EAAC,oBAAoB,CAAC,CAAC;AACtD,CAAC;AAwCD,gBAAgB;AAChB;IACE,IAAA,6DAA6B,EAAC,gBAAgB,CAAC,CAAC;AAClD,CAAC;AAyCD,gBAAgB;AAChB;IACE,IAAA,6DAA6B,EAAC,sBAAsB,CAAC,CAAC;AACxD,CAAC;AA2BD,gBAAgB;AAChB;IACE,IAAA,6DAA6B,EAAC,gBAAgB,CAAC,CAAC;AAClD,CAAC;AAuBD,gBAAgB;AAChB;IACE,IAAA,6DAA6B,EAAC,qBAAqB,CAAC,CAAC;AACvD,CAAC;AA6BD,gBAAgB;AAChB;IAIE,IAAA,6DAA6B,EAAC,2BAA2B,CAAC,CAAC;AAC7D,CAAC;AAoBD,gBAAgB;AAChB;IACE,IAAA,6DAA6B,EAAC,uBAAuB,CAAC,CAAC;AACzD,CAAC;AAoBD,gBAAgB;AAChB;IAGE,IAAA,6DAA6B,EAAC,6BAA6B,CAAC,CAAC;AAC/D,CAAC;AAoBD,gBAAgB;AAChB;IAGE,IAAA,6DAA6B,EAAC,kBAAkB,CAAC,CAAC;AACpD,CAAC;AA6BD,gBAAgB;AAChB;IAIE,IAAA,6DAA6B,EAAC,wBAAwB,CAAC,CAAC;AAC1D,CAAC;AAoBD,gBAAgB;AAChB;IAGE,IAAA,6DAA6B,EAAC,oBAAoB,CAAC,CAAC;AACtD,CAAC;AAoBD,gBAAgB;AAChB;IAGE,IAAA,6DAA6B,EAAC,0BAA0B,CAAC,CAAC;AAC5D,CAAC;AAoBD,gBAAgB;AAChB;IAGE,IAAA,6DAA6B,EAAC,oBAAoB,CAAC,CAAC;AACtD,CAAC;AA6BD,gBAAgB;AAChB;IAIE,IAAA,6DAA6B,EAAC,0BAA0B,CAAC,CAAC;AAC5D,CAAC;AAoBD,gBAAgB;AAChB;IAGE,IAAA,6DAA6B,EAAC,sBAAsB,CAAC,CAAC;AACxD,CAAC;AAoBD,gBAAgB;AAChB;IAGE,IAAA,6DAA6B,EAAC,4BAA4B,CAAC,CAAC;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): (\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"}
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`, `bigint`, or `number` are cast from their text, and `Blob` and\n * `File` properties are read as given, except that the text `null` reads as\n * `null`: as `undefined` instead for an optional single property whose type\n * does not admit `null`, and always as `null` for an array element.\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 * An absent key decodes a required array to `[]`, a nullable one to `null`, and\n * an optional one to `undefined`. A string property keeps the text `null`\n * unless its type admits `null`, and a blank numeric value decodes to\n * `undefined`.\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`, `bigint`, or `number` are cast to\n * 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` or their array types allowed\n * 4. No union types allowed\n *\n * An absent key decodes a required array to `[]`, a nullable one to `null`, and\n * an optional one to `undefined`, since a query string has no other spelling\n * for an empty array. An absent required non-array property throws\n * `Error(\"missing <key>\")`. A string property keeps the text `null` unless its\n * type admits `null`, and a blank numeric value decodes to `undefined`.\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`, `bigint`, or `number` are cast to expected types during decoding.\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 are read by their lowercase name; two keys that differ only by\n * case are not allowed\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 * An absent optional array header, or one given as an empty array, is omitted,\n * and an absent required one decodes to `[]`. `set-cookie` values are never\n * split. A blank numeric header decodes to `undefined`.\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 are read by their lowercase name; two keys that differ only by\n * case are not allowed\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 are read by their lowercase name; two keys that differ only by\n * case are not allowed\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 are read by their lowercase name; two keys that differ only by\n * case are not allowed\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`, `bigint`, or `number`, casts the string value to the expected\n * type. Also performs type assertion via {@link assert}, throwing\n * {@link TypeGuardError} on mismatch.\n *\n * A blank value is not a number, and a string parameter keeps the text `null`\n * unless `T` admits `null`.\n *\n * @template T Target atomic type (`boolean`, `bigint`, `number`, or `string`),\n * optionally with `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>(): (\n input: FormData,\n) => Resolved<T>;\n\n/** @internal */\nexport function createFormData<T>(): (input: FormData) => Resolved<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) => Resolved<T>;\n\n/** @internal */\nexport function createAssertFormData<T>(): (\n input: FormData,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n) => Resolved<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) => Resolved<T> | null;\n\n/** @internal */\nexport function createIsFormData<T>(): (input: FormData) => Resolved<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) => Resolved<T>;\n\n/** @internal */\nexport function createQuery<T>(): (\n input: string | IReadableURLSearchParams,\n) => Resolved<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) => Resolved<T>;\n\n/** @internal */\nexport function createAssertQuery<T>(): (\n input: string | IReadableURLSearchParams,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n) => Resolved<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) => Resolved<T> | null;\n\n/** @internal */\nexport function createIsQuery<T>(): (\n input: string | IReadableURLSearchParams,\n) => Resolved<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) => Resolved<T>;\n\n/** @internal */\nexport function createHeaders<T>(): (\n input: Record<string, string | string[] | undefined>,\n) => Resolved<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) => Resolved<T>;\n\n/** @internal */\nexport function createAssertHeaders<T>(): (\n input: Record<string, string | string[] | undefined>,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n) => Resolved<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) => Resolved<T> | null;\n\n/** @internal */\nexport function createIsHeaders<T>(): (\n input: Record<string, string | string[] | undefined>,\n) => Resolved<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) => Resolved<T>;\n\n/** @internal */\nexport function createParameter<T extends Atomic.Type | null>(): (\n input: string,\n) => Resolved<T> {\n NoTransformConfigurationError(\"http.createParameter\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwDA,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;;AAyCA,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;;AAgDA,SAAgB,UAAiB;CAC/B,8BAA8B,cAAc;AAC9C;;AA6CA,SAAgB,gBAAuB;CACrC,8BAA8B,oBAAoB;AACpD;;AAyCA,SAAgB,YAAmB;CACjC,8BAA8B,gBAAgB;AAChD;;AA0CA,SAAgB,kBAAyB;CACvC,8BAA8B,sBAAsB;AACtD;;AA4BA,SAAgB,YAAmB;CACjC,8BAA8B,gBAAgB;AAChD;;AAwBA,SAAgB,iBAAsD;CACpE,8BAA8B,qBAAqB;AACrD;;AA8BA,SAAgB,uBAGC;CACf,8BAA8B,2BAA2B;AAC3D;;AAqBA,SAAgB,mBAA+D;CAC7E,8BAA8B,uBAAuB;AACvD;;AAqBA,SAAgB,yBAEc;CAC5B,8BAA8B,6BAA6B;AAC7D;;AAqBA,SAAgB,cAEC;CACf,8BAA8B,kBAAkB;AAClD;;AA8BA,SAAgB,oBAGC;CACf,8BAA8B,wBAAwB;AACxD;;AAqBA,SAAgB,gBAEQ;CACtB,8BAA8B,oBAAoB;AACpD;;AAqBA,SAAgB,sBAEc;CAC5B,8BAA8B,0BAA0B;AAC1D;;AAqBA,SAAgB,gBAEC;CACf,8BAA8B,oBAAoB;AACpD;;AA8BA,SAAgB,sBAGC;CACf,8BAA8B,0BAA0B;AAC1D;;AAqBA,SAAgB,kBAEQ;CACtB,8BAA8B,sBAAsB;AACtD;;AAqBA,SAAgB,wBAEc;CAC5B,8BAA8B,4BAA4B;AAC5D;;AAqBA,SAAgB,kBAEC;CACf,8BAA8B,sBAAsB;AACtD"}
@@ -0,0 +1 @@
1
+ export {};