typia 5.4.2 → 5.4.3
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.
- package/lib/CamelCase.d.ts +1 -1
- package/lib/PascalCase.d.ts +1 -1
- package/lib/Resolved.d.ts +1 -1
- package/lib/SnakeCase.d.ts +1 -1
- package/lib/factories/internal/metadata/iterate_metadata_native.js +20 -21
- package/lib/factories/internal/metadata/iterate_metadata_native.js.map +1 -1
- package/lib/functional/$FormDataReader/$FormDataReader.d.ts +7 -0
- package/lib/functional/$FormDataReader/$FormDataReader.js +80 -0
- package/lib/functional/$FormDataReader/$FormDataReader.js.map +1 -0
- package/lib/functional/$FormDataReader/index.d.ts +1 -0
- package/lib/functional/$FormDataReader/index.js +28 -0
- package/lib/functional/$FormDataReader/index.js.map +1 -0
- package/lib/functional/Namespace/http.d.ts +3 -1
- package/lib/functional/Namespace/http.js +6 -3
- package/lib/functional/Namespace/http.js.map +1 -1
- package/lib/http.d.ts +334 -0
- package/lib/http.js +78 -1
- package/lib/http.js.map +1 -1
- package/lib/programmers/RandomProgrammer.js +18 -0
- package/lib/programmers/RandomProgrammer.js.map +1 -1
- package/lib/programmers/http/HttpAssertFormDataProgrammer.d.ts +6 -0
- package/lib/programmers/http/HttpAssertFormDataProgrammer.js +41 -0
- package/lib/programmers/http/HttpAssertFormDataProgrammer.js.map +1 -0
- package/lib/programmers/http/HttpFormDataProgrammer.d.ts +9 -0
- package/lib/programmers/http/HttpFormDataProgrammer.js +191 -0
- package/lib/programmers/http/HttpFormDataProgrammer.js.map +1 -0
- package/lib/programmers/http/HttpIsFormDataProgrammer.d.ts +6 -0
- package/lib/programmers/http/HttpIsFormDataProgrammer.js +45 -0
- package/lib/programmers/http/HttpIsFormDataProgrammer.js.map +1 -0
- package/lib/programmers/http/HttpIsHeadersProgrammer.js +2 -2
- package/lib/programmers/http/HttpIsHeadersProgrammer.js.map +1 -1
- package/lib/programmers/http/HttpIsQueryProgrammer.js +2 -2
- package/lib/programmers/http/HttpIsQueryProgrammer.js.map +1 -1
- package/lib/programmers/http/HttpValidateFormDataProgrammer.d.ts +6 -0
- package/lib/programmers/http/HttpValidateFormDataProgrammer.js +41 -0
- package/lib/programmers/http/HttpValidateFormDataProgrammer.js.map +1 -0
- package/lib/programmers/http/HttpValidateHeadersProgrammer.js +2 -2
- package/lib/programmers/http/HttpValidateHeadersProgrammer.js.map +1 -1
- package/lib/programmers/http/HttpValidateQueryProgrammer.js +2 -2
- package/lib/programmers/http/HttpValidateQueryProgrammer.js.map +1 -1
- package/lib/programmers/internal/application_native.js +6 -0
- package/lib/programmers/internal/application_native.js.map +1 -1
- package/lib/programmers/json/JsonApplicationProgrammer.d.ts +1 -0
- package/lib/programmers/json/JsonApplicationProgrammer.js +46 -0
- package/lib/programmers/json/JsonApplicationProgrammer.js.map +1 -1
- package/lib/transformers/CallExpressionTransformer.js +19 -0
- package/lib/transformers/CallExpressionTransformer.js.map +1 -1
- package/lib/transformers/features/http/CreateHttpAssertFormDataTransformer.d.ts +4 -0
- package/lib/transformers/features/http/CreateHttpAssertFormDataTransformer.js +12 -0
- package/lib/transformers/features/http/CreateHttpAssertFormDataTransformer.js.map +1 -0
- package/lib/transformers/features/http/CreateHttpFormDataTransformer.d.ts +4 -0
- package/lib/transformers/features/http/CreateHttpFormDataTransformer.js +10 -0
- package/lib/transformers/features/http/CreateHttpFormDataTransformer.js.map +1 -0
- package/lib/transformers/features/http/CreateHttpIsFormDataTransformer.d.ts +4 -0
- package/lib/transformers/features/http/CreateHttpIsFormDataTransformer.js +10 -0
- package/lib/transformers/features/http/CreateHttpIsFormDataTransformer.js.map +1 -0
- package/lib/transformers/features/http/CreateHttpValidateFormDataTransformer.d.ts +4 -0
- package/lib/transformers/features/http/CreateHttpValidateFormDataTransformer.js +12 -0
- package/lib/transformers/features/http/CreateHttpValidateFormDataTransformer.js.map +1 -0
- package/lib/transformers/features/http/HttpAssertFormDataTransformer.d.ts +4 -0
- package/lib/transformers/features/http/HttpAssertFormDataTransformer.js +12 -0
- package/lib/transformers/features/http/HttpAssertFormDataTransformer.js.map +1 -0
- package/lib/transformers/features/http/HttpFormDataTransformer.d.ts +4 -0
- package/lib/transformers/features/http/HttpFormDataTransformer.js +10 -0
- package/lib/transformers/features/http/HttpFormDataTransformer.js.map +1 -0
- package/lib/transformers/features/http/HttpIsFormDataTransformer.d.ts +4 -0
- package/lib/transformers/features/http/HttpIsFormDataTransformer.js +10 -0
- package/lib/transformers/features/http/HttpIsFormDataTransformer.js.map +1 -0
- package/lib/transformers/features/http/HttpValidateFormDataTransformer.d.ts +4 -0
- package/lib/transformers/features/http/HttpValidateFormDataTransformer.js +12 -0
- package/lib/transformers/features/http/HttpValidateFormDataTransformer.js.map +1 -0
- package/lib/transformers/features/json/JsonApplicationTransformer.js +1 -2
- package/lib/transformers/features/json/JsonApplicationTransformer.js.map +1 -1
- package/package.json +1 -1
- package/src/CamelCase.ts +2 -0
- package/src/PascalCase.ts +2 -0
- package/src/Resolved.ts +2 -0
- package/src/SnakeCase.ts +2 -0
- package/src/factories/internal/metadata/iterate_metadata_native.ts +21 -20
- package/src/functional/$FormDataReader/$FormDataReader.ts +77 -0
- package/src/functional/$FormDataReader/index.ts +1 -0
- package/src/functional/Namespace/http.ts +3 -1
- package/src/http.ts +474 -1
- package/src/programmers/RandomProgrammer.ts +44 -0
- package/src/programmers/http/HttpAssertFormDataProgrammer.ts +75 -0
- package/src/programmers/http/HttpFormDataProgrammer.ts +247 -0
- package/src/programmers/http/HttpIsFormDataProgrammer.ts +82 -0
- package/src/programmers/http/HttpIsHeadersProgrammer.ts +2 -2
- package/src/programmers/http/HttpIsQueryProgrammer.ts +2 -2
- package/src/programmers/http/HttpValidateFormDataProgrammer.ts +75 -0
- package/src/programmers/http/HttpValidateHeadersProgrammer.ts +2 -2
- package/src/programmers/http/HttpValidateQueryProgrammer.ts +2 -2
- package/src/programmers/internal/application_native.ts +7 -1
- package/src/programmers/json/JsonApplicationProgrammer.ts +28 -1
- package/src/transformers/CallExpressionTransformer.ts +19 -0
- package/src/transformers/features/http/CreateHttpAssertFormDataTransformer.ts +12 -0
- package/src/transformers/features/http/CreateHttpFormDataTransformer.ts +9 -0
- package/src/transformers/features/http/CreateHttpIsFormDataTransformer.ts +9 -0
- package/src/transformers/features/http/CreateHttpValidateFormDataTransformer.ts +12 -0
- package/src/transformers/features/http/HttpAssertFormDataTransformer.ts +10 -0
- package/src/transformers/features/http/HttpFormDataTransformer.ts +9 -0
- package/src/transformers/features/http/HttpIsFormDataTransformer.ts +9 -0
- package/src/transformers/features/http/HttpValidateFormDataTransformer.ts +10 -0
- package/src/transformers/features/json/JsonApplicationTransformer.ts +1 -2
package/package.json
CHANGED
package/src/CamelCase.ts
CHANGED
package/src/PascalCase.ts
CHANGED
package/src/Resolved.ts
CHANGED
package/src/SnakeCase.ts
CHANGED
|
@@ -110,10 +110,7 @@ const SIMPLES: Map<string, IClassInfo> = new Map([
|
|
|
110
110
|
name,
|
|
111
111
|
return: "string",
|
|
112
112
|
})),
|
|
113
|
-
{
|
|
114
|
-
name: "valueOf",
|
|
115
|
-
return: "number",
|
|
116
|
-
},
|
|
113
|
+
{ name: "valueOf", return: "number" },
|
|
117
114
|
],
|
|
118
115
|
},
|
|
119
116
|
],
|
|
@@ -127,10 +124,7 @@ const SIMPLES: Map<string, IClassInfo> = new Map([
|
|
|
127
124
|
"trim",
|
|
128
125
|
"replace",
|
|
129
126
|
"substring",
|
|
130
|
-
].map((name) => ({
|
|
131
|
-
name,
|
|
132
|
-
return: "string",
|
|
133
|
-
})),
|
|
127
|
+
].map((name) => ({ name, return: "string" })),
|
|
134
128
|
},
|
|
135
129
|
],
|
|
136
130
|
...[
|
|
@@ -148,21 +142,28 @@ const SIMPLES: Map<string, IClassInfo> = new Map([
|
|
|
148
142
|
].map((name) => [name, getBinaryProps(name)] as const),
|
|
149
143
|
...["ArrayBuffer", "SharedArrayBuffer"].map((className) => {
|
|
150
144
|
const info: IClassInfo = {
|
|
151
|
-
methods: [
|
|
152
|
-
|
|
153
|
-
name: "slice",
|
|
154
|
-
return: className,
|
|
155
|
-
},
|
|
156
|
-
],
|
|
157
|
-
properties: [
|
|
158
|
-
{
|
|
159
|
-
name: "byteLength",
|
|
160
|
-
type: "number",
|
|
161
|
-
},
|
|
162
|
-
],
|
|
145
|
+
methods: [{ name: "slice", return: className }],
|
|
146
|
+
properties: [{ name: "byteLength", type: "number" }],
|
|
163
147
|
};
|
|
164
148
|
return [className, info] as const;
|
|
165
149
|
}),
|
|
150
|
+
...["Blob", "File"].map(
|
|
151
|
+
(className) =>
|
|
152
|
+
[
|
|
153
|
+
className,
|
|
154
|
+
{
|
|
155
|
+
methods: [
|
|
156
|
+
{ name: "arrayBuffer", return: "Promise<ArrayBuffer>" },
|
|
157
|
+
{ name: "slice", return: "Blob" },
|
|
158
|
+
{ name: "text", return: "Promise<string>" },
|
|
159
|
+
],
|
|
160
|
+
properties: [
|
|
161
|
+
{ name: "size", type: "number" },
|
|
162
|
+
{ name: "type", type: "string" },
|
|
163
|
+
],
|
|
164
|
+
},
|
|
165
|
+
] satisfies [string, IClassInfo],
|
|
166
|
+
),
|
|
166
167
|
[
|
|
167
168
|
"DataView",
|
|
168
169
|
{
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
export const boolean = (
|
|
2
|
+
input: string | File | null,
|
|
3
|
+
): boolean | null | undefined =>
|
|
4
|
+
input instanceof File
|
|
5
|
+
? (input as any)
|
|
6
|
+
: input === null
|
|
7
|
+
? undefined
|
|
8
|
+
: input === "null"
|
|
9
|
+
? null
|
|
10
|
+
: input.length === 0
|
|
11
|
+
? true
|
|
12
|
+
: input === "true" || input === "1"
|
|
13
|
+
? true
|
|
14
|
+
: input === "false" || input === "0"
|
|
15
|
+
? false
|
|
16
|
+
: (input as any); // wrong type
|
|
17
|
+
|
|
18
|
+
export const number = (
|
|
19
|
+
input: string | File | null,
|
|
20
|
+
): number | null | undefined =>
|
|
21
|
+
input instanceof File
|
|
22
|
+
? (input as any)
|
|
23
|
+
: !!input?.length
|
|
24
|
+
? input === "null"
|
|
25
|
+
? null
|
|
26
|
+
: (toNumber(input) as any)
|
|
27
|
+
: undefined;
|
|
28
|
+
|
|
29
|
+
export const bigint = (
|
|
30
|
+
input: string | File | null,
|
|
31
|
+
): bigint | null | undefined =>
|
|
32
|
+
input instanceof File
|
|
33
|
+
? (input as any)
|
|
34
|
+
: !!input?.length
|
|
35
|
+
? input === "null"
|
|
36
|
+
? null
|
|
37
|
+
: (toBigint(input) as any)
|
|
38
|
+
: undefined;
|
|
39
|
+
|
|
40
|
+
export const string = (
|
|
41
|
+
input: string | File | null,
|
|
42
|
+
): string | null | undefined =>
|
|
43
|
+
input instanceof File
|
|
44
|
+
? (input as any)
|
|
45
|
+
: input === null
|
|
46
|
+
? undefined
|
|
47
|
+
: input === "null"
|
|
48
|
+
? null
|
|
49
|
+
: input;
|
|
50
|
+
|
|
51
|
+
export const array = (input: any[], alternative: null | undefined) =>
|
|
52
|
+
input.length ? input : alternative;
|
|
53
|
+
|
|
54
|
+
export const blob = (input: string | File | null): Blob | null | undefined =>
|
|
55
|
+
file(input);
|
|
56
|
+
|
|
57
|
+
export const file = (input: string | File | null): File | null | undefined =>
|
|
58
|
+
input instanceof File
|
|
59
|
+
? input
|
|
60
|
+
: input === null
|
|
61
|
+
? undefined
|
|
62
|
+
: input === "null"
|
|
63
|
+
? null
|
|
64
|
+
: (input as any);
|
|
65
|
+
|
|
66
|
+
const toNumber = (str: string): number | string => {
|
|
67
|
+
const value: number = Number(str);
|
|
68
|
+
return isNaN(value) ? str : value;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const toBigint = (str: string): bigint | string => {
|
|
72
|
+
try {
|
|
73
|
+
return BigInt(str);
|
|
74
|
+
} catch {
|
|
75
|
+
return str;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as $FormDataReader from "./$FormDataReader";
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { $FormDataReader } from "../$FormDataReader";
|
|
1
2
|
import { $HeadersReader } from "../$HeadersReader";
|
|
2
3
|
import { $ParameterReader } from "../$ParameterReader";
|
|
3
4
|
import { $QueryReader } from "../$QueryReader";
|
|
4
5
|
|
|
5
|
-
export const
|
|
6
|
+
export const formData = () => $FormDataReader;
|
|
6
7
|
export const headers = () => $HeadersReader;
|
|
7
8
|
export const parameter = () => $ParameterReader;
|
|
9
|
+
export const query = () => $QueryReader;
|
package/src/http.ts
CHANGED
|
@@ -7,11 +7,330 @@ import { Resolved } from "./Resolved";
|
|
|
7
7
|
|
|
8
8
|
/* ===========================================================
|
|
9
9
|
HTTP
|
|
10
|
+
- FORM-DATA
|
|
10
11
|
- QUERY
|
|
11
12
|
- HEADERS
|
|
12
13
|
- PARAMETER
|
|
13
14
|
- FACTORY FUNCTIONS
|
|
14
15
|
==============================================================
|
|
16
|
+
FORM-DATA
|
|
17
|
+
----------------------------------------------------------- */
|
|
18
|
+
/**
|
|
19
|
+
* > You must configure the generic argument `T`.
|
|
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 roperty type be defined
|
|
25
|
+
* as `boolean` or `Blob` type, `typia.http.formData()` will cast the value to
|
|
26
|
+
* the 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 occured.
|
|
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 types are allowed
|
|
35
|
+
* 4. By the way, union type never be not allowed
|
|
36
|
+
*
|
|
37
|
+
* Also, `typia.http.formData()` function does not perform validation about the
|
|
38
|
+
* decoded value. Therefore, if you can't sure that input data is following the
|
|
39
|
+
* `T` type, it would better to call one of below functions intead.
|
|
40
|
+
*
|
|
41
|
+
* - {@link assertFormData}
|
|
42
|
+
* - {@link isFormData}
|
|
43
|
+
* - {@link validateFormData}
|
|
44
|
+
*
|
|
45
|
+
* @template T Expected type of decoded value
|
|
46
|
+
* @param input FormData instance
|
|
47
|
+
* @returns Decoded form FormData
|
|
48
|
+
*
|
|
49
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
50
|
+
*/
|
|
51
|
+
function formData(): never;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Form data decoder.
|
|
55
|
+
*
|
|
56
|
+
* `typia.http.formData()` 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.formData()` will cast the value to
|
|
59
|
+
* the expected type when decoding.
|
|
60
|
+
*
|
|
61
|
+
* By the way, as `FormData` is not enough to express complex data structures,
|
|
62
|
+
* `typia.http.formData()` function has some limitations. If target type `T` is
|
|
63
|
+
* not following those restrictions, compilation errors would be occured.
|
|
64
|
+
*
|
|
65
|
+
* 1. Type `T` must be an object type
|
|
66
|
+
* 2. Do not allow dynamic property
|
|
67
|
+
* 3. Only `boolean`, `bigint`, `number`, `string`, `Blob`, `File` or their array types are allowed
|
|
68
|
+
* 4. By the way, union type never be not allowed
|
|
69
|
+
*
|
|
70
|
+
* Also, `typia.http.formData()` function does not perform validation about the
|
|
71
|
+
* decoded value. Therefore, if you can't sure that input data is following the
|
|
72
|
+
* `T` type, it would better to call one of below functions intead.
|
|
73
|
+
*
|
|
74
|
+
* @template T Expected type of decoded value
|
|
75
|
+
* @param input FormData instance
|
|
76
|
+
* @returns Decoded form FormData
|
|
77
|
+
*
|
|
78
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
79
|
+
*/
|
|
80
|
+
function formData<T extends object>(input: FormData): Resolved<T>;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* @internal
|
|
84
|
+
*/
|
|
85
|
+
function formData(): never {
|
|
86
|
+
halt("formData");
|
|
87
|
+
}
|
|
88
|
+
const formDataPure = /** @__PURE__ */ Object.assign<typeof formData, {}>(
|
|
89
|
+
formData,
|
|
90
|
+
/** @__PURE__ */ Namespace.http.formData(),
|
|
91
|
+
);
|
|
92
|
+
export { formDataPure as formData };
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* > You must configure the generic argument `T`.
|
|
96
|
+
*
|
|
97
|
+
* Form data decoder with type assertion.
|
|
98
|
+
*
|
|
99
|
+
* `typia.http.assertFormData()` is a function decoding `FormData` instance, with
|
|
100
|
+
* automatic type casting to the expected type. When roperty type be defined
|
|
101
|
+
* as `boolean` or `Blob` type, `typia.http.assertFormData()` will cast the value
|
|
102
|
+
* to the expected type when decoding.
|
|
103
|
+
*
|
|
104
|
+
* Also, after decoding, `typia.http.assertFormData()` performs type assertion to
|
|
105
|
+
* the decoded value by combining with {@link assert} function. Therefore, when
|
|
106
|
+
* the decoded value is not following the `T` type, {@link TypeGuardError} would
|
|
107
|
+
* be thrown.
|
|
108
|
+
*
|
|
109
|
+
* By the way, as `FormData` is not enough to express complex data structures,
|
|
110
|
+
* `typia.http.assertFormData()` function has some limitations. If target type `T`
|
|
111
|
+
* is not following those restrictions, compilation errors would be occured.
|
|
112
|
+
*
|
|
113
|
+
* 1. Type `T` must be an object type
|
|
114
|
+
* 2. Do not allow dynamic property
|
|
115
|
+
* 3. Only `boolean`, `bigint`, `number`, `string`, `Blob`, `File` or their array types are allowed
|
|
116
|
+
* 4. By the way, union type never be not allowed
|
|
117
|
+
*
|
|
118
|
+
* @template T Expected type of decoded value
|
|
119
|
+
* @param input FormData instance
|
|
120
|
+
* @returns Decoded form FormData
|
|
121
|
+
*
|
|
122
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
123
|
+
*/
|
|
124
|
+
function assertFormData(): never;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Form data decoder with type assertion.
|
|
128
|
+
*
|
|
129
|
+
* `typia.http.assertFormData()` is a function decoding `FormData` instance, with
|
|
130
|
+
* automatic type casting to the expected type. When roperty type be defined
|
|
131
|
+
* as `boolean` or `Blob` type, `typia.http.assertFormData()` will cast the value
|
|
132
|
+
* to the expected type when decoding.
|
|
133
|
+
*
|
|
134
|
+
* Also, after decoding, `typia.http.assertFormData()` performs type assertion to
|
|
135
|
+
* the decoded value by combining with {@link assert} function. Therefore, when
|
|
136
|
+
* the decoded value is not following the `T` type, {@link TypeGuardError} would
|
|
137
|
+
* be thrown.
|
|
138
|
+
*
|
|
139
|
+
* By the way, as `FormData` is not enough to express complex data structures,
|
|
140
|
+
* `typia.http.assertFormData()` function has some limitations. If target type `T`
|
|
141
|
+
* is not following those restrictions, compilation errors would be occured.
|
|
142
|
+
*
|
|
143
|
+
* 1. Type `T` must be an object type
|
|
144
|
+
* 2. Do not allow dynamic property
|
|
145
|
+
* 3. Only `boolean`, `bigint`, `number`, `string`, `Blob`, `File` or their array types are allowed
|
|
146
|
+
* 4. By the way, union type never be not allowed
|
|
147
|
+
*
|
|
148
|
+
* @template T Expected type of decoded value
|
|
149
|
+
* @param input FormData instance
|
|
150
|
+
* @returns Decoded form FormData
|
|
151
|
+
*
|
|
152
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
153
|
+
*/
|
|
154
|
+
function assertFormData<T extends object>(input: FormData): Resolved<T>;
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* @internal
|
|
158
|
+
*/
|
|
159
|
+
function assertFormData(): never {
|
|
160
|
+
halt("assertFormData");
|
|
161
|
+
}
|
|
162
|
+
const assertFormDataPure = /** @__PURE__ */ Object.assign<
|
|
163
|
+
typeof assertFormData,
|
|
164
|
+
{},
|
|
165
|
+
{}
|
|
166
|
+
>(
|
|
167
|
+
assertFormData,
|
|
168
|
+
/** @__PURE__ */ Namespace.http.formData(),
|
|
169
|
+
/** @__PURE__ */ Namespace.assert("http.assertFormData"),
|
|
170
|
+
);
|
|
171
|
+
export { assertFormDataPure as assertFormData };
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* > You must configure the generic argument `T`.
|
|
175
|
+
*
|
|
176
|
+
* Form data decoder with type checking.
|
|
177
|
+
*
|
|
178
|
+
* `typia.http.isFormData()` is a function decoding `FormData` instance, with
|
|
179
|
+
* automatic type casting to the expected type. When roperty type be defined
|
|
180
|
+
* as `boolean` or `Blob` type, `typia.http.isFormData()` will cast the value
|
|
181
|
+
* to the expected type when decoding.
|
|
182
|
+
*
|
|
183
|
+
* Also, after decoding, `typia.http.isFormData()` performs type checking to the
|
|
184
|
+
* decoded value by combining with {@link is} function. Therefore, when the
|
|
185
|
+
* decoded value is not following the `T` type, `null` value would be returned.
|
|
186
|
+
*
|
|
187
|
+
* By the way, as `FormData` is not enough to express complex data structures,
|
|
188
|
+
* `typia.http.isFormData()` function has some limitations. If target type `T` is
|
|
189
|
+
* not following those restrictions, compilation errors would be occured.
|
|
190
|
+
*
|
|
191
|
+
* 1. Type `T` must be an object type
|
|
192
|
+
* 2. Do not allow dynamic property
|
|
193
|
+
* 3. Only `boolean`, `bigint`, `number`, `string`, `Blob`, `File` or their array types are allowed
|
|
194
|
+
* 4. By the way, union type never be not allowed
|
|
195
|
+
*
|
|
196
|
+
* @template T Expected type of decoded value
|
|
197
|
+
* @param input FormData instance
|
|
198
|
+
* @returns Decoded form FormData or `null` value
|
|
199
|
+
*
|
|
200
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
201
|
+
*/
|
|
202
|
+
function isFormData(): never;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Form data decoder with type checking.
|
|
206
|
+
*
|
|
207
|
+
* `typia.http.isFormData()` is a function decoding `FormData` instance, with
|
|
208
|
+
* automatic type casting to the expected type. When roperty type be defined
|
|
209
|
+
* as `boolean` or `Blob` type, `typia.http.isFormData()` will cast the value
|
|
210
|
+
* to the expected type when decoding.
|
|
211
|
+
*
|
|
212
|
+
* Also, after decoding, `typia.http.isFormData()` performs type checking to the
|
|
213
|
+
* decoded value by combining with {@link is} function. Therefore, when the
|
|
214
|
+
* decoded value is not following the `T` type, `null` value would be returned.
|
|
215
|
+
*
|
|
216
|
+
* By the way, as `FormData` is not enough to express complex data structures,
|
|
217
|
+
* `typia.http.isFormData()` function has some limitations. If target type `T` is
|
|
218
|
+
* not following those restrictions, compilation errors would be occured.
|
|
219
|
+
*
|
|
220
|
+
* 1. Type `T` must be an object type
|
|
221
|
+
* 2. Do not allow dynamic property
|
|
222
|
+
* 3. Only `boolean`, `bigint`, `number`, `string`, `Blob`, `File` or their array types are allowed
|
|
223
|
+
* 4. By the way, union type never be not allowed
|
|
224
|
+
*
|
|
225
|
+
* @template T Expected type of decoded value
|
|
226
|
+
* @param input FormData instance
|
|
227
|
+
* @returns Decoded form FormData or `null` value
|
|
228
|
+
*
|
|
229
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
230
|
+
*/
|
|
231
|
+
function isFormData<T extends object>(input: FormData): Resolved<T> | null;
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* @internal
|
|
235
|
+
*/
|
|
236
|
+
function isFormData(): never {
|
|
237
|
+
halt("isFormData");
|
|
238
|
+
}
|
|
239
|
+
const isFormDataPure = /** @__PURE__ */ Object.assign<
|
|
240
|
+
typeof isFormData,
|
|
241
|
+
{},
|
|
242
|
+
{}
|
|
243
|
+
>(
|
|
244
|
+
isFormData,
|
|
245
|
+
/** @__PURE__ */ Namespace.http.formData(),
|
|
246
|
+
/** @__PURE__ */ Namespace.is(),
|
|
247
|
+
);
|
|
248
|
+
export { isFormDataPure as isFormData };
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* > You must configure the generic argument `T`.
|
|
252
|
+
*
|
|
253
|
+
* Form data decoder with type validation.
|
|
254
|
+
*
|
|
255
|
+
* `typia.http.validateFormData()` is a function decoding `FormData` instance,
|
|
256
|
+
* with automatic type casting to the expected type. When roperty type be defined
|
|
257
|
+
* as `boolean` or `Blob` type, `typia.http.validateFormData()` will cast the
|
|
258
|
+
* value to the expected type when decoding.
|
|
259
|
+
*
|
|
260
|
+
* Also, after decoding, `typia.http.validateFormData()` performs type validation
|
|
261
|
+
* to the decoded value by combining with {@link validate} function. Therefore,
|
|
262
|
+
* when the decoded value is not following the `T` type,
|
|
263
|
+
* {@link IValidation.IFailure} would be returned. Otherwise,
|
|
264
|
+
* x@xxxx IValidation.ISuccess} would be returned.
|
|
265
|
+
*
|
|
266
|
+
* By the way, as `FormData` is not enough to express complex data structures,
|
|
267
|
+
* `typia.http.validateFormData()` function has some limitations. If target type
|
|
268
|
+
* `T` is not following those restrictions, compilation errors would be occured.
|
|
269
|
+
*
|
|
270
|
+
* 1. Type `T` must be an object type
|
|
271
|
+
* 2. Do not allow dynamic property
|
|
272
|
+
* 3. Only `boolean`, `bigint`, `number`, `string`, `Blob`, `File` or their array types are allowed
|
|
273
|
+
* 4. By the way, union type never be not allowed
|
|
274
|
+
*
|
|
275
|
+
* @template T Expected type of decoded value
|
|
276
|
+
* @param input FormData instance
|
|
277
|
+
* @returns Validation result with decoded form FormData
|
|
278
|
+
*
|
|
279
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
280
|
+
*/
|
|
281
|
+
function validateFormData(): never;
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Form data decoder with type validation.
|
|
285
|
+
*
|
|
286
|
+
* `typia.http.validateFormData()` is a function decoding `FormData` instance,
|
|
287
|
+
* with automatic type casting to the expected type. When roperty type be defined
|
|
288
|
+
* as `boolean` or `Blob` type, `typia.http.validateFormData()` will cast the
|
|
289
|
+
* value to the expected type when decoding.
|
|
290
|
+
*
|
|
291
|
+
* Also, after decoding, `typia.http.validateFormData()` performs type validation
|
|
292
|
+
* to the decoded value by combining with {@link validate} function. Therefore,
|
|
293
|
+
* when the decoded value is not following the `T` type,
|
|
294
|
+
* {@link IValidation.IFailure} would be returned. Otherwise,
|
|
295
|
+
* x@xxxx IValidation.ISuccess} would be returned.
|
|
296
|
+
*
|
|
297
|
+
* By the way, as `FormData` is not enough to express complex data structures,
|
|
298
|
+
* `typia.http.validateFormData()` function has some limitations. If target type
|
|
299
|
+
* `T` is not following those restrictions, compilation errors would be occured.
|
|
300
|
+
*
|
|
301
|
+
* 1. Type `T` must be an object type
|
|
302
|
+
* 2. Do not allow dynamic property
|
|
303
|
+
* 3. Only `boolean`, `bigint`, `number`, `string`, `Blob`, `File` or their array types are allowed
|
|
304
|
+
* 4. By the way, union type never be not allowed
|
|
305
|
+
*
|
|
306
|
+
* @template T Expected type of decoded value
|
|
307
|
+
* @param input FormData instance
|
|
308
|
+
* @returns Validation result with decoded form FormData
|
|
309
|
+
*
|
|
310
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
311
|
+
*/
|
|
312
|
+
function validateFormData<T extends object>(
|
|
313
|
+
input: FormData,
|
|
314
|
+
): IValidation<Resolved<T>>;
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* @internal
|
|
318
|
+
*/
|
|
319
|
+
function validateFormData(): never {
|
|
320
|
+
halt("validateFormData");
|
|
321
|
+
}
|
|
322
|
+
const validateFormDataPure = /** @__PURE__ */ Object.assign<
|
|
323
|
+
typeof validateFormData,
|
|
324
|
+
{},
|
|
325
|
+
{}
|
|
326
|
+
>(
|
|
327
|
+
validateFormData,
|
|
328
|
+
/** @__PURE__ */ Namespace.http.formData(),
|
|
329
|
+
/** @__PURE__ */ Namespace.validate(),
|
|
330
|
+
);
|
|
331
|
+
export { validateFormDataPure as validateFormData };
|
|
332
|
+
|
|
333
|
+
/* -----------------------------------------------------------
|
|
15
334
|
QUERY
|
|
16
335
|
----------------------------------------------------------- */
|
|
17
336
|
/**
|
|
@@ -164,7 +483,6 @@ function assertQuery<T extends object>(
|
|
|
164
483
|
function assertQuery(): never {
|
|
165
484
|
halt("assertQuery");
|
|
166
485
|
}
|
|
167
|
-
|
|
168
486
|
const assertQueryPure = /** @__PURE__ */ Object.assign<
|
|
169
487
|
typeof assertQuery,
|
|
170
488
|
{},
|
|
@@ -890,6 +1208,161 @@ export { parameterPure as parameter };
|
|
|
890
1208
|
/* -----------------------------------------------------------
|
|
891
1209
|
FACTORY FUNCTIONS
|
|
892
1210
|
----------------------------------------------------------- */
|
|
1211
|
+
/**
|
|
1212
|
+
* Creates a reusable {@link formdata} function.
|
|
1213
|
+
*
|
|
1214
|
+
* @danger You must configure the generic argument `T`
|
|
1215
|
+
* @template T The type of the formdata object
|
|
1216
|
+
* @throws compile error
|
|
1217
|
+
*
|
|
1218
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
1219
|
+
*/
|
|
1220
|
+
function createFormData(): never;
|
|
1221
|
+
|
|
1222
|
+
/**
|
|
1223
|
+
* Creates a reusable {@link formdata} function.
|
|
1224
|
+
*
|
|
1225
|
+
* @template T The type of the formdata object
|
|
1226
|
+
* @returns A reusable `formdata` function
|
|
1227
|
+
*
|
|
1228
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
1229
|
+
*/
|
|
1230
|
+
function createFormData<T extends object>(): (input: FormData) => T;
|
|
1231
|
+
|
|
1232
|
+
/**
|
|
1233
|
+
* @internal
|
|
1234
|
+
*/
|
|
1235
|
+
function createFormData<T>(): (input: FormData) => T {
|
|
1236
|
+
halt("createFormData");
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
const createFormDataPure = /** @__PURE__ */ Object.assign<
|
|
1240
|
+
typeof createFormData,
|
|
1241
|
+
{}
|
|
1242
|
+
>(createFormData, /** @__PURE__ */ Namespace.http.formData());
|
|
1243
|
+
export { createFormDataPure as createFormData };
|
|
1244
|
+
|
|
1245
|
+
/**
|
|
1246
|
+
* Creates a reusable {@link assertFormData} function.
|
|
1247
|
+
*
|
|
1248
|
+
* @danger You must configure the generic argument `T`
|
|
1249
|
+
* @template T The type of the formdata object
|
|
1250
|
+
* @throws compile error
|
|
1251
|
+
*
|
|
1252
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
1253
|
+
*/
|
|
1254
|
+
function createAssertFormData(): never;
|
|
1255
|
+
|
|
1256
|
+
/**
|
|
1257
|
+
* Creates a reusable {@link assertFormData} function.
|
|
1258
|
+
*
|
|
1259
|
+
* @template T The type of the formdata object
|
|
1260
|
+
* @returns A reusable `assertFormData` function
|
|
1261
|
+
*
|
|
1262
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
1263
|
+
*/
|
|
1264
|
+
function createAssertFormData<T extends object>(): (input: FormData) => T;
|
|
1265
|
+
|
|
1266
|
+
/**
|
|
1267
|
+
* @internal
|
|
1268
|
+
*/
|
|
1269
|
+
function createAssertFormData<T>(): (input: FormData) => T {
|
|
1270
|
+
halt("createAssertFormData");
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
const createAssertFormDataPure = /** @__PURE__ */ Object.assign<
|
|
1274
|
+
typeof createAssertFormData,
|
|
1275
|
+
{},
|
|
1276
|
+
{}
|
|
1277
|
+
>(
|
|
1278
|
+
createAssertFormData,
|
|
1279
|
+
/** @__PURE__ */ Namespace.http.formData(),
|
|
1280
|
+
/** @__PURE__ */ Namespace.assert("http.createAssertFormData"),
|
|
1281
|
+
);
|
|
1282
|
+
export { createAssertFormDataPure as createAssertFormData };
|
|
1283
|
+
|
|
1284
|
+
/**
|
|
1285
|
+
* Creates a reusable {@link isFormData} function.
|
|
1286
|
+
*
|
|
1287
|
+
* @danger You must configure the generic argument `T`
|
|
1288
|
+
* @template T The type of the formdata object
|
|
1289
|
+
* @throws compile error
|
|
1290
|
+
*
|
|
1291
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
1292
|
+
*/
|
|
1293
|
+
function createIsFormData(): never;
|
|
1294
|
+
|
|
1295
|
+
/**
|
|
1296
|
+
* Creates a reusable {@link isFormData} function.
|
|
1297
|
+
*
|
|
1298
|
+
* @template T The type of the formdata object
|
|
1299
|
+
* @returns A reusable `isFormData` function
|
|
1300
|
+
*
|
|
1301
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
1302
|
+
*/
|
|
1303
|
+
function createIsFormData<T extends object>(): (input: FormData) => T | null;
|
|
1304
|
+
|
|
1305
|
+
/**
|
|
1306
|
+
* @internal
|
|
1307
|
+
*/
|
|
1308
|
+
function createIsFormData<T>(): (input: FormData) => T | null {
|
|
1309
|
+
halt("createIsFormData");
|
|
1310
|
+
}
|
|
1311
|
+
|
|
1312
|
+
const createIsFormDataPure = /** @__PURE__ */ Object.assign<
|
|
1313
|
+
typeof createIsFormData,
|
|
1314
|
+
{},
|
|
1315
|
+
{}
|
|
1316
|
+
>(
|
|
1317
|
+
createIsFormData,
|
|
1318
|
+
/** @__PURE__ */ Namespace.http.formData(),
|
|
1319
|
+
/** @__PURE__ */ Namespace.is(),
|
|
1320
|
+
);
|
|
1321
|
+
export { createIsFormDataPure as createIsFormData };
|
|
1322
|
+
|
|
1323
|
+
/**
|
|
1324
|
+
* Creates a reusable {@link validateFormData} function.
|
|
1325
|
+
*
|
|
1326
|
+
* @danger You must configure the generic argument `T`
|
|
1327
|
+
* @template T The type of the formdata object
|
|
1328
|
+
* @throws compile error
|
|
1329
|
+
*
|
|
1330
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
1331
|
+
*/
|
|
1332
|
+
function createValidateFormData(): never;
|
|
1333
|
+
|
|
1334
|
+
/**
|
|
1335
|
+
* Creates a reusable {@link validateFormData} function.
|
|
1336
|
+
*
|
|
1337
|
+
* @template T The type of the formdata object
|
|
1338
|
+
* @returns A reusable `validateFormData` function
|
|
1339
|
+
*
|
|
1340
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
1341
|
+
*/
|
|
1342
|
+
function createValidateFormData<T extends object>(): (
|
|
1343
|
+
input: FormData,
|
|
1344
|
+
) => IValidation<Resolved<T>>;
|
|
1345
|
+
|
|
1346
|
+
/**
|
|
1347
|
+
* @internal
|
|
1348
|
+
*/
|
|
1349
|
+
function createValidateFormData<T>(): (
|
|
1350
|
+
input: FormData,
|
|
1351
|
+
) => IValidation<Resolved<T>> {
|
|
1352
|
+
halt("createValidateFormData");
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1355
|
+
const createValidateFormDataPure = /** @__PURE__ */ Object.assign<
|
|
1356
|
+
typeof createValidateFormData,
|
|
1357
|
+
{},
|
|
1358
|
+
{}
|
|
1359
|
+
>(
|
|
1360
|
+
createValidateFormData,
|
|
1361
|
+
/** @__PURE__ */ Namespace.http.formData(),
|
|
1362
|
+
/** @__PURE__ */ Namespace.validate(),
|
|
1363
|
+
);
|
|
1364
|
+
export { createValidateFormDataPure as createValidateFormData };
|
|
1365
|
+
|
|
893
1366
|
/**
|
|
894
1367
|
* Creates a reusable {@link query} function.
|
|
895
1368
|
*
|