zod 3.25.0-canary.20250211T214501 → 4.0.0-beta.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.
Files changed (97) hide show
  1. package/dist/commonjs/checks.d.ts +1 -0
  2. package/dist/commonjs/checks.js +32 -0
  3. package/dist/commonjs/coerce.d.ts +17 -0
  4. package/dist/commonjs/coerce.js +57 -0
  5. package/dist/commonjs/compat.d.ts +47 -0
  6. package/dist/commonjs/compat.js +73 -0
  7. package/dist/commonjs/errors.d.ts +23 -0
  8. package/dist/commonjs/errors.js +57 -0
  9. package/dist/commonjs/external.d.ts +8 -0
  10. package/dist/commonjs/external.js +67 -0
  11. package/dist/commonjs/index.d.ts +4 -0
  12. package/{lib → dist/commonjs}/index.js +19 -9
  13. package/dist/commonjs/iso.d.ts +22 -0
  14. package/dist/commonjs/iso.js +70 -0
  15. package/dist/commonjs/package.json +3 -0
  16. package/dist/commonjs/parse.d.ts +17 -0
  17. package/dist/commonjs/parse.js +44 -0
  18. package/dist/commonjs/schemas.d.ts +738 -0
  19. package/dist/commonjs/schemas.js +1171 -0
  20. package/dist/esm/checks.d.ts +1 -0
  21. package/dist/esm/checks.js +1 -0
  22. package/dist/esm/coerce.d.ts +17 -0
  23. package/dist/esm/coerce.js +17 -0
  24. package/dist/esm/compat.d.ts +47 -0
  25. package/dist/esm/compat.js +33 -0
  26. package/dist/esm/errors.d.ts +23 -0
  27. package/dist/esm/errors.js +20 -0
  28. package/dist/esm/external.d.ts +8 -0
  29. package/dist/esm/external.js +11 -0
  30. package/dist/esm/index.d.ts +4 -0
  31. package/dist/esm/index.js +4 -0
  32. package/dist/esm/iso.d.ts +22 -0
  33. package/dist/esm/iso.js +30 -0
  34. package/dist/esm/package.json +3 -0
  35. package/dist/esm/parse.d.ts +17 -0
  36. package/dist/esm/parse.js +8 -0
  37. package/dist/esm/schemas.d.ts +738 -0
  38. package/dist/esm/schemas.js +1057 -0
  39. package/package.json +59 -99
  40. package/src/checks.ts +30 -0
  41. package/src/coerce.ts +27 -0
  42. package/src/compat.ts +74 -0
  43. package/src/errors.ts +47 -0
  44. package/src/external.ts +29 -0
  45. package/src/index.ts +5 -0
  46. package/src/iso.ts +90 -0
  47. package/src/parse.ts +32 -0
  48. package/src/schemas.ts +2324 -0
  49. package/README.md +0 -3074
  50. package/index.d.ts +0 -2
  51. package/lib/ZodError.d.ts +0 -164
  52. package/lib/ZodError.js +0 -137
  53. package/lib/__tests__/Mocker.d.ts +0 -17
  54. package/lib/__tests__/Mocker.js +0 -57
  55. package/lib/benchmarks/datetime.d.ts +0 -5
  56. package/lib/benchmarks/datetime.js +0 -54
  57. package/lib/benchmarks/discriminatedUnion.d.ts +0 -5
  58. package/lib/benchmarks/discriminatedUnion.js +0 -79
  59. package/lib/benchmarks/index.d.ts +0 -1
  60. package/lib/benchmarks/index.js +0 -59
  61. package/lib/benchmarks/ipv4.d.ts +0 -5
  62. package/lib/benchmarks/ipv4.js +0 -54
  63. package/lib/benchmarks/object.d.ts +0 -5
  64. package/lib/benchmarks/object.js +0 -70
  65. package/lib/benchmarks/primitives.d.ts +0 -5
  66. package/lib/benchmarks/primitives.js +0 -170
  67. package/lib/benchmarks/realworld.d.ts +0 -5
  68. package/lib/benchmarks/realworld.js +0 -56
  69. package/lib/benchmarks/string.d.ts +0 -5
  70. package/lib/benchmarks/string.js +0 -55
  71. package/lib/benchmarks/union.d.ts +0 -5
  72. package/lib/benchmarks/union.js +0 -79
  73. package/lib/errors.d.ts +0 -5
  74. package/lib/errors.js +0 -17
  75. package/lib/external.d.ts +0 -6
  76. package/lib/external.js +0 -22
  77. package/lib/helpers/enumUtil.d.ts +0 -8
  78. package/lib/helpers/enumUtil.js +0 -2
  79. package/lib/helpers/errorUtil.d.ts +0 -9
  80. package/lib/helpers/errorUtil.js +0 -8
  81. package/lib/helpers/parseUtil.d.ts +0 -78
  82. package/lib/helpers/parseUtil.js +0 -125
  83. package/lib/helpers/partialUtil.d.ts +0 -8
  84. package/lib/helpers/partialUtil.js +0 -2
  85. package/lib/helpers/typeAliases.d.ts +0 -2
  86. package/lib/helpers/typeAliases.js +0 -2
  87. package/lib/helpers/util.d.ts +0 -82
  88. package/lib/helpers/util.js +0 -142
  89. package/lib/index.d.ts +0 -4
  90. package/lib/index.mjs +0 -4405
  91. package/lib/index.umd.js +0 -4520
  92. package/lib/locales/en.d.ts +0 -3
  93. package/lib/locales/en.js +0 -129
  94. package/lib/standard-schema.d.ts +0 -102
  95. package/lib/standard-schema.js +0 -2
  96. package/lib/types.d.ts +0 -1062
  97. package/lib/types.js +0 -3846
@@ -0,0 +1 @@
1
+ export { _lt as lt, _lte as lte, _gt as gt, _gte as gte, _positive as positive, _negative as negative, _nonpositive as nonpositive, _nonnegative as nonnegative, _multipleOf as multipleOf, _maxSize as maxSize, _minSize as minSize, _size as size, _maxLength as maxLength, _minLength as minLength, _length as length, _regex as regex, _lowercase as lowercase, _uppercase as uppercase, _includes as includes, _startsWith as startsWith, _endsWith as endsWith, _property as property, _mime as mime, _overwrite as overwrite, _normalize as normalize, _trim as trim, _toLowerCase as toLowerCase, _toUpperCase as toUpperCase, } from "@zod/core";
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toUpperCase = exports.toLowerCase = exports.trim = exports.normalize = exports.overwrite = exports.mime = exports.property = exports.endsWith = exports.startsWith = exports.includes = exports.uppercase = exports.lowercase = exports.regex = exports.length = exports.minLength = exports.maxLength = exports.size = exports.minSize = exports.maxSize = exports.multipleOf = exports.nonnegative = exports.nonpositive = exports.negative = exports.positive = exports.gte = exports.gt = exports.lte = exports.lt = void 0;
4
+ var core_1 = require("@zod/core");
5
+ Object.defineProperty(exports, "lt", { enumerable: true, get: function () { return core_1._lt; } });
6
+ Object.defineProperty(exports, "lte", { enumerable: true, get: function () { return core_1._lte; } });
7
+ Object.defineProperty(exports, "gt", { enumerable: true, get: function () { return core_1._gt; } });
8
+ Object.defineProperty(exports, "gte", { enumerable: true, get: function () { return core_1._gte; } });
9
+ Object.defineProperty(exports, "positive", { enumerable: true, get: function () { return core_1._positive; } });
10
+ Object.defineProperty(exports, "negative", { enumerable: true, get: function () { return core_1._negative; } });
11
+ Object.defineProperty(exports, "nonpositive", { enumerable: true, get: function () { return core_1._nonpositive; } });
12
+ Object.defineProperty(exports, "nonnegative", { enumerable: true, get: function () { return core_1._nonnegative; } });
13
+ Object.defineProperty(exports, "multipleOf", { enumerable: true, get: function () { return core_1._multipleOf; } });
14
+ Object.defineProperty(exports, "maxSize", { enumerable: true, get: function () { return core_1._maxSize; } });
15
+ Object.defineProperty(exports, "minSize", { enumerable: true, get: function () { return core_1._minSize; } });
16
+ Object.defineProperty(exports, "size", { enumerable: true, get: function () { return core_1._size; } });
17
+ Object.defineProperty(exports, "maxLength", { enumerable: true, get: function () { return core_1._maxLength; } });
18
+ Object.defineProperty(exports, "minLength", { enumerable: true, get: function () { return core_1._minLength; } });
19
+ Object.defineProperty(exports, "length", { enumerable: true, get: function () { return core_1._length; } });
20
+ Object.defineProperty(exports, "regex", { enumerable: true, get: function () { return core_1._regex; } });
21
+ Object.defineProperty(exports, "lowercase", { enumerable: true, get: function () { return core_1._lowercase; } });
22
+ Object.defineProperty(exports, "uppercase", { enumerable: true, get: function () { return core_1._uppercase; } });
23
+ Object.defineProperty(exports, "includes", { enumerable: true, get: function () { return core_1._includes; } });
24
+ Object.defineProperty(exports, "startsWith", { enumerable: true, get: function () { return core_1._startsWith; } });
25
+ Object.defineProperty(exports, "endsWith", { enumerable: true, get: function () { return core_1._endsWith; } });
26
+ Object.defineProperty(exports, "property", { enumerable: true, get: function () { return core_1._property; } });
27
+ Object.defineProperty(exports, "mime", { enumerable: true, get: function () { return core_1._mime; } });
28
+ Object.defineProperty(exports, "overwrite", { enumerable: true, get: function () { return core_1._overwrite; } });
29
+ Object.defineProperty(exports, "normalize", { enumerable: true, get: function () { return core_1._normalize; } });
30
+ Object.defineProperty(exports, "trim", { enumerable: true, get: function () { return core_1._trim; } });
31
+ Object.defineProperty(exports, "toLowerCase", { enumerable: true, get: function () { return core_1._toLowerCase; } });
32
+ Object.defineProperty(exports, "toUpperCase", { enumerable: true, get: function () { return core_1._toUpperCase; } });
@@ -0,0 +1,17 @@
1
+ import * as core from "@zod/core";
2
+ import * as schemas from "./schemas.js";
3
+ export interface ZodCoercedString extends schemas._ZodString<unknown> {
4
+ }
5
+ export declare function string(params?: string | core.$ZodStringParams): ZodCoercedString;
6
+ export interface ZodCoercedNumber extends schemas._ZodNumber<unknown> {
7
+ }
8
+ export declare function number(params?: string | core.$ZodNumberParams): ZodCoercedNumber;
9
+ export interface ZodCoercedBoolean extends schemas._ZodBoolean<unknown> {
10
+ }
11
+ export declare function boolean(params?: string | core.$ZodBooleanParams): ZodCoercedBoolean;
12
+ export interface ZodCoercedBigInt extends schemas._ZodBigInt<unknown> {
13
+ }
14
+ export declare function bigint(params?: string | core.$ZodBigIntParams): ZodCoercedBigInt;
15
+ export interface ZodCoercedDate extends schemas._ZodDate<unknown> {
16
+ }
17
+ export declare function date(params?: string | core.$ZodDateParams): ZodCoercedDate;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.string = string;
37
+ exports.number = number;
38
+ exports.boolean = boolean;
39
+ exports.bigint = bigint;
40
+ exports.date = date;
41
+ const core = __importStar(require("@zod/core"));
42
+ const schemas = __importStar(require("./schemas.js"));
43
+ function string(params) {
44
+ return core._coercedString(schemas.ZodString, params);
45
+ }
46
+ function number(params) {
47
+ return core._coercedNumber(schemas.ZodNumber, params);
48
+ }
49
+ function boolean(params) {
50
+ return core._coercedBoolean(schemas.ZodBoolean, params);
51
+ }
52
+ function bigint(params) {
53
+ return core._coercedBigint(schemas.ZodBigInt, params);
54
+ }
55
+ function date(params) {
56
+ return core._coercedDate(schemas.ZodDate, params);
57
+ }
@@ -0,0 +1,47 @@
1
+ import * as core from "@zod/core";
2
+ import type { ZodType } from "./schemas.js";
3
+ export type {
4
+ /** @deprecated Use `z.output<T>` instead. */
5
+ output as TypeOf,
6
+ /** @deprecated Use `z.output<T>` instead. */
7
+ output as Infer,
8
+ /** @deprecated Use `z.core.$$ZodFirstPartyTypes` instead */
9
+ $ZodTypes as ZodFirstPartySchemaTypes, } from "@zod/core";
10
+ /** @deprecated Use the raw string literal codes instead, e.g. "invalid_type". */
11
+ export declare const ZodIssueCode: {
12
+ readonly invalid_type: "invalid_type";
13
+ readonly too_big: "too_big";
14
+ readonly too_small: "too_small";
15
+ readonly invalid_format: "invalid_format";
16
+ readonly not_multiple_of: "not_multiple_of";
17
+ readonly unrecognized_keys: "unrecognized_keys";
18
+ readonly invalid_union: "invalid_union";
19
+ readonly invalid_key: "invalid_key";
20
+ readonly invalid_element: "invalid_element";
21
+ readonly invalid_value: "invalid_value";
22
+ readonly custom: "custom";
23
+ };
24
+ /** A special constant with type `never` */
25
+ export declare const NEVER: never;
26
+ /** @deprecated Use `z.$ZodFlattenedError` */
27
+ export type inferFlattenedErrors<T extends core.$ZodType, U = string> = core.$ZodFlattenedError<core.output<T>, U>;
28
+ /** @deprecated Use `z.$ZodFormattedError` */
29
+ export type inferFormattedError<T extends core.$ZodType<any, any>, U = string> = core.$ZodFormattedError<core.output<T>, U>;
30
+ /** Use `z.$brand` instead */
31
+ export type BRAND<T extends string | number | symbol = string | number | symbol> = {
32
+ [core.$brand]: {
33
+ [k in T]: true;
34
+ };
35
+ };
36
+ export { $brand, config } from "@zod/core";
37
+ /** @deprecated Use `z.config(params)` instead. */
38
+ export declare function setErrorMap(map: core.$ZodErrorMap): void;
39
+ /** @deprecated Use `z.config()` instead. */
40
+ export declare function getErrorMap(): core.$ZodErrorMap<core.$ZodIssue> | undefined;
41
+ export type {
42
+ /** @deprecated Use z.ZodType (without generics) instead. */
43
+ ZodType as ZodTypeAny,
44
+ /** @deprecated Use `z.ZodType` */
45
+ ZodType as ZodSchema,
46
+ /** @deprecated Use `z.ZodType` */
47
+ ZodType as Schema, };
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ // Zod 3 compat layer
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.config = exports.$brand = exports.NEVER = exports.ZodIssueCode = void 0;
38
+ exports.setErrorMap = setErrorMap;
39
+ exports.getErrorMap = getErrorMap;
40
+ const core = __importStar(require("@zod/core"));
41
+ /** @deprecated Use the raw string literal codes instead, e.g. "invalid_type". */
42
+ exports.ZodIssueCode = {
43
+ invalid_type: "invalid_type",
44
+ too_big: "too_big",
45
+ too_small: "too_small",
46
+ invalid_format: "invalid_format",
47
+ not_multiple_of: "not_multiple_of",
48
+ unrecognized_keys: "unrecognized_keys",
49
+ invalid_union: "invalid_union",
50
+ invalid_key: "invalid_key",
51
+ invalid_element: "invalid_element",
52
+ invalid_value: "invalid_value",
53
+ custom: "custom",
54
+ };
55
+ /** @deprecated Not necessary in Zod 4. */
56
+ const INVALID = Object.freeze({
57
+ status: "aborted",
58
+ });
59
+ /** A special constant with type `never` */
60
+ exports.NEVER = INVALID;
61
+ var core_1 = require("@zod/core");
62
+ Object.defineProperty(exports, "$brand", { enumerable: true, get: function () { return core_1.$brand; } });
63
+ Object.defineProperty(exports, "config", { enumerable: true, get: function () { return core_1.config; } });
64
+ /** @deprecated Use `z.config(params)` instead. */
65
+ function setErrorMap(map) {
66
+ core.config({
67
+ customError: map,
68
+ });
69
+ }
70
+ /** @deprecated Use `z.config()` instead. */
71
+ function getErrorMap() {
72
+ return core.config().customError;
73
+ }
@@ -0,0 +1,23 @@
1
+ import * as core from "@zod/core";
2
+ /** @deprecated Use `z.core.$ZodIssue` from `@zod/core` instead, especially if you are building a library on top of Zod. */
3
+ export type ZodIssue = core.$ZodIssue;
4
+ export declare class ZodError<T = unknown> extends core.$ZodError<T> {
5
+ /** @deprecated Use the `z.formatError(err)` function instead. */
6
+ format(): core.$ZodFormattedError<T>;
7
+ format<U>(mapper: (issue: core.$ZodIssue) => U): core.$ZodFormattedError<T, U>;
8
+ /** @deprecated Use the `z.flattenError(err)` function instead. */
9
+ flatten(): core.$ZodFlattenedError<T>;
10
+ flatten<U>(mapper: (issue: core.$ZodIssue) => U): core.$ZodFlattenedError<T, U>;
11
+ addIssue(issue: core.$ZodIssue): void;
12
+ addIssues(issues: core.$ZodIssue[]): void;
13
+ get isEmpty(): boolean;
14
+ }
15
+ export type {
16
+ /** @deprecated Use `z.core.$ZodFlattenedError` instead. */
17
+ $ZodFlattenedError as ZodFlattenedError,
18
+ /** @deprecated Use `z.core.$ZodFormattedError` instead. */
19
+ $ZodFormattedError as ZodFormattedError,
20
+ /** @deprecated Use `z.core.$ZodErrorMap` instead. */
21
+ $ZodErrorMap as ZodErrorMap, } from "@zod/core";
22
+ /** @deprecated Use `z.core.$ZodRawIssue` instead. */
23
+ export type IssueData = core.$ZodRawIssue;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.ZodError = void 0;
37
+ const core = __importStar(require("@zod/core"));
38
+ class ZodError extends core.$ZodError {
39
+ format(mapper) {
40
+ return core.formatError(this, mapper);
41
+ }
42
+ flatten(mapper) {
43
+ return core.flattenError(this, mapper);
44
+ }
45
+ addIssue(issue) {
46
+ this.issues.push(issue);
47
+ }
48
+ addIssues(issues) {
49
+ this.issues.push(...issues);
50
+ }
51
+ get isEmpty() {
52
+ return this.issues.length === 0;
53
+ }
54
+ }
55
+ exports.ZodError = ZodError;
56
+ // /** @deprecated Use `z.core.$ZodErrorMapCtx` instead. */
57
+ // export type ErrorMapCtx = core.$ZodErrorMapCtx;
@@ -0,0 +1,8 @@
1
+ export * as core from "@zod/core";
2
+ export * from "./schemas.js";
3
+ export * from "./checks.js";
4
+ export * from "./errors.js";
5
+ export * from "./parse.js";
6
+ export * from "./compat.js";
7
+ export type { infer, output, input } from "@zod/core";
8
+ export { globalRegistry, registry, config, $output, $input, $brand, function, clone, regexes, flattenError, formatError, treeifyError, prettifyError, toJSONSchema, } from "@zod/core";
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
36
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
37
+ };
38
+ var __importDefault = (this && this.__importDefault) || function (mod) {
39
+ return (mod && mod.__esModule) ? mod : { "default": mod };
40
+ };
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ exports.toJSONSchema = exports.prettifyError = exports.treeifyError = exports.formatError = exports.flattenError = exports.regexes = exports.clone = exports.function = exports.$brand = exports.$input = exports.$output = exports.config = exports.registry = exports.globalRegistry = exports.core = void 0;
43
+ exports.core = __importStar(require("@zod/core"));
44
+ __exportStar(require("./schemas.js"), exports);
45
+ __exportStar(require("./checks.js"), exports);
46
+ __exportStar(require("./errors.js"), exports);
47
+ __exportStar(require("./parse.js"), exports);
48
+ __exportStar(require("./compat.js"), exports);
49
+ // zod-specified
50
+ const core_1 = require("@zod/core");
51
+ const en_js_1 = __importDefault(require("@zod/core/locales/en.js"));
52
+ (0, core_1.config)((0, en_js_1.default)());
53
+ var core_2 = require("@zod/core");
54
+ Object.defineProperty(exports, "globalRegistry", { enumerable: true, get: function () { return core_2.globalRegistry; } });
55
+ Object.defineProperty(exports, "registry", { enumerable: true, get: function () { return core_2.registry; } });
56
+ Object.defineProperty(exports, "config", { enumerable: true, get: function () { return core_2.config; } });
57
+ Object.defineProperty(exports, "$output", { enumerable: true, get: function () { return core_2.$output; } });
58
+ Object.defineProperty(exports, "$input", { enumerable: true, get: function () { return core_2.$input; } });
59
+ Object.defineProperty(exports, "$brand", { enumerable: true, get: function () { return core_2.$brand; } });
60
+ Object.defineProperty(exports, "function", { enumerable: true, get: function () { return core_2.function; } });
61
+ Object.defineProperty(exports, "clone", { enumerable: true, get: function () { return core_2.clone; } });
62
+ Object.defineProperty(exports, "regexes", { enumerable: true, get: function () { return core_2.regexes; } });
63
+ Object.defineProperty(exports, "flattenError", { enumerable: true, get: function () { return core_2.flattenError; } });
64
+ Object.defineProperty(exports, "formatError", { enumerable: true, get: function () { return core_2.formatError; } });
65
+ Object.defineProperty(exports, "treeifyError", { enumerable: true, get: function () { return core_2.treeifyError; } });
66
+ Object.defineProperty(exports, "prettifyError", { enumerable: true, get: function () { return core_2.prettifyError; } });
67
+ Object.defineProperty(exports, "toJSONSchema", { enumerable: true, get: function () { return core_2.toJSONSchema; } });
@@ -0,0 +1,4 @@
1
+ import * as z from "./external.js";
2
+ export { z };
3
+ export * from "./external.js";
4
+ export default z;
@@ -15,19 +15,29 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
36
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
37
  };
28
38
  Object.defineProperty(exports, "__esModule", { value: true });
29
39
  exports.z = void 0;
30
- const z = __importStar(require("./external"));
40
+ const z = __importStar(require("./external.js"));
31
41
  exports.z = z;
32
- __exportStar(require("./external"), exports);
42
+ __exportStar(require("./external.js"), exports);
33
43
  exports.default = z;
@@ -0,0 +1,22 @@
1
+ import * as core from "@zod/core";
2
+ import * as schemas from "./schemas.js";
3
+ export interface ZodISODateTime extends schemas.ZodStringFormat {
4
+ _zod: core.$ZodISODateTimeInternals;
5
+ }
6
+ export declare const ZodISODateTime: core.$constructor<ZodISODateTime>;
7
+ export declare function datetime(params?: string | core.$ZodISODateTimeParams): ZodISODateTime;
8
+ export interface ZodISODate extends schemas.ZodStringFormat {
9
+ _zod: core.$ZodISODateInternals;
10
+ }
11
+ export declare const ZodISODate: core.$constructor<ZodISODate>;
12
+ export declare function date(params?: string | core.$ZodISODateParams): ZodISODate;
13
+ export interface ZodISOTime extends schemas.ZodStringFormat {
14
+ _zod: core.$ZodISOTimeInternals;
15
+ }
16
+ export declare const ZodISOTime: core.$constructor<ZodISOTime>;
17
+ export declare function time(params?: string | core.$ZodISOTimeParams): ZodISOTime;
18
+ export interface ZodISODuration extends schemas.ZodStringFormat {
19
+ _zod: core.$ZodISODurationInternals;
20
+ }
21
+ export declare const ZodISODuration: core.$constructor<ZodISODuration>;
22
+ export declare function duration(params?: string | core.$ZodISODurationParams): ZodISODuration;
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.ZodISODuration = exports.ZodISOTime = exports.ZodISODate = exports.ZodISODateTime = void 0;
37
+ exports.datetime = datetime;
38
+ exports.date = date;
39
+ exports.time = time;
40
+ exports.duration = duration;
41
+ const core = __importStar(require("@zod/core"));
42
+ const schemas = __importStar(require("./schemas.js"));
43
+ exports.ZodISODateTime = core.$constructor("ZodISODateTime", (inst, def) => {
44
+ core.$ZodISODateTime.init(inst, def);
45
+ schemas.ZodStringFormat.init(inst, def);
46
+ });
47
+ function datetime(params) {
48
+ return core._isoDateTime(exports.ZodISODateTime, params);
49
+ }
50
+ exports.ZodISODate = core.$constructor("ZodISODate", (inst, def) => {
51
+ core.$ZodISODate.init(inst, def);
52
+ schemas.ZodStringFormat.init(inst, def);
53
+ });
54
+ function date(params) {
55
+ return core._isoDate(exports.ZodISODate, params);
56
+ }
57
+ exports.ZodISOTime = core.$constructor("ZodISOTime", (inst, def) => {
58
+ core.$ZodISOTime.init(inst, def);
59
+ schemas.ZodStringFormat.init(inst, def);
60
+ });
61
+ function time(params) {
62
+ return core._isoTime(exports.ZodISOTime, params);
63
+ }
64
+ exports.ZodISODuration = core.$constructor("ZodISODuration", (inst, def) => {
65
+ core.$ZodISODuration.init(inst, def);
66
+ schemas.ZodStringFormat.init(inst, def);
67
+ });
68
+ function duration(params) {
69
+ return core._isoDuration(exports.ZodISODuration, params);
70
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
@@ -0,0 +1,17 @@
1
+ import * as core from "@zod/core";
2
+ import { ZodError } from "./errors.js";
3
+ export type ZodSafeParseResult<T> = ZodSafeParseSuccess<T> | ZodSafeParseError<T>;
4
+ export type ZodSafeParseSuccess<T> = {
5
+ success: true;
6
+ data: T;
7
+ error?: never;
8
+ };
9
+ export type ZodSafeParseError<T> = {
10
+ success: false;
11
+ data?: never;
12
+ error: ZodError<T>;
13
+ };
14
+ export declare const parse: <T extends core.$ZodType>(schema: T, value: unknown, _ctx?: core.ParseContext<core.$ZodIssue>) => core.output<T>;
15
+ export declare const safeParse: <T extends core.$ZodType>(schema: T, value: unknown, _ctx?: core.ParseContext<core.$ZodIssue>) => ZodSafeParseResult<core.output<T>>;
16
+ export declare const parseAsync: <T extends core.$ZodType>(schema: T, value: unknown, _ctx?: core.ParseContext<core.$ZodIssue>) => Promise<core.output<T>>;
17
+ export declare const safeParseAsync: <T extends core.$ZodType>(schema: T, value: unknown, _ctx?: core.ParseContext<core.$ZodIssue>) => Promise<ZodSafeParseResult<core.output<T>>>;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.safeParseAsync = exports.parseAsync = exports.safeParse = exports.parse = void 0;
37
+ const core = __importStar(require("@zod/core"));
38
+ const errors_js_1 = require("./errors.js");
39
+ exports.parse = core._parse.bind({ Error: errors_js_1.ZodError });
40
+ exports.safeParse = core._safeParse.bind({ Error: errors_js_1.ZodError });
41
+ exports.parseAsync = core._parseAsync.bind({ Error: errors_js_1.ZodError });
42
+ exports.safeParseAsync = core._safeParseAsync.bind({
43
+ Error: errors_js_1.ZodError,
44
+ });