typia 4.1.0 → 4.1.1-dev.20230621

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 (34) hide show
  1. package/lib/factories/internal/metadata/iterate_metadata_array.js +1 -1
  2. package/lib/factories/internal/metadata/iterate_metadata_array.js.map +1 -1
  3. package/lib/module.d.ts +2 -2
  4. package/package.json +3 -2
  5. package/src/factories/CommentFactory.ts +64 -64
  6. package/src/factories/IdentifierFactory.ts +59 -59
  7. package/src/factories/MetadataFactory.ts +30 -30
  8. package/src/factories/internal/metadata/iterate_metadata_array.ts +1 -2
  9. package/src/metadata/MetadataObject.ts +118 -118
  10. package/src/module.ts +2038 -2038
  11. package/src/programmers/ApplicationProgrammer.ts +47 -47
  12. package/src/programmers/AssertCloneProgrammer.ts +71 -71
  13. package/src/programmers/AssertParseProgrammer.ts +66 -66
  14. package/src/programmers/AssertProgrammer.ts +279 -279
  15. package/src/programmers/AssertPruneProgrammer.ts +68 -68
  16. package/src/programmers/AssertStringifyProgrammer.ts +66 -66
  17. package/src/programmers/CloneProgrammer.ts +587 -587
  18. package/src/programmers/IsCloneProgrammer.ts +78 -78
  19. package/src/programmers/IsParseProgrammer.ts +72 -72
  20. package/src/programmers/IsProgrammer.ts +239 -239
  21. package/src/programmers/IsPruneProgrammer.ts +73 -73
  22. package/src/programmers/IsStringifyProgrammer.ts +76 -76
  23. package/src/programmers/LiteralsProgrammer.ts +60 -60
  24. package/src/programmers/PruneProgrammer.ts +542 -542
  25. package/src/programmers/RandomProgrammer.ts +581 -581
  26. package/src/programmers/StringifyProgrammer.ts +978 -978
  27. package/src/programmers/ValidateCloneProgrammer.ts +85 -85
  28. package/src/programmers/ValidateParseProgrammer.ts +70 -70
  29. package/src/programmers/ValidateProgrammer.ts +305 -305
  30. package/src/programmers/ValidatePruneProgrammer.ts +78 -78
  31. package/src/programmers/ValidateStringifyProgrammer.ts +84 -84
  32. package/src/programmers/internal/application_tuple.ts +57 -57
  33. package/src/programmers/internal/feature_object_entries.ts +63 -63
  34. package/src/schemas/IJsonSchema.ts +133 -133
@@ -1,85 +1,85 @@
1
- import ts from "typescript";
2
-
3
- import { IdentifierFactory } from "../factories/IdentifierFactory";
4
- import { StatementFactory } from "../factories/StatementFactory";
5
- import { TypeFactory } from "../factories/TypeFactory";
6
-
7
- import { IProject } from "../transformers/IProject";
8
-
9
- import { CloneProgrammer } from "./CloneProgrammer";
10
- import { ValidateProgrammer } from "./ValidateProgrammer";
11
-
12
- export namespace ValidateCloneProgrammer {
13
- export const write =
14
- (project: IProject) =>
15
- (modulo: ts.LeftHandSideExpression) =>
16
- (type: ts.Type, name?: string) =>
17
- ts.factory.createArrowFunction(
18
- undefined,
19
- undefined,
20
- [
21
- IdentifierFactory.parameter(
22
- "input",
23
- TypeFactory.keyword("any"),
24
- ),
25
- ],
26
- ts.factory.createTypeReferenceNode(
27
- `typia.IValidation<typia.Primitive<${
28
- name ?? TypeFactory.getFullName(project.checker)(type)
29
- }>>`,
30
- ),
31
- undefined,
32
- ts.factory.createBlock([
33
- StatementFactory.constant(
34
- "validate",
35
- ValidateProgrammer.write({
36
- ...project,
37
- options: {
38
- ...project.options,
39
- functional: false,
40
- numeric: true,
41
- },
42
- })(modulo)(false)(type, name),
43
- ),
44
- StatementFactory.constant(
45
- "clone",
46
- CloneProgrammer.write({
47
- ...project,
48
- options: {
49
- ...project.options,
50
- functional: false,
51
- numeric: false,
52
- },
53
- })(modulo)(type, name),
54
- ),
55
- StatementFactory.constant(
56
- "output",
57
- ts.factory.createAsExpression(
58
- ts.factory.createCallExpression(
59
- ts.factory.createIdentifier("validate"),
60
- undefined,
61
- [ts.factory.createIdentifier("input")],
62
- ),
63
- TypeFactory.keyword("any"),
64
- ),
65
- ),
66
- ts.factory.createIfStatement(
67
- ts.factory.createIdentifier("output.success"),
68
- ts.factory.createExpressionStatement(
69
- ts.factory.createBinaryExpression(
70
- ts.factory.createIdentifier("output.data"),
71
- ts.SyntaxKind.EqualsToken,
72
- ts.factory.createCallExpression(
73
- ts.factory.createIdentifier("clone"),
74
- undefined,
75
- [ts.factory.createIdentifier("input")],
76
- ),
77
- ),
78
- ),
79
- ),
80
- ts.factory.createReturnStatement(
81
- ts.factory.createIdentifier("output"),
82
- ),
83
- ]),
84
- );
85
- }
1
+ import ts from "typescript";
2
+
3
+ import { IdentifierFactory } from "../factories/IdentifierFactory";
4
+ import { StatementFactory } from "../factories/StatementFactory";
5
+ import { TypeFactory } from "../factories/TypeFactory";
6
+
7
+ import { IProject } from "../transformers/IProject";
8
+
9
+ import { CloneProgrammer } from "./CloneProgrammer";
10
+ import { ValidateProgrammer } from "./ValidateProgrammer";
11
+
12
+ export namespace ValidateCloneProgrammer {
13
+ export const write =
14
+ (project: IProject) =>
15
+ (modulo: ts.LeftHandSideExpression) =>
16
+ (type: ts.Type, name?: string) =>
17
+ ts.factory.createArrowFunction(
18
+ undefined,
19
+ undefined,
20
+ [
21
+ IdentifierFactory.parameter(
22
+ "input",
23
+ TypeFactory.keyword("any"),
24
+ ),
25
+ ],
26
+ ts.factory.createTypeReferenceNode(
27
+ `typia.IValidation<typia.Primitive<${
28
+ name ?? TypeFactory.getFullName(project.checker)(type)
29
+ }>>`,
30
+ ),
31
+ undefined,
32
+ ts.factory.createBlock([
33
+ StatementFactory.constant(
34
+ "validate",
35
+ ValidateProgrammer.write({
36
+ ...project,
37
+ options: {
38
+ ...project.options,
39
+ functional: false,
40
+ numeric: true,
41
+ },
42
+ })(modulo)(false)(type, name),
43
+ ),
44
+ StatementFactory.constant(
45
+ "clone",
46
+ CloneProgrammer.write({
47
+ ...project,
48
+ options: {
49
+ ...project.options,
50
+ functional: false,
51
+ numeric: false,
52
+ },
53
+ })(modulo)(type, name),
54
+ ),
55
+ StatementFactory.constant(
56
+ "output",
57
+ ts.factory.createAsExpression(
58
+ ts.factory.createCallExpression(
59
+ ts.factory.createIdentifier("validate"),
60
+ undefined,
61
+ [ts.factory.createIdentifier("input")],
62
+ ),
63
+ TypeFactory.keyword("any"),
64
+ ),
65
+ ),
66
+ ts.factory.createIfStatement(
67
+ ts.factory.createIdentifier("output.success"),
68
+ ts.factory.createExpressionStatement(
69
+ ts.factory.createBinaryExpression(
70
+ ts.factory.createIdentifier("output.data"),
71
+ ts.SyntaxKind.EqualsToken,
72
+ ts.factory.createCallExpression(
73
+ ts.factory.createIdentifier("clone"),
74
+ undefined,
75
+ [ts.factory.createIdentifier("input")],
76
+ ),
77
+ ),
78
+ ),
79
+ ),
80
+ ts.factory.createReturnStatement(
81
+ ts.factory.createIdentifier("output"),
82
+ ),
83
+ ]),
84
+ );
85
+ }
@@ -1,70 +1,70 @@
1
- import ts from "typescript";
2
-
3
- import { IdentifierFactory } from "../factories/IdentifierFactory";
4
- import { StatementFactory } from "../factories/StatementFactory";
5
- import { TypeFactory } from "../factories/TypeFactory";
6
-
7
- import { IProject } from "../transformers/IProject";
8
-
9
- import { ValidateProgrammer } from "./ValidateProgrammer";
10
-
11
- export namespace ValidateParseProgrammer {
12
- export const write =
13
- (project: IProject) =>
14
- (modulo: ts.LeftHandSideExpression) =>
15
- (type: ts.Type, name?: string) =>
16
- ts.factory.createArrowFunction(
17
- undefined,
18
- undefined,
19
- [
20
- IdentifierFactory.parameter(
21
- "input",
22
- TypeFactory.keyword("string"),
23
- ),
24
- ],
25
- ts.factory.createTypeReferenceNode(
26
- `typia.IValidation<typia.Primitive<${
27
- name ?? TypeFactory.getFullName(project.checker)(type)
28
- }>>`,
29
- ),
30
- undefined,
31
- ts.factory.createBlock([
32
- StatementFactory.constant(
33
- "validate",
34
- ValidateProgrammer.write({
35
- ...project,
36
- options: {
37
- ...project.options,
38
- functional: false,
39
- numeric: false,
40
- },
41
- })(modulo)(false)(type, name),
42
- ),
43
- ts.factory.createExpressionStatement(
44
- ts.factory.createBinaryExpression(
45
- ts.factory.createIdentifier("input"),
46
- ts.SyntaxKind.EqualsToken,
47
- ts.factory.createCallExpression(
48
- ts.factory.createIdentifier("JSON.parse"),
49
- undefined,
50
- [ts.factory.createIdentifier("input")],
51
- ),
52
- ),
53
- ),
54
- StatementFactory.constant(
55
- "output",
56
- ts.factory.createCallExpression(
57
- ts.factory.createIdentifier("validate"),
58
- undefined,
59
- [ts.factory.createIdentifier("input")],
60
- ),
61
- ),
62
- ts.factory.createReturnStatement(
63
- ts.factory.createAsExpression(
64
- ts.factory.createIdentifier("output"),
65
- ts.factory.createTypeReferenceNode("any"),
66
- ),
67
- ),
68
- ]),
69
- );
70
- }
1
+ import ts from "typescript";
2
+
3
+ import { IdentifierFactory } from "../factories/IdentifierFactory";
4
+ import { StatementFactory } from "../factories/StatementFactory";
5
+ import { TypeFactory } from "../factories/TypeFactory";
6
+
7
+ import { IProject } from "../transformers/IProject";
8
+
9
+ import { ValidateProgrammer } from "./ValidateProgrammer";
10
+
11
+ export namespace ValidateParseProgrammer {
12
+ export const write =
13
+ (project: IProject) =>
14
+ (modulo: ts.LeftHandSideExpression) =>
15
+ (type: ts.Type, name?: string) =>
16
+ ts.factory.createArrowFunction(
17
+ undefined,
18
+ undefined,
19
+ [
20
+ IdentifierFactory.parameter(
21
+ "input",
22
+ TypeFactory.keyword("string"),
23
+ ),
24
+ ],
25
+ ts.factory.createTypeReferenceNode(
26
+ `typia.IValidation<typia.Primitive<${
27
+ name ?? TypeFactory.getFullName(project.checker)(type)
28
+ }>>`,
29
+ ),
30
+ undefined,
31
+ ts.factory.createBlock([
32
+ StatementFactory.constant(
33
+ "validate",
34
+ ValidateProgrammer.write({
35
+ ...project,
36
+ options: {
37
+ ...project.options,
38
+ functional: false,
39
+ numeric: false,
40
+ },
41
+ })(modulo)(false)(type, name),
42
+ ),
43
+ ts.factory.createExpressionStatement(
44
+ ts.factory.createBinaryExpression(
45
+ ts.factory.createIdentifier("input"),
46
+ ts.SyntaxKind.EqualsToken,
47
+ ts.factory.createCallExpression(
48
+ ts.factory.createIdentifier("JSON.parse"),
49
+ undefined,
50
+ [ts.factory.createIdentifier("input")],
51
+ ),
52
+ ),
53
+ ),
54
+ StatementFactory.constant(
55
+ "output",
56
+ ts.factory.createCallExpression(
57
+ ts.factory.createIdentifier("validate"),
58
+ undefined,
59
+ [ts.factory.createIdentifier("input")],
60
+ ),
61
+ ),
62
+ ts.factory.createReturnStatement(
63
+ ts.factory.createAsExpression(
64
+ ts.factory.createIdentifier("output"),
65
+ ts.factory.createTypeReferenceNode("any"),
66
+ ),
67
+ ),
68
+ ]),
69
+ );
70
+ }