typia 5.1.3 → 5.1.4
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/executable/TypiaSetupWizard.js +1 -19
- package/lib/executable/TypiaSetupWizard.js.map +1 -1
- package/package.json +1 -1
- package/src/executable/TypiaSetupWizard.ts +1 -16
- package/src/factories/MetadataCollection.ts +277 -277
- package/src/factories/MetadataFactory.ts +238 -238
- package/src/factories/MetadataTypeTagFactory.ts +325 -325
- package/src/factories/internal/metadata/emend_metadata_atomics.ts +41 -41
- package/src/factories/internal/metadata/iterate_metadata_intersection.ts +259 -259
- package/src/functional/$HeadersReader.ts +28 -28
- package/src/functional/$ParameterReader.ts +31 -31
- package/src/functional/$QueryReader.ts +56 -56
- package/src/functional/Namespace.ts +142 -142
- package/src/http.ts +1149 -1149
- package/src/json.ts +648 -648
- package/src/misc.ts +651 -651
- package/src/module.ts +657 -657
- 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 +339 -339
- package/src/programmers/http/HttpIsHeadersProgrammer.ts +87 -87
- package/src/programmers/http/HttpIsQueryProgrammer.ts +87 -87
- package/src/programmers/http/HttpParameterProgrammer.ts +104 -104
- package/src/programmers/http/HttpQueryProgrammer.ts +273 -273
- package/src/programmers/http/HttpValidateHeadersProgrammer.ts +77 -77
- package/src/programmers/http/HttpValidateQueryProgrammer.ts +77 -77
- package/src/programmers/internal/application_boolean.ts +30 -30
- package/src/programmers/internal/application_number.ts +90 -90
- package/src/programmers/internal/application_schema.ts +180 -180
- package/src/programmers/internal/application_string.ts +54 -54
- package/src/programmers/internal/check_array_length.ts +44 -44
- package/src/programmers/internal/check_bigint.ts +48 -48
- package/src/programmers/internal/check_number.ts +108 -108
- package/src/programmers/internal/check_string.ts +48 -48
- package/src/programmers/protobuf/ProtobufEncodeProgrammer.ts +882 -882
- package/src/protobuf.ts +887 -887
- package/src/schemas/json/IJsonComponents.ts +34 -34
- package/src/schemas/json/IJsonSchema.ts +112 -112
- package/src/schemas/metadata/IMetadataConstant.ts +25 -25
- package/src/schemas/metadata/IMetadataTypeTag.ts +8 -8
- package/src/schemas/metadata/Metadata.ts +686 -686
- package/src/tags/Default.ts +15 -15
- package/src/tags/Format.ts +30 -30
- package/src/tags/Pattern.ts +9 -9
- package/src/tags/TagBase.ts +68 -68
- package/src/tags/index.ts +14 -14
- package/src/transformers/CallExpressionTransformer.ts +289 -289
- 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.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
|
+
}
|