@anthonyalayo/drizzle-kit 1.0.6 → 1.1.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.js CHANGED
@@ -31,28 +31,26 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
31
31
  ));
32
32
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
33
33
 
34
- // ../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
35
35
  var require_readline = __commonJS({
36
- "../node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/readline.js"(exports2) {
36
+ "../node_modules/.pnpm/hanji@0.0.8/node_modules/hanji/readline.js"(exports2) {
37
37
  "use strict";
38
+ var __importDefault = exports2 && exports2.__importDefault || function(mod) {
39
+ return mod && mod.__esModule ? mod : { "default": mod };
40
+ };
38
41
  Object.defineProperty(exports2, "__esModule", { value: true });
39
- exports2.prepareReadLine = void 0;
40
- var prepareReadLine = () => {
41
- const stdin = process.stdin;
42
- const stdout = process.stdout;
43
- const readline = require("readline");
44
- const rl = readline.createInterface({
45
- input: stdin,
42
+ exports2.createClosable = exports2.stdout = exports2.stdin = void 0;
43
+ var readline_1 = __importDefault(require("readline"));
44
+ exports2.stdin = process.stdin;
45
+ exports2.stdout = process.stdout;
46
+ readline_1.default.emitKeypressEvents(exports2.stdin);
47
+ var createClosable = () => {
48
+ return readline_1.default.createInterface({
49
+ input: exports2.stdin,
46
50
  escapeCodeTimeout: 50
47
51
  });
48
- readline.emitKeypressEvents(stdin, rl);
49
- return {
50
- stdin,
51
- stdout,
52
- closable: rl
53
- };
54
52
  };
55
- exports2.prepareReadLine = prepareReadLine;
53
+ exports2.createClosable = createClosable;
56
54
  }
57
55
  });
58
56
 
@@ -65,20 +63,15 @@ var require_src = __commonJS({
65
63
  var beep = "\x07";
66
64
  var cursor = {
67
65
  to(x, y) {
68
- if (!y)
69
- return `${CSI}${x + 1}G`;
66
+ if (!y) return `${CSI}${x + 1}G`;
70
67
  return `${CSI}${y + 1};${x + 1}H`;
71
68
  },
72
69
  move(x, y) {
73
70
  let ret = "";
74
- if (x < 0)
75
- ret += `${CSI}${-x}D`;
76
- else if (x > 0)
77
- ret += `${CSI}${x}C`;
78
- if (y < 0)
79
- ret += `${CSI}${-y}A`;
80
- else if (y > 0)
81
- ret += `${CSI}${y}B`;
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`;
82
75
  return ret;
83
76
  },
84
77
  up: (count = 1) => `${CSI}${count}A`,
@@ -117,12 +110,12 @@ var require_src = __commonJS({
117
110
  }
118
111
  });
119
112
 
120
- // ../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
121
114
  var require_utils = __commonJS({
122
- "../node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/utils.js"(exports2) {
115
+ "../node_modules/.pnpm/hanji@0.0.8/node_modules/hanji/utils.js"(exports2) {
123
116
  "use strict";
124
117
  Object.defineProperty(exports2, "__esModule", { value: true });
125
- exports2.clear = void 0;
118
+ exports2.clear = exports2.stringWidth = exports2.fallbackStringWidth = exports2.stripAnsi = exports2.strip = void 0;
126
119
  var sisteransi_1 = require_src();
127
120
  var strip = (str) => {
128
121
  const pattern = [
@@ -132,14 +125,35 @@ var require_utils = __commonJS({
132
125
  const RGX = new RegExp(pattern, "g");
133
126
  return typeof str === "string" ? str.replace(RGX, "") : str;
134
127
  };
135
- var stringWidth = (str) => [...strip(str)].length;
128
+ exports2.strip = strip;
129
+ var stripAnsi = (str) => {
130
+ if (typeof Bun !== "undefined" && Bun.stripANSI) {
131
+ return Bun.stripANSI(str);
132
+ }
133
+ return (0, exports2.strip)(str);
134
+ };
135
+ exports2.stripAnsi = stripAnsi;
136
+ var fallbackStringWidth = (str) => {
137
+ let len = 0;
138
+ const stripped = (0, exports2.stripAnsi)(str);
139
+ for (const _ of stripped)
140
+ len++;
141
+ return len;
142
+ };
143
+ exports2.fallbackStringWidth = fallbackStringWidth;
144
+ var stringWidth = (str) => {
145
+ if (typeof Bun !== "undefined" && Bun.stringWidth)
146
+ return Bun.stringWidth(str);
147
+ return (0, exports2.fallbackStringWidth)(str);
148
+ };
149
+ exports2.stringWidth = stringWidth;
136
150
  var clear = function(prompt, perLine) {
137
151
  if (!perLine)
138
152
  return sisteransi_1.erase.line + sisteransi_1.cursor.to(0);
139
153
  let rows = 0;
140
154
  const lines = prompt.split(/\r?\n/);
141
155
  for (let line of lines) {
142
- rows += 1 + Math.floor(Math.max(stringWidth(line) - 1, 0) / perLine);
156
+ rows += 1 + Math.floor(Math.max((0, exports2.stringWidth)(line) - 1, 0) / perLine);
143
157
  }
144
158
  return sisteransi_1.erase.lines(rows);
145
159
  };
@@ -295,9 +309,9 @@ var require_lodash = __commonJS({
295
309
  }
296
310
  });
297
311
 
298
- // ../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
299
313
  var require_hanji = __commonJS({
300
- "../node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/index.js"(exports2) {
314
+ "../node_modules/.pnpm/hanji@0.0.8/node_modules/hanji/index.js"(exports2) {
301
315
  "use strict";
302
316
  var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) {
303
317
  function adopt(value) {
@@ -330,7 +344,10 @@ var require_hanji = __commonJS({
330
344
  return mod && mod.__esModule ? mod : { "default": mod };
331
345
  };
332
346
  Object.defineProperty(exports2, "__esModule", { value: true });
333
- exports2.onTerminate = exports2.renderWithTask = exports2.render = exports2.TaskTerminal = exports2.TaskView = exports2.Terminal = exports2.deferred = exports2.SelectState = exports2.Prompt = void 0;
347
+ exports2.TaskTerminal = exports2.TaskView = exports2.Terminal = exports2.deferred = exports2.SelectState = exports2.Prompt = void 0;
348
+ exports2.render = render2;
349
+ exports2.renderWithTask = renderWithTask;
350
+ exports2.onTerminate = onTerminate;
334
351
  var readline_1 = require_readline();
335
352
  var sisteransi_1 = require_src();
336
353
  var utils_1 = require_utils();
@@ -409,8 +426,8 @@ var require_hanji = __commonJS({
409
426
  };
410
427
  exports2.deferred = deferred;
411
428
  var Terminal = class {
412
- constructor(view4, stdin, stdout, closable) {
413
- this.view = view4;
429
+ constructor(view5, stdin, stdout, closable) {
430
+ this.view = view5;
414
431
  this.stdin = stdin;
415
432
  this.stdout = stdout;
416
433
  this.closable = closable;
@@ -448,7 +465,7 @@ var require_hanji = __commonJS({
448
465
  this.resolve({ status: "submitted", data: this.view.result() });
449
466
  return;
450
467
  }
451
- view4.input(str, key);
468
+ view5.input(str, key);
452
469
  };
453
470
  this.stdin.on("keypress", keypress);
454
471
  this.view.attach(this);
@@ -510,8 +527,8 @@ var require_hanji = __commonJS({
510
527
  };
511
528
  exports2.TaskView = TaskView2;
512
529
  var TaskTerminal = class {
513
- constructor(view4, stdout) {
514
- this.view = view4;
530
+ constructor(view5, stdout) {
531
+ this.view = view5;
515
532
  this.stdout = stdout;
516
533
  this.text = "";
517
534
  this.view.attach(this);
@@ -528,36 +545,46 @@ var require_hanji = __commonJS({
528
545
  const clearPrefix = this.text ? (0, utils_1.clear)(this.text, this.stdout.columns) : "";
529
546
  this.stdout.write(`${clearPrefix}${string}`);
530
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
+ }
531
554
  };
532
555
  exports2.TaskTerminal = TaskTerminal;
533
- function render2(view4) {
534
- const { stdin, stdout, closable } = (0, readline_1.prepareReadLine)();
535
- if (view4 instanceof Prompt2) {
536
- const terminal = new Terminal(view4, stdin, stdout, closable);
537
- terminal.requestLayout();
538
- return terminal.result();
539
- }
540
- stdout.write(`${view4}
556
+ function render2(view5) {
557
+ if (typeof view5 === "string") {
558
+ process.stdout.write(`${view5}
541
559
  `);
542
- closable.close();
543
- 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();
544
569
  }
545
- exports2.render = render2;
546
- function renderWithTask(view4, task) {
570
+ function renderWithTask(view5, task) {
547
571
  return __awaiter(this, void 0, void 0, function* () {
548
- const terminal = new TaskTerminal(view4, process.stdout);
572
+ const terminal = new TaskTerminal(view5, process.stdout);
549
573
  terminal.requestLayout();
550
- const result = yield task;
551
- terminal.clear();
552
- 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
+ }
553
582
  });
554
583
  }
555
- exports2.renderWithTask = renderWithTask;
556
584
  var terminateHandler;
557
585
  function onTerminate(callback) {
558
586
  terminateHandler = callback;
559
587
  }
560
- exports2.onTerminate = onTerminate;
561
588
  }
562
589
  });
563
590
 
@@ -579,13 +606,14 @@ __export(utils_exports, {
579
606
  prepareMigrationMeta: () => prepareMigrationMeta,
580
607
  prepareOutFolder: () => prepareOutFolder,
581
608
  schemaRenameKey: () => schemaRenameKey,
609
+ stripTrailingCast: () => stripTrailingCast,
582
610
  tableRenameKey: () => tableRenameKey,
583
611
  unescapeSingleQuotes: () => unescapeSingleQuotes,
584
612
  validateWithReport: () => validateWithReport
585
613
  });
586
614
  module.exports = __toCommonJS(utils_exports);
587
615
 
588
- // ../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/ansi-styles/index.js
616
+ // ../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/vendor/ansi-styles/index.js
589
617
  var ANSI_BACKGROUND_OFFSET = 10;
590
618
  var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
591
619
  var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
@@ -771,7 +799,7 @@ function assembleStyles() {
771
799
  var ansiStyles = assembleStyles();
772
800
  var ansi_styles_default = ansiStyles;
773
801
 
774
- // ../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/vendor/supports-color/index.js
802
+ // ../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/vendor/supports-color/index.js
775
803
  var import_node_process = __toESM(require("node:process"), 1);
776
804
  var import_node_os = __toESM(require("node:os"), 1);
777
805
  var import_node_tty = __toESM(require("node:tty"), 1);
@@ -845,10 +873,10 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
845
873
  return 1;
846
874
  }
847
875
  if ("CI" in env) {
848
- if ("GITHUB_ACTIONS" in env || "GITEA_ACTIONS" in env) {
876
+ if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => key in env)) {
849
877
  return 3;
850
878
  }
851
- if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
879
+ if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
852
880
  return 1;
853
881
  }
854
882
  return min;
@@ -897,37 +925,37 @@ var supportsColor = {
897
925
  };
898
926
  var supports_color_default = supportsColor;
899
927
 
900
- // ../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/utilities.js
928
+ // ../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/utilities.js
901
929
  function stringReplaceAll(string, substring, replacer) {
902
- let index5 = string.indexOf(substring);
903
- if (index5 === -1) {
930
+ let index6 = string.indexOf(substring);
931
+ if (index6 === -1) {
904
932
  return string;
905
933
  }
906
934
  const substringLength = substring.length;
907
935
  let endIndex = 0;
908
936
  let returnValue = "";
909
937
  do {
910
- returnValue += string.slice(endIndex, index5) + substring + replacer;
911
- endIndex = index5 + substringLength;
912
- index5 = string.indexOf(substring, endIndex);
913
- } while (index5 !== -1);
938
+ returnValue += string.slice(endIndex, index6) + substring + replacer;
939
+ endIndex = index6 + substringLength;
940
+ index6 = string.indexOf(substring, endIndex);
941
+ } while (index6 !== -1);
914
942
  returnValue += string.slice(endIndex);
915
943
  return returnValue;
916
944
  }
917
- function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index5) {
945
+ function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index6) {
918
946
  let endIndex = 0;
919
947
  let returnValue = "";
920
948
  do {
921
- const gotCR = string[index5 - 1] === "\r";
922
- returnValue += string.slice(endIndex, gotCR ? index5 - 1 : index5) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
923
- endIndex = index5 + 1;
924
- index5 = string.indexOf("\n", endIndex);
925
- } while (index5 !== -1);
949
+ const gotCR = string[index6 - 1] === "\r";
950
+ returnValue += string.slice(endIndex, gotCR ? index6 - 1 : index6) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
951
+ endIndex = index6 + 1;
952
+ index6 = string.indexOf("\n", endIndex);
953
+ } while (index6 !== -1);
926
954
  returnValue += string.slice(endIndex);
927
955
  return returnValue;
928
956
  }
929
957
 
930
- // ../node_modules/.pnpm/chalk@5.3.0/node_modules/chalk/source/index.js
958
+ // ../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/index.js
931
959
  var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
932
960
  var GENERATOR = Symbol("GENERATOR");
933
961
  var STYLER = Symbol("STYLER");
@@ -1087,15 +1115,16 @@ var info = (msg, greyMsg = "") => {
1087
1115
 
1088
1116
  // src/global.ts
1089
1117
  var originUUID = "00000000-0000-0000-0000-000000000000";
1090
- var snapshotVersion = "8";
1118
+ var snapshotVersion = "7";
1091
1119
  function assertUnreachable(x) {
1092
1120
  throw new Error("Didn't expect to get here");
1093
1121
  }
1094
1122
 
1095
- // ../node_modules/.pnpm/zod@3.23.7/node_modules/zod/lib/index.mjs
1123
+ // ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/helpers/util.js
1096
1124
  var util;
1097
1125
  (function(util2) {
1098
- util2.assertEqual = (val) => val;
1126
+ util2.assertEqual = (_) => {
1127
+ };
1099
1128
  function assertIs(_arg) {
1100
1129
  }
1101
1130
  util2.assertIs = assertIs;
@@ -1139,7 +1168,7 @@ var util;
1139
1168
  }
1140
1169
  return void 0;
1141
1170
  };
1142
- util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val;
1171
+ util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && Number.isFinite(val) && Math.floor(val) === val;
1143
1172
  function joinValues(array, separator = " | ") {
1144
1173
  return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
1145
1174
  }
@@ -1191,7 +1220,7 @@ var getParsedType = (data) => {
1191
1220
  case "string":
1192
1221
  return ZodParsedType.string;
1193
1222
  case "number":
1194
- return isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
1223
+ return Number.isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
1195
1224
  case "boolean":
1196
1225
  return ZodParsedType.boolean;
1197
1226
  case "function":
@@ -1224,6 +1253,8 @@ var getParsedType = (data) => {
1224
1253
  return ZodParsedType.unknown;
1225
1254
  }
1226
1255
  };
1256
+
1257
+ // ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/ZodError.js
1227
1258
  var ZodIssueCode = util.arrayToEnum([
1228
1259
  "invalid_type",
1229
1260
  "invalid_literal",
@@ -1243,6 +1274,9 @@ var ZodIssueCode = util.arrayToEnum([
1243
1274
  "not_finite"
1244
1275
  ]);
1245
1276
  var ZodError = class _ZodError extends Error {
1277
+ get errors() {
1278
+ return this.issues;
1279
+ }
1246
1280
  constructor(issues) {
1247
1281
  super();
1248
1282
  this.issues = [];
@@ -1261,9 +1295,6 @@ var ZodError = class _ZodError extends Error {
1261
1295
  this.name = "ZodError";
1262
1296
  this.issues = issues;
1263
1297
  }
1264
- get errors() {
1265
- return this.issues;
1266
- }
1267
1298
  format(_mapper) {
1268
1299
  const mapper = _mapper || function(issue) {
1269
1300
  return issue.message;
@@ -1335,6 +1366,8 @@ ZodError.create = (issues) => {
1335
1366
  const error = new ZodError(issues);
1336
1367
  return error;
1337
1368
  };
1369
+
1370
+ // ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/locales/en.js
1338
1371
  var errorMap = (issue, _ctx) => {
1339
1372
  let message;
1340
1373
  switch (issue.code) {
@@ -1433,10 +1466,15 @@ var errorMap = (issue, _ctx) => {
1433
1466
  }
1434
1467
  return { message };
1435
1468
  };
1436
- var overrideErrorMap = errorMap;
1469
+ var en_default = errorMap;
1470
+
1471
+ // ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/errors.js
1472
+ var overrideErrorMap = en_default;
1437
1473
  function getErrorMap() {
1438
1474
  return overrideErrorMap;
1439
1475
  }
1476
+
1477
+ // ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/helpers/parseUtil.js
1440
1478
  var makeIssue = (params) => {
1441
1479
  const { data, path, errorMaps, issueData } = params;
1442
1480
  const fullPath = [...path, ...issueData.path || []];
@@ -1470,9 +1508,12 @@ function addIssueToContext(ctx, issueData) {
1470
1508
  path: ctx.path,
1471
1509
  errorMaps: [
1472
1510
  ctx.common.contextualErrorMap,
1511
+ // contextual error map is first priority
1473
1512
  ctx.schemaErrorMap,
1513
+ // then schema-bound map if available
1474
1514
  overrideMap,
1475
- overrideMap === errorMap ? void 0 : errorMap
1515
+ // then global override map
1516
+ overrideMap === en_default ? void 0 : en_default
1476
1517
  // then global default map
1477
1518
  ].filter((x) => !!x)
1478
1519
  });
@@ -1541,29 +1582,15 @@ var isAborted = (x) => x.status === "aborted";
1541
1582
  var isDirty = (x) => x.status === "dirty";
1542
1583
  var isValid = (x) => x.status === "valid";
1543
1584
  var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
1544
- function __classPrivateFieldGet(receiver, state, kind, f) {
1545
- if (kind === "a" && !f)
1546
- throw new TypeError("Private accessor was defined without a getter");
1547
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
1548
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
1549
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
1550
- }
1551
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
1552
- if (kind === "m")
1553
- throw new TypeError("Private method is not writable");
1554
- if (kind === "a" && !f)
1555
- throw new TypeError("Private accessor was defined without a setter");
1556
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
1557
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
1558
- return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
1559
- }
1585
+
1586
+ // ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/helpers/errorUtil.js
1560
1587
  var errorUtil;
1561
1588
  (function(errorUtil2) {
1562
1589
  errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
1563
- errorUtil2.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
1590
+ errorUtil2.toString = (message) => typeof message === "string" ? message : message == null ? void 0 : message.message;
1564
1591
  })(errorUtil || (errorUtil = {}));
1565
- var _ZodEnum_cache;
1566
- var _ZodNativeEnum_cache;
1592
+
1593
+ // ../node_modules/.pnpm/zod@3.25.42/node_modules/zod/dist/esm/v3/types.js
1567
1594
  var ParseInputLazyPath = class {
1568
1595
  constructor(parent, value, path, key) {
1569
1596
  this._cachedPath = [];
@@ -1574,7 +1601,7 @@ var ParseInputLazyPath = class {
1574
1601
  }
1575
1602
  get path() {
1576
1603
  if (!this._cachedPath.length) {
1577
- if (this._key instanceof Array) {
1604
+ if (Array.isArray(this._key)) {
1578
1605
  this._cachedPath.push(...this._path, ...this._key);
1579
1606
  } else {
1580
1607
  this._cachedPath.push(...this._path, this._key);
@@ -1612,49 +1639,20 @@ function processCreateParams(params) {
1612
1639
  if (errorMap2)
1613
1640
  return { errorMap: errorMap2, description };
1614
1641
  const customMap = (iss, ctx) => {
1615
- var _a, _b;
1616
1642
  const { message } = params;
1617
1643
  if (iss.code === "invalid_enum_value") {
1618
- return { message: message !== null && message !== void 0 ? message : ctx.defaultError };
1644
+ return { message: message ?? ctx.defaultError };
1619
1645
  }
1620
1646
  if (typeof ctx.data === "undefined") {
1621
- return { message: (_a = message !== null && message !== void 0 ? message : required_error) !== null && _a !== void 0 ? _a : ctx.defaultError };
1647
+ return { message: message ?? required_error ?? ctx.defaultError };
1622
1648
  }
1623
1649
  if (iss.code !== "invalid_type")
1624
1650
  return { message: ctx.defaultError };
1625
- return { message: (_b = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _b !== void 0 ? _b : ctx.defaultError };
1651
+ return { message: message ?? invalid_type_error ?? ctx.defaultError };
1626
1652
  };
1627
1653
  return { errorMap: customMap, description };
1628
1654
  }
1629
1655
  var ZodType = class {
1630
- constructor(def) {
1631
- this.spa = this.safeParseAsync;
1632
- this._def = def;
1633
- this.parse = this.parse.bind(this);
1634
- this.safeParse = this.safeParse.bind(this);
1635
- this.parseAsync = this.parseAsync.bind(this);
1636
- this.safeParseAsync = this.safeParseAsync.bind(this);
1637
- this.spa = this.spa.bind(this);
1638
- this.refine = this.refine.bind(this);
1639
- this.refinement = this.refinement.bind(this);
1640
- this.superRefine = this.superRefine.bind(this);
1641
- this.optional = this.optional.bind(this);
1642
- this.nullable = this.nullable.bind(this);
1643
- this.nullish = this.nullish.bind(this);
1644
- this.array = this.array.bind(this);
1645
- this.promise = this.promise.bind(this);
1646
- this.or = this.or.bind(this);
1647
- this.and = this.and.bind(this);
1648
- this.transform = this.transform.bind(this);
1649
- this.brand = this.brand.bind(this);
1650
- this.default = this.default.bind(this);
1651
- this.catch = this.catch.bind(this);
1652
- this.describe = this.describe.bind(this);
1653
- this.pipe = this.pipe.bind(this);
1654
- this.readonly = this.readonly.bind(this);
1655
- this.isNullable = this.isNullable.bind(this);
1656
- this.isOptional = this.isOptional.bind(this);
1657
- }
1658
1656
  get description() {
1659
1657
  return this._def.description;
1660
1658
  }
@@ -1702,14 +1700,13 @@ var ZodType = class {
1702
1700
  throw result.error;
1703
1701
  }
1704
1702
  safeParse(data, params) {
1705
- var _a;
1706
1703
  const ctx = {
1707
1704
  common: {
1708
1705
  issues: [],
1709
- async: (_a = params === null || params === void 0 ? void 0 : params.async) !== null && _a !== void 0 ? _a : false,
1710
- contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap
1706
+ async: (params == null ? void 0 : params.async) ?? false,
1707
+ contextualErrorMap: params == null ? void 0 : params.errorMap
1711
1708
  },
1712
- path: (params === null || params === void 0 ? void 0 : params.path) || [],
1709
+ path: (params == null ? void 0 : params.path) || [],
1713
1710
  schemaErrorMap: this._def.errorMap,
1714
1711
  parent: null,
1715
1712
  data,
@@ -1718,6 +1715,43 @@ var ZodType = class {
1718
1715
  const result = this._parseSync({ data, path: ctx.path, parent: ctx });
1719
1716
  return handleResult(ctx, result);
1720
1717
  }
1718
+ "~validate"(data) {
1719
+ var _a, _b;
1720
+ const ctx = {
1721
+ common: {
1722
+ issues: [],
1723
+ async: !!this["~standard"].async
1724
+ },
1725
+ path: [],
1726
+ schemaErrorMap: this._def.errorMap,
1727
+ parent: null,
1728
+ data,
1729
+ parsedType: getParsedType(data)
1730
+ };
1731
+ if (!this["~standard"].async) {
1732
+ try {
1733
+ const result = this._parseSync({ data, path: [], parent: ctx });
1734
+ return isValid(result) ? {
1735
+ value: result.value
1736
+ } : {
1737
+ issues: ctx.common.issues
1738
+ };
1739
+ } catch (err) {
1740
+ if ((_b = (_a = err == null ? void 0 : err.message) == null ? void 0 : _a.toLowerCase()) == null ? void 0 : _b.includes("encountered")) {
1741
+ this["~standard"].async = true;
1742
+ }
1743
+ ctx.common = {
1744
+ issues: [],
1745
+ async: true
1746
+ };
1747
+ }
1748
+ }
1749
+ return this._parseAsync({ data, path: [], parent: ctx }).then((result) => isValid(result) ? {
1750
+ value: result.value
1751
+ } : {
1752
+ issues: ctx.common.issues
1753
+ });
1754
+ }
1721
1755
  async parseAsync(data, params) {
1722
1756
  const result = await this.safeParseAsync(data, params);
1723
1757
  if (result.success)
@@ -1728,10 +1762,10 @@ var ZodType = class {
1728
1762
  const ctx = {
1729
1763
  common: {
1730
1764
  issues: [],
1731
- contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap,
1765
+ contextualErrorMap: params == null ? void 0 : params.errorMap,
1732
1766
  async: true
1733
1767
  },
1734
- path: (params === null || params === void 0 ? void 0 : params.path) || [],
1768
+ path: (params == null ? void 0 : params.path) || [],
1735
1769
  schemaErrorMap: this._def.errorMap,
1736
1770
  parent: null,
1737
1771
  data,
@@ -1795,6 +1829,39 @@ var ZodType = class {
1795
1829
  superRefine(refinement) {
1796
1830
  return this._refinement(refinement);
1797
1831
  }
1832
+ constructor(def) {
1833
+ this.spa = this.safeParseAsync;
1834
+ this._def = def;
1835
+ this.parse = this.parse.bind(this);
1836
+ this.safeParse = this.safeParse.bind(this);
1837
+ this.parseAsync = this.parseAsync.bind(this);
1838
+ this.safeParseAsync = this.safeParseAsync.bind(this);
1839
+ this.spa = this.spa.bind(this);
1840
+ this.refine = this.refine.bind(this);
1841
+ this.refinement = this.refinement.bind(this);
1842
+ this.superRefine = this.superRefine.bind(this);
1843
+ this.optional = this.optional.bind(this);
1844
+ this.nullable = this.nullable.bind(this);
1845
+ this.nullish = this.nullish.bind(this);
1846
+ this.array = this.array.bind(this);
1847
+ this.promise = this.promise.bind(this);
1848
+ this.or = this.or.bind(this);
1849
+ this.and = this.and.bind(this);
1850
+ this.transform = this.transform.bind(this);
1851
+ this.brand = this.brand.bind(this);
1852
+ this.default = this.default.bind(this);
1853
+ this.catch = this.catch.bind(this);
1854
+ this.describe = this.describe.bind(this);
1855
+ this.pipe = this.pipe.bind(this);
1856
+ this.readonly = this.readonly.bind(this);
1857
+ this.isNullable = this.isNullable.bind(this);
1858
+ this.isOptional = this.isOptional.bind(this);
1859
+ this["~standard"] = {
1860
+ version: 1,
1861
+ vendor: "zod",
1862
+ validate: (data) => this["~validate"](data)
1863
+ };
1864
+ }
1798
1865
  optional() {
1799
1866
  return ZodOptional.create(this, this._def);
1800
1867
  }
@@ -1805,7 +1872,7 @@ var ZodType = class {
1805
1872
  return this.nullable().optional();
1806
1873
  }
1807
1874
  array() {
1808
- return ZodArray.create(this, this._def);
1875
+ return ZodArray.create(this);
1809
1876
  }
1810
1877
  promise() {
1811
1878
  return ZodPromise.create(this, this._def);
@@ -1871,26 +1938,31 @@ var ZodType = class {
1871
1938
  };
1872
1939
  var cuidRegex = /^c[^\s-]{8,}$/i;
1873
1940
  var cuid2Regex = /^[0-9a-z]+$/;
1874
- var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/;
1941
+ var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i;
1875
1942
  var uuidRegex = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i;
1876
1943
  var nanoidRegex = /^[a-z0-9_-]{21}$/i;
1944
+ var jwtRegex = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;
1877
1945
  var durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;
1878
1946
  var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
1879
1947
  var _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
1880
1948
  var emojiRegex;
1881
1949
  var ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
1882
- var ipv6Regex = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;
1950
+ 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])$/;
1951
+ 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]))$/;
1952
+ var ipv6CidrRegex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
1883
1953
  var base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
1954
+ var base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;
1884
1955
  var dateRegexSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`;
1885
1956
  var dateRegex = new RegExp(`^${dateRegexSource}$`);
1886
1957
  function timeRegexSource(args) {
1887
- let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`;
1958
+ let secondsRegexSource = `[0-5]\\d`;
1888
1959
  if (args.precision) {
1889
- regex = `${regex}\\.\\d{${args.precision}}`;
1960
+ secondsRegexSource = `${secondsRegexSource}\\.\\d{${args.precision}}`;
1890
1961
  } else if (args.precision == null) {
1891
- regex = `${regex}(\\.\\d+)?`;
1962
+ secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`;
1892
1963
  }
1893
- return regex;
1964
+ const secondsQuantifier = args.precision ? "+" : "?";
1965
+ return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`;
1894
1966
  }
1895
1967
  function timeRegex(args) {
1896
1968
  return new RegExp(`^${timeRegexSource(args)}$`);
@@ -1913,6 +1985,35 @@ function isValidIP(ip, version) {
1913
1985
  }
1914
1986
  return false;
1915
1987
  }
1988
+ function isValidJWT(jwt, alg) {
1989
+ if (!jwtRegex.test(jwt))
1990
+ return false;
1991
+ try {
1992
+ const [header] = jwt.split(".");
1993
+ const base64 = header.replace(/-/g, "+").replace(/_/g, "/").padEnd(header.length + (4 - header.length % 4) % 4, "=");
1994
+ const decoded = JSON.parse(atob(base64));
1995
+ if (typeof decoded !== "object" || decoded === null)
1996
+ return false;
1997
+ if ("typ" in decoded && (decoded == null ? void 0 : decoded.typ) !== "JWT")
1998
+ return false;
1999
+ if (!decoded.alg)
2000
+ return false;
2001
+ if (alg && decoded.alg !== alg)
2002
+ return false;
2003
+ return true;
2004
+ } catch {
2005
+ return false;
2006
+ }
2007
+ }
2008
+ function isValidCidr(ip, version) {
2009
+ if ((version === "v4" || !version) && ipv4CidrRegex.test(ip)) {
2010
+ return true;
2011
+ }
2012
+ if ((version === "v6" || !version) && ipv6CidrRegex.test(ip)) {
2013
+ return true;
2014
+ }
2015
+ return false;
2016
+ }
1916
2017
  var ZodString = class _ZodString extends ZodType {
1917
2018
  _parse(input) {
1918
2019
  if (this._def.coerce) {
@@ -2059,7 +2160,7 @@ var ZodString = class _ZodString extends ZodType {
2059
2160
  } else if (check.kind === "url") {
2060
2161
  try {
2061
2162
  new URL(input.data);
2062
- } catch (_a) {
2163
+ } catch {
2063
2164
  ctx = this._getOrReturnCtx(input, ctx);
2064
2165
  addIssueToContext(ctx, {
2065
2166
  validation: "url",
@@ -2169,6 +2270,26 @@ var ZodString = class _ZodString extends ZodType {
2169
2270
  });
2170
2271
  status.dirty();
2171
2272
  }
2273
+ } else if (check.kind === "jwt") {
2274
+ if (!isValidJWT(input.data, check.alg)) {
2275
+ ctx = this._getOrReturnCtx(input, ctx);
2276
+ addIssueToContext(ctx, {
2277
+ validation: "jwt",
2278
+ code: ZodIssueCode.invalid_string,
2279
+ message: check.message
2280
+ });
2281
+ status.dirty();
2282
+ }
2283
+ } else if (check.kind === "cidr") {
2284
+ if (!isValidCidr(input.data, check.version)) {
2285
+ ctx = this._getOrReturnCtx(input, ctx);
2286
+ addIssueToContext(ctx, {
2287
+ validation: "cidr",
2288
+ code: ZodIssueCode.invalid_string,
2289
+ message: check.message
2290
+ });
2291
+ status.dirty();
2292
+ }
2172
2293
  } else if (check.kind === "base64") {
2173
2294
  if (!base64Regex.test(input.data)) {
2174
2295
  ctx = this._getOrReturnCtx(input, ctx);
@@ -2179,6 +2300,16 @@ var ZodString = class _ZodString extends ZodType {
2179
2300
  });
2180
2301
  status.dirty();
2181
2302
  }
2303
+ } else if (check.kind === "base64url") {
2304
+ if (!base64urlRegex.test(input.data)) {
2305
+ ctx = this._getOrReturnCtx(input, ctx);
2306
+ addIssueToContext(ctx, {
2307
+ validation: "base64url",
2308
+ code: ZodIssueCode.invalid_string,
2309
+ message: check.message
2310
+ });
2311
+ status.dirty();
2312
+ }
2182
2313
  } else {
2183
2314
  util.assertNever(check);
2184
2315
  }
@@ -2225,11 +2356,22 @@ var ZodString = class _ZodString extends ZodType {
2225
2356
  base64(message) {
2226
2357
  return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });
2227
2358
  }
2359
+ base64url(message) {
2360
+ return this._addCheck({
2361
+ kind: "base64url",
2362
+ ...errorUtil.errToObj(message)
2363
+ });
2364
+ }
2365
+ jwt(options) {
2366
+ return this._addCheck({ kind: "jwt", ...errorUtil.errToObj(options) });
2367
+ }
2228
2368
  ip(options) {
2229
2369
  return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
2230
2370
  }
2371
+ cidr(options) {
2372
+ return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options) });
2373
+ }
2231
2374
  datetime(options) {
2232
- var _a, _b;
2233
2375
  if (typeof options === "string") {
2234
2376
  return this._addCheck({
2235
2377
  kind: "datetime",
@@ -2241,10 +2383,10 @@ var ZodString = class _ZodString extends ZodType {
2241
2383
  }
2242
2384
  return this._addCheck({
2243
2385
  kind: "datetime",
2244
- precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
2245
- offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,
2246
- local: (_b = options === null || options === void 0 ? void 0 : options.local) !== null && _b !== void 0 ? _b : false,
2247
- ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
2386
+ precision: typeof (options == null ? void 0 : options.precision) === "undefined" ? null : options == null ? void 0 : options.precision,
2387
+ offset: (options == null ? void 0 : options.offset) ?? false,
2388
+ local: (options == null ? void 0 : options.local) ?? false,
2389
+ ...errorUtil.errToObj(options == null ? void 0 : options.message)
2248
2390
  });
2249
2391
  }
2250
2392
  date(message) {
@@ -2260,8 +2402,8 @@ var ZodString = class _ZodString extends ZodType {
2260
2402
  }
2261
2403
  return this._addCheck({
2262
2404
  kind: "time",
2263
- precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
2264
- ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
2405
+ precision: typeof (options == null ? void 0 : options.precision) === "undefined" ? null : options == null ? void 0 : options.precision,
2406
+ ...errorUtil.errToObj(options == null ? void 0 : options.message)
2265
2407
  });
2266
2408
  }
2267
2409
  duration(message) {
@@ -2278,8 +2420,8 @@ var ZodString = class _ZodString extends ZodType {
2278
2420
  return this._addCheck({
2279
2421
  kind: "includes",
2280
2422
  value,
2281
- position: options === null || options === void 0 ? void 0 : options.position,
2282
- ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
2423
+ position: options == null ? void 0 : options.position,
2424
+ ...errorUtil.errToObj(options == null ? void 0 : options.message)
2283
2425
  });
2284
2426
  }
2285
2427
  startsWith(value, message) {
@@ -2318,8 +2460,7 @@ var ZodString = class _ZodString extends ZodType {
2318
2460
  });
2319
2461
  }
2320
2462
  /**
2321
- * @deprecated Use z.string().min(1) instead.
2322
- * @see {@link ZodString.min}
2463
+ * Equivalent to `.min(1)`
2323
2464
  */
2324
2465
  nonempty(message) {
2325
2466
  return this.min(1, errorUtil.errToObj(message));
@@ -2381,9 +2522,15 @@ var ZodString = class _ZodString extends ZodType {
2381
2522
  get isIP() {
2382
2523
  return !!this._def.checks.find((ch) => ch.kind === "ip");
2383
2524
  }
2525
+ get isCIDR() {
2526
+ return !!this._def.checks.find((ch) => ch.kind === "cidr");
2527
+ }
2384
2528
  get isBase64() {
2385
2529
  return !!this._def.checks.find((ch) => ch.kind === "base64");
2386
2530
  }
2531
+ get isBase64url() {
2532
+ return !!this._def.checks.find((ch) => ch.kind === "base64url");
2533
+ }
2387
2534
  get minLength() {
2388
2535
  let min = null;
2389
2536
  for (const ch of this._def.checks) {
@@ -2406,11 +2553,10 @@ var ZodString = class _ZodString extends ZodType {
2406
2553
  }
2407
2554
  };
2408
2555
  ZodString.create = (params) => {
2409
- var _a;
2410
2556
  return new ZodString({
2411
2557
  checks: [],
2412
2558
  typeName: ZodFirstPartyTypeKind.ZodString,
2413
- coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
2559
+ coerce: (params == null ? void 0 : params.coerce) ?? false,
2414
2560
  ...processCreateParams(params)
2415
2561
  });
2416
2562
  };
@@ -2418,9 +2564,9 @@ function floatSafeRemainder(val, step) {
2418
2564
  const valDecCount = (val.toString().split(".")[1] || "").length;
2419
2565
  const stepDecCount = (step.toString().split(".")[1] || "").length;
2420
2566
  const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
2421
- const valInt = parseInt(val.toFixed(decCount).replace(".", ""));
2422
- const stepInt = parseInt(step.toFixed(decCount).replace(".", ""));
2423
- return valInt % stepInt / Math.pow(10, decCount);
2567
+ const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
2568
+ const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
2569
+ return valInt % stepInt / 10 ** decCount;
2424
2570
  }
2425
2571
  var ZodNumber = class _ZodNumber extends ZodType {
2426
2572
  constructor() {
@@ -2630,7 +2776,8 @@ var ZodNumber = class _ZodNumber extends ZodType {
2630
2776
  return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
2631
2777
  }
2632
2778
  get isFinite() {
2633
- let max = null, min = null;
2779
+ let max = null;
2780
+ let min = null;
2634
2781
  for (const ch of this._def.checks) {
2635
2782
  if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
2636
2783
  return true;
@@ -2649,7 +2796,7 @@ ZodNumber.create = (params) => {
2649
2796
  return new ZodNumber({
2650
2797
  checks: [],
2651
2798
  typeName: ZodFirstPartyTypeKind.ZodNumber,
2652
- coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
2799
+ coerce: (params == null ? void 0 : params.coerce) || false,
2653
2800
  ...processCreateParams(params)
2654
2801
  });
2655
2802
  };
@@ -2661,17 +2808,15 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
2661
2808
  }
2662
2809
  _parse(input) {
2663
2810
  if (this._def.coerce) {
2664
- input.data = BigInt(input.data);
2811
+ try {
2812
+ input.data = BigInt(input.data);
2813
+ } catch {
2814
+ return this._getInvalidInput(input);
2815
+ }
2665
2816
  }
2666
2817
  const parsedType = this._getType(input);
2667
2818
  if (parsedType !== ZodParsedType.bigint) {
2668
- const ctx2 = this._getOrReturnCtx(input);
2669
- addIssueToContext(ctx2, {
2670
- code: ZodIssueCode.invalid_type,
2671
- expected: ZodParsedType.bigint,
2672
- received: ctx2.parsedType
2673
- });
2674
- return INVALID;
2819
+ return this._getInvalidInput(input);
2675
2820
  }
2676
2821
  let ctx = void 0;
2677
2822
  const status = new ParseStatus();
@@ -2718,6 +2863,15 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
2718
2863
  }
2719
2864
  return { status: status.value, value: input.data };
2720
2865
  }
2866
+ _getInvalidInput(input) {
2867
+ const ctx = this._getOrReturnCtx(input);
2868
+ addIssueToContext(ctx, {
2869
+ code: ZodIssueCode.invalid_type,
2870
+ expected: ZodParsedType.bigint,
2871
+ received: ctx.parsedType
2872
+ });
2873
+ return INVALID;
2874
+ }
2721
2875
  gte(value, message) {
2722
2876
  return this.setLimit("min", value, true, errorUtil.toString(message));
2723
2877
  }
@@ -2811,11 +2965,10 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
2811
2965
  }
2812
2966
  };
2813
2967
  ZodBigInt.create = (params) => {
2814
- var _a;
2815
2968
  return new ZodBigInt({
2816
2969
  checks: [],
2817
2970
  typeName: ZodFirstPartyTypeKind.ZodBigInt,
2818
- coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
2971
+ coerce: (params == null ? void 0 : params.coerce) ?? false,
2819
2972
  ...processCreateParams(params)
2820
2973
  });
2821
2974
  };
@@ -2840,7 +2993,7 @@ var ZodBoolean = class extends ZodType {
2840
2993
  ZodBoolean.create = (params) => {
2841
2994
  return new ZodBoolean({
2842
2995
  typeName: ZodFirstPartyTypeKind.ZodBoolean,
2843
- coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
2996
+ coerce: (params == null ? void 0 : params.coerce) || false,
2844
2997
  ...processCreateParams(params)
2845
2998
  });
2846
2999
  };
@@ -2859,7 +3012,7 @@ var ZodDate = class _ZodDate extends ZodType {
2859
3012
  });
2860
3013
  return INVALID;
2861
3014
  }
2862
- if (isNaN(input.data.getTime())) {
3015
+ if (Number.isNaN(input.data.getTime())) {
2863
3016
  const ctx2 = this._getOrReturnCtx(input);
2864
3017
  addIssueToContext(ctx2, {
2865
3018
  code: ZodIssueCode.invalid_date
@@ -2948,7 +3101,7 @@ var ZodDate = class _ZodDate extends ZodType {
2948
3101
  ZodDate.create = (params) => {
2949
3102
  return new ZodDate({
2950
3103
  checks: [],
2951
- coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
3104
+ coerce: (params == null ? void 0 : params.coerce) || false,
2952
3105
  typeName: ZodFirstPartyTypeKind.ZodDate,
2953
3106
  ...processCreateParams(params)
2954
3107
  });
@@ -3223,7 +3376,8 @@ var ZodObject = class _ZodObject extends ZodType {
3223
3376
  return this._cached;
3224
3377
  const shape = this._def.shape();
3225
3378
  const keys = util.objectKeys(shape);
3226
- return this._cached = { shape, keys };
3379
+ this._cached = { shape, keys };
3380
+ return this._cached;
3227
3381
  }
3228
3382
  _parse(input) {
3229
3383
  const parsedType = this._getType(input);
@@ -3273,9 +3427,8 @@ var ZodObject = class _ZodObject extends ZodType {
3273
3427
  });
3274
3428
  status.dirty();
3275
3429
  }
3276
- } else if (unknownKeys === "strip")
3277
- ;
3278
- else {
3430
+ } else if (unknownKeys === "strip") {
3431
+ } else {
3279
3432
  throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);
3280
3433
  }
3281
3434
  } else {
@@ -3322,11 +3475,11 @@ var ZodObject = class _ZodObject extends ZodType {
3322
3475
  unknownKeys: "strict",
3323
3476
  ...message !== void 0 ? {
3324
3477
  errorMap: (issue, ctx) => {
3325
- var _a, _b, _c, _d;
3326
- 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;
3478
+ var _a, _b;
3479
+ const defaultError = ((_b = (_a = this._def).errorMap) == null ? void 0 : _b.call(_a, issue, ctx).message) ?? ctx.defaultError;
3327
3480
  if (issue.code === "unrecognized_keys")
3328
3481
  return {
3329
- message: (_d = errorUtil.errToObj(message).message) !== null && _d !== void 0 ? _d : defaultError
3482
+ message: errorUtil.errToObj(message).message ?? defaultError
3330
3483
  };
3331
3484
  return {
3332
3485
  message: defaultError
@@ -3449,19 +3602,19 @@ var ZodObject = class _ZodObject extends ZodType {
3449
3602
  // }) as any;
3450
3603
  // return merged;
3451
3604
  // }
3452
- catchall(index5) {
3605
+ catchall(index6) {
3453
3606
  return new _ZodObject({
3454
3607
  ...this._def,
3455
- catchall: index5
3608
+ catchall: index6
3456
3609
  });
3457
3610
  }
3458
3611
  pick(mask) {
3459
3612
  const shape = {};
3460
- util.objectKeys(mask).forEach((key) => {
3613
+ for (const key of util.objectKeys(mask)) {
3461
3614
  if (mask[key] && this.shape[key]) {
3462
3615
  shape[key] = this.shape[key];
3463
3616
  }
3464
- });
3617
+ }
3465
3618
  return new _ZodObject({
3466
3619
  ...this._def,
3467
3620
  shape: () => shape
@@ -3469,11 +3622,11 @@ var ZodObject = class _ZodObject extends ZodType {
3469
3622
  }
3470
3623
  omit(mask) {
3471
3624
  const shape = {};
3472
- util.objectKeys(this.shape).forEach((key) => {
3625
+ for (const key of util.objectKeys(this.shape)) {
3473
3626
  if (!mask[key]) {
3474
3627
  shape[key] = this.shape[key];
3475
3628
  }
3476
- });
3629
+ }
3477
3630
  return new _ZodObject({
3478
3631
  ...this._def,
3479
3632
  shape: () => shape
@@ -3487,14 +3640,14 @@ var ZodObject = class _ZodObject extends ZodType {
3487
3640
  }
3488
3641
  partial(mask) {
3489
3642
  const newShape = {};
3490
- util.objectKeys(this.shape).forEach((key) => {
3643
+ for (const key of util.objectKeys(this.shape)) {
3491
3644
  const fieldSchema = this.shape[key];
3492
3645
  if (mask && !mask[key]) {
3493
3646
  newShape[key] = fieldSchema;
3494
3647
  } else {
3495
3648
  newShape[key] = fieldSchema.optional();
3496
3649
  }
3497
- });
3650
+ }
3498
3651
  return new _ZodObject({
3499
3652
  ...this._def,
3500
3653
  shape: () => newShape
@@ -3502,7 +3655,7 @@ var ZodObject = class _ZodObject extends ZodType {
3502
3655
  }
3503
3656
  required(mask) {
3504
3657
  const newShape = {};
3505
- util.objectKeys(this.shape).forEach((key) => {
3658
+ for (const key of util.objectKeys(this.shape)) {
3506
3659
  if (mask && !mask[key]) {
3507
3660
  newShape[key] = this.shape[key];
3508
3661
  } else {
@@ -3513,7 +3666,7 @@ var ZodObject = class _ZodObject extends ZodType {
3513
3666
  }
3514
3667
  newShape[key] = newField;
3515
3668
  }
3516
- });
3669
+ }
3517
3670
  return new _ZodObject({
3518
3671
  ...this._def,
3519
3672
  shape: () => newShape
@@ -3770,9 +3923,9 @@ function mergeValues(a, b) {
3770
3923
  return { valid: false };
3771
3924
  }
3772
3925
  const newArray = [];
3773
- for (let index5 = 0; index5 < a.length; index5++) {
3774
- const itemA = a[index5];
3775
- const itemB = b[index5];
3926
+ for (let index6 = 0; index6 < a.length; index6++) {
3927
+ const itemA = a[index6];
3928
+ const itemB = b[index6];
3776
3929
  const sharedValue = mergeValues(itemA, itemB);
3777
3930
  if (!sharedValue.valid) {
3778
3931
  return { valid: false };
@@ -3978,10 +4131,10 @@ var ZodMap = class extends ZodType {
3978
4131
  }
3979
4132
  const keyType = this._def.keyType;
3980
4133
  const valueType = this._def.valueType;
3981
- const pairs = [...ctx.data.entries()].map(([key, value], index5) => {
4134
+ const pairs = [...ctx.data.entries()].map(([key, value], index6) => {
3982
4135
  return {
3983
- key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [index5, "key"])),
3984
- value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index5, "value"]))
4136
+ key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [index6, "key"])),
4137
+ value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index6, "value"]))
3985
4138
  };
3986
4139
  });
3987
4140
  if (ctx.common.async) {
@@ -4129,12 +4282,7 @@ var ZodFunction = class _ZodFunction extends ZodType {
4129
4282
  return makeIssue({
4130
4283
  data: args,
4131
4284
  path: ctx.path,
4132
- errorMaps: [
4133
- ctx.common.contextualErrorMap,
4134
- ctx.schemaErrorMap,
4135
- getErrorMap(),
4136
- errorMap
4137
- ].filter((x) => !!x),
4285
+ errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
4138
4286
  issueData: {
4139
4287
  code: ZodIssueCode.invalid_arguments,
4140
4288
  argumentsError: error
@@ -4145,12 +4293,7 @@ var ZodFunction = class _ZodFunction extends ZodType {
4145
4293
  return makeIssue({
4146
4294
  data: returns,
4147
4295
  path: ctx.path,
4148
- errorMaps: [
4149
- ctx.common.contextualErrorMap,
4150
- ctx.schemaErrorMap,
4151
- getErrorMap(),
4152
- errorMap
4153
- ].filter((x) => !!x),
4296
+ errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
4154
4297
  issueData: {
4155
4298
  code: ZodIssueCode.invalid_return_type,
4156
4299
  returnTypeError: error
@@ -4274,10 +4417,6 @@ function createZodEnum(values, params) {
4274
4417
  });
4275
4418
  }
4276
4419
  var ZodEnum = class _ZodEnum extends ZodType {
4277
- constructor() {
4278
- super(...arguments);
4279
- _ZodEnum_cache.set(this, void 0);
4280
- }
4281
4420
  _parse(input) {
4282
4421
  if (typeof input.data !== "string") {
4283
4422
  const ctx = this._getOrReturnCtx(input);
@@ -4289,10 +4428,10 @@ var ZodEnum = class _ZodEnum extends ZodType {
4289
4428
  });
4290
4429
  return INVALID;
4291
4430
  }
4292
- if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f")) {
4293
- __classPrivateFieldSet(this, _ZodEnum_cache, new Set(this._def.values), "f");
4431
+ if (!this._cache) {
4432
+ this._cache = new Set(this._def.values);
4294
4433
  }
4295
- if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f").has(input.data)) {
4434
+ if (!this._cache.has(input.data)) {
4296
4435
  const ctx = this._getOrReturnCtx(input);
4297
4436
  const expectedValues = this._def.values;
4298
4437
  addIssueToContext(ctx, {
@@ -4341,13 +4480,8 @@ var ZodEnum = class _ZodEnum extends ZodType {
4341
4480
  });
4342
4481
  }
4343
4482
  };
4344
- _ZodEnum_cache = /* @__PURE__ */ new WeakMap();
4345
4483
  ZodEnum.create = createZodEnum;
4346
4484
  var ZodNativeEnum = class extends ZodType {
4347
- constructor() {
4348
- super(...arguments);
4349
- _ZodNativeEnum_cache.set(this, void 0);
4350
- }
4351
4485
  _parse(input) {
4352
4486
  const nativeEnumValues = util.getValidEnumValues(this._def.values);
4353
4487
  const ctx = this._getOrReturnCtx(input);
@@ -4360,10 +4494,10 @@ var ZodNativeEnum = class extends ZodType {
4360
4494
  });
4361
4495
  return INVALID;
4362
4496
  }
4363
- if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f")) {
4364
- __classPrivateFieldSet(this, _ZodNativeEnum_cache, new Set(util.getValidEnumValues(this._def.values)), "f");
4497
+ if (!this._cache) {
4498
+ this._cache = new Set(util.getValidEnumValues(this._def.values));
4365
4499
  }
4366
- if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f").has(input.data)) {
4500
+ if (!this._cache.has(input.data)) {
4367
4501
  const expectedValues = util.objectValues(nativeEnumValues);
4368
4502
  addIssueToContext(ctx, {
4369
4503
  received: ctx.data,
@@ -4378,7 +4512,6 @@ var ZodNativeEnum = class extends ZodType {
4378
4512
  return this._def.values;
4379
4513
  }
4380
4514
  };
4381
- _ZodNativeEnum_cache = /* @__PURE__ */ new WeakMap();
4382
4515
  ZodNativeEnum.create = (values, params) => {
4383
4516
  return new ZodNativeEnum({
4384
4517
  values,
@@ -4519,7 +4652,7 @@ var ZodEffects = class extends ZodType {
4519
4652
  parent: ctx
4520
4653
  });
4521
4654
  if (!isValid(base))
4522
- return base;
4655
+ return INVALID;
4523
4656
  const result = effect.transform(base.value, checkCtx);
4524
4657
  if (result instanceof Promise) {
4525
4658
  throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
@@ -4528,8 +4661,11 @@ var ZodEffects = class extends ZodType {
4528
4661
  } else {
4529
4662
  return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {
4530
4663
  if (!isValid(base))
4531
- return base;
4532
- return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({ status: status.value, value: result }));
4664
+ return INVALID;
4665
+ return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
4666
+ status: status.value,
4667
+ value: result
4668
+ }));
4533
4669
  });
4534
4670
  }
4535
4671
  }
@@ -4858,83 +4994,341 @@ var nullableType = ZodNullable.create;
4858
4994
  var preprocessType = ZodEffects.createWithPreprocess;
4859
4995
  var pipelineType = ZodPipeline.create;
4860
4996
 
4861
- // src/serializer/mysqlSchema.ts
4997
+ // src/serializer/gelSchema.ts
4998
+ var enumSchema = objectType({
4999
+ name: stringType(),
5000
+ schema: stringType(),
5001
+ values: stringType().array()
5002
+ }).strict();
5003
+ var enumSchemaV1 = objectType({
5004
+ name: stringType(),
5005
+ values: recordType(stringType(), stringType())
5006
+ }).strict();
5007
+ var indexColumn = objectType({
5008
+ expression: stringType(),
5009
+ isExpression: booleanType(),
5010
+ asc: booleanType(),
5011
+ nulls: stringType().optional(),
5012
+ opclass: stringType().optional()
5013
+ });
4862
5014
  var index = objectType({
4863
5015
  name: stringType(),
4864
- columns: stringType().array(),
5016
+ columns: indexColumn.array(),
4865
5017
  isUnique: booleanType(),
4866
- using: enumType(["btree", "hash"]).optional(),
4867
- algorithm: enumType(["default", "inplace", "copy"]).optional(),
4868
- lock: enumType(["default", "none", "shared", "exclusive"]).optional()
5018
+ with: recordType(stringType(), anyType()).optional(),
5019
+ method: stringType().default("btree"),
5020
+ where: stringType().optional(),
5021
+ concurrently: booleanType().default(false)
4869
5022
  }).strict();
4870
5023
  var fk = objectType({
4871
5024
  name: stringType(),
4872
5025
  tableFrom: stringType(),
4873
5026
  columnsFrom: stringType().array(),
4874
5027
  tableTo: stringType(),
5028
+ schemaTo: stringType().optional(),
4875
5029
  columnsTo: stringType().array(),
4876
5030
  onUpdate: stringType().optional(),
4877
5031
  onDelete: stringType().optional()
4878
5032
  }).strict();
5033
+ var sequenceSchema = objectType({
5034
+ name: stringType(),
5035
+ increment: stringType().optional(),
5036
+ minValue: stringType().optional(),
5037
+ maxValue: stringType().optional(),
5038
+ startWith: stringType().optional(),
5039
+ cache: stringType().optional(),
5040
+ cycle: booleanType().optional(),
5041
+ schema: stringType()
5042
+ }).strict();
5043
+ var roleSchema = objectType({
5044
+ name: stringType(),
5045
+ createDb: booleanType().optional(),
5046
+ createRole: booleanType().optional(),
5047
+ inherit: booleanType().optional()
5048
+ }).strict();
5049
+ var sequenceSquashed = objectType({
5050
+ name: stringType(),
5051
+ schema: stringType(),
5052
+ values: stringType()
5053
+ }).strict();
4879
5054
  var column = objectType({
4880
5055
  name: stringType(),
4881
5056
  type: stringType(),
5057
+ typeSchema: stringType().optional(),
4882
5058
  primaryKey: booleanType(),
4883
5059
  notNull: booleanType(),
4884
- autoincrement: booleanType().optional(),
4885
5060
  default: anyType().optional(),
4886
- onUpdate: anyType().optional(),
5061
+ isUnique: anyType().optional(),
5062
+ uniqueName: stringType().optional(),
5063
+ nullsNotDistinct: booleanType().optional(),
4887
5064
  generated: objectType({
4888
- type: enumType(["stored", "virtual"]),
5065
+ type: literalType("stored"),
4889
5066
  as: stringType()
4890
- }).optional()
5067
+ }).optional(),
5068
+ identity: sequenceSchema.merge(objectType({ type: enumType(["always", "byDefault"]) })).optional()
4891
5069
  }).strict();
4892
- var tableV3 = objectType({
5070
+ var checkConstraint = objectType({
4893
5071
  name: stringType(),
4894
- columns: recordType(stringType(), column),
4895
- indexes: recordType(stringType(), index),
4896
- foreignKeys: recordType(stringType(), fk)
5072
+ value: stringType()
4897
5073
  }).strict();
4898
- var compositePK = objectType({
5074
+ var columnSquashed = objectType({
5075
+ name: stringType(),
5076
+ type: stringType(),
5077
+ typeSchema: stringType().optional(),
5078
+ primaryKey: booleanType(),
5079
+ notNull: booleanType(),
5080
+ default: anyType().optional(),
5081
+ isUnique: anyType().optional(),
5082
+ uniqueName: stringType().optional(),
5083
+ nullsNotDistinct: booleanType().optional(),
5084
+ generated: objectType({
5085
+ type: literalType("stored"),
5086
+ as: stringType()
5087
+ }).optional(),
5088
+ identity: stringType().optional()
5089
+ }).strict();
5090
+ var compositePK = objectType({
4899
5091
  name: stringType(),
4900
5092
  columns: stringType().array()
4901
5093
  }).strict();
4902
5094
  var uniqueConstraint = objectType({
4903
5095
  name: stringType(),
4904
- columns: stringType().array()
5096
+ columns: stringType().array(),
5097
+ nullsNotDistinct: booleanType()
4905
5098
  }).strict();
4906
- var checkConstraint = objectType({
5099
+ var policy = objectType({
4907
5100
  name: stringType(),
4908
- value: stringType()
5101
+ as: enumType(["PERMISSIVE", "RESTRICTIVE"]).optional(),
5102
+ for: enumType(["ALL", "SELECT", "INSERT", "UPDATE", "DELETE"]).optional(),
5103
+ to: stringType().array().optional(),
5104
+ using: stringType().optional(),
5105
+ withCheck: stringType().optional(),
5106
+ on: stringType().optional(),
5107
+ schema: stringType().optional()
4909
5108
  }).strict();
4910
- var tableV4 = objectType({
5109
+ var policySquashed = objectType({
4911
5110
  name: stringType(),
4912
- schema: stringType().optional(),
5111
+ values: stringType()
5112
+ }).strict();
5113
+ var viewWithOption = objectType({
5114
+ checkOption: enumType(["local", "cascaded"]).optional(),
5115
+ securityBarrier: booleanType().optional(),
5116
+ securityInvoker: booleanType().optional()
5117
+ }).strict();
5118
+ var matViewWithOption = objectType({
5119
+ fillfactor: numberType().optional(),
5120
+ toastTupleTarget: numberType().optional(),
5121
+ parallelWorkers: numberType().optional(),
5122
+ autovacuumEnabled: booleanType().optional(),
5123
+ vacuumIndexCleanup: enumType(["auto", "off", "on"]).optional(),
5124
+ vacuumTruncate: booleanType().optional(),
5125
+ autovacuumVacuumThreshold: numberType().optional(),
5126
+ autovacuumVacuumScaleFactor: numberType().optional(),
5127
+ autovacuumVacuumCostDelay: numberType().optional(),
5128
+ autovacuumVacuumCostLimit: numberType().optional(),
5129
+ autovacuumFreezeMinAge: numberType().optional(),
5130
+ autovacuumFreezeMaxAge: numberType().optional(),
5131
+ autovacuumFreezeTableAge: numberType().optional(),
5132
+ autovacuumMultixactFreezeMinAge: numberType().optional(),
5133
+ autovacuumMultixactFreezeMaxAge: numberType().optional(),
5134
+ autovacuumMultixactFreezeTableAge: numberType().optional(),
5135
+ logAutovacuumMinDuration: numberType().optional(),
5136
+ userCatalogTable: booleanType().optional()
5137
+ }).strict();
5138
+ var mergedViewWithOption = viewWithOption.merge(matViewWithOption).strict();
5139
+ var view = objectType({
5140
+ name: stringType(),
5141
+ schema: stringType(),
4913
5142
  columns: recordType(stringType(), column),
4914
- indexes: recordType(stringType(), index),
4915
- foreignKeys: recordType(stringType(), fk)
5143
+ definition: stringType().optional(),
5144
+ materialized: booleanType(),
5145
+ with: mergedViewWithOption.optional(),
5146
+ isExisting: booleanType(),
5147
+ withNoData: booleanType().optional(),
5148
+ using: stringType().optional(),
5149
+ tablespace: stringType().optional()
4916
5150
  }).strict();
4917
5151
  var table = objectType({
4918
5152
  name: stringType(),
5153
+ schema: stringType(),
4919
5154
  columns: recordType(stringType(), column),
4920
5155
  indexes: recordType(stringType(), index),
4921
5156
  foreignKeys: recordType(stringType(), fk),
4922
5157
  compositePrimaryKeys: recordType(stringType(), compositePK),
4923
5158
  uniqueConstraints: recordType(stringType(), uniqueConstraint).default({}),
4924
- checkConstraint: recordType(stringType(), checkConstraint).default({})
5159
+ policies: recordType(stringType(), policy).default({}),
5160
+ checkConstraints: recordType(stringType(), checkConstraint).default({}),
5161
+ isRLSEnabled: booleanType().default(false)
5162
+ }).strict();
5163
+ var schemaHash = objectType({
5164
+ id: stringType(),
5165
+ prevId: stringType()
5166
+ });
5167
+ var kitInternals = objectType({
5168
+ tables: recordType(
5169
+ stringType(),
5170
+ objectType({
5171
+ columns: recordType(
5172
+ stringType(),
5173
+ objectType({
5174
+ isArray: booleanType().optional(),
5175
+ dimensions: numberType().optional(),
5176
+ rawType: stringType().optional(),
5177
+ isDefaultAnExpression: booleanType().optional()
5178
+ }).optional()
5179
+ )
5180
+ }).optional()
5181
+ )
5182
+ }).optional();
5183
+ var gelSchemaExternal = objectType({
5184
+ version: literalType("1"),
5185
+ dialect: literalType("gel"),
5186
+ tables: arrayType(table),
5187
+ enums: arrayType(enumSchemaV1),
5188
+ schemas: arrayType(objectType({ name: stringType() })),
5189
+ _meta: objectType({
5190
+ schemas: recordType(stringType(), stringType()),
5191
+ tables: recordType(stringType(), stringType()),
5192
+ columns: recordType(stringType(), stringType())
5193
+ })
5194
+ }).strict();
5195
+ var gelSchemaInternal = objectType({
5196
+ version: literalType("1"),
5197
+ dialect: literalType("gel"),
5198
+ tables: recordType(stringType(), table),
5199
+ enums: recordType(stringType(), enumSchema),
5200
+ schemas: recordType(stringType(), stringType()),
5201
+ views: recordType(stringType(), view).default({}),
5202
+ sequences: recordType(stringType(), sequenceSchema).default({}),
5203
+ roles: recordType(stringType(), roleSchema).default({}),
5204
+ policies: recordType(stringType(), policy).default({}),
5205
+ _meta: objectType({
5206
+ schemas: recordType(stringType(), stringType()),
5207
+ tables: recordType(stringType(), stringType()),
5208
+ columns: recordType(stringType(), stringType())
5209
+ }),
5210
+ internal: kitInternals
5211
+ }).strict();
5212
+ var tableSquashed = objectType({
5213
+ name: stringType(),
5214
+ schema: stringType(),
5215
+ columns: recordType(stringType(), columnSquashed),
5216
+ indexes: recordType(stringType(), stringType()),
5217
+ foreignKeys: recordType(stringType(), stringType()),
5218
+ compositePrimaryKeys: recordType(stringType(), stringType()),
5219
+ uniqueConstraints: recordType(stringType(), stringType()),
5220
+ policies: recordType(stringType(), stringType()),
5221
+ checkConstraints: recordType(stringType(), stringType()),
5222
+ isRLSEnabled: booleanType().default(false)
5223
+ }).strict();
5224
+ var gelSchemaSquashed = objectType({
5225
+ version: literalType("1"),
5226
+ dialect: literalType("gel"),
5227
+ tables: recordType(stringType(), tableSquashed),
5228
+ enums: recordType(stringType(), enumSchema),
5229
+ schemas: recordType(stringType(), stringType()),
5230
+ views: recordType(stringType(), view),
5231
+ sequences: recordType(stringType(), sequenceSquashed),
5232
+ roles: recordType(stringType(), roleSchema).default({}),
5233
+ policies: recordType(stringType(), policySquashed).default({})
5234
+ }).strict();
5235
+ var gelSchema = gelSchemaInternal.merge(schemaHash);
5236
+ var backwardCompatibleGelSchema = gelSchema;
5237
+ var dryGel = gelSchema.parse({
5238
+ version: "1",
5239
+ dialect: "gel",
5240
+ id: originUUID,
5241
+ prevId: "",
5242
+ tables: {},
5243
+ enums: {},
5244
+ schemas: {},
5245
+ policies: {},
5246
+ roles: {},
5247
+ sequences: {},
5248
+ _meta: {
5249
+ schemas: {},
5250
+ tables: {},
5251
+ columns: {}
5252
+ }
5253
+ });
5254
+
5255
+ // src/serializer/mysqlSchema.ts
5256
+ var index2 = objectType({
5257
+ name: stringType(),
5258
+ columns: stringType().array(),
5259
+ isUnique: booleanType(),
5260
+ using: enumType(["btree", "hash"]).optional(),
5261
+ algorithm: enumType(["default", "inplace", "copy"]).optional(),
5262
+ lock: enumType(["default", "none", "shared", "exclusive"]).optional()
5263
+ }).strict();
5264
+ var fk2 = objectType({
5265
+ name: stringType(),
5266
+ tableFrom: stringType(),
5267
+ columnsFrom: stringType().array(),
5268
+ tableTo: stringType(),
5269
+ columnsTo: stringType().array(),
5270
+ onUpdate: stringType().optional(),
5271
+ onDelete: stringType().optional()
5272
+ }).strict();
5273
+ var column2 = objectType({
5274
+ name: stringType(),
5275
+ type: stringType(),
5276
+ primaryKey: booleanType(),
5277
+ notNull: booleanType(),
5278
+ autoincrement: booleanType().optional(),
5279
+ default: anyType().optional(),
5280
+ onUpdate: anyType().optional(),
5281
+ generated: objectType({
5282
+ type: enumType(["stored", "virtual"]),
5283
+ as: stringType()
5284
+ }).optional()
5285
+ }).strict();
5286
+ var tableV3 = objectType({
5287
+ name: stringType(),
5288
+ columns: recordType(stringType(), column2),
5289
+ indexes: recordType(stringType(), index2),
5290
+ foreignKeys: recordType(stringType(), fk2)
5291
+ }).strict();
5292
+ var compositePK2 = objectType({
5293
+ name: stringType(),
5294
+ columns: stringType().array()
5295
+ }).strict();
5296
+ var uniqueConstraint2 = objectType({
5297
+ name: stringType(),
5298
+ columns: stringType().array()
5299
+ }).strict();
5300
+ var checkConstraint2 = objectType({
5301
+ name: stringType(),
5302
+ value: stringType()
5303
+ }).strict();
5304
+ var tableV4 = objectType({
5305
+ name: stringType(),
5306
+ schema: stringType().optional(),
5307
+ columns: recordType(stringType(), column2),
5308
+ indexes: recordType(stringType(), index2),
5309
+ foreignKeys: recordType(stringType(), fk2)
5310
+ }).strict();
5311
+ var table2 = objectType({
5312
+ name: stringType(),
5313
+ columns: recordType(stringType(), column2),
5314
+ indexes: recordType(stringType(), index2),
5315
+ foreignKeys: recordType(stringType(), fk2),
5316
+ compositePrimaryKeys: recordType(stringType(), compositePK2),
5317
+ uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({}),
5318
+ checkConstraint: recordType(stringType(), checkConstraint2).default({})
4925
5319
  }).strict();
4926
5320
  var viewMeta = objectType({
4927
5321
  algorithm: enumType(["undefined", "merge", "temptable"]),
4928
5322
  sqlSecurity: enumType(["definer", "invoker"]),
4929
5323
  withCheckOption: enumType(["local", "cascaded"]).optional()
4930
5324
  }).strict();
4931
- var view = objectType({
5325
+ var view2 = objectType({
4932
5326
  name: stringType(),
4933
- columns: recordType(stringType(), column),
5327
+ columns: recordType(stringType(), column2),
4934
5328
  definition: stringType().optional(),
4935
5329
  isExisting: booleanType()
4936
5330
  }).strict().merge(viewMeta);
4937
- var kitInternals = objectType({
5331
+ var kitInternals2 = objectType({
4938
5332
  tables: recordType(
4939
5333
  stringType(),
4940
5334
  objectType({
@@ -4955,7 +5349,7 @@ var kitInternals = objectType({
4955
5349
  ).optional()
4956
5350
  }).optional();
4957
5351
  var dialect = literalType("mysql");
4958
- var schemaHash = objectType({
5352
+ var schemaHash2 = objectType({
4959
5353
  id: stringType(),
4960
5354
  prevId: stringType()
4961
5355
  });
@@ -4973,47 +5367,47 @@ var schemaInternalV4 = objectType({
4973
5367
  var schemaInternalV5 = objectType({
4974
5368
  version: literalType("5"),
4975
5369
  dialect,
4976
- tables: recordType(stringType(), table),
5370
+ tables: recordType(stringType(), table2),
4977
5371
  schemas: recordType(stringType(), stringType()),
4978
5372
  _meta: objectType({
4979
5373
  schemas: recordType(stringType(), stringType()),
4980
5374
  tables: recordType(stringType(), stringType()),
4981
5375
  columns: recordType(stringType(), stringType())
4982
5376
  }),
4983
- internal: kitInternals
5377
+ internal: kitInternals2
4984
5378
  }).strict();
4985
5379
  var schemaInternal = objectType({
4986
5380
  version: literalType("5"),
4987
5381
  dialect,
4988
- tables: recordType(stringType(), table),
4989
- views: recordType(stringType(), view).default({}),
5382
+ tables: recordType(stringType(), table2),
5383
+ views: recordType(stringType(), view2).default({}),
4990
5384
  _meta: objectType({
4991
5385
  tables: recordType(stringType(), stringType()),
4992
5386
  columns: recordType(stringType(), stringType())
4993
5387
  }),
4994
- internal: kitInternals
5388
+ internal: kitInternals2
4995
5389
  }).strict();
4996
- var schemaV3 = schemaInternalV3.merge(schemaHash);
4997
- var schemaV4 = schemaInternalV4.merge(schemaHash);
4998
- var schemaV5 = schemaInternalV5.merge(schemaHash);
4999
- var schema = schemaInternal.merge(schemaHash);
5390
+ var schemaV3 = schemaInternalV3.merge(schemaHash2);
5391
+ var schemaV4 = schemaInternalV4.merge(schemaHash2);
5392
+ var schemaV5 = schemaInternalV5.merge(schemaHash2);
5393
+ var schema = schemaInternal.merge(schemaHash2);
5000
5394
  var tableSquashedV4 = objectType({
5001
5395
  name: stringType(),
5002
5396
  schema: stringType().optional(),
5003
- columns: recordType(stringType(), column),
5397
+ columns: recordType(stringType(), column2),
5004
5398
  indexes: recordType(stringType(), stringType()),
5005
5399
  foreignKeys: recordType(stringType(), stringType())
5006
5400
  }).strict();
5007
- var tableSquashed = objectType({
5401
+ var tableSquashed2 = objectType({
5008
5402
  name: stringType(),
5009
- columns: recordType(stringType(), column),
5403
+ columns: recordType(stringType(), column2),
5010
5404
  indexes: recordType(stringType(), stringType()),
5011
5405
  foreignKeys: recordType(stringType(), stringType()),
5012
5406
  compositePrimaryKeys: recordType(stringType(), stringType()),
5013
5407
  uniqueConstraints: recordType(stringType(), stringType()).default({}),
5014
5408
  checkConstraints: recordType(stringType(), stringType()).default({})
5015
5409
  }).strict();
5016
- var viewSquashed = view.omit({
5410
+ var viewSquashed = view2.omit({
5017
5411
  algorithm: true,
5018
5412
  sqlSecurity: true,
5019
5413
  withCheckOption: true
@@ -5021,7 +5415,7 @@ var viewSquashed = view.omit({
5021
5415
  var schemaSquashed = objectType({
5022
5416
  version: literalType("5"),
5023
5417
  dialect,
5024
- tables: recordType(stringType(), tableSquashed),
5418
+ tables: recordType(stringType(), tableSquashed2),
5025
5419
  views: recordType(stringType(), viewSquashed)
5026
5420
  }).strict();
5027
5421
  var schemaSquashedV4 = objectType({
@@ -5072,7 +5466,7 @@ var tableV2 = objectType({
5072
5466
  columns: recordType(stringType(), columnV2),
5073
5467
  indexes: recordType(stringType(), indexV2)
5074
5468
  }).strict();
5075
- var checkConstraint2 = objectType({
5469
+ var checkConstraint3 = objectType({
5076
5470
  name: stringType().optional(),
5077
5471
  value: stringType()
5078
5472
  }).strict();
@@ -5082,13 +5476,13 @@ var domainSchema = objectType({
5082
5476
  baseType: stringType(),
5083
5477
  notNull: booleanType().optional(),
5084
5478
  defaultValue: anyType().optional(),
5085
- checkConstraints: recordType(stringType(), checkConstraint2).optional()
5479
+ checkConstraints: recordType(stringType(), checkConstraint3).optional()
5086
5480
  }).strict();
5087
- var enumSchemaV1 = objectType({
5481
+ var enumSchemaV12 = objectType({
5088
5482
  name: stringType(),
5089
5483
  values: recordType(stringType(), stringType())
5090
5484
  }).strict();
5091
- var enumSchema = objectType({
5485
+ var enumSchema2 = objectType({
5092
5486
  name: stringType(),
5093
5487
  schema: stringType(),
5094
5488
  values: stringType().array()
@@ -5096,7 +5490,7 @@ var enumSchema = objectType({
5096
5490
  var pgSchemaV2 = objectType({
5097
5491
  version: literalType("2"),
5098
5492
  tables: recordType(stringType(), tableV2),
5099
- enums: recordType(stringType(), enumSchemaV1)
5493
+ enums: recordType(stringType(), enumSchemaV12)
5100
5494
  }).strict();
5101
5495
  var references = objectType({
5102
5496
  foreignKeyName: stringType(),
@@ -5121,18 +5515,18 @@ var tableV1 = objectType({
5121
5515
  var pgSchemaV1 = objectType({
5122
5516
  version: literalType("1"),
5123
5517
  tables: recordType(stringType(), tableV1),
5124
- enums: recordType(stringType(), enumSchemaV1)
5518
+ enums: recordType(stringType(), enumSchemaV12)
5125
5519
  }).strict();
5126
- var indexColumn = objectType({
5520
+ var indexColumn2 = objectType({
5127
5521
  expression: stringType(),
5128
5522
  isExpression: booleanType(),
5129
5523
  asc: booleanType(),
5130
5524
  nulls: stringType().optional(),
5131
5525
  opclass: stringType().optional()
5132
5526
  });
5133
- var index2 = objectType({
5527
+ var index3 = objectType({
5134
5528
  name: stringType(),
5135
- columns: indexColumn.array(),
5529
+ columns: indexColumn2.array(),
5136
5530
  isUnique: booleanType(),
5137
5531
  with: recordType(stringType(), anyType()).optional(),
5138
5532
  method: stringType().default("btree"),
@@ -5166,7 +5560,7 @@ var indexV6 = objectType({
5166
5560
  where: stringType().optional(),
5167
5561
  concurrently: booleanType().default(false)
5168
5562
  }).strict();
5169
- var fk2 = objectType({
5563
+ var fk3 = objectType({
5170
5564
  name: stringType(),
5171
5565
  tableFrom: stringType(),
5172
5566
  columnsFrom: stringType().array(),
@@ -5176,7 +5570,7 @@ var fk2 = objectType({
5176
5570
  onUpdate: stringType().optional(),
5177
5571
  onDelete: stringType().optional()
5178
5572
  }).strict();
5179
- var sequenceSchema = objectType({
5573
+ var sequenceSchema2 = objectType({
5180
5574
  name: stringType(),
5181
5575
  increment: stringType().optional(),
5182
5576
  minValue: stringType().optional(),
@@ -5186,13 +5580,13 @@ var sequenceSchema = objectType({
5186
5580
  cycle: booleanType().optional(),
5187
5581
  schema: stringType()
5188
5582
  }).strict();
5189
- var roleSchema = objectType({
5583
+ var roleSchema2 = objectType({
5190
5584
  name: stringType(),
5191
5585
  createDb: booleanType().optional(),
5192
5586
  createRole: booleanType().optional(),
5193
5587
  inherit: booleanType().optional()
5194
5588
  }).strict();
5195
- var sequenceSquashed = objectType({
5589
+ var sequenceSquashed2 = objectType({
5196
5590
  name: stringType(),
5197
5591
  schema: stringType(),
5198
5592
  values: stringType()
@@ -5201,7 +5595,6 @@ var columnV7 = objectType({
5201
5595
  name: stringType(),
5202
5596
  type: stringType(),
5203
5597
  typeSchema: stringType().optional(),
5204
- domainTypeSchema: stringType().optional(),
5205
5598
  primaryKey: booleanType(),
5206
5599
  notNull: booleanType(),
5207
5600
  default: anyType().optional(),
@@ -5209,11 +5602,10 @@ var columnV7 = objectType({
5209
5602
  uniqueName: stringType().optional(),
5210
5603
  nullsNotDistinct: booleanType().optional()
5211
5604
  }).strict();
5212
- var column2 = objectType({
5605
+ var column3 = objectType({
5213
5606
  name: stringType(),
5214
5607
  type: stringType(),
5215
5608
  typeSchema: stringType().optional(),
5216
- domainTypeSchema: stringType().optional(),
5217
5609
  primaryKey: booleanType(),
5218
5610
  notNull: booleanType(),
5219
5611
  default: anyType().optional(),
@@ -5224,13 +5616,12 @@ var column2 = objectType({
5224
5616
  type: literalType("stored"),
5225
5617
  as: stringType()
5226
5618
  }).optional(),
5227
- identity: sequenceSchema.merge(objectType({ type: enumType(["always", "byDefault"]) })).optional()
5619
+ identity: sequenceSchema2.merge(objectType({ type: enumType(["always", "byDefault"]) })).optional()
5228
5620
  }).strict();
5229
- var columnSquashed = objectType({
5621
+ var columnSquashed2 = objectType({
5230
5622
  name: stringType(),
5231
5623
  type: stringType(),
5232
5624
  typeSchema: stringType().optional(),
5233
- domainTypeSchema: stringType().optional(),
5234
5625
  primaryKey: booleanType(),
5235
5626
  notNull: booleanType(),
5236
5627
  default: anyType().optional(),
@@ -5245,20 +5636,20 @@ var columnSquashed = objectType({
5245
5636
  }).strict();
5246
5637
  var tableV32 = objectType({
5247
5638
  name: stringType(),
5248
- columns: recordType(stringType(), column2),
5249
- indexes: recordType(stringType(), index2),
5250
- foreignKeys: recordType(stringType(), fk2)
5639
+ columns: recordType(stringType(), column3),
5640
+ indexes: recordType(stringType(), index3),
5641
+ foreignKeys: recordType(stringType(), fk3)
5251
5642
  }).strict();
5252
- var compositePK2 = objectType({
5643
+ var compositePK3 = objectType({
5253
5644
  name: stringType(),
5254
5645
  columns: stringType().array()
5255
5646
  }).strict();
5256
- var uniqueConstraint2 = objectType({
5647
+ var uniqueConstraint3 = objectType({
5257
5648
  name: stringType(),
5258
5649
  columns: stringType().array(),
5259
5650
  nullsNotDistinct: booleanType()
5260
5651
  }).strict();
5261
- var policy = objectType({
5652
+ var policy2 = objectType({
5262
5653
  name: stringType(),
5263
5654
  as: enumType(["PERMISSIVE", "RESTRICTIVE"]).optional(),
5264
5655
  for: enumType(["ALL", "SELECT", "INSERT", "UPDATE", "DELETE"]).optional(),
@@ -5268,16 +5659,16 @@ var policy = objectType({
5268
5659
  on: stringType().optional(),
5269
5660
  schema: stringType().optional()
5270
5661
  }).strict();
5271
- var policySquashed = objectType({
5662
+ var policySquashed2 = objectType({
5272
5663
  name: stringType(),
5273
5664
  values: stringType()
5274
5665
  }).strict();
5275
- var viewWithOption = objectType({
5666
+ var viewWithOption2 = objectType({
5276
5667
  checkOption: enumType(["local", "cascaded"]).optional(),
5277
5668
  securityBarrier: booleanType().optional(),
5278
5669
  securityInvoker: booleanType().optional()
5279
5670
  }).strict();
5280
- var matViewWithOption = objectType({
5671
+ var matViewWithOption2 = objectType({
5281
5672
  fillfactor: numberType().optional(),
5282
5673
  toastTupleTarget: numberType().optional(),
5283
5674
  parallelWorkers: numberType().optional(),
@@ -5297,14 +5688,14 @@ var matViewWithOption = objectType({
5297
5688
  logAutovacuumMinDuration: numberType().optional(),
5298
5689
  userCatalogTable: booleanType().optional()
5299
5690
  }).strict();
5300
- var mergedViewWithOption = viewWithOption.merge(matViewWithOption).strict();
5301
- var view2 = objectType({
5691
+ var mergedViewWithOption2 = viewWithOption2.merge(matViewWithOption2).strict();
5692
+ var view3 = objectType({
5302
5693
  name: stringType(),
5303
5694
  schema: stringType(),
5304
- columns: recordType(stringType(), column2),
5695
+ columns: recordType(stringType(), column3),
5305
5696
  definition: stringType().optional(),
5306
5697
  materialized: booleanType(),
5307
- with: mergedViewWithOption.optional(),
5698
+ with: mergedViewWithOption2.optional(),
5308
5699
  isExisting: booleanType(),
5309
5700
  withNoData: booleanType().optional(),
5310
5701
  using: stringType().optional(),
@@ -5313,54 +5704,54 @@ var view2 = objectType({
5313
5704
  var tableV42 = objectType({
5314
5705
  name: stringType(),
5315
5706
  schema: stringType(),
5316
- columns: recordType(stringType(), column2),
5707
+ columns: recordType(stringType(), column3),
5317
5708
  indexes: recordType(stringType(), indexV4),
5318
- foreignKeys: recordType(stringType(), fk2)
5709
+ foreignKeys: recordType(stringType(), fk3)
5319
5710
  }).strict();
5320
5711
  var tableV5 = objectType({
5321
5712
  name: stringType(),
5322
5713
  schema: stringType(),
5323
- columns: recordType(stringType(), column2),
5714
+ columns: recordType(stringType(), column3),
5324
5715
  indexes: recordType(stringType(), indexV5),
5325
- foreignKeys: recordType(stringType(), fk2),
5326
- compositePrimaryKeys: recordType(stringType(), compositePK2),
5327
- uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({})
5716
+ foreignKeys: recordType(stringType(), fk3),
5717
+ compositePrimaryKeys: recordType(stringType(), compositePK3),
5718
+ uniqueConstraints: recordType(stringType(), uniqueConstraint3).default({})
5328
5719
  }).strict();
5329
5720
  var tableV6 = objectType({
5330
5721
  name: stringType(),
5331
5722
  schema: stringType(),
5332
- columns: recordType(stringType(), column2),
5723
+ columns: recordType(stringType(), column3),
5333
5724
  indexes: recordType(stringType(), indexV6),
5334
- foreignKeys: recordType(stringType(), fk2),
5335
- compositePrimaryKeys: recordType(stringType(), compositePK2),
5336
- uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({})
5725
+ foreignKeys: recordType(stringType(), fk3),
5726
+ compositePrimaryKeys: recordType(stringType(), compositePK3),
5727
+ uniqueConstraints: recordType(stringType(), uniqueConstraint3).default({})
5337
5728
  }).strict();
5338
5729
  var tableV7 = objectType({
5339
5730
  name: stringType(),
5340
5731
  schema: stringType(),
5341
5732
  columns: recordType(stringType(), columnV7),
5342
- indexes: recordType(stringType(), index2),
5343
- foreignKeys: recordType(stringType(), fk2),
5344
- compositePrimaryKeys: recordType(stringType(), compositePK2),
5345
- uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({})
5733
+ indexes: recordType(stringType(), index3),
5734
+ foreignKeys: recordType(stringType(), fk3),
5735
+ compositePrimaryKeys: recordType(stringType(), compositePK3),
5736
+ uniqueConstraints: recordType(stringType(), uniqueConstraint3).default({})
5346
5737
  }).strict();
5347
- var table2 = objectType({
5738
+ var table3 = objectType({
5348
5739
  name: stringType(),
5349
5740
  schema: stringType(),
5350
- columns: recordType(stringType(), column2),
5351
- indexes: recordType(stringType(), index2),
5352
- foreignKeys: recordType(stringType(), fk2),
5353
- compositePrimaryKeys: recordType(stringType(), compositePK2),
5354
- uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({}),
5355
- policies: recordType(stringType(), policy).default({}),
5356
- checkConstraints: recordType(stringType(), checkConstraint2).default({}),
5741
+ columns: recordType(stringType(), column3),
5742
+ indexes: recordType(stringType(), index3),
5743
+ foreignKeys: recordType(stringType(), fk3),
5744
+ compositePrimaryKeys: recordType(stringType(), compositePK3),
5745
+ uniqueConstraints: recordType(stringType(), uniqueConstraint3).default({}),
5746
+ policies: recordType(stringType(), policy2).default({}),
5747
+ checkConstraints: recordType(stringType(), checkConstraint3).default({}),
5357
5748
  isRLSEnabled: booleanType().default(false)
5358
5749
  }).strict();
5359
- var schemaHash2 = objectType({
5750
+ var schemaHash3 = objectType({
5360
5751
  id: stringType(),
5361
5752
  prevId: stringType()
5362
5753
  });
5363
- var kitInternals2 = objectType({
5754
+ var kitInternals3 = objectType({
5364
5755
  tables: recordType(
5365
5756
  stringType(),
5366
5757
  objectType({
@@ -5380,46 +5771,46 @@ var pgSchemaInternalV3 = objectType({
5380
5771
  version: literalType("3"),
5381
5772
  dialect: literalType("pg"),
5382
5773
  tables: recordType(stringType(), tableV32),
5383
- enums: recordType(stringType(), enumSchemaV1)
5774
+ enums: recordType(stringType(), enumSchemaV12)
5384
5775
  }).strict();
5385
5776
  var pgSchemaInternalV4 = objectType({
5386
5777
  version: literalType("4"),
5387
5778
  dialect: literalType("pg"),
5388
5779
  tables: recordType(stringType(), tableV42),
5389
- enums: recordType(stringType(), enumSchemaV1),
5780
+ enums: recordType(stringType(), enumSchemaV12),
5390
5781
  schemas: recordType(stringType(), stringType())
5391
5782
  }).strict();
5392
5783
  var pgSchemaInternalV5 = objectType({
5393
5784
  version: literalType("5"),
5394
5785
  dialect: literalType("pg"),
5395
5786
  tables: recordType(stringType(), tableV5),
5396
- enums: recordType(stringType(), enumSchemaV1),
5787
+ enums: recordType(stringType(), enumSchemaV12),
5397
5788
  schemas: recordType(stringType(), stringType()),
5398
5789
  _meta: objectType({
5399
5790
  schemas: recordType(stringType(), stringType()),
5400
5791
  tables: recordType(stringType(), stringType()),
5401
5792
  columns: recordType(stringType(), stringType())
5402
5793
  }),
5403
- internal: kitInternals2
5794
+ internal: kitInternals3
5404
5795
  }).strict();
5405
5796
  var pgSchemaInternalV6 = objectType({
5406
5797
  version: literalType("6"),
5407
5798
  dialect: literalType("postgresql"),
5408
5799
  tables: recordType(stringType(), tableV6),
5409
- enums: recordType(stringType(), enumSchema),
5800
+ enums: recordType(stringType(), enumSchema2),
5410
5801
  schemas: recordType(stringType(), stringType()),
5411
5802
  _meta: objectType({
5412
5803
  schemas: recordType(stringType(), stringType()),
5413
5804
  tables: recordType(stringType(), stringType()),
5414
5805
  columns: recordType(stringType(), stringType())
5415
5806
  }),
5416
- internal: kitInternals2
5807
+ internal: kitInternals3
5417
5808
  }).strict();
5418
5809
  var pgSchemaExternal = objectType({
5419
5810
  version: literalType("5"),
5420
5811
  dialect: literalType("pg"),
5421
- tables: arrayType(table2),
5422
- enums: arrayType(enumSchemaV1),
5812
+ tables: arrayType(table3),
5813
+ enums: arrayType(enumSchemaV12),
5423
5814
  schemas: arrayType(objectType({ name: stringType() })),
5424
5815
  _meta: objectType({
5425
5816
  schemas: recordType(stringType(), stringType()),
@@ -5431,36 +5822,33 @@ var pgSchemaInternalV7 = objectType({
5431
5822
  version: literalType("7"),
5432
5823
  dialect: literalType("postgresql"),
5433
5824
  tables: recordType(stringType(), tableV7),
5434
- enums: recordType(stringType(), enumSchema),
5825
+ enums: recordType(stringType(), enumSchema2),
5435
5826
  schemas: recordType(stringType(), stringType()),
5436
- views: recordType(stringType(), view2).default({}),
5437
- sequences: recordType(stringType(), sequenceSchema).default({}),
5438
- roles: recordType(stringType(), roleSchema).default({}),
5439
- policies: recordType(stringType(), policy).default({}),
5827
+ sequences: recordType(stringType(), sequenceSchema2),
5440
5828
  _meta: objectType({
5441
5829
  schemas: recordType(stringType(), stringType()),
5442
5830
  tables: recordType(stringType(), stringType()),
5443
5831
  columns: recordType(stringType(), stringType())
5444
5832
  }),
5445
- internal: kitInternals2
5833
+ internal: kitInternals3
5446
5834
  }).strict();
5447
5835
  var pgSchemaInternal = objectType({
5448
- version: literalType(snapshotVersion),
5836
+ version: literalType("7"),
5449
5837
  dialect: literalType("postgresql"),
5450
- tables: recordType(stringType(), table2),
5451
- enums: recordType(stringType(), enumSchema),
5838
+ tables: recordType(stringType(), table3),
5839
+ enums: recordType(stringType(), enumSchema2),
5452
5840
  schemas: recordType(stringType(), stringType()),
5453
- domains: recordType(stringType(), domainSchema),
5454
- views: recordType(stringType(), view2).default({}),
5455
- sequences: recordType(stringType(), sequenceSchema).default({}),
5456
- roles: recordType(stringType(), roleSchema).default({}),
5457
- policies: recordType(stringType(), policy).default({}),
5841
+ domains: recordType(stringType(), domainSchema).default({}),
5842
+ views: recordType(stringType(), view3).default({}),
5843
+ sequences: recordType(stringType(), sequenceSchema2).default({}),
5844
+ roles: recordType(stringType(), roleSchema2).default({}),
5845
+ policies: recordType(stringType(), policy2).default({}),
5458
5846
  _meta: objectType({
5459
5847
  schemas: recordType(stringType(), stringType()),
5460
5848
  tables: recordType(stringType(), stringType()),
5461
5849
  columns: recordType(stringType(), stringType())
5462
5850
  }),
5463
- internal: kitInternals2
5851
+ internal: kitInternals3
5464
5852
  }).strict();
5465
5853
  var domainSquashed = objectType({
5466
5854
  name: stringType(),
@@ -5470,10 +5858,10 @@ var domainSquashed = objectType({
5470
5858
  defaultValue: stringType().optional(),
5471
5859
  checkConstraints: recordType(stringType(), stringType()).optional()
5472
5860
  }).strict();
5473
- var tableSquashed2 = objectType({
5861
+ var tableSquashed3 = objectType({
5474
5862
  name: stringType(),
5475
5863
  schema: stringType(),
5476
- columns: recordType(stringType(), columnSquashed),
5864
+ columns: recordType(stringType(), columnSquashed2),
5477
5865
  indexes: recordType(stringType(), stringType()),
5478
5866
  foreignKeys: recordType(stringType(), stringType()),
5479
5867
  compositePrimaryKeys: recordType(stringType(), stringType()),
@@ -5485,7 +5873,7 @@ var tableSquashed2 = objectType({
5485
5873
  var tableSquashedV42 = objectType({
5486
5874
  name: stringType(),
5487
5875
  schema: stringType(),
5488
- columns: recordType(stringType(), column2),
5876
+ columns: recordType(stringType(), column3),
5489
5877
  indexes: recordType(stringType(), stringType()),
5490
5878
  foreignKeys: recordType(stringType(), stringType())
5491
5879
  }).strict();
@@ -5493,52 +5881,41 @@ var pgSchemaSquashedV4 = objectType({
5493
5881
  version: literalType("4"),
5494
5882
  dialect: literalType("pg"),
5495
5883
  tables: recordType(stringType(), tableSquashedV42),
5496
- enums: recordType(stringType(), enumSchemaV1),
5884
+ enums: recordType(stringType(), enumSchemaV12),
5497
5885
  schemas: recordType(stringType(), stringType())
5498
5886
  }).strict();
5499
5887
  var pgSchemaSquashedV6 = objectType({
5500
5888
  version: literalType("6"),
5501
5889
  dialect: literalType("postgresql"),
5502
- tables: recordType(stringType(), tableSquashed2),
5503
- enums: recordType(stringType(), enumSchema),
5890
+ tables: recordType(stringType(), tableSquashed3),
5891
+ enums: recordType(stringType(), enumSchema2),
5504
5892
  schemas: recordType(stringType(), stringType())
5505
5893
  }).strict();
5506
- var pgSchemaSquashedV7 = objectType({
5507
- version: literalType("7"),
5508
- dialect: literalType("postgresql"),
5509
- tables: recordType(stringType(), tableSquashed2),
5510
- enums: recordType(stringType(), enumSchema),
5511
- schemas: recordType(stringType(), stringType()),
5512
- views: recordType(stringType(), view2),
5513
- sequences: recordType(stringType(), sequenceSquashed),
5514
- roles: recordType(stringType(), roleSchema).default({}),
5515
- policies: recordType(stringType(), policySquashed).default({})
5516
- }).strict();
5517
5894
  var pgSchemaSquashed = objectType({
5518
- version: literalType(snapshotVersion),
5895
+ version: literalType("7"),
5519
5896
  dialect: literalType("postgresql"),
5520
- tables: recordType(stringType(), tableSquashed2),
5521
- domains: recordType(stringType(), domainSquashed),
5522
- enums: recordType(stringType(), enumSchema),
5897
+ tables: recordType(stringType(), tableSquashed3),
5898
+ domains: recordType(stringType(), domainSquashed).default({}),
5899
+ enums: recordType(stringType(), enumSchema2),
5523
5900
  schemas: recordType(stringType(), stringType()),
5524
- views: recordType(stringType(), view2),
5525
- sequences: recordType(stringType(), sequenceSquashed),
5526
- roles: recordType(stringType(), roleSchema).default({}),
5527
- policies: recordType(stringType(), policySquashed).default({})
5901
+ views: recordType(stringType(), view3),
5902
+ sequences: recordType(stringType(), sequenceSquashed2),
5903
+ roles: recordType(stringType(), roleSchema2).default({}),
5904
+ policies: recordType(stringType(), policySquashed2).default({})
5528
5905
  }).strict();
5529
- var pgSchemaV3 = pgSchemaInternalV3.merge(schemaHash2);
5530
- var pgSchemaV4 = pgSchemaInternalV4.merge(schemaHash2);
5531
- var pgSchemaV5 = pgSchemaInternalV5.merge(schemaHash2);
5532
- var pgSchemaV6 = pgSchemaInternalV6.merge(schemaHash2);
5533
- var pgSchemaV7 = pgSchemaInternalV7.merge(schemaHash2);
5534
- var pgSchema = pgSchemaInternal.merge(schemaHash2);
5906
+ var pgSchemaV3 = pgSchemaInternalV3.merge(schemaHash3);
5907
+ var pgSchemaV4 = pgSchemaInternalV4.merge(schemaHash3);
5908
+ var pgSchemaV5 = pgSchemaInternalV5.merge(schemaHash3);
5909
+ var pgSchemaV6 = pgSchemaInternalV6.merge(schemaHash3);
5910
+ var pgSchemaV7 = pgSchemaInternalV7.merge(schemaHash3);
5911
+ var pgSchema = pgSchemaInternal.merge(schemaHash3);
5535
5912
  var backwardCompatiblePgSchema = unionType([
5536
5913
  pgSchemaV5,
5537
5914
  pgSchemaV6,
5538
5915
  pgSchema
5539
5916
  ]);
5540
5917
  var dryPg = pgSchema.parse({
5541
- version: snapshotVersion,
5918
+ version: "7",
5542
5919
  dialect: "postgresql",
5543
5920
  id: originUUID,
5544
5921
  prevId: "",
@@ -5557,7 +5934,7 @@ var dryPg = pgSchema.parse({
5557
5934
  });
5558
5935
 
5559
5936
  // src/serializer/singlestoreSchema.ts
5560
- var index3 = objectType({
5937
+ var index4 = objectType({
5561
5938
  name: stringType(),
5562
5939
  columns: stringType().array(),
5563
5940
  isUnique: booleanType(),
@@ -5565,7 +5942,7 @@ var index3 = objectType({
5565
5942
  algorithm: enumType(["default", "inplace", "copy"]).optional(),
5566
5943
  lock: enumType(["default", "none", "shared", "exclusive"]).optional()
5567
5944
  }).strict();
5568
- var column3 = objectType({
5945
+ var column4 = objectType({
5569
5946
  name: stringType(),
5570
5947
  type: stringType(),
5571
5948
  primaryKey: booleanType(),
@@ -5578,27 +5955,27 @@ var column3 = objectType({
5578
5955
  as: stringType()
5579
5956
  }).optional()
5580
5957
  }).strict();
5581
- var compositePK3 = objectType({
5958
+ var compositePK4 = objectType({
5582
5959
  name: stringType(),
5583
5960
  columns: stringType().array()
5584
5961
  }).strict();
5585
- var uniqueConstraint3 = objectType({
5962
+ var uniqueConstraint4 = objectType({
5586
5963
  name: stringType(),
5587
5964
  columns: stringType().array()
5588
5965
  }).strict();
5589
- var table3 = objectType({
5966
+ var table4 = objectType({
5590
5967
  name: stringType(),
5591
- columns: recordType(stringType(), column3),
5592
- indexes: recordType(stringType(), index3),
5593
- compositePrimaryKeys: recordType(stringType(), compositePK3),
5594
- uniqueConstraints: recordType(stringType(), uniqueConstraint3).default({})
5968
+ columns: recordType(stringType(), column4),
5969
+ indexes: recordType(stringType(), index4),
5970
+ compositePrimaryKeys: recordType(stringType(), compositePK4),
5971
+ uniqueConstraints: recordType(stringType(), uniqueConstraint4).default({})
5595
5972
  }).strict();
5596
5973
  var viewMeta2 = objectType({
5597
5974
  algorithm: enumType(["undefined", "merge", "temptable"]),
5598
5975
  sqlSecurity: enumType(["definer", "invoker"]),
5599
5976
  withCheckOption: enumType(["local", "cascaded"]).optional()
5600
5977
  }).strict();
5601
- var kitInternals3 = objectType({
5978
+ var kitInternals4 = objectType({
5602
5979
  tables: recordType(
5603
5980
  stringType(),
5604
5981
  objectType({
@@ -5619,25 +5996,25 @@ var kitInternals3 = objectType({
5619
5996
  ).optional()
5620
5997
  }).optional();
5621
5998
  var dialect2 = literalType("singlestore");
5622
- var schemaHash3 = objectType({
5999
+ var schemaHash4 = objectType({
5623
6000
  id: stringType(),
5624
6001
  prevId: stringType()
5625
6002
  });
5626
6003
  var schemaInternal2 = objectType({
5627
6004
  version: literalType("1"),
5628
6005
  dialect: dialect2,
5629
- tables: recordType(stringType(), table3),
6006
+ tables: recordType(stringType(), table4),
5630
6007
  /* views: record(string(), view).default({}), */
5631
6008
  _meta: objectType({
5632
6009
  tables: recordType(stringType(), stringType()),
5633
6010
  columns: recordType(stringType(), stringType())
5634
6011
  }),
5635
- internal: kitInternals3
6012
+ internal: kitInternals4
5636
6013
  }).strict();
5637
- var schema2 = schemaInternal2.merge(schemaHash3);
5638
- var tableSquashed3 = objectType({
6014
+ var schema2 = schemaInternal2.merge(schemaHash4);
6015
+ var tableSquashed4 = objectType({
5639
6016
  name: stringType(),
5640
- columns: recordType(stringType(), column3),
6017
+ columns: recordType(stringType(), column4),
5641
6018
  indexes: recordType(stringType(), stringType()),
5642
6019
  compositePrimaryKeys: recordType(stringType(), stringType()),
5643
6020
  uniqueConstraints: recordType(stringType(), stringType()).default({})
@@ -5645,7 +6022,7 @@ var tableSquashed3 = objectType({
5645
6022
  var schemaSquashed2 = objectType({
5646
6023
  version: literalType("1"),
5647
6024
  dialect: dialect2,
5648
- tables: recordType(stringType(), tableSquashed3)
6025
+ tables: recordType(stringType(), tableSquashed4)
5649
6026
  /* views: record(string(), viewSquashed), */
5650
6027
  }).strict();
5651
6028
  var singlestoreSchema = schema2;
@@ -5666,13 +6043,13 @@ var drySingleStore = singlestoreSchema.parse({
5666
6043
  });
5667
6044
 
5668
6045
  // src/serializer/sqliteSchema.ts
5669
- var index4 = objectType({
6046
+ var index5 = objectType({
5670
6047
  name: stringType(),
5671
6048
  columns: stringType().array(),
5672
6049
  where: stringType().optional(),
5673
6050
  isUnique: booleanType()
5674
6051
  }).strict();
5675
- var fk3 = objectType({
6052
+ var fk4 = objectType({
5676
6053
  name: stringType(),
5677
6054
  tableFrom: stringType(),
5678
6055
  columnsFrom: stringType().array(),
@@ -5681,11 +6058,11 @@ var fk3 = objectType({
5681
6058
  onUpdate: stringType().optional(),
5682
6059
  onDelete: stringType().optional()
5683
6060
  }).strict();
5684
- var compositePK4 = objectType({
6061
+ var compositePK5 = objectType({
5685
6062
  columns: stringType().array(),
5686
6063
  name: stringType().optional()
5687
6064
  }).strict();
5688
- var column4 = objectType({
6065
+ var column5 = objectType({
5689
6066
  name: stringType(),
5690
6067
  type: stringType(),
5691
6068
  primaryKey: booleanType(),
@@ -5699,35 +6076,35 @@ var column4 = objectType({
5699
6076
  }).strict();
5700
6077
  var tableV33 = objectType({
5701
6078
  name: stringType(),
5702
- columns: recordType(stringType(), column4),
5703
- indexes: recordType(stringType(), index4),
5704
- foreignKeys: recordType(stringType(), fk3)
6079
+ columns: recordType(stringType(), column5),
6080
+ indexes: recordType(stringType(), index5),
6081
+ foreignKeys: recordType(stringType(), fk4)
5705
6082
  }).strict();
5706
- var uniqueConstraint4 = objectType({
6083
+ var uniqueConstraint5 = objectType({
5707
6084
  name: stringType(),
5708
6085
  columns: stringType().array()
5709
6086
  }).strict();
5710
- var checkConstraint3 = objectType({
6087
+ var checkConstraint4 = objectType({
5711
6088
  name: stringType(),
5712
6089
  value: stringType()
5713
6090
  }).strict();
5714
- var table4 = objectType({
6091
+ var table5 = objectType({
5715
6092
  name: stringType(),
5716
- columns: recordType(stringType(), column4),
5717
- indexes: recordType(stringType(), index4),
5718
- foreignKeys: recordType(stringType(), fk3),
5719
- compositePrimaryKeys: recordType(stringType(), compositePK4),
5720
- uniqueConstraints: recordType(stringType(), uniqueConstraint4).default({}),
5721
- checkConstraints: recordType(stringType(), checkConstraint3).default({})
6093
+ columns: recordType(stringType(), column5),
6094
+ indexes: recordType(stringType(), index5),
6095
+ foreignKeys: recordType(stringType(), fk4),
6096
+ compositePrimaryKeys: recordType(stringType(), compositePK5),
6097
+ uniqueConstraints: recordType(stringType(), uniqueConstraint5).default({}),
6098
+ checkConstraints: recordType(stringType(), checkConstraint4).default({})
5722
6099
  }).strict();
5723
- var view3 = objectType({
6100
+ var view4 = objectType({
5724
6101
  name: stringType(),
5725
- columns: recordType(stringType(), column4),
6102
+ columns: recordType(stringType(), column5),
5726
6103
  definition: stringType().optional(),
5727
6104
  isExisting: booleanType()
5728
6105
  }).strict();
5729
6106
  var dialect3 = enumType(["sqlite"]);
5730
- var schemaHash4 = objectType({
6107
+ var schemaHash5 = objectType({
5731
6108
  id: stringType(),
5732
6109
  prevId: stringType()
5733
6110
  }).strict();
@@ -5740,21 +6117,21 @@ var schemaInternalV32 = objectType({
5740
6117
  var schemaInternalV42 = objectType({
5741
6118
  version: literalType("4"),
5742
6119
  dialect: dialect3,
5743
- tables: recordType(stringType(), table4),
5744
- views: recordType(stringType(), view3).default({}),
6120
+ tables: recordType(stringType(), table5),
6121
+ views: recordType(stringType(), view4).default({}),
5745
6122
  enums: objectType({})
5746
6123
  }).strict();
5747
6124
  var schemaInternalV52 = objectType({
5748
6125
  version: literalType("5"),
5749
6126
  dialect: dialect3,
5750
- tables: recordType(stringType(), table4),
6127
+ tables: recordType(stringType(), table5),
5751
6128
  enums: objectType({}),
5752
6129
  _meta: objectType({
5753
6130
  tables: recordType(stringType(), stringType()),
5754
6131
  columns: recordType(stringType(), stringType())
5755
6132
  })
5756
6133
  }).strict();
5757
- var kitInternals4 = objectType({
6134
+ var kitInternals5 = objectType({
5758
6135
  indexes: recordType(
5759
6136
  stringType(),
5760
6137
  objectType({
@@ -5769,22 +6146,22 @@ var latestVersion = literalType("6");
5769
6146
  var schemaInternal3 = objectType({
5770
6147
  version: latestVersion,
5771
6148
  dialect: dialect3,
5772
- tables: recordType(stringType(), table4),
5773
- views: recordType(stringType(), view3).default({}),
6149
+ tables: recordType(stringType(), table5),
6150
+ views: recordType(stringType(), view4).default({}),
5774
6151
  enums: objectType({}),
5775
6152
  _meta: objectType({
5776
6153
  tables: recordType(stringType(), stringType()),
5777
6154
  columns: recordType(stringType(), stringType())
5778
6155
  }),
5779
- internal: kitInternals4
6156
+ internal: kitInternals5
5780
6157
  }).strict();
5781
- var schemaV32 = schemaInternalV32.merge(schemaHash4).strict();
5782
- var schemaV42 = schemaInternalV42.merge(schemaHash4).strict();
5783
- var schemaV52 = schemaInternalV52.merge(schemaHash4).strict();
5784
- var schema3 = schemaInternal3.merge(schemaHash4).strict();
5785
- var tableSquashed4 = objectType({
6158
+ var schemaV32 = schemaInternalV32.merge(schemaHash5).strict();
6159
+ var schemaV42 = schemaInternalV42.merge(schemaHash5).strict();
6160
+ var schemaV52 = schemaInternalV52.merge(schemaHash5).strict();
6161
+ var schema3 = schemaInternal3.merge(schemaHash5).strict();
6162
+ var tableSquashed5 = objectType({
5786
6163
  name: stringType(),
5787
- columns: recordType(stringType(), column4),
6164
+ columns: recordType(stringType(), column5),
5788
6165
  indexes: recordType(stringType(), stringType()),
5789
6166
  foreignKeys: recordType(stringType(), stringType()),
5790
6167
  compositePrimaryKeys: recordType(stringType(), stringType()),
@@ -5794,8 +6171,8 @@ var tableSquashed4 = objectType({
5794
6171
  var schemaSquashed3 = objectType({
5795
6172
  version: latestVersion,
5796
6173
  dialect: dialect3,
5797
- tables: recordType(stringType(), tableSquashed4),
5798
- views: recordType(stringType(), view3),
6174
+ tables: recordType(stringType(), tableSquashed5),
6175
+ views: recordType(stringType(), view4),
5799
6176
  enums: anyType()
5800
6177
  }).strict();
5801
6178
  var drySQLite = schema3.parse({
@@ -5822,8 +6199,7 @@ var objectValues = (obj) => {
5822
6199
  return Object.values(obj);
5823
6200
  };
5824
6201
  var assertV1OutFolder = (out) => {
5825
- if (!(0, import_fs.existsSync)(out))
5826
- return;
6202
+ if (!(0, import_fs.existsSync)(out)) return;
5827
6203
  const oldMigrationFolders = (0, import_fs.readdirSync)(out).filter(
5828
6204
  (it) => it.length === 14 && /^\d+$/.test(it)
5829
6205
  );
@@ -5867,6 +6243,8 @@ var validatorForDialect = (dialect4) => {
5867
6243
  return { validator: backwardCompatibleMysqlSchema, version: 5 };
5868
6244
  case "singlestore":
5869
6245
  return { validator: backwardCompatibleSingleStoreSchema, version: 1 };
6246
+ case "gel":
6247
+ return { validator: backwardCompatibleGelSchema, version: 1 };
5870
6248
  }
5871
6249
  };
5872
6250
  var validateWithReport = (snapshots, dialect4) => {
@@ -5976,8 +6354,8 @@ var tableRenameKey = (it) => {
5976
6354
  const out = it.schema ? `"${it.schema}"."${it.name}"` : `"${it.name}"`;
5977
6355
  return out;
5978
6356
  };
5979
- var columnRenameKey = (table5, schema4, column5) => {
5980
- const out = schema4 ? `"${schema4}"."${table5}"."${column5}"` : `"${table5}"."${column5}"`;
6357
+ var columnRenameKey = (table6, schema4, column6) => {
6358
+ const out = schema4 ? `"${schema4}"."${table6}"."${column6}"` : `"${table6}"."${column6}"`;
5981
6359
  return out;
5982
6360
  };
5983
6361
  var kloudMeta = () => {
@@ -6033,6 +6411,9 @@ function unescapeSingleQuotes(str, ignoreFirstAndLastChar) {
6033
6411
  const regex = ignoreFirstAndLastChar ? /(?<!^)'(?!$)/g : /'/g;
6034
6412
  return str.replace(/''/g, "'").replace(regex, "\\'");
6035
6413
  }
6414
+ var stripTrailingCast = (value) => {
6415
+ return value.replace(/::(?:"[^"]+"|[\w ]+)(?:\(\d+(?:,\s*\d+)?\))?(?:\[\])*$/, "");
6416
+ };
6036
6417
  // Annotate the CommonJS export names for ESM import in node:
6037
6418
  0 && (module.exports = {
6038
6419
  assertV1OutFolder,
@@ -6050,6 +6431,7 @@ function unescapeSingleQuotes(str, ignoreFirstAndLastChar) {
6050
6431
  prepareMigrationMeta,
6051
6432
  prepareOutFolder,
6052
6433
  schemaRenameKey,
6434
+ stripTrailingCast,
6053
6435
  tableRenameKey,
6054
6436
  unescapeSingleQuotes,
6055
6437
  validateWithReport