pqb 0.7.6 → 0.7.8
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/CHANGELOG.md +12 -0
- package/dist/index.d.ts +4 -3
- package/dist/index.esm.js +9 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/adapter.ts +9 -1
- package/src/db.test.ts +13 -0
- package/src/errors.ts +1 -2
- package/src/test-utils/test-utils.ts +2 -2
- package/src/test-utils/user.csv +0 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PoolConfig, Pool, PoolClient
|
|
1
|
+
import { PoolConfig, Pool, PoolClient } from 'pg';
|
|
2
2
|
|
|
3
3
|
declare type AliasOrTable<T extends Pick<Query, 'tableAlias' | 'table'>> = T['tableAlias'] extends string ? T['tableAlias'] : T['table'] extends string ? T['table'] : never;
|
|
4
4
|
declare type StringKey<K extends PropertyKey> = Exclude<K, symbol | number>;
|
|
@@ -180,8 +180,9 @@ declare type QueryArraysResult<R extends any[] = any[]> = {
|
|
|
180
180
|
name: string;
|
|
181
181
|
}[];
|
|
182
182
|
};
|
|
183
|
-
declare type AdapterOptions = Omit<PoolConfig, 'types'> & {
|
|
183
|
+
declare type AdapterOptions = Omit<PoolConfig, 'types' | 'connectionString'> & {
|
|
184
184
|
types?: TypeParsers;
|
|
185
|
+
databaseURL?: string;
|
|
185
186
|
};
|
|
186
187
|
declare class Adapter {
|
|
187
188
|
types: TypeParsers;
|
|
@@ -819,7 +820,7 @@ declare class QueryError<T extends {
|
|
|
819
820
|
shape: ColumnsShape;
|
|
820
821
|
} = {
|
|
821
822
|
shape: ColumnsShape;
|
|
822
|
-
}> extends
|
|
823
|
+
}> extends Error {
|
|
823
824
|
message: string;
|
|
824
825
|
name: QueryErrorName;
|
|
825
826
|
stack: string | undefined;
|
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { types, Pool, DatabaseError } from 'pg';
|
|
2
2
|
|
|
3
3
|
var __defProp$q = Object.defineProperty;
|
|
4
4
|
var __defProps$k = Object.defineProperties;
|
|
@@ -773,7 +773,7 @@ const aggregateToSql = (ctx, model, item, quotedAs) => {
|
|
|
773
773
|
|
|
774
774
|
class PormError extends Error {
|
|
775
775
|
}
|
|
776
|
-
class QueryError extends
|
|
776
|
+
class QueryError extends Error {
|
|
777
777
|
get isUnique() {
|
|
778
778
|
return this.code === "23505";
|
|
779
779
|
}
|
|
@@ -3204,6 +3204,13 @@ class Adapter {
|
|
|
3204
3204
|
constructor(_a) {
|
|
3205
3205
|
var _b = _a, { types: types2 = defaultTypeParsers } = _b, config = __objRest$1(_b, ["types"]);
|
|
3206
3206
|
this.types = types2;
|
|
3207
|
+
if (config.databaseURL) {
|
|
3208
|
+
config.connectionString = config.databaseURL;
|
|
3209
|
+
const url = new URL(config.databaseURL);
|
|
3210
|
+
if (url.searchParams.get("ssl") === "true") {
|
|
3211
|
+
config.ssl = true;
|
|
3212
|
+
}
|
|
3213
|
+
}
|
|
3207
3214
|
this.pool = new Pool(config);
|
|
3208
3215
|
}
|
|
3209
3216
|
async query(query, types2) {
|