typia 9.7.2 → 10.0.0-dev.20251107

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 (116) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +153 -153
  3. package/lib/factories/ProtobufFactory.js +1 -1
  4. package/lib/factories/ProtobufFactory.mjs +1 -1
  5. package/lib/programmers/internal/json_schema_station.d.mts +2 -2
  6. package/lib/programmers/internal/json_schema_station.d.ts +2 -2
  7. package/lib/programmers/llm/LlmApplicationProgrammer.js +5 -1
  8. package/lib/programmers/llm/LlmApplicationProgrammer.js.map +1 -1
  9. package/lib/programmers/llm/LlmApplicationProgrammer.mjs +5 -1
  10. package/lib/programmers/llm/LlmSchemaProgrammer.js +1 -4
  11. package/lib/programmers/llm/LlmSchemaProgrammer.js.map +1 -1
  12. package/lib/programmers/llm/LlmSchemaProgrammer.mjs +1 -35
  13. package/package.json +121 -121
  14. package/src/AssertionGuard.ts +41 -41
  15. package/src/CamelCase.ts +75 -75
  16. package/src/IRandomGenerator.ts +337 -337
  17. package/src/IReadableURLSearchParams.ts +9 -9
  18. package/src/PascalCase.ts +71 -71
  19. package/src/Primitive.ts +90 -90
  20. package/src/Resolved.ts +72 -72
  21. package/src/SnakeCase.ts +127 -127
  22. package/src/TypeGuardError.ts +216 -216
  23. package/src/factories/MetadataCollection.ts +270 -270
  24. package/src/factories/MetadataCommentTagFactory.ts +632 -632
  25. package/src/factories/MetadataFactory.ts +402 -402
  26. package/src/factories/ProtobufFactory.ts +873 -873
  27. package/src/functional.ts +705 -705
  28. package/src/http.ts +972 -972
  29. package/src/internal/_ProtobufReader.ts +188 -188
  30. package/src/internal/_ProtobufSizer.ts +137 -137
  31. package/src/internal/_ProtobufWriter.ts +135 -135
  32. package/src/internal/_jsonStringifyString.ts +42 -42
  33. package/src/json.ts +643 -643
  34. package/src/llm.ts +615 -615
  35. package/src/misc.ts +594 -594
  36. package/src/module.ts +889 -889
  37. package/src/notations.ts +751 -751
  38. package/src/programmers/FeatureProgrammer.ts +605 -605
  39. package/src/programmers/ImportProgrammer.ts +179 -179
  40. package/src/programmers/RandomProgrammer.ts +1195 -1195
  41. package/src/programmers/helpers/ProtobufWire.ts +34 -34
  42. package/src/programmers/internal/check_array_length.ts +43 -43
  43. package/src/programmers/internal/check_bigint.ts +46 -46
  44. package/src/programmers/internal/check_dynamic_key.ts +197 -197
  45. package/src/programmers/internal/check_dynamic_properties.ts +231 -231
  46. package/src/programmers/internal/check_everything.ts +21 -21
  47. package/src/programmers/internal/check_native.ts +23 -23
  48. package/src/programmers/internal/check_number.ts +108 -108
  49. package/src/programmers/internal/check_object.ts +72 -72
  50. package/src/programmers/internal/check_string.ts +46 -46
  51. package/src/programmers/internal/check_template.ts +46 -46
  52. package/src/programmers/internal/check_union_array_like.ts +331 -331
  53. package/src/programmers/internal/decode_union_object.ts +110 -110
  54. package/src/programmers/internal/feature_object_entries.ts +59 -59
  55. package/src/programmers/internal/json_schema_escaped.ts +78 -78
  56. package/src/programmers/internal/json_schema_object.ts +150 -150
  57. package/src/programmers/internal/json_schema_station.ts +2 -2
  58. package/src/programmers/internal/metadata_to_pattern.ts +40 -40
  59. package/src/programmers/internal/postfix_of_tuple.ts +3 -3
  60. package/src/programmers/internal/prune_object_properties.ts +69 -69
  61. package/src/programmers/internal/stringify_dynamic_properties.ts +158 -158
  62. package/src/programmers/internal/stringify_native.ts +5 -5
  63. package/src/programmers/internal/stringify_regular_properties.ts +77 -77
  64. package/src/programmers/internal/template_to_pattern.ts +21 -21
  65. package/src/programmers/internal/wrap_metadata_rest_tuple.ts +21 -21
  66. package/src/programmers/json/JsonStringifyProgrammer.ts +1124 -1124
  67. package/src/programmers/llm/LlmApplicationProgrammer.ts +10 -1
  68. package/src/programmers/llm/LlmSchemaProgrammer.ts +2 -7
  69. package/src/protobuf.ts +820 -820
  70. package/src/reflect.ts +46 -46
  71. package/src/schemas/json/IJsonApplication.ts +77 -77
  72. package/src/schemas/json/IJsonSchemaCollection.ts +212 -212
  73. package/src/schemas/json/IJsonSchemaUnit.ts +263 -263
  74. package/src/schemas/metadata/IMetadataTypeTag.ts +14 -14
  75. package/src/schemas/metadata/Metadata.ts +669 -669
  76. package/src/schemas/metadata/MetadataAliasType.ts +57 -57
  77. package/src/schemas/metadata/MetadataApplication.ts +40 -40
  78. package/src/schemas/metadata/MetadataArray.ts +47 -47
  79. package/src/schemas/metadata/MetadataArrayType.ts +51 -51
  80. package/src/schemas/metadata/MetadataAtomic.ts +85 -85
  81. package/src/schemas/metadata/MetadataEscaped.ts +45 -45
  82. package/src/schemas/metadata/MetadataFunction.ts +45 -45
  83. package/src/schemas/metadata/MetadataObject.ts +46 -46
  84. package/src/schemas/metadata/MetadataObjectType.ts +137 -137
  85. package/src/schemas/metadata/MetadataParameter.ts +52 -52
  86. package/src/schemas/metadata/MetadataProperty.ts +53 -53
  87. package/src/schemas/metadata/MetadataTemplate.ts +78 -78
  88. package/src/schemas/metadata/MetadataTuple.ts +28 -28
  89. package/src/schemas/metadata/MetadataTupleType.ts +61 -61
  90. package/src/tags/Constant.ts +47 -47
  91. package/src/tags/ContentMediaType.ts +27 -27
  92. package/src/tags/Default.ts +52 -52
  93. package/src/tags/Example.ts +56 -56
  94. package/src/tags/Examples.ts +56 -56
  95. package/src/tags/ExclusiveMaximum.ts +44 -44
  96. package/src/tags/ExclusiveMinimum.ts +44 -44
  97. package/src/tags/Format.ts +78 -78
  98. package/src/tags/JsonSchemaPlugin.ts +36 -36
  99. package/src/tags/MaxItems.ts +31 -31
  100. package/src/tags/MaxLength.ts +25 -25
  101. package/src/tags/Maximum.ts +39 -39
  102. package/src/tags/MinItems.ts +31 -31
  103. package/src/tags/MinLength.ts +25 -25
  104. package/src/tags/Minimum.ts +39 -39
  105. package/src/tags/MultipleOf.ts +42 -42
  106. package/src/tags/Pattern.ts +49 -49
  107. package/src/tags/Sequence.ts +37 -37
  108. package/src/tags/TagBase.ts +102 -102
  109. package/src/tags/Type.ts +64 -64
  110. package/src/tags/UniqueItems.ts +34 -34
  111. package/src/tags/internal/FormatCheatSheet.ts +71 -71
  112. package/src/transformers/ITransformOptions.ts +70 -70
  113. package/src/transformers/ImportTransformer.ts +253 -253
  114. package/src/transformers/NoTransformConfigurationError.ts +16 -16
  115. package/src/transformers/features/llm/LlmApplicationTransformer.ts +224 -224
  116. package/src/typings/Equal.ts +18 -18
package/src/http.ts CHANGED
@@ -1,972 +1,972 @@
1
- import { NoTransformConfigurationError } from "./transformers/NoTransformConfigurationError";
2
-
3
- import { Atomic } from "./typings/Atomic";
4
-
5
- import { IReadableURLSearchParams } from "./IReadableURLSearchParams";
6
- import { IValidation } from "./IValidation";
7
- import { Resolved } from "./Resolved";
8
- import { TypeGuardError } from "./TypeGuardError";
9
-
10
- /* ===========================================================
11
- HTTP
12
- - FORM-DATA
13
- - QUERY
14
- - HEADERS
15
- - PARAMETER
16
- - FACTORY FUNCTIONS
17
- ==============================================================
18
- FORM-DATA
19
- ----------------------------------------------------------- */
20
- /**
21
- * Form data decoder.
22
- *
23
- * `typia.http.formData()` is a function decoding `FormData` instance, with
24
- * automatic type casting to the expected type. When property type is defined as
25
- * `boolean` or `Blob` type, `typia.http.formData()` will cast the value to the
26
- * expected type when decoding.
27
- *
28
- * By the way, as `FormData` is not enough to express complex data structures,
29
- * `typia.http.formData()` function has some limitations. If target type `T` is
30
- * not following those restrictions, compilation errors would be occurred.
31
- *
32
- * 1. Type `T` must be an object type
33
- * 2. Do not allow dynamic property
34
- * 3. Only `boolean`, `bigint`, `number`, `string`, `Blob`, `File` or their array
35
- * types are allowed
36
- * 4. Union types are never allowed
37
- *
38
- * Also, `typia.http.formData()` function does not perform validation about the
39
- * decoded value. Therefore, if you can't sure that input data is following the
40
- * `T` type, it would better to call one of below functions instead.
41
- *
42
- * @author Jeongho Nam - https://github.com/samchon
43
- * @template T Expected type of decoded value
44
- * @param input FormData instance
45
- * @returns Decoded form FormData
46
- */
47
- export function formData<T extends object>(input: FormData): Resolved<T>;
48
-
49
- /** @internal */
50
- export function formData(): never {
51
- NoTransformConfigurationError("http.formData");
52
- }
53
-
54
- /**
55
- * Form data decoder with type assertion.
56
- *
57
- * `typia.http.assertFormData()` is a function decoding `FormData` instance,
58
- * with automatic type casting to the expected type. When property type is
59
- * defined as `boolean` or `Blob` type, `typia.http.assertFormData()` will cast
60
- * the value to the expected type when decoding.
61
- *
62
- * Also, after decoding, `typia.http.assertFormData()` performs type assertion
63
- * to the decoded value by combining with {@link assert} function. Therefore,
64
- * when the decoded value is not following the `T` type, {@link TypeGuardError}
65
- * or custom error generated by _errorFactory_ would be thrown.
66
- *
67
- * By the way, as `FormData` is not enough to express complex data structures,
68
- * `typia.http.assertFormData()` function has some limitations. If target type
69
- * `T` is not following those restrictions, compilation errors would be
70
- * occurred.
71
- *
72
- * 1. Type `T` must be an object type
73
- * 2. Do not allow dynamic property
74
- * 3. Only `boolean`, `bigint`, `number`, `string`, `Blob`, `File` or their array
75
- * types are allowed
76
- * 4. Union types are never allowed
77
- *
78
- * @author Jeongho Nam - https://github.com/samchon
79
- * @template T Expected type of decoded value
80
- * @param input FormData instance
81
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
82
- * @returns Decoded form FormData
83
- */
84
- export function assertFormData<T extends object>(
85
- input: FormData,
86
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
87
- ): Resolved<T>;
88
-
89
- /** @internal */
90
- export function assertFormData(): never {
91
- NoTransformConfigurationError("http.assertFormData");
92
- }
93
-
94
- /**
95
- * Form data decoder with type checking.
96
- *
97
- * `typia.http.isFormData()` is a function decoding `FormData` instance, with
98
- * automatic type casting to the expected type. When property type is defined as
99
- * `boolean` or `Blob` type, `typia.http.isFormData()` will cast the value to
100
- * the expected type when decoding.
101
- *
102
- * Also, after decoding, `typia.http.isFormData()` performs type checking to the
103
- * decoded value by combining with {@link is} function. Therefore, when the
104
- * decoded value is not following the `T` type, `null` value would be returned.
105
- *
106
- * By the way, as `FormData` is not enough to express complex data structures,
107
- * `typia.http.isFormData()` function has some limitations. If target type `T`
108
- * is not following those restrictions, compilation errors would be occurred.
109
- *
110
- * 1. Type `T` must be an object type
111
- * 2. Do not allow dynamic property
112
- * 3. Only `boolean`, `bigint`, `number`, `string`, `Blob`, `File` or their array
113
- * types are allowed
114
- * 4. Union types are never allowed
115
- *
116
- * @author Jeongho Nam - https://github.com/samchon
117
- * @template T Expected type of decoded value
118
- * @param input FormData instance
119
- * @returns Decoded form FormData or `null` value
120
- */
121
- export function isFormData<T extends object>(
122
- input: FormData,
123
- ): Resolved<T> | null;
124
-
125
- /** @internal */
126
- export function isFormData(): never {
127
- NoTransformConfigurationError("http.isFormData");
128
- }
129
-
130
- /**
131
- * Form data decoder with type validation.
132
- *
133
- * `typia.http.validateFormData()` is a function decoding `FormData` instance,
134
- * with automatic type casting to the expected type. When property type is
135
- * defined as `boolean` or `Blob` type, `typia.http.validateFormData()` will
136
- * cast the value to the expected type when decoding.
137
- *
138
- * Also, after decoding, `typia.http.validateFormData()` performs type
139
- * validation to the decoded value by combining with {@link validate} function.
140
- * Therefore, when the decoded value is not following the `T` type,
141
- * {@link IValidation.IFailure} would be returned. Otherwise, x@xxxx
142
- * IValidation.ISuccess} would be returned.
143
- *
144
- * By the way, as `FormData` is not enough to express complex data structures,
145
- * `typia.http.validateFormData()` function has some limitations. If target type
146
- * `T` is not following those restrictions, compilation errors would be
147
- * occurred.
148
- *
149
- * 1. Type `T` must be an object type
150
- * 2. Do not allow dynamic property
151
- * 3. Only `boolean`, `bigint`, `number`, `string`, `Blob`, `File` or their array
152
- * types are allowed
153
- * 4. Union types are never allowed
154
- *
155
- * @author Jeongho Nam - https://github.com/samchon
156
- * @template T Expected type of decoded value
157
- * @param input FormData instance
158
- * @returns Validation result with decoded form FormData
159
- */
160
- export function validateFormData<T extends object>(
161
- input: FormData,
162
- ): IValidation<Resolved<T>>;
163
-
164
- /** @internal */
165
- export function validateFormData(): never {
166
- NoTransformConfigurationError("http.validateFormData");
167
- }
168
-
169
- /* -----------------------------------------------------------
170
- QUERY
171
- ----------------------------------------------------------- */
172
- /**
173
- * URL query decoder.
174
- *
175
- * `typia.http.query()` is a function decoding a query string or an
176
- * `URLSearchParams` instance, with automatic type casting to the expected type.
177
- * When property type be defined as `boolean` or `number` type,
178
- * `typia.http.query()` will cast the value to the expected type when decoding.
179
- *
180
- * By the way, as URL query is not enough to express complex data structures,
181
- * `typia.http.query()` function has some limitations. If target type `T` is not
182
- * following those restrictions, compilation errors would be occurred.
183
- *
184
- * 1. Type `T` must be an object type
185
- * 2. Do not allow dynamic property
186
- * 3. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
187
- * 4. Union types are never allowed
188
- *
189
- * Also, `typia.http.query()` function does not perform validation about the
190
- * decoded value. Therefore, if you can't sure that input data is following the
191
- * `T` type, it would better to call one of below functions instead.
192
- *
193
- * - {@link assertQuery}
194
- * - {@link isQuery}
195
- * - {@link validateQuery}
196
- *
197
- * @author Jeongho Nam - https://github.com/samchon
198
- * @template T Expected type of decoded value
199
- * @param input Query string or URLSearchParams instance
200
- * @returns Decoded query object
201
- */
202
- export function query<T extends object>(
203
- input: string | IReadableURLSearchParams,
204
- ): Resolved<T>;
205
-
206
- /** @internal */
207
- export function query(): never {
208
- NoTransformConfigurationError("http.query");
209
- }
210
-
211
- /**
212
- * URL query decoder with type assertion.
213
- *
214
- * `typia.http.assertQuery()` is a function decoding a query string or an
215
- * `URLSearchParams` instance, with automatic type casting to the expected type.
216
- * When property type is defined as `boolean` or `number` type,
217
- * `typia.http.assertQuery()` will cast the value to the expected type when
218
- * decoding.
219
- *
220
- * Also, after decoding, `typia.http.assertQuery()` performs type assertion to
221
- * the decoded value by combining with {@link assert} function. Therefore, when
222
- * the decoded value is not following the `T` type, {@link TypeGuardError} or
223
- * custom error generated by _errorFactory_ would be thrown.
224
- *
225
- * By the way, as URL query is not enough to express complex data structures,
226
- * `typia.http.assertQuery()` function has some limitations. If target type `T`
227
- * is notfollowing those restrictions, compilation errors would be occurred.
228
- *
229
- * 1. Type `T` must be an object type
230
- * 2. Do not allow dynamic property
231
- * 3. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
232
- * 4. Union types are never allowed
233
- *
234
- * @author Jeongho Nam - https://github.com/samchon
235
- * @template T Expected type of decoded value
236
- * @param input Query string or URLSearchParams instance
237
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
238
- * @returns Decoded query object
239
- */
240
- export function assertQuery<T extends object>(
241
- input: string | IReadableURLSearchParams,
242
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
243
- ): Resolved<T>;
244
-
245
- /** @internal */
246
- export function assertQuery(): never {
247
- NoTransformConfigurationError("http.assertQuery");
248
- }
249
-
250
- /**
251
- * URL query decoder with type checking.
252
- *
253
- * `typia.http.isQuery()` is a function decoding a query string or an
254
- * `URLSearchParams` instance, with automatic type casting to the expected type.
255
- * When property type is defined as `boolean` or `number` type,
256
- * `typia.http.isQuery()` will cast the value to the expected type when
257
- * decoding.
258
- *
259
- * Also, after decoding, `typia.http.isQuery()` performs type checking to the
260
- * decoded value by combining with {@link is} function. Therefore, when the
261
- * decoded value is not following the `T` type, `null` value would be returned.
262
- *
263
- * By the way, as URL query is not enough to express complex data structures,
264
- * `typia.http.isQuery()` function has some limitations. If target type `T` is
265
- * notfollowing those restrictions, compilation errors would be occurred.
266
- *
267
- * 1. Type `T` must be an object type
268
- * 2. Do not allow dynamic property
269
- * 3. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
270
- * 4. Union types are never allowed
271
- *
272
- * @author Jeongho Nam - https://github.com/samchon
273
- * @template T Expected type of decoded value
274
- * @param input Query string or URLSearchParams instance
275
- * @returns Decoded query object or `null` value
276
- */
277
- export function isQuery<T extends object>(
278
- input: string | IReadableURLSearchParams,
279
- ): Resolved<T> | null;
280
-
281
- /** @internal */
282
- export function isQuery(): never {
283
- NoTransformConfigurationError("http.isQuery");
284
- }
285
-
286
- /**
287
- * URL query decoder with type validation.
288
- *
289
- * `typia.http.validateQuery()` is a function decoding a query string or an
290
- * `URLSearchParams` instance, with automatic type casting to the expected type.
291
- * When property type is defined as `boolean` or `number` type,
292
- * `typia.http.validateQuery()` will cast the value to the expected type when
293
- * decoding.
294
- *
295
- * Also, after decoding, `typia.http.validateQuery()` performs type validation
296
- * to the decoded value by combining with {@link validate} function. Therefore,
297
- * when the decoded value is not following the `T` type,
298
- * {@link IValidation.IFailure} would be returned. Otherwise,
299
- * {@link IValidation.ISuccess} would be returned.
300
- *
301
- * By the way, as URL query is not enough to express complex data structures,
302
- * `typia.http.validateQuery()` function has some limitations. If target type
303
- * `T` is notfollowing those restrictions, compilation errors would be
304
- * occurred.
305
- *
306
- * 1. Type `T` must be an object type
307
- * 2. Do not allow dynamic property
308
- * 3. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
309
- * 4. Union types are never allowed
310
- *
311
- * @author Jeongho Nam - https://github.com/samchon
312
- * @template T Expected type of decoded value
313
- * @param input Query string or URLSearchParams instance
314
- * @returns Validation result with decoded query object
315
- */
316
- export function validateQuery<T extends object>(
317
- input: string | IReadableURLSearchParams,
318
- ): IValidation<Resolved<T>>;
319
-
320
- /** @internal */
321
- export function validateQuery(): never {
322
- NoTransformConfigurationError("http.validateQuery");
323
- }
324
-
325
- /* -----------------------------------------------------------
326
- HEADERS
327
- ----------------------------------------------------------- */
328
- /**
329
- * Headers decoder (for express and fastify).
330
- *
331
- * `typia.http.headers()` is a function decoding an header instance, with
332
- * automatic type casting to the expected type. When property type is defined as
333
- * `boolean` or `number` type, `typia.http.headers()` will cast the value to the
334
- * expected type.
335
- *
336
- * By the way, as HTTP headers are not enough to express complex data
337
- * structures, `typia.http.headers()` function has some limitations. If target
338
- * type `T` is not following those restrictions, compilation errors would be
339
- * occurred.
340
- *
341
- * 1. Type `T` must be an object type
342
- * 2. Do not allow dynamic property
343
- * 3. Property key must be lower case
344
- * 4. Property value cannot be `null`, but `undefined` is possible
345
- * 5. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
346
- * 6. Union types are never allowed
347
- * 7. Property `set-cookie` must be array type
348
- * 8. Those properties cannot be array type
349
- *
350
- * - Age
351
- * - Authorization
352
- * - Content-length
353
- * - Content-type
354
- * - Etag
355
- * - Expires
356
- * - From
357
- * - Host
358
- * - If-modified-since
359
- * - If-unmodified-since
360
- * - Last-modified
361
- * - Location
362
- * - Max-forwards
363
- * - Proxy-authorization
364
- * - Referer
365
- * - Retry-after
366
- * - Server
367
- * - User-agent
368
- *
369
- * Also, `typia.http.headers()` function does not perform validation about the
370
- * decoded value. Therefore, if you can't sure that input data is following the
371
- * `T` type, it would better to call one of below functions instead.
372
- *
373
- * - {@link assertHeaders}
374
- * - {@link isHeaders}
375
- * - {@link validateHeaders}
376
- *
377
- * @author Jeongho Nam - https://github.com/samchon
378
- * @template T Expected type of decoded value
379
- * @param input Query string or URLSearchParams instance
380
- * @returns Decoded headers object
381
- */
382
- export function headers<T extends object>(
383
- input: Record<string, string | string[] | undefined>,
384
- ): Resolved<T>;
385
-
386
- /** @internal */
387
- export function headers(): never {
388
- NoTransformConfigurationError("http.headers");
389
- }
390
-
391
- /**
392
- * Headers decoder with type assertion (for express and fastify).
393
- *
394
- * `typia.http.assertHeaders()` is a function decoding an header instance, with
395
- * automatic type casting to the expected type. When property type is defined as
396
- * `boolean` or `number` type, `typia.http.headers()` will cast the value to the
397
- * expected type.
398
- *
399
- * Also, after decoding, `typia.http.assertHeaders()` performs type assertion to
400
- * the decoded value by combining with {@link assert} function. Therefore, when
401
- * the decoded value is not following the `T` type, {@link TypeGuardError} or
402
- * custom error generated by _errorFactory_ would be thrown.
403
- *
404
- * By the way, as HTTP headers are not enough to express complex data
405
- * structures, `typia.http.headers()` function has some limitations. If target
406
- * type `T` is not following those restrictions, compilation errors would be
407
- * occurred.
408
- *
409
- * 1. Type `T` must be an object type
410
- * 2. Do not allow dynamic property
411
- * 3. Property key must be lower case
412
- * 4. Property value cannot be `null`, but `undefined` is possible
413
- * 5. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
414
- * 6. Union types are never allowed
415
- * 7. Property `set-cookie` must be array type
416
- * 8. Those properties cannot be array type
417
- *
418
- * - Age
419
- * - Authorization
420
- * - Content-length
421
- * - Content-type
422
- * - Etag
423
- * - Expires
424
- * - From
425
- * - Host
426
- * - If-modified-since
427
- * - If-unmodified-since
428
- * - Last-modified
429
- * - Location
430
- * - Max-forwards
431
- * - Proxy-authorization
432
- * - Referer
433
- * - Retry-after
434
- * - Server
435
- * - User-agent
436
- *
437
- * @author Jeongho Nam - https://github.com/samchon
438
- * @template T Expected type of decoded value
439
- * @param input Query string or URLSearchParams instance
440
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
441
- * @returns Decoded headers object
442
- */
443
- export function assertHeaders<T extends object>(
444
- input: Record<string, string | string[] | undefined>,
445
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
446
- ): Resolved<T>;
447
-
448
- /** @internal */
449
- export function assertHeaders(): never {
450
- NoTransformConfigurationError("http.assertHeaders");
451
- }
452
-
453
- /**
454
- * > You must configure the generic argument `T`.
455
- *
456
- * Headers decoder with type checking (for express and fastify).
457
- *
458
- * `typia.http.isHeaders()` is a function decoding an header instance, with
459
- * automatic type casting to the expected type. When property type is defined as
460
- * `boolean` or `number` type, `typia.http.headers()` will cast the value to the
461
- * expected type.
462
- *
463
- * Also, after decoding, `typia.http.isHeaders()` performs type checking to the
464
- * decoded value by combining with {@link is} function. Therefore, when the
465
- * decoded value is not following the `T` type, `null` value would be returned.
466
- *
467
- * By the way, as HTTP headers are not enough to express complex data
468
- * structures, `typia.http.headers()` function has some limitations. If target
469
- * type `T` is not following those restrictions, compilation errors would be
470
- * occurred.
471
- *
472
- * 1. Type `T` must be an object type
473
- * 2. Do not allow dynamic property
474
- * 3. Property key must be lower case
475
- * 4. Property value cannot be `null`, but `undefined` is possible
476
- * 5. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
477
- * 6. Union types are never allowed
478
- * 7. Property `set-cookie` must be array type
479
- * 8. Those properties cannot be array type
480
- *
481
- * - Age
482
- * - Authorization
483
- * - Content-length
484
- * - Content-type
485
- * - Etag
486
- * - Expires
487
- * - From
488
- * - Host
489
- * - If-modified-since
490
- * - If-unmodified-since
491
- * - Last-modified
492
- * - Location
493
- * - Max-forwards
494
- * - Proxy-authorization
495
- * - Referer
496
- * - Retry-after
497
- * - Server
498
- * - User-agent
499
- *
500
- * @author Jeongho Nam - https://github.com/samchon
501
- * @template T Expected type of decoded value
502
- * @param input Query string or URLSearchParams instance
503
- * @returns Decoded headers object or `null` value
504
- */
505
- export function isHeaders<T extends object>(
506
- input: Record<string, string | string[] | undefined>,
507
- ): Resolved<T> | null;
508
-
509
- /** @internal */
510
- export function isHeaders(): never {
511
- NoTransformConfigurationError("http.isHeaders");
512
- }
513
-
514
- /**
515
- * Headers decoder with type validation (for express and fastify).
516
- *
517
- * `typia.http.validateHeaders()` is a function decoding an header instance,
518
- * with automatic type casting to the expected type. When property type is
519
- * defined as `boolean` or `number` type, `typia.http.headers()` will cast the
520
- * value to the expected type.
521
- *
522
- * Also, after decoding, `typia.http.validateHeaders()` performs type assertion
523
- * to the decoded value by combining with {@link validate} function. Therefore,
524
- * when the decoded value is not following the `T` type,
525
- * {@link IValidation.IError} would be returned. Otherwise,
526
- * {@link IValidation.ISuccess} be returned.
527
- *
528
- * By the way, as HTTP headers are not enough to express complex data
529
- * structures, `typia.http.headers()` function has some limitations. If target
530
- * type `T` is not following those restrictions, compilation errors would be
531
- * occurred.
532
- *
533
- * 1. Type `T` must be an object type
534
- * 2. Do not allow dynamic property
535
- * 3. Property key must be lower case
536
- * 4. Property value cannot be `null`, but `undefined` is possible
537
- * 5. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
538
- * 6. Union types are never allowed
539
- * 7. Property `set-cookie` must be array type
540
- * 8. Those properties cannot be array type
541
- *
542
- * - Age
543
- * - Authorization
544
- * - Content-length
545
- * - Content-type
546
- * - Etag
547
- * - Expires
548
- * - From
549
- * - Host
550
- * - If-modified-since
551
- * - If-unmodified-since
552
- * - Last-modified
553
- * - Location
554
- * - Max-forwards
555
- * - Proxy-authorization
556
- * - Referer
557
- * - Retry-after
558
- * - Server
559
- * - User-agent
560
- *
561
- * @author Jeongho Nam - https://github.com/samchon
562
- * @template T Expected type of decoded value
563
- * @param input Query string or URLSearchParams instance
564
- * @returns Decoded headers object
565
- */
566
- export function validateHeaders<T extends object>(
567
- input: Record<string, string | string[] | undefined>,
568
- ): IValidation<Resolved<T>>;
569
-
570
- /** @internal */
571
- export function validateHeaders(): never {
572
- NoTransformConfigurationError("http.validateHeaders");
573
- }
574
-
575
- /* -----------------------------------------------------------
576
- PARAMETER
577
- ----------------------------------------------------------- */
578
- /**
579
- * URL path parameter decoder.
580
- *
581
- * `typia.http.parameter()` is a function decoding a path parameter, with
582
- * automatic type casting to the expected type. When type `T` has been defined
583
- * as `boolean` or `number` type, `typia.http.parameter()` will cast the value
584
- * to the expected type.
585
- *
586
- * Also, `typia.http.parameter()` performs type assertion to the decoded value
587
- * by combining with {@link assert} function. Therefore, when the decoded value
588
- * is not following the `T` type, {@link TypeGuardError} would be thrown.
589
- *
590
- * @template T Expected type of decoded value
591
- * @param input Path parameter string
592
- * @returns Decoded path parameter value
593
- */
594
- export function parameter<T extends Atomic.Type | null>(
595
- input: string,
596
- ): Resolved<T>;
597
-
598
- /** @internal */
599
- export function parameter(): never {
600
- NoTransformConfigurationError("http.parameter");
601
- }
602
-
603
- /* -----------------------------------------------------------
604
- FACTORY FUNCTIONS
605
- ----------------------------------------------------------- */
606
- /**
607
- * Creates a reusable {@link formdata} function.
608
- *
609
- * @author Jeongho Nam - https://github.com/samchon
610
- * @template T The type of the formdata object
611
- * @throws Compile error
612
- * @danger You must configure the generic argument `T`
613
- */
614
- export function createFormData(): never;
615
-
616
- /**
617
- * Creates a reusable {@link formdata} function.
618
- *
619
- * @author Jeongho Nam - https://github.com/samchon
620
- * @template T The type of the formdata object
621
- * @returns A reusable `formdata` function
622
- */
623
- export function createFormData<T extends object>(): (input: FormData) => T;
624
-
625
- /** @internal */
626
- export function createFormData<T>(): (input: FormData) => T {
627
- NoTransformConfigurationError("http.createFormData");
628
- }
629
-
630
- /**
631
- * Creates a reusable {@link assertFormData} function.
632
- *
633
- * @author Jeongho Nam - https://github.com/samchon
634
- * @template T The type of the formdata object
635
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
636
- * @throws Compile error
637
- * @danger You must configure the generic argument `T`
638
- */
639
- export function createAssertFormData(
640
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
641
- ): never;
642
-
643
- /**
644
- * Creates a reusable {@link assertFormData} function.
645
- *
646
- * @author Jeongho Nam - https://github.com/samchon
647
- * @template T The type of the formdata object
648
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
649
- * @returns A reusable `assertFormData` function
650
- */
651
- export function createAssertFormData<T extends object>(
652
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
653
- ): (input: FormData) => T;
654
-
655
- /** @internal */
656
- export function createAssertFormData<T>(): (input: FormData) => T {
657
- NoTransformConfigurationError("http.createAssertFormData");
658
- }
659
-
660
- /**
661
- * Creates a reusable {@link isFormData} function.
662
- *
663
- * @author Jeongho Nam - https://github.com/samchon
664
- * @template T The type of the formdata object
665
- * @throws Compile error
666
- * @danger You must configure the generic argument `T`
667
- */
668
- export function createIsFormData(): never;
669
-
670
- /**
671
- * Creates a reusable {@link isFormData} function.
672
- *
673
- * @author Jeongho Nam - https://github.com/samchon
674
- * @template T The type of the formdata object
675
- * @returns A reusable `isFormData` function
676
- */
677
- export function createIsFormData<T extends object>(): (
678
- input: FormData,
679
- ) => T | null;
680
-
681
- /** @internal */
682
- export function createIsFormData<T>(): (input: FormData) => T | null {
683
- NoTransformConfigurationError("http.createIsFormData");
684
- }
685
-
686
- /**
687
- * Creates a reusable {@link validateFormData} function.
688
- *
689
- * @author Jeongho Nam - https://github.com/samchon
690
- * @template T The type of the formdata object
691
- * @throws Compile error
692
- * @danger You must configure the generic argument `T`
693
- */
694
- export function createValidateFormData(): never;
695
-
696
- /**
697
- * Creates a reusable {@link validateFormData} function.
698
- *
699
- * @author Jeongho Nam - https://github.com/samchon
700
- * @template T The type of the formdata object
701
- * @returns A reusable `validateFormData` function
702
- */
703
- export function createValidateFormData<T extends object>(): (
704
- input: FormData,
705
- ) => IValidation<Resolved<T>>;
706
-
707
- /** @internal */
708
- export function createValidateFormData<T>(): (
709
- input: FormData,
710
- ) => IValidation<Resolved<T>> {
711
- NoTransformConfigurationError("http.createValidateFormData");
712
- }
713
-
714
- /**
715
- * Creates a reusable {@link query} function.
716
- *
717
- * @author Jeongho Nam - https://github.com/samchon
718
- * @template T The type of the query object
719
- * @throws Compile error
720
- * @danger You must configure the generic argument `T`
721
- */
722
- export function createQuery(): never;
723
-
724
- /**
725
- * Creates a reusable {@link query} function.
726
- *
727
- * @author Jeongho Nam - https://github.com/samchon
728
- * @template T The type of the query object
729
- * @returns A reusable `query` function
730
- */
731
- export function createQuery<T extends object>(): (
732
- input: string | IReadableURLSearchParams,
733
- ) => T;
734
-
735
- /** @internal */
736
- export function createQuery<T>(): (
737
- input: string | IReadableURLSearchParams,
738
- ) => T {
739
- NoTransformConfigurationError("http.createQuery");
740
- }
741
-
742
- /**
743
- * Creates a reusable {@link assertQuery} function.
744
- *
745
- * @author Jeongho Nam - https://github.com/samchon
746
- * @template T The type of the query object
747
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
748
- * @throws Compile error
749
- * @danger You must configure the generic argument `T`
750
- */
751
- export function createAssertQuery(
752
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
753
- ): never;
754
-
755
- /**
756
- * Creates a reusable {@link assertQuery} function.
757
- *
758
- * @author Jeongho Nam - https://github.com/samchon
759
- * @template T The type of the query object
760
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
761
- * @returns A reusable `assertQuery` function
762
- */
763
- export function createAssertQuery<T extends object>(
764
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
765
- ): (input: string | IReadableURLSearchParams) => T;
766
-
767
- /** @internal */
768
- export function createAssertQuery<T>(): (
769
- input: string | IReadableURLSearchParams,
770
- ) => T {
771
- NoTransformConfigurationError("http.createAssertQuery");
772
- }
773
-
774
- /**
775
- * Creates a reusable {@link isQuery} function.
776
- *
777
- * @author Jeongho Nam - https://github.com/samchon
778
- * @template T The type of the query object
779
- * @throws Compile error
780
- * @danger You must configure the generic argument `T`
781
- */
782
- export function createIsQuery(): never;
783
-
784
- /**
785
- * Creates a reusable {@link isQuery} function.
786
- *
787
- * @author Jeongho Nam - https://github.com/samchon
788
- * @template T The type of the query object
789
- * @returns A reusable `isQuery` function
790
- */
791
- export function createIsQuery<T extends object>(): (
792
- input: string | IReadableURLSearchParams,
793
- ) => T | null;
794
-
795
- /** @internal */
796
- export function createIsQuery<T>(): (
797
- input: string | IReadableURLSearchParams,
798
- ) => T | null {
799
- NoTransformConfigurationError("http.createIsQuery");
800
- }
801
-
802
- /**
803
- * Creates a reusable {@link validateQuery} function.
804
- *
805
- * @author Jeongho Nam - https://github.com/samchon
806
- * @template T The type of the query object
807
- * @throws Compile error
808
- * @danger You must configure the generic argument `T`
809
- */
810
- export function createValidateQuery(): never;
811
-
812
- /**
813
- * Creates a reusable {@link validateQuery} function.
814
- *
815
- * @author Jeongho Nam - https://github.com/samchon
816
- * @template T The type of the query object
817
- * @returns A reusable `validateQuery` function
818
- */
819
- export function createValidateQuery<T extends object>(): (
820
- input: string | IReadableURLSearchParams,
821
- ) => IValidation<Resolved<T>>;
822
-
823
- /** @internal */
824
- export function createValidateQuery<T>(): (
825
- input: string | IReadableURLSearchParams,
826
- ) => IValidation<Resolved<T>> {
827
- NoTransformConfigurationError("http.createValidateQuery");
828
- }
829
-
830
- /**
831
- * Creates a reusable {@link headers} function.
832
- *
833
- * @author Jeongho Nam - https://github.com/samchon
834
- * @template T The type of the headers object
835
- * @throws Compile error
836
- * @danger You must configure the generic argument `T`
837
- */
838
- export function createHeaders(): never;
839
-
840
- /**
841
- * Creates a reusable {@link headers} function.
842
- *
843
- * @author Jeongho Nam - https://github.com/samchon
844
- * @template T The type of the headers object
845
- * @returns A reusable `headers` function
846
- */
847
- export function createHeaders<T extends object>(): (
848
- input: Record<string, string | string[] | undefined>,
849
- ) => T;
850
-
851
- /** @internal */
852
- export function createHeaders<T>(): (
853
- input: Record<string, string | string[] | undefined>,
854
- ) => T {
855
- NoTransformConfigurationError("http.createHeaders");
856
- }
857
-
858
- /**
859
- * Creates a reusable {@link assertHeaders} function.
860
- *
861
- * @author Jeongho Nam - https://github.com/samchon
862
- * @template T The type of the headers object
863
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
864
- * @throws Compile error
865
- * @danger You must configure the generic argument `T`
866
- */
867
- export function createAssertHeaders(
868
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
869
- ): never;
870
-
871
- /**
872
- * Creates a reusable {@link assertHeaders} function.
873
- *
874
- * @author Jeongho Nam - https://github.com/samchon
875
- * @template T The type of the headers object
876
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
877
- * @returns A reusable `assertHeaders` function
878
- */
879
- export function createAssertHeaders<T extends object>(
880
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
881
- ): (input: Record<string, string | string[] | undefined>) => T;
882
-
883
- /** @internal */
884
- export function createAssertHeaders<T>(): (
885
- input: Record<string, string | string[] | undefined>,
886
- ) => T {
887
- NoTransformConfigurationError("http.createAssertHeaders");
888
- }
889
-
890
- /**
891
- * Creates a reusable {@link isHeaders} function.
892
- *
893
- * @author Jeongho Nam - https://github.com/samchon
894
- * @template T The type of the headers object
895
- * @throws Compile error
896
- * @danger You must configure the generic argument `T`
897
- */
898
- export function createIsHeaders(): never;
899
-
900
- /**
901
- * Creates a reusable {@link isHeaders} function.
902
- *
903
- * @author Jeongho Nam - https://github.com/samchon
904
- * @template T The type of the headers object
905
- * @returns A reusable `isHeaders` function
906
- */
907
- export function createIsHeaders<T extends object>(): (
908
- input: Record<string, string | string[] | undefined>,
909
- ) => T | null;
910
-
911
- /** @internal */
912
- export function createIsHeaders<T>(): (
913
- input: Record<string, string | string[] | undefined>,
914
- ) => T | null {
915
- NoTransformConfigurationError("http.createIsHeaders");
916
- }
917
-
918
- /**
919
- * Creates a reusable {@link validateHeaders} function.
920
- *
921
- * @author Jeongho Nam - https://github.com/samchon
922
- * @template T The type of the headers object
923
- * @throws Compile error
924
- * @danger You must configure the generic argument `T`
925
- */
926
- export function createValidateHeaders(): never;
927
-
928
- /**
929
- * Creates a reusable {@link validateHeaders} function.
930
- *
931
- * @author Jeongho Nam - https://github.com/samchon
932
- * @template T The type of the headers object
933
- * @returns A reusable `validateHeaders` function
934
- */
935
- export function createValidateHeaders<T extends object>(): (
936
- input: Record<string, string | string[] | undefined>,
937
- ) => IValidation<Resolved<T>>;
938
-
939
- /** @internal */
940
- export function createValidateHeaders<T>(): (
941
- input: Record<string, string | string[] | undefined>,
942
- ) => IValidation<Resolved<T>> {
943
- NoTransformConfigurationError("http.createValidateHeaders");
944
- }
945
-
946
- /**
947
- * Creates a reusable {@link parameter} function.
948
- *
949
- * @author Jeongho Nam - https://github.com/samchon
950
- * @template T The type of the parameter value
951
- * @throws Compile error
952
- * @danger You must configure the generic argument `T`
953
- */
954
- export function createParameter(): never;
955
-
956
- /**
957
- * Creates a reusable {@link parameter} function.
958
- *
959
- * @author Jeongho Nam - https://github.com/samchon
960
- * @template T The type of the parameter value
961
- * @returns A reusable `parameter` function
962
- */
963
- export function createParameter<T extends Atomic.Type | null>(): (
964
- input: string,
965
- ) => T;
966
-
967
- /** @internal */
968
- export function createParameter<T extends Atomic.Type | null>(): (
969
- input: string,
970
- ) => T {
971
- NoTransformConfigurationError("http.createParameter");
972
- }
1
+ import { NoTransformConfigurationError } from "./transformers/NoTransformConfigurationError";
2
+
3
+ import { Atomic } from "./typings/Atomic";
4
+
5
+ import { IReadableURLSearchParams } from "./IReadableURLSearchParams";
6
+ import { IValidation } from "./IValidation";
7
+ import { Resolved } from "./Resolved";
8
+ import { TypeGuardError } from "./TypeGuardError";
9
+
10
+ /* ===========================================================
11
+ HTTP
12
+ - FORM-DATA
13
+ - QUERY
14
+ - HEADERS
15
+ - PARAMETER
16
+ - FACTORY FUNCTIONS
17
+ ==============================================================
18
+ FORM-DATA
19
+ ----------------------------------------------------------- */
20
+ /**
21
+ * Form data decoder.
22
+ *
23
+ * `typia.http.formData()` is a function decoding `FormData` instance, with
24
+ * automatic type casting to the expected type. When property type is defined as
25
+ * `boolean` or `Blob` type, `typia.http.formData()` will cast the value to the
26
+ * expected type when decoding.
27
+ *
28
+ * By the way, as `FormData` is not enough to express complex data structures,
29
+ * `typia.http.formData()` function has some limitations. If target type `T` is
30
+ * not following those restrictions, compilation errors would be occurred.
31
+ *
32
+ * 1. Type `T` must be an object type
33
+ * 2. Do not allow dynamic property
34
+ * 3. Only `boolean`, `bigint`, `number`, `string`, `Blob`, `File` or their array
35
+ * types are allowed
36
+ * 4. Union types are never allowed
37
+ *
38
+ * Also, `typia.http.formData()` function does not perform validation about the
39
+ * decoded value. Therefore, if you can't sure that input data is following the
40
+ * `T` type, it would better to call one of below functions instead.
41
+ *
42
+ * @author Jeongho Nam - https://github.com/samchon
43
+ * @template T Expected type of decoded value
44
+ * @param input FormData instance
45
+ * @returns Decoded form FormData
46
+ */
47
+ export function formData<T extends object>(input: FormData): Resolved<T>;
48
+
49
+ /** @internal */
50
+ export function formData(): never {
51
+ NoTransformConfigurationError("http.formData");
52
+ }
53
+
54
+ /**
55
+ * Form data decoder with type assertion.
56
+ *
57
+ * `typia.http.assertFormData()` is a function decoding `FormData` instance,
58
+ * with automatic type casting to the expected type. When property type is
59
+ * defined as `boolean` or `Blob` type, `typia.http.assertFormData()` will cast
60
+ * the value to the expected type when decoding.
61
+ *
62
+ * Also, after decoding, `typia.http.assertFormData()` performs type assertion
63
+ * to the decoded value by combining with {@link assert} function. Therefore,
64
+ * when the decoded value is not following the `T` type, {@link TypeGuardError}
65
+ * or custom error generated by _errorFactory_ would be thrown.
66
+ *
67
+ * By the way, as `FormData` is not enough to express complex data structures,
68
+ * `typia.http.assertFormData()` function has some limitations. If target type
69
+ * `T` is not following those restrictions, compilation errors would be
70
+ * occurred.
71
+ *
72
+ * 1. Type `T` must be an object type
73
+ * 2. Do not allow dynamic property
74
+ * 3. Only `boolean`, `bigint`, `number`, `string`, `Blob`, `File` or their array
75
+ * types are allowed
76
+ * 4. Union types are never allowed
77
+ *
78
+ * @author Jeongho Nam - https://github.com/samchon
79
+ * @template T Expected type of decoded value
80
+ * @param input FormData instance
81
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
82
+ * @returns Decoded form FormData
83
+ */
84
+ export function assertFormData<T extends object>(
85
+ input: FormData,
86
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
87
+ ): Resolved<T>;
88
+
89
+ /** @internal */
90
+ export function assertFormData(): never {
91
+ NoTransformConfigurationError("http.assertFormData");
92
+ }
93
+
94
+ /**
95
+ * Form data decoder with type checking.
96
+ *
97
+ * `typia.http.isFormData()` is a function decoding `FormData` instance, with
98
+ * automatic type casting to the expected type. When property type is defined as
99
+ * `boolean` or `Blob` type, `typia.http.isFormData()` will cast the value to
100
+ * the expected type when decoding.
101
+ *
102
+ * Also, after decoding, `typia.http.isFormData()` performs type checking to the
103
+ * decoded value by combining with {@link is} function. Therefore, when the
104
+ * decoded value is not following the `T` type, `null` value would be returned.
105
+ *
106
+ * By the way, as `FormData` is not enough to express complex data structures,
107
+ * `typia.http.isFormData()` function has some limitations. If target type `T`
108
+ * is not following those restrictions, compilation errors would be occurred.
109
+ *
110
+ * 1. Type `T` must be an object type
111
+ * 2. Do not allow dynamic property
112
+ * 3. Only `boolean`, `bigint`, `number`, `string`, `Blob`, `File` or their array
113
+ * types are allowed
114
+ * 4. Union types are never allowed
115
+ *
116
+ * @author Jeongho Nam - https://github.com/samchon
117
+ * @template T Expected type of decoded value
118
+ * @param input FormData instance
119
+ * @returns Decoded form FormData or `null` value
120
+ */
121
+ export function isFormData<T extends object>(
122
+ input: FormData,
123
+ ): Resolved<T> | null;
124
+
125
+ /** @internal */
126
+ export function isFormData(): never {
127
+ NoTransformConfigurationError("http.isFormData");
128
+ }
129
+
130
+ /**
131
+ * Form data decoder with type validation.
132
+ *
133
+ * `typia.http.validateFormData()` is a function decoding `FormData` instance,
134
+ * with automatic type casting to the expected type. When property type is
135
+ * defined as `boolean` or `Blob` type, `typia.http.validateFormData()` will
136
+ * cast the value to the expected type when decoding.
137
+ *
138
+ * Also, after decoding, `typia.http.validateFormData()` performs type
139
+ * validation to the decoded value by combining with {@link validate} function.
140
+ * Therefore, when the decoded value is not following the `T` type,
141
+ * {@link IValidation.IFailure} would be returned. Otherwise, x@xxxx
142
+ * IValidation.ISuccess} would be returned.
143
+ *
144
+ * By the way, as `FormData` is not enough to express complex data structures,
145
+ * `typia.http.validateFormData()` function has some limitations. If target type
146
+ * `T` is not following those restrictions, compilation errors would be
147
+ * occurred.
148
+ *
149
+ * 1. Type `T` must be an object type
150
+ * 2. Do not allow dynamic property
151
+ * 3. Only `boolean`, `bigint`, `number`, `string`, `Blob`, `File` or their array
152
+ * types are allowed
153
+ * 4. Union types are never allowed
154
+ *
155
+ * @author Jeongho Nam - https://github.com/samchon
156
+ * @template T Expected type of decoded value
157
+ * @param input FormData instance
158
+ * @returns Validation result with decoded form FormData
159
+ */
160
+ export function validateFormData<T extends object>(
161
+ input: FormData,
162
+ ): IValidation<Resolved<T>>;
163
+
164
+ /** @internal */
165
+ export function validateFormData(): never {
166
+ NoTransformConfigurationError("http.validateFormData");
167
+ }
168
+
169
+ /* -----------------------------------------------------------
170
+ QUERY
171
+ ----------------------------------------------------------- */
172
+ /**
173
+ * URL query decoder.
174
+ *
175
+ * `typia.http.query()` is a function decoding a query string or an
176
+ * `URLSearchParams` instance, with automatic type casting to the expected type.
177
+ * When property type be defined as `boolean` or `number` type,
178
+ * `typia.http.query()` will cast the value to the expected type when decoding.
179
+ *
180
+ * By the way, as URL query is not enough to express complex data structures,
181
+ * `typia.http.query()` function has some limitations. If target type `T` is not
182
+ * following those restrictions, compilation errors would be occurred.
183
+ *
184
+ * 1. Type `T` must be an object type
185
+ * 2. Do not allow dynamic property
186
+ * 3. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
187
+ * 4. Union types are never allowed
188
+ *
189
+ * Also, `typia.http.query()` function does not perform validation about the
190
+ * decoded value. Therefore, if you can't sure that input data is following the
191
+ * `T` type, it would better to call one of below functions instead.
192
+ *
193
+ * - {@link assertQuery}
194
+ * - {@link isQuery}
195
+ * - {@link validateQuery}
196
+ *
197
+ * @author Jeongho Nam - https://github.com/samchon
198
+ * @template T Expected type of decoded value
199
+ * @param input Query string or URLSearchParams instance
200
+ * @returns Decoded query object
201
+ */
202
+ export function query<T extends object>(
203
+ input: string | IReadableURLSearchParams,
204
+ ): Resolved<T>;
205
+
206
+ /** @internal */
207
+ export function query(): never {
208
+ NoTransformConfigurationError("http.query");
209
+ }
210
+
211
+ /**
212
+ * URL query decoder with type assertion.
213
+ *
214
+ * `typia.http.assertQuery()` is a function decoding a query string or an
215
+ * `URLSearchParams` instance, with automatic type casting to the expected type.
216
+ * When property type is defined as `boolean` or `number` type,
217
+ * `typia.http.assertQuery()` will cast the value to the expected type when
218
+ * decoding.
219
+ *
220
+ * Also, after decoding, `typia.http.assertQuery()` performs type assertion to
221
+ * the decoded value by combining with {@link assert} function. Therefore, when
222
+ * the decoded value is not following the `T` type, {@link TypeGuardError} or
223
+ * custom error generated by _errorFactory_ would be thrown.
224
+ *
225
+ * By the way, as URL query is not enough to express complex data structures,
226
+ * `typia.http.assertQuery()` function has some limitations. If target type `T`
227
+ * is notfollowing those restrictions, compilation errors would be occurred.
228
+ *
229
+ * 1. Type `T` must be an object type
230
+ * 2. Do not allow dynamic property
231
+ * 3. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
232
+ * 4. Union types are never allowed
233
+ *
234
+ * @author Jeongho Nam - https://github.com/samchon
235
+ * @template T Expected type of decoded value
236
+ * @param input Query string or URLSearchParams instance
237
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
238
+ * @returns Decoded query object
239
+ */
240
+ export function assertQuery<T extends object>(
241
+ input: string | IReadableURLSearchParams,
242
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
243
+ ): Resolved<T>;
244
+
245
+ /** @internal */
246
+ export function assertQuery(): never {
247
+ NoTransformConfigurationError("http.assertQuery");
248
+ }
249
+
250
+ /**
251
+ * URL query decoder with type checking.
252
+ *
253
+ * `typia.http.isQuery()` is a function decoding a query string or an
254
+ * `URLSearchParams` instance, with automatic type casting to the expected type.
255
+ * When property type is defined as `boolean` or `number` type,
256
+ * `typia.http.isQuery()` will cast the value to the expected type when
257
+ * decoding.
258
+ *
259
+ * Also, after decoding, `typia.http.isQuery()` performs type checking to the
260
+ * decoded value by combining with {@link is} function. Therefore, when the
261
+ * decoded value is not following the `T` type, `null` value would be returned.
262
+ *
263
+ * By the way, as URL query is not enough to express complex data structures,
264
+ * `typia.http.isQuery()` function has some limitations. If target type `T` is
265
+ * notfollowing those restrictions, compilation errors would be occurred.
266
+ *
267
+ * 1. Type `T` must be an object type
268
+ * 2. Do not allow dynamic property
269
+ * 3. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
270
+ * 4. Union types are never allowed
271
+ *
272
+ * @author Jeongho Nam - https://github.com/samchon
273
+ * @template T Expected type of decoded value
274
+ * @param input Query string or URLSearchParams instance
275
+ * @returns Decoded query object or `null` value
276
+ */
277
+ export function isQuery<T extends object>(
278
+ input: string | IReadableURLSearchParams,
279
+ ): Resolved<T> | null;
280
+
281
+ /** @internal */
282
+ export function isQuery(): never {
283
+ NoTransformConfigurationError("http.isQuery");
284
+ }
285
+
286
+ /**
287
+ * URL query decoder with type validation.
288
+ *
289
+ * `typia.http.validateQuery()` is a function decoding a query string or an
290
+ * `URLSearchParams` instance, with automatic type casting to the expected type.
291
+ * When property type is defined as `boolean` or `number` type,
292
+ * `typia.http.validateQuery()` will cast the value to the expected type when
293
+ * decoding.
294
+ *
295
+ * Also, after decoding, `typia.http.validateQuery()` performs type validation
296
+ * to the decoded value by combining with {@link validate} function. Therefore,
297
+ * when the decoded value is not following the `T` type,
298
+ * {@link IValidation.IFailure} would be returned. Otherwise,
299
+ * {@link IValidation.ISuccess} would be returned.
300
+ *
301
+ * By the way, as URL query is not enough to express complex data structures,
302
+ * `typia.http.validateQuery()` function has some limitations. If target type
303
+ * `T` is notfollowing those restrictions, compilation errors would be
304
+ * occurred.
305
+ *
306
+ * 1. Type `T` must be an object type
307
+ * 2. Do not allow dynamic property
308
+ * 3. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
309
+ * 4. Union types are never allowed
310
+ *
311
+ * @author Jeongho Nam - https://github.com/samchon
312
+ * @template T Expected type of decoded value
313
+ * @param input Query string or URLSearchParams instance
314
+ * @returns Validation result with decoded query object
315
+ */
316
+ export function validateQuery<T extends object>(
317
+ input: string | IReadableURLSearchParams,
318
+ ): IValidation<Resolved<T>>;
319
+
320
+ /** @internal */
321
+ export function validateQuery(): never {
322
+ NoTransformConfigurationError("http.validateQuery");
323
+ }
324
+
325
+ /* -----------------------------------------------------------
326
+ HEADERS
327
+ ----------------------------------------------------------- */
328
+ /**
329
+ * Headers decoder (for express and fastify).
330
+ *
331
+ * `typia.http.headers()` is a function decoding an header instance, with
332
+ * automatic type casting to the expected type. When property type is defined as
333
+ * `boolean` or `number` type, `typia.http.headers()` will cast the value to the
334
+ * expected type.
335
+ *
336
+ * By the way, as HTTP headers are not enough to express complex data
337
+ * structures, `typia.http.headers()` function has some limitations. If target
338
+ * type `T` is not following those restrictions, compilation errors would be
339
+ * occurred.
340
+ *
341
+ * 1. Type `T` must be an object type
342
+ * 2. Do not allow dynamic property
343
+ * 3. Property key must be lower case
344
+ * 4. Property value cannot be `null`, but `undefined` is possible
345
+ * 5. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
346
+ * 6. Union types are never allowed
347
+ * 7. Property `set-cookie` must be array type
348
+ * 8. Those properties cannot be array type
349
+ *
350
+ * - Age
351
+ * - Authorization
352
+ * - Content-length
353
+ * - Content-type
354
+ * - Etag
355
+ * - Expires
356
+ * - From
357
+ * - Host
358
+ * - If-modified-since
359
+ * - If-unmodified-since
360
+ * - Last-modified
361
+ * - Location
362
+ * - Max-forwards
363
+ * - Proxy-authorization
364
+ * - Referer
365
+ * - Retry-after
366
+ * - Server
367
+ * - User-agent
368
+ *
369
+ * Also, `typia.http.headers()` function does not perform validation about the
370
+ * decoded value. Therefore, if you can't sure that input data is following the
371
+ * `T` type, it would better to call one of below functions instead.
372
+ *
373
+ * - {@link assertHeaders}
374
+ * - {@link isHeaders}
375
+ * - {@link validateHeaders}
376
+ *
377
+ * @author Jeongho Nam - https://github.com/samchon
378
+ * @template T Expected type of decoded value
379
+ * @param input Query string or URLSearchParams instance
380
+ * @returns Decoded headers object
381
+ */
382
+ export function headers<T extends object>(
383
+ input: Record<string, string | string[] | undefined>,
384
+ ): Resolved<T>;
385
+
386
+ /** @internal */
387
+ export function headers(): never {
388
+ NoTransformConfigurationError("http.headers");
389
+ }
390
+
391
+ /**
392
+ * Headers decoder with type assertion (for express and fastify).
393
+ *
394
+ * `typia.http.assertHeaders()` is a function decoding an header instance, with
395
+ * automatic type casting to the expected type. When property type is defined as
396
+ * `boolean` or `number` type, `typia.http.headers()` will cast the value to the
397
+ * expected type.
398
+ *
399
+ * Also, after decoding, `typia.http.assertHeaders()` performs type assertion to
400
+ * the decoded value by combining with {@link assert} function. Therefore, when
401
+ * the decoded value is not following the `T` type, {@link TypeGuardError} or
402
+ * custom error generated by _errorFactory_ would be thrown.
403
+ *
404
+ * By the way, as HTTP headers are not enough to express complex data
405
+ * structures, `typia.http.headers()` function has some limitations. If target
406
+ * type `T` is not following those restrictions, compilation errors would be
407
+ * occurred.
408
+ *
409
+ * 1. Type `T` must be an object type
410
+ * 2. Do not allow dynamic property
411
+ * 3. Property key must be lower case
412
+ * 4. Property value cannot be `null`, but `undefined` is possible
413
+ * 5. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
414
+ * 6. Union types are never allowed
415
+ * 7. Property `set-cookie` must be array type
416
+ * 8. Those properties cannot be array type
417
+ *
418
+ * - Age
419
+ * - Authorization
420
+ * - Content-length
421
+ * - Content-type
422
+ * - Etag
423
+ * - Expires
424
+ * - From
425
+ * - Host
426
+ * - If-modified-since
427
+ * - If-unmodified-since
428
+ * - Last-modified
429
+ * - Location
430
+ * - Max-forwards
431
+ * - Proxy-authorization
432
+ * - Referer
433
+ * - Retry-after
434
+ * - Server
435
+ * - User-agent
436
+ *
437
+ * @author Jeongho Nam - https://github.com/samchon
438
+ * @template T Expected type of decoded value
439
+ * @param input Query string or URLSearchParams instance
440
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
441
+ * @returns Decoded headers object
442
+ */
443
+ export function assertHeaders<T extends object>(
444
+ input: Record<string, string | string[] | undefined>,
445
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
446
+ ): Resolved<T>;
447
+
448
+ /** @internal */
449
+ export function assertHeaders(): never {
450
+ NoTransformConfigurationError("http.assertHeaders");
451
+ }
452
+
453
+ /**
454
+ * > You must configure the generic argument `T`.
455
+ *
456
+ * Headers decoder with type checking (for express and fastify).
457
+ *
458
+ * `typia.http.isHeaders()` is a function decoding an header instance, with
459
+ * automatic type casting to the expected type. When property type is defined as
460
+ * `boolean` or `number` type, `typia.http.headers()` will cast the value to the
461
+ * expected type.
462
+ *
463
+ * Also, after decoding, `typia.http.isHeaders()` performs type checking to the
464
+ * decoded value by combining with {@link is} function. Therefore, when the
465
+ * decoded value is not following the `T` type, `null` value would be returned.
466
+ *
467
+ * By the way, as HTTP headers are not enough to express complex data
468
+ * structures, `typia.http.headers()` function has some limitations. If target
469
+ * type `T` is not following those restrictions, compilation errors would be
470
+ * occurred.
471
+ *
472
+ * 1. Type `T` must be an object type
473
+ * 2. Do not allow dynamic property
474
+ * 3. Property key must be lower case
475
+ * 4. Property value cannot be `null`, but `undefined` is possible
476
+ * 5. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
477
+ * 6. Union types are never allowed
478
+ * 7. Property `set-cookie` must be array type
479
+ * 8. Those properties cannot be array type
480
+ *
481
+ * - Age
482
+ * - Authorization
483
+ * - Content-length
484
+ * - Content-type
485
+ * - Etag
486
+ * - Expires
487
+ * - From
488
+ * - Host
489
+ * - If-modified-since
490
+ * - If-unmodified-since
491
+ * - Last-modified
492
+ * - Location
493
+ * - Max-forwards
494
+ * - Proxy-authorization
495
+ * - Referer
496
+ * - Retry-after
497
+ * - Server
498
+ * - User-agent
499
+ *
500
+ * @author Jeongho Nam - https://github.com/samchon
501
+ * @template T Expected type of decoded value
502
+ * @param input Query string or URLSearchParams instance
503
+ * @returns Decoded headers object or `null` value
504
+ */
505
+ export function isHeaders<T extends object>(
506
+ input: Record<string, string | string[] | undefined>,
507
+ ): Resolved<T> | null;
508
+
509
+ /** @internal */
510
+ export function isHeaders(): never {
511
+ NoTransformConfigurationError("http.isHeaders");
512
+ }
513
+
514
+ /**
515
+ * Headers decoder with type validation (for express and fastify).
516
+ *
517
+ * `typia.http.validateHeaders()` is a function decoding an header instance,
518
+ * with automatic type casting to the expected type. When property type is
519
+ * defined as `boolean` or `number` type, `typia.http.headers()` will cast the
520
+ * value to the expected type.
521
+ *
522
+ * Also, after decoding, `typia.http.validateHeaders()` performs type assertion
523
+ * to the decoded value by combining with {@link validate} function. Therefore,
524
+ * when the decoded value is not following the `T` type,
525
+ * {@link IValidation.IError} would be returned. Otherwise,
526
+ * {@link IValidation.ISuccess} be returned.
527
+ *
528
+ * By the way, as HTTP headers are not enough to express complex data
529
+ * structures, `typia.http.headers()` function has some limitations. If target
530
+ * type `T` is not following those restrictions, compilation errors would be
531
+ * occurred.
532
+ *
533
+ * 1. Type `T` must be an object type
534
+ * 2. Do not allow dynamic property
535
+ * 3. Property key must be lower case
536
+ * 4. Property value cannot be `null`, but `undefined` is possible
537
+ * 5. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
538
+ * 6. Union types are never allowed
539
+ * 7. Property `set-cookie` must be array type
540
+ * 8. Those properties cannot be array type
541
+ *
542
+ * - Age
543
+ * - Authorization
544
+ * - Content-length
545
+ * - Content-type
546
+ * - Etag
547
+ * - Expires
548
+ * - From
549
+ * - Host
550
+ * - If-modified-since
551
+ * - If-unmodified-since
552
+ * - Last-modified
553
+ * - Location
554
+ * - Max-forwards
555
+ * - Proxy-authorization
556
+ * - Referer
557
+ * - Retry-after
558
+ * - Server
559
+ * - User-agent
560
+ *
561
+ * @author Jeongho Nam - https://github.com/samchon
562
+ * @template T Expected type of decoded value
563
+ * @param input Query string or URLSearchParams instance
564
+ * @returns Decoded headers object
565
+ */
566
+ export function validateHeaders<T extends object>(
567
+ input: Record<string, string | string[] | undefined>,
568
+ ): IValidation<Resolved<T>>;
569
+
570
+ /** @internal */
571
+ export function validateHeaders(): never {
572
+ NoTransformConfigurationError("http.validateHeaders");
573
+ }
574
+
575
+ /* -----------------------------------------------------------
576
+ PARAMETER
577
+ ----------------------------------------------------------- */
578
+ /**
579
+ * URL path parameter decoder.
580
+ *
581
+ * `typia.http.parameter()` is a function decoding a path parameter, with
582
+ * automatic type casting to the expected type. When type `T` has been defined
583
+ * as `boolean` or `number` type, `typia.http.parameter()` will cast the value
584
+ * to the expected type.
585
+ *
586
+ * Also, `typia.http.parameter()` performs type assertion to the decoded value
587
+ * by combining with {@link assert} function. Therefore, when the decoded value
588
+ * is not following the `T` type, {@link TypeGuardError} would be thrown.
589
+ *
590
+ * @template T Expected type of decoded value
591
+ * @param input Path parameter string
592
+ * @returns Decoded path parameter value
593
+ */
594
+ export function parameter<T extends Atomic.Type | null>(
595
+ input: string,
596
+ ): Resolved<T>;
597
+
598
+ /** @internal */
599
+ export function parameter(): never {
600
+ NoTransformConfigurationError("http.parameter");
601
+ }
602
+
603
+ /* -----------------------------------------------------------
604
+ FACTORY FUNCTIONS
605
+ ----------------------------------------------------------- */
606
+ /**
607
+ * Creates a reusable {@link formdata} function.
608
+ *
609
+ * @author Jeongho Nam - https://github.com/samchon
610
+ * @template T The type of the formdata object
611
+ * @throws Compile error
612
+ * @danger You must configure the generic argument `T`
613
+ */
614
+ export function createFormData(): never;
615
+
616
+ /**
617
+ * Creates a reusable {@link formdata} function.
618
+ *
619
+ * @author Jeongho Nam - https://github.com/samchon
620
+ * @template T The type of the formdata object
621
+ * @returns A reusable `formdata` function
622
+ */
623
+ export function createFormData<T extends object>(): (input: FormData) => T;
624
+
625
+ /** @internal */
626
+ export function createFormData<T>(): (input: FormData) => T {
627
+ NoTransformConfigurationError("http.createFormData");
628
+ }
629
+
630
+ /**
631
+ * Creates a reusable {@link assertFormData} function.
632
+ *
633
+ * @author Jeongho Nam - https://github.com/samchon
634
+ * @template T The type of the formdata object
635
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
636
+ * @throws Compile error
637
+ * @danger You must configure the generic argument `T`
638
+ */
639
+ export function createAssertFormData(
640
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
641
+ ): never;
642
+
643
+ /**
644
+ * Creates a reusable {@link assertFormData} function.
645
+ *
646
+ * @author Jeongho Nam - https://github.com/samchon
647
+ * @template T The type of the formdata object
648
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
649
+ * @returns A reusable `assertFormData` function
650
+ */
651
+ export function createAssertFormData<T extends object>(
652
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
653
+ ): (input: FormData) => T;
654
+
655
+ /** @internal */
656
+ export function createAssertFormData<T>(): (input: FormData) => T {
657
+ NoTransformConfigurationError("http.createAssertFormData");
658
+ }
659
+
660
+ /**
661
+ * Creates a reusable {@link isFormData} function.
662
+ *
663
+ * @author Jeongho Nam - https://github.com/samchon
664
+ * @template T The type of the formdata object
665
+ * @throws Compile error
666
+ * @danger You must configure the generic argument `T`
667
+ */
668
+ export function createIsFormData(): never;
669
+
670
+ /**
671
+ * Creates a reusable {@link isFormData} function.
672
+ *
673
+ * @author Jeongho Nam - https://github.com/samchon
674
+ * @template T The type of the formdata object
675
+ * @returns A reusable `isFormData` function
676
+ */
677
+ export function createIsFormData<T extends object>(): (
678
+ input: FormData,
679
+ ) => T | null;
680
+
681
+ /** @internal */
682
+ export function createIsFormData<T>(): (input: FormData) => T | null {
683
+ NoTransformConfigurationError("http.createIsFormData");
684
+ }
685
+
686
+ /**
687
+ * Creates a reusable {@link validateFormData} function.
688
+ *
689
+ * @author Jeongho Nam - https://github.com/samchon
690
+ * @template T The type of the formdata object
691
+ * @throws Compile error
692
+ * @danger You must configure the generic argument `T`
693
+ */
694
+ export function createValidateFormData(): never;
695
+
696
+ /**
697
+ * Creates a reusable {@link validateFormData} function.
698
+ *
699
+ * @author Jeongho Nam - https://github.com/samchon
700
+ * @template T The type of the formdata object
701
+ * @returns A reusable `validateFormData` function
702
+ */
703
+ export function createValidateFormData<T extends object>(): (
704
+ input: FormData,
705
+ ) => IValidation<Resolved<T>>;
706
+
707
+ /** @internal */
708
+ export function createValidateFormData<T>(): (
709
+ input: FormData,
710
+ ) => IValidation<Resolved<T>> {
711
+ NoTransformConfigurationError("http.createValidateFormData");
712
+ }
713
+
714
+ /**
715
+ * Creates a reusable {@link query} function.
716
+ *
717
+ * @author Jeongho Nam - https://github.com/samchon
718
+ * @template T The type of the query object
719
+ * @throws Compile error
720
+ * @danger You must configure the generic argument `T`
721
+ */
722
+ export function createQuery(): never;
723
+
724
+ /**
725
+ * Creates a reusable {@link query} function.
726
+ *
727
+ * @author Jeongho Nam - https://github.com/samchon
728
+ * @template T The type of the query object
729
+ * @returns A reusable `query` function
730
+ */
731
+ export function createQuery<T extends object>(): (
732
+ input: string | IReadableURLSearchParams,
733
+ ) => T;
734
+
735
+ /** @internal */
736
+ export function createQuery<T>(): (
737
+ input: string | IReadableURLSearchParams,
738
+ ) => T {
739
+ NoTransformConfigurationError("http.createQuery");
740
+ }
741
+
742
+ /**
743
+ * Creates a reusable {@link assertQuery} function.
744
+ *
745
+ * @author Jeongho Nam - https://github.com/samchon
746
+ * @template T The type of the query object
747
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
748
+ * @throws Compile error
749
+ * @danger You must configure the generic argument `T`
750
+ */
751
+ export function createAssertQuery(
752
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
753
+ ): never;
754
+
755
+ /**
756
+ * Creates a reusable {@link assertQuery} function.
757
+ *
758
+ * @author Jeongho Nam - https://github.com/samchon
759
+ * @template T The type of the query object
760
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
761
+ * @returns A reusable `assertQuery` function
762
+ */
763
+ export function createAssertQuery<T extends object>(
764
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
765
+ ): (input: string | IReadableURLSearchParams) => T;
766
+
767
+ /** @internal */
768
+ export function createAssertQuery<T>(): (
769
+ input: string | IReadableURLSearchParams,
770
+ ) => T {
771
+ NoTransformConfigurationError("http.createAssertQuery");
772
+ }
773
+
774
+ /**
775
+ * Creates a reusable {@link isQuery} function.
776
+ *
777
+ * @author Jeongho Nam - https://github.com/samchon
778
+ * @template T The type of the query object
779
+ * @throws Compile error
780
+ * @danger You must configure the generic argument `T`
781
+ */
782
+ export function createIsQuery(): never;
783
+
784
+ /**
785
+ * Creates a reusable {@link isQuery} function.
786
+ *
787
+ * @author Jeongho Nam - https://github.com/samchon
788
+ * @template T The type of the query object
789
+ * @returns A reusable `isQuery` function
790
+ */
791
+ export function createIsQuery<T extends object>(): (
792
+ input: string | IReadableURLSearchParams,
793
+ ) => T | null;
794
+
795
+ /** @internal */
796
+ export function createIsQuery<T>(): (
797
+ input: string | IReadableURLSearchParams,
798
+ ) => T | null {
799
+ NoTransformConfigurationError("http.createIsQuery");
800
+ }
801
+
802
+ /**
803
+ * Creates a reusable {@link validateQuery} function.
804
+ *
805
+ * @author Jeongho Nam - https://github.com/samchon
806
+ * @template T The type of the query object
807
+ * @throws Compile error
808
+ * @danger You must configure the generic argument `T`
809
+ */
810
+ export function createValidateQuery(): never;
811
+
812
+ /**
813
+ * Creates a reusable {@link validateQuery} function.
814
+ *
815
+ * @author Jeongho Nam - https://github.com/samchon
816
+ * @template T The type of the query object
817
+ * @returns A reusable `validateQuery` function
818
+ */
819
+ export function createValidateQuery<T extends object>(): (
820
+ input: string | IReadableURLSearchParams,
821
+ ) => IValidation<Resolved<T>>;
822
+
823
+ /** @internal */
824
+ export function createValidateQuery<T>(): (
825
+ input: string | IReadableURLSearchParams,
826
+ ) => IValidation<Resolved<T>> {
827
+ NoTransformConfigurationError("http.createValidateQuery");
828
+ }
829
+
830
+ /**
831
+ * Creates a reusable {@link headers} function.
832
+ *
833
+ * @author Jeongho Nam - https://github.com/samchon
834
+ * @template T The type of the headers object
835
+ * @throws Compile error
836
+ * @danger You must configure the generic argument `T`
837
+ */
838
+ export function createHeaders(): never;
839
+
840
+ /**
841
+ * Creates a reusable {@link headers} function.
842
+ *
843
+ * @author Jeongho Nam - https://github.com/samchon
844
+ * @template T The type of the headers object
845
+ * @returns A reusable `headers` function
846
+ */
847
+ export function createHeaders<T extends object>(): (
848
+ input: Record<string, string | string[] | undefined>,
849
+ ) => T;
850
+
851
+ /** @internal */
852
+ export function createHeaders<T>(): (
853
+ input: Record<string, string | string[] | undefined>,
854
+ ) => T {
855
+ NoTransformConfigurationError("http.createHeaders");
856
+ }
857
+
858
+ /**
859
+ * Creates a reusable {@link assertHeaders} function.
860
+ *
861
+ * @author Jeongho Nam - https://github.com/samchon
862
+ * @template T The type of the headers object
863
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
864
+ * @throws Compile error
865
+ * @danger You must configure the generic argument `T`
866
+ */
867
+ export function createAssertHeaders(
868
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
869
+ ): never;
870
+
871
+ /**
872
+ * Creates a reusable {@link assertHeaders} function.
873
+ *
874
+ * @author Jeongho Nam - https://github.com/samchon
875
+ * @template T The type of the headers object
876
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
877
+ * @returns A reusable `assertHeaders` function
878
+ */
879
+ export function createAssertHeaders<T extends object>(
880
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
881
+ ): (input: Record<string, string | string[] | undefined>) => T;
882
+
883
+ /** @internal */
884
+ export function createAssertHeaders<T>(): (
885
+ input: Record<string, string | string[] | undefined>,
886
+ ) => T {
887
+ NoTransformConfigurationError("http.createAssertHeaders");
888
+ }
889
+
890
+ /**
891
+ * Creates a reusable {@link isHeaders} function.
892
+ *
893
+ * @author Jeongho Nam - https://github.com/samchon
894
+ * @template T The type of the headers object
895
+ * @throws Compile error
896
+ * @danger You must configure the generic argument `T`
897
+ */
898
+ export function createIsHeaders(): never;
899
+
900
+ /**
901
+ * Creates a reusable {@link isHeaders} function.
902
+ *
903
+ * @author Jeongho Nam - https://github.com/samchon
904
+ * @template T The type of the headers object
905
+ * @returns A reusable `isHeaders` function
906
+ */
907
+ export function createIsHeaders<T extends object>(): (
908
+ input: Record<string, string | string[] | undefined>,
909
+ ) => T | null;
910
+
911
+ /** @internal */
912
+ export function createIsHeaders<T>(): (
913
+ input: Record<string, string | string[] | undefined>,
914
+ ) => T | null {
915
+ NoTransformConfigurationError("http.createIsHeaders");
916
+ }
917
+
918
+ /**
919
+ * Creates a reusable {@link validateHeaders} function.
920
+ *
921
+ * @author Jeongho Nam - https://github.com/samchon
922
+ * @template T The type of the headers object
923
+ * @throws Compile error
924
+ * @danger You must configure the generic argument `T`
925
+ */
926
+ export function createValidateHeaders(): never;
927
+
928
+ /**
929
+ * Creates a reusable {@link validateHeaders} function.
930
+ *
931
+ * @author Jeongho Nam - https://github.com/samchon
932
+ * @template T The type of the headers object
933
+ * @returns A reusable `validateHeaders` function
934
+ */
935
+ export function createValidateHeaders<T extends object>(): (
936
+ input: Record<string, string | string[] | undefined>,
937
+ ) => IValidation<Resolved<T>>;
938
+
939
+ /** @internal */
940
+ export function createValidateHeaders<T>(): (
941
+ input: Record<string, string | string[] | undefined>,
942
+ ) => IValidation<Resolved<T>> {
943
+ NoTransformConfigurationError("http.createValidateHeaders");
944
+ }
945
+
946
+ /**
947
+ * Creates a reusable {@link parameter} function.
948
+ *
949
+ * @author Jeongho Nam - https://github.com/samchon
950
+ * @template T The type of the parameter value
951
+ * @throws Compile error
952
+ * @danger You must configure the generic argument `T`
953
+ */
954
+ export function createParameter(): never;
955
+
956
+ /**
957
+ * Creates a reusable {@link parameter} function.
958
+ *
959
+ * @author Jeongho Nam - https://github.com/samchon
960
+ * @template T The type of the parameter value
961
+ * @returns A reusable `parameter` function
962
+ */
963
+ export function createParameter<T extends Atomic.Type | null>(): (
964
+ input: string,
965
+ ) => T;
966
+
967
+ /** @internal */
968
+ export function createParameter<T extends Atomic.Type | null>(): (
969
+ input: string,
970
+ ) => T {
971
+ NoTransformConfigurationError("http.createParameter");
972
+ }