@nmtjs/type 0.14.0 → 0.14.2

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.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import * as type from './types/type.ts';
1
+ import * as type from './types/_type.ts';
2
2
  export * from './types/base.ts';
3
3
  export { type, type as t };
4
4
  export default type;
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
- import * as zod from 'zod/mini';
2
- import * as type from "./types/type.js";
3
- zod.config(zod.core.locales.en());
1
+ import { en } from 'zod/locales';
2
+ import { config } from 'zod/mini';
3
+ import * as type from "./types/_type.js";
4
+ config(en());
4
5
  export * from "./types/base.js";
5
6
  export { type, type as t };
6
7
  export default type;
@@ -13,12 +13,12 @@ export * from './string.ts';
13
13
  export * from './tuple.ts';
14
14
  export * from './union.ts';
15
15
  export declare namespace infer {
16
- namespace decoded {
17
- type input<T extends BaseTypeAny> = T['decodedZodType']['_zod']['input'];
18
- type output<T extends BaseTypeAny> = T['decodedZodType']['_zod']['output'];
16
+ namespace decode {
17
+ type input<T extends BaseTypeAny> = T['decodeZodType']['_zod']['input'];
18
+ type output<T extends BaseTypeAny> = T['decodeZodType']['_zod']['output'];
19
19
  }
20
- namespace encoded {
21
- type input<T extends BaseTypeAny> = T['encodedZodType']['_zod']['input'];
22
- type output<T extends BaseTypeAny> = T['encodedZodType']['_zod']['output'];
20
+ namespace encode {
21
+ type input<T extends BaseTypeAny> = T['encodeZodType']['_zod']['input'];
22
+ type output<T extends BaseTypeAny> = T['encodeZodType']['_zod']['output'];
23
23
  }
24
24
  }
@@ -1,6 +1,6 @@
1
- import * as zod from 'zod/mini';
1
+ import type { ZodMiniAny } from 'zod/mini';
2
2
  import { BaseType } from './base.ts';
3
- export declare class AnyType extends BaseType<zod.ZodMiniAny> {
3
+ export declare class AnyType extends BaseType<ZodMiniAny> {
4
4
  static factory(): AnyType;
5
5
  }
6
6
  export declare const any: typeof AnyType.factory;
package/dist/types/any.js CHANGED
@@ -1,8 +1,8 @@
1
- import * as zod from 'zod/mini';
1
+ import { any as zodAny } 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({ encodedZodType: zod.any() });
5
+ return new AnyType({ encodeZodType: zodAny() });
6
6
  }
7
7
  }
8
8
  export const any = AnyType.factory;
@@ -1,7 +1,7 @@
1
- import * as zod from 'zod/mini';
1
+ import type { core, ZodMiniArray } from 'zod/mini';
2
2
  import { BaseType } from './base.ts';
3
- type Check = zod.core.CheckFn<any[]> | zod.core.$ZodCheck<any[]>;
4
- export declare class ArrayType<T extends BaseType = BaseType> extends BaseType<zod.ZodMiniArray<T['encodedZodType']>, zod.ZodMiniArray<T['decodedZodType']>, {
3
+ type Check = core.CheckFn<any[]> | core.$ZodCheck<any[]>;
4
+ export declare class ArrayType<T extends BaseType = BaseType> extends BaseType<ZodMiniArray<T['encodeZodType']>, ZodMiniArray<T['decodeZodType']>, {
5
5
  element: T;
6
6
  }> {
7
7
  static factory<T extends BaseType>(element: T, ...checks: Check[]): ArrayType<T>;
@@ -1,24 +1,24 @@
1
- import * as zod from 'zod/mini';
1
+ import { length, maxLength, minLength, array as zodArray } from 'zod/mini';
2
2
  import { BaseType } from "./base.js";
3
3
  export class ArrayType extends BaseType {
4
4
  static factory(element, ...checks) {
5
5
  return new ArrayType({
6
- encodedZodType: zod.array(element.encodedZodType).check(...checks),
7
- decodedZodType: zod.array(element.decodedZodType).check(...checks),
6
+ encodeZodType: zodArray(element.encodeZodType).check(...checks),
7
+ decodeZodType: zodArray(element.decodeZodType).check(...checks),
8
8
  params: { checks },
9
9
  props: { element },
10
10
  });
11
11
  }
12
12
  min(value) {
13
- const check = zod.minLength(value);
13
+ const check = minLength(value);
14
14
  return ArrayType.factory(this.props.element, ...this.params.checks, check);
15
15
  }
16
16
  max(value) {
17
- const check = zod.maxLength(value);
17
+ const check = maxLength(value);
18
18
  return ArrayType.factory(this.props.element, ...this.params.checks, check);
19
19
  }
20
20
  length(value) {
21
- const check = zod.length(value);
21
+ const check = length(value);
22
22
  return ArrayType.factory(this.props.element, ...this.params.checks, check);
23
23
  }
24
24
  }
@@ -1,8 +1,9 @@
1
- import * as zod from 'zod/mini';
1
+ import type { ZodMiniAny, ZodMiniArray, ZodMiniBoolean, ZodMiniDefault, ZodMiniEnum, ZodMiniIntersection, ZodMiniLiteral, ZodMiniNever, ZodMiniNullable, ZodMiniNumber, ZodMiniObject, ZodMiniOptional, ZodMiniRecord, ZodMiniString, ZodMiniType, ZodMiniUnion } from 'zod/mini';
2
+ import { core } from 'zod/mini';
2
3
  export type PrimitiveValueType = string | number | boolean | null;
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
- export type SimpleZodType = zod.ZodMiniType;
5
- export type ZodType = SimpleZodType | zod.ZodMiniType;
4
+ export type PrimitiveZodType = ZodMiniNever | ZodMiniDefault | ZodMiniNullable | ZodMiniOptional | ZodMiniString | ZodMiniObject | ZodMiniAny | ZodMiniArray | ZodMiniBoolean | ZodMiniNumber | ZodMiniEnum<any> | ZodMiniLiteral<PrimitiveValueType> | ZodMiniUnion | ZodMiniIntersection | ZodMiniRecord;
5
+ export type SimpleZodType = ZodMiniType;
6
+ export type ZodType = SimpleZodType | ZodMiniType;
6
7
  export type TypeProps = Record<string, any>;
7
8
  export type TypeMetadata<T = any> = {
8
9
  id?: string;
@@ -13,49 +14,49 @@ export type TypeMetadata<T = any> = {
13
14
  export type TypeParams = {
14
15
  encode?: (value: any) => any;
15
16
  metadata?: TypeMetadata;
16
- checks: Array<zod.core.CheckFn<any> | zod.core.$ZodCheck<any>>;
17
+ checks: Array<core.CheckFn<any> | core.$ZodCheck<any>>;
17
18
  };
18
19
  export type DefaultTypeParams = {
19
20
  encode?: TypeParams['encode'];
20
21
  metadata?: TypeMetadata;
21
22
  };
22
- export type BaseTypeAny<EncodedZodType extends SimpleZodType = SimpleZodType, DecodedZodType extends ZodType = zod.ZodMiniType> = BaseType<EncodedZodType, DecodedZodType, TypeProps>;
23
- export declare const typesRegistry: zod.z.core.$ZodRegistry<TypeMetadata<any>, zod.z.core.$ZodType<unknown, unknown, zod.z.core.$ZodTypeInternals<unknown, unknown>>>;
24
- export declare const NeemataTypeError: zod.z.core.$constructor<zod.z.core.$ZodError<unknown>, zod.z.core.$ZodIssue[]>;
25
- export type NeemataTypeError = zod.core.$ZodError;
26
- export declare abstract class BaseType<EncodedZodType extends SimpleZodType = SimpleZodType, DecodedZodType extends ZodType = EncodedZodType, Props extends TypeProps = TypeProps> {
27
- readonly encodedZodType: EncodedZodType;
28
- readonly decodedZodType: DecodedZodType;
23
+ export type BaseTypeAny<EncodedZodType extends SimpleZodType = SimpleZodType, DecodedZodType extends ZodType = ZodMiniType> = BaseType<EncodedZodType, DecodedZodType, TypeProps>;
24
+ export declare const typesRegistry: core.$ZodRegistry<TypeMetadata<any>, core.$ZodType<unknown, unknown, core.$ZodTypeInternals<unknown, unknown>>>;
25
+ export declare const NeemataTypeError: core.$constructor<core.$ZodError<unknown>, core.$ZodIssue[]>;
26
+ export type NeemataTypeError = core.$ZodError;
27
+ export declare abstract class BaseType<EncodeZodType extends SimpleZodType = SimpleZodType, DecodeZodType extends ZodType = EncodeZodType, Props extends TypeProps = TypeProps> {
28
+ readonly encodeZodType: EncodeZodType;
29
+ readonly decodeZodType: DecodeZodType;
29
30
  readonly props: Props;
30
31
  readonly params: TypeParams;
31
- constructor({ encodedZodType, decodedZodType, props, params, }: {
32
- encodedZodType: EncodedZodType;
33
- decodedZodType?: DecodedZodType;
32
+ constructor({ encodeZodType, decodeZodType, props, params, }: {
33
+ encodeZodType: EncodeZodType;
34
+ decodeZodType?: DecodeZodType;
34
35
  props?: Props;
35
36
  params?: Partial<TypeParams>;
36
37
  });
37
38
  optional(): OptionalType<this>;
38
39
  nullable(): NullableType<this>;
39
40
  nullish(): OptionalType<NullableType<this>>;
40
- default(value: this['encodedZodType']['_zod']['input']): DefaultType<this>;
41
+ default(value: this['encodeZodType']['_zod']['input']): DefaultType<this>;
41
42
  title(title: string): this;
42
43
  description(description: string): this;
43
- examples(...examples: this['encodedZodType']['_zod']['input'][]): this;
44
+ examples(...examples: this['encodeZodType']['_zod']['input'][]): this;
44
45
  meta(newMetadata: TypeMetadata): this;
45
- encode(data: this['encodedZodType']['_zod']['input']): this['encodedZodType']['_zod']['output'];
46
- decode(data: this['decodedZodType']['_zod']['input']): this['decodedZodType']['_zod']['output'];
46
+ encode(data: this['encodeZodType']['_zod']['input'], context?: core.ParseContext<core.$ZodIssue>): this['encodeZodType']['_zod']['output'];
47
+ decode(data: this['decodeZodType']['_zod']['input'], context?: core.ParseContext<core.$ZodIssue>): this['decodeZodType']['_zod']['output'];
47
48
  }
48
- export declare class OptionalType<Type extends BaseTypeAny = BaseTypeAny> extends BaseType<zod.ZodMiniOptional<Type['encodedZodType']>, zod.ZodMiniOptional<Type['decodedZodType']>, {
49
+ export declare class OptionalType<Type extends BaseTypeAny = BaseTypeAny> extends BaseType<ZodMiniOptional<Type['encodeZodType']>, ZodMiniOptional<Type['decodeZodType']>, {
49
50
  inner: Type;
50
51
  }> {
51
52
  static factory<T extends BaseTypeAny>(type: T): OptionalType<T>;
52
53
  }
53
- export declare class NullableType<Type extends BaseTypeAny<any> = BaseTypeAny<any>> extends BaseType<zod.ZodMiniNullable<Type['encodedZodType']>, zod.ZodMiniNullable<Type['decodedZodType']>, {
54
+ export declare class NullableType<Type extends BaseTypeAny<any> = BaseTypeAny<any>> extends BaseType<ZodMiniNullable<Type['encodeZodType']>, ZodMiniNullable<Type['decodeZodType']>, {
54
55
  inner: Type;
55
56
  }> {
56
57
  static factory<T extends BaseTypeAny<any>>(type: T): NullableType<T>;
57
58
  }
58
- export declare class DefaultType<Type extends BaseTypeAny = BaseTypeAny> extends BaseType<zod.ZodMiniDefault<Type['encodedZodType']>, zod.ZodMiniDefault<Type['decodedZodType']>, {
59
+ export declare class DefaultType<Type extends BaseTypeAny = BaseTypeAny> extends BaseType<ZodMiniDefault<Type['encodeZodType']>, ZodMiniDefault<Type['decodeZodType']>, {
59
60
  inner: Type;
60
61
  }> {
61
62
  static factory<T extends BaseTypeAny<any>>(type: T, defaultValue: any): DefaultType<T>;
@@ -1,14 +1,14 @@
1
- import * as zod from 'zod/mini';
2
- export const typesRegistry = zod.registry();
3
- export const NeemataTypeError = zod.core.$ZodError;
1
+ import { _default, core, nullable, optional, registry } from 'zod/mini';
2
+ export const typesRegistry = registry();
3
+ export const NeemataTypeError = core.$ZodError;
4
4
  export class BaseType {
5
- encodedZodType;
6
- decodedZodType;
5
+ encodeZodType;
6
+ decodeZodType;
7
7
  props;
8
8
  params;
9
- constructor({ encodedZodType, decodedZodType = encodedZodType, props = {}, params = {}, }) {
10
- this.encodedZodType = encodedZodType;
11
- this.decodedZodType = decodedZodType;
9
+ constructor({ encodeZodType, decodeZodType = encodeZodType, props = {}, params = {}, }) {
10
+ this.encodeZodType = encodeZodType;
11
+ this.decodeZodType = decodeZodType;
12
12
  this.props = props;
13
13
  this.params = Object.assign({ checks: [] }, params);
14
14
  }
@@ -38,22 +38,23 @@ export class BaseType {
38
38
  });
39
39
  }
40
40
  meta(newMetadata) {
41
- const metadata = typesRegistry.get(this.encodedZodType) ?? {};
41
+ const metadata = typesRegistry.get(this.encodeZodType) ?? {};
42
42
  Object.assign(metadata, newMetadata);
43
- typesRegistry.add(this.encodedZodType, metadata);
43
+ typesRegistry.add(this.encodeZodType, metadata);
44
44
  return this;
45
45
  }
46
- encode(data) {
47
- return this.encodedZodType.parse(data, { reportInput: true });
46
+ encode(data, context = {}) {
47
+ return this.encodeZodType.parse(data, { reportInput: true, ...context });
48
48
  }
49
- decode(data) {
50
- return this.decodedZodType.parse(data, { reportInput: true });
49
+ decode(data, context = {}) {
50
+ return this.decodeZodType.parse(data, { reportInput: true, ...context });
51
51
  }
52
52
  }
53
53
  export class OptionalType extends BaseType {
54
54
  static factory(type) {
55
55
  return new OptionalType({
56
- encodedZodType: zod.optional(type.encodedZodType),
56
+ encodeZodType: optional(type.encodeZodType),
57
+ decodeZodType: optional(type.decodeZodType),
57
58
  props: { inner: type },
58
59
  });
59
60
  }
@@ -61,7 +62,8 @@ export class OptionalType extends BaseType {
61
62
  export class NullableType extends BaseType {
62
63
  static factory(type) {
63
64
  return new NullableType({
64
- encodedZodType: zod.nullable(type.encodedZodType),
65
+ encodeZodType: nullable(type.encodeZodType),
66
+ decodeZodType: nullable(type.decodeZodType),
65
67
  props: { inner: type },
66
68
  });
67
69
  }
@@ -69,8 +71,8 @@ export class NullableType extends BaseType {
69
71
  export class DefaultType extends BaseType {
70
72
  static factory(type, defaultValue) {
71
73
  return new DefaultType({
72
- encodedZodType: zod._default(type.encodedZodType, type.params.encode?.(defaultValue) ?? defaultValue),
73
- decodedZodType: zod._default(type.decodedZodType, defaultValue),
74
+ encodeZodType: _default(type.encodeZodType, type.params.encode?.(defaultValue) ?? defaultValue),
75
+ decodeZodType: _default(type.decodeZodType, defaultValue),
74
76
  props: { inner: type },
75
77
  });
76
78
  }
@@ -1,6 +1,6 @@
1
- import * as zod from 'zod/mini';
1
+ import type { ZodMiniBoolean } from 'zod/mini';
2
2
  import { BaseType } from './base.ts';
3
- export declare class BooleanType extends BaseType<zod.ZodMiniBoolean<boolean>> {
3
+ export declare class BooleanType extends BaseType<ZodMiniBoolean<boolean>> {
4
4
  static factory(): BooleanType;
5
5
  }
6
6
  export declare const boolean: typeof BooleanType.factory;
@@ -1,8 +1,8 @@
1
- import * as zod from 'zod/mini';
1
+ import { boolean as zodBoolean } 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({ encodedZodType: zod.boolean() });
5
+ return new BooleanType({ encodeZodType: zodBoolean() });
6
6
  }
7
7
  }
8
8
  export const boolean = BooleanType.factory;
@@ -1,15 +1,15 @@
1
- import * as zod from 'zod/mini';
1
+ import type { core, ZodMiniType } from 'zod/mini';
2
2
  import type { SimpleZodType, ZodType } from './base.ts';
3
3
  import { BaseType } from './base.ts';
4
4
  export type CustomTransformFn<I, O> = (value: I) => O;
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
+ export declare abstract class TransformType<Type, EncodeType extends SimpleZodType = ZodMiniType<Type, Type>, DecodeType extends ZodType = ZodMiniType<Type, Type>> extends BaseType<ZodMiniType<EncodeType['_zod']['output'], DecodeType['_zod']['input']>, ZodMiniType<DecodeType['_zod']['output'], EncodeType['_zod']['input']>> {
6
6
  }
7
- export declare class CustomType<Type, EncodedType extends SimpleZodType = zod.ZodMiniType<Type, Type>, DecodedType extends ZodType = zod.ZodMiniType<Type, Type>> extends TransformType<Type, EncodedType, DecodedType> {
8
- static factory<Type, EncodedType extends SimpleZodType = zod.ZodMiniType<Type, Type>, DecodedType extends ZodType = zod.ZodMiniType<Type, Type>>({ decode, encode, error, type, }: {
9
- decode: CustomTransformFn<EncodedType['_zod']['input'], DecodedType['_zod']['output']>;
10
- encode: CustomTransformFn<DecodedType['_zod']['input'], EncodedType['_zod']['output']>;
11
- error?: string | zod.core.$ZodErrorMap<zod.core.$ZodIssueBase>;
12
- type?: EncodedType;
13
- }): CustomType<Type, EncodedType, DecodedType>;
7
+ export declare class CustomType<Type, EncodeType extends SimpleZodType = ZodMiniType<Type, Type>, DecodeType extends ZodType = ZodMiniType<Type, Type>> extends TransformType<Type, EncodeType, DecodeType> {
8
+ static factory<Type, EncodeType extends SimpleZodType = ZodMiniType<Type, Type>, DecodeType extends ZodType = ZodMiniType<Type, Type>>({ decode, encode, error, type, }: {
9
+ decode: CustomTransformFn<EncodeType['_zod']['input'], DecodeType['_zod']['output']>;
10
+ encode: CustomTransformFn<DecodeType['_zod']['input'], EncodeType['_zod']['output']>;
11
+ error?: string | core.$ZodErrorMap<core.$ZodIssueBase>;
12
+ type?: EncodeType;
13
+ }): CustomType<Type, EncodeType, DecodeType>;
14
14
  }
15
15
  export declare const custom: typeof CustomType.factory;
@@ -1,23 +1,14 @@
1
- import * as zod from 'zod/mini';
1
+ import { any, overwrite, pipe, refine, custom as zodCustom } from 'zod/mini';
2
2
  import { BaseType } from "./base.js";
3
3
  export class TransformType extends BaseType {
4
4
  }
5
5
  export class CustomType extends TransformType {
6
- static factory({ decode, encode, error, type = zod.any(), }) {
6
+ static factory({ decode, encode, error, type = any(), }) {
7
7
  return new CustomType({
8
- encodedZodType: zod.pipe(zod.custom().check(zod.refine((val) => typeof val !== 'undefined', {
9
- error,
10
- abort: true,
11
- }), zod.overwrite(encode)), type),
8
+ encodeZodType: pipe(zodCustom().check(refine((val) => typeof val !== 'undefined', { error, abort: true }), overwrite(encode)), type),
9
+ decodeZodType: pipe(type,
12
10
  // @ts-expect-error
13
- decodedZodType: zod.pipe(type,
14
- // @ts-expect-error
15
- zod
16
- .custom()
17
- .check(zod.refine((val) => typeof val !== 'undefined', {
18
- error,
19
- abort: true,
20
- }), zod.overwrite(decode))),
11
+ zodCustom().check(refine((val) => typeof val !== 'undefined', { error, abort: true }), overwrite(decode))),
21
12
  params: { encode },
22
13
  });
23
14
  }
@@ -1,6 +1,7 @@
1
- import * as zod from 'zod/mini';
1
+ import type { ZodMiniUnion } from 'zod/mini';
2
+ import { iso } from 'zod/mini';
2
3
  import { CustomType, TransformType } from './custom.ts';
3
- export declare class DateType extends TransformType<Date, zod.ZodMiniUnion<[zod.iso.ZodMiniISODate, zod.iso.ZodMiniISODateTime]>> {
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>>>;
4
+ export declare class DateType extends TransformType<Date, ZodMiniUnion<[iso.ZodMiniISODate, iso.ZodMiniISODateTime]>> {
5
+ static factory(): CustomType<Date, ZodMiniUnion<[iso.ZodMiniISODate, iso.ZodMiniISODateTime]>, import("zod/mini").ZodMiniType<Date, Date, import("zod/v4/core").$ZodTypeInternals<Date, Date>>>;
5
6
  }
6
7
  export declare const date: typeof DateType.factory;
@@ -1,11 +1,11 @@
1
- import * as zod from 'zod/mini';
1
+ import { iso, union } from 'zod/mini';
2
2
  import { CustomType, TransformType } from "./custom.js";
3
3
  export class DateType extends TransformType {
4
4
  static factory() {
5
5
  return CustomType.factory({
6
6
  decode: (value) => new Date(value),
7
7
  encode: (value) => value.toISOString(),
8
- type: zod.union([zod.iso.date(), zod.iso.datetime()]),
8
+ type: union([iso.date(), iso.datetime()]),
9
9
  });
10
10
  }
11
11
  }
@@ -1,10 +1,10 @@
1
- import * as zod from 'zod/mini';
1
+ import type { core, ZodMiniEnum } from 'zod/mini';
2
2
  import { BaseType } from './base.ts';
3
- export declare class EnumType<T extends zod.core.util.EnumLike = zod.core.util.EnumLike> extends BaseType<zod.ZodMiniEnum<T>, zod.ZodMiniEnum<T>, {
3
+ export declare class EnumType<T extends core.util.EnumLike = core.util.EnumLike> extends BaseType<ZodMiniEnum<T>, ZodMiniEnum<T>, {
4
4
  values: T;
5
5
  }> {
6
- static factory<T extends zod.core.util.EnumLike>(values: T): EnumType<T>;
7
- static factory<T extends string[]>(values: T): EnumType<zod.core.util.ToEnum<T[number]>>;
6
+ static factory<T extends core.util.EnumLike>(values: T): EnumType<T>;
7
+ static factory<T extends string[]>(values: T): EnumType<core.util.ToEnum<T[number]>>;
8
8
  }
9
9
  declare const _enum: typeof EnumType.factory;
10
10
  export { _enum as enum };
@@ -1,9 +1,9 @@
1
- import * as zod from 'zod/mini';
1
+ import { enum as zodEnum } from 'zod/mini';
2
2
  import { BaseType } from "./base.js";
3
3
  export class EnumType extends BaseType {
4
4
  static factory(values) {
5
5
  return new EnumType({
6
- encodedZodType: zod.enum(values),
6
+ encodeZodType: zodEnum(values),
7
7
  props: { values },
8
8
  });
9
9
  }
@@ -1,7 +1,7 @@
1
- import * as zod from 'zod/mini';
1
+ import type { ZodMiniLiteral } from 'zod/mini';
2
2
  import type { PrimitiveValueType } from './base.ts';
3
3
  import { BaseType } from './base.ts';
4
- export declare class LiteralType<T extends PrimitiveValueType = PrimitiveValueType> extends BaseType<zod.ZodMiniLiteral<T>, zod.ZodMiniLiteral<T>, {
4
+ export declare class LiteralType<T extends PrimitiveValueType = PrimitiveValueType> extends BaseType<ZodMiniLiteral<T>, ZodMiniLiteral<T>, {
5
5
  value: T;
6
6
  }> {
7
7
  static factory<T extends PrimitiveValueType>(value: T): LiteralType<T>;
@@ -1,9 +1,9 @@
1
- import * as zod from 'zod/mini';
1
+ import { literal as zodLiteral } from 'zod/mini';
2
2
  import { BaseType } from "./base.js";
3
3
  export class LiteralType extends BaseType {
4
4
  static factory(value) {
5
5
  return new LiteralType({
6
- encodedZodType: zod.literal(value),
6
+ encodeZodType: zodLiteral(value),
7
7
  props: { value },
8
8
  });
9
9
  }
@@ -1,6 +1,6 @@
1
- import * as zod from 'zod/mini';
1
+ import type { ZodMiniNever } from 'zod/mini';
2
2
  import { BaseType } from './base.ts';
3
- export declare class NeverType extends BaseType<zod.ZodMiniNever> {
3
+ export declare class NeverType extends BaseType<ZodMiniNever> {
4
4
  static factory(): NeverType;
5
5
  }
6
6
  export declare const never: typeof NeverType.factory;
@@ -1,8 +1,8 @@
1
- import * as zod from 'zod/mini';
1
+ import { never as zodNever } 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({ encodedZodType: zod.never() });
5
+ return new NeverType({ encodeZodType: zodNever() });
6
6
  }
7
7
  }
8
8
  export const never = NeverType.factory;
@@ -1,8 +1,8 @@
1
- import * as zod from 'zod/mini';
1
+ import type { core, ZodMiniNumber, ZodMiniString } from 'zod/mini';
2
2
  import { BaseType } from './base.ts';
3
3
  import { CustomType, TransformType } from './custom.ts';
4
- type Check = zod.core.CheckFn<number> | zod.core.$ZodCheck<number>;
5
- export declare class NumberType extends BaseType<zod.ZodMiniNumber<number>, zod.ZodMiniNumber<number>> {
4
+ type Check = core.CheckFn<number> | core.$ZodCheck<number>;
5
+ export declare class NumberType extends BaseType<ZodMiniNumber<number>, ZodMiniNumber<number>> {
6
6
  static factory(...checks: Check[]): NumberType;
7
7
  positive(): NumberType;
8
8
  negative(): NumberType;
@@ -14,8 +14,8 @@ export declare class NumberType extends BaseType<zod.ZodMiniNumber<number>, zod.
14
14
  export declare class IntegerType extends NumberType {
15
15
  static factory(...checks: Check[]): NumberType;
16
16
  }
17
- export declare class BigIntType extends TransformType<bigint, zod.ZodMiniString<string>> {
18
- static factory(): CustomType<bigint, zod.ZodMiniString<string>, zod.ZodMiniType<bigint, bigint, zod.z.core.$ZodTypeInternals<bigint, bigint>>>;
17
+ export declare class BigIntType extends TransformType<bigint, ZodMiniString<string>> {
18
+ static factory(): CustomType<bigint, ZodMiniString<string>, import("zod/mini").ZodMiniType<bigint, bigint, core.$ZodTypeInternals<bigint, bigint>>>;
19
19
  }
20
20
  export declare const number: typeof NumberType.factory;
21
21
  export declare const integer: typeof IntegerType.factory;
@@ -1,35 +1,35 @@
1
- import * as zod from 'zod/mini';
1
+ import { gt, gte, int, lt, lte, regex, number as zodNumber, string as zodString, } from 'zod/mini';
2
2
  import { BaseType } from "./base.js";
3
3
  import { CustomType, TransformType } from "./custom.js";
4
4
  export class NumberType extends BaseType {
5
5
  static factory(...checks) {
6
6
  return new NumberType({
7
- encodedZodType: zod.number().check(...checks),
7
+ encodeZodType: zodNumber().check(...checks),
8
8
  params: { checks },
9
9
  });
10
10
  }
11
11
  positive() {
12
- return NumberType.factory(...this.params.checks, zod.gte(0));
12
+ return NumberType.factory(...this.params.checks, gte(0));
13
13
  }
14
14
  negative() {
15
- return NumberType.factory(...this.params.checks, zod.lte(0));
15
+ return NumberType.factory(...this.params.checks, lte(0));
16
16
  }
17
17
  lt(value) {
18
- return NumberType.factory(...this.params.checks, zod.lt(value));
18
+ return NumberType.factory(...this.params.checks, lt(value));
19
19
  }
20
20
  lte(value) {
21
- return NumberType.factory(...this.params.checks, zod.lte(value));
21
+ return NumberType.factory(...this.params.checks, lte(value));
22
22
  }
23
23
  gte(value) {
24
- return NumberType.factory(...this.params.checks, zod.gte(value));
24
+ return NumberType.factory(...this.params.checks, gte(value));
25
25
  }
26
26
  gt(value) {
27
- return NumberType.factory(...this.params.checks, zod.gt(value));
27
+ return NumberType.factory(...this.params.checks, gt(value));
28
28
  }
29
29
  }
30
30
  export class IntegerType extends NumberType {
31
31
  static factory(...checks) {
32
- return NumberType.factory(...checks, zod.int());
32
+ return NumberType.factory(...checks, int());
33
33
  }
34
34
  }
35
35
  export class BigIntType extends TransformType {
@@ -37,7 +37,7 @@ export class BigIntType extends TransformType {
37
37
  return CustomType.factory({
38
38
  decode: (value) => BigInt(value),
39
39
  encode: (value) => value.toString(),
40
- type: zod.string().check(zod.regex(/^-?\d+$/)),
40
+ type: zodString().check(regex(/^-?\d+$/)),
41
41
  error: 'Invalid bigint format',
42
42
  });
43
43
  }
@@ -1,4 +1,4 @@
1
- import * as zod from 'zod/mini';
1
+ import type { core, ZodMiniObject, ZodMiniRecord } from 'zod/mini';
2
2
  import type { BaseTypeAny, OptionalType } from './base.ts';
3
3
  import type { LiteralType } from './literal.ts';
4
4
  import type { StringType } from './string.ts';
@@ -8,19 +8,19 @@ export type ObjectTypeProps = {
8
8
  [k: string]: BaseTypeAny;
9
9
  };
10
10
  export type AnyObjectType = ObjectType<ObjectTypeProps>;
11
- export declare class ObjectType<T extends ObjectTypeProps = {}> extends BaseType<zod.ZodMiniObject<{
12
- [K in keyof T]: T[K]['encodedZodType'];
13
- }, zod.core.$strict>, zod.ZodMiniObject<{
14
- [K in keyof T]: T[K]['decodedZodType'];
15
- }, zod.core.$strict>, {
11
+ export declare class ObjectType<T extends ObjectTypeProps = {}> extends BaseType<ZodMiniObject<{
12
+ [K in keyof T]: T[K]['encodeZodType'];
13
+ }, core.$strict>, ZodMiniObject<{
14
+ [K in keyof T]: T[K]['decodeZodType'];
15
+ }, core.$strict>, {
16
16
  properties: T;
17
17
  }> {
18
18
  static factory<T extends ObjectTypeProps = {}>(properties: T): ObjectType<T>;
19
19
  }
20
- export declare class RecordType<K extends LiteralType<string | number> | EnumType | StringType, E extends BaseType> extends BaseType<zod.ZodMiniRecord<K['encodedZodType'], E['encodedZodType']>, zod.ZodMiniRecord<K['decodedZodType'], E['decodedZodType']>> {
20
+ export declare class RecordType<K extends LiteralType<string | number> | EnumType | StringType, E extends BaseType> extends BaseType<ZodMiniRecord<K['encodeZodType'], E['encodeZodType']>, ZodMiniRecord<K['decodeZodType'], E['decodeZodType']>> {
21
21
  static factory<K extends LiteralType<string | number> | EnumType | StringType, E extends BaseType>(key: K, element: E): RecordType<K, E>;
22
22
  }
23
- export declare function keyof<T extends ObjectType>(type: T): EnumType<zod.core.util.ToEnum<Extract<keyof T['props']['properties'], string>>>;
23
+ export declare function keyof<T extends ObjectType>(type: T): EnumType<core.util.ToEnum<Extract<keyof T['props']['properties'], string>>>;
24
24
  export declare function pick<T extends AnyObjectType, P extends {
25
25
  [K in keyof T['props']['properties']]?: true;
26
26
  }>(source: T, pick: P): ObjectType<{
@@ -1,4 +1,4 @@
1
- import * as zod from 'zod/mini';
1
+ import { object as zodObject, record as zodRecord } from 'zod/mini';
2
2
  import { BaseType } from "./base.js";
3
3
  import { EnumType } from "./enum.js";
4
4
  export class ObjectType extends BaseType {
@@ -6,12 +6,12 @@ export class ObjectType extends BaseType {
6
6
  const encodeProperties = {};
7
7
  const decodeProperties = {};
8
8
  for (const key in properties) {
9
- encodeProperties[key] = properties[key].encodedZodType;
10
- decodeProperties[key] = properties[key].decodedZodType;
9
+ encodeProperties[key] = properties[key].encodeZodType;
10
+ decodeProperties[key] = properties[key].decodeZodType;
11
11
  }
12
12
  return new ObjectType({
13
- encodedZodType: zod.object(encodeProperties),
14
- decodedZodType: zod.object(decodeProperties),
13
+ encodeZodType: zodObject(encodeProperties),
14
+ decodeZodType: zodObject(decodeProperties),
15
15
  props: { properties },
16
16
  });
17
17
  }
@@ -19,8 +19,8 @@ export class ObjectType extends BaseType {
19
19
  export class RecordType extends BaseType {
20
20
  static factory(key, element) {
21
21
  return new RecordType({
22
- encodedZodType: zod.record(key.encodedZodType, element.encodedZodType),
23
- decodedZodType: zod.record(key.decodedZodType, element.decodedZodType),
22
+ encodeZodType: zodRecord(key.encodeZodType, element.encodeZodType),
23
+ decodeZodType: zodRecord(key.decodeZodType, element.decodeZodType),
24
24
  props: { key, element },
25
25
  });
26
26
  }
@@ -1,22 +1,22 @@
1
- import * as zod from 'zod/mini';
1
+ import type { core, ZodMiniString } from 'zod/mini';
2
2
  import { BaseType } from './base.ts';
3
- type Check = zod.core.CheckFn<string> | zod.core.$ZodCheck<string>;
4
- export declare class StringType extends BaseType<zod.ZodMiniString<string>, zod.ZodMiniString<string>> {
3
+ type Check = core.CheckFn<string> | core.$ZodCheck<string>;
4
+ export declare class StringType extends BaseType<ZodMiniString<string>, ZodMiniString<string>> {
5
5
  static factory(...checks: Check[]): StringType;
6
6
  max(value: number): StringType;
7
7
  min(value: number): StringType;
8
8
  pattern(pattern: string | RegExp): StringType;
9
- email(options?: zod.core.$ZodEmailParams): StringType;
10
- url(options?: zod.core.$ZodURLParams): StringType;
11
- ipv4(options?: zod.core.$ZodIPv4Params): StringType;
12
- ipv6(options?: zod.core.$ZodIPv6Params): StringType;
13
- uuid(options?: zod.core.$ZodUUIDParams): StringType;
14
- emoji(options?: zod.core.$ZodEmojiParams): StringType;
15
- nanoid(options?: zod.core.$ZodNanoIDParams): StringType;
16
- cuid(options?: zod.core.$ZodCUIDParams): StringType;
17
- cuid2(options?: zod.core.$ZodCUID2Params): StringType;
18
- e164(options?: zod.core.$ZodE164Params): StringType;
19
- jwt(options?: zod.core.$ZodJWTParams): StringType;
9
+ email(options?: core.$ZodEmailParams): StringType;
10
+ url(options?: core.$ZodURLParams): StringType;
11
+ ipv4(options?: core.$ZodIPv4Params): StringType;
12
+ ipv6(options?: core.$ZodIPv6Params): StringType;
13
+ uuid(options?: core.$ZodUUIDParams): StringType;
14
+ emoji(options?: core.$ZodEmojiParams): StringType;
15
+ nanoid(options?: core.$ZodNanoIDParams): StringType;
16
+ cuid(options?: core.$ZodCUIDParams): StringType;
17
+ cuid2(options?: core.$ZodCUID2Params): StringType;
18
+ e164(options?: core.$ZodE164Params): StringType;
19
+ jwt(options?: core.$ZodJWTParams): StringType;
20
20
  }
21
21
  export declare const string: typeof StringType.factory;
22
22
  export {};
@@ -1,53 +1,53 @@
1
- import * as zod from 'zod/mini';
1
+ import { cuid, cuid2, e164, email, emoji, ipv4, ipv6, jwt, maxLength, minLength, nanoid, regex, url, uuid, string as zodString, } from 'zod/mini';
2
2
  import { BaseType } from "./base.js";
3
3
  export class StringType extends BaseType {
4
4
  static factory(...checks) {
5
5
  return new StringType({
6
- encodedZodType: zod.string().check(...checks),
6
+ encodeZodType: zodString().check(...checks),
7
7
  params: { checks },
8
8
  });
9
9
  }
10
10
  max(value) {
11
- return StringType.factory(...this.params.checks, zod.maxLength(value));
11
+ return StringType.factory(...this.params.checks, maxLength(value));
12
12
  }
13
13
  min(value) {
14
- return StringType.factory(...this.params.checks, zod.minLength(value));
14
+ return StringType.factory(...this.params.checks, minLength(value));
15
15
  }
16
16
  pattern(pattern) {
17
- return StringType.factory(...this.params.checks, zod.regex(typeof pattern === 'string' ? new RegExp(pattern) : pattern));
17
+ return StringType.factory(...this.params.checks, regex(typeof pattern === 'string' ? new RegExp(pattern) : pattern));
18
18
  }
19
19
  email(options) {
20
- return StringType.factory(...this.params.checks, zod.email(options));
20
+ return StringType.factory(...this.params.checks, email(options));
21
21
  }
22
22
  url(options) {
23
- return StringType.factory(...this.params.checks, zod.url(options));
23
+ return StringType.factory(...this.params.checks, url(options));
24
24
  }
25
25
  ipv4(options) {
26
- return StringType.factory(...this.params.checks, zod.ipv4(options));
26
+ return StringType.factory(...this.params.checks, ipv4(options));
27
27
  }
28
28
  ipv6(options) {
29
- return StringType.factory(...this.params.checks, zod.ipv6(options));
29
+ return StringType.factory(...this.params.checks, ipv6(options));
30
30
  }
31
31
  uuid(options) {
32
- return StringType.factory(...this.params.checks, zod.uuid(options));
32
+ return StringType.factory(...this.params.checks, uuid(options));
33
33
  }
34
34
  emoji(options) {
35
- return StringType.factory(...this.params.checks, zod.emoji(options));
35
+ return StringType.factory(...this.params.checks, emoji(options));
36
36
  }
37
37
  nanoid(options) {
38
- return StringType.factory(...this.params.checks, zod.nanoid(options));
38
+ return StringType.factory(...this.params.checks, nanoid(options));
39
39
  }
40
40
  cuid(options) {
41
- return StringType.factory(...this.params.checks, zod.cuid(options));
41
+ return StringType.factory(...this.params.checks, cuid(options));
42
42
  }
43
43
  cuid2(options) {
44
- return StringType.factory(...this.params.checks, zod.cuid2(options));
44
+ return StringType.factory(...this.params.checks, cuid2(options));
45
45
  }
46
46
  e164(options) {
47
- return StringType.factory(...this.params.checks, zod.e164(options));
47
+ return StringType.factory(...this.params.checks, e164(options));
48
48
  }
49
49
  jwt(options) {
50
- return StringType.factory(...this.params.checks, zod.jwt(options));
50
+ return StringType.factory(...this.params.checks, jwt(options));
51
51
  }
52
52
  }
53
53
  export const string = StringType.factory;
@@ -6,34 +6,34 @@ type TemporalTransformer<T extends Types> = {
6
6
  decode: (value: string) => ReturnType<(typeof Temporal)[T]['from']>;
7
7
  encode: (value: ReturnType<(typeof Temporal)[T]['from']>) => string;
8
8
  };
9
- type EncodedType = ZodMiniString<string>;
10
- export declare class PlainDateType extends TransformType<Temporal.PlainDate, EncodedType> {
9
+ type EncodeType = ZodMiniString<string>;
10
+ export declare class PlainDateType extends TransformType<Temporal.PlainDate, EncodeType> {
11
11
  static transformer: TemporalTransformer<"PlainDate">;
12
- static factory(): CustomType<Temporal.PlainDate, EncodedType, import("zod/mini").ZodMiniType<Temporal.PlainDate, Temporal.PlainDate, import("zod/v4/core").$ZodTypeInternals<Temporal.PlainDate, Temporal.PlainDate>>>;
12
+ static factory(): CustomType<Temporal.PlainDate, EncodeType, import("zod/mini").ZodMiniType<Temporal.PlainDate, Temporal.PlainDate, import("zod/v4/core").$ZodTypeInternals<Temporal.PlainDate, Temporal.PlainDate>>>;
13
13
  }
14
- export declare class PlainDateTimeType extends TransformType<Temporal.PlainDateTime, EncodedType> {
14
+ export declare class PlainDateTimeType extends TransformType<Temporal.PlainDateTime, EncodeType> {
15
15
  static transformer: TemporalTransformer<"PlainDateTime">;
16
- static factory(): CustomType<Temporal.PlainDateTime, EncodedType, import("zod/mini").ZodMiniType<Temporal.PlainDateTime, Temporal.PlainDateTime, import("zod/v4/core").$ZodTypeInternals<Temporal.PlainDateTime, Temporal.PlainDateTime>>>;
16
+ static factory(): CustomType<Temporal.PlainDateTime, EncodeType, import("zod/mini").ZodMiniType<Temporal.PlainDateTime, Temporal.PlainDateTime, import("zod/v4/core").$ZodTypeInternals<Temporal.PlainDateTime, Temporal.PlainDateTime>>>;
17
17
  }
18
- export declare class ZonedDateTimeType extends TransformType<Temporal.ZonedDateTime, EncodedType> {
18
+ export declare class ZonedDateTimeType extends TransformType<Temporal.ZonedDateTime, EncodeType> {
19
19
  static transformer: TemporalTransformer<"ZonedDateTime">;
20
- static factory(): CustomType<Temporal.ZonedDateTime, EncodedType, import("zod/mini").ZodMiniType<Temporal.ZonedDateTime, Temporal.ZonedDateTime, import("zod/v4/core").$ZodTypeInternals<Temporal.ZonedDateTime, Temporal.ZonedDateTime>>>;
20
+ static factory(): CustomType<Temporal.ZonedDateTime, EncodeType, import("zod/mini").ZodMiniType<Temporal.ZonedDateTime, Temporal.ZonedDateTime, import("zod/v4/core").$ZodTypeInternals<Temporal.ZonedDateTime, Temporal.ZonedDateTime>>>;
21
21
  }
22
- export declare class PlainTimeType extends TransformType<Temporal.PlainTime, EncodedType> {
22
+ export declare class PlainTimeType extends TransformType<Temporal.PlainTime, EncodeType> {
23
23
  static transformer: TemporalTransformer<"PlainTime">;
24
- static factory(): CustomType<Temporal.PlainTime, EncodedType, import("zod/mini").ZodMiniType<Temporal.PlainTime, Temporal.PlainTime, import("zod/v4/core").$ZodTypeInternals<Temporal.PlainTime, Temporal.PlainTime>>>;
24
+ static factory(): CustomType<Temporal.PlainTime, EncodeType, import("zod/mini").ZodMiniType<Temporal.PlainTime, Temporal.PlainTime, import("zod/v4/core").$ZodTypeInternals<Temporal.PlainTime, Temporal.PlainTime>>>;
25
25
  }
26
- export declare class DurationType extends TransformType<Temporal.Duration, EncodedType> {
26
+ export declare class DurationType extends TransformType<Temporal.Duration, EncodeType> {
27
27
  static transformer: TemporalTransformer<"Duration">;
28
- static factory(): CustomType<Temporal.Duration, EncodedType, import("zod/mini").ZodMiniType<Temporal.Duration, Temporal.Duration, import("zod/v4/core").$ZodTypeInternals<Temporal.Duration, Temporal.Duration>>>;
28
+ static factory(): CustomType<Temporal.Duration, EncodeType, import("zod/mini").ZodMiniType<Temporal.Duration, Temporal.Duration, import("zod/v4/core").$ZodTypeInternals<Temporal.Duration, Temporal.Duration>>>;
29
29
  }
30
- export declare class PlainYearMonthType extends TransformType<Temporal.PlainYearMonth, EncodedType> {
30
+ export declare class PlainYearMonthType extends TransformType<Temporal.PlainYearMonth, EncodeType> {
31
31
  static transformer: TemporalTransformer<"PlainYearMonth">;
32
- static factory(): CustomType<Temporal.PlainYearMonth, EncodedType, import("zod/mini").ZodMiniType<Temporal.PlainYearMonth, Temporal.PlainYearMonth, import("zod/v4/core").$ZodTypeInternals<Temporal.PlainYearMonth, Temporal.PlainYearMonth>>>;
32
+ static factory(): CustomType<Temporal.PlainYearMonth, EncodeType, import("zod/mini").ZodMiniType<Temporal.PlainYearMonth, Temporal.PlainYearMonth, import("zod/v4/core").$ZodTypeInternals<Temporal.PlainYearMonth, Temporal.PlainYearMonth>>>;
33
33
  }
34
- export declare class PlainMonthDayType extends TransformType<Temporal.PlainMonthDay, EncodedType> {
34
+ export declare class PlainMonthDayType extends TransformType<Temporal.PlainMonthDay, EncodeType> {
35
35
  static transformer: TemporalTransformer<"PlainMonthDay">;
36
- static factory(): CustomType<Temporal.PlainMonthDay, EncodedType, import("zod/mini").ZodMiniType<Temporal.PlainMonthDay, Temporal.PlainMonthDay, import("zod/v4/core").$ZodTypeInternals<Temporal.PlainMonthDay, Temporal.PlainMonthDay>>>;
36
+ static factory(): CustomType<Temporal.PlainMonthDay, EncodeType, 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;
@@ -1,10 +1,10 @@
1
1
  import type { ArrayMap } from '@nmtjs/common';
2
- import * as zod from 'zod/mini';
2
+ import type { ZodMiniTuple } from 'zod/mini';
3
3
  import { BaseType } from './base.ts';
4
4
  export declare class TupleType<T extends readonly [BaseType, ...BaseType[]] = readonly [
5
5
  BaseType,
6
6
  ...BaseType[]
7
- ], R extends BaseType | null = BaseType | null> extends BaseType<R extends BaseType ? zod.ZodMiniTuple<ArrayMap<T, 'encodedZodType'>, R['encodedZodType']> : zod.ZodMiniTuple<ArrayMap<T, 'encodedZodType'>, null>, R extends BaseType ? zod.ZodMiniTuple<ArrayMap<T, 'decodedZodType'>, R['decodedZodType']> : zod.ZodMiniTuple<ArrayMap<T, 'decodedZodType'>, null>, {
7
+ ], R extends BaseType | null = BaseType | null> extends BaseType<R extends BaseType ? ZodMiniTuple<ArrayMap<T, 'encodeZodType'>, R['encodeZodType']> : ZodMiniTuple<ArrayMap<T, 'encodeZodType'>, null>, R extends BaseType ? ZodMiniTuple<ArrayMap<T, 'decodeZodType'>, R['decodeZodType']> : ZodMiniTuple<ArrayMap<T, 'decodeZodType'>, null>, {
8
8
  elements: T;
9
9
  rest?: R;
10
10
  }> {
@@ -1,14 +1,14 @@
1
- import * as zod from 'zod/mini';
1
+ import { tuple as zodTuple } from 'zod/mini';
2
2
  import { BaseType } from "./base.js";
3
3
  export class TupleType extends BaseType {
4
4
  static factory(elements, rest = null) {
5
- const encoded = elements.map((el) => el.encodedZodType);
6
- const decoded = elements.map((el) => el.decodedZodType);
5
+ const encode = elements.map((el) => el.encodeZodType);
6
+ const decode = elements.map((el) => el.decodeZodType);
7
7
  return new TupleType({
8
8
  // @ts-expect-error
9
- encodedZodType: zod.tuple(encoded, rest?.encodedZodType),
9
+ encodeZodType: zodTuple(encode, rest?.encodeZodType),
10
10
  // @ts-expect-error
11
- decodedZodType: zod.tuple(decoded, rest?.decodedZodType),
11
+ decodeZodType: zodTuple(decode, rest?.decodeZodType),
12
12
  props: { elements, rest },
13
13
  });
14
14
  }
@@ -1,5 +1,5 @@
1
1
  import type { ArrayMap } from '@nmtjs/common';
2
- import * as zod from 'zod/mini';
2
+ import type { ZodMiniDiscriminatedUnion, ZodMiniIntersection, ZodMiniUnion } from 'zod/mini';
3
3
  import type { BaseTypeAny } from './base.ts';
4
4
  import type { LiteralType } from './literal.ts';
5
5
  import type { ObjectType, ObjectTypeProps } from './object.ts';
@@ -7,7 +7,7 @@ import { BaseType } from './base.ts';
7
7
  export declare class UnionType<T extends readonly [BaseType, ...BaseType[]] = readonly [
8
8
  BaseType,
9
9
  ...BaseType[]
10
- ]> extends BaseType<zod.ZodMiniUnion<ArrayMap<T, 'encodedZodType'>>, zod.ZodMiniUnion<ArrayMap<T, 'decodedZodType'>>, {
10
+ ]> extends BaseType<ZodMiniUnion<ArrayMap<T, 'encodeZodType'>>, ZodMiniUnion<ArrayMap<T, 'decodeZodType'>>, {
11
11
  options: T;
12
12
  }> {
13
13
  static factory<T extends readonly [BaseType, ...BaseType[]] = readonly [
@@ -15,7 +15,7 @@ export declare class UnionType<T extends readonly [BaseType, ...BaseType[]] = re
15
15
  ...BaseType[]
16
16
  ]>(...options: T): UnionType<T>;
17
17
  }
18
- export declare class IntersactionType<T extends readonly [BaseType, BaseType] = readonly [BaseType, BaseType]> extends BaseType<zod.ZodMiniIntersection<T[0]['encodedZodType'], T[1]['encodedZodType']>, zod.ZodMiniIntersection<T[0]['decodedZodType'], T[1]['decodedZodType']>, {
18
+ export declare class IntersactionType<T extends readonly [BaseType, BaseType] = readonly [BaseType, BaseType]> extends BaseType<ZodMiniIntersection<T[0]['encodeZodType'], T[1]['encodeZodType']>, ZodMiniIntersection<T[0]['decodeZodType'], T[1]['decodeZodType']>, {
19
19
  options: T;
20
20
  }> {
21
21
  static factory<T extends readonly [BaseType, BaseType] = readonly [BaseType, BaseType]>(...options: T): IntersactionType<T>;
@@ -28,7 +28,7 @@ export type DiscriminatedUnionProperties<K extends string = string> = {
28
28
  export type DiscriminatedUnionOptionType<K extends string> = ObjectType<ObjectTypeProps & {
29
29
  [_ in K]: BaseTypeAny;
30
30
  }>;
31
- export declare class DiscriminatedUnionType<K extends string = string, T extends readonly DiscriminatedUnionOptionType<K>[] = DiscriminatedUnionOptionType<K>[]> extends BaseType<zod.ZodMiniDiscriminatedUnion<ArrayMap<T, 'encodedZodType'>>, zod.ZodMiniDiscriminatedUnion<ArrayMap<T, 'decodedZodType'>>, {
31
+ export declare class DiscriminatedUnionType<K extends string = string, T extends readonly DiscriminatedUnionOptionType<K>[] = DiscriminatedUnionOptionType<K>[]> extends BaseType<ZodMiniDiscriminatedUnion<ArrayMap<T, 'encodeZodType'>>, ZodMiniDiscriminatedUnion<ArrayMap<T, 'decodeZodType'>>, {
32
32
  key: K;
33
33
  options: T;
34
34
  }> {
@@ -1,12 +1,12 @@
1
- import * as zod from 'zod/mini';
1
+ import { discriminatedUnion as zodDiscriminatedUnion, intersection as zodIntersection, union as zodUnion, } from 'zod/mini';
2
2
  import { BaseType } from "./base.js";
3
3
  export class UnionType extends BaseType {
4
4
  static factory(...options) {
5
- const encoded = options.map((t) => t.encodedZodType);
6
- const decoded = options.map((t) => t.decodedZodType);
5
+ const encode = options.map((t) => t.encodeZodType);
6
+ const decode = options.map((t) => t.decodeZodType);
7
7
  return new UnionType({
8
- encodedZodType: zod.union(encoded),
9
- decodedZodType: zod.union(decoded),
8
+ encodeZodType: zodUnion(encode),
9
+ decodeZodType: zodUnion(decode),
10
10
  props: { options },
11
11
  });
12
12
  }
@@ -15,21 +15,21 @@ export class IntersactionType extends BaseType {
15
15
  static factory(...options) {
16
16
  const [first, second] = options;
17
17
  return new IntersactionType({
18
- encodedZodType: zod.intersection(first.encodedZodType, second.encodedZodType),
19
- decodedZodType: zod.intersection(first.decodedZodType, second.decodedZodType),
18
+ encodeZodType: zodIntersection(first.encodeZodType, second.encodeZodType),
19
+ decodeZodType: zodIntersection(first.decodeZodType, second.decodeZodType),
20
20
  props: { options },
21
21
  });
22
22
  }
23
23
  }
24
24
  export class DiscriminatedUnionType extends BaseType {
25
25
  static factory(key, ...options) {
26
- const encoded = options.map((t) => t.encodedZodType);
27
- const decoded = options.map((t) => t.decodedZodType);
26
+ const encode = options.map((t) => t.encodeZodType);
27
+ const decode = options.map((t) => t.decodeZodType);
28
28
  return new DiscriminatedUnionType({
29
29
  // @ts-expect-error
30
- encodedZodType: zod.discriminatedUnion(key, encoded),
30
+ encodeZodType: zodDiscriminatedUnion(key, encode),
31
31
  // @ts-expect-error
32
- decodedZodType: zod.discriminatedUnion(key, decoded),
32
+ decodeZodType: zodDiscriminatedUnion(key, decode),
33
33
  props: { key, options },
34
34
  });
35
35
  }
package/package.json CHANGED
@@ -21,19 +21,19 @@
21
21
  "peerDependencies": {
22
22
  "temporal-polyfill": "^0.3.0",
23
23
  "zod": "^4.0.0",
24
- "@nmtjs/common": "0.14.0"
24
+ "@nmtjs/common": "0.14.2"
25
25
  },
26
26
  "devDependencies": {
27
27
  "temporal-polyfill": "^0.3.0",
28
28
  "zod": "^4.0.0",
29
- "@nmtjs/common": "0.14.0"
29
+ "@nmtjs/common": "0.14.2"
30
30
  },
31
31
  "files": [
32
32
  "dist",
33
33
  "LICENSE.md",
34
34
  "README.md"
35
35
  ],
36
- "version": "0.14.0",
36
+ "version": "0.14.2",
37
37
  "scripts": {
38
38
  "build": "tsc",
39
39
  "type-check": "tsc --noEmit"
File without changes