typia 9.7.2 → 10.0.0-dev.20251107
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/LICENSE +21 -21
- package/README.md +153 -153
- package/lib/factories/ProtobufFactory.js +1 -1
- package/lib/factories/ProtobufFactory.mjs +1 -1
- package/lib/programmers/internal/json_schema_station.d.mts +2 -2
- package/lib/programmers/internal/json_schema_station.d.ts +2 -2
- package/lib/programmers/llm/LlmApplicationProgrammer.js +5 -1
- package/lib/programmers/llm/LlmApplicationProgrammer.js.map +1 -1
- package/lib/programmers/llm/LlmApplicationProgrammer.mjs +5 -1
- package/lib/programmers/llm/LlmSchemaProgrammer.js +1 -4
- package/lib/programmers/llm/LlmSchemaProgrammer.js.map +1 -1
- package/lib/programmers/llm/LlmSchemaProgrammer.mjs +1 -35
- package/package.json +121 -121
- package/src/AssertionGuard.ts +41 -41
- package/src/CamelCase.ts +75 -75
- package/src/IRandomGenerator.ts +337 -337
- package/src/IReadableURLSearchParams.ts +9 -9
- package/src/PascalCase.ts +71 -71
- package/src/Primitive.ts +90 -90
- package/src/Resolved.ts +72 -72
- package/src/SnakeCase.ts +127 -127
- package/src/TypeGuardError.ts +216 -216
- package/src/factories/MetadataCollection.ts +270 -270
- package/src/factories/MetadataCommentTagFactory.ts +632 -632
- package/src/factories/MetadataFactory.ts +402 -402
- package/src/factories/ProtobufFactory.ts +873 -873
- package/src/functional.ts +705 -705
- package/src/http.ts +972 -972
- package/src/internal/_ProtobufReader.ts +188 -188
- package/src/internal/_ProtobufSizer.ts +137 -137
- package/src/internal/_ProtobufWriter.ts +135 -135
- package/src/internal/_jsonStringifyString.ts +42 -42
- package/src/json.ts +643 -643
- package/src/llm.ts +615 -615
- package/src/misc.ts +594 -594
- package/src/module.ts +889 -889
- package/src/notations.ts +751 -751
- package/src/programmers/FeatureProgrammer.ts +605 -605
- package/src/programmers/ImportProgrammer.ts +179 -179
- package/src/programmers/RandomProgrammer.ts +1195 -1195
- package/src/programmers/helpers/ProtobufWire.ts +34 -34
- package/src/programmers/internal/check_array_length.ts +43 -43
- package/src/programmers/internal/check_bigint.ts +46 -46
- package/src/programmers/internal/check_dynamic_key.ts +197 -197
- package/src/programmers/internal/check_dynamic_properties.ts +231 -231
- package/src/programmers/internal/check_everything.ts +21 -21
- package/src/programmers/internal/check_native.ts +23 -23
- package/src/programmers/internal/check_number.ts +108 -108
- package/src/programmers/internal/check_object.ts +72 -72
- package/src/programmers/internal/check_string.ts +46 -46
- package/src/programmers/internal/check_template.ts +46 -46
- package/src/programmers/internal/check_union_array_like.ts +331 -331
- package/src/programmers/internal/decode_union_object.ts +110 -110
- package/src/programmers/internal/feature_object_entries.ts +59 -59
- package/src/programmers/internal/json_schema_escaped.ts +78 -78
- package/src/programmers/internal/json_schema_object.ts +150 -150
- package/src/programmers/internal/json_schema_station.ts +2 -2
- package/src/programmers/internal/metadata_to_pattern.ts +40 -40
- package/src/programmers/internal/postfix_of_tuple.ts +3 -3
- package/src/programmers/internal/prune_object_properties.ts +69 -69
- package/src/programmers/internal/stringify_dynamic_properties.ts +158 -158
- package/src/programmers/internal/stringify_native.ts +5 -5
- package/src/programmers/internal/stringify_regular_properties.ts +77 -77
- package/src/programmers/internal/template_to_pattern.ts +21 -21
- package/src/programmers/internal/wrap_metadata_rest_tuple.ts +21 -21
- package/src/programmers/json/JsonStringifyProgrammer.ts +1124 -1124
- package/src/programmers/llm/LlmApplicationProgrammer.ts +10 -1
- package/src/programmers/llm/LlmSchemaProgrammer.ts +2 -7
- package/src/protobuf.ts +820 -820
- package/src/reflect.ts +46 -46
- package/src/schemas/json/IJsonApplication.ts +77 -77
- package/src/schemas/json/IJsonSchemaCollection.ts +212 -212
- package/src/schemas/json/IJsonSchemaUnit.ts +263 -263
- package/src/schemas/metadata/IMetadataTypeTag.ts +14 -14
- package/src/schemas/metadata/Metadata.ts +669 -669
- package/src/schemas/metadata/MetadataAliasType.ts +57 -57
- package/src/schemas/metadata/MetadataApplication.ts +40 -40
- package/src/schemas/metadata/MetadataArray.ts +47 -47
- package/src/schemas/metadata/MetadataArrayType.ts +51 -51
- package/src/schemas/metadata/MetadataAtomic.ts +85 -85
- package/src/schemas/metadata/MetadataEscaped.ts +45 -45
- package/src/schemas/metadata/MetadataFunction.ts +45 -45
- package/src/schemas/metadata/MetadataObject.ts +46 -46
- package/src/schemas/metadata/MetadataObjectType.ts +137 -137
- package/src/schemas/metadata/MetadataParameter.ts +52 -52
- package/src/schemas/metadata/MetadataProperty.ts +53 -53
- package/src/schemas/metadata/MetadataTemplate.ts +78 -78
- package/src/schemas/metadata/MetadataTuple.ts +28 -28
- package/src/schemas/metadata/MetadataTupleType.ts +61 -61
- package/src/tags/Constant.ts +47 -47
- package/src/tags/ContentMediaType.ts +27 -27
- package/src/tags/Default.ts +52 -52
- package/src/tags/Example.ts +56 -56
- package/src/tags/Examples.ts +56 -56
- package/src/tags/ExclusiveMaximum.ts +44 -44
- package/src/tags/ExclusiveMinimum.ts +44 -44
- package/src/tags/Format.ts +78 -78
- package/src/tags/JsonSchemaPlugin.ts +36 -36
- package/src/tags/MaxItems.ts +31 -31
- package/src/tags/MaxLength.ts +25 -25
- package/src/tags/Maximum.ts +39 -39
- package/src/tags/MinItems.ts +31 -31
- package/src/tags/MinLength.ts +25 -25
- package/src/tags/Minimum.ts +39 -39
- package/src/tags/MultipleOf.ts +42 -42
- package/src/tags/Pattern.ts +49 -49
- package/src/tags/Sequence.ts +37 -37
- package/src/tags/TagBase.ts +102 -102
- package/src/tags/Type.ts +64 -64
- package/src/tags/UniqueItems.ts +34 -34
- package/src/tags/internal/FormatCheatSheet.ts +71 -71
- package/src/transformers/ITransformOptions.ts +70 -70
- package/src/transformers/ImportTransformer.ts +253 -253
- package/src/transformers/NoTransformConfigurationError.ts +16 -16
- package/src/transformers/features/llm/LlmApplicationTransformer.ts +224 -224
- package/src/typings/Equal.ts +18 -18
|
@@ -1,57 +1,57 @@
|
|
|
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
|
-
/** @ignore */
|
|
19
|
-
private constructor(props: ClassProperties<MetadataAliasType>) {
|
|
20
|
-
this.name = props.name;
|
|
21
|
-
this.value = props.value;
|
|
22
|
-
this.description = props.description;
|
|
23
|
-
this.jsDocTags = props.jsDocTags;
|
|
24
|
-
this.recursive = props.recursive;
|
|
25
|
-
this.nullables = props.nullables;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/** @internal */
|
|
29
|
-
public static create(
|
|
30
|
-
props: ClassProperties<MetadataAliasType>,
|
|
31
|
-
): MetadataAliasType {
|
|
32
|
-
return new MetadataAliasType(props);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/** @internal */
|
|
36
|
-
public static _From_without_value(props: Omit<IMetadataAliasType, "value">) {
|
|
37
|
-
return MetadataAliasType.create({
|
|
38
|
-
name: props.name,
|
|
39
|
-
value: null!,
|
|
40
|
-
description: props.description,
|
|
41
|
-
recursive: props.recursive,
|
|
42
|
-
jsDocTags: props.jsDocTags.slice(),
|
|
43
|
-
nullables: props.nullables.slice(),
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
public toJSON(): IMetadataAliasType {
|
|
48
|
-
return {
|
|
49
|
-
name: this.name,
|
|
50
|
-
value: this.value.toJSON(),
|
|
51
|
-
description: this.description,
|
|
52
|
-
recursive: this.recursive,
|
|
53
|
-
jsDocTags: this.jsDocTags.slice(),
|
|
54
|
-
nullables: this.nullables.slice(),
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
}
|
|
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
|
+
/** @ignore */
|
|
19
|
+
private constructor(props: ClassProperties<MetadataAliasType>) {
|
|
20
|
+
this.name = props.name;
|
|
21
|
+
this.value = props.value;
|
|
22
|
+
this.description = props.description;
|
|
23
|
+
this.jsDocTags = props.jsDocTags;
|
|
24
|
+
this.recursive = props.recursive;
|
|
25
|
+
this.nullables = props.nullables;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** @internal */
|
|
29
|
+
public static create(
|
|
30
|
+
props: ClassProperties<MetadataAliasType>,
|
|
31
|
+
): MetadataAliasType {
|
|
32
|
+
return new MetadataAliasType(props);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** @internal */
|
|
36
|
+
public static _From_without_value(props: Omit<IMetadataAliasType, "value">) {
|
|
37
|
+
return MetadataAliasType.create({
|
|
38
|
+
name: props.name,
|
|
39
|
+
value: null!,
|
|
40
|
+
description: props.description,
|
|
41
|
+
recursive: props.recursive,
|
|
42
|
+
jsDocTags: props.jsDocTags.slice(),
|
|
43
|
+
nullables: props.nullables.slice(),
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public toJSON(): IMetadataAliasType {
|
|
48
|
+
return {
|
|
49
|
+
name: this.name,
|
|
50
|
+
value: this.value.toJSON(),
|
|
51
|
+
description: this.description,
|
|
52
|
+
recursive: this.recursive,
|
|
53
|
+
jsDocTags: this.jsDocTags.slice(),
|
|
54
|
+
nullables: this.nullables.slice(),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import { ClassProperties } from "../../typings/ClassProperties";
|
|
2
|
-
|
|
3
|
-
import { IMetadataApplication } from "./IMetadataApplication";
|
|
4
|
-
import { Metadata } from "./Metadata";
|
|
5
|
-
import { MetadataComponents } from "./MetadataComponents";
|
|
6
|
-
|
|
7
|
-
export class MetadataApplication {
|
|
8
|
-
public readonly metadatas: Metadata[];
|
|
9
|
-
public readonly components: MetadataComponents;
|
|
10
|
-
|
|
11
|
-
/** @ignore */
|
|
12
|
-
private constructor(props: ClassProperties<MetadataApplication>) {
|
|
13
|
-
this.metadatas = props.metadatas;
|
|
14
|
-
this.components = props.components;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/** @internal */
|
|
18
|
-
public static create(
|
|
19
|
-
props: ClassProperties<MetadataApplication>,
|
|
20
|
-
): MetadataApplication {
|
|
21
|
-
return new MetadataApplication(props);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
public static from(app: IMetadataApplication): MetadataApplication {
|
|
25
|
-
const components: MetadataComponents = MetadataComponents.from(
|
|
26
|
-
app.components,
|
|
27
|
-
);
|
|
28
|
-
const metadatas: Metadata[] = app.metadatas.map((metadata) =>
|
|
29
|
-
Metadata.from(metadata, components.dictionary),
|
|
30
|
-
);
|
|
31
|
-
return MetadataApplication.create({ metadatas, components });
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
public toJSON(): IMetadataApplication {
|
|
35
|
-
return {
|
|
36
|
-
metadatas: this.metadatas.map((metadata) => metadata.toJSON()),
|
|
37
|
-
components: this.components.toJSON(),
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
}
|
|
1
|
+
import { ClassProperties } from "../../typings/ClassProperties";
|
|
2
|
+
|
|
3
|
+
import { IMetadataApplication } from "./IMetadataApplication";
|
|
4
|
+
import { Metadata } from "./Metadata";
|
|
5
|
+
import { MetadataComponents } from "./MetadataComponents";
|
|
6
|
+
|
|
7
|
+
export class MetadataApplication {
|
|
8
|
+
public readonly metadatas: Metadata[];
|
|
9
|
+
public readonly components: MetadataComponents;
|
|
10
|
+
|
|
11
|
+
/** @ignore */
|
|
12
|
+
private constructor(props: ClassProperties<MetadataApplication>) {
|
|
13
|
+
this.metadatas = props.metadatas;
|
|
14
|
+
this.components = props.components;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** @internal */
|
|
18
|
+
public static create(
|
|
19
|
+
props: ClassProperties<MetadataApplication>,
|
|
20
|
+
): MetadataApplication {
|
|
21
|
+
return new MetadataApplication(props);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
public static from(app: IMetadataApplication): MetadataApplication {
|
|
25
|
+
const components: MetadataComponents = MetadataComponents.from(
|
|
26
|
+
app.components,
|
|
27
|
+
);
|
|
28
|
+
const metadatas: Metadata[] = app.metadatas.map((metadata) =>
|
|
29
|
+
Metadata.from(metadata, components.dictionary),
|
|
30
|
+
);
|
|
31
|
+
return MetadataApplication.create({ metadatas, components });
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
public toJSON(): IMetadataApplication {
|
|
35
|
+
return {
|
|
36
|
+
metadatas: this.metadatas.map((metadata) => metadata.toJSON()),
|
|
37
|
+
components: this.components.toJSON(),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -1,47 +1,47 @@
|
|
|
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
|
-
/** @ignore */
|
|
14
|
-
private constructor(props: ClassProperties<MetadataArray>) {
|
|
15
|
-
this.type = props.type;
|
|
16
|
-
this.tags = props.tags;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
public static create(props: ClassProperties<MetadataArray>): MetadataArray {
|
|
20
|
-
return new MetadataArray(props);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
public getName(): string {
|
|
24
|
-
return (this.name_ ??= (() => {
|
|
25
|
-
if (this.tags.length === 0) return this.type.name;
|
|
26
|
-
else if (this.tags.length === 1) {
|
|
27
|
-
const str: string = [
|
|
28
|
-
this.type.name,
|
|
29
|
-
...this.tags[0]!.map((t) => t.name),
|
|
30
|
-
].join(" & ");
|
|
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 `(${this.type.name} & (${rows.join(" | ")}))`;
|
|
38
|
-
})());
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
public toJSON(): IMetadataArray {
|
|
42
|
-
return {
|
|
43
|
-
name: this.type.name,
|
|
44
|
-
tags: this.tags.map((row) => row.slice()),
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
}
|
|
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
|
+
/** @ignore */
|
|
14
|
+
private constructor(props: ClassProperties<MetadataArray>) {
|
|
15
|
+
this.type = props.type;
|
|
16
|
+
this.tags = props.tags;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public static create(props: ClassProperties<MetadataArray>): MetadataArray {
|
|
20
|
+
return new MetadataArray(props);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public getName(): string {
|
|
24
|
+
return (this.name_ ??= (() => {
|
|
25
|
+
if (this.tags.length === 0) return this.type.name;
|
|
26
|
+
else if (this.tags.length === 1) {
|
|
27
|
+
const str: string = [
|
|
28
|
+
this.type.name,
|
|
29
|
+
...this.tags[0]!.map((t) => t.name),
|
|
30
|
+
].join(" & ");
|
|
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 `(${this.type.name} & (${rows.join(" | ")}))`;
|
|
38
|
+
})());
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public toJSON(): IMetadataArray {
|
|
42
|
+
return {
|
|
43
|
+
name: this.type.name,
|
|
44
|
+
tags: this.tags.map((row) => row.slice()),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import { ClassProperties } from "../../typings/ClassProperties";
|
|
2
|
-
|
|
3
|
-
import { IMetadataArrayType } from "./IMetadataArrayType";
|
|
4
|
-
import { Metadata } from "./Metadata";
|
|
5
|
-
|
|
6
|
-
export class MetadataArrayType {
|
|
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
|
-
/** @ignore */
|
|
14
|
-
private constructor(props: ClassProperties<MetadataArrayType>) {
|
|
15
|
-
this.name = props.name;
|
|
16
|
-
this.value = props.value;
|
|
17
|
-
this.index = props.index;
|
|
18
|
-
this.recursive = props.recursive;
|
|
19
|
-
this.nullables = props.nullables;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/** @internal */
|
|
23
|
-
public static _From_without_value(
|
|
24
|
-
props: Omit<IMetadataArrayType, "value">,
|
|
25
|
-
): MetadataArrayType {
|
|
26
|
-
return MetadataArrayType.create({
|
|
27
|
-
name: props.name,
|
|
28
|
-
value: null!,
|
|
29
|
-
index: props.index,
|
|
30
|
-
recursive: props.recursive,
|
|
31
|
-
nullables: props.nullables,
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/** @internal */
|
|
36
|
-
public static create(
|
|
37
|
-
props: ClassProperties<MetadataArrayType>,
|
|
38
|
-
): MetadataArrayType {
|
|
39
|
-
return new MetadataArrayType(props);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
public toJSON(): IMetadataArrayType {
|
|
43
|
-
return {
|
|
44
|
-
name: this.name,
|
|
45
|
-
value: this.value.toJSON(),
|
|
46
|
-
nullables: this.nullables,
|
|
47
|
-
recursive: this.recursive,
|
|
48
|
-
index: this.index,
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
}
|
|
1
|
+
import { ClassProperties } from "../../typings/ClassProperties";
|
|
2
|
+
|
|
3
|
+
import { IMetadataArrayType } from "./IMetadataArrayType";
|
|
4
|
+
import { Metadata } from "./Metadata";
|
|
5
|
+
|
|
6
|
+
export class MetadataArrayType {
|
|
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
|
+
/** @ignore */
|
|
14
|
+
private constructor(props: ClassProperties<MetadataArrayType>) {
|
|
15
|
+
this.name = props.name;
|
|
16
|
+
this.value = props.value;
|
|
17
|
+
this.index = props.index;
|
|
18
|
+
this.recursive = props.recursive;
|
|
19
|
+
this.nullables = props.nullables;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** @internal */
|
|
23
|
+
public static _From_without_value(
|
|
24
|
+
props: Omit<IMetadataArrayType, "value">,
|
|
25
|
+
): MetadataArrayType {
|
|
26
|
+
return MetadataArrayType.create({
|
|
27
|
+
name: props.name,
|
|
28
|
+
value: null!,
|
|
29
|
+
index: props.index,
|
|
30
|
+
recursive: props.recursive,
|
|
31
|
+
nullables: props.nullables,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** @internal */
|
|
36
|
+
public static create(
|
|
37
|
+
props: ClassProperties<MetadataArrayType>,
|
|
38
|
+
): MetadataArrayType {
|
|
39
|
+
return new MetadataArrayType(props);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
public toJSON(): IMetadataArrayType {
|
|
43
|
+
return {
|
|
44
|
+
name: this.name,
|
|
45
|
+
value: this.value.toJSON(),
|
|
46
|
+
nullables: this.nullables,
|
|
47
|
+
recursive: this.recursive,
|
|
48
|
+
index: this.index,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -1,85 +1,85 @@
|
|
|
1
|
-
import { ClassProperties } from "../../typings/ClassProperties";
|
|
2
|
-
|
|
3
|
-
import { IMetadataAtomic } from "./IMetadataAtomic";
|
|
4
|
-
import { IMetadataTypeTag } from "./IMetadataTypeTag";
|
|
5
|
-
|
|
6
|
-
export class MetadataAtomic {
|
|
7
|
-
public readonly type: "boolean" | "bigint" | "number" | "string";
|
|
8
|
-
public readonly tags: IMetadataTypeTag[][];
|
|
9
|
-
|
|
10
|
-
private name_?: string;
|
|
11
|
-
|
|
12
|
-
/** @internal */
|
|
13
|
-
private constructor(props: ClassProperties<MetadataAtomic>) {
|
|
14
|
-
this.type = props.type;
|
|
15
|
-
this.tags = props.tags;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
public static create(props: ClassProperties<MetadataAtomic>): MetadataAtomic {
|
|
19
|
-
return new MetadataAtomic(props);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
public static from(json: IMetadataAtomic): MetadataAtomic {
|
|
23
|
-
return MetadataAtomic.create({
|
|
24
|
-
type: json.type,
|
|
25
|
-
tags: json.tags.map((row) =>
|
|
26
|
-
row.map((tag) => ({
|
|
27
|
-
target: tag.target,
|
|
28
|
-
name: tag.name,
|
|
29
|
-
kind: tag.kind,
|
|
30
|
-
value:
|
|
31
|
-
typeof tag.value === "object" &&
|
|
32
|
-
tag.value?.type === "bigint" &&
|
|
33
|
-
typeof tag.value.value === "string"
|
|
34
|
-
? BigInt(tag.value.value)
|
|
35
|
-
: tag.value,
|
|
36
|
-
validate: tag.validate,
|
|
37
|
-
exclusive: tag.exclusive,
|
|
38
|
-
schema: tag.schema,
|
|
39
|
-
})),
|
|
40
|
-
),
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
public getName(): string {
|
|
45
|
-
return (this.name_ ??= getName(this));
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
public toJSON(): IMetadataAtomic {
|
|
49
|
-
return {
|
|
50
|
-
type: this.type,
|
|
51
|
-
tags: this.tags.map((row) =>
|
|
52
|
-
row.map((tag) => ({
|
|
53
|
-
target: tag.target,
|
|
54
|
-
name: tag.name,
|
|
55
|
-
kind: tag.kind,
|
|
56
|
-
value:
|
|
57
|
-
typeof tag.value === "bigint"
|
|
58
|
-
? {
|
|
59
|
-
type: "bigint",
|
|
60
|
-
value: tag.value.toString(),
|
|
61
|
-
}
|
|
62
|
-
: tag.value,
|
|
63
|
-
validate: tag.validate,
|
|
64
|
-
exclusive: tag.exclusive,
|
|
65
|
-
schema: tag.schema,
|
|
66
|
-
})),
|
|
67
|
-
),
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const getName = (obj: MetadataAtomic): string => {
|
|
73
|
-
if (obj.tags.length === 0) return obj.type;
|
|
74
|
-
else if (obj.tags.length === 1) {
|
|
75
|
-
const str: string = [obj.type, ...obj.tags[0]!.map((t) => t.name)].join(
|
|
76
|
-
" & ",
|
|
77
|
-
);
|
|
78
|
-
return `(${str})`;
|
|
79
|
-
}
|
|
80
|
-
const rows: string[] = obj.tags.map((row) => {
|
|
81
|
-
const str: string = row.map((t) => t.name).join(" & ");
|
|
82
|
-
return row.length === 1 ? str : `(${str})`;
|
|
83
|
-
});
|
|
84
|
-
return `(${obj.type} & (${rows.join(" | ")}))`;
|
|
85
|
-
};
|
|
1
|
+
import { ClassProperties } from "../../typings/ClassProperties";
|
|
2
|
+
|
|
3
|
+
import { IMetadataAtomic } from "./IMetadataAtomic";
|
|
4
|
+
import { IMetadataTypeTag } from "./IMetadataTypeTag";
|
|
5
|
+
|
|
6
|
+
export class MetadataAtomic {
|
|
7
|
+
public readonly type: "boolean" | "bigint" | "number" | "string";
|
|
8
|
+
public readonly tags: IMetadataTypeTag[][];
|
|
9
|
+
|
|
10
|
+
private name_?: string;
|
|
11
|
+
|
|
12
|
+
/** @internal */
|
|
13
|
+
private constructor(props: ClassProperties<MetadataAtomic>) {
|
|
14
|
+
this.type = props.type;
|
|
15
|
+
this.tags = props.tags;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
public static create(props: ClassProperties<MetadataAtomic>): MetadataAtomic {
|
|
19
|
+
return new MetadataAtomic(props);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
public static from(json: IMetadataAtomic): MetadataAtomic {
|
|
23
|
+
return MetadataAtomic.create({
|
|
24
|
+
type: json.type,
|
|
25
|
+
tags: json.tags.map((row) =>
|
|
26
|
+
row.map((tag) => ({
|
|
27
|
+
target: tag.target,
|
|
28
|
+
name: tag.name,
|
|
29
|
+
kind: tag.kind,
|
|
30
|
+
value:
|
|
31
|
+
typeof tag.value === "object" &&
|
|
32
|
+
tag.value?.type === "bigint" &&
|
|
33
|
+
typeof tag.value.value === "string"
|
|
34
|
+
? BigInt(tag.value.value)
|
|
35
|
+
: tag.value,
|
|
36
|
+
validate: tag.validate,
|
|
37
|
+
exclusive: tag.exclusive,
|
|
38
|
+
schema: tag.schema,
|
|
39
|
+
})),
|
|
40
|
+
),
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
public getName(): string {
|
|
45
|
+
return (this.name_ ??= getName(this));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public toJSON(): IMetadataAtomic {
|
|
49
|
+
return {
|
|
50
|
+
type: this.type,
|
|
51
|
+
tags: this.tags.map((row) =>
|
|
52
|
+
row.map((tag) => ({
|
|
53
|
+
target: tag.target,
|
|
54
|
+
name: tag.name,
|
|
55
|
+
kind: tag.kind,
|
|
56
|
+
value:
|
|
57
|
+
typeof tag.value === "bigint"
|
|
58
|
+
? {
|
|
59
|
+
type: "bigint",
|
|
60
|
+
value: tag.value.toString(),
|
|
61
|
+
}
|
|
62
|
+
: tag.value,
|
|
63
|
+
validate: tag.validate,
|
|
64
|
+
exclusive: tag.exclusive,
|
|
65
|
+
schema: tag.schema,
|
|
66
|
+
})),
|
|
67
|
+
),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const getName = (obj: MetadataAtomic): string => {
|
|
73
|
+
if (obj.tags.length === 0) return obj.type;
|
|
74
|
+
else if (obj.tags.length === 1) {
|
|
75
|
+
const str: string = [obj.type, ...obj.tags[0]!.map((t) => t.name)].join(
|
|
76
|
+
" & ",
|
|
77
|
+
);
|
|
78
|
+
return `(${str})`;
|
|
79
|
+
}
|
|
80
|
+
const rows: string[] = obj.tags.map((row) => {
|
|
81
|
+
const str: string = row.map((t) => t.name).join(" & ");
|
|
82
|
+
return row.length === 1 ? str : `(${str})`;
|
|
83
|
+
});
|
|
84
|
+
return `(${obj.type} & (${rows.join(" | ")}))`;
|
|
85
|
+
};
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import { ClassProperties } from "../../typings/ClassProperties";
|
|
2
|
-
|
|
3
|
-
import { IMetadataDictionary } from "./IMetadataDictionary";
|
|
4
|
-
import { IMetadataEscaped } from "./IMetadataEscaped";
|
|
5
|
-
import { Metadata } from "./Metadata";
|
|
6
|
-
|
|
7
|
-
export class MetadataEscaped {
|
|
8
|
-
public readonly original: Metadata;
|
|
9
|
-
public readonly returns: Metadata;
|
|
10
|
-
|
|
11
|
-
/** @ignore */
|
|
12
|
-
private constructor(props: ClassProperties<MetadataEscaped>) {
|
|
13
|
-
this.original = props.original;
|
|
14
|
-
this.returns = props.returns;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/** @internal */
|
|
18
|
-
public static from(
|
|
19
|
-
props: IMetadataEscaped,
|
|
20
|
-
dict: IMetadataDictionary,
|
|
21
|
-
): MetadataEscaped {
|
|
22
|
-
return MetadataEscaped.create({
|
|
23
|
-
original: Metadata.from(props.original, dict),
|
|
24
|
-
returns: Metadata.from(props.returns, dict),
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/** @internal */
|
|
29
|
-
public static create(
|
|
30
|
-
props: ClassProperties<MetadataEscaped>,
|
|
31
|
-
): MetadataEscaped {
|
|
32
|
-
return new MetadataEscaped(props);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
public getName(): string {
|
|
36
|
-
return this.returns.getName();
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
public toJSON(): IMetadataEscaped {
|
|
40
|
-
return {
|
|
41
|
-
original: this.original.toJSON(),
|
|
42
|
-
returns: this.returns.toJSON(),
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
}
|
|
1
|
+
import { ClassProperties } from "../../typings/ClassProperties";
|
|
2
|
+
|
|
3
|
+
import { IMetadataDictionary } from "./IMetadataDictionary";
|
|
4
|
+
import { IMetadataEscaped } from "./IMetadataEscaped";
|
|
5
|
+
import { Metadata } from "./Metadata";
|
|
6
|
+
|
|
7
|
+
export class MetadataEscaped {
|
|
8
|
+
public readonly original: Metadata;
|
|
9
|
+
public readonly returns: Metadata;
|
|
10
|
+
|
|
11
|
+
/** @ignore */
|
|
12
|
+
private constructor(props: ClassProperties<MetadataEscaped>) {
|
|
13
|
+
this.original = props.original;
|
|
14
|
+
this.returns = props.returns;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** @internal */
|
|
18
|
+
public static from(
|
|
19
|
+
props: IMetadataEscaped,
|
|
20
|
+
dict: IMetadataDictionary,
|
|
21
|
+
): MetadataEscaped {
|
|
22
|
+
return MetadataEscaped.create({
|
|
23
|
+
original: Metadata.from(props.original, dict),
|
|
24
|
+
returns: Metadata.from(props.returns, dict),
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** @internal */
|
|
29
|
+
public static create(
|
|
30
|
+
props: ClassProperties<MetadataEscaped>,
|
|
31
|
+
): MetadataEscaped {
|
|
32
|
+
return new MetadataEscaped(props);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public getName(): string {
|
|
36
|
+
return this.returns.getName();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
public toJSON(): IMetadataEscaped {
|
|
40
|
+
return {
|
|
41
|
+
original: this.original.toJSON(),
|
|
42
|
+
returns: this.returns.toJSON(),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}
|