@nmtjs/type 0.15.0-beta.36 → 0.15.0-beta.37

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 (84) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +1 -1
  3. package/dist/index.d.ts +0 -3
  4. package/dist/index.js +3 -8
  5. package/dist/temporal/global.d.ts +7 -8
  6. package/dist/temporal/global.js +1 -2
  7. package/dist/temporal/polyfill.d.ts +8 -8
  8. package/dist/temporal/polyfill.js +1 -2
  9. package/dist/types/{_utils.d.ts → _plain.d.ts} +0 -2
  10. package/dist/types/{_utils.js → _plain.js} +0 -1
  11. package/dist/types/_type.d.ts +0 -2
  12. package/dist/types/_type.js +13 -16
  13. package/dist/types/any.js +1 -2
  14. package/dist/types/array.d.ts +1 -1
  15. package/dist/types/array.js +1 -2
  16. package/dist/types/base.d.ts +1 -1
  17. package/dist/types/base.js +0 -1
  18. package/dist/types/boolean.js +1 -2
  19. package/dist/types/custom.d.ts +1 -7
  20. package/dist/types/custom.js +6 -23
  21. package/dist/types/date.d.ts +2 -2
  22. package/dist/types/date.js +1 -3
  23. package/dist/types/enum.js +1 -2
  24. package/dist/types/literal.js +1 -2
  25. package/dist/types/never.js +1 -2
  26. package/dist/types/number.js +2 -3
  27. package/dist/types/object.d.ts +15 -42
  28. package/dist/types/object.js +4 -21
  29. package/dist/types/string.js +1 -2
  30. package/dist/types/temporal.d.ts +8 -8
  31. package/dist/types/temporal.js +1 -2
  32. package/dist/types/tuple.d.ts +1 -1
  33. package/dist/types/tuple.js +1 -2
  34. package/dist/types/union.d.ts +1 -1
  35. package/dist/types/union.js +1 -2
  36. package/package.json +27 -11
  37. package/dist/index.js.map +0 -1
  38. package/dist/temporal/global.js.map +0 -1
  39. package/dist/temporal/polyfill.js.map +0 -1
  40. package/dist/types/_convert.d.ts +0 -5
  41. package/dist/types/_convert.js +0 -56
  42. package/dist/types/_convert.js.map +0 -1
  43. package/dist/types/_type.js.map +0 -1
  44. package/dist/types/_utils.js.map +0 -1
  45. package/dist/types/any.js.map +0 -1
  46. package/dist/types/array.js.map +0 -1
  47. package/dist/types/base.js.map +0 -1
  48. package/dist/types/boolean.js.map +0 -1
  49. package/dist/types/custom.js.map +0 -1
  50. package/dist/types/date.js.map +0 -1
  51. package/dist/types/enum.js.map +0 -1
  52. package/dist/types/literal.js.map +0 -1
  53. package/dist/types/never.js.map +0 -1
  54. package/dist/types/null.d.ts +0 -7
  55. package/dist/types/null.js +0 -10
  56. package/dist/types/null.js.map +0 -1
  57. package/dist/types/number.js.map +0 -1
  58. package/dist/types/object.js.map +0 -1
  59. package/dist/types/string.js.map +0 -1
  60. package/dist/types/temporal.js.map +0 -1
  61. package/dist/types/tuple.js.map +0 -1
  62. package/dist/types/union.js.map +0 -1
  63. package/src/index.ts +0 -14
  64. package/src/temporal/global.ts +0 -32
  65. package/src/temporal/polyfill.ts +0 -31
  66. package/src/types/_convert.ts +0 -68
  67. package/src/types/_type.ts +0 -54
  68. package/src/types/_utils.ts +0 -24
  69. package/src/types/any.ts +0 -12
  70. package/src/types/array.ts +0 -53
  71. package/src/types/base.ts +0 -209
  72. package/src/types/boolean.ts +0 -12
  73. package/src/types/custom.ts +0 -109
  74. package/src/types/date.ts +0 -23
  75. package/src/types/enum.ts +0 -23
  76. package/src/types/literal.ts +0 -18
  77. package/src/types/never.ts +0 -12
  78. package/src/types/null.ts +0 -14
  79. package/src/types/number.ts +0 -73
  80. package/src/types/object.ts +0 -225
  81. package/src/types/string.ts +0 -95
  82. package/src/types/temporal.ts +0 -155
  83. package/src/types/tuple.ts +0 -49
  84. package/src/types/union.ts +0 -120
package/LICENSE.md CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2025 Denys Ilchyshyn
1
+ Copyright (c) 2024 Denis Ilchyshyn
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
4
 
package/README.md CHANGED
@@ -6,4 +6,4 @@
6
6
  - binary data streaming and event subscriptions
7
7
  - contract-based API
8
8
  - end-to-end type safety
9
- - CPU-intensive task execution on separate workers
9
+ - CPU-intensive task execution on separate workers
package/dist/index.d.ts CHANGED
@@ -1,7 +1,4 @@
1
1
  import * as type from './types/_type.ts';
2
- export * from './types/_convert.ts';
3
- export * from './types/_utils.ts';
4
2
  export * from './types/base.ts';
5
3
  export { type, type as t };
6
4
  export default type;
7
- export declare function registerDefaultLocale(): void;
package/dist/index.js CHANGED
@@ -1,12 +1,7 @@
1
1
  import { en } from 'zod/locales';
2
2
  import { config } from 'zod/mini';
3
- import * as type from './types/_type.js';
4
- export * from './types/_convert.js';
5
- export * from './types/_utils.js';
6
- export * from './types/base.js';
3
+ import * as type from "./types/_type.js";
4
+ config(en());
5
+ export * from "./types/base.js";
7
6
  export { type, type as t };
8
7
  export default type;
9
- export function registerDefaultLocale() {
10
- config(en());
11
- }
12
- //# sourceMappingURL=index.js.map
@@ -1,9 +1,8 @@
1
1
  import 'temporal-spec/global';
2
- import { DurationType, PlainDateTimeType, PlainDateType, PlainMonthDayType, PlainTimeType, PlainYearMonthType, ZonedDateTimeType } from '../types/temporal.ts';
3
- export declare const plainDate: () => PlainDateType;
4
- export declare const plainDatetime: () => PlainDateTimeType;
5
- export declare const plainTime: () => PlainTimeType;
6
- export declare const zonedDatetime: () => ZonedDateTimeType;
7
- export declare const duration: () => DurationType;
8
- export declare const plainYearMonth: () => PlainYearMonthType;
9
- export declare const plainMonthDay: () => PlainMonthDayType;
2
+ export declare const plainDate: () => import("../types/custom.ts").CustomType<import("temporal-spec").Temporal.PlainDate, import("zod/mini").ZodMiniString<string>, import("zod/mini").ZodMiniType<import("temporal-spec").Temporal.PlainDate, import("temporal-spec").Temporal.PlainDate, import("zod/v4/core").$ZodTypeInternals<import("temporal-spec").Temporal.PlainDate, import("temporal-spec").Temporal.PlainDate>>>;
3
+ export declare const plainDatetime: () => import("../types/custom.ts").CustomType<import("temporal-spec").Temporal.PlainDateTime, import("zod/mini").ZodMiniString<string>, import("zod/mini").ZodMiniType<import("temporal-spec").Temporal.PlainDateTime, import("temporal-spec").Temporal.PlainDateTime, import("zod/v4/core").$ZodTypeInternals<import("temporal-spec").Temporal.PlainDateTime, import("temporal-spec").Temporal.PlainDateTime>>>;
4
+ export declare const plainTime: () => import("../types/custom.ts").CustomType<import("temporal-spec").Temporal.PlainTime, import("zod/mini").ZodMiniString<string>, import("zod/mini").ZodMiniType<import("temporal-spec").Temporal.PlainTime, import("temporal-spec").Temporal.PlainTime, import("zod/v4/core").$ZodTypeInternals<import("temporal-spec").Temporal.PlainTime, import("temporal-spec").Temporal.PlainTime>>>;
5
+ export declare const zonedDatetime: () => import("../types/custom.ts").CustomType<import("temporal-spec").Temporal.ZonedDateTime, import("zod/mini").ZodMiniString<string>, import("zod/mini").ZodMiniType<import("temporal-spec").Temporal.ZonedDateTime, import("temporal-spec").Temporal.ZonedDateTime, import("zod/v4/core").$ZodTypeInternals<import("temporal-spec").Temporal.ZonedDateTime, import("temporal-spec").Temporal.ZonedDateTime>>>;
6
+ export declare const duration: () => import("../types/custom.ts").CustomType<import("temporal-spec").Temporal.Duration, import("zod/mini").ZodMiniString<string>, import("zod/mini").ZodMiniType<import("temporal-spec").Temporal.Duration, import("temporal-spec").Temporal.Duration, import("zod/v4/core").$ZodTypeInternals<import("temporal-spec").Temporal.Duration, import("temporal-spec").Temporal.Duration>>>;
7
+ export declare const plainYearMonth: () => import("../types/custom.ts").CustomType<import("temporal-spec").Temporal.PlainYearMonth, import("zod/mini").ZodMiniString<string>, import("zod/mini").ZodMiniType<import("temporal-spec").Temporal.PlainYearMonth, import("temporal-spec").Temporal.PlainYearMonth, import("zod/v4/core").$ZodTypeInternals<import("temporal-spec").Temporal.PlainYearMonth, import("temporal-spec").Temporal.PlainYearMonth>>>;
8
+ export declare const plainMonthDay: () => import("../types/custom.ts").CustomType<import("temporal-spec").Temporal.PlainMonthDay, import("zod/mini").ZodMiniString<string>, import("zod/mini").ZodMiniType<import("temporal-spec").Temporal.PlainMonthDay, import("temporal-spec").Temporal.PlainMonthDay, import("zod/v4/core").$ZodTypeInternals<import("temporal-spec").Temporal.PlainMonthDay, import("temporal-spec").Temporal.PlainMonthDay>>>;
@@ -1,5 +1,5 @@
1
1
  import 'temporal-spec/global';
2
- import { DurationType, PlainDateTimeType, PlainDateType, PlainMonthDayType, PlainTimeType, PlainYearMonthType, ZonedDateTimeType, } from '../types/temporal.js';
2
+ import { DurationType, PlainDateTimeType, PlainDateType, PlainMonthDayType, PlainTimeType, PlainYearMonthType, ZonedDateTimeType, } from "../types/temporal.js";
3
3
  export const plainDate = PlainDateType.factory.bind(PlainDateType, Temporal);
4
4
  export const plainDatetime = PlainDateTimeType.factory.bind(PlainDateTimeType, Temporal);
5
5
  export const plainTime = PlainTimeType.factory.bind(PlainTimeType, Temporal);
@@ -7,4 +7,3 @@ export const zonedDatetime = ZonedDateTimeType.factory.bind(ZonedDateTimeType, T
7
7
  export const duration = DurationType.factory.bind(DurationType, Temporal);
8
8
  export const plainYearMonth = PlainYearMonthType.factory.bind(PlainYearMonthType, Temporal);
9
9
  export const plainMonthDay = PlainMonthDayType.factory.bind(PlainMonthDayType, Temporal);
10
- //# sourceMappingURL=global.js.map
@@ -1,8 +1,8 @@
1
- import { DurationType, PlainDateTimeType, PlainDateType, PlainMonthDayType, PlainTimeType, PlainYearMonthType, ZonedDateTimeType } from '../types/temporal.ts';
2
- export declare const plainDate: () => PlainDateType;
3
- export declare const plainDatetime: () => PlainDateTimeType;
4
- export declare const plainTime: () => PlainTimeType;
5
- export declare const zonedDatetime: () => ZonedDateTimeType;
6
- export declare const duration: () => DurationType;
7
- export declare const plainYearMonth: () => PlainYearMonthType;
8
- export declare const plainMonthDay: () => PlainMonthDayType;
1
+ import { Temporal } from 'temporal-polyfill';
2
+ export declare const plainDate: () => import("../types/custom.ts").CustomType<Temporal.PlainDate, import("zod/mini").ZodMiniString<string>, import("zod/mini").ZodMiniType<Temporal.PlainDate, Temporal.PlainDate, import("zod/v4/core").$ZodTypeInternals<Temporal.PlainDate, Temporal.PlainDate>>>;
3
+ export declare const plainDatetime: () => import("../types/custom.ts").CustomType<Temporal.PlainDateTime, import("zod/mini").ZodMiniString<string>, import("zod/mini").ZodMiniType<Temporal.PlainDateTime, Temporal.PlainDateTime, import("zod/v4/core").$ZodTypeInternals<Temporal.PlainDateTime, Temporal.PlainDateTime>>>;
4
+ export declare const plainTime: () => import("../types/custom.ts").CustomType<Temporal.PlainTime, import("zod/mini").ZodMiniString<string>, import("zod/mini").ZodMiniType<Temporal.PlainTime, Temporal.PlainTime, import("zod/v4/core").$ZodTypeInternals<Temporal.PlainTime, Temporal.PlainTime>>>;
5
+ export declare const zonedDatetime: () => import("../types/custom.ts").CustomType<Temporal.ZonedDateTime, import("zod/mini").ZodMiniString<string>, import("zod/mini").ZodMiniType<Temporal.ZonedDateTime, Temporal.ZonedDateTime, import("zod/v4/core").$ZodTypeInternals<Temporal.ZonedDateTime, Temporal.ZonedDateTime>>>;
6
+ export declare const duration: () => import("../types/custom.ts").CustomType<Temporal.Duration, import("zod/mini").ZodMiniString<string>, import("zod/mini").ZodMiniType<Temporal.Duration, Temporal.Duration, import("zod/v4/core").$ZodTypeInternals<Temporal.Duration, Temporal.Duration>>>;
7
+ export declare const plainYearMonth: () => import("../types/custom.ts").CustomType<Temporal.PlainYearMonth, import("zod/mini").ZodMiniString<string>, import("zod/mini").ZodMiniType<Temporal.PlainYearMonth, Temporal.PlainYearMonth, import("zod/v4/core").$ZodTypeInternals<Temporal.PlainYearMonth, Temporal.PlainYearMonth>>>;
8
+ export declare const plainMonthDay: () => import("../types/custom.ts").CustomType<Temporal.PlainMonthDay, import("zod/mini").ZodMiniString<string>, import("zod/mini").ZodMiniType<Temporal.PlainMonthDay, Temporal.PlainMonthDay, import("zod/v4/core").$ZodTypeInternals<Temporal.PlainMonthDay, Temporal.PlainMonthDay>>>;
@@ -1,5 +1,5 @@
1
1
  import { Temporal } from 'temporal-polyfill';
2
- import { DurationType, PlainDateTimeType, PlainDateType, PlainMonthDayType, PlainTimeType, PlainYearMonthType, ZonedDateTimeType, } from '../types/temporal.js';
2
+ import { DurationType, PlainDateTimeType, PlainDateType, PlainMonthDayType, PlainTimeType, PlainYearMonthType, ZonedDateTimeType, } from "../types/temporal.js";
3
3
  export const plainDate = PlainDateType.factory.bind(PlainDateType, Temporal);
4
4
  export const plainDatetime = PlainDateTimeType.factory.bind(PlainDateTimeType, Temporal);
5
5
  export const plainTime = PlainTimeType.factory.bind(PlainTimeType, Temporal);
@@ -7,4 +7,3 @@ export const zonedDatetime = ZonedDateTimeType.factory.bind(ZonedDateTimeType, T
7
7
  export const duration = DurationType.factory.bind(DurationType, Temporal);
8
8
  export const plainYearMonth = PlainYearMonthType.factory.bind(PlainYearMonthType, Temporal);
9
9
  export const plainMonthDay = PlainMonthDayType.factory.bind(PlainMonthDayType, Temporal);
10
- //# sourceMappingURL=polyfill.js.map
@@ -1,5 +1,4 @@
1
1
  import type { core, ZodMiniType } from 'zod/mini';
2
- import type { BaseType } from './base.ts';
3
2
  export declare const PlainType: unique symbol;
4
3
  export type PlainType = typeof PlainType;
5
4
  export type ZodPlainType<T extends ZodMiniType<any, any, any>> = T & ZodMiniType<T['_zod']['output'] & {
@@ -12,4 +11,3 @@ export type ZodPlainType<T extends ZodMiniType<any, any, any>> = T & ZodMiniType
12
11
  [PlainType]?: true;
13
12
  }>>;
14
13
  export declare const zodPlainType: <T extends ZodMiniType<any, any, any>>(type: T) => ZodPlainType<T>;
15
- export type AnyCompatibleType<Encoded = any, Decoded = any> = BaseType<ZodMiniType<any, Decoded>, ZodMiniType<any, Encoded>>;
@@ -1,3 +1,2 @@
1
1
  export const PlainType = Symbol('PlainType');
2
2
  export const zodPlainType = (type) => type;
3
- //# sourceMappingURL=_utils.js.map
@@ -1,14 +1,12 @@
1
1
  import type { BaseTypeAny } from './base.ts';
2
2
  export * from './any.ts';
3
3
  export * from './array.ts';
4
- export { BaseType, type BaseTypeAny, DefaultType, NeemataTypeError, NullableType, OptionalType, } from './base.ts';
5
4
  export * from './boolean.ts';
6
5
  export * from './custom.ts';
7
6
  export * from './date.ts';
8
7
  export * from './enum.ts';
9
8
  export * from './literal.ts';
10
9
  export * from './never.ts';
11
- export * from './null.ts';
12
10
  export * from './number.ts';
13
11
  export * from './object.ts';
14
12
  export * from './string.ts';
@@ -1,16 +1,13 @@
1
- export * from './any.js';
2
- export * from './array.js';
3
- export { BaseType, DefaultType, NeemataTypeError, NullableType, OptionalType, } from './base.js';
4
- export * from './boolean.js';
5
- export * from './custom.js';
6
- export * from './date.js';
7
- export * from './enum.js';
8
- export * from './literal.js';
9
- export * from './never.js';
10
- export * from './null.js';
11
- export * from './number.js';
12
- export * from './object.js';
13
- export * from './string.js';
14
- export * from './tuple.js';
15
- export * from './union.js';
16
- //# sourceMappingURL=_type.js.map
1
+ export * from "./any.js";
2
+ export * from "./array.js";
3
+ export * from "./boolean.js";
4
+ export * from "./custom.js";
5
+ export * from "./date.js";
6
+ export * from "./enum.js";
7
+ export * from "./literal.js";
8
+ export * from "./never.js";
9
+ export * from "./number.js";
10
+ export * from "./object.js";
11
+ export * from "./string.js";
12
+ export * from "./tuple.js";
13
+ export * from "./union.js";
package/dist/types/any.js CHANGED
@@ -1,9 +1,8 @@
1
1
  import { any as zodAny } from 'zod/mini';
2
- import { BaseType } from './base.js';
2
+ import { BaseType } from "./base.js";
3
3
  export class AnyType extends BaseType {
4
4
  static factory() {
5
5
  return new AnyType({ encodeZodType: zodAny() });
6
6
  }
7
7
  }
8
8
  export const any = AnyType.factory;
9
- //# sourceMappingURL=any.js.map
@@ -1,5 +1,5 @@
1
1
  import type { core, ZodMiniArray } from 'zod/mini';
2
- import type { ZodPlainType } from './_utils.ts';
2
+ import type { ZodPlainType } from './_plain.ts';
3
3
  import { BaseType } from './base.ts';
4
4
  type Check = core.CheckFn<any[]> | core.$ZodCheck<any[]>;
5
5
  export declare class ArrayType<T extends BaseType = BaseType> extends BaseType<ZodMiniArray<T['encodeZodType']>, ZodMiniArray<T['decodeZodType']>, {
@@ -1,5 +1,5 @@
1
1
  import { length, maxLength, minLength, array as zodArray } from 'zod/mini';
2
- import { BaseType } from './base.js';
2
+ import { BaseType } from "./base.js";
3
3
  export class ArrayType extends BaseType {
4
4
  static factory(element, ...checks) {
5
5
  return new ArrayType({
@@ -23,4 +23,3 @@ export class ArrayType extends BaseType {
23
23
  }
24
24
  }
25
25
  export const array = ArrayType.factory;
26
- //# sourceMappingURL=array.js.map
@@ -31,7 +31,7 @@ export declare abstract class BaseType<EncodeZodType extends SimpleZodType = Sim
31
31
  readonly decodeRawZodType: RawDecodeZodType;
32
32
  readonly props: Props;
33
33
  readonly params: TypeParams;
34
- constructor({ encodeZodType, decodeZodType, props, params }: {
34
+ constructor({ encodeZodType, decodeZodType, props, params, }: {
35
35
  encodeZodType: EncodeZodType;
36
36
  decodeZodType?: DecodeZodType;
37
37
  props?: Props;
@@ -79,4 +79,3 @@ export class DefaultType extends BaseType {
79
79
  });
80
80
  }
81
81
  }
82
- //# sourceMappingURL=base.js.map
@@ -1,9 +1,8 @@
1
1
  import { boolean as zodBoolean } from 'zod/mini';
2
- import { BaseType } from './base.js';
2
+ import { BaseType } from "./base.js";
3
3
  export class BooleanType extends BaseType {
4
4
  static factory() {
5
5
  return new BooleanType({ encodeZodType: zodBoolean() });
6
6
  }
7
7
  }
8
8
  export const boolean = BooleanType.factory;
9
- //# sourceMappingURL=boolean.js.map
@@ -1,4 +1,3 @@
1
- import type { MaybePromise } from '@nmtjs/common';
2
1
  import type { core, ZodMiniType } from 'zod/mini';
3
2
  import type { SimpleZodType, ZodType } from './base.ts';
4
3
  import { BaseType } from './base.ts';
@@ -6,16 +5,11 @@ export type CustomTransformFn<I, O> = (value: I) => O;
6
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']>> {
7
6
  }
8
7
  export declare class CustomType<Type, EncodeType extends SimpleZodType = ZodMiniType<Type, Type>, DecodeType extends ZodType = ZodMiniType<Type, Type>> extends TransformType<Type, EncodeType, DecodeType> {
9
- static factory<Type, EncodeType extends SimpleZodType = ZodMiniType<Type, Type>, DecodeType extends ZodType = ZodMiniType<Type, Type>>({ decode, encode, validation, error, type, prototype }: {
8
+ static factory<Type, EncodeType extends SimpleZodType = ZodMiniType<Type, Type>, DecodeType extends ZodType = ZodMiniType<Type, Type>>({ decode, encode, error, type, }: {
10
9
  decode: CustomTransformFn<EncodeType['_zod']['input'], DecodeType['_zod']['output']>;
11
10
  encode: CustomTransformFn<DecodeType['_zod']['input'], EncodeType['_zod']['output']>;
12
- validation?: ((value: EncodeType['_zod']['input'] | DecodeType['_zod']['output'], payload: core.$RefinementCtx<EncodeType['_zod']['output'] | DecodeType['_zod']['output']>) => MaybePromise<void>) | {
13
- encode?: (value: EncodeType['_zod']['input'], payload: core.$RefinementCtx<EncodeType['_zod']['output']>) => MaybePromise<void>;
14
- decode?: (value: DecodeType['_zod']['output'], payload: core.$RefinementCtx<DecodeType['_zod']['output']>) => MaybePromise<void>;
15
- };
16
11
  error?: string | core.$ZodErrorMap<core.$ZodIssueBase>;
17
12
  type?: EncodeType;
18
- prototype?: object;
19
13
  }): CustomType<Type, EncodeType, DecodeType>;
20
14
  }
21
15
  export declare const custom: typeof CustomType.factory;
@@ -1,33 +1,16 @@
1
- import { any, overwrite, pipe, refine, superRefine, custom as zodCustom, } from 'zod/mini';
2
- import { BaseType } from './base.js';
1
+ import { any, overwrite, pipe, refine, custom as zodCustom } from 'zod/mini';
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, validation, error, type = any(), prototype, }) {
7
- const _validation = validation
8
- ? typeof validation === 'function'
9
- ? { encode: validation, decode: validation }
10
- : validation
11
- : undefined;
12
- const instance = new CustomType({
13
- encodeZodType: pipe(zodCustom().check(...[
14
- refine((val) => typeof val !== 'undefined', { abort: true }),
15
- _validation?.encode ? superRefine(_validation.encode) : undefined,
16
- overwrite(encode),
17
- ].filter((v) => !!v)), type),
6
+ static factory({ decode, encode, error, type = any(), }) {
7
+ return new CustomType({
8
+ encodeZodType: pipe(zodCustom().check(refine((val) => typeof val !== 'undefined', { error, abort: true }), overwrite(encode)), type),
18
9
  decodeZodType: pipe(type,
19
10
  // @ts-expect-error
20
- zodCustom().check(...[
21
- refine((val) => typeof val !== 'undefined', { abort: true }),
22
- overwrite(decode),
23
- _validation?.decode ? superRefine(_validation.decode) : undefined,
24
- ].filter((v) => !!v))),
11
+ zodCustom().check(refine((val) => typeof val !== 'undefined', { error, abort: true }), overwrite(decode))),
25
12
  params: { encode },
26
13
  });
27
- if (prototype)
28
- Object.setPrototypeOf(instance, prototype);
29
- return instance;
30
14
  }
31
15
  }
32
16
  export const custom = CustomType.factory;
33
- //# sourceMappingURL=custom.js.map
@@ -1,7 +1,7 @@
1
1
  import type { ZodMiniUnion } from 'zod/mini';
2
2
  import { iso } from 'zod/mini';
3
- import { TransformType } from './custom.ts';
3
+ import { CustomType, TransformType } from './custom.ts';
4
4
  export declare class DateType extends TransformType<Date, ZodMiniUnion<[iso.ZodMiniISODate, iso.ZodMiniISODateTime]>> {
5
- static factory(): DateType;
5
+ static factory(): CustomType<Date, ZodMiniUnion<[iso.ZodMiniISODate, iso.ZodMiniISODateTime]>, import("zod/mini").ZodMiniType<Date, Date, import("zod/v4/core").$ZodTypeInternals<Date, Date>>>;
6
6
  }
7
7
  export declare const date: typeof DateType.factory;
@@ -1,14 +1,12 @@
1
1
  import { iso, union } from 'zod/mini';
2
- import { CustomType, TransformType } from './custom.js';
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
8
  type: union([iso.date(), iso.datetime()]),
9
- prototype: DateType.prototype,
10
9
  });
11
10
  }
12
11
  }
13
12
  export const date = DateType.factory;
14
- //# sourceMappingURL=date.js.map
@@ -1,5 +1,5 @@
1
1
  import { enum as zodEnum } from 'zod/mini';
2
- import { BaseType } from './base.js';
2
+ import { BaseType } from "./base.js";
3
3
  export class EnumType extends BaseType {
4
4
  static factory(values) {
5
5
  return new EnumType({
@@ -10,4 +10,3 @@ export class EnumType extends BaseType {
10
10
  }
11
11
  const _enum = EnumType.factory;
12
12
  export { _enum as enum };
13
- //# sourceMappingURL=enum.js.map
@@ -1,5 +1,5 @@
1
1
  import { literal as zodLiteral } from 'zod/mini';
2
- import { BaseType } from './base.js';
2
+ import { BaseType } from "./base.js";
3
3
  export class LiteralType extends BaseType {
4
4
  static factory(value) {
5
5
  return new LiteralType({
@@ -9,4 +9,3 @@ export class LiteralType extends BaseType {
9
9
  }
10
10
  }
11
11
  export const literal = LiteralType.factory;
12
- //# sourceMappingURL=literal.js.map
@@ -1,9 +1,8 @@
1
1
  import { never as zodNever } from 'zod/mini';
2
- import { BaseType } from './base.js';
2
+ import { BaseType } from "./base.js";
3
3
  export class NeverType extends BaseType {
4
4
  static factory() {
5
5
  return new NeverType({ encodeZodType: zodNever() });
6
6
  }
7
7
  }
8
8
  export const never = NeverType.factory;
9
- //# sourceMappingURL=never.js.map
@@ -1,6 +1,6 @@
1
1
  import { gt, gte, int, lt, lte, regex, number as zodNumber, string as zodString, } from 'zod/mini';
2
- import { BaseType } from './base.js';
3
- import { CustomType, TransformType } from './custom.js';
2
+ import { BaseType } from "./base.js";
3
+ import { CustomType, TransformType } from "./custom.js";
4
4
  export class NumberType extends BaseType {
5
5
  static factory(...checks) {
6
6
  return new NumberType({
@@ -45,4 +45,3 @@ export class BigIntType extends TransformType {
45
45
  export const number = NumberType.factory;
46
46
  export const integer = IntegerType.factory;
47
47
  export const bigInt = BigIntType.factory;
48
- //# sourceMappingURL=number.js.map
@@ -1,5 +1,5 @@
1
1
  import type { core, ZodMiniObject, ZodMiniRecord } from 'zod/mini';
2
- import type { ZodPlainType } from './_utils.ts';
2
+ import type { ZodPlainType } from './_plain.ts';
3
3
  import type { BaseTypeAny, OptionalType } from './base.ts';
4
4
  import type { LiteralType } from './literal.ts';
5
5
  import type { StringType } from './string.ts';
@@ -8,72 +8,45 @@ import { EnumType } from './enum.ts';
8
8
  export type ObjectTypeProps = {
9
9
  [k: string]: BaseTypeAny;
10
10
  };
11
+ export type AnyObjectType = ObjectType<ObjectTypeProps>;
11
12
  export declare class ObjectType<T extends ObjectTypeProps = {}> extends BaseType<ZodMiniObject<{
12
13
  [K in keyof T]: T[K]['encodeZodType'];
13
- }, core.$strip>, ZodMiniObject<{
14
+ }, core.$strict>, ZodMiniObject<{
14
15
  [K in keyof T]: T[K]['decodeZodType'];
15
- }, core.$strip>, {
16
+ }, core.$strict>, {
16
17
  properties: T;
17
18
  }, ZodPlainType<ZodMiniObject<{
18
19
  [K in keyof T]: T[K]['encodeZodType'];
19
- }, core.$strip>>, ZodPlainType<ZodMiniObject<{
20
+ }, core.$strict>>, ZodPlainType<ZodMiniObject<{
20
21
  [K in keyof T]: T[K]['decodeZodType'];
21
- }, core.$strip>>> {
22
+ }, core.$strict>>> {
22
23
  static factory<T extends ObjectTypeProps = {}>(properties: T): ObjectType<T>;
23
24
  }
24
- export declare class LooseObjectType<T extends ObjectTypeProps = {}> extends BaseType<ZodMiniObject<{
25
- [K in keyof T]: T[K]['encodeZodType'];
26
- }, core.$loose>, ZodMiniObject<{
27
- [K in keyof T]: T[K]['decodeZodType'];
28
- }, core.$loose>, {
29
- properties: T;
30
- }, ZodPlainType<ZodMiniObject<{
31
- [K in keyof T]: T[K]['encodeZodType'];
32
- }, core.$loose>>, ZodPlainType<ZodMiniObject<{
33
- [K in keyof T]: T[K]['decodeZodType'];
34
- }, core.$loose>>> {
35
- static factory<T extends ObjectTypeProps = {}>(properties: T): LooseObjectType<T>;
36
- }
37
- export type ObjectLikeType<T extends ObjectTypeProps> = ObjectType<T> | LooseObjectType<T>;
38
- export type AnyObjectType = ObjectType<ObjectTypeProps>;
39
- export type AnyLooseObjectType = LooseObjectType<ObjectTypeProps>;
40
- export type AnyObjectLikeType = AnyObjectType | AnyLooseObjectType;
41
25
  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']>, {
42
26
  key: K;
43
27
  element: E;
44
28
  }, ZodPlainType<ZodMiniRecord<K['encodeZodType'], E['encodeZodType']>>, ZodPlainType<ZodMiniRecord<K['decodeZodType'], E['decodeZodType']>>> {
45
29
  static factory<K extends LiteralType<string | number> | EnumType | StringType, E extends BaseType>(key: K, element: E): RecordType<K, E>;
46
30
  }
47
- export type KeyofType<T extends AnyObjectLikeType> = EnumType<core.util.ToEnum<Extract<keyof T['props']['properties'], string>>>;
48
- export declare function keyof<T extends AnyObjectLikeType>(type: T): KeyofType<T>;
49
- export type PickObjectType<T extends AnyObjectLikeType, P extends {
31
+ export declare function keyof<T extends AnyObjectType>(type: T): EnumType<core.util.ToEnum<Extract<keyof T['props']['properties'], string>>>;
32
+ export declare function pick<T extends AnyObjectType, P extends {
50
33
  [K in keyof T['props']['properties']]?: true;
51
- }> = ObjectType<{
34
+ }>(source: T, pick: P): ObjectType<{
52
35
  [K in keyof P]: P[K] extends true ? K extends keyof T['props']['properties'] ? T['props']['properties'][K] : never : never;
53
36
  }>;
54
- export declare function pick<T extends AnyObjectLikeType, P extends {
37
+ export declare function omit<T extends AnyObjectType, P extends {
55
38
  [K in keyof T['props']['properties']]?: true;
56
- }>(source: T, pick: P): PickObjectType<T, P>;
57
- export type OmitObjectType<T extends AnyObjectLikeType, P extends {
58
- [K in keyof T['props']['properties']]?: true;
59
- }> = ObjectType<{
39
+ }>(source: T, omit: P): ObjectType<{
60
40
  [K in keyof T['props']['properties'] as K extends keyof P ? never : K]: T['props']['properties'][K];
61
41
  }>;
62
- export declare function omit<T extends AnyObjectLikeType, P extends {
63
- [K in keyof T['props']['properties']]?: true;
64
- }>(source: T, omit: P): OmitObjectType<T, P>;
65
- export type ExtendObjectType<T extends AnyObjectLikeType, P extends ObjectTypeProps> = ObjectType<{
42
+ export declare function extend<T extends AnyObjectType, P extends ObjectTypeProps>(object1: T, properties: P): ObjectType<{
66
43
  [K in keyof T['props']['properties'] | keyof P]: K extends keyof P ? P[K] : K extends keyof T['props']['properties'] ? T['props']['properties'][K] : never;
67
44
  }>;
68
- export declare function extend<T extends AnyObjectLikeType, P extends ObjectTypeProps>(object1: T, properties: P): ExtendObjectType<T, P>;
69
- export type MergeObjectTypes<T1 extends AnyObjectLikeType, T2 extends AnyObjectLikeType> = ObjectType<{
45
+ export declare function merge<T1 extends AnyObjectType, T2 extends AnyObjectType>(object1: T1, object2: T2): ObjectType<{
70
46
  [K in keyof T1['props']['properties'] | keyof T2['props']['properties']]: K extends keyof T2['props']['properties'] ? T2['props']['properties'][K] : K extends keyof T1['props']['properties'] ? T1['props']['properties'][K] : never;
71
47
  }>;
72
- export declare function merge<T1 extends AnyObjectLikeType, T2 extends AnyObjectLikeType>(object1: T1, object2: T2): MergeObjectTypes<T1, T2>;
73
- export type PartialObjectType<T extends AnyObjectLikeType> = ObjectType<{
74
- [K in keyof T['props']['properties']]: OptionalType<T['props']['properties'][K]>;
48
+ export declare function partial<T extends AnyObjectType, P extends T extends ObjectType<infer Props> ? Props : never>(object: T): ObjectType<{
49
+ [K in keyof P]: OptionalType<P[K]>;
75
50
  }>;
76
- export declare function partial<T extends AnyObjectLikeType>(object: T): PartialObjectType<T>;
77
51
  export declare const object: typeof ObjectType.factory;
78
- export declare const looseObject: typeof LooseObjectType.factory;
79
52
  export declare const record: typeof RecordType.factory;
@@ -1,7 +1,7 @@
1
- import { looseObject as zodLooseObject, object as zodObject, record as zodRecord, } from 'zod/mini';
2
- import { zodPlainType } from './_utils.js';
3
- import { BaseType } from './base.js';
4
- import { EnumType } from './enum.js';
1
+ import { object as zodObject, record as zodRecord } from 'zod/mini';
2
+ import { zodPlainType } from "./_plain.js";
3
+ import { BaseType } from "./base.js";
4
+ import { EnumType } from "./enum.js";
5
5
  export class ObjectType extends BaseType {
6
6
  static factory(properties) {
7
7
  const encodeProperties = {};
@@ -17,21 +17,6 @@ export class ObjectType extends BaseType {
17
17
  });
18
18
  }
19
19
  }
20
- export class LooseObjectType extends BaseType {
21
- static factory(properties) {
22
- const encodeProperties = {};
23
- const decodeProperties = {};
24
- for (const key in properties) {
25
- encodeProperties[key] = properties[key].encodeZodType;
26
- decodeProperties[key] = properties[key].decodeZodType;
27
- }
28
- return new LooseObjectType({
29
- encodeZodType: zodLooseObject(encodeProperties),
30
- decodeZodType: zodLooseObject(decodeProperties),
31
- props: { properties },
32
- });
33
- }
34
- }
35
20
  export class RecordType extends BaseType {
36
21
  static factory(key, element) {
37
22
  return new RecordType({
@@ -72,6 +57,4 @@ export function partial(object) {
72
57
  return ObjectType.factory(properties);
73
58
  }
74
59
  export const object = ObjectType.factory;
75
- export const looseObject = LooseObjectType.factory;
76
60
  export const record = RecordType.factory;
77
- //# sourceMappingURL=object.js.map
@@ -1,5 +1,5 @@
1
1
  import { cuid, cuid2, e164, email, emoji, ipv4, ipv6, jwt, maxLength, minLength, nanoid, regex, url, uuid, string as zodString, } from 'zod/mini';
2
- import { BaseType } from './base.js';
2
+ import { BaseType } from "./base.js";
3
3
  export class StringType extends BaseType {
4
4
  static factory(...checks) {
5
5
  return new StringType({
@@ -51,4 +51,3 @@ export class StringType extends BaseType {
51
51
  }
52
52
  }
53
53
  export const string = StringType.factory;
54
- //# sourceMappingURL=string.js.map
@@ -1,26 +1,26 @@
1
1
  import type { Temporal } from 'temporal-spec';
2
2
  import type { ZodMiniString } from 'zod/mini';
3
- import { TransformType } from './custom.ts';
3
+ import { CustomType, TransformType } from './custom.ts';
4
4
  type EncodeType = ZodMiniString<string>;
5
5
  export declare class PlainDateType extends TransformType<Temporal.PlainDate, EncodeType> {
6
- static factory(implementation: typeof Temporal): PlainDateType;
6
+ static factory(implementation: typeof Temporal): CustomType<Temporal.PlainDate, EncodeType, import("zod/mini").ZodMiniType<Temporal.PlainDate, Temporal.PlainDate, import("zod/v4/core").$ZodTypeInternals<Temporal.PlainDate, Temporal.PlainDate>>>;
7
7
  }
8
8
  export declare class PlainDateTimeType extends TransformType<Temporal.PlainDateTime, EncodeType> {
9
- static factory(implementation: typeof Temporal): PlainDateTimeType;
9
+ static factory(implementation: typeof Temporal): CustomType<Temporal.PlainDateTime, EncodeType, import("zod/mini").ZodMiniType<Temporal.PlainDateTime, Temporal.PlainDateTime, import("zod/v4/core").$ZodTypeInternals<Temporal.PlainDateTime, Temporal.PlainDateTime>>>;
10
10
  }
11
11
  export declare class ZonedDateTimeType extends TransformType<Temporal.ZonedDateTime, EncodeType> {
12
- static factory(implementation: typeof Temporal): ZonedDateTimeType;
12
+ static factory(implementation: typeof Temporal): CustomType<Temporal.ZonedDateTime, EncodeType, import("zod/mini").ZodMiniType<Temporal.ZonedDateTime, Temporal.ZonedDateTime, import("zod/v4/core").$ZodTypeInternals<Temporal.ZonedDateTime, Temporal.ZonedDateTime>>>;
13
13
  }
14
14
  export declare class PlainTimeType extends TransformType<Temporal.PlainTime, EncodeType> {
15
- static factory(implementation: typeof Temporal): PlainTimeType;
15
+ static factory(implementation: typeof Temporal): CustomType<Temporal.PlainTime, EncodeType, import("zod/mini").ZodMiniType<Temporal.PlainTime, Temporal.PlainTime, import("zod/v4/core").$ZodTypeInternals<Temporal.PlainTime, Temporal.PlainTime>>>;
16
16
  }
17
17
  export declare class DurationType extends TransformType<Temporal.Duration, EncodeType> {
18
- static factory(implementation: typeof Temporal): DurationType;
18
+ static factory(implementation: typeof Temporal): CustomType<Temporal.Duration, EncodeType, import("zod/mini").ZodMiniType<Temporal.Duration, Temporal.Duration, import("zod/v4/core").$ZodTypeInternals<Temporal.Duration, Temporal.Duration>>>;
19
19
  }
20
20
  export declare class PlainYearMonthType extends TransformType<Temporal.PlainYearMonth, EncodeType> {
21
- static factory(implementation: typeof Temporal): PlainYearMonthType;
21
+ static factory(implementation: typeof Temporal): CustomType<Temporal.PlainYearMonth, EncodeType, import("zod/mini").ZodMiniType<Temporal.PlainYearMonth, Temporal.PlainYearMonth, import("zod/v4/core").$ZodTypeInternals<Temporal.PlainYearMonth, Temporal.PlainYearMonth>>>;
22
22
  }
23
23
  export declare class PlainMonthDayType extends TransformType<Temporal.PlainMonthDay, EncodeType> {
24
- static factory(implementation: typeof Temporal): PlainMonthDayType;
24
+ static factory(implementation: typeof Temporal): CustomType<Temporal.PlainMonthDay, EncodeType, import("zod/mini").ZodMiniType<Temporal.PlainMonthDay, Temporal.PlainMonthDay, import("zod/v4/core").$ZodTypeInternals<Temporal.PlainMonthDay, Temporal.PlainMonthDay>>>;
25
25
  }
26
26
  export {};
@@ -1,5 +1,5 @@
1
1
  import { iso, regex, string } from 'zod/mini';
2
- import { CustomType, TransformType } from './custom.js';
2
+ import { CustomType, TransformType } from "./custom.js";
3
3
  const createTemporalTransformer = (implementation, type, decode = (value) => implementation[type].from(value), encode = (value) => value.toString({
4
4
  calendarName: 'never',
5
5
  smallestUnit: 'microsecond',
@@ -91,4 +91,3 @@ export class PlainMonthDayType extends TransformType {
91
91
  });
92
92
  }
93
93
  }
94
- //# sourceMappingURL=temporal.js.map
@@ -1,6 +1,6 @@
1
1
  import type { ArrayMap } from '@nmtjs/common';
2
2
  import type { ZodMiniTuple } from 'zod/mini';
3
- import type { ZodPlainType } from './_utils.ts';
3
+ import type { ZodPlainType } from './_plain.ts';
4
4
  import { BaseType } from './base.ts';
5
5
  export declare class TupleType<T extends readonly [BaseType, ...BaseType[]] = readonly [
6
6
  BaseType,
@@ -1,5 +1,5 @@
1
1
  import { tuple as zodTuple } from 'zod/mini';
2
- import { BaseType } from './base.js';
2
+ import { BaseType } from "./base.js";
3
3
  export class TupleType extends BaseType {
4
4
  static factory(elements, rest = null) {
5
5
  const encode = elements.map((el) => el.encodeZodType);
@@ -14,4 +14,3 @@ export class TupleType extends BaseType {
14
14
  }
15
15
  }
16
16
  export const tuple = TupleType.factory;
17
- //# sourceMappingURL=tuple.js.map
@@ -1,6 +1,6 @@
1
1
  import type { ArrayMap } from '@nmtjs/common';
2
2
  import type { ZodMiniDiscriminatedUnion, ZodMiniIntersection, ZodMiniUnion } from 'zod/mini';
3
- import type { ZodPlainType } from './_utils.ts';
3
+ import type { ZodPlainType } from './_plain.ts';
4
4
  import type { BaseTypeAny } from './base.ts';
5
5
  import type { LiteralType } from './literal.ts';
6
6
  import type { ObjectType, ObjectTypeProps } from './object.ts';