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/index.js CHANGED
@@ -18,11 +18,11 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
20
  // src/index.ts
21
- var src_exports = {};
22
- __export(src_exports, {
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
23
  defineConfig: () => defineConfig
24
24
  });
25
- module.exports = __toCommonJS(src_exports);
25
+ module.exports = __toCommonJS(index_exports);
26
26
  function defineConfig(config) {
27
27
  return config;
28
28
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-kit",
3
- "version": "0.30.6",
3
+ "version": "0.31.0",
4
4
  "homepage": "https://orm.drizzle.team",
5
5
  "keywords": [
6
6
  "drizzle",
@@ -45,9 +45,8 @@
45
45
  "dependencies": {
46
46
  "@drizzle-team/brocli": "^0.10.2",
47
47
  "@esbuild-kit/esm-loader": "^2.5.5",
48
- "esbuild": "^0.19.7",
49
- "esbuild-register": "^3.5.0",
50
- "gel": "^2.0.0"
48
+ "esbuild": "^0.25.2",
49
+ "esbuild-register": "^3.5.0"
51
50
  },
52
51
  "devDependencies": {
53
52
  "@arethetypeswrong/cli": "^0.15.3",
@@ -60,7 +59,7 @@
60
59
  "@neondatabase/serverless": "^0.9.1",
61
60
  "@originjs/vite-plugin-commonjs": "^1.0.3",
62
61
  "@planetscale/database": "^1.16.0",
63
- "@types/better-sqlite3": "^7.6.4",
62
+ "@types/better-sqlite3": "^7.6.13",
64
63
  "@types/dockerode": "^3.3.28",
65
64
  "@types/glob": "^8.1.0",
66
65
  "@types/json-diff": "^1.0.3",
@@ -76,7 +75,7 @@
76
75
  "@typescript-eslint/parser": "^7.2.0",
77
76
  "@vercel/postgres": "^0.8.0",
78
77
  "ava": "^5.1.0",
79
- "better-sqlite3": "^9.4.3",
78
+ "better-sqlite3": "^11.9.1",
80
79
  "bun-types": "^0.6.6",
81
80
  "camelcase": "^7.0.1",
82
81
  "chalk": "^5.2.0",
@@ -90,6 +89,7 @@
90
89
  "eslint": "^8.57.0",
91
90
  "eslint-config-prettier": "^9.1.0",
92
91
  "eslint-plugin-prettier": "^5.1.3",
92
+ "gel": "^2.0.0",
93
93
  "get-port": "^6.1.2",
94
94
  "glob": "^8.1.0",
95
95
  "hanji": "^0.0.5",
package/utils.js CHANGED
@@ -65,20 +65,15 @@ var require_src = __commonJS({
65
65
  var beep = "\x07";
66
66
  var cursor = {
67
67
  to(x, y) {
68
- if (!y)
69
- return `${CSI}${x + 1}G`;
68
+ if (!y) return `${CSI}${x + 1}G`;
70
69
  return `${CSI}${y + 1};${x + 1}H`;
71
70
  },
72
71
  move(x, y) {
73
72
  let ret = "";
74
- if (x < 0)
75
- ret += `${CSI}${-x}D`;
76
- else if (x > 0)
77
- ret += `${CSI}${x}C`;
78
- if (y < 0)
79
- ret += `${CSI}${-y}A`;
80
- else if (y > 0)
81
- 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`;
82
77
  return ret;
83
78
  },
84
79
  up: (count = 1) => `${CSI}${count}A`,
@@ -585,7 +580,7 @@ __export(utils_exports, {
585
580
  });
586
581
  module.exports = __toCommonJS(utils_exports);
587
582
 
588
- // ../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/ansi-styles/index.js
583
+ // ../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/vendor/ansi-styles/index.js
589
584
  var ANSI_BACKGROUND_OFFSET = 10;
590
585
  var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
591
586
  var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
@@ -771,7 +766,7 @@ function assembleStyles() {
771
766
  var ansiStyles = assembleStyles();
772
767
  var ansi_styles_default = ansiStyles;
773
768
 
774
- // ../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/supports-color/index.js
769
+ // ../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/vendor/supports-color/index.js
775
770
  var import_node_process = __toESM(require("node:process"), 1);
776
771
  var import_node_os = __toESM(require("node:os"), 1);
777
772
  var import_node_tty = __toESM(require("node:tty"), 1);
@@ -845,10 +840,10 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
845
840
  return 1;
846
841
  }
847
842
  if ("CI" in env) {
848
- if ("GITHUB_ACTIONS" in env || "GITEA_ACTIONS" in env) {
843
+ if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => key in env)) {
849
844
  return 3;
850
845
  }
851
- if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
846
+ if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
852
847
  return 1;
853
848
  }
854
849
  return min;
@@ -897,7 +892,7 @@ var supportsColor = {
897
892
  };
898
893
  var supports_color_default = supportsColor;
899
894
 
900
- // ../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/utilities.js
895
+ // ../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/utilities.js
901
896
  function stringReplaceAll(string, substring, replacer) {
902
897
  let index6 = string.indexOf(substring);
903
898
  if (index6 === -1) {
@@ -927,7 +922,7 @@ function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index6) {
927
922
  return returnValue;
928
923
  }
929
924
 
930
- // ../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/index.js
925
+ // ../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/index.js
931
926
  var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
932
927
  var GENERATOR = Symbol("GENERATOR");
933
928
  var STYLER = Symbol("STYLER");
@@ -1092,7 +1087,7 @@ function assertUnreachable(x) {
1092
1087
  throw new Error("Didn't expect to get here");
1093
1088
  }
1094
1089
 
1095
- // ../node_modules/.pnpm/zod@3.23.7/node_modules/zod/lib/index.mjs
1090
+ // ../node_modules/.pnpm/zod@3.24.2/node_modules/zod/lib/index.mjs
1096
1091
  var util;
1097
1092
  (function(util2) {
1098
1093
  util2.assertEqual = (val) => val;
@@ -1243,6 +1238,9 @@ var ZodIssueCode = util.arrayToEnum([
1243
1238
  "not_finite"
1244
1239
  ]);
1245
1240
  var ZodError = class _ZodError extends Error {
1241
+ get errors() {
1242
+ return this.issues;
1243
+ }
1246
1244
  constructor(issues) {
1247
1245
  super();
1248
1246
  this.issues = [];
@@ -1261,9 +1259,6 @@ var ZodError = class _ZodError extends Error {
1261
1259
  this.name = "ZodError";
1262
1260
  this.issues = issues;
1263
1261
  }
1264
- get errors() {
1265
- return this.issues;
1266
- }
1267
1262
  format(_mapper) {
1268
1263
  const mapper = _mapper || function(issue) {
1269
1264
  return issue.message;
@@ -1470,8 +1465,11 @@ function addIssueToContext(ctx, issueData) {
1470
1465
  path: ctx.path,
1471
1466
  errorMaps: [
1472
1467
  ctx.common.contextualErrorMap,
1468
+ // contextual error map is first priority
1473
1469
  ctx.schemaErrorMap,
1470
+ // then schema-bound map if available
1474
1471
  overrideMap,
1472
+ // then global override map
1475
1473
  overrideMap === errorMap ? void 0 : errorMap
1476
1474
  // then global default map
1477
1475
  ].filter((x) => !!x)
@@ -1542,19 +1540,14 @@ var isDirty = (x) => x.status === "dirty";
1542
1540
  var isValid = (x) => x.status === "valid";
1543
1541
  var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
1544
1542
  function __classPrivateFieldGet(receiver, state, kind, f) {
1545
- if (kind === "a" && !f)
1546
- throw new TypeError("Private accessor was defined without a getter");
1547
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
1548
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
1543
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
1544
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
1549
1545
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
1550
1546
  }
1551
1547
  function __classPrivateFieldSet(receiver, state, value, kind, f) {
1552
- if (kind === "m")
1553
- throw new TypeError("Private method is not writable");
1554
- if (kind === "a" && !f)
1555
- throw new TypeError("Private accessor was defined without a setter");
1556
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
1557
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
1548
+ if (kind === "m") throw new TypeError("Private method is not writable");
1549
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
1550
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
1558
1551
  return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
1559
1552
  }
1560
1553
  var errorUtil;
@@ -1627,34 +1620,6 @@ function processCreateParams(params) {
1627
1620
  return { errorMap: customMap, description };
1628
1621
  }
1629
1622
  var ZodType = class {
1630
- constructor(def) {
1631
- this.spa = this.safeParseAsync;
1632
- this._def = def;
1633
- this.parse = this.parse.bind(this);
1634
- this.safeParse = this.safeParse.bind(this);
1635
- this.parseAsync = this.parseAsync.bind(this);
1636
- this.safeParseAsync = this.safeParseAsync.bind(this);
1637
- this.spa = this.spa.bind(this);
1638
- this.refine = this.refine.bind(this);
1639
- this.refinement = this.refinement.bind(this);
1640
- this.superRefine = this.superRefine.bind(this);
1641
- this.optional = this.optional.bind(this);
1642
- this.nullable = this.nullable.bind(this);
1643
- this.nullish = this.nullish.bind(this);
1644
- this.array = this.array.bind(this);
1645
- this.promise = this.promise.bind(this);
1646
- this.or = this.or.bind(this);
1647
- this.and = this.and.bind(this);
1648
- this.transform = this.transform.bind(this);
1649
- this.brand = this.brand.bind(this);
1650
- this.default = this.default.bind(this);
1651
- this.catch = this.catch.bind(this);
1652
- this.describe = this.describe.bind(this);
1653
- this.pipe = this.pipe.bind(this);
1654
- this.readonly = this.readonly.bind(this);
1655
- this.isNullable = this.isNullable.bind(this);
1656
- this.isOptional = this.isOptional.bind(this);
1657
- }
1658
1623
  get description() {
1659
1624
  return this._def.description;
1660
1625
  }
@@ -1718,6 +1683,43 @@ var ZodType = class {
1718
1683
  const result = this._parseSync({ data, path: ctx.path, parent: ctx });
1719
1684
  return handleResult(ctx, result);
1720
1685
  }
1686
+ "~validate"(data) {
1687
+ var _a, _b;
1688
+ const ctx = {
1689
+ common: {
1690
+ issues: [],
1691
+ async: !!this["~standard"].async
1692
+ },
1693
+ path: [],
1694
+ schemaErrorMap: this._def.errorMap,
1695
+ parent: null,
1696
+ data,
1697
+ parsedType: getParsedType(data)
1698
+ };
1699
+ if (!this["~standard"].async) {
1700
+ try {
1701
+ const result = this._parseSync({ data, path: [], parent: ctx });
1702
+ return isValid(result) ? {
1703
+ value: result.value
1704
+ } : {
1705
+ issues: ctx.common.issues
1706
+ };
1707
+ } catch (err) {
1708
+ if ((_b = (_a = err === null || err === void 0 ? void 0 : err.message) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === null || _b === void 0 ? void 0 : _b.includes("encountered")) {
1709
+ this["~standard"].async = true;
1710
+ }
1711
+ ctx.common = {
1712
+ issues: [],
1713
+ async: true
1714
+ };
1715
+ }
1716
+ }
1717
+ return this._parseAsync({ data, path: [], parent: ctx }).then((result) => isValid(result) ? {
1718
+ value: result.value
1719
+ } : {
1720
+ issues: ctx.common.issues
1721
+ });
1722
+ }
1721
1723
  async parseAsync(data, params) {
1722
1724
  const result = await this.safeParseAsync(data, params);
1723
1725
  if (result.success)
@@ -1795,6 +1797,39 @@ var ZodType = class {
1795
1797
  superRefine(refinement) {
1796
1798
  return this._refinement(refinement);
1797
1799
  }
1800
+ constructor(def) {
1801
+ this.spa = this.safeParseAsync;
1802
+ this._def = def;
1803
+ this.parse = this.parse.bind(this);
1804
+ this.safeParse = this.safeParse.bind(this);
1805
+ this.parseAsync = this.parseAsync.bind(this);
1806
+ this.safeParseAsync = this.safeParseAsync.bind(this);
1807
+ this.spa = this.spa.bind(this);
1808
+ this.refine = this.refine.bind(this);
1809
+ this.refinement = this.refinement.bind(this);
1810
+ this.superRefine = this.superRefine.bind(this);
1811
+ this.optional = this.optional.bind(this);
1812
+ this.nullable = this.nullable.bind(this);
1813
+ this.nullish = this.nullish.bind(this);
1814
+ this.array = this.array.bind(this);
1815
+ this.promise = this.promise.bind(this);
1816
+ this.or = this.or.bind(this);
1817
+ this.and = this.and.bind(this);
1818
+ this.transform = this.transform.bind(this);
1819
+ this.brand = this.brand.bind(this);
1820
+ this.default = this.default.bind(this);
1821
+ this.catch = this.catch.bind(this);
1822
+ this.describe = this.describe.bind(this);
1823
+ this.pipe = this.pipe.bind(this);
1824
+ this.readonly = this.readonly.bind(this);
1825
+ this.isNullable = this.isNullable.bind(this);
1826
+ this.isOptional = this.isOptional.bind(this);
1827
+ this["~standard"] = {
1828
+ version: 1,
1829
+ vendor: "zod",
1830
+ validate: (data) => this["~validate"](data)
1831
+ };
1832
+ }
1798
1833
  optional() {
1799
1834
  return ZodOptional.create(this, this._def);
1800
1835
  }
@@ -1805,7 +1840,7 @@ var ZodType = class {
1805
1840
  return this.nullable().optional();
1806
1841
  }
1807
1842
  array() {
1808
- return ZodArray.create(this, this._def);
1843
+ return ZodArray.create(this);
1809
1844
  }
1810
1845
  promise() {
1811
1846
  return ZodPromise.create(this, this._def);
@@ -1871,16 +1906,20 @@ var ZodType = class {
1871
1906
  };
1872
1907
  var cuidRegex = /^c[^\s-]{8,}$/i;
1873
1908
  var cuid2Regex = /^[0-9a-z]+$/;
1874
- var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/;
1909
+ var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i;
1875
1910
  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;
1876
1911
  var nanoidRegex = /^[a-z0-9_-]{21}$/i;
1912
+ var jwtRegex = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;
1877
1913
  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)?)??$/;
1878
1914
  var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
1879
1915
  var _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
1880
1916
  var emojiRegex;
1881
1917
  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])$/;
1882
- 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})))$/;
1918
+ 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])$/;
1919
+ 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]))$/;
1920
+ 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])$/;
1883
1921
  var base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
1922
+ var base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;
1884
1923
  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])))`;
1885
1924
  var dateRegex = new RegExp(`^${dateRegexSource}$`);
1886
1925
  function timeRegexSource(args) {
@@ -1913,6 +1952,33 @@ function isValidIP(ip, version) {
1913
1952
  }
1914
1953
  return false;
1915
1954
  }
1955
+ function isValidJWT(jwt, alg) {
1956
+ if (!jwtRegex.test(jwt))
1957
+ return false;
1958
+ try {
1959
+ const [header] = jwt.split(".");
1960
+ const base64 = header.replace(/-/g, "+").replace(/_/g, "/").padEnd(header.length + (4 - header.length % 4) % 4, "=");
1961
+ const decoded = JSON.parse(atob(base64));
1962
+ if (typeof decoded !== "object" || decoded === null)
1963
+ return false;
1964
+ if (!decoded.typ || !decoded.alg)
1965
+ return false;
1966
+ if (alg && decoded.alg !== alg)
1967
+ return false;
1968
+ return true;
1969
+ } catch (_a) {
1970
+ return false;
1971
+ }
1972
+ }
1973
+ function isValidCidr(ip, version) {
1974
+ if ((version === "v4" || !version) && ipv4CidrRegex.test(ip)) {
1975
+ return true;
1976
+ }
1977
+ if ((version === "v6" || !version) && ipv6CidrRegex.test(ip)) {
1978
+ return true;
1979
+ }
1980
+ return false;
1981
+ }
1916
1982
  var ZodString = class _ZodString extends ZodType {
1917
1983
  _parse(input) {
1918
1984
  if (this._def.coerce) {
@@ -2169,6 +2235,26 @@ var ZodString = class _ZodString extends ZodType {
2169
2235
  });
2170
2236
  status.dirty();
2171
2237
  }
2238
+ } else if (check.kind === "jwt") {
2239
+ if (!isValidJWT(input.data, check.alg)) {
2240
+ ctx = this._getOrReturnCtx(input, ctx);
2241
+ addIssueToContext(ctx, {
2242
+ validation: "jwt",
2243
+ code: ZodIssueCode.invalid_string,
2244
+ message: check.message
2245
+ });
2246
+ status.dirty();
2247
+ }
2248
+ } else if (check.kind === "cidr") {
2249
+ if (!isValidCidr(input.data, check.version)) {
2250
+ ctx = this._getOrReturnCtx(input, ctx);
2251
+ addIssueToContext(ctx, {
2252
+ validation: "cidr",
2253
+ code: ZodIssueCode.invalid_string,
2254
+ message: check.message
2255
+ });
2256
+ status.dirty();
2257
+ }
2172
2258
  } else if (check.kind === "base64") {
2173
2259
  if (!base64Regex.test(input.data)) {
2174
2260
  ctx = this._getOrReturnCtx(input, ctx);
@@ -2179,6 +2265,16 @@ var ZodString = class _ZodString extends ZodType {
2179
2265
  });
2180
2266
  status.dirty();
2181
2267
  }
2268
+ } else if (check.kind === "base64url") {
2269
+ if (!base64urlRegex.test(input.data)) {
2270
+ ctx = this._getOrReturnCtx(input, ctx);
2271
+ addIssueToContext(ctx, {
2272
+ validation: "base64url",
2273
+ code: ZodIssueCode.invalid_string,
2274
+ message: check.message
2275
+ });
2276
+ status.dirty();
2277
+ }
2182
2278
  } else {
2183
2279
  util.assertNever(check);
2184
2280
  }
@@ -2225,9 +2321,21 @@ var ZodString = class _ZodString extends ZodType {
2225
2321
  base64(message) {
2226
2322
  return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });
2227
2323
  }
2324
+ base64url(message) {
2325
+ return this._addCheck({
2326
+ kind: "base64url",
2327
+ ...errorUtil.errToObj(message)
2328
+ });
2329
+ }
2330
+ jwt(options) {
2331
+ return this._addCheck({ kind: "jwt", ...errorUtil.errToObj(options) });
2332
+ }
2228
2333
  ip(options) {
2229
2334
  return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
2230
2335
  }
2336
+ cidr(options) {
2337
+ return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options) });
2338
+ }
2231
2339
  datetime(options) {
2232
2340
  var _a, _b;
2233
2341
  if (typeof options === "string") {
@@ -2318,8 +2426,7 @@ var ZodString = class _ZodString extends ZodType {
2318
2426
  });
2319
2427
  }
2320
2428
  /**
2321
- * @deprecated Use z.string().min(1) instead.
2322
- * @see {@link ZodString.min}
2429
+ * Equivalent to `.min(1)`
2323
2430
  */
2324
2431
  nonempty(message) {
2325
2432
  return this.min(1, errorUtil.errToObj(message));
@@ -2381,9 +2488,15 @@ var ZodString = class _ZodString extends ZodType {
2381
2488
  get isIP() {
2382
2489
  return !!this._def.checks.find((ch) => ch.kind === "ip");
2383
2490
  }
2491
+ get isCIDR() {
2492
+ return !!this._def.checks.find((ch) => ch.kind === "cidr");
2493
+ }
2384
2494
  get isBase64() {
2385
2495
  return !!this._def.checks.find((ch) => ch.kind === "base64");
2386
2496
  }
2497
+ get isBase64url() {
2498
+ return !!this._def.checks.find((ch) => ch.kind === "base64url");
2499
+ }
2387
2500
  get minLength() {
2388
2501
  let min = null;
2389
2502
  for (const ch of this._def.checks) {
@@ -2661,17 +2774,15 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
2661
2774
  }
2662
2775
  _parse(input) {
2663
2776
  if (this._def.coerce) {
2664
- input.data = BigInt(input.data);
2777
+ try {
2778
+ input.data = BigInt(input.data);
2779
+ } catch (_a) {
2780
+ return this._getInvalidInput(input);
2781
+ }
2665
2782
  }
2666
2783
  const parsedType = this._getType(input);
2667
2784
  if (parsedType !== ZodParsedType.bigint) {
2668
- const ctx2 = this._getOrReturnCtx(input);
2669
- addIssueToContext(ctx2, {
2670
- code: ZodIssueCode.invalid_type,
2671
- expected: ZodParsedType.bigint,
2672
- received: ctx2.parsedType
2673
- });
2674
- return INVALID;
2785
+ return this._getInvalidInput(input);
2675
2786
  }
2676
2787
  let ctx = void 0;
2677
2788
  const status = new ParseStatus();
@@ -2718,6 +2829,15 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
2718
2829
  }
2719
2830
  return { status: status.value, value: input.data };
2720
2831
  }
2832
+ _getInvalidInput(input) {
2833
+ const ctx = this._getOrReturnCtx(input);
2834
+ addIssueToContext(ctx, {
2835
+ code: ZodIssueCode.invalid_type,
2836
+ expected: ZodParsedType.bigint,
2837
+ received: ctx.parsedType
2838
+ });
2839
+ return INVALID;
2840
+ }
2721
2841
  gte(value, message) {
2722
2842
  return this.setLimit("min", value, true, errorUtil.toString(message));
2723
2843
  }
@@ -3273,8 +3393,7 @@ var ZodObject = class _ZodObject extends ZodType {
3273
3393
  });
3274
3394
  status.dirty();
3275
3395
  }
3276
- } else if (unknownKeys === "strip")
3277
- ;
3396
+ } else if (unknownKeys === "strip") ;
3278
3397
  else {
3279
3398
  throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);
3280
3399
  }
@@ -6044,8 +6163,7 @@ var objectValues = (obj) => {
6044
6163
  return Object.values(obj);
6045
6164
  };
6046
6165
  var assertV1OutFolder = (out) => {
6047
- if (!(0, import_fs.existsSync)(out))
6048
- return;
6166
+ if (!(0, import_fs.existsSync)(out)) return;
6049
6167
  const oldMigrationFolders = (0, import_fs.readdirSync)(out).filter(
6050
6168
  (it) => it.length === 14 && /^\d+$/.test(it)
6051
6169
  );