typia 7.0.0-dev.20241009-2 → 7.0.0-dev.20241010

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 (151) hide show
  1. package/lib/factories/JsonMetadataFactory.d.ts +5 -1
  2. package/lib/factories/JsonMetadataFactory.js +4 -1
  3. package/lib/factories/JsonMetadataFactory.js.map +1 -1
  4. package/lib/internal/{$httpFormDataReadArray.js → $httpFormdataReadArray.js} +1 -1
  5. package/lib/internal/$httpFormdataReadArray.js.map +1 -0
  6. package/lib/programmers/CheckerProgrammer.js +4 -1
  7. package/lib/programmers/CheckerProgrammer.js.map +1 -1
  8. package/lib/programmers/FeatureProgrammer.d.ts +4 -1
  9. package/lib/programmers/FeatureProgrammer.js +2 -2
  10. package/lib/programmers/FeatureProgrammer.js.map +1 -1
  11. package/lib/programmers/RandomProgrammer.js +12 -9
  12. package/lib/programmers/RandomProgrammer.js.map +1 -1
  13. package/lib/programmers/TypiaProgrammer.js +4 -1
  14. package/lib/programmers/TypiaProgrammer.js.map +1 -1
  15. package/lib/programmers/internal/prune_object_properties.js +3 -2
  16. package/lib/programmers/internal/prune_object_properties.js.map +1 -1
  17. package/lib/programmers/json/JsonAssertParseProgrammer.js +2 -2
  18. package/lib/programmers/json/JsonAssertParseProgrammer.js.map +1 -1
  19. package/lib/programmers/misc/MiscCloneProgrammer.js +4 -1
  20. package/lib/programmers/misc/MiscCloneProgrammer.js.map +1 -1
  21. package/lib/programmers/misc/MiscPruneProgrammer.js +4 -1
  22. package/lib/programmers/misc/MiscPruneProgrammer.js.map +1 -1
  23. package/lib/programmers/notations/NotationGeneralProgrammer.js +4 -1
  24. package/lib/programmers/notations/NotationGeneralProgrammer.js.map +1 -1
  25. package/lib/programmers/protobuf/ProtobufDecodeProgrammer.js +1 -1
  26. package/lib/programmers/protobuf/ProtobufDecodeProgrammer.js.map +1 -1
  27. package/lib/transformers/FileTransformer.js +0 -6
  28. package/lib/transformers/FileTransformer.js.map +1 -1
  29. package/lib/transformers/ImportTransformer.d.ts +4 -1
  30. package/lib/transformers/ImportTransformer.js +34 -30
  31. package/lib/transformers/ImportTransformer.js.map +1 -1
  32. package/package.json +1 -1
  33. package/src/IRandomGenerator.ts +49 -49
  34. package/src/factories/ExpressionFactory.ts +164 -164
  35. package/src/factories/JsonMetadataFactory.ts +25 -15
  36. package/src/factories/LiteralFactory.ts +50 -50
  37. package/src/factories/MetadataCommentTagFactory.ts +650 -650
  38. package/src/functional.ts +750 -750
  39. package/src/http.ts +1042 -1042
  40. package/src/internal/$IProtobufWriter.ts +18 -18
  41. package/src/internal/$ProtobufReader.ts +194 -194
  42. package/src/internal/$ProtobufSizer.ts +151 -151
  43. package/src/internal/$ProtobufWriter.ts +145 -145
  44. package/src/internal/$accessExpressionAsString.ts +46 -46
  45. package/src/internal/$assertGuard.ts +13 -13
  46. package/src/internal/$functionalTypeGuardErrorFactory.ts +4 -4
  47. package/src/internal/$httpFormDataReadBigint.ts +18 -18
  48. package/src/internal/$httpFormDataReadBlob.ts +10 -10
  49. package/src/internal/$httpFormDataReadBoolean.ts +16 -16
  50. package/src/internal/$httpFormDataReadFile.ts +10 -10
  51. package/src/internal/$httpFormDataReadNumber.ts +15 -15
  52. package/src/internal/$httpFormDataReadString.ts +10 -10
  53. package/src/internal/{$httpFormDataReadArray.ts → $httpFormdataReadArray.ts} +4 -4
  54. package/src/internal/$httpHeaderReadBigint.ts +10 -10
  55. package/src/internal/$httpHeaderReadBoolean.ts +8 -8
  56. package/src/internal/$httpHeaderReadNumber.ts +7 -7
  57. package/src/internal/$httpParameterBigint.ts +10 -10
  58. package/src/internal/$httpParameterBoolean.ts +8 -8
  59. package/src/internal/$httpParameterNumber.ts +7 -7
  60. package/src/internal/$httpParameterString.ts +2 -2
  61. package/src/internal/$httpQueryParseURLSearchParams.ts +10 -10
  62. package/src/internal/$httpQueryReadArray.ts +4 -4
  63. package/src/internal/$httpQueryReadBigint.ts +12 -12
  64. package/src/internal/$httpQueryReadBoolean.ts +14 -14
  65. package/src/internal/$httpQueryReadNumber.ts +9 -9
  66. package/src/internal/$httpQueryReadString.ts +4 -4
  67. package/src/internal/$isBetween.ts +2 -2
  68. package/src/internal/$isBigintString.ts +8 -8
  69. package/src/internal/$jsonStringifyNumber.ts +12 -12
  70. package/src/internal/$jsonStringifyRest.ts +3 -3
  71. package/src/internal/$jsonStringifyString.ts +42 -42
  72. package/src/internal/$jsonStringifyTail.ts +2 -2
  73. package/src/internal/$llmApplicationFinalize.ts +18 -18
  74. package/src/internal/$miscCloneAny.ts +48 -48
  75. package/src/internal/$notationAny.ts +37 -37
  76. package/src/internal/$notationCamel.ts +13 -13
  77. package/src/internal/$notationPascal.ts +8 -8
  78. package/src/internal/$notationSnake.ts +43 -43
  79. package/src/internal/$randomArray.ts +21 -21
  80. package/src/internal/$randomBigint.ts +6 -6
  81. package/src/internal/$randomBoolean.ts +1 -1
  82. package/src/internal/$randomFormatByte.ts +3 -3
  83. package/src/internal/$randomFormatDate.ts +18 -18
  84. package/src/internal/$randomFormatDatetime.ts +16 -16
  85. package/src/internal/$randomFormatDuration.ts +27 -27
  86. package/src/internal/$randomFormatEmail.ts +11 -11
  87. package/src/internal/$randomFormatHostname.ts +6 -6
  88. package/src/internal/$randomFormatIdnEmail.ts +3 -3
  89. package/src/internal/$randomFormatIdnHostname.ts +3 -3
  90. package/src/internal/$randomFormatIpv4.ts +11 -11
  91. package/src/internal/$randomFormatIpv6.ts +11 -11
  92. package/src/internal/$randomFormatIri.ts +3 -3
  93. package/src/internal/$randomFormatIriReference.ts +3 -3
  94. package/src/internal/$randomFormatJsonPointer.ts +7 -7
  95. package/src/internal/$randomFormatPassword.ts +8 -8
  96. package/src/internal/$randomFormatRegex.ts +4 -4
  97. package/src/internal/$randomFormatRelativeJsonPointer.ts +8 -8
  98. package/src/internal/$randomFormatTime.ts +14 -14
  99. package/src/internal/$randomFormatUri.ts +3 -3
  100. package/src/internal/$randomFormatUriReference.ts +3 -3
  101. package/src/internal/$randomFormatUriTemplate.ts +3 -3
  102. package/src/internal/$randomFormatUrl.ts +11 -11
  103. package/src/internal/$randomFormatUuid.ts +6 -6
  104. package/src/internal/$randomInteger.ts +47 -47
  105. package/src/internal/$randomNumber.ts +74 -74
  106. package/src/internal/$randomPattern.ts +10 -10
  107. package/src/internal/$randomPick.ts +9 -9
  108. package/src/internal/$randomString.ts +24 -24
  109. package/src/internal/$throwTypeGuardError.ts +5 -5
  110. package/src/internal/$validateReport.ts +13 -13
  111. package/src/internal/private/$__notationCapitalize.ts +2 -2
  112. package/src/internal/private/$__notationUnsnake.ts +24 -24
  113. package/src/json.ts +651 -651
  114. package/src/llm.ts +178 -178
  115. package/src/misc.ts +658 -658
  116. package/src/module.ts +933 -933
  117. package/src/notations.ts +827 -827
  118. package/src/programmers/CheckerProgrammer.ts +4 -1
  119. package/src/programmers/FeatureProgrammer.ts +619 -616
  120. package/src/programmers/RandomProgrammer.ts +24 -16
  121. package/src/programmers/TypiaProgrammer.ts +4 -1
  122. package/src/programmers/functional/FunctionalAssertFunctionProgrammer.ts +153 -153
  123. package/src/programmers/functional/FunctionalAssertParametersProgrammer.ts +125 -125
  124. package/src/programmers/functional/FunctionalAssertReturnProgrammer.ts +115 -115
  125. package/src/programmers/functional/FunctionalValidateFunctionProgrammer.ts +119 -119
  126. package/src/programmers/functional/FunctionalValidateParametersProgrammer.ts +274 -274
  127. package/src/programmers/functional/FunctionalValidateReturnProgrammer.ts +135 -135
  128. package/src/programmers/helpers/FunctionProgrammer.ts +67 -67
  129. package/src/programmers/helpers/RandomJoiner.ts +168 -168
  130. package/src/programmers/helpers/StringifyJoinder.ts +115 -115
  131. package/src/programmers/helpers/disable_function_programmer_declare.ts +32 -32
  132. package/src/programmers/internal/check_dynamic_key.ts +201 -201
  133. package/src/programmers/internal/check_dynamic_properties.ts +208 -208
  134. package/src/programmers/internal/check_object.ts +75 -75
  135. package/src/programmers/internal/feature_object_entries.ts +61 -61
  136. package/src/programmers/internal/prune_object_properties.ts +71 -63
  137. package/src/programmers/json/JsonAssertParseProgrammer.ts +14 -11
  138. package/src/programmers/llm/LlmApplicationProgrammer.ts +235 -235
  139. package/src/programmers/llm/LlmSchemaProgrammer.ts +51 -51
  140. package/src/programmers/misc/MiscCloneProgrammer.ts +4 -1
  141. package/src/programmers/misc/MiscPruneProgrammer.ts +4 -1
  142. package/src/programmers/notations/NotationGeneralProgrammer.ts +4 -1
  143. package/src/programmers/protobuf/ProtobufDecodeProgrammer.ts +1 -1
  144. package/src/protobuf.ts +868 -868
  145. package/src/reflect.ts +57 -57
  146. package/src/transformers/FileTransformer.ts +0 -6
  147. package/src/transformers/ImportTransformer.ts +59 -44
  148. package/src/utils/NamingConvention.ts +94 -94
  149. package/src/utils/StringUtil.ts +16 -16
  150. package/lib/internal/$httpFormDataReadArray.js.map +0 -1
  151. /package/lib/internal/{$httpFormDataReadArray.d.ts → $httpFormdataReadArray.d.ts} +0 -0
package/src/http.ts CHANGED
@@ -1,1042 +1,1042 @@
1
- import { Atomic } from "./typings/Atomic";
2
-
3
- import { IValidation } from "./IValidation";
4
- import { Resolved } from "./Resolved";
5
- import { TypeGuardError } from "./TypeGuardError";
6
-
7
- /* ===========================================================
8
- HTTP
9
- - FORM-DATA
10
- - QUERY
11
- - HEADERS
12
- - PARAMETER
13
- - FACTORY FUNCTIONS
14
- ==============================================================
15
- FORM-DATA
16
- ----------------------------------------------------------- */
17
- /**
18
- * Form data decoder.
19
- *
20
- * `typia.http.formData()` is a function decoding `FormData` instance, with
21
- * automatic type casting to the expected type. When roperty type be defined
22
- * as `boolean` or `Blob` type, `typia.http.formData()` will cast the value to
23
- * the expected type when decoding.
24
- *
25
- * By the way, as `FormData` is not enough to express complex data structures,
26
- * `typia.http.formData()` function has some limitations. If target type `T` is
27
- * not following those restrictions, compilation errors would be occured.
28
- *
29
- * 1. Type `T` must be an object type
30
- * 2. Do not allow dynamic property
31
- * 3. Only `boolean`, `bigint`, `number`, `string`, `Blob`, `File` or their array types are allowed
32
- * 4. By the way, union type never be not allowed
33
- *
34
- * Also, `typia.http.formData()` function does not perform validation about the
35
- * decoded value. Therefore, if you can't sure that input data is following the
36
- * `T` type, it would better to call one of below functions intead.
37
- *
38
- * @template T Expected type of decoded value
39
- * @param input FormData instance
40
- * @returns Decoded form FormData
41
- *
42
- * @author Jeongho Nam - https://github.com/samchon
43
- */
44
- export function formData<T extends object>(input: FormData): Resolved<T>;
45
-
46
- /**
47
- * @internal
48
- */
49
- export function formData(): never {
50
- halt("formData");
51
- }
52
-
53
- /**
54
- * Form data decoder with type assertion.
55
- *
56
- * `typia.http.assertFormData()` is a function decoding `FormData` instance, with
57
- * automatic type casting to the expected type. When roperty type be defined
58
- * as `boolean` or `Blob` type, `typia.http.assertFormData()` will cast the value
59
- * to the expected type when decoding.
60
- *
61
- * Also, after decoding, `typia.http.assertFormData()` performs type assertion to
62
- * the decoded value by combining with {@link assert} function. Therefore, when
63
- * the decoded value is not following the `T` type, {@link TypeGuardError} or
64
- * custom error generated by *errorFactory* would be thrown.
65
- *
66
- * By the way, as `FormData` is not enough to express complex data structures,
67
- * `typia.http.assertFormData()` function has some limitations. If target type `T`
68
- * is not following those restrictions, compilation errors would be occured.
69
- *
70
- * 1. Type `T` must be an object type
71
- * 2. Do not allow dynamic property
72
- * 3. Only `boolean`, `bigint`, `number`, `string`, `Blob`, `File` or their array types are allowed
73
- * 4. By the way, union type never be not allowed
74
- *
75
- * @template T Expected type of decoded value
76
- * @param input FormData instance
77
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
78
- * @returns Decoded form FormData
79
- *
80
- * @author Jeongho Nam - https://github.com/samchon
81
- */
82
- export function assertFormData<T extends object>(
83
- input: FormData,
84
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
85
- ): Resolved<T>;
86
-
87
- /**
88
- * @internal
89
- */
90
- export function assertFormData(): never {
91
- halt("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 roperty type be defined
99
- * as `boolean` or `Blob` type, `typia.http.isFormData()` will cast the value
100
- * to 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` is
108
- * not following those restrictions, compilation errors would be occured.
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 types are allowed
113
- * 4. By the way, union type never be not allowed
114
- *
115
- * @template T Expected type of decoded value
116
- * @param input FormData instance
117
- * @returns Decoded form FormData or `null` value
118
- *
119
- * @author Jeongho Nam - https://github.com/samchon
120
- */
121
- export function isFormData<T extends object>(
122
- input: FormData,
123
- ): Resolved<T> | null;
124
-
125
- /**
126
- * @internal
127
- */
128
- export function isFormData(): never {
129
- halt("isFormData");
130
- }
131
-
132
- /**
133
- * Form data decoder with type validation.
134
- *
135
- * `typia.http.validateFormData()` is a function decoding `FormData` instance,
136
- * with automatic type casting to the expected type. When roperty type be defined
137
- * as `boolean` or `Blob` type, `typia.http.validateFormData()` will cast the
138
- * value to the expected type when decoding.
139
- *
140
- * Also, after decoding, `typia.http.validateFormData()` performs type validation
141
- * to the decoded value by combining with {@link validate} function. Therefore,
142
- * when the decoded value is not following the `T` type,
143
- * {@link IValidation.IFailure} would be returned. Otherwise,
144
- * x@xxxx IValidation.ISuccess} would be returned.
145
- *
146
- * By the way, as `FormData` is not enough to express complex data structures,
147
- * `typia.http.validateFormData()` function has some limitations. If target type
148
- * `T` is not following those restrictions, compilation errors would be occured.
149
- *
150
- * 1. Type `T` must be an object type
151
- * 2. Do not allow dynamic property
152
- * 3. Only `boolean`, `bigint`, `number`, `string`, `Blob`, `File` or their array types are allowed
153
- * 4. By the way, union type never be not allowed
154
- *
155
- * @template T Expected type of decoded value
156
- * @param input FormData instance
157
- * @returns Validation result with decoded form FormData
158
- *
159
- * @author Jeongho Nam - https://github.com/samchon
160
- */
161
- export function validateFormData<T extends object>(
162
- input: FormData,
163
- ): IValidation<Resolved<T>>;
164
-
165
- /**
166
- * @internal
167
- */
168
- export function validateFormData(): never {
169
- halt("validateFormData");
170
- }
171
-
172
- /* -----------------------------------------------------------
173
- QUERY
174
- ----------------------------------------------------------- */
175
- /**
176
- * URL query decoder.
177
- *
178
- * `typia.http.query()` is a function decoding a query string or an `URLSearchParams`
179
- * instance, with automatic type casting to the expected type. When property type be
180
- * defined as `boolean` or `number` type, `typia.http.query()` will cast the value to
181
- * the expected type when decoding.
182
- *
183
- * By the way, as URL query is not enough to express complex data structures,
184
- * `typia.http.query()` function has some limitations. If target type `T` is not
185
- * following those restrictions, compilation errors would be occured.
186
- *
187
- * 1. Type `T` must be an object type
188
- * 2. Do not allow dynamic property
189
- * 3. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
190
- * 4. By the way, union type never be not allowed
191
- *
192
- * Also, `typia.http.query()` function does not perform validation about the decoded
193
- * value. Therefore, if you can't sure that input data is following the `T` type,
194
- * it would better to call one of below functions intead.
195
- *
196
- * - {@link assertQuery}
197
- * - {@link isQuery}
198
- * - {@link validateQuery}
199
- *
200
- * @template T Expected type of decoded value
201
- * @param input Query string or URLSearchParams instance
202
- * @returns Decoded query object
203
- *
204
- * @author Jeongho Nam - https://github.com/samchon
205
- */
206
- export function query<T extends object>(
207
- input: string | URLSearchParams,
208
- ): Resolved<T>;
209
-
210
- /**
211
- * @internal
212
- */
213
- export function query(): never {
214
- halt("query");
215
- }
216
-
217
- /**
218
- * URL query decoder with type assertion.
219
- *
220
- * `typia.http.assertQuery()` is a function decoding a query string or an
221
- * `URLSearchParams` instance, with automatic type casting to the expected type.
222
- * When property type be defined as `boolean` or `number` type,
223
- * `typia.http.assertQuery()` will cast the value to the expected type when decoding.
224
- *
225
- * Also, after decoding, `typia.http.assertQuery()` performs type assertion to the
226
- * decoded value by combining with {@link assert} function. Therefore, when the
227
- * decoded value is not following the `T` type, {@link TypeGuardError} or custom
228
- * error generated by *errorFactory* would be thrown.
229
- *
230
- * By the way, as URL query is not enough to express complex data structures,
231
- * `typia.http.assertQuery()` function has some limitations. If target type `T` is
232
- * notfollowing those restrictions, compilation errors would be occured.
233
- *
234
- * 1. Type `T` must be an object type
235
- * 2. Do not allow dynamic property
236
- * 3. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
237
- * 4. By the way, union type never be not allowed
238
- *
239
- * @template T Expected type of decoded value
240
- * @param input Query string or URLSearchParams instance
241
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
242
- * @returns Decoded query object
243
- *
244
- * @author Jeongho Nam - https://github.com/samchon
245
- */
246
- export function assertQuery<T extends object>(
247
- input: string | URLSearchParams,
248
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
249
- ): Resolved<T>;
250
-
251
- /**
252
- * @internal
253
- */
254
- export function assertQuery(): never {
255
- halt("assertQuery");
256
- }
257
-
258
- /**
259
- * URL query decoder with type checking.
260
- *
261
- * `typia.http.isQuery()` is a function decoding a query string or an
262
- * `URLSearchParams` instance, with automatic type casting to the expected type.
263
- * When property type be defined as `boolean` or `number` type,
264
- * `typia.http.isQuery()` will cast the value to the expected type when decoding.
265
- *
266
- * Also, after decoding, `typia.http.isQuery()` performs type checking to the
267
- * decoded value by combining with {@link is} function. Therefore, when the
268
- * decoded value is not following the `T` type, `null` value would be returned.
269
- *
270
- * By the way, as URL query is not enough to express complex data structures,
271
- * `typia.http.isQuery()` function has some limitations. If target type `T` is
272
- * notfollowing those restrictions, compilation errors would be occured.
273
- *
274
- * 1. Type `T` must be an object type
275
- * 2. Do not allow dynamic property
276
- * 3. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
277
- * 4. By the way, union type never be not allowed
278
- *
279
- * @template T Expected type of decoded value
280
- * @param input Query string or URLSearchParams instance
281
- * @returns Decoded query object or `null` value
282
- *
283
- * @author Jeongho Nam - https://github.com/samchon
284
- */
285
- export function isQuery<T extends object>(
286
- input: string | URLSearchParams,
287
- ): Resolved<T> | null;
288
-
289
- /**
290
- * @internal
291
- */
292
- export function isQuery(): never {
293
- halt("isQuery");
294
- }
295
-
296
- /**
297
- * URL query decoder with type validation.
298
- *
299
- * `typia.http.validateQuery()` is a function decoding a query string or an
300
- * `URLSearchParams` instance, with automatic type casting to the expected type.
301
- * When property type be defined as `boolean` or `number` type,
302
- * `typia.http.validateQuery()` will cast the value to the expected type when decoding.
303
- *
304
- * Also, after decoding, `typia.http.validateQuery()` performs type validation to the
305
- * decoded value by combining with {@link validate} function. Therefore, when the
306
- * decoded value is not following the `T` type, {@link IValidation.IFailure} would
307
- * be returned. Otherwise, {@link IValidation.ISuccess} would be returned.
308
- *
309
- * By the way, as URL query is not enough to express complex data structures,
310
- * `typia.http.validateQuery()` function has some limitations. If target type `T` is
311
- * notfollowing those restrictions, compilation errors would be occured.
312
- *
313
- * 1. Type `T` must be an object type
314
- * 2. Do not allow dynamic property
315
- * 3. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
316
- * 4. By the way, union type never be not allowed
317
- *
318
- * @template T Expected type of decoded value
319
- * @param input Query string or URLSearchParams instance
320
- * @returns Validation result with decoded query object
321
- *
322
- * @author Jeongho Nam - https://github.com/samchon
323
- */
324
- export function validateQuery<T extends object>(
325
- input: string | URLSearchParams,
326
- ): IValidation<Resolved<T>>;
327
-
328
- /**
329
- * @internal
330
- */
331
- export function validateQuery(): never {
332
- halt("validateQuery");
333
- }
334
-
335
- /* -----------------------------------------------------------
336
- HEADERS
337
- ----------------------------------------------------------- */
338
- /**
339
- * Headers decoder (for express and fastify).
340
- *
341
- * `typia.http.headers()` is a function decoding an header instance, with automatic
342
- * type casting to the expected type. When property type be defined as `boolean` or
343
- * `number` type, `typia.http.headers()` will cast the value to the expected type.
344
- *
345
- * By the way, as HTTP headers are not enough to express complex data structures,
346
- * `typia.http.headers()` function has some limitations. If target type `T` is not
347
- * following those restrictions, compilation errors would be occured.
348
- *
349
- * 1. Type `T` must be an object type
350
- * 2. Do not allow dynamic property
351
- * 3. Property key must be lower case
352
- * 4. Property value cannot be `null`, but `undefined` is possible
353
- * 5. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
354
- * 6. By the way, union type never be not allowed
355
- * 7. Property `set-cookie` must be array type
356
- * 8. Those properties cannot be array type
357
- * - age
358
- * - authorization
359
- * - content-length
360
- * - content-type
361
- * - etag
362
- * - expires
363
- * - from
364
- * - host
365
- * - if-modified-since
366
- * - if-unmodified-since
367
- * - last-modified
368
- * - location
369
- * - max-forwards
370
- * - proxy-authorization
371
- * - referer
372
- * - retry-after
373
- * - server
374
- * - user-agent
375
- *
376
- * Also, `typia.http.headers()` function does not perform validation about the decoded
377
- * value. Therefore, if you can't sure that input data is following the `T` type,
378
- * it would better to call one of below functions intead.
379
- *
380
- * - {@link assertHeaders}
381
- * - {@link isHeaders}
382
- * - {@link validateHeaders}
383
- *
384
- * @template T Expected type of decoded value
385
- * @param input Query string or URLSearchParams instance
386
- * @returns Decoded headers object
387
- *
388
- * @author Jeongho Nam - https://github.com/samchon
389
- */
390
- export function headers<T extends object>(
391
- input: Record<string, string | string[] | undefined>,
392
- ): Resolved<T>;
393
-
394
- /**
395
- * @internal
396
- */
397
- export function headers(): never {
398
- halt("headers");
399
- }
400
-
401
- /**
402
- * Headers decoder with type assertion (for express and fastify).
403
- *
404
- * `typia.http.assertHeaders()` is a function decoding an header instance, with
405
- * automatic type casting to the expected type. When property type be defined as
406
- * `boolean` or `number` type, `typia.http.headers()` will cast the value to the
407
- * expected type.
408
- *
409
- * Also, after decoding, `typia.http.assertHeaders()` performs type assertion to the
410
- * decoded value by combining with {@link assert} function. Therefore, when the
411
- * decoded value is not following the `T` type, {@link TypeGuardError} or custom
412
- * error generated by *errorFactory* would be thrown.
413
- *
414
- * By the way, as HTTP headers are not enough to express complex data structures,
415
- * `typia.http.headers()` function has some limitations. If target type `T` is not
416
- * following those restrictions, compilation errors would be occured.
417
- *
418
- * 1. Type `T` must be an object type
419
- * 2. Do not allow dynamic property
420
- * 3. Property key must be lower case
421
- * 4. Property value cannot be `null`, but `undefined` is possible
422
- * 5. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
423
- * 6. By the way, union type never be not allowed
424
- * 7. Property `set-cookie` must be array type
425
- * 8. Those properties cannot be array type
426
- * - age
427
- * - authorization
428
- * - content-length
429
- * - content-type
430
- * - etag
431
- * - expires
432
- * - from
433
- * - host
434
- * - if-modified-since
435
- * - if-unmodified-since
436
- * - last-modified
437
- * - location
438
- * - max-forwards
439
- * - proxy-authorization
440
- * - referer
441
- * - retry-after
442
- * - server
443
- * - user-agent
444
- *
445
- * @template T Expected type of decoded value
446
- * @param input Query string or URLSearchParams instance
447
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
448
- * @returns Decoded headers object
449
- *
450
- * @author Jeongho Nam - https://github.com/samchon
451
- */
452
- export function assertHeaders<T extends object>(
453
- input: Record<string, string | string[] | undefined>,
454
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
455
- ): Resolved<T>;
456
-
457
- /**
458
- * @internal
459
- */
460
- export function assertHeaders(): never {
461
- halt("assertHeaders");
462
- }
463
-
464
- /**
465
- * > You must configure the generic argument `T`.
466
- *
467
- * Headers decoder with type checking (for express and fastify).
468
- *
469
- * `typia.http.isHeaders()` is a function decoding an header instance, with
470
- * automatic type casting to the expected type. When property type be defined as
471
- * `boolean` or `number` type, `typia.http.headers()` will cast the value to the
472
- * expected type.
473
- *
474
- * Also, after decoding, `typia.http.isHeaders()` performs type checking to the
475
- * decoded value by combining with {@link is} function. Therefore, when the
476
- * decoded value is not following the `T` type, `null` value would be returned.
477
- *
478
- * By the way, as HTTP headers are not enough to express complex data structures,
479
- * `typia.http.headers()` function has some limitations. If target type `T` is not
480
- * following those restrictions, compilation errors would be occured.
481
- *
482
- * 1. Type `T` must be an object type
483
- * 2. Do not allow dynamic property
484
- * 3. Property key must be lower case
485
- * 4. Property value cannot be `null`, but `undefined` is possible
486
- * 5. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
487
- * 6. By the way, union type never be not allowed
488
- * 7. Property `set-cookie` must be array type
489
- * 8. Those properties cannot be array type
490
- * - age
491
- * - authorization
492
- * - content-length
493
- * - content-type
494
- * - etag
495
- * - expires
496
- * - from
497
- * - host
498
- * - if-modified-since
499
- * - if-unmodified-since
500
- * - last-modified
501
- * - location
502
- * - max-forwards
503
- * - proxy-authorization
504
- * - referer
505
- * - retry-after
506
- * - server
507
- * - user-agent
508
- *
509
- * @template T Expected type of decoded value
510
- * @param input Query string or URLSearchParams instance
511
- * @returns Decoded headers object or `null` value
512
- *
513
- * @author Jeongho Nam - https://github.com/samchon
514
- */
515
- export function isHeaders<T extends object>(
516
- input: Record<string, string | string[] | undefined>,
517
- ): Resolved<T> | null;
518
-
519
- /**
520
- * @internal
521
- */
522
- export function isHeaders(): never {
523
- halt("isHeaders");
524
- }
525
-
526
- /**
527
- * Headers decoder with type validation (for express and fastify).
528
- *
529
- * `typia.http.validateHeaders()` is a function decoding an header instance, with
530
- * automatic type casting to the expected type. When property type be defined as
531
- * `boolean` or `number` type, `typia.http.headers()` will cast the value to the
532
- * expected type.
533
- *
534
- * Also, after decoding, `typia.http.validateHeaders()` performs type assertion to the
535
- * decoded value by combining with {@link validate} function. Therefore, when the
536
- * decoded value is not following the `T` type, {@link IValidation.IError} would be
537
- * returned. Otherwise, {@link IValidation.ISuccess} be returned.
538
- *
539
- * By the way, as HTTP headers are not enough to express complex data structures,
540
- * `typia.http.headers()` function has some limitations. If target type `T` is not
541
- * following those restrictions, compilation errors would be occured.
542
- *
543
- * 1. Type `T` must be an object type
544
- * 2. Do not allow dynamic property
545
- * 3. Property key must be lower case
546
- * 4. Property value cannot be `null`, but `undefined` is possible
547
- * 5. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
548
- * 6. By the way, union type never be not allowed
549
- * 7. Property `set-cookie` must be array type
550
- * 8. Those properties cannot be array type
551
- * - age
552
- * - authorization
553
- * - content-length
554
- * - content-type
555
- * - etag
556
- * - expires
557
- * - from
558
- * - host
559
- * - if-modified-since
560
- * - if-unmodified-since
561
- * - last-modified
562
- * - location
563
- * - max-forwards
564
- * - proxy-authorization
565
- * - referer
566
- * - retry-after
567
- * - server
568
- * - user-agent
569
- *
570
- * @template T Expected type of decoded value
571
- * @param input Query string or URLSearchParams instance
572
- * @returns Decoded headers object
573
- *
574
- * @author Jeongho Nam - https://github.com/samchon
575
- */
576
- export function validateHeaders<T extends object>(
577
- input: Record<string, string | string[] | undefined>,
578
- ): IValidation<Resolved<T>>;
579
-
580
- /**
581
- * @internal
582
- */
583
- export function validateHeaders(): never {
584
- halt("validateHeaders");
585
- }
586
-
587
- /* -----------------------------------------------------------
588
- PARAMETER
589
- ----------------------------------------------------------- */
590
- /**
591
- * URL path parameter decoder.
592
- *
593
- * `typia.http.parameter()` is a function decoding a path parameter, with automatic
594
- * type casting to the expected type. When type `T` has beeen defined as `boolean` or
595
- * `number` type, `typia.http.parameter()` will cast the value to the expected type.
596
- *
597
- * Also, `typia.http.parameter()` performs type assertion to the decoded value by
598
- * combining with {@link assert} function. Therefore, when the decoded value is not
599
- * following the `T` type, {@link TypeGuardError} would be thrown.
600
- *
601
- * @template T Expected type of decoded value
602
- * @param input Path parameter string
603
- * @returns Decoded path parameter value
604
- */
605
- export function parameter<T extends Atomic.Type | null>(
606
- input: string,
607
- ): Resolved<T>;
608
-
609
- /**
610
- * @internal
611
- */
612
- export function parameter(): never {
613
- halt("parameter");
614
- }
615
-
616
- /* -----------------------------------------------------------
617
- FACTORY FUNCTIONS
618
- ----------------------------------------------------------- */
619
- /**
620
- * Creates a reusable {@link formdata} function.
621
- *
622
- * @danger You must configure the generic argument `T`
623
- * @template T The type of the formdata object
624
- * @throws compile error
625
- *
626
- * @author Jeongho Nam - https://github.com/samchon
627
- */
628
- export function createFormData(): never;
629
-
630
- /**
631
- * Creates a reusable {@link formdata} function.
632
- *
633
- * @template T The type of the formdata object
634
- * @returns A reusable `formdata` function
635
- *
636
- * @author Jeongho Nam - https://github.com/samchon
637
- */
638
- export function createFormData<T extends object>(): (input: FormData) => T;
639
-
640
- /**
641
- * @internal
642
- */
643
- export function createFormData<T>(): (input: FormData) => T {
644
- halt("createFormData");
645
- }
646
-
647
- /**
648
- * Creates a reusable {@link assertFormData} function.
649
- *
650
- * @danger You must configure the generic argument `T`
651
- * @template T The type of the formdata object
652
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
653
- * @throws compile error
654
- *
655
- * @author Jeongho Nam - https://github.com/samchon
656
- */
657
- export function createAssertFormData(
658
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
659
- ): never;
660
-
661
- /**
662
- * Creates a reusable {@link assertFormData} function.
663
- *
664
- * @template T The type of the formdata object
665
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
666
- * @returns A reusable `assertFormData` function
667
- *
668
- * @author Jeongho Nam - https://github.com/samchon
669
- */
670
- export function createAssertFormData<T extends object>(
671
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
672
- ): (input: FormData) => T;
673
-
674
- /**
675
- * @internal
676
- */
677
- export function createAssertFormData<T>(): (input: FormData) => T {
678
- halt("createAssertFormData");
679
- }
680
-
681
- /**
682
- * Creates a reusable {@link isFormData} function.
683
- *
684
- * @danger You must configure the generic argument `T`
685
- * @template T The type of the formdata object
686
- * @throws compile error
687
- *
688
- * @author Jeongho Nam - https://github.com/samchon
689
- */
690
- export function createIsFormData(): never;
691
-
692
- /**
693
- * Creates a reusable {@link isFormData} function.
694
- *
695
- * @template T The type of the formdata object
696
- * @returns A reusable `isFormData` function
697
- *
698
- * @author Jeongho Nam - https://github.com/samchon
699
- */
700
- export function createIsFormData<T extends object>(): (
701
- input: FormData,
702
- ) => T | null;
703
-
704
- /**
705
- * @internal
706
- */
707
- export function createIsFormData<T>(): (input: FormData) => T | null {
708
- halt("createIsFormData");
709
- }
710
-
711
- /**
712
- * Creates a reusable {@link validateFormData} function.
713
- *
714
- * @danger You must configure the generic argument `T`
715
- * @template T The type of the formdata object
716
- * @throws compile error
717
- *
718
- * @author Jeongho Nam - https://github.com/samchon
719
- */
720
- export function createValidateFormData(): never;
721
-
722
- /**
723
- * Creates a reusable {@link validateFormData} function.
724
- *
725
- * @template T The type of the formdata object
726
- * @returns A reusable `validateFormData` function
727
- *
728
- * @author Jeongho Nam - https://github.com/samchon
729
- */
730
- export function createValidateFormData<T extends object>(): (
731
- input: FormData,
732
- ) => IValidation<Resolved<T>>;
733
-
734
- /**
735
- * @internal
736
- */
737
- export function createValidateFormData<T>(): (
738
- input: FormData,
739
- ) => IValidation<Resolved<T>> {
740
- halt("createValidateFormData");
741
- }
742
-
743
- /**
744
- * Creates a reusable {@link query} function.
745
- *
746
- * @danger You must configure the generic argument `T`
747
- * @template T The type of the query object
748
- * @throws compile error
749
- *
750
- * @author Jeongho Nam - https://github.com/samchon
751
- */
752
- export function createQuery(): never;
753
-
754
- /**
755
- * Creates a reusable {@link query} function.
756
- *
757
- * @template T The type of the query object
758
- * @returns A reusable `query` function
759
- *
760
- * @author Jeongho Nam - https://github.com/samchon
761
- */
762
- export function createQuery<T extends object>(): (
763
- input: string | URLSearchParams,
764
- ) => T;
765
-
766
- /**
767
- * @internal
768
- */
769
- export function createQuery<T>(): (input: string | URLSearchParams) => T {
770
- halt("createQuery");
771
- }
772
-
773
- /**
774
- * Creates a reusable {@link assertQuery} function.
775
- *
776
- * @danger You must configure the generic argument `T`
777
- * @template T The type of the query object
778
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
779
- * @throws compile error
780
- *
781
- * @author Jeongho Nam - https://github.com/samchon
782
- */
783
- export function createAssertQuery(
784
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
785
- ): never;
786
-
787
- /**
788
- * Creates a reusable {@link assertQuery} function.
789
- *
790
- * @template T The type of the query object
791
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
792
- * @returns A reusable `assertQuery` function
793
- *
794
- * @author Jeongho Nam - https://github.com/samchon
795
- */
796
- export function createAssertQuery<T extends object>(
797
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
798
- ): (input: string | URLSearchParams) => T;
799
-
800
- /**
801
- * @internal
802
- */
803
- export function createAssertQuery<T>(): (input: string | URLSearchParams) => T {
804
- halt("createAssertQuery");
805
- }
806
-
807
- /**
808
- * Creates a reusable {@link isQuery} function.
809
- *
810
- * @danger You must configure the generic argument `T`
811
- * @template T The type of the query object
812
- * @throws compile error
813
- *
814
- * @author Jeongho Nam - https://github.com/samchon
815
- */
816
- export function createIsQuery(): never;
817
-
818
- /**
819
- * Creates a reusable {@link isQuery} function.
820
- *
821
- * @template T The type of the query object
822
- * @returns A reusable `isQuery` function
823
- *
824
- * @author Jeongho Nam - https://github.com/samchon
825
- */
826
- export function createIsQuery<T extends object>(): (
827
- input: string | URLSearchParams,
828
- ) => T | null;
829
-
830
- /**
831
- * @internal
832
- */
833
- export function createIsQuery<T>(): (
834
- input: string | URLSearchParams,
835
- ) => T | null {
836
- halt("createIsQuery");
837
- }
838
-
839
- /**
840
- * Creates a reusable {@link validateQuery} function.
841
- *
842
- * @danger You must configure the generic argument `T`
843
- * @template T The type of the query object
844
- * @throws compile error
845
- *
846
- * @author Jeongho Nam - https://github.com/samchon
847
- */
848
- export function createValidateQuery(): never;
849
-
850
- /**
851
- * Creates a reusable {@link validateQuery} function.
852
- *
853
- * @template T The type of the query object
854
- * @returns A reusable `validateQuery` function
855
- *
856
- * @author Jeongho Nam - https://github.com/samchon
857
- */
858
- export function createValidateQuery<T extends object>(): (
859
- input: string | URLSearchParams,
860
- ) => IValidation<Resolved<T>>;
861
-
862
- /**
863
- * @internal
864
- */
865
- export function createValidateQuery<T>(): (
866
- input: string | URLSearchParams,
867
- ) => IValidation<Resolved<T>> {
868
- halt("createValidateQuery");
869
- }
870
-
871
- /**
872
- * Creates a reusable {@link headers} function.
873
- *
874
- * @danger You must configure the generic argument `T`
875
- * @template T The type of the headers object
876
- * @throws compile error
877
- *
878
- * @author Jeongho Nam - https://github.com/samchon
879
- */
880
- export function createHeaders(): never;
881
-
882
- /**
883
- * Creates a reusable {@link headers} function.
884
- *
885
- * @template T The type of the headers object
886
- * @returns A reusable `headers` function
887
- *
888
- * @author Jeongho Nam - https://github.com/samchon
889
- */
890
- export function createHeaders<T extends object>(): (
891
- input: Record<string, string | string[] | undefined>,
892
- ) => T;
893
-
894
- /**
895
- * @internal
896
- */
897
- export function createHeaders<T>(): (
898
- input: Record<string, string | string[] | undefined>,
899
- ) => T {
900
- halt("createHeaders");
901
- }
902
-
903
- /**
904
- * Creates a reusable {@link assertHeaders} function.
905
- *
906
- * @danger You must configure the generic argument `T`
907
- * @template T The type of the headers object
908
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
909
- * @throws compile error
910
- *
911
- * @author Jeongho Nam - https://github.com/samchon
912
- */
913
- export function createAssertHeaders(
914
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
915
- ): never;
916
-
917
- /**
918
- * Creates a reusable {@link assertHeaders} function.
919
- *
920
- * @template T The type of the headers object
921
- * @param errorFactory Custom error factory. Default is `TypeGuardError`
922
- * @returns A reusable `assertHeaders` function
923
- *
924
- * @author Jeongho Nam - https://github.com/samchon
925
- */
926
- export function createAssertHeaders<T extends object>(
927
- errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
928
- ): (input: Record<string, string | string[] | undefined>) => T;
929
-
930
- /**
931
- * @internal
932
- */
933
- export function createAssertHeaders<T>(): (
934
- input: Record<string, string | string[] | undefined>,
935
- ) => T {
936
- halt("createAssertHeaders");
937
- }
938
-
939
- /**
940
- * Creates a reusable {@link isHeaders} function.
941
- *
942
- * @danger You must configure the generic argument `T`
943
- * @template T The type of the headers object
944
- * @throws compile error
945
- *
946
- * @author Jeongho Nam - https://github.com/samchon
947
- */
948
- export function createIsHeaders(): never;
949
-
950
- /**
951
- * Creates a reusable {@link isHeaders} function.
952
- *
953
- * @template T The type of the headers object
954
- * @returns A reusable `isHeaders` function
955
- *
956
- * @author Jeongho Nam - https://github.com/samchon
957
- */
958
- export function createIsHeaders<T extends object>(): (
959
- input: Record<string, string | string[] | undefined>,
960
- ) => T | null;
961
-
962
- /**
963
- * @internal
964
- */
965
- export function createIsHeaders<T>(): (
966
- input: Record<string, string | string[] | undefined>,
967
- ) => T | null {
968
- halt("createIsHeaders");
969
- }
970
-
971
- /**
972
- * Creates a reusable {@link validateHeaders} function.
973
- *
974
- * @danger You must configure the generic argument `T`
975
- * @template T The type of the headers object
976
- * @throws compile error
977
- *
978
- * @author Jeongho Nam - https://github.com/samchon
979
- */
980
- export function createValidateHeaders(): never;
981
-
982
- /**
983
- * Creates a reusable {@link validateHeaders} function.
984
- *
985
- * @template T The type of the headers object
986
- * @returns A reusable `validateHeaders` function
987
- *
988
- * @author Jeongho Nam - https://github.com/samchon
989
- */
990
- export function createValidateHeaders<T extends object>(): (
991
- input: Record<string, string | string[] | undefined>,
992
- ) => IValidation<Resolved<T>>;
993
-
994
- /**
995
- * @internal
996
- */
997
- export function createValidateHeaders<T>(): (
998
- input: Record<string, string | string[] | undefined>,
999
- ) => IValidation<Resolved<T>> {
1000
- halt("createValidateHeaders");
1001
- }
1002
-
1003
- /**
1004
- * Creates a reusable {@link parameter} function.
1005
- *
1006
- * @danger You must configure the generic argument `T`
1007
- * @template T The type of the parameter value
1008
- * @throws compile error
1009
- *
1010
- * @author Jeongho Nam - https://github.com/samchon
1011
- */
1012
- export function createParameter(): never;
1013
-
1014
- /**
1015
- * Creates a reusable {@link parameter} function.
1016
- *
1017
- * @template T The type of the parameter value
1018
- * @returns A reusable `parameter` function
1019
- *
1020
- * @author Jeongho Nam - https://github.com/samchon
1021
- */
1022
- export function createParameter<T extends Atomic.Type | null>(): (
1023
- input: string,
1024
- ) => T;
1025
-
1026
- /**
1027
- * @internal
1028
- */
1029
- export function createParameter<T extends Atomic.Type | null>(): (
1030
- input: string,
1031
- ) => T {
1032
- halt("createParameter");
1033
- }
1034
-
1035
- /**
1036
- * @internal
1037
- */
1038
- function halt(name: string): never {
1039
- throw new Error(
1040
- `Error on typia.http.${name}(): no transform has been configured. Read and follow https://typia.io/docs/setup please.`,
1041
- );
1042
- }
1
+ import { Atomic } from "./typings/Atomic";
2
+
3
+ import { IValidation } from "./IValidation";
4
+ import { Resolved } from "./Resolved";
5
+ import { TypeGuardError } from "./TypeGuardError";
6
+
7
+ /* ===========================================================
8
+ HTTP
9
+ - FORM-DATA
10
+ - QUERY
11
+ - HEADERS
12
+ - PARAMETER
13
+ - FACTORY FUNCTIONS
14
+ ==============================================================
15
+ FORM-DATA
16
+ ----------------------------------------------------------- */
17
+ /**
18
+ * Form data decoder.
19
+ *
20
+ * `typia.http.formData()` is a function decoding `FormData` instance, with
21
+ * automatic type casting to the expected type. When roperty type be defined
22
+ * as `boolean` or `Blob` type, `typia.http.formData()` will cast the value to
23
+ * the expected type when decoding.
24
+ *
25
+ * By the way, as `FormData` is not enough to express complex data structures,
26
+ * `typia.http.formData()` function has some limitations. If target type `T` is
27
+ * not following those restrictions, compilation errors would be occured.
28
+ *
29
+ * 1. Type `T` must be an object type
30
+ * 2. Do not allow dynamic property
31
+ * 3. Only `boolean`, `bigint`, `number`, `string`, `Blob`, `File` or their array types are allowed
32
+ * 4. By the way, union type never be not allowed
33
+ *
34
+ * Also, `typia.http.formData()` function does not perform validation about the
35
+ * decoded value. Therefore, if you can't sure that input data is following the
36
+ * `T` type, it would better to call one of below functions intead.
37
+ *
38
+ * @template T Expected type of decoded value
39
+ * @param input FormData instance
40
+ * @returns Decoded form FormData
41
+ *
42
+ * @author Jeongho Nam - https://github.com/samchon
43
+ */
44
+ export function formData<T extends object>(input: FormData): Resolved<T>;
45
+
46
+ /**
47
+ * @internal
48
+ */
49
+ export function formData(): never {
50
+ halt("formData");
51
+ }
52
+
53
+ /**
54
+ * Form data decoder with type assertion.
55
+ *
56
+ * `typia.http.assertFormData()` is a function decoding `FormData` instance, with
57
+ * automatic type casting to the expected type. When roperty type be defined
58
+ * as `boolean` or `Blob` type, `typia.http.assertFormData()` will cast the value
59
+ * to the expected type when decoding.
60
+ *
61
+ * Also, after decoding, `typia.http.assertFormData()` performs type assertion to
62
+ * the decoded value by combining with {@link assert} function. Therefore, when
63
+ * the decoded value is not following the `T` type, {@link TypeGuardError} or
64
+ * custom error generated by *errorFactory* would be thrown.
65
+ *
66
+ * By the way, as `FormData` is not enough to express complex data structures,
67
+ * `typia.http.assertFormData()` function has some limitations. If target type `T`
68
+ * is not following those restrictions, compilation errors would be occured.
69
+ *
70
+ * 1. Type `T` must be an object type
71
+ * 2. Do not allow dynamic property
72
+ * 3. Only `boolean`, `bigint`, `number`, `string`, `Blob`, `File` or their array types are allowed
73
+ * 4. By the way, union type never be not allowed
74
+ *
75
+ * @template T Expected type of decoded value
76
+ * @param input FormData instance
77
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
78
+ * @returns Decoded form FormData
79
+ *
80
+ * @author Jeongho Nam - https://github.com/samchon
81
+ */
82
+ export function assertFormData<T extends object>(
83
+ input: FormData,
84
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
85
+ ): Resolved<T>;
86
+
87
+ /**
88
+ * @internal
89
+ */
90
+ export function assertFormData(): never {
91
+ halt("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 roperty type be defined
99
+ * as `boolean` or `Blob` type, `typia.http.isFormData()` will cast the value
100
+ * to 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` is
108
+ * not following those restrictions, compilation errors would be occured.
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 types are allowed
113
+ * 4. By the way, union type never be not allowed
114
+ *
115
+ * @template T Expected type of decoded value
116
+ * @param input FormData instance
117
+ * @returns Decoded form FormData or `null` value
118
+ *
119
+ * @author Jeongho Nam - https://github.com/samchon
120
+ */
121
+ export function isFormData<T extends object>(
122
+ input: FormData,
123
+ ): Resolved<T> | null;
124
+
125
+ /**
126
+ * @internal
127
+ */
128
+ export function isFormData(): never {
129
+ halt("isFormData");
130
+ }
131
+
132
+ /**
133
+ * Form data decoder with type validation.
134
+ *
135
+ * `typia.http.validateFormData()` is a function decoding `FormData` instance,
136
+ * with automatic type casting to the expected type. When roperty type be defined
137
+ * as `boolean` or `Blob` type, `typia.http.validateFormData()` will cast the
138
+ * value to the expected type when decoding.
139
+ *
140
+ * Also, after decoding, `typia.http.validateFormData()` performs type validation
141
+ * to the decoded value by combining with {@link validate} function. Therefore,
142
+ * when the decoded value is not following the `T` type,
143
+ * {@link IValidation.IFailure} would be returned. Otherwise,
144
+ * x@xxxx IValidation.ISuccess} would be returned.
145
+ *
146
+ * By the way, as `FormData` is not enough to express complex data structures,
147
+ * `typia.http.validateFormData()` function has some limitations. If target type
148
+ * `T` is not following those restrictions, compilation errors would be occured.
149
+ *
150
+ * 1. Type `T` must be an object type
151
+ * 2. Do not allow dynamic property
152
+ * 3. Only `boolean`, `bigint`, `number`, `string`, `Blob`, `File` or their array types are allowed
153
+ * 4. By the way, union type never be not allowed
154
+ *
155
+ * @template T Expected type of decoded value
156
+ * @param input FormData instance
157
+ * @returns Validation result with decoded form FormData
158
+ *
159
+ * @author Jeongho Nam - https://github.com/samchon
160
+ */
161
+ export function validateFormData<T extends object>(
162
+ input: FormData,
163
+ ): IValidation<Resolved<T>>;
164
+
165
+ /**
166
+ * @internal
167
+ */
168
+ export function validateFormData(): never {
169
+ halt("validateFormData");
170
+ }
171
+
172
+ /* -----------------------------------------------------------
173
+ QUERY
174
+ ----------------------------------------------------------- */
175
+ /**
176
+ * URL query decoder.
177
+ *
178
+ * `typia.http.query()` is a function decoding a query string or an `URLSearchParams`
179
+ * instance, with automatic type casting to the expected type. When property type be
180
+ * defined as `boolean` or `number` type, `typia.http.query()` will cast the value to
181
+ * the expected type when decoding.
182
+ *
183
+ * By the way, as URL query is not enough to express complex data structures,
184
+ * `typia.http.query()` function has some limitations. If target type `T` is not
185
+ * following those restrictions, compilation errors would be occured.
186
+ *
187
+ * 1. Type `T` must be an object type
188
+ * 2. Do not allow dynamic property
189
+ * 3. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
190
+ * 4. By the way, union type never be not allowed
191
+ *
192
+ * Also, `typia.http.query()` function does not perform validation about the decoded
193
+ * value. Therefore, if you can't sure that input data is following the `T` type,
194
+ * it would better to call one of below functions intead.
195
+ *
196
+ * - {@link assertQuery}
197
+ * - {@link isQuery}
198
+ * - {@link validateQuery}
199
+ *
200
+ * @template T Expected type of decoded value
201
+ * @param input Query string or URLSearchParams instance
202
+ * @returns Decoded query object
203
+ *
204
+ * @author Jeongho Nam - https://github.com/samchon
205
+ */
206
+ export function query<T extends object>(
207
+ input: string | URLSearchParams,
208
+ ): Resolved<T>;
209
+
210
+ /**
211
+ * @internal
212
+ */
213
+ export function query(): never {
214
+ halt("query");
215
+ }
216
+
217
+ /**
218
+ * URL query decoder with type assertion.
219
+ *
220
+ * `typia.http.assertQuery()` is a function decoding a query string or an
221
+ * `URLSearchParams` instance, with automatic type casting to the expected type.
222
+ * When property type be defined as `boolean` or `number` type,
223
+ * `typia.http.assertQuery()` will cast the value to the expected type when decoding.
224
+ *
225
+ * Also, after decoding, `typia.http.assertQuery()` performs type assertion to the
226
+ * decoded value by combining with {@link assert} function. Therefore, when the
227
+ * decoded value is not following the `T` type, {@link TypeGuardError} or custom
228
+ * error generated by *errorFactory* would be thrown.
229
+ *
230
+ * By the way, as URL query is not enough to express complex data structures,
231
+ * `typia.http.assertQuery()` function has some limitations. If target type `T` is
232
+ * notfollowing those restrictions, compilation errors would be occured.
233
+ *
234
+ * 1. Type `T` must be an object type
235
+ * 2. Do not allow dynamic property
236
+ * 3. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
237
+ * 4. By the way, union type never be not allowed
238
+ *
239
+ * @template T Expected type of decoded value
240
+ * @param input Query string or URLSearchParams instance
241
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
242
+ * @returns Decoded query object
243
+ *
244
+ * @author Jeongho Nam - https://github.com/samchon
245
+ */
246
+ export function assertQuery<T extends object>(
247
+ input: string | URLSearchParams,
248
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
249
+ ): Resolved<T>;
250
+
251
+ /**
252
+ * @internal
253
+ */
254
+ export function assertQuery(): never {
255
+ halt("assertQuery");
256
+ }
257
+
258
+ /**
259
+ * URL query decoder with type checking.
260
+ *
261
+ * `typia.http.isQuery()` is a function decoding a query string or an
262
+ * `URLSearchParams` instance, with automatic type casting to the expected type.
263
+ * When property type be defined as `boolean` or `number` type,
264
+ * `typia.http.isQuery()` will cast the value to the expected type when decoding.
265
+ *
266
+ * Also, after decoding, `typia.http.isQuery()` performs type checking to the
267
+ * decoded value by combining with {@link is} function. Therefore, when the
268
+ * decoded value is not following the `T` type, `null` value would be returned.
269
+ *
270
+ * By the way, as URL query is not enough to express complex data structures,
271
+ * `typia.http.isQuery()` function has some limitations. If target type `T` is
272
+ * notfollowing those restrictions, compilation errors would be occured.
273
+ *
274
+ * 1. Type `T` must be an object type
275
+ * 2. Do not allow dynamic property
276
+ * 3. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
277
+ * 4. By the way, union type never be not allowed
278
+ *
279
+ * @template T Expected type of decoded value
280
+ * @param input Query string or URLSearchParams instance
281
+ * @returns Decoded query object or `null` value
282
+ *
283
+ * @author Jeongho Nam - https://github.com/samchon
284
+ */
285
+ export function isQuery<T extends object>(
286
+ input: string | URLSearchParams,
287
+ ): Resolved<T> | null;
288
+
289
+ /**
290
+ * @internal
291
+ */
292
+ export function isQuery(): never {
293
+ halt("isQuery");
294
+ }
295
+
296
+ /**
297
+ * URL query decoder with type validation.
298
+ *
299
+ * `typia.http.validateQuery()` is a function decoding a query string or an
300
+ * `URLSearchParams` instance, with automatic type casting to the expected type.
301
+ * When property type be defined as `boolean` or `number` type,
302
+ * `typia.http.validateQuery()` will cast the value to the expected type when decoding.
303
+ *
304
+ * Also, after decoding, `typia.http.validateQuery()` performs type validation to the
305
+ * decoded value by combining with {@link validate} function. Therefore, when the
306
+ * decoded value is not following the `T` type, {@link IValidation.IFailure} would
307
+ * be returned. Otherwise, {@link IValidation.ISuccess} would be returned.
308
+ *
309
+ * By the way, as URL query is not enough to express complex data structures,
310
+ * `typia.http.validateQuery()` function has some limitations. If target type `T` is
311
+ * notfollowing those restrictions, compilation errors would be occured.
312
+ *
313
+ * 1. Type `T` must be an object type
314
+ * 2. Do not allow dynamic property
315
+ * 3. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
316
+ * 4. By the way, union type never be not allowed
317
+ *
318
+ * @template T Expected type of decoded value
319
+ * @param input Query string or URLSearchParams instance
320
+ * @returns Validation result with decoded query object
321
+ *
322
+ * @author Jeongho Nam - https://github.com/samchon
323
+ */
324
+ export function validateQuery<T extends object>(
325
+ input: string | URLSearchParams,
326
+ ): IValidation<Resolved<T>>;
327
+
328
+ /**
329
+ * @internal
330
+ */
331
+ export function validateQuery(): never {
332
+ halt("validateQuery");
333
+ }
334
+
335
+ /* -----------------------------------------------------------
336
+ HEADERS
337
+ ----------------------------------------------------------- */
338
+ /**
339
+ * Headers decoder (for express and fastify).
340
+ *
341
+ * `typia.http.headers()` is a function decoding an header instance, with automatic
342
+ * type casting to the expected type. When property type be defined as `boolean` or
343
+ * `number` type, `typia.http.headers()` will cast the value to the expected type.
344
+ *
345
+ * By the way, as HTTP headers are not enough to express complex data structures,
346
+ * `typia.http.headers()` function has some limitations. If target type `T` is not
347
+ * following those restrictions, compilation errors would be occured.
348
+ *
349
+ * 1. Type `T` must be an object type
350
+ * 2. Do not allow dynamic property
351
+ * 3. Property key must be lower case
352
+ * 4. Property value cannot be `null`, but `undefined` is possible
353
+ * 5. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
354
+ * 6. By the way, union type never be not allowed
355
+ * 7. Property `set-cookie` must be array type
356
+ * 8. Those properties cannot be array type
357
+ * - age
358
+ * - authorization
359
+ * - content-length
360
+ * - content-type
361
+ * - etag
362
+ * - expires
363
+ * - from
364
+ * - host
365
+ * - if-modified-since
366
+ * - if-unmodified-since
367
+ * - last-modified
368
+ * - location
369
+ * - max-forwards
370
+ * - proxy-authorization
371
+ * - referer
372
+ * - retry-after
373
+ * - server
374
+ * - user-agent
375
+ *
376
+ * Also, `typia.http.headers()` function does not perform validation about the decoded
377
+ * value. Therefore, if you can't sure that input data is following the `T` type,
378
+ * it would better to call one of below functions intead.
379
+ *
380
+ * - {@link assertHeaders}
381
+ * - {@link isHeaders}
382
+ * - {@link validateHeaders}
383
+ *
384
+ * @template T Expected type of decoded value
385
+ * @param input Query string or URLSearchParams instance
386
+ * @returns Decoded headers object
387
+ *
388
+ * @author Jeongho Nam - https://github.com/samchon
389
+ */
390
+ export function headers<T extends object>(
391
+ input: Record<string, string | string[] | undefined>,
392
+ ): Resolved<T>;
393
+
394
+ /**
395
+ * @internal
396
+ */
397
+ export function headers(): never {
398
+ halt("headers");
399
+ }
400
+
401
+ /**
402
+ * Headers decoder with type assertion (for express and fastify).
403
+ *
404
+ * `typia.http.assertHeaders()` is a function decoding an header instance, with
405
+ * automatic type casting to the expected type. When property type be defined as
406
+ * `boolean` or `number` type, `typia.http.headers()` will cast the value to the
407
+ * expected type.
408
+ *
409
+ * Also, after decoding, `typia.http.assertHeaders()` performs type assertion to the
410
+ * decoded value by combining with {@link assert} function. Therefore, when the
411
+ * decoded value is not following the `T` type, {@link TypeGuardError} or custom
412
+ * error generated by *errorFactory* would be thrown.
413
+ *
414
+ * By the way, as HTTP headers are not enough to express complex data structures,
415
+ * `typia.http.headers()` function has some limitations. If target type `T` is not
416
+ * following those restrictions, compilation errors would be occured.
417
+ *
418
+ * 1. Type `T` must be an object type
419
+ * 2. Do not allow dynamic property
420
+ * 3. Property key must be lower case
421
+ * 4. Property value cannot be `null`, but `undefined` is possible
422
+ * 5. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
423
+ * 6. By the way, union type never be not allowed
424
+ * 7. Property `set-cookie` must be array type
425
+ * 8. Those properties cannot be array type
426
+ * - age
427
+ * - authorization
428
+ * - content-length
429
+ * - content-type
430
+ * - etag
431
+ * - expires
432
+ * - from
433
+ * - host
434
+ * - if-modified-since
435
+ * - if-unmodified-since
436
+ * - last-modified
437
+ * - location
438
+ * - max-forwards
439
+ * - proxy-authorization
440
+ * - referer
441
+ * - retry-after
442
+ * - server
443
+ * - user-agent
444
+ *
445
+ * @template T Expected type of decoded value
446
+ * @param input Query string or URLSearchParams instance
447
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
448
+ * @returns Decoded headers object
449
+ *
450
+ * @author Jeongho Nam - https://github.com/samchon
451
+ */
452
+ export function assertHeaders<T extends object>(
453
+ input: Record<string, string | string[] | undefined>,
454
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
455
+ ): Resolved<T>;
456
+
457
+ /**
458
+ * @internal
459
+ */
460
+ export function assertHeaders(): never {
461
+ halt("assertHeaders");
462
+ }
463
+
464
+ /**
465
+ * > You must configure the generic argument `T`.
466
+ *
467
+ * Headers decoder with type checking (for express and fastify).
468
+ *
469
+ * `typia.http.isHeaders()` is a function decoding an header instance, with
470
+ * automatic type casting to the expected type. When property type be defined as
471
+ * `boolean` or `number` type, `typia.http.headers()` will cast the value to the
472
+ * expected type.
473
+ *
474
+ * Also, after decoding, `typia.http.isHeaders()` performs type checking to the
475
+ * decoded value by combining with {@link is} function. Therefore, when the
476
+ * decoded value is not following the `T` type, `null` value would be returned.
477
+ *
478
+ * By the way, as HTTP headers are not enough to express complex data structures,
479
+ * `typia.http.headers()` function has some limitations. If target type `T` is not
480
+ * following those restrictions, compilation errors would be occured.
481
+ *
482
+ * 1. Type `T` must be an object type
483
+ * 2. Do not allow dynamic property
484
+ * 3. Property key must be lower case
485
+ * 4. Property value cannot be `null`, but `undefined` is possible
486
+ * 5. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
487
+ * 6. By the way, union type never be not allowed
488
+ * 7. Property `set-cookie` must be array type
489
+ * 8. Those properties cannot be array type
490
+ * - age
491
+ * - authorization
492
+ * - content-length
493
+ * - content-type
494
+ * - etag
495
+ * - expires
496
+ * - from
497
+ * - host
498
+ * - if-modified-since
499
+ * - if-unmodified-since
500
+ * - last-modified
501
+ * - location
502
+ * - max-forwards
503
+ * - proxy-authorization
504
+ * - referer
505
+ * - retry-after
506
+ * - server
507
+ * - user-agent
508
+ *
509
+ * @template T Expected type of decoded value
510
+ * @param input Query string or URLSearchParams instance
511
+ * @returns Decoded headers object or `null` value
512
+ *
513
+ * @author Jeongho Nam - https://github.com/samchon
514
+ */
515
+ export function isHeaders<T extends object>(
516
+ input: Record<string, string | string[] | undefined>,
517
+ ): Resolved<T> | null;
518
+
519
+ /**
520
+ * @internal
521
+ */
522
+ export function isHeaders(): never {
523
+ halt("isHeaders");
524
+ }
525
+
526
+ /**
527
+ * Headers decoder with type validation (for express and fastify).
528
+ *
529
+ * `typia.http.validateHeaders()` is a function decoding an header instance, with
530
+ * automatic type casting to the expected type. When property type be defined as
531
+ * `boolean` or `number` type, `typia.http.headers()` will cast the value to the
532
+ * expected type.
533
+ *
534
+ * Also, after decoding, `typia.http.validateHeaders()` performs type assertion to the
535
+ * decoded value by combining with {@link validate} function. Therefore, when the
536
+ * decoded value is not following the `T` type, {@link IValidation.IError} would be
537
+ * returned. Otherwise, {@link IValidation.ISuccess} be returned.
538
+ *
539
+ * By the way, as HTTP headers are not enough to express complex data structures,
540
+ * `typia.http.headers()` function has some limitations. If target type `T` is not
541
+ * following those restrictions, compilation errors would be occured.
542
+ *
543
+ * 1. Type `T` must be an object type
544
+ * 2. Do not allow dynamic property
545
+ * 3. Property key must be lower case
546
+ * 4. Property value cannot be `null`, but `undefined` is possible
547
+ * 5. Only `boolean`, `bigint`, `number`, `string` or their array types are allowed
548
+ * 6. By the way, union type never be not allowed
549
+ * 7. Property `set-cookie` must be array type
550
+ * 8. Those properties cannot be array type
551
+ * - age
552
+ * - authorization
553
+ * - content-length
554
+ * - content-type
555
+ * - etag
556
+ * - expires
557
+ * - from
558
+ * - host
559
+ * - if-modified-since
560
+ * - if-unmodified-since
561
+ * - last-modified
562
+ * - location
563
+ * - max-forwards
564
+ * - proxy-authorization
565
+ * - referer
566
+ * - retry-after
567
+ * - server
568
+ * - user-agent
569
+ *
570
+ * @template T Expected type of decoded value
571
+ * @param input Query string or URLSearchParams instance
572
+ * @returns Decoded headers object
573
+ *
574
+ * @author Jeongho Nam - https://github.com/samchon
575
+ */
576
+ export function validateHeaders<T extends object>(
577
+ input: Record<string, string | string[] | undefined>,
578
+ ): IValidation<Resolved<T>>;
579
+
580
+ /**
581
+ * @internal
582
+ */
583
+ export function validateHeaders(): never {
584
+ halt("validateHeaders");
585
+ }
586
+
587
+ /* -----------------------------------------------------------
588
+ PARAMETER
589
+ ----------------------------------------------------------- */
590
+ /**
591
+ * URL path parameter decoder.
592
+ *
593
+ * `typia.http.parameter()` is a function decoding a path parameter, with automatic
594
+ * type casting to the expected type. When type `T` has beeen defined as `boolean` or
595
+ * `number` type, `typia.http.parameter()` will cast the value to the expected type.
596
+ *
597
+ * Also, `typia.http.parameter()` performs type assertion to the decoded value by
598
+ * combining with {@link assert} function. Therefore, when the decoded value is not
599
+ * following the `T` type, {@link TypeGuardError} would be thrown.
600
+ *
601
+ * @template T Expected type of decoded value
602
+ * @param input Path parameter string
603
+ * @returns Decoded path parameter value
604
+ */
605
+ export function parameter<T extends Atomic.Type | null>(
606
+ input: string,
607
+ ): Resolved<T>;
608
+
609
+ /**
610
+ * @internal
611
+ */
612
+ export function parameter(): never {
613
+ halt("parameter");
614
+ }
615
+
616
+ /* -----------------------------------------------------------
617
+ FACTORY FUNCTIONS
618
+ ----------------------------------------------------------- */
619
+ /**
620
+ * Creates a reusable {@link formdata} function.
621
+ *
622
+ * @danger You must configure the generic argument `T`
623
+ * @template T The type of the formdata object
624
+ * @throws compile error
625
+ *
626
+ * @author Jeongho Nam - https://github.com/samchon
627
+ */
628
+ export function createFormData(): never;
629
+
630
+ /**
631
+ * Creates a reusable {@link formdata} function.
632
+ *
633
+ * @template T The type of the formdata object
634
+ * @returns A reusable `formdata` function
635
+ *
636
+ * @author Jeongho Nam - https://github.com/samchon
637
+ */
638
+ export function createFormData<T extends object>(): (input: FormData) => T;
639
+
640
+ /**
641
+ * @internal
642
+ */
643
+ export function createFormData<T>(): (input: FormData) => T {
644
+ halt("createFormData");
645
+ }
646
+
647
+ /**
648
+ * Creates a reusable {@link assertFormData} function.
649
+ *
650
+ * @danger You must configure the generic argument `T`
651
+ * @template T The type of the formdata object
652
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
653
+ * @throws compile error
654
+ *
655
+ * @author Jeongho Nam - https://github.com/samchon
656
+ */
657
+ export function createAssertFormData(
658
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
659
+ ): never;
660
+
661
+ /**
662
+ * Creates a reusable {@link assertFormData} function.
663
+ *
664
+ * @template T The type of the formdata object
665
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
666
+ * @returns A reusable `assertFormData` function
667
+ *
668
+ * @author Jeongho Nam - https://github.com/samchon
669
+ */
670
+ export function createAssertFormData<T extends object>(
671
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
672
+ ): (input: FormData) => T;
673
+
674
+ /**
675
+ * @internal
676
+ */
677
+ export function createAssertFormData<T>(): (input: FormData) => T {
678
+ halt("createAssertFormData");
679
+ }
680
+
681
+ /**
682
+ * Creates a reusable {@link isFormData} function.
683
+ *
684
+ * @danger You must configure the generic argument `T`
685
+ * @template T The type of the formdata object
686
+ * @throws compile error
687
+ *
688
+ * @author Jeongho Nam - https://github.com/samchon
689
+ */
690
+ export function createIsFormData(): never;
691
+
692
+ /**
693
+ * Creates a reusable {@link isFormData} function.
694
+ *
695
+ * @template T The type of the formdata object
696
+ * @returns A reusable `isFormData` function
697
+ *
698
+ * @author Jeongho Nam - https://github.com/samchon
699
+ */
700
+ export function createIsFormData<T extends object>(): (
701
+ input: FormData,
702
+ ) => T | null;
703
+
704
+ /**
705
+ * @internal
706
+ */
707
+ export function createIsFormData<T>(): (input: FormData) => T | null {
708
+ halt("createIsFormData");
709
+ }
710
+
711
+ /**
712
+ * Creates a reusable {@link validateFormData} function.
713
+ *
714
+ * @danger You must configure the generic argument `T`
715
+ * @template T The type of the formdata object
716
+ * @throws compile error
717
+ *
718
+ * @author Jeongho Nam - https://github.com/samchon
719
+ */
720
+ export function createValidateFormData(): never;
721
+
722
+ /**
723
+ * Creates a reusable {@link validateFormData} function.
724
+ *
725
+ * @template T The type of the formdata object
726
+ * @returns A reusable `validateFormData` function
727
+ *
728
+ * @author Jeongho Nam - https://github.com/samchon
729
+ */
730
+ export function createValidateFormData<T extends object>(): (
731
+ input: FormData,
732
+ ) => IValidation<Resolved<T>>;
733
+
734
+ /**
735
+ * @internal
736
+ */
737
+ export function createValidateFormData<T>(): (
738
+ input: FormData,
739
+ ) => IValidation<Resolved<T>> {
740
+ halt("createValidateFormData");
741
+ }
742
+
743
+ /**
744
+ * Creates a reusable {@link query} function.
745
+ *
746
+ * @danger You must configure the generic argument `T`
747
+ * @template T The type of the query object
748
+ * @throws compile error
749
+ *
750
+ * @author Jeongho Nam - https://github.com/samchon
751
+ */
752
+ export function createQuery(): never;
753
+
754
+ /**
755
+ * Creates a reusable {@link query} function.
756
+ *
757
+ * @template T The type of the query object
758
+ * @returns A reusable `query` function
759
+ *
760
+ * @author Jeongho Nam - https://github.com/samchon
761
+ */
762
+ export function createQuery<T extends object>(): (
763
+ input: string | URLSearchParams,
764
+ ) => T;
765
+
766
+ /**
767
+ * @internal
768
+ */
769
+ export function createQuery<T>(): (input: string | URLSearchParams) => T {
770
+ halt("createQuery");
771
+ }
772
+
773
+ /**
774
+ * Creates a reusable {@link assertQuery} function.
775
+ *
776
+ * @danger You must configure the generic argument `T`
777
+ * @template T The type of the query object
778
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
779
+ * @throws compile error
780
+ *
781
+ * @author Jeongho Nam - https://github.com/samchon
782
+ */
783
+ export function createAssertQuery(
784
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
785
+ ): never;
786
+
787
+ /**
788
+ * Creates a reusable {@link assertQuery} function.
789
+ *
790
+ * @template T The type of the query object
791
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
792
+ * @returns A reusable `assertQuery` function
793
+ *
794
+ * @author Jeongho Nam - https://github.com/samchon
795
+ */
796
+ export function createAssertQuery<T extends object>(
797
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
798
+ ): (input: string | URLSearchParams) => T;
799
+
800
+ /**
801
+ * @internal
802
+ */
803
+ export function createAssertQuery<T>(): (input: string | URLSearchParams) => T {
804
+ halt("createAssertQuery");
805
+ }
806
+
807
+ /**
808
+ * Creates a reusable {@link isQuery} function.
809
+ *
810
+ * @danger You must configure the generic argument `T`
811
+ * @template T The type of the query object
812
+ * @throws compile error
813
+ *
814
+ * @author Jeongho Nam - https://github.com/samchon
815
+ */
816
+ export function createIsQuery(): never;
817
+
818
+ /**
819
+ * Creates a reusable {@link isQuery} function.
820
+ *
821
+ * @template T The type of the query object
822
+ * @returns A reusable `isQuery` function
823
+ *
824
+ * @author Jeongho Nam - https://github.com/samchon
825
+ */
826
+ export function createIsQuery<T extends object>(): (
827
+ input: string | URLSearchParams,
828
+ ) => T | null;
829
+
830
+ /**
831
+ * @internal
832
+ */
833
+ export function createIsQuery<T>(): (
834
+ input: string | URLSearchParams,
835
+ ) => T | null {
836
+ halt("createIsQuery");
837
+ }
838
+
839
+ /**
840
+ * Creates a reusable {@link validateQuery} function.
841
+ *
842
+ * @danger You must configure the generic argument `T`
843
+ * @template T The type of the query object
844
+ * @throws compile error
845
+ *
846
+ * @author Jeongho Nam - https://github.com/samchon
847
+ */
848
+ export function createValidateQuery(): never;
849
+
850
+ /**
851
+ * Creates a reusable {@link validateQuery} function.
852
+ *
853
+ * @template T The type of the query object
854
+ * @returns A reusable `validateQuery` function
855
+ *
856
+ * @author Jeongho Nam - https://github.com/samchon
857
+ */
858
+ export function createValidateQuery<T extends object>(): (
859
+ input: string | URLSearchParams,
860
+ ) => IValidation<Resolved<T>>;
861
+
862
+ /**
863
+ * @internal
864
+ */
865
+ export function createValidateQuery<T>(): (
866
+ input: string | URLSearchParams,
867
+ ) => IValidation<Resolved<T>> {
868
+ halt("createValidateQuery");
869
+ }
870
+
871
+ /**
872
+ * Creates a reusable {@link headers} function.
873
+ *
874
+ * @danger You must configure the generic argument `T`
875
+ * @template T The type of the headers object
876
+ * @throws compile error
877
+ *
878
+ * @author Jeongho Nam - https://github.com/samchon
879
+ */
880
+ export function createHeaders(): never;
881
+
882
+ /**
883
+ * Creates a reusable {@link headers} function.
884
+ *
885
+ * @template T The type of the headers object
886
+ * @returns A reusable `headers` function
887
+ *
888
+ * @author Jeongho Nam - https://github.com/samchon
889
+ */
890
+ export function createHeaders<T extends object>(): (
891
+ input: Record<string, string | string[] | undefined>,
892
+ ) => T;
893
+
894
+ /**
895
+ * @internal
896
+ */
897
+ export function createHeaders<T>(): (
898
+ input: Record<string, string | string[] | undefined>,
899
+ ) => T {
900
+ halt("createHeaders");
901
+ }
902
+
903
+ /**
904
+ * Creates a reusable {@link assertHeaders} function.
905
+ *
906
+ * @danger You must configure the generic argument `T`
907
+ * @template T The type of the headers object
908
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
909
+ * @throws compile error
910
+ *
911
+ * @author Jeongho Nam - https://github.com/samchon
912
+ */
913
+ export function createAssertHeaders(
914
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
915
+ ): never;
916
+
917
+ /**
918
+ * Creates a reusable {@link assertHeaders} function.
919
+ *
920
+ * @template T The type of the headers object
921
+ * @param errorFactory Custom error factory. Default is `TypeGuardError`
922
+ * @returns A reusable `assertHeaders` function
923
+ *
924
+ * @author Jeongho Nam - https://github.com/samchon
925
+ */
926
+ export function createAssertHeaders<T extends object>(
927
+ errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
928
+ ): (input: Record<string, string | string[] | undefined>) => T;
929
+
930
+ /**
931
+ * @internal
932
+ */
933
+ export function createAssertHeaders<T>(): (
934
+ input: Record<string, string | string[] | undefined>,
935
+ ) => T {
936
+ halt("createAssertHeaders");
937
+ }
938
+
939
+ /**
940
+ * Creates a reusable {@link isHeaders} function.
941
+ *
942
+ * @danger You must configure the generic argument `T`
943
+ * @template T The type of the headers object
944
+ * @throws compile error
945
+ *
946
+ * @author Jeongho Nam - https://github.com/samchon
947
+ */
948
+ export function createIsHeaders(): never;
949
+
950
+ /**
951
+ * Creates a reusable {@link isHeaders} function.
952
+ *
953
+ * @template T The type of the headers object
954
+ * @returns A reusable `isHeaders` function
955
+ *
956
+ * @author Jeongho Nam - https://github.com/samchon
957
+ */
958
+ export function createIsHeaders<T extends object>(): (
959
+ input: Record<string, string | string[] | undefined>,
960
+ ) => T | null;
961
+
962
+ /**
963
+ * @internal
964
+ */
965
+ export function createIsHeaders<T>(): (
966
+ input: Record<string, string | string[] | undefined>,
967
+ ) => T | null {
968
+ halt("createIsHeaders");
969
+ }
970
+
971
+ /**
972
+ * Creates a reusable {@link validateHeaders} function.
973
+ *
974
+ * @danger You must configure the generic argument `T`
975
+ * @template T The type of the headers object
976
+ * @throws compile error
977
+ *
978
+ * @author Jeongho Nam - https://github.com/samchon
979
+ */
980
+ export function createValidateHeaders(): never;
981
+
982
+ /**
983
+ * Creates a reusable {@link validateHeaders} function.
984
+ *
985
+ * @template T The type of the headers object
986
+ * @returns A reusable `validateHeaders` function
987
+ *
988
+ * @author Jeongho Nam - https://github.com/samchon
989
+ */
990
+ export function createValidateHeaders<T extends object>(): (
991
+ input: Record<string, string | string[] | undefined>,
992
+ ) => IValidation<Resolved<T>>;
993
+
994
+ /**
995
+ * @internal
996
+ */
997
+ export function createValidateHeaders<T>(): (
998
+ input: Record<string, string | string[] | undefined>,
999
+ ) => IValidation<Resolved<T>> {
1000
+ halt("createValidateHeaders");
1001
+ }
1002
+
1003
+ /**
1004
+ * Creates a reusable {@link parameter} function.
1005
+ *
1006
+ * @danger You must configure the generic argument `T`
1007
+ * @template T The type of the parameter value
1008
+ * @throws compile error
1009
+ *
1010
+ * @author Jeongho Nam - https://github.com/samchon
1011
+ */
1012
+ export function createParameter(): never;
1013
+
1014
+ /**
1015
+ * Creates a reusable {@link parameter} function.
1016
+ *
1017
+ * @template T The type of the parameter value
1018
+ * @returns A reusable `parameter` function
1019
+ *
1020
+ * @author Jeongho Nam - https://github.com/samchon
1021
+ */
1022
+ export function createParameter<T extends Atomic.Type | null>(): (
1023
+ input: string,
1024
+ ) => T;
1025
+
1026
+ /**
1027
+ * @internal
1028
+ */
1029
+ export function createParameter<T extends Atomic.Type | null>(): (
1030
+ input: string,
1031
+ ) => T {
1032
+ halt("createParameter");
1033
+ }
1034
+
1035
+ /**
1036
+ * @internal
1037
+ */
1038
+ function halt(name: string): never {
1039
+ throw new Error(
1040
+ `Error on typia.http.${name}(): no transform has been configured. Read and follow https://typia.io/docs/setup please.`,
1041
+ );
1042
+ }