@nmtjs/type 0.12.4 → 0.12.6

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.
Files changed (55) hide show
  1. package/dist/index.d.ts +4 -0
  2. package/dist/index.js +1 -3
  3. package/dist/temporal.d.ts +1 -0
  4. package/dist/temporal.js +0 -2
  5. package/dist/types/any.d.ts +6 -0
  6. package/dist/types/any.js +6 -6
  7. package/dist/types/array.d.ts +13 -0
  8. package/dist/types/array.js +21 -23
  9. package/dist/types/base.d.ts +62 -0
  10. package/dist/types/base.js +67 -65
  11. package/dist/types/boolean.d.ts +6 -0
  12. package/dist/types/boolean.js +6 -6
  13. package/dist/types/custom.d.ts +14 -0
  14. package/dist/types/custom.js +21 -21
  15. package/dist/types/date.d.ts +6 -0
  16. package/dist/types/date.js +8 -10
  17. package/dist/types/enum.d.ts +10 -0
  18. package/dist/types/enum.js +7 -9
  19. package/dist/types/literal.d.ts +8 -0
  20. package/dist/types/literal.js +7 -9
  21. package/dist/types/never.d.ts +6 -0
  22. package/dist/types/never.js +6 -6
  23. package/dist/types/number.d.ts +23 -0
  24. package/dist/types/number.js +36 -38
  25. package/dist/types/object.d.ts +43 -0
  26. package/dist/types/object.js +39 -44
  27. package/dist/types/string.d.ts +22 -0
  28. package/dist/types/string.js +49 -51
  29. package/dist/types/temporal.d.ts +45 -0
  30. package/dist/types/temporal.js +74 -76
  31. package/dist/types/tuple.d.ts +13 -0
  32. package/dist/types/tuple.js +12 -15
  33. package/dist/types/type.d.ts +24 -0
  34. package/dist/types/type.js +0 -2
  35. package/dist/types/union.d.ts +40 -0
  36. package/dist/types/union.js +29 -32
  37. package/package.json +8 -6
  38. package/dist/index.js.map +0 -1
  39. package/dist/temporal.js.map +0 -1
  40. package/dist/types/any.js.map +0 -1
  41. package/dist/types/array.js.map +0 -1
  42. package/dist/types/base.js.map +0 -1
  43. package/dist/types/boolean.js.map +0 -1
  44. package/dist/types/custom.js.map +0 -1
  45. package/dist/types/date.js.map +0 -1
  46. package/dist/types/enum.js.map +0 -1
  47. package/dist/types/literal.js.map +0 -1
  48. package/dist/types/never.js.map +0 -1
  49. package/dist/types/number.js.map +0 -1
  50. package/dist/types/object.js.map +0 -1
  51. package/dist/types/string.js.map +0 -1
  52. package/dist/types/temporal.js.map +0 -1
  53. package/dist/types/tuple.js.map +0 -1
  54. package/dist/types/type.js.map +0 -1
  55. package/dist/types/union.js.map +0 -1
@@ -0,0 +1,4 @@
1
+ import * as type from './types/type.ts';
2
+ export * from './types/base.ts';
3
+ export { type, type as t };
4
+ export default type;
package/dist/index.js CHANGED
@@ -1,8 +1,6 @@
1
- import * as zod from "zod/v4-mini";
1
+ import * as zod from 'zod/v4-mini';
2
2
  import * as type from "./types/type.js";
3
3
  zod.config(zod.core.locales.en());
4
4
  export * from "./types/base.js";
5
5
  export { type, type as t };
6
6
  export default type;
7
-
8
- //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ export * from './types/temporal.ts';
package/dist/temporal.js CHANGED
@@ -1,3 +1 @@
1
1
  export * from "./types/temporal.js";
2
-
3
- //# sourceMappingURL=temporal.js.map
@@ -0,0 +1,6 @@
1
+ import * as zod from 'zod/v4-mini';
2
+ import { BaseType } from './base.ts';
3
+ export declare class AnyType extends BaseType<zod.ZodMiniAny> {
4
+ static factory(): AnyType;
5
+ }
6
+ export declare const any: typeof AnyType.factory;
package/dist/types/any.js CHANGED
@@ -1,10 +1,10 @@
1
- import * as zod from "zod/v4-mini";
1
+ import * as zod from 'zod/v4-mini';
2
2
  import { BaseType } from "./base.js";
3
3
  export class AnyType extends BaseType {
4
- static factory() {
5
- return new AnyType({ encodedZodType: zod.any() });
6
- }
4
+ static factory() {
5
+ return new AnyType({
6
+ encodedZodType: zod.any(),
7
+ });
8
+ }
7
9
  }
8
10
  export const any = AnyType.factory;
9
-
10
- //# sourceMappingURL=any.js.map
@@ -0,0 +1,13 @@
1
+ import * as zod from 'zod/v4-mini';
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']>, {
5
+ element: T;
6
+ }> {
7
+ static factory<T extends BaseType>(element: T, ...checks: Check[]): ArrayType<T>;
8
+ min(value: number): ArrayType<T>;
9
+ max(value: number): ArrayType<T>;
10
+ length(value: number): ArrayType<T>;
11
+ }
12
+ export declare const array: typeof ArrayType.factory;
13
+ export {};
@@ -1,27 +1,25 @@
1
- import * as zod from "zod/v4-mini";
1
+ import * as zod from 'zod/v4-mini';
2
2
  import { BaseType } from "./base.js";
3
3
  export class ArrayType extends BaseType {
4
- static factory(element, ...checks) {
5
- return new ArrayType({
6
- encodedZodType: zod.array(element.encodedZodType).check(...checks),
7
- decodedZodType: zod.array(element.decodedZodType).check(...checks),
8
- params: { checks },
9
- props: { element }
10
- });
11
- }
12
- min(value) {
13
- const check = zod.minLength(value);
14
- return ArrayType.factory(this.props.element, ...this.params.checks, check);
15
- }
16
- max(value) {
17
- const check = zod.maxLength(value);
18
- return ArrayType.factory(this.props.element, ...this.params.checks, check);
19
- }
20
- length(value) {
21
- const check = zod.length(value);
22
- return ArrayType.factory(this.props.element, ...this.params.checks, check);
23
- }
4
+ static factory(element, ...checks) {
5
+ return new ArrayType({
6
+ encodedZodType: zod.array(element.encodedZodType).check(...checks),
7
+ decodedZodType: zod.array(element.decodedZodType).check(...checks),
8
+ params: { checks },
9
+ props: { element },
10
+ });
11
+ }
12
+ min(value) {
13
+ const check = zod.minLength(value);
14
+ return ArrayType.factory(this.props.element, ...this.params.checks, check);
15
+ }
16
+ max(value) {
17
+ const check = zod.maxLength(value);
18
+ return ArrayType.factory(this.props.element, ...this.params.checks, check);
19
+ }
20
+ length(value) {
21
+ const check = zod.length(value);
22
+ return ArrayType.factory(this.props.element, ...this.params.checks, check);
23
+ }
24
24
  }
25
25
  export const array = ArrayType.factory;
26
-
27
- //# sourceMappingURL=array.js.map
@@ -0,0 +1,62 @@
1
+ import * as zod from 'zod/v4-mini';
2
+ 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;
6
+ export type TypeProps = Record<string, any>;
7
+ export type TypeMetadata<T = any> = {
8
+ id?: string;
9
+ description?: string;
10
+ examples?: T[];
11
+ title?: string;
12
+ };
13
+ export type TypeParams = {
14
+ encode?: (value: any) => any;
15
+ metadata?: TypeMetadata;
16
+ checks: Array<zod.core.CheckFn<any> | zod.core.$ZodCheck<any>>;
17
+ };
18
+ export type DefaultTypeParams = {
19
+ encode?: TypeParams['encode'];
20
+ metadata?: TypeMetadata;
21
+ };
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;
29
+ readonly props: Props;
30
+ readonly params: TypeParams;
31
+ constructor({ encodedZodType, decodedZodType, props, params, }: {
32
+ encodedZodType: EncodedZodType;
33
+ decodedZodType?: DecodedZodType;
34
+ props?: Props;
35
+ params?: Partial<TypeParams>;
36
+ });
37
+ optional(): OptionalType<this>;
38
+ nullable(): NullableType<this>;
39
+ nullish(): OptionalType<NullableType<this>>;
40
+ default(value: this['encodedZodType']['_zod']['input']): DefaultType<this>;
41
+ title(title: string): this;
42
+ description(description: string): this;
43
+ examples(...examples: this['encodedZodType']['_zod']['input'][]): this;
44
+ 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'];
47
+ }
48
+ export declare class OptionalType<Type extends BaseTypeAny = BaseTypeAny> extends BaseType<zod.ZodMiniOptional<Type['encodedZodType']>, zod.ZodMiniOptional<Type['decodedZodType']>, {
49
+ inner: Type;
50
+ }> {
51
+ static factory<T extends BaseTypeAny>(type: T): OptionalType<T>;
52
+ }
53
+ export declare class NullableType<Type extends BaseTypeAny<any> = BaseTypeAny<any>> extends BaseType<zod.ZodMiniNullable<Type['encodedZodType']>, zod.ZodMiniNullable<Type['decodedZodType']>, {
54
+ inner: Type;
55
+ }> {
56
+ static factory<T extends BaseTypeAny<any>>(type: T): NullableType<T>;
57
+ }
58
+ export declare class DefaultType<Type extends BaseTypeAny = BaseTypeAny> extends BaseType<zod.ZodMiniDefault<Type['encodedZodType']>, zod.ZodMiniDefault<Type['decodedZodType']>, {
59
+ inner: Type;
60
+ }> {
61
+ static factory<T extends BaseTypeAny<any>>(type: T, defaultValue: any): DefaultType<T>;
62
+ }
@@ -1,75 +1,77 @@
1
- import * as zod from "zod/v4-mini";
1
+ import * as zod from 'zod/v4-mini';
2
2
  export const typesRegistry = zod.registry();
3
3
  export const NeemataTypeError = zod.core.$ZodError;
4
4
  export class BaseType {
5
- encodedZodType;
6
- decodedZodType;
7
- props;
8
- params;
9
- constructor({ encodedZodType, decodedZodType = encodedZodType, props = {}, params = {} }) {
10
- this.encodedZodType = encodedZodType;
11
- this.decodedZodType = decodedZodType;
12
- this.props = props;
13
- this.params = Object.assign({ checks: [] }, params);
14
- }
15
- optional() {
16
- return OptionalType.factory(this);
17
- }
18
- nullable() {
19
- return NullableType.factory(this);
20
- }
21
- nullish() {
22
- return this.nullable().optional();
23
- }
24
- default(value) {
25
- return DefaultType.factory(this, value);
26
- }
27
- title(title) {
28
- return this.meta({ title });
29
- }
30
- description(description) {
31
- return this.meta({ description });
32
- }
33
- examples(...examples) {
34
- return this.meta({ examples: this.params.encode ? examples.map(this.params.encode) : examples });
35
- }
36
- meta(newMetadata) {
37
- const metadata = typesRegistry.get(this.encodedZodType) ?? {};
38
- Object.assign(metadata, newMetadata);
39
- typesRegistry.add(this.encodedZodType, metadata);
40
- return this;
41
- }
42
- encode(data) {
43
- return this.encodedZodType.parse(data, { reportInput: true });
44
- }
45
- decode(data) {
46
- return this.decodedZodType.parse(data, { reportInput: true });
47
- }
5
+ encodedZodType;
6
+ decodedZodType;
7
+ props;
8
+ params;
9
+ constructor({ encodedZodType, decodedZodType = encodedZodType, props = {}, params = {}, }) {
10
+ this.encodedZodType = encodedZodType;
11
+ this.decodedZodType = decodedZodType;
12
+ this.props = props;
13
+ this.params = Object.assign({ checks: [] }, params);
14
+ }
15
+ optional() {
16
+ return OptionalType.factory(this);
17
+ }
18
+ nullable() {
19
+ return NullableType.factory(this);
20
+ }
21
+ nullish() {
22
+ return this.nullable().optional();
23
+ }
24
+ default(value) {
25
+ return DefaultType.factory(this, value);
26
+ }
27
+ title(title) {
28
+ return this.meta({ title });
29
+ }
30
+ description(description) {
31
+ return this.meta({ description });
32
+ }
33
+ examples(...examples) {
34
+ return this.meta({
35
+ examples: this.params.encode
36
+ ? examples.map(this.params.encode)
37
+ : examples,
38
+ });
39
+ }
40
+ meta(newMetadata) {
41
+ const metadata = typesRegistry.get(this.encodedZodType) ?? {};
42
+ Object.assign(metadata, newMetadata);
43
+ typesRegistry.add(this.encodedZodType, metadata);
44
+ return this;
45
+ }
46
+ encode(data) {
47
+ return this.encodedZodType.parse(data, { reportInput: true });
48
+ }
49
+ decode(data) {
50
+ return this.decodedZodType.parse(data, { reportInput: true });
51
+ }
48
52
  }
49
53
  export class OptionalType extends BaseType {
50
- static factory(type) {
51
- return new OptionalType({
52
- encodedZodType: zod.optional(type.encodedZodType),
53
- props: { inner: type }
54
- });
55
- }
54
+ static factory(type) {
55
+ return new OptionalType({
56
+ encodedZodType: zod.optional(type.encodedZodType),
57
+ props: { inner: type },
58
+ });
59
+ }
56
60
  }
57
61
  export class NullableType extends BaseType {
58
- static factory(type) {
59
- return new NullableType({
60
- encodedZodType: zod.nullable(type.encodedZodType),
61
- props: { inner: type }
62
- });
63
- }
62
+ static factory(type) {
63
+ return new NullableType({
64
+ encodedZodType: zod.nullable(type.encodedZodType),
65
+ props: { inner: type },
66
+ });
67
+ }
64
68
  }
65
69
  export class DefaultType extends BaseType {
66
- static factory(type, defaultValue) {
67
- return new DefaultType({
68
- encodedZodType: zod._default(type.encodedZodType, type.params.encode?.(defaultValue) ?? defaultValue),
69
- decodedZodType: zod._default(type.decodedZodType, defaultValue),
70
- props: { inner: type }
71
- });
72
- }
70
+ static factory(type, defaultValue) {
71
+ return new DefaultType({
72
+ encodedZodType: zod._default(type.encodedZodType, type.params.encode?.(defaultValue) ?? defaultValue),
73
+ decodedZodType: zod._default(type.decodedZodType, defaultValue),
74
+ props: { inner: type },
75
+ });
76
+ }
73
77
  }
74
-
75
- //# sourceMappingURL=base.js.map
@@ -0,0 +1,6 @@
1
+ import * as zod from 'zod/v4-mini';
2
+ import { BaseType } from './base.ts';
3
+ export declare class BooleanType extends BaseType<zod.ZodMiniBoolean<boolean>> {
4
+ static factory(): BooleanType;
5
+ }
6
+ export declare const boolean: typeof BooleanType.factory;
@@ -1,10 +1,10 @@
1
- import * as zod from "zod/v4-mini";
1
+ import * as zod from 'zod/v4-mini';
2
2
  import { BaseType } from "./base.js";
3
3
  export class BooleanType extends BaseType {
4
- static factory() {
5
- return new BooleanType({ encodedZodType: zod.boolean() });
6
- }
4
+ static factory() {
5
+ return new BooleanType({
6
+ encodedZodType: zod.boolean(),
7
+ });
8
+ }
7
9
  }
8
10
  export const boolean = BooleanType.factory;
9
-
10
- //# sourceMappingURL=boolean.js.map
@@ -0,0 +1,14 @@
1
+ import * as zod from 'zod/v4-mini';
2
+ import { BaseType, type SimpleZodType, type ZodType } from './base.ts';
3
+ export type CustomTransformFn<I, O> = (value: I) => O;
4
+ 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
+ export declare class CustomType<Type, EncodedType extends SimpleZodType = zod.ZodMiniType<Type, Type>, DecodedType extends ZodType = zod.ZodMiniType<Type, Type>> extends TransformType<Type, EncodedType, DecodedType> {
7
+ static factory<Type, EncodedType extends SimpleZodType = zod.ZodMiniType<Type, Type>, DecodedType extends ZodType = zod.ZodMiniType<Type, Type>>({ decode, encode, error, type, }: {
8
+ decode: CustomTransformFn<EncodedType['_zod']['input'], DecodedType['_zod']['output']>;
9
+ encode: CustomTransformFn<DecodedType['_zod']['input'], EncodedType['_zod']['output']>;
10
+ error?: string | zod.core.$ZodErrorMap<zod.core.$ZodIssueBase>;
11
+ type?: EncodedType;
12
+ }): CustomType<Type, EncodedType, DecodedType>;
13
+ }
14
+ export declare const custom: typeof CustomType.factory;
@@ -1,25 +1,25 @@
1
- import * as zod from "zod/v4-mini";
1
+ import * as zod from 'zod/v4-mini';
2
2
  import { BaseType } from "./base.js";
3
- export class TransformType extends BaseType {}
3
+ export class TransformType extends BaseType {
4
+ }
4
5
  export class CustomType extends TransformType {
5
- static factory({ decode, encode, error, type = zod.any() }) {
6
- return new CustomType({
7
- encodedZodType: zod.pipe(zod.custom().check(zod.refine((val) => typeof val !== "undefined", {
8
- error,
9
- abort: true
10
- }), zod.overwrite(encode)), type),
11
- decodedZodType: zod.pipe(
12
- type,
13
- // @ts-expect-error
14
- zod.custom().check(zod.refine((val) => typeof val !== "undefined", {
15
- error,
16
- abort: true
17
- }), zod.overwrite(decode))
18
- ),
19
- params: { encode }
20
- });
21
- }
6
+ static factory({ decode, encode, error, type = zod.any(), }) {
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),
12
+ // @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))),
21
+ params: { encode },
22
+ });
23
+ }
22
24
  }
23
25
  export const custom = CustomType.factory;
24
-
25
- //# sourceMappingURL=custom.js.map
@@ -0,0 +1,6 @@
1
+ import * as zod from 'zod/v4-mini';
2
+ 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>>>;
5
+ }
6
+ export declare const date: typeof DateType.factory;
@@ -1,14 +1,12 @@
1
- import * as zod from "zod/v4-mini";
1
+ import * as zod from 'zod/v4-mini';
2
2
  import { CustomType, TransformType } from "./custom.js";
3
3
  export class DateType extends TransformType {
4
- static factory() {
5
- return CustomType.factory({
6
- decode: (value) => new Date(value),
7
- encode: (value) => value.toISOString(),
8
- type: zod.union([zod.iso.date(), zod.iso.datetime()])
9
- });
10
- }
4
+ static factory() {
5
+ return CustomType.factory({
6
+ decode: (value) => new Date(value),
7
+ encode: (value) => value.toISOString(),
8
+ type: zod.union([zod.iso.date(), zod.iso.datetime()]),
9
+ });
10
+ }
11
11
  }
12
12
  export const date = DateType.factory;
13
-
14
- //# sourceMappingURL=date.js.map
@@ -0,0 +1,10 @@
1
+ import * as zod from 'zod/v4-mini';
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>, {
4
+ values: T;
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]>>;
8
+ }
9
+ declare const _enum: typeof EnumType.factory;
10
+ export { _enum as enum };
@@ -1,14 +1,12 @@
1
- import * as zod from "zod/v4-mini";
1
+ import * as zod from 'zod/v4-mini';
2
2
  import { BaseType } from "./base.js";
3
3
  export class EnumType extends BaseType {
4
- static factory(values) {
5
- return new EnumType({
6
- encodedZodType: zod.enum(values),
7
- props: { values }
8
- });
9
- }
4
+ static factory(values) {
5
+ return new EnumType({
6
+ encodedZodType: zod.enum(values),
7
+ props: { values },
8
+ });
9
+ }
10
10
  }
11
11
  const _enum = EnumType.factory;
12
12
  export { _enum as enum };
13
-
14
- //# sourceMappingURL=enum.js.map
@@ -0,0 +1,8 @@
1
+ import * as zod from 'zod/v4-mini';
2
+ import { BaseType, type PrimitiveValueType } from './base.ts';
3
+ export declare class LiteralType<T extends PrimitiveValueType = PrimitiveValueType> extends BaseType<zod.ZodMiniLiteral<T>, zod.ZodMiniLiteral<T>, {
4
+ value: T;
5
+ }> {
6
+ static factory<T extends PrimitiveValueType>(value: T): LiteralType<T>;
7
+ }
8
+ export declare const literal: typeof LiteralType.factory;
@@ -1,13 +1,11 @@
1
- import * as zod from "zod/v4-mini";
1
+ import * as zod from 'zod/v4-mini';
2
2
  import { BaseType } from "./base.js";
3
3
  export class LiteralType extends BaseType {
4
- static factory(value) {
5
- return new LiteralType({
6
- encodedZodType: zod.literal(value),
7
- props: { value }
8
- });
9
- }
4
+ static factory(value) {
5
+ return new LiteralType({
6
+ encodedZodType: zod.literal(value),
7
+ props: { value },
8
+ });
9
+ }
10
10
  }
11
11
  export const literal = LiteralType.factory;
12
-
13
- //# sourceMappingURL=literal.js.map
@@ -0,0 +1,6 @@
1
+ import * as zod from 'zod/v4-mini';
2
+ import { BaseType } from './base.ts';
3
+ export declare class NeverType extends BaseType<zod.ZodMiniNever> {
4
+ static factory(): NeverType;
5
+ }
6
+ export declare const never: typeof NeverType.factory;
@@ -1,10 +1,10 @@
1
- import * as zod from "zod/v4-mini";
1
+ import * as zod from 'zod/v4-mini';
2
2
  import { BaseType } from "./base.js";
3
3
  export class NeverType extends BaseType {
4
- static factory() {
5
- return new NeverType({ encodedZodType: zod.never() });
6
- }
4
+ static factory() {
5
+ return new NeverType({
6
+ encodedZodType: zod.never(),
7
+ });
8
+ }
7
9
  }
8
10
  export const never = NeverType.factory;
9
-
10
- //# sourceMappingURL=never.js.map
@@ -0,0 +1,23 @@
1
+ import * as zod from 'zod/v4-mini';
2
+ import { BaseType } from './base.ts';
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>> {
6
+ static factory(...checks: Check[]): NumberType;
7
+ positive(): NumberType;
8
+ negative(): NumberType;
9
+ lt(value: number): NumberType;
10
+ lte(value: number): NumberType;
11
+ gte(value: number): NumberType;
12
+ gt(value: number): NumberType;
13
+ }
14
+ export declare class IntegerType extends NumberType {
15
+ static factory(...checks: Check[]): NumberType;
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>>>;
19
+ }
20
+ export declare const number: typeof NumberType.factory;
21
+ export declare const integer: typeof IntegerType.factory;
22
+ export declare const bigInt: typeof BigIntType.factory;
23
+ export {};
@@ -1,49 +1,47 @@
1
- import * as zod from "zod/v4-mini";
1
+ import * as zod from 'zod/v4-mini';
2
2
  import { BaseType } from "./base.js";
3
3
  import { CustomType, TransformType } from "./custom.js";
4
4
  export class NumberType extends BaseType {
5
- static factory(...checks) {
6
- return new NumberType({
7
- encodedZodType: zod.number().check(...checks),
8
- params: { checks }
9
- });
10
- }
11
- positive() {
12
- return NumberType.factory(...this.params.checks, zod.gte(0));
13
- }
14
- negative() {
15
- return NumberType.factory(...this.params.checks, zod.lte(0));
16
- }
17
- lt(value) {
18
- return NumberType.factory(...this.params.checks, zod.lt(value));
19
- }
20
- lte(value) {
21
- return NumberType.factory(...this.params.checks, zod.lte(value));
22
- }
23
- gte(value) {
24
- return NumberType.factory(...this.params.checks, zod.gte(value));
25
- }
26
- gt(value) {
27
- return NumberType.factory(...this.params.checks, zod.gt(value));
28
- }
5
+ static factory(...checks) {
6
+ return new NumberType({
7
+ encodedZodType: zod.number().check(...checks),
8
+ params: { checks },
9
+ });
10
+ }
11
+ positive() {
12
+ return NumberType.factory(...this.params.checks, zod.gte(0));
13
+ }
14
+ negative() {
15
+ return NumberType.factory(...this.params.checks, zod.lte(0));
16
+ }
17
+ lt(value) {
18
+ return NumberType.factory(...this.params.checks, zod.lt(value));
19
+ }
20
+ lte(value) {
21
+ return NumberType.factory(...this.params.checks, zod.lte(value));
22
+ }
23
+ gte(value) {
24
+ return NumberType.factory(...this.params.checks, zod.gte(value));
25
+ }
26
+ gt(value) {
27
+ return NumberType.factory(...this.params.checks, zod.gt(value));
28
+ }
29
29
  }
30
30
  export class IntegerType extends NumberType {
31
- static factory(...checks) {
32
- return NumberType.factory(...checks, zod.int());
33
- }
31
+ static factory(...checks) {
32
+ return NumberType.factory(...checks, zod.int());
33
+ }
34
34
  }
35
35
  export class BigIntType extends TransformType {
36
- static factory() {
37
- return CustomType.factory({
38
- decode: (value) => BigInt(value),
39
- encode: (value) => value.toString(),
40
- type: zod.string().check(zod.regex(/^-?\d+$/)),
41
- error: "Invalid bigint format"
42
- });
43
- }
36
+ static factory() {
37
+ return CustomType.factory({
38
+ decode: (value) => BigInt(value),
39
+ encode: (value) => value.toString(),
40
+ type: zod.string().check(zod.regex(/^-?\d+$/)),
41
+ error: 'Invalid bigint format',
42
+ });
43
+ }
44
44
  }
45
45
  export const number = NumberType.factory;
46
46
  export const integer = IntegerType.factory;
47
47
  export const bigInt = BigIntType.factory;
48
-
49
- //# sourceMappingURL=number.js.map