@prisma/adapter-pg 7.11.0-dev.5 → 7.11.0-dev.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -634,6 +634,13 @@ function isTlsError(error) {
634
634
  // src/pg.ts
635
635
  var types2 = import_pg2.default.types;
636
636
  var debug = (0, import_driver_adapter_utils2.Debug)("prisma:driver-adapter:pg");
637
+ function isPgPoolLike(poolOrConfig) {
638
+ if (typeof poolOrConfig !== "object" || poolOrConfig === null) {
639
+ return false;
640
+ }
641
+ const candidate = poolOrConfig;
642
+ return typeof candidate.query === "function" && typeof candidate.connect === "function" && typeof candidate.end === "function" && typeof candidate.on === "function" && typeof candidate.removeListener === "function" && typeof candidate.options === "object" && candidate.options !== null;
643
+ }
637
644
  var PgQueryable = class {
638
645
  constructor(client, pgOptions) {
639
646
  this.client = client;
@@ -847,7 +854,7 @@ var PrismaPgAdapter = class extends PgQueryable {
847
854
  var PrismaPgAdapterFactory = class {
848
855
  constructor(poolOrConfig, options) {
849
856
  this.options = options;
850
- if (poolOrConfig instanceof import_pg2.default.Pool) {
857
+ if (isPgPoolLike(poolOrConfig)) {
851
858
  this.externalPool = poolOrConfig;
852
859
  this.config = poolOrConfig.options;
853
860
  } else if (typeof poolOrConfig === "string") {
package/dist/index.mjs CHANGED
@@ -598,6 +598,13 @@ function isTlsError(error) {
598
598
  // src/pg.ts
599
599
  var types2 = pg2.types;
600
600
  var debug = Debug("prisma:driver-adapter:pg");
601
+ function isPgPoolLike(poolOrConfig) {
602
+ if (typeof poolOrConfig !== "object" || poolOrConfig === null) {
603
+ return false;
604
+ }
605
+ const candidate = poolOrConfig;
606
+ return typeof candidate.query === "function" && typeof candidate.connect === "function" && typeof candidate.end === "function" && typeof candidate.on === "function" && typeof candidate.removeListener === "function" && typeof candidate.options === "object" && candidate.options !== null;
607
+ }
601
608
  var PgQueryable = class {
602
609
  constructor(client, pgOptions) {
603
610
  this.client = client;
@@ -811,7 +818,7 @@ var PrismaPgAdapter = class extends PgQueryable {
811
818
  var PrismaPgAdapterFactory = class {
812
819
  constructor(poolOrConfig, options) {
813
820
  this.options = options;
814
- if (poolOrConfig instanceof pg2.Pool) {
821
+ if (isPgPoolLike(poolOrConfig)) {
815
822
  this.externalPool = poolOrConfig;
816
823
  this.config = poolOrConfig.options;
817
824
  } else if (typeof poolOrConfig === "string") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/adapter-pg",
3
- "version": "7.11.0-dev.5",
3
+ "version": "7.11.0-dev.7",
4
4
  "description": "Prisma's driver adapter for \"pg\"",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -34,10 +34,10 @@
34
34
  "pg": "^8.16.3",
35
35
  "postgres-array": "3.0.4",
36
36
  "@types/pg": "^8.16.0",
37
- "@prisma/driver-adapter-utils": "7.11.0-dev.5"
37
+ "@prisma/driver-adapter-utils": "7.11.0-dev.7"
38
38
  },
39
39
  "devDependencies": {
40
- "@prisma/debug": "7.11.0-dev.5"
40
+ "@prisma/debug": "7.11.0-dev.7"
41
41
  },
42
42
  "scripts": {
43
43
  "dev": "DEV=true tsx helpers/build.ts",