@anthonyalayo/drizzle-kit 1.0.7 → 1.2.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.
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() {
@@ -32,28 +31,26 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
32
31
  mod
33
32
  ));
34
33
 
35
- // ../node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/readline.js
34
+ // ../node_modules/.pnpm/hanji@0.0.8/node_modules/hanji/readline.js
36
35
  var require_readline = __commonJS({
37
- "../node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/readline.js"(exports) {
36
+ "../node_modules/.pnpm/hanji@0.0.8/node_modules/hanji/readline.js"(exports) {
38
37
  "use strict";
38
+ var __importDefault = exports && exports.__importDefault || function(mod) {
39
+ return mod && mod.__esModule ? mod : { "default": mod };
40
+ };
39
41
  Object.defineProperty(exports, "__esModule", { value: true });
40
- exports.prepareReadLine = void 0;
41
- var prepareReadLine = () => {
42
- const stdin = process.stdin;
43
- const stdout = process.stdout;
44
- const readline = __require("readline");
45
- const rl = readline.createInterface({
46
- input: stdin,
42
+ exports.createClosable = exports.stdout = exports.stdin = void 0;
43
+ var readline_1 = __importDefault(__require("readline"));
44
+ exports.stdin = process.stdin;
45
+ exports.stdout = process.stdout;
46
+ readline_1.default.emitKeypressEvents(exports.stdin);
47
+ var createClosable = () => {
48
+ return readline_1.default.createInterface({
49
+ input: exports.stdin,
47
50
  escapeCodeTimeout: 50
48
51
  });
49
- readline.emitKeypressEvents(stdin, rl);
50
- return {
51
- stdin,
52
- stdout,
53
- closable: rl
54
- };
55
52
  };
56
- exports.prepareReadLine = prepareReadLine;
53
+ exports.createClosable = createClosable;
57
54
  }
58
55
  });
59
56
 
@@ -66,20 +63,15 @@ var require_src = __commonJS({
66
63
  var beep = "\x07";
67
64
  var cursor = {
68
65
  to(x, y) {
69
- if (!y)
70
- return `${CSI}${x + 1}G`;
66
+ if (!y) return `${CSI}${x + 1}G`;
71
67
  return `${CSI}${y + 1};${x + 1}H`;
72
68
  },
73
69
  move(x, y) {
74
70
  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`;
71
+ if (x < 0) ret += `${CSI}${-x}D`;
72
+ else if (x > 0) ret += `${CSI}${x}C`;
73
+ if (y < 0) ret += `${CSI}${-y}A`;
74
+ else if (y > 0) ret += `${CSI}${y}B`;
83
75
  return ret;
84
76
  },
85
77
  up: (count = 1) => `${CSI}${count}A`,
@@ -118,12 +110,12 @@ var require_src = __commonJS({
118
110
  }
119
111
  });
120
112
 
121
- // ../node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/utils.js
113
+ // ../node_modules/.pnpm/hanji@0.0.8/node_modules/hanji/utils.js
122
114
  var require_utils = __commonJS({
123
- "../node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/utils.js"(exports) {
115
+ "../node_modules/.pnpm/hanji@0.0.8/node_modules/hanji/utils.js"(exports) {
124
116
  "use strict";
125
117
  Object.defineProperty(exports, "__esModule", { value: true });
126
- exports.clear = void 0;
118
+ exports.clear = exports.stringWidth = exports.fallbackStringWidth = exports.stripAnsi = exports.strip = void 0;
127
119
  var sisteransi_1 = require_src();
128
120
  var strip = (str) => {
129
121
  const pattern = [
@@ -133,14 +125,35 @@ var require_utils = __commonJS({
133
125
  const RGX = new RegExp(pattern, "g");
134
126
  return typeof str === "string" ? str.replace(RGX, "") : str;
135
127
  };
136
- var stringWidth = (str) => [...strip(str)].length;
128
+ exports.strip = strip;
129
+ var stripAnsi = (str) => {
130
+ if (typeof Bun !== "undefined" && Bun.stripANSI) {
131
+ return Bun.stripANSI(str);
132
+ }
133
+ return (0, exports.strip)(str);
134
+ };
135
+ exports.stripAnsi = stripAnsi;
136
+ var fallbackStringWidth = (str) => {
137
+ let len = 0;
138
+ const stripped = (0, exports.stripAnsi)(str);
139
+ for (const _ of stripped)
140
+ len++;
141
+ return len;
142
+ };
143
+ exports.fallbackStringWidth = fallbackStringWidth;
144
+ var stringWidth = (str) => {
145
+ if (typeof Bun !== "undefined" && Bun.stringWidth)
146
+ return Bun.stringWidth(str);
147
+ return (0, exports.fallbackStringWidth)(str);
148
+ };
149
+ exports.stringWidth = stringWidth;
137
150
  var clear = function(prompt, perLine) {
138
151
  if (!perLine)
139
152
  return sisteransi_1.erase.line + sisteransi_1.cursor.to(0);
140
153
  let rows = 0;
141
154
  const lines = prompt.split(/\r?\n/);
142
155
  for (let line of lines) {
143
- rows += 1 + Math.floor(Math.max(stringWidth(line) - 1, 0) / perLine);
156
+ rows += 1 + Math.floor(Math.max((0, exports.stringWidth)(line) - 1, 0) / perLine);
144
157
  }
145
158
  return sisteransi_1.erase.lines(rows);
146
159
  };
@@ -296,9 +309,9 @@ var require_lodash = __commonJS({
296
309
  }
297
310
  });
298
311
 
299
- // ../node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/index.js
312
+ // ../node_modules/.pnpm/hanji@0.0.8/node_modules/hanji/index.js
300
313
  var require_hanji = __commonJS({
301
- "../node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/index.js"(exports) {
314
+ "../node_modules/.pnpm/hanji@0.0.8/node_modules/hanji/index.js"(exports) {
302
315
  "use strict";
303
316
  var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
304
317
  function adopt(value) {
@@ -331,7 +344,10 @@ var require_hanji = __commonJS({
331
344
  return mod && mod.__esModule ? mod : { "default": mod };
332
345
  };
333
346
  Object.defineProperty(exports, "__esModule", { value: true });
334
- exports.onTerminate = exports.renderWithTask = exports.render = exports.TaskTerminal = exports.TaskView = exports.Terminal = exports.deferred = exports.SelectState = exports.Prompt = void 0;
347
+ exports.TaskTerminal = exports.TaskView = exports.Terminal = exports.deferred = exports.SelectState = exports.Prompt = void 0;
348
+ exports.render = render2;
349
+ exports.renderWithTask = renderWithTask;
350
+ exports.onTerminate = onTerminate;
335
351
  var readline_1 = require_readline();
336
352
  var sisteransi_1 = require_src();
337
353
  var utils_1 = require_utils();
@@ -410,8 +426,8 @@ var require_hanji = __commonJS({
410
426
  };
411
427
  exports.deferred = deferred;
412
428
  var Terminal = class {
413
- constructor(view4, stdin, stdout, closable) {
414
- this.view = view4;
429
+ constructor(view5, stdin, stdout, closable) {
430
+ this.view = view5;
415
431
  this.stdin = stdin;
416
432
  this.stdout = stdout;
417
433
  this.closable = closable;
@@ -449,7 +465,7 @@ var require_hanji = __commonJS({
449
465
  this.resolve({ status: "submitted", data: this.view.result() });
450
466
  return;
451
467
  }
452
- view4.input(str, key);
468
+ view5.input(str, key);
453
469
  };
454
470
  this.stdin.on("keypress", keypress);
455
471
  this.view.attach(this);
@@ -511,8 +527,8 @@ var require_hanji = __commonJS({
511
527
  };
512
528
  exports.TaskView = TaskView2;
513
529
  var TaskTerminal = class {
514
- constructor(view4, stdout) {
515
- this.view = view4;
530
+ constructor(view5, stdout) {
531
+ this.view = view5;
516
532
  this.stdout = stdout;
517
533
  this.text = "";
518
534
  this.view.attach(this);
@@ -529,40 +545,50 @@ var require_hanji = __commonJS({
529
545
  const clearPrefix = this.text ? (0, utils_1.clear)(this.text, this.stdout.columns) : "";
530
546
  this.stdout.write(`${clearPrefix}${string}`);
531
547
  }
548
+ reject(err) {
549
+ const string = this.view.render("rejected", err);
550
+ this.view.detach(this);
551
+ const clearPrefix = this.text ? (0, utils_1.clear)(this.text, this.stdout.columns) : "";
552
+ this.stdout.write(`${clearPrefix}${string}`);
553
+ }
532
554
  };
533
555
  exports.TaskTerminal = TaskTerminal;
534
- function render2(view4) {
535
- const { stdin, stdout, closable } = (0, readline_1.prepareReadLine)();
536
- if (view4 instanceof Prompt2) {
537
- const terminal = new Terminal(view4, stdin, stdout, closable);
538
- terminal.requestLayout();
539
- return terminal.result();
540
- }
541
- stdout.write(`${view4}
556
+ function render2(view5) {
557
+ if (typeof view5 === "string") {
558
+ process.stdout.write(`${view5}
542
559
  `);
543
- closable.close();
544
- return;
560
+ return;
561
+ }
562
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
563
+ return Promise.reject(new Error("Interactive prompts require a TTY terminal (process.stdin.isTTY or process.stdout.isTTY is false). This can happen when running in CI, piped input, or non-interactive shells."));
564
+ }
565
+ const closable = (0, readline_1.createClosable)();
566
+ const terminal = new Terminal(view5, readline_1.stdin, readline_1.stdout, closable);
567
+ terminal.requestLayout();
568
+ return terminal.result();
545
569
  }
546
- exports.render = render2;
547
- function renderWithTask(view4, task) {
570
+ function renderWithTask(view5, task) {
548
571
  return __awaiter(this, void 0, void 0, function* () {
549
- const terminal = new TaskTerminal(view4, process.stdout);
572
+ const terminal = new TaskTerminal(view5, process.stdout);
550
573
  terminal.requestLayout();
551
- const result = yield task;
552
- terminal.clear();
553
- return result;
574
+ try {
575
+ const result = yield task;
576
+ terminal.clear();
577
+ return result;
578
+ } catch (err) {
579
+ terminal.reject(err);
580
+ process.exit(1);
581
+ }
554
582
  });
555
583
  }
556
- exports.renderWithTask = renderWithTask;
557
584
  var terminateHandler;
558
585
  function onTerminate(callback) {
559
586
  terminateHandler = callback;
560
587
  }
561
- exports.onTerminate = onTerminate;
562
588
  }
563
589
  });
564
590
 
565
- // ../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/ansi-styles/index.js
591
+ // ../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/vendor/ansi-styles/index.js
566
592
  var ANSI_BACKGROUND_OFFSET = 10;
567
593
  var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
568
594
  var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
@@ -748,7 +774,7 @@ function assembleStyles() {
748
774
  var ansiStyles = assembleStyles();
749
775
  var ansi_styles_default = ansiStyles;
750
776
 
751
- // ../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/supports-color/index.js
777
+ // ../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/vendor/supports-color/index.js
752
778
  import process2 from "node:process";
753
779
  import os from "node:os";
754
780
  import tty from "node:tty";
@@ -822,10 +848,10 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
822
848
  return 1;
823
849
  }
824
850
  if ("CI" in env) {
825
- if ("GITHUB_ACTIONS" in env || "GITEA_ACTIONS" in env) {
851
+ if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => key in env)) {
826
852
  return 3;
827
853
  }
828
- if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
854
+ if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
829
855
  return 1;
830
856
  }
831
857
  return min;
@@ -874,37 +900,37 @@ var supportsColor = {
874
900
  };
875
901
  var supports_color_default = supportsColor;
876
902
 
877
- // ../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/utilities.js
903
+ // ../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/utilities.js
878
904
  function stringReplaceAll(string, substring, replacer) {
879
- let index5 = string.indexOf(substring);
880
- if (index5 === -1) {
905
+ let index6 = string.indexOf(substring);
906
+ if (index6 === -1) {
881
907
  return string;
882
908
  }
883
909
  const substringLength = substring.length;
884
910
  let endIndex = 0;
885
911
  let returnValue = "";
886
912
  do {
887
- returnValue += string.slice(endIndex, index5) + substring + replacer;
888
- endIndex = index5 + substringLength;
889
- index5 = string.indexOf(substring, endIndex);
890
- } while (index5 !== -1);
913
+ returnValue += string.slice(endIndex, index6) + substring + replacer;
914
+ endIndex = index6 + substringLength;
915
+ index6 = string.indexOf(substring, endIndex);
916
+ } while (index6 !== -1);
891
917
  returnValue += string.slice(endIndex);
892
918
  return returnValue;
893
919
  }
894
- function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index5) {
920
+ function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index6) {
895
921
  let endIndex = 0;
896
922
  let returnValue = "";
897
923
  do {
898
- const gotCR = string[index5 - 1] === "\r";
899
- returnValue += string.slice(endIndex, gotCR ? index5 - 1 : index5) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
900
- endIndex = index5 + 1;
901
- index5 = string.indexOf("\n", endIndex);
902
- } while (index5 !== -1);
924
+ const gotCR = string[index6 - 1] === "\r";
925
+ returnValue += string.slice(endIndex, gotCR ? index6 - 1 : index6) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
926
+ endIndex = index6 + 1;
927
+ index6 = string.indexOf("\n", endIndex);
928
+ } while (index6 !== -1);
903
929
  returnValue += string.slice(endIndex);
904
930
  return returnValue;
905
931
  }
906
932
 
907
- // ../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/index.js
933
+ // ../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/index.js
908
934
  var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
909
935
  var GENERATOR = Symbol("GENERATOR");
910
936
  var STYLER = Symbol("STYLER");
@@ -1064,15 +1090,16 @@ var info = (msg, greyMsg = "") => {
1064
1090
 
1065
1091
  // src/global.ts
1066
1092
  var originUUID = "00000000-0000-0000-0000-000000000000";
1067
- var snapshotVersion = "8";
1093
+ var snapshotVersion = "7";
1068
1094
  function assertUnreachable(x) {
1069
1095
  throw new Error("Didn't expect to get here");
1070
1096
  }
1071
1097
 
1072
- // ../node_modules/.pnpm/zod@3.23.7/node_modules/zod/lib/index.mjs
1098
+ // ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/helpers/util.js
1073
1099
  var util;
1074
1100
  (function(util2) {
1075
- util2.assertEqual = (val) => val;
1101
+ util2.assertEqual = (_) => {
1102
+ };
1076
1103
  function assertIs(_arg) {
1077
1104
  }
1078
1105
  util2.assertIs = assertIs;
@@ -1116,7 +1143,7 @@ var util;
1116
1143
  }
1117
1144
  return void 0;
1118
1145
  };
1119
- util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val;
1146
+ util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && Number.isFinite(val) && Math.floor(val) === val;
1120
1147
  function joinValues(array, separator = " | ") {
1121
1148
  return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
1122
1149
  }
@@ -1168,7 +1195,7 @@ var getParsedType = (data) => {
1168
1195
  case "string":
1169
1196
  return ZodParsedType.string;
1170
1197
  case "number":
1171
- return isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
1198
+ return Number.isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
1172
1199
  case "boolean":
1173
1200
  return ZodParsedType.boolean;
1174
1201
  case "function":
@@ -1201,6 +1228,8 @@ var getParsedType = (data) => {
1201
1228
  return ZodParsedType.unknown;
1202
1229
  }
1203
1230
  };
1231
+
1232
+ // ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/ZodError.js
1204
1233
  var ZodIssueCode = util.arrayToEnum([
1205
1234
  "invalid_type",
1206
1235
  "invalid_literal",
@@ -1220,6 +1249,9 @@ var ZodIssueCode = util.arrayToEnum([
1220
1249
  "not_finite"
1221
1250
  ]);
1222
1251
  var ZodError = class _ZodError extends Error {
1252
+ get errors() {
1253
+ return this.issues;
1254
+ }
1223
1255
  constructor(issues) {
1224
1256
  super();
1225
1257
  this.issues = [];
@@ -1238,9 +1270,6 @@ var ZodError = class _ZodError extends Error {
1238
1270
  this.name = "ZodError";
1239
1271
  this.issues = issues;
1240
1272
  }
1241
- get errors() {
1242
- return this.issues;
1243
- }
1244
1273
  format(_mapper) {
1245
1274
  const mapper = _mapper || function(issue) {
1246
1275
  return issue.message;
@@ -1312,6 +1341,8 @@ ZodError.create = (issues) => {
1312
1341
  const error = new ZodError(issues);
1313
1342
  return error;
1314
1343
  };
1344
+
1345
+ // ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/locales/en.js
1315
1346
  var errorMap = (issue, _ctx) => {
1316
1347
  let message;
1317
1348
  switch (issue.code) {
@@ -1410,10 +1441,15 @@ var errorMap = (issue, _ctx) => {
1410
1441
  }
1411
1442
  return { message };
1412
1443
  };
1413
- var overrideErrorMap = errorMap;
1444
+ var en_default = errorMap;
1445
+
1446
+ // ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/errors.js
1447
+ var overrideErrorMap = en_default;
1414
1448
  function getErrorMap() {
1415
1449
  return overrideErrorMap;
1416
1450
  }
1451
+
1452
+ // ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/helpers/parseUtil.js
1417
1453
  var makeIssue = (params) => {
1418
1454
  const { data, path, errorMaps, issueData } = params;
1419
1455
  const fullPath = [...path, ...issueData.path || []];
@@ -1447,9 +1483,12 @@ function addIssueToContext(ctx, issueData) {
1447
1483
  path: ctx.path,
1448
1484
  errorMaps: [
1449
1485
  ctx.common.contextualErrorMap,
1486
+ // contextual error map is first priority
1450
1487
  ctx.schemaErrorMap,
1488
+ // then schema-bound map if available
1451
1489
  overrideMap,
1452
- overrideMap === errorMap ? void 0 : errorMap
1490
+ // then global override map
1491
+ overrideMap === en_default ? void 0 : en_default
1453
1492
  // then global default map
1454
1493
  ].filter((x) => !!x)
1455
1494
  });
@@ -1518,29 +1557,15 @@ var isAborted = (x) => x.status === "aborted";
1518
1557
  var isDirty = (x) => x.status === "dirty";
1519
1558
  var isValid = (x) => x.status === "valid";
1520
1559
  var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
1521
- 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");
1526
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
1527
- }
1528
- 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");
1535
- return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
1536
- }
1560
+
1561
+ // ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/helpers/errorUtil.js
1537
1562
  var errorUtil;
1538
1563
  (function(errorUtil2) {
1539
1564
  errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
1540
- errorUtil2.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
1565
+ errorUtil2.toString = (message) => typeof message === "string" ? message : message == null ? void 0 : message.message;
1541
1566
  })(errorUtil || (errorUtil = {}));
1542
- var _ZodEnum_cache;
1543
- var _ZodNativeEnum_cache;
1567
+
1568
+ // ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/types.js
1544
1569
  var ParseInputLazyPath = class {
1545
1570
  constructor(parent, value, path, key) {
1546
1571
  this._cachedPath = [];
@@ -1551,7 +1576,7 @@ var ParseInputLazyPath = class {
1551
1576
  }
1552
1577
  get path() {
1553
1578
  if (!this._cachedPath.length) {
1554
- if (this._key instanceof Array) {
1579
+ if (Array.isArray(this._key)) {
1555
1580
  this._cachedPath.push(...this._path, ...this._key);
1556
1581
  } else {
1557
1582
  this._cachedPath.push(...this._path, this._key);
@@ -1589,49 +1614,20 @@ function processCreateParams(params) {
1589
1614
  if (errorMap2)
1590
1615
  return { errorMap: errorMap2, description };
1591
1616
  const customMap = (iss, ctx) => {
1592
- var _a, _b;
1593
1617
  const { message } = params;
1594
1618
  if (iss.code === "invalid_enum_value") {
1595
- return { message: message !== null && message !== void 0 ? message : ctx.defaultError };
1619
+ return { message: message ?? ctx.defaultError };
1596
1620
  }
1597
1621
  if (typeof ctx.data === "undefined") {
1598
- return { message: (_a = message !== null && message !== void 0 ? message : required_error) !== null && _a !== void 0 ? _a : ctx.defaultError };
1622
+ return { message: message ?? required_error ?? ctx.defaultError };
1599
1623
  }
1600
1624
  if (iss.code !== "invalid_type")
1601
1625
  return { message: ctx.defaultError };
1602
- return { message: (_b = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _b !== void 0 ? _b : ctx.defaultError };
1626
+ return { message: message ?? invalid_type_error ?? ctx.defaultError };
1603
1627
  };
1604
1628
  return { errorMap: customMap, description };
1605
1629
  }
1606
1630
  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
1631
  get description() {
1636
1632
  return this._def.description;
1637
1633
  }
@@ -1679,14 +1675,13 @@ var ZodType = class {
1679
1675
  throw result.error;
1680
1676
  }
1681
1677
  safeParse(data, params) {
1682
- var _a;
1683
1678
  const ctx = {
1684
1679
  common: {
1685
1680
  issues: [],
1686
- async: (_a = params === null || params === void 0 ? void 0 : params.async) !== null && _a !== void 0 ? _a : false,
1687
- contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap
1681
+ async: (params == null ? void 0 : params.async) ?? false,
1682
+ contextualErrorMap: params == null ? void 0 : params.errorMap
1688
1683
  },
1689
- path: (params === null || params === void 0 ? void 0 : params.path) || [],
1684
+ path: (params == null ? void 0 : params.path) || [],
1690
1685
  schemaErrorMap: this._def.errorMap,
1691
1686
  parent: null,
1692
1687
  data,
@@ -1695,6 +1690,43 @@ var ZodType = class {
1695
1690
  const result = this._parseSync({ data, path: ctx.path, parent: ctx });
1696
1691
  return handleResult(ctx, result);
1697
1692
  }
1693
+ "~validate"(data) {
1694
+ var _a, _b;
1695
+ const ctx = {
1696
+ common: {
1697
+ issues: [],
1698
+ async: !!this["~standard"].async
1699
+ },
1700
+ path: [],
1701
+ schemaErrorMap: this._def.errorMap,
1702
+ parent: null,
1703
+ data,
1704
+ parsedType: getParsedType(data)
1705
+ };
1706
+ if (!this["~standard"].async) {
1707
+ try {
1708
+ const result = this._parseSync({ data, path: [], parent: ctx });
1709
+ return isValid(result) ? {
1710
+ value: result.value
1711
+ } : {
1712
+ issues: ctx.common.issues
1713
+ };
1714
+ } catch (err) {
1715
+ if ((_b = (_a = err == null ? void 0 : err.message) == null ? void 0 : _a.toLowerCase()) == null ? void 0 : _b.includes("encountered")) {
1716
+ this["~standard"].async = true;
1717
+ }
1718
+ ctx.common = {
1719
+ issues: [],
1720
+ async: true
1721
+ };
1722
+ }
1723
+ }
1724
+ return this._parseAsync({ data, path: [], parent: ctx }).then((result) => isValid(result) ? {
1725
+ value: result.value
1726
+ } : {
1727
+ issues: ctx.common.issues
1728
+ });
1729
+ }
1698
1730
  async parseAsync(data, params) {
1699
1731
  const result = await this.safeParseAsync(data, params);
1700
1732
  if (result.success)
@@ -1705,10 +1737,10 @@ var ZodType = class {
1705
1737
  const ctx = {
1706
1738
  common: {
1707
1739
  issues: [],
1708
- contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap,
1740
+ contextualErrorMap: params == null ? void 0 : params.errorMap,
1709
1741
  async: true
1710
1742
  },
1711
- path: (params === null || params === void 0 ? void 0 : params.path) || [],
1743
+ path: (params == null ? void 0 : params.path) || [],
1712
1744
  schemaErrorMap: this._def.errorMap,
1713
1745
  parent: null,
1714
1746
  data,
@@ -1772,6 +1804,39 @@ var ZodType = class {
1772
1804
  superRefine(refinement) {
1773
1805
  return this._refinement(refinement);
1774
1806
  }
1807
+ constructor(def) {
1808
+ this.spa = this.safeParseAsync;
1809
+ this._def = def;
1810
+ this.parse = this.parse.bind(this);
1811
+ this.safeParse = this.safeParse.bind(this);
1812
+ this.parseAsync = this.parseAsync.bind(this);
1813
+ this.safeParseAsync = this.safeParseAsync.bind(this);
1814
+ this.spa = this.spa.bind(this);
1815
+ this.refine = this.refine.bind(this);
1816
+ this.refinement = this.refinement.bind(this);
1817
+ this.superRefine = this.superRefine.bind(this);
1818
+ this.optional = this.optional.bind(this);
1819
+ this.nullable = this.nullable.bind(this);
1820
+ this.nullish = this.nullish.bind(this);
1821
+ this.array = this.array.bind(this);
1822
+ this.promise = this.promise.bind(this);
1823
+ this.or = this.or.bind(this);
1824
+ this.and = this.and.bind(this);
1825
+ this.transform = this.transform.bind(this);
1826
+ this.brand = this.brand.bind(this);
1827
+ this.default = this.default.bind(this);
1828
+ this.catch = this.catch.bind(this);
1829
+ this.describe = this.describe.bind(this);
1830
+ this.pipe = this.pipe.bind(this);
1831
+ this.readonly = this.readonly.bind(this);
1832
+ this.isNullable = this.isNullable.bind(this);
1833
+ this.isOptional = this.isOptional.bind(this);
1834
+ this["~standard"] = {
1835
+ version: 1,
1836
+ vendor: "zod",
1837
+ validate: (data) => this["~validate"](data)
1838
+ };
1839
+ }
1775
1840
  optional() {
1776
1841
  return ZodOptional.create(this, this._def);
1777
1842
  }
@@ -1782,7 +1847,7 @@ var ZodType = class {
1782
1847
  return this.nullable().optional();
1783
1848
  }
1784
1849
  array() {
1785
- return ZodArray.create(this, this._def);
1850
+ return ZodArray.create(this);
1786
1851
  }
1787
1852
  promise() {
1788
1853
  return ZodPromise.create(this, this._def);
@@ -1848,26 +1913,31 @@ var ZodType = class {
1848
1913
  };
1849
1914
  var cuidRegex = /^c[^\s-]{8,}$/i;
1850
1915
  var cuid2Regex = /^[0-9a-z]+$/;
1851
- var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/;
1916
+ var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i;
1852
1917
  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
1918
  var nanoidRegex = /^[a-z0-9_-]{21}$/i;
1919
+ var jwtRegex = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;
1854
1920
  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
1921
  var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
1856
1922
  var _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
1857
1923
  var emojiRegex;
1858
1924
  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})))$/;
1925
+ 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])$/;
1926
+ 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]))$/;
1927
+ 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
1928
  var base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
1929
+ var base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;
1861
1930
  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
1931
  var dateRegex = new RegExp(`^${dateRegexSource}$`);
1863
1932
  function timeRegexSource(args) {
1864
- let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`;
1933
+ let secondsRegexSource = `[0-5]\\d`;
1865
1934
  if (args.precision) {
1866
- regex = `${regex}\\.\\d{${args.precision}}`;
1935
+ secondsRegexSource = `${secondsRegexSource}\\.\\d{${args.precision}}`;
1867
1936
  } else if (args.precision == null) {
1868
- regex = `${regex}(\\.\\d+)?`;
1937
+ secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`;
1869
1938
  }
1870
- return regex;
1939
+ const secondsQuantifier = args.precision ? "+" : "?";
1940
+ return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`;
1871
1941
  }
1872
1942
  function timeRegex(args) {
1873
1943
  return new RegExp(`^${timeRegexSource(args)}$`);
@@ -1890,6 +1960,35 @@ function isValidIP(ip, version) {
1890
1960
  }
1891
1961
  return false;
1892
1962
  }
1963
+ function isValidJWT(jwt, alg) {
1964
+ if (!jwtRegex.test(jwt))
1965
+ return false;
1966
+ try {
1967
+ const [header] = jwt.split(".");
1968
+ const base64 = header.replace(/-/g, "+").replace(/_/g, "/").padEnd(header.length + (4 - header.length % 4) % 4, "=");
1969
+ const decoded = JSON.parse(atob(base64));
1970
+ if (typeof decoded !== "object" || decoded === null)
1971
+ return false;
1972
+ if ("typ" in decoded && (decoded == null ? void 0 : decoded.typ) !== "JWT")
1973
+ return false;
1974
+ if (!decoded.alg)
1975
+ return false;
1976
+ if (alg && decoded.alg !== alg)
1977
+ return false;
1978
+ return true;
1979
+ } catch {
1980
+ return false;
1981
+ }
1982
+ }
1983
+ function isValidCidr(ip, version) {
1984
+ if ((version === "v4" || !version) && ipv4CidrRegex.test(ip)) {
1985
+ return true;
1986
+ }
1987
+ if ((version === "v6" || !version) && ipv6CidrRegex.test(ip)) {
1988
+ return true;
1989
+ }
1990
+ return false;
1991
+ }
1893
1992
  var ZodString = class _ZodString extends ZodType {
1894
1993
  _parse(input) {
1895
1994
  if (this._def.coerce) {
@@ -2036,7 +2135,7 @@ var ZodString = class _ZodString extends ZodType {
2036
2135
  } else if (check.kind === "url") {
2037
2136
  try {
2038
2137
  new URL(input.data);
2039
- } catch (_a) {
2138
+ } catch {
2040
2139
  ctx = this._getOrReturnCtx(input, ctx);
2041
2140
  addIssueToContext(ctx, {
2042
2141
  validation: "url",
@@ -2146,6 +2245,26 @@ var ZodString = class _ZodString extends ZodType {
2146
2245
  });
2147
2246
  status.dirty();
2148
2247
  }
2248
+ } else if (check.kind === "jwt") {
2249
+ if (!isValidJWT(input.data, check.alg)) {
2250
+ ctx = this._getOrReturnCtx(input, ctx);
2251
+ addIssueToContext(ctx, {
2252
+ validation: "jwt",
2253
+ code: ZodIssueCode.invalid_string,
2254
+ message: check.message
2255
+ });
2256
+ status.dirty();
2257
+ }
2258
+ } else if (check.kind === "cidr") {
2259
+ if (!isValidCidr(input.data, check.version)) {
2260
+ ctx = this._getOrReturnCtx(input, ctx);
2261
+ addIssueToContext(ctx, {
2262
+ validation: "cidr",
2263
+ code: ZodIssueCode.invalid_string,
2264
+ message: check.message
2265
+ });
2266
+ status.dirty();
2267
+ }
2149
2268
  } else if (check.kind === "base64") {
2150
2269
  if (!base64Regex.test(input.data)) {
2151
2270
  ctx = this._getOrReturnCtx(input, ctx);
@@ -2156,6 +2275,16 @@ var ZodString = class _ZodString extends ZodType {
2156
2275
  });
2157
2276
  status.dirty();
2158
2277
  }
2278
+ } else if (check.kind === "base64url") {
2279
+ if (!base64urlRegex.test(input.data)) {
2280
+ ctx = this._getOrReturnCtx(input, ctx);
2281
+ addIssueToContext(ctx, {
2282
+ validation: "base64url",
2283
+ code: ZodIssueCode.invalid_string,
2284
+ message: check.message
2285
+ });
2286
+ status.dirty();
2287
+ }
2159
2288
  } else {
2160
2289
  util.assertNever(check);
2161
2290
  }
@@ -2202,11 +2331,22 @@ var ZodString = class _ZodString extends ZodType {
2202
2331
  base64(message) {
2203
2332
  return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });
2204
2333
  }
2334
+ base64url(message) {
2335
+ return this._addCheck({
2336
+ kind: "base64url",
2337
+ ...errorUtil.errToObj(message)
2338
+ });
2339
+ }
2340
+ jwt(options) {
2341
+ return this._addCheck({ kind: "jwt", ...errorUtil.errToObj(options) });
2342
+ }
2205
2343
  ip(options) {
2206
2344
  return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
2207
2345
  }
2346
+ cidr(options) {
2347
+ return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options) });
2348
+ }
2208
2349
  datetime(options) {
2209
- var _a, _b;
2210
2350
  if (typeof options === "string") {
2211
2351
  return this._addCheck({
2212
2352
  kind: "datetime",
@@ -2218,10 +2358,10 @@ var ZodString = class _ZodString extends ZodType {
2218
2358
  }
2219
2359
  return this._addCheck({
2220
2360
  kind: "datetime",
2221
- precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
2222
- offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,
2223
- local: (_b = options === null || options === void 0 ? void 0 : options.local) !== null && _b !== void 0 ? _b : false,
2224
- ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
2361
+ precision: typeof (options == null ? void 0 : options.precision) === "undefined" ? null : options == null ? void 0 : options.precision,
2362
+ offset: (options == null ? void 0 : options.offset) ?? false,
2363
+ local: (options == null ? void 0 : options.local) ?? false,
2364
+ ...errorUtil.errToObj(options == null ? void 0 : options.message)
2225
2365
  });
2226
2366
  }
2227
2367
  date(message) {
@@ -2237,8 +2377,8 @@ var ZodString = class _ZodString extends ZodType {
2237
2377
  }
2238
2378
  return this._addCheck({
2239
2379
  kind: "time",
2240
- precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
2241
- ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
2380
+ precision: typeof (options == null ? void 0 : options.precision) === "undefined" ? null : options == null ? void 0 : options.precision,
2381
+ ...errorUtil.errToObj(options == null ? void 0 : options.message)
2242
2382
  });
2243
2383
  }
2244
2384
  duration(message) {
@@ -2255,8 +2395,8 @@ var ZodString = class _ZodString extends ZodType {
2255
2395
  return this._addCheck({
2256
2396
  kind: "includes",
2257
2397
  value,
2258
- position: options === null || options === void 0 ? void 0 : options.position,
2259
- ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
2398
+ position: options == null ? void 0 : options.position,
2399
+ ...errorUtil.errToObj(options == null ? void 0 : options.message)
2260
2400
  });
2261
2401
  }
2262
2402
  startsWith(value, message) {
@@ -2295,8 +2435,7 @@ var ZodString = class _ZodString extends ZodType {
2295
2435
  });
2296
2436
  }
2297
2437
  /**
2298
- * @deprecated Use z.string().min(1) instead.
2299
- * @see {@link ZodString.min}
2438
+ * Equivalent to `.min(1)`
2300
2439
  */
2301
2440
  nonempty(message) {
2302
2441
  return this.min(1, errorUtil.errToObj(message));
@@ -2358,9 +2497,15 @@ var ZodString = class _ZodString extends ZodType {
2358
2497
  get isIP() {
2359
2498
  return !!this._def.checks.find((ch) => ch.kind === "ip");
2360
2499
  }
2500
+ get isCIDR() {
2501
+ return !!this._def.checks.find((ch) => ch.kind === "cidr");
2502
+ }
2361
2503
  get isBase64() {
2362
2504
  return !!this._def.checks.find((ch) => ch.kind === "base64");
2363
2505
  }
2506
+ get isBase64url() {
2507
+ return !!this._def.checks.find((ch) => ch.kind === "base64url");
2508
+ }
2364
2509
  get minLength() {
2365
2510
  let min = null;
2366
2511
  for (const ch of this._def.checks) {
@@ -2383,11 +2528,10 @@ var ZodString = class _ZodString extends ZodType {
2383
2528
  }
2384
2529
  };
2385
2530
  ZodString.create = (params) => {
2386
- var _a;
2387
2531
  return new ZodString({
2388
2532
  checks: [],
2389
2533
  typeName: ZodFirstPartyTypeKind.ZodString,
2390
- coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
2534
+ coerce: (params == null ? void 0 : params.coerce) ?? false,
2391
2535
  ...processCreateParams(params)
2392
2536
  });
2393
2537
  };
@@ -2395,9 +2539,9 @@ function floatSafeRemainder(val, step) {
2395
2539
  const valDecCount = (val.toString().split(".")[1] || "").length;
2396
2540
  const stepDecCount = (step.toString().split(".")[1] || "").length;
2397
2541
  const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
2398
- const valInt = parseInt(val.toFixed(decCount).replace(".", ""));
2399
- const stepInt = parseInt(step.toFixed(decCount).replace(".", ""));
2400
- return valInt % stepInt / Math.pow(10, decCount);
2542
+ const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
2543
+ const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
2544
+ return valInt % stepInt / 10 ** decCount;
2401
2545
  }
2402
2546
  var ZodNumber = class _ZodNumber extends ZodType {
2403
2547
  constructor() {
@@ -2607,7 +2751,8 @@ var ZodNumber = class _ZodNumber extends ZodType {
2607
2751
  return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
2608
2752
  }
2609
2753
  get isFinite() {
2610
- let max = null, min = null;
2754
+ let max = null;
2755
+ let min = null;
2611
2756
  for (const ch of this._def.checks) {
2612
2757
  if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
2613
2758
  return true;
@@ -2626,7 +2771,7 @@ ZodNumber.create = (params) => {
2626
2771
  return new ZodNumber({
2627
2772
  checks: [],
2628
2773
  typeName: ZodFirstPartyTypeKind.ZodNumber,
2629
- coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
2774
+ coerce: (params == null ? void 0 : params.coerce) || false,
2630
2775
  ...processCreateParams(params)
2631
2776
  });
2632
2777
  };
@@ -2638,17 +2783,15 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
2638
2783
  }
2639
2784
  _parse(input) {
2640
2785
  if (this._def.coerce) {
2641
- input.data = BigInt(input.data);
2786
+ try {
2787
+ input.data = BigInt(input.data);
2788
+ } catch {
2789
+ return this._getInvalidInput(input);
2790
+ }
2642
2791
  }
2643
2792
  const parsedType = this._getType(input);
2644
2793
  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;
2794
+ return this._getInvalidInput(input);
2652
2795
  }
2653
2796
  let ctx = void 0;
2654
2797
  const status = new ParseStatus();
@@ -2695,6 +2838,15 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
2695
2838
  }
2696
2839
  return { status: status.value, value: input.data };
2697
2840
  }
2841
+ _getInvalidInput(input) {
2842
+ const ctx = this._getOrReturnCtx(input);
2843
+ addIssueToContext(ctx, {
2844
+ code: ZodIssueCode.invalid_type,
2845
+ expected: ZodParsedType.bigint,
2846
+ received: ctx.parsedType
2847
+ });
2848
+ return INVALID;
2849
+ }
2698
2850
  gte(value, message) {
2699
2851
  return this.setLimit("min", value, true, errorUtil.toString(message));
2700
2852
  }
@@ -2788,11 +2940,10 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
2788
2940
  }
2789
2941
  };
2790
2942
  ZodBigInt.create = (params) => {
2791
- var _a;
2792
2943
  return new ZodBigInt({
2793
2944
  checks: [],
2794
2945
  typeName: ZodFirstPartyTypeKind.ZodBigInt,
2795
- coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
2946
+ coerce: (params == null ? void 0 : params.coerce) ?? false,
2796
2947
  ...processCreateParams(params)
2797
2948
  });
2798
2949
  };
@@ -2817,7 +2968,7 @@ var ZodBoolean = class extends ZodType {
2817
2968
  ZodBoolean.create = (params) => {
2818
2969
  return new ZodBoolean({
2819
2970
  typeName: ZodFirstPartyTypeKind.ZodBoolean,
2820
- coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
2971
+ coerce: (params == null ? void 0 : params.coerce) || false,
2821
2972
  ...processCreateParams(params)
2822
2973
  });
2823
2974
  };
@@ -2836,7 +2987,7 @@ var ZodDate = class _ZodDate extends ZodType {
2836
2987
  });
2837
2988
  return INVALID;
2838
2989
  }
2839
- if (isNaN(input.data.getTime())) {
2990
+ if (Number.isNaN(input.data.getTime())) {
2840
2991
  const ctx2 = this._getOrReturnCtx(input);
2841
2992
  addIssueToContext(ctx2, {
2842
2993
  code: ZodIssueCode.invalid_date
@@ -2925,7 +3076,7 @@ var ZodDate = class _ZodDate extends ZodType {
2925
3076
  ZodDate.create = (params) => {
2926
3077
  return new ZodDate({
2927
3078
  checks: [],
2928
- coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
3079
+ coerce: (params == null ? void 0 : params.coerce) || false,
2929
3080
  typeName: ZodFirstPartyTypeKind.ZodDate,
2930
3081
  ...processCreateParams(params)
2931
3082
  });
@@ -3200,7 +3351,8 @@ var ZodObject = class _ZodObject extends ZodType {
3200
3351
  return this._cached;
3201
3352
  const shape = this._def.shape();
3202
3353
  const keys = util.objectKeys(shape);
3203
- return this._cached = { shape, keys };
3354
+ this._cached = { shape, keys };
3355
+ return this._cached;
3204
3356
  }
3205
3357
  _parse(input) {
3206
3358
  const parsedType = this._getType(input);
@@ -3250,9 +3402,8 @@ var ZodObject = class _ZodObject extends ZodType {
3250
3402
  });
3251
3403
  status.dirty();
3252
3404
  }
3253
- } else if (unknownKeys === "strip")
3254
- ;
3255
- else {
3405
+ } else if (unknownKeys === "strip") {
3406
+ } else {
3256
3407
  throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);
3257
3408
  }
3258
3409
  } else {
@@ -3299,11 +3450,11 @@ var ZodObject = class _ZodObject extends ZodType {
3299
3450
  unknownKeys: "strict",
3300
3451
  ...message !== void 0 ? {
3301
3452
  errorMap: (issue, ctx) => {
3302
- var _a, _b, _c, _d;
3303
- const defaultError = (_c = (_b = (_a = this._def).errorMap) === null || _b === void 0 ? void 0 : _b.call(_a, issue, ctx).message) !== null && _c !== void 0 ? _c : ctx.defaultError;
3453
+ var _a, _b;
3454
+ const defaultError = ((_b = (_a = this._def).errorMap) == null ? void 0 : _b.call(_a, issue, ctx).message) ?? ctx.defaultError;
3304
3455
  if (issue.code === "unrecognized_keys")
3305
3456
  return {
3306
- message: (_d = errorUtil.errToObj(message).message) !== null && _d !== void 0 ? _d : defaultError
3457
+ message: errorUtil.errToObj(message).message ?? defaultError
3307
3458
  };
3308
3459
  return {
3309
3460
  message: defaultError
@@ -3426,19 +3577,19 @@ var ZodObject = class _ZodObject extends ZodType {
3426
3577
  // }) as any;
3427
3578
  // return merged;
3428
3579
  // }
3429
- catchall(index5) {
3580
+ catchall(index6) {
3430
3581
  return new _ZodObject({
3431
3582
  ...this._def,
3432
- catchall: index5
3583
+ catchall: index6
3433
3584
  });
3434
3585
  }
3435
3586
  pick(mask) {
3436
3587
  const shape = {};
3437
- util.objectKeys(mask).forEach((key) => {
3588
+ for (const key of util.objectKeys(mask)) {
3438
3589
  if (mask[key] && this.shape[key]) {
3439
3590
  shape[key] = this.shape[key];
3440
3591
  }
3441
- });
3592
+ }
3442
3593
  return new _ZodObject({
3443
3594
  ...this._def,
3444
3595
  shape: () => shape
@@ -3446,11 +3597,11 @@ var ZodObject = class _ZodObject extends ZodType {
3446
3597
  }
3447
3598
  omit(mask) {
3448
3599
  const shape = {};
3449
- util.objectKeys(this.shape).forEach((key) => {
3600
+ for (const key of util.objectKeys(this.shape)) {
3450
3601
  if (!mask[key]) {
3451
3602
  shape[key] = this.shape[key];
3452
3603
  }
3453
- });
3604
+ }
3454
3605
  return new _ZodObject({
3455
3606
  ...this._def,
3456
3607
  shape: () => shape
@@ -3464,14 +3615,14 @@ var ZodObject = class _ZodObject extends ZodType {
3464
3615
  }
3465
3616
  partial(mask) {
3466
3617
  const newShape = {};
3467
- util.objectKeys(this.shape).forEach((key) => {
3618
+ for (const key of util.objectKeys(this.shape)) {
3468
3619
  const fieldSchema = this.shape[key];
3469
3620
  if (mask && !mask[key]) {
3470
3621
  newShape[key] = fieldSchema;
3471
3622
  } else {
3472
3623
  newShape[key] = fieldSchema.optional();
3473
3624
  }
3474
- });
3625
+ }
3475
3626
  return new _ZodObject({
3476
3627
  ...this._def,
3477
3628
  shape: () => newShape
@@ -3479,7 +3630,7 @@ var ZodObject = class _ZodObject extends ZodType {
3479
3630
  }
3480
3631
  required(mask) {
3481
3632
  const newShape = {};
3482
- util.objectKeys(this.shape).forEach((key) => {
3633
+ for (const key of util.objectKeys(this.shape)) {
3483
3634
  if (mask && !mask[key]) {
3484
3635
  newShape[key] = this.shape[key];
3485
3636
  } else {
@@ -3490,7 +3641,7 @@ var ZodObject = class _ZodObject extends ZodType {
3490
3641
  }
3491
3642
  newShape[key] = newField;
3492
3643
  }
3493
- });
3644
+ }
3494
3645
  return new _ZodObject({
3495
3646
  ...this._def,
3496
3647
  shape: () => newShape
@@ -3747,9 +3898,9 @@ function mergeValues(a, b) {
3747
3898
  return { valid: false };
3748
3899
  }
3749
3900
  const newArray = [];
3750
- for (let index5 = 0; index5 < a.length; index5++) {
3751
- const itemA = a[index5];
3752
- const itemB = b[index5];
3901
+ for (let index6 = 0; index6 < a.length; index6++) {
3902
+ const itemA = a[index6];
3903
+ const itemB = b[index6];
3753
3904
  const sharedValue = mergeValues(itemA, itemB);
3754
3905
  if (!sharedValue.valid) {
3755
3906
  return { valid: false };
@@ -3955,10 +4106,10 @@ var ZodMap = class extends ZodType {
3955
4106
  }
3956
4107
  const keyType = this._def.keyType;
3957
4108
  const valueType = this._def.valueType;
3958
- const pairs = [...ctx.data.entries()].map(([key, value], index5) => {
4109
+ const pairs = [...ctx.data.entries()].map(([key, value], index6) => {
3959
4110
  return {
3960
- key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [index5, "key"])),
3961
- value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index5, "value"]))
4111
+ key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [index6, "key"])),
4112
+ value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index6, "value"]))
3962
4113
  };
3963
4114
  });
3964
4115
  if (ctx.common.async) {
@@ -4106,12 +4257,7 @@ var ZodFunction = class _ZodFunction extends ZodType {
4106
4257
  return makeIssue({
4107
4258
  data: args,
4108
4259
  path: ctx.path,
4109
- errorMaps: [
4110
- ctx.common.contextualErrorMap,
4111
- ctx.schemaErrorMap,
4112
- getErrorMap(),
4113
- errorMap
4114
- ].filter((x) => !!x),
4260
+ errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
4115
4261
  issueData: {
4116
4262
  code: ZodIssueCode.invalid_arguments,
4117
4263
  argumentsError: error
@@ -4122,12 +4268,7 @@ var ZodFunction = class _ZodFunction extends ZodType {
4122
4268
  return makeIssue({
4123
4269
  data: returns,
4124
4270
  path: ctx.path,
4125
- errorMaps: [
4126
- ctx.common.contextualErrorMap,
4127
- ctx.schemaErrorMap,
4128
- getErrorMap(),
4129
- errorMap
4130
- ].filter((x) => !!x),
4271
+ errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
4131
4272
  issueData: {
4132
4273
  code: ZodIssueCode.invalid_return_type,
4133
4274
  returnTypeError: error
@@ -4251,10 +4392,6 @@ function createZodEnum(values, params) {
4251
4392
  });
4252
4393
  }
4253
4394
  var ZodEnum = class _ZodEnum extends ZodType {
4254
- constructor() {
4255
- super(...arguments);
4256
- _ZodEnum_cache.set(this, void 0);
4257
- }
4258
4395
  _parse(input) {
4259
4396
  if (typeof input.data !== "string") {
4260
4397
  const ctx = this._getOrReturnCtx(input);
@@ -4266,10 +4403,10 @@ var ZodEnum = class _ZodEnum extends ZodType {
4266
4403
  });
4267
4404
  return INVALID;
4268
4405
  }
4269
- if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f")) {
4270
- __classPrivateFieldSet(this, _ZodEnum_cache, new Set(this._def.values), "f");
4406
+ if (!this._cache) {
4407
+ this._cache = new Set(this._def.values);
4271
4408
  }
4272
- if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f").has(input.data)) {
4409
+ if (!this._cache.has(input.data)) {
4273
4410
  const ctx = this._getOrReturnCtx(input);
4274
4411
  const expectedValues = this._def.values;
4275
4412
  addIssueToContext(ctx, {
@@ -4318,13 +4455,8 @@ var ZodEnum = class _ZodEnum extends ZodType {
4318
4455
  });
4319
4456
  }
4320
4457
  };
4321
- _ZodEnum_cache = /* @__PURE__ */ new WeakMap();
4322
4458
  ZodEnum.create = createZodEnum;
4323
4459
  var ZodNativeEnum = class extends ZodType {
4324
- constructor() {
4325
- super(...arguments);
4326
- _ZodNativeEnum_cache.set(this, void 0);
4327
- }
4328
4460
  _parse(input) {
4329
4461
  const nativeEnumValues = util.getValidEnumValues(this._def.values);
4330
4462
  const ctx = this._getOrReturnCtx(input);
@@ -4337,10 +4469,10 @@ var ZodNativeEnum = class extends ZodType {
4337
4469
  });
4338
4470
  return INVALID;
4339
4471
  }
4340
- if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f")) {
4341
- __classPrivateFieldSet(this, _ZodNativeEnum_cache, new Set(util.getValidEnumValues(this._def.values)), "f");
4472
+ if (!this._cache) {
4473
+ this._cache = new Set(util.getValidEnumValues(this._def.values));
4342
4474
  }
4343
- if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f").has(input.data)) {
4475
+ if (!this._cache.has(input.data)) {
4344
4476
  const expectedValues = util.objectValues(nativeEnumValues);
4345
4477
  addIssueToContext(ctx, {
4346
4478
  received: ctx.data,
@@ -4355,7 +4487,6 @@ var ZodNativeEnum = class extends ZodType {
4355
4487
  return this._def.values;
4356
4488
  }
4357
4489
  };
4358
- _ZodNativeEnum_cache = /* @__PURE__ */ new WeakMap();
4359
4490
  ZodNativeEnum.create = (values, params) => {
4360
4491
  return new ZodNativeEnum({
4361
4492
  values,
@@ -4496,7 +4627,7 @@ var ZodEffects = class extends ZodType {
4496
4627
  parent: ctx
4497
4628
  });
4498
4629
  if (!isValid(base))
4499
- return base;
4630
+ return INVALID;
4500
4631
  const result = effect.transform(base.value, checkCtx);
4501
4632
  if (result instanceof Promise) {
4502
4633
  throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
@@ -4505,8 +4636,11 @@ var ZodEffects = class extends ZodType {
4505
4636
  } else {
4506
4637
  return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {
4507
4638
  if (!isValid(base))
4508
- return base;
4509
- return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({ status: status.value, value: result }));
4639
+ return INVALID;
4640
+ return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
4641
+ status: status.value,
4642
+ value: result
4643
+ }));
4510
4644
  });
4511
4645
  }
4512
4646
  }
@@ -4835,83 +4969,341 @@ var nullableType = ZodNullable.create;
4835
4969
  var preprocessType = ZodEffects.createWithPreprocess;
4836
4970
  var pipelineType = ZodPipeline.create;
4837
4971
 
4838
- // src/serializer/mysqlSchema.ts
4972
+ // src/serializer/gelSchema.ts
4973
+ var enumSchema = objectType({
4974
+ name: stringType(),
4975
+ schema: stringType(),
4976
+ values: stringType().array()
4977
+ }).strict();
4978
+ var enumSchemaV1 = objectType({
4979
+ name: stringType(),
4980
+ values: recordType(stringType(), stringType())
4981
+ }).strict();
4982
+ var indexColumn = objectType({
4983
+ expression: stringType(),
4984
+ isExpression: booleanType(),
4985
+ asc: booleanType(),
4986
+ nulls: stringType().optional(),
4987
+ opclass: stringType().optional()
4988
+ });
4839
4989
  var index = objectType({
4840
4990
  name: stringType(),
4841
- columns: stringType().array(),
4991
+ columns: indexColumn.array(),
4842
4992
  isUnique: booleanType(),
4843
- using: enumType(["btree", "hash"]).optional(),
4844
- algorithm: enumType(["default", "inplace", "copy"]).optional(),
4845
- lock: enumType(["default", "none", "shared", "exclusive"]).optional()
4993
+ with: recordType(stringType(), anyType()).optional(),
4994
+ method: stringType().default("btree"),
4995
+ where: stringType().optional(),
4996
+ concurrently: booleanType().default(false)
4846
4997
  }).strict();
4847
4998
  var fk = objectType({
4848
4999
  name: stringType(),
4849
5000
  tableFrom: stringType(),
4850
5001
  columnsFrom: stringType().array(),
4851
5002
  tableTo: stringType(),
5003
+ schemaTo: stringType().optional(),
4852
5004
  columnsTo: stringType().array(),
4853
5005
  onUpdate: stringType().optional(),
4854
5006
  onDelete: stringType().optional()
4855
5007
  }).strict();
5008
+ var sequenceSchema = objectType({
5009
+ name: stringType(),
5010
+ increment: stringType().optional(),
5011
+ minValue: stringType().optional(),
5012
+ maxValue: stringType().optional(),
5013
+ startWith: stringType().optional(),
5014
+ cache: stringType().optional(),
5015
+ cycle: booleanType().optional(),
5016
+ schema: stringType()
5017
+ }).strict();
5018
+ var roleSchema = objectType({
5019
+ name: stringType(),
5020
+ createDb: booleanType().optional(),
5021
+ createRole: booleanType().optional(),
5022
+ inherit: booleanType().optional()
5023
+ }).strict();
5024
+ var sequenceSquashed = objectType({
5025
+ name: stringType(),
5026
+ schema: stringType(),
5027
+ values: stringType()
5028
+ }).strict();
4856
5029
  var column = objectType({
4857
5030
  name: stringType(),
4858
5031
  type: stringType(),
5032
+ typeSchema: stringType().optional(),
4859
5033
  primaryKey: booleanType(),
4860
5034
  notNull: booleanType(),
4861
- autoincrement: booleanType().optional(),
4862
5035
  default: anyType().optional(),
4863
- onUpdate: anyType().optional(),
5036
+ isUnique: anyType().optional(),
5037
+ uniqueName: stringType().optional(),
5038
+ nullsNotDistinct: booleanType().optional(),
4864
5039
  generated: objectType({
4865
- type: enumType(["stored", "virtual"]),
5040
+ type: literalType("stored"),
4866
5041
  as: stringType()
4867
- }).optional()
5042
+ }).optional(),
5043
+ identity: sequenceSchema.merge(objectType({ type: enumType(["always", "byDefault"]) })).optional()
4868
5044
  }).strict();
4869
- var tableV3 = objectType({
5045
+ var checkConstraint = objectType({
4870
5046
  name: stringType(),
4871
- columns: recordType(stringType(), column),
4872
- indexes: recordType(stringType(), index),
4873
- foreignKeys: recordType(stringType(), fk)
5047
+ value: stringType()
4874
5048
  }).strict();
4875
- var compositePK = objectType({
5049
+ var columnSquashed = objectType({
5050
+ name: stringType(),
5051
+ type: stringType(),
5052
+ typeSchema: stringType().optional(),
5053
+ primaryKey: booleanType(),
5054
+ notNull: booleanType(),
5055
+ default: anyType().optional(),
5056
+ isUnique: anyType().optional(),
5057
+ uniqueName: stringType().optional(),
5058
+ nullsNotDistinct: booleanType().optional(),
5059
+ generated: objectType({
5060
+ type: literalType("stored"),
5061
+ as: stringType()
5062
+ }).optional(),
5063
+ identity: stringType().optional()
5064
+ }).strict();
5065
+ var compositePK = objectType({
4876
5066
  name: stringType(),
4877
5067
  columns: stringType().array()
4878
5068
  }).strict();
4879
5069
  var uniqueConstraint = objectType({
4880
5070
  name: stringType(),
4881
- columns: stringType().array()
5071
+ columns: stringType().array(),
5072
+ nullsNotDistinct: booleanType()
4882
5073
  }).strict();
4883
- var checkConstraint = objectType({
5074
+ var policy = objectType({
4884
5075
  name: stringType(),
4885
- value: stringType()
5076
+ as: enumType(["PERMISSIVE", "RESTRICTIVE"]).optional(),
5077
+ for: enumType(["ALL", "SELECT", "INSERT", "UPDATE", "DELETE"]).optional(),
5078
+ to: stringType().array().optional(),
5079
+ using: stringType().optional(),
5080
+ withCheck: stringType().optional(),
5081
+ on: stringType().optional(),
5082
+ schema: stringType().optional()
4886
5083
  }).strict();
4887
- var tableV4 = objectType({
5084
+ var policySquashed = objectType({
4888
5085
  name: stringType(),
4889
- schema: stringType().optional(),
5086
+ values: stringType()
5087
+ }).strict();
5088
+ var viewWithOption = objectType({
5089
+ checkOption: enumType(["local", "cascaded"]).optional(),
5090
+ securityBarrier: booleanType().optional(),
5091
+ securityInvoker: booleanType().optional()
5092
+ }).strict();
5093
+ var matViewWithOption = objectType({
5094
+ fillfactor: numberType().optional(),
5095
+ toastTupleTarget: numberType().optional(),
5096
+ parallelWorkers: numberType().optional(),
5097
+ autovacuumEnabled: booleanType().optional(),
5098
+ vacuumIndexCleanup: enumType(["auto", "off", "on"]).optional(),
5099
+ vacuumTruncate: booleanType().optional(),
5100
+ autovacuumVacuumThreshold: numberType().optional(),
5101
+ autovacuumVacuumScaleFactor: numberType().optional(),
5102
+ autovacuumVacuumCostDelay: numberType().optional(),
5103
+ autovacuumVacuumCostLimit: numberType().optional(),
5104
+ autovacuumFreezeMinAge: numberType().optional(),
5105
+ autovacuumFreezeMaxAge: numberType().optional(),
5106
+ autovacuumFreezeTableAge: numberType().optional(),
5107
+ autovacuumMultixactFreezeMinAge: numberType().optional(),
5108
+ autovacuumMultixactFreezeMaxAge: numberType().optional(),
5109
+ autovacuumMultixactFreezeTableAge: numberType().optional(),
5110
+ logAutovacuumMinDuration: numberType().optional(),
5111
+ userCatalogTable: booleanType().optional()
5112
+ }).strict();
5113
+ var mergedViewWithOption = viewWithOption.merge(matViewWithOption).strict();
5114
+ var view = objectType({
5115
+ name: stringType(),
5116
+ schema: stringType(),
4890
5117
  columns: recordType(stringType(), column),
4891
- indexes: recordType(stringType(), index),
4892
- foreignKeys: recordType(stringType(), fk)
5118
+ definition: stringType().optional(),
5119
+ materialized: booleanType(),
5120
+ with: mergedViewWithOption.optional(),
5121
+ isExisting: booleanType(),
5122
+ withNoData: booleanType().optional(),
5123
+ using: stringType().optional(),
5124
+ tablespace: stringType().optional()
4893
5125
  }).strict();
4894
5126
  var table = objectType({
4895
5127
  name: stringType(),
5128
+ schema: stringType(),
4896
5129
  columns: recordType(stringType(), column),
4897
5130
  indexes: recordType(stringType(), index),
4898
5131
  foreignKeys: recordType(stringType(), fk),
4899
5132
  compositePrimaryKeys: recordType(stringType(), compositePK),
4900
5133
  uniqueConstraints: recordType(stringType(), uniqueConstraint).default({}),
4901
- checkConstraint: recordType(stringType(), checkConstraint).default({})
5134
+ policies: recordType(stringType(), policy).default({}),
5135
+ checkConstraints: recordType(stringType(), checkConstraint).default({}),
5136
+ isRLSEnabled: booleanType().default(false)
5137
+ }).strict();
5138
+ var schemaHash = objectType({
5139
+ id: stringType(),
5140
+ prevId: stringType()
5141
+ });
5142
+ var kitInternals = objectType({
5143
+ tables: recordType(
5144
+ stringType(),
5145
+ objectType({
5146
+ columns: recordType(
5147
+ stringType(),
5148
+ objectType({
5149
+ isArray: booleanType().optional(),
5150
+ dimensions: numberType().optional(),
5151
+ rawType: stringType().optional(),
5152
+ isDefaultAnExpression: booleanType().optional()
5153
+ }).optional()
5154
+ )
5155
+ }).optional()
5156
+ )
5157
+ }).optional();
5158
+ var gelSchemaExternal = objectType({
5159
+ version: literalType("1"),
5160
+ dialect: literalType("gel"),
5161
+ tables: arrayType(table),
5162
+ enums: arrayType(enumSchemaV1),
5163
+ schemas: arrayType(objectType({ name: stringType() })),
5164
+ _meta: objectType({
5165
+ schemas: recordType(stringType(), stringType()),
5166
+ tables: recordType(stringType(), stringType()),
5167
+ columns: recordType(stringType(), stringType())
5168
+ })
5169
+ }).strict();
5170
+ var gelSchemaInternal = objectType({
5171
+ version: literalType("1"),
5172
+ dialect: literalType("gel"),
5173
+ tables: recordType(stringType(), table),
5174
+ enums: recordType(stringType(), enumSchema),
5175
+ schemas: recordType(stringType(), stringType()),
5176
+ views: recordType(stringType(), view).default({}),
5177
+ sequences: recordType(stringType(), sequenceSchema).default({}),
5178
+ roles: recordType(stringType(), roleSchema).default({}),
5179
+ policies: recordType(stringType(), policy).default({}),
5180
+ _meta: objectType({
5181
+ schemas: recordType(stringType(), stringType()),
5182
+ tables: recordType(stringType(), stringType()),
5183
+ columns: recordType(stringType(), stringType())
5184
+ }),
5185
+ internal: kitInternals
5186
+ }).strict();
5187
+ var tableSquashed = objectType({
5188
+ name: stringType(),
5189
+ schema: stringType(),
5190
+ columns: recordType(stringType(), columnSquashed),
5191
+ indexes: recordType(stringType(), stringType()),
5192
+ foreignKeys: recordType(stringType(), stringType()),
5193
+ compositePrimaryKeys: recordType(stringType(), stringType()),
5194
+ uniqueConstraints: recordType(stringType(), stringType()),
5195
+ policies: recordType(stringType(), stringType()),
5196
+ checkConstraints: recordType(stringType(), stringType()),
5197
+ isRLSEnabled: booleanType().default(false)
5198
+ }).strict();
5199
+ var gelSchemaSquashed = objectType({
5200
+ version: literalType("1"),
5201
+ dialect: literalType("gel"),
5202
+ tables: recordType(stringType(), tableSquashed),
5203
+ enums: recordType(stringType(), enumSchema),
5204
+ schemas: recordType(stringType(), stringType()),
5205
+ views: recordType(stringType(), view),
5206
+ sequences: recordType(stringType(), sequenceSquashed),
5207
+ roles: recordType(stringType(), roleSchema).default({}),
5208
+ policies: recordType(stringType(), policySquashed).default({})
5209
+ }).strict();
5210
+ var gelSchema = gelSchemaInternal.merge(schemaHash);
5211
+ var backwardCompatibleGelSchema = gelSchema;
5212
+ var dryGel = gelSchema.parse({
5213
+ version: "1",
5214
+ dialect: "gel",
5215
+ id: originUUID,
5216
+ prevId: "",
5217
+ tables: {},
5218
+ enums: {},
5219
+ schemas: {},
5220
+ policies: {},
5221
+ roles: {},
5222
+ sequences: {},
5223
+ _meta: {
5224
+ schemas: {},
5225
+ tables: {},
5226
+ columns: {}
5227
+ }
5228
+ });
5229
+
5230
+ // src/serializer/mysqlSchema.ts
5231
+ var index2 = objectType({
5232
+ name: stringType(),
5233
+ columns: stringType().array(),
5234
+ isUnique: booleanType(),
5235
+ using: enumType(["btree", "hash"]).optional(),
5236
+ algorithm: enumType(["default", "inplace", "copy"]).optional(),
5237
+ lock: enumType(["default", "none", "shared", "exclusive"]).optional()
5238
+ }).strict();
5239
+ var fk2 = objectType({
5240
+ name: stringType(),
5241
+ tableFrom: stringType(),
5242
+ columnsFrom: stringType().array(),
5243
+ tableTo: stringType(),
5244
+ columnsTo: stringType().array(),
5245
+ onUpdate: stringType().optional(),
5246
+ onDelete: stringType().optional()
5247
+ }).strict();
5248
+ var column2 = objectType({
5249
+ name: stringType(),
5250
+ type: stringType(),
5251
+ primaryKey: booleanType(),
5252
+ notNull: booleanType(),
5253
+ autoincrement: booleanType().optional(),
5254
+ default: anyType().optional(),
5255
+ onUpdate: anyType().optional(),
5256
+ generated: objectType({
5257
+ type: enumType(["stored", "virtual"]),
5258
+ as: stringType()
5259
+ }).optional()
5260
+ }).strict();
5261
+ var tableV3 = objectType({
5262
+ name: stringType(),
5263
+ columns: recordType(stringType(), column2),
5264
+ indexes: recordType(stringType(), index2),
5265
+ foreignKeys: recordType(stringType(), fk2)
5266
+ }).strict();
5267
+ var compositePK2 = objectType({
5268
+ name: stringType(),
5269
+ columns: stringType().array()
5270
+ }).strict();
5271
+ var uniqueConstraint2 = objectType({
5272
+ name: stringType(),
5273
+ columns: stringType().array()
5274
+ }).strict();
5275
+ var checkConstraint2 = objectType({
5276
+ name: stringType(),
5277
+ value: stringType()
5278
+ }).strict();
5279
+ var tableV4 = objectType({
5280
+ name: stringType(),
5281
+ schema: stringType().optional(),
5282
+ columns: recordType(stringType(), column2),
5283
+ indexes: recordType(stringType(), index2),
5284
+ foreignKeys: recordType(stringType(), fk2)
5285
+ }).strict();
5286
+ var table2 = objectType({
5287
+ name: stringType(),
5288
+ columns: recordType(stringType(), column2),
5289
+ indexes: recordType(stringType(), index2),
5290
+ foreignKeys: recordType(stringType(), fk2),
5291
+ compositePrimaryKeys: recordType(stringType(), compositePK2),
5292
+ uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({}),
5293
+ checkConstraint: recordType(stringType(), checkConstraint2).default({})
4902
5294
  }).strict();
4903
5295
  var viewMeta = objectType({
4904
5296
  algorithm: enumType(["undefined", "merge", "temptable"]),
4905
5297
  sqlSecurity: enumType(["definer", "invoker"]),
4906
5298
  withCheckOption: enumType(["local", "cascaded"]).optional()
4907
5299
  }).strict();
4908
- var view = objectType({
5300
+ var view2 = objectType({
4909
5301
  name: stringType(),
4910
- columns: recordType(stringType(), column),
5302
+ columns: recordType(stringType(), column2),
4911
5303
  definition: stringType().optional(),
4912
5304
  isExisting: booleanType()
4913
5305
  }).strict().merge(viewMeta);
4914
- var kitInternals = objectType({
5306
+ var kitInternals2 = objectType({
4915
5307
  tables: recordType(
4916
5308
  stringType(),
4917
5309
  objectType({
@@ -4932,7 +5324,7 @@ var kitInternals = objectType({
4932
5324
  ).optional()
4933
5325
  }).optional();
4934
5326
  var dialect = literalType("mysql");
4935
- var schemaHash = objectType({
5327
+ var schemaHash2 = objectType({
4936
5328
  id: stringType(),
4937
5329
  prevId: stringType()
4938
5330
  });
@@ -4950,47 +5342,47 @@ var schemaInternalV4 = objectType({
4950
5342
  var schemaInternalV5 = objectType({
4951
5343
  version: literalType("5"),
4952
5344
  dialect,
4953
- tables: recordType(stringType(), table),
5345
+ tables: recordType(stringType(), table2),
4954
5346
  schemas: recordType(stringType(), stringType()),
4955
5347
  _meta: objectType({
4956
5348
  schemas: recordType(stringType(), stringType()),
4957
5349
  tables: recordType(stringType(), stringType()),
4958
5350
  columns: recordType(stringType(), stringType())
4959
5351
  }),
4960
- internal: kitInternals
5352
+ internal: kitInternals2
4961
5353
  }).strict();
4962
5354
  var schemaInternal = objectType({
4963
5355
  version: literalType("5"),
4964
5356
  dialect,
4965
- tables: recordType(stringType(), table),
4966
- views: recordType(stringType(), view).default({}),
5357
+ tables: recordType(stringType(), table2),
5358
+ views: recordType(stringType(), view2).default({}),
4967
5359
  _meta: objectType({
4968
5360
  tables: recordType(stringType(), stringType()),
4969
5361
  columns: recordType(stringType(), stringType())
4970
5362
  }),
4971
- internal: kitInternals
5363
+ internal: kitInternals2
4972
5364
  }).strict();
4973
- var schemaV3 = schemaInternalV3.merge(schemaHash);
4974
- var schemaV4 = schemaInternalV4.merge(schemaHash);
4975
- var schemaV5 = schemaInternalV5.merge(schemaHash);
4976
- var schema = schemaInternal.merge(schemaHash);
5365
+ var schemaV3 = schemaInternalV3.merge(schemaHash2);
5366
+ var schemaV4 = schemaInternalV4.merge(schemaHash2);
5367
+ var schemaV5 = schemaInternalV5.merge(schemaHash2);
5368
+ var schema = schemaInternal.merge(schemaHash2);
4977
5369
  var tableSquashedV4 = objectType({
4978
5370
  name: stringType(),
4979
5371
  schema: stringType().optional(),
4980
- columns: recordType(stringType(), column),
5372
+ columns: recordType(stringType(), column2),
4981
5373
  indexes: recordType(stringType(), stringType()),
4982
5374
  foreignKeys: recordType(stringType(), stringType())
4983
5375
  }).strict();
4984
- var tableSquashed = objectType({
5376
+ var tableSquashed2 = objectType({
4985
5377
  name: stringType(),
4986
- columns: recordType(stringType(), column),
5378
+ columns: recordType(stringType(), column2),
4987
5379
  indexes: recordType(stringType(), stringType()),
4988
5380
  foreignKeys: recordType(stringType(), stringType()),
4989
5381
  compositePrimaryKeys: recordType(stringType(), stringType()),
4990
5382
  uniqueConstraints: recordType(stringType(), stringType()).default({}),
4991
5383
  checkConstraints: recordType(stringType(), stringType()).default({})
4992
5384
  }).strict();
4993
- var viewSquashed = view.omit({
5385
+ var viewSquashed = view2.omit({
4994
5386
  algorithm: true,
4995
5387
  sqlSecurity: true,
4996
5388
  withCheckOption: true
@@ -4998,7 +5390,7 @@ var viewSquashed = view.omit({
4998
5390
  var schemaSquashed = objectType({
4999
5391
  version: literalType("5"),
5000
5392
  dialect,
5001
- tables: recordType(stringType(), tableSquashed),
5393
+ tables: recordType(stringType(), tableSquashed2),
5002
5394
  views: recordType(stringType(), viewSquashed)
5003
5395
  }).strict();
5004
5396
  var schemaSquashedV4 = objectType({
@@ -5049,7 +5441,7 @@ var tableV2 = objectType({
5049
5441
  columns: recordType(stringType(), columnV2),
5050
5442
  indexes: recordType(stringType(), indexV2)
5051
5443
  }).strict();
5052
- var checkConstraint2 = objectType({
5444
+ var checkConstraint3 = objectType({
5053
5445
  name: stringType().optional(),
5054
5446
  value: stringType()
5055
5447
  }).strict();
@@ -5059,13 +5451,13 @@ var domainSchema = objectType({
5059
5451
  baseType: stringType(),
5060
5452
  notNull: booleanType().optional(),
5061
5453
  defaultValue: anyType().optional(),
5062
- checkConstraints: recordType(stringType(), checkConstraint2).optional()
5454
+ checkConstraints: recordType(stringType(), checkConstraint3).optional()
5063
5455
  }).strict();
5064
- var enumSchemaV1 = objectType({
5456
+ var enumSchemaV12 = objectType({
5065
5457
  name: stringType(),
5066
5458
  values: recordType(stringType(), stringType())
5067
5459
  }).strict();
5068
- var enumSchema = objectType({
5460
+ var enumSchema2 = objectType({
5069
5461
  name: stringType(),
5070
5462
  schema: stringType(),
5071
5463
  values: stringType().array()
@@ -5073,7 +5465,7 @@ var enumSchema = objectType({
5073
5465
  var pgSchemaV2 = objectType({
5074
5466
  version: literalType("2"),
5075
5467
  tables: recordType(stringType(), tableV2),
5076
- enums: recordType(stringType(), enumSchemaV1)
5468
+ enums: recordType(stringType(), enumSchemaV12)
5077
5469
  }).strict();
5078
5470
  var references = objectType({
5079
5471
  foreignKeyName: stringType(),
@@ -5098,18 +5490,18 @@ var tableV1 = objectType({
5098
5490
  var pgSchemaV1 = objectType({
5099
5491
  version: literalType("1"),
5100
5492
  tables: recordType(stringType(), tableV1),
5101
- enums: recordType(stringType(), enumSchemaV1)
5493
+ enums: recordType(stringType(), enumSchemaV12)
5102
5494
  }).strict();
5103
- var indexColumn = objectType({
5495
+ var indexColumn2 = objectType({
5104
5496
  expression: stringType(),
5105
5497
  isExpression: booleanType(),
5106
5498
  asc: booleanType(),
5107
5499
  nulls: stringType().optional(),
5108
5500
  opclass: stringType().optional()
5109
5501
  });
5110
- var index2 = objectType({
5502
+ var index3 = objectType({
5111
5503
  name: stringType(),
5112
- columns: indexColumn.array(),
5504
+ columns: indexColumn2.array(),
5113
5505
  isUnique: booleanType(),
5114
5506
  with: recordType(stringType(), anyType()).optional(),
5115
5507
  method: stringType().default("btree"),
@@ -5143,7 +5535,7 @@ var indexV6 = objectType({
5143
5535
  where: stringType().optional(),
5144
5536
  concurrently: booleanType().default(false)
5145
5537
  }).strict();
5146
- var fk2 = objectType({
5538
+ var fk3 = objectType({
5147
5539
  name: stringType(),
5148
5540
  tableFrom: stringType(),
5149
5541
  columnsFrom: stringType().array(),
@@ -5153,7 +5545,7 @@ var fk2 = objectType({
5153
5545
  onUpdate: stringType().optional(),
5154
5546
  onDelete: stringType().optional()
5155
5547
  }).strict();
5156
- var sequenceSchema = objectType({
5548
+ var sequenceSchema2 = objectType({
5157
5549
  name: stringType(),
5158
5550
  increment: stringType().optional(),
5159
5551
  minValue: stringType().optional(),
@@ -5163,13 +5555,13 @@ var sequenceSchema = objectType({
5163
5555
  cycle: booleanType().optional(),
5164
5556
  schema: stringType()
5165
5557
  }).strict();
5166
- var roleSchema = objectType({
5558
+ var roleSchema2 = objectType({
5167
5559
  name: stringType(),
5168
5560
  createDb: booleanType().optional(),
5169
5561
  createRole: booleanType().optional(),
5170
5562
  inherit: booleanType().optional()
5171
5563
  }).strict();
5172
- var sequenceSquashed = objectType({
5564
+ var sequenceSquashed2 = objectType({
5173
5565
  name: stringType(),
5174
5566
  schema: stringType(),
5175
5567
  values: stringType()
@@ -5185,7 +5577,7 @@ var columnV7 = objectType({
5185
5577
  uniqueName: stringType().optional(),
5186
5578
  nullsNotDistinct: booleanType().optional()
5187
5579
  }).strict();
5188
- var column2 = objectType({
5580
+ var column3 = objectType({
5189
5581
  name: stringType(),
5190
5582
  type: stringType(),
5191
5583
  typeSchema: stringType().optional(),
@@ -5199,9 +5591,9 @@ var column2 = objectType({
5199
5591
  type: literalType("stored"),
5200
5592
  as: stringType()
5201
5593
  }).optional(),
5202
- identity: sequenceSchema.merge(objectType({ type: enumType(["always", "byDefault"]) })).optional()
5594
+ identity: sequenceSchema2.merge(objectType({ type: enumType(["always", "byDefault"]) })).optional()
5203
5595
  }).strict();
5204
- var columnSquashed = objectType({
5596
+ var columnSquashed2 = objectType({
5205
5597
  name: stringType(),
5206
5598
  type: stringType(),
5207
5599
  typeSchema: stringType().optional(),
@@ -5219,20 +5611,20 @@ var columnSquashed = objectType({
5219
5611
  }).strict();
5220
5612
  var tableV32 = objectType({
5221
5613
  name: stringType(),
5222
- columns: recordType(stringType(), column2),
5223
- indexes: recordType(stringType(), index2),
5224
- foreignKeys: recordType(stringType(), fk2)
5614
+ columns: recordType(stringType(), column3),
5615
+ indexes: recordType(stringType(), index3),
5616
+ foreignKeys: recordType(stringType(), fk3)
5225
5617
  }).strict();
5226
- var compositePK2 = objectType({
5618
+ var compositePK3 = objectType({
5227
5619
  name: stringType(),
5228
5620
  columns: stringType().array()
5229
5621
  }).strict();
5230
- var uniqueConstraint2 = objectType({
5622
+ var uniqueConstraint3 = objectType({
5231
5623
  name: stringType(),
5232
5624
  columns: stringType().array(),
5233
5625
  nullsNotDistinct: booleanType()
5234
5626
  }).strict();
5235
- var policy = objectType({
5627
+ var policy2 = objectType({
5236
5628
  name: stringType(),
5237
5629
  as: enumType(["PERMISSIVE", "RESTRICTIVE"]).optional(),
5238
5630
  for: enumType(["ALL", "SELECT", "INSERT", "UPDATE", "DELETE"]).optional(),
@@ -5242,16 +5634,16 @@ var policy = objectType({
5242
5634
  on: stringType().optional(),
5243
5635
  schema: stringType().optional()
5244
5636
  }).strict();
5245
- var policySquashed = objectType({
5637
+ var policySquashed2 = objectType({
5246
5638
  name: stringType(),
5247
5639
  values: stringType()
5248
5640
  }).strict();
5249
- var viewWithOption = objectType({
5641
+ var viewWithOption2 = objectType({
5250
5642
  checkOption: enumType(["local", "cascaded"]).optional(),
5251
5643
  securityBarrier: booleanType().optional(),
5252
5644
  securityInvoker: booleanType().optional()
5253
5645
  }).strict();
5254
- var matViewWithOption = objectType({
5646
+ var matViewWithOption2 = objectType({
5255
5647
  fillfactor: numberType().optional(),
5256
5648
  toastTupleTarget: numberType().optional(),
5257
5649
  parallelWorkers: numberType().optional(),
@@ -5271,14 +5663,14 @@ var matViewWithOption = objectType({
5271
5663
  logAutovacuumMinDuration: numberType().optional(),
5272
5664
  userCatalogTable: booleanType().optional()
5273
5665
  }).strict();
5274
- var mergedViewWithOption = viewWithOption.merge(matViewWithOption).strict();
5275
- var view2 = objectType({
5666
+ var mergedViewWithOption2 = viewWithOption2.merge(matViewWithOption2).strict();
5667
+ var view3 = objectType({
5276
5668
  name: stringType(),
5277
5669
  schema: stringType(),
5278
- columns: recordType(stringType(), column2),
5670
+ columns: recordType(stringType(), column3),
5279
5671
  definition: stringType().optional(),
5280
5672
  materialized: booleanType(),
5281
- with: mergedViewWithOption.optional(),
5673
+ with: mergedViewWithOption2.optional(),
5282
5674
  isExisting: booleanType(),
5283
5675
  withNoData: booleanType().optional(),
5284
5676
  using: stringType().optional(),
@@ -5287,54 +5679,54 @@ var view2 = objectType({
5287
5679
  var tableV42 = objectType({
5288
5680
  name: stringType(),
5289
5681
  schema: stringType(),
5290
- columns: recordType(stringType(), column2),
5682
+ columns: recordType(stringType(), column3),
5291
5683
  indexes: recordType(stringType(), indexV4),
5292
- foreignKeys: recordType(stringType(), fk2)
5684
+ foreignKeys: recordType(stringType(), fk3)
5293
5685
  }).strict();
5294
5686
  var tableV5 = objectType({
5295
5687
  name: stringType(),
5296
5688
  schema: stringType(),
5297
- columns: recordType(stringType(), column2),
5689
+ columns: recordType(stringType(), column3),
5298
5690
  indexes: recordType(stringType(), indexV5),
5299
- foreignKeys: recordType(stringType(), fk2),
5300
- compositePrimaryKeys: recordType(stringType(), compositePK2),
5301
- uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({})
5691
+ foreignKeys: recordType(stringType(), fk3),
5692
+ compositePrimaryKeys: recordType(stringType(), compositePK3),
5693
+ uniqueConstraints: recordType(stringType(), uniqueConstraint3).default({})
5302
5694
  }).strict();
5303
5695
  var tableV6 = objectType({
5304
5696
  name: stringType(),
5305
5697
  schema: stringType(),
5306
- columns: recordType(stringType(), column2),
5698
+ columns: recordType(stringType(), column3),
5307
5699
  indexes: recordType(stringType(), indexV6),
5308
- foreignKeys: recordType(stringType(), fk2),
5309
- compositePrimaryKeys: recordType(stringType(), compositePK2),
5310
- uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({})
5700
+ foreignKeys: recordType(stringType(), fk3),
5701
+ compositePrimaryKeys: recordType(stringType(), compositePK3),
5702
+ uniqueConstraints: recordType(stringType(), uniqueConstraint3).default({})
5311
5703
  }).strict();
5312
5704
  var tableV7 = objectType({
5313
5705
  name: stringType(),
5314
5706
  schema: stringType(),
5315
5707
  columns: recordType(stringType(), columnV7),
5316
- indexes: recordType(stringType(), index2),
5317
- foreignKeys: recordType(stringType(), fk2),
5318
- compositePrimaryKeys: recordType(stringType(), compositePK2),
5319
- uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({})
5708
+ indexes: recordType(stringType(), index3),
5709
+ foreignKeys: recordType(stringType(), fk3),
5710
+ compositePrimaryKeys: recordType(stringType(), compositePK3),
5711
+ uniqueConstraints: recordType(stringType(), uniqueConstraint3).default({})
5320
5712
  }).strict();
5321
- var table2 = objectType({
5713
+ var table3 = objectType({
5322
5714
  name: stringType(),
5323
5715
  schema: stringType(),
5324
- columns: recordType(stringType(), column2),
5325
- indexes: recordType(stringType(), index2),
5326
- foreignKeys: recordType(stringType(), fk2),
5327
- compositePrimaryKeys: recordType(stringType(), compositePK2),
5328
- uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({}),
5329
- policies: recordType(stringType(), policy).default({}),
5330
- checkConstraints: recordType(stringType(), checkConstraint2).default({}),
5716
+ columns: recordType(stringType(), column3),
5717
+ indexes: recordType(stringType(), index3),
5718
+ foreignKeys: recordType(stringType(), fk3),
5719
+ compositePrimaryKeys: recordType(stringType(), compositePK3),
5720
+ uniqueConstraints: recordType(stringType(), uniqueConstraint3).default({}),
5721
+ policies: recordType(stringType(), policy2).default({}),
5722
+ checkConstraints: recordType(stringType(), checkConstraint3).default({}),
5331
5723
  isRLSEnabled: booleanType().default(false)
5332
5724
  }).strict();
5333
- var schemaHash2 = objectType({
5725
+ var schemaHash3 = objectType({
5334
5726
  id: stringType(),
5335
5727
  prevId: stringType()
5336
5728
  });
5337
- var kitInternals2 = objectType({
5729
+ var kitInternals3 = objectType({
5338
5730
  tables: recordType(
5339
5731
  stringType(),
5340
5732
  objectType({
@@ -5354,46 +5746,46 @@ var pgSchemaInternalV3 = objectType({
5354
5746
  version: literalType("3"),
5355
5747
  dialect: literalType("pg"),
5356
5748
  tables: recordType(stringType(), tableV32),
5357
- enums: recordType(stringType(), enumSchemaV1)
5749
+ enums: recordType(stringType(), enumSchemaV12)
5358
5750
  }).strict();
5359
5751
  var pgSchemaInternalV4 = objectType({
5360
5752
  version: literalType("4"),
5361
5753
  dialect: literalType("pg"),
5362
5754
  tables: recordType(stringType(), tableV42),
5363
- enums: recordType(stringType(), enumSchemaV1),
5755
+ enums: recordType(stringType(), enumSchemaV12),
5364
5756
  schemas: recordType(stringType(), stringType())
5365
5757
  }).strict();
5366
5758
  var pgSchemaInternalV5 = objectType({
5367
5759
  version: literalType("5"),
5368
5760
  dialect: literalType("pg"),
5369
5761
  tables: recordType(stringType(), tableV5),
5370
- enums: recordType(stringType(), enumSchemaV1),
5762
+ enums: recordType(stringType(), enumSchemaV12),
5371
5763
  schemas: recordType(stringType(), stringType()),
5372
5764
  _meta: objectType({
5373
5765
  schemas: recordType(stringType(), stringType()),
5374
5766
  tables: recordType(stringType(), stringType()),
5375
5767
  columns: recordType(stringType(), stringType())
5376
5768
  }),
5377
- internal: kitInternals2
5769
+ internal: kitInternals3
5378
5770
  }).strict();
5379
5771
  var pgSchemaInternalV6 = objectType({
5380
5772
  version: literalType("6"),
5381
5773
  dialect: literalType("postgresql"),
5382
5774
  tables: recordType(stringType(), tableV6),
5383
- enums: recordType(stringType(), enumSchema),
5775
+ enums: recordType(stringType(), enumSchema2),
5384
5776
  schemas: recordType(stringType(), stringType()),
5385
5777
  _meta: objectType({
5386
5778
  schemas: recordType(stringType(), stringType()),
5387
5779
  tables: recordType(stringType(), stringType()),
5388
5780
  columns: recordType(stringType(), stringType())
5389
5781
  }),
5390
- internal: kitInternals2
5782
+ internal: kitInternals3
5391
5783
  }).strict();
5392
5784
  var pgSchemaExternal = objectType({
5393
5785
  version: literalType("5"),
5394
5786
  dialect: literalType("pg"),
5395
- tables: arrayType(table2),
5396
- enums: arrayType(enumSchemaV1),
5787
+ tables: arrayType(table3),
5788
+ enums: arrayType(enumSchemaV12),
5397
5789
  schemas: arrayType(objectType({ name: stringType() })),
5398
5790
  _meta: objectType({
5399
5791
  schemas: recordType(stringType(), stringType()),
@@ -5405,36 +5797,33 @@ var pgSchemaInternalV7 = objectType({
5405
5797
  version: literalType("7"),
5406
5798
  dialect: literalType("postgresql"),
5407
5799
  tables: recordType(stringType(), tableV7),
5408
- enums: recordType(stringType(), enumSchema),
5800
+ enums: recordType(stringType(), enumSchema2),
5409
5801
  schemas: recordType(stringType(), stringType()),
5410
- views: recordType(stringType(), view2).default({}),
5411
- sequences: recordType(stringType(), sequenceSchema).default({}),
5412
- roles: recordType(stringType(), roleSchema).default({}),
5413
- policies: recordType(stringType(), policy).default({}),
5802
+ sequences: recordType(stringType(), sequenceSchema2),
5414
5803
  _meta: objectType({
5415
5804
  schemas: recordType(stringType(), stringType()),
5416
5805
  tables: recordType(stringType(), stringType()),
5417
5806
  columns: recordType(stringType(), stringType())
5418
5807
  }),
5419
- internal: kitInternals2
5808
+ internal: kitInternals3
5420
5809
  }).strict();
5421
5810
  var pgSchemaInternal = objectType({
5422
- version: literalType(snapshotVersion),
5811
+ version: literalType("7"),
5423
5812
  dialect: literalType("postgresql"),
5424
- tables: recordType(stringType(), table2),
5425
- enums: recordType(stringType(), enumSchema),
5813
+ tables: recordType(stringType(), table3),
5814
+ enums: recordType(stringType(), enumSchema2),
5426
5815
  schemas: recordType(stringType(), stringType()),
5427
- domains: recordType(stringType(), domainSchema),
5428
- views: recordType(stringType(), view2).default({}),
5429
- sequences: recordType(stringType(), sequenceSchema).default({}),
5430
- roles: recordType(stringType(), roleSchema).default({}),
5431
- policies: recordType(stringType(), policy).default({}),
5816
+ domains: recordType(stringType(), domainSchema).default({}),
5817
+ views: recordType(stringType(), view3).default({}),
5818
+ sequences: recordType(stringType(), sequenceSchema2).default({}),
5819
+ roles: recordType(stringType(), roleSchema2).default({}),
5820
+ policies: recordType(stringType(), policy2).default({}),
5432
5821
  _meta: objectType({
5433
5822
  schemas: recordType(stringType(), stringType()),
5434
5823
  tables: recordType(stringType(), stringType()),
5435
5824
  columns: recordType(stringType(), stringType())
5436
5825
  }),
5437
- internal: kitInternals2
5826
+ internal: kitInternals3
5438
5827
  }).strict();
5439
5828
  var domainSquashed = objectType({
5440
5829
  name: stringType(),
@@ -5444,10 +5833,10 @@ var domainSquashed = objectType({
5444
5833
  defaultValue: stringType().optional(),
5445
5834
  checkConstraints: recordType(stringType(), stringType()).optional()
5446
5835
  }).strict();
5447
- var tableSquashed2 = objectType({
5836
+ var tableSquashed3 = objectType({
5448
5837
  name: stringType(),
5449
5838
  schema: stringType(),
5450
- columns: recordType(stringType(), columnSquashed),
5839
+ columns: recordType(stringType(), columnSquashed2),
5451
5840
  indexes: recordType(stringType(), stringType()),
5452
5841
  foreignKeys: recordType(stringType(), stringType()),
5453
5842
  compositePrimaryKeys: recordType(stringType(), stringType()),
@@ -5459,7 +5848,7 @@ var tableSquashed2 = objectType({
5459
5848
  var tableSquashedV42 = objectType({
5460
5849
  name: stringType(),
5461
5850
  schema: stringType(),
5462
- columns: recordType(stringType(), column2),
5851
+ columns: recordType(stringType(), column3),
5463
5852
  indexes: recordType(stringType(), stringType()),
5464
5853
  foreignKeys: recordType(stringType(), stringType())
5465
5854
  }).strict();
@@ -5467,52 +5856,41 @@ var pgSchemaSquashedV4 = objectType({
5467
5856
  version: literalType("4"),
5468
5857
  dialect: literalType("pg"),
5469
5858
  tables: recordType(stringType(), tableSquashedV42),
5470
- enums: recordType(stringType(), enumSchemaV1),
5859
+ enums: recordType(stringType(), enumSchemaV12),
5471
5860
  schemas: recordType(stringType(), stringType())
5472
5861
  }).strict();
5473
5862
  var pgSchemaSquashedV6 = objectType({
5474
5863
  version: literalType("6"),
5475
5864
  dialect: literalType("postgresql"),
5476
- tables: recordType(stringType(), tableSquashed2),
5477
- enums: recordType(stringType(), enumSchema),
5865
+ tables: recordType(stringType(), tableSquashed3),
5866
+ enums: recordType(stringType(), enumSchema2),
5478
5867
  schemas: recordType(stringType(), stringType())
5479
5868
  }).strict();
5480
- var pgSchemaSquashedV7 = objectType({
5481
- version: literalType("7"),
5482
- dialect: literalType("postgresql"),
5483
- tables: recordType(stringType(), tableSquashed2),
5484
- enums: recordType(stringType(), enumSchema),
5485
- schemas: recordType(stringType(), stringType()),
5486
- views: recordType(stringType(), view2),
5487
- sequences: recordType(stringType(), sequenceSquashed),
5488
- roles: recordType(stringType(), roleSchema).default({}),
5489
- policies: recordType(stringType(), policySquashed).default({})
5490
- }).strict();
5491
5869
  var pgSchemaSquashed = objectType({
5492
- version: literalType(snapshotVersion),
5870
+ version: literalType("7"),
5493
5871
  dialect: literalType("postgresql"),
5494
- tables: recordType(stringType(), tableSquashed2),
5495
- domains: recordType(stringType(), domainSquashed),
5496
- enums: recordType(stringType(), enumSchema),
5872
+ tables: recordType(stringType(), tableSquashed3),
5873
+ domains: recordType(stringType(), domainSquashed).default({}),
5874
+ enums: recordType(stringType(), enumSchema2),
5497
5875
  schemas: recordType(stringType(), stringType()),
5498
- views: recordType(stringType(), view2),
5499
- sequences: recordType(stringType(), sequenceSquashed),
5500
- roles: recordType(stringType(), roleSchema).default({}),
5501
- policies: recordType(stringType(), policySquashed).default({})
5876
+ views: recordType(stringType(), view3),
5877
+ sequences: recordType(stringType(), sequenceSquashed2),
5878
+ roles: recordType(stringType(), roleSchema2).default({}),
5879
+ policies: recordType(stringType(), policySquashed2).default({})
5502
5880
  }).strict();
5503
- var pgSchemaV3 = pgSchemaInternalV3.merge(schemaHash2);
5504
- var pgSchemaV4 = pgSchemaInternalV4.merge(schemaHash2);
5505
- var pgSchemaV5 = pgSchemaInternalV5.merge(schemaHash2);
5506
- var pgSchemaV6 = pgSchemaInternalV6.merge(schemaHash2);
5507
- var pgSchemaV7 = pgSchemaInternalV7.merge(schemaHash2);
5508
- var pgSchema = pgSchemaInternal.merge(schemaHash2);
5881
+ var pgSchemaV3 = pgSchemaInternalV3.merge(schemaHash3);
5882
+ var pgSchemaV4 = pgSchemaInternalV4.merge(schemaHash3);
5883
+ var pgSchemaV5 = pgSchemaInternalV5.merge(schemaHash3);
5884
+ var pgSchemaV6 = pgSchemaInternalV6.merge(schemaHash3);
5885
+ var pgSchemaV7 = pgSchemaInternalV7.merge(schemaHash3);
5886
+ var pgSchema = pgSchemaInternal.merge(schemaHash3);
5509
5887
  var backwardCompatiblePgSchema = unionType([
5510
5888
  pgSchemaV5,
5511
5889
  pgSchemaV6,
5512
5890
  pgSchema
5513
5891
  ]);
5514
5892
  var dryPg = pgSchema.parse({
5515
- version: snapshotVersion,
5893
+ version: "7",
5516
5894
  dialect: "postgresql",
5517
5895
  id: originUUID,
5518
5896
  prevId: "",
@@ -5531,7 +5909,7 @@ var dryPg = pgSchema.parse({
5531
5909
  });
5532
5910
 
5533
5911
  // src/serializer/singlestoreSchema.ts
5534
- var index3 = objectType({
5912
+ var index4 = objectType({
5535
5913
  name: stringType(),
5536
5914
  columns: stringType().array(),
5537
5915
  isUnique: booleanType(),
@@ -5539,7 +5917,7 @@ var index3 = objectType({
5539
5917
  algorithm: enumType(["default", "inplace", "copy"]).optional(),
5540
5918
  lock: enumType(["default", "none", "shared", "exclusive"]).optional()
5541
5919
  }).strict();
5542
- var column3 = objectType({
5920
+ var column4 = objectType({
5543
5921
  name: stringType(),
5544
5922
  type: stringType(),
5545
5923
  primaryKey: booleanType(),
@@ -5552,27 +5930,27 @@ var column3 = objectType({
5552
5930
  as: stringType()
5553
5931
  }).optional()
5554
5932
  }).strict();
5555
- var compositePK3 = objectType({
5933
+ var compositePK4 = objectType({
5556
5934
  name: stringType(),
5557
5935
  columns: stringType().array()
5558
5936
  }).strict();
5559
- var uniqueConstraint3 = objectType({
5937
+ var uniqueConstraint4 = objectType({
5560
5938
  name: stringType(),
5561
5939
  columns: stringType().array()
5562
5940
  }).strict();
5563
- var table3 = objectType({
5941
+ var table4 = objectType({
5564
5942
  name: stringType(),
5565
- columns: recordType(stringType(), column3),
5566
- indexes: recordType(stringType(), index3),
5567
- compositePrimaryKeys: recordType(stringType(), compositePK3),
5568
- uniqueConstraints: recordType(stringType(), uniqueConstraint3).default({})
5943
+ columns: recordType(stringType(), column4),
5944
+ indexes: recordType(stringType(), index4),
5945
+ compositePrimaryKeys: recordType(stringType(), compositePK4),
5946
+ uniqueConstraints: recordType(stringType(), uniqueConstraint4).default({})
5569
5947
  }).strict();
5570
5948
  var viewMeta2 = objectType({
5571
5949
  algorithm: enumType(["undefined", "merge", "temptable"]),
5572
5950
  sqlSecurity: enumType(["definer", "invoker"]),
5573
5951
  withCheckOption: enumType(["local", "cascaded"]).optional()
5574
5952
  }).strict();
5575
- var kitInternals3 = objectType({
5953
+ var kitInternals4 = objectType({
5576
5954
  tables: recordType(
5577
5955
  stringType(),
5578
5956
  objectType({
@@ -5593,25 +5971,25 @@ var kitInternals3 = objectType({
5593
5971
  ).optional()
5594
5972
  }).optional();
5595
5973
  var dialect2 = literalType("singlestore");
5596
- var schemaHash3 = objectType({
5974
+ var schemaHash4 = objectType({
5597
5975
  id: stringType(),
5598
5976
  prevId: stringType()
5599
5977
  });
5600
5978
  var schemaInternal2 = objectType({
5601
5979
  version: literalType("1"),
5602
5980
  dialect: dialect2,
5603
- tables: recordType(stringType(), table3),
5981
+ tables: recordType(stringType(), table4),
5604
5982
  /* views: record(string(), view).default({}), */
5605
5983
  _meta: objectType({
5606
5984
  tables: recordType(stringType(), stringType()),
5607
5985
  columns: recordType(stringType(), stringType())
5608
5986
  }),
5609
- internal: kitInternals3
5987
+ internal: kitInternals4
5610
5988
  }).strict();
5611
- var schema2 = schemaInternal2.merge(schemaHash3);
5612
- var tableSquashed3 = objectType({
5989
+ var schema2 = schemaInternal2.merge(schemaHash4);
5990
+ var tableSquashed4 = objectType({
5613
5991
  name: stringType(),
5614
- columns: recordType(stringType(), column3),
5992
+ columns: recordType(stringType(), column4),
5615
5993
  indexes: recordType(stringType(), stringType()),
5616
5994
  compositePrimaryKeys: recordType(stringType(), stringType()),
5617
5995
  uniqueConstraints: recordType(stringType(), stringType()).default({})
@@ -5619,7 +5997,7 @@ var tableSquashed3 = objectType({
5619
5997
  var schemaSquashed2 = objectType({
5620
5998
  version: literalType("1"),
5621
5999
  dialect: dialect2,
5622
- tables: recordType(stringType(), tableSquashed3)
6000
+ tables: recordType(stringType(), tableSquashed4)
5623
6001
  /* views: record(string(), viewSquashed), */
5624
6002
  }).strict();
5625
6003
  var singlestoreSchema = schema2;
@@ -5640,13 +6018,13 @@ var drySingleStore = singlestoreSchema.parse({
5640
6018
  });
5641
6019
 
5642
6020
  // src/serializer/sqliteSchema.ts
5643
- var index4 = objectType({
6021
+ var index5 = objectType({
5644
6022
  name: stringType(),
5645
6023
  columns: stringType().array(),
5646
6024
  where: stringType().optional(),
5647
6025
  isUnique: booleanType()
5648
6026
  }).strict();
5649
- var fk3 = objectType({
6027
+ var fk4 = objectType({
5650
6028
  name: stringType(),
5651
6029
  tableFrom: stringType(),
5652
6030
  columnsFrom: stringType().array(),
@@ -5655,11 +6033,11 @@ var fk3 = objectType({
5655
6033
  onUpdate: stringType().optional(),
5656
6034
  onDelete: stringType().optional()
5657
6035
  }).strict();
5658
- var compositePK4 = objectType({
6036
+ var compositePK5 = objectType({
5659
6037
  columns: stringType().array(),
5660
6038
  name: stringType().optional()
5661
6039
  }).strict();
5662
- var column4 = objectType({
6040
+ var column5 = objectType({
5663
6041
  name: stringType(),
5664
6042
  type: stringType(),
5665
6043
  primaryKey: booleanType(),
@@ -5673,35 +6051,35 @@ var column4 = objectType({
5673
6051
  }).strict();
5674
6052
  var tableV33 = objectType({
5675
6053
  name: stringType(),
5676
- columns: recordType(stringType(), column4),
5677
- indexes: recordType(stringType(), index4),
5678
- foreignKeys: recordType(stringType(), fk3)
6054
+ columns: recordType(stringType(), column5),
6055
+ indexes: recordType(stringType(), index5),
6056
+ foreignKeys: recordType(stringType(), fk4)
5679
6057
  }).strict();
5680
- var uniqueConstraint4 = objectType({
6058
+ var uniqueConstraint5 = objectType({
5681
6059
  name: stringType(),
5682
6060
  columns: stringType().array()
5683
6061
  }).strict();
5684
- var checkConstraint3 = objectType({
6062
+ var checkConstraint4 = objectType({
5685
6063
  name: stringType(),
5686
6064
  value: stringType()
5687
6065
  }).strict();
5688
- var table4 = objectType({
6066
+ var table5 = objectType({
5689
6067
  name: stringType(),
5690
- columns: recordType(stringType(), column4),
5691
- indexes: recordType(stringType(), index4),
5692
- foreignKeys: recordType(stringType(), fk3),
5693
- compositePrimaryKeys: recordType(stringType(), compositePK4),
5694
- uniqueConstraints: recordType(stringType(), uniqueConstraint4).default({}),
5695
- checkConstraints: recordType(stringType(), checkConstraint3).default({})
6068
+ columns: recordType(stringType(), column5),
6069
+ indexes: recordType(stringType(), index5),
6070
+ foreignKeys: recordType(stringType(), fk4),
6071
+ compositePrimaryKeys: recordType(stringType(), compositePK5),
6072
+ uniqueConstraints: recordType(stringType(), uniqueConstraint5).default({}),
6073
+ checkConstraints: recordType(stringType(), checkConstraint4).default({})
5696
6074
  }).strict();
5697
- var view3 = objectType({
6075
+ var view4 = objectType({
5698
6076
  name: stringType(),
5699
- columns: recordType(stringType(), column4),
6077
+ columns: recordType(stringType(), column5),
5700
6078
  definition: stringType().optional(),
5701
6079
  isExisting: booleanType()
5702
6080
  }).strict();
5703
6081
  var dialect3 = enumType(["sqlite"]);
5704
- var schemaHash4 = objectType({
6082
+ var schemaHash5 = objectType({
5705
6083
  id: stringType(),
5706
6084
  prevId: stringType()
5707
6085
  }).strict();
@@ -5714,21 +6092,21 @@ var schemaInternalV32 = objectType({
5714
6092
  var schemaInternalV42 = objectType({
5715
6093
  version: literalType("4"),
5716
6094
  dialect: dialect3,
5717
- tables: recordType(stringType(), table4),
5718
- views: recordType(stringType(), view3).default({}),
6095
+ tables: recordType(stringType(), table5),
6096
+ views: recordType(stringType(), view4).default({}),
5719
6097
  enums: objectType({})
5720
6098
  }).strict();
5721
6099
  var schemaInternalV52 = objectType({
5722
6100
  version: literalType("5"),
5723
6101
  dialect: dialect3,
5724
- tables: recordType(stringType(), table4),
6102
+ tables: recordType(stringType(), table5),
5725
6103
  enums: objectType({}),
5726
6104
  _meta: objectType({
5727
6105
  tables: recordType(stringType(), stringType()),
5728
6106
  columns: recordType(stringType(), stringType())
5729
6107
  })
5730
6108
  }).strict();
5731
- var kitInternals4 = objectType({
6109
+ var kitInternals5 = objectType({
5732
6110
  indexes: recordType(
5733
6111
  stringType(),
5734
6112
  objectType({
@@ -5743,22 +6121,22 @@ var latestVersion = literalType("6");
5743
6121
  var schemaInternal3 = objectType({
5744
6122
  version: latestVersion,
5745
6123
  dialect: dialect3,
5746
- tables: recordType(stringType(), table4),
5747
- views: recordType(stringType(), view3).default({}),
6124
+ tables: recordType(stringType(), table5),
6125
+ views: recordType(stringType(), view4).default({}),
5748
6126
  enums: objectType({}),
5749
6127
  _meta: objectType({
5750
6128
  tables: recordType(stringType(), stringType()),
5751
6129
  columns: recordType(stringType(), stringType())
5752
6130
  }),
5753
- internal: kitInternals4
6131
+ internal: kitInternals5
5754
6132
  }).strict();
5755
- var schemaV32 = schemaInternalV32.merge(schemaHash4).strict();
5756
- var schemaV42 = schemaInternalV42.merge(schemaHash4).strict();
5757
- var schemaV52 = schemaInternalV52.merge(schemaHash4).strict();
5758
- var schema3 = schemaInternal3.merge(schemaHash4).strict();
5759
- var tableSquashed4 = objectType({
6133
+ var schemaV32 = schemaInternalV32.merge(schemaHash5).strict();
6134
+ var schemaV42 = schemaInternalV42.merge(schemaHash5).strict();
6135
+ var schemaV52 = schemaInternalV52.merge(schemaHash5).strict();
6136
+ var schema3 = schemaInternal3.merge(schemaHash5).strict();
6137
+ var tableSquashed5 = objectType({
5760
6138
  name: stringType(),
5761
- columns: recordType(stringType(), column4),
6139
+ columns: recordType(stringType(), column5),
5762
6140
  indexes: recordType(stringType(), stringType()),
5763
6141
  foreignKeys: recordType(stringType(), stringType()),
5764
6142
  compositePrimaryKeys: recordType(stringType(), stringType()),
@@ -5768,8 +6146,8 @@ var tableSquashed4 = objectType({
5768
6146
  var schemaSquashed3 = objectType({
5769
6147
  version: latestVersion,
5770
6148
  dialect: dialect3,
5771
- tables: recordType(stringType(), tableSquashed4),
5772
- views: recordType(stringType(), view3),
6149
+ tables: recordType(stringType(), tableSquashed5),
6150
+ views: recordType(stringType(), view4),
5773
6151
  enums: anyType()
5774
6152
  }).strict();
5775
6153
  var drySQLite = schema3.parse({
@@ -5796,8 +6174,7 @@ var objectValues = (obj) => {
5796
6174
  return Object.values(obj);
5797
6175
  };
5798
6176
  var assertV1OutFolder = (out) => {
5799
- if (!existsSync(out))
5800
- return;
6177
+ if (!existsSync(out)) return;
5801
6178
  const oldMigrationFolders = readdirSync(out).filter(
5802
6179
  (it) => it.length === 14 && /^\d+$/.test(it)
5803
6180
  );
@@ -5841,6 +6218,8 @@ var validatorForDialect = (dialect4) => {
5841
6218
  return { validator: backwardCompatibleMysqlSchema, version: 5 };
5842
6219
  case "singlestore":
5843
6220
  return { validator: backwardCompatibleSingleStoreSchema, version: 1 };
6221
+ case "gel":
6222
+ return { validator: backwardCompatibleGelSchema, version: 1 };
5844
6223
  }
5845
6224
  };
5846
6225
  var validateWithReport = (snapshots, dialect4) => {
@@ -5950,8 +6329,8 @@ var tableRenameKey = (it) => {
5950
6329
  const out = it.schema ? `"${it.schema}"."${it.name}"` : `"${it.name}"`;
5951
6330
  return out;
5952
6331
  };
5953
- var columnRenameKey = (table5, schema4, column5) => {
5954
- const out = schema4 ? `"${schema4}"."${table5}"."${column5}"` : `"${table5}"."${column5}"`;
6332
+ var columnRenameKey = (table6, schema4, column6) => {
6333
+ const out = schema4 ? `"${schema4}"."${table6}"."${column6}"` : `"${table6}"."${column6}"`;
5955
6334
  return out;
5956
6335
  };
5957
6336
  var kloudMeta = () => {
@@ -6007,6 +6386,9 @@ function unescapeSingleQuotes(str, ignoreFirstAndLastChar) {
6007
6386
  const regex = ignoreFirstAndLastChar ? /(?<!^)'(?!$)/g : /'/g;
6008
6387
  return str.replace(/''/g, "'").replace(regex, "\\'");
6009
6388
  }
6389
+ var stripTrailingCast = (value) => {
6390
+ return value.replace(/::(?:"[^"]+"|[\w ]+)(?:\(\d+(?:,\s*\d+)?\))?(?:\[\])*$/, "");
6391
+ };
6010
6392
  export {
6011
6393
  assertV1OutFolder,
6012
6394
  columnRenameKey,
@@ -6023,6 +6405,7 @@ export {
6023
6405
  prepareMigrationMeta,
6024
6406
  prepareOutFolder,
6025
6407
  schemaRenameKey,
6408
+ stripTrailingCast,
6026
6409
  tableRenameKey,
6027
6410
  unescapeSingleQuotes,
6028
6411
  validateWithReport