@prisma/migrate 6.6.0-dev.8 → 6.6.0-dev.80

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 (150) hide show
  1. package/dist/CLI.js +3 -3
  2. package/dist/Migrate.js +8 -6
  3. package/dist/SchemaEngine.js +5 -5
  4. package/dist/bin.js +47 -46
  5. package/dist/chunk-23DZXSTI.js +62 -0
  6. package/dist/{chunk-WWAWV7DQ.js → chunk-2ESYSVXG.js} +3 -27
  7. package/dist/{chunk-LKTTJWFT.js → chunk-2R6DII47.js} +5 -5
  8. package/dist/chunk-33LPBNDX.js +1399 -0
  9. package/dist/{chunk-V3ZMNXZC.js → chunk-5LKIRKDL.js} +307 -382
  10. package/dist/{chunk-IR55GBON.js → chunk-5LTDMS3H.js} +18 -18
  11. package/dist/{chunk-LOGAFLCN.js → chunk-5R44VVVX.js} +29 -29
  12. package/dist/{chunk-Q3ZLC44N.js → chunk-63X7FE2R.js} +57 -66
  13. package/dist/{chunk-DJMFXNR4.js → chunk-74LUB4XX.js} +56 -57
  14. package/dist/{chunk-N4XTKFY6.js → chunk-7RM467G7.js} +39 -38
  15. package/dist/{chunk-RP2N6UXA.js → chunk-AI6DH66U.js} +6 -6
  16. package/dist/{chunk-A6PMXMMT.js → chunk-AUGZZ6RT.js} +105 -13
  17. package/dist/{chunk-G2XUUMKH.js → chunk-B4SUSDC2.js} +31 -39
  18. package/dist/{chunk-ZOEKRXDP.js → chunk-D2DGSPW6.js} +29 -55
  19. package/dist/{chunk-W2SZNLK4.js → chunk-EJG7GKM7.js} +37 -39
  20. package/dist/{chunk-5PSO7BDO.js → chunk-EJUXYFV3.js} +15 -15
  21. package/dist/{chunk-HCBZB4XC.js → chunk-FFPSJTA6.js} +53 -52
  22. package/dist/{chunk-N3KYWSX2.js → chunk-FZGPSDP7.js} +55 -49
  23. package/dist/{chunk-MCWCB2AX.js → chunk-IINN7QUV.js} +170 -643
  24. package/dist/{chunk-255BRND3.js → chunk-KRQEFTDT.js} +6 -6
  25. package/dist/{chunk-VVKOFN3Y.js → chunk-LLO7YF56.js} +44 -46
  26. package/dist/{chunk-VZ23KD5C.js → chunk-NGQA5JTN.js} +8 -10
  27. package/dist/{chunk-MKK3GSDF.js → chunk-NIKXBMZL.js} +5 -5
  28. package/dist/{chunk-GG54LOYV.js → chunk-O6RQXRWU.js} +45 -44
  29. package/dist/{chunk-MATFO4ZW.js → chunk-OEWQACEH.js} +38 -39
  30. package/dist/{chunk-3GHGKOL4.js → chunk-OPKM35BD.js} +370 -529
  31. package/dist/{chunk-EGPJABTW.js → chunk-QVMYNWAN.js} +257 -103
  32. package/dist/{chunk-V5TUSOJX.js → chunk-SQKGZVG3.js} +45 -45
  33. package/dist/{chunk-CQZFVAXC.js → chunk-TN7JMNXD.js} +42 -41
  34. package/dist/chunk-URKH6SE2.js +479 -0
  35. package/dist/chunk-V6PVGSDJ.js +76 -0
  36. package/dist/{chunk-DLLXDCI2.js → chunk-VAJ4VX67.js} +5 -6
  37. package/dist/{chunk-KC5MOJ5I.js → chunk-WU6Z6FMF.js} +371 -530
  38. package/dist/{chunk-OCQGHQED.js → chunk-YBX7R3MT.js} +12 -12
  39. package/dist/{chunk-KS7IEA6Z.js → chunk-YGBJA7QJ.js} +50 -52
  40. package/dist/{chunk-WI2A2TQE.js → chunk-ZJ4IDCRR.js} +90 -91
  41. package/dist/chunk-ZLHWX5PJ.js +883 -0
  42. package/dist/commands/DbCommand.js +3 -3
  43. package/dist/commands/DbDrop.js +4 -5
  44. package/dist/commands/DbExecute.js +9 -7
  45. package/dist/commands/DbPull.js +11 -10
  46. package/dist/commands/DbPush.js +10 -9
  47. package/dist/commands/DbSeed.js +4 -5
  48. package/dist/commands/MigrateCommand.js +3 -3
  49. package/dist/commands/MigrateDeploy.js +12 -11
  50. package/dist/commands/MigrateDev.js +14 -13
  51. package/dist/commands/MigrateDiff.js +12 -10
  52. package/dist/commands/MigrateReset.js +13 -12
  53. package/dist/commands/MigrateResolve.js +10 -9
  54. package/dist/commands/MigrateStatus.js +10 -9
  55. package/dist/index.js +50 -51
  56. package/dist/internals/src/Generator.d.ts +23 -5
  57. package/dist/internals/src/cli/checkUnsupportedDataProxy.d.ts +12 -17
  58. package/dist/internals/src/cli/directoryConfig.d.ts +7 -0
  59. package/dist/internals/src/cli/getSchema.d.ts +3 -28
  60. package/dist/internals/src/cli/hashes.d.ts +1 -2
  61. package/dist/internals/src/cli/schemaContext.d.ts +59 -0
  62. package/dist/internals/src/client/getClientEngineType.d.ts +1 -1
  63. package/dist/internals/src/convertCredentials.d.ts +1 -1
  64. package/dist/internals/src/engine-commands/getConfig.d.ts +1 -5
  65. package/dist/internals/src/engine-commands/getDmmf.d.ts +3 -6
  66. package/dist/internals/src/engine-commands/lintSchema.d.ts +1 -1
  67. package/dist/internals/src/errorReporting.d.ts +0 -1
  68. package/dist/internals/src/get-generators/getGenerators.d.ts +22 -9
  69. package/dist/internals/src/get-generators/utils/binaryTypeToEngineType.d.ts +1 -1
  70. package/dist/internals/src/get-generators/utils/engineTypeToBinaryType.d.ts +1 -1
  71. package/dist/internals/src/get-generators/utils/fixBinaryTargets.d.ts +1 -1
  72. package/dist/internals/src/get-generators/utils/getBinaryPathsByVersion.d.ts +1 -1
  73. package/dist/internals/src/get-generators/utils/getEngineVersionForGenerator.d.ts +1 -1
  74. package/dist/internals/src/get-generators/utils/printGeneratorConfig.d.ts +1 -1
  75. package/dist/internals/src/index.d.ts +7 -7
  76. package/dist/internals/src/migrateTypes.d.ts +63 -0
  77. package/dist/internals/src/panic.d.ts +1 -4
  78. package/dist/internals/src/resolvePkg.d.ts +7 -0
  79. package/dist/internals/src/types.d.ts +1 -1
  80. package/dist/internals/src/utils/extractPreviewFeatures.d.ts +2 -2
  81. package/dist/internals/src/utils/getEnvPaths.d.ts +1 -1
  82. package/dist/internals/src/utils/parseEnvValue.d.ts +1 -1
  83. package/dist/internals/src/utils/schemaFileInput.d.ts +0 -4
  84. package/dist/internals/src/utils/toSchemasContainer.d.ts +2 -3
  85. package/dist/migrate/src/Migrate.d.ts +7 -5
  86. package/dist/migrate/src/SchemaEngine.d.ts +5 -9
  87. package/dist/migrate/src/index.d.ts +0 -1
  88. package/dist/migrate/src/types.d.ts +14 -10
  89. package/dist/migrate/src/utils/createMigration.d.ts +21 -0
  90. package/dist/migrate/src/utils/ensureDatabaseExists.d.ts +4 -6
  91. package/dist/migrate/src/utils/introspectSql.d.ts +3 -2
  92. package/dist/migrate/src/utils/listMigrations.d.ts +9 -0
  93. package/dist/migrate/src/utils/printDatasources.d.ts +1 -1
  94. package/dist/migrate/src/utils/seed.d.ts +0 -2
  95. package/dist/migrate/src/views/handleViewsIO.d.ts +2 -2
  96. package/dist/{multipart-parser-54WEFGGN-NLZG56KM.js → multipart-parser-ASKQAOL4-WZ47HU6G.js} +92 -125
  97. package/dist/{multipart-parser-NDLECNMN.js → multipart-parser-QCI3Y5IB.js} +66 -68
  98. package/dist/types.js +1 -1
  99. package/dist/{typescript-WN4QH2CP.js → typescript-2LKASCMC.js} +33 -33
  100. package/dist/{typescript-AILDXN3I.js → typescript-H3AVJ6KX.js} +32 -32
  101. package/dist/utils/byline.js +1 -1
  102. package/dist/utils/captureStdout.js +3 -3
  103. package/dist/utils/countModelsAndTypes.js +1 -1
  104. package/dist/utils/{getSchemaPathAndPrint.js → createMigration.js} +8 -8
  105. package/dist/utils/customColors.js +1 -1
  106. package/dist/utils/ensureDatabaseExists.js +7 -7
  107. package/dist/utils/errors.js +1 -1
  108. package/dist/utils/flagErrors.js +1 -1
  109. package/dist/utils/getDatabaseVersionSafe.js +5 -5
  110. package/dist/utils/handleEvaluateDataloss.js +1 -1
  111. package/dist/utils/introspectSql.js +5 -5
  112. package/dist/utils/isSchemaEmpty.js +1 -1
  113. package/dist/utils/listMigrations.js +25 -0
  114. package/dist/utils/now.js +1 -1
  115. package/dist/utils/printDatasource.js +1 -1
  116. package/dist/utils/printDatasources.js +5 -5
  117. package/dist/utils/printFiles.js +5 -5
  118. package/dist/utils/printIntrospectedSchema.js +1 -1
  119. package/dist/utils/printMigrationId.js +1 -1
  120. package/dist/utils/promptForMigrationName.js +3 -3
  121. package/dist/utils/removeSchemaFiles.js +1 -1
  122. package/dist/utils/replaceOrAddDatasource.js +1 -1
  123. package/dist/utils/replaceOrAddDatasource.test.js +1 -1
  124. package/dist/utils/saveSchemaFiles.js +1 -1
  125. package/dist/utils/seed.js +4 -7
  126. package/dist/utils/setupCockroach.js +3 -3
  127. package/dist/utils/setupMSSQL.js +1478 -707
  128. package/dist/utils/setupMongo.js +553 -552
  129. package/dist/utils/setupMysql.js +508 -563
  130. package/dist/utils/setupPostgres.js +3 -3
  131. package/dist/utils/spinner.js +4 -3
  132. package/dist/utils/test-handlePanic.js +1 -30
  133. package/dist/utils/unixSocket.js +1 -1
  134. package/dist/views/handleViewsIO.js +3 -3
  135. package/package.json +11 -11
  136. package/dist/chunk-GKDFIHM2.js +0 -45
  137. package/dist/chunk-J46BJQHT.js +0 -268
  138. package/dist/chunk-KOF4LGTS.js +0 -1817
  139. package/dist/chunk-YYPMC5FN.js +0 -1407
  140. package/dist/internals/src/get-generators/generatorResolvers/generatorResolvers.d.ts +0 -15
  141. package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/auto-installation/findPrismaClientDir.d.ts +0 -6
  142. package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/auto-installation/getPackageCmd.d.ts +0 -9
  143. package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/auto-installation/runPackageCmd.d.ts +0 -8
  144. package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/check-dependencies/checkTypeScriptVersion.d.ts +0 -6
  145. package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/check-dependencies/isYarnUsed.d.ts +0 -1
  146. package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/check-dependencies/resolve.d.ts +0 -20
  147. package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/check-dependencies/semverLt.d.ts +0 -7
  148. package/dist/internals/src/get-generators/generatorResolvers/prisma-client-js/prismaClientResolver.d.ts +0 -20
  149. package/dist/internals/src/get-generators/utils/check-feature-flags/checkFeatureFlags.d.ts +0 -8
  150. package/dist/migrate/src/utils/getSchemaPathAndPrint.d.ts +0 -10
@@ -16,13 +16,13 @@ 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_EGPJABTW_exports = {};
20
- __export(chunk_EGPJABTW_exports, {
19
+ var chunk_QVMYNWAN_exports = {};
20
+ __export(chunk_QVMYNWAN_exports, {
21
21
  require_lib: () => require_lib2
22
22
  });
23
- module.exports = __toCommonJS(chunk_EGPJABTW_exports);
24
- var import_chunk_WWAWV7DQ = require("./chunk-WWAWV7DQ.js");
25
- var require_postgres_array = (0, import_chunk_WWAWV7DQ.__commonJS)({
23
+ module.exports = __toCommonJS(chunk_QVMYNWAN_exports);
24
+ var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
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) {
27
27
  "use strict";
28
28
  exports.parse = function(source, transform) {
@@ -114,7 +114,7 @@ var require_postgres_array = (0, import_chunk_WWAWV7DQ.__commonJS)({
114
114
  }
115
115
  }
116
116
  });
117
- var require_arrayParser = (0, import_chunk_WWAWV7DQ.__commonJS)({
117
+ var require_arrayParser = (0, import_chunk_2ESYSVXG.__commonJS)({
118
118
  "../../node_modules/.pnpm/pg-types@2.2.0/node_modules/pg-types/lib/arrayParser.js"(exports, module2) {
119
119
  "use strict";
120
120
  var array = require_postgres_array();
@@ -129,7 +129,7 @@ var require_arrayParser = (0, import_chunk_WWAWV7DQ.__commonJS)({
129
129
  };
130
130
  }
131
131
  });
132
- var require_postgres_date = (0, import_chunk_WWAWV7DQ.__commonJS)({
132
+ var require_postgres_date = (0, import_chunk_2ESYSVXG.__commonJS)({
133
133
  "../../node_modules/.pnpm/postgres-date@1.0.7/node_modules/postgres-date/index.js"(exports, module2) {
134
134
  "use strict";
135
135
  var DATE_TIME = /(\d{1,})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})(\.\d{1,})?.*?( BC)?$/;
@@ -214,7 +214,7 @@ var require_postgres_date = (0, import_chunk_WWAWV7DQ.__commonJS)({
214
214
  }
215
215
  }
216
216
  });
217
- var require_mutable = (0, import_chunk_WWAWV7DQ.__commonJS)({
217
+ var require_mutable = (0, import_chunk_2ESYSVXG.__commonJS)({
218
218
  "../../node_modules/.pnpm/xtend@4.0.2/node_modules/xtend/mutable.js"(exports, module2) {
219
219
  "use strict";
220
220
  module2.exports = extend;
@@ -232,7 +232,7 @@ var require_mutable = (0, import_chunk_WWAWV7DQ.__commonJS)({
232
232
  }
233
233
  }
234
234
  });
235
- var require_postgres_interval = (0, import_chunk_WWAWV7DQ.__commonJS)({
235
+ var require_postgres_interval = (0, import_chunk_2ESYSVXG.__commonJS)({
236
236
  "../../node_modules/.pnpm/postgres-interval@1.2.0/node_modules/postgres-interval/index.js"(exports, module2) {
237
237
  "use strict";
238
238
  var extend = require_mutable();
@@ -321,7 +321,7 @@ var require_postgres_interval = (0, import_chunk_WWAWV7DQ.__commonJS)({
321
321
  }
322
322
  }
323
323
  });
324
- var require_postgres_bytea = (0, import_chunk_WWAWV7DQ.__commonJS)({
324
+ var require_postgres_bytea = (0, import_chunk_2ESYSVXG.__commonJS)({
325
325
  "../../node_modules/.pnpm/postgres-bytea@1.0.0/node_modules/postgres-bytea/index.js"(exports, module2) {
326
326
  "use strict";
327
327
  module2.exports = function parseBytea(input) {
@@ -354,7 +354,7 @@ var require_postgres_bytea = (0, import_chunk_WWAWV7DQ.__commonJS)({
354
354
  };
355
355
  }
356
356
  });
357
- var require_textParsers = (0, import_chunk_WWAWV7DQ.__commonJS)({
357
+ var require_textParsers = (0, import_chunk_2ESYSVXG.__commonJS)({
358
358
  "../../node_modules/.pnpm/pg-types@2.2.0/node_modules/pg-types/lib/textParsers.js"(exports, module2) {
359
359
  "use strict";
360
360
  var array = require_postgres_array();
@@ -553,7 +553,7 @@ var require_textParsers = (0, import_chunk_WWAWV7DQ.__commonJS)({
553
553
  };
554
554
  }
555
555
  });
556
- var require_pg_int8 = (0, import_chunk_WWAWV7DQ.__commonJS)({
556
+ var require_pg_int8 = (0, import_chunk_2ESYSVXG.__commonJS)({
557
557
  "../../node_modules/.pnpm/pg-int8@1.0.1/node_modules/pg-int8/index.js"(exports, module2) {
558
558
  "use strict";
559
559
  var BASE = 1e6;
@@ -631,7 +631,7 @@ var require_pg_int8 = (0, import_chunk_WWAWV7DQ.__commonJS)({
631
631
  module2.exports = readInt8;
632
632
  }
633
633
  });
634
- var require_binaryParsers = (0, import_chunk_WWAWV7DQ.__commonJS)({
634
+ var require_binaryParsers = (0, import_chunk_2ESYSVXG.__commonJS)({
635
635
  "../../node_modules/.pnpm/pg-types@2.2.0/node_modules/pg-types/lib/binaryParsers.js"(exports, module2) {
636
636
  "use strict";
637
637
  var parseInt64 = require_pg_int8();
@@ -830,7 +830,7 @@ var require_binaryParsers = (0, import_chunk_WWAWV7DQ.__commonJS)({
830
830
  };
831
831
  }
832
832
  });
833
- var require_builtins = (0, import_chunk_WWAWV7DQ.__commonJS)({
833
+ var require_builtins = (0, import_chunk_2ESYSVXG.__commonJS)({
834
834
  "../../node_modules/.pnpm/pg-types@2.2.0/node_modules/pg-types/lib/builtins.js"(exports, module2) {
835
835
  "use strict";
836
836
  module2.exports = {
@@ -897,7 +897,7 @@ var require_builtins = (0, import_chunk_WWAWV7DQ.__commonJS)({
897
897
  };
898
898
  }
899
899
  });
900
- var require_pg_types = (0, import_chunk_WWAWV7DQ.__commonJS)({
900
+ var require_pg_types = (0, import_chunk_2ESYSVXG.__commonJS)({
901
901
  "../../node_modules/.pnpm/pg-types@2.2.0/node_modules/pg-types/index.js"(exports) {
902
902
  "use strict";
903
903
  var textParsers = require_textParsers();
@@ -937,8 +937,8 @@ var require_pg_types = (0, import_chunk_WWAWV7DQ.__commonJS)({
937
937
  });
938
938
  }
939
939
  });
940
- var require_defaults = (0, import_chunk_WWAWV7DQ.__commonJS)({
941
- "../../node_modules/.pnpm/pg@8.13.3/node_modules/pg/lib/defaults.js"(exports, module2) {
940
+ var require_defaults = (0, import_chunk_2ESYSVXG.__commonJS)({
941
+ "../../node_modules/.pnpm/pg@8.14.1/node_modules/pg/lib/defaults.js"(exports, module2) {
942
942
  "use strict";
943
943
  module2.exports = {
944
944
  // database host. defaults to localhost
@@ -997,8 +997,8 @@ var require_defaults = (0, import_chunk_WWAWV7DQ.__commonJS)({
997
997
  });
998
998
  }
999
999
  });
1000
- var require_utils = (0, import_chunk_WWAWV7DQ.__commonJS)({
1001
- "../../node_modules/.pnpm/pg@8.13.3/node_modules/pg/lib/utils.js"(exports, module2) {
1000
+ var require_utils = (0, import_chunk_2ESYSVXG.__commonJS)({
1001
+ "../../node_modules/.pnpm/pg@8.14.1/node_modules/pg/lib/utils.js"(exports, module2) {
1002
1002
  "use strict";
1003
1003
  var defaults = require_defaults();
1004
1004
  function escapeElement(elementRepresentation) {
@@ -1145,10 +1145,10 @@ var require_utils = (0, import_chunk_WWAWV7DQ.__commonJS)({
1145
1145
  };
1146
1146
  }
1147
1147
  });
1148
- var require_utils_legacy = (0, import_chunk_WWAWV7DQ.__commonJS)({
1149
- "../../node_modules/.pnpm/pg@8.13.3/node_modules/pg/lib/crypto/utils-legacy.js"(exports, module2) {
1148
+ var require_utils_legacy = (0, import_chunk_2ESYSVXG.__commonJS)({
1149
+ "../../node_modules/.pnpm/pg@8.14.1/node_modules/pg/lib/crypto/utils-legacy.js"(exports, module2) {
1150
1150
  "use strict";
1151
- var nodeCrypto = (0, import_chunk_WWAWV7DQ.__require)("crypto");
1151
+ var nodeCrypto = (0, import_chunk_2ESYSVXG.__require)("crypto");
1152
1152
  function md5(string) {
1153
1153
  return nodeCrypto.createHash("md5").update(string, "utf-8").digest("hex");
1154
1154
  }
@@ -1160,6 +1160,10 @@ var require_utils_legacy = (0, import_chunk_WWAWV7DQ.__commonJS)({
1160
1160
  function sha256(text) {
1161
1161
  return nodeCrypto.createHash("sha256").update(text).digest();
1162
1162
  }
1163
+ function hashByName(hashName, text) {
1164
+ hashName = hashName.replace(/(\D)-/, "$1");
1165
+ return nodeCrypto.createHash(hashName).update(text).digest();
1166
+ }
1163
1167
  function hmacSha256(key, msg) {
1164
1168
  return nodeCrypto.createHmac("sha256", key).update(msg).digest();
1165
1169
  }
@@ -1171,20 +1175,22 @@ var require_utils_legacy = (0, import_chunk_WWAWV7DQ.__commonJS)({
1171
1175
  randomBytes: nodeCrypto.randomBytes,
1172
1176
  deriveKey,
1173
1177
  sha256,
1178
+ hashByName,
1174
1179
  hmacSha256,
1175
1180
  md5
1176
1181
  };
1177
1182
  }
1178
1183
  });
1179
- var require_utils_webcrypto = (0, import_chunk_WWAWV7DQ.__commonJS)({
1180
- "../../node_modules/.pnpm/pg@8.13.3/node_modules/pg/lib/crypto/utils-webcrypto.js"(exports, module2) {
1184
+ var require_utils_webcrypto = (0, import_chunk_2ESYSVXG.__commonJS)({
1185
+ "../../node_modules/.pnpm/pg@8.14.1/node_modules/pg/lib/crypto/utils-webcrypto.js"(exports, module2) {
1181
1186
  "use strict";
1182
- var nodeCrypto = (0, import_chunk_WWAWV7DQ.__require)("crypto");
1187
+ var nodeCrypto = (0, import_chunk_2ESYSVXG.__require)("crypto");
1183
1188
  module2.exports = {
1184
1189
  postgresMd5PasswordHash,
1185
1190
  randomBytes,
1186
1191
  deriveKey,
1187
1192
  sha256,
1193
+ hashByName,
1188
1194
  hmacSha256,
1189
1195
  md5
1190
1196
  };
@@ -1211,6 +1217,9 @@ var require_utils_webcrypto = (0, import_chunk_WWAWV7DQ.__commonJS)({
1211
1217
  async function sha256(text) {
1212
1218
  return await subtleCrypto.digest("SHA-256", text);
1213
1219
  }
1220
+ async function hashByName(hashName, text) {
1221
+ return await subtleCrypto.digest(hashName, text);
1222
+ }
1214
1223
  async function hmacSha256(keyBuffer, msg) {
1215
1224
  const key = await subtleCrypto.importKey("raw", keyBuffer, { name: "HMAC", hash: "SHA-256" }, false, ["sign"]);
1216
1225
  return await subtleCrypto.sign("HMAC", key, textEncoder.encode(msg));
@@ -1222,8 +1231,8 @@ var require_utils_webcrypto = (0, import_chunk_WWAWV7DQ.__commonJS)({
1222
1231
  }
1223
1232
  }
1224
1233
  });
1225
- var require_utils2 = (0, import_chunk_WWAWV7DQ.__commonJS)({
1226
- "../../node_modules/.pnpm/pg@8.13.3/node_modules/pg/lib/crypto/utils.js"(exports, module2) {
1234
+ var require_utils2 = (0, import_chunk_2ESYSVXG.__commonJS)({
1235
+ "../../node_modules/.pnpm/pg@8.14.1/node_modules/pg/lib/crypto/utils.js"(exports, module2) {
1227
1236
  "use strict";
1228
1237
  var useLegacyCrypto = parseInt(process.versions && process.versions.node && process.versions.node.split(".")[0]) < 15;
1229
1238
  if (useLegacyCrypto) {
@@ -1233,23 +1242,142 @@ var require_utils2 = (0, import_chunk_WWAWV7DQ.__commonJS)({
1233
1242
  }
1234
1243
  }
1235
1244
  });
1236
- var require_sasl = (0, import_chunk_WWAWV7DQ.__commonJS)({
1237
- "../../node_modules/.pnpm/pg@8.13.3/node_modules/pg/lib/crypto/sasl.js"(exports, module2) {
1245
+ var require_cert_signatures = (0, import_chunk_2ESYSVXG.__commonJS)({
1246
+ "../../node_modules/.pnpm/pg@8.14.1/node_modules/pg/lib/crypto/cert-signatures.js"(exports, module2) {
1247
+ "use strict";
1248
+ function x509Error(msg, cert) {
1249
+ throw new Error("SASL channel binding: " + msg + " when parsing public certificate " + cert.toString("base64"));
1250
+ }
1251
+ function readASN1Length(data, index) {
1252
+ let length = data[index++];
1253
+ if (length < 128) return { length, index };
1254
+ const lengthBytes = length & 127;
1255
+ if (lengthBytes > 4) x509Error("bad length", data);
1256
+ length = 0;
1257
+ for (let i = 0; i < lengthBytes; i++) {
1258
+ length = length << 8 | data[index++];
1259
+ }
1260
+ return { length, index };
1261
+ }
1262
+ function readASN1OID(data, index) {
1263
+ if (data[index++] !== 6) x509Error("non-OID data", data);
1264
+ const { length: OIDLength, index: indexAfterOIDLength } = readASN1Length(data, index);
1265
+ index = indexAfterOIDLength;
1266
+ lastIndex = index + OIDLength;
1267
+ const byte1 = data[index++];
1268
+ let oid = (byte1 / 40 >> 0) + "." + byte1 % 40;
1269
+ while (index < lastIndex) {
1270
+ let value = 0;
1271
+ while (index < lastIndex) {
1272
+ const nextByte = data[index++];
1273
+ value = value << 7 | nextByte & 127;
1274
+ if (nextByte < 128) break;
1275
+ }
1276
+ oid += "." + value;
1277
+ }
1278
+ return { oid, index };
1279
+ }
1280
+ function expectASN1Seq(data, index) {
1281
+ if (data[index++] !== 48) x509Error("non-sequence data", data);
1282
+ return readASN1Length(data, index);
1283
+ }
1284
+ function signatureAlgorithmHashFromCertificate(data, index) {
1285
+ if (index === void 0) index = 0;
1286
+ index = expectASN1Seq(data, index).index;
1287
+ const { length: certInfoLength, index: indexAfterCertInfoLength } = expectASN1Seq(data, index);
1288
+ index = indexAfterCertInfoLength + certInfoLength;
1289
+ index = expectASN1Seq(data, index).index;
1290
+ const { oid, index: indexAfterOID } = readASN1OID(data, index);
1291
+ switch (oid) {
1292
+ // RSA
1293
+ case "1.2.840.113549.1.1.4":
1294
+ return "MD5";
1295
+ case "1.2.840.113549.1.1.5":
1296
+ return "SHA-1";
1297
+ case "1.2.840.113549.1.1.11":
1298
+ return "SHA-256";
1299
+ case "1.2.840.113549.1.1.12":
1300
+ return "SHA-384";
1301
+ case "1.2.840.113549.1.1.13":
1302
+ return "SHA-512";
1303
+ case "1.2.840.113549.1.1.14":
1304
+ return "SHA-224";
1305
+ case "1.2.840.113549.1.1.15":
1306
+ return "SHA512-224";
1307
+ case "1.2.840.113549.1.1.16":
1308
+ return "SHA512-256";
1309
+ // ECDSA
1310
+ case "1.2.840.10045.4.1":
1311
+ return "SHA-1";
1312
+ case "1.2.840.10045.4.3.1":
1313
+ return "SHA-224";
1314
+ case "1.2.840.10045.4.3.2":
1315
+ return "SHA-256";
1316
+ case "1.2.840.10045.4.3.3":
1317
+ return "SHA-384";
1318
+ case "1.2.840.10045.4.3.4":
1319
+ return "SHA-512";
1320
+ // RSASSA-PSS: hash is indicated separately
1321
+ case "1.2.840.113549.1.1.10":
1322
+ index = indexAfterOID;
1323
+ index = expectASN1Seq(data, index).index;
1324
+ if (data[index++] !== 160) x509Error("non-tag data", data);
1325
+ index = readASN1Length(data, index).index;
1326
+ index = expectASN1Seq(data, index).index;
1327
+ const { oid: hashOID } = readASN1OID(data, index);
1328
+ switch (hashOID) {
1329
+ // standalone hash OIDs
1330
+ case "1.2.840.113549.2.5":
1331
+ return "MD5";
1332
+ case "1.3.14.3.2.26":
1333
+ return "SHA-1";
1334
+ case "2.16.840.1.101.3.4.2.1":
1335
+ return "SHA-256";
1336
+ case "2.16.840.1.101.3.4.2.2":
1337
+ return "SHA-384";
1338
+ case "2.16.840.1.101.3.4.2.3":
1339
+ return "SHA-512";
1340
+ }
1341
+ x509Error("unknown hash OID " + hashOID, data);
1342
+ // Ed25519 -- see https: return//github.com/openssl/openssl/issues/15477
1343
+ case "1.3.101.110":
1344
+ case "1.3.101.112":
1345
+ return "SHA-512";
1346
+ // Ed448 -- still not in pg 17.2 (if supported, digest would be SHAKE256 x 64 bytes)
1347
+ case "1.3.101.111":
1348
+ case "1.3.101.113":
1349
+ x509Error("Ed448 certificate channel binding is not currently supported by Postgres");
1350
+ }
1351
+ x509Error("unknown OID " + oid, data);
1352
+ }
1353
+ module2.exports = { signatureAlgorithmHashFromCertificate };
1354
+ }
1355
+ });
1356
+ var require_sasl = (0, import_chunk_2ESYSVXG.__commonJS)({
1357
+ "../../node_modules/.pnpm/pg@8.14.1/node_modules/pg/lib/crypto/sasl.js"(exports, module2) {
1238
1358
  "use strict";
1239
1359
  var crypto = require_utils2();
1240
- function startSession(mechanisms) {
1241
- if (mechanisms.indexOf("SCRAM-SHA-256") === -1) {
1242
- throw new Error("SASL: Only mechanism SCRAM-SHA-256 is currently supported");
1360
+ var { signatureAlgorithmHashFromCertificate } = require_cert_signatures();
1361
+ function startSession(mechanisms, stream) {
1362
+ const candidates = ["SCRAM-SHA-256"];
1363
+ if (stream) candidates.unshift("SCRAM-SHA-256-PLUS");
1364
+ const mechanism = candidates.find((candidate) => mechanisms.includes(candidate));
1365
+ if (!mechanism) {
1366
+ throw new Error("SASL: Only mechanism(s) " + candidates.join(" and ") + " are supported");
1367
+ }
1368
+ if (mechanism === "SCRAM-SHA-256-PLUS" && typeof stream.getPeerCertificate !== "function") {
1369
+ throw new Error("SASL: Mechanism SCRAM-SHA-256-PLUS requires a certificate");
1243
1370
  }
1244
1371
  const clientNonce = crypto.randomBytes(18).toString("base64");
1372
+ const gs2Header = mechanism === "SCRAM-SHA-256-PLUS" ? "p=tls-server-end-point" : stream ? "y" : "n";
1245
1373
  return {
1246
- mechanism: "SCRAM-SHA-256",
1374
+ mechanism,
1247
1375
  clientNonce,
1248
- response: "n,,n=*,r=" + clientNonce,
1376
+ response: gs2Header + ",,n=*,r=" + clientNonce,
1249
1377
  message: "SASLInitialResponse"
1250
1378
  };
1251
1379
  }
1252
- async function continueSession(session, password, serverData) {
1380
+ async function continueSession(session, password, serverData, stream) {
1253
1381
  if (session.message !== "SASLInitialResponse") {
1254
1382
  throw new Error("SASL: Last message was not SASLInitialResponse");
1255
1383
  }
@@ -1270,7 +1398,16 @@ var require_sasl = (0, import_chunk_WWAWV7DQ.__commonJS)({
1270
1398
  }
1271
1399
  var clientFirstMessageBare = "n=*,r=" + session.clientNonce;
1272
1400
  var serverFirstMessage = "r=" + sv.nonce + ",s=" + sv.salt + ",i=" + sv.iteration;
1273
- var clientFinalMessageWithoutProof = "c=biws,r=" + sv.nonce;
1401
+ let channelBinding = stream ? "eSws" : "biws";
1402
+ if (session.mechanism === "SCRAM-SHA-256-PLUS") {
1403
+ const peerCert = stream.getPeerCertificate().raw;
1404
+ let hashName = signatureAlgorithmHashFromCertificate(peerCert);
1405
+ if (hashName === "MD5" || hashName === "SHA-1") hashName = "SHA-256";
1406
+ const certHash = await crypto.hashByName(hashName, peerCert);
1407
+ const bindingData = Buffer.concat([Buffer.from("p=tls-server-end-point,,"), Buffer.from(certHash)]);
1408
+ channelBinding = bindingData.toString("base64");
1409
+ }
1410
+ var clientFinalMessageWithoutProof = "c=" + channelBinding + ",r=" + sv.nonce;
1274
1411
  var authMessage = clientFirstMessageBare + "," + serverFirstMessage + "," + clientFinalMessageWithoutProof;
1275
1412
  var saltBytes = Buffer.from(sv.salt, "base64");
1276
1413
  var saltedPassword = await crypto.deriveKey(password, saltBytes, sv.iteration);
@@ -1381,8 +1518,8 @@ var require_sasl = (0, import_chunk_WWAWV7DQ.__commonJS)({
1381
1518
  };
1382
1519
  }
1383
1520
  });
1384
- var require_type_overrides = (0, import_chunk_WWAWV7DQ.__commonJS)({
1385
- "../../node_modules/.pnpm/pg@8.13.3/node_modules/pg/lib/type-overrides.js"(exports, module2) {
1521
+ var require_type_overrides = (0, import_chunk_2ESYSVXG.__commonJS)({
1522
+ "../../node_modules/.pnpm/pg@8.14.1/node_modules/pg/lib/type-overrides.js"(exports, module2) {
1386
1523
  "use strict";
1387
1524
  var types = require_pg_types();
1388
1525
  function TypeOverrides(userTypes) {
@@ -1414,7 +1551,7 @@ var require_type_overrides = (0, import_chunk_WWAWV7DQ.__commonJS)({
1414
1551
  module2.exports = TypeOverrides;
1415
1552
  }
1416
1553
  });
1417
- var require_pg_connection_string = (0, import_chunk_WWAWV7DQ.__commonJS)({
1554
+ var require_pg_connection_string = (0, import_chunk_2ESYSVXG.__commonJS)({
1418
1555
  "../../node_modules/.pnpm/pg-connection-string@2.7.0/node_modules/pg-connection-string/index.js"(exports, module2) {
1419
1556
  "use strict";
1420
1557
  function parse(str) {
@@ -1465,7 +1602,7 @@ var require_pg_connection_string = (0, import_chunk_WWAWV7DQ.__commonJS)({
1465
1602
  if (config.sslcert || config.sslkey || config.sslrootcert || config.sslmode) {
1466
1603
  config.ssl = {};
1467
1604
  }
1468
- const fs = config.sslcert || config.sslkey || config.sslrootcert ? (0, import_chunk_WWAWV7DQ.__require)("fs") : null;
1605
+ const fs = config.sslcert || config.sslkey || config.sslrootcert ? (0, import_chunk_2ESYSVXG.__require)("fs") : null;
1469
1606
  if (config.sslcert) {
1470
1607
  config.ssl.cert = fs.readFileSync(config.sslcert).toString();
1471
1608
  }
@@ -1497,10 +1634,10 @@ var require_pg_connection_string = (0, import_chunk_WWAWV7DQ.__commonJS)({
1497
1634
  parse.parse = parse;
1498
1635
  }
1499
1636
  });
1500
- var require_connection_parameters = (0, import_chunk_WWAWV7DQ.__commonJS)({
1501
- "../../node_modules/.pnpm/pg@8.13.3/node_modules/pg/lib/connection-parameters.js"(exports, module2) {
1637
+ var require_connection_parameters = (0, import_chunk_2ESYSVXG.__commonJS)({
1638
+ "../../node_modules/.pnpm/pg@8.14.1/node_modules/pg/lib/connection-parameters.js"(exports, module2) {
1502
1639
  "use strict";
1503
- var dns = (0, import_chunk_WWAWV7DQ.__require)("dns");
1640
+ var dns = (0, import_chunk_2ESYSVXG.__require)("dns");
1504
1641
  var defaults = require_defaults();
1505
1642
  var parse = require_pg_connection_string().parse;
1506
1643
  var val = function(key, config, envVar) {
@@ -1633,8 +1770,8 @@ var require_connection_parameters = (0, import_chunk_WWAWV7DQ.__commonJS)({
1633
1770
  module2.exports = ConnectionParameters;
1634
1771
  }
1635
1772
  });
1636
- var require_result = (0, import_chunk_WWAWV7DQ.__commonJS)({
1637
- "../../node_modules/.pnpm/pg@8.13.3/node_modules/pg/lib/result.js"(exports, module2) {
1773
+ var require_result = (0, import_chunk_2ESYSVXG.__commonJS)({
1774
+ "../../node_modules/.pnpm/pg@8.14.1/node_modules/pg/lib/result.js"(exports, module2) {
1638
1775
  "use strict";
1639
1776
  var types = require_pg_types();
1640
1777
  var matchRegexp = /^([A-Za-z]+)(?: (\d+))?(?: (\d+))?/;
@@ -1721,10 +1858,10 @@ var require_result = (0, import_chunk_WWAWV7DQ.__commonJS)({
1721
1858
  module2.exports = Result;
1722
1859
  }
1723
1860
  });
1724
- var require_query = (0, import_chunk_WWAWV7DQ.__commonJS)({
1725
- "../../node_modules/.pnpm/pg@8.13.3/node_modules/pg/lib/query.js"(exports, module2) {
1861
+ var require_query = (0, import_chunk_2ESYSVXG.__commonJS)({
1862
+ "../../node_modules/.pnpm/pg@8.14.1/node_modules/pg/lib/query.js"(exports, module2) {
1726
1863
  "use strict";
1727
- var { EventEmitter } = (0, import_chunk_WWAWV7DQ.__require)("events");
1864
+ var { EventEmitter } = (0, import_chunk_2ESYSVXG.__require)("events");
1728
1865
  var Result = require_result();
1729
1866
  var utils = require_utils();
1730
1867
  var Query = class extends EventEmitter {
@@ -1852,7 +1989,12 @@ var require_query = (0, import_chunk_WWAWV7DQ.__commonJS)({
1852
1989
  return new Error("Query values must be an array");
1853
1990
  }
1854
1991
  if (this.requiresPreparation()) {
1855
- this.prepare(connection);
1992
+ connection.stream.cork && connection.stream.cork();
1993
+ try {
1994
+ this.prepare(connection);
1995
+ } finally {
1996
+ connection.stream.uncork && connection.stream.uncork();
1997
+ }
1856
1998
  } else {
1857
1999
  connection.query(this.text);
1858
2000
  }
@@ -1912,8 +2054,8 @@ var require_query = (0, import_chunk_WWAWV7DQ.__commonJS)({
1912
2054
  module2.exports = Query;
1913
2055
  }
1914
2056
  });
1915
- var require_messages = (0, import_chunk_WWAWV7DQ.__commonJS)({
1916
- "../../node_modules/.pnpm/pg-protocol@1.7.1/node_modules/pg-protocol/dist/messages.js"(exports) {
2057
+ 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) {
1917
2059
  "use strict";
1918
2060
  Object.defineProperty(exports, "__esModule", { value: true });
1919
2061
  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;
@@ -2075,8 +2217,8 @@ var require_messages = (0, import_chunk_WWAWV7DQ.__commonJS)({
2075
2217
  exports.NoticeMessage = NoticeMessage;
2076
2218
  }
2077
2219
  });
2078
- var require_buffer_writer = (0, import_chunk_WWAWV7DQ.__commonJS)({
2079
- "../../node_modules/.pnpm/pg-protocol@1.7.1/node_modules/pg-protocol/dist/buffer-writer.js"(exports) {
2220
+ 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) {
2080
2222
  "use strict";
2081
2223
  Object.defineProperty(exports, "__esModule", { value: true });
2082
2224
  exports.Writer = void 0;
@@ -2154,8 +2296,8 @@ var require_buffer_writer = (0, import_chunk_WWAWV7DQ.__commonJS)({
2154
2296
  exports.Writer = Writer;
2155
2297
  }
2156
2298
  });
2157
- var require_serializer = (0, import_chunk_WWAWV7DQ.__commonJS)({
2158
- "../../node_modules/.pnpm/pg-protocol@1.7.1/node_modules/pg-protocol/dist/serializer.js"(exports) {
2299
+ 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) {
2159
2301
  "use strict";
2160
2302
  Object.defineProperty(exports, "__esModule", { value: true });
2161
2303
  exports.serialize = void 0;
@@ -2368,8 +2510,8 @@ var require_serializer = (0, import_chunk_WWAWV7DQ.__commonJS)({
2368
2510
  exports.serialize = serialize;
2369
2511
  }
2370
2512
  });
2371
- var require_buffer_reader = (0, import_chunk_WWAWV7DQ.__commonJS)({
2372
- "../../node_modules/.pnpm/pg-protocol@1.7.1/node_modules/pg-protocol/dist/buffer-reader.js"(exports) {
2513
+ 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) {
2373
2515
  "use strict";
2374
2516
  Object.defineProperty(exports, "__esModule", { value: true });
2375
2517
  exports.BufferReader = void 0;
@@ -2426,8 +2568,8 @@ var require_buffer_reader = (0, import_chunk_WWAWV7DQ.__commonJS)({
2426
2568
  exports.BufferReader = BufferReader;
2427
2569
  }
2428
2570
  });
2429
- var require_parser = (0, import_chunk_WWAWV7DQ.__commonJS)({
2430
- "../../node_modules/.pnpm/pg-protocol@1.7.1/node_modules/pg-protocol/dist/parser.js"(exports) {
2571
+ 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) {
2431
2573
  "use strict";
2432
2574
  Object.defineProperty(exports, "__esModule", { value: true });
2433
2575
  exports.Parser = void 0;
@@ -2715,8 +2857,8 @@ var require_parser = (0, import_chunk_WWAWV7DQ.__commonJS)({
2715
2857
  exports.Parser = Parser;
2716
2858
  }
2717
2859
  });
2718
- var require_dist = (0, import_chunk_WWAWV7DQ.__commonJS)({
2719
- "../../node_modules/.pnpm/pg-protocol@1.7.1/node_modules/pg-protocol/dist/index.js"(exports) {
2860
+ 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) {
2720
2862
  "use strict";
2721
2863
  Object.defineProperty(exports, "__esModule", { value: true });
2722
2864
  exports.DatabaseError = exports.serialize = exports.parse = void 0;
@@ -2738,18 +2880,18 @@ var require_dist = (0, import_chunk_WWAWV7DQ.__commonJS)({
2738
2880
  }
2739
2881
  });
2740
2882
  var empty_exports = {};
2741
- (0, import_chunk_WWAWV7DQ.__export)(empty_exports, {
2883
+ (0, import_chunk_2ESYSVXG.__export)(empty_exports, {
2742
2884
  default: () => empty_default
2743
2885
  });
2744
2886
  var empty_default;
2745
- var init_empty = (0, import_chunk_WWAWV7DQ.__esm)({
2887
+ var init_empty = (0, import_chunk_2ESYSVXG.__esm)({
2746
2888
  "../../node_modules/.pnpm/pg-cloudflare@1.1.1/node_modules/pg-cloudflare/dist/empty.js"() {
2747
2889
  "use strict";
2748
2890
  empty_default = {};
2749
2891
  }
2750
2892
  });
2751
- var require_stream = (0, import_chunk_WWAWV7DQ.__commonJS)({
2752
- "../../node_modules/.pnpm/pg@8.13.3/node_modules/pg/lib/stream.js"(exports, module2) {
2893
+ var require_stream = (0, import_chunk_2ESYSVXG.__commonJS)({
2894
+ "../../node_modules/.pnpm/pg@8.14.1/node_modules/pg/lib/stream.js"(exports, module2) {
2753
2895
  "use strict";
2754
2896
  var { getStream, getSecureStream } = getStreamFuncs();
2755
2897
  module2.exports = {
@@ -2767,11 +2909,11 @@ var require_stream = (0, import_chunk_WWAWV7DQ.__commonJS)({
2767
2909
  };
2768
2910
  function getNodejsStreamFuncs() {
2769
2911
  function getStream2(ssl) {
2770
- const net = (0, import_chunk_WWAWV7DQ.__require)("net");
2912
+ const net = (0, import_chunk_2ESYSVXG.__require)("net");
2771
2913
  return new net.Socket();
2772
2914
  }
2773
2915
  function getSecureStream2(options) {
2774
- var tls = (0, import_chunk_WWAWV7DQ.__require)("tls");
2916
+ var tls = (0, import_chunk_2ESYSVXG.__require)("tls");
2775
2917
  return tls.connect(options);
2776
2918
  }
2777
2919
  return {
@@ -2781,7 +2923,7 @@ var require_stream = (0, import_chunk_WWAWV7DQ.__commonJS)({
2781
2923
  }
2782
2924
  function getCloudflareStreamFuncs() {
2783
2925
  function getStream2(ssl) {
2784
- const { CloudflareSocket } = (init_empty(), (0, import_chunk_WWAWV7DQ.__toCommonJS)(empty_exports));
2926
+ const { CloudflareSocket } = (init_empty(), (0, import_chunk_2ESYSVXG.__toCommonJS)(empty_exports));
2785
2927
  return new CloudflareSocket(ssl);
2786
2928
  }
2787
2929
  function getSecureStream2(options) {
@@ -2813,10 +2955,10 @@ var require_stream = (0, import_chunk_WWAWV7DQ.__commonJS)({
2813
2955
  }
2814
2956
  }
2815
2957
  });
2816
- var require_connection = (0, import_chunk_WWAWV7DQ.__commonJS)({
2817
- "../../node_modules/.pnpm/pg@8.13.3/node_modules/pg/lib/connection.js"(exports, module2) {
2958
+ var require_connection = (0, import_chunk_2ESYSVXG.__commonJS)({
2959
+ "../../node_modules/.pnpm/pg@8.14.1/node_modules/pg/lib/connection.js"(exports, module2) {
2818
2960
  "use strict";
2819
- var EventEmitter = (0, import_chunk_WWAWV7DQ.__require)("events").EventEmitter;
2961
+ var EventEmitter = (0, import_chunk_2ESYSVXG.__require)("events").EventEmitter;
2820
2962
  var { parse, serialize } = require_dist();
2821
2963
  var { getStream, getSecureStream } = require_stream();
2822
2964
  var flushBuffer = serialize.flush();
@@ -2889,7 +3031,7 @@ var require_connection = (0, import_chunk_WWAWV7DQ.__commonJS)({
2889
3031
  options.key = self.ssl.key;
2890
3032
  }
2891
3033
  }
2892
- var net = (0, import_chunk_WWAWV7DQ.__require)("net");
3034
+ var net = (0, import_chunk_2ESYSVXG.__require)("net");
2893
3035
  if (net.isIP && net.isIP(host) === 0) {
2894
3036
  options.servername = host;
2895
3037
  }
@@ -2995,11 +3137,11 @@ var require_connection = (0, import_chunk_WWAWV7DQ.__commonJS)({
2995
3137
  module2.exports = Connection;
2996
3138
  }
2997
3139
  });
2998
- var require_split2 = (0, import_chunk_WWAWV7DQ.__commonJS)({
3140
+ var require_split2 = (0, import_chunk_2ESYSVXG.__commonJS)({
2999
3141
  "../../node_modules/.pnpm/split2@4.2.0/node_modules/split2/index.js"(exports, module2) {
3000
3142
  "use strict";
3001
- var { Transform } = (0, import_chunk_WWAWV7DQ.__require)("stream");
3002
- var { StringDecoder } = (0, import_chunk_WWAWV7DQ.__require)("string_decoder");
3143
+ var { Transform } = (0, import_chunk_2ESYSVXG.__require)("stream");
3144
+ var { StringDecoder } = (0, import_chunk_2ESYSVXG.__require)("string_decoder");
3003
3145
  var kLast = Symbol("last");
3004
3146
  var kDecoder = Symbol("decoder");
3005
3147
  function transform(chunk, enc, cb) {
@@ -3094,13 +3236,13 @@ var require_split2 = (0, import_chunk_WWAWV7DQ.__commonJS)({
3094
3236
  module2.exports = split;
3095
3237
  }
3096
3238
  });
3097
- var require_helper = (0, import_chunk_WWAWV7DQ.__commonJS)({
3239
+ var require_helper = (0, import_chunk_2ESYSVXG.__commonJS)({
3098
3240
  "../../node_modules/.pnpm/pgpass@1.0.5/node_modules/pgpass/lib/helper.js"(exports, module2) {
3099
3241
  "use strict";
3100
- var path = (0, import_chunk_WWAWV7DQ.__require)("path");
3101
- var Stream = (0, import_chunk_WWAWV7DQ.__require)("stream").Stream;
3242
+ var path = (0, import_chunk_2ESYSVXG.__require)("path");
3243
+ var Stream = (0, import_chunk_2ESYSVXG.__require)("stream").Stream;
3102
3244
  var split = require_split2();
3103
- var util = (0, import_chunk_WWAWV7DQ.__require)("util");
3245
+ var util = (0, import_chunk_2ESYSVXG.__require)("util");
3104
3246
  var defaultPort = 5432;
3105
3247
  var isWin = process.platform === "win32";
3106
3248
  var warnStream = process.stderr;
@@ -3263,11 +3405,11 @@ var require_helper = (0, import_chunk_WWAWV7DQ.__commonJS)({
3263
3405
  };
3264
3406
  }
3265
3407
  });
3266
- var require_lib = (0, import_chunk_WWAWV7DQ.__commonJS)({
3408
+ var require_lib = (0, import_chunk_2ESYSVXG.__commonJS)({
3267
3409
  "../../node_modules/.pnpm/pgpass@1.0.5/node_modules/pgpass/lib/index.js"(exports, module2) {
3268
3410
  "use strict";
3269
- var path = (0, import_chunk_WWAWV7DQ.__require)("path");
3270
- var fs = (0, import_chunk_WWAWV7DQ.__require)("fs");
3411
+ var path = (0, import_chunk_2ESYSVXG.__require)("path");
3412
+ var fs = (0, import_chunk_2ESYSVXG.__require)("fs");
3271
3413
  var helper = require_helper();
3272
3414
  module2.exports = function(connInfo, cb) {
3273
3415
  var file = helper.getFileName();
@@ -3282,10 +3424,10 @@ var require_lib = (0, import_chunk_WWAWV7DQ.__commonJS)({
3282
3424
  module2.exports.warnTo = helper.warnTo;
3283
3425
  }
3284
3426
  });
3285
- var require_client = (0, import_chunk_WWAWV7DQ.__commonJS)({
3286
- "../../node_modules/.pnpm/pg@8.13.3/node_modules/pg/lib/client.js"(exports, module2) {
3427
+ var require_client = (0, import_chunk_2ESYSVXG.__commonJS)({
3428
+ "../../node_modules/.pnpm/pg@8.14.1/node_modules/pg/lib/client.js"(exports, module2) {
3287
3429
  "use strict";
3288
- var EventEmitter = (0, import_chunk_WWAWV7DQ.__require)("events").EventEmitter;
3430
+ var EventEmitter = (0, import_chunk_2ESYSVXG.__require)("events").EventEmitter;
3289
3431
  var utils = require_utils();
3290
3432
  var sasl = require_sasl();
3291
3433
  var TypeOverrides = require_type_overrides();
@@ -3318,6 +3460,7 @@ var require_client = (0, import_chunk_WWAWV7DQ.__commonJS)({
3318
3460
  this._connected = false;
3319
3461
  this._connectionError = false;
3320
3462
  this._queryable = true;
3463
+ this.enableChannelBinding = Boolean(c.enableChannelBinding);
3321
3464
  this.connection = c.connection || new Connection({
3322
3465
  stream: c.stream,
3323
3466
  ssl: this.connectionParameters.ssl,
@@ -3367,6 +3510,9 @@ var require_client = (0, import_chunk_WWAWV7DQ.__commonJS)({
3367
3510
  con._ending = true;
3368
3511
  con.stream.destroy(new Error("timeout expired"));
3369
3512
  }, this._connectionTimeoutMillis);
3513
+ if (this.connectionTimeoutHandle.unref) {
3514
+ this.connectionTimeoutHandle.unref();
3515
+ }
3370
3516
  }
3371
3517
  if (this.host && this.host.indexOf("/") === 0) {
3372
3518
  con.connect(this.host + "/.s.PGSQL." + this.port);
@@ -3494,7 +3640,7 @@ var require_client = (0, import_chunk_WWAWV7DQ.__commonJS)({
3494
3640
  _handleAuthSASL(msg) {
3495
3641
  this._checkPgPass(() => {
3496
3642
  try {
3497
- this.saslSession = sasl.startSession(msg.mechanisms);
3643
+ this.saslSession = sasl.startSession(msg.mechanisms, this.enableChannelBinding && this.connection.stream);
3498
3644
  this.connection.sendSASLInitialResponseMessage(this.saslSession.mechanism, this.saslSession.response);
3499
3645
  } catch (err) {
3500
3646
  this.connection.emit("error", err);
@@ -3503,7 +3649,12 @@ var require_client = (0, import_chunk_WWAWV7DQ.__commonJS)({
3503
3649
  }
3504
3650
  async _handleAuthSASLContinue(msg) {
3505
3651
  try {
3506
- await sasl.continueSession(this.saslSession, this.password, msg.data);
3652
+ await sasl.continueSession(
3653
+ this.saslSession,
3654
+ this.password,
3655
+ msg.data,
3656
+ this.enableChannelBinding && this.connection.stream
3657
+ );
3507
3658
  this.connection.sendSCRAMClientFinalMessage(this.saslSession.response);
3508
3659
  } catch (err) {
3509
3660
  this.connection.emit("error", err);
@@ -3798,10 +3949,10 @@ var require_client = (0, import_chunk_WWAWV7DQ.__commonJS)({
3798
3949
  module2.exports = Client;
3799
3950
  }
3800
3951
  });
3801
- var require_pg_pool = (0, import_chunk_WWAWV7DQ.__commonJS)({
3802
- "../../node_modules/.pnpm/pg-pool@3.7.1_pg@8.13.3/node_modules/pg-pool/index.js"(exports, module2) {
3952
+ 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) {
3803
3954
  "use strict";
3804
- var EventEmitter = (0, import_chunk_WWAWV7DQ.__require)("events").EventEmitter;
3955
+ var EventEmitter = (0, import_chunk_2ESYSVXG.__require)("events").EventEmitter;
3805
3956
  var NOOP = function() {
3806
3957
  };
3807
3958
  var removeWhere = (list, predicate) => {
@@ -3965,6 +4116,9 @@ var require_pg_pool = (0, import_chunk_WWAWV7DQ.__commonJS)({
3965
4116
  pendingItem.timedOut = true;
3966
4117
  response.callback(new Error("timeout exceeded when trying to connect"));
3967
4118
  }, this.options.connectionTimeoutMillis);
4119
+ if (tid.unref) {
4120
+ tid.unref();
4121
+ }
3968
4122
  this._pendingQueue.push(pendingItem);
3969
4123
  return result;
3970
4124
  }
@@ -4179,11 +4333,11 @@ var require_pg_pool = (0, import_chunk_WWAWV7DQ.__commonJS)({
4179
4333
  module2.exports = Pool;
4180
4334
  }
4181
4335
  });
4182
- var require_query2 = (0, import_chunk_WWAWV7DQ.__commonJS)({
4183
- "../../node_modules/.pnpm/pg@8.13.3/node_modules/pg/lib/native/query.js"(exports, module2) {
4336
+ var require_query2 = (0, import_chunk_2ESYSVXG.__commonJS)({
4337
+ "../../node_modules/.pnpm/pg@8.14.1/node_modules/pg/lib/native/query.js"(exports, module2) {
4184
4338
  "use strict";
4185
- var EventEmitter = (0, import_chunk_WWAWV7DQ.__require)("events").EventEmitter;
4186
- var util = (0, import_chunk_WWAWV7DQ.__require)("util");
4339
+ var EventEmitter = (0, import_chunk_2ESYSVXG.__require)("events").EventEmitter;
4340
+ var util = (0, import_chunk_2ESYSVXG.__require)("util");
4187
4341
  var utils = require_utils();
4188
4342
  var NativeQuery = module2.exports = function(config, values, callback) {
4189
4343
  EventEmitter.call(this);
@@ -4319,18 +4473,18 @@ var require_query2 = (0, import_chunk_WWAWV7DQ.__commonJS)({
4319
4473
  };
4320
4474
  }
4321
4475
  });
4322
- var require_client2 = (0, import_chunk_WWAWV7DQ.__commonJS)({
4323
- "../../node_modules/.pnpm/pg@8.13.3/node_modules/pg/lib/native/client.js"(exports, module2) {
4476
+ var require_client2 = (0, import_chunk_2ESYSVXG.__commonJS)({
4477
+ "../../node_modules/.pnpm/pg@8.14.1/node_modules/pg/lib/native/client.js"(exports, module2) {
4324
4478
  "use strict";
4325
4479
  var Native;
4326
4480
  try {
4327
- Native = (0, import_chunk_WWAWV7DQ.__require)("pg-native");
4481
+ Native = (0, import_chunk_2ESYSVXG.__require)("pg-native");
4328
4482
  } catch (e) {
4329
4483
  throw e;
4330
4484
  }
4331
4485
  var TypeOverrides = require_type_overrides();
4332
- var EventEmitter = (0, import_chunk_WWAWV7DQ.__require)("events").EventEmitter;
4333
- var util = (0, import_chunk_WWAWV7DQ.__require)("util");
4486
+ var EventEmitter = (0, import_chunk_2ESYSVXG.__require)("events").EventEmitter;
4487
+ var util = (0, import_chunk_2ESYSVXG.__require)("util");
4334
4488
  var ConnectionParameters = require_connection_parameters();
4335
4489
  var NativeQuery = require_query2();
4336
4490
  var Client = module2.exports = function(config) {
@@ -4557,14 +4711,14 @@ var require_client2 = (0, import_chunk_WWAWV7DQ.__commonJS)({
4557
4711
  };
4558
4712
  }
4559
4713
  });
4560
- var require_native = (0, import_chunk_WWAWV7DQ.__commonJS)({
4561
- "../../node_modules/.pnpm/pg@8.13.3/node_modules/pg/lib/native/index.js"(exports, module2) {
4714
+ var require_native = (0, import_chunk_2ESYSVXG.__commonJS)({
4715
+ "../../node_modules/.pnpm/pg@8.14.1/node_modules/pg/lib/native/index.js"(exports, module2) {
4562
4716
  "use strict";
4563
4717
  module2.exports = require_client2();
4564
4718
  }
4565
4719
  });
4566
- var require_lib2 = (0, import_chunk_WWAWV7DQ.__commonJS)({
4567
- "../../node_modules/.pnpm/pg@8.13.3/node_modules/pg/lib/index.js"(exports, module2) {
4720
+ var require_lib2 = (0, import_chunk_2ESYSVXG.__commonJS)({
4721
+ "../../node_modules/.pnpm/pg@8.14.1/node_modules/pg/lib/index.js"(exports, module2) {
4568
4722
  "use strict";
4569
4723
  var Client = require_client();
4570
4724
  var defaults = require_defaults();