typia 5.1.0-dev.20230924 → 5.1.0-dev.20230926
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/README.md +1 -1
- package/lib/functional/$HeadersReader.d.ts +3 -3
- package/lib/functional/$HeadersReader.js +21 -3
- package/lib/functional/$HeadersReader.js.map +1 -1
- package/lib/functional/$ParameterReader.d.ts +6 -0
- package/lib/functional/$ParameterReader.js +35 -0
- package/lib/functional/$ParameterReader.js.map +1 -0
- package/lib/functional/$QueryReader.js +22 -2
- package/lib/functional/$QueryReader.js.map +1 -1
- package/lib/functional/Namespace.js +2 -0
- package/lib/functional/Namespace.js.map +1 -1
- package/lib/http.d.ts +2 -2
- package/lib/http.js +2 -0
- package/lib/http.js.map +1 -1
- package/lib/programmers/http/HttpHeadersProgrammer.js +36 -50
- package/lib/programmers/http/HttpHeadersProgrammer.js.map +1 -1
- package/lib/programmers/http/HttpParameterProgrammer.js +10 -29
- package/lib/programmers/http/HttpParameterProgrammer.js.map +1 -1
- package/lib/programmers/http/HttpQueryProgrammer.js +16 -12
- package/lib/programmers/http/HttpQueryProgrammer.js.map +1 -1
- package/package.json +1 -1
- package/src/factories/MetadataCollection.ts +274 -274
- package/src/functional/$HeadersReader.ts +28 -9
- package/src/functional/$ParameterReader.ts +31 -0
- package/src/functional/$QueryReader.ts +53 -32
- package/src/functional/Namespace.ts +2 -0
- package/src/http.ts +1149 -1141
- package/src/programmers/helpers/HttpMetadataUtil.ts +21 -21
- package/src/programmers/http/HttpAssertHeadersProgrammer.ts +77 -77
- package/src/programmers/http/HttpAssertQueryProgrammer.ts +77 -77
- package/src/programmers/http/HttpHeadersProgrammer.ts +320 -321
- package/src/programmers/http/HttpIsHeadersProgrammer.ts +87 -87
- package/src/programmers/http/HttpIsQueryProgrammer.ts +87 -87
- package/src/programmers/http/HttpParameterProgrammer.ts +104 -168
- package/src/programmers/http/HttpQueryProgrammer.ts +286 -267
- package/src/programmers/http/HttpValidateHeadersProgrammer.ts +77 -77
- package/src/programmers/http/HttpValidateQueryProgrammer.ts +77 -77
- package/src/programmers/protobuf/ProtobufEncodeProgrammer.ts +0 -1
- package/src/transformers/features/http/CreateHttpAssertHeadersTransformer.ts +12 -12
- package/src/transformers/features/http/CreateHttpAssertQueryTransformer.ts +12 -12
- package/src/transformers/features/http/CreateHttpHeadersTransformer.ts +9 -9
- package/src/transformers/features/http/CreateHttpIsHeadersTransformer.ts +9 -9
- package/src/transformers/features/http/CreateHttpIsQueryTransformer.ts +9 -9
- package/src/transformers/features/http/CreateHttpParameterTransformer.ts +9 -9
- package/src/transformers/features/http/CreateHttpQueryTransformer.ts +9 -9
- package/src/transformers/features/http/CreateHttpValidateHeadersTransformer copy.ts +12 -12
- package/src/transformers/features/http/CreateHttpValidateQueryTransformer.ts +12 -12
- package/src/transformers/features/http/HttpAssertHeadersTransformer.ts +10 -10
- package/src/transformers/features/http/HttpAssertQueryTransformer.ts +10 -10
- package/src/transformers/features/http/HttpHeadersTransformer.ts +9 -9
- package/src/transformers/features/http/HttpIsHeadersTransformer.ts +9 -9
- package/src/transformers/features/http/HttpIsQueryTransformer.ts +9 -9
- package/src/transformers/features/http/HttpParameterTransformer.ts +9 -9
- package/src/transformers/features/http/HttpQueryTransformer.ts +9 -9
- package/src/transformers/features/http/HttpValidateHeadersTransformer.ts +10 -10
- package/src/transformers/features/http/HttpValidateQueryTransformer.ts +10 -10
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { Metadata } from "../../schemas/metadata/Metadata";
|
|
2
|
-
|
|
3
|
-
export namespace HttpMetadataUtil {
|
|
4
|
-
export const atomics = (
|
|
5
|
-
meta: Metadata,
|
|
6
|
-
): Set<"boolean" | "bigint" | "number" | "string"> =>
|
|
7
|
-
new Set([
|
|
8
|
-
...meta.atomics.map((a) => a.type),
|
|
9
|
-
...meta.constants.map((c) => c.type),
|
|
10
|
-
...(meta.templates.length ? (["string"] as const) : []),
|
|
11
|
-
]);
|
|
12
|
-
|
|
13
|
-
export const isUnion = (meta: Metadata): boolean =>
|
|
14
|
-
atomics(meta).size +
|
|
15
|
-
meta.arrays.length +
|
|
16
|
-
meta.tuples.length +
|
|
17
|
-
meta.natives.length +
|
|
18
|
-
meta.maps.length +
|
|
19
|
-
meta.objects.length >
|
|
20
|
-
1;
|
|
21
|
-
}
|
|
1
|
+
import { Metadata } from "../../schemas/metadata/Metadata";
|
|
2
|
+
|
|
3
|
+
export namespace HttpMetadataUtil {
|
|
4
|
+
export const atomics = (
|
|
5
|
+
meta: Metadata,
|
|
6
|
+
): Set<"boolean" | "bigint" | "number" | "string"> =>
|
|
7
|
+
new Set([
|
|
8
|
+
...meta.atomics.map((a) => a.type),
|
|
9
|
+
...meta.constants.map((c) => c.type),
|
|
10
|
+
...(meta.templates.length ? (["string"] as const) : []),
|
|
11
|
+
]);
|
|
12
|
+
|
|
13
|
+
export const isUnion = (meta: Metadata): boolean =>
|
|
14
|
+
atomics(meta).size +
|
|
15
|
+
meta.arrays.length +
|
|
16
|
+
meta.tuples.length +
|
|
17
|
+
meta.natives.length +
|
|
18
|
+
meta.maps.length +
|
|
19
|
+
meta.objects.length >
|
|
20
|
+
1;
|
|
21
|
+
}
|
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
|
-
import { IdentifierFactory } from "../../factories/IdentifierFactory";
|
|
4
|
-
import { StatementFactory } from "../../factories/StatementFactory";
|
|
5
|
-
import { TypeFactory } from "../../factories/TypeFactory";
|
|
6
|
-
|
|
7
|
-
import { IProject } from "../../transformers/IProject";
|
|
8
|
-
|
|
9
|
-
import { AssertProgrammer } from "../AssertProgrammer";
|
|
10
|
-
import { HttpHeadersProgrammer } from "./HttpHeadersProgrammer";
|
|
11
|
-
|
|
12
|
-
export namespace HttpAssertHeadersProgrammer {
|
|
13
|
-
export const write =
|
|
14
|
-
(project: IProject) =>
|
|
15
|
-
(modulo: ts.LeftHandSideExpression) =>
|
|
16
|
-
(type: ts.Type, name?: string): ts.ArrowFunction =>
|
|
17
|
-
ts.factory.createArrowFunction(
|
|
18
|
-
undefined,
|
|
19
|
-
undefined,
|
|
20
|
-
[
|
|
21
|
-
IdentifierFactory.parameter(
|
|
22
|
-
"input",
|
|
23
|
-
ts.factory.createTypeReferenceNode(
|
|
24
|
-
HttpHeadersProgrammer.INPUT_TYPE,
|
|
25
|
-
),
|
|
26
|
-
),
|
|
27
|
-
],
|
|
28
|
-
ts.factory.createTypeReferenceNode(
|
|
29
|
-
`typia.Resolved<${
|
|
30
|
-
name ?? TypeFactory.getFullName(project.checker)(type)
|
|
31
|
-
}>`,
|
|
32
|
-
),
|
|
33
|
-
undefined,
|
|
34
|
-
ts.factory.createBlock([
|
|
35
|
-
StatementFactory.constant(
|
|
36
|
-
"decode",
|
|
37
|
-
HttpHeadersProgrammer.write({
|
|
38
|
-
...project,
|
|
39
|
-
options: {
|
|
40
|
-
...project.options,
|
|
41
|
-
functional: false,
|
|
42
|
-
numeric: false,
|
|
43
|
-
},
|
|
44
|
-
})(modulo)(type, name),
|
|
45
|
-
),
|
|
46
|
-
StatementFactory.constant(
|
|
47
|
-
"assert",
|
|
48
|
-
AssertProgrammer.write({
|
|
49
|
-
...project,
|
|
50
|
-
options: {
|
|
51
|
-
...project.options,
|
|
52
|
-
functional: false,
|
|
53
|
-
numeric: false,
|
|
54
|
-
},
|
|
55
|
-
})(modulo)(false)(type, name),
|
|
56
|
-
),
|
|
57
|
-
StatementFactory.constant(
|
|
58
|
-
"output",
|
|
59
|
-
ts.factory.createCallExpression(
|
|
60
|
-
ts.factory.createIdentifier("decode"),
|
|
61
|
-
undefined,
|
|
62
|
-
[ts.factory.createIdentifier("input")],
|
|
63
|
-
),
|
|
64
|
-
),
|
|
65
|
-
ts.factory.createReturnStatement(
|
|
66
|
-
ts.factory.createAsExpression(
|
|
67
|
-
ts.factory.createCallExpression(
|
|
68
|
-
ts.factory.createIdentifier("assert"),
|
|
69
|
-
undefined,
|
|
70
|
-
[ts.factory.createIdentifier("output")],
|
|
71
|
-
),
|
|
72
|
-
TypeFactory.keyword("any"),
|
|
73
|
-
),
|
|
74
|
-
),
|
|
75
|
-
]),
|
|
76
|
-
);
|
|
77
|
-
}
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
|
|
3
|
+
import { IdentifierFactory } from "../../factories/IdentifierFactory";
|
|
4
|
+
import { StatementFactory } from "../../factories/StatementFactory";
|
|
5
|
+
import { TypeFactory } from "../../factories/TypeFactory";
|
|
6
|
+
|
|
7
|
+
import { IProject } from "../../transformers/IProject";
|
|
8
|
+
|
|
9
|
+
import { AssertProgrammer } from "../AssertProgrammer";
|
|
10
|
+
import { HttpHeadersProgrammer } from "./HttpHeadersProgrammer";
|
|
11
|
+
|
|
12
|
+
export namespace HttpAssertHeadersProgrammer {
|
|
13
|
+
export const write =
|
|
14
|
+
(project: IProject) =>
|
|
15
|
+
(modulo: ts.LeftHandSideExpression) =>
|
|
16
|
+
(type: ts.Type, name?: string): ts.ArrowFunction =>
|
|
17
|
+
ts.factory.createArrowFunction(
|
|
18
|
+
undefined,
|
|
19
|
+
undefined,
|
|
20
|
+
[
|
|
21
|
+
IdentifierFactory.parameter(
|
|
22
|
+
"input",
|
|
23
|
+
ts.factory.createTypeReferenceNode(
|
|
24
|
+
HttpHeadersProgrammer.INPUT_TYPE,
|
|
25
|
+
),
|
|
26
|
+
),
|
|
27
|
+
],
|
|
28
|
+
ts.factory.createTypeReferenceNode(
|
|
29
|
+
`typia.Resolved<${
|
|
30
|
+
name ?? TypeFactory.getFullName(project.checker)(type)
|
|
31
|
+
}>`,
|
|
32
|
+
),
|
|
33
|
+
undefined,
|
|
34
|
+
ts.factory.createBlock([
|
|
35
|
+
StatementFactory.constant(
|
|
36
|
+
"decode",
|
|
37
|
+
HttpHeadersProgrammer.write({
|
|
38
|
+
...project,
|
|
39
|
+
options: {
|
|
40
|
+
...project.options,
|
|
41
|
+
functional: false,
|
|
42
|
+
numeric: false,
|
|
43
|
+
},
|
|
44
|
+
})(modulo)(type, name),
|
|
45
|
+
),
|
|
46
|
+
StatementFactory.constant(
|
|
47
|
+
"assert",
|
|
48
|
+
AssertProgrammer.write({
|
|
49
|
+
...project,
|
|
50
|
+
options: {
|
|
51
|
+
...project.options,
|
|
52
|
+
functional: false,
|
|
53
|
+
numeric: false,
|
|
54
|
+
},
|
|
55
|
+
})(modulo)(false)(type, name),
|
|
56
|
+
),
|
|
57
|
+
StatementFactory.constant(
|
|
58
|
+
"output",
|
|
59
|
+
ts.factory.createCallExpression(
|
|
60
|
+
ts.factory.createIdentifier("decode"),
|
|
61
|
+
undefined,
|
|
62
|
+
[ts.factory.createIdentifier("input")],
|
|
63
|
+
),
|
|
64
|
+
),
|
|
65
|
+
ts.factory.createReturnStatement(
|
|
66
|
+
ts.factory.createAsExpression(
|
|
67
|
+
ts.factory.createCallExpression(
|
|
68
|
+
ts.factory.createIdentifier("assert"),
|
|
69
|
+
undefined,
|
|
70
|
+
[ts.factory.createIdentifier("output")],
|
|
71
|
+
),
|
|
72
|
+
TypeFactory.keyword("any"),
|
|
73
|
+
),
|
|
74
|
+
),
|
|
75
|
+
]),
|
|
76
|
+
);
|
|
77
|
+
}
|
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
|
-
import { IdentifierFactory } from "../../factories/IdentifierFactory";
|
|
4
|
-
import { StatementFactory } from "../../factories/StatementFactory";
|
|
5
|
-
import { TypeFactory } from "../../factories/TypeFactory";
|
|
6
|
-
|
|
7
|
-
import { IProject } from "../../transformers/IProject";
|
|
8
|
-
|
|
9
|
-
import { AssertProgrammer } from "../AssertProgrammer";
|
|
10
|
-
import { HttpQueryProgrammer } from "./HttpQueryProgrammer";
|
|
11
|
-
|
|
12
|
-
export namespace HttpAssertQueryProgrammer {
|
|
13
|
-
export const write =
|
|
14
|
-
(project: IProject) =>
|
|
15
|
-
(modulo: ts.LeftHandSideExpression) =>
|
|
16
|
-
(type: ts.Type, name?: string): ts.ArrowFunction =>
|
|
17
|
-
ts.factory.createArrowFunction(
|
|
18
|
-
undefined,
|
|
19
|
-
undefined,
|
|
20
|
-
[
|
|
21
|
-
IdentifierFactory.parameter(
|
|
22
|
-
"input",
|
|
23
|
-
ts.factory.createTypeReferenceNode(
|
|
24
|
-
HttpQueryProgrammer.INPUT_TYPE,
|
|
25
|
-
),
|
|
26
|
-
),
|
|
27
|
-
],
|
|
28
|
-
ts.factory.createTypeReferenceNode(
|
|
29
|
-
`typia.Resolved<${
|
|
30
|
-
name ?? TypeFactory.getFullName(project.checker)(type)
|
|
31
|
-
}>`,
|
|
32
|
-
),
|
|
33
|
-
undefined,
|
|
34
|
-
ts.factory.createBlock([
|
|
35
|
-
StatementFactory.constant(
|
|
36
|
-
"decode",
|
|
37
|
-
HttpQueryProgrammer.write({
|
|
38
|
-
...project,
|
|
39
|
-
options: {
|
|
40
|
-
...project.options,
|
|
41
|
-
functional: false,
|
|
42
|
-
numeric: false,
|
|
43
|
-
},
|
|
44
|
-
})(modulo)(type, name),
|
|
45
|
-
),
|
|
46
|
-
StatementFactory.constant(
|
|
47
|
-
"assert",
|
|
48
|
-
AssertProgrammer.write({
|
|
49
|
-
...project,
|
|
50
|
-
options: {
|
|
51
|
-
...project.options,
|
|
52
|
-
functional: false,
|
|
53
|
-
numeric: false,
|
|
54
|
-
},
|
|
55
|
-
})(modulo)(false)(type, name),
|
|
56
|
-
),
|
|
57
|
-
StatementFactory.constant(
|
|
58
|
-
"output",
|
|
59
|
-
ts.factory.createCallExpression(
|
|
60
|
-
ts.factory.createIdentifier("decode"),
|
|
61
|
-
undefined,
|
|
62
|
-
[ts.factory.createIdentifier("input")],
|
|
63
|
-
),
|
|
64
|
-
),
|
|
65
|
-
ts.factory.createReturnStatement(
|
|
66
|
-
ts.factory.createAsExpression(
|
|
67
|
-
ts.factory.createCallExpression(
|
|
68
|
-
ts.factory.createIdentifier("assert"),
|
|
69
|
-
undefined,
|
|
70
|
-
[ts.factory.createIdentifier("output")],
|
|
71
|
-
),
|
|
72
|
-
TypeFactory.keyword("any"),
|
|
73
|
-
),
|
|
74
|
-
),
|
|
75
|
-
]),
|
|
76
|
-
);
|
|
77
|
-
}
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
|
|
3
|
+
import { IdentifierFactory } from "../../factories/IdentifierFactory";
|
|
4
|
+
import { StatementFactory } from "../../factories/StatementFactory";
|
|
5
|
+
import { TypeFactory } from "../../factories/TypeFactory";
|
|
6
|
+
|
|
7
|
+
import { IProject } from "../../transformers/IProject";
|
|
8
|
+
|
|
9
|
+
import { AssertProgrammer } from "../AssertProgrammer";
|
|
10
|
+
import { HttpQueryProgrammer } from "./HttpQueryProgrammer";
|
|
11
|
+
|
|
12
|
+
export namespace HttpAssertQueryProgrammer {
|
|
13
|
+
export const write =
|
|
14
|
+
(project: IProject) =>
|
|
15
|
+
(modulo: ts.LeftHandSideExpression) =>
|
|
16
|
+
(type: ts.Type, name?: string): ts.ArrowFunction =>
|
|
17
|
+
ts.factory.createArrowFunction(
|
|
18
|
+
undefined,
|
|
19
|
+
undefined,
|
|
20
|
+
[
|
|
21
|
+
IdentifierFactory.parameter(
|
|
22
|
+
"input",
|
|
23
|
+
ts.factory.createTypeReferenceNode(
|
|
24
|
+
HttpQueryProgrammer.INPUT_TYPE,
|
|
25
|
+
),
|
|
26
|
+
),
|
|
27
|
+
],
|
|
28
|
+
ts.factory.createTypeReferenceNode(
|
|
29
|
+
`typia.Resolved<${
|
|
30
|
+
name ?? TypeFactory.getFullName(project.checker)(type)
|
|
31
|
+
}>`,
|
|
32
|
+
),
|
|
33
|
+
undefined,
|
|
34
|
+
ts.factory.createBlock([
|
|
35
|
+
StatementFactory.constant(
|
|
36
|
+
"decode",
|
|
37
|
+
HttpQueryProgrammer.write({
|
|
38
|
+
...project,
|
|
39
|
+
options: {
|
|
40
|
+
...project.options,
|
|
41
|
+
functional: false,
|
|
42
|
+
numeric: false,
|
|
43
|
+
},
|
|
44
|
+
})(modulo)(type, name),
|
|
45
|
+
),
|
|
46
|
+
StatementFactory.constant(
|
|
47
|
+
"assert",
|
|
48
|
+
AssertProgrammer.write({
|
|
49
|
+
...project,
|
|
50
|
+
options: {
|
|
51
|
+
...project.options,
|
|
52
|
+
functional: false,
|
|
53
|
+
numeric: false,
|
|
54
|
+
},
|
|
55
|
+
})(modulo)(false)(type, name),
|
|
56
|
+
),
|
|
57
|
+
StatementFactory.constant(
|
|
58
|
+
"output",
|
|
59
|
+
ts.factory.createCallExpression(
|
|
60
|
+
ts.factory.createIdentifier("decode"),
|
|
61
|
+
undefined,
|
|
62
|
+
[ts.factory.createIdentifier("input")],
|
|
63
|
+
),
|
|
64
|
+
),
|
|
65
|
+
ts.factory.createReturnStatement(
|
|
66
|
+
ts.factory.createAsExpression(
|
|
67
|
+
ts.factory.createCallExpression(
|
|
68
|
+
ts.factory.createIdentifier("assert"),
|
|
69
|
+
undefined,
|
|
70
|
+
[ts.factory.createIdentifier("output")],
|
|
71
|
+
),
|
|
72
|
+
TypeFactory.keyword("any"),
|
|
73
|
+
),
|
|
74
|
+
),
|
|
75
|
+
]),
|
|
76
|
+
);
|
|
77
|
+
}
|