typia 6.7.3-dev.20240808 → 6.8.0-dev.20240811

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.
Files changed (109) hide show
  1. package/lib/factories/TypeFactory.d.ts +0 -2
  2. package/lib/factories/TypeFactory.js +4 -83
  3. package/lib/factories/TypeFactory.js.map +1 -1
  4. package/lib/factories/internal/metadata/emplace_metadata_array_type.js +1 -5
  5. package/lib/factories/internal/metadata/emplace_metadata_array_type.js.map +1 -1
  6. package/lib/factories/internal/metadata/emplace_metadata_object.js +3 -4
  7. package/lib/factories/internal/metadata/emplace_metadata_object.js.map +1 -1
  8. package/lib/factories/internal/metadata/iterate_metadata.js +1 -2
  9. package/lib/factories/internal/metadata/iterate_metadata.js.map +1 -1
  10. package/lib/factories/internal/metadata/iterate_metadata_array.js +1 -2
  11. package/lib/factories/internal/metadata/iterate_metadata_array.js.map +1 -1
  12. package/lib/factories/internal/metadata/iterate_metadata_atomic.js +1 -1
  13. package/lib/factories/internal/metadata/iterate_metadata_atomic.js.map +1 -1
  14. package/lib/factories/internal/metadata/iterate_metadata_coalesce.js +1 -1
  15. package/lib/factories/internal/metadata/iterate_metadata_coalesce.js.map +1 -1
  16. package/lib/factories/internal/metadata/iterate_metadata_constant.js +2 -3
  17. package/lib/factories/internal/metadata/iterate_metadata_constant.js.map +1 -1
  18. package/lib/factories/internal/metadata/iterate_metadata_intersection.js +2 -3
  19. package/lib/factories/internal/metadata/iterate_metadata_intersection.js.map +1 -1
  20. package/lib/factories/internal/metadata/iterate_metadata_map.js +1 -1
  21. package/lib/factories/internal/metadata/iterate_metadata_map.js.map +1 -1
  22. package/lib/factories/internal/metadata/iterate_metadata_native.js +1 -1
  23. package/lib/factories/internal/metadata/iterate_metadata_native.js.map +1 -1
  24. package/lib/factories/internal/metadata/iterate_metadata_object.js +2 -3
  25. package/lib/factories/internal/metadata/iterate_metadata_object.js.map +1 -1
  26. package/lib/factories/internal/metadata/iterate_metadata_set.js +1 -1
  27. package/lib/factories/internal/metadata/iterate_metadata_set.js.map +1 -1
  28. package/lib/factories/internal/metadata/iterate_metadata_template.js +1 -1
  29. package/lib/factories/internal/metadata/iterate_metadata_template.js.map +1 -1
  30. package/lib/factories/internal/metadata/iterate_metadata_union.js +1 -2
  31. package/lib/factories/internal/metadata/iterate_metadata_union.js.map +1 -1
  32. package/lib/programmers/internal/application_bigint.d.ts +1 -0
  33. package/lib/programmers/internal/application_bigint.js +14 -0
  34. package/lib/programmers/internal/application_bigint.js.map +1 -0
  35. package/lib/programmers/internal/application_v30_schema.js +10 -12
  36. package/lib/programmers/internal/application_v30_schema.js.map +1 -1
  37. package/lib/programmers/internal/application_v31_constant.js +3 -1
  38. package/lib/programmers/internal/application_v31_constant.js.map +1 -1
  39. package/lib/programmers/internal/application_v31_schema.js +10 -12
  40. package/lib/programmers/internal/application_v31_schema.js.map +1 -1
  41. package/lib/tags/Constant.d.ts +2 -2
  42. package/lib/tags/Default.d.ts +5 -1
  43. package/lib/tags/ExclusiveMaximum.d.ts +9 -5
  44. package/lib/tags/ExclusiveMinimum.d.ts +9 -5
  45. package/lib/tags/JsonSchemaPlugin.d.ts +1 -1
  46. package/lib/tags/Maximum.d.ts +8 -5
  47. package/lib/tags/Minimum.d.ts +8 -5
  48. package/lib/tags/MultipleOf.d.ts +7 -4
  49. package/lib/transformers/features/CreateRandomTransformer.js +1 -2
  50. package/lib/transformers/features/CreateRandomTransformer.js.map +1 -1
  51. package/lib/transformers/features/RandomTransformer.js +1 -2
  52. package/lib/transformers/features/RandomTransformer.js.map +1 -1
  53. package/lib/transformers/features/json/JsonApplicationTransformer.js +4 -5
  54. package/lib/transformers/features/json/JsonApplicationTransformer.js.map +1 -1
  55. package/lib/transformers/features/misc/MiscLiteralsTransformer.js +1 -2
  56. package/lib/transformers/features/misc/MiscLiteralsTransformer.js.map +1 -1
  57. package/lib/transformers/features/protobuf/ProtobufMessageTransformer.js +1 -2
  58. package/lib/transformers/features/protobuf/ProtobufMessageTransformer.js.map +1 -1
  59. package/lib/transformers/features/reflect/ReflectMetadataTransformer.js +1 -2
  60. package/lib/transformers/features/reflect/ReflectMetadataTransformer.js.map +1 -1
  61. package/lib/transformers/internal/GenericTransformer.js +2 -3
  62. package/lib/transformers/internal/GenericTransformer.js.map +1 -1
  63. package/package.json +2 -2
  64. package/src/factories/CommentFactory.ts +79 -79
  65. package/src/factories/MetadataCollection.ts +274 -274
  66. package/src/factories/MetadataFactory.ts +272 -272
  67. package/src/factories/TypeFactory.ts +118 -190
  68. package/src/factories/internal/metadata/emplace_metadata_array_type.ts +42 -42
  69. package/src/factories/internal/metadata/emplace_metadata_object.ts +176 -179
  70. package/src/factories/internal/metadata/iterate_metadata.ts +94 -96
  71. package/src/factories/internal/metadata/iterate_metadata_array.ts +63 -64
  72. package/src/factories/internal/metadata/iterate_metadata_atomic.ts +62 -62
  73. package/src/factories/internal/metadata/iterate_metadata_coalesce.ts +33 -33
  74. package/src/factories/internal/metadata/iterate_metadata_constant.ts +76 -77
  75. package/src/factories/internal/metadata/iterate_metadata_intersection.ts +213 -214
  76. package/src/factories/internal/metadata/iterate_metadata_map.ts +50 -50
  77. package/src/factories/internal/metadata/iterate_metadata_native.ts +220 -217
  78. package/src/factories/internal/metadata/iterate_metadata_object.ts +33 -34
  79. package/src/factories/internal/metadata/iterate_metadata_set.ts +41 -41
  80. package/src/factories/internal/metadata/iterate_metadata_template.ts +44 -44
  81. package/src/factories/internal/metadata/iterate_metadata_union.ts +27 -29
  82. package/src/programmers/internal/application_bigint.ts +25 -0
  83. package/src/programmers/internal/application_v30_alias.ts +52 -52
  84. package/src/programmers/internal/application_v30_object.ts +149 -149
  85. package/src/programmers/internal/application_v30_schema.ts +162 -159
  86. package/src/programmers/internal/application_v30_tuple.ts +33 -33
  87. package/src/programmers/internal/application_v31_constant.ts +4 -1
  88. package/src/programmers/internal/application_v31_schema.ts +159 -157
  89. package/src/programmers/json/JsonApplicationProgrammer.ts +82 -82
  90. package/src/tags/Constant.ts +2 -2
  91. package/src/tags/Default.ts +7 -3
  92. package/src/tags/ExclusiveMaximum.ts +12 -6
  93. package/src/tags/ExclusiveMinimum.ts +12 -6
  94. package/src/tags/JsonSchemaPlugin.ts +1 -1
  95. package/src/tags/Maximum.ts +9 -8
  96. package/src/tags/Minimum.ts +9 -8
  97. package/src/tags/MultipleOf.ts +9 -8
  98. package/src/transformers/FileTransformer.ts +91 -91
  99. package/src/transformers/features/CreateRandomTransformer.ts +40 -42
  100. package/src/transformers/features/RandomTransformer.ts +44 -46
  101. package/src/transformers/features/json/JsonApplicationTransformer.ts +124 -126
  102. package/src/transformers/features/misc/MiscLiteralsTransformer.ts +32 -34
  103. package/src/transformers/features/protobuf/ProtobufMessageTransformer.ts +33 -35
  104. package/src/transformers/features/reflect/ReflectMetadataTransformer.ts +62 -64
  105. package/src/transformers/internal/GenericTransformer.ts +2 -4
  106. package/lib/utils/TypePredicator.d.ts +0 -10
  107. package/lib/utils/TypePredicator.js +0 -36
  108. package/lib/utils/TypePredicator.js.map +0 -1
  109. package/src/utils/TypePredicator.ts +0 -32
@@ -1,179 +1,176 @@
1
- import ts from "typescript";
2
-
3
- import { Metadata } from "../../../schemas/metadata/Metadata";
4
- import { MetadataObject } from "../../../schemas/metadata/MetadataObject";
5
- import { MetadataProperty } from "../../../schemas/metadata/MetadataProperty";
6
-
7
- import { Writable } from "../../../typings/Writable";
8
-
9
- import { ArrayUtil } from "../../../utils/ArrayUtil";
10
- import { TypePredicator } from "../../../utils/TypePredicator";
11
-
12
- import { CommentFactory } from "../../CommentFactory";
13
- import { MetadataCollection } from "../../MetadataCollection";
14
- import { MetadataFactory } from "../../MetadataFactory";
15
- import { MetadataHelper } from "./MetadataHelper";
16
- import { explore_metadata } from "./explore_metadata";
17
- import { iterate_metadata_coalesce } from "./iterate_metadata_coalesce";
18
-
19
- export const emplace_metadata_object =
20
- (checker: ts.TypeChecker) =>
21
- (options: MetadataFactory.IOptions) =>
22
- (collection: MetadataCollection) =>
23
- (errors: MetadataFactory.IError[]) =>
24
- (parent: ts.Type, nullable: boolean): MetadataObject => {
25
- // EMPLACE OBJECT
26
- const [obj, newbie] = collection.emplace(checker, parent);
27
- ArrayUtil.add(obj.nullables, nullable, (elem) => elem === nullable);
28
-
29
- if (newbie === false) return obj;
30
-
31
- // PREPARE ASSETS
32
- const isClass: boolean = TypePredicator.isClass(parent);
33
- const pred: (node: ts.Declaration) => boolean = isClass
34
- ? (node) => {
35
- const kind: ts.SyntaxKind | undefined = node
36
- .getChildren()[0]
37
- ?.getChildren()[0]?.kind;
38
- return (
39
- kind !== ts.SyntaxKind.PrivateKeyword &&
40
- kind !== ts.SyntaxKind.ProtectedKeyword &&
41
- isProperty(node)
42
- );
43
- }
44
- : (node) => isProperty(node);
45
-
46
- const insert =
47
- (key: Metadata) =>
48
- (value: Metadata) =>
49
- (
50
- symbol: ts.Symbol | undefined,
51
- filter?: (doc: ts.JSDocTagInfo) => boolean,
52
- ): MetadataProperty => {
53
- // COMMENTS AND TAGS
54
- const description: string | null = symbol
55
- ? CommentFactory.description(symbol) ?? null
56
- : null;
57
- const jsDocTags: ts.JSDocTagInfo[] = (
58
- symbol?.getJsDocTags() ?? []
59
- ).filter(filter ?? (() => true));
60
-
61
- // THE PROPERTY
62
- const property = MetadataProperty.create({
63
- key,
64
- value,
65
- description,
66
- jsDocTags,
67
- });
68
- obj.properties.push(property);
69
- return property;
70
- };
71
-
72
- //----
73
- // REGULAR PROPERTIES
74
- //----
75
- for (const prop of checker.getPropertiesOfType(
76
- checker.getApparentType(parent),
77
- )) {
78
- // CHECK INTERNAL TAG
79
- if (
80
- (prop.getJsDocTags(checker) ?? []).find(
81
- (tag) => tag.name === "internal",
82
- ) !== undefined
83
- )
84
- continue;
85
-
86
- // CHECK NODE IS A FORMAL PROPERTY
87
- const [node, type] = (() => {
88
- const node = prop.getDeclarations()?.[0] as
89
- | ts.PropertyDeclaration
90
- | undefined;
91
- const type: ts.Type | undefined = node
92
- ? checker.getTypeOfSymbolAtLocation(prop, node)
93
- : checker.getTypeOfPropertyOfType(parent, prop.name);
94
- return [node, type];
95
- })();
96
- if ((node && pred(node) === false) || type === undefined) continue;
97
-
98
- // GET EXACT TYPE
99
- const key: Metadata = MetadataHelper.literal_to_metadata(prop.name);
100
- const value: Metadata = explore_metadata(checker)(options)(collection)(
101
- errors,
102
- )(type, {
103
- top: false,
104
- object: obj,
105
- property: prop.name,
106
- nested: null,
107
- escaped: false,
108
- aliased: false,
109
- });
110
- Writable(value).optional = (prop.flags & ts.SymbolFlags.Optional) !== 0;
111
- insert(key)(value)(prop);
112
- }
113
-
114
- //----
115
- // DYNAMIC PROPERTIES
116
- //----
117
- for (const index of checker.getIndexInfosOfType(parent)) {
118
- // GET EXACT TYPE
119
- const analyzer = (type: ts.Type) => (property: {} | null) =>
120
- explore_metadata(checker)(options)(collection)(errors)(type, {
121
- top: false,
122
- object: obj,
123
- property,
124
- nested: null,
125
- escaped: false,
126
- aliased: false,
127
- });
128
- const key: Metadata = analyzer(index.keyType)(null);
129
- const value: Metadata = analyzer(index.type)({});
130
-
131
- if (
132
- key.atomics.length +
133
- key.constants.map((c) => c.values.length).reduce((a, b) => a + b, 0) +
134
- key.templates.length +
135
- key.natives.filter(
136
- (type) =>
137
- type === "Boolean" ||
138
- type === "BigInt" ||
139
- type === "Number" ||
140
- type === "String",
141
- ).length !==
142
- key.size()
143
- )
144
- errors.push({
145
- name: key.getName(),
146
- explore: {
147
- top: false,
148
- object: obj,
149
- property: "[key]",
150
- nested: null,
151
- escaped: false,
152
- aliased: false,
153
- },
154
- messages: [],
155
- });
156
-
157
- // INSERT WITH REQUIRED CONFIGURATION
158
- insert(key)(value)(
159
- index.declaration?.parent
160
- ? checker.getSymbolAtLocation(index.declaration.parent)
161
- : undefined,
162
- (doc) => doc.name !== "default",
163
- );
164
- }
165
- return obj;
166
- };
167
-
168
- const isProperty = (node: ts.Declaration) =>
169
- ts.isParameter(node) ||
170
- ts.isPropertyDeclaration(node) ||
171
- ts.isPropertyAssignment(node) ||
172
- ts.isPropertySignature(node) ||
173
- ts.isTypeLiteralNode(node);
174
-
175
- const iterate_optional_coalesce = (meta: Metadata, type: ts.Type): void => {
176
- if (TypePredicator.isUnionOrIntersection(type))
177
- type.types.forEach((child) => iterate_optional_coalesce(meta, child));
178
- else iterate_metadata_coalesce(meta, type);
179
- };
1
+ import ts from "typescript";
2
+
3
+ import { Metadata } from "../../../schemas/metadata/Metadata";
4
+ import { MetadataObject } from "../../../schemas/metadata/MetadataObject";
5
+ import { MetadataProperty } from "../../../schemas/metadata/MetadataProperty";
6
+
7
+ import { Writable } from "../../../typings/Writable";
8
+
9
+ import { ArrayUtil } from "../../../utils/ArrayUtil";
10
+
11
+ import { CommentFactory } from "../../CommentFactory";
12
+ import { MetadataCollection } from "../../MetadataCollection";
13
+ import { MetadataFactory } from "../../MetadataFactory";
14
+ import { MetadataHelper } from "./MetadataHelper";
15
+ import { explore_metadata } from "./explore_metadata";
16
+ import { iterate_metadata_coalesce } from "./iterate_metadata_coalesce";
17
+
18
+ export const emplace_metadata_object =
19
+ (checker: ts.TypeChecker) =>
20
+ (options: MetadataFactory.IOptions) =>
21
+ (collection: MetadataCollection) =>
22
+ (errors: MetadataFactory.IError[]) =>
23
+ (parent: ts.Type, nullable: boolean): MetadataObject => {
24
+ // EMPLACE OBJECT
25
+ const [obj, newbie] = collection.emplace(checker, parent);
26
+ ArrayUtil.add(obj.nullables, nullable, (elem) => elem === nullable);
27
+
28
+ if (newbie === false) return obj;
29
+
30
+ // PREPARE ASSETS
31
+ const isClass: boolean = parent.isClass();
32
+ const pred: (node: ts.Declaration) => boolean = isClass
33
+ ? (node) => {
34
+ const kind: ts.SyntaxKind | undefined = node
35
+ .getChildren()[0]
36
+ ?.getChildren()[0]?.kind;
37
+ return (
38
+ kind !== ts.SyntaxKind.PrivateKeyword &&
39
+ kind !== ts.SyntaxKind.ProtectedKeyword &&
40
+ isProperty(node)
41
+ );
42
+ }
43
+ : (node) => isProperty(node);
44
+
45
+ const insert =
46
+ (key: Metadata) =>
47
+ (value: Metadata) =>
48
+ (
49
+ symbol: ts.Symbol | undefined,
50
+ filter?: (doc: ts.JSDocTagInfo) => boolean,
51
+ ): MetadataProperty => {
52
+ // COMMENTS AND TAGS
53
+ const description: string | null = symbol
54
+ ? CommentFactory.description(symbol) ?? null
55
+ : null;
56
+ const jsDocTags: ts.JSDocTagInfo[] = (
57
+ symbol?.getJsDocTags() ?? []
58
+ ).filter(filter ?? (() => true));
59
+
60
+ // THE PROPERTY
61
+ const property = MetadataProperty.create({
62
+ key,
63
+ value,
64
+ description,
65
+ jsDocTags,
66
+ });
67
+ obj.properties.push(property);
68
+ return property;
69
+ };
70
+
71
+ //----
72
+ // REGULAR PROPERTIES
73
+ //----
74
+ for (const prop of parent.getApparentProperties()) {
75
+ // CHECK INTERNAL TAG
76
+ if (
77
+ (prop.getJsDocTags(checker) ?? []).find(
78
+ (tag) => tag.name === "internal",
79
+ ) !== undefined
80
+ )
81
+ continue;
82
+
83
+ // CHECK NODE IS A FORMAL PROPERTY
84
+ const [node, type] = (() => {
85
+ const node = prop.getDeclarations()?.[0] as
86
+ | ts.PropertyDeclaration
87
+ | undefined;
88
+ const type: ts.Type | undefined = node
89
+ ? checker.getTypeOfSymbolAtLocation(prop, node)
90
+ : checker.getTypeOfPropertyOfType(parent, prop.name);
91
+ return [node, type];
92
+ })();
93
+ if ((node && pred(node) === false) || type === undefined) continue;
94
+
95
+ // GET EXACT TYPE
96
+ const key: Metadata = MetadataHelper.literal_to_metadata(prop.name);
97
+ const value: Metadata = explore_metadata(checker)(options)(collection)(
98
+ errors,
99
+ )(type, {
100
+ top: false,
101
+ object: obj,
102
+ property: prop.name,
103
+ nested: null,
104
+ escaped: false,
105
+ aliased: false,
106
+ });
107
+ Writable(value).optional = (prop.flags & ts.SymbolFlags.Optional) !== 0;
108
+ insert(key)(value)(prop);
109
+ }
110
+
111
+ //----
112
+ // DYNAMIC PROPERTIES
113
+ //----
114
+ for (const index of checker.getIndexInfosOfType(parent)) {
115
+ // GET EXACT TYPE
116
+ const analyzer = (type: ts.Type) => (property: {} | null) =>
117
+ explore_metadata(checker)(options)(collection)(errors)(type, {
118
+ top: false,
119
+ object: obj,
120
+ property,
121
+ nested: null,
122
+ escaped: false,
123
+ aliased: false,
124
+ });
125
+ const key: Metadata = analyzer(index.keyType)(null);
126
+ const value: Metadata = analyzer(index.type)({});
127
+
128
+ if (
129
+ key.atomics.length +
130
+ key.constants.map((c) => c.values.length).reduce((a, b) => a + b, 0) +
131
+ key.templates.length +
132
+ key.natives.filter(
133
+ (type) =>
134
+ type === "Boolean" ||
135
+ type === "BigInt" ||
136
+ type === "Number" ||
137
+ type === "String",
138
+ ).length !==
139
+ key.size()
140
+ )
141
+ errors.push({
142
+ name: key.getName(),
143
+ explore: {
144
+ top: false,
145
+ object: obj,
146
+ property: "[key]",
147
+ nested: null,
148
+ escaped: false,
149
+ aliased: false,
150
+ },
151
+ messages: [],
152
+ });
153
+
154
+ // INSERT WITH REQUIRED CONFIGURATION
155
+ insert(key)(value)(
156
+ index.declaration?.parent
157
+ ? checker.getSymbolAtLocation(index.declaration.parent)
158
+ : undefined,
159
+ (doc) => doc.name !== "default",
160
+ );
161
+ }
162
+ return obj;
163
+ };
164
+
165
+ const isProperty = (node: ts.Declaration) =>
166
+ ts.isParameter(node) ||
167
+ ts.isPropertyDeclaration(node) ||
168
+ ts.isPropertyAssignment(node) ||
169
+ ts.isPropertySignature(node) ||
170
+ ts.isTypeLiteralNode(node);
171
+
172
+ const iterate_optional_coalesce = (meta: Metadata, type: ts.Type): void => {
173
+ if (type.isUnionOrIntersection())
174
+ type.types.forEach((child) => iterate_optional_coalesce(meta, child));
175
+ else iterate_metadata_coalesce(meta, type);
176
+ };
@@ -1,96 +1,94 @@
1
- import ts from "typescript";
2
-
3
- import { Metadata } from "../../../schemas/metadata/Metadata";
4
-
5
- import { TypePredicator } from "../../../utils/TypePredicator";
6
-
7
- import { MetadataCollection } from "../../MetadataCollection";
8
- import { MetadataFactory } from "../../MetadataFactory";
9
- import { TypeFactory } from "../../TypeFactory";
10
- import { iterate_metadata_alias } from "./iterate_metadata_alias";
11
- import { iterate_metadata_array } from "./iterate_metadata_array";
12
- import { iterate_metadata_atomic } from "./iterate_metadata_atomic";
13
- import { iterate_metadata_coalesce } from "./iterate_metadata_coalesce";
14
- import { iterate_metadata_constant } from "./iterate_metadata_constant";
15
- import { iterate_metadata_escape } from "./iterate_metadata_escape";
16
- import { iterate_metadata_intersection } from "./iterate_metadata_intersection";
17
- import { iterate_metadata_map } from "./iterate_metadata_map";
18
- import { iterate_metadata_native } from "./iterate_metadata_native";
19
- import { iterate_metadata_object } from "./iterate_metadata_object";
20
- import { iterate_metadata_set } from "./iterate_metadata_set";
21
- import { iterate_metadata_template } from "./iterate_metadata_template";
22
- import { iterate_metadata_tuple } from "./iterate_metadata_tuple";
23
- import { iterate_metadata_union } from "./iterate_metadata_union";
24
-
25
- export const iterate_metadata =
26
- (checker: ts.TypeChecker) =>
27
- (options: MetadataFactory.IOptions) =>
28
- (collection: MetadataCollection) =>
29
- (errors: MetadataFactory.IError[]) =>
30
- (meta: Metadata, type: ts.Type, explore: MetadataFactory.IExplore): void => {
31
- if (TypePredicator.isTypeParameter(type) === true) {
32
- errors.push({
33
- name: TypeFactory.getFullName(checker)(type),
34
- explore: { ...explore },
35
- messages: ["non-specified generic argument found."],
36
- });
37
- return;
38
- }
39
- // CHECK SPECIAL CASES
40
- else if (
41
- (explore.aliased !== true &&
42
- iterate_metadata_alias(checker)(options)(collection)(errors)(
43
- meta,
44
- type,
45
- explore,
46
- )) ||
47
- iterate_metadata_intersection(checker)(options)(collection)(errors)(
48
- meta,
49
- type,
50
- explore,
51
- ) ||
52
- iterate_metadata_union(checker)(options)(collection)(errors)(
53
- meta,
54
- type,
55
- explore,
56
- ) ||
57
- iterate_metadata_escape(checker)(options)(collection)(errors)(
58
- meta,
59
- type,
60
- explore,
61
- )
62
- )
63
- return;
64
-
65
- // ITERATE CASES
66
- iterate_metadata_coalesce(meta, type) ||
67
- iterate_metadata_constant(checker)(options)(meta, type) ||
68
- iterate_metadata_template(checker)(options)(collection)(errors)(
69
- meta,
70
- type,
71
- explore,
72
- ) ||
73
- iterate_metadata_atomic(meta, type) ||
74
- iterate_metadata_tuple(checker)(options)(collection)(errors)(
75
- meta,
76
- type as ts.TupleType,
77
- explore,
78
- ) ||
79
- iterate_metadata_array(checker)(options)(collection)(errors)(
80
- meta,
81
- type,
82
- explore,
83
- ) ||
84
- iterate_metadata_native(checker)(meta, type) ||
85
- iterate_metadata_map(checker)(options)(collection)(errors)(
86
- meta,
87
- type,
88
- explore,
89
- ) ||
90
- iterate_metadata_set(checker)(options)(collection)(errors)(
91
- meta,
92
- type,
93
- explore,
94
- ) ||
95
- iterate_metadata_object(checker)(options)(collection)(errors)(meta, type);
96
- };
1
+ import ts from "typescript";
2
+
3
+ import { Metadata } from "../../../schemas/metadata/Metadata";
4
+
5
+ import { MetadataCollection } from "../../MetadataCollection";
6
+ import { MetadataFactory } from "../../MetadataFactory";
7
+ import { TypeFactory } from "../../TypeFactory";
8
+ import { iterate_metadata_alias } from "./iterate_metadata_alias";
9
+ import { iterate_metadata_array } from "./iterate_metadata_array";
10
+ import { iterate_metadata_atomic } from "./iterate_metadata_atomic";
11
+ import { iterate_metadata_coalesce } from "./iterate_metadata_coalesce";
12
+ import { iterate_metadata_constant } from "./iterate_metadata_constant";
13
+ import { iterate_metadata_escape } from "./iterate_metadata_escape";
14
+ import { iterate_metadata_intersection } from "./iterate_metadata_intersection";
15
+ import { iterate_metadata_map } from "./iterate_metadata_map";
16
+ import { iterate_metadata_native } from "./iterate_metadata_native";
17
+ import { iterate_metadata_object } from "./iterate_metadata_object";
18
+ import { iterate_metadata_set } from "./iterate_metadata_set";
19
+ import { iterate_metadata_template } from "./iterate_metadata_template";
20
+ import { iterate_metadata_tuple } from "./iterate_metadata_tuple";
21
+ import { iterate_metadata_union } from "./iterate_metadata_union";
22
+
23
+ export const iterate_metadata =
24
+ (checker: ts.TypeChecker) =>
25
+ (options: MetadataFactory.IOptions) =>
26
+ (collection: MetadataCollection) =>
27
+ (errors: MetadataFactory.IError[]) =>
28
+ (meta: Metadata, type: ts.Type, explore: MetadataFactory.IExplore): void => {
29
+ if (type.isTypeParameter() === true) {
30
+ errors.push({
31
+ name: TypeFactory.getFullName(checker)(type),
32
+ explore: { ...explore },
33
+ messages: ["non-specified generic argument found."],
34
+ });
35
+ return;
36
+ }
37
+ // CHECK SPECIAL CASES
38
+ else if (
39
+ (explore.aliased !== true &&
40
+ iterate_metadata_alias(checker)(options)(collection)(errors)(
41
+ meta,
42
+ type,
43
+ explore,
44
+ )) ||
45
+ iterate_metadata_intersection(checker)(options)(collection)(errors)(
46
+ meta,
47
+ type,
48
+ explore,
49
+ ) ||
50
+ iterate_metadata_union(checker)(options)(collection)(errors)(
51
+ meta,
52
+ type,
53
+ explore,
54
+ ) ||
55
+ iterate_metadata_escape(checker)(options)(collection)(errors)(
56
+ meta,
57
+ type,
58
+ explore,
59
+ )
60
+ )
61
+ return;
62
+
63
+ // ITERATE CASES
64
+ iterate_metadata_coalesce(meta, type) ||
65
+ iterate_metadata_constant(checker)(options)(meta, type) ||
66
+ iterate_metadata_template(checker)(options)(collection)(errors)(
67
+ meta,
68
+ type,
69
+ explore,
70
+ ) ||
71
+ iterate_metadata_atomic(meta, type) ||
72
+ iterate_metadata_tuple(checker)(options)(collection)(errors)(
73
+ meta,
74
+ type as ts.TupleType,
75
+ explore,
76
+ ) ||
77
+ iterate_metadata_array(checker)(options)(collection)(errors)(
78
+ meta,
79
+ type,
80
+ explore,
81
+ ) ||
82
+ iterate_metadata_native(checker)(meta, type) ||
83
+ iterate_metadata_map(checker)(options)(collection)(errors)(
84
+ meta,
85
+ type,
86
+ explore,
87
+ ) ||
88
+ iterate_metadata_set(checker)(options)(collection)(errors)(
89
+ meta,
90
+ type,
91
+ explore,
92
+ ) ||
93
+ iterate_metadata_object(checker)(options)(collection)(errors)(meta, type);
94
+ };