@nestia/core 4.4.0 → 4.4.1-dev.20241216

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 (89) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +87 -87
  3. package/lib/options/INestiaTransformOptions.d.ts +7 -0
  4. package/lib/programmers/TypedBodyProgrammer.js +11 -0
  5. package/lib/programmers/TypedBodyProgrammer.js.map +1 -1
  6. package/lib/programmers/TypedQueryBodyProgrammer.js +36 -0
  7. package/lib/programmers/TypedQueryBodyProgrammer.js.map +1 -1
  8. package/lib/programmers/TypedQueryProgrammer.js +36 -0
  9. package/lib/programmers/TypedQueryProgrammer.js.map +1 -1
  10. package/lib/programmers/TypedQueryRouteProgrammer.js +36 -0
  11. package/lib/programmers/TypedQueryRouteProgrammer.js.map +1 -1
  12. package/lib/programmers/TypedRouteProgrammer.js +18 -0
  13. package/lib/programmers/TypedRouteProgrammer.js.map +1 -1
  14. package/lib/programmers/internal/LlmValidatePredicator.d.ts +5 -0
  15. package/lib/programmers/internal/LlmValidatePredicator.js +18 -0
  16. package/lib/programmers/internal/LlmValidatePredicator.js.map +1 -0
  17. package/package.json +6 -6
  18. package/src/adaptors/WebSocketAdaptor.ts +426 -426
  19. package/src/decorators/DynamicModule.ts +43 -43
  20. package/src/decorators/EncryptedBody.ts +101 -101
  21. package/src/decorators/EncryptedController.ts +38 -38
  22. package/src/decorators/EncryptedModule.ts +100 -100
  23. package/src/decorators/EncryptedRoute.ts +219 -219
  24. package/src/decorators/NoTransformConfigurationError.ts +32 -32
  25. package/src/decorators/PlainBody.ts +79 -79
  26. package/src/decorators/SwaggerCustomizer.ts +115 -115
  27. package/src/decorators/SwaggerExample.ts +100 -100
  28. package/src/decorators/TypedBody.ts +59 -59
  29. package/src/decorators/TypedException.ts +128 -128
  30. package/src/decorators/TypedFormData.ts +195 -195
  31. package/src/decorators/TypedHeaders.ts +64 -64
  32. package/src/decorators/TypedParam.ts +77 -77
  33. package/src/decorators/TypedQuery.ts +245 -245
  34. package/src/decorators/TypedRoute.ts +214 -214
  35. package/src/decorators/WebSocketRoute.ts +242 -242
  36. package/src/decorators/internal/EncryptedConstant.ts +4 -4
  37. package/src/decorators/internal/IWebSocketRouteReflect.ts +23 -23
  38. package/src/decorators/internal/NoTransformConfigureError.ts +2 -2
  39. package/src/decorators/internal/get_path_and_querify.ts +108 -108
  40. package/src/decorators/internal/get_path_and_stringify.ts +122 -122
  41. package/src/decorators/internal/get_text_body.ts +20 -20
  42. package/src/decorators/internal/headers_to_object.ts +13 -13
  43. package/src/decorators/internal/is_request_body_undefined.ts +14 -14
  44. package/src/decorators/internal/load_controller.ts +49 -49
  45. package/src/decorators/internal/route_error.ts +45 -45
  46. package/src/decorators/internal/validate_request_body.ts +74 -74
  47. package/src/decorators/internal/validate_request_form_data.ts +77 -77
  48. package/src/decorators/internal/validate_request_headers.ts +86 -86
  49. package/src/decorators/internal/validate_request_query.ts +74 -74
  50. package/src/index.ts +5 -5
  51. package/src/module.ts +21 -21
  52. package/src/options/INestiaTransformOptions.ts +38 -29
  53. package/src/options/INestiaTransformProject.ts +8 -8
  54. package/src/options/IRequestBodyValidator.ts +20 -20
  55. package/src/options/IRequestFormDataProps.ts +27 -27
  56. package/src/options/IRequestHeadersValidator.ts +22 -22
  57. package/src/options/IRequestQueryValidator.ts +20 -20
  58. package/src/options/IResponseBodyQuerifier.ts +25 -25
  59. package/src/options/IResponseBodyStringifier.ts +30 -30
  60. package/src/programmers/PlainBodyProgrammer.ts +70 -70
  61. package/src/programmers/TypedBodyProgrammer.ts +143 -132
  62. package/src/programmers/TypedFormDataBodyProgrammer.ts +118 -118
  63. package/src/programmers/TypedHeadersProgrammer.ts +63 -63
  64. package/src/programmers/TypedParamProgrammer.ts +33 -33
  65. package/src/programmers/TypedQueryBodyProgrammer.ts +106 -63
  66. package/src/programmers/TypedQueryProgrammer.ts +108 -65
  67. package/src/programmers/TypedQueryRouteProgrammer.ts +99 -56
  68. package/src/programmers/TypedRouteProgrammer.ts +95 -76
  69. package/src/programmers/http/HttpAssertQuerifyProgrammer.ts +72 -72
  70. package/src/programmers/http/HttpIsQuerifyProgrammer.ts +75 -75
  71. package/src/programmers/http/HttpQuerifyProgrammer.ts +108 -108
  72. package/src/programmers/http/HttpValidateQuerifyProgrammer.ts +76 -76
  73. package/src/programmers/internal/CoreMetadataUtil.ts +21 -21
  74. package/src/programmers/internal/LlmValidatePredicator.ts +16 -0
  75. package/src/transform.ts +35 -35
  76. package/src/transformers/FileTransformer.ts +110 -110
  77. package/src/transformers/MethodTransformer.ts +103 -103
  78. package/src/transformers/NodeTransformer.ts +23 -23
  79. package/src/transformers/ParameterDecoratorTransformer.ts +143 -143
  80. package/src/transformers/ParameterTransformer.ts +57 -57
  81. package/src/transformers/TypedRouteTransformer.ts +85 -85
  82. package/src/transformers/WebSocketRouteTransformer.ts +120 -120
  83. package/src/typings/Creator.ts +3 -3
  84. package/src/typings/get-function-location.d.ts +7 -7
  85. package/src/utils/ArrayUtil.ts +7 -7
  86. package/src/utils/ExceptionManager.ts +112 -112
  87. package/src/utils/Singleton.ts +20 -20
  88. package/src/utils/SourceFinder.ts +57 -57
  89. package/src/utils/VersioningStrategy.ts +27 -27
@@ -1,56 +1,99 @@
1
- import ts from "typescript";
2
- import { ITypiaContext } from "typia/lib/transformers/ITypiaContext";
3
-
4
- import { INestiaTransformContext } from "../options/INestiaTransformProject";
5
- import { HttpAssertQuerifyProgrammer } from "./http/HttpAssertQuerifyProgrammer";
6
- import { HttpIsQuerifyProgrammer } from "./http/HttpIsQuerifyProgrammer";
7
- import { HttpQuerifyProgrammer } from "./http/HttpQuerifyProgrammer";
8
- import { HttpValidateQuerifyProgrammer } from "./http/HttpValidateQuerifyProgrammer";
9
-
10
- export namespace TypedQueryRouteProgrammer {
11
- export const generate = (props: {
12
- context: INestiaTransformContext;
13
- modulo: ts.LeftHandSideExpression;
14
- type: ts.Type;
15
- }): ts.Expression => {
16
- // GENERATE STRINGIFY PLAN
17
- const parameter = (
18
- key: string,
19
- programmer: (next: {
20
- context: ITypiaContext;
21
- modulo: ts.LeftHandSideExpression;
22
- type: ts.Type;
23
- }) => ts.ArrowFunction,
24
- ) =>
25
- ts.factory.createObjectLiteralExpression([
26
- ts.factory.createPropertyAssignment(
27
- ts.factory.createIdentifier("type"),
28
- ts.factory.createStringLiteral(key),
29
- ),
30
- ts.factory.createPropertyAssignment(
31
- ts.factory.createIdentifier(key),
32
- programmer({
33
- context: {
34
- ...props.context,
35
- options: {}, // use default option
36
- },
37
- modulo: props.modulo,
38
- type: props.type,
39
- }),
40
- ),
41
- ]);
42
-
43
- // RETURNS
44
- if (props.context.options.stringify === "is")
45
- return parameter("is", HttpIsQuerifyProgrammer.write);
46
- else if (props.context.options.stringify === "validate")
47
- return parameter("validate", HttpValidateQuerifyProgrammer.write);
48
- else if (props.context.options.stringify === "stringify")
49
- return parameter("stringify", HttpQuerifyProgrammer.write);
50
- else if (props.context.options.stringify === null)
51
- return ts.factory.createNull();
52
-
53
- // ASSERT IS DEFAULT
54
- return parameter("assert", HttpAssertQuerifyProgrammer.write);
55
- };
56
- }
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 { ITypiaContext } from "typia/lib/transformers/ITypiaContext";
7
+ import { TransformerError } from "typia/lib/transformers/TransformerError";
8
+
9
+ import { INestiaTransformContext } from "../options/INestiaTransformProject";
10
+ import { HttpAssertQuerifyProgrammer } from "./http/HttpAssertQuerifyProgrammer";
11
+ import { HttpIsQuerifyProgrammer } from "./http/HttpIsQuerifyProgrammer";
12
+ import { HttpQuerifyProgrammer } from "./http/HttpQuerifyProgrammer";
13
+ import { HttpValidateQuerifyProgrammer } from "./http/HttpValidateQuerifyProgrammer";
14
+ import { LlmValidatePredicator } from "./internal/LlmValidatePredicator";
15
+
16
+ export namespace TypedQueryRouteProgrammer {
17
+ export const generate = (props: {
18
+ context: INestiaTransformContext;
19
+ modulo: ts.LeftHandSideExpression;
20
+ type: ts.Type;
21
+ }): ts.Expression => {
22
+ // VALIDATE TYPE
23
+ if (LlmValidatePredicator.is(props.context.options.llm)) {
24
+ const result = MetadataFactory.analyze({
25
+ checker: props.context.checker,
26
+ transformer: props.context.transformer,
27
+ options: {
28
+ escape: false,
29
+ constant: true,
30
+ absorb: true,
31
+ validate: (meta, explore) => {
32
+ const errors: string[] = HttpQueryProgrammer.validate(
33
+ meta,
34
+ explore,
35
+ true,
36
+ );
37
+ errors.push(
38
+ ...LlmSchemaProgrammer.validate({
39
+ model: props.context.options.llm!.model,
40
+ config: {
41
+ strict: props.context.options.llm!.strict,
42
+ recursive: props.context.options.llm!.recursive,
43
+ },
44
+ })(meta),
45
+ );
46
+ return errors;
47
+ },
48
+ },
49
+ collection: new MetadataCollection(),
50
+ type: props.type,
51
+ });
52
+ if (result.success === false)
53
+ throw TransformerError.from({
54
+ code: props.modulo.getText(),
55
+ errors: result.errors,
56
+ });
57
+ }
58
+
59
+ // GENERATE STRINGIFY PLAN
60
+ const parameter = (
61
+ key: string,
62
+ programmer: (next: {
63
+ context: ITypiaContext;
64
+ modulo: ts.LeftHandSideExpression;
65
+ type: ts.Type;
66
+ }) => ts.ArrowFunction,
67
+ ) =>
68
+ ts.factory.createObjectLiteralExpression([
69
+ ts.factory.createPropertyAssignment(
70
+ ts.factory.createIdentifier("type"),
71
+ ts.factory.createStringLiteral(key),
72
+ ),
73
+ ts.factory.createPropertyAssignment(
74
+ ts.factory.createIdentifier(key),
75
+ programmer({
76
+ context: {
77
+ ...props.context,
78
+ options: {}, // use default option
79
+ },
80
+ modulo: props.modulo,
81
+ type: props.type,
82
+ }),
83
+ ),
84
+ ]);
85
+
86
+ // RETURNS
87
+ if (props.context.options.stringify === "is")
88
+ return parameter("is", HttpIsQuerifyProgrammer.write);
89
+ else if (props.context.options.stringify === "validate")
90
+ return parameter("validate", HttpValidateQuerifyProgrammer.write);
91
+ else if (props.context.options.stringify === "stringify")
92
+ return parameter("stringify", HttpQuerifyProgrammer.write);
93
+ else if (props.context.options.stringify === null)
94
+ return ts.factory.createNull();
95
+
96
+ // ASSERT IS DEFAULT
97
+ return parameter("assert", HttpAssertQuerifyProgrammer.write);
98
+ };
99
+ }
@@ -1,76 +1,95 @@
1
- import ts from "typescript";
2
- import { JsonAssertStringifyProgrammer } from "typia/lib/programmers/json/JsonAssertStringifyProgrammer";
3
- import { JsonIsStringifyProgrammer } from "typia/lib/programmers/json/JsonIsStringifyProgrammer";
4
- import { JsonStringifyProgrammer } from "typia/lib/programmers/json/JsonStringifyProgrammer";
5
- import { JsonValidateStringifyProgrammer } from "typia/lib/programmers/json/JsonValidateStringifyProgrammer";
6
- import { IProgrammerProps } from "typia/lib/transformers/IProgrammerProps";
7
-
8
- import { INestiaTransformContext } from "../options/INestiaTransformProject";
9
-
10
- export namespace TypedRouteProgrammer {
11
- export const generate = (props: {
12
- context: INestiaTransformContext;
13
- modulo: ts.LeftHandSideExpression;
14
- type: ts.Type;
15
- }): ts.Expression => {
16
- // GENERATE STRINGIFY PLAN
17
- const parameter = (next: {
18
- type: string;
19
- key: string;
20
- programmer: (next: IProgrammerProps) => ts.Expression;
21
- }) =>
22
- ts.factory.createObjectLiteralExpression([
23
- ts.factory.createPropertyAssignment(
24
- ts.factory.createIdentifier("type"),
25
- ts.factory.createStringLiteral(next.type),
26
- ),
27
- ts.factory.createPropertyAssignment(
28
- ts.factory.createIdentifier(next.key),
29
- next.programmer({
30
- context: {
31
- ...props.context,
32
- options: {}, // use default option
33
- },
34
- modulo: props.modulo,
35
- type: props.type,
36
- name: undefined,
37
- }),
38
- ),
39
- ]);
40
-
41
- // RETURNS
42
- if (props.context.options.stringify === "is")
43
- return parameter({
44
- type: "is",
45
- key: "is",
46
- programmer: JsonIsStringifyProgrammer.write,
47
- });
48
- else if (props.context.options.stringify === "validate")
49
- return parameter({
50
- type: "validate",
51
- key: "validate",
52
- programmer: JsonValidateStringifyProgrammer.write,
53
- });
54
- else if (props.context.options.stringify === "stringify")
55
- return parameter({
56
- type: "stringify",
57
- key: "stringify",
58
- programmer: JsonStringifyProgrammer.write,
59
- });
60
- else if (props.context.options.stringify === "validate.log")
61
- return parameter({
62
- type: "validate.log",
63
- key: "validate",
64
- programmer: JsonValidateStringifyProgrammer.write,
65
- });
66
- else if (props.context.options.stringify === null)
67
- return ts.factory.createNull();
68
-
69
- // ASSERT IS DEFAULT
70
- return parameter({
71
- type: "assert",
72
- key: "assert",
73
- programmer: JsonAssertStringifyProgrammer.write,
74
- });
75
- };
76
- }
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
+ import { LlmValidatePredicator } from "./internal/LlmValidatePredicator";
12
+
13
+ export namespace TypedRouteProgrammer {
14
+ export const generate = (props: {
15
+ context: INestiaTransformContext;
16
+ modulo: ts.LeftHandSideExpression;
17
+ type: ts.Type;
18
+ }): ts.Expression => {
19
+ // VALIDATE TYPE
20
+ if (LlmValidatePredicator.is(props.context.options.llm))
21
+ JsonMetadataFactory.analyze({
22
+ method: "@nestia.core.TypedBody",
23
+ checker: props.context.checker,
24
+ transformer: props.context.transformer,
25
+ type: props.type,
26
+ validate: LlmSchemaProgrammer.validate({
27
+ model: props.context.options.llm.model,
28
+ config: {
29
+ strict: props.context.options.llm.strict,
30
+ recursive: props.context.options.llm.recursive,
31
+ },
32
+ }),
33
+ });
34
+
35
+ // GENERATE STRINGIFY PLAN
36
+ const parameter = (next: {
37
+ type: string;
38
+ key: string;
39
+ programmer: (next: IProgrammerProps) => ts.Expression;
40
+ }) =>
41
+ ts.factory.createObjectLiteralExpression([
42
+ ts.factory.createPropertyAssignment(
43
+ ts.factory.createIdentifier("type"),
44
+ ts.factory.createStringLiteral(next.type),
45
+ ),
46
+ ts.factory.createPropertyAssignment(
47
+ ts.factory.createIdentifier(next.key),
48
+ next.programmer({
49
+ context: {
50
+ ...props.context,
51
+ options: {}, // use default option
52
+ },
53
+ modulo: props.modulo,
54
+ type: props.type,
55
+ name: undefined,
56
+ }),
57
+ ),
58
+ ]);
59
+
60
+ // RETURNS
61
+ if (props.context.options.stringify === "is")
62
+ return parameter({
63
+ type: "is",
64
+ key: "is",
65
+ programmer: JsonIsStringifyProgrammer.write,
66
+ });
67
+ else if (props.context.options.stringify === "validate")
68
+ return parameter({
69
+ type: "validate",
70
+ key: "validate",
71
+ programmer: JsonValidateStringifyProgrammer.write,
72
+ });
73
+ else if (props.context.options.stringify === "stringify")
74
+ return parameter({
75
+ type: "stringify",
76
+ key: "stringify",
77
+ programmer: JsonStringifyProgrammer.write,
78
+ });
79
+ else if (props.context.options.stringify === "validate.log")
80
+ return parameter({
81
+ type: "validate.log",
82
+ key: "validate",
83
+ programmer: JsonValidateStringifyProgrammer.write,
84
+ });
85
+ else if (props.context.options.stringify === null)
86
+ return ts.factory.createNull();
87
+
88
+ // ASSERT IS DEFAULT
89
+ return parameter({
90
+ type: "assert",
91
+ key: "assert",
92
+ programmer: JsonAssertStringifyProgrammer.write,
93
+ });
94
+ };
95
+ }
@@ -1,72 +1,72 @@
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 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,75 +1,75 @@
1
- import ts from "typescript";
2
- import { IdentifierFactory } from "typia/lib/factories/IdentifierFactory";
3
- import { StatementFactory } from "typia/lib/factories/StatementFactory";
4
- import { IsProgrammer } from "typia/lib/programmers/IsProgrammer";
5
- import { ITypiaContext } from "typia/lib/transformers/ITypiaContext";
6
-
7
- import { HttpQuerifyProgrammer } from "./HttpQuerifyProgrammer";
8
-
9
- export namespace HttpIsQuerifyProgrammer {
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: "is",
24
- value: IsProgrammer.write({
25
- config: {
26
- equals: false,
27
- },
28
- context: {
29
- ...props.context,
30
- options: {
31
- ...props.context.options,
32
- functional: false,
33
- numeric: false,
34
- },
35
- },
36
- modulo: props.modulo,
37
- type: props.type,
38
- name: undefined,
39
- }),
40
- }),
41
- StatementFactory.constant({
42
- name: "stringify",
43
- value: HttpQuerifyProgrammer.write({
44
- context: {
45
- ...props.context,
46
- options: {
47
- ...props.context.options,
48
- functional: false,
49
- numeric: false,
50
- },
51
- },
52
- modulo: props.modulo,
53
- type: props.type,
54
- }),
55
- }),
56
- ts.factory.createReturnStatement(
57
- ts.factory.createConditionalExpression(
58
- ts.factory.createCallExpression(
59
- ts.factory.createIdentifier("is"),
60
- undefined,
61
- [ts.factory.createIdentifier("input")],
62
- ),
63
- undefined,
64
- ts.factory.createCallExpression(
65
- ts.factory.createIdentifier("stringify"),
66
- undefined,
67
- [ts.factory.createIdentifier("input")],
68
- ),
69
- undefined,
70
- ts.factory.createNull(),
71
- ),
72
- ),
73
- ]),
74
- );
75
- }
1
+ import ts from "typescript";
2
+ import { IdentifierFactory } from "typia/lib/factories/IdentifierFactory";
3
+ import { StatementFactory } from "typia/lib/factories/StatementFactory";
4
+ import { IsProgrammer } from "typia/lib/programmers/IsProgrammer";
5
+ import { ITypiaContext } from "typia/lib/transformers/ITypiaContext";
6
+
7
+ import { HttpQuerifyProgrammer } from "./HttpQuerifyProgrammer";
8
+
9
+ export namespace HttpIsQuerifyProgrammer {
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: "is",
24
+ value: IsProgrammer.write({
25
+ config: {
26
+ equals: false,
27
+ },
28
+ context: {
29
+ ...props.context,
30
+ options: {
31
+ ...props.context.options,
32
+ functional: false,
33
+ numeric: false,
34
+ },
35
+ },
36
+ modulo: props.modulo,
37
+ type: props.type,
38
+ name: undefined,
39
+ }),
40
+ }),
41
+ StatementFactory.constant({
42
+ name: "stringify",
43
+ value: HttpQuerifyProgrammer.write({
44
+ context: {
45
+ ...props.context,
46
+ options: {
47
+ ...props.context.options,
48
+ functional: false,
49
+ numeric: false,
50
+ },
51
+ },
52
+ modulo: props.modulo,
53
+ type: props.type,
54
+ }),
55
+ }),
56
+ ts.factory.createReturnStatement(
57
+ ts.factory.createConditionalExpression(
58
+ ts.factory.createCallExpression(
59
+ ts.factory.createIdentifier("is"),
60
+ undefined,
61
+ [ts.factory.createIdentifier("input")],
62
+ ),
63
+ undefined,
64
+ ts.factory.createCallExpression(
65
+ ts.factory.createIdentifier("stringify"),
66
+ undefined,
67
+ [ts.factory.createIdentifier("input")],
68
+ ),
69
+ undefined,
70
+ ts.factory.createNull(),
71
+ ),
72
+ ),
73
+ ]),
74
+ );
75
+ }