drizzle-kit 0.31.1 → 0.31.2

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 (8) hide show
  1. package/api.d.mts +466 -466
  2. package/api.d.ts +466 -466
  3. package/api.js +3000 -2347
  4. package/api.mjs +3003 -2350
  5. package/bin.cjs +4960 -4606
  6. package/package.json +10 -11
  7. package/utils.js +90 -106
  8. package/utils.mjs +90 -106
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-kit",
3
- "version": "0.31.1",
3
+ "version": "0.31.2",
4
4
  "homepage": "https://orm.drizzle.team",
5
5
  "keywords": [
6
6
  "drizzle",
@@ -45,7 +45,7 @@
45
45
  "dependencies": {
46
46
  "@drizzle-team/brocli": "^0.10.2",
47
47
  "@esbuild-kit/esm-loader": "^2.5.5",
48
- "esbuild": "^0.25.2",
48
+ "esbuild": "^0.25.4",
49
49
  "esbuild-register": "^3.5.0"
50
50
  },
51
51
  "devDependencies": {
@@ -80,7 +80,7 @@
80
80
  "camelcase": "^7.0.1",
81
81
  "chalk": "^5.2.0",
82
82
  "commander": "^12.1.0",
83
- "dockerode": "^3.3.4",
83
+ "dockerode": "^4.0.6",
84
84
  "dotenv": "^16.0.3",
85
85
  "drizzle-kit": "0.25.0-b1faa33",
86
86
  "drizzle-orm": "workspace:./drizzle-orm/dist",
@@ -93,27 +93,26 @@
93
93
  "get-port": "^6.1.2",
94
94
  "glob": "^8.1.0",
95
95
  "hanji": "^0.0.5",
96
- "hono": "^4.1.5",
96
+ "hono": "^4.7.9",
97
97
  "json-diff": "1.0.6",
98
98
  "micromatch": "^4.0.8",
99
99
  "minimatch": "^7.4.3",
100
- "mysql2": "3.3.3",
100
+ "mysql2": "3.14.1",
101
101
  "node-fetch": "^3.3.2",
102
102
  "ohm-js": "^17.1.0",
103
103
  "pg": "^8.11.5",
104
104
  "pluralize": "^8.0.0",
105
105
  "postgres": "^3.4.4",
106
- "prettier": "^2.8.1",
107
- "semver": "^7.5.4",
106
+ "prettier": "^3.5.3",
107
+ "semver": "^7.7.2",
108
108
  "superjson": "^2.2.1",
109
- "tsup": "^8.0.2",
109
+ "tsup": "^8.3.5",
110
110
  "tsx": "^3.12.1",
111
111
  "typescript": "^5.6.3",
112
112
  "uuid": "^9.0.1",
113
113
  "vite-tsconfig-paths": "^4.3.2",
114
- "vitest": "^1.4.0",
115
- "wrangler": "^3.22.1",
116
- "ws": "^8.16.0",
114
+ "vitest": "^3.1.3",
115
+ "ws": "^8.18.2",
117
116
  "zod": "^3.20.2",
118
117
  "zx": "^8.3.2"
119
118
  },
package/utils.js CHANGED
@@ -1087,10 +1087,11 @@ function assertUnreachable(x) {
1087
1087
  throw new Error("Didn't expect to get here");
1088
1088
  }
1089
1089
 
1090
- // ../node_modules/.pnpm/zod@3.24.2/node_modules/zod/lib/index.mjs
1090
+ // ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/helpers/util.js
1091
1091
  var util;
1092
1092
  (function(util2) {
1093
- util2.assertEqual = (val) => val;
1093
+ util2.assertEqual = (_) => {
1094
+ };
1094
1095
  function assertIs(_arg) {
1095
1096
  }
1096
1097
  util2.assertIs = assertIs;
@@ -1134,7 +1135,7 @@ var util;
1134
1135
  }
1135
1136
  return void 0;
1136
1137
  };
1137
- util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val;
1138
+ util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && Number.isFinite(val) && Math.floor(val) === val;
1138
1139
  function joinValues(array, separator = " | ") {
1139
1140
  return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
1140
1141
  }
@@ -1186,7 +1187,7 @@ var getParsedType = (data) => {
1186
1187
  case "string":
1187
1188
  return ZodParsedType.string;
1188
1189
  case "number":
1189
- return isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
1190
+ return Number.isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
1190
1191
  case "boolean":
1191
1192
  return ZodParsedType.boolean;
1192
1193
  case "function":
@@ -1219,6 +1220,8 @@ var getParsedType = (data) => {
1219
1220
  return ZodParsedType.unknown;
1220
1221
  }
1221
1222
  };
1223
+
1224
+ // ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/ZodError.js
1222
1225
  var ZodIssueCode = util.arrayToEnum([
1223
1226
  "invalid_type",
1224
1227
  "invalid_literal",
@@ -1330,6 +1333,8 @@ ZodError.create = (issues) => {
1330
1333
  const error = new ZodError(issues);
1331
1334
  return error;
1332
1335
  };
1336
+
1337
+ // ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/locales/en.js
1333
1338
  var errorMap = (issue, _ctx) => {
1334
1339
  let message;
1335
1340
  switch (issue.code) {
@@ -1428,10 +1433,15 @@ var errorMap = (issue, _ctx) => {
1428
1433
  }
1429
1434
  return { message };
1430
1435
  };
1431
- var overrideErrorMap = errorMap;
1436
+ var en_default = errorMap;
1437
+
1438
+ // ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/errors.js
1439
+ var overrideErrorMap = en_default;
1432
1440
  function getErrorMap() {
1433
1441
  return overrideErrorMap;
1434
1442
  }
1443
+
1444
+ // ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/helpers/parseUtil.js
1435
1445
  var makeIssue = (params) => {
1436
1446
  const { data, path, errorMaps, issueData } = params;
1437
1447
  const fullPath = [...path, ...issueData.path || []];
@@ -1470,7 +1480,7 @@ function addIssueToContext(ctx, issueData) {
1470
1480
  // then schema-bound map if available
1471
1481
  overrideMap,
1472
1482
  // then global override map
1473
- overrideMap === errorMap ? void 0 : errorMap
1483
+ overrideMap === en_default ? void 0 : en_default
1474
1484
  // then global default map
1475
1485
  ].filter((x) => !!x)
1476
1486
  });
@@ -1539,24 +1549,15 @@ var isAborted = (x) => x.status === "aborted";
1539
1549
  var isDirty = (x) => x.status === "dirty";
1540
1550
  var isValid = (x) => x.status === "valid";
1541
1551
  var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
1542
- function __classPrivateFieldGet(receiver, state, kind, f) {
1543
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
1544
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
1545
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
1546
- }
1547
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
1548
- if (kind === "m") throw new TypeError("Private method is not writable");
1549
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
1550
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
1551
- return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
1552
- }
1552
+
1553
+ // ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/helpers/errorUtil.js
1553
1554
  var errorUtil;
1554
1555
  (function(errorUtil2) {
1555
1556
  errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
1556
- errorUtil2.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
1557
+ errorUtil2.toString = (message) => typeof message === "string" ? message : message == null ? void 0 : message.message;
1557
1558
  })(errorUtil || (errorUtil = {}));
1558
- var _ZodEnum_cache;
1559
- var _ZodNativeEnum_cache;
1559
+
1560
+ // ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/types.js
1560
1561
  var ParseInputLazyPath = class {
1561
1562
  constructor(parent, value, path, key) {
1562
1563
  this._cachedPath = [];
@@ -1567,7 +1568,7 @@ var ParseInputLazyPath = class {
1567
1568
  }
1568
1569
  get path() {
1569
1570
  if (!this._cachedPath.length) {
1570
- if (this._key instanceof Array) {
1571
+ if (Array.isArray(this._key)) {
1571
1572
  this._cachedPath.push(...this._path, ...this._key);
1572
1573
  } else {
1573
1574
  this._cachedPath.push(...this._path, this._key);
@@ -1605,17 +1606,16 @@ function processCreateParams(params) {
1605
1606
  if (errorMap2)
1606
1607
  return { errorMap: errorMap2, description };
1607
1608
  const customMap = (iss, ctx) => {
1608
- var _a, _b;
1609
1609
  const { message } = params;
1610
1610
  if (iss.code === "invalid_enum_value") {
1611
- return { message: message !== null && message !== void 0 ? message : ctx.defaultError };
1611
+ return { message: message ?? ctx.defaultError };
1612
1612
  }
1613
1613
  if (typeof ctx.data === "undefined") {
1614
- return { message: (_a = message !== null && message !== void 0 ? message : required_error) !== null && _a !== void 0 ? _a : ctx.defaultError };
1614
+ return { message: message ?? required_error ?? ctx.defaultError };
1615
1615
  }
1616
1616
  if (iss.code !== "invalid_type")
1617
1617
  return { message: ctx.defaultError };
1618
- return { message: (_b = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _b !== void 0 ? _b : ctx.defaultError };
1618
+ return { message: message ?? invalid_type_error ?? ctx.defaultError };
1619
1619
  };
1620
1620
  return { errorMap: customMap, description };
1621
1621
  }
@@ -1667,14 +1667,13 @@ var ZodType = class {
1667
1667
  throw result.error;
1668
1668
  }
1669
1669
  safeParse(data, params) {
1670
- var _a;
1671
1670
  const ctx = {
1672
1671
  common: {
1673
1672
  issues: [],
1674
- async: (_a = params === null || params === void 0 ? void 0 : params.async) !== null && _a !== void 0 ? _a : false,
1675
- contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap
1673
+ async: (params == null ? void 0 : params.async) ?? false,
1674
+ contextualErrorMap: params == null ? void 0 : params.errorMap
1676
1675
  },
1677
- path: (params === null || params === void 0 ? void 0 : params.path) || [],
1676
+ path: (params == null ? void 0 : params.path) || [],
1678
1677
  schemaErrorMap: this._def.errorMap,
1679
1678
  parent: null,
1680
1679
  data,
@@ -1705,7 +1704,7 @@ var ZodType = class {
1705
1704
  issues: ctx.common.issues
1706
1705
  };
1707
1706
  } catch (err) {
1708
- if ((_b = (_a = err === null || err === void 0 ? void 0 : err.message) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === null || _b === void 0 ? void 0 : _b.includes("encountered")) {
1707
+ if ((_b = (_a = err == null ? void 0 : err.message) == null ? void 0 : _a.toLowerCase()) == null ? void 0 : _b.includes("encountered")) {
1709
1708
  this["~standard"].async = true;
1710
1709
  }
1711
1710
  ctx.common = {
@@ -1730,10 +1729,10 @@ var ZodType = class {
1730
1729
  const ctx = {
1731
1730
  common: {
1732
1731
  issues: [],
1733
- contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap,
1732
+ contextualErrorMap: params == null ? void 0 : params.errorMap,
1734
1733
  async: true
1735
1734
  },
1736
- path: (params === null || params === void 0 ? void 0 : params.path) || [],
1735
+ path: (params == null ? void 0 : params.path) || [],
1737
1736
  schemaErrorMap: this._def.errorMap,
1738
1737
  parent: null,
1739
1738
  data,
@@ -1923,13 +1922,14 @@ var base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_
1923
1922
  var dateRegexSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`;
1924
1923
  var dateRegex = new RegExp(`^${dateRegexSource}$`);
1925
1924
  function timeRegexSource(args) {
1926
- let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`;
1925
+ let secondsRegexSource = `[0-5]\\d`;
1927
1926
  if (args.precision) {
1928
- regex = `${regex}\\.\\d{${args.precision}}`;
1927
+ secondsRegexSource = `${secondsRegexSource}\\.\\d{${args.precision}}`;
1929
1928
  } else if (args.precision == null) {
1930
- regex = `${regex}(\\.\\d+)?`;
1929
+ secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`;
1931
1930
  }
1932
- return regex;
1931
+ const secondsQuantifier = args.precision ? "+" : "?";
1932
+ return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`;
1933
1933
  }
1934
1934
  function timeRegex(args) {
1935
1935
  return new RegExp(`^${timeRegexSource(args)}$`);
@@ -1961,12 +1961,14 @@ function isValidJWT(jwt, alg) {
1961
1961
  const decoded = JSON.parse(atob(base64));
1962
1962
  if (typeof decoded !== "object" || decoded === null)
1963
1963
  return false;
1964
- if (!decoded.typ || !decoded.alg)
1964
+ if ("typ" in decoded && (decoded == null ? void 0 : decoded.typ) !== "JWT")
1965
+ return false;
1966
+ if (!decoded.alg)
1965
1967
  return false;
1966
1968
  if (alg && decoded.alg !== alg)
1967
1969
  return false;
1968
1970
  return true;
1969
- } catch (_a) {
1971
+ } catch {
1970
1972
  return false;
1971
1973
  }
1972
1974
  }
@@ -2125,7 +2127,7 @@ var ZodString = class _ZodString extends ZodType {
2125
2127
  } else if (check.kind === "url") {
2126
2128
  try {
2127
2129
  new URL(input.data);
2128
- } catch (_a) {
2130
+ } catch {
2129
2131
  ctx = this._getOrReturnCtx(input, ctx);
2130
2132
  addIssueToContext(ctx, {
2131
2133
  validation: "url",
@@ -2337,7 +2339,6 @@ var ZodString = class _ZodString extends ZodType {
2337
2339
  return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options) });
2338
2340
  }
2339
2341
  datetime(options) {
2340
- var _a, _b;
2341
2342
  if (typeof options === "string") {
2342
2343
  return this._addCheck({
2343
2344
  kind: "datetime",
@@ -2349,10 +2350,10 @@ var ZodString = class _ZodString extends ZodType {
2349
2350
  }
2350
2351
  return this._addCheck({
2351
2352
  kind: "datetime",
2352
- precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
2353
- offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,
2354
- local: (_b = options === null || options === void 0 ? void 0 : options.local) !== null && _b !== void 0 ? _b : false,
2355
- ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
2353
+ precision: typeof (options == null ? void 0 : options.precision) === "undefined" ? null : options == null ? void 0 : options.precision,
2354
+ offset: (options == null ? void 0 : options.offset) ?? false,
2355
+ local: (options == null ? void 0 : options.local) ?? false,
2356
+ ...errorUtil.errToObj(options == null ? void 0 : options.message)
2356
2357
  });
2357
2358
  }
2358
2359
  date(message) {
@@ -2368,8 +2369,8 @@ var ZodString = class _ZodString extends ZodType {
2368
2369
  }
2369
2370
  return this._addCheck({
2370
2371
  kind: "time",
2371
- precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
2372
- ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
2372
+ precision: typeof (options == null ? void 0 : options.precision) === "undefined" ? null : options == null ? void 0 : options.precision,
2373
+ ...errorUtil.errToObj(options == null ? void 0 : options.message)
2373
2374
  });
2374
2375
  }
2375
2376
  duration(message) {
@@ -2386,8 +2387,8 @@ var ZodString = class _ZodString extends ZodType {
2386
2387
  return this._addCheck({
2387
2388
  kind: "includes",
2388
2389
  value,
2389
- position: options === null || options === void 0 ? void 0 : options.position,
2390
- ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
2390
+ position: options == null ? void 0 : options.position,
2391
+ ...errorUtil.errToObj(options == null ? void 0 : options.message)
2391
2392
  });
2392
2393
  }
2393
2394
  startsWith(value, message) {
@@ -2519,11 +2520,10 @@ var ZodString = class _ZodString extends ZodType {
2519
2520
  }
2520
2521
  };
2521
2522
  ZodString.create = (params) => {
2522
- var _a;
2523
2523
  return new ZodString({
2524
2524
  checks: [],
2525
2525
  typeName: ZodFirstPartyTypeKind.ZodString,
2526
- coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
2526
+ coerce: (params == null ? void 0 : params.coerce) ?? false,
2527
2527
  ...processCreateParams(params)
2528
2528
  });
2529
2529
  };
@@ -2531,9 +2531,9 @@ function floatSafeRemainder(val, step) {
2531
2531
  const valDecCount = (val.toString().split(".")[1] || "").length;
2532
2532
  const stepDecCount = (step.toString().split(".")[1] || "").length;
2533
2533
  const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
2534
- const valInt = parseInt(val.toFixed(decCount).replace(".", ""));
2535
- const stepInt = parseInt(step.toFixed(decCount).replace(".", ""));
2536
- return valInt % stepInt / Math.pow(10, decCount);
2534
+ const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
2535
+ const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
2536
+ return valInt % stepInt / 10 ** decCount;
2537
2537
  }
2538
2538
  var ZodNumber = class _ZodNumber extends ZodType {
2539
2539
  constructor() {
@@ -2743,7 +2743,8 @@ var ZodNumber = class _ZodNumber extends ZodType {
2743
2743
  return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
2744
2744
  }
2745
2745
  get isFinite() {
2746
- let max = null, min = null;
2746
+ let max = null;
2747
+ let min = null;
2747
2748
  for (const ch of this._def.checks) {
2748
2749
  if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
2749
2750
  return true;
@@ -2762,7 +2763,7 @@ ZodNumber.create = (params) => {
2762
2763
  return new ZodNumber({
2763
2764
  checks: [],
2764
2765
  typeName: ZodFirstPartyTypeKind.ZodNumber,
2765
- coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
2766
+ coerce: (params == null ? void 0 : params.coerce) || false,
2766
2767
  ...processCreateParams(params)
2767
2768
  });
2768
2769
  };
@@ -2776,7 +2777,7 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
2776
2777
  if (this._def.coerce) {
2777
2778
  try {
2778
2779
  input.data = BigInt(input.data);
2779
- } catch (_a) {
2780
+ } catch {
2780
2781
  return this._getInvalidInput(input);
2781
2782
  }
2782
2783
  }
@@ -2931,11 +2932,10 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
2931
2932
  }
2932
2933
  };
2933
2934
  ZodBigInt.create = (params) => {
2934
- var _a;
2935
2935
  return new ZodBigInt({
2936
2936
  checks: [],
2937
2937
  typeName: ZodFirstPartyTypeKind.ZodBigInt,
2938
- coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
2938
+ coerce: (params == null ? void 0 : params.coerce) ?? false,
2939
2939
  ...processCreateParams(params)
2940
2940
  });
2941
2941
  };
@@ -2960,7 +2960,7 @@ var ZodBoolean = class extends ZodType {
2960
2960
  ZodBoolean.create = (params) => {
2961
2961
  return new ZodBoolean({
2962
2962
  typeName: ZodFirstPartyTypeKind.ZodBoolean,
2963
- coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
2963
+ coerce: (params == null ? void 0 : params.coerce) || false,
2964
2964
  ...processCreateParams(params)
2965
2965
  });
2966
2966
  };
@@ -2979,7 +2979,7 @@ var ZodDate = class _ZodDate extends ZodType {
2979
2979
  });
2980
2980
  return INVALID;
2981
2981
  }
2982
- if (isNaN(input.data.getTime())) {
2982
+ if (Number.isNaN(input.data.getTime())) {
2983
2983
  const ctx2 = this._getOrReturnCtx(input);
2984
2984
  addIssueToContext(ctx2, {
2985
2985
  code: ZodIssueCode.invalid_date
@@ -3068,7 +3068,7 @@ var ZodDate = class _ZodDate extends ZodType {
3068
3068
  ZodDate.create = (params) => {
3069
3069
  return new ZodDate({
3070
3070
  checks: [],
3071
- coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
3071
+ coerce: (params == null ? void 0 : params.coerce) || false,
3072
3072
  typeName: ZodFirstPartyTypeKind.ZodDate,
3073
3073
  ...processCreateParams(params)
3074
3074
  });
@@ -3343,7 +3343,8 @@ var ZodObject = class _ZodObject extends ZodType {
3343
3343
  return this._cached;
3344
3344
  const shape = this._def.shape();
3345
3345
  const keys = util.objectKeys(shape);
3346
- return this._cached = { shape, keys };
3346
+ this._cached = { shape, keys };
3347
+ return this._cached;
3347
3348
  }
3348
3349
  _parse(input) {
3349
3350
  const parsedType = this._getType(input);
@@ -3393,8 +3394,8 @@ var ZodObject = class _ZodObject extends ZodType {
3393
3394
  });
3394
3395
  status.dirty();
3395
3396
  }
3396
- } else if (unknownKeys === "strip") ;
3397
- else {
3397
+ } else if (unknownKeys === "strip") {
3398
+ } else {
3398
3399
  throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);
3399
3400
  }
3400
3401
  } else {
@@ -3441,11 +3442,11 @@ var ZodObject = class _ZodObject extends ZodType {
3441
3442
  unknownKeys: "strict",
3442
3443
  ...message !== void 0 ? {
3443
3444
  errorMap: (issue, ctx) => {
3444
- var _a, _b, _c, _d;
3445
- const defaultError = (_c = (_b = (_a = this._def).errorMap) === null || _b === void 0 ? void 0 : _b.call(_a, issue, ctx).message) !== null && _c !== void 0 ? _c : ctx.defaultError;
3445
+ var _a, _b;
3446
+ const defaultError = ((_b = (_a = this._def).errorMap) == null ? void 0 : _b.call(_a, issue, ctx).message) ?? ctx.defaultError;
3446
3447
  if (issue.code === "unrecognized_keys")
3447
3448
  return {
3448
- message: (_d = errorUtil.errToObj(message).message) !== null && _d !== void 0 ? _d : defaultError
3449
+ message: errorUtil.errToObj(message).message ?? defaultError
3449
3450
  };
3450
3451
  return {
3451
3452
  message: defaultError
@@ -3576,11 +3577,11 @@ var ZodObject = class _ZodObject extends ZodType {
3576
3577
  }
3577
3578
  pick(mask) {
3578
3579
  const shape = {};
3579
- util.objectKeys(mask).forEach((key) => {
3580
+ for (const key of util.objectKeys(mask)) {
3580
3581
  if (mask[key] && this.shape[key]) {
3581
3582
  shape[key] = this.shape[key];
3582
3583
  }
3583
- });
3584
+ }
3584
3585
  return new _ZodObject({
3585
3586
  ...this._def,
3586
3587
  shape: () => shape
@@ -3588,11 +3589,11 @@ var ZodObject = class _ZodObject extends ZodType {
3588
3589
  }
3589
3590
  omit(mask) {
3590
3591
  const shape = {};
3591
- util.objectKeys(this.shape).forEach((key) => {
3592
+ for (const key of util.objectKeys(this.shape)) {
3592
3593
  if (!mask[key]) {
3593
3594
  shape[key] = this.shape[key];
3594
3595
  }
3595
- });
3596
+ }
3596
3597
  return new _ZodObject({
3597
3598
  ...this._def,
3598
3599
  shape: () => shape
@@ -3606,14 +3607,14 @@ var ZodObject = class _ZodObject extends ZodType {
3606
3607
  }
3607
3608
  partial(mask) {
3608
3609
  const newShape = {};
3609
- util.objectKeys(this.shape).forEach((key) => {
3610
+ for (const key of util.objectKeys(this.shape)) {
3610
3611
  const fieldSchema = this.shape[key];
3611
3612
  if (mask && !mask[key]) {
3612
3613
  newShape[key] = fieldSchema;
3613
3614
  } else {
3614
3615
  newShape[key] = fieldSchema.optional();
3615
3616
  }
3616
- });
3617
+ }
3617
3618
  return new _ZodObject({
3618
3619
  ...this._def,
3619
3620
  shape: () => newShape
@@ -3621,7 +3622,7 @@ var ZodObject = class _ZodObject extends ZodType {
3621
3622
  }
3622
3623
  required(mask) {
3623
3624
  const newShape = {};
3624
- util.objectKeys(this.shape).forEach((key) => {
3625
+ for (const key of util.objectKeys(this.shape)) {
3625
3626
  if (mask && !mask[key]) {
3626
3627
  newShape[key] = this.shape[key];
3627
3628
  } else {
@@ -3632,7 +3633,7 @@ var ZodObject = class _ZodObject extends ZodType {
3632
3633
  }
3633
3634
  newShape[key] = newField;
3634
3635
  }
3635
- });
3636
+ }
3636
3637
  return new _ZodObject({
3637
3638
  ...this._def,
3638
3639
  shape: () => newShape
@@ -4248,12 +4249,7 @@ var ZodFunction = class _ZodFunction extends ZodType {
4248
4249
  return makeIssue({
4249
4250
  data: args,
4250
4251
  path: ctx.path,
4251
- errorMaps: [
4252
- ctx.common.contextualErrorMap,
4253
- ctx.schemaErrorMap,
4254
- getErrorMap(),
4255
- errorMap
4256
- ].filter((x) => !!x),
4252
+ errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
4257
4253
  issueData: {
4258
4254
  code: ZodIssueCode.invalid_arguments,
4259
4255
  argumentsError: error
@@ -4264,12 +4260,7 @@ var ZodFunction = class _ZodFunction extends ZodType {
4264
4260
  return makeIssue({
4265
4261
  data: returns,
4266
4262
  path: ctx.path,
4267
- errorMaps: [
4268
- ctx.common.contextualErrorMap,
4269
- ctx.schemaErrorMap,
4270
- getErrorMap(),
4271
- errorMap
4272
- ].filter((x) => !!x),
4263
+ errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
4273
4264
  issueData: {
4274
4265
  code: ZodIssueCode.invalid_return_type,
4275
4266
  returnTypeError: error
@@ -4393,10 +4384,6 @@ function createZodEnum(values, params) {
4393
4384
  });
4394
4385
  }
4395
4386
  var ZodEnum = class _ZodEnum extends ZodType {
4396
- constructor() {
4397
- super(...arguments);
4398
- _ZodEnum_cache.set(this, void 0);
4399
- }
4400
4387
  _parse(input) {
4401
4388
  if (typeof input.data !== "string") {
4402
4389
  const ctx = this._getOrReturnCtx(input);
@@ -4408,10 +4395,10 @@ var ZodEnum = class _ZodEnum extends ZodType {
4408
4395
  });
4409
4396
  return INVALID;
4410
4397
  }
4411
- if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f")) {
4412
- __classPrivateFieldSet(this, _ZodEnum_cache, new Set(this._def.values), "f");
4398
+ if (!this._cache) {
4399
+ this._cache = new Set(this._def.values);
4413
4400
  }
4414
- if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f").has(input.data)) {
4401
+ if (!this._cache.has(input.data)) {
4415
4402
  const ctx = this._getOrReturnCtx(input);
4416
4403
  const expectedValues = this._def.values;
4417
4404
  addIssueToContext(ctx, {
@@ -4460,13 +4447,8 @@ var ZodEnum = class _ZodEnum extends ZodType {
4460
4447
  });
4461
4448
  }
4462
4449
  };
4463
- _ZodEnum_cache = /* @__PURE__ */ new WeakMap();
4464
4450
  ZodEnum.create = createZodEnum;
4465
4451
  var ZodNativeEnum = class extends ZodType {
4466
- constructor() {
4467
- super(...arguments);
4468
- _ZodNativeEnum_cache.set(this, void 0);
4469
- }
4470
4452
  _parse(input) {
4471
4453
  const nativeEnumValues = util.getValidEnumValues(this._def.values);
4472
4454
  const ctx = this._getOrReturnCtx(input);
@@ -4479,10 +4461,10 @@ var ZodNativeEnum = class extends ZodType {
4479
4461
  });
4480
4462
  return INVALID;
4481
4463
  }
4482
- if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f")) {
4483
- __classPrivateFieldSet(this, _ZodNativeEnum_cache, new Set(util.getValidEnumValues(this._def.values)), "f");
4464
+ if (!this._cache) {
4465
+ this._cache = new Set(util.getValidEnumValues(this._def.values));
4484
4466
  }
4485
- if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f").has(input.data)) {
4467
+ if (!this._cache.has(input.data)) {
4486
4468
  const expectedValues = util.objectValues(nativeEnumValues);
4487
4469
  addIssueToContext(ctx, {
4488
4470
  received: ctx.data,
@@ -4497,7 +4479,6 @@ var ZodNativeEnum = class extends ZodType {
4497
4479
  return this._def.values;
4498
4480
  }
4499
4481
  };
4500
- _ZodNativeEnum_cache = /* @__PURE__ */ new WeakMap();
4501
4482
  ZodNativeEnum.create = (values, params) => {
4502
4483
  return new ZodNativeEnum({
4503
4484
  values,
@@ -4638,7 +4619,7 @@ var ZodEffects = class extends ZodType {
4638
4619
  parent: ctx
4639
4620
  });
4640
4621
  if (!isValid(base))
4641
- return base;
4622
+ return INVALID;
4642
4623
  const result = effect.transform(base.value, checkCtx);
4643
4624
  if (result instanceof Promise) {
4644
4625
  throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
@@ -4647,8 +4628,11 @@ var ZodEffects = class extends ZodType {
4647
4628
  } else {
4648
4629
  return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {
4649
4630
  if (!isValid(base))
4650
- return base;
4651
- return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({ status: status.value, value: result }));
4631
+ return INVALID;
4632
+ return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
4633
+ status: status.value,
4634
+ value: result
4635
+ }));
4652
4636
  });
4653
4637
  }
4654
4638
  }