@nmtjs/type 0.6.5 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +34 -31
- package/dist/index.js.map +1 -1
- package/dist/temporal.js +0 -1
- package/dist/temporal.js.map +1 -1
- package/dist/types/any.js +4 -4
- package/dist/types/any.js.map +1 -1
- package/dist/types/array.js +21 -23
- package/dist/types/array.js.map +1 -1
- package/dist/types/base.js +65 -66
- package/dist/types/base.js.map +1 -1
- package/dist/types/boolean.js +4 -4
- package/dist/types/boolean.js.map +1 -1
- package/dist/types/custom.js +9 -8
- package/dist/types/custom.js.map +1 -1
- package/dist/types/date.js +8 -13
- package/dist/types/date.js.map +1 -1
- package/dist/types/enum.js +7 -16
- package/dist/types/enum.js.map +1 -1
- package/dist/types/literal.js +7 -6
- package/dist/types/literal.js.map +1 -1
- package/dist/types/never.js +4 -4
- package/dist/types/never.js.map +1 -1
- package/dist/types/number.js +39 -92
- package/dist/types/number.js.map +1 -1
- package/dist/types/object.js +42 -31
- package/dist/types/object.js.map +1 -1
- package/dist/types/string.js +49 -47
- package/dist/types/string.js.map +1 -1
- package/dist/types/temporal.js +75 -41
- package/dist/types/temporal.js.map +1 -1
- package/dist/types/union.js +26 -18
- package/dist/types/union.js.map +1 -1
- package/package.json +7 -19
- package/src/index.ts +22 -24
- package/src/temporal.ts +1 -1
- package/src/types/any.ts +5 -3
- package/src/types/array.ts +37 -22
- package/src/types/base.ts +149 -81
- package/src/types/boolean.ts +5 -3
- package/src/types/custom.ts +59 -26
- package/src/types/date.ts +13 -17
- package/src/types/enum.ts +12 -22
- package/src/types/literal.ts +9 -6
- package/src/types/never.ts +5 -3
- package/src/types/number.ts +43 -90
- package/src/types/object.ts +45 -37
- package/src/types/string.ts +68 -37
- package/src/types/temporal.ts +69 -53
- package/src/types/union.ts +54 -50
- package/dist/compiler.js +0 -55
- package/dist/compiler.js.map +0 -1
- package/dist/formats.js +0 -127
- package/dist/formats.js.map +0 -1
- package/dist/inference.js +0 -1
- package/dist/inference.js.map +0 -1
- package/dist/parse.js +0 -145
- package/dist/parse.js.map +0 -1
- package/dist/runtime.js +0 -73
- package/dist/runtime.js.map +0 -1
- package/dist/schemas/default.js +0 -6
- package/dist/schemas/default.js.map +0 -1
- package/dist/schemas/discriminated-union.js +0 -9
- package/dist/schemas/discriminated-union.js.map +0 -1
- package/dist/schemas/nullable.js +0 -11
- package/dist/schemas/nullable.js.map +0 -1
- package/dist/utils.js +0 -1
- package/dist/utils.js.map +0 -1
- package/src/compiler.ts +0 -100
- package/src/formats.ts +0 -182
- package/src/inference.ts +0 -128
- package/src/parse.ts +0 -217
- package/src/runtime.ts +0 -137
- package/src/schemas/default.ts +0 -12
- package/src/schemas/discriminated-union.ts +0 -49
- package/src/schemas/nullable.ts +0 -20
- package/src/utils.ts +0 -24
package/dist/index.js
CHANGED
|
@@ -1,44 +1,47 @@
|
|
|
1
|
+
import * as zod from "@zod/mini";
|
|
1
2
|
import { AnyType } from "./types/any.js";
|
|
2
3
|
import { ArrayType } from "./types/array.js";
|
|
3
4
|
import { BooleanType } from "./types/boolean.js";
|
|
4
5
|
import { CustomType } from "./types/custom.js";
|
|
5
6
|
import { DateType } from "./types/date.js";
|
|
6
|
-
import { EnumType
|
|
7
|
+
import { EnumType } from "./types/enum.js";
|
|
7
8
|
import { LiteralType } from "./types/literal.js";
|
|
8
9
|
import { NeverType } from "./types/never.js";
|
|
9
10
|
import { BigIntType, IntegerType, NumberType } from "./types/number.js";
|
|
10
11
|
import { extend, keyof, merge, ObjectType, omit, partial, pick, RecordType } from "./types/object.js";
|
|
11
12
|
import { StringType } from "./types/string.js";
|
|
12
13
|
import { DiscriminatedUnionType, IntersactionType, UnionType } from "./types/union.js";
|
|
13
|
-
|
|
14
|
+
zod.config(zod.core.locales.en());
|
|
15
|
+
export { NeemataTypeError } from "./types/base.js";
|
|
14
16
|
export { BaseType } from "./types/base.js";
|
|
15
|
-
export { ArrayType, BooleanType, CustomType, DateType, EnumType, LiteralType, IntegerType, NumberType, ObjectType, StringType, IntersactionType, UnionType, AnyType, NeverType,
|
|
16
|
-
export
|
|
17
|
-
(function(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
17
|
+
export { ArrayType, BooleanType, CustomType, DateType, EnumType, LiteralType, IntegerType, NumberType, ObjectType, StringType, IntersactionType, UnionType, AnyType, NeverType, DiscriminatedUnionType, RecordType };
|
|
18
|
+
export let type;
|
|
19
|
+
(function(_type) {
|
|
20
|
+
const never = _type.never = NeverType.factory;
|
|
21
|
+
const boolean = _type.boolean = BooleanType.factory;
|
|
22
|
+
const string = _type.string = StringType.factory;
|
|
23
|
+
const number = _type.number = NumberType.factory;
|
|
24
|
+
const integer = _type.integer = IntegerType.factory;
|
|
25
|
+
const bitint = _type.bitint = BigIntType.factory;
|
|
26
|
+
const literal = _type.literal = LiteralType.factory;
|
|
27
|
+
const enumeration = _type.enumeration = EnumType.factory;
|
|
28
|
+
const date = _type.date = DateType.factory;
|
|
29
|
+
const array = _type.array = ArrayType.factory;
|
|
30
|
+
const record = _type.record = RecordType.factory;
|
|
31
|
+
const any = _type.any = AnyType.factory;
|
|
32
|
+
const or = _type.or = UnionType.factory;
|
|
33
|
+
const and = _type.and = IntersactionType.factory;
|
|
34
|
+
const union = _type.union = UnionType.factory;
|
|
35
|
+
const intersaction = _type.intersaction = IntersactionType.factory;
|
|
36
|
+
const discriminatedUnion = _type.discriminatedUnion = DiscriminatedUnionType.factory;
|
|
37
|
+
const custom = _type.custom = CustomType.factory;
|
|
38
|
+
const object = _type.object = Object.assign(ObjectType.factory.bind(ObjectType), {
|
|
39
|
+
keyof,
|
|
40
|
+
partial,
|
|
41
|
+
merge,
|
|
42
|
+
omit,
|
|
43
|
+
extend,
|
|
44
|
+
pick
|
|
45
|
+
});
|
|
43
46
|
})(type || (type = {}));
|
|
44
|
-
export { type as t };
|
|
47
|
+
export { type as t, zod };
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"
|
|
1
|
+
{"mappings":"AAAA,YAAY,SAAS,WAAW;AAChC,SAAS,eAAe,gBAAgB;AACxC,SAAS,iBAAiB,kBAAkB;AAE5C,SAAS,mBAAmB,oBAAoB;AAChD,SAAS,kBAAkB,mBAAmB;AAC9C,SAAS,gBAAgB,iBAAiB;AAC1C,SAAS,gBAAgB,iBAAiB;AAC1C,SAAS,mBAAmB,oBAAoB;AAChD,SAAS,iBAAiB,kBAAkB;AAC5C,SAAS,YAAY,aAAa,kBAAkB,mBAAmB;AACvE,SACE,QACA,OACA,OACA,YACA,MACA,SACA,MACA,kBACK,mBAAmB;AAC1B,SAAS,kBAAkB,mBAAmB;AAC9C,SACE,wBACA,kBACA,iBACK,kBAAkB;AAEzB,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC;AAEjC,SAAS,wBAAwB;AACjC,SAAS,gBAAkC;AAC3C,SACE,WACA,aACA,YACA,UACA,UACA,aACA,aACA,YACA,YACA,YACA,kBACA,WACA,SACA,WACA,wBACA;;AAGK;CAiBE,MAAM,sBAAQ,UAAU;CACxB,MAAM,0BAAU,YAAY;CAC5B,MAAM,wBAAS,WAAW;CAC1B,MAAM,wBAAS,WAAW;CAC1B,MAAM,0BAAU,YAAY;CAC5B,MAAM,wBAAS,WAAW;CAC1B,MAAM,0BAAU,YAAY;CAC5B,MAAM,kCAAc,SAAS;CAC7B,MAAM,oBAAO,SAAS;CACtB,MAAM,sBAAQ,UAAU;CACxB,MAAM,wBAAS,WAAW;CAC1B,MAAM,kBAAM,QAAQ;CACpB,MAAM,gBAAK,UAAU;CACrB,MAAM,kBAAM,iBAAiB;CAC7B,MAAM,sBAAQ,UAAU;CACxB,MAAM,oCAAe,iBAAiB;CACtC,MAAM,gDAAqB,uBAAuB;CAClD,MAAM,wBAAS,WAAW;CAC1B,MAAM,wBAAS,OAAO,OAAO,WAAW,QAAQ,KAAK,WAAW,EAAE;EACvE;EACA;EACA;EACA;EACA;EACA;CACD,EAAC;;AAGJ,SAAS,QAAQ,GAAG","names":[],"sources":["src/index.ts"],"sourcesContent":["import * as zod from '@zod/mini'\nimport { AnyType } from './types/any.ts'\nimport { ArrayType } from './types/array.ts'\nimport type { BaseTypeAny } from './types/base.ts'\nimport { BooleanType } from './types/boolean.ts'\nimport { CustomType } from './types/custom.ts'\nimport { DateType } from './types/date.ts'\nimport { EnumType } from './types/enum.ts'\nimport { LiteralType } from './types/literal.ts'\nimport { NeverType } from './types/never.ts'\nimport { BigIntType, IntegerType, NumberType } from './types/number.ts'\nimport {\n extend,\n keyof,\n merge,\n ObjectType,\n omit,\n partial,\n pick,\n RecordType,\n} from './types/object.ts'\nimport { StringType } from './types/string.ts'\nimport {\n DiscriminatedUnionType,\n IntersactionType,\n UnionType,\n} from './types/union.ts'\n\nzod.config(zod.core.locales.en())\n\nexport { NeemataTypeError } from './types/base.ts'\nexport { BaseType, type BaseTypeAny } from './types/base.ts'\nexport {\n ArrayType,\n BooleanType,\n CustomType,\n DateType,\n EnumType,\n LiteralType,\n IntegerType,\n NumberType,\n ObjectType,\n StringType,\n IntersactionType,\n UnionType,\n AnyType,\n NeverType,\n DiscriminatedUnionType,\n RecordType,\n}\n\nexport namespace type {\n export namespace infer {\n export type decoded<T extends BaseTypeAny> =\n T['decodedZodType']['_zod']['output']\n\n export type encoded<T extends BaseTypeAny> =\n T['encodedZodType']['_zod']['output']\n\n export namespace input {\n export type decoded<T extends BaseTypeAny> =\n T['decodedZodType']['_zod']['input']\n\n export type encoded<T extends BaseTypeAny> =\n T['encodedZodType']['_zod']['input']\n }\n }\n\n export const never = NeverType.factory\n export const boolean = BooleanType.factory\n export const string = StringType.factory\n export const number = NumberType.factory\n export const integer = IntegerType.factory\n export const bitint = BigIntType.factory\n export const literal = LiteralType.factory\n export const enumeration = EnumType.factory\n export const date = DateType.factory\n export const array = ArrayType.factory\n export const record = RecordType.factory\n export const any = AnyType.factory\n export const or = UnionType.factory\n export const and = IntersactionType.factory\n export const union = UnionType.factory\n export const intersaction = IntersactionType.factory\n export const discriminatedUnion = DiscriminatedUnionType.factory\n export const custom = CustomType.factory\n export const object = Object.assign(ObjectType.factory.bind(ObjectType), {\n keyof,\n partial,\n merge,\n omit,\n extend,\n pick,\n })\n}\n\nexport { type as t, zod }\n"],"version":3}
|
package/dist/temporal.js
CHANGED
|
@@ -6,4 +6,3 @@ export const zonedDatetime = ZonedDateTimeType.factory;
|
|
|
6
6
|
export const duration = DurationType.factory;
|
|
7
7
|
export const plainYearMonth = PlainYearMonthType.factory;
|
|
8
8
|
export const plainMonthDay = PlainMonthDayType.factory;
|
|
9
|
-
export { DurationType, PlainDateTimeType, PlainDateType, PlainMonthDayType, PlainTimeType, PlainYearMonthType, ZonedDateTimeType, };
|
package/dist/temporal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"
|
|
1
|
+
{"mappings":"AAAA,SACE,cACA,mBACA,eACA,mBACA,eACA,oBACA,yBACK,qBAAqB;AAE5B,OAAO,MAAM,YAAY,cAAc;AACvC,OAAO,MAAM,gBAAgB,kBAAkB;AAC/C,OAAO,MAAM,YAAY,cAAc;AACvC,OAAO,MAAM,gBAAgB,kBAAkB;AAC/C,OAAO,MAAM,WAAW,aAAa;AACrC,OAAO,MAAM,iBAAiB,mBAAmB;AACjD,OAAO,MAAM,gBAAgB,kBAAkB","names":[],"sources":["src/temporal.ts"],"sourcesContent":["import {\n DurationType,\n PlainDateTimeType,\n PlainDateType,\n PlainMonthDayType,\n PlainTimeType,\n PlainYearMonthType,\n ZonedDateTimeType,\n} from './types/temporal.ts'\n\nexport const plainDate = PlainDateType.factory\nexport const plainDatetime = PlainDateTimeType.factory\nexport const plainTime = PlainTimeType.factory\nexport const zonedDatetime = ZonedDateTimeType.factory\nexport const duration = DurationType.factory\nexport const plainYearMonth = PlainYearMonthType.factory\nexport const plainMonthDay = PlainMonthDayType.factory\n\nexport type {\n DurationType,\n PlainDateTimeType,\n PlainDateType,\n PlainMonthDayType,\n PlainTimeType,\n PlainYearMonthType,\n ZonedDateTimeType,\n}\n"],"version":3}
|
package/dist/types/any.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { any } from "@zod/mini";
|
|
2
2
|
import { BaseType } from "./base.js";
|
|
3
3
|
export class AnyType extends BaseType {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
static factory() {
|
|
5
|
+
return new AnyType({ encodedZodType: any() });
|
|
6
|
+
}
|
|
7
7
|
}
|
package/dist/types/any.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"
|
|
1
|
+
{"mappings":"AAAA,SAAS,WAA4B,WAAW;AAChD,SAAS,gBAAgB,WAAW;AAEpC,OAAO,MAAM,gBAAgB,SAAqB;CAChD,OAAO,UAAU;AACf,SAAO,IAAI,QAAQ,EACjB,gBAAgB,KAAK,CACtB;CACF;AACF","names":[],"sources":["src/types/any.ts"],"sourcesContent":["import { any, type ZodMiniAny } from '@zod/mini'\nimport { BaseType } from './base.ts'\n\nexport class AnyType extends BaseType<ZodMiniAny> {\n static factory() {\n return new AnyType({\n encodedZodType: any(),\n })\n }\n}\n"],"version":3}
|
package/dist/types/array.js
CHANGED
|
@@ -1,26 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { array, length, maxLength, minLength } from "@zod/mini";
|
|
2
2
|
import { BaseType } from "./base.js";
|
|
3
3
|
export class ArrayType extends BaseType {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
});
|
|
25
|
-
}
|
|
4
|
+
static factory(element, ...checks) {
|
|
5
|
+
return new ArrayType({
|
|
6
|
+
encodedZodType: array(element.encodedZodType).check(...checks),
|
|
7
|
+
decodedZodType: array(element.decodedZodType).check(...checks),
|
|
8
|
+
params: { checks },
|
|
9
|
+
props: { element }
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
min(value) {
|
|
13
|
+
const check = minLength(value);
|
|
14
|
+
return ArrayType.factory(this.props.element, ...this.params.checks, check);
|
|
15
|
+
}
|
|
16
|
+
max(value) {
|
|
17
|
+
const check = maxLength(value);
|
|
18
|
+
return ArrayType.factory(this.props.element, ...this.params.checks, check);
|
|
19
|
+
}
|
|
20
|
+
length(value) {
|
|
21
|
+
const check = length(value);
|
|
22
|
+
return ArrayType.factory(this.props.element, ...this.params.checks, check);
|
|
23
|
+
}
|
|
26
24
|
}
|
package/dist/types/array.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"
|
|
1
|
+
{"mappings":"AAAA,SACE,OAEA,QACA,WACA,iBAEK,WAAW;AAClB,SAAS,gBAAgB,WAAW;AAIpC,OAAO,MAAM,kBAAiD,SAI5D;CACA,OAAO,QAA4BA,SAAY,GAAG,QAAiB;AACjE,SAAO,IAAI,UAAa;GACtB,gBAAgB,MAAM,QAAQ,eAAe,CAAC,MAAM,GAAG,OAAO;GAC9D,gBAAgB,MAAM,QAAQ,eAAe,CAAC,MAAM,GAAG,OAAO;GAC9D,QAAQ,EAAE,OAAQ;GAClB,OAAO,EAAE,QAAS;EACnB;CACF;CAED,IAAIC,OAAe;EACjB,MAAM,QAAQ,UAAU,MAAM;AAC9B,SAAO,UAAU,QACf,KAAK,MAAM,SACX,GAAG,KAAK,OAAO,QACf,MACD;CACF;CAED,IAAIA,OAAe;EACjB,MAAM,QAAQ,UAAU,MAAM;AAC9B,SAAO,UAAU,QACf,KAAK,MAAM,SACX,GAAG,KAAK,OAAO,QACf,MACD;CACF;CAED,OAAOA,OAAe;EACpB,MAAM,QAAQ,OAAO,MAAM;AAC3B,SAAO,UAAU,QACf,KAAK,MAAM,SACX,GAAG,KAAK,OAAO,QACf,MACD;CACF;AACF","names":["element: T","value: number"],"sources":["src/types/array.ts"],"sourcesContent":["import {\n array,\n type core,\n length,\n maxLength,\n minLength,\n type ZodMiniArray,\n} from '@zod/mini'\nimport { BaseType } from './base.ts'\n\ntype Check = core.CheckFn<any[]> | core.$ZodCheck<any[]>\n\nexport class ArrayType<T extends BaseType = BaseType> extends BaseType<\n ZodMiniArray<T['encodedZodType']>,\n ZodMiniArray<T['decodedZodType']>,\n { element: T }\n> {\n static factory<T extends BaseType>(element: T, ...checks: Check[]) {\n return new ArrayType<T>({\n encodedZodType: array(element.encodedZodType).check(...checks),\n decodedZodType: array(element.decodedZodType).check(...checks),\n params: { checks },\n props: { element },\n })\n }\n\n min(value: number) {\n const check = minLength(value)\n return ArrayType.factory<T>(\n this.props.element,\n ...this.params.checks,\n check,\n )\n }\n\n max(value: number) {\n const check = maxLength(value)\n return ArrayType.factory<T>(\n this.props.element,\n ...this.params.checks,\n check,\n )\n }\n\n length(value: number) {\n const check = length(value)\n return ArrayType.factory<T>(\n this.props.element,\n ...this.params.checks,\n check,\n )\n }\n}\n"],"version":3}
|
package/dist/types/base.js
CHANGED
|
@@ -1,74 +1,73 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
+
}
|
|
44
48
|
}
|
|
45
49
|
export class OptionalType extends BaseType {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
});
|
|
53
|
-
}
|
|
50
|
+
static factory(type) {
|
|
51
|
+
return new OptionalType({
|
|
52
|
+
encodedZodType: optional(type.encodedZodType),
|
|
53
|
+
props: { inner: type }
|
|
54
|
+
});
|
|
55
|
+
}
|
|
54
56
|
}
|
|
55
57
|
export class NullableType extends BaseType {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
});
|
|
63
|
-
}
|
|
58
|
+
static factory(type) {
|
|
59
|
+
return new NullableType({
|
|
60
|
+
encodedZodType: nullable(type.encodedZodType),
|
|
61
|
+
props: { inner: type }
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
64
|
}
|
|
65
65
|
export class DefaultType extends BaseType {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
66
|
+
static factory(type, defaultValue) {
|
|
67
|
+
return new DefaultType({
|
|
68
|
+
encodedZodType: _default(type.encodedZodType, type.params.encode?.(defaultValue) ?? defaultValue),
|
|
69
|
+
decodedZodType: _default(type.decodedZodType, defaultValue),
|
|
70
|
+
props: { inner: type }
|
|
71
|
+
});
|
|
72
|
+
}
|
|
74
73
|
}
|
package/dist/types/base.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"
|
|
1
|
+
{"mappings":"AAAA,SACE,UACA,MACA,UACA,UACA,gBAmBK,WAAW;AAkDlB,OAAO,MAAM,gBAAgB,UAAwB;AAErD,OAAO,MAAM,mBAAmB,KAAK;AAGrC,OAAO,MAAe,SAIpB;CACA,AAAS;CACT,AAAS;CACT,AAAS;CACT,AAAS;CAET,YAAY,EACV,gBACA,iBAAiB,gBACjB,QAAQ,CAAE,GACV,SAAS,CAAE,GAMZ,EAAE;AACD,OAAK,iBAAiB;AACtB,OAAK,iBAAiB;AAEtB,OAAK,QAAQ;AACb,OAAK,SAAS,OAAO,OAAO,EAAE,QAAQ,CAAE,EAAE,GAAE,OAAO;CACpD;CAED,WAA+B;AAC7B,SAAO,aAAa,QAAQ,KAAK;CAClC;CAED,WAA+B;AAC7B,SAAO,aAAa,QAAQ,KAAK;CAClC;CAED,UAAU;AACR,SAAO,KAAK,UAAU,CAAC,UAAU;CAClC;CAED,QAAQA,OAAmE;AACzE,SAAO,YAAY,QAAQ,MAAM,MAAM;CACxC;CAED,MAAMC,OAAqB;AACzB,SAAO,KAAK,KAAK,EAAE,MAAO,EAAC;CAC5B;CAED,YAAYC,aAA2B;AACrC,SAAO,KAAK,KAAK,EAAE,YAAa,EAAC;CAClC;CAED,SAAS,GAAG,UAA2D;AACrE,SAAO,KAAK,KAAK,EACf,UAAU,KAAK,OAAO,SAClB,SAAS,IAAI,KAAK,OAAO,OAAO,GAChC,SACL,EAAC;CACH;CAED,KAAKC,aAAiC;EACpC,MAAM,WAAW,cAAc,IAAI,KAAK,eAAe,IAAI,CAAE;AAC7D,SAAO,OAAO,UAAU,YAAY;AACpC,gBAAc,IAAI,KAAK,gBAAgB,SAAS;AAChD,SAAO;CACR;CAED,OACEC,MAC0C;AAC1C,SAAO,KAAK,eAAe,MAAM,MAAM,EAAE,aAAa,KAAM,EAAC;CAC9D;CAED,OACEC,MAC0C;AAC1C,SAAO,KAAK,eAAe,MAAM,MAAM,EAAE,aAAa,KAAM,EAAC;CAC9D;AACF;AAED,OAAO,MAAM,qBAEH,SAIR;CACA,OAAO,QAA+BC,MAAS;AAC7C,SAAO,IAAI,aAAgB;GACzB,gBAAgB,SAAS,KAAK,eAAe;GAC7C,OAAO,EAAE,OAAO,KAAM;EACvB;CACF;AACF;AAED,OAAO,MAAM,qBAEH,SAIR;CACA,OAAO,QAAoCA,MAAS;AAClD,SAAO,IAAI,aAAgB;GACzB,gBAAgB,SAAS,KAAK,eAAe;GAC7C,OAAO,EAAE,OAAO,KAAM;EACvB;CACF;AACF;AAED,OAAO,MAAM,oBAEH,SAIR;CACA,OAAO,QAAoCA,MAASC,cAAmB;AACrE,SAAO,IAAI,YAAe;GACxB,gBAAgB,SACd,KAAK,gBACL,KAAK,OAAO,SAAS,aAAa,IAAI,aACvC;GACD,gBAAgB,SAAS,KAAK,gBAAgB,aAAa;GAC3D,OAAO,EAAE,OAAO,KAAM;EACvB;CACF;AACF","names":["value: this['encodedZodType']['_zod']['input']","title: string","description: string","newMetadata: TypeMetadata","data: this['encodedZodType']['_zod']['input']","data: this['decodedZodType']['_zod']['input']","type: T","defaultValue: any"],"sources":["src/types/base.ts"],"sourcesContent":["import {\n _default,\n core,\n nullable,\n optional,\n registry,\n type ZodMiniAny,\n type ZodMiniArray,\n type ZodMiniBoolean,\n type ZodMiniDefault,\n type ZodMiniEnum,\n type ZodMiniInterface,\n type ZodMiniIntersection,\n type ZodMiniLiteral,\n type ZodMiniNever,\n type ZodMiniNullable,\n type ZodMiniNumber,\n type ZodMiniObject,\n type ZodMiniOptional,\n type ZodMiniPipe,\n type ZodMiniRecord,\n type ZodMiniString,\n type ZodMiniType,\n type ZodMiniUnion,\n} from '@zod/mini'\n\nexport type PrimitiveValueType = string | number | boolean | null\n\nexport type SimpleZodType =\n | ZodMiniNever\n | ZodMiniDefault\n | ZodMiniNullable\n | ZodMiniOptional\n | ZodMiniString\n | ZodMiniObject\n | ZodMiniAny\n | ZodMiniArray\n | ZodMiniBoolean\n | ZodMiniNumber\n | ZodMiniEnum<any>\n | ZodMiniLiteral<PrimitiveValueType>\n | ZodMiniUnion\n | ZodMiniIntersection\n | ZodMiniInterface\n | ZodMiniRecord\n | ZodMiniPipe\n\nexport type ZodType = SimpleZodType | ZodMiniType\n\nexport type TypeProps = Record<string, any>\n\nexport type TypeMetadata<T = any> = {\n id?: string\n description?: string\n examples?: T[]\n title?: string\n}\n\nexport type TypeParams = {\n encode?: (value: any) => any\n metadata?: TypeMetadata\n checks: Array<core.CheckFn<any> | core.$ZodCheck<any>>\n}\n\nexport type DefaultTypeParams = {\n encode?: TypeParams['encode']\n metadata?: TypeMetadata\n}\n\nexport type BaseTypeAny<\n EncodedZodType extends SimpleZodType = SimpleZodType,\n DecodedZodType extends ZodType = ZodMiniType,\n> = BaseType<EncodedZodType, DecodedZodType, TypeProps>\n\nexport const typesRegistry = registry<TypeMetadata>()\n\nexport const NeemataTypeError = core.$ZodError\nexport type NeemataTypeError = core.$ZodError\n\nexport abstract class BaseType<\n EncodedZodType extends SimpleZodType = SimpleZodType,\n DecodedZodType extends ZodType = EncodedZodType,\n Props extends TypeProps = TypeProps,\n> {\n readonly encodedZodType: EncodedZodType\n readonly decodedZodType: DecodedZodType\n readonly props: Props\n readonly params: TypeParams\n\n constructor({\n encodedZodType,\n decodedZodType = encodedZodType as unknown as DecodedZodType,\n props = {} as Props,\n params = {} as Partial<TypeParams>,\n }: {\n encodedZodType: EncodedZodType\n decodedZodType?: DecodedZodType\n props?: Props\n params?: Partial<TypeParams>\n }) {\n this.encodedZodType = encodedZodType\n this.decodedZodType = decodedZodType\n\n this.props = props\n this.params = Object.assign({ checks: [] }, params)\n }\n\n optional(): OptionalType<this> {\n return OptionalType.factory(this)\n }\n\n nullable(): NullableType<this> {\n return NullableType.factory(this)\n }\n\n nullish() {\n return this.nullable().optional()\n }\n\n default(value: this['encodedZodType']['_zod']['input']): DefaultType<this> {\n return DefaultType.factory(this, value)\n }\n\n title(title: string): this {\n return this.meta({ title })\n }\n\n description(description: string): this {\n return this.meta({ description })\n }\n\n examples(...examples: this['decodedZodType']['_zod']['input'][]): this {\n return this.meta({\n examples: this.params.encode\n ? examples.map(this.params.encode)\n : examples,\n })\n }\n\n meta(newMetadata: TypeMetadata): this {\n const metadata = typesRegistry.get(this.encodedZodType) ?? {}\n Object.assign(metadata, newMetadata)\n typesRegistry.add(this.encodedZodType, metadata)\n return this\n }\n\n encode(\n data: this['encodedZodType']['_zod']['input'],\n ): this['encodedZodType']['_zod']['output'] {\n return this.encodedZodType.parse(data, { reportInput: true })\n }\n\n decode(\n data: this['decodedZodType']['_zod']['input'],\n ): this['decodedZodType']['_zod']['output'] {\n return this.decodedZodType.parse(data, { reportInput: true })\n }\n}\n\nexport class OptionalType<\n Type extends BaseTypeAny = BaseTypeAny,\n> extends BaseType<\n ZodMiniOptional<Type['encodedZodType']>,\n ZodMiniOptional<Type['decodedZodType']>,\n { inner: Type }\n> {\n static factory<T extends BaseTypeAny>(type: T) {\n return new OptionalType<T>({\n encodedZodType: optional(type.encodedZodType) as any,\n props: { inner: type },\n })\n }\n}\n\nexport class NullableType<\n Type extends BaseTypeAny<any> = BaseTypeAny<any>,\n> extends BaseType<\n ZodMiniNullable<Type['encodedZodType']>,\n ZodMiniNullable<Type['decodedZodType']>,\n { inner: Type }\n> {\n static factory<T extends BaseTypeAny<any>>(type: T) {\n return new NullableType<T>({\n encodedZodType: nullable(type.encodedZodType),\n props: { inner: type },\n })\n }\n}\n\nexport class DefaultType<\n Type extends BaseTypeAny = BaseTypeAny,\n> extends BaseType<\n ZodMiniDefault<Type['encodedZodType']>,\n ZodMiniDefault<Type['decodedZodType']>,\n { inner: Type }\n> {\n static factory<T extends BaseTypeAny<any>>(type: T, defaultValue: any) {\n return new DefaultType<T>({\n encodedZodType: _default(\n type.encodedZodType,\n type.params.encode?.(defaultValue) ?? defaultValue,\n ) as any,\n decodedZodType: _default(type.decodedZodType, defaultValue) as any,\n props: { inner: type },\n })\n }\n}\n"],"version":3}
|
package/dist/types/boolean.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { boolean } from "@zod/mini";
|
|
2
2
|
import { BaseType } from "./base.js";
|
|
3
3
|
export class BooleanType extends BaseType {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
static factory() {
|
|
5
|
+
return new BooleanType({ encodedZodType: boolean() });
|
|
6
|
+
}
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"
|
|
1
|
+
{"mappings":"AAAA,SAAS,eAAoC,WAAW;AACxD,SAAS,gBAAgB,WAAW;AAEpC,OAAO,MAAM,oBAAoB,SAAkC;CACjE,OAAO,UAAU;AACf,SAAO,IAAI,YAAY,EACrB,gBAAgB,SAAS,CAC1B;CACF;AACF","names":[],"sources":["src/types/boolean.ts"],"sourcesContent":["import { boolean, type ZodMiniBoolean } from '@zod/mini'\nimport { BaseType } from './base.ts'\n\nexport class BooleanType extends BaseType<ZodMiniBoolean<boolean>> {\n static factory() {\n return new BooleanType({\n encodedZodType: boolean(),\n })\n }\n}\n"],"version":3}
|
package/dist/types/custom.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { any, custom, overwrite, pipe } from "@zod/mini";
|
|
2
2
|
import { BaseType } from "./base.js";
|
|
3
|
-
export class TransformType extends BaseType {
|
|
4
|
-
}
|
|
3
|
+
export class TransformType extends BaseType {}
|
|
5
4
|
export class CustomType extends TransformType {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
static factory({ decode, encode, error, type = any() }) {
|
|
6
|
+
return new CustomType({
|
|
7
|
+
encodedZodType: pipe(custom().check(overwrite(encode)), type),
|
|
8
|
+
decodedZodType: pipe(type, custom(undefined, { error }).check(overwrite(decode))),
|
|
9
|
+
params: { encode }
|
|
10
|
+
});
|
|
11
|
+
}
|
|
11
12
|
}
|
package/dist/types/custom.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"
|
|
1
|
+
{"mappings":"AAAA,SACE,KAEA,QACA,WACA,YAIK,WAAW;AAClB,SAAS,gBAAkD,WAAW;AAKtE,OAAO,MAAe,sBAIZ,SASR,CAAE;AAEJ,OAAO,MAAM,mBAIH,cAA8C;CACtD,OAAO,QAIL,EACA,QACA,QACA,OACA,OAAO,KAAK,EAYb,EAAE;AACD,SAAO,IAAI,WAA2C;GACpD,gBAAgB,KAAK,QAAQ,CAAC,MAAM,UAAU,OAAO,CAAC,EAAE,KAAK;GAC7D,gBAAgB,KACd,MACA,OAAO,WAAW,EAAE,MAAO,EAAC,CAAC,MAAM,UAAU,OAAO,CAAC,CACtD;GACD,QAAQ,EAAE,OAAQ;EACnB;CACF;AACF","names":[],"sources":["src/types/custom.ts"],"sourcesContent":["import {\n any,\n type core,\n custom,\n overwrite,\n pipe,\n type ZodMiniAny,\n type ZodMiniCustom,\n type ZodMiniPipe,\n} from '@zod/mini'\nimport { BaseType, type SimpleZodType, type ZodType } from './base.ts'\n\nexport type CustomTypeDecode<I, O> = (value: I) => O\nexport type CustomTypeEncode<I, O> = (value: I) => O\n\nexport abstract class TransformType<\n Type,\n EncodedType extends SimpleZodType = ZodMiniAny,\n DecodedType extends ZodType = ZodMiniCustom<Type, Type>,\n> extends BaseType<\n ZodMiniPipe<\n ZodMiniCustom<DecodedType['_zod']['output'], DecodedType['_zod']['input']>,\n EncodedType\n >,\n ZodMiniPipe<\n EncodedType,\n ZodMiniCustom<EncodedType['_zod']['output'], EncodedType['_zod']['input']>\n >\n> {}\n\nexport class CustomType<\n Type,\n EncodedType extends SimpleZodType = ZodMiniAny,\n DecodedType extends ZodType = ZodMiniCustom<Type, Type>,\n> extends TransformType<Type, EncodedType, DecodedType> {\n static factory<\n Type,\n EncodedType extends SimpleZodType = ZodMiniAny,\n DecodedType extends ZodType = ZodMiniCustom<Type, Type>,\n >({\n decode,\n encode,\n error,\n type = any() as unknown as EncodedType,\n }: {\n decode: CustomTypeDecode<\n EncodedType['_zod']['input'],\n DecodedType['_zod']['output']\n >\n encode: CustomTypeEncode<\n DecodedType['_zod']['input'],\n EncodedType['_zod']['output']\n >\n error?: string | core.$ZodErrorMap<core.$ZodIssueBase>\n type?: EncodedType\n }) {\n return new CustomType<Type, EncodedType, DecodedType>({\n encodedZodType: pipe(custom().check(overwrite(encode)), type),\n decodedZodType: pipe(\n type,\n custom(undefined, { error }).check(overwrite(decode)),\n ),\n params: { encode },\n })\n }\n}\n"],"version":3}
|
package/dist/types/date.js
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { iso, union } from "@zod/mini";
|
|
2
2
|
import { CustomType, TransformType } from "./custom.js";
|
|
3
|
-
const decode = (value)=>new Date(value);
|
|
4
|
-
const encode = (value)=>value.toISOString();
|
|
5
3
|
export class DateType extends TransformType {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
})
|
|
14
|
-
]));
|
|
15
|
-
}
|
|
4
|
+
static factory() {
|
|
5
|
+
return CustomType.factory({
|
|
6
|
+
decode: (value) => new Date(value),
|
|
7
|
+
encode: (value) => value.toISOString(),
|
|
8
|
+
type: union([iso.datetime(), iso.date()])
|
|
9
|
+
});
|
|
10
|
+
}
|
|
16
11
|
}
|
package/dist/types/date.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"
|
|
1
|
+
{"mappings":"AAAA,SAAS,KAAK,aAAgC,WAAW;AACzD,SAAS,YAAY,qBAAqB,aAAa;AAEvD,OAAO,MAAM,iBAAiB,cAG5B;CACA,OAAO,UAAU;AACf,SAAO,WAAW,QAGhB;GACA,QAAQ,CAACA,UAAwB,IAAI,KAAK;GAC1C,QAAQ,CAACC,UAAwB,MAAM,aAAa;GACpD,MAAM,MAAM,CAAC,IAAI,UAAU,EAAE,IAAI,MAAM,AAAC,EAAC;EAC1C,EAAC;CACH;AACF","names":["value: string","value: Date"],"sources":["src/types/date.ts"],"sourcesContent":["import { iso, union, type ZodMiniUnion } from '@zod/mini'\nimport { CustomType, TransformType } from './custom.ts'\n\nexport class DateType extends TransformType<\n Date,\n ZodMiniUnion<[iso.ZodMiniISODate, iso.ZodMiniISODateTime]>\n> {\n static factory() {\n return CustomType.factory<\n Date,\n ZodMiniUnion<Array<iso.ZodMiniISODate | iso.ZodMiniISODateTime>>\n >({\n decode: (value: string): Date => new Date(value),\n encode: (value: Date): string => value.toISOString(),\n type: union([iso.datetime(), iso.date()]),\n })\n }\n}\n"],"version":3}
|
package/dist/types/enum.js
CHANGED
|
@@ -1,19 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { enum as enum_ } from "@zod/mini";
|
|
2
2
|
import { BaseType } from "./base.js";
|
|
3
|
-
export class ObjectEnumType extends BaseType {
|
|
4
|
-
static factory(values) {
|
|
5
|
-
return new ObjectEnumType(Type.Enum(values), {
|
|
6
|
-
values: Object.values(values)
|
|
7
|
-
});
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
3
|
export class EnumType extends BaseType {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
});
|
|
18
|
-
}
|
|
4
|
+
static factory(values) {
|
|
5
|
+
return new EnumType({
|
|
6
|
+
encodedZodType: enum_(values),
|
|
7
|
+
props: { values }
|
|
8
|
+
});
|
|
9
|
+
}
|
|
19
10
|
}
|
package/dist/types/enum.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"
|
|
1
|
+
{"mappings":"AAAA,SAAoB,QAAQ,aAA+B,WAAW;AACtE,SAAS,gBAAgB,WAAW;AAEpC,OAAO,MAAM,iBAEH,SAAwD;CAKhE,OAAO,QAAkDA,QAAW;AAClE,SAAO,IAAI,SAAS;GAClB,gBAAgB,MAAM,OAAc;GACpC,OAAO,EAAE,OAAQ;EAClB;CACF;AACF","names":["values: T"],"sources":["src/types/enum.ts"],"sourcesContent":["import { type core, enum as enum_, type ZodMiniEnum } from '@zod/mini'\nimport { BaseType } from './base.ts'\n\nexport class EnumType<\n T extends core.utils.EnumLike = core.utils.EnumLike,\n> extends BaseType<ZodMiniEnum<T>, ZodMiniEnum<T>, { values: T }> {\n static factory<T extends core.utils.EnumLike>(values: T): EnumType<T>\n static factory<T extends string[]>(\n values: T,\n ): EnumType<core.utils.ToEnum<T[number]>>\n static factory<T extends core.utils.EnumLike | string[]>(values: T) {\n return new EnumType({\n encodedZodType: enum_(values as any),\n props: { values },\n })\n }\n}\n"],"version":3}
|
package/dist/types/literal.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { literal } from "@zod/mini";
|
|
2
2
|
import { BaseType } from "./base.js";
|
|
3
3
|
export class LiteralType extends BaseType {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
static factory(value) {
|
|
5
|
+
return new LiteralType({
|
|
6
|
+
encodedZodType: literal(value),
|
|
7
|
+
props: { value }
|
|
8
|
+
});
|
|
9
|
+
}
|
|
9
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"
|
|
1
|
+
{"mappings":"AAAA,SAAS,eAAoC,WAAW;AACxD,SAAS,gBAAyC,WAAW;AAE7D,OAAO,MAAM,oBAEH,SAA6D;CACrE,OAAO,QAAsCA,OAAU;AACrD,SAAO,IAAI,YAAe;GACxB,gBAAgB,QAAQ,MAAM;GAC9B,OAAO,EAAE,MAAO;EACjB;CACF;AACF","names":["value: T"],"sources":["src/types/literal.ts"],"sourcesContent":["import { literal, type ZodMiniLiteral } from '@zod/mini'\nimport { BaseType, type PrimitiveValueType } from './base.ts'\n\nexport class LiteralType<\n T extends PrimitiveValueType = PrimitiveValueType,\n> extends BaseType<ZodMiniLiteral<T>, ZodMiniLiteral<T>, { value: T }> {\n static factory<T extends PrimitiveValueType>(value: T) {\n return new LiteralType<T>({\n encodedZodType: literal(value),\n props: { value },\n })\n }\n}\n"],"version":3}
|
package/dist/types/never.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { never } from "@zod/mini";
|
|
2
2
|
import { BaseType } from "./base.js";
|
|
3
3
|
export class NeverType extends BaseType {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
static factory() {
|
|
5
|
+
return new NeverType({ encodedZodType: never() });
|
|
6
|
+
}
|
|
7
7
|
}
|
package/dist/types/never.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"
|
|
1
|
+
{"mappings":"AAAA,SAAS,aAAgC,WAAW;AACpD,SAAS,gBAAgB,WAAW;AAEpC,OAAO,MAAM,kBAAkB,SAAuB;CACpD,OAAO,UAAU;AACf,SAAO,IAAI,UAAU,EACnB,gBAAgB,OAAO,CACxB;CACF;AACF","names":[],"sources":["src/types/never.ts"],"sourcesContent":["import { never, type ZodMiniNever } from '@zod/mini'\nimport { BaseType } from './base.ts'\n\nexport class NeverType extends BaseType<ZodMiniNever> {\n static factory() {\n return new NeverType({\n encodedZodType: never(),\n })\n }\n}\n"],"version":3}
|