@bernierllc/database-adapter-postgresql 1.2.5 → 1.4.0

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.
@@ -19,10 +19,12 @@ const PostgreSQLTransaction_1 = require("./PostgreSQLTransaction");
19
19
  * Implements connection pooling, RLS, and real-time features
20
20
  */
21
21
  class PostgreSQLAdapter extends database_adapter_core_1.BaseDatabaseAdapter {
22
+ pool = null;
23
+ supabase = null;
24
+ rlsManager;
25
+ logger;
22
26
  constructor(config) {
23
27
  super(config);
24
- this.pool = null;
25
- this.supabase = null;
26
28
  this.rlsManager = new database_adapter_core_1.RLSContextManager();
27
29
  this.logger = (0, logger_1.createLogger)({ context: { component: 'PostgreSQLAdapter' } });
28
30
  // Initialize Supabase client if configured
@@ -12,12 +12,16 @@ exports.PostgreSQLTransaction = void 0;
12
12
  * PostgreSQL transaction implementation with RLS context support
13
13
  */
14
14
  class PostgreSQLTransaction {
15
+ client;
16
+ _rlsManager;
17
+ id;
18
+ active = true;
19
+ logger;
15
20
  constructor(client,
16
21
  // @ts-expect-error - Reserved for future RLS context support in transactions
17
22
  _rlsManager, logger) {
18
23
  this.client = client;
19
24
  this._rlsManager = _rlsManager;
20
- this.active = true;
21
25
  this.id = `txn_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
22
26
  this.logger = logger;
23
27
  if (this.logger) {
@@ -0,0 +1,11 @@
1
+ export type DatabaseAdapterPostgresqlErrorCode = 'DATABASE_ADAPTER_POSTGRESQL_ERROR' | 'INVALID_INPUT' | 'OPERATION_FAILED';
2
+ export interface DatabaseAdapterPostgresqlErrorOptions {
3
+ cause?: Error;
4
+ code?: DatabaseAdapterPostgresqlErrorCode;
5
+ context?: Record<string, unknown>;
6
+ }
7
+ export declare class DatabaseAdapterPostgresqlError extends Error {
8
+ readonly code: DatabaseAdapterPostgresqlErrorCode;
9
+ readonly context?: Record<string, unknown>;
10
+ constructor(message: string, options?: DatabaseAdapterPostgresqlErrorOptions);
11
+ }
package/dist/errors.js ADDED
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ /*
3
+ Copyright (c) 2025 Bernier LLC
4
+
5
+ This file is licensed to the client under a limited-use license.
6
+ The client may use and modify this code only within the scope of the project it was delivered for.
7
+ Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.DatabaseAdapterPostgresqlError = void 0;
11
+ class DatabaseAdapterPostgresqlError extends Error {
12
+ code;
13
+ context;
14
+ constructor(message, options) {
15
+ super(message, options?.cause ? { cause: options.cause } : undefined);
16
+ this.name = 'DatabaseAdapterPostgresqlError';
17
+ this.code = options?.code ?? 'DATABASE_ADAPTER_POSTGRESQL_ERROR';
18
+ if (options?.context !== undefined) {
19
+ this.context = options.context;
20
+ }
21
+ Error.captureStackTrace?.(this, this.constructor);
22
+ }
23
+ }
24
+ exports.DatabaseAdapterPostgresqlError = DatabaseAdapterPostgresqlError;
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export { DatabaseAdapterPostgresqlError, type DatabaseAdapterPostgresqlErrorCode, type DatabaseAdapterPostgresqlErrorOptions, } from './errors';
1
2
  export { PostgreSQLAdapter, ISupabaseConfig } from './PostgreSQLAdapter';
2
3
  export { PostgreSQLTransaction } from './PostgreSQLTransaction';
3
4
  export { RLSPolicyGenerator } from './rls/RLSPolicyGenerator';
package/dist/index.js CHANGED
@@ -7,7 +7,10 @@ The client may use and modify this code *only within the scope of the project it
7
7
  Redistribution or use in other products or commercial offerings is not permitted without written consent from Bernier LLC.
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.migration_001_initial_schema = exports.FullTextSearchManager = exports.RealtimeManager = exports.ClerkIntegration = exports.RLSPolicyGenerator = exports.PostgreSQLTransaction = exports.PostgreSQLAdapter = void 0;
10
+ exports.migration_001_initial_schema = exports.FullTextSearchManager = exports.RealtimeManager = exports.ClerkIntegration = exports.RLSPolicyGenerator = exports.PostgreSQLTransaction = exports.PostgreSQLAdapter = exports.DatabaseAdapterPostgresqlError = void 0;
11
+ // Errors
12
+ var errors_1 = require("./errors");
13
+ Object.defineProperty(exports, "DatabaseAdapterPostgresqlError", { enumerable: true, get: function () { return errors_1.DatabaseAdapterPostgresqlError; } });
11
14
  // Main adapter
12
15
  var PostgreSQLAdapter_1 = require("./PostgreSQLAdapter");
13
16
  Object.defineProperty(exports, "PostgreSQLAdapter", { enumerable: true, get: function () { return PostgreSQLAdapter_1.PostgreSQLAdapter; } });
@@ -12,9 +12,11 @@ exports.RealtimeManager = void 0;
12
12
  * Manages Supabase real-time subscriptions for collaborative editing
13
13
  */
14
14
  class RealtimeManager {
15
+ adapter;
16
+ channels = new Map();
17
+ logger;
15
18
  constructor(adapter) {
16
19
  this.adapter = adapter;
17
- this.channels = new Map();
18
20
  // Access logger from adapter (it's a public property but typed generically)
19
21
  this.logger = adapter.logger;
20
22
  }
@@ -13,6 +13,8 @@ exports.FullTextSearchManager = void 0;
13
13
  * Enables fuzzy matching and typo-tolerance
14
14
  */
15
15
  class FullTextSearchManager {
16
+ adapter;
17
+ logger;
16
18
  constructor(adapter) {
17
19
  this.adapter = adapter;
18
20
  // Access logger from adapter (it's a public property but typed generically)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bernierllc/database-adapter-postgresql",
3
- "version": "1.2.5",
3
+ "version": "1.4.0",
4
4
  "description": "PostgreSQL/Supabase Database Adapter Implementation with RLS, real-time subscriptions, and full-text search",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -19,10 +19,10 @@
19
19
  "dependencies": {
20
20
  "@supabase/supabase-js": "^2.38.0",
21
21
  "pg": "^8.11.0",
22
- "@bernierllc/crypto-utils": "1.2.0",
23
- "@bernierllc/database-adapter-core": "1.0.11",
24
- "@bernierllc/logger": "1.4.3",
25
- "@bernierllc/retry-policy": "0.5.1"
22
+ "@bernierllc/crypto-utils": "1.3.0",
23
+ "@bernierllc/database-adapter-core": "1.1.0",
24
+ "@bernierllc/logger": "1.6.0",
25
+ "@bernierllc/retry-policy": "0.6.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/jest": "^29.0.0",