cdk-rds-sql 8.0.6 → 8.0.8

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.
@@ -15998,20 +15998,16 @@ var require_packet = __commonJS({
15998
15998
  readInt64() {
15999
15999
  const word0 = this.readInt32();
16000
16000
  const word1 = this.readInt32();
16001
- let res = new Long(word0, word1, true);
16001
+ const res = new Long(word0, word1, true);
16002
16002
  const resNumber = res.toNumber();
16003
- const resString = res.toString();
16004
- res = resNumber.toString() === resString ? resNumber : resString;
16005
- return res;
16003
+ return Number.isSafeInteger(resNumber) ? resNumber : res.toString();
16006
16004
  }
16007
16005
  readSInt64() {
16008
16006
  const word0 = this.readInt32();
16009
16007
  const word1 = this.readInt32();
16010
- let res = new Long(word0, word1, false);
16008
+ const res = new Long(word0, word1, false);
16011
16009
  const resNumber = res.toNumber();
16012
- const resString = res.toString();
16013
- res = resNumber.toString() === resString ? resNumber : resString;
16014
- return res;
16010
+ return Number.isSafeInteger(resNumber) ? resNumber : res.toString();
16015
16011
  }
16016
16012
  isEOF() {
16017
16013
  return this.buffer[this.offset] === 254 && this.length() < 13;
@@ -16056,8 +16052,10 @@ var require_packet = __commonJS({
16056
16052
  res = new Long(word0, word1, !signed);
16057
16053
  const resNumber = res.toNumber();
16058
16054
  const resString = res.toString();
16059
- res = resNumber.toString() === resString ? resNumber : resString;
16060
- return bigNumberStrings ? resString : res;
16055
+ if (bigNumberStrings || !Number.isSafeInteger(resNumber)) {
16056
+ return resString;
16057
+ }
16058
+ return resNumber;
16061
16059
  }
16062
16060
  console.trace();
16063
16061
  throw new Error(`Should not reach here: ${tag}`);
@@ -16115,6 +16113,9 @@ var require_packet = __commonJS({
16115
16113
  return new Date(y, m - 1, d, H, M, S, ms);
16116
16114
  }
16117
16115
  let str = this.readDateTimeString(6, "T", null);
16116
+ if (!str) {
16117
+ return INVALID_DATE;
16118
+ }
16118
16119
  if (str.length === 10) {
16119
16120
  str += "T00:00:00";
16120
16121
  }
@@ -16264,7 +16265,7 @@ var require_packet = __commonJS({
16264
16265
  if (numDigits >= 15) {
16265
16266
  str = this.readString(end - this.offset, "binary");
16266
16267
  result = parseInt(str, 10);
16267
- if (result.toString() === str) {
16268
+ if (Number.isSafeInteger(sign * result)) {
16268
16269
  return sign * result;
16269
16270
  }
16270
16271
  return sign === -1 ? `-${str}` : str;
@@ -16286,11 +16287,10 @@ var require_packet = __commonJS({
16286
16287
  if (!supportBigNumbers) {
16287
16288
  return num;
16288
16289
  }
16289
- str = this.buffer.toString("ascii", start, end);
16290
- if (num.toString() === str) {
16290
+ if (Number.isSafeInteger(num)) {
16291
16291
  return num;
16292
16292
  }
16293
- return str;
16293
+ return this.buffer.toString("ascii", start, end);
16294
16294
  }
16295
16295
  // note that if value of inputNumberAsString is bigger than MAX_SAFE_INTEGER
16296
16296
  // ( or smaller than MIN_SAFE_INTEGER ) the parseIntNoBigCheck result might be
@@ -17137,6 +17137,8 @@ var require_commands = __commonJS({
17137
17137
  DAEMON: 29,
17138
17138
  // deprecated
17139
17139
  BINLOG_DUMP_GTID: 30,
17140
+ RESET_CONNECTION: 31,
17141
+ // introduced in 5.7.3
17140
17142
  UNKNOWN: 255
17141
17143
  // bad!
17142
17144
  };
@@ -17201,6 +17203,7 @@ var require_client3 = __commonJS({
17201
17203
  exports2.PLUGIN_AUTH_LENENC_CLIENT_DATA = 2097152;
17202
17204
  exports2.CAN_HANDLE_EXPIRED_PASSWORDS = 4194304;
17203
17205
  exports2.SESSION_TRACK = 8388608;
17206
+ exports2.CLIENT_QUERY_ATTRIBUTES = 134217728;
17204
17207
  exports2.SSL_VERIFY_SERVER_CERT = 1073741824;
17205
17208
  exports2.REMEMBER_OPTIONS = 2147483648;
17206
17209
  exports2.MULTI_FACTOR_AUTHENTICATION = 268435456;
@@ -17975,20 +17978,18 @@ var require_cursor = __commonJS({
17975
17978
  NO_CURSOR: 0,
17976
17979
  READ_ONLY: 1,
17977
17980
  FOR_UPDATE: 2,
17978
- SCROLLABLE: 3
17981
+ SCROLLABLE: 3,
17982
+ PARAMETER_COUNT_AVAILABLE: 8
17979
17983
  };
17980
17984
  }
17981
17985
  });
17982
17986
 
17983
- // node_modules/mysql2/lib/packets/execute.js
17984
- var require_execute = __commonJS({
17985
- "node_modules/mysql2/lib/packets/execute.js"(exports2, module2) {
17987
+ // node_modules/mysql2/lib/packets/encode_parameter.js
17988
+ var require_encode_parameter = __commonJS({
17989
+ "node_modules/mysql2/lib/packets/encode_parameter.js"(exports2, module2) {
17986
17990
  "use strict";
17987
- var CursorType = require_cursor();
17988
- var CommandCodes = require_commands();
17989
17991
  var Types = require_types();
17990
17992
  var Packet = require_packet();
17991
- var CharsetToEncoding = require_charset_encodings();
17992
17993
  function isJSON(value) {
17993
17994
  return Array.isArray(value) || value.constructor === Object || typeof value.toJSON === "function" && !Buffer.isBuffer(value);
17994
17995
  }
@@ -18040,12 +18041,29 @@ var require_execute = __commonJS({
18040
18041
  }
18041
18042
  return { value, type, length, writer };
18042
18043
  }
18044
+ module2.exports = { toParameter, isJSON };
18045
+ }
18046
+ });
18047
+
18048
+ // node_modules/mysql2/lib/packets/execute.js
18049
+ var require_execute = __commonJS({
18050
+ "node_modules/mysql2/lib/packets/execute.js"(exports2, module2) {
18051
+ "use strict";
18052
+ var CursorType = require_cursor();
18053
+ var CommandCodes = require_commands();
18054
+ var ClientConstants = require_client3();
18055
+ var Types = require_types();
18056
+ var Packet = require_packet();
18057
+ var CharsetToEncoding = require_charset_encodings();
18058
+ var { toParameter } = require_encode_parameter();
18043
18059
  var Execute = class {
18044
- constructor(id, parameters, charsetNumber, timezone) {
18060
+ constructor(id, parameters, charsetNumber, timezone, attributes, clientFlags) {
18045
18061
  this.id = id;
18046
18062
  this.parameters = parameters;
18047
18063
  this.encoding = CharsetToEncoding[charsetNumber];
18048
18064
  this.timezone = timezone;
18065
+ this.attributes = attributes;
18066
+ this.clientFlags = clientFlags || 0;
18049
18067
  }
18050
18068
  static fromPacket(packet, encoding) {
18051
18069
  const stmtId = packet.readInt32();
@@ -18087,32 +18105,36 @@ var require_execute = __commonJS({
18087
18105
  }
18088
18106
  return { stmtId, flags, iterationCount, values };
18089
18107
  }
18090
- toPacket() {
18091
- let length = 14;
18092
- let parameters;
18093
- if (this.parameters && this.parameters.length > 0) {
18094
- length += Math.floor((this.parameters.length + 7) / 8);
18095
- length += 1;
18096
- length += 2 * this.parameters.length;
18097
- parameters = this.parameters.map(
18098
- (value) => toParameter(value, this.encoding, this.timezone)
18099
- );
18100
- length += parameters.reduce(
18101
- (accumulator, parameter) => accumulator + parameter.length,
18102
- 0
18103
- );
18104
- }
18105
- const buffer = Buffer.allocUnsafe(length);
18106
- const packet = new Packet(0, buffer, 0, length);
18108
+ _serializeToBuffer(buffer) {
18109
+ const useQueryAttributes = this.clientFlags & ClientConstants.CLIENT_QUERY_ATTRIBUTES;
18110
+ const attrNames = useQueryAttributes && this.attributes ? Object.keys(this.attributes) : [];
18111
+ const numParams = this.parameters ? this.parameters.length : 0;
18112
+ const numAttrs = attrNames.length;
18113
+ const totalParams = numParams + numAttrs;
18114
+ const packet = new Packet(0, buffer, 0, buffer.length);
18107
18115
  packet.offset = 4;
18108
18116
  packet.writeInt8(CommandCodes.STMT_EXECUTE);
18109
18117
  packet.writeInt32(this.id);
18110
- packet.writeInt8(CursorType.NO_CURSOR);
18118
+ let cursorFlags = CursorType.NO_CURSOR;
18119
+ if (useQueryAttributes) {
18120
+ cursorFlags |= CursorType.PARAMETER_COUNT_AVAILABLE;
18121
+ }
18122
+ packet.writeInt8(cursorFlags);
18111
18123
  packet.writeInt32(1);
18112
- if (parameters) {
18124
+ if (useQueryAttributes) {
18125
+ packet.writeLengthCodedNumber(totalParams);
18126
+ }
18127
+ if (totalParams > 0) {
18128
+ const bindParams = numParams > 0 ? this.parameters.map(
18129
+ (v) => toParameter(v, this.encoding, this.timezone)
18130
+ ) : [];
18131
+ const attrParams = attrNames.map(
18132
+ (name) => toParameter(this.attributes[name], this.encoding, this.timezone)
18133
+ );
18134
+ const allParams = bindParams.concat(attrParams);
18113
18135
  let bitmap = 0;
18114
18136
  let bitValue = 1;
18115
- parameters.forEach((parameter) => {
18137
+ allParams.forEach((parameter) => {
18116
18138
  if (parameter.type === Types.NULL) {
18117
18139
  bitmap += bitValue;
18118
18140
  }
@@ -18127,11 +18149,15 @@ var require_execute = __commonJS({
18127
18149
  packet.writeInt8(bitmap);
18128
18150
  }
18129
18151
  packet.writeInt8(1);
18130
- parameters.forEach((parameter) => {
18131
- packet.writeInt8(parameter.type);
18152
+ for (let i = 0; i < allParams.length; i++) {
18153
+ packet.writeInt8(allParams[i].type);
18132
18154
  packet.writeInt8(0);
18133
- });
18134
- parameters.forEach((parameter) => {
18155
+ if (useQueryAttributes) {
18156
+ const name = i < numParams ? "" : attrNames[i - numParams];
18157
+ packet.writeLengthCodedString(name, this.encoding);
18158
+ }
18159
+ }
18160
+ allParams.forEach((parameter) => {
18135
18161
  if (parameter.type !== Types.NULL) {
18136
18162
  parameter.writer.call(packet, parameter.value);
18137
18163
  }
@@ -18139,6 +18165,10 @@ var require_execute = __commonJS({
18139
18165
  }
18140
18166
  return packet;
18141
18167
  }
18168
+ toPacket() {
18169
+ const p = this._serializeToBuffer(Packet.MockBuffer());
18170
+ return this._serializeToBuffer(Buffer.allocUnsafe(p.offset));
18171
+ }
18142
18172
  };
18143
18173
  module2.exports = Execute;
18144
18174
  }
@@ -18361,11 +18391,11 @@ var require_handshake_response = __commonJS({
18361
18391
  const p = this.serializeResponse(Packet.MockBuffer());
18362
18392
  return this.serializeResponse(Buffer.alloc(p.offset));
18363
18393
  }
18364
- static fromPacket(packet) {
18394
+ static fromPacket(packet, serverFlags = 4294967295) {
18365
18395
  const args = {};
18366
18396
  args.clientFlags = packet.readInt32();
18367
18397
  function isSet(flag) {
18368
- return args.clientFlags & ClientConstants[flag];
18398
+ return args.clientFlags & serverFlags & ClientConstants[flag];
18369
18399
  }
18370
18400
  args.maxPacketSize = packet.readInt32();
18371
18401
  args.charsetNumber = packet.readInt8();
@@ -18460,22 +18490,80 @@ var require_query3 = __commonJS({
18460
18490
  var CommandCode = require_commands();
18461
18491
  var StringParser = require_string();
18462
18492
  var CharsetToEncoding = require_charset_encodings();
18493
+ var ClientConstants = require_client3();
18494
+ var Types = require_types();
18495
+ var { toParameter } = require_encode_parameter();
18463
18496
  var Query2 = class {
18464
- constructor(sql, charsetNumber) {
18497
+ constructor(sql, charsetNumber, attributes, clientFlags) {
18465
18498
  this.query = sql;
18466
18499
  this.charsetNumber = charsetNumber;
18467
18500
  this.encoding = CharsetToEncoding[charsetNumber];
18501
+ this.attributes = attributes;
18502
+ this.clientFlags = clientFlags || 0;
18468
18503
  }
18469
- toPacket() {
18470
- const buf = StringParser.encode(this.query, this.encoding);
18471
- const length = 5 + buf.length;
18472
- const buffer = Buffer.allocUnsafe(length);
18473
- const packet = new Packet(0, buffer, 0, length);
18504
+ serializeToBuffer(buffer) {
18505
+ const useQueryAttributes = this.clientFlags & ClientConstants.CLIENT_QUERY_ATTRIBUTES;
18506
+ const sqlBuf = StringParser.encode(this.query, this.encoding);
18507
+ const packet = new Packet(0, buffer, 0, buffer.length);
18474
18508
  packet.offset = 4;
18475
18509
  packet.writeInt8(CommandCode.QUERY);
18476
- packet.writeBuffer(buf);
18510
+ if (useQueryAttributes) {
18511
+ const attrs = this.attributes;
18512
+ const names = attrs ? Object.keys(attrs) : [];
18513
+ const paramCount = names.length;
18514
+ packet.writeLengthCodedNumber(paramCount);
18515
+ packet.writeLengthCodedNumber(1);
18516
+ if (paramCount > 0) {
18517
+ const parameters = names.map(
18518
+ (name) => toParameter(attrs[name], this.encoding, "local")
18519
+ );
18520
+ let bitmap = 0;
18521
+ let bitValue = 1;
18522
+ parameters.forEach((parameter) => {
18523
+ if (parameter.type === Types.NULL) {
18524
+ bitmap += bitValue;
18525
+ }
18526
+ bitValue *= 2;
18527
+ if (bitValue === 256) {
18528
+ packet.writeInt8(bitmap);
18529
+ bitmap = 0;
18530
+ bitValue = 1;
18531
+ }
18532
+ });
18533
+ if (bitValue !== 1) {
18534
+ packet.writeInt8(bitmap);
18535
+ }
18536
+ packet.writeInt8(1);
18537
+ for (let i = 0; i < paramCount; i++) {
18538
+ packet.writeInt8(parameters[i].type);
18539
+ packet.writeInt8(0);
18540
+ packet.writeLengthCodedString(names[i], this.encoding);
18541
+ }
18542
+ parameters.forEach((parameter) => {
18543
+ if (parameter.type !== Types.NULL) {
18544
+ parameter.writer.call(packet, parameter.value);
18545
+ }
18546
+ });
18547
+ }
18548
+ }
18549
+ packet.writeBuffer(sqlBuf);
18477
18550
  return packet;
18478
18551
  }
18552
+ toPacket() {
18553
+ const useQueryAttributes = this.clientFlags & ClientConstants.CLIENT_QUERY_ATTRIBUTES;
18554
+ if (!useQueryAttributes) {
18555
+ const buf = StringParser.encode(this.query, this.encoding);
18556
+ const length = 5 + buf.length;
18557
+ const buffer = Buffer.allocUnsafe(length);
18558
+ const packet = new Packet(0, buffer, 0, length);
18559
+ packet.offset = 4;
18560
+ packet.writeInt8(CommandCode.QUERY);
18561
+ packet.writeBuffer(buf);
18562
+ return packet;
18563
+ }
18564
+ const p = this.serializeToBuffer(Packet.MockBuffer());
18565
+ return this.serializeToBuffer(Buffer.allocUnsafe(p.offset));
18566
+ }
18479
18567
  };
18480
18568
  module2.exports = Query2;
18481
18569
  }
@@ -18521,6 +18609,26 @@ var require_register_slave = __commonJS({
18521
18609
  }
18522
18610
  });
18523
18611
 
18612
+ // node_modules/mysql2/lib/packets/reset_connection.js
18613
+ var require_reset_connection = __commonJS({
18614
+ "node_modules/mysql2/lib/packets/reset_connection.js"(exports2, module2) {
18615
+ "use strict";
18616
+ var Packet = require_packet();
18617
+ var CommandCodes = require_commands();
18618
+ var ResetConnection = class {
18619
+ constructor() {
18620
+ }
18621
+ toPacket() {
18622
+ const packet = new Packet(0, Buffer.alloc(5), 0, 5);
18623
+ packet.offset = 4;
18624
+ packet.writeInt8(CommandCodes.RESET_CONNECTION);
18625
+ return packet;
18626
+ }
18627
+ };
18628
+ module2.exports = ResetConnection;
18629
+ }
18630
+ });
18631
+
18524
18632
  // node_modules/mysql2/lib/constants/server_status.js
18525
18633
  var require_server_status = __commonJS({
18526
18634
  "node_modules/mysql2/lib/constants/server_status.js"(exports2) {
@@ -18646,7 +18754,7 @@ var require_resultset_header = __commonJS({
18646
18754
  let stateChanges = null;
18647
18755
  if (isSet("SESSION_TRACK") && packet.offset < packet.end) {
18648
18756
  this.info = packet.readLengthCodedString(encoding);
18649
- if (this.serverStatus && ServerSatusFlags.SERVER_SESSION_STATE_CHANGED) {
18757
+ if (this.serverStatus & ServerSatusFlags.SERVER_SESSION_STATE_CHANGED) {
18650
18758
  let len = packet.offset < packet.end ? packet.readLengthCodedNumber() : 0;
18651
18759
  const end = packet.offset + len;
18652
18760
  let type, key, stateEnd;
@@ -18814,6 +18922,7 @@ var require_packets = __commonJS({
18814
18922
  var PreparedStatementHeader = require_prepared_statement_header();
18815
18923
  var Query2 = require_query3();
18816
18924
  var RegisterSlave = require_register_slave();
18925
+ var ResetConnection = require_reset_connection();
18817
18926
  var ResultSetHeader = require_resultset_header();
18818
18927
  var SSLRequest = require_ssl_request();
18819
18928
  var TextRow = require_text_row();
@@ -18834,6 +18943,7 @@ var require_packets = __commonJS({
18834
18943
  PreparedStatementHeader,
18835
18944
  Query: Query2,
18836
18945
  RegisterSlave,
18946
+ ResetConnection,
18837
18947
  ResultSetHeader,
18838
18948
  SSLRequest,
18839
18949
  TextRow
@@ -19225,6 +19335,20 @@ var require_auth_switch = __commonJS({
19225
19335
  });
19226
19336
  return;
19227
19337
  }
19338
+ if (pluginName === "mysql_clear_password") {
19339
+ const hasCustomPlugin = connection.config.authPlugins && Object.prototype.hasOwnProperty.call(
19340
+ connection.config.authPlugins,
19341
+ "mysql_clear_password"
19342
+ );
19343
+ if (!hasCustomPlugin && !connection.config.enableCleartextPlugin) {
19344
+ const err = new Error(
19345
+ "Server requested authentication using mysql_clear_password, which sends the password in plaintext over the network and is disabled by default. To enable it, set the `enableCleartextPlugin` option to `true` in your connection configuration, or provide a custom `mysql_clear_password` auth plugin via the `authPlugins` option. Only use this over a secure connection (TLS/SSL)."
19346
+ );
19347
+ err.code = "MYSQL_CLEAR_PASSWORD_NOT_ENABLED";
19348
+ err.fatal = true;
19349
+ throw err;
19350
+ }
19351
+ }
19228
19352
  const authPlugin = getAuthPlugin(pluginName, connection);
19229
19353
  if (!authPlugin) {
19230
19354
  throw new Error(
@@ -19466,7 +19590,7 @@ var require_client_handshake = __commonJS({
19466
19590
  serverAuthMethod
19467
19591
  );
19468
19592
  const hasLegacyAuthSwitchHandler = typeof connection.config.authSwitchHandler === "function";
19469
- const canUseDirectAuth = !hasCustomAuthPlugin && !hasLegacyAuthSwitchHandler && this.canUseAuthMethodDirectly(serverAuthMethod, isSecureConnection);
19593
+ const canUseDirectAuth = !hasCustomAuthPlugin && !hasLegacyAuthSwitchHandler && this.canUseAuthMethodDirectly(serverAuthMethod, isSecureConnection) && (serverAuthMethod !== "mysql_clear_password" || connection.config.enableCleartextPlugin);
19470
19594
  const clientAuthMethod = canUseDirectAuth ? serverAuthMethod : "mysql_native_password";
19471
19595
  const authToken = this.calculateAuthToken(
19472
19596
  clientAuthMethod,
@@ -19632,7 +19756,9 @@ var require_client_handshake = __commonJS({
19632
19756
  }
19633
19757
  return _ClientHandshake.prototype.handshakeResult;
19634
19758
  } catch (err) {
19635
- err.code = "AUTH_SWITCH_PLUGIN_ERROR";
19759
+ if (!err.code) {
19760
+ err.code = "AUTH_SWITCH_PLUGIN_ERROR";
19761
+ }
19636
19762
  err.fatal = true;
19637
19763
  if (this.onResult) {
19638
19764
  this.onResult(err);
@@ -19696,7 +19822,10 @@ var require_server_handshake = __commonJS({
19696
19822
  return _ServerHandshake.prototype.readClientReply;
19697
19823
  }
19698
19824
  readClientReply(packet, connection) {
19699
- const clientHelloReply = Packets.HandshakeResponse.fromPacket(packet);
19825
+ const clientHelloReply = Packets.HandshakeResponse.fromPacket(
19826
+ packet,
19827
+ this.args.capabilityFlags
19828
+ );
19700
19829
  connection.clientHelloReply = clientHelloReply;
19701
19830
  if (this.args.authCallback) {
19702
19831
  this.args.authCallback(
@@ -20743,9 +20872,12 @@ var require_query4 = __commonJS({
20743
20872
  this._connection = connection;
20744
20873
  this.options = Object.assign({}, connection.config, this._queryOptions);
20745
20874
  this._setTimeout();
20875
+ const clientFlags = connection.config.clientFlags & (connection.serverCapabilityFlags || 0);
20746
20876
  const cmdPacket = new Packets.Query(
20747
20877
  this.sql,
20748
- connection.config.charsetNumber
20878
+ connection.config.charsetNumber,
20879
+ this._queryOptions.attributes,
20880
+ clientFlags
20749
20881
  );
20750
20882
  connection.writePacket(cmdPacket.toPacket(1));
20751
20883
  return _Query.prototype.resultsetHeader;
@@ -21440,11 +21572,14 @@ var require_execute2 = __commonJS({
21440
21572
  this._connection = connection;
21441
21573
  this.options = Object.assign({}, connection.config, this._executeOptions);
21442
21574
  this._setTimeout();
21575
+ const clientFlags = connection.config.clientFlags & (connection.serverCapabilityFlags || 0);
21443
21576
  const executePacket = new Packets.Execute(
21444
21577
  this.statement.id,
21445
21578
  this.parameters,
21446
21579
  connection.config.charsetNumber,
21447
- connection.config.timezone
21580
+ connection.config.timezone,
21581
+ this._executeOptions.attributes,
21582
+ clientFlags
21448
21583
  );
21449
21584
  try {
21450
21585
  connection.writePacket(executePacket.toPacket(1));
@@ -21949,6 +22084,36 @@ var require_change_user2 = __commonJS({
21949
22084
  }
21950
22085
  });
21951
22086
 
22087
+ // node_modules/mysql2/lib/commands/reset_connection.js
22088
+ var require_reset_connection2 = __commonJS({
22089
+ "node_modules/mysql2/lib/commands/reset_connection.js"(exports2, module2) {
22090
+ "use strict";
22091
+ var Command = require_command();
22092
+ var Packets = require_packets();
22093
+ var ResetConnection = class _ResetConnection extends Command {
22094
+ constructor(callback) {
22095
+ super();
22096
+ this.onResult = callback;
22097
+ }
22098
+ start(packet, connection) {
22099
+ const req = new Packets.ResetConnection();
22100
+ connection.writePacket(req.toPacket());
22101
+ return _ResetConnection.prototype.resetConnectionResponse;
22102
+ }
22103
+ resetConnectionResponse(packet, connection) {
22104
+ if (connection._statements) {
22105
+ connection._statements.clear();
22106
+ }
22107
+ if (this.onResult) {
22108
+ process.nextTick(this.onResult.bind(this, null));
22109
+ }
22110
+ return null;
22111
+ }
22112
+ };
22113
+ module2.exports = ResetConnection;
22114
+ }
22115
+ });
22116
+
21952
22117
  // node_modules/mysql2/lib/commands/quit.js
21953
22118
  var require_quit = __commonJS({
21954
22119
  "node_modules/mysql2/lib/commands/quit.js"(exports2, module2) {
@@ -21994,6 +22159,7 @@ var require_commands2 = __commonJS({
21994
22159
  var RegisterSlave = require_register_slave2();
21995
22160
  var BinlogDump = require_binlog_dump2();
21996
22161
  var ChangeUser = require_change_user2();
22162
+ var ResetConnection = require_reset_connection2();
21997
22163
  var Quit = require_quit();
21998
22164
  module2.exports = {
21999
22165
  ClientHandshake,
@@ -22006,6 +22172,7 @@ var require_commands2 = __commonJS({
22006
22172
  RegisterSlave,
22007
22173
  BinlogDump,
22008
22174
  ChangeUser,
22175
+ ResetConnection,
22009
22176
  Quit
22010
22177
  };
22011
22178
  }
@@ -22016,7 +22183,7 @@ var require_package = __commonJS({
22016
22183
  "node_modules/mysql2/package.json"(exports2, module2) {
22017
22184
  module2.exports = {
22018
22185
  name: "mysql2",
22019
- version: "3.20.0",
22186
+ version: "3.22.2",
22020
22187
  description: "fast mysql driver. Implements core protocol, prepared statements, ssl and compression in native JS",
22021
22188
  main: "index.js",
22022
22189
  typings: "typings/mysql/index",
@@ -22084,7 +22251,7 @@ var require_package = __commonJS({
22084
22251
  devDependencies: {
22085
22252
  "@eslint/eslintrc": "^3.3.3",
22086
22253
  "@eslint/js": "^9.39.2",
22087
- "@eslint/markdown": "^7.5.1",
22254
+ "@eslint/markdown": "^8.0.1",
22088
22255
  "@ianvs/prettier-plugin-sort-imports": "^4.7.1",
22089
22256
  "@pokujs/multi-suite": "^1.0.0",
22090
22257
  "@rollup/plugin-commonjs": "^29.0.2",
@@ -22340,6 +22507,7 @@ var require_connection_config = __commonJS({
22340
22507
  uri: 1,
22341
22508
  user: 1,
22342
22509
  disableEval: 1,
22510
+ enableCleartextPlugin: 1,
22343
22511
  // These options are used for Pool
22344
22512
  connectionLimit: 1,
22345
22513
  maxIdle: 1,
@@ -22411,6 +22579,7 @@ var require_connection_config = __commonJS({
22411
22579
  this.nestTables = options.nestTables === void 0 ? void 0 : options.nestTables;
22412
22580
  this.typeCast = options.typeCast === void 0 ? true : options.typeCast;
22413
22581
  this.disableEval = Boolean(options.disableEval);
22582
+ this.enableCleartextPlugin = Boolean(options.enableCleartextPlugin);
22414
22583
  if (this.timezone[0] === " ") {
22415
22584
  this.timezone = `+${this.timezone.slice(1)}`;
22416
22585
  }
@@ -22482,7 +22651,8 @@ var require_connection_config = __commonJS({
22482
22651
  "MULTI_RESULTS",
22483
22652
  "TRANSACTIONS",
22484
22653
  "SESSION_TRACK",
22485
- "CONNECT_ATTRS"
22654
+ "CONNECT_ATTRS",
22655
+ "CLIENT_QUERY_ATTRIBUTES"
22486
22656
  ];
22487
22657
  if (options && options.multipleStatements) {
22488
22658
  defaultFlags.push("MULTI_STATEMENTS");
@@ -23523,6 +23693,9 @@ var require_connection2 = __commonJS({
23523
23693
  ping(cb) {
23524
23694
  return this.addCommand(new Commands.Ping(cb));
23525
23695
  }
23696
+ reset(cb) {
23697
+ return this.addCommand(new Commands.ResetConnection(cb));
23698
+ }
23526
23699
  _registerSlave(opts, cb) {
23527
23700
  return this.addCommand(new Commands.RegisterSlave(opts, cb));
23528
23701
  }
@@ -23695,20 +23868,36 @@ var require_connection2 = __commonJS({
23695
23868
  }
23696
23869
  });
23697
23870
 
23871
+ // node_modules/mysql2/lib/promise/capture_local_err.js
23872
+ var require_capture_local_err = __commonJS({
23873
+ "node_modules/mysql2/lib/promise/capture_local_err.js"(exports2, module2) {
23874
+ "use strict";
23875
+ function captureStackHolder(constructorOpt) {
23876
+ const holder = {};
23877
+ Error.captureStackTrace(holder, constructorOpt);
23878
+ return holder;
23879
+ }
23880
+ function applyCapturedStack(err, holder) {
23881
+ const stack = holder && holder.stack;
23882
+ if (typeof stack !== "string" || !stack) return;
23883
+ const lines = stack.split("\n");
23884
+ lines[0] = `${err.name}: ${err.message}`;
23885
+ err.stack = lines.join("\n");
23886
+ }
23887
+ module2.exports = { captureStackHolder, applyCapturedStack };
23888
+ }
23889
+ });
23890
+
23698
23891
  // node_modules/mysql2/lib/promise/make_done_cb.js
23699
23892
  var require_make_done_cb = __commonJS({
23700
23893
  "node_modules/mysql2/lib/promise/make_done_cb.js"(exports2, module2) {
23701
23894
  "use strict";
23702
- function makeDoneCb(resolve, reject, localErr) {
23895
+ var { applyCapturedStack } = require_capture_local_err();
23896
+ function makeDoneCb(resolve, reject, stackHolder) {
23703
23897
  return function(err, rows, fields) {
23704
23898
  if (err) {
23705
- localErr.message = err.message;
23706
- localErr.code = err.code;
23707
- localErr.errno = err.errno;
23708
- localErr.sql = err.sql;
23709
- localErr.sqlState = err.sqlState;
23710
- localErr.sqlMessage = err.sqlMessage;
23711
- reject(localErr);
23899
+ applyCapturedStack(err, stackHolder);
23900
+ reject(err);
23712
23901
  } else {
23713
23902
  resolve([rows, fields]);
23714
23903
  }
@@ -23722,17 +23911,20 @@ var require_make_done_cb = __commonJS({
23722
23911
  var require_prepared_statement_info = __commonJS({
23723
23912
  "node_modules/mysql2/lib/promise/prepared_statement_info.js"(exports2, module2) {
23724
23913
  "use strict";
23914
+ var { captureStackHolder } = require_capture_local_err();
23725
23915
  var makeDoneCb = require_make_done_cb();
23726
- var PromisePreparedStatementInfo = class {
23916
+ var PromisePreparedStatementInfo = class _PromisePreparedStatementInfo {
23727
23917
  constructor(statement, promiseImpl) {
23728
23918
  this.statement = statement;
23729
23919
  this.Promise = promiseImpl;
23730
23920
  }
23731
23921
  execute(parameters) {
23732
23922
  const s = this.statement;
23733
- const localErr = new Error();
23923
+ const stackHolder = captureStackHolder(
23924
+ _PromisePreparedStatementInfo.prototype.execute
23925
+ );
23734
23926
  return new this.Promise((resolve, reject) => {
23735
- const done = makeDoneCb(resolve, reject, localErr);
23927
+ const done = makeDoneCb(resolve, reject, stackHolder);
23736
23928
  if (parameters) {
23737
23929
  s.execute(parameters, done);
23738
23930
  } else {
@@ -23785,10 +23977,14 @@ var require_connection3 = __commonJS({
23785
23977
  "use strict";
23786
23978
  var EventEmitter = require("events").EventEmitter;
23787
23979
  var PromisePreparedStatementInfo = require_prepared_statement_info();
23980
+ var {
23981
+ captureStackHolder,
23982
+ applyCapturedStack
23983
+ } = require_capture_local_err();
23788
23984
  var makeDoneCb = require_make_done_cb();
23789
23985
  var inheritEvents = require_inherit_events();
23790
23986
  var BaseConnection = require_connection2();
23791
- var PromiseConnection = class extends EventEmitter {
23987
+ var PromiseConnection = class _PromiseConnection extends EventEmitter {
23792
23988
  constructor(connection, promiseImpl) {
23793
23989
  super();
23794
23990
  this.connection = connection;
@@ -23806,14 +24002,14 @@ var require_connection3 = __commonJS({
23806
24002
  }
23807
24003
  query(query, params) {
23808
24004
  const c = this.connection;
23809
- const localErr = new Error();
24005
+ const stackHolder = captureStackHolder(_PromiseConnection.prototype.query);
23810
24006
  if (typeof params === "function") {
23811
24007
  throw new Error(
23812
24008
  "Callback function is not available with promise clients."
23813
24009
  );
23814
24010
  }
23815
24011
  return new this.Promise((resolve, reject) => {
23816
- const done = makeDoneCb(resolve, reject, localErr);
24012
+ const done = makeDoneCb(resolve, reject, stackHolder);
23817
24013
  if (params !== void 0) {
23818
24014
  c.query(query, params, done);
23819
24015
  } else {
@@ -23823,14 +24019,14 @@ var require_connection3 = __commonJS({
23823
24019
  }
23824
24020
  execute(query, params) {
23825
24021
  const c = this.connection;
23826
- const localErr = new Error();
24022
+ const stackHolder = captureStackHolder(_PromiseConnection.prototype.execute);
23827
24023
  if (typeof params === "function") {
23828
24024
  throw new Error(
23829
24025
  "Callback function is not available with promise clients."
23830
24026
  );
23831
24027
  }
23832
24028
  return new this.Promise((resolve, reject) => {
23833
- const done = makeDoneCb(resolve, reject, localErr);
24029
+ const done = makeDoneCb(resolve, reject, stackHolder);
23834
24030
  if (params !== void 0) {
23835
24031
  c.execute(query, params, done);
23836
24032
  } else {
@@ -23850,58 +24046,68 @@ var require_connection3 = __commonJS({
23850
24046
  }
23851
24047
  beginTransaction() {
23852
24048
  const c = this.connection;
23853
- const localErr = new Error();
24049
+ const stackHolder = captureStackHolder(
24050
+ _PromiseConnection.prototype.beginTransaction
24051
+ );
23854
24052
  return new this.Promise((resolve, reject) => {
23855
- const done = makeDoneCb(resolve, reject, localErr);
24053
+ const done = makeDoneCb(resolve, reject, stackHolder);
23856
24054
  c.beginTransaction(done);
23857
24055
  });
23858
24056
  }
23859
24057
  commit() {
23860
24058
  const c = this.connection;
23861
- const localErr = new Error();
24059
+ const stackHolder = captureStackHolder(_PromiseConnection.prototype.commit);
23862
24060
  return new this.Promise((resolve, reject) => {
23863
- const done = makeDoneCb(resolve, reject, localErr);
24061
+ const done = makeDoneCb(resolve, reject, stackHolder);
23864
24062
  c.commit(done);
23865
24063
  });
23866
24064
  }
23867
24065
  rollback() {
23868
24066
  const c = this.connection;
23869
- const localErr = new Error();
24067
+ const stackHolder = captureStackHolder(
24068
+ _PromiseConnection.prototype.rollback
24069
+ );
23870
24070
  return new this.Promise((resolve, reject) => {
23871
- const done = makeDoneCb(resolve, reject, localErr);
24071
+ const done = makeDoneCb(resolve, reject, stackHolder);
23872
24072
  c.rollback(done);
23873
24073
  });
23874
24074
  }
23875
24075
  ping() {
23876
24076
  const c = this.connection;
23877
- const localErr = new Error();
24077
+ const stackHolder = captureStackHolder(_PromiseConnection.prototype.ping);
23878
24078
  return new this.Promise((resolve, reject) => {
23879
24079
  c.ping((err) => {
23880
24080
  if (err) {
23881
- localErr.message = err.message;
23882
- localErr.code = err.code;
23883
- localErr.errno = err.errno;
23884
- localErr.sqlState = err.sqlState;
23885
- localErr.sqlMessage = err.sqlMessage;
23886
- reject(localErr);
24081
+ applyCapturedStack(err, stackHolder);
24082
+ reject(err);
23887
24083
  } else {
23888
24084
  resolve(true);
23889
24085
  }
23890
24086
  });
23891
24087
  });
23892
24088
  }
24089
+ reset() {
24090
+ const c = this.connection;
24091
+ const stackHolder = captureStackHolder(_PromiseConnection.prototype.reset);
24092
+ return new this.Promise((resolve, reject) => {
24093
+ c.reset((err) => {
24094
+ if (err) {
24095
+ applyCapturedStack(err, stackHolder);
24096
+ reject(err);
24097
+ } else {
24098
+ resolve();
24099
+ }
24100
+ });
24101
+ });
24102
+ }
23893
24103
  connect() {
23894
24104
  const c = this.connection;
23895
- const localErr = new Error();
24105
+ const stackHolder = captureStackHolder(_PromiseConnection.prototype.connect);
23896
24106
  return new this.Promise((resolve, reject) => {
23897
24107
  c.connect((err, param) => {
23898
24108
  if (err) {
23899
- localErr.message = err.message;
23900
- localErr.code = err.code;
23901
- localErr.errno = err.errno;
23902
- localErr.sqlState = err.sqlState;
23903
- localErr.sqlMessage = err.sqlMessage;
23904
- reject(localErr);
24109
+ applyCapturedStack(err, stackHolder);
24110
+ reject(err);
23905
24111
  } else {
23906
24112
  resolve(param);
23907
24113
  }
@@ -23911,16 +24117,12 @@ var require_connection3 = __commonJS({
23911
24117
  prepare(options) {
23912
24118
  const c = this.connection;
23913
24119
  const promiseImpl = this.Promise;
23914
- const localErr = new Error();
24120
+ const stackHolder = captureStackHolder(_PromiseConnection.prototype.prepare);
23915
24121
  return new this.Promise((resolve, reject) => {
23916
24122
  c.prepare(options, (err, statement) => {
23917
24123
  if (err) {
23918
- localErr.message = err.message;
23919
- localErr.code = err.code;
23920
- localErr.errno = err.errno;
23921
- localErr.sqlState = err.sqlState;
23922
- localErr.sqlMessage = err.sqlMessage;
23923
- reject(localErr);
24124
+ applyCapturedStack(err, stackHolder);
24125
+ reject(err);
23924
24126
  } else {
23925
24127
  const wrappedStatement = new PromisePreparedStatementInfo(
23926
24128
  statement,
@@ -23933,16 +24135,14 @@ var require_connection3 = __commonJS({
23933
24135
  }
23934
24136
  changeUser(options) {
23935
24137
  const c = this.connection;
23936
- const localErr = new Error();
24138
+ const stackHolder = captureStackHolder(
24139
+ _PromiseConnection.prototype.changeUser
24140
+ );
23937
24141
  return new this.Promise((resolve, reject) => {
23938
24142
  c.changeUser(options, (err) => {
23939
24143
  if (err) {
23940
- localErr.message = err.message;
23941
- localErr.code = err.code;
23942
- localErr.errno = err.errno;
23943
- localErr.sqlState = err.sqlState;
23944
- localErr.sqlMessage = err.sqlMessage;
23945
- reject(localErr);
24144
+ applyCapturedStack(err, stackHolder);
24145
+ reject(err);
23946
24146
  } else {
23947
24147
  resolve();
23948
24148
  }
@@ -24203,7 +24403,29 @@ var require_pool = __commonJS({
24203
24403
  cb = this._connectionQueue.shift();
24204
24404
  process2.nextTick(this.getConnection.bind(this, cb));
24205
24405
  }
24206
- } else if (this._connectionQueue.length) {
24406
+ return;
24407
+ }
24408
+ if (this.config.resetOnRelease && connection.reset) {
24409
+ connection.reset((err) => {
24410
+ if (err) {
24411
+ connection._pool = null;
24412
+ spliceConnection(this._allConnections, connection);
24413
+ connection.destroy();
24414
+ if (this._connectionQueue.length) {
24415
+ cb = this._connectionQueue.shift();
24416
+ process2.nextTick(this.getConnection.bind(this, cb));
24417
+ }
24418
+ return;
24419
+ }
24420
+ this._handleSuccessfulRelease(connection);
24421
+ });
24422
+ } else {
24423
+ this._handleSuccessfulRelease(connection);
24424
+ }
24425
+ }
24426
+ _handleSuccessfulRelease(connection) {
24427
+ let cb;
24428
+ if (this._connectionQueue.length) {
24207
24429
  cb = this._connectionQueue.shift();
24208
24430
  process2.nextTick(() => {
24209
24431
  connection._released = false;
@@ -24372,11 +24594,15 @@ var require_pool2 = __commonJS({
24372
24594
  "node_modules/mysql2/lib/promise/pool.js"(exports2, module2) {
24373
24595
  "use strict";
24374
24596
  var EventEmitter = require("events").EventEmitter;
24597
+ var {
24598
+ captureStackHolder,
24599
+ applyCapturedStack
24600
+ } = require_capture_local_err();
24375
24601
  var makeDoneCb = require_make_done_cb();
24376
24602
  var PromisePoolConnection = require_pool_connection();
24377
24603
  var inheritEvents = require_inherit_events();
24378
24604
  var BasePool = require_pool();
24379
- var PromisePool = class extends EventEmitter {
24605
+ var PromisePool = class _PromisePool extends EventEmitter {
24380
24606
  constructor(pool, thePromise) {
24381
24607
  super();
24382
24608
  this.pool = pool;
@@ -24400,14 +24626,14 @@ var require_pool2 = __commonJS({
24400
24626
  }
24401
24627
  query(sql, args) {
24402
24628
  const corePool = this.pool;
24403
- const localErr = new Error();
24629
+ const stackHolder = captureStackHolder(_PromisePool.prototype.query);
24404
24630
  if (typeof args === "function") {
24405
24631
  throw new Error(
24406
24632
  "Callback function is not available with promise clients."
24407
24633
  );
24408
24634
  }
24409
24635
  return new this.Promise((resolve, reject) => {
24410
- const done = makeDoneCb(resolve, reject, localErr);
24636
+ const done = makeDoneCb(resolve, reject, stackHolder);
24411
24637
  if (args !== void 0) {
24412
24638
  corePool.query(sql, args, done);
24413
24639
  } else {
@@ -24417,14 +24643,14 @@ var require_pool2 = __commonJS({
24417
24643
  }
24418
24644
  execute(sql, args) {
24419
24645
  const corePool = this.pool;
24420
- const localErr = new Error();
24646
+ const stackHolder = captureStackHolder(_PromisePool.prototype.execute);
24421
24647
  if (typeof args === "function") {
24422
24648
  throw new Error(
24423
24649
  "Callback function is not available with promise clients."
24424
24650
  );
24425
24651
  }
24426
24652
  return new this.Promise((resolve, reject) => {
24427
- const done = makeDoneCb(resolve, reject, localErr);
24653
+ const done = makeDoneCb(resolve, reject, stackHolder);
24428
24654
  if (args) {
24429
24655
  corePool.execute(sql, args, done);
24430
24656
  } else {
@@ -24434,16 +24660,12 @@ var require_pool2 = __commonJS({
24434
24660
  }
24435
24661
  end() {
24436
24662
  const corePool = this.pool;
24437
- const localErr = new Error();
24663
+ const stackHolder = captureStackHolder(_PromisePool.prototype.end);
24438
24664
  return new this.Promise((resolve, reject) => {
24439
24665
  corePool.end((err) => {
24440
24666
  if (err) {
24441
- localErr.message = err.message;
24442
- localErr.code = err.code;
24443
- localErr.errno = err.errno;
24444
- localErr.sqlState = err.sqlState;
24445
- localErr.sqlMessage = err.sqlMessage;
24446
- reject(localErr);
24667
+ applyCapturedStack(err, stackHolder);
24668
+ reject(err);
24447
24669
  } else {
24448
24670
  resolve();
24449
24671
  }
@@ -24508,6 +24730,7 @@ var require_pool_config = __commonJS({
24508
24730
  this.maxIdle = isNaN(options.maxIdle) ? this.connectionLimit : Number(options.maxIdle);
24509
24731
  this.idleTimeout = isNaN(options.idleTimeout) ? 6e4 : Number(options.idleTimeout);
24510
24732
  this.queueLimit = isNaN(options.queueLimit) ? 0 : Number(options.queueLimit);
24733
+ this.resetOnRelease = options.resetOnRelease === void 0 ? false : Boolean(options.resetOnRelease);
24511
24734
  }
24512
24735
  };
24513
24736
  module2.exports = PoolConfig;
@@ -24866,9 +25089,10 @@ var require_create_pool_cluster = __commonJS({
24866
25089
  var require_pool_cluster2 = __commonJS({
24867
25090
  "node_modules/mysql2/lib/promise/pool_cluster.js"(exports2, module2) {
24868
25091
  "use strict";
25092
+ var { captureStackHolder } = require_capture_local_err();
24869
25093
  var PromisePoolConnection = require_pool_connection();
24870
25094
  var makeDoneCb = require_make_done_cb();
24871
- var PromisePoolNamespace = class {
25095
+ var PromisePoolNamespace = class _PromisePoolNamespace {
24872
25096
  constructor(poolNamespace, thePromise) {
24873
25097
  this.poolNamespace = poolNamespace;
24874
25098
  this.Promise = thePromise || Promise;
@@ -24887,27 +25111,31 @@ var require_pool_cluster2 = __commonJS({
24887
25111
  }
24888
25112
  query(sql, values) {
24889
25113
  const corePoolNamespace = this.poolNamespace;
24890
- const localErr = new Error();
25114
+ const stackHolder = captureStackHolder(
25115
+ _PromisePoolNamespace.prototype.query
25116
+ );
24891
25117
  if (typeof values === "function") {
24892
25118
  throw new Error(
24893
25119
  "Callback function is not available with promise clients."
24894
25120
  );
24895
25121
  }
24896
25122
  return new this.Promise((resolve, reject) => {
24897
- const done = makeDoneCb(resolve, reject, localErr);
25123
+ const done = makeDoneCb(resolve, reject, stackHolder);
24898
25124
  corePoolNamespace.query(sql, values, done);
24899
25125
  });
24900
25126
  }
24901
25127
  execute(sql, values) {
24902
25128
  const corePoolNamespace = this.poolNamespace;
24903
- const localErr = new Error();
25129
+ const stackHolder = captureStackHolder(
25130
+ _PromisePoolNamespace.prototype.execute
25131
+ );
24904
25132
  if (typeof values === "function") {
24905
25133
  throw new Error(
24906
25134
  "Callback function is not available with promise clients."
24907
25135
  );
24908
25136
  }
24909
25137
  return new this.Promise((resolve, reject) => {
24910
- const done = makeDoneCb(resolve, reject, localErr);
25138
+ const done = makeDoneCb(resolve, reject, stackHolder);
24911
25139
  corePoolNamespace.execute(sql, values, done);
24912
25140
  });
24913
25141
  }
@@ -24929,13 +25157,17 @@ var require_promise = __commonJS({
24929
25157
  var createPoolCluster = require_create_pool_cluster();
24930
25158
  var PromiseConnection = require_connection3();
24931
25159
  var PromisePool = require_pool2();
25160
+ var {
25161
+ captureStackHolder,
25162
+ applyCapturedStack
25163
+ } = require_capture_local_err();
24932
25164
  var makeDoneCb = require_make_done_cb();
24933
25165
  var PromisePoolConnection = require_pool_connection();
24934
25166
  var inheritEvents = require_inherit_events();
24935
25167
  var PromisePoolNamespace = require_pool_cluster2();
24936
25168
  function createConnectionPromise(opts) {
24937
25169
  const coreConnection = createConnection(opts);
24938
- const createConnectionErr = new Error();
25170
+ const stackHolder = captureStackHolder(createConnectionPromise);
24939
25171
  const thePromise = opts.Promise || Promise;
24940
25172
  if (!thePromise) {
24941
25173
  throw new Error(
@@ -24947,11 +25179,8 @@ var require_promise = __commonJS({
24947
25179
  resolve(new PromiseConnection(coreConnection, thePromise));
24948
25180
  });
24949
25181
  coreConnection.once("error", (err) => {
24950
- createConnectionErr.message = err.message;
24951
- createConnectionErr.code = err.code;
24952
- createConnectionErr.errno = err.errno;
24953
- createConnectionErr.sqlState = err.sqlState;
24954
- reject(createConnectionErr);
25182
+ applyCapturedStack(err, stackHolder);
25183
+ reject(err);
24955
25184
  });
24956
25185
  });
24957
25186
  }
@@ -24965,7 +25194,7 @@ var require_promise = __commonJS({
24965
25194
  }
24966
25195
  return new PromisePool(corePool, thePromise);
24967
25196
  }
24968
- var PromisePoolCluster = class extends EventEmitter {
25197
+ var PromisePoolCluster = class _PromisePoolCluster extends EventEmitter {
24969
25198
  constructor(poolCluster, thePromise) {
24970
25199
  super();
24971
25200
  this.poolCluster = poolCluster;
@@ -24990,27 +25219,29 @@ var require_promise = __commonJS({
24990
25219
  }
24991
25220
  query(sql, args) {
24992
25221
  const corePoolCluster = this.poolCluster;
24993
- const localErr = new Error();
25222
+ const stackHolder = captureStackHolder(_PromisePoolCluster.prototype.query);
24994
25223
  if (typeof args === "function") {
24995
25224
  throw new Error(
24996
25225
  "Callback function is not available with promise clients."
24997
25226
  );
24998
25227
  }
24999
25228
  return new this.Promise((resolve, reject) => {
25000
- const done = makeDoneCb(resolve, reject, localErr);
25229
+ const done = makeDoneCb(resolve, reject, stackHolder);
25001
25230
  corePoolCluster.query(sql, args, done);
25002
25231
  });
25003
25232
  }
25004
25233
  execute(sql, args) {
25005
25234
  const corePoolCluster = this.poolCluster;
25006
- const localErr = new Error();
25235
+ const stackHolder = captureStackHolder(
25236
+ _PromisePoolCluster.prototype.execute
25237
+ );
25007
25238
  if (typeof args === "function") {
25008
25239
  throw new Error(
25009
25240
  "Callback function is not available with promise clients."
25010
25241
  );
25011
25242
  }
25012
25243
  return new this.Promise((resolve, reject) => {
25013
- const done = makeDoneCb(resolve, reject, localErr);
25244
+ const done = makeDoneCb(resolve, reject, stackHolder);
25014
25245
  corePoolCluster.execute(sql, args, done);
25015
25246
  });
25016
25247
  }
@@ -25022,16 +25253,12 @@ var require_promise = __commonJS({
25022
25253
  }
25023
25254
  end() {
25024
25255
  const corePoolCluster = this.poolCluster;
25025
- const localErr = new Error();
25256
+ const stackHolder = captureStackHolder(_PromisePoolCluster.prototype.end);
25026
25257
  return new this.Promise((resolve, reject) => {
25027
25258
  corePoolCluster.end((err) => {
25028
25259
  if (err) {
25029
- localErr.message = err.message;
25030
- localErr.code = err.code;
25031
- localErr.errno = err.errno;
25032
- localErr.sqlState = err.sqlState;
25033
- localErr.sqlMessage = err.sqlMessage;
25034
- reject(localErr);
25260
+ applyCapturedStack(err, stackHolder);
25261
+ reject(err);
25035
25262
  } else {
25036
25263
  resolve();
25037
25264
  }