typia 4.1.4-dev.20230707-2 → 4.1.5-dev.20230711

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.
@@ -1,129 +1,129 @@
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
- * @internal
20
- */
21
- public tagged_: boolean = false;
22
-
23
- /* -----------------------------------------------------------
24
- CONSTRUCTORS
25
- ----------------------------------------------------------- */
26
- /**
27
- * @hidden
28
- */
29
- private constructor(
30
- props: Omit<ClassProperties<MetadataObject>, "tagged_">,
31
- ) {
32
- this.name = props.name;
33
- this.properties = props.properties;
34
- this.description = props.description;
35
- this.jsDocTags = props.jsDocTags;
36
-
37
- this.index = props.index;
38
- this.validated = props.validated;
39
- this.recursive = props.recursive;
40
- this.nullables = [];
41
-
42
- this.tagged_ = false;
43
- }
44
-
45
- /**
46
- * @internal
47
- */
48
- public static create(
49
- props: Omit<ClassProperties<MetadataObject>, "tagged_">,
50
- ) {
51
- return new MetadataObject(props);
52
- }
53
-
54
- /**
55
- * @internal
56
- */
57
- public static _From_without_properties(
58
- obj: IMetadataObject,
59
- ): MetadataObject {
60
- return this.create({
61
- name: obj.name,
62
- properties: [],
63
- description: obj.description,
64
- jsDocTags: obj.jsDocTags,
65
-
66
- index: obj.index,
67
- validated: obj.validated,
68
- recursive: obj.recursive,
69
- nullables: obj.nullables.slice(),
70
- });
71
- }
72
-
73
- /**
74
- * @internal
75
- */
76
- public _Is_simple(level: number = 0): boolean {
77
- return (
78
- this.recursive === false &&
79
- this.properties.length < 10 &&
80
- this.properties.every(
81
- (property) =>
82
- property.key.isSoleLiteral() &&
83
- property.value.size() === 1 &&
84
- property.value.isRequired() === true &&
85
- property.value.nullable === false &&
86
- (property.value.atomics.length === 1 ||
87
- (level < 1 &&
88
- property.value.objects.length === 1 &&
89
- property.value.objects[0]!._Is_simple(level + 1))),
90
- )
91
- );
92
- }
93
-
94
- public toJSON(): IMetadataObject {
95
- return {
96
- name: this.name,
97
- properties: this.properties.map((property) => property.toJSON()),
98
- description: this.description,
99
- jsDocTags: this.jsDocTags,
100
-
101
- index: this.index,
102
- validated: this.validated,
103
- recursive: this.recursive,
104
- nullables: this.nullables.slice(),
105
- };
106
- }
107
- }
108
-
109
- /**
110
- * @internal
111
- */
112
- export namespace MetadataObject {
113
- export const intersects = (x: MetadataObject, y: MetadataObject): boolean =>
114
- x.properties.some(
115
- (prop) =>
116
- y.properties.find(
117
- (oppo) => prop.key.getName() === oppo.key.getName(),
118
- ) !== undefined,
119
- );
120
-
121
- export const covers = (x: MetadataObject, y: MetadataObject): boolean =>
122
- x.properties.length >= y.properties.length &&
123
- x.properties.every(
124
- (prop) =>
125
- y.properties.find(
126
- (oppo) => prop.key.getName() === oppo.key.getName(),
127
- ) !== undefined,
128
- );
129
- }
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
+ * @internal
20
+ */
21
+ public tagged_: boolean = false;
22
+
23
+ /* -----------------------------------------------------------
24
+ CONSTRUCTORS
25
+ ----------------------------------------------------------- */
26
+ /**
27
+ * @hidden
28
+ */
29
+ private constructor(
30
+ props: Omit<ClassProperties<MetadataObject>, "tagged_">,
31
+ ) {
32
+ this.name = props.name;
33
+ this.properties = props.properties;
34
+ this.description = props.description;
35
+ this.jsDocTags = props.jsDocTags;
36
+
37
+ this.index = props.index;
38
+ this.validated = props.validated;
39
+ this.recursive = props.recursive;
40
+ this.nullables = [];
41
+
42
+ this.tagged_ = false;
43
+ }
44
+
45
+ /**
46
+ * @internal
47
+ */
48
+ public static create(
49
+ props: Omit<ClassProperties<MetadataObject>, "tagged_">,
50
+ ) {
51
+ return new MetadataObject(props);
52
+ }
53
+
54
+ /**
55
+ * @internal
56
+ */
57
+ public static _From_without_properties(
58
+ obj: IMetadataObject,
59
+ ): MetadataObject {
60
+ return this.create({
61
+ name: obj.name,
62
+ properties: [],
63
+ description: obj.description,
64
+ jsDocTags: obj.jsDocTags,
65
+
66
+ index: obj.index,
67
+ validated: obj.validated,
68
+ recursive: obj.recursive,
69
+ nullables: obj.nullables.slice(),
70
+ });
71
+ }
72
+
73
+ /**
74
+ * @internal
75
+ */
76
+ public _Is_simple(level: number = 0): boolean {
77
+ return (
78
+ this.recursive === false &&
79
+ this.properties.length < 10 &&
80
+ this.properties.every(
81
+ (property) =>
82
+ property.key.isSoleLiteral() &&
83
+ property.value.size() === 1 &&
84
+ property.value.isRequired() === true &&
85
+ property.value.nullable === false &&
86
+ (property.value.atomics.length === 1 ||
87
+ (level < 1 &&
88
+ property.value.objects.length === 1 &&
89
+ property.value.objects[0]!._Is_simple(level + 1))),
90
+ )
91
+ );
92
+ }
93
+
94
+ public toJSON(): IMetadataObject {
95
+ return {
96
+ name: this.name,
97
+ properties: this.properties.map((property) => property.toJSON()),
98
+ description: this.description,
99
+ jsDocTags: this.jsDocTags,
100
+
101
+ index: this.index,
102
+ validated: this.validated,
103
+ recursive: this.recursive,
104
+ nullables: this.nullables.slice(),
105
+ };
106
+ }
107
+ }
108
+
109
+ /**
110
+ * @internal
111
+ */
112
+ export namespace MetadataObject {
113
+ export const intersects = (x: MetadataObject, y: MetadataObject): boolean =>
114
+ x.properties.some(
115
+ (prop) =>
116
+ y.properties.find(
117
+ (oppo) => prop.key.getName() === oppo.key.getName(),
118
+ ) !== undefined,
119
+ );
120
+
121
+ export const covers = (x: MetadataObject, y: MetadataObject): boolean =>
122
+ x.properties.length >= y.properties.length &&
123
+ x.properties.every(
124
+ (prop) =>
125
+ y.properties.find(
126
+ (oppo) => prop.key.getName() === oppo.key.getName(),
127
+ ) !== undefined,
128
+ );
129
+ }