@holo-js/db-postgres 0.3.23 → 0.3.25

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 CHANGED
@@ -1,5 +1,5 @@
1
1
  import { PoolConfig } from 'pg';
2
- import { DriverAdapter, DriverQueryResult, DriverExecutionResult, DatabaseDriverFactory } from '@holo-js/db';
2
+ import { DriverAdapter, CompiledStatement, DriverQueryResult, DriverExecutionResult, DatabaseDriverFactory } from '@holo-js/db';
3
3
  export { DriverAdapter, DriverExecutionResult, DriverQueryResult } from '@holo-js/db';
4
4
 
5
5
  type PostgresQueryResult = {
@@ -37,6 +37,7 @@ declare class PostgresAdapter<TConfig extends PoolConfig = PoolConfig> implement
37
37
  isDatabaseMissingError(error: unknown): boolean;
38
38
  disconnect(): Promise<void>;
39
39
  isConnected(): boolean;
40
+ getMutationReturningPermissionQuery(tableName: string): CompiledStatement;
40
41
  runWithTransactionScope<T>(callback: () => Promise<T>): Promise<T>;
41
42
  query<TRow extends Record<string, unknown> = Record<string, unknown>>(sql: string, bindings?: readonly unknown[]): Promise<DriverQueryResult<TRow>>;
42
43
  introspect<TRow extends Record<string, unknown> = Record<string, unknown>>(sql: string, bindings?: readonly unknown[]): Promise<DriverQueryResult<TRow>>;
package/dist/index.mjs CHANGED
@@ -116,6 +116,13 @@ var PostgresAdapter = class {
116
116
  isConnected() {
117
117
  return this.connected;
118
118
  }
119
+ getMutationReturningPermissionQuery(tableName) {
120
+ return {
121
+ sql: "SELECT has_table_privilege(current_user, $1, 'SELECT') AND NOT row_security_active($1) AS allowed",
122
+ bindings: [quoteDatabaseIdentifier(tableName)],
123
+ source: "schema"
124
+ };
125
+ }
119
126
  runWithTransactionScope(callback) {
120
127
  return this.transactionClients.run(callback);
121
128
  }
@@ -218,13 +225,18 @@ var postgresDatabaseDriverFactory = Object.freeze({
218
225
  driver: "postgres",
219
226
  supportsConcurrentTransactionScopes: true,
220
227
  create(connection) {
221
- return connection.url ? createPostgresAdapter({ connectionString: connection.url }) : createPostgresAdapter({ config: {
228
+ return createPostgresAdapter({ config: {
229
+ connectionString: connection.url,
222
230
  host: connection.host,
223
231
  port: connection.port,
224
232
  user: connection.username,
225
233
  password: connection.password,
226
234
  database: connection.database,
227
- ssl: connection.ssl
235
+ ssl: connection.ssl,
236
+ max: connection.max,
237
+ connectionTimeoutMillis: connection.connectionTimeoutMillis,
238
+ idleTimeoutMillis: connection.idleTimeoutMillis,
239
+ application_name: connection.application_name
228
240
  } });
229
241
  }
230
242
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@holo-js/db-postgres",
3
- "version": "0.3.23",
3
+ "version": "0.3.25",
4
4
  "description": "Holo-JS Framework - Postgres database adapter",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -24,13 +24,13 @@
24
24
  "test:integration": "HOLO_POSTGRES_INTEGRATION=1 vitest --run tests/postgres.test.ts"
25
25
  },
26
26
  "peerDependencies": {
27
- "@holo-js/db": "^0.3.23"
27
+ "@holo-js/db": "^0.3.25"
28
28
  },
29
29
  "dependencies": {
30
30
  "pg": "^8.13.0"
31
31
  },
32
32
  "devDependencies": {
33
- "@holo-js/db": "^0.3.23",
33
+ "@holo-js/db": "^0.3.25",
34
34
  "@types/pg": "^8.11.0",
35
35
  "tsup": "^8.3.5",
36
36
  "typescript": "^5.7.2",