zod 4.0.0-beta.1 → 4.0.0-beta.20250410T035006

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 (102) hide show
  1. package/LICENSE +1 -1
  2. package/dist/commonjs/checks.d.ts +1 -0
  3. package/dist/commonjs/checks.js +32 -0
  4. package/dist/commonjs/coerce.d.ts +17 -0
  5. package/dist/commonjs/coerce.js +57 -0
  6. package/dist/commonjs/compat.d.ts +47 -0
  7. package/dist/commonjs/compat.js +73 -0
  8. package/dist/commonjs/errors.d.ts +29 -0
  9. package/dist/commonjs/errors.js +61 -0
  10. package/dist/commonjs/external.d.ts +8 -0
  11. package/dist/commonjs/external.js +67 -0
  12. package/dist/commonjs/index.d.ts +4 -0
  13. package/dist/commonjs/index.js +43 -0
  14. package/dist/commonjs/iso.d.ts +22 -0
  15. package/dist/commonjs/iso.js +70 -0
  16. package/dist/commonjs/package.json +3 -0
  17. package/dist/commonjs/parse.d.ts +17 -0
  18. package/dist/commonjs/parse.js +44 -0
  19. package/dist/commonjs/schemas.d.ts +750 -0
  20. package/dist/commonjs/schemas.js +1190 -0
  21. package/dist/esm/checks.d.ts +1 -0
  22. package/dist/esm/checks.js +1 -0
  23. package/dist/esm/coerce.d.ts +17 -0
  24. package/dist/esm/coerce.js +17 -0
  25. package/dist/esm/compat.d.ts +47 -0
  26. package/dist/esm/compat.js +33 -0
  27. package/dist/esm/errors.d.ts +29 -0
  28. package/dist/esm/errors.js +24 -0
  29. package/dist/esm/external.d.ts +8 -0
  30. package/dist/esm/external.js +14 -0
  31. package/dist/esm/index.d.ts +4 -0
  32. package/dist/esm/index.js +4 -0
  33. package/dist/esm/iso.d.ts +22 -0
  34. package/dist/esm/iso.js +30 -0
  35. package/dist/esm/package.json +3 -0
  36. package/dist/esm/parse.d.ts +17 -0
  37. package/dist/esm/parse.js +8 -0
  38. package/dist/esm/schemas.d.ts +750 -0
  39. package/dist/esm/schemas.js +1074 -0
  40. package/package.json +66 -82
  41. package/src/checks.ts +30 -0
  42. package/src/coerce.ts +27 -0
  43. package/src/compat.ts +74 -0
  44. package/src/errors.ts +50 -0
  45. package/src/external.ts +29 -0
  46. package/src/index.ts +5 -0
  47. package/src/iso.ts +90 -0
  48. package/src/parse.ts +32 -0
  49. package/src/schemas.ts +2360 -0
  50. package/CHANGELOG.md +0 -160
  51. package/README.md +0 -1730
  52. package/lib/.DS_Store +0 -0
  53. package/lib/PseudoPromise.d.ts +0 -7
  54. package/lib/PseudoPromise.d.ts.map +0 -1
  55. package/lib/PseudoPromise.js +0 -17
  56. package/lib/PseudoPromise.js.map +0 -1
  57. package/lib/ZodError.d.ts +0 -137
  58. package/lib/ZodError.d.ts.map +0 -1
  59. package/lib/ZodError.js +0 -301
  60. package/lib/ZodError.js.map +0 -1
  61. package/lib/benchmarks/index.d.ts +0 -2
  62. package/lib/benchmarks/index.d.ts.map +0 -1
  63. package/lib/benchmarks/index.js +0 -54
  64. package/lib/benchmarks/index.js.map +0 -1
  65. package/lib/benchmarks/object.d.ts +0 -6
  66. package/lib/benchmarks/object.d.ts.map +0 -1
  67. package/lib/benchmarks/object.js +0 -71
  68. package/lib/benchmarks/object.js.map +0 -1
  69. package/lib/benchmarks/string.d.ts +0 -6
  70. package/lib/benchmarks/string.d.ts.map +0 -1
  71. package/lib/benchmarks/string.js +0 -45
  72. package/lib/benchmarks/string.js.map +0 -1
  73. package/lib/external.d.ts +0 -4
  74. package/lib/external.d.ts.map +0 -1
  75. package/lib/external.js +0 -16
  76. package/lib/external.js.map +0 -1
  77. package/lib/helpers/errorUtil.d.ts +0 -10
  78. package/lib/helpers/errorUtil.d.ts.map +0 -1
  79. package/lib/helpers/errorUtil.js +0 -13
  80. package/lib/helpers/errorUtil.js.map +0 -1
  81. package/lib/helpers/parseUtil.d.ts +0 -74
  82. package/lib/helpers/parseUtil.d.ts.map +0 -1
  83. package/lib/helpers/parseUtil.js +0 -179
  84. package/lib/helpers/parseUtil.js.map +0 -1
  85. package/lib/helpers/partialUtil.d.ts +0 -18
  86. package/lib/helpers/partialUtil.d.ts.map +0 -1
  87. package/lib/helpers/partialUtil.js +0 -3
  88. package/lib/helpers/partialUtil.js.map +0 -1
  89. package/lib/helpers/util.d.ts +0 -18
  90. package/lib/helpers/util.d.ts.map +0 -1
  91. package/lib/helpers/util.js +0 -87
  92. package/lib/helpers/util.js.map +0 -1
  93. package/lib/index.d.ts +0 -4
  94. package/lib/index.d.ts.map +0 -1
  95. package/lib/index.js +0 -29
  96. package/lib/index.js.map +0 -1
  97. package/lib/index.mjs +0 -2808
  98. package/lib/index.mjs.map +0 -1
  99. package/lib/types.d.ts +0 -541
  100. package/lib/types.d.ts.map +0 -1
  101. package/lib/types.js +0 -2282
  102. package/lib/types.js.map +0 -1
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2020 Colin McDonnell
3
+ Copyright (c) 2025 Colin McDonnell
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -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,29 @@
1
+ import * as core from "@zod/core";
2
+ import { $ZodError } from "@zod/core";
3
+ /** @deprecated Use `z.core.$ZodIssue` from `@zod/core` instead, especially if you are building a library on top of Zod. */
4
+ export type ZodIssue = core.$ZodIssue;
5
+ export declare class ZodError<T = unknown> extends $ZodError<T> {
6
+ /** @deprecated Use the `z.treeifyError(err)` function instead. */
7
+ format(): core.$ZodFormattedError<T>;
8
+ /** @deprecated Use the `z.treeifyError(err)` function instead. */
9
+ format<U>(mapper: (issue: core.$ZodIssue) => U): core.$ZodFormattedError<T, U>;
10
+ /** @deprecated Use the `z.treeifyError(err)` function instead. */
11
+ flatten(): core.$ZodFlattenedError<T>;
12
+ /** @deprecated Use the `z.treeifyError(err)` function instead. */
13
+ flatten<U>(mapper: (issue: core.$ZodIssue) => U): core.$ZodFlattenedError<T, U>;
14
+ /** @deprecated Push directly to `.issues` instead. */
15
+ addIssue(issue: core.$ZodIssue): void;
16
+ /** @deprecated Push directly to `.issues` instead. */
17
+ addIssues(issues: core.$ZodIssue[]): void;
18
+ /** @deprecated Check `err.issues.length === 0` instead. */
19
+ get isEmpty(): boolean;
20
+ }
21
+ export type {
22
+ /** @deprecated Use `z.core.$ZodFlattenedError` instead. */
23
+ $ZodFlattenedError as ZodFlattenedError,
24
+ /** @deprecated Use `z.core.$ZodFormattedError` instead. */
25
+ $ZodFormattedError as ZodFormattedError,
26
+ /** @deprecated Use `z.core.$ZodErrorMap` instead. */
27
+ $ZodErrorMap as ZodErrorMap, } from "@zod/core";
28
+ /** @deprecated Use `z.core.$ZodRawIssue` instead. */
29
+ export type IssueData = core.$ZodRawIssue;
@@ -0,0 +1,61 @@
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
+ const core_1 = require("@zod/core");
39
+ class ZodError extends core_1.$ZodError {
40
+ format(mapper) {
41
+ return core.formatError(this, mapper);
42
+ }
43
+ flatten(mapper) {
44
+ return core.flattenError(this, mapper);
45
+ }
46
+ /** @deprecated Push directly to `.issues` instead. */
47
+ addIssue(issue) {
48
+ this.issues.push(issue);
49
+ }
50
+ /** @deprecated Push directly to `.issues` instead. */
51
+ addIssues(issues) {
52
+ this.issues.push(...issues);
53
+ }
54
+ /** @deprecated Check `err.issues.length === 0` instead. */
55
+ get isEmpty() {
56
+ return this.issues.length === 0;
57
+ }
58
+ }
59
+ exports.ZodError = ZodError;
60
+ // /** @deprecated Use `z.core.$ZodErrorMapCtx` instead. */
61
+ // 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, 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.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
+ // flattenError,
64
+ // 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;
@@ -0,0 +1,43 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.z = void 0;
40
+ const z = __importStar(require("./external.js"));
41
+ exports.z = z;
42
+ __exportStar(require("./external.js"), exports);
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
+ });