drizzle-kit 0.20.17-7a1dd7a → 0.20.17-80a5bf9

Sign up to get free protection for your applications and to get access to all the features.
package/payload.mjs CHANGED
@@ -40,7 +40,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
40
40
  ));
41
41
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
42
42
 
43
- // node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/ansi-styles/index.js
43
+ // node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/vendor/ansi-styles/index.js
44
44
  function assembleStyles() {
45
45
  const codes = /* @__PURE__ */ new Map();
46
46
  for (const [groupName, group] of Object.entries(styles)) {
@@ -157,7 +157,7 @@ function assembleStyles() {
157
157
  }
158
158
  var ANSI_BACKGROUND_OFFSET, wrapAnsi16, wrapAnsi256, wrapAnsi16m, styles, modifierNames, foregroundColorNames, backgroundColorNames, colorNames, ansiStyles, ansi_styles_default;
159
159
  var init_ansi_styles = __esm({
160
- "node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/ansi-styles/index.js"() {
160
+ "node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/vendor/ansi-styles/index.js"() {
161
161
  ANSI_BACKGROUND_OFFSET = 10;
162
162
  wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
163
163
  wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
@@ -231,7 +231,7 @@ var init_ansi_styles = __esm({
231
231
  }
232
232
  });
233
233
 
234
- // node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/supports-color/index.js
234
+ // node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/vendor/supports-color/index.js
235
235
  import process2 from "node:process";
236
236
  import os from "node:os";
237
237
  import tty from "node:tty";
@@ -298,7 +298,7 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
298
298
  return 1;
299
299
  }
300
300
  if ("CI" in env) {
301
- if ("GITHUB_ACTIONS" in env || "GITEA_ACTIONS" in env) {
301
+ if ("GITHUB_ACTIONS" in env) {
302
302
  return 3;
303
303
  }
304
304
  if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
@@ -346,7 +346,7 @@ function createSupportsColor(stream, options = {}) {
346
346
  }
347
347
  var env, flagForceColor, supportsColor, supports_color_default;
348
348
  var init_supports_color = __esm({
349
- "node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/supports-color/index.js"() {
349
+ "node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/vendor/supports-color/index.js"() {
350
350
  ({ env } = process2);
351
351
  if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
352
352
  flagForceColor = 0;
@@ -361,7 +361,7 @@ var init_supports_color = __esm({
361
361
  }
362
362
  });
363
363
 
364
- // node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/utilities.js
364
+ // node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/utilities.js
365
365
  function stringReplaceAll(string, substring, replacer) {
366
366
  let index4 = string.indexOf(substring);
367
367
  if (index4 === -1) {
@@ -391,20 +391,21 @@ function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index4) {
391
391
  return returnValue;
392
392
  }
393
393
  var init_utilities = __esm({
394
- "node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/utilities.js"() {
394
+ "node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/utilities.js"() {
395
395
  }
396
396
  });
397
397
 
398
- // node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/index.js
398
+ // node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/index.js
399
399
  function createChalk(options) {
400
400
  return chalkFactory(options);
401
401
  }
402
402
  var stdoutColor, stderrColor, GENERATOR, STYLER, IS_EMPTY, levelMapping, styles2, applyOptions, chalkFactory, getModelAnsi, usedModels, proto, createStyler, createBuilder, applyStyle, chalk, chalkStderr, source_default;
403
403
  var init_source = __esm({
404
- "node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/index.js"() {
404
+ "node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/index.js"() {
405
405
  init_ansi_styles();
406
406
  init_supports_color();
407
407
  init_utilities();
408
+ init_ansi_styles();
408
409
  ({ stdout: stdoutColor, stderr: stderrColor } = supports_color_default);
409
410
  GENERATOR = Symbol("GENERATOR");
410
411
  STYLER = Symbol("STYLER");
@@ -1115,12 +1116,11 @@ var init_global = __esm({
1115
1116
  }
1116
1117
  });
1117
1118
 
1118
- // node_modules/.pnpm/zod@3.23.4/node_modules/zod/lib/index.mjs
1119
+ // node_modules/.pnpm/zod@3.20.2/node_modules/zod/lib/index.mjs
1119
1120
  function getErrorMap() {
1120
1121
  return overrideErrorMap;
1121
1122
  }
1122
1123
  function addIssueToContext(ctx, issueData) {
1123
- const overrideMap = getErrorMap();
1124
1124
  const issue = makeIssue({
1125
1125
  issueData,
1126
1126
  data: ctx.data,
@@ -1128,29 +1128,13 @@ function addIssueToContext(ctx, issueData) {
1128
1128
  errorMaps: [
1129
1129
  ctx.common.contextualErrorMap,
1130
1130
  ctx.schemaErrorMap,
1131
- overrideMap,
1132
- overrideMap === errorMap ? void 0 : errorMap
1131
+ getErrorMap(),
1132
+ errorMap
1133
1133
  // then global default map
1134
1134
  ].filter((x) => !!x)
1135
1135
  });
1136
1136
  ctx.common.issues.push(issue);
1137
1137
  }
1138
- function __classPrivateFieldGet(receiver, state, kind, f) {
1139
- if (kind === "a" && !f)
1140
- throw new TypeError("Private accessor was defined without a getter");
1141
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
1142
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
1143
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
1144
- }
1145
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
1146
- if (kind === "m")
1147
- throw new TypeError("Private method is not writable");
1148
- if (kind === "a" && !f)
1149
- throw new TypeError("Private accessor was defined without a setter");
1150
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
1151
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
1152
- return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
1153
- }
1154
1138
  function processCreateParams(params) {
1155
1139
  if (!params)
1156
1140
  return {};
@@ -1161,50 +1145,15 @@ function processCreateParams(params) {
1161
1145
  if (errorMap2)
1162
1146
  return { errorMap: errorMap2, description };
1163
1147
  const customMap = (iss, ctx) => {
1164
- var _a, _b;
1165
- const { message } = params;
1166
- if (iss.code === "invalid_enum_value") {
1167
- return { message: message !== null && message !== void 0 ? message : ctx.defaultError };
1168
- }
1169
- if (typeof ctx.data === "undefined") {
1170
- return { message: (_a = message !== null && message !== void 0 ? message : required_error) !== null && _a !== void 0 ? _a : ctx.defaultError };
1171
- }
1172
1148
  if (iss.code !== "invalid_type")
1173
1149
  return { message: ctx.defaultError };
1174
- return { message: (_b = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _b !== void 0 ? _b : ctx.defaultError };
1150
+ if (typeof ctx.data === "undefined") {
1151
+ return { message: required_error !== null && required_error !== void 0 ? required_error : ctx.defaultError };
1152
+ }
1153
+ return { message: invalid_type_error !== null && invalid_type_error !== void 0 ? invalid_type_error : ctx.defaultError };
1175
1154
  };
1176
1155
  return { errorMap: customMap, description };
1177
1156
  }
1178
- function timeRegexSource(args) {
1179
- let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`;
1180
- if (args.precision) {
1181
- regex = `${regex}\\.\\d{${args.precision}}`;
1182
- } else if (args.precision == null) {
1183
- regex = `${regex}(\\.\\d+)?`;
1184
- }
1185
- return regex;
1186
- }
1187
- function timeRegex(args) {
1188
- return new RegExp(`^${timeRegexSource(args)}$`);
1189
- }
1190
- function datetimeRegex(args) {
1191
- let regex = `${dateRegexSource}T${timeRegexSource(args)}`;
1192
- const opts = [];
1193
- opts.push(args.local ? `Z?` : `Z`);
1194
- if (args.offset)
1195
- opts.push(`([+-]\\d{2}:?\\d{2})`);
1196
- regex = `${regex}(${opts.join("|")})`;
1197
- return new RegExp(`^${regex}$`);
1198
- }
1199
- function isValidIP(ip, version) {
1200
- if ((version === "v4" || !version) && ipv4Regex.test(ip)) {
1201
- return true;
1202
- }
1203
- if ((version === "v6" || !version) && ipv6Regex.test(ip)) {
1204
- return true;
1205
- }
1206
- return false;
1207
- }
1208
1157
  function floatSafeRemainder(val, step) {
1209
1158
  const valDecCount = (val.toString().split(".")[1] || "").length;
1210
1159
  const stepDecCount = (step.toString().split(".")[1] || "").length;
@@ -1225,10 +1174,7 @@ function deepPartialify(schema4) {
1225
1174
  shape: () => newShape
1226
1175
  });
1227
1176
  } else if (schema4 instanceof ZodArray) {
1228
- return new ZodArray({
1229
- ...schema4._def,
1230
- type: deepPartialify(schema4.element)
1231
- });
1177
+ return ZodArray.create(deepPartialify(schema4.element));
1232
1178
  } else if (schema4 instanceof ZodOptional) {
1233
1179
  return ZodOptional.create(deepPartialify(schema4.unwrap()));
1234
1180
  } else if (schema4 instanceof ZodNullable) {
@@ -1284,9 +1230,9 @@ function createZodEnum(values, params) {
1284
1230
  ...processCreateParams(params)
1285
1231
  });
1286
1232
  }
1287
- var util, objectUtil, ZodParsedType, getParsedType, ZodIssueCode, ZodError, errorMap, overrideErrorMap, makeIssue, ParseStatus, INVALID, DIRTY, OK, isAborted, isDirty, isValid, isAsync, errorUtil, _ZodEnum_cache, _ZodNativeEnum_cache, ParseInputLazyPath, handleResult, ZodType, cuidRegex, cuid2Regex, ulidRegex, uuidRegex, nanoidRegex, durationRegex, emailRegex, _emojiRegex, emojiRegex, ipv4Regex, ipv6Regex, base64Regex, dateRegexSource, dateRegex, ZodString, ZodNumber, ZodBigInt, ZodBoolean, ZodDate, ZodSymbol, ZodUndefined, ZodNull, ZodAny, ZodUnknown, ZodNever, ZodVoid, ZodArray, ZodObject, ZodUnion, getDiscriminator, ZodDiscriminatedUnion, ZodIntersection, ZodTuple, ZodRecord, ZodMap, ZodSet, ZodFunction, ZodLazy, ZodLiteral, ZodEnum, ZodNativeEnum, ZodPromise, ZodEffects, ZodOptional, ZodNullable, ZodDefault, ZodCatch, ZodNaN, BRAND, ZodBranded, ZodPipeline, ZodReadonly, late, ZodFirstPartyTypeKind, stringType, numberType, nanType, bigIntType, booleanType, dateType, symbolType, undefinedType, nullType, anyType, unknownType, neverType, voidType, arrayType, objectType, strictObjectType, unionType, discriminatedUnionType, intersectionType, tupleType, recordType, mapType, setType, functionType, lazyType, literalType, enumType, nativeEnumType, promiseType, effectsType, optionalType, nullableType, preprocessType, pipelineType, coerce;
1233
+ var util, ZodParsedType, getParsedType, ZodIssueCode, ZodError, errorMap, overrideErrorMap, makeIssue, ParseStatus, INVALID, DIRTY, OK, isAborted, isDirty, isValid, isAsync, errorUtil, ParseInputLazyPath, handleResult, ZodType, cuidRegex, uuidRegex, emailRegex, datetimeRegex, ZodString, ZodNumber, ZodBigInt, ZodBoolean, ZodDate, ZodSymbol, ZodUndefined, ZodNull, ZodAny, ZodUnknown, ZodNever, ZodVoid, ZodArray, objectUtil, AugmentFactory, ZodObject, ZodUnion, getDiscriminator, ZodDiscriminatedUnion, ZodIntersection, ZodTuple, ZodRecord, ZodMap, ZodSet, ZodFunction, ZodLazy, ZodLiteral, ZodEnum, ZodNativeEnum, ZodPromise, ZodEffects, ZodOptional, ZodNullable, ZodDefault, ZodCatch, ZodNaN, BRAND, ZodBranded, ZodPipeline, late, ZodFirstPartyTypeKind, stringType, numberType, nanType, bigIntType, booleanType, dateType, symbolType, undefinedType, nullType, anyType, unknownType, neverType, voidType, arrayType, objectType, strictObjectType, unionType, discriminatedUnionType, intersectionType, tupleType, recordType, mapType, setType, functionType, lazyType, literalType, enumType, nativeEnumType, promiseType, effectsType, optionalType, nullableType, preprocessType, pipelineType, coerce;
1288
1234
  var init_lib = __esm({
1289
- "node_modules/.pnpm/zod@3.23.4/node_modules/zod/lib/index.mjs"() {
1235
+ "node_modules/.pnpm/zod@3.20.2/node_modules/zod/lib/index.mjs"() {
1290
1236
  (function(util2) {
1291
1237
  util2.assertEqual = (val) => val;
1292
1238
  function assertIs(_arg) {
@@ -1344,15 +1290,6 @@ var init_lib = __esm({
1344
1290
  return value;
1345
1291
  };
1346
1292
  })(util || (util = {}));
1347
- (function(objectUtil2) {
1348
- objectUtil2.mergeShapes = (first, second) => {
1349
- return {
1350
- ...first,
1351
- ...second
1352
- // second overwrites first
1353
- };
1354
- };
1355
- })(objectUtil || (objectUtil = {}));
1356
1293
  ZodParsedType = util.arrayToEnum([
1357
1294
  "string",
1358
1295
  "nan",
@@ -1434,7 +1371,7 @@ var init_lib = __esm({
1434
1371
  "not_multiple_of",
1435
1372
  "not_finite"
1436
1373
  ]);
1437
- ZodError = class _ZodError extends Error {
1374
+ ZodError = class extends Error {
1438
1375
  constructor(issues) {
1439
1376
  super();
1440
1377
  this.issues = [];
@@ -1492,11 +1429,6 @@ var init_lib = __esm({
1492
1429
  processError(this);
1493
1430
  return fieldErrors;
1494
1431
  }
1495
- static assert(value) {
1496
- if (!(value instanceof _ZodError)) {
1497
- throw new Error(`Not a ZodError: ${value}`);
1498
- }
1499
- }
1500
1432
  toString() {
1501
1433
  return this.message;
1502
1434
  }
@@ -1563,12 +1495,7 @@ var init_lib = __esm({
1563
1495
  break;
1564
1496
  case ZodIssueCode.invalid_string:
1565
1497
  if (typeof issue.validation === "object") {
1566
- if ("includes" in issue.validation) {
1567
- message = `Invalid input: must include "${issue.validation.includes}"`;
1568
- if (typeof issue.validation.position === "number") {
1569
- message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;
1570
- }
1571
- } else if ("startsWith" in issue.validation) {
1498
+ if ("startsWith" in issue.validation) {
1572
1499
  message = `Invalid input: must start with "${issue.validation.startsWith}"`;
1573
1500
  } else if ("endsWith" in issue.validation) {
1574
1501
  message = `Invalid input: must end with "${issue.validation.endsWith}"`;
@@ -1589,7 +1516,7 @@ var init_lib = __esm({
1589
1516
  else if (issue.type === "number")
1590
1517
  message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
1591
1518
  else if (issue.type === "date")
1592
- message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;
1519
+ message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(issue.minimum)}`;
1593
1520
  else
1594
1521
  message = "Invalid input";
1595
1522
  break;
@@ -1600,10 +1527,8 @@ var init_lib = __esm({
1600
1527
  message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
1601
1528
  else if (issue.type === "number")
1602
1529
  message = `Number must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
1603
- else if (issue.type === "bigint")
1604
- message = `BigInt must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
1605
1530
  else if (issue.type === "date")
1606
- message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue.maximum))}`;
1531
+ message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(issue.maximum)}`;
1607
1532
  else
1608
1533
  message = "Invalid input";
1609
1534
  break;
@@ -1633,13 +1558,6 @@ var init_lib = __esm({
1633
1558
  ...issueData,
1634
1559
  path: fullPath
1635
1560
  };
1636
- if (issueData.message !== void 0) {
1637
- return {
1638
- ...issueData,
1639
- path: fullPath,
1640
- message: issueData.message
1641
- };
1642
- }
1643
1561
  let errorMessage = "";
1644
1562
  const maps = errorMaps.filter((m) => !!m).slice().reverse();
1645
1563
  for (const map of maps) {
@@ -1648,7 +1566,7 @@ var init_lib = __esm({
1648
1566
  return {
1649
1567
  ...issueData,
1650
1568
  path: fullPath,
1651
- message: errorMessage
1569
+ message: issueData.message || errorMessage
1652
1570
  };
1653
1571
  };
1654
1572
  ParseStatus = class _ParseStatus {
@@ -1677,11 +1595,9 @@ var init_lib = __esm({
1677
1595
  static async mergeObjectAsync(status, pairs) {
1678
1596
  const syncPairs = [];
1679
1597
  for (const pair of pairs) {
1680
- const key = await pair.key;
1681
- const value = await pair.value;
1682
1598
  syncPairs.push({
1683
- key,
1684
- value
1599
+ key: await pair.key,
1600
+ value: await pair.value
1685
1601
  });
1686
1602
  }
1687
1603
  return _ParseStatus.mergeObjectSync(status, syncPairs);
@@ -1698,7 +1614,7 @@ var init_lib = __esm({
1698
1614
  status.dirty();
1699
1615
  if (value.status === "dirty")
1700
1616
  status.dirty();
1701
- if (key.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) {
1617
+ if (typeof value.value !== "undefined" || pair.alwaysSet) {
1702
1618
  finalObject[key.value] = value.value;
1703
1619
  }
1704
1620
  }
@@ -1713,28 +1629,20 @@ var init_lib = __esm({
1713
1629
  isAborted = (x) => x.status === "aborted";
1714
1630
  isDirty = (x) => x.status === "dirty";
1715
1631
  isValid = (x) => x.status === "valid";
1716
- isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
1632
+ isAsync = (x) => typeof Promise !== void 0 && x instanceof Promise;
1717
1633
  (function(errorUtil2) {
1718
1634
  errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
1719
1635
  errorUtil2.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
1720
1636
  })(errorUtil || (errorUtil = {}));
1721
1637
  ParseInputLazyPath = class {
1722
1638
  constructor(parent, value, path2, key) {
1723
- this._cachedPath = [];
1724
1639
  this.parent = parent;
1725
1640
  this.data = value;
1726
1641
  this._path = path2;
1727
1642
  this._key = key;
1728
1643
  }
1729
1644
  get path() {
1730
- if (!this._cachedPath.length) {
1731
- if (this._key instanceof Array) {
1732
- this._cachedPath.push(...this._path, ...this._key);
1733
- } else {
1734
- this._cachedPath.push(...this._path, this._key);
1735
- }
1736
- }
1737
- return this._cachedPath;
1645
+ return this._path.concat(this._key);
1738
1646
  }
1739
1647
  };
1740
1648
  handleResult = (ctx, result) => {
@@ -1744,16 +1652,8 @@ var init_lib = __esm({
1744
1652
  if (!ctx.common.issues.length) {
1745
1653
  throw new Error("Validation failed but no issues detected.");
1746
1654
  }
1747
- return {
1748
- success: false,
1749
- get error() {
1750
- if (this._error)
1751
- return this._error;
1752
- const error2 = new ZodError(ctx.common.issues);
1753
- this._error = error2;
1754
- return this._error;
1755
- }
1756
- };
1655
+ const error2 = new ZodError(ctx.common.issues);
1656
+ return { success: false, error: error2 };
1757
1657
  }
1758
1658
  };
1759
1659
  ZodType = class {
@@ -1781,7 +1681,6 @@ var init_lib = __esm({
1781
1681
  this.catch = this.catch.bind(this);
1782
1682
  this.describe = this.describe.bind(this);
1783
1683
  this.pipe = this.pipe.bind(this);
1784
- this.readonly = this.readonly.bind(this);
1785
1684
  this.isNullable = this.isNullable.bind(this);
1786
1685
  this.isOptional = this.isOptional.bind(this);
1787
1686
  }
@@ -1926,29 +1825,28 @@ var init_lib = __esm({
1926
1825
  return this._refinement(refinement);
1927
1826
  }
1928
1827
  optional() {
1929
- return ZodOptional.create(this, this._def);
1828
+ return ZodOptional.create(this);
1930
1829
  }
1931
1830
  nullable() {
1932
- return ZodNullable.create(this, this._def);
1831
+ return ZodNullable.create(this);
1933
1832
  }
1934
1833
  nullish() {
1935
- return this.nullable().optional();
1834
+ return this.optional().nullable();
1936
1835
  }
1937
1836
  array() {
1938
- return ZodArray.create(this, this._def);
1837
+ return ZodArray.create(this);
1939
1838
  }
1940
1839
  promise() {
1941
- return ZodPromise.create(this, this._def);
1840
+ return ZodPromise.create(this);
1942
1841
  }
1943
1842
  or(option) {
1944
- return ZodUnion.create([this, option], this._def);
1843
+ return ZodUnion.create([this, option]);
1945
1844
  }
1946
1845
  and(incoming) {
1947
- return ZodIntersection.create(this, incoming, this._def);
1846
+ return ZodIntersection.create(this, incoming);
1948
1847
  }
1949
1848
  transform(transform) {
1950
1849
  return new ZodEffects({
1951
- ...processCreateParams(this._def),
1952
1850
  schema: this,
1953
1851
  typeName: ZodFirstPartyTypeKind.ZodEffects,
1954
1852
  effect: { type: "transform", transform }
@@ -1957,7 +1855,6 @@ var init_lib = __esm({
1957
1855
  default(def) {
1958
1856
  const defaultValueFunc = typeof def === "function" ? def : () => def;
1959
1857
  return new ZodDefault({
1960
- ...processCreateParams(this._def),
1961
1858
  innerType: this,
1962
1859
  defaultValue: defaultValueFunc,
1963
1860
  typeName: ZodFirstPartyTypeKind.ZodDefault
@@ -1967,15 +1864,14 @@ var init_lib = __esm({
1967
1864
  return new ZodBranded({
1968
1865
  typeName: ZodFirstPartyTypeKind.ZodBranded,
1969
1866
  type: this,
1970
- ...processCreateParams(this._def)
1867
+ ...processCreateParams(void 0)
1971
1868
  });
1972
1869
  }
1973
1870
  catch(def) {
1974
- const catchValueFunc = typeof def === "function" ? def : () => def;
1871
+ const defaultValueFunc = typeof def === "function" ? def : () => def;
1975
1872
  return new ZodCatch({
1976
- ...processCreateParams(this._def),
1977
1873
  innerType: this,
1978
- catchValue: catchValueFunc,
1874
+ defaultValue: defaultValueFunc,
1979
1875
  typeName: ZodFirstPartyTypeKind.ZodCatch
1980
1876
  });
1981
1877
  }
@@ -1989,9 +1885,6 @@ var init_lib = __esm({
1989
1885
  pipe(target) {
1990
1886
  return ZodPipeline.create(this, target);
1991
1887
  }
1992
- readonly() {
1993
- return ZodReadonly.create(this);
1994
- }
1995
1888
  isOptional() {
1996
1889
  return this.safeParse(void 0).success;
1997
1890
  }
@@ -2000,19 +1893,43 @@ var init_lib = __esm({
2000
1893
  }
2001
1894
  };
2002
1895
  cuidRegex = /^c[^\s-]{8,}$/i;
2003
- cuid2Regex = /^[0-9a-z]+$/;
2004
- ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/;
2005
- uuidRegex = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i;
2006
- nanoidRegex = /^[a-z0-9_-]{21}$/i;
2007
- durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;
2008
- emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
2009
- _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
2010
- ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
2011
- ipv6Regex = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;
2012
- base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
2013
- 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])))`;
2014
- dateRegex = new RegExp(`^${dateRegexSource}$`);
1896
+ uuidRegex = /^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i;
1897
+ emailRegex = /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i;
1898
+ datetimeRegex = (args) => {
1899
+ if (args.precision) {
1900
+ if (args.offset) {
1901
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}:\\d{2})|Z)$`);
1902
+ } else {
1903
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$`);
1904
+ }
1905
+ } else if (args.precision === 0) {
1906
+ if (args.offset) {
1907
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}:\\d{2})|Z)$`);
1908
+ } else {
1909
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`);
1910
+ }
1911
+ } else {
1912
+ if (args.offset) {
1913
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$`);
1914
+ } else {
1915
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`);
1916
+ }
1917
+ }
1918
+ };
2015
1919
  ZodString = class _ZodString extends ZodType {
1920
+ constructor() {
1921
+ super(...arguments);
1922
+ this._regex = (regex, validation, message) => this.refinement((data) => regex.test(data), {
1923
+ validation,
1924
+ code: ZodIssueCode.invalid_string,
1925
+ ...errorUtil.errToObj(message)
1926
+ });
1927
+ this.nonempty = (message) => this.min(1, errorUtil.errToObj(message));
1928
+ this.trim = () => new _ZodString({
1929
+ ...this._def,
1930
+ checks: [...this._def.checks, { kind: "trim" }]
1931
+ });
1932
+ }
2016
1933
  _parse(input) {
2017
1934
  if (this._def.coerce) {
2018
1935
  input.data = String(input.data);
@@ -2020,11 +1937,15 @@ var init_lib = __esm({
2020
1937
  const parsedType = this._getType(input);
2021
1938
  if (parsedType !== ZodParsedType.string) {
2022
1939
  const ctx2 = this._getOrReturnCtx(input);
2023
- addIssueToContext(ctx2, {
2024
- code: ZodIssueCode.invalid_type,
2025
- expected: ZodParsedType.string,
2026
- received: ctx2.parsedType
2027
- });
1940
+ addIssueToContext(
1941
+ ctx2,
1942
+ {
1943
+ code: ZodIssueCode.invalid_type,
1944
+ expected: ZodParsedType.string,
1945
+ received: ctx2.parsedType
1946
+ }
1947
+ //
1948
+ );
2028
1949
  return INVALID;
2029
1950
  }
2030
1951
  const status = new ParseStatus();
@@ -2092,19 +2013,6 @@ var init_lib = __esm({
2092
2013
  });
2093
2014
  status.dirty();
2094
2015
  }
2095
- } else if (check.kind === "emoji") {
2096
- if (!emojiRegex) {
2097
- emojiRegex = new RegExp(_emojiRegex, "u");
2098
- }
2099
- if (!emojiRegex.test(input.data)) {
2100
- ctx = this._getOrReturnCtx(input, ctx);
2101
- addIssueToContext(ctx, {
2102
- validation: "emoji",
2103
- code: ZodIssueCode.invalid_string,
2104
- message: check.message
2105
- });
2106
- status.dirty();
2107
- }
2108
2016
  } else if (check.kind === "uuid") {
2109
2017
  if (!uuidRegex.test(input.data)) {
2110
2018
  ctx = this._getOrReturnCtx(input, ctx);
@@ -2115,16 +2023,6 @@ var init_lib = __esm({
2115
2023
  });
2116
2024
  status.dirty();
2117
2025
  }
2118
- } else if (check.kind === "nanoid") {
2119
- if (!nanoidRegex.test(input.data)) {
2120
- ctx = this._getOrReturnCtx(input, ctx);
2121
- addIssueToContext(ctx, {
2122
- validation: "nanoid",
2123
- code: ZodIssueCode.invalid_string,
2124
- message: check.message
2125
- });
2126
- status.dirty();
2127
- }
2128
2026
  } else if (check.kind === "cuid") {
2129
2027
  if (!cuidRegex.test(input.data)) {
2130
2028
  ctx = this._getOrReturnCtx(input, ctx);
@@ -2135,26 +2033,6 @@ var init_lib = __esm({
2135
2033
  });
2136
2034
  status.dirty();
2137
2035
  }
2138
- } else if (check.kind === "cuid2") {
2139
- if (!cuid2Regex.test(input.data)) {
2140
- ctx = this._getOrReturnCtx(input, ctx);
2141
- addIssueToContext(ctx, {
2142
- validation: "cuid2",
2143
- code: ZodIssueCode.invalid_string,
2144
- message: check.message
2145
- });
2146
- status.dirty();
2147
- }
2148
- } else if (check.kind === "ulid") {
2149
- if (!ulidRegex.test(input.data)) {
2150
- ctx = this._getOrReturnCtx(input, ctx);
2151
- addIssueToContext(ctx, {
2152
- validation: "ulid",
2153
- code: ZodIssueCode.invalid_string,
2154
- message: check.message
2155
- });
2156
- status.dirty();
2157
- }
2158
2036
  } else if (check.kind === "url") {
2159
2037
  try {
2160
2038
  new URL(input.data);
@@ -2181,20 +2059,6 @@ var init_lib = __esm({
2181
2059
  }
2182
2060
  } else if (check.kind === "trim") {
2183
2061
  input.data = input.data.trim();
2184
- } else if (check.kind === "includes") {
2185
- if (!input.data.includes(check.value, check.position)) {
2186
- ctx = this._getOrReturnCtx(input, ctx);
2187
- addIssueToContext(ctx, {
2188
- code: ZodIssueCode.invalid_string,
2189
- validation: { includes: check.value, position: check.position },
2190
- message: check.message
2191
- });
2192
- status.dirty();
2193
- }
2194
- } else if (check.kind === "toLowerCase") {
2195
- input.data = input.data.toLowerCase();
2196
- } else if (check.kind === "toUpperCase") {
2197
- input.data = input.data.toUpperCase();
2198
2062
  } else if (check.kind === "startsWith") {
2199
2063
  if (!input.data.startsWith(check.value)) {
2200
2064
  ctx = this._getOrReturnCtx(input, ctx);
@@ -2226,71 +2090,12 @@ var init_lib = __esm({
2226
2090
  });
2227
2091
  status.dirty();
2228
2092
  }
2229
- } else if (check.kind === "date") {
2230
- const regex = dateRegex;
2231
- if (!regex.test(input.data)) {
2232
- ctx = this._getOrReturnCtx(input, ctx);
2233
- addIssueToContext(ctx, {
2234
- code: ZodIssueCode.invalid_string,
2235
- validation: "date",
2236
- message: check.message
2237
- });
2238
- status.dirty();
2239
- }
2240
- } else if (check.kind === "time") {
2241
- const regex = timeRegex(check);
2242
- if (!regex.test(input.data)) {
2243
- ctx = this._getOrReturnCtx(input, ctx);
2244
- addIssueToContext(ctx, {
2245
- code: ZodIssueCode.invalid_string,
2246
- validation: "time",
2247
- message: check.message
2248
- });
2249
- status.dirty();
2250
- }
2251
- } else if (check.kind === "duration") {
2252
- if (!durationRegex.test(input.data)) {
2253
- ctx = this._getOrReturnCtx(input, ctx);
2254
- addIssueToContext(ctx, {
2255
- validation: "duration",
2256
- code: ZodIssueCode.invalid_string,
2257
- message: check.message
2258
- });
2259
- status.dirty();
2260
- }
2261
- } else if (check.kind === "ip") {
2262
- if (!isValidIP(input.data, check.version)) {
2263
- ctx = this._getOrReturnCtx(input, ctx);
2264
- addIssueToContext(ctx, {
2265
- validation: "ip",
2266
- code: ZodIssueCode.invalid_string,
2267
- message: check.message
2268
- });
2269
- status.dirty();
2270
- }
2271
- } else if (check.kind === "base64") {
2272
- if (!base64Regex.test(input.data)) {
2273
- ctx = this._getOrReturnCtx(input, ctx);
2274
- addIssueToContext(ctx, {
2275
- validation: "base64",
2276
- code: ZodIssueCode.invalid_string,
2277
- message: check.message
2278
- });
2279
- status.dirty();
2280
- }
2281
2093
  } else {
2282
2094
  util.assertNever(check);
2283
2095
  }
2284
2096
  }
2285
2097
  return { status: status.value, value: input.data };
2286
2098
  }
2287
- _regex(regex, validation, message) {
2288
- return this.refinement((data) => regex.test(data), {
2289
- validation,
2290
- code: ZodIssueCode.invalid_string,
2291
- ...errorUtil.errToObj(message)
2292
- });
2293
- }
2294
2099
  _addCheck(check) {
2295
2100
  return new _ZodString({
2296
2101
  ...this._def,
@@ -2303,38 +2108,19 @@ var init_lib = __esm({
2303
2108
  url(message) {
2304
2109
  return this._addCheck({ kind: "url", ...errorUtil.errToObj(message) });
2305
2110
  }
2306
- emoji(message) {
2307
- return this._addCheck({ kind: "emoji", ...errorUtil.errToObj(message) });
2308
- }
2309
2111
  uuid(message) {
2310
2112
  return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) });
2311
2113
  }
2312
- nanoid(message) {
2313
- return this._addCheck({ kind: "nanoid", ...errorUtil.errToObj(message) });
2314
- }
2315
2114
  cuid(message) {
2316
2115
  return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
2317
2116
  }
2318
- cuid2(message) {
2319
- return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) });
2320
- }
2321
- ulid(message) {
2322
- return this._addCheck({ kind: "ulid", ...errorUtil.errToObj(message) });
2323
- }
2324
- base64(message) {
2325
- return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });
2326
- }
2327
- ip(options) {
2328
- return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
2329
- }
2330
2117
  datetime(options) {
2331
- var _a, _b;
2118
+ var _a;
2332
2119
  if (typeof options === "string") {
2333
2120
  return this._addCheck({
2334
2121
  kind: "datetime",
2335
2122
  precision: null,
2336
2123
  offset: false,
2337
- local: false,
2338
2124
  message: options
2339
2125
  });
2340
2126
  }
@@ -2342,30 +2128,9 @@ var init_lib = __esm({
2342
2128
  kind: "datetime",
2343
2129
  precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
2344
2130
  offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,
2345
- local: (_b = options === null || options === void 0 ? void 0 : options.local) !== null && _b !== void 0 ? _b : false,
2346
2131
  ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
2347
2132
  });
2348
2133
  }
2349
- date(message) {
2350
- return this._addCheck({ kind: "date", message });
2351
- }
2352
- time(options) {
2353
- if (typeof options === "string") {
2354
- return this._addCheck({
2355
- kind: "time",
2356
- precision: null,
2357
- message: options
2358
- });
2359
- }
2360
- return this._addCheck({
2361
- kind: "time",
2362
- precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
2363
- ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
2364
- });
2365
- }
2366
- duration(message) {
2367
- return this._addCheck({ kind: "duration", ...errorUtil.errToObj(message) });
2368
- }
2369
2134
  regex(regex, message) {
2370
2135
  return this._addCheck({
2371
2136
  kind: "regex",
@@ -2373,14 +2138,6 @@ var init_lib = __esm({
2373
2138
  ...errorUtil.errToObj(message)
2374
2139
  });
2375
2140
  }
2376
- includes(value, options) {
2377
- return this._addCheck({
2378
- kind: "includes",
2379
- value,
2380
- position: options === null || options === void 0 ? void 0 : options.position,
2381
- ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
2382
- });
2383
- }
2384
2141
  startsWith(value, message) {
2385
2142
  return this._addCheck({
2386
2143
  kind: "startsWith",
@@ -2416,73 +2173,21 @@ var init_lib = __esm({
2416
2173
  ...errorUtil.errToObj(message)
2417
2174
  });
2418
2175
  }
2419
- /**
2420
- * @deprecated Use z.string().min(1) instead.
2421
- * @see {@link ZodString.min}
2422
- */
2423
- nonempty(message) {
2424
- return this.min(1, errorUtil.errToObj(message));
2425
- }
2426
- trim() {
2427
- return new _ZodString({
2428
- ...this._def,
2429
- checks: [...this._def.checks, { kind: "trim" }]
2430
- });
2431
- }
2432
- toLowerCase() {
2433
- return new _ZodString({
2434
- ...this._def,
2435
- checks: [...this._def.checks, { kind: "toLowerCase" }]
2436
- });
2437
- }
2438
- toUpperCase() {
2439
- return new _ZodString({
2440
- ...this._def,
2441
- checks: [...this._def.checks, { kind: "toUpperCase" }]
2442
- });
2443
- }
2444
2176
  get isDatetime() {
2445
2177
  return !!this._def.checks.find((ch) => ch.kind === "datetime");
2446
2178
  }
2447
- get isDate() {
2448
- return !!this._def.checks.find((ch) => ch.kind === "date");
2449
- }
2450
- get isTime() {
2451
- return !!this._def.checks.find((ch) => ch.kind === "time");
2452
- }
2453
- get isDuration() {
2454
- return !!this._def.checks.find((ch) => ch.kind === "duration");
2455
- }
2456
2179
  get isEmail() {
2457
2180
  return !!this._def.checks.find((ch) => ch.kind === "email");
2458
2181
  }
2459
2182
  get isURL() {
2460
2183
  return !!this._def.checks.find((ch) => ch.kind === "url");
2461
2184
  }
2462
- get isEmoji() {
2463
- return !!this._def.checks.find((ch) => ch.kind === "emoji");
2464
- }
2465
2185
  get isUUID() {
2466
2186
  return !!this._def.checks.find((ch) => ch.kind === "uuid");
2467
2187
  }
2468
- get isNANOID() {
2469
- return !!this._def.checks.find((ch) => ch.kind === "nanoid");
2470
- }
2471
2188
  get isCUID() {
2472
2189
  return !!this._def.checks.find((ch) => ch.kind === "cuid");
2473
2190
  }
2474
- get isCUID2() {
2475
- return !!this._def.checks.find((ch) => ch.kind === "cuid2");
2476
- }
2477
- get isULID() {
2478
- return !!this._def.checks.find((ch) => ch.kind === "ulid");
2479
- }
2480
- get isIP() {
2481
- return !!this._def.checks.find((ch) => ch.kind === "ip");
2482
- }
2483
- get isBase64() {
2484
- return !!this._def.checks.find((ch) => ch.kind === "base64");
2485
- }
2486
2191
  get minLength() {
2487
2192
  let min = null;
2488
2193
  for (const ch of this._def.checks) {
@@ -2684,19 +2389,6 @@ var init_lib = __esm({
2684
2389
  message: errorUtil.toString(message)
2685
2390
  });
2686
2391
  }
2687
- safe(message) {
2688
- return this._addCheck({
2689
- kind: "min",
2690
- inclusive: true,
2691
- value: Number.MIN_SAFE_INTEGER,
2692
- message: errorUtil.toString(message)
2693
- })._addCheck({
2694
- kind: "max",
2695
- inclusive: true,
2696
- value: Number.MAX_SAFE_INTEGER,
2697
- message: errorUtil.toString(message)
2698
- });
2699
- }
2700
2392
  get minValue() {
2701
2393
  let min = null;
2702
2394
  for (const ch of this._def.checks) {
@@ -2718,22 +2410,7 @@ var init_lib = __esm({
2718
2410
  return max;
2719
2411
  }
2720
2412
  get isInt() {
2721
- return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
2722
- }
2723
- get isFinite() {
2724
- let max = null, min = null;
2725
- for (const ch of this._def.checks) {
2726
- if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
2727
- return true;
2728
- } else if (ch.kind === "min") {
2729
- if (min === null || ch.value > min)
2730
- min = ch.value;
2731
- } else if (ch.kind === "max") {
2732
- if (max === null || ch.value < max)
2733
- max = ch.value;
2734
- }
2735
- }
2736
- return Number.isFinite(min) && Number.isFinite(max);
2413
+ return !!this._def.checks.find((ch) => ch.kind === "int");
2737
2414
  }
2738
2415
  };
2739
2416
  ZodNumber.create = (params) => {
@@ -2744,167 +2421,27 @@ var init_lib = __esm({
2744
2421
  ...processCreateParams(params)
2745
2422
  });
2746
2423
  };
2747
- ZodBigInt = class _ZodBigInt extends ZodType {
2748
- constructor() {
2749
- super(...arguments);
2750
- this.min = this.gte;
2751
- this.max = this.lte;
2752
- }
2424
+ ZodBigInt = class extends ZodType {
2753
2425
  _parse(input) {
2754
2426
  if (this._def.coerce) {
2755
2427
  input.data = BigInt(input.data);
2756
2428
  }
2757
2429
  const parsedType = this._getType(input);
2758
2430
  if (parsedType !== ZodParsedType.bigint) {
2759
- const ctx2 = this._getOrReturnCtx(input);
2760
- addIssueToContext(ctx2, {
2431
+ const ctx = this._getOrReturnCtx(input);
2432
+ addIssueToContext(ctx, {
2761
2433
  code: ZodIssueCode.invalid_type,
2762
2434
  expected: ZodParsedType.bigint,
2763
- received: ctx2.parsedType
2435
+ received: ctx.parsedType
2764
2436
  });
2765
2437
  return INVALID;
2766
2438
  }
2767
- let ctx = void 0;
2768
- const status = new ParseStatus();
2769
- for (const check of this._def.checks) {
2770
- if (check.kind === "min") {
2771
- const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
2772
- if (tooSmall) {
2773
- ctx = this._getOrReturnCtx(input, ctx);
2774
- addIssueToContext(ctx, {
2775
- code: ZodIssueCode.too_small,
2776
- type: "bigint",
2777
- minimum: check.value,
2778
- inclusive: check.inclusive,
2779
- message: check.message
2780
- });
2781
- status.dirty();
2782
- }
2783
- } else if (check.kind === "max") {
2784
- const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
2785
- if (tooBig) {
2786
- ctx = this._getOrReturnCtx(input, ctx);
2787
- addIssueToContext(ctx, {
2788
- code: ZodIssueCode.too_big,
2789
- type: "bigint",
2790
- maximum: check.value,
2791
- inclusive: check.inclusive,
2792
- message: check.message
2793
- });
2794
- status.dirty();
2795
- }
2796
- } else if (check.kind === "multipleOf") {
2797
- if (input.data % check.value !== BigInt(0)) {
2798
- ctx = this._getOrReturnCtx(input, ctx);
2799
- addIssueToContext(ctx, {
2800
- code: ZodIssueCode.not_multiple_of,
2801
- multipleOf: check.value,
2802
- message: check.message
2803
- });
2804
- status.dirty();
2805
- }
2806
- } else {
2807
- util.assertNever(check);
2808
- }
2809
- }
2810
- return { status: status.value, value: input.data };
2811
- }
2812
- gte(value, message) {
2813
- return this.setLimit("min", value, true, errorUtil.toString(message));
2814
- }
2815
- gt(value, message) {
2816
- return this.setLimit("min", value, false, errorUtil.toString(message));
2817
- }
2818
- lte(value, message) {
2819
- return this.setLimit("max", value, true, errorUtil.toString(message));
2820
- }
2821
- lt(value, message) {
2822
- return this.setLimit("max", value, false, errorUtil.toString(message));
2823
- }
2824
- setLimit(kind, value, inclusive, message) {
2825
- return new _ZodBigInt({
2826
- ...this._def,
2827
- checks: [
2828
- ...this._def.checks,
2829
- {
2830
- kind,
2831
- value,
2832
- inclusive,
2833
- message: errorUtil.toString(message)
2834
- }
2835
- ]
2836
- });
2837
- }
2838
- _addCheck(check) {
2839
- return new _ZodBigInt({
2840
- ...this._def,
2841
- checks: [...this._def.checks, check]
2842
- });
2843
- }
2844
- positive(message) {
2845
- return this._addCheck({
2846
- kind: "min",
2847
- value: BigInt(0),
2848
- inclusive: false,
2849
- message: errorUtil.toString(message)
2850
- });
2851
- }
2852
- negative(message) {
2853
- return this._addCheck({
2854
- kind: "max",
2855
- value: BigInt(0),
2856
- inclusive: false,
2857
- message: errorUtil.toString(message)
2858
- });
2859
- }
2860
- nonpositive(message) {
2861
- return this._addCheck({
2862
- kind: "max",
2863
- value: BigInt(0),
2864
- inclusive: true,
2865
- message: errorUtil.toString(message)
2866
- });
2867
- }
2868
- nonnegative(message) {
2869
- return this._addCheck({
2870
- kind: "min",
2871
- value: BigInt(0),
2872
- inclusive: true,
2873
- message: errorUtil.toString(message)
2874
- });
2875
- }
2876
- multipleOf(value, message) {
2877
- return this._addCheck({
2878
- kind: "multipleOf",
2879
- value,
2880
- message: errorUtil.toString(message)
2881
- });
2882
- }
2883
- get minValue() {
2884
- let min = null;
2885
- for (const ch of this._def.checks) {
2886
- if (ch.kind === "min") {
2887
- if (min === null || ch.value > min)
2888
- min = ch.value;
2889
- }
2890
- }
2891
- return min;
2892
- }
2893
- get maxValue() {
2894
- let max = null;
2895
- for (const ch of this._def.checks) {
2896
- if (ch.kind === "max") {
2897
- if (max === null || ch.value < max)
2898
- max = ch.value;
2899
- }
2900
- }
2901
- return max;
2439
+ return OK(input.data);
2902
2440
  }
2903
2441
  };
2904
2442
  ZodBigInt.create = (params) => {
2905
2443
  var _a;
2906
2444
  return new ZodBigInt({
2907
- checks: [],
2908
2445
  typeName: ZodFirstPartyTypeKind.ZodBigInt,
2909
2446
  coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
2910
2447
  ...processCreateParams(params)
@@ -3230,13 +2767,13 @@ var init_lib = __esm({
3230
2767
  }
3231
2768
  }
3232
2769
  if (ctx.common.async) {
3233
- return Promise.all([...ctx.data].map((item, i) => {
2770
+ return Promise.all(ctx.data.map((item, i) => {
3234
2771
  return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
3235
2772
  })).then((result2) => {
3236
2773
  return ParseStatus.mergeArray(status, result2);
3237
2774
  });
3238
2775
  }
3239
- const result = [...ctx.data].map((item, i) => {
2776
+ const result = ctx.data.map((item, i) => {
3240
2777
  return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
3241
2778
  });
3242
2779
  return ParseStatus.mergeArray(status, result);
@@ -3276,12 +2813,31 @@ var init_lib = __esm({
3276
2813
  ...processCreateParams(params)
3277
2814
  });
3278
2815
  };
2816
+ (function(objectUtil2) {
2817
+ objectUtil2.mergeShapes = (first, second) => {
2818
+ return {
2819
+ ...first,
2820
+ ...second
2821
+ // second overwrites first
2822
+ };
2823
+ };
2824
+ })(objectUtil || (objectUtil = {}));
2825
+ AugmentFactory = (def) => (augmentation) => {
2826
+ return new ZodObject({
2827
+ ...def,
2828
+ shape: () => ({
2829
+ ...def.shape(),
2830
+ ...augmentation
2831
+ })
2832
+ });
2833
+ };
3279
2834
  ZodObject = class _ZodObject extends ZodType {
3280
2835
  constructor() {
3281
2836
  super(...arguments);
3282
2837
  this._cached = null;
3283
2838
  this.nonstrict = this.passthrough;
3284
- this.augment = this.extend;
2839
+ this.augment = AugmentFactory(this._def);
2840
+ this.extend = AugmentFactory(this._def);
3285
2841
  }
3286
2842
  _getCached() {
3287
2843
  if (this._cached !== null)
@@ -3362,10 +2918,9 @@ var init_lib = __esm({
3362
2918
  const syncPairs = [];
3363
2919
  for (const pair of pairs) {
3364
2920
  const key = await pair.key;
3365
- const value = await pair.value;
3366
2921
  syncPairs.push({
3367
2922
  key,
3368
- value,
2923
+ value: await pair.value,
3369
2924
  alwaysSet: pair.alwaysSet
3370
2925
  });
3371
2926
  }
@@ -3412,31 +2967,8 @@ var init_lib = __esm({
3412
2967
  unknownKeys: "passthrough"
3413
2968
  });
3414
2969
  }
3415
- // const AugmentFactory =
3416
- // <Def extends ZodObjectDef>(def: Def) =>
3417
- // <Augmentation extends ZodRawShape>(
3418
- // augmentation: Augmentation
3419
- // ): ZodObject<
3420
- // extendShape<ReturnType<Def["shape"]>, Augmentation>,
3421
- // Def["unknownKeys"],
3422
- // Def["catchall"]
3423
- // > => {
3424
- // return new ZodObject({
3425
- // ...def,
3426
- // shape: () => ({
3427
- // ...def.shape(),
3428
- // ...augmentation,
3429
- // }),
3430
- // }) as any;
3431
- // };
3432
- extend(augmentation) {
3433
- return new _ZodObject({
3434
- ...this._def,
3435
- shape: () => ({
3436
- ...this._def.shape(),
3437
- ...augmentation
3438
- })
3439
- });
2970
+ setKey(key, schema4) {
2971
+ return this.augment({ [key]: schema4 });
3440
2972
  }
3441
2973
  /**
3442
2974
  * Prior to zod@1.0.12 there was a bug in the
@@ -3447,73 +2979,11 @@ var init_lib = __esm({
3447
2979
  const merged = new _ZodObject({
3448
2980
  unknownKeys: merging._def.unknownKeys,
3449
2981
  catchall: merging._def.catchall,
3450
- shape: () => ({
3451
- ...this._def.shape(),
3452
- ...merging._def.shape()
3453
- }),
2982
+ shape: () => objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
3454
2983
  typeName: ZodFirstPartyTypeKind.ZodObject
3455
2984
  });
3456
2985
  return merged;
3457
2986
  }
3458
- // merge<
3459
- // Incoming extends AnyZodObject,
3460
- // Augmentation extends Incoming["shape"],
3461
- // NewOutput extends {
3462
- // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
3463
- // ? Augmentation[k]["_output"]
3464
- // : k extends keyof Output
3465
- // ? Output[k]
3466
- // : never;
3467
- // },
3468
- // NewInput extends {
3469
- // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
3470
- // ? Augmentation[k]["_input"]
3471
- // : k extends keyof Input
3472
- // ? Input[k]
3473
- // : never;
3474
- // }
3475
- // >(
3476
- // merging: Incoming
3477
- // ): ZodObject<
3478
- // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
3479
- // Incoming["_def"]["unknownKeys"],
3480
- // Incoming["_def"]["catchall"],
3481
- // NewOutput,
3482
- // NewInput
3483
- // > {
3484
- // const merged: any = new ZodObject({
3485
- // unknownKeys: merging._def.unknownKeys,
3486
- // catchall: merging._def.catchall,
3487
- // shape: () =>
3488
- // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
3489
- // typeName: ZodFirstPartyTypeKind.ZodObject,
3490
- // }) as any;
3491
- // return merged;
3492
- // }
3493
- setKey(key, schema4) {
3494
- return this.augment({ [key]: schema4 });
3495
- }
3496
- // merge<Incoming extends AnyZodObject>(
3497
- // merging: Incoming
3498
- // ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
3499
- // ZodObject<
3500
- // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
3501
- // Incoming["_def"]["unknownKeys"],
3502
- // Incoming["_def"]["catchall"]
3503
- // > {
3504
- // // const mergedShape = objectUtil.mergeShapes(
3505
- // // this._def.shape(),
3506
- // // merging._def.shape()
3507
- // // );
3508
- // const merged: any = new ZodObject({
3509
- // unknownKeys: merging._def.unknownKeys,
3510
- // catchall: merging._def.catchall,
3511
- // shape: () =>
3512
- // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
3513
- // typeName: ZodFirstPartyTypeKind.ZodObject,
3514
- // }) as any;
3515
- // return merged;
3516
- // }
3517
2987
  catchall(index4) {
3518
2988
  return new _ZodObject({
3519
2989
  ...this._def,
@@ -3522,10 +2992,9 @@ var init_lib = __esm({
3522
2992
  }
3523
2993
  pick(mask) {
3524
2994
  const shape = {};
3525
- util.objectKeys(mask).forEach((key) => {
3526
- if (mask[key] && this.shape[key]) {
2995
+ util.objectKeys(mask).map((key) => {
2996
+ if (this.shape[key])
3527
2997
  shape[key] = this.shape[key];
3528
- }
3529
2998
  });
3530
2999
  return new _ZodObject({
3531
3000
  ...this._def,
@@ -3534,8 +3003,8 @@ var init_lib = __esm({
3534
3003
  }
3535
3004
  omit(mask) {
3536
3005
  const shape = {};
3537
- util.objectKeys(this.shape).forEach((key) => {
3538
- if (!mask[key]) {
3006
+ util.objectKeys(this.shape).map((key) => {
3007
+ if (util.objectKeys(mask).indexOf(key) === -1) {
3539
3008
  shape[key] = this.shape[key];
3540
3009
  }
3541
3010
  });
@@ -3544,22 +3013,29 @@ var init_lib = __esm({
3544
3013
  shape: () => shape
3545
3014
  });
3546
3015
  }
3547
- /**
3548
- * @deprecated
3549
- */
3550
3016
  deepPartial() {
3551
3017
  return deepPartialify(this);
3552
3018
  }
3553
3019
  partial(mask) {
3554
3020
  const newShape = {};
3555
- util.objectKeys(this.shape).forEach((key) => {
3556
- const fieldSchema = this.shape[key];
3557
- if (mask && !mask[key]) {
3558
- newShape[key] = fieldSchema;
3559
- } else {
3021
+ if (mask) {
3022
+ util.objectKeys(this.shape).map((key) => {
3023
+ if (util.objectKeys(mask).indexOf(key) === -1) {
3024
+ newShape[key] = this.shape[key];
3025
+ } else {
3026
+ newShape[key] = this.shape[key].optional();
3027
+ }
3028
+ });
3029
+ return new _ZodObject({
3030
+ ...this._def,
3031
+ shape: () => newShape
3032
+ });
3033
+ } else {
3034
+ for (const key in this.shape) {
3035
+ const fieldSchema = this.shape[key];
3560
3036
  newShape[key] = fieldSchema.optional();
3561
3037
  }
3562
- });
3038
+ }
3563
3039
  return new _ZodObject({
3564
3040
  ...this._def,
3565
3041
  shape: () => newShape
@@ -3567,10 +3043,21 @@ var init_lib = __esm({
3567
3043
  }
3568
3044
  required(mask) {
3569
3045
  const newShape = {};
3570
- util.objectKeys(this.shape).forEach((key) => {
3571
- if (mask && !mask[key]) {
3572
- newShape[key] = this.shape[key];
3573
- } else {
3046
+ if (mask) {
3047
+ util.objectKeys(this.shape).map((key) => {
3048
+ if (util.objectKeys(mask).indexOf(key) === -1) {
3049
+ newShape[key] = this.shape[key];
3050
+ } else {
3051
+ const fieldSchema = this.shape[key];
3052
+ let newField = fieldSchema;
3053
+ while (newField instanceof ZodOptional) {
3054
+ newField = newField._def.innerType;
3055
+ }
3056
+ newShape[key] = newField;
3057
+ }
3058
+ });
3059
+ } else {
3060
+ for (const key in this.shape) {
3574
3061
  const fieldSchema = this.shape[key];
3575
3062
  let newField = fieldSchema;
3576
3063
  while (newField instanceof ZodOptional) {
@@ -3578,7 +3065,7 @@ var init_lib = __esm({
3578
3065
  }
3579
3066
  newShape[key] = newField;
3580
3067
  }
3581
- });
3068
+ }
3582
3069
  return new _ZodObject({
3583
3070
  ...this._def,
3584
3071
  shape: () => newShape
@@ -3716,25 +3203,15 @@ var init_lib = __esm({
3716
3203
  } else if (type instanceof ZodEnum) {
3717
3204
  return type.options;
3718
3205
  } else if (type instanceof ZodNativeEnum) {
3719
- return util.objectValues(type.enum);
3206
+ return Object.keys(type.enum);
3720
3207
  } else if (type instanceof ZodDefault) {
3721
3208
  return getDiscriminator(type._def.innerType);
3722
3209
  } else if (type instanceof ZodUndefined) {
3723
3210
  return [void 0];
3724
3211
  } else if (type instanceof ZodNull) {
3725
3212
  return [null];
3726
- } else if (type instanceof ZodOptional) {
3727
- return [void 0, ...getDiscriminator(type.unwrap())];
3728
- } else if (type instanceof ZodNullable) {
3729
- return [null, ...getDiscriminator(type.unwrap())];
3730
- } else if (type instanceof ZodBranded) {
3731
- return getDiscriminator(type.unwrap());
3732
- } else if (type instanceof ZodReadonly) {
3733
- return getDiscriminator(type.unwrap());
3734
- } else if (type instanceof ZodCatch) {
3735
- return getDiscriminator(type._def.innerType);
3736
3213
  } else {
3737
- return [];
3214
+ return null;
3738
3215
  }
3739
3216
  };
3740
3217
  ZodDiscriminatedUnion = class _ZodDiscriminatedUnion extends ZodType {
@@ -3794,7 +3271,7 @@ var init_lib = __esm({
3794
3271
  const optionsMap = /* @__PURE__ */ new Map();
3795
3272
  for (const type of options) {
3796
3273
  const discriminatorValues = getDiscriminator(type.shape[discriminator]);
3797
- if (!discriminatorValues.length) {
3274
+ if (!discriminatorValues) {
3798
3275
  throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
3799
3276
  }
3800
3277
  for (const value of discriminatorValues) {
@@ -3898,7 +3375,7 @@ var init_lib = __esm({
3898
3375
  });
3899
3376
  status.dirty();
3900
3377
  }
3901
- const items = [...ctx.data].map((item, itemIndex) => {
3378
+ const items = ctx.data.map((item, itemIndex) => {
3902
3379
  const schema4 = this._def.items[itemIndex] || this._def.rest;
3903
3380
  if (!schema4)
3904
3381
  return null;
@@ -3956,8 +3433,7 @@ var init_lib = __esm({
3956
3433
  for (const key in ctx.data) {
3957
3434
  pairs.push({
3958
3435
  key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),
3959
- value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),
3960
- alwaysSet: key in ctx.data
3436
+ value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key))
3961
3437
  });
3962
3438
  }
3963
3439
  if (ctx.common.async) {
@@ -3987,12 +3463,6 @@ var init_lib = __esm({
3987
3463
  }
3988
3464
  };
3989
3465
  ZodMap = class extends ZodType {
3990
- get keySchema() {
3991
- return this._def.keyType;
3992
- }
3993
- get valueSchema() {
3994
- return this._def.valueType;
3995
- }
3996
3466
  _parse(input) {
3997
3467
  const { status, ctx } = this._processInputParams(input);
3998
3468
  if (ctx.parsedType !== ZodParsedType.map) {
@@ -4187,29 +3657,27 @@ var init_lib = __esm({
4187
3657
  const params = { errorMap: ctx.common.contextualErrorMap };
4188
3658
  const fn = ctx.data;
4189
3659
  if (this._def.returns instanceof ZodPromise) {
4190
- const me = this;
4191
- return OK(async function(...args) {
3660
+ return OK(async (...args) => {
4192
3661
  const error2 = new ZodError([]);
4193
- const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {
3662
+ const parsedArgs = await this._def.args.parseAsync(args, params).catch((e) => {
4194
3663
  error2.addIssue(makeArgsIssue(args, e));
4195
3664
  throw error2;
4196
3665
  });
4197
- const result = await Reflect.apply(fn, this, parsedArgs);
4198
- const parsedReturns = await me._def.returns._def.type.parseAsync(result, params).catch((e) => {
3666
+ const result = await fn(...parsedArgs);
3667
+ const parsedReturns = await this._def.returns._def.type.parseAsync(result, params).catch((e) => {
4199
3668
  error2.addIssue(makeReturnsIssue(result, e));
4200
3669
  throw error2;
4201
3670
  });
4202
3671
  return parsedReturns;
4203
3672
  });
4204
3673
  } else {
4205
- const me = this;
4206
- return OK(function(...args) {
4207
- const parsedArgs = me._def.args.safeParse(args, params);
3674
+ return OK((...args) => {
3675
+ const parsedArgs = this._def.args.safeParse(args, params);
4208
3676
  if (!parsedArgs.success) {
4209
3677
  throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
4210
3678
  }
4211
- const result = Reflect.apply(fn, this, parsedArgs.data);
4212
- const parsedReturns = me._def.returns.safeParse(result, params);
3679
+ const result = fn(...parsedArgs.data);
3680
+ const parsedReturns = this._def.returns.safeParse(result, params);
4213
3681
  if (!parsedReturns.success) {
4214
3682
  throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
4215
3683
  }
@@ -4274,7 +3742,6 @@ var init_lib = __esm({
4274
3742
  if (input.data !== this._def.value) {
4275
3743
  const ctx = this._getOrReturnCtx(input);
4276
3744
  addIssueToContext(ctx, {
4277
- received: ctx.data,
4278
3745
  code: ZodIssueCode.invalid_literal,
4279
3746
  expected: this._def.value
4280
3747
  });
@@ -4293,11 +3760,7 @@ var init_lib = __esm({
4293
3760
  ...processCreateParams(params)
4294
3761
  });
4295
3762
  };
4296
- ZodEnum = class _ZodEnum extends ZodType {
4297
- constructor() {
4298
- super(...arguments);
4299
- _ZodEnum_cache.set(this, void 0);
4300
- }
3763
+ ZodEnum = class extends ZodType {
4301
3764
  _parse(input) {
4302
3765
  if (typeof input.data !== "string") {
4303
3766
  const ctx = this._getOrReturnCtx(input);
@@ -4309,10 +3772,7 @@ var init_lib = __esm({
4309
3772
  });
4310
3773
  return INVALID;
4311
3774
  }
4312
- if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f")) {
4313
- __classPrivateFieldSet(this, _ZodEnum_cache, new Set(this._def.values), "f");
4314
- }
4315
- if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f").has(input.data)) {
3775
+ if (this._def.values.indexOf(input.data) === -1) {
4316
3776
  const ctx = this._getOrReturnCtx(input);
4317
3777
  const expectedValues = this._def.values;
4318
3778
  addIssueToContext(ctx, {
@@ -4348,26 +3808,9 @@ var init_lib = __esm({
4348
3808
  }
4349
3809
  return enumValues;
4350
3810
  }
4351
- extract(values, newDef = this._def) {
4352
- return _ZodEnum.create(values, {
4353
- ...this._def,
4354
- ...newDef
4355
- });
4356
- }
4357
- exclude(values, newDef = this._def) {
4358
- return _ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), {
4359
- ...this._def,
4360
- ...newDef
4361
- });
4362
- }
4363
3811
  };
4364
- _ZodEnum_cache = /* @__PURE__ */ new WeakMap();
4365
3812
  ZodEnum.create = createZodEnum;
4366
3813
  ZodNativeEnum = class extends ZodType {
4367
- constructor() {
4368
- super(...arguments);
4369
- _ZodNativeEnum_cache.set(this, void 0);
4370
- }
4371
3814
  _parse(input) {
4372
3815
  const nativeEnumValues = util.getValidEnumValues(this._def.values);
4373
3816
  const ctx = this._getOrReturnCtx(input);
@@ -4380,10 +3823,7 @@ var init_lib = __esm({
4380
3823
  });
4381
3824
  return INVALID;
4382
3825
  }
4383
- if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f")) {
4384
- __classPrivateFieldSet(this, _ZodNativeEnum_cache, new Set(util.getValidEnumValues(this._def.values)), "f");
4385
- }
4386
- if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f").has(input.data)) {
3826
+ if (nativeEnumValues.indexOf(input.data) === -1) {
4387
3827
  const expectedValues = util.objectValues(nativeEnumValues);
4388
3828
  addIssueToContext(ctx, {
4389
3829
  received: ctx.data,
@@ -4398,7 +3838,6 @@ var init_lib = __esm({
4398
3838
  return this._def.values;
4399
3839
  }
4400
3840
  };
4401
- _ZodNativeEnum_cache = /* @__PURE__ */ new WeakMap();
4402
3841
  ZodNativeEnum.create = (values, params) => {
4403
3842
  return new ZodNativeEnum({
4404
3843
  values,
@@ -4407,9 +3846,6 @@ var init_lib = __esm({
4407
3846
  });
4408
3847
  };
4409
3848
  ZodPromise = class extends ZodType {
4410
- unwrap() {
4411
- return this._def.type;
4412
- }
4413
3849
  _parse(input) {
4414
3850
  const { ctx } = this._processInputParams(input);
4415
3851
  if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
@@ -4446,56 +3882,38 @@ var init_lib = __esm({
4446
3882
  _parse(input) {
4447
3883
  const { status, ctx } = this._processInputParams(input);
4448
3884
  const effect = this._def.effect || null;
4449
- const checkCtx = {
4450
- addIssue: (arg) => {
4451
- addIssueToContext(ctx, arg);
4452
- if (arg.fatal) {
4453
- status.abort();
4454
- } else {
4455
- status.dirty();
4456
- }
4457
- },
4458
- get path() {
4459
- return ctx.path;
4460
- }
4461
- };
4462
- checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
4463
3885
  if (effect.type === "preprocess") {
4464
- const processed = effect.transform(ctx.data, checkCtx);
3886
+ const processed = effect.transform(ctx.data);
4465
3887
  if (ctx.common.async) {
4466
- return Promise.resolve(processed).then(async (processed2) => {
4467
- if (status.value === "aborted")
4468
- return INVALID;
4469
- const result = await this._def.schema._parseAsync({
3888
+ return Promise.resolve(processed).then((processed2) => {
3889
+ return this._def.schema._parseAsync({
4470
3890
  data: processed2,
4471
3891
  path: ctx.path,
4472
3892
  parent: ctx
4473
3893
  });
4474
- if (result.status === "aborted")
4475
- return INVALID;
4476
- if (result.status === "dirty")
4477
- return DIRTY(result.value);
4478
- if (status.value === "dirty")
4479
- return DIRTY(result.value);
4480
- return result;
4481
3894
  });
4482
3895
  } else {
4483
- if (status.value === "aborted")
4484
- return INVALID;
4485
- const result = this._def.schema._parseSync({
3896
+ return this._def.schema._parseSync({
4486
3897
  data: processed,
4487
3898
  path: ctx.path,
4488
3899
  parent: ctx
4489
3900
  });
4490
- if (result.status === "aborted")
4491
- return INVALID;
4492
- if (result.status === "dirty")
4493
- return DIRTY(result.value);
4494
- if (status.value === "dirty")
4495
- return DIRTY(result.value);
4496
- return result;
4497
3901
  }
4498
3902
  }
3903
+ const checkCtx = {
3904
+ addIssue: (arg) => {
3905
+ addIssueToContext(ctx, arg);
3906
+ if (arg.fatal) {
3907
+ status.abort();
3908
+ } else {
3909
+ status.dirty();
3910
+ }
3911
+ },
3912
+ get path() {
3913
+ return ctx.path;
3914
+ }
3915
+ };
3916
+ checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
4499
3917
  if (effect.type === "refinement") {
4500
3918
  const executeRefinement = (acc) => {
4501
3919
  const result = effect.refinement(acc, checkCtx);
@@ -4638,45 +4056,26 @@ var init_lib = __esm({
4638
4056
  ZodCatch = class extends ZodType {
4639
4057
  _parse(input) {
4640
4058
  const { ctx } = this._processInputParams(input);
4641
- const newCtx = {
4642
- ...ctx,
4643
- common: {
4644
- ...ctx.common,
4645
- issues: []
4646
- }
4647
- };
4648
4059
  const result = this._def.innerType._parse({
4649
- data: newCtx.data,
4650
- path: newCtx.path,
4651
- parent: {
4652
- ...newCtx
4653
- }
4060
+ data: ctx.data,
4061
+ path: ctx.path,
4062
+ parent: ctx
4654
4063
  });
4655
4064
  if (isAsync(result)) {
4656
4065
  return result.then((result2) => {
4657
4066
  return {
4658
4067
  status: "valid",
4659
- value: result2.status === "valid" ? result2.value : this._def.catchValue({
4660
- get error() {
4661
- return new ZodError(newCtx.common.issues);
4662
- },
4663
- input: newCtx.data
4664
- })
4068
+ value: result2.status === "valid" ? result2.value : this._def.defaultValue()
4665
4069
  };
4666
4070
  });
4667
4071
  } else {
4668
4072
  return {
4669
4073
  status: "valid",
4670
- value: result.status === "valid" ? result.value : this._def.catchValue({
4671
- get error() {
4672
- return new ZodError(newCtx.common.issues);
4673
- },
4674
- input: newCtx.data
4675
- })
4074
+ value: result.status === "valid" ? result.value : this._def.defaultValue()
4676
4075
  };
4677
4076
  }
4678
4077
  }
4679
- removeCatch() {
4078
+ removeDefault() {
4680
4079
  return this._def.innerType;
4681
4080
  }
4682
4081
  };
@@ -4684,7 +4083,7 @@ var init_lib = __esm({
4684
4083
  return new ZodCatch({
4685
4084
  innerType: type,
4686
4085
  typeName: ZodFirstPartyTypeKind.ZodCatch,
4687
- catchValue: typeof params.catch === "function" ? params.catch : () => params.catch,
4086
+ defaultValue: typeof params.default === "function" ? params.default : () => params.default,
4688
4087
  ...processCreateParams(params)
4689
4088
  });
4690
4089
  };
@@ -4779,25 +4178,6 @@ var init_lib = __esm({
4779
4178
  });
4780
4179
  }
4781
4180
  };
4782
- ZodReadonly = class extends ZodType {
4783
- _parse(input) {
4784
- const result = this._def.innerType._parse(input);
4785
- if (isValid(result)) {
4786
- result.value = Object.freeze(result.value);
4787
- }
4788
- return result;
4789
- }
4790
- unwrap() {
4791
- return this._def.innerType;
4792
- }
4793
- };
4794
- ZodReadonly.create = (type, params) => {
4795
- return new ZodReadonly({
4796
- innerType: type,
4797
- typeName: ZodFirstPartyTypeKind.ZodReadonly,
4798
- ...processCreateParams(params)
4799
- });
4800
- };
4801
4181
  late = {
4802
4182
  object: ZodObject.lazycreate
4803
4183
  };
@@ -4837,7 +4217,6 @@ var init_lib = __esm({
4837
4217
  ZodFirstPartyTypeKind2["ZodPromise"] = "ZodPromise";
4838
4218
  ZodFirstPartyTypeKind2["ZodBranded"] = "ZodBranded";
4839
4219
  ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline";
4840
- ZodFirstPartyTypeKind2["ZodReadonly"] = "ZodReadonly";
4841
4220
  })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
4842
4221
  stringType = ZodString.create;
4843
4222
  numberType = ZodNumber.create;
@@ -4876,10 +4255,7 @@ var init_lib = __esm({
4876
4255
  coerce = {
4877
4256
  string: (arg) => ZodString.create({ ...arg, coerce: true }),
4878
4257
  number: (arg) => ZodNumber.create({ ...arg, coerce: true }),
4879
- boolean: (arg) => ZodBoolean.create({
4880
- ...arg,
4881
- coerce: true
4882
- }),
4258
+ boolean: (arg) => ZodBoolean.create({ ...arg, coerce: true }),
4883
4259
  bigint: (arg) => ZodBigInt.create({ ...arg, coerce: true }),
4884
4260
  date: (arg) => ZodDate.create({ ...arg, coerce: true })
4885
4261
  };
@@ -5701,6 +5077,7 @@ var init_utils = __esm({
5701
5077
  init_mysqlSchema();
5702
5078
  init_pgSchema();
5703
5079
  init_sqliteSchema();
5080
+ init_source();
5704
5081
  init_global();
5705
5082
  copy = (it) => {
5706
5083
  return JSON.parse(JSON.stringify(it));
@@ -5905,6 +5282,7 @@ var sqlToStr;
5905
5282
  var init_serializer = __esm({
5906
5283
  "src/serializer/index.ts"() {
5907
5284
  "use strict";
5285
+ init_source();
5908
5286
  init_views();
5909
5287
  sqlToStr = (sql2) => {
5910
5288
  return sql2.toQuery({
@@ -6953,9 +6331,9 @@ var require_src2 = __commonJS({
6953
6331
  }
6954
6332
  });
6955
6333
 
6956
- // node_modules/.pnpm/esbuild-register@3.5.0_esbuild@0.19.12/node_modules/esbuild-register/dist/node.js
6334
+ // node_modules/.pnpm/esbuild-register@3.5.0_esbuild@0.19.7/node_modules/esbuild-register/dist/node.js
6957
6335
  var require_node2 = __commonJS({
6958
- "node_modules/.pnpm/esbuild-register@3.5.0_esbuild@0.19.12/node_modules/esbuild-register/dist/node.js"(exports) {
6336
+ "node_modules/.pnpm/esbuild-register@3.5.0_esbuild@0.19.7/node_modules/esbuild-register/dist/node.js"(exports) {
6959
6337
  "use strict";
6960
6338
  Object.defineProperty(exports, "__esModule", { value: true });
6961
6339
  function _interopRequireDefault2(obj) {
@@ -11816,6 +11194,7 @@ var init_utils2 = __esm({
11816
11194
  "src/cli/commands/utils.ts"() {
11817
11195
  "use strict";
11818
11196
  init_serializer();
11197
+ init_source();
11819
11198
  init_views();
11820
11199
  import_hanji2 = __toESM(require_hanji());
11821
11200
  init_global();
@@ -12792,10 +12171,10 @@ var require_brace_expansion = __commonJS({
12792
12171
  }
12793
12172
  });
12794
12173
 
12795
- // node_modules/.pnpm/minimatch@7.4.6/node_modules/minimatch/dist/mjs/brace-expressions.js
12174
+ // node_modules/.pnpm/minimatch@7.4.3/node_modules/minimatch/dist/mjs/brace-expressions.js
12796
12175
  var posixClasses, braceEscape, regexpEscape, rangesToString, parseClass;
12797
12176
  var init_brace_expressions = __esm({
12798
- "node_modules/.pnpm/minimatch@7.4.6/node_modules/minimatch/dist/mjs/brace-expressions.js"() {
12177
+ "node_modules/.pnpm/minimatch@7.4.3/node_modules/minimatch/dist/mjs/brace-expressions.js"() {
12799
12178
  posixClasses = {
12800
12179
  "[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true],
12801
12180
  "[:alpha:]": ["\\p{L}\\p{Nl}", true],
@@ -12907,30 +12286,30 @@ var init_brace_expressions = __esm({
12907
12286
  }
12908
12287
  });
12909
12288
 
12910
- // node_modules/.pnpm/minimatch@7.4.6/node_modules/minimatch/dist/mjs/escape.js
12289
+ // node_modules/.pnpm/minimatch@7.4.3/node_modules/minimatch/dist/mjs/escape.js
12911
12290
  var escape;
12912
12291
  var init_escape = __esm({
12913
- "node_modules/.pnpm/minimatch@7.4.6/node_modules/minimatch/dist/mjs/escape.js"() {
12292
+ "node_modules/.pnpm/minimatch@7.4.3/node_modules/minimatch/dist/mjs/escape.js"() {
12914
12293
  escape = (s, { windowsPathsNoEscape = false } = {}) => {
12915
12294
  return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
12916
12295
  };
12917
12296
  }
12918
12297
  });
12919
12298
 
12920
- // node_modules/.pnpm/minimatch@7.4.6/node_modules/minimatch/dist/mjs/unescape.js
12299
+ // node_modules/.pnpm/minimatch@7.4.3/node_modules/minimatch/dist/mjs/unescape.js
12921
12300
  var unescape;
12922
12301
  var init_unescape = __esm({
12923
- "node_modules/.pnpm/minimatch@7.4.6/node_modules/minimatch/dist/mjs/unescape.js"() {
12302
+ "node_modules/.pnpm/minimatch@7.4.3/node_modules/minimatch/dist/mjs/unescape.js"() {
12924
12303
  unescape = (s, { windowsPathsNoEscape = false } = {}) => {
12925
12304
  return windowsPathsNoEscape ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1");
12926
12305
  };
12927
12306
  }
12928
12307
  });
12929
12308
 
12930
- // node_modules/.pnpm/minimatch@7.4.6/node_modules/minimatch/dist/mjs/index.js
12309
+ // node_modules/.pnpm/minimatch@7.4.3/node_modules/minimatch/dist/mjs/index.js
12931
12310
  var import_brace_expansion, minimatch, starDotExtRE, starDotExtTest, starDotExtTestDot, starDotExtTestNocase, starDotExtTestNocaseDot, starDotStarRE, starDotStarTest, starDotStarTestDot, dotStarRE, dotStarTest, starRE, starTest, starTestDot, qmarksRE, qmarksTestNocase, qmarksTestNocaseDot, qmarksTestDot, qmarksTest, qmarksTestNoExt, qmarksTestNoExtDot, defaultPlatform, path, sep, GLOBSTAR, plTypes, qmark, star, twoStarDot, twoStarNoDot, charSet, reSpecials, addPatternStartSet, filter, ext, defaults, braceExpand, MAX_PATTERN_LENGTH, assertValidPattern, makeRe, match, globUnescape, globMagic, regExpEscape, Minimatch;
12932
12311
  var init_mjs = __esm({
12933
- "node_modules/.pnpm/minimatch@7.4.6/node_modules/minimatch/dist/mjs/index.js"() {
12312
+ "node_modules/.pnpm/minimatch@7.4.3/node_modules/minimatch/dist/mjs/index.js"() {
12934
12313
  import_brace_expansion = __toESM(require_brace_expansion(), 1);
12935
12314
  init_brace_expressions();
12936
12315
  init_escape();