drizzle-kit 0.30.6 → 0.31.0

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 (9) hide show
  1. package/api.d.mts +393 -393
  2. package/api.d.ts +393 -393
  3. package/api.js +1638 -1329
  4. package/api.mjs +1641 -1332
  5. package/bin.cjs +18883 -18385
  6. package/index.js +3 -3
  7. package/package.json +6 -6
  8. package/utils.js +193 -75
  9. package/utils.mjs +194 -77
package/utils.mjs CHANGED
@@ -8,8 +8,7 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
8
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
9
9
  get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
10
10
  }) : x)(function(x) {
11
- if (typeof require !== "undefined")
12
- return require.apply(this, arguments);
11
+ if (typeof require !== "undefined") return require.apply(this, arguments);
13
12
  throw Error('Dynamic require of "' + x + '" is not supported');
14
13
  });
15
14
  var __commonJS = (cb, mod) => function __require2() {
@@ -66,20 +65,15 @@ var require_src = __commonJS({
66
65
  var beep = "\x07";
67
66
  var cursor = {
68
67
  to(x, y) {
69
- if (!y)
70
- return `${CSI}${x + 1}G`;
68
+ if (!y) return `${CSI}${x + 1}G`;
71
69
  return `${CSI}${y + 1};${x + 1}H`;
72
70
  },
73
71
  move(x, y) {
74
72
  let ret = "";
75
- if (x < 0)
76
- ret += `${CSI}${-x}D`;
77
- else if (x > 0)
78
- ret += `${CSI}${x}C`;
79
- if (y < 0)
80
- ret += `${CSI}${-y}A`;
81
- else if (y > 0)
82
- ret += `${CSI}${y}B`;
73
+ if (x < 0) ret += `${CSI}${-x}D`;
74
+ else if (x > 0) ret += `${CSI}${x}C`;
75
+ if (y < 0) ret += `${CSI}${-y}A`;
76
+ else if (y > 0) ret += `${CSI}${y}B`;
83
77
  return ret;
84
78
  },
85
79
  up: (count = 1) => `${CSI}${count}A`,
@@ -562,7 +556,7 @@ var require_hanji = __commonJS({
562
556
  }
563
557
  });
564
558
 
565
- // ../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/ansi-styles/index.js
559
+ // ../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/vendor/ansi-styles/index.js
566
560
  var ANSI_BACKGROUND_OFFSET = 10;
567
561
  var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
568
562
  var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
@@ -748,7 +742,7 @@ function assembleStyles() {
748
742
  var ansiStyles = assembleStyles();
749
743
  var ansi_styles_default = ansiStyles;
750
744
 
751
- // ../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/supports-color/index.js
745
+ // ../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/vendor/supports-color/index.js
752
746
  import process2 from "node:process";
753
747
  import os from "node:os";
754
748
  import tty from "node:tty";
@@ -822,10 +816,10 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
822
816
  return 1;
823
817
  }
824
818
  if ("CI" in env) {
825
- if ("GITHUB_ACTIONS" in env || "GITEA_ACTIONS" in env) {
819
+ if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => key in env)) {
826
820
  return 3;
827
821
  }
828
- if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
822
+ if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
829
823
  return 1;
830
824
  }
831
825
  return min;
@@ -874,7 +868,7 @@ var supportsColor = {
874
868
  };
875
869
  var supports_color_default = supportsColor;
876
870
 
877
- // ../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/utilities.js
871
+ // ../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/utilities.js
878
872
  function stringReplaceAll(string, substring, replacer) {
879
873
  let index6 = string.indexOf(substring);
880
874
  if (index6 === -1) {
@@ -904,7 +898,7 @@ function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index6) {
904
898
  return returnValue;
905
899
  }
906
900
 
907
- // ../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/index.js
901
+ // ../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/index.js
908
902
  var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
909
903
  var GENERATOR = Symbol("GENERATOR");
910
904
  var STYLER = Symbol("STYLER");
@@ -1069,7 +1063,7 @@ function assertUnreachable(x) {
1069
1063
  throw new Error("Didn't expect to get here");
1070
1064
  }
1071
1065
 
1072
- // ../node_modules/.pnpm/zod@3.23.7/node_modules/zod/lib/index.mjs
1066
+ // ../node_modules/.pnpm/zod@3.24.2/node_modules/zod/lib/index.mjs
1073
1067
  var util;
1074
1068
  (function(util2) {
1075
1069
  util2.assertEqual = (val) => val;
@@ -1220,6 +1214,9 @@ var ZodIssueCode = util.arrayToEnum([
1220
1214
  "not_finite"
1221
1215
  ]);
1222
1216
  var ZodError = class _ZodError extends Error {
1217
+ get errors() {
1218
+ return this.issues;
1219
+ }
1223
1220
  constructor(issues) {
1224
1221
  super();
1225
1222
  this.issues = [];
@@ -1238,9 +1235,6 @@ var ZodError = class _ZodError extends Error {
1238
1235
  this.name = "ZodError";
1239
1236
  this.issues = issues;
1240
1237
  }
1241
- get errors() {
1242
- return this.issues;
1243
- }
1244
1238
  format(_mapper) {
1245
1239
  const mapper = _mapper || function(issue) {
1246
1240
  return issue.message;
@@ -1447,8 +1441,11 @@ function addIssueToContext(ctx, issueData) {
1447
1441
  path: ctx.path,
1448
1442
  errorMaps: [
1449
1443
  ctx.common.contextualErrorMap,
1444
+ // contextual error map is first priority
1450
1445
  ctx.schemaErrorMap,
1446
+ // then schema-bound map if available
1451
1447
  overrideMap,
1448
+ // then global override map
1452
1449
  overrideMap === errorMap ? void 0 : errorMap
1453
1450
  // then global default map
1454
1451
  ].filter((x) => !!x)
@@ -1519,19 +1516,14 @@ var isDirty = (x) => x.status === "dirty";
1519
1516
  var isValid = (x) => x.status === "valid";
1520
1517
  var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
1521
1518
  function __classPrivateFieldGet(receiver, state, kind, f) {
1522
- if (kind === "a" && !f)
1523
- throw new TypeError("Private accessor was defined without a getter");
1524
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
1525
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
1519
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
1520
+ 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");
1526
1521
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
1527
1522
  }
1528
1523
  function __classPrivateFieldSet(receiver, state, value, kind, f) {
1529
- if (kind === "m")
1530
- throw new TypeError("Private method is not writable");
1531
- if (kind === "a" && !f)
1532
- throw new TypeError("Private accessor was defined without a setter");
1533
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
1534
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
1524
+ if (kind === "m") throw new TypeError("Private method is not writable");
1525
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
1526
+ 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");
1535
1527
  return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
1536
1528
  }
1537
1529
  var errorUtil;
@@ -1604,34 +1596,6 @@ function processCreateParams(params) {
1604
1596
  return { errorMap: customMap, description };
1605
1597
  }
1606
1598
  var ZodType = class {
1607
- constructor(def) {
1608
- this.spa = this.safeParseAsync;
1609
- this._def = def;
1610
- this.parse = this.parse.bind(this);
1611
- this.safeParse = this.safeParse.bind(this);
1612
- this.parseAsync = this.parseAsync.bind(this);
1613
- this.safeParseAsync = this.safeParseAsync.bind(this);
1614
- this.spa = this.spa.bind(this);
1615
- this.refine = this.refine.bind(this);
1616
- this.refinement = this.refinement.bind(this);
1617
- this.superRefine = this.superRefine.bind(this);
1618
- this.optional = this.optional.bind(this);
1619
- this.nullable = this.nullable.bind(this);
1620
- this.nullish = this.nullish.bind(this);
1621
- this.array = this.array.bind(this);
1622
- this.promise = this.promise.bind(this);
1623
- this.or = this.or.bind(this);
1624
- this.and = this.and.bind(this);
1625
- this.transform = this.transform.bind(this);
1626
- this.brand = this.brand.bind(this);
1627
- this.default = this.default.bind(this);
1628
- this.catch = this.catch.bind(this);
1629
- this.describe = this.describe.bind(this);
1630
- this.pipe = this.pipe.bind(this);
1631
- this.readonly = this.readonly.bind(this);
1632
- this.isNullable = this.isNullable.bind(this);
1633
- this.isOptional = this.isOptional.bind(this);
1634
- }
1635
1599
  get description() {
1636
1600
  return this._def.description;
1637
1601
  }
@@ -1695,6 +1659,43 @@ var ZodType = class {
1695
1659
  const result = this._parseSync({ data, path: ctx.path, parent: ctx });
1696
1660
  return handleResult(ctx, result);
1697
1661
  }
1662
+ "~validate"(data) {
1663
+ var _a, _b;
1664
+ const ctx = {
1665
+ common: {
1666
+ issues: [],
1667
+ async: !!this["~standard"].async
1668
+ },
1669
+ path: [],
1670
+ schemaErrorMap: this._def.errorMap,
1671
+ parent: null,
1672
+ data,
1673
+ parsedType: getParsedType(data)
1674
+ };
1675
+ if (!this["~standard"].async) {
1676
+ try {
1677
+ const result = this._parseSync({ data, path: [], parent: ctx });
1678
+ return isValid(result) ? {
1679
+ value: result.value
1680
+ } : {
1681
+ issues: ctx.common.issues
1682
+ };
1683
+ } catch (err) {
1684
+ 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")) {
1685
+ this["~standard"].async = true;
1686
+ }
1687
+ ctx.common = {
1688
+ issues: [],
1689
+ async: true
1690
+ };
1691
+ }
1692
+ }
1693
+ return this._parseAsync({ data, path: [], parent: ctx }).then((result) => isValid(result) ? {
1694
+ value: result.value
1695
+ } : {
1696
+ issues: ctx.common.issues
1697
+ });
1698
+ }
1698
1699
  async parseAsync(data, params) {
1699
1700
  const result = await this.safeParseAsync(data, params);
1700
1701
  if (result.success)
@@ -1772,6 +1773,39 @@ var ZodType = class {
1772
1773
  superRefine(refinement) {
1773
1774
  return this._refinement(refinement);
1774
1775
  }
1776
+ constructor(def) {
1777
+ this.spa = this.safeParseAsync;
1778
+ this._def = def;
1779
+ this.parse = this.parse.bind(this);
1780
+ this.safeParse = this.safeParse.bind(this);
1781
+ this.parseAsync = this.parseAsync.bind(this);
1782
+ this.safeParseAsync = this.safeParseAsync.bind(this);
1783
+ this.spa = this.spa.bind(this);
1784
+ this.refine = this.refine.bind(this);
1785
+ this.refinement = this.refinement.bind(this);
1786
+ this.superRefine = this.superRefine.bind(this);
1787
+ this.optional = this.optional.bind(this);
1788
+ this.nullable = this.nullable.bind(this);
1789
+ this.nullish = this.nullish.bind(this);
1790
+ this.array = this.array.bind(this);
1791
+ this.promise = this.promise.bind(this);
1792
+ this.or = this.or.bind(this);
1793
+ this.and = this.and.bind(this);
1794
+ this.transform = this.transform.bind(this);
1795
+ this.brand = this.brand.bind(this);
1796
+ this.default = this.default.bind(this);
1797
+ this.catch = this.catch.bind(this);
1798
+ this.describe = this.describe.bind(this);
1799
+ this.pipe = this.pipe.bind(this);
1800
+ this.readonly = this.readonly.bind(this);
1801
+ this.isNullable = this.isNullable.bind(this);
1802
+ this.isOptional = this.isOptional.bind(this);
1803
+ this["~standard"] = {
1804
+ version: 1,
1805
+ vendor: "zod",
1806
+ validate: (data) => this["~validate"](data)
1807
+ };
1808
+ }
1775
1809
  optional() {
1776
1810
  return ZodOptional.create(this, this._def);
1777
1811
  }
@@ -1782,7 +1816,7 @@ var ZodType = class {
1782
1816
  return this.nullable().optional();
1783
1817
  }
1784
1818
  array() {
1785
- return ZodArray.create(this, this._def);
1819
+ return ZodArray.create(this);
1786
1820
  }
1787
1821
  promise() {
1788
1822
  return ZodPromise.create(this, this._def);
@@ -1848,16 +1882,20 @@ var ZodType = class {
1848
1882
  };
1849
1883
  var cuidRegex = /^c[^\s-]{8,}$/i;
1850
1884
  var cuid2Regex = /^[0-9a-z]+$/;
1851
- var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/;
1885
+ var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i;
1852
1886
  var 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;
1853
1887
  var nanoidRegex = /^[a-z0-9_-]{21}$/i;
1888
+ var jwtRegex = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;
1854
1889
  var 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)?)??$/;
1855
1890
  var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
1856
1891
  var _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
1857
1892
  var emojiRegex;
1858
1893
  var 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])$/;
1859
- var 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})))$/;
1894
+ var ipv4CidrRegex = /^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/;
1895
+ var ipv6Regex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;
1896
+ var ipv6CidrRegex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
1860
1897
  var base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
1898
+ var base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;
1861
1899
  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])))`;
1862
1900
  var dateRegex = new RegExp(`^${dateRegexSource}$`);
1863
1901
  function timeRegexSource(args) {
@@ -1890,6 +1928,33 @@ function isValidIP(ip, version) {
1890
1928
  }
1891
1929
  return false;
1892
1930
  }
1931
+ function isValidJWT(jwt, alg) {
1932
+ if (!jwtRegex.test(jwt))
1933
+ return false;
1934
+ try {
1935
+ const [header] = jwt.split(".");
1936
+ const base64 = header.replace(/-/g, "+").replace(/_/g, "/").padEnd(header.length + (4 - header.length % 4) % 4, "=");
1937
+ const decoded = JSON.parse(atob(base64));
1938
+ if (typeof decoded !== "object" || decoded === null)
1939
+ return false;
1940
+ if (!decoded.typ || !decoded.alg)
1941
+ return false;
1942
+ if (alg && decoded.alg !== alg)
1943
+ return false;
1944
+ return true;
1945
+ } catch (_a) {
1946
+ return false;
1947
+ }
1948
+ }
1949
+ function isValidCidr(ip, version) {
1950
+ if ((version === "v4" || !version) && ipv4CidrRegex.test(ip)) {
1951
+ return true;
1952
+ }
1953
+ if ((version === "v6" || !version) && ipv6CidrRegex.test(ip)) {
1954
+ return true;
1955
+ }
1956
+ return false;
1957
+ }
1893
1958
  var ZodString = class _ZodString extends ZodType {
1894
1959
  _parse(input) {
1895
1960
  if (this._def.coerce) {
@@ -2146,6 +2211,26 @@ var ZodString = class _ZodString extends ZodType {
2146
2211
  });
2147
2212
  status.dirty();
2148
2213
  }
2214
+ } else if (check.kind === "jwt") {
2215
+ if (!isValidJWT(input.data, check.alg)) {
2216
+ ctx = this._getOrReturnCtx(input, ctx);
2217
+ addIssueToContext(ctx, {
2218
+ validation: "jwt",
2219
+ code: ZodIssueCode.invalid_string,
2220
+ message: check.message
2221
+ });
2222
+ status.dirty();
2223
+ }
2224
+ } else if (check.kind === "cidr") {
2225
+ if (!isValidCidr(input.data, check.version)) {
2226
+ ctx = this._getOrReturnCtx(input, ctx);
2227
+ addIssueToContext(ctx, {
2228
+ validation: "cidr",
2229
+ code: ZodIssueCode.invalid_string,
2230
+ message: check.message
2231
+ });
2232
+ status.dirty();
2233
+ }
2149
2234
  } else if (check.kind === "base64") {
2150
2235
  if (!base64Regex.test(input.data)) {
2151
2236
  ctx = this._getOrReturnCtx(input, ctx);
@@ -2156,6 +2241,16 @@ var ZodString = class _ZodString extends ZodType {
2156
2241
  });
2157
2242
  status.dirty();
2158
2243
  }
2244
+ } else if (check.kind === "base64url") {
2245
+ if (!base64urlRegex.test(input.data)) {
2246
+ ctx = this._getOrReturnCtx(input, ctx);
2247
+ addIssueToContext(ctx, {
2248
+ validation: "base64url",
2249
+ code: ZodIssueCode.invalid_string,
2250
+ message: check.message
2251
+ });
2252
+ status.dirty();
2253
+ }
2159
2254
  } else {
2160
2255
  util.assertNever(check);
2161
2256
  }
@@ -2202,9 +2297,21 @@ var ZodString = class _ZodString extends ZodType {
2202
2297
  base64(message) {
2203
2298
  return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });
2204
2299
  }
2300
+ base64url(message) {
2301
+ return this._addCheck({
2302
+ kind: "base64url",
2303
+ ...errorUtil.errToObj(message)
2304
+ });
2305
+ }
2306
+ jwt(options) {
2307
+ return this._addCheck({ kind: "jwt", ...errorUtil.errToObj(options) });
2308
+ }
2205
2309
  ip(options) {
2206
2310
  return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
2207
2311
  }
2312
+ cidr(options) {
2313
+ return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options) });
2314
+ }
2208
2315
  datetime(options) {
2209
2316
  var _a, _b;
2210
2317
  if (typeof options === "string") {
@@ -2295,8 +2402,7 @@ var ZodString = class _ZodString extends ZodType {
2295
2402
  });
2296
2403
  }
2297
2404
  /**
2298
- * @deprecated Use z.string().min(1) instead.
2299
- * @see {@link ZodString.min}
2405
+ * Equivalent to `.min(1)`
2300
2406
  */
2301
2407
  nonempty(message) {
2302
2408
  return this.min(1, errorUtil.errToObj(message));
@@ -2358,9 +2464,15 @@ var ZodString = class _ZodString extends ZodType {
2358
2464
  get isIP() {
2359
2465
  return !!this._def.checks.find((ch) => ch.kind === "ip");
2360
2466
  }
2467
+ get isCIDR() {
2468
+ return !!this._def.checks.find((ch) => ch.kind === "cidr");
2469
+ }
2361
2470
  get isBase64() {
2362
2471
  return !!this._def.checks.find((ch) => ch.kind === "base64");
2363
2472
  }
2473
+ get isBase64url() {
2474
+ return !!this._def.checks.find((ch) => ch.kind === "base64url");
2475
+ }
2364
2476
  get minLength() {
2365
2477
  let min = null;
2366
2478
  for (const ch of this._def.checks) {
@@ -2638,17 +2750,15 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
2638
2750
  }
2639
2751
  _parse(input) {
2640
2752
  if (this._def.coerce) {
2641
- input.data = BigInt(input.data);
2753
+ try {
2754
+ input.data = BigInt(input.data);
2755
+ } catch (_a) {
2756
+ return this._getInvalidInput(input);
2757
+ }
2642
2758
  }
2643
2759
  const parsedType = this._getType(input);
2644
2760
  if (parsedType !== ZodParsedType.bigint) {
2645
- const ctx2 = this._getOrReturnCtx(input);
2646
- addIssueToContext(ctx2, {
2647
- code: ZodIssueCode.invalid_type,
2648
- expected: ZodParsedType.bigint,
2649
- received: ctx2.parsedType
2650
- });
2651
- return INVALID;
2761
+ return this._getInvalidInput(input);
2652
2762
  }
2653
2763
  let ctx = void 0;
2654
2764
  const status = new ParseStatus();
@@ -2695,6 +2805,15 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
2695
2805
  }
2696
2806
  return { status: status.value, value: input.data };
2697
2807
  }
2808
+ _getInvalidInput(input) {
2809
+ const ctx = this._getOrReturnCtx(input);
2810
+ addIssueToContext(ctx, {
2811
+ code: ZodIssueCode.invalid_type,
2812
+ expected: ZodParsedType.bigint,
2813
+ received: ctx.parsedType
2814
+ });
2815
+ return INVALID;
2816
+ }
2698
2817
  gte(value, message) {
2699
2818
  return this.setLimit("min", value, true, errorUtil.toString(message));
2700
2819
  }
@@ -3250,8 +3369,7 @@ var ZodObject = class _ZodObject extends ZodType {
3250
3369
  });
3251
3370
  status.dirty();
3252
3371
  }
3253
- } else if (unknownKeys === "strip")
3254
- ;
3372
+ } else if (unknownKeys === "strip") ;
3255
3373
  else {
3256
3374
  throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);
3257
3375
  }
@@ -6021,8 +6139,7 @@ var objectValues = (obj) => {
6021
6139
  return Object.values(obj);
6022
6140
  };
6023
6141
  var assertV1OutFolder = (out) => {
6024
- if (!existsSync(out))
6025
- return;
6142
+ if (!existsSync(out)) return;
6026
6143
  const oldMigrationFolders = readdirSync(out).filter(
6027
6144
  (it) => it.length === 14 && /^\d+$/.test(it)
6028
6145
  );