@prisma/adapter-pg 7.11.0-dev.2 → 7.11.0-dev.3
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.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +1 -28
- package/dist/index.mjs +1 -28
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -57,11 +57,11 @@ declare class PrismaPgAdapter extends PgQueryable<StdClient> implements SqlDrive
|
|
|
57
57
|
|
|
58
58
|
declare type PrismaPgOptions = {
|
|
59
59
|
/**
|
|
60
|
-
* The name of the schema to use in generated queries.
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
60
|
+
* The name of the schema to use in generated queries. Raw queries are not affected: they resolve
|
|
61
|
+
* unqualified names through the connection's `search_path`. Qualify the name in raw SQL
|
|
62
|
+
* (`"mySchema"."User"`), or set the search path on the database role
|
|
63
|
+
* (`ALTER ROLE ... SET search_path = ...`). The adapter does not set it itself, because behind a
|
|
64
|
+
* connection pooler in transaction mode a session setting is shared with the pooler's other clients.
|
|
65
65
|
*/
|
|
66
66
|
schema?: string;
|
|
67
67
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -57,11 +57,11 @@ declare class PrismaPgAdapter extends PgQueryable<StdClient> implements SqlDrive
|
|
|
57
57
|
|
|
58
58
|
declare type PrismaPgOptions = {
|
|
59
59
|
/**
|
|
60
|
-
* The name of the schema to use in generated queries.
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
60
|
+
* The name of the schema to use in generated queries. Raw queries are not affected: they resolve
|
|
61
|
+
* unqualified names through the connection's `search_path`. Qualify the name in raw SQL
|
|
62
|
+
* (`"mySchema"."User"`), or set the search path on the database role
|
|
63
|
+
* (`ALTER ROLE ... SET search_path = ...`). The adapter does not set it itself, because behind a
|
|
64
|
+
* connection pooler in transaction mode a session setting is shared with the pooler's other clients.
|
|
65
65
|
*/
|
|
66
66
|
schema?: string;
|
|
67
67
|
/**
|
package/dist/index.js
CHANGED
|
@@ -860,12 +860,7 @@ var PrismaPgAdapterFactory = class {
|
|
|
860
860
|
config;
|
|
861
861
|
externalPool;
|
|
862
862
|
async connect() {
|
|
863
|
-
const client = this.externalPool ?? new import_pg2.default.Pool(
|
|
864
|
-
if (this.externalPool !== null && this.options?.schema !== void 0) {
|
|
865
|
-
debug(
|
|
866
|
-
`The search path is not set on externally provided pools, schema "${this.options.schema}" is only used for generated queries. Set the search path on the pool itself if raw queries need it.`
|
|
867
|
-
);
|
|
868
|
-
}
|
|
863
|
+
const client = this.externalPool ?? new import_pg2.default.Pool(this.config);
|
|
869
864
|
const onIdleClientError = (err) => {
|
|
870
865
|
debug(`Error from idle pool client: ${err.message} %O`, err);
|
|
871
866
|
this.options?.onPoolError?.(err);
|
|
@@ -895,28 +890,6 @@ var PrismaPgAdapterFactory = class {
|
|
|
895
890
|
});
|
|
896
891
|
}
|
|
897
892
|
};
|
|
898
|
-
function withSearchPath(config, schema) {
|
|
899
|
-
if (schema === void 0 || setsSearchPath(config.options)) {
|
|
900
|
-
return config;
|
|
901
|
-
}
|
|
902
|
-
const searchPath = `-c search_path=${escapeOptionValue(quoteIdentifierIfNeeded(schema))},public`;
|
|
903
|
-
return {
|
|
904
|
-
...config,
|
|
905
|
-
options: config.options ? `${config.options} ${searchPath}` : searchPath
|
|
906
|
-
};
|
|
907
|
-
}
|
|
908
|
-
function setsSearchPath(options) {
|
|
909
|
-
return options !== void 0 && /(?:^|\s)(?:-c\s*|--)search[_-]path=/i.test(options);
|
|
910
|
-
}
|
|
911
|
-
function quoteIdentifierIfNeeded(name2) {
|
|
912
|
-
if (/^[a-z_][a-z0-9_$]*$/.test(name2)) {
|
|
913
|
-
return name2;
|
|
914
|
-
}
|
|
915
|
-
return `"${name2.replaceAll('"', '""')}"`;
|
|
916
|
-
}
|
|
917
|
-
function escapeOptionValue(value) {
|
|
918
|
-
return value.replace(/[\\\s]/g, (char) => `\\${char}`);
|
|
919
|
-
}
|
|
920
893
|
// Annotate the CommonJS export names for ESM import in node:
|
|
921
894
|
0 && (module.exports = {
|
|
922
895
|
PrismaPg
|
package/dist/index.mjs
CHANGED
|
@@ -824,12 +824,7 @@ var PrismaPgAdapterFactory = class {
|
|
|
824
824
|
config;
|
|
825
825
|
externalPool;
|
|
826
826
|
async connect() {
|
|
827
|
-
const client = this.externalPool ?? new pg2.Pool(
|
|
828
|
-
if (this.externalPool !== null && this.options?.schema !== void 0) {
|
|
829
|
-
debug(
|
|
830
|
-
`The search path is not set on externally provided pools, schema "${this.options.schema}" is only used for generated queries. Set the search path on the pool itself if raw queries need it.`
|
|
831
|
-
);
|
|
832
|
-
}
|
|
827
|
+
const client = this.externalPool ?? new pg2.Pool(this.config);
|
|
833
828
|
const onIdleClientError = (err) => {
|
|
834
829
|
debug(`Error from idle pool client: ${err.message} %O`, err);
|
|
835
830
|
this.options?.onPoolError?.(err);
|
|
@@ -859,28 +854,6 @@ var PrismaPgAdapterFactory = class {
|
|
|
859
854
|
});
|
|
860
855
|
}
|
|
861
856
|
};
|
|
862
|
-
function withSearchPath(config, schema) {
|
|
863
|
-
if (schema === void 0 || setsSearchPath(config.options)) {
|
|
864
|
-
return config;
|
|
865
|
-
}
|
|
866
|
-
const searchPath = `-c search_path=${escapeOptionValue(quoteIdentifierIfNeeded(schema))},public`;
|
|
867
|
-
return {
|
|
868
|
-
...config,
|
|
869
|
-
options: config.options ? `${config.options} ${searchPath}` : searchPath
|
|
870
|
-
};
|
|
871
|
-
}
|
|
872
|
-
function setsSearchPath(options) {
|
|
873
|
-
return options !== void 0 && /(?:^|\s)(?:-c\s*|--)search[_-]path=/i.test(options);
|
|
874
|
-
}
|
|
875
|
-
function quoteIdentifierIfNeeded(name2) {
|
|
876
|
-
if (/^[a-z_][a-z0-9_$]*$/.test(name2)) {
|
|
877
|
-
return name2;
|
|
878
|
-
}
|
|
879
|
-
return `"${name2.replaceAll('"', '""')}"`;
|
|
880
|
-
}
|
|
881
|
-
function escapeOptionValue(value) {
|
|
882
|
-
return value.replace(/[\\\s]/g, (char) => `\\${char}`);
|
|
883
|
-
}
|
|
884
857
|
export {
|
|
885
858
|
PrismaPgAdapterFactory as PrismaPg
|
|
886
859
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/adapter-pg",
|
|
3
|
-
"version": "7.11.0-dev.
|
|
3
|
+
"version": "7.11.0-dev.3",
|
|
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.
|
|
37
|
+
"@prisma/driver-adapter-utils": "7.11.0-dev.3"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@prisma/debug": "7.11.0-dev.
|
|
40
|
+
"@prisma/debug": "7.11.0-dev.3"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"dev": "DEV=true tsx helpers/build.ts",
|