drizzle-kit 1.0.0-beta.2-e689d82 → 1.0.0-beta.2-a1a6b39

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
@@ -22955,22 +22955,23 @@ var init_common3 = __esm({
22955
22955
  out: stringType().optional()
22956
22956
  });
22957
22957
  drivers = ["d1-http", "expo", "aws-data-api", "pglite", "durable-sqlite", "sqlite-cloud"];
22958
- wrapParam = (name, param, optional = false, type) => {
22958
+ wrapParam = (name, param, optional = false, type, isValid2 = true) => {
22959
22959
  const check2 = `[${source_default.green("\u2713")}]`;
22960
22960
  const cross = `[${source_default.red("x")}]`;
22961
+ const prefix2 = isValid2 === true ? check2 : cross;
22962
+ if (optional) {
22963
+ return source_default.gray(` ${prefix2} ${name}?: `);
22964
+ }
22961
22965
  if (typeof param === "string") {
22962
22966
  if (param.length === 0) {
22963
22967
  return ` ${cross} ${name}: ''`;
22964
22968
  }
22965
22969
  if (type === "secret") {
22966
- return ` ${check2} ${name}: '*****'`;
22970
+ return ` ${prefix2} ${name}: '*****'`;
22967
22971
  } else if (type === "url") {
22968
- return ` ${check2} ${name}: '${param.replace(/(?<=:\/\/[^:\n]*:)([^@]*)/, "****")}'`;
22972
+ return ` ${prefix2} ${name}: '${param.replace(/(?<=:\/\/[^:\n]*:)([^@]*)/, "****")}'`;
22969
22973
  }
22970
- return ` ${check2} ${name}: '${param}'`;
22971
- }
22972
- if (optional) {
22973
- return source_default.gray(` ${name}?: `);
22974
+ return ` ${prefix2} ${name}: '${param}'`;
22974
22975
  }
22975
22976
  return ` ${cross} ${name}: ${source_default.gray("undefined")}`;
22976
22977
  };
@@ -28623,41 +28624,41 @@ var require_ms = __commonJS({
28623
28624
  return void 0;
28624
28625
  }
28625
28626
  }
28626
- function fmtShort(ms2) {
28627
- var msAbs = Math.abs(ms2);
28627
+ function fmtShort(ms) {
28628
+ var msAbs = Math.abs(ms);
28628
28629
  if (msAbs >= d5) {
28629
- return Math.round(ms2 / d5) + "d";
28630
+ return Math.round(ms / d5) + "d";
28630
28631
  }
28631
28632
  if (msAbs >= h6) {
28632
- return Math.round(ms2 / h6) + "h";
28633
+ return Math.round(ms / h6) + "h";
28633
28634
  }
28634
28635
  if (msAbs >= m6) {
28635
- return Math.round(ms2 / m6) + "m";
28636
+ return Math.round(ms / m6) + "m";
28636
28637
  }
28637
28638
  if (msAbs >= s6) {
28638
- return Math.round(ms2 / s6) + "s";
28639
+ return Math.round(ms / s6) + "s";
28639
28640
  }
28640
- return ms2 + "ms";
28641
+ return ms + "ms";
28641
28642
  }
28642
- function fmtLong(ms2) {
28643
- var msAbs = Math.abs(ms2);
28643
+ function fmtLong(ms) {
28644
+ var msAbs = Math.abs(ms);
28644
28645
  if (msAbs >= d5) {
28645
- return plural2(ms2, msAbs, d5, "day");
28646
+ return plural2(ms, msAbs, d5, "day");
28646
28647
  }
28647
28648
  if (msAbs >= h6) {
28648
- return plural2(ms2, msAbs, h6, "hour");
28649
+ return plural2(ms, msAbs, h6, "hour");
28649
28650
  }
28650
28651
  if (msAbs >= m6) {
28651
- return plural2(ms2, msAbs, m6, "minute");
28652
+ return plural2(ms, msAbs, m6, "minute");
28652
28653
  }
28653
28654
  if (msAbs >= s6) {
28654
- return plural2(ms2, msAbs, s6, "second");
28655
+ return plural2(ms, msAbs, s6, "second");
28655
28656
  }
28656
- return ms2 + " ms";
28657
+ return ms + " ms";
28657
28658
  }
28658
- function plural2(ms2, msAbs, n5, name) {
28659
+ function plural2(ms, msAbs, n5, name) {
28659
28660
  var isPlural = msAbs >= n5 * 1.5;
28660
- return Math.round(ms2 / n5) + " " + name + (isPlural ? "s" : "");
28661
+ return Math.round(ms / n5) + " " + name + (isPlural ? "s" : "");
28661
28662
  }
28662
28663
  }
28663
28664
  });
@@ -28700,8 +28701,8 @@ var require_common2 = __commonJS({
28700
28701
  }
28701
28702
  const self2 = debug;
28702
28703
  const curr = Number(/* @__PURE__ */ new Date());
28703
- const ms2 = curr - (prevTime || curr);
28704
- self2.diff = ms2;
28704
+ const ms = curr - (prevTime || curr);
28705
+ self2.diff = ms;
28705
28706
  self2.prev = prevTime;
28706
28707
  self2.curr = curr;
28707
28708
  prevTime = curr;
@@ -35839,8 +35840,8 @@ ${sql}
35839
35840
  `;
35840
35841
  return content;
35841
35842
  };
35842
- prepareSnapshotFolderName = (ms2) => {
35843
- const now = ms2 ? new Date(ms2) : /* @__PURE__ */ new Date();
35843
+ prepareSnapshotFolderName = (ms) => {
35844
+ const now = ms ? new Date(ms) : /* @__PURE__ */ new Date();
35844
35845
  return `${now.getFullYear()}${two(now.getUTCMonth() + 1)}${two(
35845
35846
  now.getUTCDate()
35846
35847
  )}${two(now.getUTCHours())}${two(now.getUTCMinutes())}${two(
@@ -55589,7 +55590,7 @@ var require_websocket = __commonJS({
55589
55590
  var EventEmitter = require("events");
55590
55591
  var https2 = require("https");
55591
55592
  var http3 = require("http");
55592
- var net2 = require("net");
55593
+ var net = require("net");
55593
55594
  var tls = require("tls");
55594
55595
  var { randomBytes, createHash: createHash2 } = require("crypto");
55595
55596
  var { Duplex, Readable: Readable2 } = require("stream");
@@ -56320,12 +56321,12 @@ var require_websocket = __commonJS({
56320
56321
  }
56321
56322
  function netConnect(options) {
56322
56323
  options.path = options.socketPath;
56323
- return net2.connect(options);
56324
+ return net.connect(options);
56324
56325
  }
56325
56326
  function tlsConnect(options) {
56326
56327
  options.path = void 0;
56327
56328
  if (!options.servername && options.servername !== "") {
56328
- options.servername = net2.isIP(options.host) ? "" : options.host;
56329
+ options.servername = net.isIP(options.host) ? "" : options.host;
56329
56330
  }
56330
56331
  return tls.connect(options);
56331
56332
  }
@@ -58616,7 +58617,7 @@ var require_dist_cjs14 = __commonJS({
58616
58617
  return transformedHeaders;
58617
58618
  };
58618
58619
  var timing = {
58619
- setTimeout: (cb, ms2) => setTimeout(cb, ms2),
58620
+ setTimeout: (cb, ms) => setTimeout(cb, ms),
58620
58621
  clearTimeout: (timeoutId) => clearTimeout(timeoutId)
58621
58622
  };
58622
58623
  var DEFER_EVENT_LISTENER_TIME$2 = 1e3;
@@ -61675,13 +61676,13 @@ var init_schema_date_utils = __esm({
61675
61676
  if (!matches) {
61676
61677
  throw new TypeError(`Invalid RFC3339 timestamp format ${value}`);
61677
61678
  }
61678
- const [, yearStr, monthStr, dayStr, hours, minutes, seconds, , ms2, offsetStr] = matches;
61679
+ const [, yearStr, monthStr, dayStr, hours, minutes, seconds, , ms, offsetStr] = matches;
61679
61680
  range(monthStr, 1, 12);
61680
61681
  range(dayStr, 1, 31);
61681
61682
  range(hours, 0, 23);
61682
61683
  range(minutes, 0, 59);
61683
61684
  range(seconds, 0, 60);
61684
- const date2 = new Date(Date.UTC(Number(yearStr), Number(monthStr) - 1, Number(dayStr), Number(hours), Number(minutes), Number(seconds), Number(ms2) ? Math.round(parseFloat(`0.${ms2}`) * 1e3) : 0));
61685
+ const date2 = new Date(Date.UTC(Number(yearStr), Number(monthStr) - 1, Number(dayStr), Number(hours), Number(minutes), Number(seconds), Number(ms) ? Math.round(parseFloat(`0.${ms}`) * 1e3) : 0));
61685
61686
  date2.setUTCFullYear(Number(yearStr));
61686
61687
  if (offsetStr.toUpperCase() != "Z") {
61687
61688
  const [, sign, offsetH, offsetM] = /([+-])(\d\d):(\d\d)/.exec(offsetStr) || [void 0, "+", 0, 0];
@@ -81572,8 +81573,8 @@ var require_datetime2 = __commonJS({
81572
81573
  if (!(object instanceof Date)) {
81573
81574
  throw new errors_1.InvalidArgumentError(`a Date instance was expected, got "${object}"`);
81574
81575
  }
81575
- const ms2 = object.getTime() - TIMESHIFT;
81576
- const us = ms2 * 1e3;
81576
+ const ms = object.getTime() - TIMESHIFT;
81577
+ const us = ms * 1e3;
81577
81578
  buf.writeInt32(8);
81578
81579
  buf.writeInt64(us);
81579
81580
  }
@@ -81583,12 +81584,12 @@ var require_datetime2 = __commonJS({
81583
81584
  return ctx.postDecode(this, us2 + BI_TIMESHIFT_US);
81584
81585
  }
81585
81586
  const us = Number(buf.readBigInt64());
81586
- let ms2 = Math.round(us / 1e3);
81587
- if (Math.abs(us % 1e3) === 500 && Math.abs(ms2) % 2 === 1) {
81588
- ms2 -= 1;
81587
+ let ms = Math.round(us / 1e3);
81588
+ if (Math.abs(us % 1e3) === 500 && Math.abs(ms) % 2 === 1) {
81589
+ ms -= 1;
81589
81590
  }
81590
- ms2 += TIMESHIFT;
81591
- return new Date(ms2);
81591
+ ms += TIMESHIFT;
81592
+ return new Date(ms);
81592
81593
  }
81593
81594
  };
81594
81595
  exports2.DateTimeCodec = DateTimeCodec;
@@ -81609,8 +81610,8 @@ var require_datetime2 = __commonJS({
81609
81610
  if (!(object instanceof datetime_1.LocalDateTime)) {
81610
81611
  throw new errors_1.InvalidArgumentError(`a LocalDateTime instance was expected, got "${object}"`);
81611
81612
  }
81612
- const ms2 = BigInt(datetime_1.localDateInstances.get(object).getTime() - TIMESHIFT);
81613
- let us = ms2 * 1000n + BigInt(object.hour * 36e8 + object.minute * 6e7 + object.second * 1e6 + object.millisecond * 1e3 + object.microsecond);
81613
+ const ms = BigInt(datetime_1.localDateInstances.get(object).getTime() - TIMESHIFT);
81614
+ let us = ms * 1000n + BigInt(object.hour * 36e8 + object.minute * 6e7 + object.second * 1e6 + object.millisecond * 1e3 + object.microsecond);
81614
81615
  if (object.nanosecond === 500 && Math.abs(object.microsecond) % 2 === 1 || object.nanosecond > 500) {
81615
81616
  us += 1n;
81616
81617
  }
@@ -81624,13 +81625,13 @@ var require_datetime2 = __commonJS({
81624
81625
  }
81625
81626
  const bi_ms = bi_us / 1000n;
81626
81627
  let us = Number(bi_us - bi_ms * 1000n);
81627
- let ms2 = Number(bi_ms);
81628
+ let ms = Number(bi_ms);
81628
81629
  if (us < 0) {
81629
81630
  us += 1e3;
81630
- ms2 -= 1;
81631
+ ms -= 1;
81631
81632
  }
81632
- ms2 += TIMESHIFT;
81633
- const date2 = new Date(ms2);
81633
+ ms += TIMESHIFT;
81634
+ const date2 = new Date(ms);
81634
81635
  return new datetime_1.LocalDateTime(date2.getUTCFullYear(), date2.getUTCMonth() + 1, date2.getUTCDate(), date2.getUTCHours(), date2.getUTCMinutes(), date2.getUTCSeconds(), date2.getUTCMilliseconds(), us);
81635
81636
  }
81636
81637
  };
@@ -81692,13 +81693,13 @@ var require_datetime2 = __commonJS({
81692
81693
  }
81693
81694
  let us = Number(bius);
81694
81695
  let seconds = Math.floor(us / 1e6);
81695
- const ms2 = Math.floor(us % 1e6 / 1e3);
81696
- us = us % 1e6 - ms2 * 1e3;
81696
+ const ms = Math.floor(us % 1e6 / 1e3);
81697
+ us = us % 1e6 - ms * 1e3;
81697
81698
  let minutes = Math.floor(seconds / 60);
81698
81699
  seconds = Math.floor(seconds % 60);
81699
81700
  const hours = Math.floor(minutes / 60);
81700
81701
  minutes = Math.floor(minutes % 60);
81701
- return new datetime_1.LocalTime(hours, minutes, seconds, ms2, us);
81702
+ return new datetime_1.LocalTime(hours, minutes, seconds, ms, us);
81702
81703
  }
81703
81704
  };
81704
81705
  exports2.LocalTimeCodec = LocalTimeCodec;
@@ -81775,14 +81776,14 @@ var require_datetime2 = __commonJS({
81775
81776
  const biMillion = 1000000n;
81776
81777
  const biSeconds = bius / biMillion;
81777
81778
  let us = Number(bius - biSeconds * biMillion);
81778
- const ms2 = Math.floor(us / 1e3);
81779
+ const ms = Math.floor(us / 1e3);
81779
81780
  us = us % 1e3;
81780
81781
  let seconds = Number(biSeconds);
81781
81782
  let minutes = Math.floor(seconds / 60);
81782
81783
  seconds = Math.floor(seconds % 60);
81783
81784
  const hours = Math.floor(minutes / 60);
81784
81785
  minutes = Math.floor(minutes % 60);
81785
- return new datetime_1.Duration(0, 0, 0, 0, hours * sign, minutes * sign, seconds * sign, ms2 * sign, us * sign);
81786
+ return new datetime_1.Duration(0, 0, 0, 0, hours * sign, minutes * sign, seconds * sign, ms * sign, us * sign);
81786
81787
  }
81787
81788
  };
81788
81789
  exports2.DurationCodec = DurationCodec;
@@ -81828,7 +81829,7 @@ var require_datetime2 = __commonJS({
81828
81829
  const million = BigInt(1e6);
81829
81830
  const biSeconds = bius / million;
81830
81831
  let us = Number(bius - biSeconds * million);
81831
- const ms2 = Math.trunc(us / 1e3);
81832
+ const ms = Math.trunc(us / 1e3);
81832
81833
  us = us % 1e3;
81833
81834
  let seconds = Number(biSeconds);
81834
81835
  let minutes = Math.trunc(seconds / 60);
@@ -81839,7 +81840,7 @@ var require_datetime2 = __commonJS({
81839
81840
  days = Math.trunc(days % 7);
81840
81841
  const years = Math.trunc(months2 / 12);
81841
81842
  months2 = Math.trunc(months2 % 12);
81842
- return new datetime_1.RelativeDuration(years, months2, weeks, days, hours * sign, minutes * sign, seconds * sign, ms2 * sign, us * sign);
81843
+ return new datetime_1.RelativeDuration(years, months2, weeks, days, hours * sign, minutes * sign, seconds * sign, ms * sign, us * sign);
81843
81844
  }
81844
81845
  };
81845
81846
  exports2.RelativeDurationCodec = RelativeDurationCodec;
@@ -106326,11 +106327,11 @@ var require_TokenExpiredError = __commonJS({
106326
106327
  // ../node_modules/.pnpm/jsonwebtoken@9.0.2/node_modules/jsonwebtoken/lib/timespan.js
106327
106328
  var require_timespan = __commonJS({
106328
106329
  "../node_modules/.pnpm/jsonwebtoken@9.0.2/node_modules/jsonwebtoken/lib/timespan.js"(exports2, module2) {
106329
- var ms2 = require_ms();
106330
+ var ms = require_ms();
106330
106331
  module2.exports = function(time2, iat) {
106331
106332
  var timestamp = iat || Math.floor(Date.now() / 1e3);
106332
106333
  if (typeof time2 === "string") {
106333
- var milliseconds = ms2(time2);
106334
+ var milliseconds = ms(time2);
106334
106335
  if (typeof milliseconds === "undefined") {
106335
106336
  return;
106336
106337
  }
@@ -120917,7 +120918,7 @@ var require_dist = __commonJS({
120917
120918
  };
120918
120919
  Object.defineProperty(exports2, "__esModule", { value: true });
120919
120920
  exports2.Agent = void 0;
120920
- var net2 = __importStar2(require("net"));
120921
+ var net = __importStar2(require("net"));
120921
120922
  var http3 = __importStar2(require("http"));
120922
120923
  var https_1 = require("https");
120923
120924
  __exportStar2(require_helpers2(), exports2);
@@ -120957,7 +120958,7 @@ var require_dist = __commonJS({
120957
120958
  if (!this.sockets[name]) {
120958
120959
  this.sockets[name] = [];
120959
120960
  }
120960
- const fakeSocket = new net2.Socket({ writable: false });
120961
+ const fakeSocket = new net.Socket({ writable: false });
120961
120962
  this.sockets[name].push(fakeSocket);
120962
120963
  this.totalSocketCount++;
120963
120964
  return fakeSocket;
@@ -121169,7 +121170,7 @@ var require_dist2 = __commonJS({
121169
121170
  };
121170
121171
  Object.defineProperty(exports2, "__esModule", { value: true });
121171
121172
  exports2.HttpsProxyAgent = void 0;
121172
- var net2 = __importStar2(require("net"));
121173
+ var net = __importStar2(require("net"));
121173
121174
  var tls = __importStar2(require("tls"));
121174
121175
  var assert_1 = __importDefault2(require("assert"));
121175
121176
  var debug_1 = __importDefault2(require_src2());
@@ -121178,7 +121179,7 @@ var require_dist2 = __commonJS({
121178
121179
  var parse_proxy_response_1 = require_parse_proxy_response();
121179
121180
  var debug = (0, debug_1.default)("https-proxy-agent");
121180
121181
  var setServernameFromNonIpHost = (options) => {
121181
- if (options.servername === void 0 && options.host && !net2.isIP(options.host)) {
121182
+ if (options.servername === void 0 && options.host && !net.isIP(options.host)) {
121182
121183
  return {
121183
121184
  ...options,
121184
121185
  servername: options.host
@@ -121218,10 +121219,10 @@ var require_dist2 = __commonJS({
121218
121219
  socket = tls.connect(setServernameFromNonIpHost(this.connectOpts));
121219
121220
  } else {
121220
121221
  debug("Creating `net.Socket`: %o", this.connectOpts);
121221
- socket = net2.connect(this.connectOpts);
121222
+ socket = net.connect(this.connectOpts);
121222
121223
  }
121223
121224
  const headers = typeof this.proxyHeaders === "function" ? this.proxyHeaders() : { ...this.proxyHeaders };
121224
- const host = net2.isIPv6(opts.host) ? `[${opts.host}]` : opts.host;
121225
+ const host = net.isIPv6(opts.host) ? `[${opts.host}]` : opts.host;
121225
121226
  let payload2 = `CONNECT ${host}:${opts.port} HTTP/1.1\r
121226
121227
  `;
121227
121228
  if (proxy.username || proxy.password) {
@@ -121254,7 +121255,7 @@ var require_dist2 = __commonJS({
121254
121255
  return socket;
121255
121256
  }
121256
121257
  socket.destroy();
121257
- const fakeSocket = new net2.Socket({ writable: false });
121258
+ const fakeSocket = new net.Socket({ writable: false });
121258
121259
  fakeSocket.readable = true;
121259
121260
  req.once("socket", (s6) => {
121260
121261
  debug("Replaying proxy buffer for failed request");
@@ -121319,7 +121320,7 @@ var require_dist3 = __commonJS({
121319
121320
  };
121320
121321
  Object.defineProperty(exports2, "__esModule", { value: true });
121321
121322
  exports2.HttpProxyAgent = void 0;
121322
- var net2 = __importStar2(require("net"));
121323
+ var net = __importStar2(require("net"));
121323
121324
  var tls = __importStar2(require("tls"));
121324
121325
  var debug_1 = __importDefault2(require_src2());
121325
121326
  var events_1 = require("events");
@@ -121392,7 +121393,7 @@ var require_dist3 = __commonJS({
121392
121393
  socket = tls.connect(this.connectOpts);
121393
121394
  } else {
121394
121395
  debug("Creating `net.Socket`: %o", this.connectOpts);
121395
- socket = net2.connect(this.connectOpts);
121396
+ socket = net.connect(this.connectOpts);
121396
121397
  }
121397
121398
  await (0, events_1.once)(socket, "connect");
121398
121399
  return socket;
@@ -160306,7 +160307,7 @@ var require_connection = __commonJS({
160306
160307
  var _crypto = _interopRequireDefault(require("crypto"));
160307
160308
  var _os = _interopRequireDefault(require("os"));
160308
160309
  var tls = _interopRequireWildcard(require("tls"));
160309
- var net2 = _interopRequireWildcard(require("net"));
160310
+ var net = _interopRequireWildcard(require("net"));
160310
160311
  var _dns = _interopRequireDefault(require("dns"));
160311
160312
  var _constants = _interopRequireDefault(require("constants"));
160312
160313
  var _stream = require("stream");
@@ -161355,7 +161356,7 @@ var require_connection = __commonJS({
161355
161356
  async wrapWithTls(socket, signal) {
161356
161357
  signal.throwIfAborted();
161357
161358
  const secureContext = tls.createSecureContext(this.secureContextOptions);
161358
- const serverName = !net2.isIP(this.config.server) ? this.config.server : "";
161359
+ const serverName = !net.isIP(this.config.server) ? this.config.server : "";
161359
161360
  const encryptOptions = {
161360
161361
  host: this.config.server,
161361
161362
  socket,
@@ -164282,11 +164283,10 @@ function parseMssqlUrl(url) {
164282
164283
  }
164283
164284
  };
164284
164285
  }
164285
- var import_net, ms, normalisePGliteUrl, preparePostgresDB, prepareCockroach, prepareGelDB, parseSingleStoreCredentials, connectToSingleStore, parseMysqlCredentials, connectToMySQL, parseMssqlCredentials, connectToMsSQL, prepareSqliteParams, preparePGliteParams, connectToSQLite, connectToLibSQL;
164286
+ var normalisePGliteUrl, preparePostgresDB, prepareCockroach, prepareGelDB, parseSingleStoreCredentials, connectToSingleStore, parseMysqlCredentials, connectToMySQL, parseMssqlCredentials, connectToMsSQL, prepareSqliteParams, preparePGliteParams, connectToSQLite, connectToLibSQL;
164286
164287
  var init_connections = __esm({
164287
164288
  "src/cli/connections.ts"() {
164288
164289
  "use strict";
164289
- import_net = __toESM(require("net"));
164290
164290
  init_src();
164291
164291
  init_wrapper();
164292
164292
  init_utils2();
@@ -164294,7 +164294,6 @@ var init_connections = __esm({
164294
164294
  init_when_json_met_bigint();
164295
164295
  init_utils4();
164296
164296
  init_outputs();
164297
- ms = (a5, b5) => Number(b5 - a5) / 1e6;
164298
164297
  normalisePGliteUrl = (it2) => {
164299
164298
  if (it2.startsWith("file:")) {
164300
164299
  return it2.substring(5);
@@ -164449,13 +164448,13 @@ var init_connections = __esm({
164449
164448
  return pg.types.getTypeParser(typeId, format2);
164450
164449
  }
164451
164450
  };
164452
- const pool = "url" in credentials2 ? new pg.Pool({ connectionString: credentials2.url, max: 1 }) : new pg.Pool({ ...credentials2, ssl, max: 1 });
164453
- const db = drizzle({ client: pool });
164451
+ const client = "url" in credentials2 ? new pg.Pool({ connectionString: credentials2.url, max: 1 }) : new pg.Pool({ ...credentials2, ssl, max: 1 });
164452
+ const db = drizzle({ client });
164454
164453
  const migrateFn = async (config) => {
164455
164454
  return migrate2(db, config);
164456
164455
  };
164457
164456
  const query = async (sql, params) => {
164458
- const result2 = await pool.query({
164457
+ const result2 = await client.query({
164459
164458
  text: sql,
164460
164459
  values: params ?? [],
164461
164460
  types: types3
@@ -164465,7 +164464,7 @@ var init_connections = __esm({
164465
164464
  return result2.rows;
164466
164465
  };
164467
164466
  const proxy = async (params) => {
164468
- const result2 = await pool.query({
164467
+ const result2 = await client.query({
164469
164468
  text: params.sql,
164470
164469
  values: params.params,
164471
164470
  ...params.mode === "array" && { rowMode: "array" },
@@ -164477,7 +164476,7 @@ var init_connections = __esm({
164477
164476
  };
164478
164477
  const transactionProxy = async (queries) => {
164479
164478
  const results = [];
164480
- const tx = await pool.connect();
164479
+ const tx = await client.connect();
164481
164480
  try {
164482
164481
  await tx.query("BEGIN");
164483
164482
  for (const query2 of queries) {
@@ -164496,72 +164495,7 @@ var init_connections = __esm({
164496
164495
  }
164497
164496
  return results;
164498
164497
  };
164499
- const benchmarkQuery = async (sql, params) => {
164500
- const explainResult = await pool.query({
164501
- text: `EXPLAIN ANALYZE ${sql}`,
164502
- values: params ?? [],
164503
- types: types3
164504
- });
164505
- const stringifiedResult = JSON.stringify(explainResult.rows);
164506
- const planningMatch = stringifiedResult.match(/Planning Time:\s*([\d.]+)\s*ms/i);
164507
- const executionMatch = stringifiedResult.match(/Execution Time:\s*([\d.]+)\s*ms/i);
164508
- const planningTime = Number(planningMatch[1]);
164509
- const executionTime = Number(executionMatch[1]);
164510
- let startAt = 0n;
164511
- let tcpConnectedAt = 0n;
164512
- let tlsConnectedAt = null;
164513
- let dbReadyAt = 0n;
164514
- let querySentAt = 0n;
164515
- let firstDataAt = 0n;
164516
- let lastDataAt = 0n;
164517
- let bytesReceived = 0;
164518
- const client = "url" in credentials2 ? new pg.Client({ connectionString: credentials2.url }) : new pg.Client({ ...credentials2, ssl });
164519
- client.connection.once("connect", () => {
164520
- tcpConnectedAt = process.hrtime.bigint();
164521
- });
164522
- client.connection.prependOnceListener("sslconnect", () => {
164523
- tlsConnectedAt = process.hrtime.bigint();
164524
- });
164525
- client.connection.prependOnceListener("readyForQuery", () => {
164526
- dbReadyAt = process.hrtime.bigint();
164527
- });
164528
- client.connection.addListener("rowDescription", (data2) => {
164529
- if (firstDataAt === 0n) {
164530
- firstDataAt = process.hrtime.bigint();
164531
- }
164532
- bytesReceived += data2.length;
164533
- });
164534
- client.connection.addListener("dataRow", (data2) => {
164535
- bytesReceived += data2.length;
164536
- });
164537
- client.connection.addListener("commandComplete", () => {
164538
- lastDataAt = process.hrtime.bigint();
164539
- });
164540
- startAt = process.hrtime.bigint();
164541
- await client.connect();
164542
- querySentAt = process.hrtime.bigint();
164543
- await client.query(sql, params);
164544
- await client.end();
164545
- return {
164546
- tcpHandshake: ms(startAt, tcpConnectedAt),
164547
- tlsHandshake: tlsConnectedAt ? ms(tcpConnectedAt, tlsConnectedAt) : null,
164548
- dbHandshake: ms(tlsConnectedAt ?? tcpConnectedAt, dbReadyAt),
164549
- planning: planningTime,
164550
- execution: executionTime,
164551
- dataDownload: ms(firstDataAt, lastDataAt) + ms(querySentAt, firstDataAt) - executionTime - planningTime,
164552
- total: ms(startAt, lastDataAt),
164553
- dataSize: bytesReceived
164554
- };
164555
- };
164556
- const benchmarkProxy = async ({ sql, params }, repeats) => {
164557
- const results = [];
164558
- for (let i6 = 0; i6 < repeats; i6++) {
164559
- const r6 = await benchmarkQuery(sql, params);
164560
- results.push(r6);
164561
- }
164562
- return results;
164563
- };
164564
- return { packageName: "pg", query, proxy, transactionProxy, benchmarkProxy, migrate: migrateFn };
164498
+ return { packageName: "pg", query, proxy, transactionProxy, migrate: migrateFn };
164565
164499
  }
164566
164500
  if (await checkPackage("postgres")) {
164567
164501
  console.log(
@@ -165056,6 +164990,7 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
165056
164990
  }
165057
164991
  return next();
165058
164992
  };
164993
+ await connection.connect();
165059
164994
  const query = async (sql, params) => {
165060
164995
  const res = await connection.execute({
165061
164996
  sql,
@@ -165095,111 +165030,11 @@ To link your project, please refer https://docs.geldata.com/reference/cli/gel_in
165095
165030
  }
165096
165031
  return results;
165097
165032
  };
165098
- const benchmarkQuery = async (sql, params) => {
165099
- const { createConnection: createConnection2 } = await import("mysql2");
165100
- const explainResult = await connection.query({
165101
- sql: `EXPLAIN ANALYZE ${sql}`,
165102
- values: params ?? [],
165103
- typeCast
165104
- });
165105
- const stringifiedResult = JSON.stringify(explainResult[0]);
165106
- const timeMatch = stringifiedResult.match(
165107
- /actual time=([0-9.eE+-]+)\.\.([0-9.eE+-]+)/
165108
- );
165109
- const lastRowTime = Number(timeMatch[2]);
165110
- const executionTime = lastRowTime;
165111
- let startAt = 0n;
165112
- let tcpConnectedAt = 0n;
165113
- let tlsConnectedAt = null;
165114
- let querySentAt = 0n;
165115
- let firstDataAt = 0n;
165116
- let lastDataAt = 0n;
165117
- let bytesReceived = 0;
165118
- const createStream = ({ config }) => {
165119
- let stream;
165120
- if (config.socketPath) {
165121
- stream = import_net.default.connect(config.socketPath);
165122
- } else {
165123
- stream = import_net.default.connect(config.port, config.host);
165124
- }
165125
- if (config.enableKeepAlive) {
165126
- stream.on("connect", () => {
165127
- stream.setKeepAlive(true, config.keepAliveInitialDelay);
165128
- });
165129
- }
165130
- stream.setNoDelay(true);
165131
- stream.once("connect", () => {
165132
- tcpConnectedAt = process.hrtime.bigint();
165133
- });
165134
- return stream;
165135
- };
165136
- startAt = process.hrtime.bigint();
165137
- const newConnection = result2.url ? createConnection2({
165138
- // debug: true,
165139
- uri: result2.url,
165140
- stream: createStream
165141
- }) : createConnection2({
165142
- ...result2.credentials,
165143
- stream: createStream
165144
- });
165145
- await new Promise((resolve3, reject) => {
165146
- newConnection.connect((err2) => {
165147
- tlsConnectedAt = process.hrtime.bigint();
165148
- if (err2) {
165149
- reject(err2);
165150
- } else {
165151
- resolve3();
165152
- }
165153
- });
165154
- });
165155
- querySentAt = process.hrtime.bigint();
165156
- await new Promise((resolve3, reject) => {
165157
- const query2 = newConnection.query({
165158
- sql,
165159
- values: params ?? [],
165160
- typeCast
165161
- // rowsAsArray: true,
165162
- });
165163
- query2.on("error", (err2) => {
165164
- reject(err2);
165165
- });
165166
- query2.on("fields", (fields) => {
165167
- if (firstDataAt === 0n) {
165168
- firstDataAt = process.hrtime.bigint();
165169
- }
165170
- bytesReceived += fields[0]._buf.length;
165171
- });
165172
- query2.on("end", () => {
165173
- lastDataAt = process.hrtime.bigint();
165174
- resolve3();
165175
- newConnection.end();
165176
- });
165177
- });
165178
- return {
165179
- tcpHandshake: ms(startAt, tcpConnectedAt),
165180
- tlsHandshake: tlsConnectedAt ? ms(tcpConnectedAt, tlsConnectedAt) : null,
165181
- dbHandshake: null,
165182
- planning: null,
165183
- execution: executionTime,
165184
- dataDownload: ms(firstDataAt, lastDataAt) + ms(querySentAt, firstDataAt) - executionTime,
165185
- total: ms(startAt, lastDataAt),
165186
- dataSize: bytesReceived
165187
- };
165188
- };
165189
- const benchmarkProxy = async ({ sql, params }, repeats) => {
165190
- const results = [];
165191
- for (let i6 = 0; i6 < repeats; i6++) {
165192
- const r6 = await benchmarkQuery(sql, params);
165193
- results.push(r6);
165194
- }
165195
- return results;
165196
- };
165197
165033
  return {
165198
165034
  db: { query },
165199
165035
  packageName: "mysql2",
165200
165036
  proxy,
165201
165037
  transactionProxy,
165202
- benchmarkProxy,
165203
165038
  database: result2.database,
165204
165039
  migrate: migrateFn
165205
165040
  };
@@ -176854,7 +176689,7 @@ __export(studio_exports, {
176854
176689
  prepareServer: () => prepareServer,
176855
176690
  prepareSingleStoreSchema: () => prepareSingleStoreSchema
176856
176691
  });
176857
- var import_crypto11, import_drizzle_orm8, import_relations8, import_mssql_core3, import_mysql_core3, import_pg_core3, import_singlestore_core2, import_sqlite_core3, import_fs16, import_node_https2, preparePgSchema, prepareMySqlSchema, prepareMsSqlSchema, prepareSQLiteSchema, prepareSingleStoreSchema, getCustomDefaults, drizzleForPostgres, drizzleForMySQL, drizzleForSQLite, drizzleForLibSQL, drizzleForSingleStore, extractRelations, init, proxySchema, transactionProxySchema, benchmarkProxySchema, defaultsSchema, schema5, jsonStringify, prepareServer;
176692
+ var import_crypto11, import_drizzle_orm8, import_relations8, import_mssql_core3, import_mysql_core3, import_pg_core3, import_singlestore_core2, import_sqlite_core3, import_fs16, import_node_https2, preparePgSchema, prepareMySqlSchema, prepareMsSqlSchema, prepareSQLiteSchema, prepareSingleStoreSchema, getCustomDefaults, drizzleForPostgres, drizzleForMySQL, drizzleForSQLite, drizzleForLibSQL, drizzleForSingleStore, extractRelations, init, proxySchema, transactionProxySchema, defaultsSchema, schema5, jsonStringify, prepareServer;
176858
176693
  var init_studio = __esm({
176859
176694
  "src/cli/commands/studio.ts"() {
176860
176695
  "use strict";
@@ -177078,7 +176913,6 @@ var init_studio = __esm({
177078
176913
  packageName: db.packageName,
177079
176914
  proxy: db.proxy,
177080
176915
  transactionProxy: db.transactionProxy,
177081
- benchmarkProxy: db.benchmarkProxy,
177082
176916
  customDefaults,
177083
176917
  schema: pgSchema2,
177084
176918
  relations: relations5,
@@ -177088,7 +176922,7 @@ var init_studio = __esm({
177088
176922
  };
177089
176923
  drizzleForMySQL = async (credentials2, mysqlSchema, relations5, schemaFiles, casing2) => {
177090
176924
  const { connectToMySQL: connectToMySQL2 } = await Promise.resolve().then(() => (init_connections(), connections_exports));
177091
- const { proxy, transactionProxy, benchmarkProxy, database, packageName } = await connectToMySQL2(credentials2);
176925
+ const { proxy, transactionProxy, database, packageName } = await connectToMySQL2(credentials2);
177092
176926
  const customDefaults = getCustomDefaults(mysqlSchema, casing2);
177093
176927
  let dbUrl;
177094
176928
  if ("url" in credentials2) {
@@ -177104,7 +176938,6 @@ var init_studio = __esm({
177104
176938
  databaseName: database,
177105
176939
  proxy,
177106
176940
  transactionProxy,
177107
- benchmarkProxy,
177108
176941
  customDefaults,
177109
176942
  schema: mysqlSchema,
177110
176943
  relations: relations5,
@@ -177274,23 +177107,6 @@ var init_studio = __esm({
177274
177107
  ]).optional()
177275
177108
  }).array()
177276
177109
  });
177277
- benchmarkProxySchema = external_exports.object({
177278
- type: external_exports.literal("bproxy"),
177279
- data: external_exports.object({
177280
- query: external_exports.object({
177281
- sql: external_exports.string(),
177282
- params: external_exports.array(external_exports.any()).optional(),
177283
- method: external_exports.union([
177284
- external_exports.literal("values"),
177285
- external_exports.literal("get"),
177286
- external_exports.literal("all"),
177287
- external_exports.literal("run"),
177288
- external_exports.literal("execute")
177289
- ]).optional()
177290
- }),
177291
- repeats: external_exports.number().min(1).optional()
177292
- })
177293
- });
177294
177110
  defaultsSchema = external_exports.object({
177295
177111
  type: external_exports.literal("defaults"),
177296
177112
  data: external_exports.array(
@@ -177305,7 +177121,6 @@ var init_studio = __esm({
177305
177121
  init,
177306
177122
  proxySchema,
177307
177123
  transactionProxySchema,
177308
- benchmarkProxySchema,
177309
177124
  defaultsSchema
177310
177125
  ]);
177311
177126
  jsonStringify = (data2) => {
@@ -177328,7 +177143,6 @@ var init_studio = __esm({
177328
177143
  databaseName,
177329
177144
  proxy,
177330
177145
  transactionProxy,
177331
- benchmarkProxy,
177332
177146
  customDefaults,
177333
177147
  schema: drizzleSchema,
177334
177148
  relations: relations5,
@@ -177392,7 +177206,7 @@ var init_studio = __esm({
177392
177206
  console.warn("Error message:", error4.message);
177393
177207
  }
177394
177208
  return c5.json({
177395
- version: "6.3",
177209
+ version: "6.2",
177396
177210
  dialect: dialect6,
177397
177211
  driver: driver2,
177398
177212
  packageName,
@@ -177430,21 +177244,6 @@ var init_studio = __esm({
177430
177244
  }
177431
177245
  );
177432
177246
  }
177433
- if (type === "bproxy") {
177434
- if (!benchmarkProxy) {
177435
- throw new Error("Benchmark proxy is not configured for this database.");
177436
- }
177437
- const result2 = await benchmarkProxy(body.data.query, body.data.repeats || 1);
177438
- const res = jsonStringify(result2);
177439
- return c5.body(
177440
- res,
177441
- {
177442
- headers: {
177443
- "Content-Type": "application/json"
177444
- }
177445
- }
177446
- );
177447
- }
177448
177247
  if (type === "defaults") {
177449
177248
  const columns = body.data;
177450
177249
  const result2 = columns.map((column12) => {
@@ -179622,13 +179421,15 @@ var printConfigConnectionIssues6 = (options) => {
179622
179421
  if ("host" in options || "database" in options) {
179623
179422
  let text = `Please provide required params for Postgres driver:
179624
179423
  `;
179424
+ const portHint = typeof options.port === "number" ? "" : ` (port should be a number)`;
179425
+ const sslHint = typeof options.ssl === "boolean" || typeof options.ssl === "string" && ["require", "allow", "prefer", "verify-full"].includes(options.ssl) || typeof options.ssl === "object" && options.ssl !== null ? "" : ` (ssl should be of type boolean | "require" | "allow" | "prefer" | "verify-full" | options from node:tls)`;
179625
179426
  console.log(error2(text));
179626
179427
  console.log(wrapParam("host", options.host));
179627
- console.log(wrapParam("port", options.port, true));
179428
+ console.log(wrapParam("port", options.port, true, void 0, portHint === "" ? true : false) + portHint);
179628
179429
  console.log(wrapParam("user", options.user, true));
179629
179430
  console.log(wrapParam("password", options.password, true, "secret"));
179630
179431
  console.log(wrapParam("database", options.database));
179631
- console.log(wrapParam("ssl", options.ssl, true));
179432
+ console.log(wrapParam("ssl", options.ssl, true, void 0, sslHint === "" ? true : false) + sslHint);
179632
179433
  process.exit(1);
179633
179434
  }
179634
179435
  console.log(