@nestia/core 11.0.0-dev.20260313-5 → 11.0.0

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 (60) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +93 -93
  3. package/lib/decorators/NoTransformConfigurationError.d.ts +1 -24
  4. package/lib/decorators/NoTransformConfigurationError.js +2 -0
  5. package/lib/decorators/NoTransformConfigurationError.js.map +1 -1
  6. package/lib/decorators/doNotThrowTransformError.d.ts +1 -0
  7. package/lib/decorators/doNotThrowTransformError.js +9 -0
  8. package/lib/decorators/doNotThrowTransformError.js.map +1 -0
  9. package/lib/module.d.ts +1 -1
  10. package/lib/module.js +1 -1
  11. package/lib/module.js.map +1 -1
  12. package/lib/options/INestiaTransformOptions.d.ts +1 -1
  13. package/lib/programmers/PlainBodyProgrammer.js +1 -1
  14. package/lib/programmers/PlainBodyProgrammer.js.map +1 -1
  15. package/lib/programmers/TypedBodyProgrammer.js +6 -3
  16. package/lib/programmers/TypedBodyProgrammer.js.map +1 -1
  17. package/lib/programmers/TypedQueryBodyProgrammer.js +9 -4
  18. package/lib/programmers/TypedQueryBodyProgrammer.js.map +1 -1
  19. package/lib/programmers/TypedQueryProgrammer.js +9 -4
  20. package/lib/programmers/TypedQueryProgrammer.js.map +1 -1
  21. package/lib/programmers/TypedQueryRouteProgrammer.js +14 -8
  22. package/lib/programmers/TypedQueryRouteProgrammer.js.map +1 -1
  23. package/lib/programmers/TypedRouteProgrammer.js +11 -6
  24. package/lib/programmers/TypedRouteProgrammer.js.map +1 -1
  25. package/package.json +8 -8
  26. package/src/adaptors/WebSocketAdaptor.ts +429 -429
  27. package/src/decorators/EncryptedBody.ts +96 -96
  28. package/src/decorators/EncryptedController.ts +40 -40
  29. package/src/decorators/EncryptedModule.ts +98 -98
  30. package/src/decorators/EncryptedRoute.ts +212 -212
  31. package/src/decorators/HumanRoute.ts +21 -21
  32. package/src/decorators/NoTransformConfigurationError.ts +37 -34
  33. package/src/decorators/SwaggerCustomizer.ts +97 -97
  34. package/src/decorators/TypedFormData.ts +187 -187
  35. package/src/decorators/TypedRoute.ts +196 -196
  36. package/src/decorators/doNotThrowTransformError.ts +5 -0
  37. package/src/decorators/internal/headers_to_object.ts +11 -11
  38. package/src/module.ts +23 -23
  39. package/src/options/INestiaTransformOptions.ts +34 -34
  40. package/src/options/INestiaTransformProject.ts +10 -10
  41. package/src/programmers/PlainBodyProgrammer.ts +72 -72
  42. package/src/programmers/TypedBodyProgrammer.ts +148 -144
  43. package/src/programmers/TypedFormDataBodyProgrammer.ts +118 -118
  44. package/src/programmers/TypedHeadersProgrammer.ts +65 -65
  45. package/src/programmers/TypedParamProgrammer.ts +33 -33
  46. package/src/programmers/TypedQueryBodyProgrammer.ts +113 -111
  47. package/src/programmers/TypedQueryProgrammer.ts +115 -113
  48. package/src/programmers/TypedQueryRouteProgrammer.ts +107 -104
  49. package/src/programmers/TypedRouteProgrammer.ts +103 -96
  50. package/src/programmers/http/HttpAssertQuerifyProgrammer.ts +74 -74
  51. package/src/programmers/http/HttpIsQuerifyProgrammer.ts +77 -77
  52. package/src/programmers/http/HttpQuerifyProgrammer.ts +110 -110
  53. package/src/programmers/http/HttpValidateQuerifyProgrammer.ts +78 -78
  54. package/src/programmers/internal/CoreMetadataUtil.ts +21 -21
  55. package/src/transform.ts +35 -35
  56. package/src/transformers/FileTransformer.ts +109 -109
  57. package/src/transformers/MethodTransformer.ts +103 -103
  58. package/src/transformers/ParameterDecoratorTransformer.ts +143 -143
  59. package/src/transformers/TypedRouteTransformer.ts +85 -85
  60. package/src/transformers/WebSocketRouteTransformer.ts +120 -120
@@ -1,74 +1,74 @@
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
- }
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
+ }
@@ -1,77 +1,77 @@
1
- import {
2
- ITypiaContext,
3
- IdentifierFactory,
4
- IsProgrammer,
5
- StatementFactory,
6
- } from "@typia/core";
7
- import ts from "typescript";
8
-
9
- import { HttpQuerifyProgrammer } from "./HttpQuerifyProgrammer";
10
-
11
- export namespace HttpIsQuerifyProgrammer {
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: "is",
26
- value: IsProgrammer.write({
27
- config: {
28
- equals: false,
29
- },
30
- context: {
31
- ...props.context,
32
- options: {
33
- ...props.context.options,
34
- functional: false,
35
- numeric: false,
36
- },
37
- },
38
- modulo: props.modulo,
39
- type: props.type,
40
- name: undefined,
41
- }),
42
- }),
43
- StatementFactory.constant({
44
- name: "stringify",
45
- value: HttpQuerifyProgrammer.write({
46
- context: {
47
- ...props.context,
48
- options: {
49
- ...props.context.options,
50
- functional: false,
51
- numeric: false,
52
- },
53
- },
54
- modulo: props.modulo,
55
- type: props.type,
56
- }),
57
- }),
58
- ts.factory.createReturnStatement(
59
- ts.factory.createConditionalExpression(
60
- ts.factory.createCallExpression(
61
- ts.factory.createIdentifier("is"),
62
- undefined,
63
- [ts.factory.createIdentifier("input")],
64
- ),
65
- undefined,
66
- ts.factory.createCallExpression(
67
- ts.factory.createIdentifier("stringify"),
68
- undefined,
69
- [ts.factory.createIdentifier("input")],
70
- ),
71
- undefined,
72
- ts.factory.createNull(),
73
- ),
74
- ),
75
- ]),
76
- );
77
- }
1
+ import {
2
+ ITypiaContext,
3
+ IdentifierFactory,
4
+ IsProgrammer,
5
+ StatementFactory,
6
+ } from "@typia/core";
7
+ import ts from "typescript";
8
+
9
+ import { HttpQuerifyProgrammer } from "./HttpQuerifyProgrammer";
10
+
11
+ export namespace HttpIsQuerifyProgrammer {
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: "is",
26
+ value: IsProgrammer.write({
27
+ config: {
28
+ equals: false,
29
+ },
30
+ context: {
31
+ ...props.context,
32
+ options: {
33
+ ...props.context.options,
34
+ functional: false,
35
+ numeric: false,
36
+ },
37
+ },
38
+ modulo: props.modulo,
39
+ type: props.type,
40
+ name: undefined,
41
+ }),
42
+ }),
43
+ StatementFactory.constant({
44
+ name: "stringify",
45
+ value: HttpQuerifyProgrammer.write({
46
+ context: {
47
+ ...props.context,
48
+ options: {
49
+ ...props.context.options,
50
+ functional: false,
51
+ numeric: false,
52
+ },
53
+ },
54
+ modulo: props.modulo,
55
+ type: props.type,
56
+ }),
57
+ }),
58
+ ts.factory.createReturnStatement(
59
+ ts.factory.createConditionalExpression(
60
+ ts.factory.createCallExpression(
61
+ ts.factory.createIdentifier("is"),
62
+ undefined,
63
+ [ts.factory.createIdentifier("input")],
64
+ ),
65
+ undefined,
66
+ ts.factory.createCallExpression(
67
+ ts.factory.createIdentifier("stringify"),
68
+ undefined,
69
+ [ts.factory.createIdentifier("input")],
70
+ ),
71
+ undefined,
72
+ ts.factory.createNull(),
73
+ ),
74
+ ),
75
+ ]),
76
+ );
77
+ }
@@ -1,110 +1,110 @@
1
- import {
2
- FunctionProgrammer,
3
- HttpQueryProgrammer,
4
- ITypiaContext,
5
- IdentifierFactory,
6
- MetadataCollection,
7
- MetadataFactory,
8
- MetadataObject,
9
- MetadataSchema,
10
- StatementFactory,
11
- TransformerError,
12
- } from "@typia/core";
13
- import ts from "typescript";
14
-
15
- export namespace HttpQuerifyProgrammer {
16
- export const write = (props: {
17
- context: ITypiaContext;
18
- modulo: ts.LeftHandSideExpression;
19
- type: ts.Type;
20
- }): ts.ArrowFunction => {
21
- // GET OBJECT TYPE
22
- const functor: FunctionProgrammer = new FunctionProgrammer(
23
- props.modulo.getText(),
24
- );
25
- const storage: MetadataCollection = new MetadataCollection();
26
- const result = MetadataFactory.analyze({
27
- checker: props.context.checker,
28
- transformer: props.context.transformer,
29
- options: {
30
- escape: false,
31
- constant: true,
32
- absorb: true,
33
- validate: HttpQueryProgrammer.validate,
34
- },
35
- type: props.type,
36
- components: storage,
37
- });
38
- if (result.success === false)
39
- throw TransformerError.from({
40
- code: functor.method,
41
- errors: result.errors,
42
- });
43
-
44
- const object: MetadataObject = result.data.objects[0]!;
45
- return ts.factory.createArrowFunction(
46
- undefined,
47
- undefined,
48
- [IdentifierFactory.parameter("input")],
49
- undefined,
50
- undefined,
51
- ts.factory.createBlock(
52
- [
53
- ...functor.declare(),
54
- StatementFactory.constant({
55
- name: "output",
56
- value: ts.factory.createNewExpression(
57
- ts.factory.createIdentifier("URLSearchParams"),
58
- undefined,
59
- [],
60
- ),
61
- }),
62
- ...object.type.properties.map((p) =>
63
- ts.factory.createExpressionStatement(
64
- decode(p.key.constants[0]!.values[0]!.value as string)(p.value),
65
- ),
66
- ),
67
- ts.factory.createReturnStatement(
68
- ts.factory.createIdentifier("output"),
69
- ),
70
- ],
71
- true,
72
- ),
73
- );
74
- };
75
-
76
- const decode =
77
- (key: string) =>
78
- (value: MetadataSchema): ts.CallExpression =>
79
- !!value.arrays.length
80
- ? ts.factory.createCallExpression(
81
- IdentifierFactory.access(
82
- IdentifierFactory.access(
83
- ts.factory.createIdentifier("input"),
84
- key,
85
- ),
86
- "forEach",
87
- ),
88
- undefined,
89
- [
90
- ts.factory.createArrowFunction(
91
- undefined,
92
- undefined,
93
- [IdentifierFactory.parameter("elem")],
94
- undefined,
95
- undefined,
96
- append(key)(ts.factory.createIdentifier("elem")),
97
- ),
98
- ],
99
- )
100
- : append(key)(
101
- IdentifierFactory.access(ts.factory.createIdentifier("input"), key),
102
- );
103
-
104
- const append = (key: string) => (elem: ts.Expression) =>
105
- ts.factory.createCallExpression(
106
- IdentifierFactory.access(ts.factory.createIdentifier("output"), "append"),
107
- undefined,
108
- [ts.factory.createStringLiteral(key), elem],
109
- );
110
- }
1
+ import {
2
+ FunctionProgrammer,
3
+ HttpQueryProgrammer,
4
+ ITypiaContext,
5
+ IdentifierFactory,
6
+ MetadataCollection,
7
+ MetadataFactory,
8
+ MetadataObject,
9
+ MetadataSchema,
10
+ StatementFactory,
11
+ TransformerError,
12
+ } from "@typia/core";
13
+ import ts from "typescript";
14
+
15
+ export namespace HttpQuerifyProgrammer {
16
+ export const write = (props: {
17
+ context: ITypiaContext;
18
+ modulo: ts.LeftHandSideExpression;
19
+ type: ts.Type;
20
+ }): ts.ArrowFunction => {
21
+ // GET OBJECT TYPE
22
+ const functor: FunctionProgrammer = new FunctionProgrammer(
23
+ props.modulo.getText(),
24
+ );
25
+ const storage: MetadataCollection = new MetadataCollection();
26
+ const result = MetadataFactory.analyze({
27
+ checker: props.context.checker,
28
+ transformer: props.context.transformer,
29
+ options: {
30
+ escape: false,
31
+ constant: true,
32
+ absorb: true,
33
+ validate: HttpQueryProgrammer.validate,
34
+ },
35
+ type: props.type,
36
+ components: storage,
37
+ });
38
+ if (result.success === false)
39
+ throw TransformerError.from({
40
+ code: functor.method,
41
+ errors: result.errors,
42
+ });
43
+
44
+ const object: MetadataObject = result.data.objects[0]!;
45
+ return ts.factory.createArrowFunction(
46
+ undefined,
47
+ undefined,
48
+ [IdentifierFactory.parameter("input")],
49
+ undefined,
50
+ undefined,
51
+ ts.factory.createBlock(
52
+ [
53
+ ...functor.declare(),
54
+ StatementFactory.constant({
55
+ name: "output",
56
+ value: ts.factory.createNewExpression(
57
+ ts.factory.createIdentifier("URLSearchParams"),
58
+ undefined,
59
+ [],
60
+ ),
61
+ }),
62
+ ...object.type.properties.map((p) =>
63
+ ts.factory.createExpressionStatement(
64
+ decode(p.key.constants[0]!.values[0]!.value as string)(p.value),
65
+ ),
66
+ ),
67
+ ts.factory.createReturnStatement(
68
+ ts.factory.createIdentifier("output"),
69
+ ),
70
+ ],
71
+ true,
72
+ ),
73
+ );
74
+ };
75
+
76
+ const decode =
77
+ (key: string) =>
78
+ (value: MetadataSchema): ts.CallExpression =>
79
+ !!value.arrays.length
80
+ ? ts.factory.createCallExpression(
81
+ IdentifierFactory.access(
82
+ IdentifierFactory.access(
83
+ ts.factory.createIdentifier("input"),
84
+ key,
85
+ ),
86
+ "forEach",
87
+ ),
88
+ undefined,
89
+ [
90
+ ts.factory.createArrowFunction(
91
+ undefined,
92
+ undefined,
93
+ [IdentifierFactory.parameter("elem")],
94
+ undefined,
95
+ undefined,
96
+ append(key)(ts.factory.createIdentifier("elem")),
97
+ ),
98
+ ],
99
+ )
100
+ : append(key)(
101
+ IdentifierFactory.access(ts.factory.createIdentifier("input"), key),
102
+ );
103
+
104
+ const append = (key: string) => (elem: ts.Expression) =>
105
+ ts.factory.createCallExpression(
106
+ IdentifierFactory.access(ts.factory.createIdentifier("output"), "append"),
107
+ undefined,
108
+ [ts.factory.createStringLiteral(key), elem],
109
+ );
110
+ }
@@ -1,78 +1,78 @@
1
- import {
2
- ITypiaContext,
3
- IdentifierFactory,
4
- StatementFactory,
5
- ValidateProgrammer,
6
- } from "@typia/core";
7
- import ts from "typescript";
8
-
9
- import { HttpQuerifyProgrammer } from "./HttpQuerifyProgrammer";
10
-
11
- export namespace HttpValidateQuerifyProgrammer {
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: "validate",
26
- value: ValidateProgrammer.write({
27
- config: {
28
- equals: false,
29
- },
30
- context: {
31
- ...props.context,
32
- options: {
33
- ...props.context.options,
34
- functional: false,
35
- numeric: true,
36
- },
37
- },
38
- modulo: props.modulo,
39
- type: props.type,
40
- name: undefined,
41
- }),
42
- }),
43
- StatementFactory.constant({
44
- name: "query",
45
- value: HttpQuerifyProgrammer.write({
46
- context: {
47
- ...props.context,
48
- options: {
49
- ...props.context.options,
50
- functional: false,
51
- numeric: false,
52
- },
53
- },
54
- modulo: props.modulo,
55
- type: props.type,
56
- }),
57
- }),
58
- StatementFactory.constant({
59
- name: "output",
60
- value: ts.factory.createCallExpression(
61
- ts.factory.createIdentifier("query"),
62
- undefined,
63
- [ts.factory.createIdentifier("input")],
64
- ),
65
- }),
66
- ts.factory.createReturnStatement(
67
- ts.factory.createAsExpression(
68
- ts.factory.createCallExpression(
69
- ts.factory.createIdentifier("validate"),
70
- undefined,
71
- [ts.factory.createIdentifier("output")],
72
- ),
73
- ts.factory.createTypeReferenceNode("any"),
74
- ),
75
- ),
76
- ]),
77
- );
78
- }
1
+ import {
2
+ ITypiaContext,
3
+ IdentifierFactory,
4
+ StatementFactory,
5
+ ValidateProgrammer,
6
+ } from "@typia/core";
7
+ import ts from "typescript";
8
+
9
+ import { HttpQuerifyProgrammer } from "./HttpQuerifyProgrammer";
10
+
11
+ export namespace HttpValidateQuerifyProgrammer {
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: "validate",
26
+ value: ValidateProgrammer.write({
27
+ config: {
28
+ equals: false,
29
+ },
30
+ context: {
31
+ ...props.context,
32
+ options: {
33
+ ...props.context.options,
34
+ functional: false,
35
+ numeric: true,
36
+ },
37
+ },
38
+ modulo: props.modulo,
39
+ type: props.type,
40
+ name: undefined,
41
+ }),
42
+ }),
43
+ StatementFactory.constant({
44
+ name: "query",
45
+ value: HttpQuerifyProgrammer.write({
46
+ context: {
47
+ ...props.context,
48
+ options: {
49
+ ...props.context.options,
50
+ functional: false,
51
+ numeric: false,
52
+ },
53
+ },
54
+ modulo: props.modulo,
55
+ type: props.type,
56
+ }),
57
+ }),
58
+ StatementFactory.constant({
59
+ name: "output",
60
+ value: ts.factory.createCallExpression(
61
+ ts.factory.createIdentifier("query"),
62
+ undefined,
63
+ [ts.factory.createIdentifier("input")],
64
+ ),
65
+ }),
66
+ ts.factory.createReturnStatement(
67
+ ts.factory.createAsExpression(
68
+ ts.factory.createCallExpression(
69
+ ts.factory.createIdentifier("validate"),
70
+ undefined,
71
+ [ts.factory.createIdentifier("output")],
72
+ ),
73
+ ts.factory.createTypeReferenceNode("any"),
74
+ ),
75
+ ),
76
+ ]),
77
+ );
78
+ }