@nmtjs/type 0.13.0 → 0.14.0
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 +1 -1
- package/dist/types/any.d.ts +1 -1
- package/dist/types/any.js +2 -4
- package/dist/types/array.d.ts +1 -1
- package/dist/types/array.js +1 -1
- package/dist/types/base.d.ts +1 -1
- package/dist/types/base.js +1 -1
- package/dist/types/boolean.d.ts +1 -1
- package/dist/types/boolean.js +2 -4
- package/dist/types/custom.d.ts +3 -2
- package/dist/types/custom.js +1 -1
- package/dist/types/date.d.ts +1 -1
- package/dist/types/date.js +1 -1
- package/dist/types/enum.d.ts +1 -1
- package/dist/types/enum.js +1 -1
- package/dist/types/literal.d.ts +3 -2
- package/dist/types/literal.js +1 -1
- package/dist/types/never.d.ts +1 -1
- package/dist/types/never.js +2 -4
- package/dist/types/number.d.ts +1 -1
- package/dist/types/number.js +1 -1
- package/dist/types/object.d.ts +4 -3
- package/dist/types/object.js +1 -1
- package/dist/types/string.d.ts +1 -1
- package/dist/types/string.js +1 -1
- package/dist/types/temporal.d.ts +8 -8
- package/dist/types/temporal.js +2 -5
- package/dist/types/tuple.d.ts +1 -1
- package/dist/types/tuple.js +1 -1
- package/dist/types/union.d.ts +3 -2
- package/dist/types/union.js +1 -1
- package/package.json +10 -5
package/dist/index.js
CHANGED
package/dist/types/any.d.ts
CHANGED
package/dist/types/any.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import * as zod from 'zod/
|
|
1
|
+
import * as zod from 'zod/mini';
|
|
2
2
|
import { BaseType } from "./base.js";
|
|
3
3
|
export class AnyType extends BaseType {
|
|
4
4
|
static factory() {
|
|
5
|
-
return new AnyType({
|
|
6
|
-
encodedZodType: zod.any(),
|
|
7
|
-
});
|
|
5
|
+
return new AnyType({ encodedZodType: zod.any() });
|
|
8
6
|
}
|
|
9
7
|
}
|
|
10
8
|
export const any = AnyType.factory;
|
package/dist/types/array.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as zod from 'zod/
|
|
1
|
+
import * as zod from 'zod/mini';
|
|
2
2
|
import { BaseType } from './base.ts';
|
|
3
3
|
type Check = zod.core.CheckFn<any[]> | zod.core.$ZodCheck<any[]>;
|
|
4
4
|
export declare class ArrayType<T extends BaseType = BaseType> extends BaseType<zod.ZodMiniArray<T['encodedZodType']>, zod.ZodMiniArray<T['decodedZodType']>, {
|
package/dist/types/array.js
CHANGED
package/dist/types/base.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as zod from 'zod/
|
|
1
|
+
import * as zod from 'zod/mini';
|
|
2
2
|
export type PrimitiveValueType = string | number | boolean | null;
|
|
3
3
|
export type PrimitiveZodType = zod.ZodMiniNever | zod.ZodMiniDefault | zod.ZodMiniNullable | zod.ZodMiniOptional | zod.ZodMiniString | zod.ZodMiniObject | zod.ZodMiniAny | zod.ZodMiniArray | zod.ZodMiniBoolean | zod.ZodMiniNumber | zod.ZodMiniEnum<any> | zod.ZodMiniLiteral<PrimitiveValueType> | zod.ZodMiniUnion | zod.ZodMiniIntersection | zod.ZodMiniRecord;
|
|
4
4
|
export type SimpleZodType = zod.ZodMiniType;
|
package/dist/types/base.js
CHANGED
package/dist/types/boolean.d.ts
CHANGED
package/dist/types/boolean.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import * as zod from 'zod/
|
|
1
|
+
import * as zod from 'zod/mini';
|
|
2
2
|
import { BaseType } from "./base.js";
|
|
3
3
|
export class BooleanType extends BaseType {
|
|
4
4
|
static factory() {
|
|
5
|
-
return new BooleanType({
|
|
6
|
-
encodedZodType: zod.boolean(),
|
|
7
|
-
});
|
|
5
|
+
return new BooleanType({ encodedZodType: zod.boolean() });
|
|
8
6
|
}
|
|
9
7
|
}
|
|
10
8
|
export const boolean = BooleanType.factory;
|
package/dist/types/custom.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import * as zod from 'zod/
|
|
2
|
-
import {
|
|
1
|
+
import * as zod from 'zod/mini';
|
|
2
|
+
import type { SimpleZodType, ZodType } from './base.ts';
|
|
3
|
+
import { BaseType } from './base.ts';
|
|
3
4
|
export type CustomTransformFn<I, O> = (value: I) => O;
|
|
4
5
|
export declare abstract class TransformType<Type, EncodedType extends SimpleZodType = zod.ZodMiniType<Type, Type>, DecodedType extends ZodType = zod.ZodMiniType<Type, Type>> extends BaseType<zod.ZodMiniPipe<zod.ZodMiniType<DecodedType['_zod']['output'], DecodedType['_zod']['input']>, EncodedType>, zod.ZodMiniPipe<EncodedType, zod.ZodMiniType<DecodedType['_zod']['output'], DecodedType['_zod']['input']>>> {
|
|
5
6
|
}
|
package/dist/types/custom.js
CHANGED
package/dist/types/date.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as zod from 'zod/
|
|
1
|
+
import * as zod from 'zod/mini';
|
|
2
2
|
import { CustomType, TransformType } from './custom.ts';
|
|
3
3
|
export declare class DateType extends TransformType<Date, zod.ZodMiniUnion<[zod.iso.ZodMiniISODate, zod.iso.ZodMiniISODateTime]>> {
|
|
4
4
|
static factory(): CustomType<Date, zod.ZodMiniUnion<[zod.z.iso.ZodMiniISODate, zod.z.iso.ZodMiniISODateTime]>, zod.ZodMiniType<Date, Date, zod.z.core.$ZodTypeInternals<Date, Date>>>;
|
package/dist/types/date.js
CHANGED
package/dist/types/enum.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as zod from 'zod/
|
|
1
|
+
import * as zod from 'zod/mini';
|
|
2
2
|
import { BaseType } from './base.ts';
|
|
3
3
|
export declare class EnumType<T extends zod.core.util.EnumLike = zod.core.util.EnumLike> extends BaseType<zod.ZodMiniEnum<T>, zod.ZodMiniEnum<T>, {
|
|
4
4
|
values: T;
|
package/dist/types/enum.js
CHANGED
package/dist/types/literal.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import * as zod from 'zod/
|
|
2
|
-
import {
|
|
1
|
+
import * as zod from 'zod/mini';
|
|
2
|
+
import type { PrimitiveValueType } from './base.ts';
|
|
3
|
+
import { BaseType } from './base.ts';
|
|
3
4
|
export declare class LiteralType<T extends PrimitiveValueType = PrimitiveValueType> extends BaseType<zod.ZodMiniLiteral<T>, zod.ZodMiniLiteral<T>, {
|
|
4
5
|
value: T;
|
|
5
6
|
}> {
|
package/dist/types/literal.js
CHANGED
package/dist/types/never.d.ts
CHANGED
package/dist/types/never.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import * as zod from 'zod/
|
|
1
|
+
import * as zod from 'zod/mini';
|
|
2
2
|
import { BaseType } from "./base.js";
|
|
3
3
|
export class NeverType extends BaseType {
|
|
4
4
|
static factory() {
|
|
5
|
-
return new NeverType({
|
|
6
|
-
encodedZodType: zod.never(),
|
|
7
|
-
});
|
|
5
|
+
return new NeverType({ encodedZodType: zod.never() });
|
|
8
6
|
}
|
|
9
7
|
}
|
|
10
8
|
export const never = NeverType.factory;
|
package/dist/types/number.d.ts
CHANGED
package/dist/types/number.js
CHANGED
package/dist/types/object.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import * as zod from 'zod/
|
|
2
|
-
import {
|
|
3
|
-
import { EnumType } from './enum.ts';
|
|
1
|
+
import * as zod from 'zod/mini';
|
|
2
|
+
import type { BaseTypeAny, OptionalType } from './base.ts';
|
|
4
3
|
import type { LiteralType } from './literal.ts';
|
|
5
4
|
import type { StringType } from './string.ts';
|
|
5
|
+
import { BaseType } from './base.ts';
|
|
6
|
+
import { EnumType } from './enum.ts';
|
|
6
7
|
export type ObjectTypeProps = {
|
|
7
8
|
[k: string]: BaseTypeAny;
|
|
8
9
|
};
|
package/dist/types/object.js
CHANGED
package/dist/types/string.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as zod from 'zod/
|
|
1
|
+
import * as zod from 'zod/mini';
|
|
2
2
|
import { BaseType } from './base.ts';
|
|
3
3
|
type Check = zod.core.CheckFn<string> | zod.core.$ZodCheck<string>;
|
|
4
4
|
export declare class StringType extends BaseType<zod.ZodMiniString<string>, zod.ZodMiniString<string>> {
|
package/dist/types/string.js
CHANGED
package/dist/types/temporal.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { ZodMiniString } from 'zod/mini';
|
|
1
2
|
import { Temporal } from 'temporal-polyfill';
|
|
2
|
-
import { type ZodMiniString } from 'zod/v4-mini';
|
|
3
3
|
import { CustomType, TransformType } from './custom.ts';
|
|
4
4
|
type Types = Exclude<keyof typeof Temporal, 'Now' | 'Instant' | 'Calendar' | 'TimeZone'>;
|
|
5
5
|
type TemporalTransformer<T extends Types> = {
|
|
@@ -9,31 +9,31 @@ type TemporalTransformer<T extends Types> = {
|
|
|
9
9
|
type EncodedType = ZodMiniString<string>;
|
|
10
10
|
export declare class PlainDateType extends TransformType<Temporal.PlainDate, EncodedType> {
|
|
11
11
|
static transformer: TemporalTransformer<"PlainDate">;
|
|
12
|
-
static factory(): CustomType<Temporal.PlainDate, EncodedType, import("zod/
|
|
12
|
+
static factory(): CustomType<Temporal.PlainDate, EncodedType, import("zod/mini").ZodMiniType<Temporal.PlainDate, Temporal.PlainDate, import("zod/v4/core").$ZodTypeInternals<Temporal.PlainDate, Temporal.PlainDate>>>;
|
|
13
13
|
}
|
|
14
14
|
export declare class PlainDateTimeType extends TransformType<Temporal.PlainDateTime, EncodedType> {
|
|
15
15
|
static transformer: TemporalTransformer<"PlainDateTime">;
|
|
16
|
-
static factory(): CustomType<Temporal.PlainDateTime, EncodedType, import("zod/
|
|
16
|
+
static factory(): CustomType<Temporal.PlainDateTime, EncodedType, import("zod/mini").ZodMiniType<Temporal.PlainDateTime, Temporal.PlainDateTime, import("zod/v4/core").$ZodTypeInternals<Temporal.PlainDateTime, Temporal.PlainDateTime>>>;
|
|
17
17
|
}
|
|
18
18
|
export declare class ZonedDateTimeType extends TransformType<Temporal.ZonedDateTime, EncodedType> {
|
|
19
19
|
static transformer: TemporalTransformer<"ZonedDateTime">;
|
|
20
|
-
static factory(): CustomType<Temporal.ZonedDateTime, EncodedType, import("zod/
|
|
20
|
+
static factory(): CustomType<Temporal.ZonedDateTime, EncodedType, import("zod/mini").ZodMiniType<Temporal.ZonedDateTime, Temporal.ZonedDateTime, import("zod/v4/core").$ZodTypeInternals<Temporal.ZonedDateTime, Temporal.ZonedDateTime>>>;
|
|
21
21
|
}
|
|
22
22
|
export declare class PlainTimeType extends TransformType<Temporal.PlainTime, EncodedType> {
|
|
23
23
|
static transformer: TemporalTransformer<"PlainTime">;
|
|
24
|
-
static factory(): CustomType<Temporal.PlainTime, EncodedType, import("zod/
|
|
24
|
+
static factory(): CustomType<Temporal.PlainTime, EncodedType, import("zod/mini").ZodMiniType<Temporal.PlainTime, Temporal.PlainTime, import("zod/v4/core").$ZodTypeInternals<Temporal.PlainTime, Temporal.PlainTime>>>;
|
|
25
25
|
}
|
|
26
26
|
export declare class DurationType extends TransformType<Temporal.Duration, EncodedType> {
|
|
27
27
|
static transformer: TemporalTransformer<"Duration">;
|
|
28
|
-
static factory(): CustomType<Temporal.Duration, EncodedType, import("zod/
|
|
28
|
+
static factory(): CustomType<Temporal.Duration, EncodedType, import("zod/mini").ZodMiniType<Temporal.Duration, Temporal.Duration, import("zod/v4/core").$ZodTypeInternals<Temporal.Duration, Temporal.Duration>>>;
|
|
29
29
|
}
|
|
30
30
|
export declare class PlainYearMonthType extends TransformType<Temporal.PlainYearMonth, EncodedType> {
|
|
31
31
|
static transformer: TemporalTransformer<"PlainYearMonth">;
|
|
32
|
-
static factory(): CustomType<Temporal.PlainYearMonth, EncodedType, import("zod/
|
|
32
|
+
static factory(): CustomType<Temporal.PlainYearMonth, EncodedType, import("zod/mini").ZodMiniType<Temporal.PlainYearMonth, Temporal.PlainYearMonth, import("zod/v4/core").$ZodTypeInternals<Temporal.PlainYearMonth, Temporal.PlainYearMonth>>>;
|
|
33
33
|
}
|
|
34
34
|
export declare class PlainMonthDayType extends TransformType<Temporal.PlainMonthDay, EncodedType> {
|
|
35
35
|
static transformer: TemporalTransformer<"PlainMonthDay">;
|
|
36
|
-
static factory(): CustomType<Temporal.PlainMonthDay, EncodedType, import("zod/
|
|
36
|
+
static factory(): CustomType<Temporal.PlainMonthDay, EncodedType, import("zod/mini").ZodMiniType<Temporal.PlainMonthDay, Temporal.PlainMonthDay, import("zod/v4/core").$ZodTypeInternals<Temporal.PlainMonthDay, Temporal.PlainMonthDay>>>;
|
|
37
37
|
}
|
|
38
38
|
export declare const plainDate: typeof PlainDateType.factory;
|
|
39
39
|
export declare const plainDatetime: typeof PlainDateTimeType.factory;
|
package/dist/types/temporal.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Temporal } from 'temporal-polyfill';
|
|
2
|
-
import { iso, regex, string } from 'zod/
|
|
2
|
+
import { iso, regex, string } from 'zod/mini';
|
|
3
3
|
import { CustomType, TransformType } from "./custom.js";
|
|
4
4
|
const createTemporalTransformer = (type, decode = (value) => Temporal[type].from(value)) => {
|
|
5
5
|
const encode = (value) => value.toString({
|
|
@@ -7,10 +7,7 @@ const createTemporalTransformer = (type, decode = (value) => Temporal[type].from
|
|
|
7
7
|
smallestUnit: 'microsecond',
|
|
8
8
|
timeZoneName: 'never',
|
|
9
9
|
});
|
|
10
|
-
return {
|
|
11
|
-
decode,
|
|
12
|
-
encode,
|
|
13
|
-
};
|
|
10
|
+
return { decode, encode };
|
|
14
11
|
};
|
|
15
12
|
export class PlainDateType extends TransformType {
|
|
16
13
|
static transformer = createTemporalTransformer('PlainDate');
|
package/dist/types/tuple.d.ts
CHANGED
package/dist/types/tuple.js
CHANGED
package/dist/types/union.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { ArrayMap } from '@nmtjs/common';
|
|
2
|
-
import * as zod from 'zod/
|
|
3
|
-
import {
|
|
2
|
+
import * as zod from 'zod/mini';
|
|
3
|
+
import type { BaseTypeAny } from './base.ts';
|
|
4
4
|
import type { LiteralType } from './literal.ts';
|
|
5
5
|
import type { ObjectType, ObjectTypeProps } from './object.ts';
|
|
6
|
+
import { BaseType } from './base.ts';
|
|
6
7
|
export declare class UnionType<T extends readonly [BaseType, ...BaseType[]] = readonly [
|
|
7
8
|
BaseType,
|
|
8
9
|
...BaseType[]
|
package/dist/types/union.js
CHANGED
package/package.json
CHANGED
|
@@ -7,6 +7,11 @@
|
|
|
7
7
|
"import": "./dist/index.js",
|
|
8
8
|
"module-sync": "./dist/index.js"
|
|
9
9
|
},
|
|
10
|
+
"./*": {
|
|
11
|
+
"types": "./dist/types/*.d.ts",
|
|
12
|
+
"import": "./dist/types/*.js",
|
|
13
|
+
"module-sync": "./dist/types/*.js"
|
|
14
|
+
},
|
|
10
15
|
"./temporal": {
|
|
11
16
|
"types": "./dist/temporal.d.ts",
|
|
12
17
|
"import": "./dist/temporal.js",
|
|
@@ -15,20 +20,20 @@
|
|
|
15
20
|
},
|
|
16
21
|
"peerDependencies": {
|
|
17
22
|
"temporal-polyfill": "^0.3.0",
|
|
18
|
-
"zod": "^
|
|
19
|
-
"@nmtjs/common": "0.
|
|
23
|
+
"zod": "^4.0.0",
|
|
24
|
+
"@nmtjs/common": "0.14.0"
|
|
20
25
|
},
|
|
21
26
|
"devDependencies": {
|
|
22
27
|
"temporal-polyfill": "^0.3.0",
|
|
23
|
-
"zod": "^
|
|
24
|
-
"@nmtjs/common": "0.
|
|
28
|
+
"zod": "^4.0.0",
|
|
29
|
+
"@nmtjs/common": "0.14.0"
|
|
25
30
|
},
|
|
26
31
|
"files": [
|
|
27
32
|
"dist",
|
|
28
33
|
"LICENSE.md",
|
|
29
34
|
"README.md"
|
|
30
35
|
],
|
|
31
|
-
"version": "0.
|
|
36
|
+
"version": "0.14.0",
|
|
32
37
|
"scripts": {
|
|
33
38
|
"build": "tsc",
|
|
34
39
|
"type-check": "tsc --noEmit"
|