zod 4.0.0-beta.0 → 4.0.0-beta.20250409T222615
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/LICENSE +1 -1
- package/dist/commonjs/errors.d.ts +7 -2
- package/dist/commonjs/errors.js +3 -0
- package/dist/commonjs/external.d.ts +1 -1
- package/dist/commonjs/external.js +3 -3
- package/dist/esm/errors.d.ts +7 -2
- package/dist/esm/errors.js +3 -0
- package/dist/esm/external.d.ts +1 -1
- package/dist/esm/external.js +4 -1
- package/package.json +5 -3
- package/src/errors.ts +7 -2
- package/src/external.ts +2 -2
package/LICENSE
CHANGED
|
@@ -2,14 +2,19 @@ import * as core from "@zod/core";
|
|
|
2
2
|
/** @deprecated Use `z.core.$ZodIssue` from `@zod/core` instead, especially if you are building a library on top of Zod. */
|
|
3
3
|
export type ZodIssue = core.$ZodIssue;
|
|
4
4
|
export declare class ZodError<T = unknown> extends core.$ZodError<T> {
|
|
5
|
-
/** @deprecated Use the `z.
|
|
5
|
+
/** @deprecated Use the `z.treeifyError(err)` function instead. */
|
|
6
6
|
format(): core.$ZodFormattedError<T>;
|
|
7
|
+
/** @deprecated Use the `z.treeifyError(err)` function instead. */
|
|
7
8
|
format<U>(mapper: (issue: core.$ZodIssue) => U): core.$ZodFormattedError<T, U>;
|
|
8
|
-
/** @deprecated Use the `z.
|
|
9
|
+
/** @deprecated Use the `z.treeifyError(err)` function instead. */
|
|
9
10
|
flatten(): core.$ZodFlattenedError<T>;
|
|
11
|
+
/** @deprecated Use the `z.treeifyError(err)` function instead. */
|
|
10
12
|
flatten<U>(mapper: (issue: core.$ZodIssue) => U): core.$ZodFlattenedError<T, U>;
|
|
13
|
+
/** @deprecated Push directly to `.issues` instead. */
|
|
11
14
|
addIssue(issue: core.$ZodIssue): void;
|
|
15
|
+
/** @deprecated Push directly to `.issues` instead. */
|
|
12
16
|
addIssues(issues: core.$ZodIssue[]): void;
|
|
17
|
+
/** @deprecated Check `err.issues.length === 0` instead. */
|
|
13
18
|
get isEmpty(): boolean;
|
|
14
19
|
}
|
|
15
20
|
export type {
|
package/dist/commonjs/errors.js
CHANGED
|
@@ -42,12 +42,15 @@ class ZodError extends core.$ZodError {
|
|
|
42
42
|
flatten(mapper) {
|
|
43
43
|
return core.flattenError(this, mapper);
|
|
44
44
|
}
|
|
45
|
+
/** @deprecated Push directly to `.issues` instead. */
|
|
45
46
|
addIssue(issue) {
|
|
46
47
|
this.issues.push(issue);
|
|
47
48
|
}
|
|
49
|
+
/** @deprecated Push directly to `.issues` instead. */
|
|
48
50
|
addIssues(issues) {
|
|
49
51
|
this.issues.push(...issues);
|
|
50
52
|
}
|
|
53
|
+
/** @deprecated Check `err.issues.length === 0` instead. */
|
|
51
54
|
get isEmpty() {
|
|
52
55
|
return this.issues.length === 0;
|
|
53
56
|
}
|
|
@@ -5,4 +5,4 @@ export * from "./errors.js";
|
|
|
5
5
|
export * from "./parse.js";
|
|
6
6
|
export * from "./compat.js";
|
|
7
7
|
export type { infer, output, input } from "@zod/core";
|
|
8
|
-
export { globalRegistry, registry, config, $output, $input, $brand, function, clone, regexes,
|
|
8
|
+
export { globalRegistry, registry, config, $output, $input, $brand, function, clone, regexes, treeifyError, prettifyError, toJSONSchema, } from "@zod/core";
|
|
@@ -39,7 +39,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
39
39
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
40
|
};
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.toJSONSchema = exports.prettifyError = exports.treeifyError = exports.
|
|
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
43
|
exports.core = __importStar(require("@zod/core"));
|
|
44
44
|
__exportStar(require("./schemas.js"), exports);
|
|
45
45
|
__exportStar(require("./checks.js"), exports);
|
|
@@ -60,8 +60,8 @@ Object.defineProperty(exports, "$brand", { enumerable: true, get: function () {
|
|
|
60
60
|
Object.defineProperty(exports, "function", { enumerable: true, get: function () { return core_2.function; } });
|
|
61
61
|
Object.defineProperty(exports, "clone", { enumerable: true, get: function () { return core_2.clone; } });
|
|
62
62
|
Object.defineProperty(exports, "regexes", { enumerable: true, get: function () { return core_2.regexes; } });
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
// flattenError,
|
|
64
|
+
// formatError,
|
|
65
65
|
Object.defineProperty(exports, "treeifyError", { enumerable: true, get: function () { return core_2.treeifyError; } });
|
|
66
66
|
Object.defineProperty(exports, "prettifyError", { enumerable: true, get: function () { return core_2.prettifyError; } });
|
|
67
67
|
Object.defineProperty(exports, "toJSONSchema", { enumerable: true, get: function () { return core_2.toJSONSchema; } });
|
package/dist/esm/errors.d.ts
CHANGED
|
@@ -2,14 +2,19 @@ import * as core from "@zod/core";
|
|
|
2
2
|
/** @deprecated Use `z.core.$ZodIssue` from `@zod/core` instead, especially if you are building a library on top of Zod. */
|
|
3
3
|
export type ZodIssue = core.$ZodIssue;
|
|
4
4
|
export declare class ZodError<T = unknown> extends core.$ZodError<T> {
|
|
5
|
-
/** @deprecated Use the `z.
|
|
5
|
+
/** @deprecated Use the `z.treeifyError(err)` function instead. */
|
|
6
6
|
format(): core.$ZodFormattedError<T>;
|
|
7
|
+
/** @deprecated Use the `z.treeifyError(err)` function instead. */
|
|
7
8
|
format<U>(mapper: (issue: core.$ZodIssue) => U): core.$ZodFormattedError<T, U>;
|
|
8
|
-
/** @deprecated Use the `z.
|
|
9
|
+
/** @deprecated Use the `z.treeifyError(err)` function instead. */
|
|
9
10
|
flatten(): core.$ZodFlattenedError<T>;
|
|
11
|
+
/** @deprecated Use the `z.treeifyError(err)` function instead. */
|
|
10
12
|
flatten<U>(mapper: (issue: core.$ZodIssue) => U): core.$ZodFlattenedError<T, U>;
|
|
13
|
+
/** @deprecated Push directly to `.issues` instead. */
|
|
11
14
|
addIssue(issue: core.$ZodIssue): void;
|
|
15
|
+
/** @deprecated Push directly to `.issues` instead. */
|
|
12
16
|
addIssues(issues: core.$ZodIssue[]): void;
|
|
17
|
+
/** @deprecated Check `err.issues.length === 0` instead. */
|
|
13
18
|
get isEmpty(): boolean;
|
|
14
19
|
}
|
|
15
20
|
export type {
|
package/dist/esm/errors.js
CHANGED
|
@@ -6,12 +6,15 @@ export class ZodError extends core.$ZodError {
|
|
|
6
6
|
flatten(mapper) {
|
|
7
7
|
return core.flattenError(this, mapper);
|
|
8
8
|
}
|
|
9
|
+
/** @deprecated Push directly to `.issues` instead. */
|
|
9
10
|
addIssue(issue) {
|
|
10
11
|
this.issues.push(issue);
|
|
11
12
|
}
|
|
13
|
+
/** @deprecated Push directly to `.issues` instead. */
|
|
12
14
|
addIssues(issues) {
|
|
13
15
|
this.issues.push(...issues);
|
|
14
16
|
}
|
|
17
|
+
/** @deprecated Check `err.issues.length === 0` instead. */
|
|
15
18
|
get isEmpty() {
|
|
16
19
|
return this.issues.length === 0;
|
|
17
20
|
}
|
package/dist/esm/external.d.ts
CHANGED
|
@@ -5,4 +5,4 @@ export * from "./errors.js";
|
|
|
5
5
|
export * from "./parse.js";
|
|
6
6
|
export * from "./compat.js";
|
|
7
7
|
export type { infer, output, input } from "@zod/core";
|
|
8
|
-
export { globalRegistry, registry, config, $output, $input, $brand, function, clone, regexes,
|
|
8
|
+
export { globalRegistry, registry, config, $output, $input, $brand, function, clone, regexes, treeifyError, prettifyError, toJSONSchema, } from "@zod/core";
|
package/dist/esm/external.js
CHANGED
|
@@ -8,4 +8,7 @@ export * from "./compat.js";
|
|
|
8
8
|
import { config } from "@zod/core";
|
|
9
9
|
import en from "@zod/core/locales/en.js";
|
|
10
10
|
config(en());
|
|
11
|
-
export { globalRegistry, registry, config, $output, $input, $brand, function, clone, regexes,
|
|
11
|
+
export { globalRegistry, registry, config, $output, $input, $brand, function, clone, regexes,
|
|
12
|
+
// flattenError,
|
|
13
|
+
// formatError,
|
|
14
|
+
treeifyError, prettifyError, toJSONSchema, } from "@zod/core";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zod",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.20250409T222615",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "Colin McDonnell <zod@colinhacks.com>",
|
|
6
6
|
"description": "TypeScript-first schema declaration and validation library with static type inference",
|
|
@@ -70,13 +70,15 @@
|
|
|
70
70
|
}
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@zod/core": "0.1.
|
|
73
|
+
"@zod/core": "0.1.2"
|
|
74
74
|
},
|
|
75
75
|
"scripts": {
|
|
76
76
|
"clean": "rm -rf dist",
|
|
77
77
|
"build": "tshy",
|
|
78
78
|
"postbuild": "pnpm biome check --write .",
|
|
79
79
|
"test:watch": "pnpm vitest",
|
|
80
|
-
"test": "pnpm vitest run"
|
|
80
|
+
"test": "pnpm vitest run",
|
|
81
|
+
"bump:beta": "pnpm version v4.0.0-beta.$(date +%Y%m%dT%H%M%S)",
|
|
82
|
+
"pub:beta": "pnpm bump:beta && pnpm publish --tag next --publish-branch v4 --no-git-checks"
|
|
81
83
|
}
|
|
82
84
|
}
|
package/src/errors.ts
CHANGED
|
@@ -5,27 +5,32 @@ import type { AnyFunc } from "@zod/core/util";
|
|
|
5
5
|
export type ZodIssue = core.$ZodIssue;
|
|
6
6
|
|
|
7
7
|
export class ZodError<T = unknown> extends core.$ZodError<T> {
|
|
8
|
-
/** @deprecated Use the `z.
|
|
8
|
+
/** @deprecated Use the `z.treeifyError(err)` function instead. */
|
|
9
9
|
format(): core.$ZodFormattedError<T>;
|
|
10
|
+
/** @deprecated Use the `z.treeifyError(err)` function instead. */
|
|
10
11
|
format<U>(mapper: (issue: core.$ZodIssue) => U): core.$ZodFormattedError<T, U>;
|
|
11
12
|
format(mapper?: AnyFunc): any {
|
|
12
13
|
return core.formatError(this, mapper);
|
|
13
14
|
}
|
|
14
15
|
|
|
15
|
-
/** @deprecated Use the `z.
|
|
16
|
+
/** @deprecated Use the `z.treeifyError(err)` function instead. */
|
|
16
17
|
flatten(): core.$ZodFlattenedError<T>;
|
|
18
|
+
/** @deprecated Use the `z.treeifyError(err)` function instead. */
|
|
17
19
|
flatten<U>(mapper: (issue: core.$ZodIssue) => U): core.$ZodFlattenedError<T, U>;
|
|
18
20
|
flatten(mapper?: AnyFunc): core.$ZodFlattenedError<T> {
|
|
19
21
|
return core.flattenError(this, mapper);
|
|
20
22
|
}
|
|
21
23
|
|
|
24
|
+
/** @deprecated Push directly to `.issues` instead. */
|
|
22
25
|
addIssue(issue: core.$ZodIssue): void {
|
|
23
26
|
this.issues.push(issue);
|
|
24
27
|
}
|
|
28
|
+
/** @deprecated Push directly to `.issues` instead. */
|
|
25
29
|
addIssues(issues: core.$ZodIssue[]): void {
|
|
26
30
|
this.issues.push(...issues);
|
|
27
31
|
}
|
|
28
32
|
|
|
33
|
+
/** @deprecated Check `err.issues.length === 0` instead. */
|
|
29
34
|
get isEmpty(): boolean {
|
|
30
35
|
return this.issues.length === 0;
|
|
31
36
|
}
|