@bernierllc/database-adapter-core 3.0.0 → 3.0.2

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.
Files changed (58) hide show
  1. package/package.json +2 -2
  2. package/dist/base/BaseDatabaseAdapter.d.ts +0 -34
  3. package/dist/base/BaseDatabaseAdapter.d.ts.map +0 -1
  4. package/dist/base/BaseDatabaseAdapter.js +0 -53
  5. package/dist/base/BaseMigrationManager.d.ts +0 -41
  6. package/dist/base/BaseMigrationManager.d.ts.map +0 -1
  7. package/dist/base/BaseMigrationManager.js +0 -115
  8. package/dist/base/BaseQueryBuilder.d.ts +0 -68
  9. package/dist/base/BaseQueryBuilder.d.ts.map +0 -1
  10. package/dist/base/BaseQueryBuilder.js +0 -103
  11. package/dist/base/BaseTransaction.d.ts +0 -13
  12. package/dist/base/BaseTransaction.d.ts.map +0 -1
  13. package/dist/base/BaseTransaction.js +0 -17
  14. package/dist/base/index.d.ts +0 -5
  15. package/dist/base/index.d.ts.map +0 -1
  16. package/dist/base/index.js +0 -27
  17. package/dist/errors.d.ts +0 -53
  18. package/dist/errors.d.ts.map +0 -1
  19. package/dist/errors.js +0 -58
  20. package/dist/index.d.ts +0 -11
  21. package/dist/index.d.ts.map +0 -1
  22. package/dist/index.js +0 -37
  23. package/dist/interfaces/IConnectionPool.d.ts +0 -41
  24. package/dist/interfaces/IConnectionPool.d.ts.map +0 -1
  25. package/dist/interfaces/IConnectionPool.js +0 -9
  26. package/dist/interfaces/IDatabaseAdapter.d.ts +0 -45
  27. package/dist/interfaces/IDatabaseAdapter.d.ts.map +0 -1
  28. package/dist/interfaces/IDatabaseAdapter.js +0 -9
  29. package/dist/interfaces/IDatabaseConfig.d.ts +0 -40
  30. package/dist/interfaces/IDatabaseConfig.d.ts.map +0 -1
  31. package/dist/interfaces/IDatabaseConfig.js +0 -9
  32. package/dist/interfaces/IDatabaseHealth.d.ts +0 -16
  33. package/dist/interfaces/IDatabaseHealth.d.ts.map +0 -1
  34. package/dist/interfaces/IDatabaseHealth.js +0 -9
  35. package/dist/interfaces/IMigration.d.ts +0 -54
  36. package/dist/interfaces/IMigration.d.ts.map +0 -1
  37. package/dist/interfaces/IMigration.js +0 -9
  38. package/dist/interfaces/IQueryBuilder.d.ts +0 -106
  39. package/dist/interfaces/IQueryBuilder.d.ts.map +0 -1
  40. package/dist/interfaces/IQueryBuilder.js +0 -9
  41. package/dist/interfaces/IQueryResult.d.ts +0 -28
  42. package/dist/interfaces/IQueryResult.d.ts.map +0 -1
  43. package/dist/interfaces/IQueryResult.js +0 -9
  44. package/dist/interfaces/IRLSContext.d.ts +0 -15
  45. package/dist/interfaces/IRLSContext.d.ts.map +0 -1
  46. package/dist/interfaces/IRLSContext.js +0 -9
  47. package/dist/interfaces/ITransaction.d.ts +0 -50
  48. package/dist/interfaces/ITransaction.d.ts.map +0 -1
  49. package/dist/interfaces/ITransaction.js +0 -9
  50. package/dist/interfaces/index.d.ts +0 -10
  51. package/dist/interfaces/index.d.ts.map +0 -1
  52. package/dist/interfaces/index.js +0 -32
  53. package/dist/rls/RLSContextManager.d.ts +0 -45
  54. package/dist/rls/RLSContextManager.d.ts.map +0 -1
  55. package/dist/rls/RLSContextManager.js +0 -86
  56. package/dist/rls/index.d.ts +0 -2
  57. package/dist/rls/index.d.ts.map +0 -1
  58. package/dist/rls/index.js +0 -24
@@ -1,45 +0,0 @@
1
- import { IRLSContext } from '../interfaces';
2
- /**
3
- * Row Level Security context manager
4
- * Enables multi-tenant security and user-based access control
5
- */
6
- export declare class RLSContextManager {
7
- private context;
8
- /**
9
- * Set RLS context for current operation
10
- * Context is scoped to this manager instance
11
- * @param context - RLS context to set
12
- */
13
- setContext(context: IRLSContext): void;
14
- /**
15
- * Get current RLS context
16
- * @returns Current context or null if not set
17
- */
18
- getContext(): IRLSContext | null;
19
- /**
20
- * Clear RLS context
21
- */
22
- clearContext(): void;
23
- /**
24
- * Execute function with RLS context
25
- * Restores previous context after execution
26
- * @template T - Return type of function
27
- * @param context - RLS context to use
28
- * @param fn - Function to execute
29
- * @returns Result of function execution
30
- */
31
- withContext<T>(context: IRLSContext, fn: () => Promise<T>): Promise<T>;
32
- /**
33
- * Generate PostgreSQL SET statements for RLS
34
- * These statements set session variables that can be used in RLS policies
35
- * @returns Array of SQL SET statements
36
- */
37
- generateRLSStatements(): string[];
38
- /**
39
- * Escape single quotes in values for SQL safety
40
- * @param value - Value to escape
41
- * @returns Escaped value
42
- */
43
- private escapeValue;
44
- }
45
- //# sourceMappingURL=RLSContextManager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RLSContextManager.d.ts","sourceRoot":"","sources":["../../src/rls/RLSContextManager.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;;GAGG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,OAAO,CAA4B;IAE3C;;;;OAIG;IACI,UAAU,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI;IAI7C;;;OAGG;IACI,UAAU,IAAI,WAAW,GAAG,IAAI;IAIvC;;OAEG;IACI,YAAY,IAAI,IAAI;IAI3B;;;;;;;OAOG;IACU,WAAW,CAAC,CAAC,EACxB,OAAO,EAAE,WAAW,EACpB,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC,CAAC,CAAC;IAUb;;;;OAIG;IACI,qBAAqB,IAAI,MAAM,EAAE;IAyBxC;;;;OAIG;IACH,OAAO,CAAC,WAAW;CAGpB"}
@@ -1,86 +0,0 @@
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.RLSContextManager = void 0;
11
- /**
12
- * Row Level Security context manager
13
- * Enables multi-tenant security and user-based access control
14
- */
15
- class RLSContextManager {
16
- context = null;
17
- /**
18
- * Set RLS context for current operation
19
- * Context is scoped to this manager instance
20
- * @param context - RLS context to set
21
- */
22
- setContext(context) {
23
- this.context = context;
24
- }
25
- /**
26
- * Get current RLS context
27
- * @returns Current context or null if not set
28
- */
29
- getContext() {
30
- return this.context;
31
- }
32
- /**
33
- * Clear RLS context
34
- */
35
- clearContext() {
36
- this.context = null;
37
- }
38
- /**
39
- * Execute function with RLS context
40
- * Restores previous context after execution
41
- * @template T - Return type of function
42
- * @param context - RLS context to use
43
- * @param fn - Function to execute
44
- * @returns Result of function execution
45
- */
46
- async withContext(context, fn) {
47
- const previous = this.context;
48
- this.context = context;
49
- try {
50
- return await fn();
51
- }
52
- finally {
53
- this.context = previous;
54
- }
55
- }
56
- /**
57
- * Generate PostgreSQL SET statements for RLS
58
- * These statements set session variables that can be used in RLS policies
59
- * @returns Array of SQL SET statements
60
- */
61
- generateRLSStatements() {
62
- if (!this.context) {
63
- return [];
64
- }
65
- const statements = [
66
- `SET LOCAL "app.user_id" = '${this.escapeValue(this.context.userId)}';`,
67
- `SET LOCAL "app.user_role" = '${this.escapeValue(this.context.userRole)}';`
68
- ];
69
- if (this.context.tenantId) {
70
- statements.push(`SET LOCAL "app.tenant_id" = '${this.escapeValue(this.context.tenantId)}';`);
71
- }
72
- if (this.context.claims) {
73
- statements.push(`SET LOCAL "app.claims" = '${this.escapeValue(JSON.stringify(this.context.claims))}';`);
74
- }
75
- return statements;
76
- }
77
- /**
78
- * Escape single quotes in values for SQL safety
79
- * @param value - Value to escape
80
- * @returns Escaped value
81
- */
82
- escapeValue(value) {
83
- return value.replace(/'/g, "''");
84
- }
85
- }
86
- exports.RLSContextManager = RLSContextManager;
@@ -1,2 +0,0 @@
1
- export * from './RLSContextManager';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/rls/index.ts"],"names":[],"mappings":"AAQA,cAAc,qBAAqB,CAAC"}
package/dist/rls/index.js DELETED
@@ -1,24 +0,0 @@
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
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- var desc = Object.getOwnPropertyDescriptor(m, k);
12
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
- desc = { enumerable: true, get: function() { return m[k]; } };
14
- }
15
- Object.defineProperty(o, k2, desc);
16
- }) : (function(o, m, k, k2) {
17
- if (k2 === undefined) k2 = k;
18
- o[k2] = m[k];
19
- }));
20
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
21
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
22
- };
23
- Object.defineProperty(exports, "__esModule", { value: true });
24
- __exportStar(require("./RLSContextManager"), exports);