typia 4.0.0 → 4.0.1
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/lib/programmers/ApplicationProgrammer.js +1 -1
- package/lib/programmers/internal/application_array.js +19 -41
- package/lib/programmers/internal/application_array.js.map +1 -1
- package/lib/programmers/internal/application_definition.d.ts +1 -1
- package/lib/programmers/internal/application_definition.js +8 -8
- package/lib/programmers/internal/application_definition.js.map +1 -1
- package/lib/programmers/internal/application_native.js +3 -3
- package/lib/programmers/internal/application_object.js +4 -4
- package/lib/programmers/internal/application_schema.js +3 -3
- package/lib/programmers/internal/application_schema.js.map +1 -1
- package/lib/programmers/internal/application_tuple.js +8 -30
- package/lib/programmers/internal/application_tuple.js.map +1 -1
- package/lib/schemas/IJsonComponents.d.ts +1 -12
- package/lib/schemas/IJsonSchema.d.ts +1 -1
- package/package.json +1 -1
- package/src/IRandomGenerator.ts +34 -34
- package/src/factories/IdentifierFactory.ts +65 -65
- package/src/factories/MetadataCollection.ts +254 -254
- package/src/factories/MetadataFactory.ts +40 -40
- package/src/factories/MetadataTagFactory.ts +300 -300
- package/src/factories/internal/metadata/emplace_metadata_array.ts +34 -34
- package/src/factories/internal/metadata/emplace_metadata_definition.ts +35 -35
- package/src/factories/internal/metadata/emplace_metadata_object.ts +142 -142
- package/src/factories/internal/metadata/emplace_metadata_tuple.ts +50 -50
- package/src/factories/internal/metadata/explore_metadata.ts +66 -66
- package/src/factories/internal/metadata/iterate_metadata.ts +77 -77
- package/src/factories/internal/metadata/iterate_metadata_array.ts +25 -25
- package/src/factories/internal/metadata/iterate_metadata_collection.ts +130 -130
- package/src/factories/internal/metadata/iterate_metadata_definition.ts +30 -30
- package/src/factories/internal/metadata/iterate_metadata_object.ts +49 -49
- package/src/factories/internal/metadata/iterate_metadata_sort.ts +68 -68
- package/src/factories/internal/metadata/iterate_metadata_tuple.ts +24 -24
- package/src/factories/internal/metadata/iterate_metadata_union.ts +68 -68
- package/src/metadata/IMetadata.ts +27 -27
- package/src/metadata/IMetadataAlias.ts +12 -12
- package/src/metadata/IMetadataApplication.ts +7 -7
- package/src/metadata/IMetadataArray.ts +10 -10
- package/src/metadata/IMetadataCollection.ts +11 -11
- package/src/metadata/IMetadataDictionary.ts +14 -14
- package/src/metadata/IMetadataObject.ts +18 -18
- package/src/metadata/IMetadataProperty.ts +11 -11
- package/src/metadata/IMetadataTuple.ts +10 -10
- package/src/metadata/Metadata.ts +585 -585
- package/src/metadata/MetadataAlias.ts +61 -61
- package/src/metadata/MetadataArray.ts +52 -52
- package/src/metadata/MetadataObject.ts +114 -114
- package/src/metadata/MetadataProperty.ts +64 -64
- package/src/metadata/MetadataTuple.ts +53 -53
- package/src/programmers/ApplicationProgrammer.ts +55 -55
- package/src/programmers/AssertProgrammer.ts +291 -291
- package/src/programmers/CheckerProgrammer.ts +1182 -1182
- package/src/programmers/CloneProgrammer.ts +595 -595
- package/src/programmers/FeatureProgrammer.ts +495 -495
- package/src/programmers/IsProgrammer.ts +250 -250
- package/src/programmers/LiteralsProgrammer.ts +66 -66
- package/src/programmers/PruneProgrammer.ts +550 -550
- package/src/programmers/RandomProgrammer.ts +589 -589
- package/src/programmers/StringifyProgrammer.ts +990 -990
- package/src/programmers/ValidateProgrammer.ts +313 -313
- package/src/programmers/helpers/FunctionImporeter.ts +78 -78
- package/src/programmers/helpers/RandomJoiner.ts +173 -173
- package/src/programmers/helpers/UnionExplorer.ts +301 -301
- package/src/programmers/helpers/UnionPredicator.ts +81 -81
- package/src/programmers/helpers/disable_function_importer_declare.ts +26 -26
- package/src/programmers/internal/JSON_SCHEMA_PREFIX.ts +1 -1
- package/src/programmers/internal/application_array.ts +30 -64
- package/src/programmers/internal/application_boolean.ts +15 -15
- package/src/programmers/internal/application_constant.ts +26 -26
- package/src/programmers/internal/application_default.ts +17 -17
- package/src/programmers/internal/application_definition.ts +45 -45
- package/src/programmers/internal/application_native.ts +39 -39
- package/src/programmers/internal/application_number.ts +74 -74
- package/src/programmers/internal/application_object.ts +167 -167
- package/src/programmers/internal/application_schema.ts +156 -164
- package/src/programmers/internal/application_tuple.ts +47 -77
- package/src/programmers/internal/check_union_array_like.ts +329 -329
- package/src/programmers/internal/feature_object_entries.ts +63 -63
- package/src/programmers/internal/wrap_metadata_rest_tuple.ts +16 -16
- package/src/schemas/IJsonApplication.ts +8 -8
- package/src/schemas/IJsonComponents.ts +34 -45
- package/src/schemas/IJsonSchema.ts +134 -134
- package/src/transformers/CallExpressionTransformer.ts +179 -179
- package/src/transformers/FileTransformer.ts +47 -47
- package/src/transformers/features/miscellaneous/ApplicationTransformer.ts +104 -104
- package/src/transformers/features/miscellaneous/MetadataTransformer.ts +53 -53
- package/src/utils/ArrayUtil.ts +45 -45
- package/src/utils/RandomGenerator.ts +81 -81
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
import { ClassProperties } from "../typings/ClassProperties";
|
|
2
|
-
|
|
3
|
-
import { IJsDocTagInfo } from "./IJsDocTagInfo";
|
|
4
|
-
import { IMetadataAlias } from "./IMetadataAlias";
|
|
5
|
-
import { Metadata } from "./Metadata";
|
|
6
|
-
|
|
7
|
-
export class MetadataAlias {
|
|
8
|
-
public readonly name: string;
|
|
9
|
-
public readonly value: Metadata;
|
|
10
|
-
public readonly description: string | null;
|
|
11
|
-
public readonly jsDocTags: IJsDocTagInfo[];
|
|
12
|
-
public readonly recursive: boolean;
|
|
13
|
-
public readonly nullables: boolean[];
|
|
14
|
-
|
|
15
|
-
/* -----------------------------------------------------------
|
|
16
|
-
CONSTRUCTORS
|
|
17
|
-
----------------------------------------------------------- */
|
|
18
|
-
/**
|
|
19
|
-
* @hidden
|
|
20
|
-
*/
|
|
21
|
-
private constructor(props: ClassProperties<MetadataAlias>) {
|
|
22
|
-
this.name = props.name;
|
|
23
|
-
this.value = props.value;
|
|
24
|
-
this.description = props.description;
|
|
25
|
-
this.jsDocTags = props.jsDocTags;
|
|
26
|
-
this.recursive = props.recursive;
|
|
27
|
-
this.nullables = props.nullables;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* @internal
|
|
32
|
-
*/
|
|
33
|
-
public static create(props: ClassProperties<MetadataAlias>): MetadataAlias {
|
|
34
|
-
return new MetadataAlias(props);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* @internal
|
|
39
|
-
*/
|
|
40
|
-
public static _From_without_value(props: Omit<IMetadataAlias, "value">) {
|
|
41
|
-
return this.create({
|
|
42
|
-
name: props.name,
|
|
43
|
-
value: null!,
|
|
44
|
-
description: props.description,
|
|
45
|
-
recursive: props.recursive,
|
|
46
|
-
jsDocTags: props.jsDocTags.slice(),
|
|
47
|
-
nullables: props.nullables.slice(),
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
public toJSON(): IMetadataAlias {
|
|
52
|
-
return {
|
|
53
|
-
name: this.name,
|
|
54
|
-
value: this.value.toJSON(),
|
|
55
|
-
description: this.description,
|
|
56
|
-
recursive: this.recursive,
|
|
57
|
-
jsDocTags: this.jsDocTags,
|
|
58
|
-
nullables: this.nullables.slice(),
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
}
|
|
1
|
+
import { ClassProperties } from "../typings/ClassProperties";
|
|
2
|
+
|
|
3
|
+
import { IJsDocTagInfo } from "./IJsDocTagInfo";
|
|
4
|
+
import { IMetadataAlias } from "./IMetadataAlias";
|
|
5
|
+
import { Metadata } from "./Metadata";
|
|
6
|
+
|
|
7
|
+
export class MetadataAlias {
|
|
8
|
+
public readonly name: string;
|
|
9
|
+
public readonly value: Metadata;
|
|
10
|
+
public readonly description: string | null;
|
|
11
|
+
public readonly jsDocTags: IJsDocTagInfo[];
|
|
12
|
+
public readonly recursive: boolean;
|
|
13
|
+
public readonly nullables: boolean[];
|
|
14
|
+
|
|
15
|
+
/* -----------------------------------------------------------
|
|
16
|
+
CONSTRUCTORS
|
|
17
|
+
----------------------------------------------------------- */
|
|
18
|
+
/**
|
|
19
|
+
* @hidden
|
|
20
|
+
*/
|
|
21
|
+
private constructor(props: ClassProperties<MetadataAlias>) {
|
|
22
|
+
this.name = props.name;
|
|
23
|
+
this.value = props.value;
|
|
24
|
+
this.description = props.description;
|
|
25
|
+
this.jsDocTags = props.jsDocTags;
|
|
26
|
+
this.recursive = props.recursive;
|
|
27
|
+
this.nullables = props.nullables;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
33
|
+
public static create(props: ClassProperties<MetadataAlias>): MetadataAlias {
|
|
34
|
+
return new MetadataAlias(props);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @internal
|
|
39
|
+
*/
|
|
40
|
+
public static _From_without_value(props: Omit<IMetadataAlias, "value">) {
|
|
41
|
+
return this.create({
|
|
42
|
+
name: props.name,
|
|
43
|
+
value: null!,
|
|
44
|
+
description: props.description,
|
|
45
|
+
recursive: props.recursive,
|
|
46
|
+
jsDocTags: props.jsDocTags.slice(),
|
|
47
|
+
nullables: props.nullables.slice(),
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public toJSON(): IMetadataAlias {
|
|
52
|
+
return {
|
|
53
|
+
name: this.name,
|
|
54
|
+
value: this.value.toJSON(),
|
|
55
|
+
description: this.description,
|
|
56
|
+
recursive: this.recursive,
|
|
57
|
+
jsDocTags: this.jsDocTags,
|
|
58
|
+
nullables: this.nullables.slice(),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
import { ClassProperties } from "../typings/ClassProperties";
|
|
2
|
-
|
|
3
|
-
import { IMetadataArray } from "./IMetadataArray";
|
|
4
|
-
import { Metadata } from "./Metadata";
|
|
5
|
-
|
|
6
|
-
export class MetadataArray {
|
|
7
|
-
public readonly name: string;
|
|
8
|
-
public readonly value: Metadata;
|
|
9
|
-
public readonly nullables: boolean[];
|
|
10
|
-
public readonly recursive: boolean;
|
|
11
|
-
public readonly index: number | null;
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* @internal
|
|
15
|
-
*/
|
|
16
|
-
private constructor(props: ClassProperties<MetadataArray>) {
|
|
17
|
-
this.name = props.name;
|
|
18
|
-
this.value = props.value;
|
|
19
|
-
this.index = props.index;
|
|
20
|
-
this.recursive = props.recursive;
|
|
21
|
-
this.nullables = props.nullables;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* @internal
|
|
26
|
-
*/
|
|
27
|
-
public static _From_without_value(
|
|
28
|
-
props: Omit<IMetadataArray, "value">,
|
|
29
|
-
): MetadataArray {
|
|
30
|
-
return this.create({
|
|
31
|
-
name: props.name,
|
|
32
|
-
value: null!,
|
|
33
|
-
index: props.index,
|
|
34
|
-
recursive: props.recursive,
|
|
35
|
-
nullables: props.nullables,
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
public static create(props: ClassProperties<MetadataArray>): MetadataArray {
|
|
40
|
-
return new MetadataArray(props);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
public toJSON(): IMetadataArray {
|
|
44
|
-
return {
|
|
45
|
-
name: this.name,
|
|
46
|
-
value: this.value.toJSON(),
|
|
47
|
-
nullables: this.nullables,
|
|
48
|
-
recursive: this.recursive,
|
|
49
|
-
index: this.index,
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
}
|
|
1
|
+
import { ClassProperties } from "../typings/ClassProperties";
|
|
2
|
+
|
|
3
|
+
import { IMetadataArray } from "./IMetadataArray";
|
|
4
|
+
import { Metadata } from "./Metadata";
|
|
5
|
+
|
|
6
|
+
export class MetadataArray {
|
|
7
|
+
public readonly name: string;
|
|
8
|
+
public readonly value: Metadata;
|
|
9
|
+
public readonly nullables: boolean[];
|
|
10
|
+
public readonly recursive: boolean;
|
|
11
|
+
public readonly index: number | null;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
private constructor(props: ClassProperties<MetadataArray>) {
|
|
17
|
+
this.name = props.name;
|
|
18
|
+
this.value = props.value;
|
|
19
|
+
this.index = props.index;
|
|
20
|
+
this.recursive = props.recursive;
|
|
21
|
+
this.nullables = props.nullables;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
public static _From_without_value(
|
|
28
|
+
props: Omit<IMetadataArray, "value">,
|
|
29
|
+
): MetadataArray {
|
|
30
|
+
return this.create({
|
|
31
|
+
name: props.name,
|
|
32
|
+
value: null!,
|
|
33
|
+
index: props.index,
|
|
34
|
+
recursive: props.recursive,
|
|
35
|
+
nullables: props.nullables,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
public static create(props: ClassProperties<MetadataArray>): MetadataArray {
|
|
40
|
+
return new MetadataArray(props);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
public toJSON(): IMetadataArray {
|
|
44
|
+
return {
|
|
45
|
+
name: this.name,
|
|
46
|
+
value: this.value.toJSON(),
|
|
47
|
+
nullables: this.nullables,
|
|
48
|
+
recursive: this.recursive,
|
|
49
|
+
index: this.index,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -1,114 +1,114 @@
|
|
|
1
|
-
import { ClassProperties } from "../typings/ClassProperties";
|
|
2
|
-
|
|
3
|
-
import { IJsDocTagInfo } from "./IJsDocTagInfo";
|
|
4
|
-
import { IMetadataObject } from "./IMetadataObject";
|
|
5
|
-
import { MetadataProperty } from "./MetadataProperty";
|
|
6
|
-
|
|
7
|
-
export class MetadataObject {
|
|
8
|
-
public readonly name: string;
|
|
9
|
-
public readonly properties: Array<MetadataProperty>;
|
|
10
|
-
public readonly description: string | undefined;
|
|
11
|
-
public readonly jsDocTags: IJsDocTagInfo[];
|
|
12
|
-
|
|
13
|
-
public readonly index: number;
|
|
14
|
-
public validated: boolean;
|
|
15
|
-
public recursive: boolean;
|
|
16
|
-
public nullables: boolean[] = [];
|
|
17
|
-
|
|
18
|
-
/* -----------------------------------------------------------
|
|
19
|
-
CONSTRUCTORS
|
|
20
|
-
----------------------------------------------------------- */
|
|
21
|
-
/**
|
|
22
|
-
* @hidden
|
|
23
|
-
*/
|
|
24
|
-
private constructor(props: ClassProperties<MetadataObject>) {
|
|
25
|
-
this.name = props.name;
|
|
26
|
-
this.properties = props.properties;
|
|
27
|
-
this.description = props.description;
|
|
28
|
-
this.jsDocTags = props.jsDocTags;
|
|
29
|
-
|
|
30
|
-
this.index = props.index;
|
|
31
|
-
this.validated = props.validated;
|
|
32
|
-
this.recursive = props.recursive;
|
|
33
|
-
this.nullables = [];
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* @internal
|
|
38
|
-
*/
|
|
39
|
-
public static create(props: ClassProperties<MetadataObject>) {
|
|
40
|
-
return new MetadataObject(props);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* @internal
|
|
45
|
-
*/
|
|
46
|
-
public static _From_without_properties(
|
|
47
|
-
obj: IMetadataObject,
|
|
48
|
-
): MetadataObject {
|
|
49
|
-
return this.create({
|
|
50
|
-
name: obj.name,
|
|
51
|
-
properties: [],
|
|
52
|
-
description: obj.description,
|
|
53
|
-
jsDocTags: obj.jsDocTags,
|
|
54
|
-
|
|
55
|
-
index: obj.index,
|
|
56
|
-
validated: obj.validated,
|
|
57
|
-
recursive: obj.recursive,
|
|
58
|
-
nullables: obj.nullables.slice(),
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* @internal
|
|
64
|
-
*/
|
|
65
|
-
public _Is_simple(): boolean {
|
|
66
|
-
return (
|
|
67
|
-
this.properties.length < 4 &&
|
|
68
|
-
this.properties.every(
|
|
69
|
-
(property) =>
|
|
70
|
-
property.key.isSoleLiteral() &&
|
|
71
|
-
property.value.size() === 1 &&
|
|
72
|
-
property.value.atomics.length === 1 &&
|
|
73
|
-
property.value.nullable === false &&
|
|
74
|
-
property.value.required === true,
|
|
75
|
-
)
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
public toJSON(): IMetadataObject {
|
|
80
|
-
return {
|
|
81
|
-
name: this.name,
|
|
82
|
-
properties: this.properties.map((property) => property.toJSON()),
|
|
83
|
-
description: this.description,
|
|
84
|
-
jsDocTags: this.jsDocTags,
|
|
85
|
-
|
|
86
|
-
index: this.index,
|
|
87
|
-
validated: this.validated,
|
|
88
|
-
recursive: this.recursive,
|
|
89
|
-
nullables: this.nullables.slice(),
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* @internal
|
|
96
|
-
*/
|
|
97
|
-
export namespace MetadataObject {
|
|
98
|
-
export const intersects = (x: MetadataObject, y: MetadataObject): boolean =>
|
|
99
|
-
x.properties.some(
|
|
100
|
-
(prop) =>
|
|
101
|
-
y.properties.find(
|
|
102
|
-
(oppo) => prop.key.getName() === oppo.key.getName(),
|
|
103
|
-
) !== undefined,
|
|
104
|
-
);
|
|
105
|
-
|
|
106
|
-
export const covers = (x: MetadataObject, y: MetadataObject): boolean =>
|
|
107
|
-
x.properties.length >= y.properties.length &&
|
|
108
|
-
x.properties.every(
|
|
109
|
-
(prop) =>
|
|
110
|
-
y.properties.find(
|
|
111
|
-
(oppo) => prop.key.getName() === oppo.key.getName(),
|
|
112
|
-
) !== undefined,
|
|
113
|
-
);
|
|
114
|
-
}
|
|
1
|
+
import { ClassProperties } from "../typings/ClassProperties";
|
|
2
|
+
|
|
3
|
+
import { IJsDocTagInfo } from "./IJsDocTagInfo";
|
|
4
|
+
import { IMetadataObject } from "./IMetadataObject";
|
|
5
|
+
import { MetadataProperty } from "./MetadataProperty";
|
|
6
|
+
|
|
7
|
+
export class MetadataObject {
|
|
8
|
+
public readonly name: string;
|
|
9
|
+
public readonly properties: Array<MetadataProperty>;
|
|
10
|
+
public readonly description: string | undefined;
|
|
11
|
+
public readonly jsDocTags: IJsDocTagInfo[];
|
|
12
|
+
|
|
13
|
+
public readonly index: number;
|
|
14
|
+
public validated: boolean;
|
|
15
|
+
public recursive: boolean;
|
|
16
|
+
public nullables: boolean[] = [];
|
|
17
|
+
|
|
18
|
+
/* -----------------------------------------------------------
|
|
19
|
+
CONSTRUCTORS
|
|
20
|
+
----------------------------------------------------------- */
|
|
21
|
+
/**
|
|
22
|
+
* @hidden
|
|
23
|
+
*/
|
|
24
|
+
private constructor(props: ClassProperties<MetadataObject>) {
|
|
25
|
+
this.name = props.name;
|
|
26
|
+
this.properties = props.properties;
|
|
27
|
+
this.description = props.description;
|
|
28
|
+
this.jsDocTags = props.jsDocTags;
|
|
29
|
+
|
|
30
|
+
this.index = props.index;
|
|
31
|
+
this.validated = props.validated;
|
|
32
|
+
this.recursive = props.recursive;
|
|
33
|
+
this.nullables = [];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
39
|
+
public static create(props: ClassProperties<MetadataObject>) {
|
|
40
|
+
return new MetadataObject(props);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @internal
|
|
45
|
+
*/
|
|
46
|
+
public static _From_without_properties(
|
|
47
|
+
obj: IMetadataObject,
|
|
48
|
+
): MetadataObject {
|
|
49
|
+
return this.create({
|
|
50
|
+
name: obj.name,
|
|
51
|
+
properties: [],
|
|
52
|
+
description: obj.description,
|
|
53
|
+
jsDocTags: obj.jsDocTags,
|
|
54
|
+
|
|
55
|
+
index: obj.index,
|
|
56
|
+
validated: obj.validated,
|
|
57
|
+
recursive: obj.recursive,
|
|
58
|
+
nullables: obj.nullables.slice(),
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* @internal
|
|
64
|
+
*/
|
|
65
|
+
public _Is_simple(): boolean {
|
|
66
|
+
return (
|
|
67
|
+
this.properties.length < 4 &&
|
|
68
|
+
this.properties.every(
|
|
69
|
+
(property) =>
|
|
70
|
+
property.key.isSoleLiteral() &&
|
|
71
|
+
property.value.size() === 1 &&
|
|
72
|
+
property.value.atomics.length === 1 &&
|
|
73
|
+
property.value.nullable === false &&
|
|
74
|
+
property.value.required === true,
|
|
75
|
+
)
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
public toJSON(): IMetadataObject {
|
|
80
|
+
return {
|
|
81
|
+
name: this.name,
|
|
82
|
+
properties: this.properties.map((property) => property.toJSON()),
|
|
83
|
+
description: this.description,
|
|
84
|
+
jsDocTags: this.jsDocTags,
|
|
85
|
+
|
|
86
|
+
index: this.index,
|
|
87
|
+
validated: this.validated,
|
|
88
|
+
recursive: this.recursive,
|
|
89
|
+
nullables: this.nullables.slice(),
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* @internal
|
|
96
|
+
*/
|
|
97
|
+
export namespace MetadataObject {
|
|
98
|
+
export const intersects = (x: MetadataObject, y: MetadataObject): boolean =>
|
|
99
|
+
x.properties.some(
|
|
100
|
+
(prop) =>
|
|
101
|
+
y.properties.find(
|
|
102
|
+
(oppo) => prop.key.getName() === oppo.key.getName(),
|
|
103
|
+
) !== undefined,
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
export const covers = (x: MetadataObject, y: MetadataObject): boolean =>
|
|
107
|
+
x.properties.length >= y.properties.length &&
|
|
108
|
+
x.properties.every(
|
|
109
|
+
(prop) =>
|
|
110
|
+
y.properties.find(
|
|
111
|
+
(oppo) => prop.key.getName() === oppo.key.getName(),
|
|
112
|
+
) !== undefined,
|
|
113
|
+
);
|
|
114
|
+
}
|
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
import { ClassProperties } from "../typings/ClassProperties";
|
|
2
|
-
|
|
3
|
-
import { IJsDocTagInfo } from "./IJsDocTagInfo";
|
|
4
|
-
import { IMetadataDictionary } from "./IMetadataDictionary";
|
|
5
|
-
import { IMetadataProperty } from "./IMetadataProperty";
|
|
6
|
-
import { IMetadataTag } from "./IMetadataTag";
|
|
7
|
-
import { Metadata } from "./Metadata";
|
|
8
|
-
|
|
9
|
-
export class MetadataProperty {
|
|
10
|
-
public readonly key: Metadata;
|
|
11
|
-
public readonly value: Metadata;
|
|
12
|
-
public readonly description: string | null;
|
|
13
|
-
public readonly tags: IMetadataTag[];
|
|
14
|
-
public readonly jsDocTags: IJsDocTagInfo[];
|
|
15
|
-
|
|
16
|
-
/* -----------------------------------------------------------
|
|
17
|
-
CONSTRUCTORS
|
|
18
|
-
----------------------------------------------------------- */
|
|
19
|
-
/**
|
|
20
|
-
* @hidden
|
|
21
|
-
*/
|
|
22
|
-
private constructor(props: ClassProperties<MetadataProperty>) {
|
|
23
|
-
this.key = props.key;
|
|
24
|
-
this.value = props.value;
|
|
25
|
-
this.description = props.description;
|
|
26
|
-
this.tags = props.tags;
|
|
27
|
-
this.jsDocTags = props.jsDocTags;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* @internal
|
|
32
|
-
*/
|
|
33
|
-
public static create(
|
|
34
|
-
props: ClassProperties<MetadataProperty>,
|
|
35
|
-
): MetadataProperty {
|
|
36
|
-
return new MetadataProperty(props);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* @internal
|
|
41
|
-
*/
|
|
42
|
-
public static _From(
|
|
43
|
-
property: IMetadataProperty,
|
|
44
|
-
dict: IMetadataDictionary,
|
|
45
|
-
) {
|
|
46
|
-
return this.create({
|
|
47
|
-
key: Metadata._From(property.key, dict),
|
|
48
|
-
value: Metadata._From(property.value, dict),
|
|
49
|
-
description: property.description,
|
|
50
|
-
tags: property.tags.slice(),
|
|
51
|
-
jsDocTags: property.jsDocTags.slice(),
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
public toJSON(): IMetadataProperty {
|
|
56
|
-
return {
|
|
57
|
-
key: this.key.toJSON(),
|
|
58
|
-
value: this.value.toJSON(),
|
|
59
|
-
description: this.description,
|
|
60
|
-
tags: this.tags,
|
|
61
|
-
jsDocTags: this.jsDocTags,
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
}
|
|
1
|
+
import { ClassProperties } from "../typings/ClassProperties";
|
|
2
|
+
|
|
3
|
+
import { IJsDocTagInfo } from "./IJsDocTagInfo";
|
|
4
|
+
import { IMetadataDictionary } from "./IMetadataDictionary";
|
|
5
|
+
import { IMetadataProperty } from "./IMetadataProperty";
|
|
6
|
+
import { IMetadataTag } from "./IMetadataTag";
|
|
7
|
+
import { Metadata } from "./Metadata";
|
|
8
|
+
|
|
9
|
+
export class MetadataProperty {
|
|
10
|
+
public readonly key: Metadata;
|
|
11
|
+
public readonly value: Metadata;
|
|
12
|
+
public readonly description: string | null;
|
|
13
|
+
public readonly tags: IMetadataTag[];
|
|
14
|
+
public readonly jsDocTags: IJsDocTagInfo[];
|
|
15
|
+
|
|
16
|
+
/* -----------------------------------------------------------
|
|
17
|
+
CONSTRUCTORS
|
|
18
|
+
----------------------------------------------------------- */
|
|
19
|
+
/**
|
|
20
|
+
* @hidden
|
|
21
|
+
*/
|
|
22
|
+
private constructor(props: ClassProperties<MetadataProperty>) {
|
|
23
|
+
this.key = props.key;
|
|
24
|
+
this.value = props.value;
|
|
25
|
+
this.description = props.description;
|
|
26
|
+
this.tags = props.tags;
|
|
27
|
+
this.jsDocTags = props.jsDocTags;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
33
|
+
public static create(
|
|
34
|
+
props: ClassProperties<MetadataProperty>,
|
|
35
|
+
): MetadataProperty {
|
|
36
|
+
return new MetadataProperty(props);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @internal
|
|
41
|
+
*/
|
|
42
|
+
public static _From(
|
|
43
|
+
property: IMetadataProperty,
|
|
44
|
+
dict: IMetadataDictionary,
|
|
45
|
+
) {
|
|
46
|
+
return this.create({
|
|
47
|
+
key: Metadata._From(property.key, dict),
|
|
48
|
+
value: Metadata._From(property.value, dict),
|
|
49
|
+
description: property.description,
|
|
50
|
+
tags: property.tags.slice(),
|
|
51
|
+
jsDocTags: property.jsDocTags.slice(),
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
public toJSON(): IMetadataProperty {
|
|
56
|
+
return {
|
|
57
|
+
key: this.key.toJSON(),
|
|
58
|
+
value: this.value.toJSON(),
|
|
59
|
+
description: this.description,
|
|
60
|
+
tags: this.tags,
|
|
61
|
+
jsDocTags: this.jsDocTags,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
}
|