drizzle-kit 1.0.0-beta.1-2cd01ec → 1.0.0-beta.1-bc61bbe

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/bin.cjs CHANGED
@@ -658,9 +658,9 @@ var require_main = __commonJS({
658
658
  const attrs = _instructions(result, key);
659
659
  decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);
660
660
  break;
661
- } catch (error2) {
661
+ } catch (error3) {
662
662
  if (i4 + 1 >= length) {
663
- throw error2;
663
+ throw error3;
664
664
  }
665
665
  }
666
666
  }
@@ -685,13 +685,13 @@ var require_main = __commonJS({
685
685
  let uri;
686
686
  try {
687
687
  uri = new URL(dotenvKey);
688
- } catch (error2) {
689
- if (error2.code === "ERR_INVALID_URL") {
688
+ } catch (error3) {
689
+ if (error3.code === "ERR_INVALID_URL") {
690
690
  const err2 = new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");
691
691
  err2.code = "INVALID_DOTENV_KEY";
692
692
  throw err2;
693
693
  }
694
- throw error2;
694
+ throw error3;
695
695
  }
696
696
  const key = uri.password;
697
697
  if (!key) {
@@ -817,10 +817,10 @@ var require_main = __commonJS({
817
817
  const aesgcm = crypto7.createDecipheriv("aes-256-gcm", key, nonce);
818
818
  aesgcm.setAuthTag(authTag);
819
819
  return `${aesgcm.update(ciphertext)}${aesgcm.final()}`;
820
- } catch (error2) {
821
- const isRange = error2 instanceof RangeError;
822
- const invalidKeyLength = error2.message === "Invalid key length";
823
- const decryptionFailed = error2.message === "Unsupported state or unable to authenticate data";
820
+ } catch (error3) {
821
+ const isRange = error3 instanceof RangeError;
822
+ const invalidKeyLength = error3.message === "Invalid key length";
823
+ const decryptionFailed = error3.message === "Unsupported state or unable to authenticate data";
824
824
  if (isRange || invalidKeyLength) {
825
825
  const err2 = new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");
826
826
  err2.code = "INVALID_DOTENV_KEY";
@@ -830,7 +830,7 @@ var require_main = __commonJS({
830
830
  err2.code = "DECRYPTION_FAILED";
831
831
  throw err2;
832
832
  } else {
833
- throw error2;
833
+ throw error3;
834
834
  }
835
835
  }
836
836
  }
@@ -1634,8 +1634,8 @@ var init_ZodError = __esm({
1634
1634
  return issue.message;
1635
1635
  };
1636
1636
  const fieldErrors = { _errors: [] };
1637
- const processError = (error2) => {
1638
- for (const issue of error2.issues) {
1637
+ const processError = (error3) => {
1638
+ for (const issue of error3.issues) {
1639
1639
  if (issue.code === "invalid_union") {
1640
1640
  issue.unionErrors.map(processError);
1641
1641
  } else if (issue.code === "invalid_return_type") {
@@ -1697,8 +1697,8 @@ var init_ZodError = __esm({
1697
1697
  }
1698
1698
  };
1699
1699
  ZodError.create = (issues) => {
1700
- const error2 = new ZodError(issues);
1701
- return error2;
1700
+ const error3 = new ZodError(issues);
1701
+ return error3;
1702
1702
  };
1703
1703
  }
1704
1704
  });
@@ -2200,8 +2200,8 @@ var init_types = __esm({
2200
2200
  get error() {
2201
2201
  if (this._error)
2202
2202
  return this._error;
2203
- const error2 = new ZodError(ctx.common.issues);
2204
- this._error = error2;
2203
+ const error3 = new ZodError(ctx.common.issues);
2204
+ this._error = error3;
2205
2205
  return this._error;
2206
2206
  }
2207
2207
  };
@@ -4700,25 +4700,25 @@ var init_types = __esm({
4700
4700
  });
4701
4701
  return INVALID;
4702
4702
  }
4703
- function makeArgsIssue(args, error2) {
4703
+ function makeArgsIssue(args, error3) {
4704
4704
  return makeIssue({
4705
4705
  data: args,
4706
4706
  path: ctx.path,
4707
4707
  errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x4) => !!x4),
4708
4708
  issueData: {
4709
4709
  code: ZodIssueCode.invalid_arguments,
4710
- argumentsError: error2
4710
+ argumentsError: error3
4711
4711
  }
4712
4712
  });
4713
4713
  }
4714
- function makeReturnsIssue(returns, error2) {
4714
+ function makeReturnsIssue(returns, error3) {
4715
4715
  return makeIssue({
4716
4716
  data: returns,
4717
4717
  path: ctx.path,
4718
4718
  errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x4) => !!x4),
4719
4719
  issueData: {
4720
4720
  code: ZodIssueCode.invalid_return_type,
4721
- returnTypeError: error2
4721
+ returnTypeError: error3
4722
4722
  }
4723
4723
  });
4724
4724
  }
@@ -4727,15 +4727,15 @@ var init_types = __esm({
4727
4727
  if (this._def.returns instanceof ZodPromise) {
4728
4728
  const me = this;
4729
4729
  return OK(async function(...args) {
4730
- const error2 = new ZodError([]);
4730
+ const error3 = new ZodError([]);
4731
4731
  const parsedArgs = await me._def.args.parseAsync(args, params).catch((e4) => {
4732
- error2.addIssue(makeArgsIssue(args, e4));
4733
- throw error2;
4732
+ error3.addIssue(makeArgsIssue(args, e4));
4733
+ throw error3;
4734
4734
  });
4735
4735
  const result = await Reflect.apply(fn, this, parsedArgs);
4736
4736
  const parsedReturns = await me._def.returns._def.type.parseAsync(result, params).catch((e4) => {
4737
- error2.addIssue(makeReturnsIssue(result, e4));
4738
- throw error2;
4737
+ error3.addIssue(makeReturnsIssue(result, e4));
4738
+ throw error3;
4739
4739
  });
4740
4740
  return parsedReturns;
4741
4741
  });
@@ -7362,8 +7362,8 @@ var init_views = __esm({
7362
7362
  grey = (msg) => {
7363
7363
  return source_default.grey(msg);
7364
7364
  };
7365
- error = (error2, greyMsg = "") => {
7366
- return `${source_default.bgRed.bold(" Error ")} ${error2} ${greyMsg ? source_default.grey(greyMsg) : ""}`.trim();
7365
+ error = (error3, greyMsg = "") => {
7366
+ return `${source_default.bgRed.bold(" Error ")} ${error3} ${greyMsg ? source_default.grey(greyMsg) : ""}`.trim();
7367
7367
  };
7368
7368
  schema4 = (schema6) => {
7369
7369
  const tables = Object.values(schema6.tables);
@@ -8271,7 +8271,7 @@ var init_utils2 = __esm({
8271
8271
  return `file:${it}`;
8272
8272
  }
8273
8273
  }
8274
- if (type === "better-sqlite") {
8274
+ if (type === "better-sqlite" || type === "@tursodatabase/database" || type === "bun") {
8275
8275
  if (it.startsWith("file:")) {
8276
8276
  return it.substring(5);
8277
8277
  }
@@ -9800,10 +9800,10 @@ var require_sync = __commonJS({
9800
9800
  var abs = this._makeAbs(f5);
9801
9801
  this.cache[abs] = "FILE";
9802
9802
  if (abs === this.cwdAbs) {
9803
- var error2 = new Error(er.code + " invalid cwd " + this.cwd);
9804
- error2.path = this.cwd;
9805
- error2.code = er.code;
9806
- throw error2;
9803
+ var error3 = new Error(er.code + " invalid cwd " + this.cwd);
9804
+ error3.path = this.cwd;
9805
+ error3.code = er.code;
9806
+ throw error3;
9807
9807
  }
9808
9808
  break;
9809
9809
  case "ENOENT":
@@ -10450,10 +10450,10 @@ var require_glob = __commonJS({
10450
10450
  var abs = this._makeAbs(f5);
10451
10451
  this.cache[abs] = "FILE";
10452
10452
  if (abs === this.cwdAbs) {
10453
- var error2 = new Error(er.code + " invalid cwd " + this.cwd);
10454
- error2.path = this.cwd;
10455
- error2.code = er.code;
10456
- this.emit("error", error2);
10453
+ var error3 = new Error(er.code + " invalid cwd " + this.cwd);
10454
+ error3.path = this.cwd;
10455
+ error3.code = er.code;
10456
+ this.emit("error", error3);
10457
10457
  this.abort();
10458
10458
  }
10459
10459
  break;
@@ -10707,7 +10707,7 @@ var init_common = __esm({
10707
10707
  init_schemaValidator();
10708
10708
  init_outputs();
10709
10709
  assertCollisions = (command, options, whitelist, remainingKeys) => {
10710
- const { config, ...rest } = options;
10710
+ const { config, init: init2, ...rest } = options;
10711
10711
  let atLeastOneParam = false;
10712
10712
  for (const key of Object.keys(rest)) {
10713
10713
  if (whitelist.includes(key)) continue;
@@ -10725,7 +10725,8 @@ var init_common = __esm({
10725
10725
  sqliteDriversLiterals = [
10726
10726
  literalType("d1-http"),
10727
10727
  literalType("expo"),
10728
- literalType("durable-sqlite")
10728
+ literalType("durable-sqlite"),
10729
+ literalType("sqlite-cloud")
10729
10730
  ];
10730
10731
  postgresqlDriversLiterals = [
10731
10732
  literalType("aws-data-api"),
@@ -10803,7 +10804,7 @@ var init_common = __esm({
10803
10804
  strict: booleanType().default(false),
10804
10805
  out: stringType().optional()
10805
10806
  });
10806
- drivers = ["d1-http", "expo", "aws-data-api", "pglite", "durable-sqlite"];
10807
+ drivers = ["d1-http", "expo", "aws-data-api", "pglite", "durable-sqlite", "sqlite-cloud"];
10807
10808
  wrapParam = (name, param, optional = false, type) => {
10808
10809
  const check2 = `[${source_default.green("\u2713")}]`;
10809
10810
  const cross = `[${source_default.red("x")}]`;
@@ -10870,9 +10871,7 @@ var init_cli = __esm({
10870
10871
  extensionsFilters: literalType("postgis").array().optional(),
10871
10872
  casing,
10872
10873
  breakpoints: booleanType().optional().default(true),
10873
- migrations: objectType({
10874
- prefix: prefix.optional().default("index")
10875
- }).optional(),
10874
+ migrations: configMigrations,
10876
10875
  entities: objectType({
10877
10876
  roles: booleanType().or(objectType({
10878
10877
  provider: stringType().optional(),
@@ -11210,6 +11209,10 @@ var init_sqlite = __esm({
11210
11209
  databaseId: stringType().min(1),
11211
11210
  token: stringType().min(1)
11212
11211
  }),
11212
+ objectType({
11213
+ driver: literalType("sqlite-cloud"),
11214
+ url: stringType().min(1)
11215
+ }),
11213
11216
  objectType({
11214
11217
  driver: undefinedType(),
11215
11218
  url: stringType().min(1)
@@ -11271,6 +11274,12 @@ var init_sqlite = __esm({
11271
11274
  console.log(error("Unexpected error with SQLite Durable Object driver \u{1F914}"));
11272
11275
  }
11273
11276
  process.exit(1);
11277
+ } else if (driver2 === "sqlite-cloud") {
11278
+ let text2 = `Please provide required params for SQLite Cloud driver:
11279
+ `;
11280
+ console.log(error(text2));
11281
+ console.log(wrapParam("url", options.url));
11282
+ process.exit(1);
11274
11283
  } else {
11275
11284
  softAssertUnreachable(driver2);
11276
11285
  }
@@ -11757,14 +11766,14 @@ var require_browser = __commonJS({
11757
11766
  } else {
11758
11767
  exports2.storage.removeItem("debug");
11759
11768
  }
11760
- } catch (error2) {
11769
+ } catch (error3) {
11761
11770
  }
11762
11771
  }
11763
11772
  function load() {
11764
11773
  let r4;
11765
11774
  try {
11766
11775
  r4 = exports2.storage.getItem("debug") || exports2.storage.getItem("DEBUG");
11767
- } catch (error2) {
11776
+ } catch (error3) {
11768
11777
  }
11769
11778
  if (!r4 && typeof process !== "undefined" && "env" in process) {
11770
11779
  r4 = process.env.DEBUG;
@@ -11774,7 +11783,7 @@ var require_browser = __commonJS({
11774
11783
  function localstorage() {
11775
11784
  try {
11776
11785
  return localStorage;
11777
- } catch (error2) {
11786
+ } catch (error3) {
11778
11787
  }
11779
11788
  }
11780
11789
  module2.exports = require_common2()(exports2);
@@ -11782,8 +11791,8 @@ var require_browser = __commonJS({
11782
11791
  formatters.j = function(v6) {
11783
11792
  try {
11784
11793
  return JSON.stringify(v6);
11785
- } catch (error2) {
11786
- return "[UnexpectedJSONParseError]: " + error2.message;
11794
+ } catch (error3) {
11795
+ return "[UnexpectedJSONParseError]: " + error3.message;
11787
11796
  }
11788
11797
  };
11789
11798
  }
@@ -12015,7 +12024,7 @@ var require_node = __commonJS({
12015
12024
  221
12016
12025
  ];
12017
12026
  }
12018
- } catch (error2) {
12027
+ } catch (error3) {
12019
12028
  }
12020
12029
  exports2.inspectOpts = Object.keys(process.env).filter((key) => {
12021
12030
  return /^debug_/i.test(key);
@@ -14139,13 +14148,13 @@ var require_node2 = __commonJS({
14139
14148
  }
14140
14149
  return frame;
14141
14150
  }
14142
- function prepareStackTrace(error2, stack) {
14151
+ function prepareStackTrace(error3, stack) {
14143
14152
  if (emptyCacheBetweenOperations) {
14144
14153
  fileContentsCache = {};
14145
14154
  sourceMapCache = {};
14146
14155
  }
14147
- var name = error2.name || "Error";
14148
- var message = error2.message || "";
14156
+ var name = error3.name || "Error";
14157
+ var message = error3.message || "";
14149
14158
  var errorString = name + ": " + message;
14150
14159
  var state2 = { nextPosition: null, curPosition: null };
14151
14160
  var processedStack = [];
@@ -14156,8 +14165,8 @@ var require_node2 = __commonJS({
14156
14165
  state2.curPosition = state2.nextPosition = null;
14157
14166
  return errorString + processedStack.reverse().join("");
14158
14167
  }
14159
- function getErrorSource(error2) {
14160
- var match2 = /\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(error2.stack);
14168
+ function getErrorSource(error3) {
14169
+ var match2 = /\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(error3.stack);
14161
14170
  if (match2) {
14162
14171
  var source = match2[1];
14163
14172
  var line = +match2[2];
@@ -14179,8 +14188,8 @@ var require_node2 = __commonJS({
14179
14188
  }
14180
14189
  return null;
14181
14190
  }
14182
- function printErrorAndExit(error2) {
14183
- var source = getErrorSource(error2);
14191
+ function printErrorAndExit(error3) {
14192
+ var source = getErrorSource(error3);
14184
14193
  if (process.stderr._handle && process.stderr._handle.setBlocking) {
14185
14194
  process.stderr._handle.setBlocking(true);
14186
14195
  }
@@ -14188,7 +14197,7 @@ var require_node2 = __commonJS({
14188
14197
  console.error();
14189
14198
  console.error(source);
14190
14199
  }
14191
- console.error(error2.stack);
14200
+ console.error(error3.stack);
14192
14201
  process.exit(1);
14193
14202
  }
14194
14203
  function shimEmitUncaughtException() {
@@ -14370,8 +14379,8 @@ var require_node2 = __commonJS({
14370
14379
  try {
14371
14380
  var info2 = gen[key](arg);
14372
14381
  var value = info2.value;
14373
- } catch (error2) {
14374
- reject(error2);
14382
+ } catch (error3) {
14383
+ reject(error3);
14375
14384
  return;
14376
14385
  }
14377
14386
  if (info2.done) {
@@ -16864,9 +16873,9 @@ var require_node2 = __commonJS({
16864
16873
  extensions[".js"] = function(module22, filename) {
16865
16874
  try {
16866
16875
  return jsHandler.call(this, module22, filename);
16867
- } catch (error2) {
16868
- if (error2.code !== "ERR_REQUIRE_ESM") {
16869
- throw error2;
16876
+ } catch (error3) {
16877
+ if (error3.code !== "ERR_REQUIRE_ESM") {
16878
+ throw error3;
16870
16879
  }
16871
16880
  let content = _fs3.default.readFileSync(filename, "utf8");
16872
16881
  content = compile(content, filename, "cjs");
@@ -17247,6 +17256,7 @@ var init_utils3 = __esm({
17247
17256
  }
17248
17257
  const config = parsed.data;
17249
17258
  const dialect6 = config.dialect;
17259
+ const { schema: schema6, table: table6 } = parsed.data.migrations || {};
17250
17260
  const tablesFilterConfig = config.tablesFilter;
17251
17261
  const tablesFilter = tablesFilterConfig ? typeof tablesFilterConfig === "string" ? [tablesFilterConfig] : tablesFilterConfig : [];
17252
17262
  if (config.extensionsFilters) {
@@ -17273,7 +17283,10 @@ var init_utils3 = __esm({
17273
17283
  tablesFilter,
17274
17284
  schemasFilter,
17275
17285
  prefix: ((_a2 = config.migrations) == null ? void 0 : _a2.prefix) || "index",
17276
- entities: config.entities
17286
+ entities: config.entities,
17287
+ init: !!options.init,
17288
+ migrationsSchema: schema6,
17289
+ migrationsTable: table6
17277
17290
  };
17278
17291
  }
17279
17292
  if (dialect6 === "mysql") {
@@ -17291,7 +17304,10 @@ var init_utils3 = __esm({
17291
17304
  tablesFilter,
17292
17305
  schemasFilter,
17293
17306
  prefix: ((_b = config.migrations) == null ? void 0 : _b.prefix) || "index",
17294
- entities: config.entities
17307
+ entities: config.entities,
17308
+ init: !!options.init,
17309
+ migrationsSchema: schema6,
17310
+ migrationsTable: table6
17295
17311
  };
17296
17312
  }
17297
17313
  if (dialect6 === "singlestore") {
@@ -17309,7 +17325,10 @@ var init_utils3 = __esm({
17309
17325
  tablesFilter,
17310
17326
  schemasFilter,
17311
17327
  prefix: ((_c = config.migrations) == null ? void 0 : _c.prefix) || "index",
17312
- entities: config.entities
17328
+ entities: config.entities,
17329
+ init: !!options.init,
17330
+ migrationsSchema: schema6,
17331
+ migrationsTable: table6
17313
17332
  };
17314
17333
  }
17315
17334
  if (dialect6 === "sqlite") {
@@ -17327,7 +17346,10 @@ var init_utils3 = __esm({
17327
17346
  tablesFilter,
17328
17347
  schemasFilter,
17329
17348
  prefix: ((_d = config.migrations) == null ? void 0 : _d.prefix) || "index",
17330
- entities: config.entities
17349
+ entities: config.entities,
17350
+ init: !!options.init,
17351
+ migrationsSchema: schema6,
17352
+ migrationsTable: table6
17331
17353
  };
17332
17354
  }
17333
17355
  if (dialect6 === "turso") {
@@ -17345,7 +17367,10 @@ var init_utils3 = __esm({
17345
17367
  tablesFilter,
17346
17368
  schemasFilter,
17347
17369
  prefix: ((_e = config.migrations) == null ? void 0 : _e.prefix) || "index",
17348
- entities: config.entities
17370
+ entities: config.entities,
17371
+ init: !!options.init,
17372
+ migrationsSchema: schema6,
17373
+ migrationsTable: table6
17349
17374
  };
17350
17375
  }
17351
17376
  if (dialect6 === "gel") {
@@ -17363,7 +17388,10 @@ var init_utils3 = __esm({
17363
17388
  tablesFilter,
17364
17389
  schemasFilter,
17365
17390
  prefix: ((_f = config.migrations) == null ? void 0 : _f.prefix) || "index",
17366
- entities: config.entities
17391
+ entities: config.entities,
17392
+ init: !!options.init,
17393
+ migrationsSchema: schema6,
17394
+ migrationsTable: table6
17367
17395
  };
17368
17396
  }
17369
17397
  assertUnreachable(dialect6);
@@ -34041,31 +34069,26 @@ var init_migrate = __esm({
34041
34069
  return { sqlStatements, statements, squashedPrev, squashedCur };
34042
34070
  };
34043
34071
  prepareMySQLPush = async (schemaPath, snapshot, casing2) => {
34044
- try {
34045
- const { prev, cur } = await prepareMySqlDbPushSnapshot(
34046
- snapshot,
34047
- schemaPath,
34048
- casing2
34049
- );
34050
- const validatedPrev = mysqlSchema.parse(prev);
34051
- const validatedCur = mysqlSchema.parse(cur);
34052
- const squashedPrev = squashMysqlScheme(validatedPrev);
34053
- const squashedCur = squashMysqlScheme(validatedCur);
34054
- const { sqlStatements, statements } = await applyMysqlSnapshotsDiff(
34055
- squashedPrev,
34056
- squashedCur,
34057
- tablesResolver,
34058
- columnsResolver,
34059
- mySqlViewsResolver,
34060
- validatedPrev,
34061
- validatedCur,
34062
- "push"
34063
- );
34064
- return { sqlStatements, statements, validatedCur, validatedPrev };
34065
- } catch (e4) {
34066
- console.error(e4);
34067
- process.exit(1);
34068
- }
34072
+ const { prev, cur } = await prepareMySqlDbPushSnapshot(
34073
+ snapshot,
34074
+ schemaPath,
34075
+ casing2
34076
+ );
34077
+ const validatedPrev = mysqlSchema.parse(prev);
34078
+ const validatedCur = mysqlSchema.parse(cur);
34079
+ const squashedPrev = squashMysqlScheme(validatedPrev);
34080
+ const squashedCur = squashMysqlScheme(validatedCur);
34081
+ const { sqlStatements, statements } = await applyMysqlSnapshotsDiff(
34082
+ squashedPrev,
34083
+ squashedCur,
34084
+ tablesResolver,
34085
+ columnsResolver,
34086
+ mySqlViewsResolver,
34087
+ validatedPrev,
34088
+ validatedCur,
34089
+ "push"
34090
+ );
34091
+ return { sqlStatements, statements, validatedCur, validatedPrev };
34069
34092
  };
34070
34093
  prepareAndMigrateMysql = async (config) => {
34071
34094
  const outFolder = config.out;
@@ -34120,31 +34143,26 @@ var init_migrate = __esm({
34120
34143
  }
34121
34144
  };
34122
34145
  prepareSingleStorePush = async (schemaPath, snapshot, casing2) => {
34123
- try {
34124
- const { prev, cur } = await prepareSingleStoreDbPushSnapshot(
34125
- snapshot,
34126
- schemaPath,
34127
- casing2
34128
- );
34129
- const validatedPrev = singlestoreSchema.parse(prev);
34130
- const validatedCur = singlestoreSchema.parse(cur);
34131
- const squashedPrev = squashSingleStoreScheme(validatedPrev);
34132
- const squashedCur = squashSingleStoreScheme(validatedCur);
34133
- const { sqlStatements, statements } = await applySingleStoreSnapshotsDiff(
34134
- squashedPrev,
34135
- squashedCur,
34136
- tablesResolver,
34137
- columnsResolver,
34138
- /* singleStoreViewsResolver, */
34139
- validatedPrev,
34140
- validatedCur,
34141
- "push"
34142
- );
34143
- return { sqlStatements, statements, validatedCur, validatedPrev };
34144
- } catch (e4) {
34145
- console.error(e4);
34146
- process.exit(1);
34147
- }
34146
+ const { prev, cur } = await prepareSingleStoreDbPushSnapshot(
34147
+ snapshot,
34148
+ schemaPath,
34149
+ casing2
34150
+ );
34151
+ const validatedPrev = singlestoreSchema.parse(prev);
34152
+ const validatedCur = singlestoreSchema.parse(cur);
34153
+ const squashedPrev = squashSingleStoreScheme(validatedPrev);
34154
+ const squashedCur = squashSingleStoreScheme(validatedCur);
34155
+ const { sqlStatements, statements } = await applySingleStoreSnapshotsDiff(
34156
+ squashedPrev,
34157
+ squashedCur,
34158
+ tablesResolver,
34159
+ columnsResolver,
34160
+ /* singleStoreViewsResolver, */
34161
+ validatedPrev,
34162
+ validatedCur,
34163
+ "push"
34164
+ );
34165
+ return { sqlStatements, statements, validatedCur, validatedPrev };
34148
34166
  };
34149
34167
  prepareAndMigrateSingleStore = async (config) => {
34150
34168
  const outFolder = config.out;
@@ -38650,10 +38668,10 @@ var require_ponyfill_es2018 = __commonJS({
38650
38668
  });
38651
38669
  return promise;
38652
38670
  }
38653
- function WritableStreamDealWithRejection(stream, error2) {
38671
+ function WritableStreamDealWithRejection(stream, error3) {
38654
38672
  const state2 = stream._state;
38655
38673
  if (state2 === "writable") {
38656
- WritableStreamStartErroring(stream, error2);
38674
+ WritableStreamStartErroring(stream, error3);
38657
38675
  return;
38658
38676
  }
38659
38677
  WritableStreamFinishErroring(stream);
@@ -38704,10 +38722,10 @@ var require_ponyfill_es2018 = __commonJS({
38704
38722
  stream._inFlightWriteRequest._resolve(void 0);
38705
38723
  stream._inFlightWriteRequest = void 0;
38706
38724
  }
38707
- function WritableStreamFinishInFlightWriteWithError(stream, error2) {
38708
- stream._inFlightWriteRequest._reject(error2);
38725
+ function WritableStreamFinishInFlightWriteWithError(stream, error3) {
38726
+ stream._inFlightWriteRequest._reject(error3);
38709
38727
  stream._inFlightWriteRequest = void 0;
38710
- WritableStreamDealWithRejection(stream, error2);
38728
+ WritableStreamDealWithRejection(stream, error3);
38711
38729
  }
38712
38730
  function WritableStreamFinishInFlightClose(stream) {
38713
38731
  stream._inFlightCloseRequest._resolve(void 0);
@@ -38726,14 +38744,14 @@ var require_ponyfill_es2018 = __commonJS({
38726
38744
  defaultWriterClosedPromiseResolve(writer);
38727
38745
  }
38728
38746
  }
38729
- function WritableStreamFinishInFlightCloseWithError(stream, error2) {
38730
- stream._inFlightCloseRequest._reject(error2);
38747
+ function WritableStreamFinishInFlightCloseWithError(stream, error3) {
38748
+ stream._inFlightCloseRequest._reject(error3);
38731
38749
  stream._inFlightCloseRequest = void 0;
38732
38750
  if (stream._pendingAbortRequest !== void 0) {
38733
- stream._pendingAbortRequest._reject(error2);
38751
+ stream._pendingAbortRequest._reject(error3);
38734
38752
  stream._pendingAbortRequest = void 0;
38735
38753
  }
38736
- WritableStreamDealWithRejection(stream, error2);
38754
+ WritableStreamDealWithRejection(stream, error3);
38737
38755
  }
38738
38756
  function WritableStreamCloseQueuedOrInFlight(stream) {
38739
38757
  if (stream._closeRequest === void 0 && stream._inFlightCloseRequest === void 0) {
@@ -38950,18 +38968,18 @@ var require_ponyfill_es2018 = __commonJS({
38950
38968
  }
38951
38969
  return WritableStreamDefaultWriterClose(writer);
38952
38970
  }
38953
- function WritableStreamDefaultWriterEnsureClosedPromiseRejected(writer, error2) {
38971
+ function WritableStreamDefaultWriterEnsureClosedPromiseRejected(writer, error3) {
38954
38972
  if (writer._closedPromiseState === "pending") {
38955
- defaultWriterClosedPromiseReject(writer, error2);
38973
+ defaultWriterClosedPromiseReject(writer, error3);
38956
38974
  } else {
38957
- defaultWriterClosedPromiseResetToRejected(writer, error2);
38975
+ defaultWriterClosedPromiseResetToRejected(writer, error3);
38958
38976
  }
38959
38977
  }
38960
- function WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, error2) {
38978
+ function WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, error3) {
38961
38979
  if (writer._readyPromiseState === "pending") {
38962
- defaultWriterReadyPromiseReject(writer, error2);
38980
+ defaultWriterReadyPromiseReject(writer, error3);
38963
38981
  } else {
38964
- defaultWriterReadyPromiseResetToRejected(writer, error2);
38982
+ defaultWriterReadyPromiseResetToRejected(writer, error3);
38965
38983
  }
38966
38984
  }
38967
38985
  function WritableStreamDefaultWriterGetDesiredSize(writer) {
@@ -39196,9 +39214,9 @@ var require_ponyfill_es2018 = __commonJS({
39196
39214
  WritableStreamDefaultControllerProcessWrite(controller, value);
39197
39215
  }
39198
39216
  }
39199
- function WritableStreamDefaultControllerErrorIfNeeded(controller, error2) {
39217
+ function WritableStreamDefaultControllerErrorIfNeeded(controller, error3) {
39200
39218
  if (controller._controlledWritableStream._state === "writable") {
39201
- WritableStreamDefaultControllerError(controller, error2);
39219
+ WritableStreamDefaultControllerError(controller, error3);
39202
39220
  }
39203
39221
  }
39204
39222
  function WritableStreamDefaultControllerProcessClose(controller) {
@@ -39241,10 +39259,10 @@ var require_ponyfill_es2018 = __commonJS({
39241
39259
  const desiredSize = WritableStreamDefaultControllerGetDesiredSize(controller);
39242
39260
  return desiredSize <= 0;
39243
39261
  }
39244
- function WritableStreamDefaultControllerError(controller, error2) {
39262
+ function WritableStreamDefaultControllerError(controller, error3) {
39245
39263
  const stream = controller._controlledWritableStream;
39246
39264
  WritableStreamDefaultControllerClearAlgorithms(controller);
39247
- WritableStreamStartErroring(stream, error2);
39265
+ WritableStreamStartErroring(stream, error3);
39248
39266
  }
39249
39267
  function streamBrandCheckException$2(name) {
39250
39268
  return new TypeError(`WritableStream.prototype.${name} can only be used on a WritableStream`);
@@ -39388,12 +39406,12 @@ var require_ponyfill_es2018 = __commonJS({
39388
39406
  let abortAlgorithm;
39389
39407
  if (signal !== void 0) {
39390
39408
  abortAlgorithm = () => {
39391
- const error2 = signal.reason !== void 0 ? signal.reason : new DOMException2("Aborted", "AbortError");
39409
+ const error3 = signal.reason !== void 0 ? signal.reason : new DOMException2("Aborted", "AbortError");
39392
39410
  const actions = [];
39393
39411
  if (!preventAbort) {
39394
39412
  actions.push(() => {
39395
39413
  if (dest._state === "writable") {
39396
- return WritableStreamAbort(dest, error2);
39414
+ return WritableStreamAbort(dest, error3);
39397
39415
  }
39398
39416
  return promiseResolvedWith(void 0);
39399
39417
  });
@@ -39401,12 +39419,12 @@ var require_ponyfill_es2018 = __commonJS({
39401
39419
  if (!preventCancel) {
39402
39420
  actions.push(() => {
39403
39421
  if (source._state === "readable") {
39404
- return ReadableStreamCancel(source, error2);
39422
+ return ReadableStreamCancel(source, error3);
39405
39423
  }
39406
39424
  return promiseResolvedWith(void 0);
39407
39425
  });
39408
39426
  }
39409
- shutdownWithAction(() => Promise.all(actions.map((action) => action())), true, error2);
39427
+ shutdownWithAction(() => Promise.all(actions.map((action) => action())), true, error3);
39410
39428
  };
39411
39429
  if (signal.aborted) {
39412
39430
  abortAlgorithm();
@@ -39509,25 +39527,25 @@ var require_ponyfill_es2018 = __commonJS({
39509
39527
  return null;
39510
39528
  }
39511
39529
  }
39512
- function shutdown(isError, error2) {
39530
+ function shutdown(isError, error3) {
39513
39531
  if (shuttingDown) {
39514
39532
  return;
39515
39533
  }
39516
39534
  shuttingDown = true;
39517
39535
  if (dest._state === "writable" && !WritableStreamCloseQueuedOrInFlight(dest)) {
39518
- uponFulfillment(waitForWritesToFinish(), () => finalize(isError, error2));
39536
+ uponFulfillment(waitForWritesToFinish(), () => finalize(isError, error3));
39519
39537
  } else {
39520
- finalize(isError, error2);
39538
+ finalize(isError, error3);
39521
39539
  }
39522
39540
  }
39523
- function finalize(isError, error2) {
39541
+ function finalize(isError, error3) {
39524
39542
  WritableStreamDefaultWriterRelease(writer);
39525
39543
  ReadableStreamReaderGenericRelease(reader);
39526
39544
  if (signal !== void 0) {
39527
39545
  signal.removeEventListener("abort", abortAlgorithm);
39528
39546
  }
39529
39547
  if (isError) {
39530
- reject(error2);
39548
+ reject(error3);
39531
39549
  } else {
39532
39550
  resolve2(void 0);
39533
39551
  }
@@ -40922,8 +40940,8 @@ var require_ponyfill_es2018 = __commonJS({
40922
40940
  const stream = controller._controlledTransformStream;
40923
40941
  const readableController = stream._readable._readableStreamController;
40924
40942
  ReadableStreamDefaultControllerClose(readableController);
40925
- const error2 = new TypeError("TransformStream terminated");
40926
- TransformStreamErrorWritableAndUnblockWrite(stream, error2);
40943
+ const error3 = new TypeError("TransformStream terminated");
40944
+ TransformStreamErrorWritableAndUnblockWrite(stream, error3);
40927
40945
  }
40928
40946
  function TransformStreamDefaultSinkWriteAlgorithm(stream, chunk) {
40929
40947
  const controller = stream._transformStreamController;
@@ -41080,11 +41098,11 @@ var require_streams = __commonJS({
41080
41098
  };
41081
41099
  Object.assign(globalThis, require("node:stream/web"));
41082
41100
  process4.emitWarning = emitWarning;
41083
- } catch (error2) {
41101
+ } catch (error3) {
41084
41102
  process4.emitWarning = emitWarning;
41085
- throw error2;
41103
+ throw error3;
41086
41104
  }
41087
- } catch (error2) {
41105
+ } catch (error3) {
41088
41106
  Object.assign(globalThis, require_ponyfill_es2018());
41089
41107
  }
41090
41108
  }
@@ -41108,7 +41126,7 @@ var require_streams = __commonJS({
41108
41126
  });
41109
41127
  };
41110
41128
  }
41111
- } catch (error2) {
41129
+ } catch (error3) {
41112
41130
  }
41113
41131
  }
41114
41132
  });
@@ -41937,15 +41955,15 @@ async function consumeBody(data) {
41937
41955
  try {
41938
41956
  for await (const chunk of body) {
41939
41957
  if (data.size > 0 && accumBytes + chunk.length > data.size) {
41940
- const error2 = new FetchError(`content size at ${data.url} over limit: ${data.size}`, "max-size");
41941
- body.destroy(error2);
41942
- throw error2;
41958
+ const error3 = new FetchError(`content size at ${data.url} over limit: ${data.size}`, "max-size");
41959
+ body.destroy(error3);
41960
+ throw error3;
41943
41961
  }
41944
41962
  accumBytes += chunk.length;
41945
41963
  accum.push(chunk);
41946
41964
  }
41947
- } catch (error2) {
41948
- const error_ = error2 instanceof FetchBaseError ? error2 : new FetchError(`Invalid response body while trying to fetch ${data.url}: ${error2.message}`, "system", error2);
41965
+ } catch (error3) {
41966
+ const error_ = error3 instanceof FetchBaseError ? error3 : new FetchError(`Invalid response body while trying to fetch ${data.url}: ${error3.message}`, "system", error3);
41949
41967
  throw error_;
41950
41968
  }
41951
41969
  if (body.readableEnded === true || body._readableState.ended === true) {
@@ -41954,8 +41972,8 @@ async function consumeBody(data) {
41954
41972
  return import_node_buffer.Buffer.from(accum.join(""));
41955
41973
  }
41956
41974
  return import_node_buffer.Buffer.concat(accum, accumBytes);
41957
- } catch (error2) {
41958
- throw new FetchError(`Could not create Buffer from response body for ${data.url}: ${error2.message}`, "system", error2);
41975
+ } catch (error3) {
41976
+ throw new FetchError(`Could not create Buffer from response body for ${data.url}: ${error3.message}`, "system", error3);
41959
41977
  }
41960
41978
  } else {
41961
41979
  throw new FetchError(`Premature close of server response while trying to fetch ${data.url}`);
@@ -42012,8 +42030,8 @@ var init_body = __esm({
42012
42030
  this.size = size;
42013
42031
  if (body instanceof import_node_stream.default) {
42014
42032
  body.on("error", (error_) => {
42015
- const error2 = error_ instanceof FetchBaseError ? error_ : new FetchError(`Invalid response body while trying to fetch ${this.url}: ${error_.message}`, "system", error_);
42016
- this[INTERNALS].error = error2;
42033
+ const error3 = error_ instanceof FetchBaseError ? error_ : new FetchError(`Invalid response body while trying to fetch ${this.url}: ${error_.message}`, "system", error_);
42034
+ this[INTERNALS].error = error3;
42017
42035
  });
42018
42036
  }
42019
42037
  }
@@ -42200,16 +42218,16 @@ var init_headers = __esm({
42200
42218
  import_node_http = __toESM(require("node:http"), 1);
42201
42219
  validateHeaderName = typeof import_node_http.default.validateHeaderName === "function" ? import_node_http.default.validateHeaderName : (name) => {
42202
42220
  if (!/^[\^`\-\w!#$%&'*+.|~]+$/.test(name)) {
42203
- const error2 = new TypeError(`Header name must be a valid HTTP token [${name}]`);
42204
- Object.defineProperty(error2, "code", { value: "ERR_INVALID_HTTP_TOKEN" });
42205
- throw error2;
42221
+ const error3 = new TypeError(`Header name must be a valid HTTP token [${name}]`);
42222
+ Object.defineProperty(error3, "code", { value: "ERR_INVALID_HTTP_TOKEN" });
42223
+ throw error3;
42206
42224
  }
42207
42225
  };
42208
42226
  validateHeaderValue = typeof import_node_http.default.validateHeaderValue === "function" ? import_node_http.default.validateHeaderValue : (name, value) => {
42209
42227
  if (/[^\t\u0020-\u007E\u0080-\u00FF]/.test(value)) {
42210
- const error2 = new TypeError(`Invalid character in header content ["${name}"]`);
42211
- Object.defineProperty(error2, "code", { value: "ERR_INVALID_CHAR" });
42212
- throw error2;
42228
+ const error3 = new TypeError(`Invalid character in header content ["${name}"]`);
42229
+ Object.defineProperty(error3, "code", { value: "ERR_INVALID_CHAR" });
42230
+ throw error3;
42213
42231
  }
42214
42232
  };
42215
42233
  Headers2 = class _Headers extends URLSearchParams {
@@ -42898,15 +42916,15 @@ async function fetch2(url, options_) {
42898
42916
  const { signal } = request;
42899
42917
  let response = null;
42900
42918
  const abort = () => {
42901
- const error2 = new AbortError("The operation was aborted.");
42902
- reject(error2);
42919
+ const error3 = new AbortError("The operation was aborted.");
42920
+ reject(error3);
42903
42921
  if (request.body && request.body instanceof import_node_stream2.default.Readable) {
42904
- request.body.destroy(error2);
42922
+ request.body.destroy(error3);
42905
42923
  }
42906
42924
  if (!response || !response.body) {
42907
42925
  return;
42908
42926
  }
42909
- response.body.emit("error", error2);
42927
+ response.body.emit("error", error3);
42910
42928
  };
42911
42929
  if (signal && signal.aborted) {
42912
42930
  abort();
@@ -42926,13 +42944,13 @@ async function fetch2(url, options_) {
42926
42944
  signal.removeEventListener("abort", abortAndFinalize);
42927
42945
  }
42928
42946
  };
42929
- request_.on("error", (error2) => {
42930
- reject(new FetchError(`request to ${request.url} failed, reason: ${error2.message}`, "system", error2));
42947
+ request_.on("error", (error3) => {
42948
+ reject(new FetchError(`request to ${request.url} failed, reason: ${error3.message}`, "system", error3));
42931
42949
  finalize();
42932
42950
  });
42933
- fixResponseChunkedTransferBadEnding(request_, (error2) => {
42951
+ fixResponseChunkedTransferBadEnding(request_, (error3) => {
42934
42952
  if (response && response.body) {
42935
- response.body.destroy(error2);
42953
+ response.body.destroy(error3);
42936
42954
  }
42937
42955
  });
42938
42956
  if (process.version < "v14") {
@@ -42943,9 +42961,9 @@ async function fetch2(url, options_) {
42943
42961
  });
42944
42962
  s4.prependListener("close", (hadError) => {
42945
42963
  if (response && endedWithEventsCount < s4._eventsCount && !hadError) {
42946
- const error2 = new Error("Premature close");
42947
- error2.code = "ERR_STREAM_PREMATURE_CLOSE";
42948
- response.body.emit("error", error2);
42964
+ const error3 = new Error("Premature close");
42965
+ error3.code = "ERR_STREAM_PREMATURE_CLOSE";
42966
+ response.body.emit("error", error3);
42949
42967
  }
42950
42968
  });
42951
42969
  });
@@ -43026,9 +43044,9 @@ async function fetch2(url, options_) {
43026
43044
  signal.removeEventListener("abort", abortAndFinalize);
43027
43045
  });
43028
43046
  }
43029
- let body = (0, import_node_stream2.pipeline)(response_, new import_node_stream2.PassThrough(), (error2) => {
43030
- if (error2) {
43031
- reject(error2);
43047
+ let body = (0, import_node_stream2.pipeline)(response_, new import_node_stream2.PassThrough(), (error3) => {
43048
+ if (error3) {
43049
+ reject(error3);
43032
43050
  }
43033
43051
  });
43034
43052
  if (process.version < "v12.10") {
@@ -43054,9 +43072,9 @@ async function fetch2(url, options_) {
43054
43072
  finishFlush: import_node_zlib.default.Z_SYNC_FLUSH
43055
43073
  };
43056
43074
  if (codings === "gzip" || codings === "x-gzip") {
43057
- body = (0, import_node_stream2.pipeline)(body, import_node_zlib.default.createGunzip(zlibOptions), (error2) => {
43058
- if (error2) {
43059
- reject(error2);
43075
+ body = (0, import_node_stream2.pipeline)(body, import_node_zlib.default.createGunzip(zlibOptions), (error3) => {
43076
+ if (error3) {
43077
+ reject(error3);
43060
43078
  }
43061
43079
  });
43062
43080
  response = new Response2(body, responseOptions);
@@ -43064,22 +43082,22 @@ async function fetch2(url, options_) {
43064
43082
  return;
43065
43083
  }
43066
43084
  if (codings === "deflate" || codings === "x-deflate") {
43067
- const raw2 = (0, import_node_stream2.pipeline)(response_, new import_node_stream2.PassThrough(), (error2) => {
43068
- if (error2) {
43069
- reject(error2);
43085
+ const raw2 = (0, import_node_stream2.pipeline)(response_, new import_node_stream2.PassThrough(), (error3) => {
43086
+ if (error3) {
43087
+ reject(error3);
43070
43088
  }
43071
43089
  });
43072
43090
  raw2.once("data", (chunk) => {
43073
43091
  if ((chunk[0] & 15) === 8) {
43074
- body = (0, import_node_stream2.pipeline)(body, import_node_zlib.default.createInflate(), (error2) => {
43075
- if (error2) {
43076
- reject(error2);
43092
+ body = (0, import_node_stream2.pipeline)(body, import_node_zlib.default.createInflate(), (error3) => {
43093
+ if (error3) {
43094
+ reject(error3);
43077
43095
  }
43078
43096
  });
43079
43097
  } else {
43080
- body = (0, import_node_stream2.pipeline)(body, import_node_zlib.default.createInflateRaw(), (error2) => {
43081
- if (error2) {
43082
- reject(error2);
43098
+ body = (0, import_node_stream2.pipeline)(body, import_node_zlib.default.createInflateRaw(), (error3) => {
43099
+ if (error3) {
43100
+ reject(error3);
43083
43101
  }
43084
43102
  });
43085
43103
  }
@@ -43095,9 +43113,9 @@ async function fetch2(url, options_) {
43095
43113
  return;
43096
43114
  }
43097
43115
  if (codings === "br") {
43098
- body = (0, import_node_stream2.pipeline)(body, import_node_zlib.default.createBrotliDecompress(), (error2) => {
43099
- if (error2) {
43100
- reject(error2);
43116
+ body = (0, import_node_stream2.pipeline)(body, import_node_zlib.default.createBrotliDecompress(), (error3) => {
43117
+ if (error3) {
43118
+ reject(error3);
43101
43119
  }
43102
43120
  });
43103
43121
  response = new Response2(body, responseOptions);
@@ -43122,9 +43140,9 @@ function fixResponseChunkedTransferBadEnding(request, errorCallback) {
43122
43140
  request.on("socket", (socket) => {
43123
43141
  const onSocketClose = () => {
43124
43142
  if (isChunkedTransfer && !properLastChunkReceived) {
43125
- const error2 = new Error("Premature close");
43126
- error2.code = "ERR_STREAM_PREMATURE_CLOSE";
43127
- errorCallback(error2);
43143
+ const error3 = new Error("Premature close");
43144
+ error3.code = "ERR_STREAM_PREMATURE_CLOSE";
43145
+ errorCallback(error3);
43128
43146
  }
43129
43147
  };
43130
43148
  const onData = (buf) => {
@@ -44319,26 +44337,26 @@ var require_receiver = __commonJS({
44319
44337
  }
44320
44338
  const buf = this.consume(2);
44321
44339
  if ((buf[0] & 48) !== 0) {
44322
- const error2 = this.createError(
44340
+ const error3 = this.createError(
44323
44341
  RangeError,
44324
44342
  "RSV2 and RSV3 must be clear",
44325
44343
  true,
44326
44344
  1002,
44327
44345
  "WS_ERR_UNEXPECTED_RSV_2_3"
44328
44346
  );
44329
- cb(error2);
44347
+ cb(error3);
44330
44348
  return;
44331
44349
  }
44332
44350
  const compressed = (buf[0] & 64) === 64;
44333
44351
  if (compressed && !this._extensions[PerMessageDeflate.extensionName]) {
44334
- const error2 = this.createError(
44352
+ const error3 = this.createError(
44335
44353
  RangeError,
44336
44354
  "RSV1 must be clear",
44337
44355
  true,
44338
44356
  1002,
44339
44357
  "WS_ERR_UNEXPECTED_RSV_1"
44340
44358
  );
44341
- cb(error2);
44359
+ cb(error3);
44342
44360
  return;
44343
44361
  }
44344
44362
  this._fin = (buf[0] & 128) === 128;
@@ -44346,109 +44364,109 @@ var require_receiver = __commonJS({
44346
44364
  this._payloadLength = buf[1] & 127;
44347
44365
  if (this._opcode === 0) {
44348
44366
  if (compressed) {
44349
- const error2 = this.createError(
44367
+ const error3 = this.createError(
44350
44368
  RangeError,
44351
44369
  "RSV1 must be clear",
44352
44370
  true,
44353
44371
  1002,
44354
44372
  "WS_ERR_UNEXPECTED_RSV_1"
44355
44373
  );
44356
- cb(error2);
44374
+ cb(error3);
44357
44375
  return;
44358
44376
  }
44359
44377
  if (!this._fragmented) {
44360
- const error2 = this.createError(
44378
+ const error3 = this.createError(
44361
44379
  RangeError,
44362
44380
  "invalid opcode 0",
44363
44381
  true,
44364
44382
  1002,
44365
44383
  "WS_ERR_INVALID_OPCODE"
44366
44384
  );
44367
- cb(error2);
44385
+ cb(error3);
44368
44386
  return;
44369
44387
  }
44370
44388
  this._opcode = this._fragmented;
44371
44389
  } else if (this._opcode === 1 || this._opcode === 2) {
44372
44390
  if (this._fragmented) {
44373
- const error2 = this.createError(
44391
+ const error3 = this.createError(
44374
44392
  RangeError,
44375
44393
  `invalid opcode ${this._opcode}`,
44376
44394
  true,
44377
44395
  1002,
44378
44396
  "WS_ERR_INVALID_OPCODE"
44379
44397
  );
44380
- cb(error2);
44398
+ cb(error3);
44381
44399
  return;
44382
44400
  }
44383
44401
  this._compressed = compressed;
44384
44402
  } else if (this._opcode > 7 && this._opcode < 11) {
44385
44403
  if (!this._fin) {
44386
- const error2 = this.createError(
44404
+ const error3 = this.createError(
44387
44405
  RangeError,
44388
44406
  "FIN must be set",
44389
44407
  true,
44390
44408
  1002,
44391
44409
  "WS_ERR_EXPECTED_FIN"
44392
44410
  );
44393
- cb(error2);
44411
+ cb(error3);
44394
44412
  return;
44395
44413
  }
44396
44414
  if (compressed) {
44397
- const error2 = this.createError(
44415
+ const error3 = this.createError(
44398
44416
  RangeError,
44399
44417
  "RSV1 must be clear",
44400
44418
  true,
44401
44419
  1002,
44402
44420
  "WS_ERR_UNEXPECTED_RSV_1"
44403
44421
  );
44404
- cb(error2);
44422
+ cb(error3);
44405
44423
  return;
44406
44424
  }
44407
44425
  if (this._payloadLength > 125 || this._opcode === 8 && this._payloadLength === 1) {
44408
- const error2 = this.createError(
44426
+ const error3 = this.createError(
44409
44427
  RangeError,
44410
44428
  `invalid payload length ${this._payloadLength}`,
44411
44429
  true,
44412
44430
  1002,
44413
44431
  "WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH"
44414
44432
  );
44415
- cb(error2);
44433
+ cb(error3);
44416
44434
  return;
44417
44435
  }
44418
44436
  } else {
44419
- const error2 = this.createError(
44437
+ const error3 = this.createError(
44420
44438
  RangeError,
44421
44439
  `invalid opcode ${this._opcode}`,
44422
44440
  true,
44423
44441
  1002,
44424
44442
  "WS_ERR_INVALID_OPCODE"
44425
44443
  );
44426
- cb(error2);
44444
+ cb(error3);
44427
44445
  return;
44428
44446
  }
44429
44447
  if (!this._fin && !this._fragmented) this._fragmented = this._opcode;
44430
44448
  this._masked = (buf[1] & 128) === 128;
44431
44449
  if (this._isServer) {
44432
44450
  if (!this._masked) {
44433
- const error2 = this.createError(
44451
+ const error3 = this.createError(
44434
44452
  RangeError,
44435
44453
  "MASK must be set",
44436
44454
  true,
44437
44455
  1002,
44438
44456
  "WS_ERR_EXPECTED_MASK"
44439
44457
  );
44440
- cb(error2);
44458
+ cb(error3);
44441
44459
  return;
44442
44460
  }
44443
44461
  } else if (this._masked) {
44444
- const error2 = this.createError(
44462
+ const error3 = this.createError(
44445
44463
  RangeError,
44446
44464
  "MASK must be clear",
44447
44465
  true,
44448
44466
  1002,
44449
44467
  "WS_ERR_UNEXPECTED_MASK"
44450
44468
  );
44451
- cb(error2);
44469
+ cb(error3);
44452
44470
  return;
44453
44471
  }
44454
44472
  if (this._payloadLength === 126) this._state = GET_PAYLOAD_LENGTH_16;
@@ -44483,14 +44501,14 @@ var require_receiver = __commonJS({
44483
44501
  const buf = this.consume(8);
44484
44502
  const num = buf.readUInt32BE(0);
44485
44503
  if (num > Math.pow(2, 53 - 32) - 1) {
44486
- const error2 = this.createError(
44504
+ const error3 = this.createError(
44487
44505
  RangeError,
44488
44506
  "Unsupported WebSocket frame: payload length > 2^53 - 1",
44489
44507
  false,
44490
44508
  1009,
44491
44509
  "WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH"
44492
44510
  );
44493
- cb(error2);
44511
+ cb(error3);
44494
44512
  return;
44495
44513
  }
44496
44514
  this._payloadLength = num * Math.pow(2, 32) + buf.readUInt32BE(4);
@@ -44506,14 +44524,14 @@ var require_receiver = __commonJS({
44506
44524
  if (this._payloadLength && this._opcode < 8) {
44507
44525
  this._totalPayloadLength += this._payloadLength;
44508
44526
  if (this._totalPayloadLength > this._maxPayload && this._maxPayload > 0) {
44509
- const error2 = this.createError(
44527
+ const error3 = this.createError(
44510
44528
  RangeError,
44511
44529
  "Max payload size exceeded",
44512
44530
  false,
44513
44531
  1009,
44514
44532
  "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"
44515
44533
  );
44516
- cb(error2);
44534
+ cb(error3);
44517
44535
  return;
44518
44536
  }
44519
44537
  }
@@ -44580,14 +44598,14 @@ var require_receiver = __commonJS({
44580
44598
  if (buf.length) {
44581
44599
  this._messageLength += buf.length;
44582
44600
  if (this._messageLength > this._maxPayload && this._maxPayload > 0) {
44583
- const error2 = this.createError(
44601
+ const error3 = this.createError(
44584
44602
  RangeError,
44585
44603
  "Max payload size exceeded",
44586
44604
  false,
44587
44605
  1009,
44588
44606
  "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"
44589
44607
  );
44590
- cb(error2);
44608
+ cb(error3);
44591
44609
  return;
44592
44610
  }
44593
44611
  this._fragments.push(buf);
@@ -44638,14 +44656,14 @@ var require_receiver = __commonJS({
44638
44656
  } else {
44639
44657
  const buf = concat(fragments, messageLength);
44640
44658
  if (!this._skipUTF8Validation && !isValidUTF8(buf)) {
44641
- const error2 = this.createError(
44659
+ const error3 = this.createError(
44642
44660
  Error,
44643
44661
  "invalid UTF-8 sequence",
44644
44662
  true,
44645
44663
  1007,
44646
44664
  "WS_ERR_INVALID_UTF8"
44647
44665
  );
44648
- cb(error2);
44666
+ cb(error3);
44649
44667
  return;
44650
44668
  }
44651
44669
  if (this._state === INFLATING || this._allowSynchronousEvents) {
@@ -44677,14 +44695,14 @@ var require_receiver = __commonJS({
44677
44695
  } else {
44678
44696
  const code = data.readUInt16BE(0);
44679
44697
  if (!isValidStatusCode(code)) {
44680
- const error2 = this.createError(
44698
+ const error3 = this.createError(
44681
44699
  RangeError,
44682
44700
  `invalid status code ${code}`,
44683
44701
  true,
44684
44702
  1002,
44685
44703
  "WS_ERR_INVALID_CLOSE_CODE"
44686
44704
  );
44687
- cb(error2);
44705
+ cb(error3);
44688
44706
  return;
44689
44707
  }
44690
44708
  const buf = new FastBuffer(
@@ -44693,14 +44711,14 @@ var require_receiver = __commonJS({
44693
44711
  data.length - 2
44694
44712
  );
44695
44713
  if (!this._skipUTF8Validation && !isValidUTF8(buf)) {
44696
- const error2 = this.createError(
44714
+ const error3 = this.createError(
44697
44715
  Error,
44698
44716
  "invalid UTF-8 sequence",
44699
44717
  true,
44700
44718
  1007,
44701
44719
  "WS_ERR_INVALID_UTF8"
44702
44720
  );
44703
- cb(error2);
44721
+ cb(error3);
44704
44722
  return;
44705
44723
  }
44706
44724
  this._loop = false;
@@ -45112,7 +45130,7 @@ var require_sender = __commonJS({
45112
45130
  * @param {Function} [cb] Callback
45113
45131
  * @private
45114
45132
  */
45115
- getBlobData(blob, compress2, options, cb) {
45133
+ getBlobData(blob, compress3, options, cb) {
45116
45134
  this._bufferedBytes += options[kByteLength];
45117
45135
  this._state = GET_BLOB_DATA;
45118
45136
  blob.arrayBuffer().then((arrayBuffer) => {
@@ -45125,12 +45143,12 @@ var require_sender = __commonJS({
45125
45143
  }
45126
45144
  this._bufferedBytes -= options[kByteLength];
45127
45145
  const data = toBuffer(arrayBuffer);
45128
- if (!compress2) {
45146
+ if (!compress3) {
45129
45147
  this._state = DEFAULT;
45130
45148
  this.sendFrame(_Sender.frame(data, options), cb);
45131
45149
  this.dequeue();
45132
45150
  } else {
45133
- this.dispatch(data, compress2, options, cb);
45151
+ this.dispatch(data, compress3, options, cb);
45134
45152
  }
45135
45153
  }).catch((err2) => {
45136
45154
  process.nextTick(onError, this, err2, cb);
@@ -45159,8 +45177,8 @@ var require_sender = __commonJS({
45159
45177
  * @param {Function} [cb] Callback
45160
45178
  * @private
45161
45179
  */
45162
- dispatch(data, compress2, options, cb) {
45163
- if (!compress2) {
45180
+ dispatch(data, compress3, options, cb) {
45181
+ if (!compress3) {
45164
45182
  this.sendFrame(_Sender.frame(data, options), cb);
45165
45183
  return;
45166
45184
  }
@@ -45409,10 +45427,10 @@ var require_event_target = __commonJS({
45409
45427
  callListener(handler, this, event);
45410
45428
  };
45411
45429
  } else if (type === "error") {
45412
- wrapper = function onError(error2) {
45430
+ wrapper = function onError(error3) {
45413
45431
  const event = new ErrorEvent("error", {
45414
- error: error2,
45415
- message: error2.message
45432
+ error: error3,
45433
+ message: error3.message
45416
45434
  });
45417
45435
  event[kTarget] = this;
45418
45436
  callListener(handler, this, event);
@@ -45630,7 +45648,7 @@ var require_websocket = __commonJS({
45630
45648
  var net = require("net");
45631
45649
  var tls = require("tls");
45632
45650
  var { randomBytes, createHash: createHash2 } = require("crypto");
45633
- var { Duplex, Readable: Readable2 } = require("stream");
45651
+ var { Duplex, Readable: Readable3 } = require("stream");
45634
45652
  var { URL: URL3 } = require("url");
45635
45653
  var PerMessageDeflate = require_permessage_deflate();
45636
45654
  var Receiver2 = require_receiver();
@@ -46537,7 +46555,7 @@ var require_stream = __commonJS({
46537
46555
  const data = !isBinary && duplex._readableState.objectMode ? msg.toString() : msg;
46538
46556
  if (!duplex.push(data)) ws.pause();
46539
46557
  });
46540
- ws.once("error", function error2(err2) {
46558
+ ws.once("error", function error3(err2) {
46541
46559
  if (duplex.destroyed) return;
46542
46560
  terminateOnDestroy = false;
46543
46561
  duplex.destroy(err2);
@@ -46553,7 +46571,7 @@ var require_stream = __commonJS({
46553
46571
  return;
46554
46572
  }
46555
46573
  let called = false;
46556
- ws.once("error", function error2(err3) {
46574
+ ws.once("error", function error3(err3) {
46557
46575
  called = true;
46558
46576
  callback(err3);
46559
46577
  });
@@ -47505,7 +47523,7 @@ var require_dist_cjs4 = __commonJS({
47505
47523
  metadata: $metadata
47506
47524
  });
47507
47525
  return response;
47508
- } catch (error2) {
47526
+ } catch (error3) {
47509
47527
  const { clientName, commandName, logger: logger3, dynamoDbDocumentClientOptions = {} } = context;
47510
47528
  const { overrideInputFilterSensitiveLog } = dynamoDbDocumentClientOptions;
47511
47529
  const inputFilterSensitiveLog = overrideInputFilterSensitiveLog ?? context.inputFilterSensitiveLog;
@@ -47513,10 +47531,10 @@ var require_dist_cjs4 = __commonJS({
47513
47531
  clientName,
47514
47532
  commandName,
47515
47533
  input: inputFilterSensitiveLog(args.input),
47516
- error: error2,
47517
- metadata: error2.$metadata
47534
+ error: error3,
47535
+ metadata: error3.$metadata
47518
47536
  });
47519
- throw error2;
47537
+ throw error3;
47520
47538
  }
47521
47539
  }, "loggerMiddleware");
47522
47540
  var loggerMiddlewareOptions = {
@@ -47790,14 +47808,14 @@ var require_dist_cjs7 = __commonJS({
47790
47808
  response,
47791
47809
  output: parsed
47792
47810
  };
47793
- } catch (error2) {
47794
- Object.defineProperty(error2, "$response", {
47811
+ } catch (error3) {
47812
+ Object.defineProperty(error3, "$response", {
47795
47813
  value: response
47796
47814
  });
47797
- if (!("$metadata" in error2)) {
47815
+ if (!("$metadata" in error3)) {
47798
47816
  const hint = `Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.`;
47799
47817
  try {
47800
- error2.message += "\n " + hint;
47818
+ error3.message += "\n " + hint;
47801
47819
  } catch (e4) {
47802
47820
  if (!context.logger || ((_b = (_a2 = context.logger) == null ? void 0 : _a2.constructor) == null ? void 0 : _b.name) === "NoOpLogger") {
47803
47821
  console.warn(hint);
@@ -47805,16 +47823,16 @@ var require_dist_cjs7 = __commonJS({
47805
47823
  (_d = (_c = context.logger) == null ? void 0 : _c.warn) == null ? void 0 : _d.call(_c, hint);
47806
47824
  }
47807
47825
  }
47808
- if (typeof error2.$responseBodyText !== "undefined") {
47809
- if (error2.$response) {
47810
- error2.$response.body = error2.$responseBodyText;
47826
+ if (typeof error3.$responseBodyText !== "undefined") {
47827
+ if (error3.$response) {
47828
+ error3.$response.body = error3.$responseBodyText;
47811
47829
  }
47812
47830
  }
47813
47831
  try {
47814
47832
  if (import_protocol_http15.HttpResponse.isInstance(response)) {
47815
47833
  const { headers = {} } = response;
47816
47834
  const headerEntries = Object.entries(headers);
47817
- error2.$metadata = {
47835
+ error3.$metadata = {
47818
47836
  httpStatusCode: response.statusCode,
47819
47837
  requestId: findHeader(/^x-[\w-]+-request-?id$/, headerEntries),
47820
47838
  extendedRequestId: findHeader(/^x-[\w-]+-id-2$/, headerEntries),
@@ -47824,7 +47842,7 @@ var require_dist_cjs7 = __commonJS({
47824
47842
  } catch (e4) {
47825
47843
  }
47826
47844
  }
47827
- throw error2;
47845
+ throw error3;
47828
47846
  }
47829
47847
  }, "deserializerMiddleware");
47830
47848
  var findHeader = /* @__PURE__ */ __name((pattern, headers) => {
@@ -47910,8 +47928,8 @@ var init_httpSigningMiddleware = __esm({
47910
47928
  import_protocol_http = __toESM(require_dist_cjs2());
47911
47929
  import_types3 = __toESM(require_dist_cjs());
47912
47930
  import_util_middleware2 = __toESM(require_dist_cjs6());
47913
- defaultErrorHandler = (signingProperties) => (error2) => {
47914
- throw error2;
47931
+ defaultErrorHandler = (signingProperties) => (error3) => {
47932
+ throw error3;
47915
47933
  };
47916
47934
  defaultSuccessHandler = (httpResponse, signingProperties) => {
47917
47935
  };
@@ -48337,8 +48355,8 @@ var require_createChecksumStream_browser = __commonJS({
48337
48355
  const digest = await checksum.digest();
48338
48356
  const received = encoder(digest);
48339
48357
  if (expectedChecksum !== received) {
48340
- const error2 = new Error(`Checksum mismatch: expected "${expectedChecksum}" but received "${received}" in response header "${checksumSourceLocation}".`);
48341
- controller.error(error2);
48358
+ const error3 = new Error(`Checksum mismatch: expected "${expectedChecksum}" but received "${received}" in response header "${checksumSourceLocation}".`);
48359
+ controller.error(error3);
48342
48360
  } else {
48343
48361
  controller.terminate();
48344
48362
  }
@@ -52577,7 +52595,7 @@ var require_dist_cjs18 = __commonJS({
52577
52595
  return url;
52578
52596
  }
52579
52597
  return new URL(value);
52580
- } catch (error2) {
52598
+ } catch (error3) {
52581
52599
  return null;
52582
52600
  }
52583
52601
  })();
@@ -52764,9 +52782,9 @@ var require_dist_cjs18 = __commonJS({
52764
52782
  if (typeof expression === "string") {
52765
52783
  try {
52766
52784
  return new URL(expression);
52767
- } catch (error2) {
52768
- console.error(`Failed to construct URL with ${expression}`, error2);
52769
- throw error2;
52785
+ } catch (error3) {
52786
+ console.error(`Failed to construct URL with ${expression}`, error3);
52787
+ throw error3;
52770
52788
  }
52771
52789
  }
52772
52790
  throw new EndpointError2(`Endpoint URL must be a string, got ${typeof expression}`);
@@ -52795,13 +52813,13 @@ var require_dist_cjs18 = __commonJS({
52795
52813
  };
52796
52814
  }, "evaluateEndpointRule");
52797
52815
  var evaluateErrorRule = /* @__PURE__ */ __name((errorRule, options) => {
52798
- const { conditions, error: error2 } = errorRule;
52816
+ const { conditions, error: error3 } = errorRule;
52799
52817
  const { result, referenceRecord } = evaluateConditions(conditions, options);
52800
52818
  if (!result) {
52801
52819
  return;
52802
52820
  }
52803
52821
  throw new EndpointError2(
52804
- evaluateExpression(error2, "Error", {
52822
+ evaluateExpression(error3, "Error", {
52805
52823
  ...options,
52806
52824
  referenceRecord: { ...options.referenceRecord, ...referenceRecord }
52807
52825
  })
@@ -53439,18 +53457,18 @@ var init_AwsSdkSigV4Signer = __esm({
53439
53457
  return signedRequest;
53440
53458
  }
53441
53459
  errorHandler(signingProperties) {
53442
- return (error2) => {
53443
- const serverTime = error2.ServerTime ?? getDateHeader(error2.$response);
53460
+ return (error3) => {
53461
+ const serverTime = error3.ServerTime ?? getDateHeader(error3.$response);
53444
53462
  if (serverTime) {
53445
53463
  const config = throwSigningPropertyError("config", signingProperties.config);
53446
53464
  const initialSystemClockOffset = config.systemClockOffset;
53447
53465
  config.systemClockOffset = getUpdatedSystemClockOffset(serverTime, config.systemClockOffset);
53448
53466
  const clockSkewCorrected = config.systemClockOffset !== initialSystemClockOffset;
53449
- if (clockSkewCorrected && error2.$metadata) {
53450
- error2.$metadata.clockSkewCorrected = true;
53467
+ if (clockSkewCorrected && error3.$metadata) {
53468
+ error3.$metadata.clockSkewCorrected = true;
53451
53469
  }
53452
53470
  }
53453
- throw error2;
53471
+ throw error3;
53454
53472
  };
53455
53473
  }
53456
53474
  successHandler(httpResponse, signingProperties) {
@@ -53590,8 +53608,8 @@ var require_dist_cjs20 = __commonJS({
53590
53608
  /**
53591
53609
  * @deprecated use new operator.
53592
53610
  */
53593
- static from(error2, options = true) {
53594
- return Object.assign(new this(error2.message, options), error2);
53611
+ static from(error3, options = true) {
53612
+ return Object.assign(new this(error3.message, options), error3);
53595
53613
  }
53596
53614
  }, __name(_a2, "ProviderError"), _a2);
53597
53615
  var _a3;
@@ -57334,9 +57352,9 @@ var require_node2json = __commonJS({
57334
57352
  "../node_modules/.pnpm/fast-xml-parser@4.4.1/node_modules/fast-xml-parser/src/xmlparser/node2json.js"(exports2) {
57335
57353
  "use strict";
57336
57354
  function prettify(node, options) {
57337
- return compress2(node, options);
57355
+ return compress3(node, options);
57338
57356
  }
57339
- function compress2(arr, options, jPath) {
57357
+ function compress3(arr, options, jPath) {
57340
57358
  let text;
57341
57359
  const compressedObj = {};
57342
57360
  for (let i4 = 0; i4 < arr.length; i4++) {
@@ -57351,7 +57369,7 @@ var require_node2json = __commonJS({
57351
57369
  } else if (property === void 0) {
57352
57370
  continue;
57353
57371
  } else if (tagObj[property]) {
57354
- let val2 = compress2(tagObj[property], options, newJpath);
57372
+ let val2 = compress3(tagObj[property], options, newJpath);
57355
57373
  const isLeaf = isLeafTag(val2, options);
57356
57374
  if (tagObj[":@"]) {
57357
57375
  assignAttributes(val2, tagObj[":@"], newJpath, options);
@@ -59503,7 +59521,7 @@ var require_dist_cjs29 = __commonJS({
59503
59521
  ...request.headers,
59504
59522
  [CONTENT_LENGTH_HEADER]: String(length)
59505
59523
  };
59506
- } catch (error2) {
59524
+ } catch (error3) {
59507
59525
  }
59508
59526
  }
59509
59527
  }
@@ -60690,13 +60708,13 @@ var require_dist_cjs35 = __commonJS({
60690
60708
  var TRANSIENT_ERROR_CODES = ["TimeoutError", "RequestTimeout", "RequestTimeoutException"];
60691
60709
  var TRANSIENT_ERROR_STATUS_CODES = [500, 502, 503, 504];
60692
60710
  var NODEJS_TIMEOUT_ERROR_CODES = ["ECONNRESET", "ECONNREFUSED", "EPIPE", "ETIMEDOUT"];
60693
- var isRetryableByTrait = /* @__PURE__ */ __name((error2) => error2.$retryable !== void 0, "isRetryableByTrait");
60694
- var isClockSkewError = /* @__PURE__ */ __name((error2) => CLOCK_SKEW_ERROR_CODES.includes(error2.name), "isClockSkewError");
60695
- var isClockSkewCorrectedError = /* @__PURE__ */ __name((error2) => {
60711
+ var isRetryableByTrait = /* @__PURE__ */ __name((error3) => error3.$retryable !== void 0, "isRetryableByTrait");
60712
+ var isClockSkewError = /* @__PURE__ */ __name((error3) => CLOCK_SKEW_ERROR_CODES.includes(error3.name), "isClockSkewError");
60713
+ var isClockSkewCorrectedError = /* @__PURE__ */ __name((error3) => {
60696
60714
  var _a2;
60697
- return (_a2 = error2.$metadata) == null ? void 0 : _a2.clockSkewCorrected;
60715
+ return (_a2 = error3.$metadata) == null ? void 0 : _a2.clockSkewCorrected;
60698
60716
  }, "isClockSkewCorrectedError");
60699
- var isBrowserNetworkError = /* @__PURE__ */ __name((error2) => {
60717
+ var isBrowserNetworkError = /* @__PURE__ */ __name((error3) => {
60700
60718
  const errorMessages = /* @__PURE__ */ new Set([
60701
60719
  "Failed to fetch",
60702
60720
  // Chrome
@@ -60709,25 +60727,25 @@ var require_dist_cjs35 = __commonJS({
60709
60727
  "Network request failed"
60710
60728
  // `cross-fetch`
60711
60729
  ]);
60712
- const isValid2 = error2 && error2 instanceof TypeError;
60730
+ const isValid2 = error3 && error3 instanceof TypeError;
60713
60731
  if (!isValid2) {
60714
60732
  return false;
60715
60733
  }
60716
- return errorMessages.has(error2.message);
60734
+ return errorMessages.has(error3.message);
60717
60735
  }, "isBrowserNetworkError");
60718
- var isThrottlingError = /* @__PURE__ */ __name((error2) => {
60736
+ var isThrottlingError = /* @__PURE__ */ __name((error3) => {
60719
60737
  var _a2, _b;
60720
- return ((_a2 = error2.$metadata) == null ? void 0 : _a2.httpStatusCode) === 429 || THROTTLING_ERROR_CODES.includes(error2.name) || ((_b = error2.$retryable) == null ? void 0 : _b.throttling) == true;
60738
+ return ((_a2 = error3.$metadata) == null ? void 0 : _a2.httpStatusCode) === 429 || THROTTLING_ERROR_CODES.includes(error3.name) || ((_b = error3.$retryable) == null ? void 0 : _b.throttling) == true;
60721
60739
  }, "isThrottlingError");
60722
- var isTransientError = /* @__PURE__ */ __name((error2, depth = 0) => {
60740
+ var isTransientError = /* @__PURE__ */ __name((error3, depth = 0) => {
60723
60741
  var _a2;
60724
- return isClockSkewCorrectedError(error2) || TRANSIENT_ERROR_CODES.includes(error2.name) || NODEJS_TIMEOUT_ERROR_CODES.includes((error2 == null ? void 0 : error2.code) || "") || TRANSIENT_ERROR_STATUS_CODES.includes(((_a2 = error2.$metadata) == null ? void 0 : _a2.httpStatusCode) || 0) || isBrowserNetworkError(error2) || error2.cause !== void 0 && depth <= 10 && isTransientError(error2.cause, depth + 1);
60742
+ return isClockSkewCorrectedError(error3) || TRANSIENT_ERROR_CODES.includes(error3.name) || NODEJS_TIMEOUT_ERROR_CODES.includes((error3 == null ? void 0 : error3.code) || "") || TRANSIENT_ERROR_STATUS_CODES.includes(((_a2 = error3.$metadata) == null ? void 0 : _a2.httpStatusCode) || 0) || isBrowserNetworkError(error3) || error3.cause !== void 0 && depth <= 10 && isTransientError(error3.cause, depth + 1);
60725
60743
  }, "isTransientError");
60726
- var isServerError = /* @__PURE__ */ __name((error2) => {
60744
+ var isServerError = /* @__PURE__ */ __name((error3) => {
60727
60745
  var _a2;
60728
- if (((_a2 = error2.$metadata) == null ? void 0 : _a2.httpStatusCode) !== void 0) {
60729
- const statusCode = error2.$metadata.httpStatusCode;
60730
- if (500 <= statusCode && statusCode <= 599 && !isTransientError(error2)) {
60746
+ if (((_a2 = error3.$metadata) == null ? void 0 : _a2.httpStatusCode) !== void 0) {
60747
+ const statusCode = error3.$metadata.httpStatusCode;
60748
+ if (500 <= statusCode && statusCode <= 599 && !isTransientError(error3)) {
60731
60749
  return true;
60732
60750
  }
60733
60751
  return false;
@@ -60971,7 +60989,7 @@ var require_dist_cjs36 = __commonJS({
60971
60989
  async getMaxAttempts() {
60972
60990
  try {
60973
60991
  return await this.maxAttemptsProvider();
60974
- } catch (error2) {
60992
+ } catch (error3) {
60975
60993
  console.warn(`Max attempts provider could not resolve. Using default of ${DEFAULT_MAX_ATTEMPTS}`);
60976
60994
  return DEFAULT_MAX_ATTEMPTS;
60977
60995
  }
@@ -61111,13 +61129,13 @@ var require_dist_cjs37 = __commonJS({
61111
61129
  const retryCost = (options == null ? void 0 : options.retryCost) ?? import_util_retry3.RETRY_COST;
61112
61130
  const timeoutRetryCost = (options == null ? void 0 : options.timeoutRetryCost) ?? import_util_retry3.TIMEOUT_RETRY_COST;
61113
61131
  let availableCapacity = initialRetryTokens;
61114
- const getCapacityAmount = /* @__PURE__ */ __name((error2) => error2.name === "TimeoutError" ? timeoutRetryCost : retryCost, "getCapacityAmount");
61115
- const hasRetryTokens = /* @__PURE__ */ __name((error2) => getCapacityAmount(error2) <= availableCapacity, "hasRetryTokens");
61116
- const retrieveRetryTokens = /* @__PURE__ */ __name((error2) => {
61117
- if (!hasRetryTokens(error2)) {
61132
+ const getCapacityAmount = /* @__PURE__ */ __name((error3) => error3.name === "TimeoutError" ? timeoutRetryCost : retryCost, "getCapacityAmount");
61133
+ const hasRetryTokens = /* @__PURE__ */ __name((error3) => getCapacityAmount(error3) <= availableCapacity, "hasRetryTokens");
61134
+ const retrieveRetryTokens = /* @__PURE__ */ __name((error3) => {
61135
+ if (!hasRetryTokens(error3)) {
61118
61136
  throw new Error("No retry token available");
61119
61137
  }
61120
- const capacityAmount = getCapacityAmount(error2);
61138
+ const capacityAmount = getCapacityAmount(error3);
61121
61139
  availableCapacity -= capacityAmount;
61122
61140
  return capacityAmount;
61123
61141
  }, "retrieveRetryTokens");
@@ -61133,20 +61151,20 @@ var require_dist_cjs37 = __commonJS({
61133
61151
  }, "getDefaultRetryQuota");
61134
61152
  var defaultDelayDecider = /* @__PURE__ */ __name((delayBase, attempts) => Math.floor(Math.min(import_util_retry3.MAXIMUM_RETRY_DELAY, Math.random() * 2 ** attempts * delayBase)), "defaultDelayDecider");
61135
61153
  var import_service_error_classification = require_dist_cjs35();
61136
- var defaultRetryDecider = /* @__PURE__ */ __name((error2) => {
61137
- if (!error2) {
61154
+ var defaultRetryDecider = /* @__PURE__ */ __name((error3) => {
61155
+ if (!error3) {
61138
61156
  return false;
61139
61157
  }
61140
- return (0, import_service_error_classification.isRetryableByTrait)(error2) || (0, import_service_error_classification.isClockSkewError)(error2) || (0, import_service_error_classification.isThrottlingError)(error2) || (0, import_service_error_classification.isTransientError)(error2);
61158
+ return (0, import_service_error_classification.isRetryableByTrait)(error3) || (0, import_service_error_classification.isClockSkewError)(error3) || (0, import_service_error_classification.isThrottlingError)(error3) || (0, import_service_error_classification.isTransientError)(error3);
61141
61159
  }, "defaultRetryDecider");
61142
- var asSdkError = /* @__PURE__ */ __name((error2) => {
61143
- if (error2 instanceof Error)
61144
- return error2;
61145
- if (error2 instanceof Object)
61146
- return Object.assign(new Error(), error2);
61147
- if (typeof error2 === "string")
61148
- return new Error(error2);
61149
- return new Error(`AWS SDK error wrapper for ${error2}`);
61160
+ var asSdkError = /* @__PURE__ */ __name((error3) => {
61161
+ if (error3 instanceof Error)
61162
+ return error3;
61163
+ if (error3 instanceof Object)
61164
+ return Object.assign(new Error(), error3);
61165
+ if (typeof error3 === "string")
61166
+ return new Error(error3);
61167
+ return new Error(`AWS SDK error wrapper for ${error3}`);
61150
61168
  }, "asSdkError");
61151
61169
  var _a2;
61152
61170
  var StandardRetryStrategy = (_a2 = class {
@@ -61157,14 +61175,14 @@ var require_dist_cjs37 = __commonJS({
61157
61175
  this.delayDecider = (options == null ? void 0 : options.delayDecider) ?? defaultDelayDecider;
61158
61176
  this.retryQuota = (options == null ? void 0 : options.retryQuota) ?? getDefaultRetryQuota(import_util_retry3.INITIAL_RETRY_TOKENS);
61159
61177
  }
61160
- shouldRetry(error2, attempts, maxAttempts) {
61161
- return attempts < maxAttempts && this.retryDecider(error2) && this.retryQuota.hasRetryTokens(error2);
61178
+ shouldRetry(error3, attempts, maxAttempts) {
61179
+ return attempts < maxAttempts && this.retryDecider(error3) && this.retryQuota.hasRetryTokens(error3);
61162
61180
  }
61163
61181
  async getMaxAttempts() {
61164
61182
  let maxAttempts;
61165
61183
  try {
61166
61184
  maxAttempts = await this.maxAttemptsProvider();
61167
- } catch (error2) {
61185
+ } catch (error3) {
61168
61186
  maxAttempts = import_util_retry3.DEFAULT_MAX_ATTEMPTS;
61169
61187
  }
61170
61188
  return maxAttempts;
@@ -61381,23 +61399,23 @@ var require_dist_cjs37 = __commonJS({
61381
61399
  }
61382
61400
  }, "retryMiddleware");
61383
61401
  var isRetryStrategyV2 = /* @__PURE__ */ __name((retryStrategy) => typeof retryStrategy.acquireInitialRetryToken !== "undefined" && typeof retryStrategy.refreshRetryTokenForRetry !== "undefined" && typeof retryStrategy.recordSuccess !== "undefined", "isRetryStrategyV2");
61384
- var getRetryErrorInfo = /* @__PURE__ */ __name((error2) => {
61402
+ var getRetryErrorInfo = /* @__PURE__ */ __name((error3) => {
61385
61403
  const errorInfo = {
61386
- error: error2,
61387
- errorType: getRetryErrorType(error2)
61404
+ error: error3,
61405
+ errorType: getRetryErrorType(error3)
61388
61406
  };
61389
- const retryAfterHint = getRetryAfterHint(error2.$response);
61407
+ const retryAfterHint = getRetryAfterHint(error3.$response);
61390
61408
  if (retryAfterHint) {
61391
61409
  errorInfo.retryAfterHint = retryAfterHint;
61392
61410
  }
61393
61411
  return errorInfo;
61394
61412
  }, "getRetryErrorInfo");
61395
- var getRetryErrorType = /* @__PURE__ */ __name((error2) => {
61396
- if ((0, import_service_error_classification.isThrottlingError)(error2))
61413
+ var getRetryErrorType = /* @__PURE__ */ __name((error3) => {
61414
+ if ((0, import_service_error_classification.isThrottlingError)(error3))
61397
61415
  return "THROTTLING";
61398
- if ((0, import_service_error_classification.isTransientError)(error2))
61416
+ if ((0, import_service_error_classification.isTransientError)(error3))
61399
61417
  return "TRANSIENT";
61400
- if ((0, import_service_error_classification.isServerError)(error2))
61418
+ if ((0, import_service_error_classification.isServerError)(error3))
61401
61419
  return "SERVER_ERROR";
61402
61420
  return "CLIENT_ERROR";
61403
61421
  }, "getRetryErrorType");
@@ -61714,8 +61732,8 @@ function __read(o3, n3) {
61714
61732
  var i4 = m4.call(o3), r4, ar = [], e4;
61715
61733
  try {
61716
61734
  while ((n3 === void 0 || n3-- > 0) && !(r4 = i4.next()).done) ar.push(r4.value);
61717
- } catch (error2) {
61718
- e4 = { error: error2 };
61735
+ } catch (error3) {
61736
+ e4 = { error: error3 };
61719
61737
  } finally {
61720
61738
  try {
61721
61739
  if (r4 && !r4.done && (m4 = i4["return"])) m4.call(i4);
@@ -61965,9 +61983,9 @@ var init_tslib_es6 = __esm({
61965
61983
  };
61966
61984
  return ownKeys(o3);
61967
61985
  };
61968
- _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function(error2, suppressed, message) {
61986
+ _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function(error3, suppressed, message) {
61969
61987
  var e4 = new Error(message);
61970
- return e4.name = "SuppressedError", e4.error = error2, e4.suppressed = suppressed, e4;
61988
+ return e4.name = "SuppressedError", e4.error = error3, e4.suppressed = suppressed, e4;
61971
61989
  };
61972
61990
  tslib_es6_default = {
61973
61991
  __extends,
@@ -62527,12 +62545,12 @@ For more information, please visit: ` + STATIC_STABILITY_DOC_URL
62527
62545
  let token;
62528
62546
  try {
62529
62547
  token = (await getMetadataToken({ ...endpoint, timeout })).toString();
62530
- } catch (error2) {
62531
- if ((error2 == null ? void 0 : error2.statusCode) === 400) {
62532
- throw Object.assign(error2, {
62548
+ } catch (error3) {
62549
+ if ((error3 == null ? void 0 : error3.statusCode) === 400) {
62550
+ throw Object.assign(error3, {
62533
62551
  message: "EC2 Metadata token request returned error"
62534
62552
  });
62535
- } else if (error2.message === "TimeoutError" || [403, 404, 405].includes(error2.statusCode)) {
62553
+ } else if (error3.message === "TimeoutError" || [403, 404, 405].includes(error3.statusCode)) {
62536
62554
  disableFetchToken = true;
62537
62555
  }
62538
62556
  logger3 == null ? void 0 : logger3.debug("AWS SDK Instance Metadata", "using v1 fallback (initial)");
@@ -65224,13 +65242,13 @@ var require_dist_cjs47 = __commonJS({
65224
65242
  expiresAt: newTokenExpiration.toISOString(),
65225
65243
  refreshToken: newSsoOidcToken.refreshToken
65226
65244
  });
65227
- } catch (error2) {
65245
+ } catch (error3) {
65228
65246
  }
65229
65247
  return {
65230
65248
  token: newSsoOidcToken.accessToken,
65231
65249
  expiration: newTokenExpiration
65232
65250
  };
65233
- } catch (error2) {
65251
+ } catch (error3) {
65234
65252
  validateTokenExpiry(existingToken);
65235
65253
  return existingToken;
65236
65254
  }
@@ -66825,8 +66843,8 @@ var require_dist_cjs49 = __commonJS({
66825
66843
  throw Error(`Profile ${profileName} credential_process returned invalid JSON.`);
66826
66844
  }
66827
66845
  return getValidatedProcessCredentials(profileName, data, profiles);
66828
- } catch (error2) {
66829
- throw new import_property_provider2.CredentialsProviderError(error2.message, { logger: logger3 });
66846
+ } catch (error3) {
66847
+ throw new import_property_provider2.CredentialsProviderError(error3.message, { logger: logger3 });
66830
66848
  }
66831
66849
  } else {
66832
66850
  throw new import_property_provider2.CredentialsProviderError(`Profile ${profileName} did not contain credential_process.`, { logger: logger3 });
@@ -76782,8 +76800,8 @@ var require_util3 = __commonJS({
76782
76800
  var enums_1 = require_enums();
76783
76801
  var util2;
76784
76802
  (function(util3) {
76785
- function assertNever(arg, error2) {
76786
- throw error2 ?? new Error(`${arg} is supposed to be of "never" type`);
76803
+ function assertNever(arg, error3) {
76804
+ throw error3 ?? new Error(`${arg} is supposed to be of "never" type`);
76787
76805
  }
76788
76806
  util3.assertNever = assertNever;
76789
76807
  function splitName(name) {
@@ -77319,9 +77337,9 @@ var require_baseClient = __commonJS({
77319
77337
  const connectionHolder = await this._queue.get();
77320
77338
  try {
77321
77339
  return await connectionHolder.acquire(options);
77322
- } catch (error2) {
77340
+ } catch (error3) {
77323
77341
  this._queue.push(connectionHolder);
77324
- throw error2;
77342
+ throw error3;
77325
77343
  }
77326
77344
  }
77327
77345
  enqueue(holder) {
@@ -79537,7 +79555,7 @@ var require_baseConn = __commonJS({
79537
79555
  wb.writeSync();
79538
79556
  this._sendData(wb.unwrap());
79539
79557
  let parsing = true;
79540
- let error2 = null;
79558
+ let error3 = null;
79541
79559
  let newCard = null;
79542
79560
  let capabilities = -1;
79543
79561
  let inCodec = null;
@@ -79572,13 +79590,13 @@ var require_baseConn = __commonJS({
79572
79590
  unsafeIsolationDangers
79573
79591
  ]);
79574
79592
  } catch (e4) {
79575
- error2 = e4;
79593
+ error3 = e4;
79576
79594
  }
79577
79595
  break;
79578
79596
  }
79579
79597
  case chars.$E: {
79580
- error2 = this._parseErrorMessage();
79581
- error2._query = query;
79598
+ error3 = this._parseErrorMessage();
79599
+ error3._query = query;
79582
79600
  break;
79583
79601
  }
79584
79602
  case chars.$s: {
@@ -79595,11 +79613,11 @@ var require_baseConn = __commonJS({
79595
79613
  this._fallthrough();
79596
79614
  }
79597
79615
  }
79598
- if (error2 !== null) {
79599
- if (error2 instanceof errors.StateMismatchError) {
79616
+ if (error3 !== null) {
79617
+ if (error3 instanceof errors.StateMismatchError) {
79600
79618
  return this._parse(language, query, outputFormat, expectedCardinality, state2, capabilitiesFlags, options, unsafeIsolationDangers);
79601
79619
  }
79602
- throw error2;
79620
+ throw error3;
79603
79621
  }
79604
79622
  return [
79605
79623
  newCard,
@@ -79628,7 +79646,7 @@ var require_baseConn = __commonJS({
79628
79646
  wb.endMessage();
79629
79647
  wb.writeSync();
79630
79648
  this._sendData(wb.unwrap());
79631
- let error2 = null;
79649
+ let error3 = null;
79632
79650
  let parsing = true;
79633
79651
  let currentWarnings = [];
79634
79652
  while (parsing) {
@@ -79638,11 +79656,11 @@ var require_baseConn = __commonJS({
79638
79656
  const mtype = this.buffer.getMessageType();
79639
79657
  switch (mtype) {
79640
79658
  case chars.$D: {
79641
- if (error2 == null) {
79659
+ if (error3 == null) {
79642
79660
  try {
79643
79661
  this._parseDataMessages(outCodec, result, ctx);
79644
79662
  } catch (e4) {
79645
- error2 = e4;
79663
+ error3 = e4;
79646
79664
  this.buffer.finishMessage();
79647
79665
  }
79648
79666
  } else {
@@ -79680,7 +79698,7 @@ var require_baseConn = __commonJS({
79680
79698
  currentUnsafeIsolationDangers = _dangers;
79681
79699
  } catch (e4) {
79682
79700
  options_1.Options.signalSchemaChange();
79683
- error2 = e4;
79701
+ error3 = e4;
79684
79702
  }
79685
79703
  break;
79686
79704
  }
@@ -79690,19 +79708,19 @@ var require_baseConn = __commonJS({
79690
79708
  break;
79691
79709
  }
79692
79710
  case chars.$E: {
79693
- error2 = this._parseErrorMessage();
79694
- error2._query = query;
79711
+ error3 = this._parseErrorMessage();
79712
+ error3._query = query;
79695
79713
  break;
79696
79714
  }
79697
79715
  default:
79698
79716
  this._fallthrough();
79699
79717
  }
79700
79718
  }
79701
- if (error2 != null) {
79702
- if (error2 instanceof errors.StateMismatchError) {
79719
+ if (error3 != null) {
79720
+ if (error3 instanceof errors.StateMismatchError) {
79703
79721
  return this._executeFlow(language, query, args, outputFormat, expectedCardinality, state2, inCodec, outCodec, result, capabilitiesFlags, options, currentUnsafeIsolationDangers);
79704
79722
  }
79705
- throw error2;
79723
+ throw error3;
79706
79724
  }
79707
79725
  return [currentWarnings, currentUnsafeIsolationDangers];
79708
79726
  }
@@ -80958,8 +80976,8 @@ var require_wkt = __commonJS({
80958
80976
  return geoms;
80959
80977
  }
80960
80978
  }
80961
- function createParseError(_wkt, index6, error2) {
80962
- return new Error(`${error2} at position ${index6}`);
80979
+ function createParseError(_wkt, index6, error3) {
80980
+ return new Error(`${error3} at position ${index6}`);
80963
80981
  }
80964
80982
  function assertNever(_type, message) {
80965
80983
  throw new Error(message);
@@ -82319,8 +82337,8 @@ var init_connections = __esm({
82319
82337
  results.push(result.rows);
82320
82338
  }
82321
82339
  });
82322
- } catch (error2) {
82323
- results.push(error2);
82340
+ } catch (error3) {
82341
+ results.push(error3);
82324
82342
  }
82325
82343
  return results;
82326
82344
  };
@@ -82387,9 +82405,9 @@ var init_connections = __esm({
82387
82405
  results.push(result.rows);
82388
82406
  }
82389
82407
  await tx.query("COMMIT");
82390
- } catch (error2) {
82408
+ } catch (error3) {
82391
82409
  await tx.query("ROLLBACK");
82392
- results.push(error2);
82410
+ results.push(error3);
82393
82411
  } finally {
82394
82412
  tx.release();
82395
82413
  }
@@ -82435,8 +82453,8 @@ var init_connections = __esm({
82435
82453
  results.push(result);
82436
82454
  }
82437
82455
  });
82438
- } catch (error2) {
82439
- results.push(error2);
82456
+ } catch (error3) {
82457
+ results.push(error3);
82440
82458
  }
82441
82459
  return results;
82442
82460
  };
@@ -82509,9 +82527,9 @@ var init_connections = __esm({
82509
82527
  results.push(result.rows);
82510
82528
  }
82511
82529
  await tx.query("COMMIT");
82512
- } catch (error2) {
82530
+ } catch (error3) {
82513
82531
  await tx.query("ROLLBACK");
82514
- results.push(error2);
82532
+ results.push(error3);
82515
82533
  } finally {
82516
82534
  tx.release();
82517
82535
  }
@@ -82588,9 +82606,9 @@ var init_connections = __esm({
82588
82606
  results.push(result.rows);
82589
82607
  }
82590
82608
  await tx.query("COMMIT");
82591
- } catch (error2) {
82609
+ } catch (error3) {
82592
82610
  await tx.query("ROLLBACK");
82593
- results.push(error2);
82611
+ results.push(error3);
82594
82612
  } finally {
82595
82613
  tx.release();
82596
82614
  }
@@ -82598,8 +82616,51 @@ var init_connections = __esm({
82598
82616
  };
82599
82617
  return { packageName: "@neondatabase/serverless", query, proxy, transactionProxy, migrate: migrateFn };
82600
82618
  }
82619
+ if (await checkPackage("bun")) {
82620
+ console.log(withStyle.info(`Using 'bun' driver for database querying`));
82621
+ const { SQL: SQL6 } = await import("bun");
82622
+ const { drizzle } = await import("drizzle-orm/bun-sql");
82623
+ const { migrate: migrate2 } = await import("drizzle-orm/bun-sql/migrator");
82624
+ const ssl = "ssl" in credentials2 ? credentials2.ssl === "prefer" || credentials2.ssl === "require" || credentials2.ssl === "allow" ? true : false : void 0;
82625
+ const client = new SQL6({
82626
+ adapter: "postgres",
82627
+ ...credentials2,
82628
+ ssl,
82629
+ max: 1
82630
+ });
82631
+ const db = drizzle(client);
82632
+ const migrateFn = async (config) => {
82633
+ return migrate2(db, config);
82634
+ };
82635
+ const query = async (sql, params) => {
82636
+ const result = await client.unsafe(sql, params ?? []);
82637
+ return result;
82638
+ };
82639
+ const proxy = async (params) => {
82640
+ const query2 = client.unsafe(params.sql, params.params);
82641
+ if (params.mode === "array") {
82642
+ return await query2.values();
82643
+ }
82644
+ return await query2;
82645
+ };
82646
+ const transactionProxy = async (queries) => {
82647
+ const results = [];
82648
+ try {
82649
+ await client.transaction(async (tx) => {
82650
+ for (const query2 of queries) {
82651
+ const result = await tx.unsafe(query2.sql);
82652
+ results.push(result);
82653
+ }
82654
+ });
82655
+ } catch (error3) {
82656
+ results.push(error3);
82657
+ }
82658
+ return results;
82659
+ };
82660
+ return { packageName: "bun", query, proxy, transactionProxy, migrate: migrateFn };
82661
+ }
82601
82662
  console.error(
82602
- "To connect to Postgres database - please install either of 'pg', 'postgres', '@neondatabase/serverless' or '@vercel/postgres' drivers"
82663
+ "To connect to Postgres database - please install either of 'pg', 'postgres', 'bun', '@neondatabase/serverless' or '@vercel/postgres' drivers"
82603
82664
  );
82604
82665
  process.exit(1);
82605
82666
  };
@@ -82611,15 +82672,15 @@ var init_connections = __esm({
82611
82672
  client = gel.createClient();
82612
82673
  try {
82613
82674
  await client.querySQL(`select 1;`);
82614
- } catch (error2) {
82615
- if (error2 instanceof gel.ClientConnectionError) {
82675
+ } catch (error3) {
82676
+ if (error3 instanceof gel.ClientConnectionError) {
82616
82677
  console.error(
82617
82678
  `It looks like you forgot to link the Gel project or provide the database credentials.
82618
82679
  To link your project, please refer https://docs.geldata.com/reference/cli/gel_instance/gel_instance_link, or add the dbCredentials to your configuration file.`
82619
82680
  );
82620
82681
  process.exit(1);
82621
82682
  }
82622
- throw error2;
82683
+ throw error3;
82623
82684
  }
82624
82685
  } else if ("url" in credentials2) {
82625
82686
  "tlsSecurity" in credentials2 ? client = gel.createClient({ dsn: credentials2.url, tlsSecurity: credentials2.tlsSecurity, concurrency: 1 }) : client = gel.createClient({ dsn: credentials2.url, concurrency: 1 });
@@ -82652,8 +82713,8 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
82652
82713
  result.push(res);
82653
82714
  }
82654
82715
  });
82655
- } catch (error2) {
82656
- result.push(error2);
82716
+ } catch (error3) {
82717
+ result.push(error3);
82657
82718
  }
82658
82719
  return result;
82659
82720
  };
@@ -82717,9 +82778,9 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
82717
82778
  results.push(res[0]);
82718
82779
  }
82719
82780
  await connection.commit();
82720
- } catch (error2) {
82781
+ } catch (error3) {
82721
82782
  await connection.rollback();
82722
- results.push(error2);
82783
+ results.push(error3);
82723
82784
  }
82724
82785
  return results;
82725
82786
  };
@@ -82760,6 +82821,7 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
82760
82821
  connectToMySQL = async (it) => {
82761
82822
  const result = parseMysqlCredentials(it);
82762
82823
  if (await checkPackage("mysql2")) {
82824
+ console.log(withStyle.info(`Using 'mysql2' driver for database querying`));
82763
82825
  const { createConnection } = await import("mysql2/promise");
82764
82826
  const { drizzle } = await import("drizzle-orm/mysql2");
82765
82827
  const { migrate: migrate2 } = await import("drizzle-orm/mysql2/migrator");
@@ -82801,9 +82863,9 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
82801
82863
  results.push(res[0]);
82802
82864
  }
82803
82865
  await connection.commit();
82804
- } catch (error2) {
82866
+ } catch (error3) {
82805
82867
  await connection.rollback();
82806
- results.push(error2);
82868
+ results.push(error3);
82807
82869
  }
82808
82870
  return results;
82809
82871
  };
@@ -82817,6 +82879,7 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
82817
82879
  };
82818
82880
  }
82819
82881
  if (await checkPackage("@planetscale/database")) {
82882
+ console.log(withStyle.info(`Using '@planetscale/database' driver for database querying`));
82820
82883
  const { Client } = await import("@planetscale/database");
82821
82884
  const { drizzle } = await import("drizzle-orm/planetscale-serverless");
82822
82885
  const { migrate: migrate2 } = await import("drizzle-orm/planetscale-serverless/migrator");
@@ -82846,8 +82909,8 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
82846
82909
  results.push(res.rows);
82847
82910
  }
82848
82911
  });
82849
- } catch (error2) {
82850
- results.push(error2);
82912
+ } catch (error3) {
82913
+ results.push(error3);
82851
82914
  }
82852
82915
  return results;
82853
82916
  };
@@ -82860,8 +82923,57 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
82860
82923
  migrate: migrateFn
82861
82924
  };
82862
82925
  }
82926
+ if (await checkPackage("bun")) {
82927
+ console.log(withStyle.info(`Using 'bun' driver for database querying`));
82928
+ const { SQL: SQL6 } = await import("bun");
82929
+ const { drizzle } = await import("drizzle-orm/bun-sql");
82930
+ const { migrate: migrate2 } = await import("drizzle-orm/bun-sql/migrator");
82931
+ const ssl = result.credentials && "ssl" in result.credentials ? result.credentials.ssl === "prefer" || result.credentials.ssl === "require" || result.credentials.ssl === "allow" ? true : false : void 0;
82932
+ const client = result.url ? new SQL6(result.url) : new SQL6({
82933
+ adapter: "mysql",
82934
+ ...result.credentials,
82935
+ ssl
82936
+ });
82937
+ const db = drizzle(client);
82938
+ const migrateFn = async (config) => {
82939
+ return migrate2(db, config);
82940
+ };
82941
+ const query = async (sql, params) => {
82942
+ const result2 = await client.unsafe(sql, params ?? []);
82943
+ return result2;
82944
+ };
82945
+ const proxy = async (params) => {
82946
+ const query2 = client.unsafe(params.sql, params.params);
82947
+ if (params.mode === "array") {
82948
+ return await query2.values();
82949
+ }
82950
+ return await query2;
82951
+ };
82952
+ const transactionProxy = async (queries) => {
82953
+ const results = [];
82954
+ try {
82955
+ await client.transaction(async (tx) => {
82956
+ for (const query2 of queries) {
82957
+ const result2 = await tx.unsafe(query2.sql);
82958
+ results.push(result2);
82959
+ }
82960
+ });
82961
+ } catch (error3) {
82962
+ results.push(error3);
82963
+ }
82964
+ return results;
82965
+ };
82966
+ return {
82967
+ packageName: "bun",
82968
+ db: { query },
82969
+ proxy,
82970
+ transactionProxy,
82971
+ migrate: migrateFn,
82972
+ database: result.database
82973
+ };
82974
+ }
82863
82975
  console.error(
82864
- "To connect to MySQL database - please install either of 'mysql2' or '@planetscale/database' drivers"
82976
+ "To connect to MySQL database - please install either of 'mysql2', 'bun' or '@planetscale/database' drivers"
82865
82977
  );
82866
82978
  process.exit(1);
82867
82979
  };
@@ -82948,21 +83060,19 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
82948
83060
  return migrate2(
82949
83061
  drzl,
82950
83062
  async (queries) => {
82951
- for (const query of queries) {
82952
- await remoteCallback(query, [], "run");
83063
+ for (const query2 of queries) {
83064
+ await remoteCallback(query2, [], "run");
82953
83065
  }
82954
83066
  },
82955
83067
  config
82956
83068
  );
82957
83069
  };
82958
- const db = {
82959
- query: async (sql, params) => {
82960
- const res = await remoteCallback(sql, params || [], "all");
82961
- return res.rows;
82962
- },
82963
- run: async (query) => {
82964
- await remoteCallback(query, [], "run");
82965
- }
83070
+ const query = async (sql, params) => {
83071
+ const res = await remoteCallback(sql, params || [], "all");
83072
+ return res.rows;
83073
+ };
83074
+ const run2 = async (query2) => {
83075
+ await remoteCallback(query2, [], "run");
82966
83076
  };
82967
83077
  const proxy = async (params) => {
82968
83078
  const preparedParams = prepareSqliteParams(params.params || [], "d1-http");
@@ -82977,12 +83087,90 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
82977
83087
  const result = await remoteBatchCallback(queries);
82978
83088
  return result.rows;
82979
83089
  };
82980
- return { ...db, packageName: "d1-http", proxy, transactionProxy, migrate: migrateFn };
83090
+ return { query, run: run2, packageName: "d1-http", proxy, transactionProxy, migrate: migrateFn };
83091
+ } else if (driver2 === "sqlite-cloud") {
83092
+ assertPackages("@sqlitecloud/drivers");
83093
+ const { Database } = await import("@sqlitecloud/drivers");
83094
+ const { drizzle } = await import("drizzle-orm/sqlite-cloud");
83095
+ const { migrate: migrate2 } = await import("drizzle-orm/sqlite-cloud/migrator");
83096
+ const client = new Database(credentials2.url);
83097
+ const drzl = drizzle(client);
83098
+ const migrateFn = async (config) => {
83099
+ return migrate2(drzl, config);
83100
+ };
83101
+ const query = async (sql, params) => {
83102
+ const stmt = client.prepare(sql).bind(params || []);
83103
+ return await new Promise((resolve2, reject) => {
83104
+ stmt.all((e4, d3) => {
83105
+ if (e4) return reject(e4);
83106
+ return resolve2(d3.map((v6) => Object.fromEntries(Object.entries(v6))));
83107
+ });
83108
+ });
83109
+ };
83110
+ const run2 = async (query2) => {
83111
+ return await new Promise((resolve2, reject) => {
83112
+ client.exec(query2, (e4) => {
83113
+ if (e4) return reject(e4);
83114
+ return resolve2();
83115
+ });
83116
+ });
83117
+ };
83118
+ const proxy = async (params) => {
83119
+ const preparedParams = prepareSqliteParams(params.params || []);
83120
+ const stmt = client.prepare(params.sql).bind(preparedParams);
83121
+ return await new Promise((resolve2, reject) => {
83122
+ stmt.all((e4, d3) => {
83123
+ if (e4) return reject(e4);
83124
+ if (params.mode === "array") {
83125
+ return resolve2((d3 || []).map((v6) => v6.getData()));
83126
+ } else {
83127
+ return resolve2((d3 || []).map((v6) => Object.fromEntries(Object.entries(v6))));
83128
+ }
83129
+ });
83130
+ });
83131
+ };
83132
+ const transactionProxy = async (queries) => {
83133
+ const results = [];
83134
+ try {
83135
+ await new Promise((resolve2, reject) => {
83136
+ client.exec("BEGIN", (e4) => {
83137
+ if (e4) return reject(e4);
83138
+ return resolve2();
83139
+ });
83140
+ });
83141
+ for (const query2 of queries) {
83142
+ const result = await new Promise((resolve2, reject) => {
83143
+ client.all(query2.sql, (e4, d3) => {
83144
+ if (e4) return reject(e4);
83145
+ return resolve2((d3 || []).map((v6) => Object.fromEntries(Object.entries(v6))));
83146
+ });
83147
+ });
83148
+ results.push(result);
83149
+ }
83150
+ await new Promise((resolve2, reject) => {
83151
+ client.exec("COMMIT", (e4) => {
83152
+ if (e4) return reject(e4);
83153
+ return resolve2();
83154
+ });
83155
+ });
83156
+ } catch (error3) {
83157
+ results.push(error3);
83158
+ await new Promise((resolve2, reject) => {
83159
+ client.exec("ROLLBACK", (e4) => {
83160
+ if (e4) return reject(e4);
83161
+ return resolve2();
83162
+ });
83163
+ });
83164
+ }
83165
+ return results;
83166
+ };
83167
+ return { query, run: run2, packageName: "@sqlitecloud/drivers", proxy, transactionProxy, migrate: migrateFn };
82981
83168
  } else {
82982
83169
  assertUnreachable(driver2);
82983
83170
  }
82984
83171
  }
82985
83172
  if (await checkPackage("@libsql/client")) {
83173
+ console.log(withStyle.info(`Using '@libsql/client' driver for database querying`));
82986
83174
  const { createClient } = await import("@libsql/client");
82987
83175
  const { drizzle } = await import("drizzle-orm/libsql");
82988
83176
  const { migrate: migrate2 } = await import("drizzle-orm/libsql/migrator");
@@ -82993,14 +83181,12 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
82993
83181
  const migrateFn = async (config) => {
82994
83182
  return migrate2(drzl, config);
82995
83183
  };
82996
- const db = {
82997
- query: async (sql, params) => {
82998
- const res = await client.execute({ sql, args: params || [] });
82999
- return res.rows;
83000
- },
83001
- run: async (query) => {
83002
- await client.execute(query);
83003
- }
83184
+ const query = async (sql, params) => {
83185
+ const res = await client.execute({ sql, args: params || [] });
83186
+ return res.rows;
83187
+ };
83188
+ const run2 = async (query2) => {
83189
+ await client.execute(query2);
83004
83190
  };
83005
83191
  const proxy = async (params) => {
83006
83192
  const preparedParams = prepareSqliteParams(params.params || []);
@@ -83019,22 +83205,23 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
83019
83205
  let transaction = null;
83020
83206
  try {
83021
83207
  transaction = await client.transaction();
83022
- for (const query of queries) {
83023
- const result = await transaction.execute(query.sql);
83208
+ for (const query2 of queries) {
83209
+ const result = await transaction.execute(query2.sql);
83024
83210
  results.push(result.rows);
83025
83211
  }
83026
83212
  await transaction.commit();
83027
- } catch (error2) {
83028
- results.push(error2);
83213
+ } catch (error3) {
83214
+ results.push(error3);
83029
83215
  await (transaction == null ? void 0 : transaction.rollback());
83030
83216
  } finally {
83031
83217
  transaction == null ? void 0 : transaction.close();
83032
83218
  }
83033
83219
  return results;
83034
83220
  };
83035
- return { ...db, packageName: "@libsql/client", proxy, transactionProxy, migrate: migrateFn };
83221
+ return { query, run: run2, packageName: "@libsql/client", proxy, transactionProxy, migrate: migrateFn };
83036
83222
  }
83037
83223
  if (await checkPackage("better-sqlite3")) {
83224
+ console.log(withStyle.info(`Using 'better-sqlite3' driver for database querying`));
83038
83225
  const { default: Database } = await import("better-sqlite3");
83039
83226
  const { drizzle } = await import("drizzle-orm/better-sqlite3");
83040
83227
  const { migrate: migrate2 } = await import("drizzle-orm/better-sqlite3/migrator");
@@ -83045,13 +83232,11 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
83045
83232
  const migrateFn = async (config) => {
83046
83233
  return migrate2(drzl, config);
83047
83234
  };
83048
- const db = {
83049
- query: async (sql, params = []) => {
83050
- return sqlite.prepare(sql).bind(params).all();
83051
- },
83052
- run: async (query) => {
83053
- sqlite.prepare(query).run();
83054
- }
83235
+ const query = async (sql, params = []) => {
83236
+ return sqlite.prepare(sql).bind(params).all();
83237
+ };
83238
+ const run2 = async (query2) => {
83239
+ sqlite.prepare(query2).run();
83055
83240
  };
83056
83241
  const proxy = async (params) => {
83057
83242
  const preparedParams = prepareSqliteParams(params.params || []);
@@ -83064,27 +83249,77 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
83064
83249
  const transactionProxy = async (queries) => {
83065
83250
  const results = [];
83066
83251
  const tx = sqlite.transaction((queries2) => {
83067
- for (const query of queries2) {
83252
+ for (const query2 of queries2) {
83068
83253
  let result = [];
83069
- if (query.method === "values" || query.method === "get" || query.method === "all") {
83070
- result = sqlite.prepare(query.sql).all();
83254
+ if (query2.method === "values" || query2.method === "get" || query2.method === "all") {
83255
+ result = sqlite.prepare(query2.sql).all();
83071
83256
  } else {
83072
- sqlite.prepare(query.sql).run();
83257
+ sqlite.prepare(query2.sql).run();
83073
83258
  }
83074
83259
  results.push(result);
83075
83260
  }
83076
83261
  });
83077
83262
  try {
83078
83263
  tx(queries);
83079
- } catch (error2) {
83080
- results.push(error2);
83264
+ } catch (error3) {
83265
+ results.push(error3);
83081
83266
  }
83082
83267
  return results;
83083
83268
  };
83084
- return { ...db, packageName: "better-sqlite3", proxy, transactionProxy, migrate: migrateFn };
83269
+ return { query, run: run2, packageName: "better-sqlite3", proxy, transactionProxy, migrate: migrateFn };
83270
+ }
83271
+ if (await checkPackage("bun")) {
83272
+ console.log(withStyle.info(`Using 'bun' driver for database querying`));
83273
+ const { SQL: SQL6 } = await import("bun");
83274
+ const { drizzle } = await import("drizzle-orm/bun-sql");
83275
+ const { migrate: migrate2 } = await import("drizzle-orm/bun-sql/migrator");
83276
+ const client = new SQL6({
83277
+ adapter: "sqlite",
83278
+ filename: normaliseSQLiteUrl(credentials2.url, "bun")
83279
+ });
83280
+ const db = drizzle(client);
83281
+ const migrateFn = async (config) => {
83282
+ return migrate2(db, config);
83283
+ };
83284
+ const query = async (sql, params) => {
83285
+ const result = await client.unsafe(sql, params ?? []);
83286
+ return result;
83287
+ };
83288
+ const run2 = async (sql) => {
83289
+ await client.unsafe(sql);
83290
+ };
83291
+ const proxy = async (params) => {
83292
+ const query2 = client.unsafe(params.sql, params.params);
83293
+ if (params.mode === "array") {
83294
+ return await query2.values();
83295
+ }
83296
+ return await query2;
83297
+ };
83298
+ const transactionProxy = async (queries) => {
83299
+ const results = [];
83300
+ try {
83301
+ await client.transaction(async (tx) => {
83302
+ for (const query2 of queries) {
83303
+ const result = await tx.unsafe(query2.sql);
83304
+ results.push(result);
83305
+ }
83306
+ });
83307
+ } catch (error3) {
83308
+ results.push(error3);
83309
+ }
83310
+ return results;
83311
+ };
83312
+ return {
83313
+ packageName: "bun",
83314
+ query,
83315
+ run: run2,
83316
+ proxy,
83317
+ transactionProxy,
83318
+ migrate: migrateFn
83319
+ };
83085
83320
  }
83086
83321
  console.log(
83087
- "Please install either 'better-sqlite3' or '@libsql/client' for Drizzle Kit to connect to SQLite databases"
83322
+ "Please install either 'better-sqlite3', '@libsql/client' or 'bun' for Drizzle Kit to connect to SQLite databases"
83088
83323
  );
83089
83324
  process.exit(1);
83090
83325
  };
@@ -83135,8 +83370,8 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
83135
83370
  results.push(result.rows);
83136
83371
  }
83137
83372
  await transaction.commit();
83138
- } catch (error2) {
83139
- results.push(error2);
83373
+ } catch (error3) {
83374
+ results.push(error3);
83140
83375
  await (transaction == null ? void 0 : transaction.rollback());
83141
83376
  } finally {
83142
83377
  transaction == null ? void 0 : transaction.close();
@@ -89973,9 +90208,11 @@ var init_introspect = __esm({
89973
90208
  init_utils2();
89974
90209
  init_views();
89975
90210
  init_migrate();
89976
- introspectPostgres = async (casing2, out, breakpoints, credentials2, tablesFilter, schemasFilter, prefix2, entities) => {
89977
- const { preparePostgresDB: preparePostgresDB2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
89978
- const db = await preparePostgresDB2(credentials2);
90211
+ introspectPostgres = async (casing2, out, breakpoints, credentials2, tablesFilter, schemasFilter, prefix2, entities, db) => {
90212
+ if (!db) {
90213
+ const { preparePostgresDB: preparePostgresDB2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
90214
+ db = await preparePostgresDB2(credentials2);
90215
+ }
89979
90216
  const matchers = tablesFilter.map((it) => {
89980
90217
  return new Minimatch(it);
89981
90218
  });
@@ -90065,11 +90302,12 @@ var init_introspect = __esm({
90065
90302
  relationsFile
90066
90303
  )} \u{1F680}`
90067
90304
  );
90068
- process.exit(0);
90069
90305
  };
90070
- introspectGel = async (casing2, out, breakpoints, credentials2, tablesFilter, schemasFilter, prefix2, entities) => {
90071
- const { prepareGelDB: prepareGelDB2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
90072
- const db = await prepareGelDB2(credentials2);
90306
+ introspectGel = async (casing2, out, breakpoints, credentials2, tablesFilter, schemasFilter, prefix2, entities, db) => {
90307
+ if (!db) {
90308
+ const { prepareGelDB: prepareGelDB2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
90309
+ db = await prepareGelDB2(credentials2);
90310
+ }
90073
90311
  const matchers = tablesFilter.map((it) => {
90074
90312
  return new Minimatch(it);
90075
90313
  });
@@ -90125,11 +90363,12 @@ var init_introspect = __esm({
90125
90363
  relationsFile
90126
90364
  )} \u{1F680}`
90127
90365
  );
90128
- process.exit(0);
90129
90366
  };
90130
- introspectMysql = async (casing2, out, breakpoints, credentials2, tablesFilter, prefix2) => {
90131
- const { connectToMySQL: connectToMySQL2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
90132
- const { db, database } = await connectToMySQL2(credentials2);
90367
+ introspectMysql = async (casing2, out, breakpoints, credentials2, tablesFilter, prefix2, connection) => {
90368
+ if (!connection) {
90369
+ const { connectToMySQL: connectToMySQL2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
90370
+ connection = await connectToMySQL2(credentials2);
90371
+ }
90133
90372
  const matchers = tablesFilter.map((it) => {
90134
90373
  return new Minimatch(it);
90135
90374
  });
@@ -90154,7 +90393,7 @@ var init_introspect = __esm({
90154
90393
  const progress = new IntrospectProgress();
90155
90394
  const res = await (0, import_hanji14.renderWithTask)(
90156
90395
  progress,
90157
- fromDatabase(db, database, filter2, (stage, count, status) => {
90396
+ fromDatabase(connection.db, connection.database, filter2, (stage, count, status) => {
90158
90397
  progress.update(stage, count, status);
90159
90398
  })
90160
90399
  );
@@ -90207,11 +90446,12 @@ var init_introspect = __esm({
90207
90446
  relationsFile
90208
90447
  )} \u{1F680}`
90209
90448
  );
90210
- process.exit(0);
90211
90449
  };
90212
- introspectSingleStore = async (casing2, out, breakpoints, credentials2, tablesFilter, prefix2) => {
90213
- const { connectToSingleStore: connectToSingleStore2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
90214
- const { db, database } = await connectToSingleStore2(credentials2);
90450
+ introspectSingleStore = async (casing2, out, breakpoints, credentials2, tablesFilter, prefix2, connection) => {
90451
+ if (!connection) {
90452
+ const { connectToSingleStore: connectToSingleStore2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
90453
+ connection = await connectToSingleStore2(credentials2);
90454
+ }
90215
90455
  const matchers = tablesFilter.map((it) => {
90216
90456
  return new Minimatch(it);
90217
90457
  });
@@ -90236,7 +90476,7 @@ var init_introspect = __esm({
90236
90476
  const progress = new IntrospectProgress();
90237
90477
  const res = await (0, import_hanji14.renderWithTask)(
90238
90478
  progress,
90239
- fromDatabase4(db, database, filter2, (stage, count, status) => {
90479
+ fromDatabase4(connection.db, connection.database, filter2, (stage, count, status) => {
90240
90480
  progress.update(stage, count, status);
90241
90481
  })
90242
90482
  );
@@ -90279,11 +90519,12 @@ var init_introspect = __esm({
90279
90519
  "\u2713"
90280
90520
  )}] You schema file is ready \u279C ${source_default.bold.underline.blue(schemaFile)} \u{1F680}`
90281
90521
  );
90282
- process.exit(0);
90283
90522
  };
90284
- introspectSqlite = async (casing2, out, breakpoints, credentials2, tablesFilter, prefix2) => {
90285
- const { connectToSQLite: connectToSQLite2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
90286
- const db = await connectToSQLite2(credentials2);
90523
+ introspectSqlite = async (casing2, out, breakpoints, credentials2, tablesFilter, prefix2, db) => {
90524
+ if (!db) {
90525
+ const { connectToSQLite: connectToSQLite2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
90526
+ db = await connectToSQLite2(credentials2);
90527
+ }
90287
90528
  const matchers = tablesFilter.map((it) => {
90288
90529
  return new Minimatch(it);
90289
90530
  });
@@ -90360,11 +90601,12 @@ var init_introspect = __esm({
90360
90601
  relationsFile
90361
90602
  )} \u{1F680}`
90362
90603
  );
90363
- process.exit(0);
90364
90604
  };
90365
- introspectLibSQL = async (casing2, out, breakpoints, credentials2, tablesFilter, prefix2) => {
90366
- const { connectToLibSQL: connectToLibSQL2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
90367
- const db = await connectToLibSQL2(credentials2);
90605
+ introspectLibSQL = async (casing2, out, breakpoints, credentials2, tablesFilter, prefix2, db) => {
90606
+ if (!db) {
90607
+ const { connectToLibSQL: connectToLibSQL2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
90608
+ db = await connectToLibSQL2(credentials2);
90609
+ }
90368
90610
  const matchers = tablesFilter.map((it) => {
90369
90611
  return new Minimatch(it);
90370
90612
  });
@@ -90441,7 +90683,6 @@ var init_introspect = __esm({
90441
90683
  relationsFile
90442
90684
  )} \u{1F680}`
90443
90685
  );
90444
- process.exit(0);
90445
90686
  };
90446
90687
  withCasing4 = (value, casing2) => {
90447
90688
  if (casing2 === "preserve") {
@@ -90645,11 +90886,11 @@ function writeFromReadableStream(stream, writable) {
90645
90886
  writable.off("close", cancel);
90646
90887
  writable.off("error", cancel);
90647
90888
  });
90648
- function cancel(error2) {
90649
- reader.cancel(error2).catch(() => {
90889
+ function cancel(error3) {
90890
+ reader.cancel(error3).catch(() => {
90650
90891
  });
90651
- if (error2) {
90652
- writable.destroy(error2);
90892
+ if (error3) {
90893
+ writable.destroy(error3);
90653
90894
  }
90654
90895
  }
90655
90896
  function onDrain() {
@@ -93035,7 +93276,7 @@ var init_compress2 = __esm({
93035
93276
  cacheControlNoTransformRegExp = /(?:^|,)\s*?no-transform\s*?(?:,|$)/i;
93036
93277
  compress = (options) => {
93037
93278
  const threshold = (options == null ? void 0 : options.threshold) ?? 1024;
93038
- return async function compress2(ctx, next) {
93279
+ return async function compress22(ctx, next) {
93039
93280
  await next();
93040
93281
  const contentLength = ctx.res.headers.get("Content-Length");
93041
93282
  if (ctx.res.headers.has("Content-Encoding") || ctx.res.headers.has("Transfer-Encoding") || ctx.req.method === "HEAD" || contentLength && Number(contentLength) < threshold || !shouldCompress(ctx.res) || !shouldTransform(ctx.res)) {
@@ -93063,6 +93304,62 @@ var init_compress2 = __esm({
93063
93304
  }
93064
93305
  });
93065
93306
 
93307
+ // ../node_modules/.pnpm/@hono+bun-compress@0.1.0_hono@4.7.11/node_modules/@hono/bun-compress/dist/index.js
93308
+ var import_node_stream3, import_node_zlib2, ENCODING_TYPES2, cacheControlNoTransformRegExp2, compress2, shouldCompress2, shouldTransform2;
93309
+ var init_dist4 = __esm({
93310
+ "../node_modules/.pnpm/@hono+bun-compress@0.1.0_hono@4.7.11/node_modules/@hono/bun-compress/dist/index.js"() {
93311
+ init_compress2();
93312
+ init_compress();
93313
+ import_node_stream3 = require("node:stream");
93314
+ import_node_zlib2 = require("node:zlib");
93315
+ ENCODING_TYPES2 = ["gzip", "deflate"];
93316
+ cacheControlNoTransformRegExp2 = /(?:^|,)\s*?no-transform\s*?(?:,|$)/i;
93317
+ compress2 = (options) => {
93318
+ if (typeof CompressionStream !== "undefined") {
93319
+ return compress(options);
93320
+ }
93321
+ const threshold = (options == null ? void 0 : options.threshold) ?? 1024;
93322
+ return async function compress22(ctx, next) {
93323
+ await next();
93324
+ const contentLength = ctx.res.headers.get("Content-Length");
93325
+ if (ctx.res.headers.has("Content-Encoding") || // already encoded
93326
+ ctx.res.headers.has("Transfer-Encoding") || // already encoded or chunked
93327
+ ctx.req.method === "HEAD" || // HEAD request
93328
+ contentLength && Number(contentLength) < threshold || // content-length below threshold
93329
+ !shouldCompress2(ctx.res) || // not compressible type
93330
+ !shouldTransform2(ctx.res)) {
93331
+ return;
93332
+ }
93333
+ const accepted = ctx.req.header("Accept-Encoding");
93334
+ const encoding = (options == null ? void 0 : options.encoding) ?? ENCODING_TYPES2.find((encoding2) => accepted == null ? void 0 : accepted.includes(encoding2));
93335
+ if (!encoding || !ctx.res.body) {
93336
+ return;
93337
+ }
93338
+ try {
93339
+ const compressedStream = encoding === "gzip" ? (0, import_node_zlib2.createGzip)() : (0, import_node_zlib2.createDeflate)();
93340
+ const readableBody = ctx.res.body;
93341
+ const readableStream = import_node_stream3.Readable.fromWeb(readableBody);
93342
+ const compressedBody = readableStream.pipe(compressedStream);
93343
+ const compressedReadableStream = import_node_stream3.Readable.toWeb(compressedBody);
93344
+ ctx.res = new Response(compressedReadableStream, ctx.res);
93345
+ ctx.res.headers.delete("Content-Length");
93346
+ ctx.res.headers.set("Content-Encoding", encoding);
93347
+ } catch (error3) {
93348
+ console.error("Compression error:", error3);
93349
+ }
93350
+ };
93351
+ };
93352
+ shouldCompress2 = (res) => {
93353
+ const type = res.headers.get("Content-Type");
93354
+ return type && COMPRESSIBLE_CONTENT_TYPE_REGEX.test(type);
93355
+ };
93356
+ shouldTransform2 = (res) => {
93357
+ const cacheControl = res.headers.get("Cache-Control");
93358
+ return !cacheControl || !cacheControlNoTransformRegExp2.test(cacheControl);
93359
+ };
93360
+ }
93361
+ });
93362
+
93066
93363
  // ../node_modules/.pnpm/hono@4.7.11/node_modules/hono/dist/middleware/cors/index.js
93067
93364
  var cors;
93068
93365
  var init_cors = __esm({
@@ -93176,7 +93473,7 @@ var init_studio2 = __esm({
93176
93473
  import_sqlite_core3 = require("drizzle-orm/sqlite-core");
93177
93474
  import_fs12 = __toESM(require("fs"));
93178
93475
  init_dist3();
93179
- init_compress2();
93476
+ init_dist4();
93180
93477
  init_cors();
93181
93478
  import_node_https2 = require("node:https");
93182
93479
  init_global();
@@ -93395,6 +93692,8 @@ var init_studio2 = __esm({
93395
93692
  const { driver: driver2 } = credentials2;
93396
93693
  if (driver2 === "d1-http") {
93397
93694
  dbUrl = `d1-http://${credentials2.accountId}/${credentials2.databaseId}/${credentials2.token}`;
93695
+ } else if (driver2 === "sqlite-cloud") {
93696
+ dbUrl = credentials2.url;
93398
93697
  } else {
93399
93698
  assertUnreachable(driver2);
93400
93699
  }
@@ -93505,7 +93804,7 @@ var init_studio2 = __esm({
93505
93804
  refSchema: refSchema || "public",
93506
93805
  refColumns
93507
93806
  };
93508
- } catch (error2) {
93807
+ } catch (error3) {
93509
93808
  throw new Error(
93510
93809
  `Invalid relation "${relation.fieldName}" for table "${it.schema ? `${it.schema}.${it.dbName}` : it.dbName}"`
93511
93810
  );
@@ -93593,7 +93892,7 @@ var init_studio2 = __esm({
93593
93892
  schemaFiles
93594
93893
  }, app) => {
93595
93894
  app = app !== void 0 ? app : new Hono2();
93596
- app.use(compress());
93895
+ app.use(compress2());
93597
93896
  app.use(async (ctx, next) => {
93598
93897
  await next();
93599
93898
  ctx.header("Access-Control-Allow-Private-Network", "true");
@@ -93635,7 +93934,7 @@ var init_studio2 = __esm({
93635
93934
  let relations6 = [];
93636
93935
  try {
93637
93936
  relations6 = extractRelations(relationsConfig, casing2);
93638
- } catch (error2) {
93937
+ } catch (error3) {
93639
93938
  console.warn(
93640
93939
  "Failed to extract relations. This is likely due to ambiguous or misconfigured relations."
93641
93940
  );
@@ -93645,7 +93944,7 @@ var init_studio2 = __esm({
93645
93944
  console.warn(
93646
93945
  "See: https://orm.drizzle.team/docs/relations#disambiguating-relations"
93647
93946
  );
93648
- console.warn("Error message:", error2.message);
93947
+ console.warn("Error message:", error3.message);
93649
93948
  }
93650
93949
  return c3.json({
93651
93950
  version: "6.2",
@@ -95220,8 +95519,8 @@ var import_node_child_process = require("node:child_process");
95220
95519
  var import_path2 = require("path");
95221
95520
  function runCommand(command, options = {}) {
95222
95521
  return new Promise((resolve2) => {
95223
- (0, import_node_child_process.exec)(command, options, (error2) => {
95224
- return resolve2({ exitCode: (error2 == null ? void 0 : error2.code) ?? 0 });
95522
+ (0, import_node_child_process.exec)(command, options, (error3) => {
95523
+ return resolve2({ exitCode: (error3 == null ? void 0 : error3.code) ?? 0 });
95225
95524
  });
95226
95525
  });
95227
95526
  }
@@ -95532,12 +95831,7 @@ var generate = command2({
95532
95831
  } else if (dialect6 === "singlestore") {
95533
95832
  await prepareAndMigrateSingleStore2(opts);
95534
95833
  } else if (dialect6 === "gel") {
95535
- console.log(
95536
- error(
95537
- `You can't use 'generate' command with Gel dialect`
95538
- )
95539
- );
95540
- process.exit(1);
95834
+ throw new Error(`You can't use 'generate' command with Gel dialect`);
95541
95835
  } else {
95542
95836
  assertUnreachable(dialect6);
95543
95837
  }
@@ -95555,97 +95849,86 @@ var migrate = command2({
95555
95849
  await assertOrmCoreVersion();
95556
95850
  await assertPackages("drizzle-orm");
95557
95851
  const { dialect: dialect6, schema: schema6, table: table6, out, credentials: credentials2 } = opts;
95558
- try {
95559
- if (dialect6 === "postgresql") {
95560
- if ("driver" in credentials2) {
95561
- const { driver: driver2 } = credentials2;
95562
- if (driver2 === "aws-data-api") {
95563
- if (!await ormVersionGt("0.30.10")) {
95564
- console.log(
95565
- "To use 'aws-data-api' driver - please update drizzle-orm to the latest version"
95566
- );
95567
- process.exit(1);
95568
- }
95569
- } else if (driver2 === "pglite") {
95570
- if (!await ormVersionGt("0.30.6")) {
95571
- console.log(
95572
- "To use 'pglite' driver - please update drizzle-orm to the latest version"
95573
- );
95574
- process.exit(1);
95575
- }
95576
- } else {
95577
- assertUnreachable(driver2);
95852
+ if (dialect6 === "postgresql") {
95853
+ if ("driver" in credentials2) {
95854
+ const { driver: driver2 } = credentials2;
95855
+ if (driver2 === "aws-data-api") {
95856
+ if (!await ormVersionGt("0.30.10")) {
95857
+ console.log(
95858
+ "To use 'aws-data-api' driver - please update drizzle-orm to the latest version"
95859
+ );
95860
+ process.exit(1);
95578
95861
  }
95862
+ } else if (driver2 === "pglite") {
95863
+ if (!await ormVersionGt("0.30.6")) {
95864
+ console.log(
95865
+ "To use 'pglite' driver - please update drizzle-orm to the latest version"
95866
+ );
95867
+ process.exit(1);
95868
+ }
95869
+ } else {
95870
+ assertUnreachable(driver2);
95579
95871
  }
95580
- const { preparePostgresDB: preparePostgresDB2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
95581
- const { migrate: migrate2 } = await preparePostgresDB2(credentials2);
95582
- await (0, import_hanji15.renderWithTask)(
95583
- new MigrateProgress(),
95584
- migrate2({
95585
- migrationsFolder: out,
95586
- migrationsTable: table6,
95587
- migrationsSchema: schema6
95588
- })
95589
- );
95590
- } else if (dialect6 === "mysql") {
95591
- const { connectToMySQL: connectToMySQL2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
95592
- const { migrate: migrate2 } = await connectToMySQL2(credentials2);
95593
- await (0, import_hanji15.renderWithTask)(
95594
- new MigrateProgress(),
95595
- migrate2({
95596
- migrationsFolder: out,
95597
- migrationsTable: table6,
95598
- migrationsSchema: schema6
95599
- })
95600
- );
95601
- } else if (dialect6 === "singlestore") {
95602
- const { connectToSingleStore: connectToSingleStore2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
95603
- const { migrate: migrate2 } = await connectToSingleStore2(credentials2);
95604
- await (0, import_hanji15.renderWithTask)(
95605
- new MigrateProgress(),
95606
- migrate2({
95607
- migrationsFolder: out,
95608
- migrationsTable: table6,
95609
- migrationsSchema: schema6
95610
- })
95611
- );
95612
- } else if (dialect6 === "sqlite") {
95613
- const { connectToSQLite: connectToSQLite2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
95614
- const { migrate: migrate2 } = await connectToSQLite2(credentials2);
95615
- await (0, import_hanji15.renderWithTask)(
95616
- new MigrateProgress(),
95617
- migrate2({
95618
- migrationsFolder: opts.out,
95619
- migrationsTable: table6,
95620
- migrationsSchema: schema6
95621
- })
95622
- );
95623
- } else if (dialect6 === "turso") {
95624
- const { connectToLibSQL: connectToLibSQL2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
95625
- const { migrate: migrate2 } = await connectToLibSQL2(credentials2);
95626
- await (0, import_hanji15.renderWithTask)(
95627
- new MigrateProgress(),
95628
- migrate2({
95629
- migrationsFolder: opts.out,
95630
- migrationsTable: table6,
95631
- migrationsSchema: schema6
95632
- })
95633
- );
95634
- } else if (dialect6 === "gel") {
95635
- console.log(
95636
- error(
95637
- `You can't use 'migrate' command with Gel dialect`
95638
- )
95639
- );
95640
- process.exit(1);
95641
- } else {
95642
- assertUnreachable(dialect6);
95643
95872
  }
95644
- } catch (e4) {
95645
- console.error(e4);
95646
- process.exit(1);
95873
+ const { preparePostgresDB: preparePostgresDB2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
95874
+ const { migrate: migrate2 } = await preparePostgresDB2(credentials2);
95875
+ await (0, import_hanji15.renderWithTask)(
95876
+ new MigrateProgress(),
95877
+ migrate2({
95878
+ migrationsFolder: out,
95879
+ migrationsTable: table6,
95880
+ migrationsSchema: schema6
95881
+ })
95882
+ );
95883
+ } else if (dialect6 === "mysql") {
95884
+ const { connectToMySQL: connectToMySQL2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
95885
+ const { migrate: migrate2 } = await connectToMySQL2(credentials2);
95886
+ await (0, import_hanji15.renderWithTask)(
95887
+ new MigrateProgress(),
95888
+ migrate2({
95889
+ migrationsFolder: out,
95890
+ migrationsTable: table6,
95891
+ migrationsSchema: schema6
95892
+ })
95893
+ );
95894
+ } else if (dialect6 === "singlestore") {
95895
+ const { connectToSingleStore: connectToSingleStore2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
95896
+ const { migrate: migrate2 } = await connectToSingleStore2(credentials2);
95897
+ await (0, import_hanji15.renderWithTask)(
95898
+ new MigrateProgress(),
95899
+ migrate2({
95900
+ migrationsFolder: out,
95901
+ migrationsTable: table6,
95902
+ migrationsSchema: schema6
95903
+ })
95904
+ );
95905
+ } else if (dialect6 === "sqlite") {
95906
+ const { connectToSQLite: connectToSQLite2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
95907
+ const { migrate: migrate2 } = await connectToSQLite2(credentials2);
95908
+ await (0, import_hanji15.renderWithTask)(
95909
+ new MigrateProgress(),
95910
+ migrate2({
95911
+ migrationsFolder: opts.out,
95912
+ migrationsTable: table6,
95913
+ migrationsSchema: schema6
95914
+ })
95915
+ );
95916
+ } else if (dialect6 === "turso") {
95917
+ const { connectToLibSQL: connectToLibSQL2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
95918
+ const { migrate: migrate2 } = await connectToLibSQL2(credentials2);
95919
+ await (0, import_hanji15.renderWithTask)(
95920
+ new MigrateProgress(),
95921
+ migrate2({
95922
+ migrationsFolder: opts.out,
95923
+ migrationsTable: table6,
95924
+ migrationsSchema: schema6
95925
+ })
95926
+ );
95927
+ } else if (dialect6 === "gel") {
95928
+ throw new Error(`You can't use 'migrate' command with Gel dialect`);
95929
+ } else {
95930
+ assertUnreachable(dialect6);
95647
95931
  }
95648
- process.exit(0);
95649
95932
  }
95650
95933
  });
95651
95934
  var optionsFilters = {
@@ -95726,98 +96009,88 @@ var push = command2({
95726
96009
  casing: casing2,
95727
96010
  entities
95728
96011
  } = config;
95729
- try {
95730
- if (dialect6 === "mysql") {
95731
- const { mysqlPush: mysqlPush2 } = await Promise.resolve().then(() => (init_push(), push_exports));
95732
- await mysqlPush2(
95733
- schemaPath,
95734
- credentials2,
95735
- tablesFilter,
95736
- strict,
95737
- verbose,
95738
- force,
95739
- casing2
95740
- );
95741
- } else if (dialect6 === "postgresql") {
95742
- if ("driver" in credentials2) {
95743
- const { driver: driver2 } = credentials2;
95744
- if (driver2 === "aws-data-api") {
95745
- if (!await ormVersionGt("0.30.10")) {
95746
- console.log(
95747
- "To use 'aws-data-api' driver - please update drizzle-orm to the latest version"
95748
- );
95749
- process.exit(1);
95750
- }
95751
- } else if (driver2 === "pglite") {
95752
- if (!await ormVersionGt("0.30.6")) {
95753
- console.log(
95754
- "To use 'pglite' driver - please update drizzle-orm to the latest version"
95755
- );
95756
- process.exit(1);
95757
- }
95758
- } else {
95759
- assertUnreachable(driver2);
96012
+ if (dialect6 === "mysql") {
96013
+ const { mysqlPush: mysqlPush2 } = await Promise.resolve().then(() => (init_push(), push_exports));
96014
+ await mysqlPush2(
96015
+ schemaPath,
96016
+ credentials2,
96017
+ tablesFilter,
96018
+ strict,
96019
+ verbose,
96020
+ force,
96021
+ casing2
96022
+ );
96023
+ } else if (dialect6 === "postgresql") {
96024
+ if ("driver" in credentials2) {
96025
+ const { driver: driver2 } = credentials2;
96026
+ if (driver2 === "aws-data-api") {
96027
+ if (!await ormVersionGt("0.30.10")) {
96028
+ console.log(
96029
+ "To use 'aws-data-api' driver - please update drizzle-orm to the latest version"
96030
+ );
96031
+ process.exit(1);
96032
+ }
96033
+ } else if (driver2 === "pglite") {
96034
+ if (!await ormVersionGt("0.30.6")) {
96035
+ console.log(
96036
+ "To use 'pglite' driver - please update drizzle-orm to the latest version"
96037
+ );
96038
+ process.exit(1);
95760
96039
  }
96040
+ } else {
96041
+ assertUnreachable(driver2);
95761
96042
  }
95762
- const { pgPush: pgPush2 } = await Promise.resolve().then(() => (init_push(), push_exports));
95763
- await pgPush2(
95764
- schemaPath,
95765
- verbose,
95766
- strict,
95767
- credentials2,
95768
- tablesFilter,
95769
- schemasFilter,
95770
- entities,
95771
- force,
95772
- casing2
95773
- );
95774
- } else if (dialect6 === "sqlite") {
95775
- const { sqlitePush: sqlitePush2 } = await Promise.resolve().then(() => (init_push(), push_exports));
95776
- await sqlitePush2(
95777
- schemaPath,
95778
- verbose,
95779
- strict,
95780
- credentials2,
95781
- tablesFilter,
95782
- force,
95783
- casing2
95784
- );
95785
- } else if (dialect6 === "turso") {
95786
- const { libSQLPush: libSQLPush2 } = await Promise.resolve().then(() => (init_push(), push_exports));
95787
- await libSQLPush2(
95788
- schemaPath,
95789
- verbose,
95790
- strict,
95791
- credentials2,
95792
- tablesFilter,
95793
- force,
95794
- casing2
95795
- );
95796
- } else if (dialect6 === "singlestore") {
95797
- const { singlestorePush: singlestorePush2 } = await Promise.resolve().then(() => (init_push(), push_exports));
95798
- await singlestorePush2(
95799
- schemaPath,
95800
- credentials2,
95801
- tablesFilter,
95802
- strict,
95803
- verbose,
95804
- force,
95805
- casing2
95806
- );
95807
- } else if (dialect6 === "gel") {
95808
- console.log(
95809
- error(
95810
- `You can't use 'push' command with Gel dialect`
95811
- )
95812
- );
95813
- process.exit(1);
95814
- } else {
95815
- assertUnreachable(dialect6);
95816
96043
  }
95817
- } catch (e4) {
95818
- console.error(e4);
96044
+ const { pgPush: pgPush2 } = await Promise.resolve().then(() => (init_push(), push_exports));
96045
+ await pgPush2(
96046
+ schemaPath,
96047
+ verbose,
96048
+ strict,
96049
+ credentials2,
96050
+ tablesFilter,
96051
+ schemasFilter,
96052
+ entities,
96053
+ force,
96054
+ casing2
96055
+ );
96056
+ } else if (dialect6 === "sqlite") {
96057
+ const { sqlitePush: sqlitePush2 } = await Promise.resolve().then(() => (init_push(), push_exports));
96058
+ await sqlitePush2(
96059
+ schemaPath,
96060
+ verbose,
96061
+ strict,
96062
+ credentials2,
96063
+ tablesFilter,
96064
+ force,
96065
+ casing2
96066
+ );
96067
+ } else if (dialect6 === "turso") {
96068
+ const { libSQLPush: libSQLPush2 } = await Promise.resolve().then(() => (init_push(), push_exports));
96069
+ await libSQLPush2(
96070
+ schemaPath,
96071
+ verbose,
96072
+ strict,
96073
+ credentials2,
96074
+ tablesFilter,
96075
+ force,
96076
+ casing2
96077
+ );
96078
+ } else if (dialect6 === "singlestore") {
96079
+ const { singlestorePush: singlestorePush2 } = await Promise.resolve().then(() => (init_push(), push_exports));
96080
+ await singlestorePush2(
96081
+ schemaPath,
96082
+ credentials2,
96083
+ tablesFilter,
96084
+ strict,
96085
+ verbose,
96086
+ force,
96087
+ casing2
96088
+ );
96089
+ } else if (dialect6 === "gel") {
96090
+ throw new Error(`You can't use 'push' command with Gel dialect`);
96091
+ } else {
96092
+ assertUnreachable(dialect6);
95819
96093
  }
95820
- process.exit(0);
95821
96094
  }
95822
96095
  });
95823
96096
  var check = command2({
@@ -95866,12 +96139,7 @@ var up = command2({
95866
96139
  upSinglestoreHandler(out);
95867
96140
  }
95868
96141
  if (dialect6 === "gel") {
95869
- console.log(
95870
- error(
95871
- `You can't use 'up' command with Gel dialect`
95872
- )
95873
- );
95874
- process.exit(1);
96142
+ throw new Error(`You can't use 'up' command with Gel dialect`);
95875
96143
  }
95876
96144
  }
95877
96145
  });
@@ -95884,6 +96152,7 @@ var pull = command2({
95884
96152
  out: optionOut,
95885
96153
  breakpoints: optionBreakpoints,
95886
96154
  casing: string("introspect-casing").enum("camel", "preserve"),
96155
+ init: boolean("init").desc("Create migration metadata for pulled schema in database"),
95887
96156
  ...optionsFilters,
95888
96157
  ...optionsDatabaseCredentials
95889
96158
  },
@@ -95909,7 +96178,8 @@ var pull = command2({
95909
96178
  "tablesFilter",
95910
96179
  "schemaFilters",
95911
96180
  "extensionsFilters",
95912
- "tlsSecurity"
96181
+ "tlsSecurity",
96182
+ "init"
95913
96183
  ]
95914
96184
  );
95915
96185
  return preparePullConfig(opts, from);
@@ -95926,7 +96196,10 @@ var pull = command2({
95926
96196
  tablesFilter,
95927
96197
  schemasFilter,
95928
96198
  prefix: prefix2,
95929
- entities
96199
+ entities,
96200
+ init: init2,
96201
+ migrationsSchema,
96202
+ migrationsTable
95930
96203
  } = config;
95931
96204
  (0, import_fs13.mkdirSync)(out, { recursive: true });
95932
96205
  console.log(
@@ -95935,98 +96208,139 @@ var pull = command2({
95935
96208
  )
95936
96209
  );
95937
96210
  console.log();
95938
- try {
95939
- if (dialect6 === "postgresql") {
95940
- if ("driver" in credentials2) {
95941
- const { driver: driver2 } = credentials2;
95942
- if (driver2 === "aws-data-api") {
95943
- if (!await ormVersionGt("0.30.10")) {
95944
- console.log(
95945
- "To use 'aws-data-api' driver - please update drizzle-orm to the latest version"
95946
- );
95947
- process.exit(1);
95948
- }
95949
- } else if (driver2 === "pglite") {
95950
- if (!await ormVersionGt("0.30.6")) {
95951
- console.log(
95952
- "To use 'pglite' driver - please update drizzle-orm to the latest version"
95953
- );
95954
- process.exit(1);
95955
- }
95956
- } else {
95957
- assertUnreachable(driver2);
96211
+ let migrate2;
96212
+ if (dialect6 === "postgresql") {
96213
+ if ("driver" in credentials2) {
96214
+ const { driver: driver2 } = credentials2;
96215
+ if (driver2 === "aws-data-api") {
96216
+ if (!await ormVersionGt("0.30.10")) {
96217
+ console.log(
96218
+ "To use 'aws-data-api' driver - please update drizzle-orm to the latest version"
96219
+ );
96220
+ process.exit(1);
95958
96221
  }
96222
+ } else if (driver2 === "pglite") {
96223
+ if (!await ormVersionGt("0.30.6")) {
96224
+ console.log(
96225
+ "To use 'pglite' driver - please update drizzle-orm to the latest version"
96226
+ );
96227
+ process.exit(1);
96228
+ }
96229
+ } else {
96230
+ assertUnreachable(driver2);
96231
+ }
96232
+ }
96233
+ const { preparePostgresDB: preparePostgresDB2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
96234
+ const db = await preparePostgresDB2(credentials2);
96235
+ migrate2 = db.migrate;
96236
+ const { introspectPostgres: introspectPostgres2 } = await Promise.resolve().then(() => (init_introspect(), introspect_exports));
96237
+ await introspectPostgres2(
96238
+ casing2,
96239
+ out,
96240
+ breakpoints,
96241
+ credentials2,
96242
+ tablesFilter,
96243
+ schemasFilter,
96244
+ prefix2,
96245
+ entities,
96246
+ db
96247
+ );
96248
+ } else if (dialect6 === "mysql") {
96249
+ const { connectToMySQL: connectToMySQL2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
96250
+ const db = await connectToMySQL2(credentials2);
96251
+ migrate2 = db.migrate;
96252
+ const { introspectMysql: introspectMysql2 } = await Promise.resolve().then(() => (init_introspect(), introspect_exports));
96253
+ await introspectMysql2(
96254
+ casing2,
96255
+ out,
96256
+ breakpoints,
96257
+ credentials2,
96258
+ tablesFilter,
96259
+ prefix2,
96260
+ db
96261
+ );
96262
+ } else if (dialect6 === "sqlite") {
96263
+ const { connectToSQLite: connectToSQLite2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
96264
+ const db = await connectToSQLite2(credentials2);
96265
+ migrate2 = db.migrate;
96266
+ const { introspectSqlite: introspectSqlite2 } = await Promise.resolve().then(() => (init_introspect(), introspect_exports));
96267
+ await introspectSqlite2(
96268
+ casing2,
96269
+ out,
96270
+ breakpoints,
96271
+ credentials2,
96272
+ tablesFilter,
96273
+ prefix2,
96274
+ db
96275
+ );
96276
+ } else if (dialect6 === "turso") {
96277
+ const { connectToLibSQL: connectToLibSQL2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
96278
+ const db = await connectToLibSQL2(credentials2);
96279
+ migrate2 = db.migrate;
96280
+ const { introspectLibSQL: introspectLibSQL2 } = await Promise.resolve().then(() => (init_introspect(), introspect_exports));
96281
+ await introspectLibSQL2(
96282
+ casing2,
96283
+ out,
96284
+ breakpoints,
96285
+ credentials2,
96286
+ tablesFilter,
96287
+ prefix2,
96288
+ db
96289
+ );
96290
+ } else if (dialect6 === "singlestore") {
96291
+ const { connectToSingleStore: connectToSingleStore2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
96292
+ const db = await connectToSingleStore2(credentials2);
96293
+ migrate2 = db.migrate;
96294
+ const { introspectSingleStore: introspectSingleStore2 } = await Promise.resolve().then(() => (init_introspect(), introspect_exports));
96295
+ await introspectSingleStore2(
96296
+ casing2,
96297
+ out,
96298
+ breakpoints,
96299
+ credentials2,
96300
+ tablesFilter,
96301
+ prefix2,
96302
+ db
96303
+ );
96304
+ } else if (dialect6 === "gel") {
96305
+ const { prepareGelDB: prepareGelDB2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
96306
+ const db = await prepareGelDB2(credentials2);
96307
+ if (init2) throw new Error(`You can't use "--init" flag with Gel`);
96308
+ const { introspectGel: introspectGel2 } = await Promise.resolve().then(() => (init_introspect(), introspect_exports));
96309
+ await introspectGel2(
96310
+ casing2,
96311
+ out,
96312
+ breakpoints,
96313
+ credentials2,
96314
+ tablesFilter,
96315
+ schemasFilter,
96316
+ prefix2,
96317
+ entities,
96318
+ db
96319
+ );
96320
+ } else {
96321
+ assertUnreachable(dialect6);
96322
+ }
96323
+ if (init2) {
96324
+ if (!migrate2) throw new Error(`--init can't be used with ${dialect6}`);
96325
+ console.log();
96326
+ console.log(grey("Applying migration metadata to the database"));
96327
+ const migrateInput = {
96328
+ migrationsFolder: out,
96329
+ migrationsTable,
96330
+ migrationsSchema,
96331
+ // Internal param - won't be displayed in types. Do not remove.
96332
+ init: init2
96333
+ };
96334
+ const error3 = await migrate2(migrateInput);
96335
+ if (error3) {
96336
+ if (error3.exitCode === "localMigrations") {
96337
+ throw new Error("--init can't be used with existing migrations");
96338
+ }
96339
+ if (error3.exitCode === "databaseMigrations") {
96340
+ throw new Error("--init can't be used when database already has migrations set");
95959
96341
  }
95960
- const { introspectPostgres: introspectPostgres2 } = await Promise.resolve().then(() => (init_introspect(), introspect_exports));
95961
- await introspectPostgres2(
95962
- casing2,
95963
- out,
95964
- breakpoints,
95965
- credentials2,
95966
- tablesFilter,
95967
- schemasFilter,
95968
- prefix2,
95969
- entities
95970
- );
95971
- } else if (dialect6 === "mysql") {
95972
- const { introspectMysql: introspectMysql2 } = await Promise.resolve().then(() => (init_introspect(), introspect_exports));
95973
- await introspectMysql2(
95974
- casing2,
95975
- out,
95976
- breakpoints,
95977
- credentials2,
95978
- tablesFilter,
95979
- prefix2
95980
- );
95981
- } else if (dialect6 === "sqlite") {
95982
- const { introspectSqlite: introspectSqlite2 } = await Promise.resolve().then(() => (init_introspect(), introspect_exports));
95983
- await introspectSqlite2(
95984
- casing2,
95985
- out,
95986
- breakpoints,
95987
- credentials2,
95988
- tablesFilter,
95989
- prefix2
95990
- );
95991
- } else if (dialect6 === "turso") {
95992
- const { introspectLibSQL: introspectLibSQL2 } = await Promise.resolve().then(() => (init_introspect(), introspect_exports));
95993
- await introspectLibSQL2(
95994
- casing2,
95995
- out,
95996
- breakpoints,
95997
- credentials2,
95998
- tablesFilter,
95999
- prefix2
96000
- );
96001
- } else if (dialect6 === "singlestore") {
96002
- const { introspectSingleStore: introspectSingleStore2 } = await Promise.resolve().then(() => (init_introspect(), introspect_exports));
96003
- await introspectSingleStore2(
96004
- casing2,
96005
- out,
96006
- breakpoints,
96007
- credentials2,
96008
- tablesFilter,
96009
- prefix2
96010
- );
96011
- } else if (dialect6 === "gel") {
96012
- const { introspectGel: introspectGel2 } = await Promise.resolve().then(() => (init_introspect(), introspect_exports));
96013
- await introspectGel2(
96014
- casing2,
96015
- out,
96016
- breakpoints,
96017
- credentials2,
96018
- tablesFilter,
96019
- schemasFilter,
96020
- prefix2,
96021
- entities
96022
- );
96023
- } else {
96024
- assertUnreachable(dialect6);
96025
96342
  }
96026
- } catch (e4) {
96027
- console.error(e4);
96028
96343
  }
96029
- process.exit(0);
96030
96344
  }
96031
96345
  });
96032
96346
  var drop = command2({
@@ -96078,99 +96392,89 @@ var studio = command2({
96078
96392
  drizzleForLibSQL: drizzleForLibSQL2
96079
96393
  } = await Promise.resolve().then(() => (init_studio2(), studio_exports));
96080
96394
  let setup;
96081
- try {
96082
- if (dialect6 === "postgresql") {
96083
- if ("driver" in credentials2) {
96084
- const { driver: driver2 } = credentials2;
96085
- if (driver2 === "aws-data-api") {
96086
- if (!await ormVersionGt("0.30.10")) {
96087
- console.log(
96088
- "To use 'aws-data-api' driver - please update drizzle-orm to the latest version"
96089
- );
96090
- process.exit(1);
96091
- }
96092
- } else if (driver2 === "pglite") {
96093
- if (!await ormVersionGt("0.30.6")) {
96094
- console.log(
96095
- "To use 'pglite' driver - please update drizzle-orm to the latest version"
96096
- );
96097
- process.exit(1);
96098
- }
96099
- } else {
96100
- assertUnreachable(driver2);
96101
- }
96102
- }
96103
- const { schema: schema6, relations: relations5, files } = schemaPath ? await preparePgSchema2(schemaPath) : { schema: {}, relations: {}, files: [] };
96104
- setup = await drizzleForPostgres2(credentials2, schema6, relations5, files, casing2);
96105
- } else if (dialect6 === "mysql") {
96106
- const { schema: schema6, relations: relations5, files } = schemaPath ? await prepareMySqlSchema2(schemaPath) : { schema: {}, relations: {}, files: [] };
96107
- setup = await drizzleForMySQL2(credentials2, schema6, relations5, files, casing2);
96108
- } else if (dialect6 === "sqlite") {
96109
- const { schema: schema6, relations: relations5, files } = schemaPath ? await prepareSQLiteSchema2(schemaPath) : { schema: {}, relations: {}, files: [] };
96110
- setup = await drizzleForSQLite2(credentials2, schema6, relations5, files, casing2);
96111
- } else if (dialect6 === "turso") {
96112
- const { schema: schema6, relations: relations5, files } = schemaPath ? await prepareSQLiteSchema2(schemaPath) : { schema: {}, relations: {}, files: [] };
96113
- setup = await drizzleForLibSQL2(credentials2, schema6, relations5, files, casing2);
96114
- } else if (dialect6 === "singlestore") {
96115
- const { schema: schema6, relations: relations5, files } = schemaPath ? await prepareSingleStoreSchema2(schemaPath) : { schema: {}, relations: {}, files: [] };
96116
- setup = await drizzleForSingleStore2(
96117
- credentials2,
96118
- schema6,
96119
- relations5,
96120
- files,
96121
- casing2
96122
- );
96123
- } else if (dialect6 === "gel") {
96124
- console.log(
96125
- error(
96126
- `You can't use 'studio' command with Gel dialect`
96127
- )
96128
- );
96129
- process.exit(1);
96130
- } else {
96131
- assertUnreachable(dialect6);
96132
- }
96133
- const { prepareServer: prepareServer2 } = await Promise.resolve().then(() => (init_studio2(), studio_exports));
96134
- const server = await prepareServer2(setup);
96135
- console.log();
96136
- console.log(
96137
- withStyle.fullWarning(
96138
- "Drizzle Studio is currently in Beta. If you find anything that is not working as expected or should be improved, feel free to create an issue on GitHub: https://github.com/drizzle-team/drizzle-kit-mirror/issues/new or write to us on Discord: https://discord.gg/WcRKz2FFxN"
96139
- )
96140
- );
96141
- const { key, cert } = await certs() || {};
96142
- server.start({
96143
- host,
96144
- port,
96145
- key,
96146
- cert,
96147
- cb: (err2, address) => {
96148
- if (err2) {
96149
- console.error(err2);
96150
- } else {
96151
- const queryParams = {};
96152
- if (port !== 4983) {
96153
- queryParams.port = port;
96154
- }
96155
- if (host !== "127.0.0.1") {
96156
- queryParams.host = host;
96157
- }
96158
- const queryString = Object.keys(queryParams).map((key2) => {
96159
- return `${key2}=${queryParams[key2]}`;
96160
- }).join("&");
96395
+ if (dialect6 === "postgresql") {
96396
+ if ("driver" in credentials2) {
96397
+ const { driver: driver2 } = credentials2;
96398
+ if (driver2 === "aws-data-api") {
96399
+ if (!await ormVersionGt("0.30.10")) {
96161
96400
  console.log(
96162
- `
96163
- Drizzle Studio is up and running on ${source_default.blue(
96164
- `https://local.drizzle.studio${queryString ? `?${queryString}` : ""}`
96165
- )}`
96401
+ "To use 'aws-data-api' driver - please update drizzle-orm to the latest version"
96402
+ );
96403
+ process.exit(1);
96404
+ }
96405
+ } else if (driver2 === "pglite") {
96406
+ if (!await ormVersionGt("0.30.6")) {
96407
+ console.log(
96408
+ "To use 'pglite' driver - please update drizzle-orm to the latest version"
96166
96409
  );
96410
+ process.exit(1);
96167
96411
  }
96412
+ } else {
96413
+ assertUnreachable(driver2);
96168
96414
  }
96169
- });
96170
- } catch (e4) {
96171
- console.error(e4);
96172
- process.exit(0);
96415
+ }
96416
+ const { schema: schema6, relations: relations5, files } = schemaPath ? await preparePgSchema2(schemaPath) : { schema: {}, relations: {}, files: [] };
96417
+ setup = await drizzleForPostgres2(credentials2, schema6, relations5, files, casing2);
96418
+ } else if (dialect6 === "mysql") {
96419
+ const { schema: schema6, relations: relations5, files } = schemaPath ? await prepareMySqlSchema2(schemaPath) : { schema: {}, relations: {}, files: [] };
96420
+ setup = await drizzleForMySQL2(credentials2, schema6, relations5, files, casing2);
96421
+ } else if (dialect6 === "sqlite") {
96422
+ const { schema: schema6, relations: relations5, files } = schemaPath ? await prepareSQLiteSchema2(schemaPath) : { schema: {}, relations: {}, files: [] };
96423
+ setup = await drizzleForSQLite2(credentials2, schema6, relations5, files, casing2);
96424
+ } else if (dialect6 === "turso") {
96425
+ const { schema: schema6, relations: relations5, files } = schemaPath ? await prepareSQLiteSchema2(schemaPath) : { schema: {}, relations: {}, files: [] };
96426
+ setup = await drizzleForLibSQL2(credentials2, schema6, relations5, files, casing2);
96427
+ } else if (dialect6 === "singlestore") {
96428
+ const { schema: schema6, relations: relations5, files } = schemaPath ? await prepareSingleStoreSchema2(schemaPath) : { schema: {}, relations: {}, files: [] };
96429
+ setup = await drizzleForSingleStore2(
96430
+ credentials2,
96431
+ schema6,
96432
+ relations5,
96433
+ files,
96434
+ casing2
96435
+ );
96436
+ } else if (dialect6 === "gel") {
96437
+ throw new Error(`You can't use 'studio' command with Gel dialect`);
96438
+ } else {
96439
+ assertUnreachable(dialect6);
96173
96440
  }
96441
+ const { prepareServer: prepareServer2 } = await Promise.resolve().then(() => (init_studio2(), studio_exports));
96442
+ const server = await prepareServer2(setup);
96443
+ console.log();
96444
+ console.log(
96445
+ withStyle.fullWarning(
96446
+ "Drizzle Studio is currently in Beta. If you find anything that is not working as expected or should be improved, feel free to create an issue on GitHub: https://github.com/drizzle-team/drizzle-kit-mirror/issues/new or write to us on Discord: https://discord.gg/WcRKz2FFxN"
96447
+ )
96448
+ );
96449
+ const { key, cert } = await certs() || {};
96450
+ server.start({
96451
+ host,
96452
+ port,
96453
+ key,
96454
+ cert,
96455
+ cb: (err2, address) => {
96456
+ if (err2) {
96457
+ console.error(err2);
96458
+ } else {
96459
+ const queryParams = {};
96460
+ if (port !== 4983) {
96461
+ queryParams.port = port;
96462
+ }
96463
+ if (host !== "127.0.0.1") {
96464
+ queryParams.host = host;
96465
+ }
96466
+ const queryString = Object.keys(queryParams).map((key2) => {
96467
+ return `${key2}=${queryParams[key2]}`;
96468
+ }).join("&");
96469
+ console.log(
96470
+ `
96471
+ Drizzle Studio is up and running on ${source_default.blue(
96472
+ `https://local.drizzle.studio${queryString ? `?${queryString}` : ""}`
96473
+ )}`
96474
+ );
96475
+ }
96476
+ }
96477
+ });
96174
96478
  }
96175
96479
  });
96176
96480
  var exportRaw = command2({
@@ -96208,12 +96512,7 @@ var exportRaw = command2({
96208
96512
  } else if (dialect6 === "singlestore") {
96209
96513
  await prepareAndExportSinglestore2(opts);
96210
96514
  } else if (dialect6 === "gel") {
96211
- console.log(
96212
- error(
96213
- `You can't use 'export' command with Gel dialect`
96214
- )
96215
- );
96216
- process.exit(1);
96515
+ throw new Error(`You can't use 'export' command with Gel dialect`);
96217
96516
  } else {
96218
96517
  assertUnreachable(dialect6);
96219
96518
  }
@@ -96222,10 +96521,11 @@ var exportRaw = command2({
96222
96521
 
96223
96522
  // src/cli/index.ts
96224
96523
  init_utils5();
96524
+ init_views();
96225
96525
  var version2 = async () => {
96226
96526
  const { npmVersion } = await ormCoreVersions();
96227
96527
  const ormVersion = npmVersion ? `drizzle-orm: v${npmVersion}` : "";
96228
- const envVersion = "1.0.0-beta.1-2cd01ec";
96528
+ const envVersion = "1.0.0-beta.1-bc61bbe";
96229
96529
  const kitVersion = envVersion ? `v${envVersion}` : "--";
96230
96530
  const versions = `drizzle-kit: ${kitVersion}
96231
96531
  ${ormVersion}`;
@@ -96261,7 +96561,20 @@ var legacy = [
96261
96561
  ];
96262
96562
  run([generate, migrate, pull, push, studio, up, check, drop, exportRaw, ...legacy], {
96263
96563
  name: "drizzle-kit",
96264
- version: version2
96564
+ version: version2,
96565
+ hook: (event, command) => {
96566
+ if (event === "after" && getCommandNameWithParents(command) !== "studio") process.exit(0);
96567
+ },
96568
+ theme: (event) => {
96569
+ if (event.type === "error") {
96570
+ if (event.violation !== "unknown_error") return false;
96571
+ const reason = event.error;
96572
+ if (!(typeof reason === "object" && reason !== null && "message" in reason && typeof reason.message === "string")) return false;
96573
+ console.log(error(reason.message));
96574
+ return true;
96575
+ }
96576
+ return false;
96577
+ }
96265
96578
  });
96266
96579
  /*! Bundled license information:
96267
96580