@nmtjs/type 0.15.0-beta.9 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/standart-schema.d.ts +12 -0
- package/dist/standart-schema.js +103 -0
- package/dist/standart-schema.js.map +1 -0
- package/dist/temporal/global.d.ts +2 -2
- package/dist/temporal/global.js +9 -9
- package/dist/temporal/global.js.map +1 -1
- package/dist/temporal/index.d.ts +9 -0
- package/dist/temporal/index.js +10 -0
- package/dist/temporal/index.js.map +1 -0
- package/dist/temporal/polyfill.d.ts +10 -8
- package/dist/temporal/polyfill.js +25 -8
- package/dist/temporal/polyfill.js.map +1 -1
- package/dist/types/_convert.js +11 -11
- package/dist/types/_convert.js.map +1 -1
- package/dist/types/_metadata.d.ts +8 -0
- package/dist/types/_metadata.js +3 -0
- package/dist/types/_metadata.js.map +1 -0
- package/dist/types/_type.d.ts +2 -0
- package/dist/types/_type.js +16 -14
- package/dist/types/_type.js.map +1 -1
- package/dist/types/any.js +1 -1
- package/dist/types/any.js.map +1 -1
- package/dist/types/array.js +1 -1
- package/dist/types/array.js.map +1 -1
- package/dist/types/base.d.ts +9 -9
- package/dist/types/base.js +10 -2
- package/dist/types/base.js.map +1 -1
- package/dist/types/boolean.js +1 -1
- package/dist/types/boolean.js.map +1 -1
- package/dist/types/custom.d.ts +5 -5
- package/dist/types/custom.js +1 -1
- package/dist/types/custom.js.map +1 -1
- package/dist/types/date.js +1 -1
- package/dist/types/date.js.map +1 -1
- package/dist/types/enum.js +1 -1
- package/dist/types/enum.js.map +1 -1
- package/dist/types/literal.js +1 -1
- package/dist/types/literal.js.map +1 -1
- package/dist/types/never.js +1 -1
- package/dist/types/never.js.map +1 -1
- package/dist/types/null.js +1 -1
- package/dist/types/null.js.map +1 -1
- package/dist/types/number.js +2 -2
- package/dist/types/number.js.map +1 -1
- package/dist/types/object.js +3 -3
- package/dist/types/object.js.map +1 -1
- package/dist/types/string.d.ts +2 -0
- package/dist/types/string.js +8 -2
- package/dist/types/string.js.map +1 -1
- package/dist/types/temporal.d.ts +17 -15
- package/dist/types/temporal.js +21 -11
- package/dist/types/temporal.js.map +1 -1
- package/dist/types/tuple.js +1 -1
- package/dist/types/tuple.js.map +1 -1
- package/dist/types/union.js +1 -1
- package/dist/types/union.js.map +1 -1
- package/dist/types/unknown.d.ts +6 -0
- package/dist/types/unknown.js +9 -0
- package/dist/types/unknown.js.map +1 -0
- package/package.json +35 -16
- package/src/standart-schema.ts +146 -0
- package/src/temporal/global.ts +12 -9
- package/src/temporal/index.ts +20 -0
- package/src/temporal/polyfill.ts +60 -7
- package/src/types/_metadata.ts +12 -0
- package/src/types/_type.ts +9 -0
- package/src/types/base.ts +17 -11
- package/src/types/custom.ts +4 -5
- package/src/types/string.ts +10 -0
- package/src/types/temporal.ts +82 -61
- package/src/types/unknown.ts +12 -0
package/README.md
CHANGED
|
@@ -6,4 +6,34 @@
|
|
|
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
|
|
10
|
+
|
|
11
|
+
## Jobs E2E (Local Docker)
|
|
12
|
+
|
|
13
|
+
Prerequisites:
|
|
14
|
+
- Docker Desktop (or Docker Engine) with `docker compose` available
|
|
15
|
+
|
|
16
|
+
No host ports are exposed in this setup. Tests run fully inside Docker containers.
|
|
17
|
+
The test image is optimized for Docker layer caching with `pnpm fetch` + offline install.
|
|
18
|
+
|
|
19
|
+
Run both backends with one command:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pnpm run test:e2e:jobs:docker
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
This command rebuilds the test image on each run and executes Redis + Valkey suites in one pass.
|
|
26
|
+
|
|
27
|
+
Run Jobs E2E directly in Docker:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
docker compose -f docker-compose.jobs-e2e.yml run --rm --build test-jobs
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Manual Docker control:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
docker compose -f docker-compose.jobs-e2e.yml up -d --wait redis valkey
|
|
37
|
+
docker compose -f docker-compose.jobs-e2e.yml run --rm --build test-jobs
|
|
38
|
+
docker compose -f docker-compose.jobs-e2e.yml down -v --remove-orphans
|
|
39
|
+
```
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { en } from 'zod/locales';
|
|
2
2
|
import { config } from 'zod/mini';
|
|
3
|
-
import * as type from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
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';
|
|
7
7
|
export { type, type as t };
|
|
8
8
|
export default type;
|
|
9
9
|
export function registerDefaultLocale() {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAA;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,OAAO,KAAK,IAAI,MAAM,kBAAkB,CAAA;AAExC,cAAc,qBAAqB,CAAA;AACnC,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA;AAC/B,OAAO,EAAE,IAAI,EAAE,IAAI,IAAI,CAAC,EAAE,CAAA;AAC1B,eAAe,IAAI,CAAA;AAEnB,MAAM,UAAU,qBAAqB;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAA;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,OAAO,KAAK,IAAI,MAAM,kBAAkB,CAAA;AAExC,cAAc,qBAAqB,CAAA;AACnC,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA;AAC/B,OAAO,EAAE,IAAI,EAAE,IAAI,IAAI,CAAC,EAAE,CAAA;AAC1B,eAAe,IAAI,CAAA;AAEnB,MAAM,UAAU,qBAAqB,GAAG;IACtC,MAAM,CAAC,EAAE,EAAE,CAAC,CAAA;AAAA,CACb"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { StandardJSONSchemaV1, StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
|
+
import type { ZodMiniType } from 'zod/mini';
|
|
3
|
+
import { core } from 'zod/mini';
|
|
4
|
+
import type { BaseType } from './types/_type.ts';
|
|
5
|
+
export declare namespace standard {
|
|
6
|
+
type Schema<T extends ZodMiniType> = StandardSchemaV1<T['_zod']['input'], T['_zod']['output']> & StandardJSONSchemaV1<T['_zod']['input'], T['_zod']['output']>;
|
|
7
|
+
type SchemaProps<T extends ZodMiniType> = StandardSchemaV1.Props<T['_zod']['input'], T['_zod']['output']> & StandardJSONSchemaV1.Props<T['_zod']['input'], T['_zod']['output']>;
|
|
8
|
+
type JSONProps<T extends ZodMiniType> = StandardJSONSchemaV1.Props<T['_zod']['input'], T['_zod']['output']>;
|
|
9
|
+
type Props<T extends ZodMiniType> = SchemaProps<T> & JSONProps<T>;
|
|
10
|
+
const decode: <T extends BaseType<import("./index.ts").SimpleZodType, import("./index.ts").SimpleZodType, import("./index.ts").TypeProps, import("./index.ts").SimpleZodType, import("./index.ts").SimpleZodType>>(type: T, registry: core.$ZodRegistry<import("./types/_metadata.ts").TypeMetadata<any>, core.$ZodType<unknown, unknown, core.$ZodTypeInternals<unknown, unknown>>>) => Schema<T["decodeZodType"]>;
|
|
11
|
+
const encode: <T extends BaseType<import("./index.ts").SimpleZodType, import("./index.ts").SimpleZodType, import("./index.ts").TypeProps, import("./index.ts").SimpleZodType, import("./index.ts").SimpleZodType>>(type: T, registry: core.$ZodRegistry<import("./types/_metadata.ts").TypeMetadata<any>, core.$ZodType<unknown, unknown, core.$ZodTypeInternals<unknown, unknown>>>) => Schema<T["encodeZodType"]>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { core, toJSONSchema } from 'zod/mini';
|
|
2
|
+
export { standard };
|
|
3
|
+
var standard;
|
|
4
|
+
(function (standard) {
|
|
5
|
+
standard.decode = (type, registry) => {
|
|
6
|
+
return Object.freeze({
|
|
7
|
+
'~standard': Object.freeze({
|
|
8
|
+
vendor: 'neemata-type',
|
|
9
|
+
version: 1,
|
|
10
|
+
validate: (value, options = {}) => {
|
|
11
|
+
try {
|
|
12
|
+
return { value: type.decode(value) };
|
|
13
|
+
}
|
|
14
|
+
catch (e) {
|
|
15
|
+
if (e instanceof core.$ZodError) {
|
|
16
|
+
const issues = e.issues.map((issue) => ({
|
|
17
|
+
message: issue.message,
|
|
18
|
+
path: issue.path.length > 0 ? issue.path : undefined,
|
|
19
|
+
}));
|
|
20
|
+
return { issues };
|
|
21
|
+
}
|
|
22
|
+
throw e;
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
jsonSchema: {
|
|
26
|
+
input: ({ target, libraryOptions }) => {
|
|
27
|
+
const { json = {} } = (libraryOptions || {});
|
|
28
|
+
const { cycles = 'throw', reused = 'inline' } = json;
|
|
29
|
+
return toJSONSchema(type.decodeZodType, {
|
|
30
|
+
target,
|
|
31
|
+
io: 'input',
|
|
32
|
+
cycles,
|
|
33
|
+
reused,
|
|
34
|
+
unrepresentable: 'any',
|
|
35
|
+
metadata: registry,
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
output: ({ target, libraryOptions }) => {
|
|
39
|
+
const { json = {} } = (libraryOptions || {});
|
|
40
|
+
const { cycles = 'throw', reused = 'inline' } = json;
|
|
41
|
+
return toJSONSchema(type.decodeZodType, {
|
|
42
|
+
target,
|
|
43
|
+
io: 'output',
|
|
44
|
+
cycles,
|
|
45
|
+
reused,
|
|
46
|
+
unrepresentable: 'any',
|
|
47
|
+
metadata: registry,
|
|
48
|
+
});
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
}),
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
standard.encode = (type, registry) => {
|
|
55
|
+
return Object.freeze({
|
|
56
|
+
'~standard': Object.freeze({
|
|
57
|
+
vendor: 'neemata-type',
|
|
58
|
+
version: 1,
|
|
59
|
+
validate: (value) => {
|
|
60
|
+
try {
|
|
61
|
+
return { value: type.encode(value) };
|
|
62
|
+
}
|
|
63
|
+
catch (e) {
|
|
64
|
+
if (e instanceof core.$ZodError) {
|
|
65
|
+
const issues = e.issues.map((issue) => ({
|
|
66
|
+
message: issue.message,
|
|
67
|
+
path: issue.path.length > 0 ? issue.path : undefined,
|
|
68
|
+
}));
|
|
69
|
+
return { issues };
|
|
70
|
+
}
|
|
71
|
+
throw e;
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
jsonSchema: {
|
|
75
|
+
input: ({ target, libraryOptions }) => {
|
|
76
|
+
const { json = {} } = (libraryOptions || {});
|
|
77
|
+
const { cycles = 'throw', reused = 'inline' } = json;
|
|
78
|
+
return toJSONSchema(type.encodeZodType, {
|
|
79
|
+
target,
|
|
80
|
+
io: 'input',
|
|
81
|
+
cycles,
|
|
82
|
+
reused,
|
|
83
|
+
unrepresentable: 'any',
|
|
84
|
+
metadata: registry,
|
|
85
|
+
});
|
|
86
|
+
},
|
|
87
|
+
output: ({ target, libraryOptions }) => {
|
|
88
|
+
const { json = {} } = (libraryOptions || {});
|
|
89
|
+
const { cycles = 'throw', reused = 'inline' } = json;
|
|
90
|
+
return toJSONSchema(type.encodeZodType, {
|
|
91
|
+
target,
|
|
92
|
+
io: 'output',
|
|
93
|
+
cycles,
|
|
94
|
+
reused,
|
|
95
|
+
unrepresentable: 'any',
|
|
96
|
+
});
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
}),
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
})(standard || (standard = {}));
|
|
103
|
+
//# sourceMappingURL=standart-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"standart-schema.js","sourceRoot":"","sources":["../src/standart-schema.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;SAK5B,QAAQ;AAAzB,IAAiB,QAsIhB;AAtID,WAAiB,QAAQ,EAAC;IAoBX,eAAM,GAAG,CACpB,IAAO,EACP,QAA0B,EACE,EAAE,CAAC;QAC/B,OAAO,MAAM,CAAC,MAAM,CAAC;YACnB,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC;gBACzB,MAAM,EAAE,cAAc;gBACtB,OAAO,EAAE,CAAC;gBACV,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,GAAG,EAAE,EAAE,EAAE,CAAC;oBACjC,IAAI,CAAC;wBACH,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAA;oBACtC,CAAC;oBAAC,OAAO,CAAC,EAAE,CAAC;wBACX,IAAI,CAAC,YAAY,IAAI,CAAC,SAAS,EAAE,CAAC;4BAChC,MAAM,MAAM,GAA6B,CAAC,CAAC,MAAM,CAAC,GAAG,CACnD,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;gCACV,OAAO,EAAE,KAAK,CAAC,OAAO;gCACtB,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;6BACrD,CAAC,CACH,CAAA;4BACD,OAAO,EAAE,MAAM,EAAE,CAAA;wBACnB,CAAC;wBACD,MAAM,CAAC,CAAA;oBACT,CAAC;gBAAA,CACF;gBACD,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AAO,YAAY,CAAC,IAAI,CAAC,aAAa,EAAE;4BACtC,MAAM;4BACN,EAAE,EAAE,QAAQ;4BACZ,MAAM;4BACN,MAAM;4BACN,eAAe,EAAE,KAAK;yBACvB,CAAC,CAAA;oBAAA,CACH;iBACF;aACkC,CAAC;SACvC,CAAC,CAAA;IAAA,CACH,CAAA;AAAA,CACF,EAtIgB,QAAQ,KAAR,QAAQ,QAsIxB"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import 'temporal
|
|
2
|
-
import { DurationType, PlainDateTimeType, PlainDateType, PlainMonthDayType, PlainTimeType, PlainYearMonthType, ZonedDateTimeType } from '../types/temporal.ts';
|
|
1
|
+
import { DurationType, InstantType, PlainDateTimeType, PlainDateType, PlainMonthDayType, PlainTimeType, PlainYearMonthType, ZonedDateTimeType } from '../types/temporal.ts';
|
|
3
2
|
export declare const plainDate: () => PlainDateType;
|
|
4
3
|
export declare const plainDatetime: () => PlainDateTimeType;
|
|
5
4
|
export declare const plainTime: () => PlainTimeType;
|
|
6
5
|
export declare const zonedDatetime: () => ZonedDateTimeType;
|
|
6
|
+
export declare const instant: () => InstantType;
|
|
7
7
|
export declare const duration: () => DurationType;
|
|
8
8
|
export declare const plainYearMonth: () => PlainYearMonthType;
|
|
9
9
|
export declare const plainMonthDay: () => PlainMonthDayType;
|
package/dist/temporal/global.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import 'temporal
|
|
2
|
-
|
|
3
|
-
export const
|
|
4
|
-
export const
|
|
5
|
-
export const
|
|
6
|
-
export const
|
|
7
|
-
export const duration = DurationType.factory.bind(DurationType, Temporal);
|
|
8
|
-
export const plainYearMonth = PlainYearMonthType.factory.bind(PlainYearMonthType, Temporal);
|
|
9
|
-
export const plainMonthDay = PlainMonthDayType.factory.bind(PlainMonthDayType, Temporal);
|
|
1
|
+
import { DurationType, InstantType, PlainDateTimeType, PlainDateType, PlainMonthDayType, PlainTimeType, PlainYearMonthType, ZonedDateTimeType, } from '../types/temporal.js';
|
|
2
|
+
export const plainDate = PlainDateType.factory.bind(PlainDateType, globalThis.Temporal);
|
|
3
|
+
export const plainDatetime = PlainDateTimeType.factory.bind(PlainDateTimeType, globalThis.Temporal);
|
|
4
|
+
export const plainTime = PlainTimeType.factory.bind(PlainTimeType, globalThis.Temporal);
|
|
5
|
+
export const zonedDatetime = ZonedDateTimeType.factory.bind(ZonedDateTimeType, globalThis.Temporal);
|
|
6
|
+
export const instant = InstantType.factory.bind(InstantType, globalThis.Temporal);
|
|
7
|
+
export const duration = DurationType.factory.bind(DurationType, globalThis.Temporal);
|
|
8
|
+
export const plainYearMonth = PlainYearMonthType.factory.bind(PlainYearMonthType, globalThis.Temporal);
|
|
9
|
+
export const plainMonthDay = PlainMonthDayType.factory.bind(PlainMonthDayType, globalThis.Temporal);
|
|
10
10
|
//# sourceMappingURL=global.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global.js","sourceRoot":"","sources":["../../src/temporal/global.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"global.js","sourceRoot":"","sources":["../../src/temporal/global.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,sBAAsB,CAAA;AAE7B,MAAM,CAAC,MAAM,SAAS,GAAwB,aAAa,CAAC,OAAO,CAAC,IAAI,CACtE,aAAa,EACb,UAAU,CAAC,QAAQ,CACpB,CAAA;AACD,MAAM,CAAC,MAAM,aAAa,GACxB,iBAAiB,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAA;AACxE,MAAM,CAAC,MAAM,SAAS,GAAwB,aAAa,CAAC,OAAO,CAAC,IAAI,CACtE,aAAa,EACb,UAAU,CAAC,QAAQ,CACpB,CAAA;AACD,MAAM,CAAC,MAAM,aAAa,GACxB,iBAAiB,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAA;AACxE,MAAM,CAAC,MAAM,OAAO,GAAsB,WAAW,CAAC,OAAO,CAAC,IAAI,CAChE,WAAW,EACX,UAAU,CAAC,QAAQ,CACpB,CAAA;AACD,MAAM,CAAC,MAAM,QAAQ,GAAuB,YAAY,CAAC,OAAO,CAAC,IAAI,CACnE,YAAY,EACZ,UAAU,CAAC,QAAQ,CACpB,CAAA;AACD,MAAM,CAAC,MAAM,cAAc,GACzB,kBAAkB,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAA;AAC1E,MAAM,CAAC,MAAM,aAAa,GACxB,iBAAiB,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DurationType, InstantType, PlainDateTimeType, PlainDateType, PlainMonthDayType, PlainTimeType, PlainYearMonthType, ZonedDateTimeType } from '../types/temporal.ts';
|
|
2
|
+
export declare const plainDate: typeof PlainDateType.factory;
|
|
3
|
+
export declare const plainDatetime: typeof PlainDateTimeType.factory;
|
|
4
|
+
export declare const plainTime: typeof PlainTimeType.factory;
|
|
5
|
+
export declare const zonedDatetime: typeof ZonedDateTimeType.factory;
|
|
6
|
+
export declare const instant: typeof InstantType.factory;
|
|
7
|
+
export declare const duration: typeof DurationType.factory;
|
|
8
|
+
export declare const plainYearMonth: typeof PlainYearMonthType.factory;
|
|
9
|
+
export declare const plainMonthDay: typeof PlainMonthDayType.factory;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DurationType, InstantType, PlainDateTimeType, PlainDateType, PlainMonthDayType, PlainTimeType, PlainYearMonthType, ZonedDateTimeType, } from '../types/temporal.js';
|
|
2
|
+
export const plainDate = PlainDateType.factory.bind(PlainDateType);
|
|
3
|
+
export const plainDatetime = PlainDateTimeType.factory.bind(PlainDateTimeType);
|
|
4
|
+
export const plainTime = PlainTimeType.factory.bind(PlainTimeType);
|
|
5
|
+
export const zonedDatetime = ZonedDateTimeType.factory.bind(ZonedDateTimeType);
|
|
6
|
+
export const instant = InstantType.factory.bind(InstantType);
|
|
7
|
+
export const duration = DurationType.factory.bind(DurationType);
|
|
8
|
+
export const plainYearMonth = PlainYearMonthType.factory.bind(PlainYearMonthType);
|
|
9
|
+
export const plainMonthDay = PlainMonthDayType.factory.bind(PlainMonthDayType);
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/temporal/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,sBAAsB,CAAA;AAE7B,MAAM,CAAC,MAAM,SAAS,GAAG,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;AAClE,MAAM,CAAC,MAAM,aAAa,GAAG,iBAAiB,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;AAC9E,MAAM,CAAC,MAAM,SAAS,GAAG,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;AAClE,MAAM,CAAC,MAAM,aAAa,GAAG,iBAAiB,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;AAC9E,MAAM,CAAC,MAAM,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;AAC5D,MAAM,CAAC,MAAM,QAAQ,GAAG,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;AAC/D,MAAM,CAAC,MAAM,cAAc,GACzB,kBAAkB,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAA;AACrD,MAAM,CAAC,MAAM,aAAa,GAAG,iBAAiB,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const
|
|
1
|
+
import { Temporal } from 'temporal-polyfill';
|
|
2
|
+
import { DurationType, InstantType, PlainDateTimeType, PlainDateType, PlainMonthDayType, PlainTimeType, PlainYearMonthType, ZonedDateTimeType } from '../types/temporal.ts';
|
|
3
|
+
export declare const plainDate: () => PlainDateType<typeof Temporal>;
|
|
4
|
+
export declare const plainDatetime: () => PlainDateTimeType<typeof Temporal>;
|
|
5
|
+
export declare const plainTime: () => PlainTimeType<typeof Temporal>;
|
|
6
|
+
export declare const zonedDatetime: () => ZonedDateTimeType<typeof Temporal>;
|
|
7
|
+
export declare const instant: () => InstantType<typeof Temporal>;
|
|
8
|
+
export declare const duration: () => DurationType<typeof Temporal>;
|
|
9
|
+
export declare const plainYearMonth: () => PlainYearMonthType<typeof Temporal>;
|
|
10
|
+
export declare const plainMonthDay: () => PlainMonthDayType<typeof Temporal>;
|
|
@@ -1,10 +1,27 @@
|
|
|
1
1
|
import { Temporal } from 'temporal-polyfill';
|
|
2
|
-
import { DurationType, PlainDateTimeType, PlainDateType, PlainMonthDayType, PlainTimeType, PlainYearMonthType, ZonedDateTimeType, } from
|
|
3
|
-
export const plainDate = PlainDateType.factory.bind(PlainDateType,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export const
|
|
2
|
+
import { DurationType, InstantType, PlainDateTimeType, PlainDateType, PlainMonthDayType, PlainTimeType, PlainYearMonthType, ZonedDateTimeType, } from '../types/temporal.js';
|
|
3
|
+
export const plainDate = PlainDateType.factory.bind(PlainDateType,
|
|
4
|
+
// @ts-expect-error
|
|
5
|
+
Temporal);
|
|
6
|
+
export const plainDatetime = PlainDateTimeType.factory.bind(PlainDateTimeType,
|
|
7
|
+
// @ts-expect-error
|
|
8
|
+
Temporal);
|
|
9
|
+
export const plainTime = PlainTimeType.factory.bind(PlainTimeType,
|
|
10
|
+
// @ts-expect-error
|
|
11
|
+
Temporal);
|
|
12
|
+
export const zonedDatetime = ZonedDateTimeType.factory.bind(ZonedDateTimeType,
|
|
13
|
+
// @ts-expect-error
|
|
14
|
+
Temporal);
|
|
15
|
+
export const instant = InstantType.factory.bind(InstantType,
|
|
16
|
+
// @ts-expect-error
|
|
17
|
+
Temporal);
|
|
18
|
+
export const duration = DurationType.factory.bind(DurationType,
|
|
19
|
+
// @ts-expect-error
|
|
20
|
+
Temporal);
|
|
21
|
+
export const plainYearMonth = PlainYearMonthType.factory.bind(PlainYearMonthType,
|
|
22
|
+
// @ts-expect-error
|
|
23
|
+
Temporal);
|
|
24
|
+
export const plainMonthDay = PlainMonthDayType.factory.bind(PlainMonthDayType,
|
|
25
|
+
// @ts-expect-error
|
|
26
|
+
Temporal);
|
|
10
27
|
//# sourceMappingURL=polyfill.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"polyfill.js","sourceRoot":"","sources":["../../src/temporal/polyfill.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE5C,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,sBAAsB,CAAA;AAE7B,MAAM,CAAC,MAAM,SAAS,GAAG,aAAa,CAAC,OAAO,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"polyfill.js","sourceRoot":"","sources":["../../src/temporal/polyfill.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QA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nyType } from
|
|
3
|
-
import { ArrayType } from
|
|
4
|
-
import { NullableType, OptionalType } from
|
|
5
|
-
import { BooleanType } from
|
|
6
|
-
import { CustomType } from
|
|
7
|
-
import { DateType } from
|
|
8
|
-
import { LiteralType } from
|
|
9
|
-
import { NumberType } from
|
|
10
|
-
import { ObjectType } from
|
|
11
|
-
import { StringType } from
|
|
12
|
-
import { TupleType } from
|
|
2
|
+
import { AnyType } from './any.js';
|
|
3
|
+
import { ArrayType } from './array.js';
|
|
4
|
+
import { NullableType, OptionalType } from './base.js';
|
|
5
|
+
import { BooleanType } from './boolean.js';
|
|
6
|
+
import { CustomType } from './custom.js';
|
|
7
|
+
import { DateType } from './date.js';
|
|
8
|
+
import { LiteralType } from './literal.js';
|
|
9
|
+
import { NumberType } from './number.js';
|
|
10
|
+
import { ObjectType } from './object.js';
|
|
11
|
+
import { StringType } from './string.js';
|
|
12
|
+
import { TupleType } from './tuple.js';
|
|
13
13
|
export function typeToString(type) {
|
|
14
14
|
switch (true) {
|
|
15
15
|
case type instanceof OptionalType:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_convert.js","sourceRoot":"","sources":["../../src/types/_convert.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAGvC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AACtC,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,M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UAAU;YAC7B,OAAO,gBAAgB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,IAAI,IAAI,QAAQ,CAAA;QAC1D;YACE,OAAO,SAAS,CAAA;IACpB,CAAC;AAAA,CACF;AAED,MAAM,UAAU,gBAAgB,CAC9B,IAAc,EACd,IAAyB,EACzB,OAA4C,EAChB;IAC5B,MAAM,OAAO,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,aAAa,EAAE,MAAM,EAAE,IAAI,CAAC,aAAa,EAAE,CACxE,IAAI,CACL,CAAA;IACD,OAAO,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;AAAA,CACtC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type TypeMetadata<T = any> = {
|
|
2
|
+
id?: string;
|
|
3
|
+
description?: string;
|
|
4
|
+
examples?: T[];
|
|
5
|
+
title?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const typesRegistry: import("zod/v4/core").$ZodRegistry<TypeMetadata<any>, import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>>;
|
|
8
|
+
export type MetadataRegistry = typeof typesRegistry;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_metadata.js","sourceRoot":"","sources":["../../src/types/_metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AASnC,MAAM,CAAC,MAAM,aAAa,GAAG,QAAQ,EAAgB,CAAA"}
|
package/dist/types/_type.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
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';
|
|
4
5
|
export * from './boolean.ts';
|
|
5
6
|
export * from './custom.ts';
|
|
6
7
|
export * from './date.ts';
|
|
@@ -13,6 +14,7 @@ export * from './object.ts';
|
|
|
13
14
|
export * from './string.ts';
|
|
14
15
|
export * from './tuple.ts';
|
|
15
16
|
export * from './union.ts';
|
|
17
|
+
export * from './unknown.ts';
|
|
16
18
|
export declare namespace infer {
|
|
17
19
|
namespace decode {
|
|
18
20
|
type input<T extends BaseTypeAny> = T['decodeZodType']['_zod']['input'];
|
package/dist/types/_type.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
11
|
-
export * from
|
|
12
|
-
export * from
|
|
13
|
-
export * from
|
|
14
|
-
export * from
|
|
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
|
+
export * from './unknown.js';
|
|
15
17
|
//# sourceMappingURL=_type.js.map
|
package/dist/types/_type.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_type.js","sourceRoot":"","sources":["../../src/types/_type.ts"],"names":[],"mappings":"AAEA,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA"}
|
|
1
|
+
{"version":3,"file":"_type.js","sourceRoot":"","sources":["../../src/types/_type.ts"],"names":[],"mappings":"AAEA,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,OAAO,EACL,QAAQ,EAER,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,YAAY,GACb,MAAM,WAAW,CAAA;AAClB,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA"}
|
package/dist/types/any.js
CHANGED
package/dist/types/any.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"any.js","sourceRoot":"","sources":["../../src/types/any.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,IAAI,MAAM,EAAE,MAAM,UAAU,CAAA;AAExC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAEpC,MAAM,OAAO,OAAQ,SAAQ,QAAoB;IAC/C,MAAM,CAAC,OAAO;
|
|
1
|
+
{"version":3,"file":"any.js","sourceRoot":"","sources":["../../src/types/any.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,IAAI,MAAM,EAAE,MAAM,UAAU,CAAA;AAExC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAEpC,MAAM,OAAO,OAAQ,SAAQ,QAAoB;IAC/C,MAAM,CAAC,OAAO,GAAG;QACf,OAAO,IAAI,OAAO,CAAC,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,CAAC,CAAA;IAAA,CAChD;CACF;AAED,MAAM,CAAC,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAA"}
|
package/dist/types/array.js
CHANGED
package/dist/types/array.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array.js","sourceRoot":"","sources":["../../src/types/array.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,IAAI,QAAQ,EAAE,MAAM,UAAU,CAAA;AAG1E,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAIpC,MAAM,OAAO,SAAyC,SAAQ,QAM7D;IACC,MAAM,CAAC,OAAO,CAAqB,OAAU,EAAE,GAAG,MAAe;
|
|
1
|
+
{"version":3,"file":"array.js","sourceRoot":"","sources":["../../src/types/array.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,IAAI,QAAQ,EAAE,MAAM,UAAU,CAAA;AAG1E,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAIpC,MAAM,OAAO,SAAyC,SAAQ,QAM7D;IACC,MAAM,CAAC,OAAO,CAAqB,OAAU,EAAE,GAAG,MAAe,EAAE;QACjE,OAAO,IAAI,SAAS,CAAI;YACtB,aAAa,EAAE,QAAQ,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC;YAC/D,aAAa,EAAE,QAAQ,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC;YAC/D,MAAM,EAAE,EAAE,MAAM,EAAE;YAClB,KAAK,EAAE,EAAE,OAAO,EAAE;SACnB,CAAC,CAAA;IAAA,CACH;IAED,GAAG,CAAC,KAAa,EAAE;QACjB,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,CAAA;QAC9B,OAAO,SAAS,CAAC,OAAO,CACtB,IAAI,CAAC,KAAK,CAAC,OAAO,EAClB,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,EACrB,KAAK,CACN,CAAA;IAAA,CACF;IAED,GAAG,CAAC,KAAa,EAAE;QACjB,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,CAAA;QAC9B,OAAO,SAAS,CAAC,OAAO,CACtB,IAAI,CAAC,KAAK,CAAC,OAAO,EAClB,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,EACrB,KAAK,CACN,CAAA;IAAA,CACF;IAED,MAAM,CAAC,KAAa,EAAE;QACpB,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;QAC3B,OAAO,SAAS,CAAC,OAAO,CACtB,IAAI,CAAC,KAAK,CAAC,OAAO,EAClB,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,EACrB,KAAK,CACN,CAAA;IAAA,CACF;CACF;AAED,MAAM,CAAC,MAAM,KAAK,GAAG,SAAS,CAAC,OAAO,CAAA"}
|
package/dist/types/base.d.ts
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
import type { ZodMiniAny, ZodMiniArray, ZodMiniBoolean, ZodMiniDefault, ZodMiniEnum, ZodMiniIntersection, ZodMiniLiteral, ZodMiniNever, ZodMiniNullable, ZodMiniNumber, ZodMiniObject, ZodMiniOptional, ZodMiniRecord, ZodMiniString, ZodMiniType, ZodMiniUnion } from 'zod/mini';
|
|
2
2
|
import { core } from 'zod/mini';
|
|
3
|
+
import type { TypeMetadata } from './_metadata.ts';
|
|
4
|
+
import { standard } from '../standart-schema.ts';
|
|
3
5
|
export type PrimitiveValueType = string | number | boolean | null;
|
|
4
6
|
export type PrimitiveZodType = ZodMiniNever | ZodMiniDefault | ZodMiniNullable | ZodMiniOptional | ZodMiniString | ZodMiniObject | ZodMiniAny | ZodMiniArray | ZodMiniBoolean | ZodMiniNumber | ZodMiniEnum<any> | ZodMiniLiteral<PrimitiveValueType> | ZodMiniUnion | ZodMiniIntersection | ZodMiniRecord;
|
|
5
7
|
export type SimpleZodType = ZodMiniType;
|
|
6
8
|
export type ZodType = SimpleZodType | ZodMiniType;
|
|
7
9
|
export type TypeProps = Record<string, any>;
|
|
8
|
-
export type TypeMetadata<T = any> = {
|
|
9
|
-
id?: string;
|
|
10
|
-
description?: string;
|
|
11
|
-
examples?: T[];
|
|
12
|
-
title?: string;
|
|
13
|
-
};
|
|
14
10
|
export type TypeParams = {
|
|
15
11
|
encode?: (value: any) => any;
|
|
16
12
|
metadata?: TypeMetadata;
|
|
@@ -21,17 +17,21 @@ export type DefaultTypeParams = {
|
|
|
21
17
|
metadata?: TypeMetadata;
|
|
22
18
|
};
|
|
23
19
|
export type BaseTypeAny<EncodedZodType extends SimpleZodType = SimpleZodType, DecodedZodType extends ZodType = ZodMiniType> = BaseType<EncodedZodType, DecodedZodType, TypeProps>;
|
|
24
|
-
export declare const typesRegistry: core.$ZodRegistry<TypeMetadata<any>, core.$ZodType<unknown, unknown, core.$ZodTypeInternals<unknown, unknown>>>;
|
|
25
20
|
export declare const NeemataTypeError: core.$constructor<core.$ZodError<unknown>, core.$ZodIssue[]>;
|
|
26
21
|
export type NeemataTypeError = core.$ZodError;
|
|
27
|
-
export declare abstract class BaseType<EncodeZodType extends SimpleZodType = SimpleZodType, DecodeZodType extends ZodType = EncodeZodType, Props extends TypeProps = TypeProps, RawEncodeZodType extends SimpleZodType = EncodeZodType, RawDecodeZodType extends ZodType = DecodeZodType> {
|
|
22
|
+
export declare abstract class BaseType<EncodeZodType extends SimpleZodType = SimpleZodType, DecodeZodType extends ZodType = EncodeZodType, Props extends TypeProps = TypeProps, RawEncodeZodType extends SimpleZodType = EncodeZodType, RawDecodeZodType extends ZodType = DecodeZodType> implements standard.Schema<DecodeZodType> {
|
|
28
23
|
readonly encodeZodType: EncodeZodType;
|
|
29
24
|
readonly decodeZodType: DecodeZodType;
|
|
30
25
|
readonly encodeRawZodType: RawEncodeZodType;
|
|
31
26
|
readonly decodeRawZodType: RawDecodeZodType;
|
|
32
27
|
readonly props: Props;
|
|
33
28
|
readonly params: TypeParams;
|
|
34
|
-
|
|
29
|
+
readonly standard: {
|
|
30
|
+
encode: standard.Schema<EncodeZodType>;
|
|
31
|
+
decode: standard.Schema<DecodeZodType>;
|
|
32
|
+
};
|
|
33
|
+
readonly '~standard': standard.Props<DecodeZodType>;
|
|
34
|
+
constructor({ encodeZodType, decodeZodType, props, params }: {
|
|
35
35
|
encodeZodType: EncodeZodType;
|
|
36
36
|
decodeZodType?: DecodeZodType;
|
|
37
37
|
props?: Props;
|
package/dist/types/base.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { _default, core, nullable, optional
|
|
2
|
-
|
|
1
|
+
import { _default, core, nullable, optional } from 'zod/mini';
|
|
2
|
+
import { standard } from '../standart-schema.js';
|
|
3
|
+
import { typesRegistry } from './_metadata.js';
|
|
3
4
|
export const NeemataTypeError = core.$ZodError;
|
|
4
5
|
export class BaseType {
|
|
5
6
|
encodeZodType;
|
|
@@ -8,11 +9,18 @@ export class BaseType {
|
|
|
8
9
|
decodeRawZodType;
|
|
9
10
|
props;
|
|
10
11
|
params;
|
|
12
|
+
standard;
|
|
13
|
+
'~standard';
|
|
11
14
|
constructor({ encodeZodType, decodeZodType = encodeZodType, props = {}, params = {}, }) {
|
|
12
15
|
this.encodeZodType = encodeZodType;
|
|
13
16
|
this.decodeZodType = decodeZodType;
|
|
14
17
|
this.props = props;
|
|
15
18
|
this.params = Object.assign({ checks: [] }, params);
|
|
19
|
+
this.standard = {
|
|
20
|
+
encode: standard.encode(this, typesRegistry),
|
|
21
|
+
decode: standard.decode(this, typesRegistry),
|
|
22
|
+
};
|
|
23
|
+
this['~standard'] = this.standard.decode['~standard'];
|
|
16
24
|
}
|
|
17
25
|
optional() {
|
|
18
26
|
return OptionalType.factory(this);
|
package/dist/types/base.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/types/base.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/types/base.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAG7D,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AA2C9C,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAC,SAAS,CAAA;AAG9C,MAAM,OAAgB,QAAQ;IAQnB,aAAa,CAAe;IAC5B,aAAa,CAAe;IAC5B,gBAAgB,CAAmB;IACnC,gBAAgB,CAAmB;IACnC,KAAK,CAAO;IACZ,MAAM,CAAY;IAClB,QAAQ,CAGhB;IACQ,WAAW,CAA+B;IAEnD,YAAY,EACV,aAAa,EACb,aAAa,GAAG,aAAyC,EACzD,KAAK,GAAG,EAAW,EACnB,MAAM,GAAG,EAAyB,GAMnC,EAAE;QACD,IAAI,CAAC,aAAa,GAAG,aAAa,CAAA;QAClC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAA;QAElC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,CAAA;QACnD,IAAI,CAAC,QAAQ,GAAG;YACd,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,aAAa,CAAC;YAC5C,MAAM,EAA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C,aAAa,EAClB,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,YAAY,CAAC,IAAI,YAAY,CACnD;YACD,aAAa,EAAE,QAAQ,CAAC,IAAI,CAAC,aAAa,EAAE,YAAY,CAAC;YACzD,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE;SACvB,CAAC,CAAA;IAAA,CACH;CACF"}
|
package/dist/types/boolean.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boolean.js","sourceRoot":"","sources":["../../src/types/boolean.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,UAAU,CAAA;AAEhD,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAEpC,MAAM,OAAO,WAAY,SAAQ,QAAiC;IAChE,MAAM,CAAC,OAAO;
|
|
1
|
+
{"version":3,"file":"boolean.js","sourceRoot":"","sources":["../../src/types/boolean.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,UAAU,CAAA;AAEhD,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAEpC,MAAM,OAAO,WAAY,SAAQ,QAAiC;IAChE,MAAM,CAAC,OAAO,GAAG;QACf,OAAO,IAAI,WAAW,CAAC,EAAE,aAAa,EAAE,UAAU,EAAE,EAAE,CAAC,CAAA;IAAA,CACxD;CACF;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,WAAW,CAAC,OAAO,CAAA"}
|
package/dist/types/custom.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { MaybePromise } from '@nmtjs/common';
|
|
2
2
|
import type { core, ZodMiniType } from 'zod/mini';
|
|
3
3
|
import type { SimpleZodType, ZodType } from './base.ts';
|
|
4
4
|
import { BaseType } from './base.ts';
|
|
@@ -6,12 +6,12 @@ export type CustomTransformFn<I, O> = (value: I) => O;
|
|
|
6
6
|
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
7
|
}
|
|
8
8
|
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
|
|
9
|
+
static factory<Type, EncodeType extends SimpleZodType = ZodMiniType<Type, Type>, DecodeType extends ZodType = ZodMiniType<Type, Type>>({ decode, encode, validation, error, type, prototype }: {
|
|
10
10
|
decode: CustomTransformFn<EncodeType['_zod']['input'], DecodeType['_zod']['output']>;
|
|
11
11
|
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']>) =>
|
|
13
|
-
encode?: (value: EncodeType['_zod']['input'], payload: core.$RefinementCtx<EncodeType['_zod']['output']>) =>
|
|
14
|
-
decode?: (value: DecodeType['_zod']['output'], payload: core.$RefinementCtx<DecodeType['_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
15
|
};
|
|
16
16
|
error?: string | core.$ZodErrorMap<core.$ZodIssueBase>;
|
|
17
17
|
type?: EncodeType;
|