@prisma/migrate 6.19.0-integration-engines-6-19-0-30-push-otuqumlrponx-17ff4a7bd0bffdf0b40b58a399869660f7f0e368.1 → 6.19.0-integration-feat-remove-library-engine.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.
Files changed (51) hide show
  1. package/dist/Migrate.js +3 -3
  2. package/dist/bin.js +27 -28
  3. package/dist/{chunk-J33EXHZB.js → chunk-2Z63R7HP.js} +10 -12
  4. package/dist/{chunk-F2XCBEZ4.js → chunk-3VYHMV3C.js} +10 -12
  5. package/dist/{chunk-Z27SI4AV.js → chunk-43R3GFIU.js} +4 -4
  6. package/dist/{chunk-3AKRTEIK.js → chunk-45NSU26W.js} +7 -7
  7. package/dist/{chunk-OP2BDF75.js → chunk-FRY7T46S.js} +10 -11
  8. package/dist/{chunk-O35BTK6Y.js → chunk-JVGKTJYZ.js} +5 -5
  9. package/dist/{chunk-VV4M6AN7.js → chunk-JX2HIV7V.js} +10 -10
  10. package/dist/{chunk-PHXLQVPT.js → chunk-L7EZFBB4.js} +40 -68
  11. package/dist/{chunk-R4IWP35Z.js → chunk-L7EZXEMS.js} +6 -6
  12. package/dist/{chunk-NB4FRYRQ.js → chunk-LNQIFWXN.js} +5 -5
  13. package/dist/{chunk-ZTIS675B.js → chunk-O57XJHDD.js} +64 -76
  14. package/dist/{chunk-BHJMJSM4.js → chunk-PJYHZKCF.js} +6 -6
  15. package/dist/{chunk-6ORQRJLP.js → chunk-QZUMMKCI.js} +16 -47
  16. package/dist/{chunk-VU5BLQUI.js → chunk-T2ACIU5M.js} +14 -8
  17. package/dist/{chunk-7TVX3D4W.js → chunk-TCBZUTEL.js} +27 -65
  18. package/dist/{chunk-TW22Y3AA.js → chunk-URVKYSZJ.js} +7 -7
  19. package/dist/{chunk-D6LYHB65.js → chunk-V5D5NSLS.js} +33 -25
  20. package/dist/{chunk-D4TRX77Y.js → chunk-W2NKGYXF.js} +7 -9
  21. package/dist/{chunk-QVMYNWAN.js → chunk-XA2JOJS2.js} +157 -70
  22. package/dist/commands/DbDrop.js +2 -2
  23. package/dist/commands/DbExecute.js +4 -4
  24. package/dist/commands/DbPull.js +5 -6
  25. package/dist/commands/DbPush.js +4 -4
  26. package/dist/commands/DbSeed.js +3 -3
  27. package/dist/commands/MigrateDeploy.js +4 -4
  28. package/dist/commands/MigrateDev.js +5 -5
  29. package/dist/commands/MigrateDiff.js +4 -4
  30. package/dist/commands/MigrateReset.js +5 -5
  31. package/dist/commands/MigrateResolve.js +4 -4
  32. package/dist/commands/MigrateStatus.js +4 -4
  33. package/dist/index.js +31 -32
  34. package/dist/internals/src/cli/getSchema.d.ts +1 -15
  35. package/dist/migrate/src/Migrate.d.ts +1 -2
  36. package/dist/migrate/src/utils/seed.d.ts +0 -6
  37. package/dist/open-GFNXULGD.js +593 -0
  38. package/dist/utils/getDatabaseVersionSafe.js +4 -4
  39. package/dist/utils/introspectSql.js +4 -4
  40. package/dist/utils/seed.js +2 -3
  41. package/dist/utils/setupCockroach.js +2 -2
  42. package/dist/utils/setupMSSQL.js +30734 -30124
  43. package/dist/utils/setupMongo.js +2048 -768
  44. package/dist/utils/setupPostgres.js +2 -2
  45. package/dist/utils/spinner.js +3 -3
  46. package/package.json +11 -11
  47. package/dist/chunk-RR6BKMNO.js +0 -80
  48. package/dist/migrate/src/utils/replaceOrAddDatasource.d.ts +0 -2
  49. package/dist/migrate/src/utils/replaceOrAddDatasource.test.d.ts +0 -1
  50. package/dist/utils/replaceOrAddDatasource.js +0 -25
  51. package/dist/utils/replaceOrAddDatasource.test.js +0 -207
@@ -16,11 +16,11 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var chunk_QVMYNWAN_exports = {};
20
- __export(chunk_QVMYNWAN_exports, {
19
+ var chunk_XA2JOJS2_exports = {};
20
+ __export(chunk_XA2JOJS2_exports, {
21
21
  require_lib: () => require_lib2
22
22
  });
23
- module.exports = __toCommonJS(chunk_QVMYNWAN_exports);
23
+ module.exports = __toCommonJS(chunk_XA2JOJS2_exports);
24
24
  var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
25
25
  var require_postgres_array = (0, import_chunk_2ESYSVXG.__commonJS)({
26
26
  "../../node_modules/.pnpm/postgres-array@2.0.0/node_modules/postgres-array/index.js"(exports) {
@@ -1552,9 +1552,9 @@ var require_type_overrides = (0, import_chunk_2ESYSVXG.__commonJS)({
1552
1552
  }
1553
1553
  });
1554
1554
  var require_pg_connection_string = (0, import_chunk_2ESYSVXG.__commonJS)({
1555
- "../../node_modules/.pnpm/pg-connection-string@2.7.0/node_modules/pg-connection-string/index.js"(exports, module2) {
1555
+ "../../node_modules/.pnpm/pg-connection-string@2.9.1/node_modules/pg-connection-string/index.js"(exports, module2) {
1556
1556
  "use strict";
1557
- function parse(str) {
1557
+ function parse(str, options = {}) {
1558
1558
  if (str.charAt(0) === "/") {
1559
1559
  const config2 = str.split(" ");
1560
1560
  return { host: config2[0], database: config2[1] };
@@ -1563,13 +1563,17 @@ var require_pg_connection_string = (0, import_chunk_2ESYSVXG.__commonJS)({
1563
1563
  let result;
1564
1564
  let dummyHost = false;
1565
1565
  if (/ |%[^a-f0-9]|%[a-f0-9][^a-f0-9]/i.test(str)) {
1566
- str = encodeURI(str).replace(/\%25(\d\d)/g, "%$1");
1566
+ str = encodeURI(str).replace(/%25(\d\d)/g, "%$1");
1567
1567
  }
1568
1568
  try {
1569
- result = new URL(str, "postgres://base");
1570
- } catch (e) {
1571
- result = new URL(str.replace("@/", "@___DUMMY___/"), "postgres://base");
1572
- dummyHost = true;
1569
+ try {
1570
+ result = new URL(str, "postgres://base");
1571
+ } catch (e) {
1572
+ result = new URL(str.replace("@/", "@___DUMMY___/"), "postgres://base");
1573
+ dummyHost = true;
1574
+ }
1575
+ } catch (err) {
1576
+ err.input && (err.input = "*****REDACTED*****");
1573
1577
  }
1574
1578
  for (const entry of result.searchParams.entries()) {
1575
1579
  config[entry[0]] = entry[1];
@@ -1612,26 +1616,105 @@ var require_pg_connection_string = (0, import_chunk_2ESYSVXG.__commonJS)({
1612
1616
  if (config.sslrootcert) {
1613
1617
  config.ssl.ca = fs.readFileSync(config.sslrootcert).toString();
1614
1618
  }
1615
- switch (config.sslmode) {
1616
- case "disable": {
1617
- config.ssl = false;
1618
- break;
1619
- }
1620
- case "prefer":
1621
- case "require":
1622
- case "verify-ca":
1623
- case "verify-full": {
1624
- break;
1619
+ if (options.useLibpqCompat && config.uselibpqcompat) {
1620
+ throw new Error("Both useLibpqCompat and uselibpqcompat are set. Please use only one of them.");
1621
+ }
1622
+ if (config.uselibpqcompat === "true" || options.useLibpqCompat) {
1623
+ switch (config.sslmode) {
1624
+ case "disable": {
1625
+ config.ssl = false;
1626
+ break;
1627
+ }
1628
+ case "prefer": {
1629
+ config.ssl.rejectUnauthorized = false;
1630
+ break;
1631
+ }
1632
+ case "require": {
1633
+ if (config.sslrootcert) {
1634
+ config.ssl.checkServerIdentity = function() {
1635
+ };
1636
+ } else {
1637
+ config.ssl.rejectUnauthorized = false;
1638
+ }
1639
+ break;
1640
+ }
1641
+ case "verify-ca": {
1642
+ if (!config.ssl.ca) {
1643
+ throw new Error(
1644
+ "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."
1645
+ );
1646
+ }
1647
+ config.ssl.checkServerIdentity = function() {
1648
+ };
1649
+ break;
1650
+ }
1651
+ case "verify-full": {
1652
+ break;
1653
+ }
1625
1654
  }
1626
- case "no-verify": {
1627
- config.ssl.rejectUnauthorized = false;
1628
- break;
1655
+ } else {
1656
+ switch (config.sslmode) {
1657
+ case "disable": {
1658
+ config.ssl = false;
1659
+ break;
1660
+ }
1661
+ case "prefer":
1662
+ case "require":
1663
+ case "verify-ca":
1664
+ case "verify-full": {
1665
+ break;
1666
+ }
1667
+ case "no-verify": {
1668
+ config.ssl.rejectUnauthorized = false;
1669
+ break;
1670
+ }
1629
1671
  }
1630
1672
  }
1631
1673
  return config;
1632
1674
  }
1675
+ function toConnectionOptions(sslConfig) {
1676
+ const connectionOptions = Object.entries(sslConfig).reduce((c, [key, value]) => {
1677
+ if (value !== void 0 && value !== null) {
1678
+ c[key] = value;
1679
+ }
1680
+ return c;
1681
+ }, {});
1682
+ return connectionOptions;
1683
+ }
1684
+ function toClientConfig(config) {
1685
+ const poolConfig = Object.entries(config).reduce((c, [key, value]) => {
1686
+ if (key === "ssl") {
1687
+ const sslConfig = value;
1688
+ if (typeof sslConfig === "boolean") {
1689
+ c[key] = sslConfig;
1690
+ }
1691
+ if (typeof sslConfig === "object") {
1692
+ c[key] = toConnectionOptions(sslConfig);
1693
+ }
1694
+ } else if (value !== void 0 && value !== null) {
1695
+ if (key === "port") {
1696
+ if (value !== "") {
1697
+ const v = parseInt(value, 10);
1698
+ if (isNaN(v)) {
1699
+ throw new Error(`Invalid ${key}: ${value}`);
1700
+ }
1701
+ c[key] = v;
1702
+ }
1703
+ } else {
1704
+ c[key] = value;
1705
+ }
1706
+ }
1707
+ return c;
1708
+ }, {});
1709
+ return poolConfig;
1710
+ }
1711
+ function parseIntoClientConfig(str) {
1712
+ return toClientConfig(parse(str));
1713
+ }
1633
1714
  module2.exports = parse;
1634
1715
  parse.parse = parse;
1716
+ parse.toClientConfig = toClientConfig;
1717
+ parse.parseIntoClientConfig = parseIntoClientConfig;
1635
1718
  }
1636
1719
  });
1637
1720
  var require_connection_parameters = (0, import_chunk_2ESYSVXG.__commonJS)({
@@ -2055,7 +2138,7 @@ var require_query = (0, import_chunk_2ESYSVXG.__commonJS)({
2055
2138
  }
2056
2139
  });
2057
2140
  var require_messages = (0, import_chunk_2ESYSVXG.__commonJS)({
2058
- "../../node_modules/.pnpm/pg-protocol@1.8.0/node_modules/pg-protocol/dist/messages.js"(exports) {
2141
+ "../../node_modules/.pnpm/pg-protocol@1.10.3/node_modules/pg-protocol/dist/messages.js"(exports) {
2059
2142
  "use strict";
2060
2143
  Object.defineProperty(exports, "__esModule", { value: true });
2061
2144
  exports.NoticeMessage = exports.DataRowMessage = exports.CommandCompleteMessage = exports.ReadyForQueryMessage = exports.NotificationResponseMessage = exports.BackendKeyDataMessage = exports.AuthenticationMD5Password = exports.ParameterStatusMessage = exports.ParameterDescriptionMessage = exports.RowDescriptionMessage = exports.Field = exports.CopyResponse = exports.CopyDataMessage = exports.DatabaseError = exports.copyDone = exports.emptyQuery = exports.replicationStart = exports.portalSuspended = exports.noData = exports.closeComplete = exports.bindComplete = exports.parseComplete = void 0;
@@ -2218,7 +2301,7 @@ var require_messages = (0, import_chunk_2ESYSVXG.__commonJS)({
2218
2301
  }
2219
2302
  });
2220
2303
  var require_buffer_writer = (0, import_chunk_2ESYSVXG.__commonJS)({
2221
- "../../node_modules/.pnpm/pg-protocol@1.8.0/node_modules/pg-protocol/dist/buffer-writer.js"(exports) {
2304
+ "../../node_modules/.pnpm/pg-protocol@1.10.3/node_modules/pg-protocol/dist/buffer-writer.js"(exports) {
2222
2305
  "use strict";
2223
2306
  Object.defineProperty(exports, "__esModule", { value: true });
2224
2307
  exports.Writer = void 0;
@@ -2230,10 +2313,10 @@ var require_buffer_writer = (0, import_chunk_2ESYSVXG.__commonJS)({
2230
2313
  this.buffer = Buffer.allocUnsafe(size);
2231
2314
  }
2232
2315
  ensure(size) {
2233
- var remaining = this.buffer.length - this.offset;
2316
+ const remaining = this.buffer.length - this.offset;
2234
2317
  if (remaining < size) {
2235
- var oldBuffer = this.buffer;
2236
- var newSize = oldBuffer.length + (oldBuffer.length >> 1) + size;
2318
+ const oldBuffer = this.buffer;
2319
+ const newSize = oldBuffer.length + (oldBuffer.length >> 1) + size;
2237
2320
  this.buffer = Buffer.allocUnsafe(newSize);
2238
2321
  oldBuffer.copy(this.buffer);
2239
2322
  }
@@ -2256,7 +2339,7 @@ var require_buffer_writer = (0, import_chunk_2ESYSVXG.__commonJS)({
2256
2339
  if (!string) {
2257
2340
  this.ensure(1);
2258
2341
  } else {
2259
- var len = Buffer.byteLength(string);
2342
+ const len = Buffer.byteLength(string);
2260
2343
  this.ensure(len + 1);
2261
2344
  this.buffer.write(string, this.offset, "utf-8");
2262
2345
  this.offset += len;
@@ -2265,7 +2348,7 @@ var require_buffer_writer = (0, import_chunk_2ESYSVXG.__commonJS)({
2265
2348
  return this;
2266
2349
  }
2267
2350
  addString(string = "") {
2268
- var len = Buffer.byteLength(string);
2351
+ const len = Buffer.byteLength(string);
2269
2352
  this.ensure(len);
2270
2353
  this.buffer.write(string, this.offset);
2271
2354
  this.offset += len;
@@ -2286,7 +2369,7 @@ var require_buffer_writer = (0, import_chunk_2ESYSVXG.__commonJS)({
2286
2369
  return this.buffer.slice(code ? 0 : 5, this.offset);
2287
2370
  }
2288
2371
  flush(code) {
2289
- var result = this.join(code);
2372
+ const result = this.join(code);
2290
2373
  this.offset = 5;
2291
2374
  this.headerPosition = 0;
2292
2375
  this.buffer = Buffer.allocUnsafe(this.size);
@@ -2297,7 +2380,7 @@ var require_buffer_writer = (0, import_chunk_2ESYSVXG.__commonJS)({
2297
2380
  }
2298
2381
  });
2299
2382
  var require_serializer = (0, import_chunk_2ESYSVXG.__commonJS)({
2300
- "../../node_modules/.pnpm/pg-protocol@1.8.0/node_modules/pg-protocol/dist/serializer.js"(exports) {
2383
+ "../../node_modules/.pnpm/pg-protocol@1.10.3/node_modules/pg-protocol/dist/serializer.js"(exports) {
2301
2384
  "use strict";
2302
2385
  Object.defineProperty(exports, "__esModule", { value: true });
2303
2386
  exports.serialize = void 0;
@@ -2309,8 +2392,8 @@ var require_serializer = (0, import_chunk_2ESYSVXG.__commonJS)({
2309
2392
  writer.addCString(key).addCString(opts[key]);
2310
2393
  }
2311
2394
  writer.addCString("client_encoding").addCString("UTF8");
2312
- var bodyBuffer = writer.addCString("").flush();
2313
- var length = bodyBuffer.length + 4;
2395
+ const bodyBuffer = writer.addCString("").flush();
2396
+ const length = bodyBuffer.length + 4;
2314
2397
  return new buffer_writer_1.Writer().addInt32(length).add(bodyBuffer).flush();
2315
2398
  };
2316
2399
  var requestSsl = () => {
@@ -2353,9 +2436,9 @@ var require_serializer = (0, import_chunk_2ESYSVXG.__commonJS)({
2353
2436
  console.error("This can cause conflicts and silent errors executing queries");
2354
2437
  }
2355
2438
  const types = query2.types || emptyArray;
2356
- var len = types.length;
2357
- var buffer = writer.addCString(name).addCString(query2.text).addInt16(len);
2358
- for (var i = 0; i < len; i++) {
2439
+ const len = types.length;
2440
+ const buffer = writer.addCString(name).addCString(query2.text).addInt16(len);
2441
+ for (let i = 0; i < len; i++) {
2359
2442
  buffer.addInt32(types[i]);
2360
2443
  }
2361
2444
  return writer.flush(
@@ -2401,6 +2484,7 @@ var require_serializer = (0, import_chunk_2ESYSVXG.__commonJS)({
2401
2484
  writeValues(values, config.valueMapper);
2402
2485
  writer.addInt16(len);
2403
2486
  writer.add(paramWriter.flush());
2487
+ writer.addInt16(1);
2404
2488
  writer.addInt16(
2405
2489
  binary ? 1 : 0
2406
2490
  /* ParamType.STRING */
@@ -2511,7 +2595,7 @@ var require_serializer = (0, import_chunk_2ESYSVXG.__commonJS)({
2511
2595
  }
2512
2596
  });
2513
2597
  var require_buffer_reader = (0, import_chunk_2ESYSVXG.__commonJS)({
2514
- "../../node_modules/.pnpm/pg-protocol@1.8.0/node_modules/pg-protocol/dist/buffer-reader.js"(exports) {
2598
+ "../../node_modules/.pnpm/pg-protocol@1.10.3/node_modules/pg-protocol/dist/buffer-reader.js"(exports) {
2515
2599
  "use strict";
2516
2600
  Object.defineProperty(exports, "__esModule", { value: true });
2517
2601
  exports.BufferReader = void 0;
@@ -2569,7 +2653,7 @@ var require_buffer_reader = (0, import_chunk_2ESYSVXG.__commonJS)({
2569
2653
  }
2570
2654
  });
2571
2655
  var require_parser = (0, import_chunk_2ESYSVXG.__commonJS)({
2572
- "../../node_modules/.pnpm/pg-protocol@1.8.0/node_modules/pg-protocol/dist/parser.js"(exports) {
2656
+ "../../node_modules/.pnpm/pg-protocol@1.10.3/node_modules/pg-protocol/dist/parser.js"(exports) {
2573
2657
  "use strict";
2574
2658
  Object.defineProperty(exports, "__esModule", { value: true });
2575
2659
  exports.Parser = void 0;
@@ -2802,15 +2886,17 @@ var require_parser = (0, import_chunk_2ESYSVXG.__commonJS)({
2802
2886
  }
2803
2887
  break;
2804
2888
  case 10:
2805
- message.name = "authenticationSASL";
2806
- message.mechanisms = [];
2807
- let mechanism;
2808
- do {
2809
- mechanism = this.reader.cstring();
2810
- if (mechanism) {
2811
- message.mechanisms.push(mechanism);
2812
- }
2813
- } while (mechanism);
2889
+ {
2890
+ message.name = "authenticationSASL";
2891
+ message.mechanisms = [];
2892
+ let mechanism;
2893
+ do {
2894
+ mechanism = this.reader.cstring();
2895
+ if (mechanism) {
2896
+ message.mechanisms.push(mechanism);
2897
+ }
2898
+ } while (mechanism);
2899
+ }
2814
2900
  break;
2815
2901
  case 11:
2816
2902
  message.name = "authenticationSASLContinue";
@@ -2858,7 +2944,7 @@ var require_parser = (0, import_chunk_2ESYSVXG.__commonJS)({
2858
2944
  }
2859
2945
  });
2860
2946
  var require_dist = (0, import_chunk_2ESYSVXG.__commonJS)({
2861
- "../../node_modules/.pnpm/pg-protocol@1.8.0/node_modules/pg-protocol/dist/index.js"(exports) {
2947
+ "../../node_modules/.pnpm/pg-protocol@1.10.3/node_modules/pg-protocol/dist/index.js"(exports) {
2862
2948
  "use strict";
2863
2949
  Object.defineProperty(exports, "__esModule", { value: true });
2864
2950
  exports.DatabaseError = exports.serialize = exports.parse = void 0;
@@ -2879,15 +2965,11 @@ var require_dist = (0, import_chunk_2ESYSVXG.__commonJS)({
2879
2965
  exports.parse = parse;
2880
2966
  }
2881
2967
  });
2882
- var empty_exports = {};
2883
- (0, import_chunk_2ESYSVXG.__export)(empty_exports, {
2884
- default: () => empty_default
2885
- });
2886
- var empty_default;
2887
- var init_empty = (0, import_chunk_2ESYSVXG.__esm)({
2888
- "../../node_modules/.pnpm/pg-cloudflare@1.1.1/node_modules/pg-cloudflare/dist/empty.js"() {
2968
+ var require_empty = (0, import_chunk_2ESYSVXG.__commonJS)({
2969
+ "../../node_modules/.pnpm/pg-cloudflare@1.2.7/node_modules/pg-cloudflare/dist/empty.js"(exports) {
2889
2970
  "use strict";
2890
- empty_default = {};
2971
+ Object.defineProperty(exports, "__esModule", { value: true });
2972
+ exports.default = {};
2891
2973
  }
2892
2974
  });
2893
2975
  var require_stream = (0, import_chunk_2ESYSVXG.__commonJS)({
@@ -2923,7 +3005,7 @@ var require_stream = (0, import_chunk_2ESYSVXG.__commonJS)({
2923
3005
  }
2924
3006
  function getCloudflareStreamFuncs() {
2925
3007
  function getStream2(ssl) {
2926
- const { CloudflareSocket } = (init_empty(), (0, import_chunk_2ESYSVXG.__toCommonJS)(empty_exports));
3008
+ const { CloudflareSocket } = require_empty();
2927
3009
  return new CloudflareSocket(ssl);
2928
3010
  }
2929
3011
  function getSecureStream2(options) {
@@ -3950,7 +4032,7 @@ var require_client = (0, import_chunk_2ESYSVXG.__commonJS)({
3950
4032
  }
3951
4033
  });
3952
4034
  var require_pg_pool = (0, import_chunk_2ESYSVXG.__commonJS)({
3953
- "../../node_modules/.pnpm/pg-pool@3.8.0_pg@8.14.1/node_modules/pg-pool/index.js"(exports, module2) {
4035
+ "../../node_modules/.pnpm/pg-pool@3.10.1_pg@8.14.1/node_modules/pg-pool/index.js"(exports, module2) {
3954
4036
  "use strict";
3955
4037
  var EventEmitter = (0, import_chunk_2ESYSVXG.__require)("events").EventEmitter;
3956
4038
  var NOOP = function() {
@@ -4021,6 +4103,7 @@ var require_pg_pool = (0, import_chunk_2ESYSVXG.__commonJS)({
4021
4103
  });
4022
4104
  }
4023
4105
  this.options.max = this.options.max || this.options.poolSize || 10;
4106
+ this.options.min = this.options.min || 0;
4024
4107
  this.options.maxUses = this.options.maxUses || Infinity;
4025
4108
  this.options.allowExitOnIdle = this.options.allowExitOnIdle || false;
4026
4109
  this.options.maxLifetimeSeconds = this.options.maxLifetimeSeconds || 0;
@@ -4042,6 +4125,9 @@ var require_pg_pool = (0, import_chunk_2ESYSVXG.__commonJS)({
4042
4125
  _isFull() {
4043
4126
  return this._clients.length >= this.options.max;
4044
4127
  }
4128
+ _isAboveMin() {
4129
+ return this._clients.length > this.options.min;
4130
+ }
4045
4131
  _pulseQueue() {
4046
4132
  this.log("pulse queue");
4047
4133
  if (this.ended) {
@@ -4082,14 +4168,19 @@ var require_pg_pool = (0, import_chunk_2ESYSVXG.__commonJS)({
4082
4168
  }
4083
4169
  throw new Error("unexpected condition");
4084
4170
  }
4085
- _remove(client) {
4171
+ _remove(client, callback) {
4086
4172
  const removed = removeWhere(this._idle, (item) => item.client === client);
4087
4173
  if (removed !== void 0) {
4088
4174
  clearTimeout(removed.timeoutId);
4089
4175
  }
4090
4176
  this._clients = this._clients.filter((c) => c !== client);
4091
- client.end();
4092
- this.emit("remove", client);
4177
+ const context = this;
4178
+ client.end(() => {
4179
+ context.emit("remove", client);
4180
+ if (typeof callback === "function") {
4181
+ callback();
4182
+ }
4183
+ });
4093
4184
  }
4094
4185
  connect(cb) {
4095
4186
  if (this.ending) {
@@ -4227,23 +4318,19 @@ var require_pg_pool = (0, import_chunk_2ESYSVXG.__commonJS)({
4227
4318
  if (client._poolUseCount >= this.options.maxUses) {
4228
4319
  this.log("remove expended client");
4229
4320
  }
4230
- this._remove(client);
4231
- this._pulseQueue();
4232
- return;
4321
+ return this._remove(client, this._pulseQueue.bind(this));
4233
4322
  }
4234
4323
  const isExpired = this._expired.has(client);
4235
4324
  if (isExpired) {
4236
4325
  this.log("remove expired client");
4237
4326
  this._expired.delete(client);
4238
- this._remove(client);
4239
- this._pulseQueue();
4240
- return;
4327
+ return this._remove(client, this._pulseQueue.bind(this));
4241
4328
  }
4242
4329
  let tid;
4243
- if (this.options.idleTimeoutMillis) {
4330
+ if (this.options.idleTimeoutMillis && this._isAboveMin()) {
4244
4331
  tid = setTimeout(() => {
4245
4332
  this.log("remove idle client");
4246
- this._remove(client);
4333
+ this._remove(client, this._pulseQueue.bind(this));
4247
4334
  }, this.options.idleTimeoutMillis);
4248
4335
  if (this.options.allowExitOnIdle) {
4249
4336
  tid.unref();
@@ -18,10 +18,10 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var DbDrop_exports = {};
20
20
  __export(DbDrop_exports, {
21
- DbDrop: () => import_chunk_Z27SI4AV.DbDrop
21
+ DbDrop: () => import_chunk_43R3GFIU.DbDrop
22
22
  });
23
23
  module.exports = __toCommonJS(DbDrop_exports);
24
- var import_chunk_Z27SI4AV = require("../chunk-Z27SI4AV.js");
24
+ var import_chunk_43R3GFIU = require("../chunk-43R3GFIU.js");
25
25
  var import_chunk_IHDN3L3R = require("../chunk-IHDN3L3R.js");
26
26
  var import_chunk_FBDQVK4W = require("../chunk-FBDQVK4W.js");
27
27
  var import_chunk_3WC4XD74 = require("../chunk-3WC4XD74.js");
@@ -18,13 +18,13 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var DbExecute_exports = {};
20
20
  __export(DbExecute_exports, {
21
- DbExecute: () => import_chunk_7TVX3D4W.DbExecute
21
+ DbExecute: () => import_chunk_TCBZUTEL.DbExecute
22
22
  });
23
23
  module.exports = __toCommonJS(DbExecute_exports);
24
- var import_chunk_7TVX3D4W = require("../chunk-7TVX3D4W.js");
25
- var import_chunk_D6LYHB65 = require("../chunk-D6LYHB65.js");
24
+ var import_chunk_TCBZUTEL = require("../chunk-TCBZUTEL.js");
25
+ var import_chunk_V5D5NSLS = require("../chunk-V5D5NSLS.js");
26
+ var import_chunk_JX2HIV7V = require("../chunk-JX2HIV7V.js");
26
27
  var import_chunk_T64SUJ5L = require("../chunk-T64SUJ5L.js");
27
- var import_chunk_VV4M6AN7 = require("../chunk-VV4M6AN7.js");
28
28
  var import_chunk_GGA2F64G = require("../chunk-GGA2F64G.js");
29
29
  var import_chunk_23DZXSTI = require("../chunk-23DZXSTI.js");
30
30
  var import_chunk_3WDCTXHL = require("../chunk-3WDCTXHL.js");
@@ -18,14 +18,13 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var DbPull_exports = {};
20
20
  __export(DbPull_exports, {
21
- DbPull: () => import_chunk_6ORQRJLP.DbPull
21
+ DbPull: () => import_chunk_QZUMMKCI.DbPull
22
22
  });
23
23
  module.exports = __toCommonJS(DbPull_exports);
24
- var import_chunk_6ORQRJLP = require("../chunk-6ORQRJLP.js");
25
- var import_chunk_VU5BLQUI = require("../chunk-VU5BLQUI.js");
24
+ var import_chunk_QZUMMKCI = require("../chunk-QZUMMKCI.js");
25
+ var import_chunk_T2ACIU5M = require("../chunk-T2ACIU5M.js");
26
26
  var import_chunk_AHJ2N6BJ = require("../chunk-AHJ2N6BJ.js");
27
27
  var import_chunk_JZ75RIMZ = require("../chunk-JZ75RIMZ.js");
28
- var import_chunk_RR6BKMNO = require("../chunk-RR6BKMNO.js");
29
28
  var import_chunk_RTGQXNX6 = require("../chunk-RTGQXNX6.js");
30
29
  var import_chunk_JFKDSUIE = require("../chunk-JFKDSUIE.js");
31
30
  var import_chunk_AI6DH66U = require("../chunk-AI6DH66U.js");
@@ -35,9 +34,9 @@ var import_chunk_3WC4XD74 = require("../chunk-3WC4XD74.js");
35
34
  var import_chunk_2FXU5NZQ = require("../chunk-2FXU5NZQ.js");
36
35
  var import_chunk_74LUB4XX = require("../chunk-74LUB4XX.js");
37
36
  var import_chunk_TWPTG4XS = require("../chunk-TWPTG4XS.js");
38
- var import_chunk_D6LYHB65 = require("../chunk-D6LYHB65.js");
37
+ var import_chunk_V5D5NSLS = require("../chunk-V5D5NSLS.js");
38
+ var import_chunk_JX2HIV7V = require("../chunk-JX2HIV7V.js");
39
39
  var import_chunk_T64SUJ5L = require("../chunk-T64SUJ5L.js");
40
- var import_chunk_VV4M6AN7 = require("../chunk-VV4M6AN7.js");
41
40
  var import_chunk_GGA2F64G = require("../chunk-GGA2F64G.js");
42
41
  var import_chunk_23DZXSTI = require("../chunk-23DZXSTI.js");
43
42
  var import_chunk_3WDCTXHL = require("../chunk-3WDCTXHL.js");
@@ -18,18 +18,18 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var DbPush_exports = {};
20
20
  __export(DbPush_exports, {
21
- DbPush: () => import_chunk_TW22Y3AA.DbPush
21
+ DbPush: () => import_chunk_URVKYSZJ.DbPush
22
22
  });
23
23
  module.exports = __toCommonJS(DbPush_exports);
24
- var import_chunk_TW22Y3AA = require("../chunk-TW22Y3AA.js");
24
+ var import_chunk_URVKYSZJ = require("../chunk-URVKYSZJ.js");
25
25
  var import_chunk_FBDQVK4W = require("../chunk-FBDQVK4W.js");
26
26
  var import_chunk_3WC4XD74 = require("../chunk-3WC4XD74.js");
27
27
  var import_chunk_2FXU5NZQ = require("../chunk-2FXU5NZQ.js");
28
28
  var import_chunk_74LUB4XX = require("../chunk-74LUB4XX.js");
29
29
  var import_chunk_TWPTG4XS = require("../chunk-TWPTG4XS.js");
30
- var import_chunk_D6LYHB65 = require("../chunk-D6LYHB65.js");
30
+ var import_chunk_V5D5NSLS = require("../chunk-V5D5NSLS.js");
31
+ var import_chunk_JX2HIV7V = require("../chunk-JX2HIV7V.js");
31
32
  var import_chunk_T64SUJ5L = require("../chunk-T64SUJ5L.js");
32
- var import_chunk_VV4M6AN7 = require("../chunk-VV4M6AN7.js");
33
33
  var import_chunk_GGA2F64G = require("../chunk-GGA2F64G.js");
34
34
  var import_chunk_23DZXSTI = require("../chunk-23DZXSTI.js");
35
35
  var import_chunk_3WDCTXHL = require("../chunk-3WDCTXHL.js");
@@ -18,11 +18,11 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var DbSeed_exports = {};
20
20
  __export(DbSeed_exports, {
21
- DbSeed: () => import_chunk_D4TRX77Y.DbSeed
21
+ DbSeed: () => import_chunk_W2NKGYXF.DbSeed
22
22
  });
23
23
  module.exports = __toCommonJS(DbSeed_exports);
24
- var import_chunk_D4TRX77Y = require("../chunk-D4TRX77Y.js");
25
- var import_chunk_PHXLQVPT = require("../chunk-PHXLQVPT.js");
24
+ var import_chunk_W2NKGYXF = require("../chunk-W2NKGYXF.js");
25
+ var import_chunk_L7EZFBB4 = require("../chunk-L7EZFBB4.js");
26
26
  var import_chunk_3WDCTXHL = require("../chunk-3WDCTXHL.js");
27
27
  var import_chunk_SKRR5WT4 = require("../chunk-SKRR5WT4.js");
28
28
  var import_chunk_2ESYSVXG = require("../chunk-2ESYSVXG.js");
@@ -18,19 +18,19 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var MigrateDeploy_exports = {};
20
20
  __export(MigrateDeploy_exports, {
21
- MigrateDeploy: () => import_chunk_BHJMJSM4.MigrateDeploy
21
+ MigrateDeploy: () => import_chunk_PJYHZKCF.MigrateDeploy
22
22
  });
23
23
  module.exports = __toCommonJS(MigrateDeploy_exports);
24
- var import_chunk_BHJMJSM4 = require("../chunk-BHJMJSM4.js");
24
+ var import_chunk_PJYHZKCF = require("../chunk-PJYHZKCF.js");
25
25
  var import_chunk_KRQEFTDT = require("../chunk-KRQEFTDT.js");
26
26
  var import_chunk_UP6FVCDK = require("../chunk-UP6FVCDK.js");
27
27
  var import_chunk_2R6DII47 = require("../chunk-2R6DII47.js");
28
28
  var import_chunk_2FXU5NZQ = require("../chunk-2FXU5NZQ.js");
29
29
  var import_chunk_74LUB4XX = require("../chunk-74LUB4XX.js");
30
30
  var import_chunk_TWPTG4XS = require("../chunk-TWPTG4XS.js");
31
- var import_chunk_D6LYHB65 = require("../chunk-D6LYHB65.js");
31
+ var import_chunk_V5D5NSLS = require("../chunk-V5D5NSLS.js");
32
+ var import_chunk_JX2HIV7V = require("../chunk-JX2HIV7V.js");
32
33
  var import_chunk_T64SUJ5L = require("../chunk-T64SUJ5L.js");
33
- var import_chunk_VV4M6AN7 = require("../chunk-VV4M6AN7.js");
34
34
  var import_chunk_GGA2F64G = require("../chunk-GGA2F64G.js");
35
35
  var import_chunk_23DZXSTI = require("../chunk-23DZXSTI.js");
36
36
  var import_chunk_3WDCTXHL = require("../chunk-3WDCTXHL.js");
@@ -18,10 +18,10 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var MigrateDev_exports = {};
20
20
  __export(MigrateDev_exports, {
21
- MigrateDev: () => import_chunk_F2XCBEZ4.MigrateDev
21
+ MigrateDev: () => import_chunk_3VYHMV3C.MigrateDev
22
22
  });
23
23
  module.exports = __toCommonJS(MigrateDev_exports);
24
- var import_chunk_F2XCBEZ4 = require("../chunk-F2XCBEZ4.js");
24
+ var import_chunk_3VYHMV3C = require("../chunk-3VYHMV3C.js");
25
25
  var import_chunk_C3722PDA = require("../chunk-C3722PDA.js");
26
26
  var import_chunk_7CQBDP4H = require("../chunk-7CQBDP4H.js");
27
27
  var import_chunk_KRQEFTDT = require("../chunk-KRQEFTDT.js");
@@ -31,10 +31,10 @@ var import_chunk_3WC4XD74 = require("../chunk-3WC4XD74.js");
31
31
  var import_chunk_2FXU5NZQ = require("../chunk-2FXU5NZQ.js");
32
32
  var import_chunk_74LUB4XX = require("../chunk-74LUB4XX.js");
33
33
  var import_chunk_TWPTG4XS = require("../chunk-TWPTG4XS.js");
34
- var import_chunk_PHXLQVPT = require("../chunk-PHXLQVPT.js");
35
- var import_chunk_D6LYHB65 = require("../chunk-D6LYHB65.js");
34
+ var import_chunk_L7EZFBB4 = require("../chunk-L7EZFBB4.js");
35
+ var import_chunk_V5D5NSLS = require("../chunk-V5D5NSLS.js");
36
+ var import_chunk_JX2HIV7V = require("../chunk-JX2HIV7V.js");
36
37
  var import_chunk_T64SUJ5L = require("../chunk-T64SUJ5L.js");
37
- var import_chunk_VV4M6AN7 = require("../chunk-VV4M6AN7.js");
38
38
  var import_chunk_GGA2F64G = require("../chunk-GGA2F64G.js");
39
39
  var import_chunk_23DZXSTI = require("../chunk-23DZXSTI.js");
40
40
  var import_chunk_3WDCTXHL = require("../chunk-3WDCTXHL.js");
@@ -18,14 +18,14 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var MigrateDiff_exports = {};
20
20
  __export(MigrateDiff_exports, {
21
- MigrateDiff: () => import_chunk_ZTIS675B.MigrateDiff
21
+ MigrateDiff: () => import_chunk_O57XJHDD.MigrateDiff
22
22
  });
23
23
  module.exports = __toCommonJS(MigrateDiff_exports);
24
- var import_chunk_ZTIS675B = require("../chunk-ZTIS675B.js");
24
+ var import_chunk_O57XJHDD = require("../chunk-O57XJHDD.js");
25
25
  var import_chunk_VAJ4VX67 = require("../chunk-VAJ4VX67.js");
26
- var import_chunk_D6LYHB65 = require("../chunk-D6LYHB65.js");
26
+ var import_chunk_V5D5NSLS = require("../chunk-V5D5NSLS.js");
27
+ var import_chunk_JX2HIV7V = require("../chunk-JX2HIV7V.js");
27
28
  var import_chunk_T64SUJ5L = require("../chunk-T64SUJ5L.js");
28
- var import_chunk_VV4M6AN7 = require("../chunk-VV4M6AN7.js");
29
29
  var import_chunk_GGA2F64G = require("../chunk-GGA2F64G.js");
30
30
  var import_chunk_23DZXSTI = require("../chunk-23DZXSTI.js");
31
31
  var import_chunk_3WDCTXHL = require("../chunk-3WDCTXHL.js");
@@ -18,10 +18,10 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var MigrateReset_exports = {};
20
20
  __export(MigrateReset_exports, {
21
- MigrateReset: () => import_chunk_J33EXHZB.MigrateReset
21
+ MigrateReset: () => import_chunk_2Z63R7HP.MigrateReset
22
22
  });
23
23
  module.exports = __toCommonJS(MigrateReset_exports);
24
- var import_chunk_J33EXHZB = require("../chunk-J33EXHZB.js");
24
+ var import_chunk_2Z63R7HP = require("../chunk-2Z63R7HP.js");
25
25
  var import_chunk_KRQEFTDT = require("../chunk-KRQEFTDT.js");
26
26
  var import_chunk_UP6FVCDK = require("../chunk-UP6FVCDK.js");
27
27
  var import_chunk_2R6DII47 = require("../chunk-2R6DII47.js");
@@ -30,10 +30,10 @@ var import_chunk_3WC4XD74 = require("../chunk-3WC4XD74.js");
30
30
  var import_chunk_2FXU5NZQ = require("../chunk-2FXU5NZQ.js");
31
31
  var import_chunk_74LUB4XX = require("../chunk-74LUB4XX.js");
32
32
  var import_chunk_TWPTG4XS = require("../chunk-TWPTG4XS.js");
33
- var import_chunk_PHXLQVPT = require("../chunk-PHXLQVPT.js");
34
- var import_chunk_D6LYHB65 = require("../chunk-D6LYHB65.js");
33
+ var import_chunk_L7EZFBB4 = require("../chunk-L7EZFBB4.js");
34
+ var import_chunk_V5D5NSLS = require("../chunk-V5D5NSLS.js");
35
+ var import_chunk_JX2HIV7V = require("../chunk-JX2HIV7V.js");
35
36
  var import_chunk_T64SUJ5L = require("../chunk-T64SUJ5L.js");
36
- var import_chunk_VV4M6AN7 = require("../chunk-VV4M6AN7.js");
37
37
  var import_chunk_GGA2F64G = require("../chunk-GGA2F64G.js");
38
38
  var import_chunk_23DZXSTI = require("../chunk-23DZXSTI.js");
39
39
  var import_chunk_3WDCTXHL = require("../chunk-3WDCTXHL.js");
@@ -18,16 +18,16 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var MigrateResolve_exports = {};
20
20
  __export(MigrateResolve_exports, {
21
- MigrateResolve: () => import_chunk_3AKRTEIK.MigrateResolve
21
+ MigrateResolve: () => import_chunk_45NSU26W.MigrateResolve
22
22
  });
23
23
  module.exports = __toCommonJS(MigrateResolve_exports);
24
- var import_chunk_3AKRTEIK = require("../chunk-3AKRTEIK.js");
24
+ var import_chunk_45NSU26W = require("../chunk-45NSU26W.js");
25
25
  var import_chunk_2FXU5NZQ = require("../chunk-2FXU5NZQ.js");
26
26
  var import_chunk_74LUB4XX = require("../chunk-74LUB4XX.js");
27
27
  var import_chunk_TWPTG4XS = require("../chunk-TWPTG4XS.js");
28
- var import_chunk_D6LYHB65 = require("../chunk-D6LYHB65.js");
28
+ var import_chunk_V5D5NSLS = require("../chunk-V5D5NSLS.js");
29
+ var import_chunk_JX2HIV7V = require("../chunk-JX2HIV7V.js");
29
30
  var import_chunk_T64SUJ5L = require("../chunk-T64SUJ5L.js");
30
- var import_chunk_VV4M6AN7 = require("../chunk-VV4M6AN7.js");
31
31
  var import_chunk_GGA2F64G = require("../chunk-GGA2F64G.js");
32
32
  var import_chunk_23DZXSTI = require("../chunk-23DZXSTI.js");
33
33
  var import_chunk_3WDCTXHL = require("../chunk-3WDCTXHL.js");