@nestia/core 10.0.2 → 11.0.0-dev.20260312
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/LICENSE +21 -21
- package/README.md +93 -93
- package/lib/adaptors/WebSocketAdaptor.js.map +1 -1
- package/lib/decorators/DynamicModule.js +54 -10
- package/lib/decorators/DynamicModule.js.map +1 -1
- package/lib/decorators/EncryptedBody.js +2 -2
- package/lib/decorators/EncryptedBody.js.map +1 -1
- package/lib/decorators/EncryptedController.d.ts +1 -1
- package/lib/decorators/EncryptedModule.d.ts +1 -1
- package/lib/decorators/EncryptedModule.js +54 -10
- package/lib/decorators/EncryptedModule.js.map +1 -1
- package/lib/decorators/EncryptedRoute.js +2 -2
- package/lib/decorators/EncryptedRoute.js.map +1 -1
- package/lib/decorators/HumanRoute.d.ts +1 -2
- package/lib/decorators/HumanRoute.js +1 -2
- package/lib/decorators/HumanRoute.js.map +1 -1
- package/lib/decorators/NoTransformConfigurationError.js +1 -1
- package/lib/decorators/NoTransformConfigurationError.js.map +1 -1
- package/lib/decorators/SwaggerCustomizer.d.ts +1 -1
- package/lib/decorators/TypedFormData.js.map +1 -1
- package/lib/decorators/TypedParam.js +1 -1
- package/lib/decorators/TypedParam.js.map +1 -1
- package/lib/decorators/internal/get_path_and_querify.js +1 -1
- package/lib/decorators/internal/get_path_and_querify.js.map +1 -1
- package/lib/decorators/internal/get_path_and_stringify.js +1 -1
- package/lib/decorators/internal/get_path_and_stringify.js.map +1 -1
- package/lib/decorators/internal/headers_to_object.js.map +1 -1
- package/lib/decorators/internal/validate_request_body.js +1 -1
- package/lib/decorators/internal/validate_request_body.js.map +1 -1
- package/lib/decorators/internal/validate_request_form_data.js +1 -1
- package/lib/decorators/internal/validate_request_form_data.js.map +1 -1
- package/lib/decorators/internal/validate_request_headers.js +1 -1
- package/lib/decorators/internal/validate_request_headers.js.map +1 -1
- package/lib/decorators/internal/validate_request_query.js +1 -1
- package/lib/decorators/internal/validate_request_query.js.map +1 -1
- package/lib/module.d.ts +1 -0
- package/lib/module.js +1 -0
- package/lib/module.js.map +1 -1
- package/lib/options/INestiaTransformProject.d.ts +1 -1
- package/lib/programmers/PlainBodyProgrammer.js +5 -8
- package/lib/programmers/PlainBodyProgrammer.js.map +1 -1
- package/lib/programmers/TypedBodyProgrammer.js +15 -23
- package/lib/programmers/TypedBodyProgrammer.js.map +1 -1
- package/lib/programmers/TypedFormDataBodyProgrammer.js +11 -20
- package/lib/programmers/TypedFormDataBodyProgrammer.js.map +1 -1
- package/lib/programmers/TypedHeadersProgrammer.js +4 -6
- package/lib/programmers/TypedHeadersProgrammer.js.map +1 -1
- package/lib/programmers/TypedParamProgrammer.js +2 -2
- package/lib/programmers/TypedParamProgrammer.js.map +1 -1
- package/lib/programmers/TypedQueryBodyProgrammer.js +11 -17
- package/lib/programmers/TypedQueryBodyProgrammer.js.map +1 -1
- package/lib/programmers/TypedQueryProgrammer.js +11 -17
- package/lib/programmers/TypedQueryProgrammer.js.map +1 -1
- package/lib/programmers/TypedQueryRouteProgrammer.js +8 -11
- package/lib/programmers/TypedQueryRouteProgrammer.js.map +1 -1
- package/lib/programmers/TypedRouteProgrammer.js +10 -15
- package/lib/programmers/TypedRouteProgrammer.js.map +1 -1
- package/lib/programmers/http/HttpAssertQuerifyProgrammer.d.ts +1 -1
- package/lib/programmers/http/HttpAssertQuerifyProgrammer.js +5 -7
- package/lib/programmers/http/HttpAssertQuerifyProgrammer.js.map +1 -1
- package/lib/programmers/http/HttpIsQuerifyProgrammer.d.ts +1 -1
- package/lib/programmers/http/HttpIsQuerifyProgrammer.js +5 -7
- package/lib/programmers/http/HttpIsQuerifyProgrammer.js.map +1 -1
- package/lib/programmers/http/HttpQuerifyProgrammer.d.ts +1 -1
- package/lib/programmers/http/HttpQuerifyProgrammer.js +13 -19
- package/lib/programmers/http/HttpQuerifyProgrammer.js.map +1 -1
- package/lib/programmers/http/HttpValidateQuerifyProgrammer.d.ts +1 -1
- package/lib/programmers/http/HttpValidateQuerifyProgrammer.js +6 -8
- package/lib/programmers/http/HttpValidateQuerifyProgrammer.js.map +1 -1
- package/lib/programmers/internal/CoreMetadataUtil.d.ts +3 -3
- package/lib/programmers/internal/CoreMetadataUtil.js.map +1 -1
- package/lib/transform.d.ts +1 -1
- package/lib/transform.js.map +1 -1
- package/lib/transformers/FileTransformer.js +2 -2
- package/lib/transformers/FileTransformer.js.map +1 -1
- package/lib/transformers/MethodTransformer.js.map +1 -1
- package/lib/transformers/ParameterDecoratorTransformer.js +1 -1
- package/lib/transformers/ParameterDecoratorTransformer.js.map +1 -1
- package/lib/transformers/TypedRouteTransformer.js +1 -1
- package/lib/transformers/TypedRouteTransformer.js.map +1 -1
- package/lib/transformers/WebSocketRouteTransformer.js +1 -1
- package/lib/transformers/WebSocketRouteTransformer.js.map +1 -1
- package/package.json +34 -26
- package/src/adaptors/WebSocketAdaptor.ts +429 -429
- package/src/decorators/EncryptedBody.ts +96 -97
- package/src/decorators/EncryptedController.ts +40 -40
- package/src/decorators/EncryptedModule.ts +98 -98
- package/src/decorators/EncryptedRoute.ts +212 -213
- package/src/decorators/HumanRoute.ts +21 -22
- package/src/decorators/NoTransformConfigurationError.ts +34 -34
- package/src/decorators/SwaggerCustomizer.ts +97 -97
- package/src/decorators/TypedFormData.ts +187 -195
- package/src/decorators/TypedRoute.ts +196 -196
- package/src/decorators/internal/headers_to_object.ts +11 -11
- package/src/module.ts +23 -22
- package/src/options/INestiaTransformOptions.ts +34 -34
- package/src/options/INestiaTransformProject.ts +10 -8
- package/src/programmers/PlainBodyProgrammer.ts +72 -70
- package/src/programmers/TypedBodyProgrammer.ts +144 -142
- package/src/programmers/TypedFormDataBodyProgrammer.ts +118 -118
- package/src/programmers/TypedHeadersProgrammer.ts +65 -63
- package/src/programmers/TypedParamProgrammer.ts +33 -33
- package/src/programmers/TypedQueryBodyProgrammer.ts +111 -109
- package/src/programmers/TypedQueryProgrammer.ts +113 -111
- package/src/programmers/TypedQueryRouteProgrammer.ts +104 -102
- package/src/programmers/TypedRouteProgrammer.ts +96 -94
- package/src/programmers/http/HttpAssertQuerifyProgrammer.ts +74 -72
- package/src/programmers/http/HttpIsQuerifyProgrammer.ts +77 -75
- package/src/programmers/http/HttpQuerifyProgrammer.ts +110 -108
- package/src/programmers/http/HttpValidateQuerifyProgrammer.ts +78 -76
- package/src/programmers/internal/CoreMetadataUtil.ts +21 -21
- package/src/transform.ts +35 -35
- package/src/transformers/FileTransformer.ts +109 -110
- package/src/transformers/MethodTransformer.ts +103 -103
- package/src/transformers/ParameterDecoratorTransformer.ts +143 -143
- package/src/transformers/TypedRouteTransformer.ts +85 -85
- package/src/transformers/WebSocketRouteTransformer.ts +120 -120
|
@@ -1,102 +1,104 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
ts.
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
return parameter("
|
|
94
|
-
else if (props.context.options.stringify === "
|
|
95
|
-
return parameter("
|
|
96
|
-
else if (props.context.options.stringify ===
|
|
97
|
-
return
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
1
|
+
import {
|
|
2
|
+
HttpQueryProgrammer,
|
|
3
|
+
ITypiaContext,
|
|
4
|
+
LlmSchemaProgrammer,
|
|
5
|
+
MetadataCollection,
|
|
6
|
+
MetadataFactory,
|
|
7
|
+
MetadataSchema,
|
|
8
|
+
TransformerError,
|
|
9
|
+
} from "@typia/core";
|
|
10
|
+
import { ValidationPipe } from "@typia/interface";
|
|
11
|
+
import ts from "typescript";
|
|
12
|
+
|
|
13
|
+
import { INestiaTransformOptions } from "../options/INestiaTransformOptions";
|
|
14
|
+
import { INestiaTransformContext } from "../options/INestiaTransformProject";
|
|
15
|
+
import { HttpAssertQuerifyProgrammer } from "./http/HttpAssertQuerifyProgrammer";
|
|
16
|
+
import { HttpIsQuerifyProgrammer } from "./http/HttpIsQuerifyProgrammer";
|
|
17
|
+
import { HttpQuerifyProgrammer } from "./http/HttpQuerifyProgrammer";
|
|
18
|
+
import { HttpValidateQuerifyProgrammer } from "./http/HttpValidateQuerifyProgrammer";
|
|
19
|
+
|
|
20
|
+
export namespace TypedQueryRouteProgrammer {
|
|
21
|
+
export const generate = (props: {
|
|
22
|
+
context: INestiaTransformContext;
|
|
23
|
+
modulo: ts.LeftHandSideExpression;
|
|
24
|
+
type: ts.Type;
|
|
25
|
+
}): ts.Expression => {
|
|
26
|
+
// VALIDATE TYPE
|
|
27
|
+
if (props.context.options.llm) {
|
|
28
|
+
const llm: INestiaTransformOptions.ILlm = props.context.options.llm;
|
|
29
|
+
const result: ValidationPipe<MetadataSchema, MetadataFactory.IError> =
|
|
30
|
+
MetadataFactory.analyze({
|
|
31
|
+
checker: props.context.checker,
|
|
32
|
+
transformer: props.context.transformer,
|
|
33
|
+
options: {
|
|
34
|
+
escape: false,
|
|
35
|
+
constant: true,
|
|
36
|
+
absorb: true,
|
|
37
|
+
validate: (meta, explore) => {
|
|
38
|
+
const errors: string[] = HttpQueryProgrammer.validate(
|
|
39
|
+
meta,
|
|
40
|
+
explore,
|
|
41
|
+
true,
|
|
42
|
+
);
|
|
43
|
+
errors.push(
|
|
44
|
+
...LlmSchemaProgrammer.validate({
|
|
45
|
+
config: {
|
|
46
|
+
strict: llm.strict ?? false,
|
|
47
|
+
},
|
|
48
|
+
metadata: meta,
|
|
49
|
+
}),
|
|
50
|
+
);
|
|
51
|
+
return errors;
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
components: new MetadataCollection(),
|
|
55
|
+
type: props.type,
|
|
56
|
+
});
|
|
57
|
+
if (result.success === false)
|
|
58
|
+
throw TransformerError.from({
|
|
59
|
+
code: props.modulo.getText(),
|
|
60
|
+
errors: result.errors,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// GENERATE STRINGIFY PLAN
|
|
65
|
+
const parameter = (
|
|
66
|
+
key: string,
|
|
67
|
+
programmer: (next: {
|
|
68
|
+
context: ITypiaContext;
|
|
69
|
+
modulo: ts.LeftHandSideExpression;
|
|
70
|
+
type: ts.Type;
|
|
71
|
+
}) => ts.ArrowFunction,
|
|
72
|
+
) =>
|
|
73
|
+
ts.factory.createObjectLiteralExpression([
|
|
74
|
+
ts.factory.createPropertyAssignment(
|
|
75
|
+
ts.factory.createIdentifier("type"),
|
|
76
|
+
ts.factory.createStringLiteral(key),
|
|
77
|
+
),
|
|
78
|
+
ts.factory.createPropertyAssignment(
|
|
79
|
+
ts.factory.createIdentifier(key),
|
|
80
|
+
programmer({
|
|
81
|
+
context: {
|
|
82
|
+
...props.context,
|
|
83
|
+
options: {}, // use default option
|
|
84
|
+
},
|
|
85
|
+
modulo: props.modulo,
|
|
86
|
+
type: props.type,
|
|
87
|
+
}),
|
|
88
|
+
),
|
|
89
|
+
]);
|
|
90
|
+
|
|
91
|
+
// RETURNS
|
|
92
|
+
if (props.context.options.stringify === "is")
|
|
93
|
+
return parameter("is", HttpIsQuerifyProgrammer.write);
|
|
94
|
+
else if (props.context.options.stringify === "validate")
|
|
95
|
+
return parameter("validate", HttpValidateQuerifyProgrammer.write);
|
|
96
|
+
else if (props.context.options.stringify === "stringify")
|
|
97
|
+
return parameter("stringify", HttpQuerifyProgrammer.write);
|
|
98
|
+
else if (props.context.options.stringify === null)
|
|
99
|
+
return ts.factory.createNull();
|
|
100
|
+
|
|
101
|
+
// ASSERT IS DEFAULT
|
|
102
|
+
return parameter("assert", HttpAssertQuerifyProgrammer.write);
|
|
103
|
+
};
|
|
104
|
+
}
|
|
@@ -1,94 +1,96 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
ts.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
IProgrammerProps,
|
|
3
|
+
JsonAssertStringifyProgrammer,
|
|
4
|
+
JsonIsStringifyProgrammer,
|
|
5
|
+
JsonMetadataFactory,
|
|
6
|
+
JsonStringifyProgrammer,
|
|
7
|
+
JsonValidateStringifyProgrammer,
|
|
8
|
+
LlmSchemaProgrammer,
|
|
9
|
+
} from "@typia/core";
|
|
10
|
+
import ts from "typescript";
|
|
11
|
+
|
|
12
|
+
import { INestiaTransformContext } from "../options/INestiaTransformProject";
|
|
13
|
+
|
|
14
|
+
export namespace TypedRouteProgrammer {
|
|
15
|
+
export const generate = (props: {
|
|
16
|
+
context: INestiaTransformContext;
|
|
17
|
+
modulo: ts.LeftHandSideExpression;
|
|
18
|
+
type: ts.Type;
|
|
19
|
+
}): ts.Expression => {
|
|
20
|
+
// VALIDATE TYPE
|
|
21
|
+
if (props.context.options.llm)
|
|
22
|
+
JsonMetadataFactory.analyze({
|
|
23
|
+
method: "@nestia.core.TypedRoute",
|
|
24
|
+
checker: props.context.checker,
|
|
25
|
+
transformer: props.context.transformer,
|
|
26
|
+
type: props.type,
|
|
27
|
+
validate: (metadata) =>
|
|
28
|
+
LlmSchemaProgrammer.validate({
|
|
29
|
+
config: {
|
|
30
|
+
strict: props.context.options.llm?.strict ?? false,
|
|
31
|
+
},
|
|
32
|
+
metadata,
|
|
33
|
+
}),
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
// GENERATE STRINGIFY PLAN
|
|
37
|
+
const parameter = (next: {
|
|
38
|
+
type: string;
|
|
39
|
+
key: string;
|
|
40
|
+
programmer: (next: IProgrammerProps) => ts.Expression;
|
|
41
|
+
}) =>
|
|
42
|
+
ts.factory.createObjectLiteralExpression([
|
|
43
|
+
ts.factory.createPropertyAssignment(
|
|
44
|
+
ts.factory.createIdentifier("type"),
|
|
45
|
+
ts.factory.createStringLiteral(next.type),
|
|
46
|
+
),
|
|
47
|
+
ts.factory.createPropertyAssignment(
|
|
48
|
+
ts.factory.createIdentifier(next.key),
|
|
49
|
+
next.programmer({
|
|
50
|
+
context: {
|
|
51
|
+
...props.context,
|
|
52
|
+
options: {}, // use default option
|
|
53
|
+
},
|
|
54
|
+
modulo: props.modulo,
|
|
55
|
+
type: props.type,
|
|
56
|
+
name: undefined,
|
|
57
|
+
}),
|
|
58
|
+
),
|
|
59
|
+
]);
|
|
60
|
+
|
|
61
|
+
// RETURNS
|
|
62
|
+
if (props.context.options.stringify === "is")
|
|
63
|
+
return parameter({
|
|
64
|
+
type: "is",
|
|
65
|
+
key: "is",
|
|
66
|
+
programmer: JsonIsStringifyProgrammer.write,
|
|
67
|
+
});
|
|
68
|
+
else if (props.context.options.stringify === "validate")
|
|
69
|
+
return parameter({
|
|
70
|
+
type: "validate",
|
|
71
|
+
key: "validate",
|
|
72
|
+
programmer: JsonValidateStringifyProgrammer.write,
|
|
73
|
+
});
|
|
74
|
+
else if (props.context.options.stringify === "stringify")
|
|
75
|
+
return parameter({
|
|
76
|
+
type: "stringify",
|
|
77
|
+
key: "stringify",
|
|
78
|
+
programmer: JsonStringifyProgrammer.write,
|
|
79
|
+
});
|
|
80
|
+
else if (props.context.options.stringify === "validate.log")
|
|
81
|
+
return parameter({
|
|
82
|
+
type: "validate.log",
|
|
83
|
+
key: "validate",
|
|
84
|
+
programmer: JsonValidateStringifyProgrammer.write,
|
|
85
|
+
});
|
|
86
|
+
else if (props.context.options.stringify === null)
|
|
87
|
+
return ts.factory.createNull();
|
|
88
|
+
|
|
89
|
+
// ASSERT IS DEFAULT
|
|
90
|
+
return parameter({
|
|
91
|
+
type: "assert",
|
|
92
|
+
key: "assert",
|
|
93
|
+
programmer: JsonAssertStringifyProgrammer.write,
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
}
|
|
@@ -1,72 +1,74 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
ts.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
undefined,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
1
|
+
import {
|
|
2
|
+
AssertProgrammer,
|
|
3
|
+
ITypiaContext,
|
|
4
|
+
IdentifierFactory,
|
|
5
|
+
StatementFactory,
|
|
6
|
+
} from "@typia/core";
|
|
7
|
+
import ts from "typescript";
|
|
8
|
+
|
|
9
|
+
import { HttpQuerifyProgrammer } from "./HttpQuerifyProgrammer";
|
|
10
|
+
|
|
11
|
+
export namespace HttpAssertQuerifyProgrammer {
|
|
12
|
+
export const write = (props: {
|
|
13
|
+
context: ITypiaContext;
|
|
14
|
+
modulo: ts.LeftHandSideExpression;
|
|
15
|
+
type: ts.Type;
|
|
16
|
+
}): ts.ArrowFunction =>
|
|
17
|
+
ts.factory.createArrowFunction(
|
|
18
|
+
undefined,
|
|
19
|
+
undefined,
|
|
20
|
+
[IdentifierFactory.parameter("input")],
|
|
21
|
+
undefined,
|
|
22
|
+
undefined,
|
|
23
|
+
ts.factory.createBlock([
|
|
24
|
+
StatementFactory.constant({
|
|
25
|
+
name: "assert",
|
|
26
|
+
value: AssertProgrammer.write({
|
|
27
|
+
context: {
|
|
28
|
+
...props.context,
|
|
29
|
+
options: {
|
|
30
|
+
...props.context.options,
|
|
31
|
+
functional: false,
|
|
32
|
+
numeric: false,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
modulo: props.modulo,
|
|
36
|
+
config: {
|
|
37
|
+
equals: false,
|
|
38
|
+
guard: false,
|
|
39
|
+
},
|
|
40
|
+
type: props.type,
|
|
41
|
+
name: undefined,
|
|
42
|
+
}),
|
|
43
|
+
}),
|
|
44
|
+
StatementFactory.constant({
|
|
45
|
+
name: "stringify",
|
|
46
|
+
value: HttpQuerifyProgrammer.write({
|
|
47
|
+
context: {
|
|
48
|
+
...props.context,
|
|
49
|
+
options: {
|
|
50
|
+
...props.context.options,
|
|
51
|
+
functional: false,
|
|
52
|
+
numeric: false,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
modulo: props.modulo,
|
|
56
|
+
type: props.type,
|
|
57
|
+
}),
|
|
58
|
+
}),
|
|
59
|
+
ts.factory.createReturnStatement(
|
|
60
|
+
ts.factory.createCallExpression(
|
|
61
|
+
ts.factory.createIdentifier("stringify"),
|
|
62
|
+
undefined,
|
|
63
|
+
[
|
|
64
|
+
ts.factory.createCallExpression(
|
|
65
|
+
ts.factory.createIdentifier("assert"),
|
|
66
|
+
undefined,
|
|
67
|
+
[ts.factory.createIdentifier("input")],
|
|
68
|
+
),
|
|
69
|
+
],
|
|
70
|
+
),
|
|
71
|
+
),
|
|
72
|
+
]),
|
|
73
|
+
);
|
|
74
|
+
}
|