@prisma/adapter-pg-worker
Advanced tools
Comparing version 6.5.0-dev.24 to 6.5.0-dev.25
import type { ConnectionInfo } from '@prisma/driver-adapter-utils'; | ||
import type { DriverAdapter } from '@prisma/driver-adapter-utils'; | ||
import * as pg from '@prisma/pg-worker'; | ||
import type { Query } from '@prisma/driver-adapter-utils'; | ||
import type { Queryable } from '@prisma/driver-adapter-utils'; | ||
import type { Result } from '@prisma/driver-adapter-utils'; | ||
import type { ResultSet } from '@prisma/driver-adapter-utils'; | ||
import type { SqlConnection } from '@prisma/driver-adapter-utils'; | ||
import type { SqlQuery } from '@prisma/driver-adapter-utils'; | ||
import type { SqlQueryable } from '@prisma/driver-adapter-utils'; | ||
import type { SqlResultSet } from '@prisma/driver-adapter-utils'; | ||
import type { TransactionContext } from '@prisma/driver-adapter-utils'; | ||
declare class PgQueryable<ClientT extends StdClient | TransactionClient> implements Queryable { | ||
declare class PgQueryable<ClientT extends StdClient | TransactionClient> implements SqlQueryable { | ||
protected readonly client: ClientT; | ||
@@ -18,3 +17,3 @@ readonly provider = "postgres"; | ||
*/ | ||
queryRaw(query: Query): Promise<Result<ResultSet>>; | ||
queryRaw(query: SqlQuery): Promise<SqlResultSet>; | ||
/** | ||
@@ -25,3 +24,3 @@ * Execute a query given as SQL, interpolating the given parameters and | ||
*/ | ||
executeRaw(query: Query): Promise<Result<number>>; | ||
executeRaw(query: SqlQuery): Promise<number>; | ||
/** | ||
@@ -35,7 +34,9 @@ * Run a query against the database, returning the result set. | ||
export declare class PrismaPg extends PgQueryable<StdClient> implements DriverAdapter { | ||
export declare class PrismaPg extends PgQueryable<StdClient> implements SqlConnection { | ||
private options?; | ||
constructor(client: pg.Pool, options?: PrismaPgOptions | undefined); | ||
getConnectionInfo(): Result<ConnectionInfo>; | ||
transactionContext(): Promise<Result<TransactionContext>>; | ||
executeScript(_script: string): Promise<void>; | ||
getConnectionInfo(): ConnectionInfo; | ||
transactionContext(): Promise<TransactionContext>; | ||
dispose(): Promise<void>; | ||
} | ||
@@ -42,0 +43,0 @@ |
@@ -386,7 +386,3 @@ "use strict"; | ||
debug(`${tag} %O`, query); | ||
const res = await this.performIO(query); | ||
if (!res.ok) { | ||
return (0, import_driver_adapter_utils2.err)(res.error); | ||
} | ||
const { fields, rows } = res.value; | ||
const { fields, rows } = await this.performIO(query); | ||
const columnNames = fields.map((field) => field.name); | ||
@@ -398,3 +394,3 @@ let columnTypes = []; | ||
if (e instanceof UnsupportedNativeDataType) { | ||
return (0, import_driver_adapter_utils2.err)({ | ||
throw new import_driver_adapter_utils2.DriverAdapterError({ | ||
kind: "UnsupportedNativeDataType", | ||
@@ -406,7 +402,7 @@ type: e.type | ||
} | ||
return (0, import_driver_adapter_utils2.ok)({ | ||
return { | ||
columnNames, | ||
columnTypes, | ||
rows | ||
}); | ||
}; | ||
} | ||
@@ -421,3 +417,3 @@ /** | ||
debug(`${tag} %O`, query); | ||
return (await this.performIO(query)).map(({ rowCount: rowsAffected }) => rowsAffected ?? 0); | ||
return (await this.performIO(query)).rowCount ?? 0; | ||
} | ||
@@ -460,3 +456,3 @@ /** | ||
); | ||
return (0, import_driver_adapter_utils2.ok)(result); | ||
return result; | ||
} catch (e) { | ||
@@ -466,3 +462,3 @@ const error = e; | ||
if (e && typeof e.code === "string" && typeof e.severity === "string" && typeof e.message === "string") { | ||
return (0, import_driver_adapter_utils2.err)({ | ||
throw new import_driver_adapter_utils2.DriverAdapterError({ | ||
kind: "postgres", | ||
@@ -489,3 +485,2 @@ code: e.code, | ||
this.client.release(); | ||
return (0, import_driver_adapter_utils2.ok)(void 0); | ||
} | ||
@@ -495,3 +490,2 @@ async rollback() { | ||
this.client.release(); | ||
return (0, import_driver_adapter_utils2.ok)(void 0); | ||
} | ||
@@ -510,3 +504,3 @@ }; | ||
debug("%s options: %O", tag, options); | ||
return (0, import_driver_adapter_utils2.ok)(new PgTransaction(this.conn, options)); | ||
return new PgTransaction(this.conn, options); | ||
} | ||
@@ -526,11 +520,17 @@ }; | ||
} | ||
executeScript(_script) { | ||
throw new Error("Not implemented yet"); | ||
} | ||
getConnectionInfo() { | ||
return (0, import_driver_adapter_utils2.ok)({ | ||
return { | ||
schemaName: this.options?.schema | ||
}); | ||
}; | ||
} | ||
async transactionContext() { | ||
const conn = await this.client.connect(); | ||
return (0, import_driver_adapter_utils2.ok)(new PgTransactionContext(conn)); | ||
return new PgTransactionContext(conn); | ||
} | ||
dispose() { | ||
return this.client.end(); | ||
} | ||
}; | ||
@@ -537,0 +537,0 @@ // Annotate the CommonJS export names for ESM import in node: |
{ | ||
"name": "@prisma/adapter-pg-worker", | ||
"version": "6.5.0-dev.24", | ||
"version": "6.5.0-dev.25", | ||
"description": "Prisma's driver adapter for \"@prisma/pg-worker\"", | ||
@@ -35,3 +35,3 @@ "main": "dist/index.js", | ||
"postgres-array": "3.0.2", | ||
"@prisma/driver-adapter-utils": "6.5.0-dev.24" | ||
"@prisma/driver-adapter-utils": "6.5.0-dev.25" | ||
}, | ||
@@ -43,3 +43,3 @@ "devDependencies": { | ||
"jest-junit": "16.0.0", | ||
"@prisma/pg-worker": "6.5.0-dev.24" | ||
"@prisma/pg-worker": "6.5.0-dev.25" | ||
}, | ||
@@ -46,0 +46,0 @@ "peerDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1058
49248
+ Added@prisma/debug@6.5.0-dev.25(transitive)
+ Added@prisma/driver-adapter-utils@6.5.0-dev.25(transitive)
- Removed@prisma/debug@6.5.0-dev.24(transitive)
- Removed@prisma/driver-adapter-utils@6.5.0-dev.24(transitive)