dominus-sdk-nodejs 1.1.8 → 1.2.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.
package/dist/index.d.ts CHANGED
@@ -6,14 +6,24 @@
6
6
  * Usage:
7
7
  * import { dominus } from 'dominus-sdk-nodejs';
8
8
  *
9
- * // Secrets
10
- * const value = await dominus.secrets.get("DB_URL");
11
- * await dominus.secrets.upsert("KEY", "value");
9
+ * // Secrets (root-level shortcuts)
10
+ * const value = await dominus.get("DB_URL");
11
+ * await dominus.upsert("KEY", "value");
12
12
  *
13
- * // Database
13
+ * // Database (root-level shortcuts)
14
+ * const tables = await dominus.listTables();
15
+ * const users = await dominus.queryTable("users", { filters: { status: "active" } });
16
+ * await dominus.insertRow("users", { name: "John" });
17
+ *
18
+ * // Secure table access (with audit logging)
19
+ * const patients = await dominus.secure.query("patients", {
20
+ * reason: "Reviewing chart for appointment #123",
21
+ * actor: userId
22
+ * });
23
+ *
24
+ * // Database (namespace)
14
25
  * const tables = await dominus.db.tables();
15
26
  * const users = await dominus.db.query("users", { filters: { status: "active" } });
16
- * await dominus.db.insert("users", { name: "John" });
17
27
  *
18
28
  * // Redis
19
29
  * await dominus.redis.set("key", "value", { ttl: 3600 });
@@ -25,7 +35,7 @@
25
35
  *
26
36
  * // Auth
27
37
  * const users = await dominus.auth.listUsers();
28
- * await dominus.auth.addUser({ username: "john", password: "secret" });
38
+ * await dominus.auth.createUser({ username: "john", email: "j@ex.com", password: "secret" });
29
39
  *
30
40
  * // DDL
31
41
  * await dominus.ddl.createTable("orders", [{ name: "id", type: "UUID" }]);
@@ -45,21 +55,28 @@
45
55
  * // Health
46
56
  * const status = await dominus.health.check();
47
57
  *
58
+ * // Crypto helpers
59
+ * import { hashPassword, hashPsk, generateToken } from 'dominus-sdk-nodejs';
60
+ * const hashed = hashPassword("secret");
61
+ *
48
62
  * Configuration:
49
63
  * Set DOMINUS_TOKEN environment variable with your PSK token.
50
64
  */
51
65
  import { SecretsNamespace } from './namespaces/secrets.js';
52
- import { DbNamespace } from './namespaces/db.js';
66
+ import { DbNamespace, QueryOptions, QueryResult } from './namespaces/db.js';
53
67
  import { RedisNamespace } from './namespaces/redis.js';
54
68
  import { FilesNamespace } from './namespaces/files.js';
55
69
  import { AuthNamespace } from './namespaces/auth.js';
56
- import { DdlNamespace } from './namespaces/ddl.js';
70
+ import { DdlNamespace, ColumnDefinition } from './namespaces/ddl.js';
57
71
  import { LogsNamespace } from './namespaces/logs.js';
58
72
  import { PortalNamespace } from './namespaces/portal.js';
59
73
  import { CourierNamespace } from './namespaces/courier.js';
60
74
  import { OpenNamespace } from './namespaces/open.js';
61
75
  import { HealthNamespace } from './namespaces/health.js';
76
+ import { SecureNamespace } from './namespaces/secure.js';
62
77
  export { DominusError, AuthenticationError, AuthorizationError, NotFoundError, ValidationError, ConflictError, ServiceError, ConnectionError, TimeoutError, SecureTableError, } from './lib/errors.js';
78
+ export { hashPassword, verifyPasswordLocal, hashPsk, verifyPskLocal, generatePskLocal, hashToken, generateToken, } from './lib/crypto.js';
79
+ export { CircuitBreaker, DominusCache, exponentialBackoffWithJitter, dominusCache, orchestratorCircuitBreaker, } from './lib/cache.js';
63
80
  export type { DominusClient } from './lib/client.js';
64
81
  export type { Secret, UpsertResult } from './namespaces/secrets.js';
65
82
  export type { QueryOptions, QueryResult, TableInfo, ColumnInfo } from './namespaces/db.js';
@@ -70,10 +87,12 @@ export type { LogContext, LogEntry, BatchResult } from './namespaces/logs.js';
70
87
  export type { Session } from './namespaces/portal.js';
71
88
  export type { SendResult } from './namespaces/courier.js';
72
89
  export type { HealthStatus } from './namespaces/health.js';
90
+ export type { SecureQueryOptions, SecureAccessContext } from './namespaces/secure.js';
73
91
  /**
74
92
  * Main Dominus SDK class.
75
93
  *
76
- * Provides namespace-based access to all Dominus services.
94
+ * Provides namespace-based access to all Dominus services,
95
+ * plus root-level shortcuts for common operations.
77
96
  */
78
97
  export declare class Dominus {
79
98
  private _client;
@@ -81,6 +100,8 @@ export declare class Dominus {
81
100
  readonly secrets: SecretsNamespace;
82
101
  /** Database CRUD operations (Scribe) */
83
102
  readonly db: DbNamespace;
103
+ /** Secure table operations with audit logging */
104
+ readonly secure: SecureNamespace;
84
105
  /** Redis caching operations (Whisperer) */
85
106
  readonly redis: RedisNamespace;
86
107
  /** File storage operations (Archivist) */
@@ -108,6 +129,62 @@ export declare class Dominus {
108
129
  * Create or update a secret (shortcut for dominus.secrets.upsert).
109
130
  */
110
131
  upsert(key: string, value: string, comment?: string): Promise<import("./namespaces/secrets.js").UpsertResult>;
132
+ /**
133
+ * List tables in a schema (shortcut for dominus.db.tables).
134
+ */
135
+ listTables(schema?: string): Promise<import("./namespaces/db.js").TableInfo[]>;
136
+ /**
137
+ * Query table data (shortcut for dominus.db.query).
138
+ */
139
+ queryTable(table: string, options?: QueryOptions): Promise<QueryResult>;
140
+ /**
141
+ * Insert a row (shortcut for dominus.db.insert).
142
+ */
143
+ insertRow(table: string, data: Record<string, unknown>, options?: {
144
+ schema?: string;
145
+ reason?: string;
146
+ actor?: string;
147
+ }): Promise<Record<string, unknown>>;
148
+ /**
149
+ * Update rows (shortcut for dominus.db.update).
150
+ */
151
+ updateRows(table: string, data: Record<string, unknown>, filters: Record<string, unknown>, options?: {
152
+ schema?: string;
153
+ reason?: string;
154
+ actor?: string;
155
+ }): Promise<{
156
+ affected_rows: number;
157
+ }>;
158
+ /**
159
+ * Delete rows (shortcut for dominus.db.delete).
160
+ */
161
+ deleteRows(table: string, filters: Record<string, unknown>, options?: {
162
+ schema?: string;
163
+ reason?: string;
164
+ actor?: string;
165
+ }): Promise<{
166
+ affected_rows: number;
167
+ }>;
168
+ /**
169
+ * List columns in a table (shortcut for dominus.db.columns).
170
+ */
171
+ listColumns(table: string, schema?: string): Promise<import("./namespaces/db.js").ColumnInfo[]>;
172
+ /**
173
+ * Create a table (shortcut for dominus.ddl.createTable).
174
+ */
175
+ addTable(tableName: string, columns: ColumnDefinition[], schema?: string): Promise<Record<string, unknown>>;
176
+ /**
177
+ * Drop a table (shortcut for dominus.ddl.dropTable).
178
+ */
179
+ deleteTable(tableName: string, schema?: string): Promise<Record<string, unknown>>;
180
+ /**
181
+ * Add a column to a table (shortcut for dominus.ddl.addColumn).
182
+ */
183
+ addColumn(tableName: string, column: ColumnDefinition, schema?: string): Promise<Record<string, unknown>>;
184
+ /**
185
+ * Drop a column from a table (shortcut for dominus.ddl.dropColumn).
186
+ */
187
+ deleteColumn(tableName: string, columnName: string, schema?: string): Promise<Record<string, unknown>>;
111
188
  }
112
189
  export declare const dominus: Dominus;
113
190
  export default dominus;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAGzD,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,aAAa,EACb,eAAe,EACf,aAAa,EACb,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,gBAAg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,CAAA;KAAE;IAKhE;;OAEG;IACG,UAAU,CACd,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;;;IAKhE;;OAEG;IACG,UAAU,CACd,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;;;IAKhE;;OAEG;IACG,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,SAAW;IAQlD;;OAEG;IACG,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,EAAE,MAAM,SAAW;IAIhF;;OAEG;IACG,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,SAAW;IAItD;;OAEG;IACG,SAAS,CACb,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,gBAAgB,EACxB,MAAM,SAAW;IAKnB;;OAEG;IACG,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,SAAW;CAG5E;AAGD,eAAO,MAAM,OAAO,SAAgB,CAAC;AAGrC,eAAe,OAAO,CAAC"}
package/dist/index.js CHANGED
@@ -6,14 +6,24 @@
6
6
  * Usage:
7
7
  * import { dominus } from 'dominus-sdk-nodejs';
8
8
  *
9
- * // Secrets
10
- * const value = await dominus.secrets.get("DB_URL");
11
- * await dominus.secrets.upsert("KEY", "value");
9
+ * // Secrets (root-level shortcuts)
10
+ * const value = await dominus.get("DB_URL");
11
+ * await dominus.upsert("KEY", "value");
12
12
  *
13
- * // Database
13
+ * // Database (root-level shortcuts)
14
+ * const tables = await dominus.listTables();
15
+ * const users = await dominus.queryTable("users", { filters: { status: "active" } });
16
+ * await dominus.insertRow("users", { name: "John" });
17
+ *
18
+ * // Secure table access (with audit logging)
19
+ * const patients = await dominus.secure.query("patients", {
20
+ * reason: "Reviewing chart for appointment #123",
21
+ * actor: userId
22
+ * });
23
+ *
24
+ * // Database (namespace)
14
25
  * const tables = await dominus.db.tables();
15
26
  * const users = await dominus.db.query("users", { filters: { status: "active" } });
16
- * await dominus.db.insert("users", { name: "John" });
17
27
  *
18
28
  * // Redis
19
29
  * await dominus.redis.set("key", "value", { ttl: 3600 });
@@ -25,7 +35,7 @@
25
35
  *
26
36
  * // Auth
27
37
  * const users = await dominus.auth.listUsers();
28
- * await dominus.auth.addUser({ username: "john", password: "secret" });
38
+ * await dominus.auth.createUser({ username: "john", email: "j@ex.com", password: "secret" });
29
39
  *
30
40
  * // DDL
31
41
  * await dominus.ddl.createTable("orders", [{ name: "id", type: "UUID" }]);
@@ -45,6 +55,10 @@
45
55
  * // Health
46
56
  * const status = await dominus.health.check();
47
57
  *
58
+ * // Crypto helpers
59
+ * import { hashPassword, hashPsk, generateToken } from 'dominus-sdk-nodejs';
60
+ * const hashed = hashPassword("secret");
61
+ *
48
62
  * Configuration:
49
63
  * Set DOMINUS_TOKEN environment variable with your PSK token.
50
64
  */
@@ -60,12 +74,24 @@ import { PortalNamespace } from './namespaces/portal.js';
60
74
  import { CourierNamespace } from './namespaces/courier.js';
61
75
  import { OpenNamespace } from './namespaces/open.js';
62
76
  import { HealthNamespace } from './namespaces/health.js';
77
+ import { SecureNamespace } from './namespaces/secure.js';
78
+ // Initialize cache with token for encryption
79
+ import { dominusCache } from './lib/cache.js';
80
+ const token = process.env.DOMINUS_TOKEN;
81
+ if (token) {
82
+ dominusCache.setEncryptionKey(token);
83
+ }
63
84
  // Re-export errors for consumers
64
85
  export { DominusError, AuthenticationError, AuthorizationError, NotFoundError, ValidationError, ConflictError, ServiceError, ConnectionError, TimeoutError, SecureTableError, } from './lib/errors.js';
86
+ // Re-export crypto helpers for consumers
87
+ export { hashPassword, verifyPasswordLocal, hashPsk, verifyPskLocal, generatePskLocal, hashToken, generateToken, } from './lib/crypto.js';
88
+ // Re-export cache utilities (internal but useful)
89
+ export { CircuitBreaker, DominusCache, exponentialBackoffWithJitter, dominusCache, orchestratorCircuitBreaker, } from './lib/cache.js';
65
90
  /**
66
91
  * Main Dominus SDK class.
67
92
  *
68
- * Provides namespace-based access to all Dominus services.
93
+ * Provides namespace-based access to all Dominus services,
94
+ * plus root-level shortcuts for common operations.
69
95
  */
70
96
  export class Dominus {
71
97
  _client;
@@ -73,6 +99,8 @@ export class Dominus {
73
99
  secrets;
74
100
  /** Database CRUD operations (Scribe) */
75
101
  db;
102
+ /** Secure table operations with audit logging */
103
+ secure;
76
104
  /** Redis caching operations (Whisperer) */
77
105
  redis;
78
106
  /** File storage operations (Archivist) */
@@ -96,6 +124,7 @@ export class Dominus {
96
124
  // Initialize all namespaces
97
125
  this.secrets = new SecretsNamespace(this._client);
98
126
  this.db = new DbNamespace(this._client);
127
+ this.secure = new SecureNamespace(this._client);
99
128
  this.redis = new RedisNamespace(this._client);
100
129
  this.files = new FilesNamespace(this._client);
101
130
  this.auth = new AuthNamespace(this._client);
@@ -107,7 +136,7 @@ export class Dominus {
107
136
  this.health = new HealthNamespace(this._client);
108
137
  }
109
138
  // ========================================
110
- // ROOT-LEVEL SHORTCUTS (convenience)
139
+ // ROOT-LEVEL SHORTCUTS - SECRETS
111
140
  // ========================================
112
141
  /**
113
142
  * Get a secret value (shortcut for dominus.secrets.get).
@@ -121,6 +150,72 @@ export class Dominus {
121
150
  async upsert(key, value, comment) {
122
151
  return this.secrets.upsert(key, value, comment);
123
152
  }
153
+ // ========================================
154
+ // ROOT-LEVEL SHORTCUTS - DATABASE
155
+ // ========================================
156
+ /**
157
+ * List tables in a schema (shortcut for dominus.db.tables).
158
+ */
159
+ async listTables(schema = 'public') {
160
+ return this.db.tables(schema);
161
+ }
162
+ /**
163
+ * Query table data (shortcut for dominus.db.query).
164
+ */
165
+ async queryTable(table, options) {
166
+ return this.db.query(table, options);
167
+ }
168
+ /**
169
+ * Insert a row (shortcut for dominus.db.insert).
170
+ */
171
+ async insertRow(table, data, options) {
172
+ return this.db.insert(table, data, options);
173
+ }
174
+ /**
175
+ * Update rows (shortcut for dominus.db.update).
176
+ */
177
+ async updateRows(table, data, filters, options) {
178
+ return this.db.update(table, data, filters, options);
179
+ }
180
+ /**
181
+ * Delete rows (shortcut for dominus.db.delete).
182
+ */
183
+ async deleteRows(table, filters, options) {
184
+ return this.db.delete(table, filters, options);
185
+ }
186
+ /**
187
+ * List columns in a table (shortcut for dominus.db.columns).
188
+ */
189
+ async listColumns(table, schema = 'public') {
190
+ return this.db.columns(table, schema);
191
+ }
192
+ // ========================================
193
+ // ROOT-LEVEL SHORTCUTS - DDL
194
+ // ========================================
195
+ /**
196
+ * Create a table (shortcut for dominus.ddl.createTable).
197
+ */
198
+ async addTable(tableName, columns, schema = 'public') {
199
+ return this.ddl.createTable(tableName, columns, schema);
200
+ }
201
+ /**
202
+ * Drop a table (shortcut for dominus.ddl.dropTable).
203
+ */
204
+ async deleteTable(tableName, schema = 'public') {
205
+ return this.ddl.dropTable(tableName, schema);
206
+ }
207
+ /**
208
+ * Add a column to a table (shortcut for dominus.ddl.addColumn).
209
+ */
210
+ async addColumn(tableName, column, schema = 'public') {
211
+ return this.ddl.addColumn(tableName, column, schema);
212
+ }
213
+ /**
214
+ * Drop a column from a table (shortcut for dominus.ddl.dropColumn).
215
+ */
216
+ async deleteColumn(tableName, columnName, schema = 'public') {
217
+ return this.ddl.dropColumn(tableName, columnName, schema);
218
+ }
124
219
  }
125
220
  // Create and export singleton instance
126
221
  export const dominus = new Dominus();
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version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AEG;IACH,KAAK,CAAC,WAAW,CAAC,SAAiB,EAAE,MAAM,GAAG,QAAQ;QACpD,OAAO,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAC/C,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,SAAS,CACb,SAAiB,EACjB,MAAwB,EACxB,MAAM,GAAG,QAAQ;QAEjB,OAAO,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACvD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,YAAY,CAAC,SAAiB,EAAE,UAAkB,EAAE,MAAM,GAAG,QAAQ;QACzE,OAAO,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,SAAS,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;IAC5D,CAAC;CACF;AAED,uCAAuC;AACvC,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAErC,uCAAuC;AACvC,eAAe,OAAO,CAAC"}
@@ -0,0 +1,112 @@
1
+ /**
2
+ * Internal cache with automatic encryption and circuit breaker.
3
+ *
4
+ * NOT exposed to SDK users - internal use only.
5
+ */
6
+ /**
7
+ * Circuit breaker states.
8
+ */
9
+ declare enum CircuitState {
10
+ CLOSED = "closed",
11
+ OPEN = "open",
12
+ HALF_OPEN = "half_open"
13
+ }
14
+ /**
15
+ * Simple circuit breaker to prevent runaway retries.
16
+ *
17
+ * States:
18
+ * - CLOSED: Normal operation, requests pass through
19
+ * - OPEN: Too many failures, requests blocked
20
+ * - HALF_OPEN: Testing if service recovered
21
+ *
22
+ * Prevents CPU/quota exhaustion from retry storms.
23
+ */
24
+ export declare class CircuitBreaker {
25
+ private failureThreshold;
26
+ private recoveryTimeout;
27
+ private halfOpenMaxCalls;
28
+ private failureCount;
29
+ private state;
30
+ private lastFailureTime;
31
+ private halfOpenCalls;
32
+ constructor(failureThreshold?: number, recoveryTimeout?: number, // 30 seconds in ms
33
+ halfOpenMaxCalls?: number);
34
+ /**
35
+ * Get current state, transitioning OPEN→HALF_OPEN if timeout elapsed.
36
+ */
37
+ getState(): CircuitState;
38
+ /**
39
+ * Check if a request can be executed.
40
+ */
41
+ canExecute(): boolean;
42
+ /**
43
+ * Record a successful call.
44
+ */
45
+ recordSuccess(): void;
46
+ /**
47
+ * Record a failed call.
48
+ */
49
+ recordFailure(): void;
50
+ /**
51
+ * Record a call attempt in HALF_OPEN state.
52
+ */
53
+ recordHalfOpenCall(): void;
54
+ /**
55
+ * Reset the circuit breaker.
56
+ */
57
+ reset(): void;
58
+ }
59
+ /**
60
+ * Calculate backoff delay with jitter to prevent thundering herd.
61
+ *
62
+ * @param attempt - Zero-based attempt number
63
+ * @param baseDelay - Base delay in milliseconds
64
+ * @param maxDelay - Maximum delay cap
65
+ * @param jitter - Jitter factor (0-1), adds randomness
66
+ * @returns Delay in milliseconds
67
+ */
68
+ export declare function exponentialBackoffWithJitter(attempt: number, baseDelay?: number, maxDelay?: number, jitter?: number): number;
69
+ /**
70
+ * Internal process-local cache with auto-encryption.
71
+ *
72
+ * Used by dominus services only:
73
+ * - Validation state
74
+ * - Service URLs
75
+ * - API responses
76
+ *
77
+ * NOT accessible by SDK users.
78
+ */
79
+ export declare class DominusCache {
80
+ private defaultTtl;
81
+ private store;
82
+ private cipher;
83
+ constructor(defaultTtl?: number);
84
+ /**
85
+ * Initialize encryption using auth token.
86
+ */
87
+ setEncryptionKey(token: string): void;
88
+ /**
89
+ * Get and decrypt, refresh TTL.
90
+ */
91
+ get<T = unknown>(key: string): T | null;
92
+ /**
93
+ * Encrypt and store.
94
+ */
95
+ set<T = unknown>(key: string, value: T, ttl?: number): void;
96
+ /**
97
+ * Delete key.
98
+ */
99
+ delete(key: string): boolean;
100
+ /**
101
+ * Clear all.
102
+ */
103
+ clear(): number;
104
+ /**
105
+ * Get cache size.
106
+ */
107
+ size(): number;
108
+ }
109
+ export declare const dominusCache: DominusCache;
110
+ export declare const orchestratorCircuitBreaker: CircuitBreaker;
111
+ export {};
112
+ //# sourceMappingURL=cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/lib/cache.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AACH,aAAK,YAAY;IACf,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,SAAS,cAAc;CACxB;AAED;;;;;;;;;GASG;AACH,qBAAa,cAAc;IAOvB,OAAO,CAAC,gBAAgB;IACxB,OAAO,CAAC,eAAe;IACvB,OAAO,CAAC,gBAAgB;IAR1B,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,KAAK,CAAqC;IAClD,OAAO,CAAC,eAAe,CAAK;IAC5B,OAAO,CAAC,aAAa,CAAK;gBAGhB,gBAAgB,SAAI,EACpB,eAAe,SAAQ,EAAE,mBAAmB;IAC5C,gBAAgB,SAAI;IAG9B;;OAEG;IACH,QAAQ,IAAI,YAAY;IAUxB;;OAEG;IACH,UAAU,IAAI,OAAO;IAWrB;;OAEG;IACH,aAAa,IAAI,IAAI;IAQrB;;OAEG;IACH,aAAa,IAAI,IAAI;IAYrB;;OAEG;IACH,kBAAkB,IAAI,IAAI;IAI1B;;OAEG;IACH,KAAK,IAAI,IAAI;CAMd;AAED;;;;;;;;GAQG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,MAAM,EACf,SAAS,SAAO,EAChB,QAAQ,SAAQ,EAChB,MAAM,SAAM,GACX,MAAM,CAIR;AAOD;;;;;;;;;GASG;AACH,qBAAa,YAAY;IAIX,OAAO,CAAC,UAAU;IAH9B,OAAO,CAAC,KAAK,CAAiC;IAC9C,OAAO,CAAC,MAAM,CAAmD;gBAE7C,UAAU,SAAS;IAEvC;;OAEG;IACH,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAMrC;;OAEG;IACH,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI;IA4CvC;;OAEG;IACH,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI;IA+B3D;;OAEG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAI5B;;OAEG;IACH,KAAK,IAAI,MAAM;IAMf;;OAEG;IACH,IAAI,IAAI,MAAM;CAGf;AAGD,eAAO,MAAM,YAAY,cAA2B,CAAC;AAGrD,eAAO,MAAM,0BAA0B,gBAItC,CAAC"}
@@ -0,0 +1,237 @@
1
+ /**
2
+ * Internal cache with automatic encryption and circuit breaker.
3
+ *
4
+ * NOT exposed to SDK users - internal use only.
5
+ */
6
+ import crypto from 'crypto';
7
+ /**
8
+ * Circuit breaker states.
9
+ */
10
+ var CircuitState;
11
+ (function (CircuitState) {
12
+ CircuitState["CLOSED"] = "closed";
13
+ CircuitState["OPEN"] = "open";
14
+ CircuitState["HALF_OPEN"] = "half_open";
15
+ })(CircuitState || (CircuitState = {}));
16
+ /**
17
+ * Simple circuit breaker to prevent runaway retries.
18
+ *
19
+ * States:
20
+ * - CLOSED: Normal operation, requests pass through
21
+ * - OPEN: Too many failures, requests blocked
22
+ * - HALF_OPEN: Testing if service recovered
23
+ *
24
+ * Prevents CPU/quota exhaustion from retry storms.
25
+ */
26
+ export class CircuitBreaker {
27
+ failureThreshold;
28
+ recoveryTimeout;
29
+ halfOpenMaxCalls;
30
+ failureCount = 0;
31
+ state = CircuitState.CLOSED;
32
+ lastFailureTime = 0;
33
+ halfOpenCalls = 0;
34
+ constructor(failureThreshold = 5, recoveryTimeout = 30000, // 30 seconds in ms
35
+ halfOpenMaxCalls = 1) {
36
+ this.failureThreshold = failureThreshold;
37
+ this.recoveryTimeout = recoveryTimeout;
38
+ this.halfOpenMaxCalls = halfOpenMaxCalls;
39
+ }
40
+ /**
41
+ * Get current state, transitioning OPEN→HALF_OPEN if timeout elapsed.
42
+ */
43
+ getState() {
44
+ if (this.state === CircuitState.OPEN) {
45
+ if (Date.now() - this.lastFailureTime >= this.recoveryTimeout) {
46
+ this.state = CircuitState.HALF_OPEN;
47
+ this.halfOpenCalls = 0;
48
+ }
49
+ }
50
+ return this.state;
51
+ }
52
+ /**
53
+ * Check if a request can be executed.
54
+ */
55
+ canExecute() {
56
+ const state = this.getState();
57
+ if (state === CircuitState.CLOSED) {
58
+ return true;
59
+ }
60
+ if (state === CircuitState.HALF_OPEN) {
61
+ return this.halfOpenCalls < this.halfOpenMaxCalls;
62
+ }
63
+ return false; // OPEN
64
+ }
65
+ /**
66
+ * Record a successful call.
67
+ */
68
+ recordSuccess() {
69
+ if (this.state === CircuitState.HALF_OPEN) {
70
+ this.state = CircuitState.CLOSED;
71
+ }
72
+ this.failureCount = 0;
73
+ this.halfOpenCalls = 0;
74
+ }
75
+ /**
76
+ * Record a failed call.
77
+ */
78
+ recordFailure() {
79
+ this.failureCount++;
80
+ this.lastFailureTime = Date.now();
81
+ if (this.state === CircuitState.HALF_OPEN) {
82
+ // Failed during recovery test, go back to OPEN
83
+ this.state = CircuitState.OPEN;
84
+ }
85
+ else if (this.failureCount >= this.failureThreshold) {
86
+ this.state = CircuitState.OPEN;
87
+ }
88
+ }
89
+ /**
90
+ * Record a call attempt in HALF_OPEN state.
91
+ */
92
+ recordHalfOpenCall() {
93
+ this.halfOpenCalls++;
94
+ }
95
+ /**
96
+ * Reset the circuit breaker.
97
+ */
98
+ reset() {
99
+ this.failureCount = 0;
100
+ this.state = CircuitState.CLOSED;
101
+ this.lastFailureTime = 0;
102
+ this.halfOpenCalls = 0;
103
+ }
104
+ }
105
+ /**
106
+ * Calculate backoff delay with jitter to prevent thundering herd.
107
+ *
108
+ * @param attempt - Zero-based attempt number
109
+ * @param baseDelay - Base delay in milliseconds
110
+ * @param maxDelay - Maximum delay cap
111
+ * @param jitter - Jitter factor (0-1), adds randomness
112
+ * @returns Delay in milliseconds
113
+ */
114
+ export function exponentialBackoffWithJitter(attempt, baseDelay = 1000, maxDelay = 30000, jitter = 0.5) {
115
+ const delay = Math.min(baseDelay * Math.pow(2, attempt), maxDelay);
116
+ const jitterRange = delay * jitter;
117
+ return delay + (Math.random() * 2 - 1) * jitterRange;
118
+ }
119
+ /**
120
+ * Internal process-local cache with auto-encryption.
121
+ *
122
+ * Used by dominus services only:
123
+ * - Validation state
124
+ * - Service URLs
125
+ * - API responses
126
+ *
127
+ * NOT accessible by SDK users.
128
+ */
129
+ export class DominusCache {
130
+ defaultTtl;
131
+ store = new Map();
132
+ cipher = null;
133
+ constructor(defaultTtl = 300000) {
134
+ this.defaultTtl = defaultTtl;
135
+ } // 5 minutes in ms
136
+ /**
137
+ * Initialize encryption using auth token.
138
+ */
139
+ setEncryptionKey(token) {
140
+ if (!token)
141
+ return;
142
+ const key = crypto.createHash('sha256').update(token).digest();
143
+ this.cipher = { key, algorithm: 'aes-256-gcm' };
144
+ }
145
+ /**
146
+ * Get and decrypt, refresh TTL.
147
+ */
148
+ get(key) {
149
+ const entry = this.store.get(key);
150
+ if (!entry)
151
+ return null;
152
+ // Check expiry
153
+ if (Date.now() >= entry.expiresAt) {
154
+ this.store.delete(key);
155
+ return null;
156
+ }
157
+ try {
158
+ let value;
159
+ if (this.cipher) {
160
+ // Decrypt
161
+ const iv = entry.encryptedValue.subarray(0, 16);
162
+ const authTag = entry.encryptedValue.subarray(16, 32);
163
+ const encrypted = entry.encryptedValue.subarray(32);
164
+ const decipher = crypto.createDecipheriv(this.cipher.algorithm, this.cipher.key, iv);
165
+ decipher.setAuthTag(authTag);
166
+ const decrypted = Buffer.concat([
167
+ decipher.update(encrypted),
168
+ decipher.final(),
169
+ ]);
170
+ value = JSON.parse(decrypted.toString('utf8'));
171
+ }
172
+ else {
173
+ value = JSON.parse(entry.encryptedValue.toString('utf8'));
174
+ }
175
+ // Touch TTL
176
+ entry.expiresAt = Date.now() + this.defaultTtl;
177
+ return value;
178
+ }
179
+ catch {
180
+ this.store.delete(key);
181
+ return null;
182
+ }
183
+ }
184
+ /**
185
+ * Encrypt and store.
186
+ */
187
+ set(key, value, ttl) {
188
+ const duration = ttl ?? this.defaultTtl;
189
+ const plaintext = JSON.stringify(value);
190
+ let encryptedValue;
191
+ if (this.cipher) {
192
+ const iv = crypto.randomBytes(16);
193
+ const cipher = crypto.createCipheriv(this.cipher.algorithm, this.cipher.key, iv);
194
+ const encrypted = Buffer.concat([
195
+ cipher.update(plaintext, 'utf8'),
196
+ cipher.final(),
197
+ ]);
198
+ const authTag = cipher.getAuthTag();
199
+ encryptedValue = Buffer.concat([iv, authTag, encrypted]);
200
+ }
201
+ else {
202
+ encryptedValue = Buffer.from(plaintext, 'utf8');
203
+ }
204
+ this.store.set(key, {
205
+ encryptedValue,
206
+ expiresAt: Date.now() + duration,
207
+ });
208
+ }
209
+ /**
210
+ * Delete key.
211
+ */
212
+ delete(key) {
213
+ return this.store.delete(key);
214
+ }
215
+ /**
216
+ * Clear all.
217
+ */
218
+ clear() {
219
+ const count = this.store.size;
220
+ this.store.clear();
221
+ return count;
222
+ }
223
+ /**
224
+ * Get cache size.
225
+ */
226
+ size() {
227
+ return this.store.size;
228
+ }
229
+ }
230
+ // Internal singletons - NOT exported to users
231
+ export const dominusCache = new DominusCache(300000); // 5 minutes
232
+ // Circuit breakers for different services (prevents retry storms)
233
+ export const orchestratorCircuitBreaker = new CircuitBreaker(5, // Open after 5 consecutive failures
234
+ 30000, // Try again after 30 seconds
235
+ 1 // Allow 1 test call in half-open state
236
+ );
237
+ //# sourceMappingURL=cache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.js","sourceRoot":"","sources":["../../src/lib/cache.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B;;GAEG;AACH,IAAK,YAIJ;AAJD,WAAK,YAAY;IACf,iCAAiB,CAAA;IACjB,6BAAa,CAAA;IACb,uCAAuB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C,CAAC,CAAM,uCAAuC;CAC/C,CAAC"}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Cryptographic helpers for password and PSK hashing.
3
+ *
4
+ * All hashing is done client-side (in SDK) before sending to Orchestrator.
5
+ * This ensures passwords/PSKs are never transmitted in plaintext.
6
+ */
7
+ /**
8
+ * Hash a password using bcrypt.
9
+ *
10
+ * @param password - Raw password string
11
+ * @returns Bcrypt hash string (includes salt)
12
+ */
13
+ export declare function hashPassword(password: string): string;
14
+ /**
15
+ * Verify a password against a bcrypt hash locally.
16
+ *
17
+ * This is primarily for testing. In production, verification
18
+ * happens via the orchestrator's verify endpoints.
19
+ *
20
+ * @param password - Raw password to verify
21
+ * @param passwordHash - Bcrypt hash to compare against
22
+ * @returns True if password matches hash
23
+ */
24
+ export declare function verifyPasswordLocal(password: string, passwordHash: string): boolean;
25
+ /**
26
+ * Hash a PSK (Pre-Shared Key) using bcrypt.
27
+ *
28
+ * @param psk - Raw PSK string
29
+ * @returns Bcrypt hash string (includes salt)
30
+ */
31
+ export declare function hashPsk(psk: string): string;
32
+ /**
33
+ * Verify a PSK against a bcrypt hash locally.
34
+ *
35
+ * This is primarily for testing. In production, verification
36
+ * happens via the orchestrator's verify endpoints.
37
+ *
38
+ * @param psk - Raw PSK to verify
39
+ * @param pskHash - Bcrypt hash to compare against
40
+ * @returns True if PSK matches hash
41
+ */
42
+ export declare function verifyPskLocal(psk: string, pskHash: string): boolean;
43
+ /**
44
+ * Generate a random PSK locally.
45
+ *
46
+ * Note: In production, prefer using the orchestrator's PSK generation
47
+ * for centralized PSK management. This is a fallback.
48
+ *
49
+ * @param length - Length of PSK to generate (default: 32)
50
+ * @returns Random PSK string
51
+ */
52
+ export declare function generatePskLocal(length?: number): string;
53
+ /**
54
+ * Hash a token using SHA-256.
55
+ *
56
+ * Used for refresh tokens where we need fast comparison
57
+ * and don't need the security properties of bcrypt.
58
+ *
59
+ * @param token - Raw token string
60
+ * @returns SHA-256 hex digest
61
+ */
62
+ export declare function hashToken(token: string): string;
63
+ /**
64
+ * Generate a random token string.
65
+ *
66
+ * @param length - Length of token to generate (default: 64)
67
+ * @returns Random URL-safe token string
68
+ */
69
+ export declare function generateToken(length?: number): string;
70
+ //# sourceMappingURL=crypto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../src/lib/crypto.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAGrD;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAEnF;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAG3C;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAEpE;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,SAAK,GAAG,MAAM,CAQpD;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,MAAM,SAAK,GAAG,MAAM,CAEjD"}
@@ -0,0 +1,95 @@
1
+ /**
2
+ * Cryptographic helpers for password and PSK hashing.
3
+ *
4
+ * All hashing is done client-side (in SDK) before sending to Orchestrator.
5
+ * This ensures passwords/PSKs are never transmitted in plaintext.
6
+ */
7
+ import bcrypt from 'bcryptjs';
8
+ import crypto from 'crypto';
9
+ const BCRYPT_ROUNDS = 12;
10
+ /**
11
+ * Hash a password using bcrypt.
12
+ *
13
+ * @param password - Raw password string
14
+ * @returns Bcrypt hash string (includes salt)
15
+ */
16
+ export function hashPassword(password) {
17
+ const salt = bcrypt.genSaltSync(BCRYPT_ROUNDS);
18
+ return bcrypt.hashSync(password, salt);
19
+ }
20
+ /**
21
+ * Verify a password against a bcrypt hash locally.
22
+ *
23
+ * This is primarily for testing. In production, verification
24
+ * happens via the orchestrator's verify endpoints.
25
+ *
26
+ * @param password - Raw password to verify
27
+ * @param passwordHash - Bcrypt hash to compare against
28
+ * @returns True if password matches hash
29
+ */
30
+ export function verifyPasswordLocal(password, passwordHash) {
31
+ return bcrypt.compareSync(password, passwordHash);
32
+ }
33
+ /**
34
+ * Hash a PSK (Pre-Shared Key) using bcrypt.
35
+ *
36
+ * @param psk - Raw PSK string
37
+ * @returns Bcrypt hash string (includes salt)
38
+ */
39
+ export function hashPsk(psk) {
40
+ const salt = bcrypt.genSaltSync(BCRYPT_ROUNDS);
41
+ return bcrypt.hashSync(psk, salt);
42
+ }
43
+ /**
44
+ * Verify a PSK against a bcrypt hash locally.
45
+ *
46
+ * This is primarily for testing. In production, verification
47
+ * happens via the orchestrator's verify endpoints.
48
+ *
49
+ * @param psk - Raw PSK to verify
50
+ * @param pskHash - Bcrypt hash to compare against
51
+ * @returns True if PSK matches hash
52
+ */
53
+ export function verifyPskLocal(psk, pskHash) {
54
+ return bcrypt.compareSync(psk, pskHash);
55
+ }
56
+ /**
57
+ * Generate a random PSK locally.
58
+ *
59
+ * Note: In production, prefer using the orchestrator's PSK generation
60
+ * for centralized PSK management. This is a fallback.
61
+ *
62
+ * @param length - Length of PSK to generate (default: 32)
63
+ * @returns Random PSK string
64
+ */
65
+ export function generatePskLocal(length = 32) {
66
+ const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*';
67
+ let result = '';
68
+ const randomBytes = crypto.randomBytes(length);
69
+ for (let i = 0; i < length; i++) {
70
+ result += alphabet[randomBytes[i] % alphabet.length];
71
+ }
72
+ return result;
73
+ }
74
+ /**
75
+ * Hash a token using SHA-256.
76
+ *
77
+ * Used for refresh tokens where we need fast comparison
78
+ * and don't need the security properties of bcrypt.
79
+ *
80
+ * @param token - Raw token string
81
+ * @returns SHA-256 hex digest
82
+ */
83
+ export function hashToken(token) {
84
+ return crypto.createHash('sha256').update(token).digest('hex');
85
+ }
86
+ /**
87
+ * Generate a random token string.
88
+ *
89
+ * @param length - Length of token to generate (default: 64)
90
+ * @returns Random URL-safe token string
91
+ */
92
+ export function generateToken(length = 64) {
93
+ return crypto.randomBytes(length).toString('base64url');
94
+ }
95
+ //# sourceMappingURL=crypto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crypto.js","sourceRoot":"","sources":["../../src/lib/crypto.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,MAAM,aAAa,GAAG,EAAE,CAAC;AAEzB;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,QAAgB;IAC3C,MAAM,IAAI,GAAG,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;IAC/C,OAAO,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AACzC,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,mBAAmB,CAAC,QAAgB,EAAE,YAAoB;IACxE,OAAO,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;AACpD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,OAAO,CAAC,GAAW;IACjC,MAAM,IAAI,GAAG,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;IAC/C,OAAO,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;AACpC,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,cAAc,CAAC,GAAW,EAAE,OAAe;IACzD,OAAO,MAAM,CAAC,WAAW,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AAC1C,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAM,GAAG,EAAE;IAC1C,MAAM,QAAQ,GAAG,wEAAwE,CAAC;IAC1F,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAC/C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAChC,MAAM,IAAI,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;IACvD,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,SAAS,CAAC,KAAa;IACrC,OAAO,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACjE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,MAAM,GAAG,EAAE;IACvC,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;AAC1D,CAAC"}
@@ -0,0 +1,102 @@
1
+ /**
2
+ * Secure Namespace - Operations requiring audit logging.
3
+ *
4
+ * Provides convenience methods for accessing tables registered as secure.
5
+ * All operations automatically include reason/actor for audit trail.
6
+ *
7
+ * Secure tables are registered via auth.createSecureTable() and require
8
+ * a justification reason for every access.
9
+ */
10
+ import type { DominusClient } from '../lib/client.js';
11
+ import type { QueryResult, TableInfo, ColumnInfo } from './db.js';
12
+ export interface SecureQueryOptions {
13
+ schema?: string;
14
+ filters?: Record<string, unknown>;
15
+ sortBy?: string;
16
+ sortOrder?: 'ASC' | 'DESC';
17
+ limit?: number;
18
+ offset?: number;
19
+ }
20
+ export interface SecureAccessContext {
21
+ /** Justification for accessing secure data (required) */
22
+ reason: string;
23
+ /** User ID or identifier performing the action */
24
+ actor: string;
25
+ }
26
+ export declare class SecureNamespace {
27
+ private client;
28
+ constructor(client: DominusClient);
29
+ /**
30
+ * List tables in a schema.
31
+ *
32
+ * @param schema - Schema name (default: "public")
33
+ * @returns List of table metadata
34
+ */
35
+ tables(schema?: string): Promise<TableInfo[]>;
36
+ /**
37
+ * List columns in a table.
38
+ *
39
+ * @param table - Table name
40
+ * @param schema - Schema name (default: "public")
41
+ * @returns List of column metadata
42
+ */
43
+ columns(table: string, schema?: string): Promise<ColumnInfo[]>;
44
+ /**
45
+ * Query secure table data with audit logging.
46
+ *
47
+ * @param table - Table name
48
+ * @param context - Access context (reason and actor required)
49
+ * @param options - Query options
50
+ * @returns Query result with rows and total count
51
+ */
52
+ query(table: string, context: SecureAccessContext, options?: SecureQueryOptions): Promise<QueryResult>;
53
+ /**
54
+ * Insert a row into a secure table with audit logging.
55
+ *
56
+ * @param table - Table name
57
+ * @param data - Column:value dictionary
58
+ * @param context - Access context (reason and actor required)
59
+ * @param schema - Schema name (default: "public")
60
+ * @returns Inserted row data
61
+ */
62
+ insert(table: string, data: Record<string, unknown>, context: SecureAccessContext, schema?: string): Promise<Record<string, unknown>>;
63
+ /**
64
+ * Update rows in a secure table with audit logging.
65
+ *
66
+ * @param table - Table name
67
+ * @param data - Column:value dictionary of updates
68
+ * @param filters - Column:value dictionary for WHERE clause
69
+ * @param context - Access context (reason and actor required)
70
+ * @param schema - Schema name (default: "public")
71
+ * @returns Affected rows count
72
+ */
73
+ update(table: string, data: Record<string, unknown>, filters: Record<string, unknown>, context: SecureAccessContext, schema?: string): Promise<{
74
+ affected_rows: number;
75
+ }>;
76
+ /**
77
+ * Delete rows from a secure table with audit logging.
78
+ *
79
+ * @param table - Table name
80
+ * @param filters - Column:value dictionary for WHERE clause
81
+ * @param context - Access context (reason and actor required)
82
+ * @param schema - Schema name (default: "public")
83
+ * @returns Affected rows count
84
+ */
85
+ delete(table: string, filters: Record<string, unknown>, context: SecureAccessContext, schema?: string): Promise<{
86
+ affected_rows: number;
87
+ }>;
88
+ /**
89
+ * Insert multiple rows into a secure table with audit logging.
90
+ *
91
+ * @param table - Table name
92
+ * @param rows - List of column:value dictionaries
93
+ * @param context - Access context (reason and actor required)
94
+ * @param schema - Schema name (default: "public")
95
+ * @returns Insert count and optionally rows
96
+ */
97
+ bulkInsert(table: string, rows: Array<Record<string, unknown>>, context: SecureAccessContext, schema?: string): Promise<{
98
+ inserted_count: number;
99
+ rows?: Array<Record<string, unknown>>;
100
+ }>;
101
+ }
102
+ //# sourceMappingURL=secure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secure.d.ts","sourceRoot":"","sources":["../../src/namespaces/secure.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAElE,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,mBAAmB;IAClC,yDAAyD;IACzD,MAAM,EAAE,MAAM,CAAC;IACf,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAC;CACf;AAED,qBAAa,eAAe;IACd,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,aAAa;IAMzC;;;;;OAKG;IACG,MAAM,CAAC,MAAM,SAAW,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IASrD;;;;;;OAMG;IACG,OAAO,CAAC,KAAK,EAAE,MAAM,EA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@
1
+ /**
2
+ * Secure Namespace - Operations requiring audit logging.
3
+ *
4
+ * Provides convenience methods for accessing tables registered as secure.
5
+ * All operations automatically include reason/actor for audit trail.
6
+ *
7
+ * Secure tables are registered via auth.createSecureTable() and require
8
+ * a justification reason for every access.
9
+ */
10
+ export class SecureNamespace {
11
+ client;
12
+ constructor(client) {
13
+ this.client = client;
14
+ }
15
+ // ========================================
16
+ // SECURE DATA OPERATIONS
17
+ // ========================================
18
+ /**
19
+ * List tables in a schema.
20
+ *
21
+ * @param schema - Schema name (default: "public")
22
+ * @returns List of table metadata
23
+ */
24
+ async tables(schema = 'public') {
25
+ const result = await this.client.request({
26
+ endpoint: `/api/scribe/data/${schema}/tables`,
27
+ method: 'GET',
28
+ });
29
+ if (Array.isArray(result))
30
+ return result;
31
+ return result.tables || [];
32
+ }
33
+ /**
34
+ * List columns in a table.
35
+ *
36
+ * @param table - Table name
37
+ * @param schema - Schema name (default: "public")
38
+ * @returns List of column metadata
39
+ */
40
+ async columns(table, schema = 'public') {
41
+ const result = await this.client.request({
42
+ endpoint: `/api/scribe/data/${schema}/${table}/columns`,
43
+ method: 'GET',
44
+ });
45
+ if (Array.isArray(result))
46
+ return result;
47
+ return result.columns || [];
48
+ }
49
+ /**
50
+ * Query secure table data with audit logging.
51
+ *
52
+ * @param table - Table name
53
+ * @param context - Access context (reason and actor required)
54
+ * @param options - Query options
55
+ * @returns Query result with rows and total count
56
+ */
57
+ async query(table, context, options = {}) {
58
+ const { schema = 'public', filters, sortBy, sortOrder = 'ASC', limit = 100, offset = 0, } = options;
59
+ return this.client.request({
60
+ endpoint: `/api/scribe/data/${schema}/${table}/query`,
61
+ body: {
62
+ filters,
63
+ sort_by: sortBy,
64
+ sort_order: sortOrder,
65
+ limit,
66
+ offset,
67
+ reason: context.reason,
68
+ actor: context.actor,
69
+ },
70
+ });
71
+ }
72
+ /**
73
+ * Insert a row into a secure table with audit logging.
74
+ *
75
+ * @param table - Table name
76
+ * @param data - Column:value dictionary
77
+ * @param context - Access context (reason and actor required)
78
+ * @param schema - Schema name (default: "public")
79
+ * @returns Inserted row data
80
+ */
81
+ async insert(table, data, context, schema = 'public') {
82
+ return this.client.request({
83
+ endpoint: `/api/scribe/data/${schema}/${table}/insert`,
84
+ body: {
85
+ data,
86
+ reason: context.reason,
87
+ actor: context.actor,
88
+ },
89
+ });
90
+ }
91
+ /**
92
+ * Update rows in a secure table with audit logging.
93
+ *
94
+ * @param table - Table name
95
+ * @param data - Column:value dictionary of updates
96
+ * @param filters - Column:value dictionary for WHERE clause
97
+ * @param context - Access context (reason and actor required)
98
+ * @param schema - Schema name (default: "public")
99
+ * @returns Affected rows count
100
+ */
101
+ async update(table, data, filters, context, schema = 'public') {
102
+ return this.client.request({
103
+ endpoint: `/api/scribe/data/${schema}/${table}/update`,
104
+ body: {
105
+ data,
106
+ filters,
107
+ reason: context.reason,
108
+ actor: context.actor,
109
+ },
110
+ });
111
+ }
112
+ /**
113
+ * Delete rows from a secure table with audit logging.
114
+ *
115
+ * @param table - Table name
116
+ * @param filters - Column:value dictionary for WHERE clause
117
+ * @param context - Access context (reason and actor required)
118
+ * @param schema - Schema name (default: "public")
119
+ * @returns Affected rows count
120
+ */
121
+ async delete(table, filters, context, schema = 'public') {
122
+ return this.client.request({
123
+ endpoint: `/api/scribe/data/${schema}/${table}/delete`,
124
+ body: {
125
+ filters,
126
+ reason: context.reason,
127
+ actor: context.actor,
128
+ },
129
+ });
130
+ }
131
+ /**
132
+ * Insert multiple rows into a secure table with audit logging.
133
+ *
134
+ * @param table - Table name
135
+ * @param rows - List of column:value dictionaries
136
+ * @param context - Access context (reason and actor required)
137
+ * @param schema - Schema name (default: "public")
138
+ * @returns Insert count and optionally rows
139
+ */
140
+ async bulkInsert(table, rows, context, schema = 'public') {
141
+ return this.client.request({
142
+ endpoint: `/api/scribe/data/${schema}/${table}/bulk-insert`,
143
+ body: {
144
+ rows,
145
+ reason: context.reason,
146
+ actor: context.actor,
147
+ },
148
+ });
149
+ }
150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KAAK,SAAS;YACtD,IAAI,EAAE;gBACJ,OAAO;gBACP,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,KAAK,EAAE,OAAO,CAAC,KAAK;aACrB;SACF,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,UAAU,CACd,KAAa,EACb,IAAoC,EACpC,OAA4B,EAC5B,MAAM,GAAG,QAAQ;QAEjB,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;YACzB,QAAQ,EAAE,oBAAoB,MAAM,IAAI,KAAK,cAAc;YAC3D,IAAI,EAAE;gBACJ,IAAI;gBACJ,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,KAAK,EAAE,OAAO,CAAC,KAAK;aACrB;SACF,CAAC,CAAC;IACL,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dominus-sdk-nodejs",
3
- "version": "1.1.8",
3
+ "version": "1.2.0",
4
4
  "description": "Node.js SDK for the Dominus Orchestrator Platform",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",