typia 7.0.0-dev.20241012 → 7.0.0-dev.20241019
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/factories/JsonMetadataFactory.js +3 -2
- package/lib/factories/JsonMetadataFactory.js.map +1 -1
- package/lib/factories/MetadataCollection.d.ts +3 -3
- package/lib/factories/MetadataCollection.js +2 -2
- package/lib/factories/MetadataCollection.js.map +1 -1
- package/lib/factories/MetadataFactory.d.ts +2 -2
- package/lib/factories/MetadataFactory.js +3 -3
- package/lib/factories/MetadataFactory.js.map +1 -1
- package/lib/factories/MetadataTypeTagFactory.d.ts +3 -2
- package/lib/factories/MetadataTypeTagFactory.js +26 -3
- package/lib/factories/MetadataTypeTagFactory.js.map +1 -1
- package/lib/factories/ProtobufFactory.js +1266 -160
- package/lib/factories/ProtobufFactory.js.map +1 -1
- package/lib/factories/internal/metadata/IMetadataIteratorProps.d.ts +1 -0
- package/lib/factories/internal/metadata/MetadataHelper.js +1 -1
- package/lib/factories/internal/metadata/MetadataHelper.js.map +1 -1
- package/lib/factories/internal/metadata/emplace_metadata_alias.d.ts +2 -2
- package/lib/factories/internal/metadata/emplace_metadata_object.js +5 -5
- package/lib/factories/internal/metadata/emplace_metadata_object.js.map +1 -1
- package/lib/factories/internal/metadata/explore_metadata.js +2 -0
- package/lib/factories/internal/metadata/explore_metadata.js.map +1 -1
- package/lib/factories/internal/metadata/iterate_metadata.js +1 -1
- package/lib/factories/internal/metadata/iterate_metadata.js.map +1 -1
- package/lib/factories/internal/metadata/iterate_metadata_alias.js +8 -2
- package/lib/factories/internal/metadata/iterate_metadata_alias.js.map +1 -1
- package/lib/factories/internal/metadata/iterate_metadata_collection.js +6 -6
- package/lib/factories/internal/metadata/iterate_metadata_collection.js.map +1 -1
- package/lib/factories/internal/metadata/iterate_metadata_intersection.js +262 -137
- package/lib/factories/internal/metadata/iterate_metadata_intersection.js.map +1 -1
- package/lib/factories/internal/metadata/iterate_metadata_map.js +4 -2
- package/lib/factories/internal/metadata/iterate_metadata_map.js.map +1 -1
- package/lib/factories/internal/metadata/iterate_metadata_native.js +27 -11
- package/lib/factories/internal/metadata/iterate_metadata_native.js.map +1 -1
- package/lib/factories/internal/metadata/iterate_metadata_set.js +8 -1
- package/lib/factories/internal/metadata/iterate_metadata_set.js.map +1 -1
- package/lib/factories/internal/metadata/iterate_metadata_sort.js +1 -1
- package/lib/factories/internal/metadata/iterate_metadata_sort.js.map +1 -1
- package/lib/factories/internal/metadata/iterate_metadata_template.js +1 -1
- package/lib/factories/internal/metadata/iterate_metadata_template.js.map +1 -1
- package/lib/programmers/CheckerProgrammer.js +5 -5
- package/lib/programmers/CheckerProgrammer.js.map +1 -1
- package/lib/programmers/RandomProgrammer.js +12 -12
- package/lib/programmers/RandomProgrammer.js.map +1 -1
- package/lib/programmers/helpers/AtomicPredicator.js +3 -3
- package/lib/programmers/helpers/AtomicPredicator.js.map +1 -1
- package/lib/programmers/helpers/ProtobufUtil.d.ts +6 -3
- package/lib/programmers/helpers/ProtobufUtil.js +216 -93
- package/lib/programmers/helpers/ProtobufUtil.js.map +1 -1
- package/lib/programmers/helpers/UnionExplorer.d.ts +4 -2
- package/lib/programmers/helpers/UnionExplorer.js +1 -1
- package/lib/programmers/helpers/UnionExplorer.js.map +1 -1
- package/lib/programmers/http/HttpFormDataProgrammer.js +6 -6
- package/lib/programmers/http/HttpFormDataProgrammer.js.map +1 -1
- package/lib/programmers/internal/application_escaped.js +2 -2
- package/lib/programmers/internal/application_escaped.js.map +1 -1
- package/lib/programmers/internal/application_v30_alias.js +13 -8
- package/lib/programmers/internal/application_v30_alias.js.map +1 -1
- package/lib/programmers/internal/application_v30_native.js +17 -10
- package/lib/programmers/internal/application_v30_native.js.map +1 -1
- package/lib/programmers/internal/application_v30_object.js +16 -6
- package/lib/programmers/internal/application_v30_object.js.map +1 -1
- package/lib/programmers/internal/application_v30_schema.js +24 -17
- package/lib/programmers/internal/application_v30_schema.js.map +1 -1
- package/lib/programmers/internal/application_v31_alias.js +12 -11
- package/lib/programmers/internal/application_v31_alias.js.map +1 -1
- package/lib/programmers/internal/application_v31_native.js +17 -10
- package/lib/programmers/internal/application_v31_native.js.map +1 -1
- package/lib/programmers/internal/application_v31_object.js +13 -6
- package/lib/programmers/internal/application_v31_object.js.map +1 -1
- package/lib/programmers/internal/application_v31_schema.js +23 -16
- package/lib/programmers/internal/application_v31_schema.js.map +1 -1
- package/lib/programmers/internal/check_dynamic_key.js +4 -4
- package/lib/programmers/internal/check_dynamic_key.js.map +1 -1
- package/lib/programmers/internal/check_native.js +3 -3
- package/lib/programmers/internal/check_union_array_like.js.map +1 -1
- package/lib/programmers/internal/llm_schema_escaped.js +2 -2
- package/lib/programmers/internal/llm_schema_escaped.js.map +1 -1
- package/lib/programmers/internal/llm_schema_object.js +18 -14
- package/lib/programmers/internal/llm_schema_object.js.map +1 -1
- package/lib/programmers/internal/llm_schema_station.js +8 -8
- package/lib/programmers/internal/llm_schema_station.js.map +1 -1
- package/lib/programmers/json/JsonSchemasProgrammer.js +5 -5
- package/lib/programmers/json/JsonSchemasProgrammer.js.map +1 -1
- package/lib/programmers/json/JsonStringifyProgrammer.js +18 -17
- package/lib/programmers/json/JsonStringifyProgrammer.js.map +1 -1
- package/lib/programmers/llm/LlmSchemaProgrammer.js +6 -6
- package/lib/programmers/llm/LlmSchemaProgrammer.js.map +1 -1
- package/lib/programmers/misc/MiscCloneProgrammer.js +7 -5
- package/lib/programmers/misc/MiscCloneProgrammer.js.map +1 -1
- package/lib/programmers/misc/MiscPruneProgrammer.js +1 -1
- package/lib/programmers/misc/MiscPruneProgrammer.js.map +1 -1
- package/lib/programmers/notations/NotationGeneralProgrammer.js +6 -4
- package/lib/programmers/notations/NotationGeneralProgrammer.js.map +1 -1
- package/lib/programmers/protobuf/ProtobufDecodeProgrammer.js +169 -220
- package/lib/programmers/protobuf/ProtobufDecodeProgrammer.js.map +1 -1
- package/lib/programmers/protobuf/ProtobufEncodeProgrammer.js +6 -4
- package/lib/programmers/protobuf/ProtobufEncodeProgrammer.js.map +1 -1
- package/lib/programmers/protobuf/ProtobufMessageProgrammer.d.ts +1 -1
- package/lib/programmers/protobuf/ProtobufMessageProgrammer.js +53 -128
- package/lib/programmers/protobuf/ProtobufMessageProgrammer.js.map +1 -1
- package/lib/schemas/metadata/IMetadata.d.ts +14 -18
- package/lib/schemas/metadata/IMetadataAlias.d.ts +2 -7
- package/lib/schemas/metadata/IMetadataAliasType.d.ts +10 -0
- package/lib/schemas/metadata/IMetadataAliasType.js +3 -0
- package/lib/schemas/metadata/IMetadataAliasType.js.map +1 -0
- package/lib/schemas/metadata/IMetadataComponents.d.ts +2 -2
- package/lib/schemas/metadata/IMetadataConstantValue.d.ts +1 -1
- package/lib/schemas/metadata/IMetadataDictionary.d.ts +2 -2
- package/lib/schemas/metadata/IMetadataMap.d.ts +7 -0
- package/lib/schemas/metadata/{IMetadataEntry.js → IMetadataMap.js} +1 -1
- package/lib/schemas/metadata/IMetadataMap.js.map +1 -0
- package/lib/schemas/metadata/IMetadataNative.d.ts +5 -0
- package/lib/schemas/metadata/IMetadataNative.js +3 -0
- package/lib/schemas/metadata/IMetadataNative.js.map +1 -0
- package/lib/schemas/metadata/IMetadataSet.d.ts +6 -0
- package/lib/schemas/metadata/IMetadataSet.js +3 -0
- package/lib/schemas/metadata/IMetadataSet.js.map +1 -0
- package/lib/schemas/metadata/IMetadataTemplate.d.ts +1 -1
- package/lib/schemas/metadata/IMetadataTypeTag.d.ts +1 -1
- package/lib/schemas/metadata/Metadata.d.ts +6 -9
- package/lib/schemas/metadata/Metadata.js +136 -98
- package/lib/schemas/metadata/Metadata.js.map +1 -1
- package/lib/schemas/metadata/MetadataAlias.d.ts +8 -11
- package/lib/schemas/metadata/MetadataAlias.js +48 -33
- package/lib/schemas/metadata/MetadataAlias.js.map +1 -1
- package/lib/schemas/metadata/MetadataAliasType.d.ts +16 -0
- package/lib/schemas/metadata/MetadataAliasType.js +51 -0
- package/lib/schemas/metadata/MetadataAliasType.js.map +1 -0
- package/lib/schemas/metadata/MetadataComponents.d.ts +2 -2
- package/lib/schemas/metadata/MetadataComponents.js +2 -2
- package/lib/schemas/metadata/MetadataComponents.js.map +1 -1
- package/lib/schemas/metadata/MetadataConstantValue.d.ts +1 -1
- package/lib/schemas/metadata/MetadataMap.d.ts +14 -0
- package/lib/schemas/metadata/MetadataMap.js +66 -0
- package/lib/schemas/metadata/MetadataMap.js.map +1 -0
- package/lib/schemas/metadata/MetadataNative.d.ts +12 -0
- package/lib/schemas/metadata/MetadataNative.js +65 -0
- package/lib/schemas/metadata/MetadataNative.js.map +1 -0
- package/lib/schemas/metadata/MetadataProperty.d.ts +2 -0
- package/lib/schemas/metadata/MetadataProperty.js.map +1 -1
- package/lib/schemas/metadata/MetadataSet.d.ts +13 -0
- package/lib/schemas/metadata/MetadataSet.js +64 -0
- package/lib/schemas/metadata/MetadataSet.js.map +1 -0
- package/lib/schemas/metadata/MetadataTemplate.d.ts +1 -1
- package/lib/schemas/protobuf/IProtobufProperty.d.ts +5 -0
- package/lib/schemas/protobuf/IProtobufProperty.js +3 -0
- package/lib/schemas/protobuf/IProtobufProperty.js.map +1 -0
- package/lib/schemas/protobuf/IProtobufPropertyType.d.ts +28 -0
- package/lib/schemas/protobuf/IProtobufPropertyType.js +3 -0
- package/lib/schemas/protobuf/IProtobufPropertyType.js.map +1 -0
- package/lib/schemas/protobuf/IProtobufSchema.d.ts +38 -0
- package/lib/schemas/protobuf/IProtobufSchema.js +3 -0
- package/lib/schemas/protobuf/IProtobufSchema.js.map +1 -0
- package/lib/tags/Example.d.ts +2 -2
- package/lib/tags/Examples.d.ts +2 -2
- package/lib/tags/JsonSchemaPlugin.d.ts +1 -1
- package/lib/tags/Sequence.d.ts +9 -0
- package/lib/tags/Sequence.js +3 -0
- package/lib/tags/Sequence.js.map +1 -0
- package/lib/tags/TagBase.d.ts +1 -1
- package/lib/tags/index.d.ts +1 -0
- package/lib/tags/index.js +1 -0
- package/lib/tags/index.js.map +1 -1
- package/lib/utils/{NameEncoder.d.ts → ProtobufNameEncoder.d.ts} +1 -1
- package/lib/utils/{NameEncoder.js → ProtobufNameEncoder.js} +7 -7
- package/lib/utils/ProtobufNameEncoder.js.map +1 -0
- package/package.json +1 -1
- package/src/factories/JsonMetadataFactory.ts +5 -2
- package/src/factories/MetadataCollection.ts +6 -6
- package/src/factories/MetadataFactory.ts +7 -7
- package/src/factories/MetadataTypeTagFactory.ts +31 -6
- package/src/factories/ProtobufFactory.ts +794 -177
- package/src/factories/internal/metadata/IMetadataIteratorProps.ts +1 -0
- package/src/factories/internal/metadata/MetadataHelper.ts +1 -1
- package/src/factories/internal/metadata/emplace_metadata_alias.ts +2 -2
- package/src/factories/internal/metadata/emplace_metadata_object.ts +5 -5
- package/src/factories/internal/metadata/explore_metadata.ts +1 -0
- package/src/factories/internal/metadata/iterate_metadata.ts +1 -1
- package/src/factories/internal/metadata/iterate_metadata_alias.ts +9 -4
- package/src/factories/internal/metadata/iterate_metadata_collection.ts +6 -6
- package/src/factories/internal/metadata/iterate_metadata_intersection.ts +163 -181
- package/src/factories/internal/metadata/iterate_metadata_map.ts +5 -2
- package/src/factories/internal/metadata/iterate_metadata_native.ts +20 -2
- package/src/factories/internal/metadata/iterate_metadata_set.ts +27 -11
- package/src/factories/internal/metadata/iterate_metadata_sort.ts +1 -1
- package/src/factories/internal/metadata/iterate_metadata_template.ts +1 -3
- package/src/programmers/CheckerProgrammer.ts +9 -7
- package/src/programmers/RandomProgrammer.ts +16 -14
- package/src/programmers/helpers/AtomicPredicator.ts +3 -3
- package/src/programmers/helpers/ProtobufUtil.ts +147 -44
- package/src/programmers/helpers/UnionExplorer.ts +62 -62
- package/src/programmers/http/HttpFormDataProgrammer.ts +10 -6
- package/src/programmers/internal/application_escaped.ts +2 -2
- package/src/programmers/internal/application_v30_alias.ts +18 -12
- package/src/programmers/internal/application_v30_native.ts +22 -12
- package/src/programmers/internal/application_v30_object.ts +23 -8
- package/src/programmers/internal/application_v30_schema.ts +31 -34
- package/src/programmers/internal/application_v31_alias.ts +16 -13
- package/src/programmers/internal/application_v31_native.ts +22 -12
- package/src/programmers/internal/application_v31_object.ts +19 -8
- package/src/programmers/internal/application_v31_schema.ts +26 -29
- package/src/programmers/internal/check_dynamic_key.ts +4 -4
- package/src/programmers/internal/check_native.ts +4 -4
- package/src/programmers/internal/check_union_array_like.ts +2 -1
- package/src/programmers/internal/llm_schema_escaped.ts +2 -2
- package/src/programmers/internal/llm_schema_object.ts +21 -18
- package/src/programmers/internal/llm_schema_station.ts +9 -11
- package/src/programmers/json/JsonSchemasProgrammer.ts +5 -5
- package/src/programmers/json/JsonStringifyProgrammer.ts +5 -5
- package/src/programmers/llm/LlmSchemaProgrammer.ts +6 -6
- package/src/programmers/misc/MiscCloneProgrammer.ts +11 -7
- package/src/programmers/misc/MiscPruneProgrammer.ts +1 -1
- package/src/programmers/notations/NotationGeneralProgrammer.ts +10 -6
- package/src/programmers/protobuf/ProtobufDecodeProgrammer.ts +254 -308
- package/src/programmers/protobuf/ProtobufEncodeProgrammer.ts +11 -8
- package/src/programmers/protobuf/ProtobufMessageProgrammer.ts +73 -95
- package/src/schemas/metadata/IMetadata.ts +35 -39
- package/src/schemas/metadata/IMetadataAlias.ts +6 -12
- package/src/schemas/metadata/IMetadataAliasType.ts +12 -0
- package/src/schemas/metadata/IMetadataArray.ts +6 -6
- package/src/schemas/metadata/IMetadataComponents.ts +11 -11
- package/src/schemas/metadata/IMetadataConstantValue.ts +1 -1
- package/src/schemas/metadata/IMetadataDictionary.ts +2 -2
- package/src/schemas/metadata/IMetadataMap.ts +8 -0
- package/src/schemas/metadata/IMetadataNative.ts +6 -0
- package/src/schemas/metadata/IMetadataObjectType.ts +13 -13
- package/src/schemas/metadata/IMetadataSet.ts +7 -0
- package/src/schemas/metadata/IMetadataTemplate.ts +7 -7
- package/src/schemas/metadata/IMetadataTuple.ts +6 -6
- package/src/schemas/metadata/IMetadataTypeTag.ts +16 -16
- package/src/schemas/metadata/Metadata.ts +100 -47
- package/src/schemas/metadata/MetadataAlias.ts +46 -61
- package/src/schemas/metadata/MetadataAliasType.ts +63 -0
- package/src/schemas/metadata/MetadataArray.ts +49 -49
- package/src/schemas/metadata/MetadataComponents.ts +3 -3
- package/src/schemas/metadata/MetadataConstantValue.ts +1 -1
- package/src/schemas/metadata/MetadataMap.ts +48 -0
- package/src/schemas/metadata/MetadataNative.ts +44 -0
- package/src/schemas/metadata/MetadataProperty.ts +3 -0
- package/src/schemas/metadata/MetadataSet.ts +45 -0
- package/src/schemas/metadata/MetadataTemplate.ts +80 -80
- package/src/schemas/metadata/MetadataTuple.ts +32 -32
- package/src/schemas/protobuf/IProtobufProperty.ts +6 -0
- package/src/schemas/protobuf/IProtobufPropertyType.ts +37 -0
- package/src/schemas/protobuf/IProtobufSchema.ts +50 -0
- package/src/tags/Example.ts +24 -17
- package/src/tags/Examples.ts +16 -16
- package/src/tags/JsonSchemaPlugin.ts +8 -8
- package/src/tags/Sequence.ts +10 -0
- package/src/tags/TagBase.ts +82 -76
- package/src/tags/index.ts +1 -0
- package/src/utils/{NameEncoder.ts → ProtobufNameEncoder.ts} +1 -1
- package/lib/schemas/metadata/IMetadataEntry.d.ts +0 -5
- package/lib/schemas/metadata/IMetadataEntry.js.map +0 -1
- package/lib/utils/NameEncoder.js.map +0 -1
- package/src/schemas/metadata/IMetadataEntry.ts +0 -6
|
@@ -11,8 +11,11 @@ import { MetadataAtomic } from "./MetadataAtomic";
|
|
|
11
11
|
import { MetadataConstant } from "./MetadataConstant";
|
|
12
12
|
import { MetadataEscaped } from "./MetadataEscaped";
|
|
13
13
|
import { MetadataFunction } from "./MetadataFunction";
|
|
14
|
+
import { MetadataMap } from "./MetadataMap";
|
|
15
|
+
import { MetadataNative } from "./MetadataNative";
|
|
14
16
|
import { MetadataObject } from "./MetadataObject";
|
|
15
17
|
import { MetadataObjectType } from "./MetadataObjectType";
|
|
18
|
+
import { MetadataSet } from "./MetadataSet";
|
|
16
19
|
import { MetadataTemplate } from "./MetadataTemplate";
|
|
17
20
|
import { MetadataTuple } from "./MetadataTuple";
|
|
18
21
|
|
|
@@ -34,15 +37,16 @@ export class Metadata {
|
|
|
34
37
|
public objects: MetadataObject[];
|
|
35
38
|
public functions: MetadataFunction[];
|
|
36
39
|
|
|
37
|
-
public natives:
|
|
38
|
-
public sets:
|
|
39
|
-
public maps:
|
|
40
|
+
public natives: MetadataNative[];
|
|
41
|
+
public sets: MetadataSet[];
|
|
42
|
+
public maps: MetadataMap[];
|
|
40
43
|
|
|
41
44
|
/** @internal */ private name_?: string;
|
|
42
45
|
/** @internal */ private parent_resolved_: boolean = false;
|
|
43
46
|
/** @internal */ public union_index?: number;
|
|
44
47
|
/** @internal */ public fixed_?: number | null;
|
|
45
48
|
/** @internal */ public boolean_literal_intersected_?: boolean;
|
|
49
|
+
/** @internal */ private is_sequence_?: boolean;
|
|
46
50
|
|
|
47
51
|
/* -----------------------------------------------------------
|
|
48
52
|
CONSTRUCTORS
|
|
@@ -126,14 +130,11 @@ export class Metadata {
|
|
|
126
130
|
arrays: this.arrays.map((array) => array.toJSON()),
|
|
127
131
|
tuples: this.tuples.map((tuple) => tuple.toJSON()),
|
|
128
132
|
objects: this.objects.map((obj) => obj.toJSON()),
|
|
129
|
-
aliases: this.aliases.map((alias) => alias.
|
|
130
|
-
|
|
131
|
-
natives: this.natives.
|
|
132
|
-
sets: this.sets.map((
|
|
133
|
-
maps: this.maps.map((
|
|
134
|
-
key: entry.key.toJSON(),
|
|
135
|
-
value: entry.value.toJSON(),
|
|
136
|
-
})),
|
|
133
|
+
aliases: this.aliases.map((alias) => alias.toJSON()),
|
|
134
|
+
|
|
135
|
+
natives: this.natives.map((native) => native.toJSON()),
|
|
136
|
+
sets: this.sets.map((set) => set.toJSON()),
|
|
137
|
+
maps: this.maps.map((map) => map.toJSON()),
|
|
137
138
|
};
|
|
138
139
|
}
|
|
139
140
|
|
|
@@ -185,19 +186,30 @@ export class Metadata {
|
|
|
185
186
|
});
|
|
186
187
|
}),
|
|
187
188
|
aliases: meta.aliases.map((alias) => {
|
|
188
|
-
const
|
|
189
|
-
if (
|
|
189
|
+
const type = dict.aliases.get(alias.name);
|
|
190
|
+
if (type === undefined)
|
|
190
191
|
throw new RangeError(
|
|
191
192
|
`Error on Metadata.from(): failed to find alias "${alias}".`,
|
|
192
193
|
);
|
|
193
|
-
return
|
|
194
|
+
return MetadataAlias.create({
|
|
195
|
+
type,
|
|
196
|
+
tags: alias.tags.map((r) => r.slice()),
|
|
197
|
+
});
|
|
194
198
|
}),
|
|
195
|
-
natives: meta.natives.
|
|
196
|
-
sets: meta.sets.map((
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
199
|
+
natives: meta.natives.map((native) => MetadataNative.create(native)),
|
|
200
|
+
sets: meta.sets.map((set) =>
|
|
201
|
+
MetadataSet.create({
|
|
202
|
+
value: Metadata.from(set.value, dict),
|
|
203
|
+
tags: set.tags.map((r) => r.slice()),
|
|
204
|
+
}),
|
|
205
|
+
),
|
|
206
|
+
maps: meta.maps.map((map) =>
|
|
207
|
+
MetadataMap.create({
|
|
208
|
+
key: this.from(map.key, dict),
|
|
209
|
+
value: this.from(map.value, dict),
|
|
210
|
+
tags: map.tags.map((r) => r.slice()),
|
|
211
|
+
}),
|
|
212
|
+
),
|
|
201
213
|
});
|
|
202
214
|
}
|
|
203
215
|
|
|
@@ -250,6 +262,39 @@ export class Metadata {
|
|
|
250
262
|
);
|
|
251
263
|
}
|
|
252
264
|
|
|
265
|
+
/**
|
|
266
|
+
* @internal
|
|
267
|
+
*/
|
|
268
|
+
public isSequence(): boolean {
|
|
269
|
+
return (this.is_sequence_ ??= (() => {
|
|
270
|
+
const exists = (tags: IMetadataTypeTag[][]): boolean =>
|
|
271
|
+
tags.some((row) => {
|
|
272
|
+
const sequence = row.find(
|
|
273
|
+
(t) =>
|
|
274
|
+
t.kind === "sequence" &&
|
|
275
|
+
typeof (t.schema as any)?.["x-protobuf-sequence"] === "number",
|
|
276
|
+
);
|
|
277
|
+
if (sequence === undefined) return false;
|
|
278
|
+
const value: number = Number(
|
|
279
|
+
(sequence.schema as any)["x-protobuf-sequence"],
|
|
280
|
+
);
|
|
281
|
+
return !Number.isNaN(value);
|
|
282
|
+
});
|
|
283
|
+
return (
|
|
284
|
+
this.atomics.some((atomic) => exists(atomic.tags)) &&
|
|
285
|
+
this.constants.some((c) =>
|
|
286
|
+
c.values.some((v) => exists(v.tags ?? [])),
|
|
287
|
+
) &&
|
|
288
|
+
this.templates.some((tpl) => exists(tpl.tags)) &&
|
|
289
|
+
this.arrays.some((array) => exists(array.tags)) &&
|
|
290
|
+
this.objects.some((object) => exists(object.tags)) &&
|
|
291
|
+
this.natives.some(
|
|
292
|
+
(native) => native.name === "Uint8Array" && exists(native.tags),
|
|
293
|
+
)
|
|
294
|
+
);
|
|
295
|
+
})());
|
|
296
|
+
}
|
|
297
|
+
|
|
253
298
|
public isConstant(): boolean {
|
|
254
299
|
return this.bucket() === (this.constants.length ? 1 : 0);
|
|
255
300
|
}
|
|
@@ -423,7 +468,8 @@ export namespace Metadata {
|
|
|
423
468
|
|
|
424
469
|
// ALIASES
|
|
425
470
|
for (const yd of y.aliases)
|
|
426
|
-
if (x.aliases.some((xd) => xd.name === yd.name) === false)
|
|
471
|
+
if (x.aliases.some((xd) => xd.type.name === yd.type.name) === false)
|
|
472
|
+
return false;
|
|
427
473
|
|
|
428
474
|
// NATIVES
|
|
429
475
|
for (const yn of y.natives)
|
|
@@ -431,7 +477,8 @@ export namespace Metadata {
|
|
|
431
477
|
|
|
432
478
|
// SETS
|
|
433
479
|
for (const ys of y.sets)
|
|
434
|
-
if (x.sets.some((xs) => covers(xs, ys)) === false)
|
|
480
|
+
if (x.sets.some((xs) => covers(xs.value, ys.value)) === false)
|
|
481
|
+
return false;
|
|
435
482
|
|
|
436
483
|
//----
|
|
437
484
|
// VALUES
|
|
@@ -476,7 +523,6 @@ export namespace Metadata {
|
|
|
476
523
|
required: x.required && y.required,
|
|
477
524
|
optional: x.optional || y.optional,
|
|
478
525
|
functions: x.functions.length ? x.functions : y.functions, // @todo
|
|
479
|
-
|
|
480
526
|
escaped:
|
|
481
527
|
x.escaped !== null && y.escaped !== null
|
|
482
528
|
? MetadataEscaped.create({
|
|
@@ -491,12 +537,10 @@ export namespace Metadata {
|
|
|
491
537
|
})(y.atomics),
|
|
492
538
|
constants: [...x.constants],
|
|
493
539
|
templates: x.templates.slice(),
|
|
494
|
-
|
|
495
540
|
rest:
|
|
496
541
|
x.rest !== null && y.rest !== null
|
|
497
542
|
? merge(x.rest, y.rest)
|
|
498
543
|
: (x.rest ?? y.rest),
|
|
499
|
-
// arrays: x.arrays.slice(),
|
|
500
544
|
arrays: mergeTaggedTypes({
|
|
501
545
|
container: x.arrays,
|
|
502
546
|
equals: (x, y) => x.type.name === y.type.name,
|
|
@@ -507,12 +551,33 @@ export namespace Metadata {
|
|
|
507
551
|
equals: (x, y) => x.type.name === y.type.name,
|
|
508
552
|
getter: (x) => x.tags,
|
|
509
553
|
})(y.tuples),
|
|
510
|
-
objects:
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
554
|
+
objects: mergeTaggedTypes({
|
|
555
|
+
container: x.objects,
|
|
556
|
+
equals: (x, y) => x.type.name === y.type.name,
|
|
557
|
+
getter: (x) => x.tags,
|
|
558
|
+
})(y.objects),
|
|
559
|
+
aliases: mergeTaggedTypes({
|
|
560
|
+
container: x.aliases,
|
|
561
|
+
equals: (x, y) => x.type.name === y.type.name,
|
|
562
|
+
getter: (x) => x.tags,
|
|
563
|
+
})(y.aliases),
|
|
564
|
+
natives: mergeTaggedTypes({
|
|
565
|
+
container: x.natives,
|
|
566
|
+
equals: (x, y) => x.name === y.name,
|
|
567
|
+
getter: (x) => x.tags,
|
|
568
|
+
})(y.natives),
|
|
569
|
+
sets: mergeTaggedTypes({
|
|
570
|
+
container: x.sets,
|
|
571
|
+
equals: (x, y) => x.value.getName() === y.value.getName(),
|
|
572
|
+
getter: (x) => x.tags,
|
|
573
|
+
})(y.sets),
|
|
574
|
+
maps: mergeTaggedTypes({
|
|
575
|
+
container: x.maps,
|
|
576
|
+
equals: (x, y) =>
|
|
577
|
+
x.key.getName() === y.key.getName() &&
|
|
578
|
+
x.value.getName() === y.value.getName(),
|
|
579
|
+
getter: (x) => x.tags,
|
|
580
|
+
})(y.maps),
|
|
516
581
|
});
|
|
517
582
|
for (const constant of y.constants) {
|
|
518
583
|
const target: MetadataConstant = ArrayUtil.take(
|
|
@@ -527,11 +592,6 @@ export namespace Metadata {
|
|
|
527
592
|
for (const value of constant.values)
|
|
528
593
|
ArrayUtil.add(target.values, value, (a, b) => a.value === b.value);
|
|
529
594
|
}
|
|
530
|
-
for (const obj of y.objects)
|
|
531
|
-
ArrayUtil.set(output.objects, obj, (elem) => elem.type.name);
|
|
532
|
-
for (const alias of y.aliases)
|
|
533
|
-
ArrayUtil.set(output.aliases, alias, (elem) => elem.name);
|
|
534
|
-
|
|
535
595
|
return output;
|
|
536
596
|
};
|
|
537
597
|
}
|
|
@@ -554,17 +614,16 @@ const getName = (metadata: Metadata): string => {
|
|
|
554
614
|
for (const template of metadata.templates) elements.push(template.getName());
|
|
555
615
|
|
|
556
616
|
// NATIVES
|
|
557
|
-
for (const native of metadata.natives) elements.push(native);
|
|
558
|
-
for (const set of metadata.sets) elements.push(
|
|
559
|
-
for (const map of metadata.maps)
|
|
560
|
-
elements.push(`Map<${map.key.getName()}, ${map.value.getName()}>`);
|
|
617
|
+
for (const native of metadata.natives) elements.push(native.getName());
|
|
618
|
+
for (const set of metadata.sets) elements.push(set.getName());
|
|
619
|
+
for (const map of metadata.maps) elements.push(map.getName());
|
|
561
620
|
|
|
562
621
|
// INSTANCES
|
|
563
622
|
if (metadata.rest !== null) elements.push(`...${metadata.rest.getName()}`);
|
|
564
623
|
for (const tuple of metadata.tuples) elements.push(tuple.type.name);
|
|
565
624
|
for (const array of metadata.arrays) elements.push(array.getName());
|
|
566
625
|
for (const object of metadata.objects) elements.push(object.getName());
|
|
567
|
-
for (const alias of metadata.aliases) elements.push(alias.
|
|
626
|
+
for (const alias of metadata.aliases) elements.push(alias.getName());
|
|
568
627
|
if (metadata.escaped !== null) elements.push(metadata.escaped.getName());
|
|
569
628
|
|
|
570
629
|
// RETURNS
|
|
@@ -574,12 +633,6 @@ const getName = (metadata: Metadata): string => {
|
|
|
574
633
|
elements.sort();
|
|
575
634
|
return `(${elements.join(" | ")})`;
|
|
576
635
|
};
|
|
577
|
-
export namespace Metadata {
|
|
578
|
-
export interface Entry {
|
|
579
|
-
key: Metadata;
|
|
580
|
-
value: Metadata;
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
636
|
|
|
584
637
|
const mergeTaggedTypes =
|
|
585
638
|
<T>(props: {
|
|
@@ -1,61 +1,46 @@
|
|
|
1
|
-
import { ClassProperties } from "../../typings/ClassProperties";
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
export class MetadataAlias {
|
|
8
|
-
public readonly
|
|
9
|
-
public readonly
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
this.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
public
|
|
41
|
-
return
|
|
42
|
-
name:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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.slice(),
|
|
58
|
-
nullables: this.nullables.slice(),
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
}
|
|
1
|
+
import { ClassProperties } from "../../typings/ClassProperties";
|
|
2
|
+
|
|
3
|
+
import { IMetadataAlias } from "./IMetadataAlias";
|
|
4
|
+
import { IMetadataTypeTag } from "./IMetadataTypeTag";
|
|
5
|
+
import { MetadataAliasType } from "./MetadataAliasType";
|
|
6
|
+
|
|
7
|
+
export class MetadataAlias {
|
|
8
|
+
public readonly type: MetadataAliasType;
|
|
9
|
+
public readonly tags: IMetadataTypeTag[][];
|
|
10
|
+
private name_?: string;
|
|
11
|
+
|
|
12
|
+
private constructor(props: ClassProperties<MetadataAlias>) {
|
|
13
|
+
this.type = props.type;
|
|
14
|
+
this.tags = props.tags;
|
|
15
|
+
this.type = props.type;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
public static create(props: ClassProperties<MetadataAlias>): MetadataAlias {
|
|
19
|
+
return new MetadataAlias(props);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
public getName(): string {
|
|
23
|
+
return (this.name_ ??= (() => {
|
|
24
|
+
if (this.tags.length === 0) return this.type.name;
|
|
25
|
+
else if (this.tags.length === 1) {
|
|
26
|
+
const str: string = [
|
|
27
|
+
this.type.name,
|
|
28
|
+
...this.tags[0]!.map((t) => t.name),
|
|
29
|
+
].join(" & ");
|
|
30
|
+
return `(${str})`;
|
|
31
|
+
}
|
|
32
|
+
const rows: string[] = this.tags.map((row) => {
|
|
33
|
+
const str: string = row.map((t) => t.name).join(" & ");
|
|
34
|
+
return row.length === 1 ? str : `(${str})`;
|
|
35
|
+
});
|
|
36
|
+
return `(${this.type.name} & (${rows.join(" | ")}))`;
|
|
37
|
+
})());
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
public toJSON(): IMetadataAlias {
|
|
41
|
+
return {
|
|
42
|
+
name: this.type.name,
|
|
43
|
+
tags: this.tags,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { ClassProperties } from "../../typings/ClassProperties";
|
|
2
|
+
|
|
3
|
+
import { IJsDocTagInfo } from "./IJsDocTagInfo";
|
|
4
|
+
import { IMetadataAliasType } from "./IMetadataAliasType";
|
|
5
|
+
import { Metadata } from "./Metadata";
|
|
6
|
+
|
|
7
|
+
export class MetadataAliasType {
|
|
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<MetadataAliasType>) {
|
|
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(
|
|
34
|
+
props: ClassProperties<MetadataAliasType>,
|
|
35
|
+
): MetadataAliasType {
|
|
36
|
+
return new MetadataAliasType(props);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @internal
|
|
41
|
+
*/
|
|
42
|
+
public static _From_without_value(props: Omit<IMetadataAliasType, "value">) {
|
|
43
|
+
return MetadataAliasType.create({
|
|
44
|
+
name: props.name,
|
|
45
|
+
value: null!,
|
|
46
|
+
description: props.description,
|
|
47
|
+
recursive: props.recursive,
|
|
48
|
+
jsDocTags: props.jsDocTags.slice(),
|
|
49
|
+
nullables: props.nullables.slice(),
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
public toJSON(): IMetadataAliasType {
|
|
54
|
+
return {
|
|
55
|
+
name: this.name,
|
|
56
|
+
value: this.value.toJSON(),
|
|
57
|
+
description: this.description,
|
|
58
|
+
recursive: this.recursive,
|
|
59
|
+
jsDocTags: this.jsDocTags.slice(),
|
|
60
|
+
nullables: this.nullables.slice(),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
import { ClassProperties } from "../../typings/ClassProperties";
|
|
2
|
-
|
|
3
|
-
import { IMetadataArray } from "./IMetadataArray";
|
|
4
|
-
import { IMetadataTypeTag } from "./IMetadataTypeTag";
|
|
5
|
-
import { MetadataArrayType } from "./MetadataArrayType";
|
|
6
|
-
|
|
7
|
-
export class MetadataArray {
|
|
8
|
-
public readonly type: MetadataArrayType;
|
|
9
|
-
public readonly tags: IMetadataTypeTag[][];
|
|
10
|
-
|
|
11
|
-
private name_?: string;
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* @hidden
|
|
15
|
-
*/
|
|
16
|
-
private constructor(props: ClassProperties<MetadataArray>) {
|
|
17
|
-
this.type = props.type;
|
|
18
|
-
this.tags = props.tags;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
public static create(props: ClassProperties<MetadataArray>): MetadataArray {
|
|
22
|
-
return new MetadataArray(props);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
public getName(): string {
|
|
26
|
-
return (this.name_ ??= (() => {
|
|
27
|
-
if (this.tags.length === 0) return this.type.name;
|
|
28
|
-
else if (this.tags.length === 1) {
|
|
29
|
-
const str: string = [
|
|
30
|
-
this.type.name,
|
|
31
|
-
...this.tags[0]!.map((t) => t.name),
|
|
32
|
-
].join(" & ");
|
|
33
|
-
return `(${str})`;
|
|
34
|
-
}
|
|
35
|
-
const rows: string[] = this.tags.map((row) => {
|
|
36
|
-
const str: string = row.map((t) => t.name).join(" & ");
|
|
37
|
-
return row.length === 1 ? str : `(${str})`;
|
|
38
|
-
});
|
|
39
|
-
return `(${this.type.name} & (${rows.join(" | ")}))`;
|
|
40
|
-
})());
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
public toJSON(): IMetadataArray {
|
|
44
|
-
return {
|
|
45
|
-
name: this.type.name,
|
|
46
|
-
tags: this.tags.map((row) => row.slice()),
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
}
|
|
1
|
+
import { ClassProperties } from "../../typings/ClassProperties";
|
|
2
|
+
|
|
3
|
+
import { IMetadataArray } from "./IMetadataArray";
|
|
4
|
+
import { IMetadataTypeTag } from "./IMetadataTypeTag";
|
|
5
|
+
import { MetadataArrayType } from "./MetadataArrayType";
|
|
6
|
+
|
|
7
|
+
export class MetadataArray {
|
|
8
|
+
public readonly type: MetadataArrayType;
|
|
9
|
+
public readonly tags: IMetadataTypeTag[][];
|
|
10
|
+
|
|
11
|
+
private name_?: string;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @hidden
|
|
15
|
+
*/
|
|
16
|
+
private constructor(props: ClassProperties<MetadataArray>) {
|
|
17
|
+
this.type = props.type;
|
|
18
|
+
this.tags = props.tags;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
public static create(props: ClassProperties<MetadataArray>): MetadataArray {
|
|
22
|
+
return new MetadataArray(props);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
public getName(): string {
|
|
26
|
+
return (this.name_ ??= (() => {
|
|
27
|
+
if (this.tags.length === 0) return this.type.name;
|
|
28
|
+
else if (this.tags.length === 1) {
|
|
29
|
+
const str: string = [
|
|
30
|
+
this.type.name,
|
|
31
|
+
...this.tags[0]!.map((t) => t.name),
|
|
32
|
+
].join(" & ");
|
|
33
|
+
return `(${str})`;
|
|
34
|
+
}
|
|
35
|
+
const rows: string[] = this.tags.map((row) => {
|
|
36
|
+
const str: string = row.map((t) => t.name).join(" & ");
|
|
37
|
+
return row.length === 1 ? str : `(${str})`;
|
|
38
|
+
});
|
|
39
|
+
return `(${this.type.name} & (${rows.join(" | ")}))`;
|
|
40
|
+
})());
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
public toJSON(): IMetadataArray {
|
|
44
|
+
return {
|
|
45
|
+
name: this.type.name,
|
|
46
|
+
tags: this.tags.map((row) => row.slice()),
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -4,14 +4,14 @@ import { Writable } from "../../typings/Writable";
|
|
|
4
4
|
import { IMetadataComponents } from "./IMetadataComponents";
|
|
5
5
|
import { IMetadataDictionary } from "./IMetadataDictionary";
|
|
6
6
|
import { Metadata } from "./Metadata";
|
|
7
|
-
import {
|
|
7
|
+
import { MetadataAliasType } from "./MetadataAliasType";
|
|
8
8
|
import { MetadataArrayType } from "./MetadataArrayType";
|
|
9
9
|
import { MetadataObjectType } from "./MetadataObjectType";
|
|
10
10
|
import { MetadataProperty } from "./MetadataProperty";
|
|
11
11
|
import { MetadataTupleType } from "./MetadataTupleType";
|
|
12
12
|
|
|
13
13
|
export class MetadataComponents {
|
|
14
|
-
public readonly aliases:
|
|
14
|
+
public readonly aliases: MetadataAliasType[];
|
|
15
15
|
public readonly objects: MetadataObjectType[];
|
|
16
16
|
public readonly arrays: MetadataArrayType[];
|
|
17
17
|
public readonly tuples: MetadataTupleType[];
|
|
@@ -37,7 +37,7 @@ export class MetadataComponents {
|
|
|
37
37
|
aliases: new Map(
|
|
38
38
|
json.aliases.map((alias) => [
|
|
39
39
|
alias.name,
|
|
40
|
-
|
|
40
|
+
MetadataAliasType._From_without_value(alias),
|
|
41
41
|
]),
|
|
42
42
|
),
|
|
43
43
|
arrays: new Map(
|
|
@@ -6,7 +6,7 @@ import { IMetadataTypeTag } from "./IMetadataTypeTag";
|
|
|
6
6
|
|
|
7
7
|
export class MetadataConstantValue {
|
|
8
8
|
public readonly value: boolean | bigint | number | string;
|
|
9
|
-
public tags: IMetadataTypeTag[][]
|
|
9
|
+
public tags: IMetadataTypeTag[][];
|
|
10
10
|
public readonly description?: string | null;
|
|
11
11
|
public readonly jsDocTags?: IJsDocTagInfo[];
|
|
12
12
|
private name_?: string;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ClassProperties } from "../../typings/ClassProperties";
|
|
2
|
+
|
|
3
|
+
import { IMetadataMap } from "./IMetadataMap";
|
|
4
|
+
import { IMetadataTypeTag } from "./IMetadataTypeTag";
|
|
5
|
+
import { Metadata } from "./Metadata";
|
|
6
|
+
|
|
7
|
+
export class MetadataMap {
|
|
8
|
+
public readonly key: Metadata;
|
|
9
|
+
public readonly value: Metadata;
|
|
10
|
+
public readonly tags: IMetadataTypeTag[][];
|
|
11
|
+
private name_?: string;
|
|
12
|
+
|
|
13
|
+
private constructor(props: ClassProperties<MetadataMap>) {
|
|
14
|
+
this.key = props.key;
|
|
15
|
+
this.value = props.value;
|
|
16
|
+
this.tags = props.tags;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public static create(props: ClassProperties<MetadataMap>): MetadataMap {
|
|
20
|
+
return new MetadataMap(props);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public getName(): string {
|
|
24
|
+
return (this.name_ ??= (() => {
|
|
25
|
+
const symbol: string = `Map<${this.key.getName()}, ${this.value.getName()}>`;
|
|
26
|
+
if (this.tags.length === 0) return symbol;
|
|
27
|
+
else if (this.tags.length === 1) {
|
|
28
|
+
const str: string = [symbol, ...this.tags[0]!.map((t) => t.name)].join(
|
|
29
|
+
" & ",
|
|
30
|
+
);
|
|
31
|
+
return `(${str})`;
|
|
32
|
+
}
|
|
33
|
+
const rows: string[] = this.tags.map((row) => {
|
|
34
|
+
const str: string = row.map((t) => t.name).join(" & ");
|
|
35
|
+
return row.length === 1 ? str : `(${str})`;
|
|
36
|
+
});
|
|
37
|
+
return `(${symbol} & (${rows.join(" | ")}))`;
|
|
38
|
+
})());
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public toJSON(): IMetadataMap {
|
|
42
|
+
return {
|
|
43
|
+
key: this.key.toJSON(),
|
|
44
|
+
value: this.value.toJSON(),
|
|
45
|
+
tags: this.tags,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ClassProperties } from "../../typings/ClassProperties";
|
|
2
|
+
|
|
3
|
+
import { IMetadataNative } from "./IMetadataNative";
|
|
4
|
+
import { IMetadataTypeTag } from "./IMetadataTypeTag";
|
|
5
|
+
|
|
6
|
+
export class MetadataNative {
|
|
7
|
+
public readonly name: string;
|
|
8
|
+
public readonly tags: IMetadataTypeTag[][];
|
|
9
|
+
private typeName_?: string;
|
|
10
|
+
|
|
11
|
+
private constructor(props: ClassProperties<MetadataNative>) {
|
|
12
|
+
this.name = props.name;
|
|
13
|
+
this.tags = props.tags;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
public static create(props: ClassProperties<MetadataNative>): MetadataNative {
|
|
17
|
+
return new MetadataNative(props);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public getName(): string {
|
|
21
|
+
return (this.typeName_ ??= (() => {
|
|
22
|
+
if (this.tags.length === 0) return this.name;
|
|
23
|
+
else if (this.tags.length === 1) {
|
|
24
|
+
const str: string = [
|
|
25
|
+
this.name,
|
|
26
|
+
...this.tags[0]!.map((t) => t.name),
|
|
27
|
+
].join(" & ");
|
|
28
|
+
return `(${str})`;
|
|
29
|
+
}
|
|
30
|
+
const rows: string[] = this.tags.map((row) => {
|
|
31
|
+
const str: string = row.map((t) => t.name).join(" & ");
|
|
32
|
+
return row.length === 1 ? str : `(${str})`;
|
|
33
|
+
});
|
|
34
|
+
return `(${this.name} & (${rows.join(" | ")}))`;
|
|
35
|
+
})());
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
public toJSON(): IMetadataNative {
|
|
39
|
+
return {
|
|
40
|
+
name: this.name,
|
|
41
|
+
tags: this.tags,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ClassProperties } from "../../typings/ClassProperties";
|
|
2
2
|
|
|
3
|
+
import { IProtobufProperty } from "../protobuf/IProtobufProperty";
|
|
3
4
|
import { IJsDocTagInfo } from "./IJsDocTagInfo";
|
|
4
5
|
import { IMetadataDictionary } from "./IMetadataDictionary";
|
|
5
6
|
import { IMetadataProperty } from "./IMetadataProperty";
|
|
@@ -11,6 +12,8 @@ export class MetadataProperty {
|
|
|
11
12
|
public readonly description: string | null;
|
|
12
13
|
public readonly jsDocTags: IJsDocTagInfo[];
|
|
13
14
|
|
|
15
|
+
public of_protobuf_?: IProtobufProperty;
|
|
16
|
+
|
|
14
17
|
/* -----------------------------------------------------------
|
|
15
18
|
CONSTRUCTORS
|
|
16
19
|
----------------------------------------------------------- */
|