@prisma/orm-target-postgres 8.0.0-rc.1-dev.36 → 8.0.0-rc.1-dev.38

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.
@@ -11,6 +11,7 @@ declare class PostgresControlDriver implements SqlControlDriverInstance<'postgre
11
11
  query<Row = Record<string, unknown>>(sql: string, params?: readonly unknown[]): Promise<{
12
12
  readonly rows: Row[];
13
13
  }>;
14
+ databaseName(): Promise<string | undefined>;
14
15
  close(): Promise<void>;
15
16
  }
16
17
  /**
@@ -19,4 +20,4 @@ declare class PostgresControlDriver implements SqlControlDriverInstance<'postgre
19
20
  declare const postgresDriverDescriptor: ControlDriverDescriptor<'sql', 'postgres', PostgresControlDriver>;
20
21
  //#endregion
21
22
  export { postgresDriverDescriptor as n, PostgresControlDriver as t };
22
- //# sourceMappingURL=control-B-FTbEnE.d.mts.map
23
+ //# sourceMappingURL=control-BaUpALVp.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"control-BaUpALVp.d.mts","names":[],"sources":["../../../../3-targets/7-drivers/postgres/dist/control.d.mts"],"mappings":";;;;;cAIc,iCAAiC;mBAC5B;WACR;WACA;EACT,YAAY,QAAQ;EACpB,MAAM,MAAM,yBAAyB,aAAa,8BAA8B;aACrE,MAAM;;EAEjB,gBAAgB;EAChB,SAAS;;;;;cAKG,0BAA0B,2CAA2C"}
@@ -19,6 +19,10 @@ var PostgresControlDriver = class {
19
19
  throw normalizePgError(error);
20
20
  }
21
21
  }
22
+ async databaseName() {
23
+ const name = (await this.query("select current_database() as name")).rows[0]?.name;
24
+ return typeof name === "string" && name.length > 0 ? name : void 0;
25
+ }
22
26
  async close() {
23
27
  await this.client.end().catch(() => {});
24
28
  }
@@ -58,4 +62,4 @@ const postgresDriverDescriptor = {
58
62
  //#endregion
59
63
  export { postgresDriverDescriptor as n, PostgresControlDriver as t };
60
64
 
61
- //# sourceMappingURL=control-hqYHq_Y_.mjs.map
65
+ //# sourceMappingURL=control-Y6FxMu3o.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"control-Y6FxMu3o.mjs","names":[],"sources":["../../../../3-targets/7-drivers/postgres/dist/control.mjs"],"sourcesContent":["import { i as postgresDriverDescriptorMeta, r as normalizePgError } from \"./normalize-error-CNjgVO71.mjs\";\nimport { errorRuntime } from \"@internal/errors/execution\";\nimport { SqlQueryError } from \"@internal/sql-errors\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { redactDatabaseUrl } from \"@internal/utils/redact-db-url\";\nimport { Client } from \"pg\";\n//#region src/exports/control.ts\nvar PostgresControlDriver = class {\n\tclient;\n\tfamilyId = \"sql\";\n\ttargetId = \"postgres\";\n\tconstructor(client) {\n\t\tthis.client = client;\n\t}\n\tasync query(sql, params) {\n\t\ttry {\n\t\t\treturn { rows: (await this.client.query(sql, params)).rows };\n\t\t} catch (error) {\n\t\t\tthrow normalizePgError(error);\n\t\t}\n\t}\n\tasync databaseName() {\n\t\tconst name = (await this.query(\"select current_database() as name\")).rows[0]?.name;\n\t\treturn typeof name === \"string\" && name.length > 0 ? name : void 0;\n\t}\n\tasync close() {\n\t\tawait this.client.end().catch(() => {});\n\t}\n};\n/**\n* Postgres driver descriptor for CLI config.\n*/\nconst postgresDriverDescriptor = {\n\t...postgresDriverDescriptorMeta,\n\tasync create(url) {\n\t\tconst client = new Client({ connectionString: url });\n\t\tclient.on(\"error\", () => {});\n\t\ttry {\n\t\t\tawait client.connect();\n\t\t\treturn new PostgresControlDriver(client);\n\t\t} catch (error) {\n\t\t\tconst normalized = normalizePgError(error);\n\t\t\tconst redacted = redactDatabaseUrl(url);\n\t\t\ttry {\n\t\t\t\tawait client.end();\n\t\t\t} catch {}\n\t\t\tconst codeFromSqlState = SqlQueryError.is(normalized) ? normalized.sqlState : void 0;\n\t\t\tconst causeCode = \"cause\" in normalized && normalized.cause ? normalized.cause.code : void 0;\n\t\t\tconst sqlState = codeFromSqlState ?? causeCode;\n\t\t\tthrow errorRuntime(\"DRIVER.CONNECTION_FAILED\", \"Database connection failed\", {\n\t\t\t\twhy: normalized.message,\n\t\t\t\tfix: \"Verify the database URL, ensure the database is reachable, and confirm credentials/permissions\",\n\t\t\t\tmeta: {\n\t\t\t\t\t...ifDefined(\"sqlState\", sqlState),\n\t\t\t\t\t...redacted\n\t\t\t\t},\n\t\t\t\tcause: error\n\t\t\t});\n\t\t}\n\t}\n};\n//#endregion\nexport { PostgresControlDriver, postgresDriverDescriptor as default };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;AAOA,IAAI,wBAAwB,MAAM;CACjC;CACA,WAAW;CACX,WAAW;CACX,YAAY,QAAQ;EACnB,KAAK,SAAS;CACf;CACA,MAAM,MAAM,KAAK,QAAQ;EACxB,IAAI;GACH,OAAO,EAAE,OAAO,MAAM,KAAK,OAAO,MAAM,KAAK,MAAM,EAAA,CAAG,KAAK;EAC5D,SAAS,OAAO;GACf,MAAM,iBAAiB,KAAK;EAC7B;CACD;CACA,MAAM,eAAe;EACpB,MAAM,QAAQ,MAAM,KAAK,MAAM,mCAAmC,EAAA,CAAG,KAAK,EAAE,EAAE;EAC9E,OAAO,OAAO,SAAS,YAAY,KAAK,SAAS,IAAI,OAAO,KAAK;CAClE;CACA,MAAM,QAAQ;EACb,MAAM,KAAK,OAAO,IAAI,CAAC,CAAC,YAAY,CAAC,CAAC;CACvC;AACD;;;;AAIA,MAAM,2BAA2B;CAChC,GAAG;CACH,MAAM,OAAO,KAAK;EACjB,MAAM,SAAS,IAAI,OAAO,EAAE,kBAAkB,IAAI,CAAC;EACnD,OAAO,GAAG,eAAe,CAAC,CAAC;EAC3B,IAAI;GACH,MAAM,OAAO,QAAQ;GACrB,OAAO,IAAI,sBAAsB,MAAM;EACxC,SAAS,OAAO;GACf,MAAM,aAAa,iBAAiB,KAAK;GACzC,MAAM,WAAW,kBAAkB,GAAG;GACtC,IAAI;IACH,MAAM,OAAO,IAAI;GAClB,QAAQ,CAAC;GACT,MAAM,mBAAmB,cAAc,GAAG,UAAU,IAAI,WAAW,WAAW,KAAK;GACnF,MAAM,YAAY,WAAW,cAAc,WAAW,QAAQ,WAAW,MAAM,OAAO,KAAK;GAC3F,MAAM,WAAW,oBAAoB;GACrC,MAAM,aAAa,4BAA4B,8BAA8B;IAC5E,KAAK,WAAW;IAChB,KAAK;IACL,MAAM;KACL,GAAG,UAAU,YAAY,QAAQ;KACjC,GAAG;IACJ;IACA,OAAO;GACR,CAAC;EACF;CACD;AACD"}
package/dist/driver.d.mts CHANGED
@@ -1,3 +1,3 @@
1
- import { t as PostgresControlDriver } from "./control-B-FTbEnE.mjs";
1
+ import { t as PostgresControlDriver } from "./control-BaUpALVp.mjs";
2
2
  import { i as QueryResult, n as PostgresDriverCreateOptions, r as PostgresRuntimeDriver, t as PostgresBinding } from "./runtime-lHBKgjB9.mjs";
3
3
  export { type PostgresBinding, PostgresControlDriver, type PostgresDriverCreateOptions, PostgresRuntimeDriver, type QueryResult };
package/dist/driver.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { t as PostgresControlDriver } from "./control-hqYHq_Y_.mjs";
1
+ import { t as PostgresControlDriver } from "./control-Y6FxMu3o.mjs";
2
2
  export { PostgresControlDriver };
@@ -1,2 +1,2 @@
1
- import { n as postgresDriverDescriptor, t as PostgresControlDriver } from "./control-B-FTbEnE.mjs";
1
+ import { n as postgresDriverDescriptor, t as PostgresControlDriver } from "./control-BaUpALVp.mjs";
2
2
  export { PostgresControlDriver, postgresDriverDescriptor as default };
@@ -1,2 +1,2 @@
1
- import { n as postgresDriverDescriptor, t as PostgresControlDriver } from "./control-hqYHq_Y_.mjs";
1
+ import { n as postgresDriverDescriptor, t as PostgresControlDriver } from "./control-Y6FxMu3o.mjs";
2
2
  export { PostgresControlDriver, postgresDriverDescriptor as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/orm-target-postgres",
3
- "version": "8.0.0-rc.1-dev.36",
3
+ "version": "8.0.0-rc.1-dev.38",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -9,9 +9,9 @@
9
9
  "dist"
10
10
  ],
11
11
  "dependencies": {
12
- "@prisma/orm-family-sql": "8.0.0-rc.1-dev.36",
13
- "@prisma/orm-framework": "8.0.0-rc.1-dev.36",
14
- "@prisma/orm-toolchain": "8.0.0-rc.1-dev.36",
12
+ "@prisma/orm-family-sql": "8.0.0-rc.1-dev.38",
13
+ "@prisma/orm-framework": "8.0.0-rc.1-dev.38",
14
+ "@prisma/orm-toolchain": "8.0.0-rc.1-dev.38",
15
15
  "@standard-schema/spec": "^1.1.0",
16
16
  "@types/pg": "8.20.4",
17
17
  "arktype": "^2.2.2",
@@ -20,11 +20,11 @@
20
20
  "pg-cursor": "^2.21.0"
21
21
  },
22
22
  "devDependencies": {
23
- "@internal/adapter-postgres": "8.0.0-rc.1-dev.36",
24
- "@internal/driver-postgres": "8.0.0-rc.1-dev.36",
25
- "@internal/target-postgres": "8.0.0-rc.1-dev.36",
26
- "@repo/tsconfig": "8.0.0-rc.1-dev.36",
27
- "@repo/tsdown": "8.0.0-rc.1-dev.36",
23
+ "@internal/adapter-postgres": "8.0.0-rc.1-dev.38",
24
+ "@internal/driver-postgres": "8.0.0-rc.1-dev.38",
25
+ "@internal/target-postgres": "8.0.0-rc.1-dev.38",
26
+ "@repo/tsconfig": "8.0.0-rc.1-dev.38",
27
+ "@repo/tsdown": "8.0.0-rc.1-dev.38",
28
28
  "tsdown": "0.22.14",
29
29
  "typescript": "5.9.3",
30
30
  "vitest": "4.1.10"
@@ -1 +0,0 @@
1
- {"version":3,"file":"control-B-FTbEnE.d.mts","names":[],"sources":["../../../../3-targets/7-drivers/postgres/dist/control.d.mts"],"mappings":";;;;;cAIc,iCAAiC;mBAC5B;WACR;WACA;EACT,YAAY,QAAQ;EACpB,MAAM,MAAM,yBAAyB,aAAa,8BAA8B;aACrE,MAAM;;EAEjB,SAAS;;;;;cAKG,0BAA0B,2CAA2C"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"control-hqYHq_Y_.mjs","names":[],"sources":["../../../../3-targets/7-drivers/postgres/dist/control.mjs"],"sourcesContent":["import { i as postgresDriverDescriptorMeta, r as normalizePgError } from \"./normalize-error-CNjgVO71.mjs\";\nimport { errorRuntime } from \"@internal/errors/execution\";\nimport { SqlQueryError } from \"@internal/sql-errors\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { redactDatabaseUrl } from \"@internal/utils/redact-db-url\";\nimport { Client } from \"pg\";\n//#region src/exports/control.ts\nvar PostgresControlDriver = class {\n\tclient;\n\tfamilyId = \"sql\";\n\ttargetId = \"postgres\";\n\tconstructor(client) {\n\t\tthis.client = client;\n\t}\n\tasync query(sql, params) {\n\t\ttry {\n\t\t\treturn { rows: (await this.client.query(sql, params)).rows };\n\t\t} catch (error) {\n\t\t\tthrow normalizePgError(error);\n\t\t}\n\t}\n\tasync close() {\n\t\tawait this.client.end().catch(() => {});\n\t}\n};\n/**\n* Postgres driver descriptor for CLI config.\n*/\nconst postgresDriverDescriptor = {\n\t...postgresDriverDescriptorMeta,\n\tasync create(url) {\n\t\tconst client = new Client({ connectionString: url });\n\t\tclient.on(\"error\", () => {});\n\t\ttry {\n\t\t\tawait client.connect();\n\t\t\treturn new PostgresControlDriver(client);\n\t\t} catch (error) {\n\t\t\tconst normalized = normalizePgError(error);\n\t\t\tconst redacted = redactDatabaseUrl(url);\n\t\t\ttry {\n\t\t\t\tawait client.end();\n\t\t\t} catch {}\n\t\t\tconst codeFromSqlState = SqlQueryError.is(normalized) ? normalized.sqlState : void 0;\n\t\t\tconst causeCode = \"cause\" in normalized && normalized.cause ? normalized.cause.code : void 0;\n\t\t\tconst sqlState = codeFromSqlState ?? causeCode;\n\t\t\tthrow errorRuntime(\"DRIVER.CONNECTION_FAILED\", \"Database connection failed\", {\n\t\t\t\twhy: normalized.message,\n\t\t\t\tfix: \"Verify the database URL, ensure the database is reachable, and confirm credentials/permissions\",\n\t\t\t\tmeta: {\n\t\t\t\t\t...ifDefined(\"sqlState\", sqlState),\n\t\t\t\t\t...redacted\n\t\t\t\t},\n\t\t\t\tcause: error\n\t\t\t});\n\t\t}\n\t}\n};\n//#endregion\nexport { PostgresControlDriver, postgresDriverDescriptor as default };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;AAOA,IAAI,wBAAwB,MAAM;CACjC;CACA,WAAW;CACX,WAAW;CACX,YAAY,QAAQ;EACnB,KAAK,SAAS;CACf;CACA,MAAM,MAAM,KAAK,QAAQ;EACxB,IAAI;GACH,OAAO,EAAE,OAAO,MAAM,KAAK,OAAO,MAAM,KAAK,MAAM,EAAA,CAAG,KAAK;EAC5D,SAAS,OAAO;GACf,MAAM,iBAAiB,KAAK;EAC7B;CACD;CACA,MAAM,QAAQ;EACb,MAAM,KAAK,OAAO,IAAI,CAAC,CAAC,YAAY,CAAC,CAAC;CACvC;AACD;;;;AAIA,MAAM,2BAA2B;CAChC,GAAG;CACH,MAAM,OAAO,KAAK;EACjB,MAAM,SAAS,IAAI,OAAO,EAAE,kBAAkB,IAAI,CAAC;EACnD,OAAO,GAAG,eAAe,CAAC,CAAC;EAC3B,IAAI;GACH,MAAM,OAAO,QAAQ;GACrB,OAAO,IAAI,sBAAsB,MAAM;EACxC,SAAS,OAAO;GACf,MAAM,aAAa,iBAAiB,KAAK;GACzC,MAAM,WAAW,kBAAkB,GAAG;GACtC,IAAI;IACH,MAAM,OAAO,IAAI;GAClB,QAAQ,CAAC;GACT,MAAM,mBAAmB,cAAc,GAAG,UAAU,IAAI,WAAW,WAAW,KAAK;GACnF,MAAM,YAAY,WAAW,cAAc,WAAW,QAAQ,WAAW,MAAM,OAAO,KAAK;GAC3F,MAAM,WAAW,oBAAoB;GACrC,MAAM,aAAa,4BAA4B,8BAA8B;IAC5E,KAAK,WAAW;IAChB,KAAK;IACL,MAAM;KACL,GAAG,UAAU,YAAY,QAAQ;KACjC,GAAG;IACJ;IACA,OAAO;GACR,CAAC;EACF;CACD;AACD"}