cdk-rds-sql 6.1.2 → 6.1.4

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.
@@ -5,9 +5,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __esm = (fn, res) => function __init() {
9
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
10
- };
11
8
  var __commonJS = (cb, mod) => function __require() {
12
9
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
13
10
  };
@@ -12226,28 +12223,28 @@ var require_execute = __commonJS({
12226
12223
  }
12227
12224
  i++;
12228
12225
  }
12229
- const types = [];
12226
+ const types2 = [];
12230
12227
  for (let i2 = packet.offset + 1; i2 < packet.end - 1; i2++) {
12231
12228
  if ((packet.buffer[i2] === Types.VAR_STRING || packet.buffer[i2] === Types.NULL || packet.buffer[i2] === Types.DOUBLE || packet.buffer[i2] === Types.TINY || packet.buffer[i2] === Types.DATETIME || packet.buffer[i2] === Types.JSON) && packet.buffer[i2 + 1] === 0) {
12232
- types.push(packet.buffer[i2]);
12229
+ types2.push(packet.buffer[i2]);
12233
12230
  packet.skip(2);
12234
12231
  }
12235
12232
  }
12236
12233
  packet.skip(1);
12237
12234
  const values = [];
12238
- for (let i2 = 0; i2 < types.length; i2++) {
12239
- if (types[i2] === Types.VAR_STRING) {
12235
+ for (let i2 = 0; i2 < types2.length; i2++) {
12236
+ if (types2[i2] === Types.VAR_STRING) {
12240
12237
  values.push(packet.readLengthCodedString(encoding));
12241
- } else if (types[i2] === Types.DOUBLE) {
12238
+ } else if (types2[i2] === Types.DOUBLE) {
12242
12239
  values.push(packet.readDouble());
12243
- } else if (types[i2] === Types.TINY) {
12240
+ } else if (types2[i2] === Types.TINY) {
12244
12241
  values.push(packet.readInt8());
12245
- } else if (types[i2] === Types.DATETIME) {
12242
+ } else if (types2[i2] === Types.DATETIME) {
12246
12243
  values.push(packet.readDateTime());
12247
- } else if (types[i2] === Types.JSON) {
12244
+ } else if (types2[i2] === Types.JSON) {
12248
12245
  values.push(JSON.parse(packet.readLengthCodedString(encoding)));
12249
12246
  }
12250
- if (types[i2] === Types.NULL) {
12247
+ if (types2[i2] === Types.NULL) {
12251
12248
  values.push(null);
12252
12249
  }
12253
12250
  }
@@ -12607,7 +12604,7 @@ var require_query = __commonJS({
12607
12604
  var CommandCode = require_commands();
12608
12605
  var StringParser = require_string();
12609
12606
  var CharsetToEncoding = require_charset_encodings();
12610
- var Query = class {
12607
+ var Query2 = class {
12611
12608
  constructor(sql, charsetNumber) {
12612
12609
  this.query = sql;
12613
12610
  this.charsetNumber = charsetNumber;
@@ -12624,7 +12621,7 @@ var require_query = __commonJS({
12624
12621
  return packet;
12625
12622
  }
12626
12623
  };
12627
- module2.exports = Query;
12624
+ module2.exports = Query2;
12628
12625
  }
12629
12626
  });
12630
12627
 
@@ -12735,7 +12732,8 @@ var require_encoding_charset = __commonJS({
12735
12732
  geostd8: 92,
12736
12733
  cp932: 95,
12737
12734
  eucjpms: 97,
12738
- gb18030: 248
12735
+ gb18030: 248,
12736
+ utf8mb3: 192
12739
12737
  };
12740
12738
  }
12741
12739
  });
@@ -12814,7 +12812,9 @@ var require_resultset_header = __commonJS({
12814
12812
  stateChanges.systemVariables[key] = val;
12815
12813
  if (key === "character_set_client") {
12816
12814
  const charsetNumber = EncodingToCharset[val];
12817
- connection.config.charsetNumber = charsetNumber;
12815
+ if (typeof charsetNumber !== "undefined") {
12816
+ connection.config.charsetNumber = charsetNumber;
12817
+ }
12818
12818
  }
12819
12819
  } else if (type === sessionInfoTypes.SCHEMA) {
12820
12820
  key = packet.readLengthCodedString(encoding);
@@ -12956,7 +12956,7 @@ var require_packets = __commonJS({
12956
12956
  var HandshakeResponse = require_handshake_response();
12957
12957
  var PrepareStatement = require_prepare_statement();
12958
12958
  var PreparedStatementHeader = require_prepared_statement_header();
12959
- var Query = require_query();
12959
+ var Query2 = require_query();
12960
12960
  var RegisterSlave = require_register_slave();
12961
12961
  var ResultSetHeader = require_resultset_header();
12962
12962
  var SSLRequest = require_ssl_request();
@@ -12976,7 +12976,7 @@ var require_packets = __commonJS({
12976
12976
  HandshakeResponse,
12977
12977
  PrepareStatement,
12978
12978
  PreparedStatementHeader,
12979
- Query,
12979
+ Query: Query2,
12980
12980
  RegisterSlave,
12981
12981
  ResultSetHeader,
12982
12982
  SSLRequest,
@@ -14847,7 +14847,7 @@ var require_query2 = __commonJS({
14847
14847
  var staticParser = require_static_text_parser();
14848
14848
  var ServerStatus = require_server_status();
14849
14849
  var EmptyPacket = new Packets.Packet(0, Buffer.allocUnsafe(4), 0, 4);
14850
- var Query = class _Query extends Command {
14850
+ var Query2 = class _Query extends Command {
14851
14851
  constructor(options, callback) {
14852
14852
  super();
14853
14853
  this.sql = options.sql;
@@ -15126,8 +15126,8 @@ var require_query2 = __commonJS({
15126
15126
  }
15127
15127
  }
15128
15128
  };
15129
- Query.prototype.catch = Query.prototype.then;
15130
- module2.exports = Query;
15129
+ Query2.prototype.catch = Query2.prototype.then;
15130
+ module2.exports = Query2;
15131
15131
  }
15132
15132
  });
15133
15133
 
@@ -15515,7 +15515,7 @@ var require_execute2 = __commonJS({
15515
15515
  "node_modules/mysql2/lib/commands/execute.js"(exports2, module2) {
15516
15516
  "use strict";
15517
15517
  var Command = require_command();
15518
- var Query = require_query2();
15518
+ var Query2 = require_query2();
15519
15519
  var Packets = require_packets();
15520
15520
  var getBinaryParser = require_binary_parser();
15521
15521
  var getStaticBinaryParser = require_static_binary_parser();
@@ -15592,15 +15592,15 @@ var require_execute2 = __commonJS({
15592
15592
  return _Execute.prototype.row;
15593
15593
  }
15594
15594
  };
15595
- Execute.prototype.done = Query.prototype.done;
15596
- Execute.prototype.doneInsert = Query.prototype.doneInsert;
15597
- Execute.prototype.resultsetHeader = Query.prototype.resultsetHeader;
15598
- Execute.prototype._findOrCreateReadStream = Query.prototype._findOrCreateReadStream;
15599
- Execute.prototype._streamLocalInfile = Query.prototype._streamLocalInfile;
15600
- Execute.prototype._setTimeout = Query.prototype._setTimeout;
15601
- Execute.prototype._handleTimeoutError = Query.prototype._handleTimeoutError;
15602
- Execute.prototype.row = Query.prototype.row;
15603
- Execute.prototype.stream = Query.prototype.stream;
15595
+ Execute.prototype.done = Query2.prototype.done;
15596
+ Execute.prototype.doneInsert = Query2.prototype.doneInsert;
15597
+ Execute.prototype.resultsetHeader = Query2.prototype.resultsetHeader;
15598
+ Execute.prototype._findOrCreateReadStream = Query2.prototype._findOrCreateReadStream;
15599
+ Execute.prototype._streamLocalInfile = Query2.prototype._streamLocalInfile;
15600
+ Execute.prototype._setTimeout = Query2.prototype._setTimeout;
15601
+ Execute.prototype._handleTimeoutError = Query2.prototype._handleTimeoutError;
15602
+ Execute.prototype.row = Query2.prototype.row;
15603
+ Execute.prototype.stream = Query2.prototype.stream;
15604
15604
  module2.exports = Execute;
15605
15605
  }
15606
15606
  });
@@ -15648,8 +15648,8 @@ var require_prepare = __commonJS({
15648
15648
  this.options = options;
15649
15649
  }
15650
15650
  start(packet, connection) {
15651
- const Connection = connection.constructor;
15652
- this.key = Connection.statementKey(this.options);
15651
+ const Connection2 = connection.constructor;
15652
+ this.key = Connection2.statementKey(this.options);
15653
15653
  const statement = connection._statements.get(this.key);
15654
15654
  if (statement) {
15655
15655
  if (this.onResult) {
@@ -16099,7 +16099,7 @@ var require_commands2 = __commonJS({
16099
16099
  "use strict";
16100
16100
  var ClientHandshake = require_client_handshake();
16101
16101
  var ServerHandshake = require_server_handshake();
16102
- var Query = require_query2();
16102
+ var Query2 = require_query2();
16103
16103
  var Prepare = require_prepare();
16104
16104
  var CloseStatement = require_close_statement2();
16105
16105
  var Execute = require_execute2();
@@ -16111,7 +16111,7 @@ var require_commands2 = __commonJS({
16111
16111
  module2.exports = {
16112
16112
  ClientHandshake,
16113
16113
  ServerHandshake,
16114
- Query,
16114
+ Query: Query2,
16115
16115
  Prepare,
16116
16116
  CloseStatement,
16117
16117
  Execute,
@@ -16129,7 +16129,7 @@ var require_package = __commonJS({
16129
16129
  "node_modules/mysql2/package.json"(exports2, module2) {
16130
16130
  module2.exports = {
16131
16131
  name: "mysql2",
16132
- version: "3.14.0",
16132
+ version: "3.14.1",
16133
16133
  description: "fast mysql driver. Implements core protocol, prepared statements, ssl and compression in native JS",
16134
16134
  main: "index.js",
16135
16135
  typings: "typings/mysql/index",
@@ -19271,13 +19271,13 @@ var require_pool3 = __commonJS({
19271
19271
  "node_modules/mysql2/lib/pool.js"(exports2, module2) {
19272
19272
  "use strict";
19273
19273
  var BasePool = require_pool();
19274
- var Pool = class extends BasePool {
19274
+ var Pool2 = class extends BasePool {
19275
19275
  promise(promiseImpl) {
19276
19276
  const PromisePool = require_pool2();
19277
19277
  return new PromisePool(this, promiseImpl);
19278
19278
  }
19279
19279
  };
19280
- module2.exports = Pool;
19280
+ module2.exports = Pool2;
19281
19281
  }
19282
19282
  });
19283
19283
 
@@ -19308,13 +19308,13 @@ var require_connection3 = __commonJS({
19308
19308
  "node_modules/mysql2/lib/connection.js"(exports2, module2) {
19309
19309
  "use strict";
19310
19310
  var BaseConnection = require_connection();
19311
- var Connection = class extends BaseConnection {
19311
+ var Connection2 = class extends BaseConnection {
19312
19312
  promise(promiseImpl) {
19313
19313
  const PromiseConnection = require_connection2();
19314
19314
  return new PromiseConnection(this, promiseImpl);
19315
19315
  }
19316
19316
  };
19317
- module2.exports = Connection;
19317
+ module2.exports = Connection2;
19318
19318
  }
19319
19319
  });
19320
19320
 
@@ -19323,9 +19323,9 @@ var require_pool_cluster = __commonJS({
19323
19323
  "node_modules/mysql2/lib/pool_cluster.js"(exports2, module2) {
19324
19324
  "use strict";
19325
19325
  var process2 = require("process");
19326
- var Pool = require_pool3();
19326
+ var Pool2 = require_pool3();
19327
19327
  var PoolConfig = require_pool_config();
19328
- var Connection = require_connection3();
19328
+ var Connection2 = require_connection3();
19329
19329
  var EventEmitter = require("events").EventEmitter;
19330
19330
  var makeSelector = {
19331
19331
  RR() {
@@ -19392,7 +19392,7 @@ var require_pool_cluster = __commonJS({
19392
19392
  * @returns query
19393
19393
  */
19394
19394
  query(sql, values, cb) {
19395
- const query = Connection.createQuery(sql, values, cb, {});
19395
+ const query = Connection2.createQuery(sql, values, cb, {});
19396
19396
  this.getConnection((err, conn) => {
19397
19397
  if (err) {
19398
19398
  if (typeof query.onResult === "function") {
@@ -19484,7 +19484,7 @@ var require_pool_cluster = __commonJS({
19484
19484
  this._nodes[id] = {
19485
19485
  id,
19486
19486
  errorCount: 0,
19487
- pool: new Pool({ config: new PoolConfig(config) }),
19487
+ pool: new Pool2({ config: new PoolConfig(config) }),
19488
19488
  _offlineUntil: 0
19489
19489
  };
19490
19490
  this._serviceableNodeIds.push(id);
@@ -19627,10 +19627,10 @@ var require_pool_cluster = __commonJS({
19627
19627
  var require_create_connection = __commonJS({
19628
19628
  "node_modules/mysql2/lib/create_connection.js"(exports2, module2) {
19629
19629
  "use strict";
19630
- var Connection = require_connection3();
19630
+ var Connection2 = require_connection3();
19631
19631
  var ConnectionConfig = require_connection_config();
19632
19632
  function createConnection(opts) {
19633
- return new Connection({ config: new ConnectionConfig(opts) });
19633
+ return new Connection2({ config: new ConnectionConfig(opts) });
19634
19634
  }
19635
19635
  module2.exports = createConnection;
19636
19636
  }
@@ -19640,10 +19640,10 @@ var require_create_connection = __commonJS({
19640
19640
  var require_create_pool = __commonJS({
19641
19641
  "node_modules/mysql2/lib/create_pool.js"(exports2, module2) {
19642
19642
  "use strict";
19643
- var Pool = require_pool3();
19643
+ var Pool2 = require_pool3();
19644
19644
  var PoolConfig = require_pool_config();
19645
19645
  function createPool(config) {
19646
- return new Pool({ config: new PoolConfig(config) });
19646
+ return new Pool2({ config: new PoolConfig(config) });
19647
19647
  }
19648
19648
  module2.exports = createPool;
19649
19649
  }
@@ -20281,9 +20281,9 @@ var require_lib4 = __commonJS({
20281
20281
  }
20282
20282
  });
20283
20283
 
20284
- // node_modules/pg/node_modules/postgres-array/index.js
20284
+ // node_modules/postgres-array/index.js
20285
20285
  var require_postgres_array = __commonJS({
20286
- "node_modules/pg/node_modules/postgres-array/index.js"(exports2) {
20286
+ "node_modules/postgres-array/index.js"(exports2) {
20287
20287
  "use strict";
20288
20288
  exports2.parse = function(source, transform) {
20289
20289
  return new ArrayParser(source, transform).parse();
@@ -20375,9 +20375,9 @@ var require_postgres_array = __commonJS({
20375
20375
  }
20376
20376
  });
20377
20377
 
20378
- // node_modules/pg/node_modules/pg-types/lib/arrayParser.js
20378
+ // node_modules/pg-types/lib/arrayParser.js
20379
20379
  var require_arrayParser = __commonJS({
20380
- "node_modules/pg/node_modules/pg-types/lib/arrayParser.js"(exports2, module2) {
20380
+ "node_modules/pg-types/lib/arrayParser.js"(exports2, module2) {
20381
20381
  var array = require_postgres_array();
20382
20382
  module2.exports = {
20383
20383
  create: function(source, transform) {
@@ -20391,9 +20391,9 @@ var require_arrayParser = __commonJS({
20391
20391
  }
20392
20392
  });
20393
20393
 
20394
- // node_modules/pg/node_modules/postgres-date/index.js
20394
+ // node_modules/postgres-date/index.js
20395
20395
  var require_postgres_date = __commonJS({
20396
- "node_modules/pg/node_modules/postgres-date/index.js"(exports2, module2) {
20396
+ "node_modules/postgres-date/index.js"(exports2, module2) {
20397
20397
  "use strict";
20398
20398
  var DATE_TIME = /(\d{1,})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})(\.\d{1,})?.*?( BC)?$/;
20399
20399
  var DATE = /^(\d{1,})-(\d{2})-(\d{2})( BC)?$/;
@@ -20497,9 +20497,9 @@ var require_mutable = __commonJS({
20497
20497
  }
20498
20498
  });
20499
20499
 
20500
- // node_modules/pg/node_modules/postgres-interval/index.js
20500
+ // node_modules/postgres-interval/index.js
20501
20501
  var require_postgres_interval = __commonJS({
20502
- "node_modules/pg/node_modules/postgres-interval/index.js"(exports2, module2) {
20502
+ "node_modules/postgres-interval/index.js"(exports2, module2) {
20503
20503
  "use strict";
20504
20504
  var extend = require_mutable();
20505
20505
  module2.exports = PostgresInterval;
@@ -20588,9 +20588,9 @@ var require_postgres_interval = __commonJS({
20588
20588
  }
20589
20589
  });
20590
20590
 
20591
- // node_modules/pg/node_modules/postgres-bytea/index.js
20591
+ // node_modules/postgres-bytea/index.js
20592
20592
  var require_postgres_bytea = __commonJS({
20593
- "node_modules/pg/node_modules/postgres-bytea/index.js"(exports2, module2) {
20593
+ "node_modules/postgres-bytea/index.js"(exports2, module2) {
20594
20594
  "use strict";
20595
20595
  module2.exports = function parseBytea(input) {
20596
20596
  if (/^\\x/.test(input)) {
@@ -20623,9 +20623,9 @@ var require_postgres_bytea = __commonJS({
20623
20623
  }
20624
20624
  });
20625
20625
 
20626
- // node_modules/pg/node_modules/pg-types/lib/textParsers.js
20626
+ // node_modules/pg-types/lib/textParsers.js
20627
20627
  var require_textParsers = __commonJS({
20628
- "node_modules/pg/node_modules/pg-types/lib/textParsers.js"(exports2, module2) {
20628
+ "node_modules/pg-types/lib/textParsers.js"(exports2, module2) {
20629
20629
  var array = require_postgres_array();
20630
20630
  var arrayParser = require_arrayParser();
20631
20631
  var parseDate = require_postgres_date();
@@ -20903,9 +20903,9 @@ var require_pg_int8 = __commonJS({
20903
20903
  }
20904
20904
  });
20905
20905
 
20906
- // node_modules/pg/node_modules/pg-types/lib/binaryParsers.js
20906
+ // node_modules/pg-types/lib/binaryParsers.js
20907
20907
  var require_binaryParsers = __commonJS({
20908
- "node_modules/pg/node_modules/pg-types/lib/binaryParsers.js"(exports2, module2) {
20908
+ "node_modules/pg-types/lib/binaryParsers.js"(exports2, module2) {
20909
20909
  var parseInt64 = require_pg_int8();
20910
20910
  var parseBits = function(data, bits, offset, invert, callback) {
20911
20911
  offset = offset || 0;
@@ -21103,9 +21103,9 @@ var require_binaryParsers = __commonJS({
21103
21103
  }
21104
21104
  });
21105
21105
 
21106
- // node_modules/pg/node_modules/pg-types/lib/builtins.js
21106
+ // node_modules/pg-types/lib/builtins.js
21107
21107
  var require_builtins = __commonJS({
21108
- "node_modules/pg/node_modules/pg-types/lib/builtins.js"(exports2, module2) {
21108
+ "node_modules/pg-types/lib/builtins.js"(exports2, module2) {
21109
21109
  module2.exports = {
21110
21110
  BOOL: 16,
21111
21111
  BYTEA: 17,
@@ -21171,9 +21171,9 @@ var require_builtins = __commonJS({
21171
21171
  }
21172
21172
  });
21173
21173
 
21174
- // node_modules/pg/node_modules/pg-types/index.js
21174
+ // node_modules/pg-types/index.js
21175
21175
  var require_pg_types = __commonJS({
21176
- "node_modules/pg/node_modules/pg-types/index.js"(exports2) {
21176
+ "node_modules/pg-types/index.js"(exports2) {
21177
21177
  var textParsers = require_textParsers();
21178
21178
  var binaryParsers = require_binaryParsers();
21179
21179
  var arrayParser = require_arrayParser();
@@ -21278,14 +21278,16 @@ var require_defaults2 = __commonJS({
21278
21278
  var require_utils = __commonJS({
21279
21279
  "node_modules/pg/lib/utils.js"(exports2, module2) {
21280
21280
  "use strict";
21281
- var defaults = require_defaults2();
21281
+ var defaults2 = require_defaults2();
21282
+ var util = require("util");
21283
+ var { isDate } = util.types || util;
21282
21284
  function escapeElement(elementRepresentation) {
21283
- var escaped = elementRepresentation.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
21285
+ const escaped = elementRepresentation.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
21284
21286
  return '"' + escaped + '"';
21285
21287
  }
21286
21288
  function arrayString(val) {
21287
- var result = "{";
21288
- for (var i = 0; i < val.length; i++) {
21289
+ let result = "{";
21290
+ for (let i = 0; i < val.length; i++) {
21289
21291
  if (i > 0) {
21290
21292
  result = result + ",";
21291
21293
  }
@@ -21294,9 +21296,9 @@ var require_utils = __commonJS({
21294
21296
  } else if (Array.isArray(val[i])) {
21295
21297
  result = result + arrayString(val[i]);
21296
21298
  } else if (ArrayBuffer.isView(val[i])) {
21297
- var item = val[i];
21299
+ let item = val[i];
21298
21300
  if (!(item instanceof Buffer)) {
21299
- var buf = Buffer.from(item.buffer, item.byteOffset, item.byteLength);
21301
+ const buf = Buffer.from(item.buffer, item.byteOffset, item.byteLength);
21300
21302
  if (buf.length === item.byteLength) {
21301
21303
  item = buf;
21302
21304
  } else {
@@ -21320,14 +21322,14 @@ var require_utils = __commonJS({
21320
21322
  return val;
21321
21323
  }
21322
21324
  if (ArrayBuffer.isView(val)) {
21323
- var buf = Buffer.from(val.buffer, val.byteOffset, val.byteLength);
21325
+ const buf = Buffer.from(val.buffer, val.byteOffset, val.byteLength);
21324
21326
  if (buf.length === val.byteLength) {
21325
21327
  return buf;
21326
21328
  }
21327
21329
  return buf.slice(val.byteOffset, val.byteOffset + val.byteLength);
21328
21330
  }
21329
- if (val instanceof Date) {
21330
- if (defaults.parseInputDatesAsUTC) {
21331
+ if (isDate(val)) {
21332
+ if (defaults2.parseInputDatesAsUTC) {
21331
21333
  return dateToStringUTC(val);
21332
21334
  } else {
21333
21335
  return dateToString(val);
@@ -21352,11 +21354,11 @@ var require_utils = __commonJS({
21352
21354
  return JSON.stringify(val);
21353
21355
  }
21354
21356
  function dateToString(date) {
21355
- var offset = -date.getTimezoneOffset();
21356
- var year = date.getFullYear();
21357
- var isBCYear = year < 1;
21357
+ let offset = -date.getTimezoneOffset();
21358
+ let year = date.getFullYear();
21359
+ const isBCYear = year < 1;
21358
21360
  if (isBCYear) year = Math.abs(year) + 1;
21359
- var ret = String(year).padStart(4, "0") + "-" + String(date.getMonth() + 1).padStart(2, "0") + "-" + String(date.getDate()).padStart(2, "0") + "T" + String(date.getHours()).padStart(2, "0") + ":" + String(date.getMinutes()).padStart(2, "0") + ":" + String(date.getSeconds()).padStart(2, "0") + "." + String(date.getMilliseconds()).padStart(3, "0");
21361
+ let ret = String(year).padStart(4, "0") + "-" + String(date.getMonth() + 1).padStart(2, "0") + "-" + String(date.getDate()).padStart(2, "0") + "T" + String(date.getHours()).padStart(2, "0") + ":" + String(date.getMinutes()).padStart(2, "0") + ":" + String(date.getSeconds()).padStart(2, "0") + "." + String(date.getMilliseconds()).padStart(3, "0");
21360
21362
  if (offset < 0) {
21361
21363
  ret += "-";
21362
21364
  offset *= -1;
@@ -21368,10 +21370,10 @@ var require_utils = __commonJS({
21368
21370
  return ret;
21369
21371
  }
21370
21372
  function dateToStringUTC(date) {
21371
- var year = date.getUTCFullYear();
21372
- var isBCYear = year < 1;
21373
+ let year = date.getUTCFullYear();
21374
+ const isBCYear = year < 1;
21373
21375
  if (isBCYear) year = Math.abs(year) + 1;
21374
- var ret = String(year).padStart(4, "0") + "-" + String(date.getUTCMonth() + 1).padStart(2, "0") + "-" + String(date.getUTCDate()).padStart(2, "0") + "T" + String(date.getUTCHours()).padStart(2, "0") + ":" + String(date.getUTCMinutes()).padStart(2, "0") + ":" + String(date.getUTCSeconds()).padStart(2, "0") + "." + String(date.getUTCMilliseconds()).padStart(3, "0");
21376
+ let ret = String(year).padStart(4, "0") + "-" + String(date.getUTCMonth() + 1).padStart(2, "0") + "-" + String(date.getUTCDate()).padStart(2, "0") + "T" + String(date.getUTCHours()).padStart(2, "0") + ":" + String(date.getUTCMinutes()).padStart(2, "0") + ":" + String(date.getUTCSeconds()).padStart(2, "0") + "." + String(date.getUTCMilliseconds()).padStart(3, "0");
21375
21377
  ret += "+00:00";
21376
21378
  if (isBCYear) ret += " BC";
21377
21379
  return ret;
@@ -21390,14 +21392,20 @@ var require_utils = __commonJS({
21390
21392
  }
21391
21393
  return config;
21392
21394
  }
21393
- var escapeIdentifier = function(str) {
21395
+ var escapeIdentifier2 = function(str) {
21394
21396
  return '"' + str.replace(/"/g, '""') + '"';
21395
21397
  };
21396
- var escapeLiteral = function(str) {
21397
- var hasBackslash = false;
21398
- var escaped = "'";
21399
- for (var i = 0; i < str.length; i++) {
21400
- var c = str[i];
21398
+ var escapeLiteral2 = function(str) {
21399
+ let hasBackslash = false;
21400
+ let escaped = "'";
21401
+ if (str == null) {
21402
+ return "''";
21403
+ }
21404
+ if (typeof str !== "string") {
21405
+ return "''";
21406
+ }
21407
+ for (let i = 0; i < str.length; i++) {
21408
+ const c = str[i];
21401
21409
  if (c === "'") {
21402
21410
  escaped += c + c;
21403
21411
  } else if (c === "\\") {
@@ -21418,8 +21426,8 @@ var require_utils = __commonJS({
21418
21426
  return prepareValue(value);
21419
21427
  },
21420
21428
  normalizeQueryConfig,
21421
- escapeIdentifier,
21422
- escapeLiteral
21429
+ escapeIdentifier: escapeIdentifier2,
21430
+ escapeLiteral: escapeLiteral2
21423
21431
  };
21424
21432
  }
21425
21433
  });
@@ -21433,8 +21441,8 @@ var require_utils_legacy = __commonJS({
21433
21441
  return nodeCrypto.createHash("md5").update(string, "utf-8").digest("hex");
21434
21442
  }
21435
21443
  function postgresMd5PasswordHash(user, password, salt) {
21436
- var inner = md5(password + user);
21437
- var outer = md5(Buffer.concat([Buffer.from(inner), salt]));
21444
+ const inner = md5(password + user);
21445
+ const outer = md5(Buffer.concat([Buffer.from(inner), salt]));
21438
21446
  return "md5" + outer;
21439
21447
  }
21440
21448
  function sha256(text) {
@@ -21491,8 +21499,8 @@ var require_utils_webcrypto = __commonJS({
21491
21499
  }
21492
21500
  }
21493
21501
  async function postgresMd5PasswordHash(user, password, salt) {
21494
- var inner = await md5(password + user);
21495
- var outer = await md5(Buffer.concat([Buffer.from(inner), salt]));
21502
+ const inner = await md5(password + user);
21503
+ const outer = await md5(Buffer.concat([Buffer.from(inner), salt]));
21496
21504
  return "md5" + outer;
21497
21505
  }
21498
21506
  async function sha256(text) {
@@ -21530,13 +21538,13 @@ var require_utils2 = __commonJS({
21530
21538
  var require_cert_signatures = __commonJS({
21531
21539
  "node_modules/pg/lib/crypto/cert-signatures.js"(exports2, module2) {
21532
21540
  function x509Error(msg, cert) {
21533
- throw new Error("SASL channel binding: " + msg + " when parsing public certificate " + cert.toString("base64"));
21541
+ return new Error("SASL channel binding: " + msg + " when parsing public certificate " + cert.toString("base64"));
21534
21542
  }
21535
21543
  function readASN1Length(data, index) {
21536
21544
  let length = data[index++];
21537
21545
  if (length < 128) return { length, index };
21538
21546
  const lengthBytes = length & 127;
21539
- if (lengthBytes > 4) x509Error("bad length", data);
21547
+ if (lengthBytes > 4) throw x509Error("bad length", data);
21540
21548
  length = 0;
21541
21549
  for (let i = 0; i < lengthBytes; i++) {
21542
21550
  length = length << 8 | data[index++];
@@ -21544,10 +21552,10 @@ var require_cert_signatures = __commonJS({
21544
21552
  return { length, index };
21545
21553
  }
21546
21554
  function readASN1OID(data, index) {
21547
- if (data[index++] !== 6) x509Error("non-OID data", data);
21555
+ if (data[index++] !== 6) throw x509Error("non-OID data", data);
21548
21556
  const { length: OIDLength, index: indexAfterOIDLength } = readASN1Length(data, index);
21549
21557
  index = indexAfterOIDLength;
21550
- lastIndex = index + OIDLength;
21558
+ const lastIndex = index + OIDLength;
21551
21559
  const byte1 = data[index++];
21552
21560
  let oid = (byte1 / 40 >> 0) + "." + byte1 % 40;
21553
21561
  while (index < lastIndex) {
@@ -21562,7 +21570,7 @@ var require_cert_signatures = __commonJS({
21562
21570
  return { oid, index };
21563
21571
  }
21564
21572
  function expectASN1Seq(data, index) {
21565
- if (data[index++] !== 48) x509Error("non-sequence data", data);
21573
+ if (data[index++] !== 48) throw x509Error("non-sequence data", data);
21566
21574
  return readASN1Length(data, index);
21567
21575
  }
21568
21576
  function signatureAlgorithmHashFromCertificate(data, index) {
@@ -21602,10 +21610,10 @@ var require_cert_signatures = __commonJS({
21602
21610
  case "1.2.840.10045.4.3.4":
21603
21611
  return "SHA-512";
21604
21612
  // RSASSA-PSS: hash is indicated separately
21605
- case "1.2.840.113549.1.1.10":
21613
+ case "1.2.840.113549.1.1.10": {
21606
21614
  index = indexAfterOID;
21607
21615
  index = expectASN1Seq(data, index).index;
21608
- if (data[index++] !== 160) x509Error("non-tag data", data);
21616
+ if (data[index++] !== 160) throw x509Error("non-tag data", data);
21609
21617
  index = readASN1Length(data, index).index;
21610
21618
  index = expectASN1Seq(data, index).index;
21611
21619
  const { oid: hashOID } = readASN1OID(data, index);
@@ -21622,7 +21630,8 @@ var require_cert_signatures = __commonJS({
21622
21630
  case "2.16.840.1.101.3.4.2.3":
21623
21631
  return "SHA-512";
21624
21632
  }
21625
- x509Error("unknown hash OID " + hashOID, data);
21633
+ throw x509Error("unknown hash OID " + hashOID, data);
21634
+ }
21626
21635
  // Ed25519 -- see https: return//github.com/openssl/openssl/issues/15477
21627
21636
  case "1.3.101.110":
21628
21637
  case "1.3.101.112":
@@ -21630,9 +21639,9 @@ var require_cert_signatures = __commonJS({
21630
21639
  // Ed448 -- still not in pg 17.2 (if supported, digest would be SHAKE256 x 64 bytes)
21631
21640
  case "1.3.101.111":
21632
21641
  case "1.3.101.113":
21633
- x509Error("Ed448 certificate channel binding is not currently supported by Postgres");
21642
+ throw x509Error("Ed448 certificate channel binding is not currently supported by Postgres");
21634
21643
  }
21635
- x509Error("unknown OID " + oid, data);
21644
+ throw x509Error("unknown OID " + oid, data);
21636
21645
  }
21637
21646
  module2.exports = { signatureAlgorithmHashFromCertificate };
21638
21647
  }
@@ -21682,8 +21691,8 @@ var require_sasl = __commonJS({
21682
21691
  } else if (sv.nonce.length === session.clientNonce.length) {
21683
21692
  throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce is too short");
21684
21693
  }
21685
- var clientFirstMessageBare = "n=*,r=" + session.clientNonce;
21686
- var serverFirstMessage = "r=" + sv.nonce + ",s=" + sv.salt + ",i=" + sv.iteration;
21694
+ const clientFirstMessageBare = "n=*,r=" + session.clientNonce;
21695
+ const serverFirstMessage = "r=" + sv.nonce + ",s=" + sv.salt + ",i=" + sv.iteration;
21687
21696
  let channelBinding = stream ? "eSws" : "biws";
21688
21697
  if (session.mechanism === "SCRAM-SHA-256-PLUS") {
21689
21698
  const peerCert = stream.getPeerCertificate().raw;
@@ -21693,16 +21702,16 @@ var require_sasl = __commonJS({
21693
21702
  const bindingData = Buffer.concat([Buffer.from("p=tls-server-end-point,,"), Buffer.from(certHash)]);
21694
21703
  channelBinding = bindingData.toString("base64");
21695
21704
  }
21696
- var clientFinalMessageWithoutProof = "c=" + channelBinding + ",r=" + sv.nonce;
21697
- var authMessage = clientFirstMessageBare + "," + serverFirstMessage + "," + clientFinalMessageWithoutProof;
21698
- var saltBytes = Buffer.from(sv.salt, "base64");
21699
- var saltedPassword = await crypto.deriveKey(password, saltBytes, sv.iteration);
21700
- var clientKey = await crypto.hmacSha256(saltedPassword, "Client Key");
21701
- var storedKey = await crypto.sha256(clientKey);
21702
- var clientSignature = await crypto.hmacSha256(storedKey, authMessage);
21703
- var clientProof = xorBuffers(Buffer.from(clientKey), Buffer.from(clientSignature)).toString("base64");
21704
- var serverKey = await crypto.hmacSha256(saltedPassword, "Server Key");
21705
- var serverSignatureBytes = await crypto.hmacSha256(serverKey, authMessage);
21705
+ const clientFinalMessageWithoutProof = "c=" + channelBinding + ",r=" + sv.nonce;
21706
+ const authMessage = clientFirstMessageBare + "," + serverFirstMessage + "," + clientFinalMessageWithoutProof;
21707
+ const saltBytes = Buffer.from(sv.salt, "base64");
21708
+ const saltedPassword = await crypto.deriveKey(password, saltBytes, sv.iteration);
21709
+ const clientKey = await crypto.hmacSha256(saltedPassword, "Client Key");
21710
+ const storedKey = await crypto.sha256(clientKey);
21711
+ const clientSignature = await crypto.hmacSha256(storedKey, authMessage);
21712
+ const clientProof = xorBuffers(Buffer.from(clientKey), Buffer.from(clientSignature)).toString("base64");
21713
+ const serverKey = await crypto.hmacSha256(saltedPassword, "Server Key");
21714
+ const serverSignatureBytes = await crypto.hmacSha256(serverKey, authMessage);
21706
21715
  session.message = "SASLResponse";
21707
21716
  session.serverSignature = Buffer.from(serverSignatureBytes).toString("base64");
21708
21717
  session.response = clientFinalMessageWithoutProof + ",p=" + clientProof;
@@ -21809,13 +21818,13 @@ var require_sasl = __commonJS({
21809
21818
  var require_type_overrides = __commonJS({
21810
21819
  "node_modules/pg/lib/type-overrides.js"(exports2, module2) {
21811
21820
  "use strict";
21812
- var types = require_pg_types();
21813
- function TypeOverrides(userTypes) {
21814
- this._types = userTypes || types;
21821
+ var types2 = require_pg_types();
21822
+ function TypeOverrides2(userTypes) {
21823
+ this._types = userTypes || types2;
21815
21824
  this.text = {};
21816
21825
  this.binary = {};
21817
21826
  }
21818
- TypeOverrides.prototype.getOverrides = function(format) {
21827
+ TypeOverrides2.prototype.getOverrides = function(format) {
21819
21828
  switch (format) {
21820
21829
  case "text":
21821
21830
  return this.text;
@@ -21825,18 +21834,18 @@ var require_type_overrides = __commonJS({
21825
21834
  return {};
21826
21835
  }
21827
21836
  };
21828
- TypeOverrides.prototype.setTypeParser = function(oid, format, parseFn) {
21837
+ TypeOverrides2.prototype.setTypeParser = function(oid, format, parseFn) {
21829
21838
  if (typeof format === "function") {
21830
21839
  parseFn = format;
21831
21840
  format = "text";
21832
21841
  }
21833
21842
  this.getOverrides(format)[oid] = parseFn;
21834
21843
  };
21835
- TypeOverrides.prototype.getTypeParser = function(oid, format) {
21844
+ TypeOverrides2.prototype.getTypeParser = function(oid, format) {
21836
21845
  format = format || "text";
21837
21846
  return this.getOverrides(format)[oid] || this._types.getTypeParser(oid, format);
21838
21847
  };
21839
- module2.exports = TypeOverrides;
21848
+ module2.exports = TypeOverrides2;
21840
21849
  }
21841
21850
  });
21842
21851
 
@@ -21844,7 +21853,7 @@ var require_type_overrides = __commonJS({
21844
21853
  var require_pg_connection_string = __commonJS({
21845
21854
  "node_modules/pg-connection-string/index.js"(exports2, module2) {
21846
21855
  "use strict";
21847
- function parse(str) {
21856
+ function parse(str, options = {}) {
21848
21857
  if (str.charAt(0) === "/") {
21849
21858
  const config2 = str.split(" ");
21850
21859
  return { host: config2[0], database: config2[1] };
@@ -21853,13 +21862,17 @@ var require_pg_connection_string = __commonJS({
21853
21862
  let result;
21854
21863
  let dummyHost = false;
21855
21864
  if (/ |%[^a-f0-9]|%[a-f0-9][^a-f0-9]/i.test(str)) {
21856
- str = encodeURI(str).replace(/\%25(\d\d)/g, "%$1");
21865
+ str = encodeURI(str).replace(/%25(\d\d)/g, "%$1");
21857
21866
  }
21858
21867
  try {
21859
- result = new URL(str, "postgres://base");
21860
- } catch (e) {
21861
- result = new URL(str.replace("@/", "@___DUMMY___/"), "postgres://base");
21862
- dummyHost = true;
21868
+ try {
21869
+ result = new URL(str, "postgres://base");
21870
+ } catch (e) {
21871
+ result = new URL(str.replace("@/", "@___DUMMY___/"), "postgres://base");
21872
+ dummyHost = true;
21873
+ }
21874
+ } catch (err) {
21875
+ err.input && (err.input = "*****REDACTED*****");
21863
21876
  }
21864
21877
  for (const entry of result.searchParams.entries()) {
21865
21878
  config[entry[0]] = entry[1];
@@ -21902,26 +21915,105 @@ var require_pg_connection_string = __commonJS({
21902
21915
  if (config.sslrootcert) {
21903
21916
  config.ssl.ca = fs3.readFileSync(config.sslrootcert).toString();
21904
21917
  }
21905
- switch (config.sslmode) {
21906
- case "disable": {
21907
- config.ssl = false;
21908
- break;
21909
- }
21910
- case "prefer":
21911
- case "require":
21912
- case "verify-ca":
21913
- case "verify-full": {
21914
- break;
21918
+ if (options.useLibpqCompat && config.uselibpqcompat) {
21919
+ throw new Error("Both useLibpqCompat and uselibpqcompat are set. Please use only one of them.");
21920
+ }
21921
+ if (config.uselibpqcompat === "true" || options.useLibpqCompat) {
21922
+ switch (config.sslmode) {
21923
+ case "disable": {
21924
+ config.ssl = false;
21925
+ break;
21926
+ }
21927
+ case "prefer": {
21928
+ config.ssl.rejectUnauthorized = false;
21929
+ break;
21930
+ }
21931
+ case "require": {
21932
+ if (config.sslrootcert) {
21933
+ config.ssl.checkServerIdentity = function() {
21934
+ };
21935
+ } else {
21936
+ config.ssl.rejectUnauthorized = false;
21937
+ }
21938
+ break;
21939
+ }
21940
+ case "verify-ca": {
21941
+ if (!config.ssl.ca) {
21942
+ throw new Error(
21943
+ "SECURITY WARNING: Using sslmode=verify-ca requires specifying a CA with sslrootcert. If a public CA is used, verify-ca allows connections to a server that somebody else may have registered with the CA, making you vulnerable to Man-in-the-Middle attacks. Either specify a custom CA certificate with sslrootcert parameter or use sslmode=verify-full for proper security."
21944
+ );
21945
+ }
21946
+ config.ssl.checkServerIdentity = function() {
21947
+ };
21948
+ break;
21949
+ }
21950
+ case "verify-full": {
21951
+ break;
21952
+ }
21915
21953
  }
21916
- case "no-verify": {
21917
- config.ssl.rejectUnauthorized = false;
21918
- break;
21954
+ } else {
21955
+ switch (config.sslmode) {
21956
+ case "disable": {
21957
+ config.ssl = false;
21958
+ break;
21959
+ }
21960
+ case "prefer":
21961
+ case "require":
21962
+ case "verify-ca":
21963
+ case "verify-full": {
21964
+ break;
21965
+ }
21966
+ case "no-verify": {
21967
+ config.ssl.rejectUnauthorized = false;
21968
+ break;
21969
+ }
21919
21970
  }
21920
21971
  }
21921
21972
  return config;
21922
21973
  }
21974
+ function toConnectionOptions(sslConfig) {
21975
+ const connectionOptions = Object.entries(sslConfig).reduce((c, [key, value]) => {
21976
+ if (value !== void 0 && value !== null) {
21977
+ c[key] = value;
21978
+ }
21979
+ return c;
21980
+ }, {});
21981
+ return connectionOptions;
21982
+ }
21983
+ function toClientConfig(config) {
21984
+ const poolConfig = Object.entries(config).reduce((c, [key, value]) => {
21985
+ if (key === "ssl") {
21986
+ const sslConfig = value;
21987
+ if (typeof sslConfig === "boolean") {
21988
+ c[key] = sslConfig;
21989
+ }
21990
+ if (typeof sslConfig === "object") {
21991
+ c[key] = toConnectionOptions(sslConfig);
21992
+ }
21993
+ } else if (value !== void 0 && value !== null) {
21994
+ if (key === "port") {
21995
+ if (value !== "") {
21996
+ const v = parseInt(value, 10);
21997
+ if (isNaN(v)) {
21998
+ throw new Error(`Invalid ${key}: ${value}`);
21999
+ }
22000
+ c[key] = v;
22001
+ }
22002
+ } else {
22003
+ c[key] = value;
22004
+ }
22005
+ }
22006
+ return c;
22007
+ }, {});
22008
+ return poolConfig;
22009
+ }
22010
+ function parseIntoClientConfig(str) {
22011
+ return toClientConfig(parse(str));
22012
+ }
21923
22013
  module2.exports = parse;
21924
22014
  parse.parse = parse;
22015
+ parse.toClientConfig = toClientConfig;
22016
+ parse.parseIntoClientConfig = parseIntoClientConfig;
21925
22017
  }
21926
22018
  });
21927
22019
 
@@ -21930,7 +22022,7 @@ var require_connection_parameters = __commonJS({
21930
22022
  "node_modules/pg/lib/connection-parameters.js"(exports2, module2) {
21931
22023
  "use strict";
21932
22024
  var dns = require("dns");
21933
- var defaults = require_defaults2();
22025
+ var defaults2 = require_defaults2();
21934
22026
  var parse = require_pg_connection_string().parse;
21935
22027
  var val = function(key, config, envVar) {
21936
22028
  if (envVar === void 0) {
@@ -21939,7 +22031,7 @@ var require_connection_parameters = __commonJS({
21939
22031
  } else {
21940
22032
  envVar = process.env[envVar];
21941
22033
  }
21942
- return config[key] || envVar || defaults[key];
22034
+ return config[key] || envVar || defaults2[key];
21943
22035
  };
21944
22036
  var readSSLConfigFromEnvironment = function() {
21945
22037
  switch (process.env.PGSSLMODE) {
@@ -21953,13 +22045,13 @@ var require_connection_parameters = __commonJS({
21953
22045
  case "no-verify":
21954
22046
  return { rejectUnauthorized: false };
21955
22047
  }
21956
- return defaults.ssl;
22048
+ return defaults2.ssl;
21957
22049
  };
21958
22050
  var quoteParamValue = function(value) {
21959
22051
  return "'" + ("" + value).replace(/\\/g, "\\\\").replace(/'/g, "\\'") + "'";
21960
22052
  };
21961
22053
  var add = function(params, config, paramName) {
21962
- var value = config[paramName];
22054
+ const value = config[paramName];
21963
22055
  if (value !== void 0 && value !== null) {
21964
22056
  params.push(paramName + "=" + quoteParamValue(value));
21965
22057
  }
@@ -22023,7 +22115,7 @@ var require_connection_parameters = __commonJS({
22023
22115
  }
22024
22116
  }
22025
22117
  getLibpqConnectionString(cb) {
22026
- var params = [];
22118
+ const params = [];
22027
22119
  add(params, this, "user");
22028
22120
  add(params, this, "password");
22029
22121
  add(params, this, "port");
@@ -22031,7 +22123,7 @@ var require_connection_parameters = __commonJS({
22031
22123
  add(params, this, "fallback_application_name");
22032
22124
  add(params, this, "connect_timeout");
22033
22125
  add(params, this, "options");
22034
- var ssl = typeof this.ssl === "object" ? this.ssl : this.ssl ? { sslmode: this.ssl } : {};
22126
+ const ssl = typeof this.ssl === "object" ? this.ssl : this.ssl ? { sslmode: this.ssl } : {};
22035
22127
  add(params, ssl, "sslmode");
22036
22128
  add(params, ssl, "sslca");
22037
22129
  add(params, ssl, "sslkey");
@@ -22067,17 +22159,17 @@ var require_connection_parameters = __commonJS({
22067
22159
  var require_result = __commonJS({
22068
22160
  "node_modules/pg/lib/result.js"(exports2, module2) {
22069
22161
  "use strict";
22070
- var types = require_pg_types();
22162
+ var types2 = require_pg_types();
22071
22163
  var matchRegexp = /^([A-Za-z]+)(?: (\d+))?(?: (\d+))?/;
22072
- var Result = class {
22073
- constructor(rowMode, types2) {
22164
+ var Result2 = class {
22165
+ constructor(rowMode, types3) {
22074
22166
  this.command = null;
22075
22167
  this.rowCount = null;
22076
22168
  this.oid = null;
22077
22169
  this.rows = [];
22078
22170
  this.fields = [];
22079
22171
  this._parsers = void 0;
22080
- this._types = types2;
22172
+ this._types = types3;
22081
22173
  this.RowCtor = null;
22082
22174
  this.rowAsArray = rowMode === "array";
22083
22175
  if (this.rowAsArray) {
@@ -22087,7 +22179,7 @@ var require_result = __commonJS({
22087
22179
  }
22088
22180
  // adds a command complete message
22089
22181
  addCommandComplete(msg) {
22090
- var match;
22182
+ let match;
22091
22183
  if (msg.text) {
22092
22184
  match = matchRegexp.exec(msg.text);
22093
22185
  } else {
@@ -22104,9 +22196,9 @@ var require_result = __commonJS({
22104
22196
  }
22105
22197
  }
22106
22198
  _parseRowAsArray(rowData) {
22107
- var row = new Array(rowData.length);
22108
- for (var i = 0, len = rowData.length; i < len; i++) {
22109
- var rawValue = rowData[i];
22199
+ const row = new Array(rowData.length);
22200
+ for (let i = 0, len = rowData.length; i < len; i++) {
22201
+ const rawValue = rowData[i];
22110
22202
  if (rawValue !== null) {
22111
22203
  row[i] = this._parsers[i](rawValue);
22112
22204
  } else {
@@ -22116,12 +22208,13 @@ var require_result = __commonJS({
22116
22208
  return row;
22117
22209
  }
22118
22210
  parseRow(rowData) {
22119
- var row = { ...this._prebuiltEmptyResultObject };
22120
- for (var i = 0, len = rowData.length; i < len; i++) {
22121
- var rawValue = rowData[i];
22122
- var field = this.fields[i].name;
22211
+ const row = { ...this._prebuiltEmptyResultObject };
22212
+ for (let i = 0, len = rowData.length; i < len; i++) {
22213
+ const rawValue = rowData[i];
22214
+ const field = this.fields[i].name;
22123
22215
  if (rawValue !== null) {
22124
- row[field] = this._parsers[i](rawValue);
22216
+ const v = this.fields[i].format === "binary" ? Buffer.from(rawValue) : rawValue;
22217
+ row[field] = this._parsers[i](v);
22125
22218
  } else {
22126
22219
  row[field] = null;
22127
22220
  }
@@ -22136,20 +22229,20 @@ var require_result = __commonJS({
22136
22229
  if (this.fields.length) {
22137
22230
  this._parsers = new Array(fieldDescriptions.length);
22138
22231
  }
22139
- var row = {};
22140
- for (var i = 0; i < fieldDescriptions.length; i++) {
22141
- var desc = fieldDescriptions[i];
22232
+ const row = {};
22233
+ for (let i = 0; i < fieldDescriptions.length; i++) {
22234
+ const desc = fieldDescriptions[i];
22142
22235
  row[desc.name] = null;
22143
22236
  if (this._types) {
22144
22237
  this._parsers[i] = this._types.getTypeParser(desc.dataTypeID, desc.format || "text");
22145
22238
  } else {
22146
- this._parsers[i] = types.getTypeParser(desc.dataTypeID, desc.format || "text");
22239
+ this._parsers[i] = types2.getTypeParser(desc.dataTypeID, desc.format || "text");
22147
22240
  }
22148
22241
  }
22149
22242
  this._prebuiltEmptyResultObject = { ...row };
22150
22243
  }
22151
22244
  };
22152
- module2.exports = Result;
22245
+ module2.exports = Result2;
22153
22246
  }
22154
22247
  });
22155
22248
 
@@ -22158,9 +22251,9 @@ var require_query3 = __commonJS({
22158
22251
  "node_modules/pg/lib/query.js"(exports2, module2) {
22159
22252
  "use strict";
22160
22253
  var { EventEmitter } = require("events");
22161
- var Result = require_result();
22254
+ var Result2 = require_result();
22162
22255
  var utils = require_utils();
22163
- var Query = class extends EventEmitter {
22256
+ var Query2 = class extends EventEmitter {
22164
22257
  constructor(config, values, callback) {
22165
22258
  super();
22166
22259
  config = utils.normalizeQueryConfig(config, values, callback);
@@ -22177,7 +22270,7 @@ var require_query3 = __commonJS({
22177
22270
  if (process.domain && config.callback) {
22178
22271
  this.callback = process.domain.bind(config.callback);
22179
22272
  }
22180
- this._result = new Result(this._rowMode, this.types);
22273
+ this._result = new Result2(this._rowMode, this.types);
22181
22274
  this._results = this._result;
22182
22275
  this._canceledDueToError = false;
22183
22276
  }
@@ -22204,7 +22297,7 @@ var require_query3 = __commonJS({
22204
22297
  if (!Array.isArray(this._results)) {
22205
22298
  this._results = [this._result];
22206
22299
  }
22207
- this._result = new Result(this._rowMode, this._result._types);
22300
+ this._result = new Result2(this._rowMode, this._result._types);
22208
22301
  this._results.push(this._result);
22209
22302
  }
22210
22303
  }
@@ -22242,7 +22335,7 @@ var require_query3 = __commonJS({
22242
22335
  // if a named prepared statement is created with empty query text
22243
22336
  // the backend will send an emptyQuery message but *not* a command complete message
22244
22337
  // since we pipeline sync immediately after execute we don't need to do anything here
22245
- // unless we have rows specified, in which case we did not pipeline the intial sync call
22338
+ // unless we have rows specified, in which case we did not pipeline the initial sync call
22246
22339
  handleEmptyQuery(connection) {
22247
22340
  if (this.rows) {
22248
22341
  connection.sync();
@@ -22343,11 +22436,10 @@ var require_query3 = __commonJS({
22343
22436
  handleCopyInResponse(connection) {
22344
22437
  connection.sendCopyFail("No source stream defined");
22345
22438
  }
22346
- // eslint-disable-next-line no-unused-vars
22347
22439
  handleCopyData(msg, connection) {
22348
22440
  }
22349
22441
  };
22350
- module2.exports = Query;
22442
+ module2.exports = Query2;
22351
22443
  }
22352
22444
  });
22353
22445
 
@@ -22389,14 +22481,14 @@ var require_messages = __commonJS({
22389
22481
  name: "copyDone",
22390
22482
  length: 4
22391
22483
  };
22392
- var DatabaseError = class extends Error {
22484
+ var DatabaseError2 = class extends Error {
22393
22485
  constructor(message, length, name) {
22394
22486
  super(message);
22395
22487
  this.length = length;
22396
22488
  this.name = name;
22397
22489
  }
22398
22490
  };
22399
- exports2.DatabaseError = DatabaseError;
22491
+ exports2.DatabaseError = DatabaseError2;
22400
22492
  var CopyDataMessage = class {
22401
22493
  constructor(length, chunk) {
22402
22494
  this.length = length;
@@ -22530,10 +22622,10 @@ var require_buffer_writer = __commonJS({
22530
22622
  this.buffer = Buffer.allocUnsafe(size);
22531
22623
  }
22532
22624
  ensure(size) {
22533
- var remaining = this.buffer.length - this.offset;
22625
+ const remaining = this.buffer.length - this.offset;
22534
22626
  if (remaining < size) {
22535
- var oldBuffer = this.buffer;
22536
- var newSize = oldBuffer.length + (oldBuffer.length >> 1) + size;
22627
+ const oldBuffer = this.buffer;
22628
+ const newSize = oldBuffer.length + (oldBuffer.length >> 1) + size;
22537
22629
  this.buffer = Buffer.allocUnsafe(newSize);
22538
22630
  oldBuffer.copy(this.buffer);
22539
22631
  }
@@ -22556,7 +22648,7 @@ var require_buffer_writer = __commonJS({
22556
22648
  if (!string) {
22557
22649
  this.ensure(1);
22558
22650
  } else {
22559
- var len = Buffer.byteLength(string);
22651
+ const len = Buffer.byteLength(string);
22560
22652
  this.ensure(len + 1);
22561
22653
  this.buffer.write(string, this.offset, "utf-8");
22562
22654
  this.offset += len;
@@ -22565,7 +22657,7 @@ var require_buffer_writer = __commonJS({
22565
22657
  return this;
22566
22658
  }
22567
22659
  addString(string = "") {
22568
- var len = Buffer.byteLength(string);
22660
+ const len = Buffer.byteLength(string);
22569
22661
  this.ensure(len);
22570
22662
  this.buffer.write(string, this.offset);
22571
22663
  this.offset += len;
@@ -22586,7 +22678,7 @@ var require_buffer_writer = __commonJS({
22586
22678
  return this.buffer.slice(code ? 0 : 5, this.offset);
22587
22679
  }
22588
22680
  flush(code) {
22589
- var result = this.join(code);
22681
+ const result = this.join(code);
22590
22682
  this.offset = 5;
22591
22683
  this.headerPosition = 0;
22592
22684
  this.buffer = Buffer.allocUnsafe(this.size);
@@ -22611,8 +22703,8 @@ var require_serializer = __commonJS({
22611
22703
  writer.addCString(key).addCString(opts[key]);
22612
22704
  }
22613
22705
  writer.addCString("client_encoding").addCString("UTF8");
22614
- var bodyBuffer = writer.addCString("").flush();
22615
- var length = bodyBuffer.length + 4;
22706
+ const bodyBuffer = writer.addCString("").flush();
22707
+ const length = bodyBuffer.length + 4;
22616
22708
  return new buffer_writer_1.Writer().addInt32(length).add(bodyBuffer).flush();
22617
22709
  };
22618
22710
  var requestSsl = () => {
@@ -22654,11 +22746,11 @@ var require_serializer = __commonJS({
22654
22746
  console.error("You supplied %s (%s)", name, name.length);
22655
22747
  console.error("This can cause conflicts and silent errors executing queries");
22656
22748
  }
22657
- const types = query2.types || emptyArray;
22658
- var len = types.length;
22659
- var buffer = writer.addCString(name).addCString(query2.text).addInt16(len);
22660
- for (var i = 0; i < len; i++) {
22661
- buffer.addInt32(types[i]);
22749
+ const types2 = query2.types || emptyArray;
22750
+ const len = types2.length;
22751
+ const buffer = writer.addCString(name).addCString(query2.text).addInt16(len);
22752
+ for (let i = 0; i < len; i++) {
22753
+ buffer.addInt32(types2[i]);
22662
22754
  }
22663
22755
  return writer.flush(
22664
22756
  80
@@ -22703,6 +22795,7 @@ var require_serializer = __commonJS({
22703
22795
  writeValues(values, config.valueMapper);
22704
22796
  writer.addInt16(len);
22705
22797
  writer.add(paramWriter.flush());
22798
+ writer.addInt16(1);
22706
22799
  writer.addInt16(
22707
22800
  binary ? 1 : 0
22708
22801
  /* ParamType.STRING */
@@ -23108,15 +23201,17 @@ var require_parser = __commonJS({
23108
23201
  }
23109
23202
  break;
23110
23203
  case 10:
23111
- message.name = "authenticationSASL";
23112
- message.mechanisms = [];
23113
- let mechanism;
23114
- do {
23115
- mechanism = this.reader.cstring();
23116
- if (mechanism) {
23117
- message.mechanisms.push(mechanism);
23118
- }
23119
- } while (mechanism);
23204
+ {
23205
+ message.name = "authenticationSASL";
23206
+ message.mechanisms = [];
23207
+ let mechanism;
23208
+ do {
23209
+ mechanism = this.reader.cstring();
23210
+ if (mechanism) {
23211
+ message.mechanisms.push(mechanism);
23212
+ }
23213
+ } while (mechanism);
23214
+ }
23120
23215
  break;
23121
23216
  case 11:
23122
23217
  message.name = "authenticationSASLContinue";
@@ -23189,14 +23284,11 @@ var require_dist = __commonJS({
23189
23284
  });
23190
23285
 
23191
23286
  // node_modules/pg-cloudflare/dist/empty.js
23192
- var empty_exports = {};
23193
- __export(empty_exports, {
23194
- default: () => empty_default
23195
- });
23196
- var empty_default;
23197
- var init_empty = __esm({
23198
- "node_modules/pg-cloudflare/dist/empty.js"() {
23199
- empty_default = {};
23287
+ var require_empty = __commonJS({
23288
+ "node_modules/pg-cloudflare/dist/empty.js"(exports2) {
23289
+ "use strict";
23290
+ Object.defineProperty(exports2, "__esModule", { value: true });
23291
+ exports2.default = {};
23200
23292
  }
23201
23293
  });
23202
23294
 
@@ -23223,7 +23315,7 @@ var require_stream = __commonJS({
23223
23315
  return new net.Socket();
23224
23316
  }
23225
23317
  function getSecureStream2(options) {
23226
- var tls = require("tls");
23318
+ const tls = require("tls");
23227
23319
  return tls.connect(options);
23228
23320
  }
23229
23321
  return {
@@ -23233,7 +23325,7 @@ var require_stream = __commonJS({
23233
23325
  }
23234
23326
  function getCloudflareStreamFuncs() {
23235
23327
  function getStream2(ssl) {
23236
- const { CloudflareSocket } = (init_empty(), __toCommonJS(empty_exports));
23328
+ const { CloudflareSocket } = require_empty();
23237
23329
  return new CloudflareSocket(ssl);
23238
23330
  }
23239
23331
  function getSecureStream2(options) {
@@ -23276,7 +23368,7 @@ var require_connection4 = __commonJS({
23276
23368
  var flushBuffer = serialize.flush();
23277
23369
  var syncBuffer = serialize.sync();
23278
23370
  var endBuffer = serialize.end();
23279
- var Connection = class extends EventEmitter {
23371
+ var Connection2 = class extends EventEmitter {
23280
23372
  constructor(config) {
23281
23373
  super();
23282
23374
  config = config || {};
@@ -23291,7 +23383,7 @@ var require_connection4 = __commonJS({
23291
23383
  this.ssl = config.ssl || false;
23292
23384
  this._ending = false;
23293
23385
  this._emitMessage = false;
23294
- var self2 = this;
23386
+ const self2 = this;
23295
23387
  this.on("newListener", function(eventName) {
23296
23388
  if (eventName === "message") {
23297
23389
  self2._emitMessage = true;
@@ -23299,7 +23391,7 @@ var require_connection4 = __commonJS({
23299
23391
  });
23300
23392
  }
23301
23393
  connect(port, host) {
23302
- var self2 = this;
23394
+ const self2 = this;
23303
23395
  this._connecting = true;
23304
23396
  this.stream.setNoDelay(true);
23305
23397
  this.stream.connect(port, host);
@@ -23323,7 +23415,7 @@ var require_connection4 = __commonJS({
23323
23415
  return this.attachListeners(this.stream);
23324
23416
  }
23325
23417
  this.stream.once("data", function(buffer) {
23326
- var responseCode = buffer.toString("utf8");
23418
+ const responseCode = buffer.toString("utf8");
23327
23419
  switch (responseCode) {
23328
23420
  case "S":
23329
23421
  break;
@@ -23343,7 +23435,7 @@ var require_connection4 = __commonJS({
23343
23435
  options.key = self2.ssl.key;
23344
23436
  }
23345
23437
  }
23346
- var net = require("net");
23438
+ const net = require("net");
23347
23439
  if (net.isIP && net.isIP(host) === 0) {
23348
23440
  options.servername = host;
23349
23441
  }
@@ -23359,7 +23451,7 @@ var require_connection4 = __commonJS({
23359
23451
  }
23360
23452
  attachListeners(stream) {
23361
23453
  parse(stream, (msg) => {
23362
- var eventName = msg.name === "error" ? "errorMessage" : msg.name;
23454
+ const eventName = msg.name === "error" ? "errorMessage" : msg.name;
23363
23455
  if (this._emitMessage) {
23364
23456
  this.emit("message", msg);
23365
23457
  }
@@ -23446,7 +23538,7 @@ var require_connection4 = __commonJS({
23446
23538
  this._send(serialize.copyFail(msg));
23447
23539
  }
23448
23540
  };
23449
- module2.exports = Connection;
23541
+ module2.exports = Connection2;
23450
23542
  }
23451
23543
  });
23452
23544
 
@@ -23750,11 +23842,11 @@ var require_client2 = __commonJS({
23750
23842
  var EventEmitter = require("events").EventEmitter;
23751
23843
  var utils = require_utils();
23752
23844
  var sasl = require_sasl();
23753
- var TypeOverrides = require_type_overrides();
23845
+ var TypeOverrides2 = require_type_overrides();
23754
23846
  var ConnectionParameters = require_connection_parameters();
23755
- var Query = require_query3();
23756
- var defaults = require_defaults2();
23757
- var Connection = require_connection4();
23847
+ var Query2 = require_query3();
23848
+ var defaults2 = require_defaults2();
23849
+ var Connection2 = require_connection4();
23758
23850
  var crypto = require_utils2();
23759
23851
  var Client2 = class extends EventEmitter {
23760
23852
  constructor(config) {
@@ -23771,9 +23863,9 @@ var require_client2 = __commonJS({
23771
23863
  value: this.connectionParameters.password
23772
23864
  });
23773
23865
  this.replication = this.connectionParameters.replication;
23774
- var c = config || {};
23866
+ const c = config || {};
23775
23867
  this._Promise = c.Promise || global.Promise;
23776
- this._types = new TypeOverrides(c.types);
23868
+ this._types = new TypeOverrides2(c.types);
23777
23869
  this._ending = false;
23778
23870
  this._ended = false;
23779
23871
  this._connecting = false;
@@ -23781,7 +23873,7 @@ var require_client2 = __commonJS({
23781
23873
  this._connectionError = false;
23782
23874
  this._queryable = true;
23783
23875
  this.enableChannelBinding = Boolean(c.enableChannelBinding);
23784
- this.connection = c.connection || new Connection({
23876
+ this.connection = c.connection || new Connection2({
23785
23877
  stream: c.stream,
23786
23878
  ssl: this.connectionParameters.ssl,
23787
23879
  keepAlive: c.keepAlive || false,
@@ -23789,7 +23881,7 @@ var require_client2 = __commonJS({
23789
23881
  encoding: this.connectionParameters.client_encoding || "utf8"
23790
23882
  });
23791
23883
  this.queryQueue = [];
23792
- this.binary = c.binary || defaults.binary;
23884
+ this.binary = c.binary || defaults2.binary;
23793
23885
  this.processID = null;
23794
23886
  this.secretKey = null;
23795
23887
  this.ssl = this.connectionParameters.ssl || false;
@@ -23814,8 +23906,8 @@ var require_client2 = __commonJS({
23814
23906
  this.queryQueue.length = 0;
23815
23907
  }
23816
23908
  _connect(callback) {
23817
- var self2 = this;
23818
- var con = this.connection;
23909
+ const self2 = this;
23910
+ const con = this.connection;
23819
23911
  this._connectionCallback = callback;
23820
23912
  if (this._connecting || this._connected) {
23821
23913
  const err = new Error("Client has already been connected. You cannot reuse a client.");
@@ -24011,7 +24103,7 @@ var require_client2 = __commonJS({
24011
24103
  }
24012
24104
  this._pulseQueryQueue();
24013
24105
  }
24014
- // if we receieve an error event or error message
24106
+ // if we receive an error event or error message
24015
24107
  // during the connection process we handle it here
24016
24108
  _handleErrorWhileConnecting(err) {
24017
24109
  if (this._connectionError) {
@@ -24091,12 +24183,12 @@ var require_client2 = __commonJS({
24091
24183
  this.emit("notice", msg);
24092
24184
  }
24093
24185
  getStartupConf() {
24094
- var params = this.connectionParameters;
24095
- var data = {
24186
+ const params = this.connectionParameters;
24187
+ const data = {
24096
24188
  user: params.user,
24097
24189
  database: params.database
24098
24190
  };
24099
- var appName = params.application_name || params.fallback_application_name;
24191
+ const appName = params.application_name || params.fallback_application_name;
24100
24192
  if (appName) {
24101
24193
  data.application_name = appName;
24102
24194
  }
@@ -24119,7 +24211,7 @@ var require_client2 = __commonJS({
24119
24211
  }
24120
24212
  cancel(client, query) {
24121
24213
  if (client.activeQuery === query) {
24122
- var con = this.connection;
24214
+ const con = this.connection;
24123
24215
  if (this.host && this.host.indexOf("/") === 0) {
24124
24216
  con.connect(this.host + "/.s.PGSQL." + this.port);
24125
24217
  } else {
@@ -24168,11 +24260,11 @@ var require_client2 = __commonJS({
24168
24260
  }
24169
24261
  }
24170
24262
  query(config, values, callback) {
24171
- var query;
24172
- var result;
24173
- var readTimeout;
24174
- var readTimeoutTimer;
24175
- var queryCallback;
24263
+ let query;
24264
+ let result;
24265
+ let readTimeout;
24266
+ let readTimeoutTimer;
24267
+ let queryCallback;
24176
24268
  if (config === null || config === void 0) {
24177
24269
  throw new TypeError("Client was passed a null or undefined query");
24178
24270
  } else if (typeof config.submit === "function") {
@@ -24183,7 +24275,7 @@ var require_client2 = __commonJS({
24183
24275
  }
24184
24276
  } else {
24185
24277
  readTimeout = config.query_timeout || this.connectionParameters.query_timeout;
24186
- query = new Query(config, values, callback);
24278
+ query = new Query2(config, values, callback);
24187
24279
  if (!query.callback) {
24188
24280
  result = new this._Promise((resolve, reject) => {
24189
24281
  query.callback = (err, res) => err ? reject(err) : resolve(res);
@@ -24196,14 +24288,14 @@ var require_client2 = __commonJS({
24196
24288
  if (readTimeout) {
24197
24289
  queryCallback = query.callback;
24198
24290
  readTimeoutTimer = setTimeout(() => {
24199
- var error = new Error("Query read timeout");
24291
+ const error = new Error("Query read timeout");
24200
24292
  process.nextTick(() => {
24201
24293
  query.handleError(error, this.connection);
24202
24294
  });
24203
24295
  queryCallback(error);
24204
24296
  query.callback = () => {
24205
24297
  };
24206
- var index = this.queryQueue.indexOf(query);
24298
+ const index = this.queryQueue.indexOf(query);
24207
24299
  if (index > -1) {
24208
24300
  this.queryQueue.splice(index, 1);
24209
24301
  }
@@ -24265,7 +24357,7 @@ var require_client2 = __commonJS({
24265
24357
  }
24266
24358
  }
24267
24359
  };
24268
- Client2.Query = Query;
24360
+ Client2.Query = Query2;
24269
24361
  module2.exports = Client2;
24270
24362
  }
24271
24363
  });
@@ -24325,7 +24417,7 @@ var require_pg_pool = __commonJS({
24325
24417
  pool.emit("error", err, client);
24326
24418
  };
24327
24419
  }
24328
- var Pool = class extends EventEmitter {
24420
+ var Pool2 = class extends EventEmitter {
24329
24421
  constructor(options, Client2) {
24330
24422
  super();
24331
24423
  this.options = Object.assign({}, options);
@@ -24343,6 +24435,7 @@ var require_pg_pool = __commonJS({
24343
24435
  });
24344
24436
  }
24345
24437
  this.options.max = this.options.max || this.options.poolSize || 10;
24438
+ this.options.min = this.options.min || 0;
24346
24439
  this.options.maxUses = this.options.maxUses || Infinity;
24347
24440
  this.options.allowExitOnIdle = this.options.allowExitOnIdle || false;
24348
24441
  this.options.maxLifetimeSeconds = this.options.maxLifetimeSeconds || 0;
@@ -24364,6 +24457,9 @@ var require_pg_pool = __commonJS({
24364
24457
  _isFull() {
24365
24458
  return this._clients.length >= this.options.max;
24366
24459
  }
24460
+ _isAboveMin() {
24461
+ return this._clients.length > this.options.min;
24462
+ }
24367
24463
  _pulseQueue() {
24368
24464
  this.log("pulse queue");
24369
24465
  if (this.ended) {
@@ -24404,14 +24500,19 @@ var require_pg_pool = __commonJS({
24404
24500
  }
24405
24501
  throw new Error("unexpected condition");
24406
24502
  }
24407
- _remove(client) {
24503
+ _remove(client, callback) {
24408
24504
  const removed = removeWhere(this._idle, (item) => item.client === client);
24409
24505
  if (removed !== void 0) {
24410
24506
  clearTimeout(removed.timeoutId);
24411
24507
  }
24412
24508
  this._clients = this._clients.filter((c) => c !== client);
24413
- client.end();
24414
- this.emit("remove", client);
24509
+ const context = this;
24510
+ client.end(() => {
24511
+ context.emit("remove", client);
24512
+ if (typeof callback === "function") {
24513
+ callback();
24514
+ }
24515
+ });
24415
24516
  }
24416
24517
  connect(cb) {
24417
24518
  if (this.ending) {
@@ -24549,23 +24650,19 @@ var require_pg_pool = __commonJS({
24549
24650
  if (client._poolUseCount >= this.options.maxUses) {
24550
24651
  this.log("remove expended client");
24551
24652
  }
24552
- this._remove(client);
24553
- this._pulseQueue();
24554
- return;
24653
+ return this._remove(client, this._pulseQueue.bind(this));
24555
24654
  }
24556
24655
  const isExpired = this._expired.has(client);
24557
24656
  if (isExpired) {
24558
24657
  this.log("remove expired client");
24559
24658
  this._expired.delete(client);
24560
- this._remove(client);
24561
- this._pulseQueue();
24562
- return;
24659
+ return this._remove(client, this._pulseQueue.bind(this));
24563
24660
  }
24564
24661
  let tid;
24565
- if (this.options.idleTimeoutMillis) {
24662
+ if (this.options.idleTimeoutMillis && this._isAboveMin()) {
24566
24663
  tid = setTimeout(() => {
24567
24664
  this.log("remove idle client");
24568
- this._remove(client);
24665
+ this._remove(client, this._pulseQueue.bind(this));
24569
24666
  }, this.options.idleTimeoutMillis);
24570
24667
  if (this.options.allowExitOnIdle) {
24571
24668
  tid.unref();
@@ -24652,7 +24749,7 @@ var require_pg_pool = __commonJS({
24652
24749
  return this._clients.length;
24653
24750
  }
24654
24751
  };
24655
- module2.exports = Pool;
24752
+ module2.exports = Pool2;
24656
24753
  }
24657
24754
  });
24658
24755
 
@@ -24683,7 +24780,6 @@ var require_query4 = __commonJS({
24683
24780
  };
24684
24781
  util.inherits(NativeQuery, EventEmitter);
24685
24782
  var errorFieldMap = {
24686
- /* eslint-disable quote-props */
24687
24783
  sqlState: "code",
24688
24784
  statementPosition: "position",
24689
24785
  messagePrimary: "message",
@@ -24698,10 +24794,10 @@ var require_query4 = __commonJS({
24698
24794
  sourceFunction: "routine"
24699
24795
  };
24700
24796
  NativeQuery.prototype.handleError = function(err) {
24701
- var fields = this.native.pq.resultErrorFields();
24797
+ const fields = this.native.pq.resultErrorFields();
24702
24798
  if (fields) {
24703
- for (var key in fields) {
24704
- var normalizedFieldName = errorFieldMap[key] || key;
24799
+ for (const key in fields) {
24800
+ const normalizedFieldName = errorFieldMap[key] || key;
24705
24801
  err[normalizedFieldName] = fields[key];
24706
24802
  }
24707
24803
  }
@@ -24730,10 +24826,10 @@ var require_query4 = __commonJS({
24730
24826
  };
24731
24827
  NativeQuery.prototype.submit = function(client) {
24732
24828
  this.state = "running";
24733
- var self2 = this;
24829
+ const self2 = this;
24734
24830
  this.native = client.native;
24735
24831
  client.native.arrayMode = this._arrayMode;
24736
- var after = function(err, rows, results) {
24832
+ let after = function(err, rows, results) {
24737
24833
  client.native.arrayMode = false;
24738
24834
  setImmediate(function() {
24739
24835
  self2.emit("_done");
@@ -24769,7 +24865,7 @@ var require_query4 = __commonJS({
24769
24865
  console.error("You supplied %s (%s)", this.name, this.name.length);
24770
24866
  console.error("This can cause conflicts and silent errors executing queries");
24771
24867
  }
24772
- var values = (this.values || []).map(utils.prepareValue);
24868
+ const values = (this.values || []).map(utils.prepareValue);
24773
24869
  if (client.namedQueries[this.name]) {
24774
24870
  if (this.text && client.namedQueries[this.name] !== this.text) {
24775
24871
  const err = new Error(`Prepared statements must be unique - '${this.name}' was used for a different statement`);
@@ -24787,7 +24883,7 @@ var require_query4 = __commonJS({
24787
24883
  const err = new Error("Query values must be an array");
24788
24884
  return after(err);
24789
24885
  }
24790
- var vals = this.values.map(utils.prepareValue);
24886
+ const vals = this.values.map(utils.prepareValue);
24791
24887
  client.native.query(this.text, vals, after);
24792
24888
  } else if (this.queryMode === "extended") {
24793
24889
  client.native.query(this.text, [], after);
@@ -24808,7 +24904,7 @@ var require_client3 = __commonJS({
24808
24904
  } catch (e) {
24809
24905
  throw e;
24810
24906
  }
24811
- var TypeOverrides = require_type_overrides();
24907
+ var TypeOverrides2 = require_type_overrides();
24812
24908
  var EventEmitter = require("events").EventEmitter;
24813
24909
  var util = require("util");
24814
24910
  var ConnectionParameters = require_connection_parameters();
@@ -24817,7 +24913,7 @@ var require_client3 = __commonJS({
24817
24913
  EventEmitter.call(this);
24818
24914
  config = config || {};
24819
24915
  this._Promise = config.Promise || global.Promise;
24820
- this._types = new TypeOverrides(config.types);
24916
+ this._types = new TypeOverrides2(config.types);
24821
24917
  this.native = new Native({
24822
24918
  types: this._types
24823
24919
  });
@@ -24826,7 +24922,7 @@ var require_client3 = __commonJS({
24826
24922
  this._connecting = false;
24827
24923
  this._connected = false;
24828
24924
  this._queryable = true;
24829
- var cp = this.connectionParameters = new ConnectionParameters(config);
24925
+ const cp = this.connectionParameters = new ConnectionParameters(config);
24830
24926
  if (config.nativeConnectionString) cp.nativeConnectionString = config.nativeConnectionString;
24831
24927
  this.user = cp.user;
24832
24928
  Object.defineProperty(this, "password", {
@@ -24857,7 +24953,7 @@ var require_client3 = __commonJS({
24857
24953
  this._queryQueue.length = 0;
24858
24954
  };
24859
24955
  Client2.prototype._connect = function(cb) {
24860
- var self2 = this;
24956
+ const self2 = this;
24861
24957
  if (this._connecting) {
24862
24958
  process.nextTick(() => cb(new Error("Client has already been connected. You cannot reuse a client.")));
24863
24959
  return;
@@ -24905,11 +25001,11 @@ var require_client3 = __commonJS({
24905
25001
  });
24906
25002
  };
24907
25003
  Client2.prototype.query = function(config, values, callback) {
24908
- var query;
24909
- var result;
24910
- var readTimeout;
24911
- var readTimeoutTimer;
24912
- var queryCallback;
25004
+ let query;
25005
+ let result;
25006
+ let readTimeout;
25007
+ let readTimeoutTimer;
25008
+ let queryCallback;
24913
25009
  if (config === null || config === void 0) {
24914
25010
  throw new TypeError("Client was passed a null or undefined query");
24915
25011
  } else if (typeof config.submit === "function") {
@@ -24936,14 +25032,14 @@ var require_client3 = __commonJS({
24936
25032
  if (readTimeout) {
24937
25033
  queryCallback = query.callback;
24938
25034
  readTimeoutTimer = setTimeout(() => {
24939
- var error = new Error("Query read timeout");
25035
+ const error = new Error("Query read timeout");
24940
25036
  process.nextTick(() => {
24941
25037
  query.handleError(error, this.connection);
24942
25038
  });
24943
25039
  queryCallback(error);
24944
25040
  query.callback = () => {
24945
25041
  };
24946
- var index = this._queryQueue.indexOf(query);
25042
+ const index = this._queryQueue.indexOf(query);
24947
25043
  if (index > -1) {
24948
25044
  this._queryQueue.splice(index, 1);
24949
25045
  }
@@ -24973,12 +25069,12 @@ var require_client3 = __commonJS({
24973
25069
  return result;
24974
25070
  };
24975
25071
  Client2.prototype.end = function(cb) {
24976
- var self2 = this;
25072
+ const self2 = this;
24977
25073
  this._ending = true;
24978
25074
  if (!this._connected) {
24979
25075
  this.once("connect", this.end.bind(this, cb));
24980
25076
  }
24981
- var result;
25077
+ let result;
24982
25078
  if (!cb) {
24983
25079
  result = new this._Promise(function(resolve, reject) {
24984
25080
  cb = (err) => err ? reject(err) : resolve();
@@ -25003,7 +25099,7 @@ var require_client3 = __commonJS({
25003
25099
  if (this._hasActiveQuery()) {
25004
25100
  return;
25005
25101
  }
25006
- var query = this._queryQueue.shift();
25102
+ const query = this._queryQueue.shift();
25007
25103
  if (!query) {
25008
25104
  if (!initialConnection) {
25009
25105
  this.emit("drain");
@@ -25012,7 +25108,7 @@ var require_client3 = __commonJS({
25012
25108
  }
25013
25109
  this._activeQuery = query;
25014
25110
  query.submit(this);
25015
- var self2 = this;
25111
+ const self2 = this;
25016
25112
  query.once("_done", function() {
25017
25113
  self2._pulseQueryQueue();
25018
25114
  });
@@ -25051,29 +25147,35 @@ var require_lib6 = __commonJS({
25051
25147
  "node_modules/pg/lib/index.js"(exports2, module2) {
25052
25148
  "use strict";
25053
25149
  var Client2 = require_client2();
25054
- var defaults = require_defaults2();
25055
- var Connection = require_connection4();
25056
- var Pool = require_pg_pool();
25057
- var { DatabaseError } = require_dist();
25058
- var { escapeIdentifier, escapeLiteral } = require_utils();
25150
+ var defaults2 = require_defaults2();
25151
+ var Connection2 = require_connection4();
25152
+ var Result2 = require_result();
25153
+ var utils = require_utils();
25154
+ var Pool2 = require_pg_pool();
25155
+ var TypeOverrides2 = require_type_overrides();
25156
+ var { DatabaseError: DatabaseError2 } = require_dist();
25157
+ var { escapeIdentifier: escapeIdentifier2, escapeLiteral: escapeLiteral2 } = require_utils();
25059
25158
  var poolFactory = (Client3) => {
25060
- return class BoundPool extends Pool {
25159
+ return class BoundPool extends Pool2 {
25061
25160
  constructor(options) {
25062
25161
  super(options, Client3);
25063
25162
  }
25064
25163
  };
25065
25164
  };
25066
25165
  var PG = function(clientConstructor) {
25067
- this.defaults = defaults;
25166
+ this.defaults = defaults2;
25068
25167
  this.Client = clientConstructor;
25069
25168
  this.Query = this.Client.Query;
25070
25169
  this.Pool = poolFactory(this.Client);
25071
25170
  this._pools = [];
25072
- this.Connection = Connection;
25171
+ this.Connection = Connection2;
25073
25172
  this.types = require_pg_types();
25074
- this.DatabaseError = DatabaseError;
25075
- this.escapeIdentifier = escapeIdentifier;
25076
- this.escapeLiteral = escapeLiteral;
25173
+ this.DatabaseError = DatabaseError2;
25174
+ this.TypeOverrides = TypeOverrides2;
25175
+ this.escapeIdentifier = escapeIdentifier2;
25176
+ this.escapeLiteral = escapeLiteral2;
25177
+ this.Result = Result2;
25178
+ this.utils = utils;
25077
25179
  };
25078
25180
  if (typeof process.env.NODE_PG_FORCE_NATIVE !== "undefined") {
25079
25181
  module2.exports = new PG(require_native());
@@ -25083,7 +25185,7 @@ var require_lib6 = __commonJS({
25083
25185
  configurable: true,
25084
25186
  enumerable: false,
25085
25187
  get() {
25086
- var native = null;
25188
+ let native = null;
25087
25189
  try {
25088
25190
  native = new PG(require_native());
25089
25191
  } catch (err) {
@@ -25296,7 +25398,22 @@ var MysqlEngine = class extends AbstractEngine {
25296
25398
  // lambda/engine.postgresql.ts
25297
25399
  var fs2 = __toESM(require("fs"));
25298
25400
  var import_node_pg_format = __toESM(require_lib4());
25299
- var import_pg = __toESM(require_lib6());
25401
+
25402
+ // node_modules/pg/esm/index.mjs
25403
+ var import_lib = __toESM(require_lib6(), 1);
25404
+ var Client = import_lib.default.Client;
25405
+ var Pool = import_lib.default.Pool;
25406
+ var Connection = import_lib.default.Connection;
25407
+ var types = import_lib.default.types;
25408
+ var Query = import_lib.default.Query;
25409
+ var DatabaseError = import_lib.default.DatabaseError;
25410
+ var escapeIdentifier = import_lib.default.escapeIdentifier;
25411
+ var escapeLiteral = import_lib.default.escapeLiteral;
25412
+ var Result = import_lib.default.Result;
25413
+ var TypeOverrides = import_lib.default.TypeOverrides;
25414
+ var defaults = import_lib.default.defaults;
25415
+
25416
+ // lambda/engine.postgresql.ts
25300
25417
  var PostgresqlEngine = class extends AbstractEngine {
25301
25418
  createDatabase(resourceId, props) {
25302
25419
  const owner = props?.Owner;
@@ -25522,7 +25639,7 @@ END$$;`,
25522
25639
  `Connecting to PostgreSQL host ${params.host}:${params.port}${ssl ? " using a secure connection" : ""}, database ${params.database} as ${params.user}`
25523
25640
  );
25524
25641
  this.log("Executing SQL", sql);
25525
- const pg_client = new import_pg.Client(params);
25642
+ const pg_client = new Client(params);
25526
25643
  await pg_client.connect();
25527
25644
  try {
25528
25645
  if (typeof sql === "string") {
@@ -25631,8 +25748,9 @@ var handler = async (event) => {
25631
25748
  startingDelay: 500
25632
25749
  }
25633
25750
  );
25634
- if (!secret.SecretString)
25751
+ if (!secret.SecretString) {
25635
25752
  throw `No secret string in ${event.ResourceProperties.SecretArn}`;
25753
+ }
25636
25754
  const secretValues = JSON.parse(secret.SecretString);
25637
25755
  const engine = secretValues.engine || "postgresql";
25638
25756
  const dbEngine = EngineFactory.createEngine(engine);