@nestia/core 3.17.0-dev.20240928 → 4.0.0-dev.20241010
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/README.md +0 -1
- package/lib/options/INestiaTransformProject.d.ts +2 -2
- package/lib/programmers/PlainBodyProgrammer.d.ts +6 -2
- package/lib/programmers/PlainBodyProgrammer.js +31 -13
- package/lib/programmers/PlainBodyProgrammer.js.map +1 -1
- package/lib/programmers/TypedBodyProgrammer.d.ts +6 -2
- package/lib/programmers/TypedBodyProgrammer.js +32 -13
- package/lib/programmers/TypedBodyProgrammer.js.map +1 -1
- package/lib/programmers/TypedFormDataBodyProgrammer.d.ts +6 -2
- package/lib/programmers/TypedFormDataBodyProgrammer.js +30 -17
- package/lib/programmers/TypedFormDataBodyProgrammer.js.map +1 -1
- package/lib/programmers/TypedHeadersProgrammer.d.ts +6 -2
- package/lib/programmers/TypedHeadersProgrammer.js +12 -7
- package/lib/programmers/TypedHeadersProgrammer.js.map +1 -1
- package/lib/programmers/TypedParamProgrammer.d.ts +7 -2
- package/lib/programmers/TypedParamProgrammer.js +12 -7
- package/lib/programmers/TypedParamProgrammer.js.map +1 -1
- package/lib/programmers/TypedQueryBodyProgrammer.d.ts +6 -2
- package/lib/programmers/TypedQueryBodyProgrammer.js +12 -7
- package/lib/programmers/TypedQueryBodyProgrammer.js.map +1 -1
- package/lib/programmers/TypedQueryProgrammer.d.ts +6 -2
- package/lib/programmers/TypedQueryProgrammer.js +13 -7
- package/lib/programmers/TypedQueryProgrammer.js.map +1 -1
- package/lib/programmers/TypedQueryRouteProgrammer.d.ts +6 -2
- package/lib/programmers/TypedQueryRouteProgrammer.js +10 -6
- package/lib/programmers/TypedQueryRouteProgrammer.js.map +1 -1
- package/lib/programmers/TypedRouteProgrammer.d.ts +6 -2
- package/lib/programmers/TypedRouteProgrammer.js +14 -9
- package/lib/programmers/TypedRouteProgrammer.js.map +1 -1
- package/lib/programmers/http/HttpAssertQuerifyProgrammer.d.ts +6 -2
- package/lib/programmers/http/HttpAssertQuerifyProgrammer.js +22 -3
- package/lib/programmers/http/HttpAssertQuerifyProgrammer.js.map +1 -1
- package/lib/programmers/http/HttpIsQuerifyProgrammer.d.ts +6 -2
- package/lib/programmers/http/HttpIsQuerifyProgrammer.js +21 -3
- package/lib/programmers/http/HttpIsQuerifyProgrammer.js.map +1 -1
- package/lib/programmers/http/HttpQuerifyProgrammer.d.ts +6 -2
- package/lib/programmers/http/HttpQuerifyProgrammer.js +27 -15
- package/lib/programmers/http/HttpQuerifyProgrammer.js.map +1 -1
- package/lib/programmers/http/HttpValidateQuerifyProgrammer.d.ts +6 -2
- package/lib/programmers/http/HttpValidateQuerifyProgrammer.js +25 -4
- package/lib/programmers/http/HttpValidateQuerifyProgrammer.js.map +1 -1
- package/lib/transform.d.ts +2 -2
- package/lib/transform.js.map +1 -1
- package/lib/transformers/FileTransformer.d.ts +2 -2
- package/lib/transformers/FileTransformer.js +24 -10
- package/lib/transformers/FileTransformer.js.map +1 -1
- package/lib/transformers/MethodTransformer.d.ts +5 -2
- package/lib/transformers/MethodTransformer.js +21 -14
- package/lib/transformers/MethodTransformer.js.map +1 -1
- package/lib/transformers/NodeTransformer.d.ts +5 -2
- package/lib/transformers/NodeTransformer.js +11 -5
- package/lib/transformers/NodeTransformer.js.map +1 -1
- package/lib/transformers/ParameterDecoratorTransformer.d.ts +6 -2
- package/lib/transformers/ParameterDecoratorTransformer.js +49 -40
- package/lib/transformers/ParameterDecoratorTransformer.js.map +1 -1
- package/lib/transformers/ParameterTransformer.d.ts +5 -2
- package/lib/transformers/ParameterTransformer.js +17 -9
- package/lib/transformers/ParameterTransformer.js.map +1 -1
- package/lib/transformers/TypedRouteTransformer.d.ts +6 -2
- package/lib/transformers/TypedRouteTransformer.js +20 -16
- package/lib/transformers/TypedRouteTransformer.js.map +1 -1
- package/lib/transformers/WebSocketRouteTransformer.d.ts +6 -2
- package/lib/transformers/WebSocketRouteTransformer.js +11 -11
- package/lib/transformers/WebSocketRouteTransformer.js.map +1 -1
- package/package.json +5 -5
- package/src/options/INestiaTransformProject.ts +3 -2
- package/src/programmers/PlainBodyProgrammer.ts +32 -13
- package/src/programmers/TypedBodyProgrammer.ts +106 -82
- package/src/programmers/TypedFormDataBodyProgrammer.ts +87 -77
- package/src/programmers/TypedHeadersProgrammer.ts +48 -41
- package/src/programmers/TypedParamProgrammer.ts +21 -15
- package/src/programmers/TypedQueryBodyProgrammer.ts +48 -41
- package/src/programmers/TypedQueryProgrammer.ts +50 -45
- package/src/programmers/TypedQueryRouteProgrammer.ts +44 -39
- package/src/programmers/TypedRouteProgrammer.ts +63 -61
- package/src/programmers/http/HttpAssertQuerifyProgrammer.ts +54 -40
- package/src/programmers/http/HttpIsQuerifyProgrammer.ts +54 -41
- package/src/programmers/http/HttpQuerifyProgrammer.ts +60 -48
- package/src/programmers/http/HttpValidateQuerifyProgrammer.ts +54 -41
- package/src/transform.ts +2 -2
- package/src/transformers/FileTransformer.ts +68 -46
- package/src/transformers/MethodTransformer.ts +56 -51
- package/src/transformers/NodeTransformer.ts +16 -9
- package/src/transformers/ParameterDecoratorTransformer.ts +100 -91
- package/src/transformers/ParameterTransformer.ts +47 -38
- package/src/transformers/TypedRouteTransformer.ts +58 -55
- package/src/transformers/WebSocketRouteTransformer.ts +81 -78
|
@@ -2,55 +2,62 @@ import ts from "typescript";
|
|
|
2
2
|
import { HttpAssertQueryProgrammer } from "typia/lib/programmers/http/HttpAssertQueryProgrammer";
|
|
3
3
|
import { HttpIsQueryProgrammer } from "typia/lib/programmers/http/HttpIsQueryProgrammer";
|
|
4
4
|
import { HttpValidateQueryProgrammer } from "typia/lib/programmers/http/HttpValidateQueryProgrammer";
|
|
5
|
-
import {
|
|
5
|
+
import { ITypiaContext } from "typia/lib/transformers/ITypiaContext";
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { INestiaTransformContext } from "../options/INestiaTransformProject";
|
|
8
8
|
import { IRequestQueryValidator } from "../options/IRequestQueryValidator";
|
|
9
9
|
|
|
10
10
|
export namespace TypedQueryBodyProgrammer {
|
|
11
|
-
export const generate =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
),
|
|
30
|
-
ts.factory.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
11
|
+
export const generate = (props: {
|
|
12
|
+
context: INestiaTransformContext;
|
|
13
|
+
modulo: ts.LeftHandSideExpression;
|
|
14
|
+
type: ts.Type;
|
|
15
|
+
}): ts.ObjectLiteralExpression => {
|
|
16
|
+
// GENERATE VALIDATION PLAN
|
|
17
|
+
const parameter =
|
|
18
|
+
(key: IRequestQueryValidator<any>["type"]) =>
|
|
19
|
+
(
|
|
20
|
+
programmer: (next: {
|
|
21
|
+
context: ITypiaContext;
|
|
22
|
+
modulo: ts.LeftHandSideExpression;
|
|
23
|
+
type: ts.Type;
|
|
24
|
+
name: string | undefined;
|
|
25
|
+
}) => ts.Expression,
|
|
26
|
+
) =>
|
|
27
|
+
ts.factory.createObjectLiteralExpression([
|
|
28
|
+
ts.factory.createPropertyAssignment(
|
|
29
|
+
ts.factory.createIdentifier("type"),
|
|
30
|
+
ts.factory.createStringLiteral(key),
|
|
31
|
+
),
|
|
32
|
+
ts.factory.createPropertyAssignment(
|
|
33
|
+
ts.factory.createIdentifier(key),
|
|
34
|
+
programmer({
|
|
35
|
+
context: {
|
|
36
|
+
...props.context,
|
|
34
37
|
options: {
|
|
35
38
|
numeric: false,
|
|
36
39
|
finite: false,
|
|
37
40
|
functional: false,
|
|
38
41
|
},
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
},
|
|
43
|
+
modulo: props.modulo,
|
|
44
|
+
type: props.type,
|
|
45
|
+
name: undefined,
|
|
46
|
+
}),
|
|
47
|
+
),
|
|
48
|
+
]);
|
|
42
49
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
// RETURNS
|
|
51
|
+
const category = props.context.options.validate;
|
|
52
|
+
if (category === "is" || category === "equals")
|
|
53
|
+
return parameter("is")(HttpIsQueryProgrammer.write);
|
|
54
|
+
else if (
|
|
55
|
+
category === "validate" ||
|
|
56
|
+
category === "validateEquals" ||
|
|
57
|
+
category === "validateClone" ||
|
|
58
|
+
category === "validatePrune"
|
|
59
|
+
)
|
|
60
|
+
return parameter("validate")(HttpValidateQueryProgrammer.write);
|
|
61
|
+
return parameter("assert")(HttpAssertQueryProgrammer.write);
|
|
62
|
+
};
|
|
56
63
|
}
|
|
@@ -2,59 +2,64 @@ import ts from "typescript";
|
|
|
2
2
|
import { HttpAssertQueryProgrammer } from "typia/lib/programmers/http/HttpAssertQueryProgrammer";
|
|
3
3
|
import { HttpIsQueryProgrammer } from "typia/lib/programmers/http/HttpIsQueryProgrammer";
|
|
4
4
|
import { HttpValidateQueryProgrammer } from "typia/lib/programmers/http/HttpValidateQueryProgrammer";
|
|
5
|
-
import {
|
|
5
|
+
import { ITypiaContext } from "typia/lib/transformers/ITypiaContext";
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { INestiaTransformContext } from "../options/INestiaTransformProject";
|
|
8
8
|
import { IRequestQueryValidator } from "../options/IRequestQueryValidator";
|
|
9
9
|
|
|
10
10
|
export namespace TypedQueryProgrammer {
|
|
11
|
-
export const generate =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
),
|
|
31
|
-
ts.factory.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
11
|
+
export const generate = (props: {
|
|
12
|
+
context: INestiaTransformContext;
|
|
13
|
+
modulo: ts.LeftHandSideExpression;
|
|
14
|
+
type: ts.Type;
|
|
15
|
+
}): ts.Expression => {
|
|
16
|
+
// GENERATE VALIDATION PLAN
|
|
17
|
+
const parameter =
|
|
18
|
+
(key: IRequestQueryValidator<any>["type"]) =>
|
|
19
|
+
(
|
|
20
|
+
programmer: (next: {
|
|
21
|
+
context: ITypiaContext;
|
|
22
|
+
modulo: ts.LeftHandSideExpression;
|
|
23
|
+
type: ts.Type;
|
|
24
|
+
name: string | undefined;
|
|
25
|
+
allowOptional: boolean;
|
|
26
|
+
}) => ts.Expression,
|
|
27
|
+
) =>
|
|
28
|
+
ts.factory.createObjectLiteralExpression([
|
|
29
|
+
ts.factory.createPropertyAssignment(
|
|
30
|
+
ts.factory.createIdentifier("type"),
|
|
31
|
+
ts.factory.createStringLiteral(key),
|
|
32
|
+
),
|
|
33
|
+
ts.factory.createPropertyAssignment(
|
|
34
|
+
ts.factory.createIdentifier(key),
|
|
35
|
+
programmer({
|
|
36
|
+
context: {
|
|
37
|
+
...props.context,
|
|
35
38
|
options: {
|
|
36
39
|
numeric: false,
|
|
37
40
|
finite: false,
|
|
38
41
|
functional: false,
|
|
39
42
|
},
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
},
|
|
44
|
+
modulo: props.modulo,
|
|
45
|
+
type: props.type,
|
|
46
|
+
name: undefined,
|
|
47
|
+
allowOptional: true,
|
|
48
|
+
}),
|
|
49
|
+
),
|
|
50
|
+
]);
|
|
46
51
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
52
|
+
// RETURNS
|
|
53
|
+
const category = props.context.options.validate;
|
|
54
|
+
if (category === "is" || category === "equals")
|
|
55
|
+
return parameter("is")(HttpIsQueryProgrammer.write);
|
|
56
|
+
else if (
|
|
57
|
+
category === "validate" ||
|
|
58
|
+
category === "validateEquals" ||
|
|
59
|
+
category === "validateClone" ||
|
|
60
|
+
category === "validatePrune"
|
|
61
|
+
)
|
|
62
|
+
return parameter("validate")(HttpValidateQueryProgrammer.write);
|
|
63
|
+
return parameter("assert")(HttpAssertQueryProgrammer.write);
|
|
64
|
+
};
|
|
60
65
|
}
|
|
@@ -1,51 +1,56 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
|
-
import {
|
|
2
|
+
import { ITypiaContext } from "typia/lib/transformers/ITypiaContext";
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { INestiaTransformContext } from "../options/INestiaTransformProject";
|
|
5
5
|
import { HttpAssertQuerifyProgrammer } from "./http/HttpAssertQuerifyProgrammer";
|
|
6
6
|
import { HttpIsQuerifyProgrammer } from "./http/HttpIsQuerifyProgrammer";
|
|
7
7
|
import { HttpQuerifyProgrammer } from "./http/HttpQuerifyProgrammer";
|
|
8
8
|
import { HttpValidateQuerifyProgrammer } from "./http/HttpValidateQuerifyProgrammer";
|
|
9
9
|
|
|
10
10
|
export namespace TypedQueryRouteProgrammer {
|
|
11
|
-
export const generate =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
) =>
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
),
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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,
|
|
33
35
|
options: {}, // use default option
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
},
|
|
37
|
+
modulo: props.modulo,
|
|
38
|
+
type: props.type,
|
|
39
|
+
}),
|
|
40
|
+
),
|
|
41
|
+
]);
|
|
37
42
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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();
|
|
47
52
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
53
|
+
// ASSERT IS DEFAULT
|
|
54
|
+
return parameter("assert", HttpAssertQuerifyProgrammer.write);
|
|
55
|
+
};
|
|
51
56
|
}
|
|
@@ -3,72 +3,74 @@ import { JsonAssertStringifyProgrammer } from "typia/lib/programmers/json/JsonAs
|
|
|
3
3
|
import { JsonIsStringifyProgrammer } from "typia/lib/programmers/json/JsonIsStringifyProgrammer";
|
|
4
4
|
import { JsonStringifyProgrammer } from "typia/lib/programmers/json/JsonStringifyProgrammer";
|
|
5
5
|
import { JsonValidateStringifyProgrammer } from "typia/lib/programmers/json/JsonValidateStringifyProgrammer";
|
|
6
|
-
import {
|
|
6
|
+
import { IProgrammerProps } from "typia/lib/transformers/IProgrammerProps";
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { INestiaTransformContext } from "../options/INestiaTransformProject";
|
|
9
9
|
|
|
10
10
|
export namespace TypedRouteProgrammer {
|
|
11
|
-
export const generate =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
props.programmer({
|
|
33
|
-
...project,
|
|
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,
|
|
34
32
|
options: {}, // use default option
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
},
|
|
34
|
+
modulo: props.modulo,
|
|
35
|
+
type: props.type,
|
|
36
|
+
name: undefined,
|
|
37
|
+
}),
|
|
38
|
+
),
|
|
39
|
+
]);
|
|
38
40
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
return parameter({
|
|
60
|
-
type: "validate.log",
|
|
61
|
-
key: "validate",
|
|
62
|
-
programmer: JsonValidateStringifyProgrammer.write,
|
|
63
|
-
});
|
|
64
|
-
else if (project.options.stringify === null)
|
|
65
|
-
return ts.factory.createNull();
|
|
66
|
-
|
|
67
|
-
// ASSERT IS DEFAULT
|
|
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")
|
|
68
61
|
return parameter({
|
|
69
|
-
type: "
|
|
70
|
-
key: "
|
|
71
|
-
programmer:
|
|
62
|
+
type: "validate.log",
|
|
63
|
+
key: "validate",
|
|
64
|
+
programmer: JsonValidateStringifyProgrammer.write,
|
|
72
65
|
});
|
|
73
|
-
|
|
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
|
+
};
|
|
74
76
|
}
|
|
@@ -2,57 +2,71 @@ import ts from "typescript";
|
|
|
2
2
|
import { IdentifierFactory } from "typia/lib/factories/IdentifierFactory";
|
|
3
3
|
import { StatementFactory } from "typia/lib/factories/StatementFactory";
|
|
4
4
|
import { AssertProgrammer } from "typia/lib/programmers/AssertProgrammer";
|
|
5
|
-
import {
|
|
5
|
+
import { ITypiaContext } from "typia/lib/transformers/ITypiaContext";
|
|
6
6
|
|
|
7
7
|
import { HttpQuerifyProgrammer } from "./HttpQuerifyProgrammer";
|
|
8
8
|
|
|
9
9
|
export namespace HttpAssertQuerifyProgrammer {
|
|
10
|
-
export const write =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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,
|
|
25
27
|
options: {
|
|
26
|
-
...
|
|
28
|
+
...props.context.options,
|
|
27
29
|
functional: false,
|
|
28
30
|
numeric: false,
|
|
29
31
|
},
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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,
|
|
36
47
|
options: {
|
|
37
|
-
...
|
|
48
|
+
...props.context.options,
|
|
38
49
|
functional: false,
|
|
39
50
|
numeric: false,
|
|
40
51
|
},
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
),
|
|
53
|
-
|
|
54
|
-
|
|
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
|
+
],
|
|
55
68
|
),
|
|
56
|
-
|
|
57
|
-
)
|
|
69
|
+
),
|
|
70
|
+
]),
|
|
71
|
+
);
|
|
58
72
|
}
|