zod 3.26.0-canary.20250612T071714 → 3.26.0-canary.20250616T185210

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.
@@ -953,7 +953,7 @@ function _custom(Class, fn, _params) {
953
953
  // ): checks.$ZodCheck<T> {
954
954
  // return _custom(Class, fn, _params);
955
955
  // }
956
- // same as _custom but deafults to abort:false
956
+ // same as _custom but defaults to abort:false
957
957
  function _refine(Class, fn, _params) {
958
958
  const schema = new Class({
959
959
  type: "custom",
@@ -568,7 +568,6 @@ exports.$ZodCheckMimeType = core.$constructor("$ZodCheckMimeType", (inst, def) =
568
568
  code: "invalid_value",
569
569
  values: def.mime,
570
570
  input: payload.value.type,
571
- path: ["type"],
572
571
  inst,
573
572
  });
574
573
  };
@@ -35,7 +35,7 @@ const _parse = (_Err) => (schema, value, _ctx, _params) => {
35
35
  }
36
36
  if (result.issues.length) {
37
37
  const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())));
38
- Error.captureStackTrace(e, _params?.callee);
38
+ util.captureStackTrace(e, _params?.callee);
39
39
  throw e;
40
40
  }
41
41
  return result.value;
@@ -49,7 +49,7 @@ const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
49
49
  result = await result;
50
50
  if (result.issues.length) {
51
51
  const e = new (params?.Err ?? _Err)(result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())));
52
- Error.captureStackTrace(e, params?.callee);
52
+ util.captureStackTrace(e, params?.callee);
53
53
  throw e;
54
54
  }
55
55
  return result.value;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Class = exports.BIGINT_FORMAT_RANGES = exports.NUMBER_FORMAT_RANGES = exports.primitiveTypes = exports.propertyKeyTypes = exports.getParsedType = exports.allowsEval = void 0;
3
+ exports.Class = exports.BIGINT_FORMAT_RANGES = exports.NUMBER_FORMAT_RANGES = exports.primitiveTypes = exports.propertyKeyTypes = exports.getParsedType = exports.allowsEval = exports.captureStackTrace = void 0;
4
4
  exports.assertEqual = assertEqual;
5
5
  exports.assertNotEqual = assertNotEqual;
6
6
  exports.assertIs = assertIs;
@@ -154,11 +154,14 @@ function randomString(length = 10) {
154
154
  function esc(str) {
155
155
  return JSON.stringify(str);
156
156
  }
157
+ exports.captureStackTrace = Error.captureStackTrace
158
+ ? Error.captureStackTrace
159
+ : (..._args) => { };
157
160
  function isObject(data) {
158
161
  return typeof data === "object" && data !== null && !Array.isArray(data);
159
162
  }
160
163
  exports.allowsEval = cached(() => {
161
- if (typeof navigator !== "undefined" && navigator?.userAgent.includes("Cloudflare")) {
164
+ if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) {
162
165
  return false;
163
166
  }
164
167
  try {
@@ -77,6 +77,7 @@ exports.pick = pick;
77
77
  exports.omit = omit;
78
78
  exports.partial = partial;
79
79
  exports.required = required;
80
+ exports.catchall = catchall;
80
81
  exports.union = union;
81
82
  exports.discriminatedUnion = discriminatedUnion;
82
83
  exports.intersection = intersection;
@@ -487,6 +488,9 @@ function partial(schema, mask) {
487
488
  function required(schema, mask) {
488
489
  return core_1.util.required(exports.ZodMiniNonOptional, schema, mask);
489
490
  }
491
+ function catchall(inst, catchall) {
492
+ return inst.clone({ ...inst._zod.def, catchall: catchall });
493
+ }
490
494
  exports.ZodMiniUnion = core.$constructor("ZodMiniUnion", (inst, def) => {
491
495
  core.$ZodUnion.init(inst, def);
492
496
  exports.ZodMiniType.init(inst, def);
@@ -821,7 +821,7 @@ export function _custom(Class, fn, _params) {
821
821
  // ): checks.$ZodCheck<T> {
822
822
  // return _custom(Class, fn, _params);
823
823
  // }
824
- // same as _custom but deafults to abort:false
824
+ // same as _custom but defaults to abort:false
825
825
  export function _refine(Class, fn, _params) {
826
826
  const schema = new Class({
827
827
  type: "custom",
@@ -542,7 +542,6 @@ export const $ZodCheckMimeType = /*@__PURE__*/ core.$constructor("$ZodCheckMimeT
542
542
  code: "invalid_value",
543
543
  values: def.mime,
544
544
  input: payload.value.type,
545
- path: ["type"],
546
545
  inst,
547
546
  });
548
547
  };
@@ -9,7 +9,7 @@ export const _parse = (_Err) => (schema, value, _ctx, _params) => {
9
9
  }
10
10
  if (result.issues.length) {
11
11
  const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())));
12
- Error.captureStackTrace(e, _params?.callee);
12
+ util.captureStackTrace(e, _params?.callee);
13
13
  throw e;
14
14
  }
15
15
  return result.value;
@@ -22,7 +22,7 @@ export const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
22
22
  result = await result;
23
23
  if (result.issues.length) {
24
24
  const e = new (params?.Err ?? _Err)(result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())));
25
- Error.captureStackTrace(e, params?.callee);
25
+ util.captureStackTrace(e, params?.callee);
26
26
  throw e;
27
27
  }
28
28
  return result.value;
@@ -110,11 +110,14 @@ export function randomString(length = 10) {
110
110
  export function esc(str) {
111
111
  return JSON.stringify(str);
112
112
  }
113
+ export const captureStackTrace = Error.captureStackTrace
114
+ ? Error.captureStackTrace
115
+ : (..._args) => { };
113
116
  export function isObject(data) {
114
117
  return typeof data === "object" && data !== null && !Array.isArray(data);
115
118
  }
116
119
  export const allowsEval = cached(() => {
117
- if (typeof navigator !== "undefined" && navigator?.userAgent.includes("Cloudflare")) {
120
+ if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) {
118
121
  return false;
119
122
  }
120
123
  try {
@@ -379,6 +379,9 @@ export function partial(schema, mask) {
379
379
  export function required(schema, mask) {
380
380
  return util.required(ZodMiniNonOptional, schema, mask);
381
381
  }
382
+ export function catchall(inst, catchall) {
383
+ return inst.clone({ ...inst._zod.def, catchall: catchall });
384
+ }
382
385
  export const ZodMiniUnion = /*@__PURE__*/ core.$constructor("ZodMiniUnion", (inst, def) => {
383
386
  core.$ZodUnion.init(inst, def);
384
387
  ZodMiniType.init(inst, def);
@@ -127,6 +127,7 @@ export declare function promiseAllObject<T extends object>(promisesObj: T): Prom
127
127
  }>;
128
128
  export declare function randomString(length?: number): string;
129
129
  export declare function esc(str: string): string;
130
+ export declare const captureStackTrace: typeof Error.captureStackTrace;
130
131
  export declare function isObject(data: any): data is Record<PropertyKey, unknown>;
131
132
  export declare const allowsEval: {
132
133
  value: boolean;
@@ -205,6 +205,7 @@ export declare function required<T extends ZodMiniObject>(schema: T): ZodMiniObj
205
205
  export declare function required<T extends ZodMiniObject, M extends util.Mask<keyof T["shape"]>>(schema: T, mask: M): ZodMiniObject<util.Extend<T["shape"], {
206
206
  [k in keyof M & keyof T["shape"]]: ZodMiniNonOptional<T["shape"][k]>;
207
207
  }>, T["_zod"]["config"]>;
208
+ export declare function catchall<T extends ZodMiniObject, U extends SomeType>(inst: T, catchall: U): ZodMiniObject<T["shape"], core.$catchall<U>>;
208
209
  export interface ZodMiniUnion<T extends readonly SomeType[] = readonly core.$ZodType[]> extends _ZodMiniType<core.$ZodUnionInternals<T>> {
209
210
  }
210
211
  export declare const ZodMiniUnion: core.$constructor<ZodMiniUnion>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zod",
3
- "version": "3.26.0-canary.20250612T071714",
3
+ "version": "3.26.0-canary.20250616T185210",
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",