typia 3.5.0-dev.20230211 → 3.5.0-dev.20230213
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 +7 -0
- package/lib/module.d.ts +197 -4
- package/lib/module.js +74 -2
- package/lib/module.js.map +1 -1
- package/lib/programmers/AssertPruneProgrammer.d.ts +5 -0
- package/lib/programmers/AssertPruneProgrammer.js +37 -0
- package/lib/programmers/AssertPruneProgrammer.js.map +1 -0
- package/lib/programmers/CloneProgrammer.d.ts +5 -0
- package/lib/programmers/CloneProgrammer.js +287 -0
- package/lib/programmers/CloneProgrammer.js.map +1 -0
- package/lib/programmers/IsPruneProgrammer.d.ts +5 -0
- package/lib/programmers/IsPruneProgrammer.js +37 -0
- package/lib/programmers/IsPruneProgrammer.js.map +1 -0
- package/lib/programmers/PruneProgrammer.js +2 -2
- package/lib/programmers/PruneProgrammer.js.map +1 -1
- package/lib/programmers/ValidatePruneProgrammer.d.ts +5 -0
- package/lib/programmers/ValidatePruneProgrammer.js +37 -0
- package/lib/programmers/ValidatePruneProgrammer.js.map +1 -0
- package/lib/programmers/helpers/CloneJoiner.d.ts +8 -0
- package/lib/programmers/helpers/CloneJoiner.js +80 -0
- package/lib/programmers/helpers/CloneJoiner.js.map +1 -0
- package/lib/programmers/internal/feature_object_entries.d.ts +1 -1
- package/lib/transformers/CallExpressionTransformer.js +17 -1
- package/lib/transformers/CallExpressionTransformer.js.map +1 -1
- package/lib/transformers/features/miscellaneous/AssertPruneTransformer.d.ts +5 -0
- package/lib/transformers/features/miscellaneous/AssertPruneTransformer.js +23 -0
- package/lib/transformers/features/miscellaneous/AssertPruneTransformer.js.map +1 -0
- package/lib/transformers/features/miscellaneous/CloneTransformer.d.ts +5 -0
- package/lib/transformers/features/miscellaneous/CloneTransformer.js +34 -0
- package/lib/transformers/features/miscellaneous/CloneTransformer.js.map +1 -0
- package/lib/transformers/features/miscellaneous/CreateAssertPruneTransformer.d.ts +5 -0
- package/lib/transformers/features/miscellaneous/CreateAssertPruneTransformer.js +17 -0
- package/lib/transformers/features/miscellaneous/CreateAssertPruneTransformer.js.map +1 -0
- package/lib/transformers/features/miscellaneous/CreateCloneTransformer.d.ts +5 -0
- package/lib/transformers/features/miscellaneous/CreateCloneTransformer.js +17 -0
- package/lib/transformers/features/miscellaneous/CreateCloneTransformer.js.map +1 -0
- package/lib/transformers/features/miscellaneous/CreateIsPruneTransformer.d.ts +5 -0
- package/lib/transformers/features/miscellaneous/CreateIsPruneTransformer.js +17 -0
- package/lib/transformers/features/miscellaneous/CreateIsPruneTransformer.js.map +1 -0
- package/lib/transformers/features/miscellaneous/CreateValidatePruneTransformer.d.ts +5 -0
- package/lib/transformers/features/miscellaneous/CreateValidatePruneTransformer.js +17 -0
- package/lib/transformers/features/miscellaneous/CreateValidatePruneTransformer.js.map +1 -0
- package/lib/transformers/features/miscellaneous/IsPruneTransformer.d.ts +5 -0
- package/lib/transformers/features/miscellaneous/IsPruneTransformer.js +23 -0
- package/lib/transformers/features/miscellaneous/IsPruneTransformer.js.map +1 -0
- package/lib/transformers/features/miscellaneous/ValidatePruneTransformer.d.ts +5 -0
- package/lib/transformers/features/miscellaneous/ValidatePruneTransformer.js +23 -0
- package/lib/transformers/features/miscellaneous/ValidatePruneTransformer.js.map +1 -0
- package/package.json +1 -1
- package/src/module.ts +311 -5
- package/src/programmers/AssertPruneProgrammer.ts +59 -0
- package/src/programmers/CloneProgrammer.ts +357 -0
- package/src/programmers/IsPruneProgrammer.ts +63 -0
- package/src/programmers/PruneProgrammer.ts +5 -2
- package/src/programmers/ValidatePruneProgrammer.ts +73 -0
- package/src/programmers/helpers/CloneJoiner.ts +126 -0
- package/src/transformers/CallExpressionTransformer.ts +17 -1
- package/src/transformers/features/miscellaneous/AssertPruneTransformer.ts +38 -0
- package/src/transformers/features/miscellaneous/CloneTransformer.ts +46 -0
- package/src/transformers/features/miscellaneous/CreateAssertPruneTransformer.ts +32 -0
- package/src/transformers/features/miscellaneous/CreateCloneTransformer.ts +31 -0
- package/src/transformers/features/miscellaneous/CreateIsPruneTransformer.ts +32 -0
- package/src/transformers/features/miscellaneous/CreateValidatePruneTransformer.ts +32 -0
- package/src/transformers/features/miscellaneous/IsPruneTransformer.ts +38 -0
- package/src/transformers/features/miscellaneous/ValidatePruneTransformer.ts +38 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
|
|
3
|
+
import { AssertPruneProgrammer } from "../../../programmers/AssertPruneProgrammer";
|
|
4
|
+
|
|
5
|
+
import { IProject } from "../../IProject";
|
|
6
|
+
|
|
7
|
+
export namespace AssertPruneTransformer {
|
|
8
|
+
export function transform(
|
|
9
|
+
project: IProject,
|
|
10
|
+
modulo: ts.LeftHandSideExpression,
|
|
11
|
+
expression: ts.CallExpression,
|
|
12
|
+
): ts.Expression {
|
|
13
|
+
if (expression.arguments.length !== 1)
|
|
14
|
+
throw new Error(ErrorMessages.NO_INPUT_VALUE);
|
|
15
|
+
|
|
16
|
+
// GET TYPE INFO
|
|
17
|
+
const type: ts.Type =
|
|
18
|
+
expression.typeArguments && expression.typeArguments[0]
|
|
19
|
+
? project.checker.getTypeFromTypeNode(
|
|
20
|
+
expression.typeArguments[0],
|
|
21
|
+
)
|
|
22
|
+
: project.checker.getTypeAtLocation(expression.arguments[0]!);
|
|
23
|
+
if (type.isTypeParameter())
|
|
24
|
+
throw new Error(ErrorMessages.GENERIC_ARGUMENT);
|
|
25
|
+
|
|
26
|
+
// DO TRANSFORM
|
|
27
|
+
return ts.factory.createCallExpression(
|
|
28
|
+
AssertPruneProgrammer.generate(project, modulo)(type),
|
|
29
|
+
undefined,
|
|
30
|
+
[expression.arguments[0]!],
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const enum ErrorMessages {
|
|
36
|
+
NO_INPUT_VALUE = "Error on typia.assertPrune(): no input value.",
|
|
37
|
+
GENERIC_ARGUMENT = "Error on typia.assertPrune(): non-specified generic argument.",
|
|
38
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
|
|
3
|
+
import { CloneProgrammer } from "../../../programmers/CloneProgrammer";
|
|
4
|
+
|
|
5
|
+
import { IProject } from "../../IProject";
|
|
6
|
+
|
|
7
|
+
export namespace CloneTransformer {
|
|
8
|
+
export function transform(
|
|
9
|
+
project: IProject,
|
|
10
|
+
modulo: ts.LeftHandSideExpression,
|
|
11
|
+
expression: ts.CallExpression,
|
|
12
|
+
): ts.Expression {
|
|
13
|
+
if (expression.arguments.length !== 1)
|
|
14
|
+
throw new Error(ErrorMessages.NO_INPUT_VALUE);
|
|
15
|
+
|
|
16
|
+
const type: ts.Type =
|
|
17
|
+
expression.typeArguments && expression.typeArguments[0]
|
|
18
|
+
? project.checker.getTypeFromTypeNode(
|
|
19
|
+
expression.typeArguments[0],
|
|
20
|
+
)
|
|
21
|
+
: project.checker.getTypeAtLocation(expression.arguments[0]!);
|
|
22
|
+
if (type.isTypeParameter())
|
|
23
|
+
throw new Error(ErrorMessages.GENERIC_ARGUMENT);
|
|
24
|
+
|
|
25
|
+
return ts.factory.createCallExpression(
|
|
26
|
+
CloneProgrammer.generate(
|
|
27
|
+
{
|
|
28
|
+
...project,
|
|
29
|
+
options: {
|
|
30
|
+
...project.options,
|
|
31
|
+
functional: false,
|
|
32
|
+
numeric: false,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
modulo,
|
|
36
|
+
)(type),
|
|
37
|
+
undefined,
|
|
38
|
+
[expression.arguments[0]!],
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const enum ErrorMessages {
|
|
44
|
+
NO_INPUT_VALUE = "Error on typia.clone(): no input value.",
|
|
45
|
+
GENERIC_ARGUMENT = "Error on typia.clone(): non-specified generic argument.",
|
|
46
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
|
|
3
|
+
import { AssertPruneProgrammer } from "../../../programmers/AssertPruneProgrammer";
|
|
4
|
+
|
|
5
|
+
import { IProject } from "../../IProject";
|
|
6
|
+
|
|
7
|
+
export namespace CreateAssertPruneTransformer {
|
|
8
|
+
export function transform(
|
|
9
|
+
project: IProject,
|
|
10
|
+
modulo: ts.LeftHandSideExpression,
|
|
11
|
+
expression: ts.CallExpression,
|
|
12
|
+
): ts.Expression {
|
|
13
|
+
// CHECK GENERIC ARGUMENT EXISTENCE
|
|
14
|
+
if (!expression.typeArguments || !expression.typeArguments[0])
|
|
15
|
+
throw new Error(ErrorMessages.NOT_SPECIFIED);
|
|
16
|
+
|
|
17
|
+
// GET TYPE INFO
|
|
18
|
+
const type: ts.Type = project.checker.getTypeFromTypeNode(
|
|
19
|
+
expression.typeArguments[0],
|
|
20
|
+
);
|
|
21
|
+
if (type.isTypeParameter())
|
|
22
|
+
throw new Error(ErrorMessages.GENERIC_ARGUMENT);
|
|
23
|
+
|
|
24
|
+
// DO TRANSFORM
|
|
25
|
+
return AssertPruneProgrammer.generate(project, modulo)(type);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const enum ErrorMessages {
|
|
30
|
+
NOT_SPECIFIED = "Error on typia.assertPrune(): generic argument is not specified.",
|
|
31
|
+
GENERIC_ARGUMENT = "Error on typia.assertPrune(): non-specified generic argument.",
|
|
32
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
|
|
3
|
+
import { CloneProgrammer } from "../../../programmers/CloneProgrammer";
|
|
4
|
+
|
|
5
|
+
import { IProject } from "../../IProject";
|
|
6
|
+
|
|
7
|
+
export namespace CreateCloneTransformer {
|
|
8
|
+
export function transform(
|
|
9
|
+
project: IProject,
|
|
10
|
+
modulo: ts.LeftHandSideExpression,
|
|
11
|
+
expression: ts.CallExpression,
|
|
12
|
+
): ts.Expression {
|
|
13
|
+
// CHECK GENERIC ARGUMENT EXISTENCE
|
|
14
|
+
if (!expression.typeArguments || !expression.typeArguments[0])
|
|
15
|
+
throw new Error(ErrorMessages.NOT_SPECIFIED);
|
|
16
|
+
|
|
17
|
+
// GET TYPE INFO
|
|
18
|
+
const type: ts.Type = project.checker.getTypeFromTypeNode(
|
|
19
|
+
expression.typeArguments[0],
|
|
20
|
+
);
|
|
21
|
+
if (type.isTypeParameter())
|
|
22
|
+
throw new Error(ErrorMessages.GENERIC_ARGUMENT);
|
|
23
|
+
|
|
24
|
+
return CloneProgrammer.generate(project, modulo)(type);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const enum ErrorMessages {
|
|
29
|
+
NOT_SPECIFIED = "Error on typia.clone(): generic argument is not specified.",
|
|
30
|
+
GENERIC_ARGUMENT = "Error on typia.clone(): non-specified generic argument.",
|
|
31
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
|
|
3
|
+
import { IsPruneProgrammer } from "../../../programmers/IsPruneProgrammer";
|
|
4
|
+
|
|
5
|
+
import { IProject } from "../../IProject";
|
|
6
|
+
|
|
7
|
+
export namespace CreateIsPruneTransformer {
|
|
8
|
+
export function transform(
|
|
9
|
+
project: IProject,
|
|
10
|
+
modulo: ts.LeftHandSideExpression,
|
|
11
|
+
expression: ts.CallExpression,
|
|
12
|
+
): ts.Expression {
|
|
13
|
+
// CHECK GENERIC ARGUMENT EXISTENCE
|
|
14
|
+
if (!expression.typeArguments || !expression.typeArguments[0])
|
|
15
|
+
throw new Error(ErrorMessages.NOT_SPECIFIED);
|
|
16
|
+
|
|
17
|
+
// GET TYPE INFO
|
|
18
|
+
const type: ts.Type = project.checker.getTypeFromTypeNode(
|
|
19
|
+
expression.typeArguments[0],
|
|
20
|
+
);
|
|
21
|
+
if (type.isTypeParameter())
|
|
22
|
+
throw new Error(ErrorMessages.GENERIC_ARGUMENT);
|
|
23
|
+
|
|
24
|
+
// DO TRANSFORM
|
|
25
|
+
return IsPruneProgrammer.generate(project, modulo)(type);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const enum ErrorMessages {
|
|
30
|
+
NOT_SPECIFIED = "Error on typia.isPrune(): generic argument is not specified.",
|
|
31
|
+
GENERIC_ARGUMENT = "Error on typia.isPrune(): non-specified generic argument.",
|
|
32
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
|
|
3
|
+
import { ValidatePruneProgrammer } from "../../../programmers/ValidatePruneProgrammer";
|
|
4
|
+
|
|
5
|
+
import { IProject } from "../../IProject";
|
|
6
|
+
|
|
7
|
+
export namespace CreateValidatePruneTransformer {
|
|
8
|
+
export function transform(
|
|
9
|
+
project: IProject,
|
|
10
|
+
modulo: ts.LeftHandSideExpression,
|
|
11
|
+
expression: ts.CallExpression,
|
|
12
|
+
): ts.Expression {
|
|
13
|
+
// CHECK GENERIC ARGUMENT EXISTENCE
|
|
14
|
+
if (!expression.typeArguments || !expression.typeArguments[0])
|
|
15
|
+
throw new Error(ErrorMessages.NOT_SPECIFIED);
|
|
16
|
+
|
|
17
|
+
// GET TYPE INFO
|
|
18
|
+
const type: ts.Type = project.checker.getTypeFromTypeNode(
|
|
19
|
+
expression.typeArguments[0],
|
|
20
|
+
);
|
|
21
|
+
if (type.isTypeParameter())
|
|
22
|
+
throw new Error(ErrorMessages.GENERIC_ARGUMENT);
|
|
23
|
+
|
|
24
|
+
// DO TRANSFORM
|
|
25
|
+
return ValidatePruneProgrammer.generate(project, modulo)(type);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const enum ErrorMessages {
|
|
30
|
+
NOT_SPECIFIED = "Error on typia.validatePrune(): generic argument is not specified.",
|
|
31
|
+
GENERIC_ARGUMENT = "Error on typia.validatePrune(): non-specified generic argument.",
|
|
32
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
|
|
3
|
+
import { IsPruneProgrammer } from "../../../programmers/IsPruneProgrammer";
|
|
4
|
+
|
|
5
|
+
import { IProject } from "../../IProject";
|
|
6
|
+
|
|
7
|
+
export namespace IsPruneTransformer {
|
|
8
|
+
export function transform(
|
|
9
|
+
project: IProject,
|
|
10
|
+
modulo: ts.LeftHandSideExpression,
|
|
11
|
+
expression: ts.CallExpression,
|
|
12
|
+
): ts.Expression {
|
|
13
|
+
if (expression.arguments.length !== 1)
|
|
14
|
+
throw new Error(ErrorMessages.NO_INPUT_VALUE);
|
|
15
|
+
|
|
16
|
+
// GET TYPE INFO
|
|
17
|
+
const type: ts.Type =
|
|
18
|
+
expression.typeArguments && expression.typeArguments[0]
|
|
19
|
+
? project.checker.getTypeFromTypeNode(
|
|
20
|
+
expression.typeArguments[0],
|
|
21
|
+
)
|
|
22
|
+
: project.checker.getTypeAtLocation(expression.arguments[0]!);
|
|
23
|
+
if (type.isTypeParameter())
|
|
24
|
+
throw new Error(ErrorMessages.GENERIC_ARGUMENT);
|
|
25
|
+
|
|
26
|
+
// DO TRANSFORM
|
|
27
|
+
return ts.factory.createCallExpression(
|
|
28
|
+
IsPruneProgrammer.generate(project, modulo)(type),
|
|
29
|
+
undefined,
|
|
30
|
+
[expression.arguments[0]!],
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const enum ErrorMessages {
|
|
36
|
+
NO_INPUT_VALUE = "Error on typia.isPrune(): no input value.",
|
|
37
|
+
GENERIC_ARGUMENT = "Error on typia.isPrune(): non-specified generic argument.",
|
|
38
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
|
|
3
|
+
import { ValidatePruneProgrammer } from "../../../programmers/ValidatePruneProgrammer";
|
|
4
|
+
|
|
5
|
+
import { IProject } from "../../IProject";
|
|
6
|
+
|
|
7
|
+
export namespace ValidatePruneTransformer {
|
|
8
|
+
export function transform(
|
|
9
|
+
project: IProject,
|
|
10
|
+
modulo: ts.LeftHandSideExpression,
|
|
11
|
+
expression: ts.CallExpression,
|
|
12
|
+
): ts.Expression {
|
|
13
|
+
if (expression.arguments.length !== 1)
|
|
14
|
+
throw new Error(ErrorMessages.NO_INPUT_VALUE);
|
|
15
|
+
|
|
16
|
+
// GET TYPE INFO
|
|
17
|
+
const type: ts.Type =
|
|
18
|
+
expression.typeArguments && expression.typeArguments[0]
|
|
19
|
+
? project.checker.getTypeFromTypeNode(
|
|
20
|
+
expression.typeArguments[0],
|
|
21
|
+
)
|
|
22
|
+
: project.checker.getTypeAtLocation(expression.arguments[0]!);
|
|
23
|
+
if (type.isTypeParameter())
|
|
24
|
+
throw new Error(ErrorMessages.GENERIC_ARGUMENT);
|
|
25
|
+
|
|
26
|
+
// DO TRANSFORM
|
|
27
|
+
return ts.factory.createCallExpression(
|
|
28
|
+
ValidatePruneProgrammer.generate(project, modulo)(type),
|
|
29
|
+
undefined,
|
|
30
|
+
[expression.arguments[0]!],
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const enum ErrorMessages {
|
|
36
|
+
NO_INPUT_VALUE = "Error on typia.validatePrune(): no input value.",
|
|
37
|
+
GENERIC_ARGUMENT = "Error on typia.validatePrune(): non-specified generic argument.",
|
|
38
|
+
}
|