@dbml/connector 10.4.0-alpha.2 → 11.0.0-alpha.2

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/dist/index.mjs CHANGED
@@ -5,14 +5,7 @@ import r, { getConnection as i } from "oracledb";
5
5
  import { Client as a } from "pg";
6
6
  import o from "snowflake-sdk";
7
7
  //#region \0rolldown/runtime.js
8
- var s = Object.defineProperty, c = Object.getOwnPropertyDescriptor, l = Object.getOwnPropertyNames, u = Object.prototype.hasOwnProperty, d = (e, t, n) => () => {
9
- if (n) throw n[0];
10
- try {
11
- return e && (t = e(e = 0)), t;
12
- } catch (e) {
13
- throw n = [e], e;
14
- }
15
- }, f = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), p = (e, t) => {
8
+ var s = Object.defineProperty, c = Object.getOwnPropertyDescriptor, l = Object.getOwnPropertyNames, u = Object.prototype.hasOwnProperty, d = (e, t) => () => (e && (t = e(e = 0)), t), f = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), p = (e, t) => {
16
9
  let n = {};
17
10
  for (var r in e) s(n, r, {
18
11
  get: e[r],
@@ -454,7 +447,7 @@ var se = "schemas=", D = (e) => e.toLowerCase().includes(se), ce = (e) => e ? e.
454
447
  ORDER BY
455
448
  s.name,
456
449
  t.name;
457
- `, i = await e.query(r), a = (e, t) => e.length === t.length && e.every((e, n) => e.tableName === t[n].tableName && e.schemaName === t[n].schemaName && e.fieldNames.length === t[n].fieldNames.length && e.fieldNames.every((e, r) => e === t[n].fieldNames[r]));
450
+ `, i = await e.query(r), a = (e, t) => e.length === t.length ? e.every((e, n) => e.tableName === t[n].tableName && e.schemaName === t[n].schemaName && e.fieldNames.length === t[n].fieldNames.length && e.fieldNames.every((e, r) => e === t[n].fieldNames[r])) : !1;
458
451
  return i.recordset.forEach((e) => {
459
452
  let { table_schema: t, fk_constraint_name: r, table_name: i, column_names: o, foreign_table_schema: s, foreign_table_name: c, foreign_column_names: l, on_delete: u, on_update: d } = e, f = {
460
453
  name: r,
@@ -592,13 +585,19 @@ var se = "schemas=", D = (e) => e.toLowerCase().includes(se), ce = (e) => e ? e.
592
585
  `, c = await e.query(s), l = {};
593
586
  return c.recordset.forEach((e) => {
594
587
  let { table_schema: t, table_name: n, column_name: r, check_name: i, check_expression: a } = e, s = `${t}.${n}`;
595
- a && (r ? (o[s] || (o[s] = {}), o[s][r] || (o[s][r] = { checks: [] }), o[s][r].checks.push({
596
- name: i,
597
- expression: a.slice(1, -1)
598
- })) : (l[s] || (l[s] = []), l[s].push({
599
- name: i,
600
- expression: a.slice(1, -1)
601
- })));
588
+ if (a) {
589
+ if (r) {
590
+ o[s] || (o[s] = {}), o[s][r] || (o[s][r] = { checks: [] }), o[s][r].checks.push({
591
+ name: i,
592
+ expression: a.slice(1, -1)
593
+ });
594
+ return;
595
+ }
596
+ l[s] || (l[s] = []), l[s].push({
597
+ name: i,
598
+ expression: a.slice(1, -1)
599
+ });
600
+ }
602
601
  }), {
603
602
  indexes: a,
604
603
  tableConstraints: o,
@@ -713,7 +712,8 @@ var Ve = /* @__PURE__ */ f(((e) => {
713
712
  return (t + n) * 3 / 4 - n;
714
713
  }
715
714
  function u(e) {
716
- for (var t, i = s(e), a = i[0], o = i[1], c = new r(l(e, a, o)), u = 0, d = o > 0 ? a - 4 : a, f = 0; f < d; f += 4) t = n[e.charCodeAt(f)] << 18 | n[e.charCodeAt(f + 1)] << 12 | n[e.charCodeAt(f + 2)] << 6 | n[e.charCodeAt(f + 3)], c[u++] = t >> 16 & 255, c[u++] = t >> 8 & 255, c[u++] = t & 255;
715
+ var t, i = s(e), a = i[0], o = i[1], c = new r(l(e, a, o)), u = 0, d = o > 0 ? a - 4 : a, f;
716
+ for (f = 0; f < d; f += 4) t = n[e.charCodeAt(f)] << 18 | n[e.charCodeAt(f + 1)] << 12 | n[e.charCodeAt(f + 2)] << 6 | n[e.charCodeAt(f + 3)], c[u++] = t >> 16 & 255, c[u++] = t >> 8 & 255, c[u++] = t & 255;
717
717
  return o === 2 && (t = n[e.charCodeAt(f)] << 2 | n[e.charCodeAt(f + 1)] >> 4, c[u++] = t & 255), o === 1 && (t = n[e.charCodeAt(f)] << 10 | n[e.charCodeAt(f + 1)] << 4 | n[e.charCodeAt(f + 2)] >> 2, c[u++] = t >> 8 & 255, c[u++] = t & 255), c;
718
718
  }
719
719
  function d(e) {
@@ -749,7 +749,7 @@ var Ve = /* @__PURE__ */ f(((e) => {
749
749
  e.kMaxLength = i, s.TYPED_ARRAY_SUPPORT = a(), !s.TYPED_ARRAY_SUPPORT && typeof console < "u" && typeof console.error == "function" && console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");
750
750
  function a() {
751
751
  try {
752
- let e = /* @__PURE__ */ new Uint8Array(1), t = { foo: function() {
752
+ let e = new Uint8Array(1), t = { foo: function() {
753
753
  return 42;
754
754
  } };
755
755
  return Object.setPrototypeOf(t, Uint8Array.prototype), Object.setPrototypeOf(e, t), e.foo() === 42;
@@ -964,7 +964,7 @@ var Ve = /* @__PURE__ */ f(((e) => {
964
964
  return e === 0 ? "" : arguments.length === 0 ? re(this, 0, e) : b.apply(this, arguments);
965
965
  }, s.prototype.toLocaleString = s.prototype.toString, s.prototype.equals = function(e) {
966
966
  if (!s.isBuffer(e)) throw TypeError("Argument must be a Buffer");
967
- return this === e || s.compare(this, e) === 0;
967
+ return this === e ? !0 : s.compare(this, e) === 0;
968
968
  }, s.prototype.inspect = function() {
969
969
  let t = "", n = e.INSPECT_MAX_BYTES;
970
970
  return t = this.toString("hex", 0, n).replace(/(.{2})/g, "$1 ").trim(), this.length > n && (t += " ... "), "<Buffer " + t + ">";
@@ -987,10 +987,8 @@ var Ve = /* @__PURE__ */ f(((e) => {
987
987
  if (typeof n == "string" ? (r = n, n = 0) : n > 2147483647 ? n = 2147483647 : n < -2147483648 && (n = -2147483648), n = +n, L(n) && (n = i ? 0 : e.length - 1), n < 0 && (n = e.length + n), n >= e.length) {
988
988
  if (i) return -1;
989
989
  n = e.length - 1;
990
- } else if (n < 0) {
991
- if (i) n = 0;
992
- else return -1;
993
- }
990
+ } else if (n < 0) if (i) n = 0;
991
+ else return -1;
994
992
  if (typeof t == "string" && (t = s.from(t, r)), s.isBuffer(t)) return t.length === 0 ? -1 : C(e, t, n, r, i);
995
993
  if (typeof t == "number") return t &= 255, typeof Uint8Array.prototype.indexOf == "function" ? i ? Uint8Array.prototype.indexOf.call(e, t, n) : Uint8Array.prototype.lastIndexOf.call(e, t, n) : C(e, [t], n, r, i);
996
994
  throw TypeError("val must be string, number or Buffer");
@@ -1033,8 +1031,8 @@ var Ve = /* @__PURE__ */ f(((e) => {
1033
1031
  r ? (r = Number(r), r > i && (r = i)) : r = i;
1034
1032
  let a = t.length;
1035
1033
  r > a / 2 && (r = a / 2);
1036
- let o = 0;
1037
- for (; o < r; ++o) {
1034
+ let o;
1035
+ for (o = 0; o < r; ++o) {
1038
1036
  let r = parseInt(t.substr(o * 2, 2), 16);
1039
1037
  if (L(r)) return o;
1040
1038
  e[n + o] = r;
@@ -1177,13 +1175,13 @@ var Ve = /* @__PURE__ */ f(((e) => {
1177
1175
  e >>>= 0, M(e, "offset");
1178
1176
  let t = this[e], n = this[e + 7];
1179
1177
  (t === void 0 || n === void 0) && N(e, this.length - 8);
1180
- let r = t + this[++e] * 256 + this[++e] * 2 ** 16 + this[++e] * 2 ** 24, i = this[++e] + this[++e] * 256 + this[++e] * 2 ** 16 + n * 2 ** 24;
1178
+ let r = t + this[++e] * 2 ** 8 + this[++e] * 2 ** 16 + this[++e] * 2 ** 24, i = this[++e] + this[++e] * 2 ** 8 + this[++e] * 2 ** 16 + n * 2 ** 24;
1181
1179
  return BigInt(r) + (BigInt(i) << BigInt(32));
1182
1180
  }), s.prototype.readBigUInt64BE = R(function(e) {
1183
1181
  e >>>= 0, M(e, "offset");
1184
1182
  let t = this[e], n = this[e + 7];
1185
1183
  (t === void 0 || n === void 0) && N(e, this.length - 8);
1186
- let r = t * 2 ** 24 + this[++e] * 2 ** 16 + this[++e] * 256 + this[++e], i = this[++e] * 2 ** 24 + this[++e] * 2 ** 16 + this[++e] * 256 + n;
1184
+ let r = t * 2 ** 24 + this[++e] * 2 ** 16 + this[++e] * 2 ** 8 + this[++e], i = this[++e] * 2 ** 24 + this[++e] * 2 ** 16 + this[++e] * 2 ** 8 + n;
1187
1185
  return (BigInt(r) << BigInt(32)) + BigInt(i);
1188
1186
  }), s.prototype.readIntLE = function(e, t, n) {
1189
1187
  e >>>= 0, t >>>= 0, n || O(e, t, this.length);
@@ -1213,14 +1211,14 @@ var Ve = /* @__PURE__ */ f(((e) => {
1213
1211
  e >>>= 0, M(e, "offset");
1214
1212
  let t = this[e], n = this[e + 7];
1215
1213
  (t === void 0 || n === void 0) && N(e, this.length - 8);
1216
- let r = this[e + 4] + this[e + 5] * 256 + this[e + 6] * 2 ** 16 + (n << 24);
1217
- return (BigInt(r) << BigInt(32)) + BigInt(t + this[++e] * 256 + this[++e] * 2 ** 16 + this[++e] * 2 ** 24);
1214
+ let r = this[e + 4] + this[e + 5] * 2 ** 8 + this[e + 6] * 2 ** 16 + (n << 24);
1215
+ return (BigInt(r) << BigInt(32)) + BigInt(t + this[++e] * 2 ** 8 + this[++e] * 2 ** 16 + this[++e] * 2 ** 24);
1218
1216
  }), s.prototype.readBigInt64BE = R(function(e) {
1219
1217
  e >>>= 0, M(e, "offset");
1220
1218
  let t = this[e], n = this[e + 7];
1221
1219
  (t === void 0 || n === void 0) && N(e, this.length - 8);
1222
- let r = (t << 24) + this[++e] * 2 ** 16 + this[++e] * 256 + this[++e];
1223
- return (BigInt(r) << BigInt(32)) + BigInt(this[++e] * 2 ** 24 + this[++e] * 2 ** 16 + this[++e] * 256 + n);
1220
+ let r = (t << 24) + this[++e] * 2 ** 16 + this[++e] * 2 ** 8 + this[++e];
1221
+ return (BigInt(r) << BigInt(32)) + BigInt(this[++e] * 2 ** 24 + this[++e] * 2 ** 16 + this[++e] * 2 ** 8 + n);
1224
1222
  }), s.prototype.readFloatLE = function(e, t) {
1225
1223
  return e >>>= 0, t || O(e, 4, this.length), n.read(this, e, !0, 23, 4);
1226
1224
  }, s.prototype.readFloatBE = function(e, t) {
@@ -1286,7 +1284,7 @@ var Ve = /* @__PURE__ */ f(((e) => {
1286
1284
  k(this, e, t, n, r - 1, -r);
1287
1285
  }
1288
1286
  let i = 0, a = 1, o = 0;
1289
- for (this[t] = e & 255; ++i < n && (a *= 256);) e < 0 && o === 0 && this[t + i - 1] !== 0 && (o = 1), this[t + i] = (e / a | 0) - o & 255;
1287
+ for (this[t] = e & 255; ++i < n && (a *= 256);) e < 0 && o === 0 && this[t + i - 1] !== 0 && (o = 1), this[t + i] = (e / a >> 0) - o & 255;
1290
1288
  return t + n;
1291
1289
  }, s.prototype.writeIntBE = function(e, t, n, r) {
1292
1290
  if (e = +e, t >>>= 0, !r) {
@@ -1294,7 +1292,7 @@ var Ve = /* @__PURE__ */ f(((e) => {
1294
1292
  k(this, e, t, n, r - 1, -r);
1295
1293
  }
1296
1294
  let i = n - 1, a = 1, o = 0;
1297
- for (this[t + i] = e & 255; --i >= 0 && (a *= 256);) e < 0 && o === 0 && this[t + i + 1] !== 0 && (o = 1), this[t + i] = (e / a | 0) - o & 255;
1295
+ for (this[t + i] = e & 255; --i >= 0 && (a *= 256);) e < 0 && o === 0 && this[t + i + 1] !== 0 && (o = 1), this[t + i] = (e / a >> 0) - o & 255;
1298
1296
  return t + n;
1299
1297
  }, s.prototype.writeInt8 = function(e, t, n) {
1300
1298
  return e = +e, t >>>= 0, n || k(this, e, t, 1, 127, -128), e < 0 && (e = 255 + e + 1), this[t] = e & 255, t + 1;
@@ -1426,7 +1424,10 @@ var Ve = /* @__PURE__ */ f(((e) => {
1426
1424
  for (let o = 0; o < r; ++o) {
1427
1425
  if (n = e.charCodeAt(o), n > 55295 && n < 57344) {
1428
1426
  if (!i) {
1429
- if (n > 56319 || o + 1 === r) {
1427
+ if (n > 56319) {
1428
+ (t -= 3) > -1 && a.push(239, 191, 189);
1429
+ continue;
1430
+ } else if (o + 1 === r) {
1430
1431
  (t -= 3) > -1 && a.push(239, 191, 189);
1431
1432
  continue;
1432
1433
  }
@@ -1469,8 +1470,8 @@ var Ve = /* @__PURE__ */ f(((e) => {
1469
1470
  return t.toByteArray(ve(e));
1470
1471
  }
1471
1472
  function F(e, t, n, r) {
1472
- let i = 0;
1473
- for (; i < r && !(i + n >= t.length || i >= e.length); ++i) t[i + n] = e[i];
1473
+ let i;
1474
+ for (i = 0; i < r && !(i + n >= t.length || i >= e.length); ++i) t[i + n] = e[i];
1474
1475
  return i;
1475
1476
  }
1476
1477
  function I(e, t) {
@@ -1495,7 +1496,7 @@ var Ve = /* @__PURE__ */ f(((e) => {
1495
1496
  }
1496
1497
  })), We = /* @__PURE__ */ f(((e) => {
1497
1498
  Object.defineProperty(e, "__esModule", { value: !0 }), e.raw = e.format = e.escape = e.arrayToList = e.bufferToString = e.objectToValues = e.escapeId = e.temporalToString = e.dateToString = void 0;
1498
- var t = Ue(), n = /* @__PURE__ */ new Uint8Array(128), r = {}, i = [
1499
+ var t = Ue(), n = new Uint8Array(128), r = {}, i = [
1499
1500
  "where",
1500
1501
  "order",
1501
1502
  "group",
@@ -1553,8 +1554,11 @@ var Ve = /* @__PURE__ */ f(((e) => {
1553
1554
  if (n === o.backtick) {
1554
1555
  let n = e.length;
1555
1556
  for (let r = t + 1; r < n; r++) if (e.charCodeAt(r) === o.backtick) {
1556
- if (e.charCodeAt(r + 1) === o.backtick) r++;
1557
- else return r + 1;
1557
+ if (e.charCodeAt(r + 1) === o.backtick) {
1558
+ r++;
1559
+ continue;
1560
+ }
1561
+ return r + 1;
1558
1562
  }
1559
1563
  return n;
1560
1564
  }
@@ -1595,12 +1599,20 @@ var Ve = /* @__PURE__ */ f(((e) => {
1595
1599
  continue;
1596
1600
  }
1597
1601
  }
1598
- if (u(t)) m++;
1599
- else if (t === o.openParen) s++, c = !0, d = !1, m++;
1600
- else if (t === o.closeParen) {
1602
+ if (u(t)) {
1603
+ m++;
1604
+ continue;
1605
+ }
1606
+ if (t === o.openParen) {
1607
+ s++, c = !0, d = !1, m++;
1608
+ continue;
1609
+ }
1610
+ if (t === o.closeParen) {
1601
1611
  if (--s < 0) return !1;
1602
1612
  c = !0, d = !1, m++;
1603
- } else if (l(t)) {
1613
+ continue;
1614
+ }
1615
+ if (l(t)) {
1604
1616
  if (s === 0 && !(t >= 48 && t <= 57)) {
1605
1617
  let n = r[t | 32];
1606
1618
  if (n) {
@@ -1611,16 +1623,16 @@ var Ve = /* @__PURE__ */ f(((e) => {
1611
1623
  m++;
1612
1624
  while (m < i && l(e.charCodeAt(m)));
1613
1625
  c = !0, d = !1;
1614
- } else {
1615
- if (s === 0) {
1616
- if (t === o.semicolon) return !1;
1617
- if (t === o.comma) {
1618
- d = !0, c = !0, m++;
1619
- continue;
1620
- }
1626
+ continue;
1627
+ }
1628
+ if (s === 0) {
1629
+ if (t === o.semicolon) return !1;
1630
+ if (t === o.comma) {
1631
+ d = !0, c = !0, m++;
1632
+ continue;
1621
1633
  }
1622
- c = !0, d = !1, m++;
1623
1634
  }
1635
+ c = !0, d = !1, m++;
1624
1636
  }
1625
1637
  return s === 0 && (!c || d);
1626
1638
  }, g = (e, t = 0) => {
@@ -1745,24 +1757,24 @@ var Ve = /* @__PURE__ */ f(((e) => {
1745
1757
  let n = x + 1, s;
1746
1758
  for (; t.charCodeAt(n) === 63;) n++;
1747
1759
  let S = n - x, C = a[b];
1748
- if (S > 2) x = m(t, n);
1749
- else {
1750
- if (S === 2) s = (0, e.escapeId)(C);
1751
- else if (typeof C == "number" || typeof C == "bigint") s = `${C}`;
1752
- else if (typeof C == "object" && C && !r) {
1753
- if (!(Array.isArray(C) || C instanceof Uint8Array || C instanceof Date || y(C) || _(C)) && (c(C) || C instanceof Map)) {
1754
- let n = x - 1;
1755
- for (; n >= v && u(t.charCodeAt(n));) n--;
1756
- let r = n >= v ? d(t.charCodeAt(n)) : 0;
1757
- if ((r < 97 || r > 122) && r !== o.comma) s = (0, e.escape)(C, !0, i);
1758
- else {
1759
- for (l === -2 && (l = g(t), f = l === -1 ? -1 : g(t, l)); f !== -1 && f <= x;) l = f, f = g(t, f);
1760
- s = l !== -1 && l <= x && h(t, l, x) ? (0, e.objectToValues)(C, i) : (0, e.escape)(C, !0, i);
1761
- }
1762
- } else s = (0, e.escape)(C, !0, i);
1763
- } else s = (0, e.escape)(C, r, i);
1764
- p += t.slice(v, x), p += s, v = n, b++, x = m(t, n);
1760
+ if (S > 2) {
1761
+ x = m(t, n);
1762
+ continue;
1765
1763
  }
1764
+ if (S === 2) s = (0, e.escapeId)(C);
1765
+ else if (typeof C == "number" || typeof C == "bigint") s = `${C}`;
1766
+ else if (typeof C == "object" && C && !r) if (!(Array.isArray(C) || C instanceof Uint8Array || C instanceof Date || y(C) || _(C)) && (c(C) || C instanceof Map)) {
1767
+ let n = x - 1;
1768
+ for (; n >= v && u(t.charCodeAt(n));) n--;
1769
+ let r = n >= v ? d(t.charCodeAt(n)) : 0;
1770
+ if ((r < 97 || r > 122) && r !== o.comma) s = (0, e.escape)(C, !0, i);
1771
+ else {
1772
+ for (l === -2 && (l = g(t), f = l === -1 ? -1 : g(t, l)); f !== -1 && f <= x;) l = f, f = g(t, f);
1773
+ s = l !== -1 && l <= x && h(t, l, x) ? (0, e.objectToValues)(C, i) : (0, e.escape)(C, !0, i);
1774
+ }
1775
+ } else s = (0, e.escape)(C, !0, i);
1776
+ else s = (0, e.escape)(C, r, i);
1777
+ p += t.slice(v, x), p += s, v = n, b++, x = m(t, n);
1766
1778
  }
1767
1779
  return v === 0 ? t : v < t.length ? p + t.slice(v) : p;
1768
1780
  }, e.raw = (e) => {
@@ -2142,7 +2154,7 @@ var Ve = /* @__PURE__ */ f(((e) => {
2142
2154
  }
2143
2155
  var l = [], u = !1, d, f = -1;
2144
2156
  function p() {
2145
- u && d && (u = !1, d.length ? l = d.concat(l) : f = -1, l.length && m());
2157
+ !u || !d || (u = !1, d.length ? l = d.concat(l) : f = -1, l.length && m());
2146
2158
  }
2147
2159
  function m() {
2148
2160
  if (!u) {
@@ -2278,24 +2290,21 @@ var Ve = /* @__PURE__ */ f(((e) => {
2278
2290
  var n = e;
2279
2291
  if (n === (n | 0)) {
2280
2292
  var r = this.size();
2281
- if (n < 0 && (n += r), !(n > r)) {
2282
- if (arguments.length > 2) {
2283
- var i, a, o, s = arguments.length, c = this._list.length, l = 2;
2284
- if (!r || n < r / 2) {
2285
- for (a = Array(n), i = 0; i < n; i++) a[i] = this._list[this._head + i & this._capacityMask];
2286
- for (t === 0 ? (o = [], n > 0 && (this._head = this._head + n + c & this._capacityMask)) : (o = this.remove(n, t), this._head = this._head + n + c & this._capacityMask); s > l;) this.unshift(arguments[--s]);
2287
- for (i = n; i > 0; i--) this.unshift(a[i - 1]);
2288
- } else {
2289
- a = Array(r - (n + t));
2290
- var u = a.length;
2291
- for (i = 0; i < u; i++) a[i] = this._list[this._head + n + t + i & this._capacityMask];
2292
- for (t === 0 ? (o = [], n != r && (this._tail = this._head + n + c & this._capacityMask)) : (o = this.remove(n, t), this._tail = this._tail - u + c & this._capacityMask); l < s;) this.push(arguments[l++]);
2293
- for (i = 0; i < u; i++) this.push(a[i]);
2294
- }
2295
- return o;
2293
+ if (n < 0 && (n += r), !(n > r)) if (arguments.length > 2) {
2294
+ var i, a, o, s = arguments.length, c = this._list.length, l = 2;
2295
+ if (!r || n < r / 2) {
2296
+ for (a = Array(n), i = 0; i < n; i++) a[i] = this._list[this._head + i & this._capacityMask];
2297
+ for (t === 0 ? (o = [], n > 0 && (this._head = this._head + n + c & this._capacityMask)) : (o = this.remove(n, t), this._head = this._head + n + c & this._capacityMask); s > l;) this.unshift(arguments[--s]);
2298
+ for (i = n; i > 0; i--) this.unshift(a[i - 1]);
2299
+ } else {
2300
+ a = Array(r - (n + t));
2301
+ var u = a.length;
2302
+ for (i = 0; i < u; i++) a[i] = this._list[this._head + n + t + i & this._capacityMask];
2303
+ for (t === 0 ? (o = [], n != r && (this._tail = this._head + n + c & this._capacityMask)) : (o = this.remove(n, t), this._tail = this._tail - u + c & this._capacityMask); l < s;) this.push(arguments[l++]);
2304
+ for (i = 0; i < u; i++) this.push(a[i]);
2296
2305
  }
2297
- return this.remove(n, t);
2298
- }
2306
+ return o;
2307
+ } else return this.remove(n, t);
2299
2308
  }
2300
2309
  }, n.prototype.clear = function() {
2301
2310
  this._list = Array(this._list.length), this._head = 0, this._tail = 0;
@@ -2715,13 +2724,10 @@ var Ve = /* @__PURE__ */ f(((e) => {
2715
2724
  }, E.toString = function(e) {
2716
2725
  if (e ||= 10, e < 2 || 36 < e) throw RangeError("radix");
2717
2726
  if (this.isZero()) return "0";
2718
- if (this.isNegative()) {
2719
- if (this.eq(T)) {
2720
- var t = c(e), n = this.div(t), r = n.mul(t).sub(this);
2721
- return n.toString(e) + r.toInt().toString(e);
2722
- }
2723
- return "-" + this.neg().toString(e);
2724
- }
2727
+ if (this.isNegative()) if (this.eq(T)) {
2728
+ var t = c(e), n = this.div(t), r = n.mul(t).sub(this);
2729
+ return n.toString(e) + r.toInt().toString(e);
2730
+ } else return "-" + this.neg().toString(e);
2725
2731
  for (var i = c(u(e, 6), this.unsigned), a = this, o = "";;) {
2726
2732
  var s = a.div(i), l = (a.sub(s.mul(i)).toInt() >>> 0).toString(e);
2727
2733
  if (a = s, a.isZero()) return l + o;
@@ -2742,7 +2748,7 @@ var Ve = /* @__PURE__ */ f(((e) => {
2742
2748
  return this.high == 0 ? t + 1 : t + 33;
2743
2749
  }, E.isSafeInteger = function() {
2744
2750
  var e = this.high >> 21;
2745
- return !e || !this.unsigned && e === -1 && (this.low !== 0 || this.high !== -2097152);
2751
+ return e ? this.unsigned ? !1 : e === -1 && !(this.low === 0 && this.high === -2097152) : !0;
2746
2752
  }, E.isZero = function() {
2747
2753
  return this.high === 0 && this.low === 0;
2748
2754
  }, E.eqz = E.isZero, E.isNegative = function() {
@@ -2752,7 +2758,7 @@ var Ve = /* @__PURE__ */ f(((e) => {
2752
2758
  }, E.isOdd = function() {
2753
2759
  return (this.low & 1) == 1;
2754
2760
  }, E.isEven = function() {
2755
- return !(this.low & 1);
2761
+ return (this.low & 1) == 0;
2756
2762
  }, E.equals = function(e) {
2757
2763
  return r(e) || (e = f(e)), this.unsigned !== e.unsigned && this.high >>> 31 == 1 && e.high >>> 31 == 1 ? !1 : this.high === e.high && this.low === e.low;
2758
2764
  }, E.eq = E.equals, E.notEquals = function(e) {
@@ -2883,9 +2889,9 @@ var Ve = /* @__PURE__ */ f(((e) => {
2883
2889
  });
2884
2890
  })), V = /* @__PURE__ */ f(((e, t) => {
2885
2891
  var n = Ue(), r = n.Buffer, i = {}, a;
2886
- for (a in n) n.hasOwnProperty(a) && a !== "SlowBuffer" && a !== "Buffer" && (i[a] = n[a]);
2892
+ for (a in n) n.hasOwnProperty(a) && (a === "SlowBuffer" || a === "Buffer" || (i[a] = n[a]));
2887
2893
  var o = i.Buffer = {};
2888
- for (a in r) r.hasOwnProperty(a) && a !== "allocUnsafe" && a !== "allocUnsafeSlow" && (o[a] = r[a]);
2894
+ for (a in r) r.hasOwnProperty(a) && (a === "allocUnsafe" || a === "allocUnsafeSlow" || (o[a] = r[a]));
2889
2895
  if (i.Buffer.prototype = r.prototype, (!o.from || o.from === Uint8Array.from) && (o.from = function(e, t, n) {
2890
2896
  if (typeof e == "number") throw TypeError("The \"value\" argument must not be of type number. Received type " + typeof e);
2891
2897
  if (e && e.length === void 0) throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof e);
@@ -2900,22 +2906,23 @@ var Ve = /* @__PURE__ */ f(((e) => {
2900
2906
  } catch {}
2901
2907
  i.constants || (i.constants = { MAX_LENGTH: i.kMaxLength }, i.kStringMaxLength && (i.constants.MAX_STRING_LENGTH = i.kStringMaxLength)), t.exports = i;
2902
2908
  })), Xe = /* @__PURE__ */ f(((e) => {
2903
- e.PrependBOM = t;
2904
- function t(e, t) {
2909
+ var t = "";
2910
+ e.PrependBOM = n;
2911
+ function n(e, t) {
2905
2912
  this.encoder = e, this.addBOM = !0;
2906
2913
  }
2907
- t.prototype.write = function(e) {
2908
- return this.addBOM &&= (e = "" + e, !1), this.encoder.write(e);
2909
- }, t.prototype.end = function() {
2914
+ n.prototype.write = function(e) {
2915
+ return this.addBOM &&= (e = t + e, !1), this.encoder.write(e);
2916
+ }, n.prototype.end = function() {
2910
2917
  return this.encoder.end();
2911
- }, e.StripBOM = n;
2912
- function n(e, t) {
2918
+ }, e.StripBOM = r;
2919
+ function r(e, t) {
2913
2920
  this.decoder = e, this.pass = !1, this.options = t || {};
2914
2921
  }
2915
- n.prototype.write = function(e) {
2916
- var t = this.decoder.write(e);
2917
- return this.pass || !t || (t[0] === "" && (t = t.slice(1), typeof this.options.stripBOM == "function" && this.options.stripBOM()), this.pass = !0), t;
2918
- }, n.prototype.end = function() {
2922
+ r.prototype.write = function(e) {
2923
+ var n = this.decoder.write(e);
2924
+ return this.pass || !n ? n : (n[0] === t && (n = n.slice(1), typeof this.options.stripBOM == "function" && this.options.stripBOM()), this.pass = !0, n);
2925
+ }, r.prototype.end = function() {
2919
2926
  return this.decoder.end();
2920
2927
  };
2921
2928
  })), Ze = /* @__PURE__ */ f(((e, t) => {
@@ -3151,7 +3158,7 @@ var Ve = /* @__PURE__ */ f(((e) => {
3151
3158
  l.prototype.write = function(e) {
3152
3159
  for (var t = this.acc, n = this.contBytes, r = this.accBytes, i = "", a = 0; a < e.length; a++) {
3153
3160
  var o = e[a];
3154
- (o & 192) == 128 ? n > 0 ? (t = t << 6 | o & 63, n--, r++, n === 0 && (i += r === 2 && t < 128 && t > 0 || r === 3 && t < 2048 ? this.defaultCharUnicode : String.fromCharCode(t))) : i += this.defaultCharUnicode : (n > 0 && (i += this.defaultCharUnicode, n = 0), o < 128 ? i += String.fromCharCode(o) : o < 224 ? (t = o & 31, n = 1, r = 1) : o < 240 ? (t = o & 15, n = 2, r = 1) : i += this.defaultCharUnicode);
3161
+ (o & 192) == 128 ? n > 0 ? (t = t << 6 | o & 63, n--, r++, n === 0 && (r === 2 && t < 128 && t > 0 || r === 3 && t < 2048 ? i += this.defaultCharUnicode : i += String.fromCharCode(t))) : i += this.defaultCharUnicode : (n > 0 && (i += this.defaultCharUnicode, n = 0), o < 128 ? i += String.fromCharCode(o) : o < 224 ? (t = o & 31, n = 1, r = 1) : o < 240 ? (t = o & 15, n = 2, r = 1) : i += this.defaultCharUnicode);
3155
3162
  }
3156
3163
  return this.acc = t, this.contBytes = n, this.accBytes = r, i;
3157
3164
  }, l.prototype.end = function() {
@@ -3192,13 +3199,11 @@ var Ve = /* @__PURE__ */ f(((e) => {
3192
3199
  r.prototype.write = function(e) {
3193
3200
  for (var n = t.from(e, "ucs2"), r = t.alloc(n.length * 2 + 4), i = this.isLE ? r.writeUInt32LE : r.writeUInt32BE, a = 0, o = 0; o < n.length; o += 2) {
3194
3201
  var s = n.readUInt16LE(o), c = s >= 55296 && s < 56320, l = s >= 56320 && s < 57344;
3195
- if (this.highSurrogate) {
3196
- if (c || !l) i.call(r, this.highSurrogate, a), a += 4;
3197
- else {
3198
- var u = (this.highSurrogate - 55296 << 10 | s - 56320) + 65536;
3199
- i.call(r, u, a), a += 4, this.highSurrogate = 0;
3200
- continue;
3201
- }
3202
+ if (this.highSurrogate) if (c || !l) i.call(r, this.highSurrogate, a), a += 4;
3203
+ else {
3204
+ var u = (this.highSurrogate - 55296 << 10 | s - 56320) + 65536;
3205
+ i.call(r, u, a), a += 4, this.highSurrogate = 0;
3206
+ continue;
3202
3207
  }
3203
3208
  c ? this.highSurrogate = s : (i.call(r, s, a), a += 4, this.highSurrogate = 0);
3204
3209
  }
@@ -4140,16 +4145,14 @@ var Ve = /* @__PURE__ */ f(((e) => {
4140
4145
  }, l.prototype._fillEncodeTable = function(e, t, n) {
4141
4146
  for (var r = this.decodeTables[e], o = !1, s = {}, c = 0; c < 256; c++) {
4142
4147
  var l = r[c], u = t + c;
4143
- if (!n[u]) {
4144
- if (l >= 0) this._setEncodeChar(l, u), o = !0;
4145
- else if (l <= a) {
4146
- var d = a - l;
4147
- if (!s[d]) {
4148
- var f = u << 8 >>> 0;
4149
- this._fillEncodeTable(d, f, n) ? o = !0 : s[d] = !0;
4150
- }
4151
- } else l <= i && (this._setEncodeSequence(this.decodeTableSeq[i - l], u), o = !0);
4152
- }
4148
+ if (!n[u]) if (l >= 0) this._setEncodeChar(l, u), o = !0;
4149
+ else if (l <= a) {
4150
+ var d = a - l;
4151
+ if (!s[d]) {
4152
+ var f = u << 8 >>> 0;
4153
+ this._fillEncodeTable(d, f, n) ? o = !0 : s[d] = !0;
4154
+ }
4155
+ } else l <= i && (this._setEncodeSequence(this.decodeTableSeq[i - l], u), o = !0);
4153
4156
  }
4154
4157
  return o;
4155
4158
  };
@@ -4165,23 +4168,20 @@ var Ve = /* @__PURE__ */ f(((e) => {
4165
4168
  var d = c;
4166
4169
  c = -1;
4167
4170
  }
4168
- if (d >= 55296 && d < 57344) {
4169
- if (d < 56320) {
4170
- if (a === -1) {
4171
- a = d;
4172
- continue;
4173
- }
4174
- a = d, d = n;
4175
- } else a === -1 ? d = n : (d = 65536 + (a - 55296) * 1024 + (d - 56320), a = -1);
4176
- } else a !== -1 && (c = d, d = n, a = -1);
4171
+ if (d >= 55296 && d < 57344) if (d < 56320) if (a === -1) {
4172
+ a = d;
4173
+ continue;
4174
+ } else a = d, d = n;
4175
+ else a === -1 ? d = n : (d = 65536 + (a - 55296) * 1024 + (d - 56320), a = -1);
4176
+ else a !== -1 && (c = d, d = n, a = -1);
4177
4177
  var p = n;
4178
4178
  if (o !== void 0 && d != n) {
4179
4179
  var m = o[d];
4180
4180
  if (typeof m == "object") {
4181
4181
  o = m;
4182
4182
  continue;
4183
- }
4184
- typeof m == "number" ? p = m : m ?? (m = o[s], m !== void 0 && (p = m, c = d)), o = void 0;
4183
+ } else typeof m == "number" ? p = m : m ?? (m = o[s], m !== void 0 && (p = m, c = d));
4184
+ o = void 0;
4185
4185
  } else if (d >= 0) {
4186
4186
  var h = this.encodeTable[d >> 8];
4187
4187
  if (h !== void 0 && (p = h[d & 255]), p <= i) {
@@ -4201,7 +4201,7 @@ var Ve = /* @__PURE__ */ f(((e) => {
4201
4201
  }
4202
4202
  return this.seqObj = o, this.leadSurrogate = a, r.slice(0, u);
4203
4203
  }, u.prototype.end = function() {
4204
- if (this.leadSurrogate !== -1 || this.seqObj !== void 0) {
4204
+ if (!(this.leadSurrogate === -1 && this.seqObj === void 0)) {
4205
4205
  var e = t.alloc(10), n = 0;
4206
4206
  if (this.seqObj) {
4207
4207
  var r = this.seqObj[s];
@@ -4216,21 +4216,19 @@ var Ve = /* @__PURE__ */ f(((e) => {
4216
4216
  d.prototype.write = function(e) {
4217
4217
  for (var o = t.alloc(e.length * 2), s = this.nodeIdx, c = this.prevBytes, l = this.prevBytes.length, u = -this.prevBytes.length, d, p = 0, m = 0; p < e.length; p++) {
4218
4218
  var h = p >= 0 ? e[p] : c[p + l], d = this.decodeTables[s][h];
4219
- if (!(d >= 0)) {
4220
- if (d === n) d = this.defaultCharUnicode.charCodeAt(0), p = u;
4221
- else if (d === r) {
4222
- if (p >= 3) var g = (e[p - 3] - 129) * 12600 + (e[p - 2] - 48) * 1260 + (e[p - 1] - 129) * 10 + (h - 48);
4223
- else var g = (c[p - 3 + l] - 129) * 12600 + ((p - 2 >= 0 ? e[p - 2] : c[p - 2 + l]) - 48) * 1260 + ((p - 1 >= 0 ? e[p - 1] : c[p - 1 + l]) - 129) * 10 + (h - 48);
4224
- var _ = f(this.gb18030.gbChars, g);
4225
- d = this.gb18030.uChars[_] + g - this.gb18030.gbChars[_];
4226
- } else if (d <= a) {
4227
- s = a - d;
4228
- continue;
4229
- } else if (d <= i) {
4230
- for (var v = this.decodeTableSeq[i - d], y = 0; y < v.length - 1; y++) d = v[y], o[m++] = d & 255, o[m++] = d >> 8;
4231
- d = v[v.length - 1];
4232
- } else throw Error("iconv-lite internal error: invalid decoding table value " + d + " at " + s + "/" + h);
4233
- }
4219
+ if (!(d >= 0)) if (d === n) d = this.defaultCharUnicode.charCodeAt(0), p = u;
4220
+ else if (d === r) {
4221
+ if (p >= 3) var g = (e[p - 3] - 129) * 12600 + (e[p - 2] - 48) * 1260 + (e[p - 1] - 129) * 10 + (h - 48);
4222
+ else var g = (c[p - 3 + l] - 129) * 12600 + ((p - 2 >= 0 ? e[p - 2] : c[p - 2 + l]) - 48) * 1260 + ((p - 1 >= 0 ? e[p - 1] : c[p - 1 + l]) - 129) * 10 + (h - 48);
4223
+ var _ = f(this.gb18030.gbChars, g);
4224
+ d = this.gb18030.uChars[_] + g - this.gb18030.gbChars[_];
4225
+ } else if (d <= a) {
4226
+ s = a - d;
4227
+ continue;
4228
+ } else if (d <= i) {
4229
+ for (var v = this.decodeTableSeq[i - d], y = 0; y < v.length - 1; y++) d = v[y], o[m++] = d & 255, o[m++] = d >> 8;
4230
+ d = v[v.length - 1];
4231
+ } else throw Error("iconv-lite internal error: invalid decoding table value " + d + " at " + s + "/" + h);
4234
4232
  if (d >= 65536) {
4235
4233
  d -= 65536;
4236
4234
  var b = 55296 | d >> 10;
@@ -5514,6 +5512,7 @@ var Ve = /* @__PURE__ */ f(((e) => {
5514
5512
  case 7:
5515
5513
  if (t + 4 > n || (u = p ? e.readUInt32LE(t) : e.readUInt32BE(t), t += 4, u > (n - t) / 9)) return null;
5516
5514
  for (f = [], o = u; o > 0; o--) f.push(r());
5515
+ break;
5517
5516
  }
5518
5517
  return f;
5519
5518
  }
@@ -5741,11 +5740,9 @@ var Ve = /* @__PURE__ */ f(((e) => {
5741
5740
  return r.offset = 4, r.writeInt8(2), r.writeNullTerminatedString(this.pluginName, e), r.writeBuffer(this.pluginData), r;
5742
5741
  }
5743
5742
  static fromPacket(t, n) {
5744
- t.readInt8();
5745
- let r = t.readNullTerminatedString(n), i = t.readBuffer();
5746
- return new e({
5747
- pluginName: r,
5748
- pluginData: i
5743
+ return t.readInt8(), new e({
5744
+ pluginName: t.readNullTerminatedString(n),
5745
+ pluginData: t.readBuffer()
5749
5746
  });
5750
5747
  }
5751
5748
  };
@@ -5760,11 +5757,9 @@ var Ve = /* @__PURE__ */ f(((e) => {
5760
5757
  return t.offset = 4, t.writeInt8(254), t.writeNullTerminatedString(this.pluginName, "cesu8"), t.writeBuffer(this.pluginData), t;
5761
5758
  }
5762
5759
  static fromPacket(t) {
5763
- t.readInt8();
5764
- let n = t.readNullTerminatedString("cesu8"), r = t.readBuffer();
5765
- return new e({
5766
- pluginName: n,
5767
- pluginData: r
5760
+ return t.readInt8(), new e({
5761
+ pluginName: t.readNullTerminatedString("cesu8"),
5762
+ pluginData: t.readBuffer()
5768
5763
  });
5769
5764
  }
5770
5765
  };
@@ -5779,9 +5774,7 @@ var Ve = /* @__PURE__ */ f(((e) => {
5779
5774
  return t.offset = 4, t.writeInt8(1), t.writeBuffer(this.data), t;
5780
5775
  }
5781
5776
  static fromPacket(t) {
5782
- t.readInt8();
5783
- let n = t.readBuffer();
5784
- return new e(n);
5777
+ return t.readInt8(), new e(t.readBuffer());
5785
5778
  }
5786
5779
  static verifyMarker(e) {
5787
5780
  return e.peekByte() === 1;
@@ -5798,8 +5791,7 @@ var Ve = /* @__PURE__ */ f(((e) => {
5798
5791
  return t.offset = 4, t.writeBuffer(this.data), t;
5799
5792
  }
5800
5793
  static fromPacket(t) {
5801
- let n = t.readBuffer();
5802
- return new e(n);
5794
+ return new e(t.readBuffer());
5803
5795
  }
5804
5796
  };
5805
5797
  })), Wt = /* @__PURE__ */ f(((e, t) => {
@@ -5810,7 +5802,11 @@ var Ve = /* @__PURE__ */ f(((e) => {
5810
5802
  static toPacket(e, t) {
5811
5803
  let i = 0;
5812
5804
  e.forEach((e) => {
5813
- e == null ? ++i : i += r.lengthCodedStringLength(e.toString(10), t);
5805
+ if (e == null) {
5806
+ ++i;
5807
+ return;
5808
+ }
5809
+ i += r.lengthCodedStringLength(e.toString(10), t);
5814
5810
  }), i += 2;
5815
5811
  let a = new r(0, Buffer.allocUnsafe(i + 4), 0, i + 4);
5816
5812
  a.offset = 4, a.writeInt8(0);
@@ -5818,7 +5814,15 @@ var Ve = /* @__PURE__ */ f(((e) => {
5818
5814
  return e.forEach((e) => {
5819
5815
  e.type === n.NULL && (o += s), s *= 2, s === 256 && (a.writeInt8(o), o = 0, s = 1);
5820
5816
  }), s !== 1 && a.writeInt8(o), e.forEach((e) => {
5821
- e === null ? a.writeNull() : e === void 0 ? a.writeInt8(0) : a.writeLengthCodedString(e.toString(10), t);
5817
+ if (e === null) {
5818
+ a.writeNull();
5819
+ return;
5820
+ }
5821
+ if (e === void 0) {
5822
+ a.writeInt8(0);
5823
+ return;
5824
+ }
5825
+ a.writeLengthCodedString(e.toString(10), t);
5822
5826
  }), a;
5823
5827
  }
5824
5828
  static fromPacket(t, n) {
@@ -6090,7 +6094,7 @@ var Ve = /* @__PURE__ */ f(((e) => {
6090
6094
  }
6091
6095
  static fromPacket(e, t) {
6092
6096
  let n = e.readInt32(), r = e.readInt8(), i = e.readInt32(), o = e.offset;
6093
- for (; o < e.end - 1 && (e.buffer[o + 1] !== a.VAR_STRING && e.buffer[o + 1] !== a.BLOB && e.buffer[o + 1] !== a.NULL && e.buffer[o + 1] !== a.DOUBLE && e.buffer[o + 1] !== a.TINY && e.buffer[o + 1] !== a.DATETIME && e.buffer[o + 1] !== a.JSON || e.buffer[o] !== 1 || e.buffer[o + 2] !== 0);) e.readInt8(), o++;
6097
+ for (; o < e.end - 1 && !((e.buffer[o + 1] === a.VAR_STRING || e.buffer[o + 1] === a.BLOB || e.buffer[o + 1] === a.NULL || e.buffer[o + 1] === a.DOUBLE || e.buffer[o + 1] === a.TINY || e.buffer[o + 1] === a.DATETIME || e.buffer[o + 1] === a.JSON) && e.buffer[o] === 1 && e.buffer[o + 2] === 0);) e.readInt8(), o++;
6094
6098
  let s = [];
6095
6099
  for (let t = e.offset + 1; t < e.end - 1; t++) (e.buffer[t] === a.VAR_STRING || e.buffer[t] === a.BLOB || e.buffer[t] === a.NULL || e.buffer[t] === a.DOUBLE || e.buffer[t] === a.TINY || e.buffer[t] === a.DATETIME || e.buffer[t] === a.JSON) && e.buffer[t + 1] === 0 && (s.push(e.buffer[t]), e.skip(2));
6096
6100
  e.skip(1);
@@ -6135,7 +6139,11 @@ var Ve = /* @__PURE__ */ f(((e) => {
6135
6139
  }
6136
6140
  setScrambleData(e) {
6137
6141
  g("crypto").randomBytes(20, (t, n) => {
6138
- t ? e(t) : (this.authPluginData1 = n.slice(0, 8), this.authPluginData2 = n.slice(8, 20), e());
6142
+ if (t) {
6143
+ e(t);
6144
+ return;
6145
+ }
6146
+ this.authPluginData1 = n.slice(0, 8), this.authPluginData2 = n.slice(8, 20), e();
6139
6147
  });
6140
6148
  }
6141
6149
  toPacket(e) {
@@ -6371,7 +6379,7 @@ var Ve = /* @__PURE__ */ f(((e) => {
6371
6379
  } else this.info = e.readString(void 0, s);
6372
6380
  u && (this.stateChanges = u);
6373
6381
  let d = this.info.match(/\schanged:\s*(\d+)/i);
6374
- this.changedRows = d === null ? 0 : parseInt(d[1], 10);
6382
+ d === null ? this.changedRows = 0 : this.changedRows = parseInt(d[1], 10);
6375
6383
  }
6376
6384
  static toPacket(e, t) {
6377
6385
  let r = 4 + n.lengthCodedNumberLength(e);
@@ -6405,11 +6413,23 @@ var Ve = /* @__PURE__ */ f(((e) => {
6405
6413
  static toPacket(e, t) {
6406
6414
  let r = 0;
6407
6415
  e.forEach((e) => {
6408
- e == null ? ++r : r += n.lengthCodedStringLength(e.toString(10), t);
6416
+ if (e == null) {
6417
+ ++r;
6418
+ return;
6419
+ }
6420
+ r += n.lengthCodedStringLength(e.toString(10), t);
6409
6421
  });
6410
6422
  let i = new n(0, Buffer.allocUnsafe(r + 4), 0, r + 4);
6411
6423
  return i.offset = 4, e.forEach((e) => {
6412
- e === null ? i.writeNull() : e === void 0 ? i.writeInt8(0) : i.writeLengthCodedString(e.toString(10), t);
6424
+ if (e === null) {
6425
+ i.writeNull();
6426
+ return;
6427
+ }
6428
+ if (e === void 0) {
6429
+ i.writeInt8(0);
6430
+ return;
6431
+ }
6432
+ i.writeLengthCodedString(e.toString(10), t);
6413
6433
  }), i;
6414
6434
  }
6415
6435
  };
@@ -6489,7 +6509,7 @@ var Ve = /* @__PURE__ */ f(((e) => {
6489
6509
  let n = e.asError(t.clientEncoding);
6490
6510
  return n.sql = this.sql || this.query, this.queryTimeout &&= (r.clearTimeout(this.queryTimeout), null), this.onResult ? (this.onResult(n), this.emit("end")) : (this.emit("error", n), this.emit("end")), !0;
6491
6511
  }
6492
- return this.next = this.next(e, t), !this.next && (this.emit("end"), !0);
6512
+ return this.next = this.next(e, t), this.next ? !1 : (this.emit("end"), !0);
6493
6513
  }
6494
6514
  };
6495
6515
  })), pn = /* @__PURE__ */ f(((e) => {
@@ -6626,14 +6646,14 @@ var Ve = /* @__PURE__ */ f(((e) => {
6626
6646
  if (e) return u(e, r);
6627
6647
  t.writePacket(new n.AuthSwitchResponse(i).toPacket());
6628
6648
  });
6629
- } else {
6630
- if (!t._authPlugin) throw Error("AuthPluginMoreData received but no auth plugin instance found");
6631
- Promise.resolve(t._authPlugin(i)).then((e) => {
6632
- e && t.writePacket(new n.AuthSwitchResponse(e).toPacket());
6633
- }).catch((e) => {
6634
- u(e, r);
6635
- });
6649
+ return;
6636
6650
  }
6651
+ if (!t._authPlugin) throw Error("AuthPluginMoreData received but no auth plugin instance found");
6652
+ Promise.resolve(t._authPlugin(i)).then((e) => {
6653
+ e && t.writePacket(new n.AuthSwitchResponse(e).toPacket());
6654
+ }).catch((e) => {
6655
+ u(e, r);
6656
+ });
6637
6657
  }
6638
6658
  t.exports = {
6639
6659
  authSwitchRequest: d,
@@ -6651,7 +6671,11 @@ var Ve = /* @__PURE__ */ f(((e) => {
6651
6671
  }
6652
6672
  _next() {
6653
6673
  let e = this._queue.shift();
6654
- e ? e({ done: () => process.nextTick(() => this._next()) }) : this._running = !1;
6674
+ if (!e) {
6675
+ this._running = !1;
6676
+ return;
6677
+ }
6678
+ e({ done: () => process.nextTick(() => this._next()) });
6655
6679
  }
6656
6680
  };
6657
6681
  function a(e) {
@@ -6660,7 +6684,11 @@ var Ve = /* @__PURE__ */ f(((e) => {
6660
6684
  t._bumpCompressedSequenceId(e.numPackets), t._inflatedPacketsParser.execute(i), n.done();
6661
6685
  }) : t.inflateQueue.push((a) => {
6662
6686
  n.inflate(i, { maxOutputLength: r }, (n, r) => {
6663
- n ? t._handleNetworkError(n) : (t._bumpCompressedSequenceId(e.numPackets), t._inflatedPacketsParser.execute(r), a.done());
6687
+ if (n) {
6688
+ t._handleNetworkError(n);
6689
+ return;
6690
+ }
6691
+ t._bumpCompressedSequenceId(e.numPackets), t._inflatedPacketsParser.execute(r), a.done();
6664
6692
  });
6665
6693
  });
6666
6694
  }
@@ -6786,7 +6814,11 @@ var Ve = /* @__PURE__ */ f(((e) => {
6786
6814
  return e.code = "HANDSHAKE_NO_SSL_SUPPORT", e.fatal = !0, this.emit("error", e), !1;
6787
6815
  }
6788
6816
  this.clientFlags |= i.SSL, this.sendSSLRequest(n), n.startTLS((e) => {
6789
- e ? (e.code = "HANDSHAKE_SSL_ERROR", e.fatal = !0, this.emit("error", e)) : this.sendCredentials(n);
6817
+ if (e) {
6818
+ e.code = "HANDSHAKE_SSL_ERROR", e.fatal = !0, this.emit("error", e);
6819
+ return;
6820
+ }
6821
+ this.sendCredentials(n);
6790
6822
  });
6791
6823
  } else this.sendCredentials(n);
6792
6824
  return c && (this.authenticationFactor = 1), e.prototype.handshakeResult;
@@ -6821,7 +6853,11 @@ var Ve = /* @__PURE__ */ f(((e) => {
6821
6853
  start(t, n) {
6822
6854
  let r = new a.Handshake(this.args);
6823
6855
  return this.serverHello = r, r.setScrambleData((e) => {
6824
- e ? n.emit("error", /* @__PURE__ */ Error("Error generating random bytes")) : n.writePacket(r.toPacket(0));
6856
+ if (e) {
6857
+ n.emit("error", /* @__PURE__ */ Error("Error generating random bytes"));
6858
+ return;
6859
+ }
6860
+ n.writePacket(r.toPacket(0));
6825
6861
  }), e.prototype.readClientReply;
6826
6862
  }
6827
6863
  readClientReply(t, n) {
@@ -6920,7 +6956,7 @@ var Ve = /* @__PURE__ */ f(((e) => {
6920
6956
  return Array.isArray(t) ? t.some((t) => e === n[t]) : !!t;
6921
6957
  }
6922
6958
  e.typeMatch = a;
6923
- var o = /* @__PURE__ */ new Set([
6959
+ var o = new Set([
6924
6960
  "__defineGetter__",
6925
6961
  "__defineSetter__",
6926
6962
  "__lookupGetter__",
@@ -6955,7 +6991,19 @@ var Ve = /* @__PURE__ */ f(((e) => {
6955
6991
  for (var r = ""; r.length < t * 2;) r += " ";
6956
6992
  e.push(r + n);
6957
6993
  }, c = function(e) {
6958
- a.test(e.trim()[0]) && i.test(e[e.length - 1]) ? (t--, s(e), t++) : i.test(e[e.length - 1]) ? (s(e), t++) : (a.test(e.trim()[0]) && t--, s(e));
6994
+ if (a.test(e.trim()[0]) && i.test(e[e.length - 1])) {
6995
+ t--, s(e), t++;
6996
+ return;
6997
+ }
6998
+ if (i.test(e[e.length - 1])) {
6999
+ s(e), t++;
7000
+ return;
7001
+ }
7002
+ if (a.test(e.trim()[0])) {
7003
+ t--, s(e);
7004
+ return;
7005
+ }
7006
+ s(e);
6959
7007
  }, d = function(e) {
6960
7008
  if (!e) return d;
6961
7009
  if (arguments.length === 1 && e.indexOf("\n") > -1) for (var t = e.trim().split("\n"), r = 0; r < t.length; r++) c(t[r].trim());
@@ -7186,7 +7234,7 @@ var Ve = /* @__PURE__ */ f(((e) => {
7186
7234
  }
7187
7235
  if (this._receivedFieldsCount === this._fieldCount) {
7188
7236
  let t = this._fields[this._resultIndex];
7189
- return this.emit("fields", t), this._rowParser = this.options.disableEval ? c(t, this.options, n.config) : new (s(t, this.options, n.config))(t), e.prototype.fieldsEOF;
7237
+ return this.emit("fields", t), this.options.disableEval ? this._rowParser = c(t, this.options, n.config) : this._rowParser = new (s(t, this.options, n.config))(t), e.prototype.fieldsEOF;
7190
7238
  }
7191
7239
  return e.prototype.readField;
7192
7240
  }
@@ -7952,7 +8000,7 @@ var Ve = /* @__PURE__ */ f(((e) => {
7952
8000
  for (let e in n) Object.prototype.hasOwnProperty.call(n, e) && (t[e] || (t[e] = n[e]));
7953
8001
  }
7954
8002
  for (let e in t) Object.prototype.hasOwnProperty.call(t, e) && s[e] !== 1 && console.error(`Ignoring invalid configuration option passed to Connection: ${e}. This is currently a warning, but in future versions of MySQL2, an error will be thrown if you pass an invalid configuration option to a Connection`);
7955
- if (this.isServer = t.isServer, this.stream = t.stream, this.host = t.host || "localhost", this.port = (typeof t.port == "string" ? parseInt(t.port, 10) : t.port) || 3306, this.localAddress = t.localAddress, this.socketPath = t.socketPath, this.user = t.user || void 0, this.password = t.password || t.password1 || void 0, this.password2 = t.password2 || void 0, this.password3 = t.password3 || void 0, this.passwordSha1 = t.passwordSha1 || void 0, this.database = t.database, this.connectTimeout = isNaN(t.connectTimeout) ? 1e4 : t.connectTimeout, this.insecureAuth = t.insecureAuth || !1, this.infileStreamFactory = t.infileStreamFactory || void 0, this.supportBigNumbers = t.supportBigNumbers || !1, this.bigNumberStrings = t.bigNumberStrings || !1, this.decimalNumbers = t.decimalNumbers || !1, this.dateStrings = t.dateStrings || !1, this.debug = t.debug, this.trace = t.trace !== !1, this.stringifyObjects = t.stringifyObjects || !1, this.enableKeepAlive = t.enableKeepAlive !== !1, this.keepAliveInitialDelay = t.keepAliveInitialDelay, t.timezone && !/^(?:local|Z|[ +-]\d\d:\d\d)$/.test(t.timezone) ? (console.error(`Ignoring invalid timezone passed to Connection: ${t.timezone}. This is currently a warning, but in future versions of MySQL2, an error will be thrown if you pass an invalid configuration option to a Connection`), this.timezone = "Z") : this.timezone = t.timezone || "local", this.queryFormat = t.queryFormat, this.pool = t.pool || void 0, this.ssl = typeof t.ssl == "string" ? e.getSSLProfile(t.ssl) : t.ssl || !1, this.multipleStatements = t.multipleStatements || !1, this.rowsAsArray = t.rowsAsArray || !1, this.namedPlaceholders = t.namedPlaceholders || !1, this.nestTables = t.nestTables === void 0 ? void 0 : t.nestTables, this.typeCast = t.typeCast === void 0 || t.typeCast, this.disableEval = !!t.disableEval, this.enableCleartextPlugin = !!t.enableCleartextPlugin, this.timezone[0] === " " && (this.timezone = `+${this.timezone.slice(1)}`), this.ssl) {
8003
+ if (this.isServer = t.isServer, this.stream = t.stream, this.host = t.host || "localhost", this.port = (typeof t.port == "string" ? parseInt(t.port, 10) : t.port) || 3306, this.localAddress = t.localAddress, this.socketPath = t.socketPath, this.user = t.user || void 0, this.password = t.password || t.password1 || void 0, this.password2 = t.password2 || void 0, this.password3 = t.password3 || void 0, this.passwordSha1 = t.passwordSha1 || void 0, this.database = t.database, this.connectTimeout = isNaN(t.connectTimeout) ? 10 * 1e3 : t.connectTimeout, this.insecureAuth = t.insecureAuth || !1, this.infileStreamFactory = t.infileStreamFactory || void 0, this.supportBigNumbers = t.supportBigNumbers || !1, this.bigNumberStrings = t.bigNumberStrings || !1, this.decimalNumbers = t.decimalNumbers || !1, this.dateStrings = t.dateStrings || !1, this.debug = t.debug, this.trace = t.trace !== !1, this.stringifyObjects = t.stringifyObjects || !1, this.enableKeepAlive = t.enableKeepAlive !== !1, this.keepAliveInitialDelay = t.keepAliveInitialDelay, t.timezone && !/^(?:local|Z|[ +-]\d\d:\d\d)$/.test(t.timezone) ? (console.error(`Ignoring invalid timezone passed to Connection: ${t.timezone}. This is currently a warning, but in future versions of MySQL2, an error will be thrown if you pass an invalid configuration option to a Connection`), this.timezone = "Z") : this.timezone = t.timezone || "local", this.queryFormat = t.queryFormat, this.pool = t.pool || void 0, this.ssl = typeof t.ssl == "string" ? e.getSSLProfile(t.ssl) : t.ssl || !1, this.multipleStatements = t.multipleStatements || !1, this.rowsAsArray = t.rowsAsArray || !1, this.namedPlaceholders = t.namedPlaceholders || !1, this.nestTables = t.nestTables === void 0 ? void 0 : t.nestTables, this.typeCast = t.typeCast === void 0 ? !0 : t.typeCast, this.disableEval = !!t.disableEval, this.enableCleartextPlugin = !!t.enableCleartextPlugin, this.timezone[0] === " " && (this.timezone = `+${this.timezone.slice(1)}`), this.ssl) {
7956
8004
  if (typeof this.ssl != "object") throw TypeError(`SSL profile must be an object, instead it's a ${typeof this.ssl}`);
7957
8005
  this.ssl.rejectUnauthorized = this.ssl.rejectUnauthorized !== !1;
7958
8006
  }
@@ -8062,39 +8110,39 @@ var Ve = /* @__PURE__ */ f(((e) => {
8062
8110
  tracePromise: f
8063
8111
  };
8064
8112
  })), mr = /* @__PURE__ */ f(((e, t) => {
8065
- var n = /(?:\?)|(?::(\d+|(?:[a-zA-Z][a-zA-Z0-9_]*)))/g;
8066
- function r(e) {
8067
- let t = n.exec(e), r = 0, i = 0, a, o = [], s = !1, c = !1, l, u = [], d = 0, f = 0, p;
8113
+ var n = /(?:\?)|(?::(\d+|(?:[a-zA-Z][a-zA-Z0-9_]*)))/g, r = 34, i = 39, a = 92;
8114
+ function o(e) {
8115
+ let t = n.exec(e), o = 0, s = 0, c, l = [], u = !1, d = !1, f, p = [], m = 0, h = 0, g;
8068
8116
  if (t) {
8069
8117
  do {
8070
- for (p = r, a = t.index; p < a; ++p) {
8071
- let t = e.charCodeAt(p);
8072
- if (t === 92) c = !c;
8118
+ for (g = o, c = t.index; g < c; ++g) {
8119
+ let t = e.charCodeAt(g);
8120
+ if (t === a) d = !d;
8073
8121
  else {
8074
- if (c) {
8075
- c = !1;
8122
+ if (d) {
8123
+ d = !1;
8076
8124
  continue;
8077
8125
  }
8078
- if (s && t === l) {
8079
- if (e.charCodeAt(p + 1) === l) {
8080
- ++p;
8126
+ if (u && t === f) {
8127
+ if (e.charCodeAt(g + 1) === f) {
8128
+ ++g;
8081
8129
  continue;
8082
8130
  }
8083
- s = !1;
8084
- } else !s && (t === 34 || t === 39) && (s = !0, l = t);
8131
+ u = !1;
8132
+ } else !u && (t === r || t === i) && (u = !0, f = t);
8085
8133
  }
8086
8134
  }
8087
- s || (o.push(e.substring(i, a)), u.push(t[0].length === 1 ? d++ : t[1]), i = a + t[0].length, f = i), r = a + t[0].length;
8135
+ u || (l.push(e.substring(s, c)), p.push(t[0].length === 1 ? m++ : t[1]), s = c + t[0].length, h = s), o = c + t[0].length;
8088
8136
  } while (t = n.exec(e));
8089
- if (u.length) return r < e.length && o.push(e.substring(f)), [o, u];
8137
+ if (p.length) return o < e.length && l.push(e.substring(h)), [l, p];
8090
8138
  }
8091
8139
  return [e];
8092
8140
  }
8093
- function i(e) {
8094
- e ||= {}, e.placeholder || (e.placeholder = "?");
8141
+ function s(e) {
8142
+ e ||= {}, e.placeholder ||= "?";
8095
8143
  let t = 100, n;
8096
8144
  typeof e.cache == "number" && (t = e.cache), typeof e.cache == "object" && (n = e.cache), e.cache !== !1 && !n && (n = Ge().createLRU({ max: t }));
8097
- function i(e, t) {
8145
+ function r(e, t) {
8098
8146
  let n = [];
8099
8147
  if (e.length === 1) return [e[0], []];
8100
8148
  if (t === void 0) throw Error("Named query contains placeholders, but parameters object is undefined");
@@ -8102,35 +8150,35 @@ var Ve = /* @__PURE__ */ f(((e) => {
8102
8150
  for (let e = 0; e < r.length; ++e) n.push(t[r[e]]);
8103
8151
  return [e[0], n];
8104
8152
  }
8105
- function a(e) {
8153
+ function i(e) {
8106
8154
  return e.slice(-1) === ":" ? e.slice(0, -1) : e;
8107
8155
  }
8108
- function o(t) {
8156
+ function a(t) {
8109
8157
  if (t.length === 1) return t;
8110
- let n = a(t[0][0]);
8111
- for (let r = 1; r < t[0].length; ++r) t[0][r - 1].slice(-1) === ":" && (n += e.placeholder), n += e.placeholder, n += a(t[0][r]);
8158
+ let n = i(t[0][0]);
8159
+ for (let r = 1; r < t[0].length; ++r) t[0][r - 1].slice(-1) === ":" && (n += e.placeholder), n += e.placeholder, n += i(t[0][r]);
8112
8160
  let r = t[0][t[0].length - 1];
8113
8161
  return t[0].length === t[1].length && (r.slice(-1) === ":" && (n += e.placeholder), n += e.placeholder), [n, t[1]];
8114
8162
  }
8115
8163
  function s(e, t) {
8116
- let a;
8117
- return n && (a = n.get(e)) || (a = o(r(e)), n && n.set(e, a)), i(a, t);
8164
+ let i;
8165
+ return n && (i = n.get(e)) ? r(i, t) : (i = a(o(e)), n && n.set(e, i), r(i, t));
8118
8166
  }
8119
- return s.parse = r, s;
8167
+ return s.parse = o, s;
8120
8168
  }
8121
- function a(e, t) {
8122
- let n = r(e), i = [];
8123
- if (n.length === 1) return [n[0], i];
8124
- let a = {}, o = 0, s = "", c, l = [];
8125
- for (let e = 0; e < n[0].length; ++e) c = a[n[1][e]], c || (c = ++o, a[n[1][e]] = c), n[1][e] ? (l[c - 1] = n[1][e], s += `${n[0][e]}$${c}`) : s += n[0][e];
8169
+ function c(e, t) {
8170
+ let n = o(e), r = [];
8171
+ if (n.length === 1) return [n[0], r];
8172
+ let i = {}, a = 0, s = "", c, l = [];
8173
+ for (let e = 0; e < n[0].length; ++e) c = i[n[1][e]], c || (c = ++a, i[n[1][e]] = c), n[1][e] ? (l[c - 1] = n[1][e], s += `${n[0][e]}$${c}`) : s += n[0][e];
8126
8174
  return [s, l.map((e) => t[e])];
8127
8175
  }
8128
- t.exports = i, t.exports.toNumbered = a;
8176
+ t.exports = s, t.exports.toNumbered = c;
8129
8177
  })), hr = /* @__PURE__ */ f(((e, t) => {
8130
8178
  var n = g("net"), r = g("tls"), i = g("timers"), a = z().EventEmitter, o = g("stream").Readable, s = qe(), c = We(), { createLRU: l } = Ge(), u = zt(), d = J(), f = Bn(), p = dr(), m = q(), { traceCallback: h, tracePromise: _, getServerContext: v, shouldTrace: y, queryChannel: b, executeChannel: x, connectChannel: S } = pr(), C = 0, w = null;
8131
8179
  t.exports = class e extends a {
8132
8180
  constructor(e) {
8133
- super(), this.config = e.config, e.config.stream ? this.stream = typeof e.config.stream == "function" ? e.config.stream(e) : e.config.stream : e.config.socketPath ? this.stream = n.connect(e.config.socketPath) : (this.stream = n.connect(e.config.port, e.config.host), this.config.enableKeepAlive && this.stream.on("connect", () => {
8181
+ super(), this.config = e.config, e.config.stream ? typeof e.config.stream == "function" ? this.stream = e.config.stream(e) : this.stream = e.config.stream : e.config.socketPath ? this.stream = n.connect(e.config.socketPath) : (this.stream = n.connect(e.config.port, e.config.host), this.config.enableKeepAlive && this.stream.on("connect", () => {
8134
8182
  this.stream.setKeepAlive(!0, this.config.keepAliveInitialDelay);
8135
8183
  }), this.stream.setNoDelay(!0)), this._internalId = C++, this._commands = new s(), this._command = null, this._paused = !1, this._paused_packets = new s(), this._statements = l({
8136
8184
  max: this.config.maxPreparedStatements,
@@ -8283,38 +8331,39 @@ var Ve = /* @__PURE__ */ f(((e) => {
8283
8331
  return this._fatalError;
8284
8332
  }
8285
8333
  handlePacket(e) {
8286
- if (this._paused) this._paused_packets.push(e);
8287
- else {
8288
- if (this.config.debug && e) {
8289
- console.log(` raw: ${e.buffer.slice(e.offset, e.offset + e.length()).toString("hex")}`), console.trace();
8290
- let t = this._command ? this._command._commandName : "(no command)", n = this._command ? this._command.stateName() : "(no command)";
8291
- console.log(`${this._internalId} ${this.connectionId} ==> ${t}#${n}(${[
8292
- e.sequenceId,
8293
- e.type(),
8294
- e.length()
8295
- ].join(",")})`);
8296
- }
8297
- if (this._command) {
8298
- if (e) {
8299
- if (this.sequenceId !== e.sequenceId) {
8300
- let t = /* @__PURE__ */ Error(`Warning: got packets out of order. Expected ${this.sequenceId} but received ${e.sequenceId}`);
8301
- t.expected = this.sequenceId, t.received = e.sequenceId, this.emit("warn", t), console.error(t.message);
8302
- }
8303
- this._bumpSequenceId(e.numPackets);
8304
- }
8305
- try {
8306
- if (this._fatalError) return;
8307
- this._command.execute(e, this) && (this._command = this._commands.shift(), this._command && (this.sequenceId = 0, this.compressedSequenceId = 0, this.handlePacket()));
8308
- } catch (e) {
8309
- this._handleFatalError(e), this.stream.destroy();
8310
- }
8311
- } else {
8312
- if (e.peekByte() === 255) {
8313
- let t = d.Error.fromPacket(e);
8314
- this.protocolError(t.message, t.code);
8315
- } else this.protocolError("Unexpected packet while no commands in the queue", "PROTOCOL_UNEXPECTED_PACKET");
8316
- this.close();
8334
+ if (this._paused) {
8335
+ this._paused_packets.push(e);
8336
+ return;
8337
+ }
8338
+ if (this.config.debug && e) {
8339
+ console.log(` raw: ${e.buffer.slice(e.offset, e.offset + e.length()).toString("hex")}`), console.trace();
8340
+ let t = this._command ? this._command._commandName : "(no command)", n = this._command ? this._command.stateName() : "(no command)";
8341
+ console.log(`${this._internalId} ${this.connectionId} ==> ${t}#${n}(${[
8342
+ e.sequenceId,
8343
+ e.type(),
8344
+ e.length()
8345
+ ].join(",")})`);
8346
+ }
8347
+ if (!this._command) {
8348
+ if (e.peekByte() === 255) {
8349
+ let t = d.Error.fromPacket(e);
8350
+ this.protocolError(t.message, t.code);
8351
+ } else this.protocolError("Unexpected packet while no commands in the queue", "PROTOCOL_UNEXPECTED_PACKET");
8352
+ this.close();
8353
+ return;
8354
+ }
8355
+ if (e) {
8356
+ if (this.sequenceId !== e.sequenceId) {
8357
+ let t = /* @__PURE__ */ Error(`Warning: got packets out of order. Expected ${this.sequenceId} but received ${e.sequenceId}`);
8358
+ t.expected = this.sequenceId, t.received = e.sequenceId, this.emit("warn", t), console.error(t.message);
8317
8359
  }
8360
+ this._bumpSequenceId(e.numPackets);
8361
+ }
8362
+ try {
8363
+ if (this._fatalError) return;
8364
+ this._command.execute(e, this) && (this._command = this._commands.shift(), this._command && (this.sequenceId = 0, this.compressedSequenceId = 0, this.handlePacket()));
8365
+ } catch (e) {
8366
+ this._handleFatalError(e), this.stream.destroy();
8318
8367
  }
8319
8368
  }
8320
8369
  addCommand(e) {
@@ -8410,9 +8459,13 @@ var Ve = /* @__PURE__ */ f(((e) => {
8410
8459
  }
8411
8460
  let i = new f.Execute(r, n), a = (e) => {
8412
8461
  let t = new f.Prepare(r, (t, n) => {
8413
- t ? (i.start = function() {
8414
- return null;
8415
- }, e(t), i.emit("end")) : i.statement = n;
8462
+ if (t) {
8463
+ i.start = function() {
8464
+ return null;
8465
+ }, e(t), i.emit("end");
8466
+ return;
8467
+ }
8468
+ i.statement = n;
8416
8469
  });
8417
8470
  this.addCommand(t), this.addCommand(i);
8418
8471
  };
@@ -8790,7 +8843,7 @@ var Ve = /* @__PURE__ */ f(((e) => {
8790
8843
  });
8791
8844
  }
8792
8845
  release() {
8793
- this._released || this._pool && !this._pool._closed && (this._released = !0, this.lastActiveTime = Date.now(), this._pool.releaseConnection(this));
8846
+ this._released || !this._pool || this._pool._closed || (this._released = !0, this.lastActiveTime = Date.now(), this._pool.releaseConnection(this));
8794
8847
  }
8795
8848
  [Symbol.dispose]() {
8796
8849
  this.release();
@@ -8851,9 +8904,17 @@ var Ve = /* @__PURE__ */ f(((e) => {
8851
8904
  }
8852
8905
  releaseConnection(e) {
8853
8906
  let t;
8854
- e._pool ? this.config.resetOnRelease && e.reset ? e.reset((r) => {
8855
- r ? (e._pool = null, p(this._allConnections, e), e.destroy(), this._connectionQueue.length && (t = this._connectionQueue.shift(), n.nextTick(this.getConnection.bind(this, t)))) : this._handleSuccessfulRelease(e);
8856
- }) : this._handleSuccessfulRelease(e) : this._connectionQueue.length && (t = this._connectionQueue.shift(), n.nextTick(this.getConnection.bind(this, t)));
8907
+ if (!e._pool) {
8908
+ this._connectionQueue.length && (t = this._connectionQueue.shift(), n.nextTick(this.getConnection.bind(this, t)));
8909
+ return;
8910
+ }
8911
+ this.config.resetOnRelease && e.reset ? e.reset((r) => {
8912
+ if (r) {
8913
+ e._pool = null, p(this._allConnections, e), e.destroy(), this._connectionQueue.length && (t = this._connectionQueue.shift(), n.nextTick(this.getConnection.bind(this, t)));
8914
+ return;
8915
+ }
8916
+ this._handleSuccessfulRelease(e);
8917
+ }) : this._handleSuccessfulRelease(e);
8857
8918
  }
8858
8919
  _handleSuccessfulRelease(e) {
8859
8920
  let t;
@@ -8872,16 +8933,25 @@ var Ve = /* @__PURE__ */ f(((e) => {
8872
8933
  n.nextTick(() => e(/* @__PURE__ */ Error("Pool is closed.")));
8873
8934
  }
8874
8935
  let t = !1, r = 0, i, a = function(n) {
8875
- t || (n || ++r >= this._allConnections.length) && (t = !0, e(n));
8936
+ if (!t && (n || ++r >= this._allConnections.length)) {
8937
+ t = !0, e(n);
8938
+ return;
8939
+ }
8876
8940
  }.bind(this);
8877
- if (this._allConnections.length === 0) a();
8878
- else for (let e = 0; e < this._allConnections.length; e++) i = this._allConnections.get(e), i._realEnd(a);
8941
+ if (this._allConnections.length === 0) {
8942
+ a();
8943
+ return;
8944
+ }
8945
+ for (let e = 0; e < this._allConnections.length; e++) i = this._allConnections.get(e), i._realEnd(a);
8879
8946
  }
8880
8947
  query(e, t, n) {
8881
8948
  let r = s.createQuery(e, t, n, this.config.connectionConfig);
8882
8949
  return r.namedPlaceholders === void 0 && (r.namedPlaceholders = this.config.connectionConfig.namedPlaceholders), this.getConnection((e, t) => {
8883
- if (e) typeof r.onResult == "function" ? r.onResult(e) : r.emit("error", e);
8884
- else try {
8950
+ if (e) {
8951
+ typeof r.onResult == "function" ? r.onResult(e) : r.emit("error", e);
8952
+ return;
8953
+ }
8954
+ try {
8885
8955
  let e = null, n = r.onResult;
8886
8956
  n ? r.onResult = function(t, r, i) {
8887
8957
  e = t || null, n(t, r, i);
@@ -9005,7 +9075,7 @@ var Ve = /* @__PURE__ */ f(((e) => {
9005
9075
  var n = dr();
9006
9076
  t.exports = class {
9007
9077
  constructor(e) {
9008
- typeof e == "string" && (e = n.parseUrl(e)), this.connectionConfig = new n(e), this.waitForConnections = e.waitForConnections === void 0 || !!e.waitForConnections, this.connectionLimit = isNaN(e.connectionLimit) ? 10 : Number(e.connectionLimit), this.maxIdle = isNaN(e.maxIdle) ? this.connectionLimit : Number(e.maxIdle), this.idleTimeout = isNaN(e.idleTimeout) ? 6e4 : Number(e.idleTimeout), this.queueLimit = isNaN(e.queueLimit) ? 0 : Number(e.queueLimit), this.resetOnRelease = e.resetOnRelease !== void 0 && !!e.resetOnRelease;
9078
+ typeof e == "string" && (e = n.parseUrl(e)), this.connectionConfig = new n(e), this.waitForConnections = e.waitForConnections === void 0 ? !0 : !!e.waitForConnections, this.connectionLimit = isNaN(e.connectionLimit) ? 10 : Number(e.connectionLimit), this.maxIdle = isNaN(e.maxIdle) ? this.connectionLimit : Number(e.maxIdle), this.idleTimeout = isNaN(e.idleTimeout) ? 6e4 : Number(e.idleTimeout), this.queueLimit = isNaN(e.queueLimit) ? 0 : Number(e.queueLimit), this.resetOnRelease = e.resetOnRelease === void 0 ? !1 : !!e.resetOnRelease;
9009
9079
  }
9010
9080
  };
9011
9081
  })), Er = /* @__PURE__ */ f(((e, t) => {
@@ -9042,8 +9112,11 @@ var Ve = /* @__PURE__ */ f(((e) => {
9042
9112
  query(e, t, n) {
9043
9113
  let r = a.createQuery(e, t, n, {});
9044
9114
  return this.getConnection((e, t) => {
9045
- if (e) typeof r.onResult == "function" ? r.onResult(e) : r.emit("error", e);
9046
- else try {
9115
+ if (e) {
9116
+ typeof r.onResult == "function" ? r.onResult(e) : r.emit("error", e);
9117
+ return;
9118
+ }
9119
+ try {
9047
9120
  t.query(r).once("end", () => {
9048
9121
  t.release();
9049
9122
  });
@@ -9073,7 +9146,7 @@ var Ve = /* @__PURE__ */ f(((e) => {
9073
9146
  };
9074
9147
  t.exports = class extends o {
9075
9148
  constructor(e) {
9076
- super(), e ||= {}, this._canRetry = e.canRetry === void 0 || e.canRetry, this._removeNodeErrorCount = e.removeNodeErrorCount || 5, this._restoreNodeTimeout = e.restoreNodeTimeout || 0, this._defaultSelector = e.defaultSelector || "RR", this._closed = !1, this._lastId = 0, this._nodes = {}, this._serviceableNodeIds = [], this._namespaces = {}, this._findCaches = {};
9149
+ super(), e ||= {}, this._canRetry = e.canRetry === void 0 ? !0 : e.canRetry, this._removeNodeErrorCount = e.removeNodeErrorCount || 5, this._restoreNodeTimeout = e.restoreNodeTimeout || 0, this._defaultSelector = e.defaultSelector || "RR", this._closed = !1, this._lastId = 0, this._nodes = {}, this._serviceableNodeIds = [], this._namespaces = {}, this._findCaches = {};
9077
9150
  }
9078
9151
  of(e, t) {
9079
9152
  e ||= "*", t ||= this._defaultSelector, t = t.toUpperCase(), !s[t] === "undefined" && (t = this._defaultSelector);
@@ -9125,7 +9198,7 @@ var Ve = /* @__PURE__ */ f(((e) => {
9125
9198
  }
9126
9199
  return this._findCaches[e] = r, t ? r : r.filter((e) => {
9127
9200
  let t = this._getNode(e);
9128
- return !t._offlineUntil || (n ||= c(), t._offlineUntil <= n);
9201
+ return t._offlineUntil ? (n ||= c(), t._offlineUntil <= n) : !0;
9129
9202
  });
9130
9203
  }
9131
9204
  _getNode(e) {
@@ -9133,7 +9206,13 @@ var Ve = /* @__PURE__ */ f(((e) => {
9133
9206
  }
9134
9207
  _increaseErrorCount(e) {
9135
9208
  let t = ++e.errorCount;
9136
- this._removeNodeErrorCount > t || (this._restoreNodeTimeout > 0 ? (e._offlineUntil = c() + this._restoreNodeTimeout, this.emit("offline", e.id)) : (this._removeNode(e), this.emit("remove", e.id)));
9209
+ if (!(this._removeNodeErrorCount > t)) {
9210
+ if (this._restoreNodeTimeout > 0) {
9211
+ e._offlineUntil = c() + this._restoreNodeTimeout, this.emit("offline", e.id);
9212
+ return;
9213
+ }
9214
+ this._removeNode(e), this.emit("remove", e.id);
9215
+ }
9137
9216
  }
9138
9217
  _decreaseErrorCount(e) {
9139
9218
  let t = e.errorCount;
@@ -9412,7 +9491,9 @@ async function Gr(e, t) {
9412
9491
  name: t,
9413
9492
  expression: a.slice(1, -1)
9414
9493
  });
9415
- } else r[o] || (r[o] = []), r[o].push({
9494
+ return;
9495
+ }
9496
+ r[o] || (r[o] = []), r[o].push({
9416
9497
  name: t,
9417
9498
  expression: a.slice(1, -1)
9418
9499
  });
@@ -9444,7 +9525,11 @@ function qr(e, t) {
9444
9525
  let n = Object.assign(e, {});
9445
9526
  return Object.keys(t).forEach((e) => {
9446
9527
  let r = t[e];
9447
- n[e] ? n[e].push(...r) : n[e] = r;
9528
+ if (!n[e]) {
9529
+ n[e] = r;
9530
+ return;
9531
+ }
9532
+ n[e].push(...r);
9448
9533
  }), n;
9449
9534
  }
9450
9535
  async function Jr(e) {
@@ -9537,34 +9622,34 @@ async function Zr(e) {
9537
9622
  expression: h
9538
9623
  };
9539
9624
  i[u].push(e);
9540
- } else {
9541
- if (m === "C" && h && p === 1 && f.length === 1) {
9542
- r[u] || (r[u] = {});
9543
- let e = f[0];
9544
- r[u][e] || (r[u][e] = { checks: [] }), r[u][e].checks.push({
9545
- name: d,
9546
- expression: h
9547
- });
9548
- }
9549
- if (["P", "U"].includes(m) && p === 1 && f.length === 1) {
9550
- r[u] || (r[u] = {});
9551
- let e = f[0];
9552
- r[u][e] || (r[u][e] = { checks: [] }), r[u][e].pk ||= m === "P", r[u][e].unique ||= m === "U";
9553
- }
9554
- if (["P", "U"].includes(m) && p > 1) {
9555
- r[u] || (r[u] = {}), n[u] || (n[u] = []);
9556
- let e = {
9557
- name: d,
9558
- type: "",
9559
- unique: !0,
9560
- pk: m === "P",
9561
- columns: f.map((e) => ({
9562
- type: "column",
9563
- value: e
9564
- }))
9565
- };
9566
- n[u].push(e);
9567
- }
9625
+ return;
9626
+ }
9627
+ if (m === "C" && h && p === 1 && f.length === 1) {
9628
+ r[u] || (r[u] = {});
9629
+ let e = f[0];
9630
+ r[u][e] || (r[u][e] = { checks: [] }), r[u][e].checks.push({
9631
+ name: d,
9632
+ expression: h
9633
+ });
9634
+ }
9635
+ if (["P", "U"].includes(m) && p === 1 && f.length === 1) {
9636
+ r[u] || (r[u] = {});
9637
+ let e = f[0];
9638
+ r[u][e] || (r[u][e] = { checks: [] }), r[u][e].pk ||= m === "P", r[u][e].unique ||= m === "U";
9639
+ }
9640
+ if (["P", "U"].includes(m) && p > 1) {
9641
+ r[u] || (r[u] = {}), n[u] || (n[u] = []);
9642
+ let e = {
9643
+ name: d,
9644
+ type: "",
9645
+ unique: !0,
9646
+ pk: m === "P",
9647
+ columns: f.map((e) => ({
9648
+ type: "column",
9649
+ value: e
9650
+ }))
9651
+ };
9652
+ n[u].push(e);
9568
9653
  }
9569
9654
  }), {
9570
9655
  indexes: n,
@@ -9578,23 +9663,30 @@ async function Qr(e) {
9578
9663
  let t = await e.execute("\n SELECT\n i.INDEX_NAME AS \"index_name\",\n i.TABLE_NAME AS \"table_name\",\n CASE\n WHEN i.INDEX_TYPE LIKE '%NORMAL' THEN 'btree'\n ELSE LOWER(REGEXP_REPLACE(i.INDEX_TYPE, '^FUNCTION-BASED ', ''))\n END AS \"index_type\",\n CASE WHEN i.UNIQUENESS = 'UNIQUE' THEN 1 ELSE 0 END AS \"is_unique\",\n ic.COLUMN_NAME AS \"column_name\",\n ic.COLUMN_POSITION AS \"column_position\",\n ie.COLUMN_EXPRESSION AS \"column_expression\"\n FROM USER_INDEXES i\n LEFT JOIN USER_IND_COLUMNS ic\n ON i.INDEX_NAME = ic.INDEX_NAME\n LEFT JOIN USER_IND_EXPRESSIONS ie\n ON i.INDEX_NAME = ie.INDEX_NAME\n AND ic.COLUMN_POSITION = ie.COLUMN_POSITION\n LEFT JOIN USER_OBJECTS obj\n ON obj.OBJECT_NAME = i.TABLE_NAME\n AND obj.OBJECT_TYPE = 'TABLE'\n WHERE NOT EXISTS (\n SELECT 1\n FROM USER_CONSTRAINTS c\n WHERE c.INDEX_NAME = i.INDEX_NAME\n )\n ORDER BY obj.CREATED, obj.OBJECT_ID, i.INDEX_NAME, ic.COLUMN_POSITION\n ", [], Yr), n = {}, r = {};
9579
9664
  return t.rows?.forEach((e) => {
9580
9665
  let { index_name: t, table_name: n, index_type: i, is_unique: a, column_name: o, column_expression: s } = e, c = t, l = n, u = i, d = !!a;
9581
- s ? (r[c] || (r[c] = {
9582
- table: l,
9583
- type: u,
9584
- unique: d,
9585
- columns: []
9586
- }), r[c].columns.push({
9587
- type: "expression",
9588
- value: s
9589
- })) : o && (r[c] || (r[c] = {
9590
- table: l,
9591
- type: u,
9592
- unique: d,
9593
- columns: []
9594
- }), r[c].columns.push({
9595
- type: "column",
9596
- value: o
9597
- }));
9666
+ if (s) {
9667
+ r[c] || (r[c] = {
9668
+ table: l,
9669
+ type: u,
9670
+ unique: d,
9671
+ columns: []
9672
+ }), r[c].columns.push({
9673
+ type: "expression",
9674
+ value: s
9675
+ });
9676
+ return;
9677
+ }
9678
+ if (o) {
9679
+ r[c] || (r[c] = {
9680
+ table: l,
9681
+ type: u,
9682
+ unique: d,
9683
+ columns: []
9684
+ }), r[c].columns.push({
9685
+ type: "column",
9686
+ value: o
9687
+ });
9688
+ return;
9689
+ }
9598
9690
  }), Object.entries(r).forEach(([e, { table: t, type: r, unique: i, columns: a }]) => {
9599
9691
  let o = {
9600
9692
  name: e,
@@ -9711,7 +9803,7 @@ function ri(e, t) {
9711
9803
  type: t
9712
9804
  };
9713
9805
  }
9714
- var ii = /* @__PURE__ */ new Set([
9806
+ var ii = new Set([
9715
9807
  "char",
9716
9808
  "varchar2",
9717
9809
  "nchar",
@@ -9727,7 +9819,7 @@ var ii = /* @__PURE__ */ new Set([
9727
9819
  "national character",
9728
9820
  "national char varying",
9729
9821
  "national char"
9730
- ]), ai = /* @__PURE__ */ new Set(["float"]), oi = "timestamp with local time zone", si = "timestamp with time zone", ci = "timestamp", li = "interval year to month", ui = "interval day to second", di = /* @__PURE__ */ new Set([
9822
+ ]), ai = new Set(["float"]), oi = "timestamp with local time zone", si = "timestamp with time zone", ci = "timestamp", li = "interval year to month", ui = "interval day to second", di = new Set([
9731
9823
  "number",
9732
9824
  "numeric",
9733
9825
  "decimal",
@@ -10094,13 +10186,17 @@ var gi = async (e) => {
10094
10186
  let { table_schema: t, table_name: n, check_name: r, check_definition: i, column_name: a, is_column_constraint: s } = e;
10095
10187
  if (typeof t != "string" || typeof n != "string" || typeof i != "string" || !i.match(/CHECK \(\(.*\)\)/) || s && typeof a != "string") return;
10096
10188
  let c = `${t}.${n}`;
10097
- s ? (o[c] || (o[c] = {}), o[c][a] || (o[c][a] = { checks: [] }), o[c][a].checks.push({
10098
- name: r || void 0,
10099
- expression: i.slice(8, -2)
10100
- })) : (l[c] || (l[c] = []), l[c].push({
10189
+ if (s) {
10190
+ o[c] || (o[c] = {}), o[c][a] || (o[c][a] = { checks: [] }), o[c][a].checks.push({
10191
+ name: r || void 0,
10192
+ expression: i.slice(8, -2)
10193
+ });
10194
+ return;
10195
+ }
10196
+ l[c] || (l[c] = []), l[c].push({
10101
10197
  name: r || void 0,
10102
10198
  expression: i.slice(8, -2)
10103
- }));
10199
+ });
10104
10200
  }), {
10105
10201
  indexes: a,
10106
10202
  tableConstraints: o,
@@ -10277,7 +10373,7 @@ var gi = async (e) => {
10277
10373
  };
10278
10374
  }, Ii = (e, t, n) => e.reduce((e, r) => {
10279
10375
  let { schema_name: i, table_name: a, column_name: o, constraint_name: s } = r;
10280
- if (t.length > 0 && !t.includes(i)) return e;
10376
+ if (!(!(t.length > 0) || t.includes(i))) return e;
10281
10377
  let c = `${i}.${a}.${s}`;
10282
10378
  if (e[c]) {
10283
10379
  let { columnNames: t } = e[c];