@prisma-next/driver-postgres 0.12.0-dev.5 → 0.12.0-dev.51
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/control.d.mts +3 -6
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +0 -4
- package/dist/control.mjs.map +1 -1
- package/package.json +12 -12
- package/src/exports/control.ts +3 -9
package/dist/control.d.mts
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { Client } from "pg";
|
|
2
|
-
import { ControlDriverDescriptor
|
|
2
|
+
import { ControlDriverDescriptor } from "@prisma-next/framework-components/control";
|
|
3
|
+
import { SqlControlDriverInstance } from "@prisma-next/sql-contract/types";
|
|
3
4
|
|
|
4
5
|
//#region src/exports/control.d.ts
|
|
5
|
-
|
|
6
|
-
* Postgres control driver instance for control-plane operations.
|
|
7
|
-
* Implements ControlDriverInstance<'sql', 'postgres'> for database queries.
|
|
8
|
-
*/
|
|
9
|
-
declare class PostgresControlDriver implements ControlDriverInstance<'sql', 'postgres'> {
|
|
6
|
+
declare class PostgresControlDriver implements SqlControlDriverInstance<'postgres'> {
|
|
10
7
|
private readonly client;
|
|
11
8
|
readonly familyId: "sql";
|
|
12
9
|
readonly targetId: "postgres";
|
package/dist/control.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control.d.mts","names":[],"sources":["../src/exports/control.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"control.d.mts","names":[],"sources":["../src/exports/control.ts"],"mappings":";;;;;cAUa,qBAAA,YAAiC,wBAAA;EAAA,iBAIf,MAAA;EAAA,SAHpB,QAAA;EAAA,SACA,QAAA;cAEoB,MAAA,EAAQ,MAAA;EAE/B,KAAA,OAAY,MAAA,kBAAA,CAChB,GAAA,UACA,MAAA,wBACC,OAAA;IAAA,SAAmB,IAAA,EAAM,GAAA;EAAA;EAStB,KAAA,CAAA,GAAS,OAAA;AAAA;;;;cAQX,wBAAA,EAA0B,uBAAuB,oBAAoB,qBAAA"}
|
package/dist/control.mjs
CHANGED
|
@@ -5,10 +5,6 @@ import { ifDefined } from "@prisma-next/utils/defined";
|
|
|
5
5
|
import { redactDatabaseUrl } from "@prisma-next/utils/redact-db-url";
|
|
6
6
|
import { Client } from "pg";
|
|
7
7
|
//#region src/exports/control.ts
|
|
8
|
-
/**
|
|
9
|
-
* Postgres control driver instance for control-plane operations.
|
|
10
|
-
* Implements ControlDriverInstance<'sql', 'postgres'> for database queries.
|
|
11
|
-
*/
|
|
12
8
|
var PostgresControlDriver = class {
|
|
13
9
|
client;
|
|
14
10
|
familyId = "sql";
|
package/dist/control.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control.mjs","names":[],"sources":["../src/exports/control.ts"],"sourcesContent":["import { errorRuntime } from '@prisma-next/errors/execution';\nimport type {
|
|
1
|
+
{"version":3,"file":"control.mjs","names":[],"sources":["../src/exports/control.ts"],"sourcesContent":["import { errorRuntime } from '@prisma-next/errors/execution';\nimport type { ControlDriverDescriptor } from '@prisma-next/framework-components/control';\nimport type { SqlControlDriverInstance } from '@prisma-next/sql-contract/types';\nimport { SqlQueryError } from '@prisma-next/sql-errors';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport { redactDatabaseUrl } from '@prisma-next/utils/redact-db-url';\nimport { Client } from 'pg';\nimport { postgresDriverDescriptorMeta } from '../core/descriptor-meta';\nimport { normalizePgError } from '../normalize-error';\n\nexport class PostgresControlDriver implements SqlControlDriverInstance<'postgres'> {\n readonly familyId = 'sql' as const;\n readonly targetId = 'postgres' as const;\n\n constructor(private readonly client: Client) {}\n\n async query<Row = Record<string, unknown>>(\n sql: string,\n params?: readonly unknown[],\n ): Promise<{ readonly rows: Row[] }> {\n try {\n const result = await this.client.query(sql, params as unknown[] | undefined);\n return { rows: result.rows as Row[] };\n } catch (error) {\n throw normalizePgError(error);\n }\n }\n\n async close(): Promise<void> {\n await this.client.end();\n }\n}\n\n/**\n * Postgres driver descriptor for CLI config.\n */\nconst postgresDriverDescriptor: ControlDriverDescriptor<'sql', 'postgres', PostgresControlDriver> =\n {\n ...postgresDriverDescriptorMeta,\n async create(url: string): Promise<PostgresControlDriver> {\n const client = new Client({ connectionString: url });\n try {\n await client.connect();\n return new PostgresControlDriver(client);\n } catch (error) {\n const normalized = normalizePgError(error);\n const redacted = redactDatabaseUrl(url);\n try {\n await client.end();\n } catch {\n // ignore\n }\n\n const codeFromSqlState = SqlQueryError.is(normalized) ? normalized.sqlState : undefined;\n const causeCode =\n 'cause' in normalized && normalized.cause\n ? (normalized.cause as { code?: unknown }).code\n : undefined;\n const code = codeFromSqlState ?? causeCode;\n\n throw errorRuntime('Database connection failed', {\n why: normalized.message,\n fix: 'Verify the database URL, ensure the database is reachable, and confirm credentials/permissions',\n meta: {\n ...ifDefined('code', code),\n ...redacted,\n },\n });\n }\n },\n };\n\nexport default postgresDriverDescriptor;\n"],"mappings":";;;;;;;AAUA,IAAa,wBAAb,MAAmF;CAIpD;CAH7B,WAAoB;CACpB,WAAoB;CAEpB,YAAY,QAAiC;EAAhB,KAAA,SAAA;CAAiB;CAE9C,MAAM,MACJ,KACA,QACmC;EACnC,IAAI;GAEF,OAAO,EAAE,OAAM,MADM,KAAK,OAAO,MAAM,KAAK,MAA+B,GACrD,KAAc;EACtC,SAAS,OAAO;GACd,MAAM,iBAAiB,KAAK;EAC9B;CACF;CAEA,MAAM,QAAuB;EAC3B,MAAM,KAAK,OAAO,IAAI;CACxB;AACF;;;;AAKA,MAAM,2BACJ;CACE,GAAG;CACH,MAAM,OAAO,KAA6C;EACxD,MAAM,SAAS,IAAI,OAAO,EAAE,kBAAkB,IAAI,CAAC;EACnD,IAAI;GACF,MAAM,OAAO,QAAQ;GACrB,OAAO,IAAI,sBAAsB,MAAM;EACzC,SAAS,OAAO;GACd,MAAM,aAAa,iBAAiB,KAAK;GACzC,MAAM,WAAW,kBAAkB,GAAG;GACtC,IAAI;IACF,MAAM,OAAO,IAAI;GACnB,QAAQ,CAER;GAEA,MAAM,mBAAmB,cAAc,GAAG,UAAU,IAAI,WAAW,WAAW,KAAA;GAC9E,MAAM,YACJ,WAAW,cAAc,WAAW,QAC/B,WAAW,MAA6B,OACzC,KAAA;GACN,MAAM,OAAO,oBAAoB;GAEjC,MAAM,aAAa,8BAA8B;IAC/C,KAAK,WAAW;IAChB,KAAK;IACL,MAAM;KACJ,GAAG,UAAU,QAAQ,IAAI;KACzB,GAAG;IACL;GACF,CAAC;EACH;CACF;AACF"}
|
package/package.json
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma-next/driver-postgres",
|
|
3
|
-
"version": "0.12.0-dev.
|
|
3
|
+
"version": "0.12.0-dev.51",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@prisma-next/contract": "0.12.0-dev.
|
|
9
|
-
"@prisma-next/errors": "0.12.0-dev.
|
|
10
|
-
"@prisma-next/framework-components": "0.12.0-dev.
|
|
11
|
-
"@prisma-next/sql-contract": "0.12.0-dev.
|
|
12
|
-
"@prisma-next/sql-errors": "0.12.0-dev.
|
|
13
|
-
"@prisma-next/sql-operations": "0.12.0-dev.
|
|
14
|
-
"@prisma-next/sql-relational-core": "0.12.0-dev.
|
|
15
|
-
"@prisma-next/utils": "0.12.0-dev.
|
|
8
|
+
"@prisma-next/contract": "0.12.0-dev.51",
|
|
9
|
+
"@prisma-next/errors": "0.12.0-dev.51",
|
|
10
|
+
"@prisma-next/framework-components": "0.12.0-dev.51",
|
|
11
|
+
"@prisma-next/sql-contract": "0.12.0-dev.51",
|
|
12
|
+
"@prisma-next/sql-errors": "0.12.0-dev.51",
|
|
13
|
+
"@prisma-next/sql-operations": "0.12.0-dev.51",
|
|
14
|
+
"@prisma-next/sql-relational-core": "0.12.0-dev.51",
|
|
15
|
+
"@prisma-next/utils": "0.12.0-dev.51",
|
|
16
16
|
"arktype": "^2.2.0",
|
|
17
17
|
"pg": "8.20.0",
|
|
18
18
|
"pg-cursor": "^2.19.0"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@prisma-next/test-utils": "0.12.0-dev.
|
|
22
|
-
"@prisma-next/tsconfig": "0.12.0-dev.
|
|
21
|
+
"@prisma-next/test-utils": "0.12.0-dev.51",
|
|
22
|
+
"@prisma-next/tsconfig": "0.12.0-dev.51",
|
|
23
23
|
"@types/pg": "8.20.0",
|
|
24
24
|
"@types/pg-cursor": "^2.4.6",
|
|
25
25
|
"pg-mem": "^3.0.5",
|
|
26
|
-
"@prisma-next/tsdown": "0.12.0-dev.
|
|
26
|
+
"@prisma-next/tsdown": "0.12.0-dev.51",
|
|
27
27
|
"tsdown": "0.22.0",
|
|
28
28
|
"typescript": "5.9.3",
|
|
29
29
|
"vitest": "4.1.6"
|
package/src/exports/control.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { errorRuntime } from '@prisma-next/errors/execution';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
ControlDriverInstance,
|
|
5
|
-
} from '@prisma-next/framework-components/control';
|
|
2
|
+
import type { ControlDriverDescriptor } from '@prisma-next/framework-components/control';
|
|
3
|
+
import type { SqlControlDriverInstance } from '@prisma-next/sql-contract/types';
|
|
6
4
|
import { SqlQueryError } from '@prisma-next/sql-errors';
|
|
7
5
|
import { ifDefined } from '@prisma-next/utils/defined';
|
|
8
6
|
import { redactDatabaseUrl } from '@prisma-next/utils/redact-db-url';
|
|
@@ -10,11 +8,7 @@ import { Client } from 'pg';
|
|
|
10
8
|
import { postgresDriverDescriptorMeta } from '../core/descriptor-meta';
|
|
11
9
|
import { normalizePgError } from '../normalize-error';
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
* Postgres control driver instance for control-plane operations.
|
|
15
|
-
* Implements ControlDriverInstance<'sql', 'postgres'> for database queries.
|
|
16
|
-
*/
|
|
17
|
-
export class PostgresControlDriver implements ControlDriverInstance<'sql', 'postgres'> {
|
|
11
|
+
export class PostgresControlDriver implements SqlControlDriverInstance<'postgres'> {
|
|
18
12
|
readonly familyId = 'sql' as const;
|
|
19
13
|
readonly targetId = 'postgres' as const;
|
|
20
14
|
|