typia 3.4.5 → 3.4.6
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 +5 -47
- package/package.json +1 -1
- package/src/executable/internal/TypiaSetupWizard.ts +148 -148
- package/src/executable/typia.ts +35 -35
- package/src/factories/MetadataTagFactory.ts +347 -347
- package/src/factories/internal/iterate_metadata.ts +81 -81
- package/src/factories/internal/iterate_metadata_native.ts +227 -227
- package/src/functional/$number.ts +19 -19
- package/src/index.ts +4 -4
- package/src/module.ts +1535 -1535
- package/src/programmers/ApplicationProgrammer.ts +55 -55
- package/src/programmers/StringifyProgrammer.ts +746 -746
- package/src/programmers/internal/application_array.ts +45 -45
- package/src/programmers/internal/application_default.ts +17 -17
- package/src/programmers/internal/application_number.ts +76 -76
- package/src/programmers/internal/application_object.ts +103 -103
- package/src/programmers/internal/application_string.ts +49 -49
- package/src/schemas/IJsonComponents.ts +24 -24
- package/src/schemas/IJsonSchema.ts +92 -92
- package/src/transformers/CallExpressionTransformer.ts +124 -124
- package/src/transformers/features/miscellaneous/ApplicationTransformer.ts +114 -114
- package/src/transformers/features/miscellaneous/CreateInstanceTransformer.ts +41 -41
- package/src/transformers/features/miscellaneous/MetadataTransformer.ts +55 -55
- package/src/transformers/features/parsers/AssertParseTransformer.ts +36 -36
- package/src/transformers/features/parsers/CreateAssertParseTransformer.ts +32 -32
- package/src/transformers/features/parsers/CreateIsParseTransformer.ts +32 -32
- package/src/transformers/features/parsers/CreateValidateParseTransformer.ts +32 -32
- package/src/transformers/features/parsers/IsParseTransformer.ts +36 -36
- package/src/transformers/features/parsers/ValidateParseTransformer.ts +36 -36
- package/src/transformers/features/stringifiers/AssertStringifyTransformer.ts +38 -38
- package/src/transformers/features/stringifiers/CreateAssertStringifyTransformer.ts +32 -32
- package/src/transformers/features/stringifiers/CreateIsStringifyTransformer.ts +32 -32
- package/src/transformers/features/stringifiers/CreateStringifyTransformer.ts +31 -31
- package/src/transformers/features/stringifiers/CreateValidateStringifyProgrammer.ts +32 -32
- package/src/transformers/features/stringifiers/IsStringifyTransformer.ts +38 -38
- package/src/transformers/features/stringifiers/StringifyTransformer.ts +36 -36
- package/src/transformers/features/stringifiers/ValidateStringifyTransformer.ts +38 -38
- package/src/transformers/features/validators/AssertTransformer.ts +43 -43
- package/src/transformers/features/validators/CreateAssertTransformer.ts +35 -35
- package/src/transformers/features/validators/CreateIsTransformer.ts +35 -35
- package/src/transformers/features/validators/CreateValidateTransformer.ts +35 -35
- package/src/transformers/features/validators/IsTransformer.ts +43 -43
- package/src/transformers/features/validators/ValidateTransformer.ts +43 -43
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
|
-
import { AssertProgrammer } from "../../../programmers/AssertProgrammer";
|
|
4
|
-
|
|
5
|
-
import { IProject } from "../../IProject";
|
|
6
|
-
|
|
7
|
-
export namespace CreateAssertTransformer {
|
|
8
|
-
export function transform(equals: boolean) {
|
|
9
|
-
const SYMBOL = equals ? "createAssertEquals" : "createAssert";
|
|
10
|
-
const MESSAGES = {
|
|
11
|
-
NOT_SPECIFIED: `Error on typia.${SYMBOL}(): generic argument is not specified.`,
|
|
12
|
-
GENERIC_ARGUMENT: `Error on typia.${SYMBOL}(): non-specified generic argument.`,
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
return function (
|
|
16
|
-
project: IProject,
|
|
17
|
-
modulo: ts.LeftHandSideExpression,
|
|
18
|
-
expression: ts.CallExpression,
|
|
19
|
-
): ts.Expression {
|
|
20
|
-
// CHECK GENERIC ARGUMENT EXISTENCE
|
|
21
|
-
if (!expression.typeArguments || !expression.typeArguments[0])
|
|
22
|
-
throw new Error(MESSAGES.NOT_SPECIFIED);
|
|
23
|
-
|
|
24
|
-
// GET TYPE INFO
|
|
25
|
-
const type: ts.Type = project.checker.getTypeFromTypeNode(
|
|
26
|
-
expression.typeArguments[0],
|
|
27
|
-
);
|
|
28
|
-
if (type.isTypeParameter())
|
|
29
|
-
throw new Error(MESSAGES.GENERIC_ARGUMENT);
|
|
30
|
-
|
|
31
|
-
// DO TRANSFORM
|
|
32
|
-
return AssertProgrammer.generate(project, modulo, equals)(type);
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
}
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
|
|
3
|
+
import { AssertProgrammer } from "../../../programmers/AssertProgrammer";
|
|
4
|
+
|
|
5
|
+
import { IProject } from "../../IProject";
|
|
6
|
+
|
|
7
|
+
export namespace CreateAssertTransformer {
|
|
8
|
+
export function transform(equals: boolean) {
|
|
9
|
+
const SYMBOL = equals ? "createAssertEquals" : "createAssert";
|
|
10
|
+
const MESSAGES = {
|
|
11
|
+
NOT_SPECIFIED: `Error on typia.${SYMBOL}(): generic argument is not specified.`,
|
|
12
|
+
GENERIC_ARGUMENT: `Error on typia.${SYMBOL}(): non-specified generic argument.`,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
return function (
|
|
16
|
+
project: IProject,
|
|
17
|
+
modulo: ts.LeftHandSideExpression,
|
|
18
|
+
expression: ts.CallExpression,
|
|
19
|
+
): ts.Expression {
|
|
20
|
+
// CHECK GENERIC ARGUMENT EXISTENCE
|
|
21
|
+
if (!expression.typeArguments || !expression.typeArguments[0])
|
|
22
|
+
throw new Error(MESSAGES.NOT_SPECIFIED);
|
|
23
|
+
|
|
24
|
+
// GET TYPE INFO
|
|
25
|
+
const type: ts.Type = project.checker.getTypeFromTypeNode(
|
|
26
|
+
expression.typeArguments[0],
|
|
27
|
+
);
|
|
28
|
+
if (type.isTypeParameter())
|
|
29
|
+
throw new Error(MESSAGES.GENERIC_ARGUMENT);
|
|
30
|
+
|
|
31
|
+
// DO TRANSFORM
|
|
32
|
+
return AssertProgrammer.generate(project, modulo, equals)(type);
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
|
-
import { IsProgrammer } from "../../../programmers/IsProgrammer";
|
|
4
|
-
|
|
5
|
-
import { IProject } from "../../IProject";
|
|
6
|
-
|
|
7
|
-
export namespace CreateIsTransformer {
|
|
8
|
-
export function transform(equals: boolean) {
|
|
9
|
-
const SYMBOL = equals ? "createEquals" : "createIs";
|
|
10
|
-
const MESSAGES = {
|
|
11
|
-
NOT_SPECIFIED: `Error on typia.${SYMBOL}(): generic argument is not specified.`,
|
|
12
|
-
GENERIC_ARGUMENT: `Error on typia.${SYMBOL}(): non-specified generic argument.`,
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
return function (
|
|
16
|
-
project: IProject,
|
|
17
|
-
modulo: ts.LeftHandSideExpression,
|
|
18
|
-
expression: ts.CallExpression,
|
|
19
|
-
): ts.Expression {
|
|
20
|
-
// CHECK GENERIC ARGUMENT EXISTENCE
|
|
21
|
-
if (!expression.typeArguments || !expression.typeArguments[0])
|
|
22
|
-
throw new Error(MESSAGES.NOT_SPECIFIED);
|
|
23
|
-
|
|
24
|
-
// GET TYPE INFO
|
|
25
|
-
const type: ts.Type = project.checker.getTypeFromTypeNode(
|
|
26
|
-
expression.typeArguments[0],
|
|
27
|
-
);
|
|
28
|
-
if (type.isTypeParameter())
|
|
29
|
-
throw new Error(MESSAGES.GENERIC_ARGUMENT);
|
|
30
|
-
|
|
31
|
-
// DO TRANSFORM
|
|
32
|
-
return IsProgrammer.generate(project, modulo, equals)(type);
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
}
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
|
|
3
|
+
import { IsProgrammer } from "../../../programmers/IsProgrammer";
|
|
4
|
+
|
|
5
|
+
import { IProject } from "../../IProject";
|
|
6
|
+
|
|
7
|
+
export namespace CreateIsTransformer {
|
|
8
|
+
export function transform(equals: boolean) {
|
|
9
|
+
const SYMBOL = equals ? "createEquals" : "createIs";
|
|
10
|
+
const MESSAGES = {
|
|
11
|
+
NOT_SPECIFIED: `Error on typia.${SYMBOL}(): generic argument is not specified.`,
|
|
12
|
+
GENERIC_ARGUMENT: `Error on typia.${SYMBOL}(): non-specified generic argument.`,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
return function (
|
|
16
|
+
project: IProject,
|
|
17
|
+
modulo: ts.LeftHandSideExpression,
|
|
18
|
+
expression: ts.CallExpression,
|
|
19
|
+
): ts.Expression {
|
|
20
|
+
// CHECK GENERIC ARGUMENT EXISTENCE
|
|
21
|
+
if (!expression.typeArguments || !expression.typeArguments[0])
|
|
22
|
+
throw new Error(MESSAGES.NOT_SPECIFIED);
|
|
23
|
+
|
|
24
|
+
// GET TYPE INFO
|
|
25
|
+
const type: ts.Type = project.checker.getTypeFromTypeNode(
|
|
26
|
+
expression.typeArguments[0],
|
|
27
|
+
);
|
|
28
|
+
if (type.isTypeParameter())
|
|
29
|
+
throw new Error(MESSAGES.GENERIC_ARGUMENT);
|
|
30
|
+
|
|
31
|
+
// DO TRANSFORM
|
|
32
|
+
return IsProgrammer.generate(project, modulo, equals)(type);
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
|
-
import { ValidateProgrammer } from "../../../programmers/ValidateProgrammer";
|
|
4
|
-
|
|
5
|
-
import { IProject } from "../../IProject";
|
|
6
|
-
|
|
7
|
-
export namespace CreateValidateTransformer {
|
|
8
|
-
export function transform(equals: boolean) {
|
|
9
|
-
const SYMBOL = equals ? "createValidateEquals" : "createValidate";
|
|
10
|
-
const MESSAGES = {
|
|
11
|
-
NOT_SPECIFIED: `Error on typia.${SYMBOL}(): generic argument is not specified.`,
|
|
12
|
-
GENERIC_ARGUMENT: `Error on typia.${SYMBOL}(): non-specified generic argument.`,
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
return function (
|
|
16
|
-
project: IProject,
|
|
17
|
-
modulo: ts.LeftHandSideExpression,
|
|
18
|
-
expression: ts.CallExpression,
|
|
19
|
-
): ts.Expression {
|
|
20
|
-
// CHECK GENERIC ARGUMENT EXISTENCE
|
|
21
|
-
if (!expression.typeArguments || !expression.typeArguments[0])
|
|
22
|
-
throw new Error(MESSAGES.NOT_SPECIFIED);
|
|
23
|
-
|
|
24
|
-
// GET TYPE INFO
|
|
25
|
-
const type: ts.Type = project.checker.getTypeFromTypeNode(
|
|
26
|
-
expression.typeArguments[0],
|
|
27
|
-
);
|
|
28
|
-
if (type.isTypeParameter())
|
|
29
|
-
throw new Error(MESSAGES.GENERIC_ARGUMENT);
|
|
30
|
-
|
|
31
|
-
// DO TRANSFORM
|
|
32
|
-
return ValidateProgrammer.generate(project, modulo, equals)(type);
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
}
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
|
|
3
|
+
import { ValidateProgrammer } from "../../../programmers/ValidateProgrammer";
|
|
4
|
+
|
|
5
|
+
import { IProject } from "../../IProject";
|
|
6
|
+
|
|
7
|
+
export namespace CreateValidateTransformer {
|
|
8
|
+
export function transform(equals: boolean) {
|
|
9
|
+
const SYMBOL = equals ? "createValidateEquals" : "createValidate";
|
|
10
|
+
const MESSAGES = {
|
|
11
|
+
NOT_SPECIFIED: `Error on typia.${SYMBOL}(): generic argument is not specified.`,
|
|
12
|
+
GENERIC_ARGUMENT: `Error on typia.${SYMBOL}(): non-specified generic argument.`,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
return function (
|
|
16
|
+
project: IProject,
|
|
17
|
+
modulo: ts.LeftHandSideExpression,
|
|
18
|
+
expression: ts.CallExpression,
|
|
19
|
+
): ts.Expression {
|
|
20
|
+
// CHECK GENERIC ARGUMENT EXISTENCE
|
|
21
|
+
if (!expression.typeArguments || !expression.typeArguments[0])
|
|
22
|
+
throw new Error(MESSAGES.NOT_SPECIFIED);
|
|
23
|
+
|
|
24
|
+
// GET TYPE INFO
|
|
25
|
+
const type: ts.Type = project.checker.getTypeFromTypeNode(
|
|
26
|
+
expression.typeArguments[0],
|
|
27
|
+
);
|
|
28
|
+
if (type.isTypeParameter())
|
|
29
|
+
throw new Error(MESSAGES.GENERIC_ARGUMENT);
|
|
30
|
+
|
|
31
|
+
// DO TRANSFORM
|
|
32
|
+
return ValidateProgrammer.generate(project, modulo, equals)(type);
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
|
-
import { IsProgrammer } from "../../../programmers/IsProgrammer";
|
|
4
|
-
|
|
5
|
-
import { IProject } from "../../IProject";
|
|
6
|
-
|
|
7
|
-
export namespace IsTransformer {
|
|
8
|
-
export function transform(equals: boolean) {
|
|
9
|
-
const SYMBOL = equals ? "equals" : "is";
|
|
10
|
-
const MESSAGES = {
|
|
11
|
-
NO_INPUT_VALUE: `Error on typia.${SYMBOL}(): no input value.`,
|
|
12
|
-
GENERIC_ARGUMENT: `Error on typia.${SYMBOL}(): non-specified generic argument.`,
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
return function (
|
|
16
|
-
project: IProject,
|
|
17
|
-
modulo: ts.LeftHandSideExpression,
|
|
18
|
-
expression: ts.CallExpression,
|
|
19
|
-
): ts.Expression {
|
|
20
|
-
if (expression.arguments.length !== 1)
|
|
21
|
-
throw new Error(MESSAGES.NO_INPUT_VALUE);
|
|
22
|
-
|
|
23
|
-
// GET TYPE INFO
|
|
24
|
-
const type: ts.Type =
|
|
25
|
-
expression.typeArguments && expression.typeArguments[0]
|
|
26
|
-
? project.checker.getTypeFromTypeNode(
|
|
27
|
-
expression.typeArguments[0],
|
|
28
|
-
)
|
|
29
|
-
: project.checker.getTypeAtLocation(
|
|
30
|
-
expression.arguments[0]!,
|
|
31
|
-
);
|
|
32
|
-
if (type.isTypeParameter())
|
|
33
|
-
throw new Error(MESSAGES.GENERIC_ARGUMENT);
|
|
34
|
-
|
|
35
|
-
// DO TRANSFORM
|
|
36
|
-
return ts.factory.createCallExpression(
|
|
37
|
-
IsProgrammer.generate(project, modulo, equals)(type),
|
|
38
|
-
undefined,
|
|
39
|
-
[expression.arguments[0]!],
|
|
40
|
-
);
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
}
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
|
|
3
|
+
import { IsProgrammer } from "../../../programmers/IsProgrammer";
|
|
4
|
+
|
|
5
|
+
import { IProject } from "../../IProject";
|
|
6
|
+
|
|
7
|
+
export namespace IsTransformer {
|
|
8
|
+
export function transform(equals: boolean) {
|
|
9
|
+
const SYMBOL = equals ? "equals" : "is";
|
|
10
|
+
const MESSAGES = {
|
|
11
|
+
NO_INPUT_VALUE: `Error on typia.${SYMBOL}(): no input value.`,
|
|
12
|
+
GENERIC_ARGUMENT: `Error on typia.${SYMBOL}(): non-specified generic argument.`,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
return function (
|
|
16
|
+
project: IProject,
|
|
17
|
+
modulo: ts.LeftHandSideExpression,
|
|
18
|
+
expression: ts.CallExpression,
|
|
19
|
+
): ts.Expression {
|
|
20
|
+
if (expression.arguments.length !== 1)
|
|
21
|
+
throw new Error(MESSAGES.NO_INPUT_VALUE);
|
|
22
|
+
|
|
23
|
+
// GET TYPE INFO
|
|
24
|
+
const type: ts.Type =
|
|
25
|
+
expression.typeArguments && expression.typeArguments[0]
|
|
26
|
+
? project.checker.getTypeFromTypeNode(
|
|
27
|
+
expression.typeArguments[0],
|
|
28
|
+
)
|
|
29
|
+
: project.checker.getTypeAtLocation(
|
|
30
|
+
expression.arguments[0]!,
|
|
31
|
+
);
|
|
32
|
+
if (type.isTypeParameter())
|
|
33
|
+
throw new Error(MESSAGES.GENERIC_ARGUMENT);
|
|
34
|
+
|
|
35
|
+
// DO TRANSFORM
|
|
36
|
+
return ts.factory.createCallExpression(
|
|
37
|
+
IsProgrammer.generate(project, modulo, equals)(type),
|
|
38
|
+
undefined,
|
|
39
|
+
[expression.arguments[0]!],
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
|
-
import { ValidateProgrammer } from "../../../programmers/ValidateProgrammer";
|
|
4
|
-
|
|
5
|
-
import { IProject } from "../../IProject";
|
|
6
|
-
|
|
7
|
-
export namespace ValidateTransformer {
|
|
8
|
-
export function transform(equals: boolean) {
|
|
9
|
-
const SYMBOL = equals ? "validateEquals" : "validate";
|
|
10
|
-
const MESSAGES = {
|
|
11
|
-
NO_INPUT_VALUE: `Error on typia.${SYMBOL}(): no input value.`,
|
|
12
|
-
GENERIC_ARGUMENT: `Error on typia.${SYMBOL}(): non-specified generic argument.`,
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
return function (
|
|
16
|
-
project: IProject,
|
|
17
|
-
modulo: ts.LeftHandSideExpression,
|
|
18
|
-
expression: ts.CallExpression,
|
|
19
|
-
): ts.Expression {
|
|
20
|
-
if (expression.arguments.length !== 1)
|
|
21
|
-
throw new Error(MESSAGES.NO_INPUT_VALUE);
|
|
22
|
-
|
|
23
|
-
// GET TYPE INFO
|
|
24
|
-
const type: ts.Type =
|
|
25
|
-
expression.typeArguments && expression.typeArguments[0]
|
|
26
|
-
? project.checker.getTypeFromTypeNode(
|
|
27
|
-
expression.typeArguments[0],
|
|
28
|
-
)
|
|
29
|
-
: project.checker.getTypeAtLocation(
|
|
30
|
-
expression.arguments[0]!,
|
|
31
|
-
);
|
|
32
|
-
if (type.isTypeParameter())
|
|
33
|
-
throw new Error(MESSAGES.GENERIC_ARGUMENT);
|
|
34
|
-
|
|
35
|
-
// DO TRANSFORM
|
|
36
|
-
return ts.factory.createCallExpression(
|
|
37
|
-
ValidateProgrammer.generate(project, modulo, equals)(type),
|
|
38
|
-
undefined,
|
|
39
|
-
[expression.arguments[0]!],
|
|
40
|
-
);
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
}
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
|
|
3
|
+
import { ValidateProgrammer } from "../../../programmers/ValidateProgrammer";
|
|
4
|
+
|
|
5
|
+
import { IProject } from "../../IProject";
|
|
6
|
+
|
|
7
|
+
export namespace ValidateTransformer {
|
|
8
|
+
export function transform(equals: boolean) {
|
|
9
|
+
const SYMBOL = equals ? "validateEquals" : "validate";
|
|
10
|
+
const MESSAGES = {
|
|
11
|
+
NO_INPUT_VALUE: `Error on typia.${SYMBOL}(): no input value.`,
|
|
12
|
+
GENERIC_ARGUMENT: `Error on typia.${SYMBOL}(): non-specified generic argument.`,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
return function (
|
|
16
|
+
project: IProject,
|
|
17
|
+
modulo: ts.LeftHandSideExpression,
|
|
18
|
+
expression: ts.CallExpression,
|
|
19
|
+
): ts.Expression {
|
|
20
|
+
if (expression.arguments.length !== 1)
|
|
21
|
+
throw new Error(MESSAGES.NO_INPUT_VALUE);
|
|
22
|
+
|
|
23
|
+
// GET TYPE INFO
|
|
24
|
+
const type: ts.Type =
|
|
25
|
+
expression.typeArguments && expression.typeArguments[0]
|
|
26
|
+
? project.checker.getTypeFromTypeNode(
|
|
27
|
+
expression.typeArguments[0],
|
|
28
|
+
)
|
|
29
|
+
: project.checker.getTypeAtLocation(
|
|
30
|
+
expression.arguments[0]!,
|
|
31
|
+
);
|
|
32
|
+
if (type.isTypeParameter())
|
|
33
|
+
throw new Error(MESSAGES.GENERIC_ARGUMENT);
|
|
34
|
+
|
|
35
|
+
// DO TRANSFORM
|
|
36
|
+
return ts.factory.createCallExpression(
|
|
37
|
+
ValidateProgrammer.generate(project, modulo, equals)(type),
|
|
38
|
+
undefined,
|
|
39
|
+
[expression.arguments[0]!],
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}
|