typia 3.8.0-dev.20230420-2 → 3.8.0-dev.20230426
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 +4 -3
- package/lib/Primitive.d.ts +7 -1
- package/lib/factories/CommentFactory.d.ts +4 -0
- package/lib/factories/CommentFactory.js.map +1 -1
- package/lib/factories/internal/metadata/iterate_metadata.js +0 -6
- package/lib/factories/internal/metadata/iterate_metadata.js.map +1 -1
- package/lib/module.d.ts +3 -3
- package/lib/programmers/AssertParseProgrammer.js +1 -1
- package/lib/programmers/AssertParseProgrammer.js.map +1 -1
- package/lib/programmers/ValidateParseProgrammer.js +1 -1
- package/lib/programmers/ValidateParseProgrammer.js.map +1 -1
- package/lib/programmers/helpers/PruneJoiner.d.ts +1 -1
- package/lib/programmers/helpers/PruneJoiner.js +29 -2
- package/lib/programmers/helpers/PruneJoiner.js.map +1 -1
- package/lib/programmers/internal/application_schema.js +4 -2
- package/lib/programmers/internal/application_schema.js.map +1 -1
- package/lib/schemas/IJsonSchema.d.ts +9 -4
- package/package.json +2 -2
- package/src/Primitive.ts +17 -1
- package/src/factories/CommentFactory.ts +0 -1
- package/src/factories/internal/metadata/iterate_metadata.ts +1 -14
- package/src/module.ts +6 -6
- package/src/programmers/AssertParseProgrammer.ts +7 -4
- package/src/programmers/AssertProgrammer.ts +285 -285
- package/src/programmers/CheckerProgrammer.ts +875 -875
- package/src/programmers/FeatureProgrammer.ts +500 -500
- package/src/programmers/ValidateParseProgrammer.ts +4 -1
- package/src/programmers/ValidateProgrammer.ts +316 -316
- package/src/programmers/helpers/PruneJoiner.ts +94 -2
- package/src/programmers/internal/application_schema.ts +12 -2
- package/src/programmers/internal/check_custom.ts +31 -31
- package/src/programmers/internal/check_dynamic_properties.ts +194 -194
- package/src/programmers/internal/check_object.ts +55 -55
- package/src/schemas/IJsonSchema.ts +11 -3
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
|
-
import { FunctionImporter } from "../helpers/FunctionImporeter";
|
|
4
|
-
import { IExpressionEntry } from "../helpers/IExpressionEntry";
|
|
5
|
-
import { check_dynamic_properties } from "./check_dynamic_properties";
|
|
6
|
-
import { check_everything } from "./check_everything";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @internal
|
|
10
|
-
*/
|
|
11
|
-
export const check_object =
|
|
12
|
-
(props: check_object.IProps) =>
|
|
13
|
-
(importer: FunctionImporter) =>
|
|
14
|
-
(input: ts.Expression, entries: IExpressionEntry<ts.Expression>[]) => {
|
|
15
|
-
// PREPARE ASSETS
|
|
16
|
-
const regular = entries.filter((entry) => entry.key.isSoleLiteral());
|
|
17
|
-
const dynamic = entries.filter((entry) => !entry.key.isSoleLiteral());
|
|
18
|
-
const flags: ts.Expression[] = regular.map((entry) => entry.expression);
|
|
19
|
-
|
|
20
|
-
// REGULAR WITHOUT DYNAMIC PROPERTIES
|
|
21
|
-
if (props.equals === false && dynamic.length === 0)
|
|
22
|
-
return regular.length === 0 ? props.positive : reduce(props)(flags);
|
|
23
|
-
|
|
24
|
-
// CHECK DYNAMIC PROPERTIES
|
|
25
|
-
flags.push(
|
|
26
|
-
check_dynamic_properties(props)(importer)(input, regular, dynamic),
|
|
27
|
-
);
|
|
28
|
-
return reduce(props)(flags);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* @internal
|
|
33
|
-
*/
|
|
34
|
-
export namespace check_object {
|
|
35
|
-
export interface IProps {
|
|
36
|
-
equals: boolean;
|
|
37
|
-
assert: boolean;
|
|
38
|
-
undefined: boolean;
|
|
39
|
-
halt?: (exp: ts.Expression) => ts.Expression;
|
|
40
|
-
reduce: (a: ts.Expression, b: ts.Expression) => ts.Expression;
|
|
41
|
-
positive: ts.Expression;
|
|
42
|
-
superfluous: (value: ts.Expression) => ts.Expression;
|
|
43
|
-
entries?: ts.Identifier;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* @internal
|
|
49
|
-
*/
|
|
50
|
-
const reduce = (props: check_object.IProps) => (expressions: ts.Expression[]) =>
|
|
51
|
-
props.assert
|
|
52
|
-
? expressions.reduce(props.reduce)
|
|
53
|
-
: check_everything(
|
|
54
|
-
ts.factory.createArrayLiteralExpression(expressions),
|
|
55
|
-
);
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
|
|
3
|
+
import { FunctionImporter } from "../helpers/FunctionImporeter";
|
|
4
|
+
import { IExpressionEntry } from "../helpers/IExpressionEntry";
|
|
5
|
+
import { check_dynamic_properties } from "./check_dynamic_properties";
|
|
6
|
+
import { check_everything } from "./check_everything";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export const check_object =
|
|
12
|
+
(props: check_object.IProps) =>
|
|
13
|
+
(importer: FunctionImporter) =>
|
|
14
|
+
(input: ts.Expression, entries: IExpressionEntry<ts.Expression>[]) => {
|
|
15
|
+
// PREPARE ASSETS
|
|
16
|
+
const regular = entries.filter((entry) => entry.key.isSoleLiteral());
|
|
17
|
+
const dynamic = entries.filter((entry) => !entry.key.isSoleLiteral());
|
|
18
|
+
const flags: ts.Expression[] = regular.map((entry) => entry.expression);
|
|
19
|
+
|
|
20
|
+
// REGULAR WITHOUT DYNAMIC PROPERTIES
|
|
21
|
+
if (props.equals === false && dynamic.length === 0)
|
|
22
|
+
return regular.length === 0 ? props.positive : reduce(props)(flags);
|
|
23
|
+
|
|
24
|
+
// CHECK DYNAMIC PROPERTIES
|
|
25
|
+
flags.push(
|
|
26
|
+
check_dynamic_properties(props)(importer)(input, regular, dynamic),
|
|
27
|
+
);
|
|
28
|
+
return reduce(props)(flags);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
34
|
+
export namespace check_object {
|
|
35
|
+
export interface IProps {
|
|
36
|
+
equals: boolean;
|
|
37
|
+
assert: boolean;
|
|
38
|
+
undefined: boolean;
|
|
39
|
+
halt?: (exp: ts.Expression) => ts.Expression;
|
|
40
|
+
reduce: (a: ts.Expression, b: ts.Expression) => ts.Expression;
|
|
41
|
+
positive: ts.Expression;
|
|
42
|
+
superfluous: (value: ts.Expression) => ts.Expression;
|
|
43
|
+
entries?: ts.Identifier;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @internal
|
|
49
|
+
*/
|
|
50
|
+
const reduce = (props: check_object.IProps) => (expressions: ts.Expression[]) =>
|
|
51
|
+
props.assert
|
|
52
|
+
? expressions.reduce(props.reduce)
|
|
53
|
+
: check_everything(
|
|
54
|
+
ts.factory.createArrayLiteralExpression(expressions),
|
|
55
|
+
);
|
|
@@ -3,9 +3,9 @@ import { IMetadataTag } from "../metadata/IMetadataTag";
|
|
|
3
3
|
|
|
4
4
|
import { Atomic } from "../typings/Atomic";
|
|
5
5
|
|
|
6
|
-
export type IJsonSchema = IJsonSchema.
|
|
6
|
+
export type IJsonSchema = IJsonSchema.Known | IJsonSchema.IUnknown;
|
|
7
7
|
export namespace IJsonSchema {
|
|
8
|
-
export type
|
|
8
|
+
export type Known =
|
|
9
9
|
| IEnumeration<"boolean">
|
|
10
10
|
| IEnumeration<"number">
|
|
11
11
|
| IEnumeration<"string">
|
|
@@ -20,6 +20,15 @@ export namespace IJsonSchema {
|
|
|
20
20
|
| IRecursiveReference
|
|
21
21
|
| INullOnly;
|
|
22
22
|
|
|
23
|
+
export interface IUnknown extends IAttribute {
|
|
24
|
+
type: undefined;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @deprecated Use {@link Known} type instead.
|
|
29
|
+
*/
|
|
30
|
+
export type NotUnknown = Known;
|
|
31
|
+
|
|
23
32
|
/* -----------------------------------------------------------
|
|
24
33
|
ATOMICS
|
|
25
34
|
----------------------------------------------------------- */
|
|
@@ -103,7 +112,6 @@ export namespace IJsonSchema {
|
|
|
103
112
|
export interface IOneOf extends IAttribute {
|
|
104
113
|
oneOf: IJsonSchema[];
|
|
105
114
|
}
|
|
106
|
-
export interface IUnknown {}
|
|
107
115
|
|
|
108
116
|
export interface ISignificant<Literal extends string> extends IAttribute {
|
|
109
117
|
type: Literal;
|