@holo-js/db-postgres 0.1.4 → 0.1.6
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.ts +3 -23
- package/package.json +6 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,27 +1,7 @@
|
|
|
1
1
|
import { PoolConfig, QueryResult } from 'pg';
|
|
2
|
+
import { DriverAdapter, DriverQueryResult, DriverExecutionResult } from '@holo-js/db';
|
|
3
|
+
export { DriverAdapter, DriverExecutionResult, DriverQueryResult } from '@holo-js/db';
|
|
2
4
|
|
|
3
|
-
interface DriverQueryResult<TRow extends Record<string, unknown> = Record<string, unknown>> {
|
|
4
|
-
rows: TRow[];
|
|
5
|
-
rowCount: number;
|
|
6
|
-
}
|
|
7
|
-
interface DriverExecutionResult {
|
|
8
|
-
affectedRows?: number;
|
|
9
|
-
lastInsertId?: number | string;
|
|
10
|
-
}
|
|
11
|
-
interface DriverAdapter {
|
|
12
|
-
initialize(): Promise<void>;
|
|
13
|
-
disconnect(): Promise<void>;
|
|
14
|
-
isConnected(): boolean;
|
|
15
|
-
runWithTransactionScope?<T>(callback: () => Promise<T>): Promise<T>;
|
|
16
|
-
query<TRow extends Record<string, unknown> = Record<string, unknown>>(sql: string, bindings?: readonly unknown[]): Promise<DriverQueryResult<TRow>>;
|
|
17
|
-
execute(sql: string, bindings?: readonly unknown[]): Promise<DriverExecutionResult>;
|
|
18
|
-
beginTransaction(): Promise<void>;
|
|
19
|
-
commit(): Promise<void>;
|
|
20
|
-
rollback(): Promise<void>;
|
|
21
|
-
createSavepoint?(name: string): Promise<void>;
|
|
22
|
-
rollbackToSavepoint?(name: string): Promise<void>;
|
|
23
|
-
releaseSavepoint?(name: string): Promise<void>;
|
|
24
|
-
}
|
|
25
5
|
interface PostgresQueryableLike {
|
|
26
6
|
query(sql: string, bindings?: readonly unknown[]): Promise<QueryResult<Record<string, unknown>> | {
|
|
27
7
|
rows: Record<string, unknown>[];
|
|
@@ -75,4 +55,4 @@ declare class PostgresAdapter implements DriverAdapter {
|
|
|
75
55
|
}
|
|
76
56
|
declare function createPostgresAdapter(options?: PostgresAdapterOptions): PostgresAdapter;
|
|
77
57
|
|
|
78
|
-
export {
|
|
58
|
+
export { PostgresAdapter, type PostgresAdapterOptions, type PostgresClientLike, type PostgresPoolLike, type PostgresQueryableLike, createPostgresAdapter };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@holo-js/db-postgres",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Holo-JS Framework - Postgres database adapter",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,19 +20,20 @@
|
|
|
20
20
|
"build": "tsup",
|
|
21
21
|
"stub": "tsup --watch",
|
|
22
22
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
23
|
-
"test": "vitest --run"
|
|
23
|
+
"test": "vitest --run",
|
|
24
|
+
"test:integration": "HOLO_POSTGRES_INTEGRATION=1 vitest --run tests/postgres.test.ts"
|
|
24
25
|
},
|
|
25
26
|
"peerDependencies": {
|
|
26
|
-
"@holo-js/db": "^0.1.
|
|
27
|
+
"@holo-js/db": "^0.1.6"
|
|
27
28
|
},
|
|
28
29
|
"dependencies": {
|
|
29
30
|
"pg": "^8.13.0"
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|
|
32
|
-
"@holo-js/db": "
|
|
33
|
+
"@holo-js/db": "^0.1.6",
|
|
33
34
|
"@types/pg": "^8.11.0",
|
|
34
35
|
"tsup": "^8.3.5",
|
|
35
36
|
"typescript": "^5.7.2",
|
|
36
|
-
"vitest": "^
|
|
37
|
+
"vitest": "^4.1.5"
|
|
37
38
|
}
|
|
38
39
|
}
|