@nmtjs/type 0.6.5 → 0.7.1
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/dist/index.js +34 -31
- package/dist/index.js.map +1 -1
- package/dist/temporal.js +0 -1
- package/dist/temporal.js.map +1 -1
- package/dist/types/any.js +4 -4
- package/dist/types/any.js.map +1 -1
- package/dist/types/array.js +21 -23
- package/dist/types/array.js.map +1 -1
- package/dist/types/base.js +65 -66
- package/dist/types/base.js.map +1 -1
- package/dist/types/boolean.js +4 -4
- package/dist/types/boolean.js.map +1 -1
- package/dist/types/custom.js +9 -8
- package/dist/types/custom.js.map +1 -1
- package/dist/types/date.js +8 -13
- package/dist/types/date.js.map +1 -1
- package/dist/types/enum.js +7 -16
- package/dist/types/enum.js.map +1 -1
- package/dist/types/literal.js +7 -6
- package/dist/types/literal.js.map +1 -1
- package/dist/types/never.js +4 -4
- package/dist/types/never.js.map +1 -1
- package/dist/types/number.js +39 -92
- package/dist/types/number.js.map +1 -1
- package/dist/types/object.js +42 -31
- package/dist/types/object.js.map +1 -1
- package/dist/types/string.js +49 -47
- package/dist/types/string.js.map +1 -1
- package/dist/types/temporal.js +75 -41
- package/dist/types/temporal.js.map +1 -1
- package/dist/types/union.js +26 -18
- package/dist/types/union.js.map +1 -1
- package/package.json +7 -19
- package/src/index.ts +22 -24
- package/src/temporal.ts +1 -1
- package/src/types/any.ts +5 -3
- package/src/types/array.ts +37 -22
- package/src/types/base.ts +149 -81
- package/src/types/boolean.ts +5 -3
- package/src/types/custom.ts +59 -26
- package/src/types/date.ts +13 -17
- package/src/types/enum.ts +12 -22
- package/src/types/literal.ts +9 -6
- package/src/types/never.ts +5 -3
- package/src/types/number.ts +43 -90
- package/src/types/object.ts +45 -37
- package/src/types/string.ts +68 -37
- package/src/types/temporal.ts +69 -53
- package/src/types/union.ts +54 -50
- package/dist/compiler.js +0 -55
- package/dist/compiler.js.map +0 -1
- package/dist/formats.js +0 -127
- package/dist/formats.js.map +0 -1
- package/dist/inference.js +0 -1
- package/dist/inference.js.map +0 -1
- package/dist/parse.js +0 -145
- package/dist/parse.js.map +0 -1
- package/dist/runtime.js +0 -73
- package/dist/runtime.js.map +0 -1
- package/dist/schemas/default.js +0 -6
- package/dist/schemas/default.js.map +0 -1
- package/dist/schemas/discriminated-union.js +0 -9
- package/dist/schemas/discriminated-union.js.map +0 -1
- package/dist/schemas/nullable.js +0 -11
- package/dist/schemas/nullable.js.map +0 -1
- package/dist/utils.js +0 -1
- package/dist/utils.js.map +0 -1
- package/src/compiler.ts +0 -100
- package/src/formats.ts +0 -182
- package/src/inference.ts +0 -128
- package/src/parse.ts +0 -217
- package/src/runtime.ts +0 -137
- package/src/schemas/default.ts +0 -12
- package/src/schemas/discriminated-union.ts +0 -49
- package/src/schemas/nullable.ts +0 -20
- package/src/utils.ts +0 -24
package/src/types/date.ts
CHANGED
|
@@ -1,22 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { iso, union, type ZodMiniUnion } from '@zod/mini'
|
|
2
2
|
import { CustomType, TransformType } from './custom.ts'
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
export class DateType extends TransformType<
|
|
5
|
+
Date,
|
|
6
|
+
ZodMiniUnion<[iso.ZodMiniISODate, iso.ZodMiniISODateTime]>
|
|
7
|
+
> {
|
|
8
8
|
static factory() {
|
|
9
|
-
return CustomType.factory<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
format: 'date-time',
|
|
18
|
-
}),
|
|
19
|
-
]) as unknown as TString,
|
|
20
|
-
)
|
|
9
|
+
return CustomType.factory<
|
|
10
|
+
Date,
|
|
11
|
+
ZodMiniUnion<Array<iso.ZodMiniISODate | iso.ZodMiniISODateTime>>
|
|
12
|
+
>({
|
|
13
|
+
decode: (value: string): Date => new Date(value),
|
|
14
|
+
encode: (value: Date): string => value.toISOString(),
|
|
15
|
+
type: union([iso.datetime(), iso.date()]),
|
|
16
|
+
})
|
|
21
17
|
}
|
|
22
18
|
}
|
package/src/types/enum.ts
CHANGED
|
@@ -1,27 +1,17 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type core, enum as enum_, type ZodMiniEnum } from '@zod/mini'
|
|
2
2
|
import { BaseType } from './base.ts'
|
|
3
3
|
|
|
4
|
-
export class ObjectEnumType<
|
|
5
|
-
T extends { [K in string]: K } = { [K in string]: K },
|
|
6
|
-
> extends BaseType<TEnum<T>, { values: T[keyof T] }, T[keyof T]> {
|
|
7
|
-
static factory<T extends { [K in string]: K }>(values: T) {
|
|
8
|
-
return new ObjectEnumType<T>(Type.Enum(values as any), {
|
|
9
|
-
values: Object.values(values) as unknown as T[keyof T],
|
|
10
|
-
})
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
4
|
export class EnumType<
|
|
15
|
-
T extends
|
|
16
|
-
> extends BaseType<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
static factory<T extends
|
|
22
|
-
return new EnumType
|
|
23
|
-
|
|
24
|
-
{ values },
|
|
25
|
-
)
|
|
5
|
+
T extends core.utils.EnumLike = core.utils.EnumLike,
|
|
6
|
+
> extends BaseType<ZodMiniEnum<T>, ZodMiniEnum<T>, { values: T }> {
|
|
7
|
+
static factory<T extends core.utils.EnumLike>(values: T): EnumType<T>
|
|
8
|
+
static factory<T extends string[]>(
|
|
9
|
+
values: T,
|
|
10
|
+
): EnumType<core.utils.ToEnum<T[number]>>
|
|
11
|
+
static factory<T extends core.utils.EnumLike | string[]>(values: T) {
|
|
12
|
+
return new EnumType({
|
|
13
|
+
encodedZodType: enum_(values as any),
|
|
14
|
+
props: { values },
|
|
15
|
+
})
|
|
26
16
|
}
|
|
27
17
|
}
|
package/src/types/literal.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { BaseType } from './base.ts'
|
|
1
|
+
import { literal, type ZodMiniLiteral } from '@zod/mini'
|
|
2
|
+
import { BaseType, type PrimitiveValueType } from './base.ts'
|
|
3
3
|
|
|
4
4
|
export class LiteralType<
|
|
5
|
-
T extends
|
|
6
|
-
> extends BaseType<
|
|
7
|
-
static factory<T extends
|
|
8
|
-
return new LiteralType<T>(
|
|
5
|
+
T extends PrimitiveValueType = PrimitiveValueType,
|
|
6
|
+
> extends BaseType<ZodMiniLiteral<T>, ZodMiniLiteral<T>, { value: T }> {
|
|
7
|
+
static factory<T extends PrimitiveValueType>(value: T) {
|
|
8
|
+
return new LiteralType<T>({
|
|
9
|
+
encodedZodType: literal(value),
|
|
10
|
+
props: { value },
|
|
11
|
+
})
|
|
9
12
|
}
|
|
10
13
|
}
|
package/src/types/never.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { never, type ZodMiniNever } from '@zod/mini'
|
|
2
2
|
import { BaseType } from './base.ts'
|
|
3
3
|
|
|
4
|
-
export class NeverType extends BaseType<
|
|
4
|
+
export class NeverType extends BaseType<ZodMiniNever> {
|
|
5
5
|
static factory() {
|
|
6
|
-
return new NeverType(
|
|
6
|
+
return new NeverType({
|
|
7
|
+
encodedZodType: never(),
|
|
8
|
+
})
|
|
7
9
|
}
|
|
8
10
|
}
|
package/src/types/number.ts
CHANGED
|
@@ -1,117 +1,70 @@
|
|
|
1
1
|
import {
|
|
2
|
-
type
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
type core,
|
|
3
|
+
gt,
|
|
4
|
+
gte,
|
|
5
|
+
int,
|
|
6
|
+
lt,
|
|
7
|
+
lte,
|
|
8
|
+
number,
|
|
9
|
+
regex,
|
|
10
|
+
string,
|
|
11
|
+
type ZodMiniNumber,
|
|
12
|
+
type ZodMiniString,
|
|
13
|
+
} from '@zod/mini'
|
|
10
14
|
import { BaseType } from './base.ts'
|
|
15
|
+
import { CustomType, TransformType } from './custom.ts'
|
|
16
|
+
|
|
17
|
+
type Check = core.CheckFn<number> | core.$ZodCheck<number>
|
|
11
18
|
|
|
12
19
|
export class NumberType extends BaseType<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
number
|
|
20
|
+
ZodMiniNumber<number>,
|
|
21
|
+
ZodMiniNumber<number>
|
|
16
22
|
> {
|
|
17
|
-
static factory(
|
|
18
|
-
return new NumberType(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
positive() {
|
|
22
|
-
return this.min(0, true)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
negative() {
|
|
26
|
-
return this.max(0, true)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
max(value: number, exclusive?: true) {
|
|
30
|
-
return NumberType.factory({
|
|
31
|
-
...this.props.options,
|
|
32
|
-
maximum: value,
|
|
33
|
-
...(!exclusive ? {} : { exclusiveMaximum: value }),
|
|
23
|
+
static factory(...checks: Check[]) {
|
|
24
|
+
return new NumberType({
|
|
25
|
+
encodedZodType: number().check(...checks),
|
|
26
|
+
params: { checks },
|
|
34
27
|
})
|
|
35
28
|
}
|
|
36
29
|
|
|
37
|
-
min(value: number, exclusive?: true) {
|
|
38
|
-
return NumberType.factory({
|
|
39
|
-
...this.props.options,
|
|
40
|
-
minimum: value,
|
|
41
|
-
...(!exclusive ? {} : { exclusiveMinimum: value }),
|
|
42
|
-
})
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export class IntegerType extends BaseType<
|
|
47
|
-
TInteger,
|
|
48
|
-
{ options: IntegerOptions },
|
|
49
|
-
number
|
|
50
|
-
> {
|
|
51
|
-
static factory(options: IntegerOptions = {}) {
|
|
52
|
-
return new IntegerType(Type.Integer(options), { options })
|
|
53
|
-
}
|
|
54
|
-
|
|
55
30
|
positive() {
|
|
56
|
-
return this.
|
|
31
|
+
return NumberType.factory(...this.params.checks, gte(0))
|
|
57
32
|
}
|
|
58
33
|
|
|
59
34
|
negative() {
|
|
60
|
-
return this.
|
|
35
|
+
return NumberType.factory(...this.params.checks, lte(0))
|
|
61
36
|
}
|
|
62
37
|
|
|
63
|
-
|
|
64
|
-
return
|
|
65
|
-
...this.props.options,
|
|
66
|
-
maximum: value,
|
|
67
|
-
...(!exclusive ? {} : { exclusiveMaximum: value }),
|
|
68
|
-
})
|
|
38
|
+
lt(value: number) {
|
|
39
|
+
return NumberType.factory(...this.params.checks, lt(value))
|
|
69
40
|
}
|
|
70
41
|
|
|
71
|
-
|
|
72
|
-
return
|
|
73
|
-
...this.props.options,
|
|
74
|
-
minimum: value,
|
|
75
|
-
...(!exclusive ? {} : { exclusiveMinimum: value }),
|
|
76
|
-
})
|
|
42
|
+
lte(value: number) {
|
|
43
|
+
return NumberType.factory(...this.params.checks, lte(value))
|
|
77
44
|
}
|
|
78
|
-
}
|
|
79
45
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
TBigInt,
|
|
83
|
-
{ options: BigIntOptions },
|
|
84
|
-
bigint
|
|
85
|
-
> {
|
|
86
|
-
static factory(options: BigIntOptions = {}) {
|
|
87
|
-
return new BigIntType(
|
|
88
|
-
Type.BigInt(options),
|
|
89
|
-
{ options },
|
|
90
|
-
{ encode: (value) => `${value}` },
|
|
91
|
-
)
|
|
46
|
+
gte(value: number) {
|
|
47
|
+
return NumberType.factory(...this.params.checks, gte(value))
|
|
92
48
|
}
|
|
93
49
|
|
|
94
|
-
|
|
95
|
-
return this.
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
negative() {
|
|
99
|
-
return this.max(0n, true)
|
|
50
|
+
gt(value: number) {
|
|
51
|
+
return NumberType.factory(...this.params.checks, gt(value))
|
|
100
52
|
}
|
|
53
|
+
}
|
|
101
54
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
maximum: value,
|
|
106
|
-
...(!exclusive ? {} : { exclusiveMaximum: value }),
|
|
107
|
-
})
|
|
55
|
+
export class IntegerType extends NumberType {
|
|
56
|
+
static factory(...checks: Check[]) {
|
|
57
|
+
return NumberType.factory(...checks, int())
|
|
108
58
|
}
|
|
59
|
+
}
|
|
109
60
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
61
|
+
export class BigIntType extends TransformType<bigint, ZodMiniString<string>> {
|
|
62
|
+
static factory() {
|
|
63
|
+
return CustomType.factory<bigint, ZodMiniString<string>>({
|
|
64
|
+
decode: (value) => BigInt(value),
|
|
65
|
+
encode: (value) => value.toString(),
|
|
66
|
+
type: string().check(regex(/^-?\d+$/)),
|
|
67
|
+
error: 'Invalid bigint format',
|
|
115
68
|
})
|
|
116
69
|
}
|
|
117
70
|
}
|
package/src/types/object.ts
CHANGED
|
@@ -1,64 +1,74 @@
|
|
|
1
1
|
import {
|
|
2
|
-
type
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
type core,
|
|
3
|
+
object,
|
|
4
|
+
record,
|
|
5
|
+
strictObject,
|
|
6
|
+
type ZodMiniObject,
|
|
7
|
+
type ZodMiniRecord,
|
|
8
|
+
} from '@zod/mini'
|
|
9
|
+
|
|
10
10
|
import { BaseType, type BaseTypeAny, type OptionalType } from './base.ts'
|
|
11
|
-
import { EnumType
|
|
11
|
+
import { EnumType } from './enum.ts'
|
|
12
12
|
import type { LiteralType } from './literal.ts'
|
|
13
13
|
import type { StringType } from './string.ts'
|
|
14
14
|
|
|
15
15
|
export type ObjectTypeProps = { [k: string]: BaseTypeAny }
|
|
16
16
|
export type AnyObjectType = ObjectType<ObjectTypeProps>
|
|
17
17
|
export class ObjectType<T extends ObjectTypeProps = {}> extends BaseType<
|
|
18
|
-
|
|
19
|
-
{
|
|
20
|
-
|
|
18
|
+
ZodMiniObject<{ [K in keyof T]: T[K]['encodedZodType'] }, {}>,
|
|
19
|
+
ZodMiniObject<{ [K in keyof T]: T[K]['decodedZodType'] }, {}>,
|
|
20
|
+
{ properties: T }
|
|
21
21
|
> {
|
|
22
|
-
static factory<T extends ObjectTypeProps = {}>(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
[K in keyof T]: T[K]['
|
|
22
|
+
static factory<T extends ObjectTypeProps = {}>(properties: T) {
|
|
23
|
+
const encodeProperties = {} as {
|
|
24
|
+
[K in keyof T]: T[K]['encodedZodType']
|
|
25
|
+
}
|
|
26
|
+
const decodeProperties = {} as {
|
|
27
|
+
[K in keyof T]: T[K]['decodedZodType']
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
for (const key in properties) {
|
|
31
|
-
|
|
31
|
+
encodeProperties[key] = properties[key].encodedZodType
|
|
32
|
+
decodeProperties[key] = properties[key].decodedZodType
|
|
32
33
|
}
|
|
33
34
|
|
|
34
|
-
return new ObjectType<T>(
|
|
35
|
-
|
|
35
|
+
return new ObjectType<T>({
|
|
36
|
+
encodedZodType: object(encodeProperties),
|
|
37
|
+
decodedZodType: object(decodeProperties),
|
|
38
|
+
props: { properties },
|
|
36
39
|
})
|
|
37
40
|
}
|
|
38
41
|
}
|
|
39
42
|
|
|
40
43
|
export class RecordType<
|
|
41
|
-
K extends LiteralType |
|
|
44
|
+
K extends LiteralType<string | number> | EnumType | StringType,
|
|
42
45
|
E extends BaseType,
|
|
43
|
-
> extends BaseType<
|
|
46
|
+
> extends BaseType<
|
|
47
|
+
ZodMiniRecord<K['encodedZodType'], E['encodedZodType']>,
|
|
48
|
+
ZodMiniRecord<K['decodedZodType'], E['decodedZodType']>
|
|
49
|
+
> {
|
|
44
50
|
static factory<
|
|
45
|
-
K extends
|
|
46
|
-
| LiteralType<any>
|
|
47
|
-
| EnumType<any>
|
|
48
|
-
| ObjectEnumType<any>
|
|
49
|
-
| StringType,
|
|
51
|
+
K extends LiteralType<string | number> | EnumType | StringType,
|
|
50
52
|
E extends BaseType,
|
|
51
|
-
>(key: K, element: E
|
|
52
|
-
return new RecordType<K, E>(
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
>(key: K, element: E) {
|
|
54
|
+
return new RecordType<K, E>({
|
|
55
|
+
encodedZodType: record(
|
|
56
|
+
(key as any).encodedZodType,
|
|
57
|
+
element.encodedZodType,
|
|
58
|
+
),
|
|
59
|
+
decodedZodType: record(
|
|
60
|
+
(key as any).decodedZodType,
|
|
61
|
+
element.decodedZodType,
|
|
62
|
+
),
|
|
63
|
+
props: { key, element },
|
|
64
|
+
})
|
|
55
65
|
}
|
|
56
66
|
}
|
|
57
67
|
|
|
58
68
|
export function keyof<T extends ObjectType>(
|
|
59
69
|
type: T,
|
|
60
70
|
): EnumType<
|
|
61
|
-
|
|
71
|
+
core.utils.ToEnum<Extract<keyof T['props']['properties'], string>>
|
|
62
72
|
> {
|
|
63
73
|
return EnumType.factory(Object.keys(type.props.properties) as any)
|
|
64
74
|
}
|
|
@@ -139,9 +149,7 @@ export function partial<
|
|
|
139
149
|
>(
|
|
140
150
|
object: T,
|
|
141
151
|
): ObjectType<{
|
|
142
|
-
[K in keyof P]: P[K]
|
|
143
|
-
? OptionalType<P[K], T>
|
|
144
|
-
: never
|
|
152
|
+
[K in keyof P]: OptionalType<P[K]>
|
|
145
153
|
}> {
|
|
146
154
|
const properties = {} as any
|
|
147
155
|
|
|
@@ -149,5 +157,5 @@ export function partial<
|
|
|
149
157
|
properties[key] = value.optional()
|
|
150
158
|
}
|
|
151
159
|
|
|
152
|
-
return ObjectType.factory(properties
|
|
160
|
+
return ObjectType.factory(properties)
|
|
153
161
|
}
|
package/src/types/string.ts
CHANGED
|
@@ -1,63 +1,94 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
type core,
|
|
3
|
+
cuid,
|
|
4
|
+
cuid2,
|
|
5
|
+
e164,
|
|
6
|
+
email,
|
|
7
|
+
emoji,
|
|
8
|
+
ipv4,
|
|
9
|
+
ipv6,
|
|
10
|
+
jwt,
|
|
11
|
+
maxLength,
|
|
12
|
+
minLength,
|
|
13
|
+
nanoid,
|
|
14
|
+
regex,
|
|
15
|
+
string,
|
|
16
|
+
url,
|
|
17
|
+
uuid,
|
|
18
|
+
type ZodMiniString,
|
|
19
|
+
} from '@zod/mini'
|
|
20
|
+
|
|
3
21
|
import { BaseType } from './base.ts'
|
|
4
22
|
|
|
23
|
+
type Check = core.CheckFn<string> | core.$ZodCheck<string>
|
|
24
|
+
|
|
5
25
|
export class StringType extends BaseType<
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
string
|
|
26
|
+
ZodMiniString<string>,
|
|
27
|
+
ZodMiniString<string>
|
|
9
28
|
> {
|
|
10
|
-
static factory(
|
|
11
|
-
return new StringType(
|
|
29
|
+
static factory(...checks: Check[]) {
|
|
30
|
+
return new StringType({
|
|
31
|
+
encodedZodType: string().check(...checks),
|
|
32
|
+
params: { checks },
|
|
33
|
+
})
|
|
12
34
|
}
|
|
13
35
|
|
|
14
36
|
max(value: number) {
|
|
15
|
-
return StringType.factory(
|
|
16
|
-
...this.props.options,
|
|
17
|
-
maxLength: value,
|
|
18
|
-
})
|
|
37
|
+
return StringType.factory(...this.params.checks, maxLength(value))
|
|
19
38
|
}
|
|
20
39
|
|
|
21
40
|
min(value: number) {
|
|
22
|
-
return StringType.factory(
|
|
23
|
-
...this.props.options,
|
|
24
|
-
minLength: value,
|
|
25
|
-
})
|
|
41
|
+
return StringType.factory(...this.params.checks, minLength(value))
|
|
26
42
|
}
|
|
27
43
|
|
|
28
|
-
|
|
29
|
-
return StringType.factory(
|
|
30
|
-
...this.
|
|
31
|
-
pattern:
|
|
32
|
-
|
|
33
|
-
})
|
|
44
|
+
pattern(pattern: string | RegExp) {
|
|
45
|
+
return StringType.factory(
|
|
46
|
+
...this.params.checks,
|
|
47
|
+
regex(typeof pattern === 'string' ? new RegExp(pattern) : pattern),
|
|
48
|
+
)
|
|
34
49
|
}
|
|
35
50
|
|
|
36
|
-
|
|
37
|
-
return StringType.factory(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
51
|
+
email(options?: core.$ZodEmailParams) {
|
|
52
|
+
return StringType.factory(...this.params.checks, email(options))
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
url(options?: core.$ZodURLParams) {
|
|
56
|
+
return StringType.factory(...this.params.checks, url(options))
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
ipv4(options?: core.$ZodIPv4Params) {
|
|
60
|
+
return StringType.factory(...this.params.checks, ipv4(options))
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
ipv6(options?: core.$ZodIPv6Params) {
|
|
64
|
+
return StringType.factory(...this.params.checks, ipv6(options))
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
uuid(options?: core.$ZodUUIDParams) {
|
|
68
|
+
return StringType.factory(...this.params.checks, uuid(options))
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
emoji(options?: core.$ZodEmojiParams) {
|
|
72
|
+
return StringType.factory(...this.params.checks, emoji(options))
|
|
42
73
|
}
|
|
43
74
|
|
|
44
|
-
|
|
45
|
-
return this.
|
|
75
|
+
nanoid(options?: core.$ZodNanoIDParams) {
|
|
76
|
+
return StringType.factory(...this.params.checks, nanoid(options))
|
|
46
77
|
}
|
|
47
78
|
|
|
48
|
-
|
|
49
|
-
return this.
|
|
79
|
+
cuid(options?: core.$ZodCUIDParams) {
|
|
80
|
+
return StringType.factory(...this.params.checks, cuid(options))
|
|
50
81
|
}
|
|
51
82
|
|
|
52
|
-
|
|
53
|
-
return this.
|
|
83
|
+
cuid2(options?: core.$ZodCUID2Params) {
|
|
84
|
+
return StringType.factory(...this.params.checks, cuid2(options))
|
|
54
85
|
}
|
|
55
86
|
|
|
56
|
-
|
|
57
|
-
return this.
|
|
87
|
+
e164(options?: core.$ZodE164Params) {
|
|
88
|
+
return StringType.factory(...this.params.checks, e164(options))
|
|
58
89
|
}
|
|
59
90
|
|
|
60
|
-
|
|
61
|
-
return this.
|
|
91
|
+
jwt(options?: core.$ZodJWTParams) {
|
|
92
|
+
return StringType.factory(...this.params.checks, jwt(options))
|
|
62
93
|
}
|
|
63
94
|
}
|