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