typia 7.6.0-dev.20241229 → 7.7.0-dev.20250130
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/TypeGuardError.mjs +26 -0
- package/lib/TypeGuardError.mjs.map +1 -0
- package/lib/executable/setup/PluginConfigurator.js +3 -3
- package/lib/executable/typia.js +15 -15
- package/lib/functional.mjs +120 -0
- package/lib/functional.mjs.map +1 -0
- package/lib/http.d.ts +15 -15
- package/lib/http.mjs +165 -0
- package/lib/http.mjs.map +1 -0
- package/lib/index.mjs +27 -1142
- package/lib/index.mjs.map +1 -1
- package/lib/json.mjs +105 -0
- package/lib/json.mjs.map +1 -0
- package/lib/llm.mjs +33 -0
- package/lib/llm.mjs.map +1 -0
- package/lib/misc.mjs +111 -0
- package/lib/misc.mjs.map +1 -0
- package/lib/module.d.ts +4 -4
- package/lib/module.mjs +139 -0
- package/lib/module.mjs.map +1 -0
- package/lib/notations.mjs +153 -0
- package/lib/notations.mjs.map +1 -0
- package/lib/programmers/json/JsonApplicationProgrammer.d.ts +12 -0
- package/lib/programmers/json/JsonApplicationProgrammer.js +22 -22
- package/lib/programmers/json/JsonApplicationProgrammer.js.map +1 -1
- package/lib/programmers/llm/LlmApplicationOfValidateProgrammer.js +15 -7
- package/lib/programmers/llm/LlmApplicationOfValidateProgrammer.js.map +1 -1
- package/lib/programmers/llm/LlmApplicationProgrammer.js +39 -15
- package/lib/programmers/llm/LlmApplicationProgrammer.js.map +1 -1
- package/lib/protobuf.d.ts +9 -9
- package/lib/protobuf.mjs +111 -0
- package/lib/protobuf.mjs.map +1 -0
- package/lib/reflect.mjs +18 -0
- package/lib/reflect.mjs.map +1 -0
- package/lib/schemas/llm/ILlmApplicationOfValidate.mjs +6 -0
- package/lib/schemas/llm/ILlmApplicationOfValidate.mjs.map +1 -0
- package/lib/schemas/llm/ILlmFunctionOfValidate.mjs +6 -0
- package/lib/schemas/llm/ILlmFunctionOfValidate.mjs.map +1 -0
- package/lib/tags/TagBase.d.ts +1 -1
- package/lib/tags/Type.d.ts +0 -1
- package/lib/tags/index.mjs +2 -0
- package/lib/tags/index.mjs.map +1 -0
- package/package.json +10 -8
- package/src/AssertionGuard.ts +1 -1
- package/src/CamelCase.ts +75 -75
- package/src/PascalCase.ts +71 -71
- package/src/Primitive.ts +92 -92
- package/src/Resolved.ts +74 -74
- package/src/SnakeCase.ts +126 -126
- package/src/TypeGuardError.ts +37 -37
- package/src/executable/setup/CommandExecutor.ts +8 -8
- package/src/executable/setup/PluginConfigurator.ts +69 -69
- package/src/executable/typia.ts +55 -55
- package/src/factories/CommentFactory.ts +79 -79
- package/src/factories/ValueFactory.ts +12 -12
- package/src/factories/internal/metadata/emend_metadata_atomics.ts +45 -45
- package/src/http.ts +15 -15
- package/src/index.ts +4 -4
- package/src/module.ts +4 -4
- package/src/programmers/helpers/ICheckEntry.ts +13 -13
- package/src/programmers/helpers/IExpressionEntry.ts +12 -12
- package/src/programmers/helpers/ProtobufWire.ts +34 -34
- package/src/programmers/internal/stringify_native.ts +7 -7
- package/src/programmers/json/JsonApplicationProgrammer.ts +27 -27
- package/src/programmers/llm/LlmApplicationOfValidateProgrammer.ts +16 -2
- package/src/programmers/llm/LlmApplicationProgrammer.ts +50 -12
- package/src/protobuf.ts +9 -9
- package/src/schemas/metadata/IJsDocTagInfo.ts +10 -10
- package/src/schemas/metadata/IMetadataArrayType.ts +10 -10
- package/src/schemas/metadata/IMetadataAtomic.ts +6 -6
- package/src/schemas/metadata/IMetadataConstant.ts +18 -18
- package/src/schemas/metadata/IMetadataEscaped.ts +6 -6
- package/src/schemas/metadata/IMetadataFunction.ts +8 -8
- package/src/schemas/metadata/IMetadataParameter.ts +9 -9
- package/src/schemas/metadata/IMetadataProperty.ts +9 -9
- package/src/schemas/metadata/IMetadataTupleType.ts +10 -10
- package/src/schemas/metadata/MetadataArrayType.ts +57 -57
- package/src/schemas/metadata/MetadataConstant.ts +34 -34
- package/src/schemas/metadata/MetadataEscaped.ts +51 -51
- package/src/schemas/metadata/MetadataFunction.ts +49 -49
- package/src/schemas/metadata/MetadataTupleType.ts +67 -67
- package/src/tags/Constant.ts +15 -15
- package/src/tags/ContentMediaType.ts +10 -10
- package/src/tags/Default.ts +22 -22
- package/src/tags/ExclusiveMaximum.ts +25 -25
- package/src/tags/ExclusiveMinimum.ts +25 -25
- package/src/tags/MaxItems.ts +12 -12
- package/src/tags/MaxLength.ts +12 -12
- package/src/tags/Maximum.ts +19 -19
- package/src/tags/MinItems.ts +12 -12
- package/src/tags/MinLength.ts +12 -12
- package/src/tags/Minimum.ts +19 -19
- package/src/tags/MultipleOf.ts +21 -21
- package/src/tags/Pattern.ts +31 -31
- package/src/tags/TagBase.ts +1 -1
- package/src/tags/Type.ts +0 -1
- package/src/tags/internal/FormatCheatSheet.ts +73 -73
- package/src/typings/Atomic.ts +13 -13
- package/src/typings/ClassProperties.ts +5 -5
- package/src/typings/Customizable.ts +5 -5
- package/src/typings/Equal.ts +18 -18
- package/src/typings/IsTuple.ts +9 -9
- package/src/typings/NativeClass.ts +23 -23
- package/src/typings/OmitNever.ts +3 -3
- package/src/typings/ProtobufAtomic.ts +19 -19
- package/src/typings/SpecialFields.ts +3 -3
- package/src/typings/ValidationPipe.ts +9 -9
- package/src/typings/ValueOf.ts +20 -20
- package/src/typings/Writable.ts +11 -11
- package/src/utils/ArrayUtil.ts +41 -41
- package/src/utils/Escaper.ts +50 -50
- package/src/utils/PatternUtil.ts +29 -29
- package/src/utils/Singleton.ts +16 -16
|
@@ -1,51 +1,51 @@
|
|
|
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
|
-
/**
|
|
12
|
-
* @hidden
|
|
13
|
-
*/
|
|
14
|
-
private constructor(props: ClassProperties<MetadataEscaped>) {
|
|
15
|
-
this.original = props.original;
|
|
16
|
-
this.returns = props.returns;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* @internal
|
|
21
|
-
*/
|
|
22
|
-
public static from(
|
|
23
|
-
props: IMetadataEscaped,
|
|
24
|
-
dict: IMetadataDictionary,
|
|
25
|
-
): MetadataEscaped {
|
|
26
|
-
return MetadataEscaped.create({
|
|
27
|
-
original: Metadata.from(props.original, dict),
|
|
28
|
-
returns: Metadata.from(props.returns, dict),
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* @internal
|
|
34
|
-
*/
|
|
35
|
-
public static create(
|
|
36
|
-
props: ClassProperties<MetadataEscaped>,
|
|
37
|
-
): MetadataEscaped {
|
|
38
|
-
return new MetadataEscaped(props);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
public getName(): string {
|
|
42
|
-
return this.returns.getName();
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
public toJSON(): IMetadataEscaped {
|
|
46
|
-
return {
|
|
47
|
-
original: this.original.toJSON(),
|
|
48
|
-
returns: this.returns.toJSON(),
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
}
|
|
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
|
+
/**
|
|
12
|
+
* @hidden
|
|
13
|
+
*/
|
|
14
|
+
private constructor(props: ClassProperties<MetadataEscaped>) {
|
|
15
|
+
this.original = props.original;
|
|
16
|
+
this.returns = props.returns;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
public static from(
|
|
23
|
+
props: IMetadataEscaped,
|
|
24
|
+
dict: IMetadataDictionary,
|
|
25
|
+
): MetadataEscaped {
|
|
26
|
+
return MetadataEscaped.create({
|
|
27
|
+
original: Metadata.from(props.original, dict),
|
|
28
|
+
returns: Metadata.from(props.returns, dict),
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @internal
|
|
34
|
+
*/
|
|
35
|
+
public static create(
|
|
36
|
+
props: ClassProperties<MetadataEscaped>,
|
|
37
|
+
): MetadataEscaped {
|
|
38
|
+
return new MetadataEscaped(props);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public getName(): string {
|
|
42
|
+
return this.returns.getName();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
public toJSON(): IMetadataEscaped {
|
|
46
|
+
return {
|
|
47
|
+
original: this.original.toJSON(),
|
|
48
|
+
returns: this.returns.toJSON(),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
import { ClassProperties } from "../../typings/ClassProperties";
|
|
2
|
-
|
|
3
|
-
import { IMetadataDictionary } from "./IMetadataDictionary";
|
|
4
|
-
import { IMetadataFunction } from "./IMetadataFunction";
|
|
5
|
-
import { Metadata } from "./Metadata";
|
|
6
|
-
import { MetadataParameter } from "./MetadataParameter";
|
|
7
|
-
|
|
8
|
-
export class MetadataFunction {
|
|
9
|
-
public parameters: MetadataParameter[];
|
|
10
|
-
public output: Metadata;
|
|
11
|
-
public async: boolean;
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* @hidden
|
|
15
|
-
*/
|
|
16
|
-
private constructor(props: ClassProperties<MetadataFunction>) {
|
|
17
|
-
this.parameters = props.parameters;
|
|
18
|
-
this.output = props.output;
|
|
19
|
-
this.async = props.async;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* @internal
|
|
24
|
-
*/
|
|
25
|
-
public static create(
|
|
26
|
-
props: ClassProperties<MetadataFunction>,
|
|
27
|
-
): MetadataFunction {
|
|
28
|
-
return new MetadataFunction(props);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
public static from(
|
|
32
|
-
json: IMetadataFunction,
|
|
33
|
-
dict: IMetadataDictionary,
|
|
34
|
-
): MetadataFunction {
|
|
35
|
-
return MetadataFunction.create({
|
|
36
|
-
parameters: json.parameters.map((p) => MetadataParameter.from(p, dict)),
|
|
37
|
-
output: Metadata.from(json.output, dict),
|
|
38
|
-
async: json.async,
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
public toJSON(): IMetadataFunction {
|
|
43
|
-
return {
|
|
44
|
-
parameters: this.parameters.map((p) => p.toJSON()),
|
|
45
|
-
output: this.output.toJSON(),
|
|
46
|
-
async: this.async,
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
}
|
|
1
|
+
import { ClassProperties } from "../../typings/ClassProperties";
|
|
2
|
+
|
|
3
|
+
import { IMetadataDictionary } from "./IMetadataDictionary";
|
|
4
|
+
import { IMetadataFunction } from "./IMetadataFunction";
|
|
5
|
+
import { Metadata } from "./Metadata";
|
|
6
|
+
import { MetadataParameter } from "./MetadataParameter";
|
|
7
|
+
|
|
8
|
+
export class MetadataFunction {
|
|
9
|
+
public parameters: MetadataParameter[];
|
|
10
|
+
public output: Metadata;
|
|
11
|
+
public async: boolean;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @hidden
|
|
15
|
+
*/
|
|
16
|
+
private constructor(props: ClassProperties<MetadataFunction>) {
|
|
17
|
+
this.parameters = props.parameters;
|
|
18
|
+
this.output = props.output;
|
|
19
|
+
this.async = props.async;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
public static create(
|
|
26
|
+
props: ClassProperties<MetadataFunction>,
|
|
27
|
+
): MetadataFunction {
|
|
28
|
+
return new MetadataFunction(props);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
public static from(
|
|
32
|
+
json: IMetadataFunction,
|
|
33
|
+
dict: IMetadataDictionary,
|
|
34
|
+
): MetadataFunction {
|
|
35
|
+
return MetadataFunction.create({
|
|
36
|
+
parameters: json.parameters.map((p) => MetadataParameter.from(p, dict)),
|
|
37
|
+
output: Metadata.from(json.output, dict),
|
|
38
|
+
async: json.async,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
public toJSON(): IMetadataFunction {
|
|
43
|
+
return {
|
|
44
|
+
parameters: this.parameters.map((p) => p.toJSON()),
|
|
45
|
+
output: this.output.toJSON(),
|
|
46
|
+
async: this.async,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
import { ClassProperties } from "../../typings/ClassProperties";
|
|
2
|
-
|
|
3
|
-
import { IMetadataTupleType } from "./IMetadataTupleType";
|
|
4
|
-
import { Metadata } from "./Metadata";
|
|
5
|
-
|
|
6
|
-
export class MetadataTupleType {
|
|
7
|
-
public readonly name: string;
|
|
8
|
-
public readonly elements: Metadata[];
|
|
9
|
-
|
|
10
|
-
public readonly index: number | null;
|
|
11
|
-
public readonly recursive: boolean;
|
|
12
|
-
public readonly nullables: boolean[];
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @internal
|
|
16
|
-
*/
|
|
17
|
-
public of_map?: boolean;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* @internal
|
|
21
|
-
*/
|
|
22
|
-
private constructor(props: ClassProperties<MetadataTupleType>) {
|
|
23
|
-
this.name = props.name;
|
|
24
|
-
this.elements = props.elements;
|
|
25
|
-
this.index = props.index;
|
|
26
|
-
this.recursive = props.recursive;
|
|
27
|
-
this.nullables = props.nullables;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* @internal
|
|
32
|
-
*/
|
|
33
|
-
public static _From_without_elements(
|
|
34
|
-
props: Omit<IMetadataTupleType, "elements">,
|
|
35
|
-
): MetadataTupleType {
|
|
36
|
-
return MetadataTupleType.create({
|
|
37
|
-
name: props.name,
|
|
38
|
-
index: props.index,
|
|
39
|
-
elements: null!,
|
|
40
|
-
recursive: props.recursive,
|
|
41
|
-
nullables: props.nullables.slice(),
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
public static create(
|
|
46
|
-
props: ClassProperties<MetadataTupleType>,
|
|
47
|
-
): MetadataTupleType {
|
|
48
|
-
return new MetadataTupleType(props);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
public isRest(): boolean {
|
|
52
|
-
return (
|
|
53
|
-
this.elements.length > 0 &&
|
|
54
|
-
this.elements[this.elements.length - 1]!.rest !== null
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
public toJSON(): IMetadataTupleType {
|
|
59
|
-
return {
|
|
60
|
-
name: this.name,
|
|
61
|
-
index: this.index,
|
|
62
|
-
elements: this.elements.map((elem) => elem.toJSON()),
|
|
63
|
-
recursive: this.recursive,
|
|
64
|
-
nullables: this.nullables.slice(),
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
}
|
|
1
|
+
import { ClassProperties } from "../../typings/ClassProperties";
|
|
2
|
+
|
|
3
|
+
import { IMetadataTupleType } from "./IMetadataTupleType";
|
|
4
|
+
import { Metadata } from "./Metadata";
|
|
5
|
+
|
|
6
|
+
export class MetadataTupleType {
|
|
7
|
+
public readonly name: string;
|
|
8
|
+
public readonly elements: Metadata[];
|
|
9
|
+
|
|
10
|
+
public readonly index: number | null;
|
|
11
|
+
public readonly recursive: boolean;
|
|
12
|
+
public readonly nullables: boolean[];
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
public of_map?: boolean;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
private constructor(props: ClassProperties<MetadataTupleType>) {
|
|
23
|
+
this.name = props.name;
|
|
24
|
+
this.elements = props.elements;
|
|
25
|
+
this.index = props.index;
|
|
26
|
+
this.recursive = props.recursive;
|
|
27
|
+
this.nullables = props.nullables;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
33
|
+
public static _From_without_elements(
|
|
34
|
+
props: Omit<IMetadataTupleType, "elements">,
|
|
35
|
+
): MetadataTupleType {
|
|
36
|
+
return MetadataTupleType.create({
|
|
37
|
+
name: props.name,
|
|
38
|
+
index: props.index,
|
|
39
|
+
elements: null!,
|
|
40
|
+
recursive: props.recursive,
|
|
41
|
+
nullables: props.nullables.slice(),
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
public static create(
|
|
46
|
+
props: ClassProperties<MetadataTupleType>,
|
|
47
|
+
): MetadataTupleType {
|
|
48
|
+
return new MetadataTupleType(props);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public isRest(): boolean {
|
|
52
|
+
return (
|
|
53
|
+
this.elements.length > 0 &&
|
|
54
|
+
this.elements[this.elements.length - 1]!.rest !== null
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
public toJSON(): IMetadataTupleType {
|
|
59
|
+
return {
|
|
60
|
+
name: this.name,
|
|
61
|
+
index: this.index,
|
|
62
|
+
elements: this.elements.map((elem) => elem.toJSON()),
|
|
63
|
+
recursive: this.recursive,
|
|
64
|
+
nullables: this.nullables.slice(),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
}
|
package/src/tags/Constant.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { TagBase } from "./TagBase";
|
|
2
|
-
|
|
3
|
-
export type Constant<
|
|
4
|
-
Value extends boolean | number | string | bigint,
|
|
5
|
-
Content extends {
|
|
6
|
-
title?: string | undefined;
|
|
7
|
-
description?: string | undefined;
|
|
8
|
-
},
|
|
9
|
-
> = Value &
|
|
10
|
-
TagBase<{
|
|
11
|
-
target: "string" | "boolean" | "number" | "bigint";
|
|
12
|
-
kind: "constant";
|
|
13
|
-
value: undefined;
|
|
14
|
-
schema: Content;
|
|
15
|
-
}>;
|
|
1
|
+
import { TagBase } from "./TagBase";
|
|
2
|
+
|
|
3
|
+
export type Constant<
|
|
4
|
+
Value extends boolean | number | string | bigint,
|
|
5
|
+
Content extends {
|
|
6
|
+
title?: string | undefined;
|
|
7
|
+
description?: string | undefined;
|
|
8
|
+
},
|
|
9
|
+
> = Value &
|
|
10
|
+
TagBase<{
|
|
11
|
+
target: "string" | "boolean" | "number" | "bigint";
|
|
12
|
+
kind: "constant";
|
|
13
|
+
value: undefined;
|
|
14
|
+
schema: Content;
|
|
15
|
+
}>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { TagBase } from "./TagBase";
|
|
2
|
-
|
|
3
|
-
export type ContentMediaType<Value extends string> = TagBase<{
|
|
4
|
-
target: "string";
|
|
5
|
-
kind: "contentMediaType";
|
|
6
|
-
value: undefined;
|
|
7
|
-
schema: {
|
|
8
|
-
contentMediaType: Value;
|
|
9
|
-
};
|
|
10
|
-
}>;
|
|
1
|
+
import { TagBase } from "./TagBase";
|
|
2
|
+
|
|
3
|
+
export type ContentMediaType<Value extends string> = TagBase<{
|
|
4
|
+
target: "string";
|
|
5
|
+
kind: "contentMediaType";
|
|
6
|
+
value: undefined;
|
|
7
|
+
schema: {
|
|
8
|
+
contentMediaType: Value;
|
|
9
|
+
};
|
|
10
|
+
}>;
|
package/src/tags/Default.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { TagBase } from "./TagBase";
|
|
2
|
-
|
|
3
|
-
export type Default<Value extends boolean | bigint | number | string> =
|
|
4
|
-
TagBase<{
|
|
5
|
-
target: Value extends boolean
|
|
6
|
-
? "boolean"
|
|
7
|
-
: Value extends bigint
|
|
8
|
-
? "bigint"
|
|
9
|
-
: Value extends number
|
|
10
|
-
? "number"
|
|
11
|
-
: "string";
|
|
12
|
-
kind: "default";
|
|
13
|
-
value: Value;
|
|
14
|
-
exclusive: true;
|
|
15
|
-
schema: Value extends bigint
|
|
16
|
-
? { default: Numeric<Value> }
|
|
17
|
-
: { default: Value };
|
|
18
|
-
}>;
|
|
19
|
-
|
|
20
|
-
type Numeric<T extends bigint> = `${T}` extends `${infer N extends number}`
|
|
21
|
-
? N
|
|
22
|
-
: never;
|
|
1
|
+
import { TagBase } from "./TagBase";
|
|
2
|
+
|
|
3
|
+
export type Default<Value extends boolean | bigint | number | string> =
|
|
4
|
+
TagBase<{
|
|
5
|
+
target: Value extends boolean
|
|
6
|
+
? "boolean"
|
|
7
|
+
: Value extends bigint
|
|
8
|
+
? "bigint"
|
|
9
|
+
: Value extends number
|
|
10
|
+
? "number"
|
|
11
|
+
: "string";
|
|
12
|
+
kind: "default";
|
|
13
|
+
value: Value;
|
|
14
|
+
exclusive: true;
|
|
15
|
+
schema: Value extends bigint
|
|
16
|
+
? { default: Numeric<Value> }
|
|
17
|
+
: { default: Value };
|
|
18
|
+
}>;
|
|
19
|
+
|
|
20
|
+
type Numeric<T extends bigint> = `${T}` extends `${infer N extends number}`
|
|
21
|
+
? N
|
|
22
|
+
: never;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { TagBase } from "./TagBase";
|
|
2
|
-
|
|
3
|
-
export type ExclusiveMaximum<Value extends number | bigint> = TagBase<{
|
|
4
|
-
target: Value extends bigint ? "bigint" : "number";
|
|
5
|
-
kind: "exclusiveMaximum";
|
|
6
|
-
value: Value;
|
|
7
|
-
validate: `$input < ${Cast<Value>}`;
|
|
8
|
-
exclusive: ["exclusiveMaximum", "maximum"];
|
|
9
|
-
schema: Value extends bigint
|
|
10
|
-
? {
|
|
11
|
-
exclusiveMaximum: true;
|
|
12
|
-
maximum: Numeric<Value>;
|
|
13
|
-
}
|
|
14
|
-
: {
|
|
15
|
-
exclusiveMaximum: true;
|
|
16
|
-
maximum: Value;
|
|
17
|
-
};
|
|
18
|
-
}>;
|
|
19
|
-
|
|
20
|
-
type Cast<Value extends number | bigint> = Value extends number
|
|
21
|
-
? Value
|
|
22
|
-
: `BigInt(${Value})`;
|
|
23
|
-
type Numeric<T extends bigint> = `${T}` extends `${infer N extends number}`
|
|
24
|
-
? N
|
|
25
|
-
: never;
|
|
1
|
+
import { TagBase } from "./TagBase";
|
|
2
|
+
|
|
3
|
+
export type ExclusiveMaximum<Value extends number | bigint> = TagBase<{
|
|
4
|
+
target: Value extends bigint ? "bigint" : "number";
|
|
5
|
+
kind: "exclusiveMaximum";
|
|
6
|
+
value: Value;
|
|
7
|
+
validate: `$input < ${Cast<Value>}`;
|
|
8
|
+
exclusive: ["exclusiveMaximum", "maximum"];
|
|
9
|
+
schema: Value extends bigint
|
|
10
|
+
? {
|
|
11
|
+
exclusiveMaximum: true;
|
|
12
|
+
maximum: Numeric<Value>;
|
|
13
|
+
}
|
|
14
|
+
: {
|
|
15
|
+
exclusiveMaximum: true;
|
|
16
|
+
maximum: Value;
|
|
17
|
+
};
|
|
18
|
+
}>;
|
|
19
|
+
|
|
20
|
+
type Cast<Value extends number | bigint> = Value extends number
|
|
21
|
+
? Value
|
|
22
|
+
: `BigInt(${Value})`;
|
|
23
|
+
type Numeric<T extends bigint> = `${T}` extends `${infer N extends number}`
|
|
24
|
+
? N
|
|
25
|
+
: never;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { TagBase } from "./TagBase";
|
|
2
|
-
|
|
3
|
-
export type ExclusiveMinimum<Value extends number | bigint> = TagBase<{
|
|
4
|
-
target: Value extends bigint ? "bigint" : "number";
|
|
5
|
-
kind: "exclusiveMinimum";
|
|
6
|
-
value: Value;
|
|
7
|
-
validate: `${Cast<Value>} < $input`;
|
|
8
|
-
exclusive: ["exclusiveMinimum", "minimum"];
|
|
9
|
-
schema: Value extends bigint
|
|
10
|
-
? {
|
|
11
|
-
exclusiveMinimum: true;
|
|
12
|
-
minimum: Numeric<Value>;
|
|
13
|
-
}
|
|
14
|
-
: {
|
|
15
|
-
exclusiveMinimum: true;
|
|
16
|
-
minimum: Value;
|
|
17
|
-
};
|
|
18
|
-
}>;
|
|
19
|
-
|
|
20
|
-
type Cast<Value extends number | bigint> = Value extends number
|
|
21
|
-
? Value
|
|
22
|
-
: `BigInt(${Value})`;
|
|
23
|
-
type Numeric<T extends bigint> = `${T}` extends `${infer N extends number}`
|
|
24
|
-
? N
|
|
25
|
-
: never;
|
|
1
|
+
import { TagBase } from "./TagBase";
|
|
2
|
+
|
|
3
|
+
export type ExclusiveMinimum<Value extends number | bigint> = TagBase<{
|
|
4
|
+
target: Value extends bigint ? "bigint" : "number";
|
|
5
|
+
kind: "exclusiveMinimum";
|
|
6
|
+
value: Value;
|
|
7
|
+
validate: `${Cast<Value>} < $input`;
|
|
8
|
+
exclusive: ["exclusiveMinimum", "minimum"];
|
|
9
|
+
schema: Value extends bigint
|
|
10
|
+
? {
|
|
11
|
+
exclusiveMinimum: true;
|
|
12
|
+
minimum: Numeric<Value>;
|
|
13
|
+
}
|
|
14
|
+
: {
|
|
15
|
+
exclusiveMinimum: true;
|
|
16
|
+
minimum: Value;
|
|
17
|
+
};
|
|
18
|
+
}>;
|
|
19
|
+
|
|
20
|
+
type Cast<Value extends number | bigint> = Value extends number
|
|
21
|
+
? Value
|
|
22
|
+
: `BigInt(${Value})`;
|
|
23
|
+
type Numeric<T extends bigint> = `${T}` extends `${infer N extends number}`
|
|
24
|
+
? N
|
|
25
|
+
: never;
|
package/src/tags/MaxItems.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { TagBase } from "./TagBase";
|
|
2
|
-
|
|
3
|
-
export type MaxItems<Value extends number> = TagBase<{
|
|
4
|
-
target: "array";
|
|
5
|
-
kind: "maxItems";
|
|
6
|
-
value: Value;
|
|
7
|
-
validate: `$input.length <= ${Value}`;
|
|
8
|
-
exclusive: true;
|
|
9
|
-
schema: {
|
|
10
|
-
maxItems: Value;
|
|
11
|
-
};
|
|
12
|
-
}>;
|
|
1
|
+
import { TagBase } from "./TagBase";
|
|
2
|
+
|
|
3
|
+
export type MaxItems<Value extends number> = TagBase<{
|
|
4
|
+
target: "array";
|
|
5
|
+
kind: "maxItems";
|
|
6
|
+
value: Value;
|
|
7
|
+
validate: `$input.length <= ${Value}`;
|
|
8
|
+
exclusive: true;
|
|
9
|
+
schema: {
|
|
10
|
+
maxItems: Value;
|
|
11
|
+
};
|
|
12
|
+
}>;
|
package/src/tags/MaxLength.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { TagBase } from "./TagBase";
|
|
2
|
-
|
|
3
|
-
export type MaxLength<Value extends number> = TagBase<{
|
|
4
|
-
target: "string";
|
|
5
|
-
kind: "maxLength";
|
|
6
|
-
value: Value;
|
|
7
|
-
validate: `$input.length <= ${Value}`;
|
|
8
|
-
exclusive: true;
|
|
9
|
-
schema: {
|
|
10
|
-
maxLength: Value;
|
|
11
|
-
};
|
|
12
|
-
}>;
|
|
1
|
+
import { TagBase } from "./TagBase";
|
|
2
|
+
|
|
3
|
+
export type MaxLength<Value extends number> = TagBase<{
|
|
4
|
+
target: "string";
|
|
5
|
+
kind: "maxLength";
|
|
6
|
+
value: Value;
|
|
7
|
+
validate: `$input.length <= ${Value}`;
|
|
8
|
+
exclusive: true;
|
|
9
|
+
schema: {
|
|
10
|
+
maxLength: Value;
|
|
11
|
+
};
|
|
12
|
+
}>;
|
package/src/tags/Maximum.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { TagBase } from "./TagBase";
|
|
2
|
-
|
|
3
|
-
export type Maximum<Value extends number | bigint> = TagBase<{
|
|
4
|
-
target: Value extends bigint ? "bigint" : "number";
|
|
5
|
-
kind: "maximum";
|
|
6
|
-
value: Value;
|
|
7
|
-
validate: `$input <= ${Cast<Value>}`;
|
|
8
|
-
exclusive: ["maximum", "exclusiveMaximum"];
|
|
9
|
-
schema: Value extends bigint
|
|
10
|
-
? { maximum: Numeric<Value> }
|
|
11
|
-
: { maximum: Value };
|
|
12
|
-
}>;
|
|
13
|
-
|
|
14
|
-
type Cast<Value extends number | bigint> = Value extends number
|
|
15
|
-
? Value
|
|
16
|
-
: `BigInt(${Value})`;
|
|
17
|
-
type Numeric<T extends bigint> = `${T}` extends `${infer N extends number}`
|
|
18
|
-
? N
|
|
19
|
-
: never;
|
|
1
|
+
import { TagBase } from "./TagBase";
|
|
2
|
+
|
|
3
|
+
export type Maximum<Value extends number | bigint> = TagBase<{
|
|
4
|
+
target: Value extends bigint ? "bigint" : "number";
|
|
5
|
+
kind: "maximum";
|
|
6
|
+
value: Value;
|
|
7
|
+
validate: `$input <= ${Cast<Value>}`;
|
|
8
|
+
exclusive: ["maximum", "exclusiveMaximum"];
|
|
9
|
+
schema: Value extends bigint
|
|
10
|
+
? { maximum: Numeric<Value> }
|
|
11
|
+
: { maximum: Value };
|
|
12
|
+
}>;
|
|
13
|
+
|
|
14
|
+
type Cast<Value extends number | bigint> = Value extends number
|
|
15
|
+
? Value
|
|
16
|
+
: `BigInt(${Value})`;
|
|
17
|
+
type Numeric<T extends bigint> = `${T}` extends `${infer N extends number}`
|
|
18
|
+
? N
|
|
19
|
+
: never;
|
package/src/tags/MinItems.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { TagBase } from "./TagBase";
|
|
2
|
-
|
|
3
|
-
export type MinItems<Value extends number> = TagBase<{
|
|
4
|
-
target: "array";
|
|
5
|
-
kind: "minItems";
|
|
6
|
-
value: Value;
|
|
7
|
-
validate: `${Value} <= $input.length`;
|
|
8
|
-
exclusive: true;
|
|
9
|
-
schema: {
|
|
10
|
-
minItems: Value;
|
|
11
|
-
};
|
|
12
|
-
}>;
|
|
1
|
+
import { TagBase } from "./TagBase";
|
|
2
|
+
|
|
3
|
+
export type MinItems<Value extends number> = TagBase<{
|
|
4
|
+
target: "array";
|
|
5
|
+
kind: "minItems";
|
|
6
|
+
value: Value;
|
|
7
|
+
validate: `${Value} <= $input.length`;
|
|
8
|
+
exclusive: true;
|
|
9
|
+
schema: {
|
|
10
|
+
minItems: Value;
|
|
11
|
+
};
|
|
12
|
+
}>;
|