dominus-sdk-nodejs 1.13.1 → 1.14.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/README.md +42 -566
- package/dist/namespaces/files.d.ts +13 -14
- package/dist/namespaces/files.d.ts.map +1 -1
- package/dist/namespaces/files.js +22 -39
- package/dist/namespaces/files.js.map +1 -1
- package/docs/architecture.md +34 -0
- package/docs/development.md +30 -0
- package/docs/namespaces.md +35 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,585 +1,61 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Dominus SDK for Node.js
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
TypeScript SDK for CareBridge Dominus services. Provides a single, async-first client that routes through the Dominus Gateway, handles JWT minting/caching, and exposes service namespaces for secrets, data, files, auth, AI workflows, and more.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
- **Namespace-based API** - Intuitive access via `dominus.db`, `dominus.redis`, `dominus.files`, etc.
|
|
10
|
-
- **Async/Await** - Built for modern async TypeScript/JavaScript applications
|
|
11
|
-
- **Automatic JWT Management** - Token minting, caching, and refresh handled transparently
|
|
12
|
-
- **Resilience Built-in** - Circuit breaker, exponential backoff with jitter, retry logic
|
|
13
|
-
- **Cold Start Handling** - Special retry logic for orchestrator cold starts
|
|
14
|
-
- **Typed Errors** - 9 specific error classes for different failure modes
|
|
15
|
-
- **Secure by Default** - Client-side password hashing, audit trail support
|
|
16
|
-
- **Server-Side Only** - Designed for Next.js API routes, Express, and Node.js backends
|
|
5
|
+
## What This Is
|
|
6
|
+
- Server-side SDK for Node.js 18+ (ESM)
|
|
7
|
+
- Default routing through the Dominus Gateway with base64-encoded JSON bodies
|
|
8
|
+
- Namespace API plus root-level shortcuts for common operations
|
|
17
9
|
|
|
18
10
|
## Quick Start
|
|
19
11
|
|
|
20
|
-
```
|
|
12
|
+
```ts
|
|
21
13
|
import { dominus } from 'dominus-sdk-nodejs';
|
|
22
14
|
|
|
23
|
-
|
|
24
|
-
process.env.DOMINUS_TOKEN = "your-psk-token";
|
|
25
|
-
|
|
26
|
-
// Secrets
|
|
27
|
-
const dbUrl = await dominus.secrets.get("DATABASE_URL");
|
|
28
|
-
|
|
29
|
-
// Database queries
|
|
30
|
-
const users = await dominus.db.query("users", { filters: { status: "active" } });
|
|
31
|
-
|
|
32
|
-
// Redis caching
|
|
33
|
-
await dominus.redis.set("session:123", { user: "john" }, { ttl: 3600 });
|
|
34
|
-
|
|
35
|
-
// File storage
|
|
36
|
-
const result = await dominus.files.upload(buffer, "report.pdf", { category: "reports" });
|
|
37
|
-
|
|
38
|
-
// Structured logging
|
|
39
|
-
await dominus.logs.info("User logged in", { user_id: "123" });
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
## Installation
|
|
15
|
+
process.env.DOMINUS_TOKEN = 'your-psk-token';
|
|
43
16
|
|
|
44
|
-
|
|
45
|
-
|
|
17
|
+
const users = await dominus.db.query('users', { filters: { status: 'active' } });
|
|
18
|
+
await dominus.redis.set('session:123', { user: 'john' }, { ttl: 3600 });
|
|
19
|
+
const file = await dominus.files.upload(buffer, 'report.pdf', { category: 'reports' });
|
|
46
20
|
```
|
|
47
21
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
## Requirements
|
|
55
|
-
|
|
56
|
-
- Node.js 18+ (uses native fetch)
|
|
57
|
-
- TypeScript 5.0+ (optional, but recommended)
|
|
22
|
+
## Architecture (SDK View)
|
|
23
|
+
- DOMINUS_TOKEN (PSK) -> Gateway `/jwt/mint` -> JWT cached in `dominusCache`
|
|
24
|
+
- All JSON requests/responses are base64-encoded
|
|
25
|
+
- GET requests send no body; all parameters must be in path or POST body
|
|
26
|
+
- SDK defaults to gateway routing (`/api/*` -> `/svc/*`)
|
|
58
27
|
|
|
59
28
|
## Namespaces
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
## Usage Examples
|
|
77
|
-
|
|
78
|
-
### Secrets Management
|
|
79
|
-
|
|
80
|
-
```typescript
|
|
81
|
-
// Get a secret
|
|
82
|
-
const value = await dominus.secrets.get("API_KEY");
|
|
83
|
-
|
|
84
|
-
// Create or update
|
|
85
|
-
await dominus.secrets.upsert("API_KEY", "new-value", "Updated API key");
|
|
86
|
-
|
|
87
|
-
// List secrets with prefix
|
|
88
|
-
const secrets = await dominus.secrets.list("DB_");
|
|
89
|
-
|
|
90
|
-
// Delete
|
|
91
|
-
await dominus.secrets.delete("OLD_KEY");
|
|
92
|
-
|
|
93
|
-
// Root-level shortcuts
|
|
94
|
-
const dbUrl = await dominus.get("DATABASE_URL");
|
|
95
|
-
await dominus.upsert("KEY", "value");
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
### Database Operations
|
|
99
|
-
|
|
100
|
-
```typescript
|
|
101
|
-
// List tables
|
|
102
|
-
const tables = await dominus.db.tables();
|
|
103
|
-
const tenantTables = await dominus.db.tables("tenant_acme");
|
|
104
|
-
|
|
105
|
-
// Query with filters and pagination
|
|
106
|
-
const users = await dominus.db.query("users", {
|
|
107
|
-
filters: { status: "active", role: ["admin", "manager"] },
|
|
108
|
-
sortBy: "created_at",
|
|
109
|
-
sortOrder: "DESC",
|
|
110
|
-
limit: 50,
|
|
111
|
-
offset: 0
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
// Insert
|
|
115
|
-
const user = await dominus.db.insert("users", {
|
|
116
|
-
email: "john@example.com",
|
|
117
|
-
name: "John Doe"
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
// Update
|
|
121
|
-
await dominus.db.update("users", { status: "inactive" }, { id: userId });
|
|
122
|
-
|
|
123
|
-
// Delete
|
|
124
|
-
await dominus.db.delete("users", { id: userId });
|
|
125
|
-
|
|
126
|
-
// Bulk insert
|
|
127
|
-
await dominus.db.bulkInsert("events", [
|
|
128
|
-
{ type: "login", user_id: "123" },
|
|
129
|
-
{ type: "login", user_id: "456" }
|
|
130
|
-
]);
|
|
131
|
-
|
|
132
|
-
// Secure table access (requires audit reason)
|
|
133
|
-
const patients = await dominus.db.query("patients", {
|
|
134
|
-
schema: "tenant_acme",
|
|
135
|
-
reason: "Reviewing records for appointment #123",
|
|
136
|
-
actor: "dr.smith"
|
|
137
|
-
});
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
### Redis Caching
|
|
141
|
-
|
|
142
|
-
```typescript
|
|
143
|
-
// Key-value operations
|
|
144
|
-
await dominus.redis.set("user:123", { name: "John" }, { ttl: 3600 });
|
|
145
|
-
const value = await dominus.redis.get("user:123");
|
|
146
|
-
|
|
147
|
-
// Distributed locks
|
|
148
|
-
const acquired = await dominus.redis.setnx("lock:job", "worker-1", { ttl: 60 });
|
|
149
|
-
if (acquired) {
|
|
150
|
-
try {
|
|
151
|
-
// Do exclusive work
|
|
152
|
-
} finally {
|
|
153
|
-
await dominus.redis.delete("lock:job");
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
// Counters
|
|
158
|
-
await dominus.redis.incr("page:views", 1);
|
|
159
|
-
|
|
160
|
-
// Hash operations
|
|
161
|
-
await dominus.redis.hset("user:123", "email", "john@example.com", { ttl: 3600 });
|
|
162
|
-
const email = await dominus.redis.hget("user:123", "email");
|
|
163
|
-
const allFields = await dominus.redis.hgetall("user:123");
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
### File Storage
|
|
167
|
-
|
|
168
|
-
```typescript
|
|
169
|
-
import { readFileSync } from 'fs';
|
|
170
|
-
|
|
171
|
-
// Upload file
|
|
172
|
-
const data = readFileSync("report.pdf");
|
|
173
|
-
const result = await dominus.files.upload(data, "report.pdf", {
|
|
174
|
-
category: "reports",
|
|
175
|
-
contentType: "application/pdf"
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
// Get download URL
|
|
179
|
-
const download = await dominus.files.download({ id: result.id });
|
|
180
|
-
console.log(download.download_url);
|
|
181
|
-
|
|
182
|
-
// Fetch file from URL and store
|
|
183
|
-
const fetched = await dominus.files.fetch("https://example.com/doc.pdf", {
|
|
184
|
-
filename: "external-doc.pdf",
|
|
185
|
-
category: "imports"
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
// List files
|
|
189
|
-
const files = await dominus.files.list({ category: "reports", prefix: "2025/" });
|
|
190
|
-
|
|
191
|
-
// Delete file
|
|
192
|
-
await dominus.files.delete({ id: result.id });
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
### Structured Logging
|
|
196
|
-
|
|
197
|
-
```typescript
|
|
198
|
-
// Simple logging (auto-captures file and function)
|
|
199
|
-
await dominus.logs.info("User logged in", { user_id: "123" });
|
|
200
|
-
await dominus.logs.error("Payment failed", { order_id: "456" });
|
|
201
|
-
|
|
202
|
-
// All log levels
|
|
203
|
-
await dominus.logs.debug("Debug message", { data: "..." });
|
|
204
|
-
await dominus.logs.notice("Important notice", {});
|
|
205
|
-
await dominus.logs.warn("Warning message", {});
|
|
206
|
-
await dominus.logs.critical("Critical error", {});
|
|
207
|
-
|
|
208
|
-
// With category
|
|
209
|
-
await dominus.logs.info("Cache hit", { key: "user:123" }, "cache");
|
|
210
|
-
|
|
211
|
-
// With exception
|
|
212
|
-
try {
|
|
213
|
-
riskyOperation();
|
|
214
|
-
} catch (error) {
|
|
215
|
-
await dominus.logs.error("Operation failed", {}, { exception: error as Error });
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
// Batch logging
|
|
219
|
-
await dominus.logs.batch([
|
|
220
|
-
{ level: "info", message: "Step 1 complete", data: {} },
|
|
221
|
-
{ level: "info", message: "Step 2 complete", data: {} }
|
|
222
|
-
]);
|
|
223
|
-
|
|
224
|
-
// Query logs
|
|
225
|
-
const errors = await dominus.logs.query({ level: "error", limit: 100 });
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
### Authentication & Authorization (Guardian)
|
|
229
|
-
|
|
230
|
-
```typescript
|
|
231
|
-
// User management
|
|
232
|
-
const users = await dominus.auth.listUsers();
|
|
233
|
-
const user = await dominus.auth.getUser("user-uuid");
|
|
234
|
-
|
|
235
|
-
const newUser = await dominus.auth.addUser({
|
|
236
|
-
username: "john",
|
|
237
|
-
password: "secure-password",
|
|
238
|
-
email: "john@example.com"
|
|
239
|
-
});
|
|
240
|
-
|
|
241
|
-
await dominus.auth.updateUser("user-uuid", { status: "active" });
|
|
242
|
-
await dominus.auth.deleteUser("user-uuid");
|
|
243
|
-
|
|
244
|
-
// Role management
|
|
245
|
-
const roles = await dominus.auth.listRoles();
|
|
246
|
-
const role = await dominus.auth.addRole({
|
|
247
|
-
name: "Editor",
|
|
248
|
-
scopeSlugs: ["read", "write", "publish"]
|
|
249
|
-
});
|
|
250
|
-
|
|
251
|
-
// Scope management
|
|
252
|
-
const scopes = await dominus.auth.listScopes();
|
|
253
|
-
await dominus.auth.addScope({ name: "publish", slug: "publish" });
|
|
254
|
-
|
|
255
|
-
// Tenant management
|
|
256
|
-
const tenants = await dominus.auth.listTenants();
|
|
257
|
-
const categories = await dominus.auth.listTenantCategories();
|
|
258
|
-
|
|
259
|
-
// Page and navigation
|
|
260
|
-
const pages = await dominus.auth.listPages();
|
|
261
|
-
const navItems = await dominus.auth.listNavigation();
|
|
262
|
-
|
|
263
|
-
// Secure tables registry
|
|
264
|
-
const secureTables = await dominus.auth.listSecureTables();
|
|
265
|
-
await dominus.auth.addSecureTable("patients", "tenant_acme");
|
|
266
|
-
```
|
|
267
|
-
|
|
268
|
-
### Schema Management (DDL)
|
|
269
|
-
|
|
270
|
-
```typescript
|
|
271
|
-
// Create table
|
|
272
|
-
await dominus.ddl.createTable("orders", [
|
|
273
|
-
{ name: "id", type: "UUID", constraints: ["PRIMARY KEY"] },
|
|
274
|
-
{ name: "user_id", type: "UUID", constraints: ["NOT NULL"] },
|
|
275
|
-
{ name: "total", type: "DECIMAL(10,2)" },
|
|
276
|
-
{ name: "created_at", type: "TIMESTAMPTZ", default: "NOW()" }
|
|
277
|
-
]);
|
|
278
|
-
|
|
279
|
-
// Add column
|
|
280
|
-
await dominus.ddl.addColumn("orders", {
|
|
281
|
-
name: "status",
|
|
282
|
-
type: "VARCHAR(50)",
|
|
283
|
-
default: "'pending'"
|
|
284
|
-
});
|
|
285
|
-
|
|
286
|
-
// Alter column
|
|
287
|
-
await dominus.ddl.alterColumn("orders", "status", { type: "VARCHAR(100)" });
|
|
288
|
-
|
|
289
|
-
// Create index
|
|
290
|
-
await dominus.ddl.createIndex("orders", "idx_orders_user", ["user_id"]);
|
|
291
|
-
|
|
292
|
-
// Migrations
|
|
293
|
-
const migrations = await dominus.ddl.listMigrations();
|
|
294
|
-
await dominus.ddl.applyMigration("20250101_add_orders");
|
|
295
|
-
|
|
296
|
-
// Provision tenant schema from category template
|
|
297
|
-
await dominus.ddl.provisionTenantFromCategory("customer_acme", "healthcare");
|
|
298
|
-
```
|
|
299
|
-
|
|
300
|
-
### User Authentication (Portal)
|
|
301
|
-
|
|
302
|
-
```typescript
|
|
303
|
-
// User login (tenant_id is optional)
|
|
304
|
-
const session = await dominus.portal.login(
|
|
305
|
-
"john@example.com",
|
|
306
|
-
"secret123",
|
|
307
|
-
"tenant-uuid" // optional
|
|
308
|
-
);
|
|
309
|
-
|
|
310
|
-
// Client login with PSK (for service-to-service)
|
|
311
|
-
const clientSession = await dominus.portal.loginClient("psk-token");
|
|
312
|
-
|
|
313
|
-
// Get current user
|
|
314
|
-
const me = await dominus.portal.me();
|
|
315
|
-
|
|
316
|
-
// Get navigation (access-filtered for current user)
|
|
317
|
-
const nav = await dominus.portal.getNavigation();
|
|
318
|
-
|
|
319
|
-
// Check page access
|
|
320
|
-
const hasAccess = await dominus.portal.checkPageAccess("/dashboard/admin/users");
|
|
321
|
-
|
|
322
|
-
// Switch tenant
|
|
323
|
-
await dominus.portal.switchTenant("other-tenant-uuid");
|
|
324
|
-
|
|
325
|
-
// Profile & preferences
|
|
326
|
-
const profile = await dominus.portal.getProfile();
|
|
327
|
-
await dominus.portal.updateProfile({ displayName: "John Doe" });
|
|
328
|
-
|
|
329
|
-
const prefs = await dominus.portal.getPreferences();
|
|
330
|
-
await dominus.portal.updatePreferences({
|
|
331
|
-
theme: "dark",
|
|
332
|
-
timezone: "America/New_York"
|
|
333
|
-
});
|
|
334
|
-
|
|
335
|
-
// Password management
|
|
336
|
-
await dominus.portal.changePassword("old-password", "new-password");
|
|
337
|
-
await dominus.portal.requestPasswordReset("john@example.com");
|
|
338
|
-
await dominus.portal.confirmPasswordReset("reset-token", "new-password");
|
|
339
|
-
|
|
340
|
-
// Session management
|
|
341
|
-
const sessions = await dominus.portal.listSessions();
|
|
342
|
-
await dominus.portal.revokeSession("session-id");
|
|
343
|
-
await dominus.portal.revokeAllSessions();
|
|
344
|
-
|
|
345
|
-
// Registration & email verification
|
|
346
|
-
await dominus.portal.register("newuser", "new@example.com", "password", "tenant-id");
|
|
347
|
-
await dominus.portal.verifyEmail("verification-token");
|
|
348
|
-
await dominus.portal.resendVerification("new@example.com");
|
|
349
|
-
|
|
350
|
-
// Logout
|
|
351
|
-
await dominus.portal.logout();
|
|
352
|
-
```
|
|
353
|
-
|
|
354
|
-
### Email Delivery (Courier)
|
|
355
|
-
|
|
356
|
-
```typescript
|
|
357
|
-
// Send email via Postmark template
|
|
358
|
-
const result = await dominus.courier.send(
|
|
359
|
-
"welcome",
|
|
360
|
-
"user@example.com",
|
|
361
|
-
"noreply@myapp.com",
|
|
362
|
-
{ name: "John", product_name: "My App" }
|
|
363
|
-
);
|
|
364
|
-
|
|
365
|
-
// Convenience methods
|
|
366
|
-
await dominus.courier.sendWelcome(
|
|
367
|
-
"user@example.com",
|
|
368
|
-
"noreply@myapp.com",
|
|
369
|
-
{ name: "John", actionUrl: "https://myapp.com/start", productName: "My App" }
|
|
370
|
-
);
|
|
371
|
-
|
|
372
|
-
await dominus.courier.sendPasswordReset(
|
|
373
|
-
"user@example.com",
|
|
374
|
-
"noreply@myapp.com",
|
|
375
|
-
{ name: "John", resetUrl: "https://myapp.com/reset?token=abc", productName: "My App" }
|
|
376
|
-
);
|
|
377
|
-
|
|
378
|
-
await dominus.courier.sendEmailVerification(
|
|
379
|
-
"user@example.com",
|
|
380
|
-
"noreply@myapp.com",
|
|
381
|
-
{ name: "John", verifyUrl: "https://myapp.com/verify?token=xyz", productName: "My App" }
|
|
382
|
-
);
|
|
383
|
-
|
|
384
|
-
await dominus.courier.sendInvitation(
|
|
385
|
-
"invited@example.com",
|
|
386
|
-
"noreply@myapp.com",
|
|
387
|
-
{
|
|
388
|
-
name: "Invited User",
|
|
389
|
-
inviteUrl: "https://myapp.com/invite?token=abc",
|
|
390
|
-
inviterName: "John",
|
|
391
|
-
productName: "My App"
|
|
392
|
-
}
|
|
393
|
-
);
|
|
394
|
-
```
|
|
395
|
-
|
|
396
|
-
### Health Checks
|
|
397
|
-
|
|
398
|
-
```typescript
|
|
399
|
-
// Basic health check
|
|
400
|
-
const status = await dominus.health.check();
|
|
401
|
-
|
|
402
|
-
// Ping (lightweight)
|
|
403
|
-
await dominus.health.ping();
|
|
404
|
-
|
|
405
|
-
// Warmup (for cold start tolerance)
|
|
406
|
-
await dominus.health.warmup();
|
|
407
|
-
```
|
|
408
|
-
|
|
409
|
-
## Error Handling
|
|
410
|
-
|
|
411
|
-
```typescript
|
|
412
|
-
import {
|
|
413
|
-
dominus,
|
|
414
|
-
DominusError,
|
|
415
|
-
AuthenticationError,
|
|
416
|
-
AuthorizationError,
|
|
417
|
-
NotFoundError,
|
|
418
|
-
ValidationError,
|
|
419
|
-
ConflictError,
|
|
420
|
-
ServiceError,
|
|
421
|
-
SecureTableError,
|
|
422
|
-
ConnectionError,
|
|
423
|
-
TimeoutError,
|
|
424
|
-
} from 'dominus-sdk-nodejs';
|
|
425
|
-
|
|
426
|
-
try {
|
|
427
|
-
const user = await dominus.auth.getUser("invalid-id");
|
|
428
|
-
} catch (error) {
|
|
429
|
-
if (error instanceof NotFoundError) {
|
|
430
|
-
console.log(`User not found: ${error.message}`);
|
|
431
|
-
} else if (error instanceof SecureTableError) {
|
|
432
|
-
console.log("Secure table requires 'reason' and 'actor' parameters");
|
|
433
|
-
} else if (error instanceof AuthenticationError) {
|
|
434
|
-
console.log("Invalid or expired token");
|
|
435
|
-
} else if (error instanceof AuthorizationError) {
|
|
436
|
-
console.log("Insufficient permissions");
|
|
437
|
-
} else if (error instanceof ValidationError) {
|
|
438
|
-
console.log(`Invalid request: ${error.message}`);
|
|
439
|
-
} else if (error instanceof TimeoutError) {
|
|
440
|
-
console.log("Request timed out");
|
|
441
|
-
} else if (error instanceof DominusError) {
|
|
442
|
-
console.log(`Error ${error.statusCode}: ${error.message}`);
|
|
443
|
-
if (error.details) {
|
|
444
|
-
console.log(`Details: ${JSON.stringify(error.details)}`);
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
```
|
|
449
|
-
|
|
450
|
-
### Error Types
|
|
451
|
-
|
|
452
|
-
| Error | Status | Description |
|
|
453
|
-
|-------|--------|-------------|
|
|
454
|
-
| `AuthenticationError` | 401 | Invalid or missing token |
|
|
455
|
-
| `AuthorizationError` | 403 | Insufficient permissions |
|
|
456
|
-
| `NotFoundError` | 404 | Resource not found |
|
|
457
|
-
| `ValidationError` | 400 | Invalid request data |
|
|
458
|
-
| `ConflictError` | 409 | Duplicate or version conflict |
|
|
459
|
-
| `ServiceError` | 5xx | Backend service error |
|
|
460
|
-
| `SecureTableError` | 403 | Missing reason for secure table |
|
|
461
|
-
| `ConnectionError` | - | Network connection failed |
|
|
462
|
-
| `TimeoutError` | 504 | Request timed out |
|
|
29
|
+
- `dominus.secrets` (Warden) secrets CRUD
|
|
30
|
+
- `dominus.db` / `dominus.secure` (Scribe) database CRUD + audit-logged tables
|
|
31
|
+
- `dominus.redis` (Whisperer) cache, locks, counters
|
|
32
|
+
- `dominus.files` (Archivist) object storage
|
|
33
|
+
- `dominus.auth` (Guardian) users/roles/scopes/tenants/pages
|
|
34
|
+
- `dominus.ddl` (Smith) schema DDL and migrations
|
|
35
|
+
- `dominus.logs` (Herald) structured logs
|
|
36
|
+
- `dominus.portal` (Portal) user sessions/profile
|
|
37
|
+
- `dominus.courier` (Courier) email
|
|
38
|
+
- `dominus.open` (Scribe Open) direct DB access
|
|
39
|
+
- `dominus.health` health checks
|
|
40
|
+
- `dominus.stt` (Oracle) streaming speech-to-text (WebSocket + VAD)
|
|
41
|
+
- `dominus.admin` admin reseed/reset operations
|
|
42
|
+
- `dominus.ai` agent-runtime: LLM, RAG, artifacts, results, orchestration
|
|
43
|
+
- `dominus.workflow` workflow-manager CRUD and execution
|
|
463
44
|
|
|
464
45
|
## Configuration
|
|
46
|
+
Required:
|
|
47
|
+
- `DOMINUS_TOKEN` (PSK)
|
|
465
48
|
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
```
|
|
472
|
-
|
|
473
|
-
### Resilience Configuration
|
|
474
|
-
|
|
475
|
-
The SDK includes built-in resilience features:
|
|
476
|
-
|
|
477
|
-
| Feature | Configuration |
|
|
478
|
-
|---------|---------------|
|
|
479
|
-
| Request Timeout | 30 seconds |
|
|
480
|
-
| Max Retries | 3 with exponential backoff |
|
|
481
|
-
| Circuit Breaker | Opens after 5 failures, resets after 30s |
|
|
482
|
-
| JWT Cache TTL | Refreshes when <60 seconds remain |
|
|
483
|
-
| JWT Mint Retries | 3 with backoff (handles cold starts) |
|
|
484
|
-
| Backoff Delays | Base 1s, max 15s with jitter |
|
|
485
|
-
|
|
486
|
-
## Architecture
|
|
487
|
-
|
|
488
|
-
```
|
|
489
|
-
┌─────────────────┐
|
|
490
|
-
│ Your App │
|
|
491
|
-
│ (Next.js API) │
|
|
492
|
-
└────────┬────────┘
|
|
493
|
-
│ await dominus.db.query(...)
|
|
494
|
-
▼
|
|
495
|
-
┌─────────────────┐
|
|
496
|
-
│ Dominus SDK │ ← JWT caching, circuit breaker, retries
|
|
497
|
-
│ (this package) │
|
|
498
|
-
└────────┬────────┘
|
|
499
|
-
│ HTTPS (base64-encoded JSON)
|
|
500
|
-
▼
|
|
501
|
-
┌─────────────────────────────────┐
|
|
502
|
-
│ Dominus Orchestrator │
|
|
503
|
-
│ (Cloud Run FastAPI backend) │
|
|
504
|
-
│ │
|
|
505
|
-
│ ┌─────────┬─────────┬────────┐ │
|
|
506
|
-
│ │ Warden │Guardian │Archivist│ │
|
|
507
|
-
│ │ Scribe │ Smith │Whisperer│ │
|
|
508
|
-
│ │ Herald │ Portal │ Courier │ │
|
|
509
|
-
│ └─────────┴─────────┴────────┘ │
|
|
510
|
-
└─────────────────────────────────┘
|
|
511
|
-
```
|
|
512
|
-
|
|
513
|
-
## Next.js Integration
|
|
49
|
+
Optional:
|
|
50
|
+
- `DOMINUS_GATEWAY_URL` (defaults to production gateway)
|
|
51
|
+
- `DOMINUS_BASE_URL` (override base URL; defaults to gateway)
|
|
52
|
+
- `DOMINUS_DEBUG=true` (extra logs)
|
|
53
|
+
- `DOMINUS_HTTP_PROXY` / `DOMINUS_HTTPS_PROXY` (proxy hints only)
|
|
514
54
|
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
export async function GET(request: NextRequest) {
|
|
521
|
-
try {
|
|
522
|
-
const users = await dominus.db.query("users", {
|
|
523
|
-
filters: { status: "active" },
|
|
524
|
-
limit: 50
|
|
525
|
-
});
|
|
526
|
-
return NextResponse.json(users);
|
|
527
|
-
} catch (error) {
|
|
528
|
-
if (error instanceof NotFoundError) {
|
|
529
|
-
return NextResponse.json({ error: "Not found" }, { status: 404 });
|
|
530
|
-
}
|
|
531
|
-
return NextResponse.json({ error: "Failed to fetch users" }, { status: 500 });
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
```
|
|
535
|
-
|
|
536
|
-
## Crypto Helpers
|
|
537
|
-
|
|
538
|
-
The SDK exports utility functions for password and token handling:
|
|
539
|
-
|
|
540
|
-
```typescript
|
|
541
|
-
import {
|
|
542
|
-
hashPassword,
|
|
543
|
-
verifyPasswordLocal,
|
|
544
|
-
hashPsk,
|
|
545
|
-
verifyPskLocal,
|
|
546
|
-
generatePskLocal,
|
|
547
|
-
hashToken,
|
|
548
|
-
generateToken
|
|
549
|
-
} from 'dominus-sdk-nodejs';
|
|
550
|
-
|
|
551
|
-
// Password hashing (bcrypt)
|
|
552
|
-
const hash = await hashPassword("user-password");
|
|
553
|
-
const isValid = await verifyPasswordLocal("user-password", hash);
|
|
554
|
-
|
|
555
|
-
// PSK generation and verification
|
|
556
|
-
const psk = generatePskLocal();
|
|
557
|
-
const pskHash = await hashPsk(psk);
|
|
558
|
-
const pskValid = await verifyPskLocal(psk, pskHash);
|
|
559
|
-
|
|
560
|
-
// Token generation
|
|
561
|
-
const token = generateToken(32); // 32-byte random token
|
|
562
|
-
const tokenHash = hashToken(token); // SHA-256 hash
|
|
563
|
-
```
|
|
564
|
-
|
|
565
|
-
## Dependencies
|
|
566
|
-
|
|
567
|
-
- `bcryptjs` - Password hashing
|
|
568
|
-
|
|
569
|
-
## Version
|
|
570
|
-
|
|
571
|
-
**v1.2.2** - Latest release with navigation routes fix and page scope methods
|
|
572
|
-
|
|
573
|
-
### Changelog
|
|
574
|
-
|
|
575
|
-
- **v1.2.2** - Fix `checkPageAccess` to send correct parameter
|
|
576
|
-
- **v1.2.0** - Add navigation routes and page scope methods
|
|
577
|
-
- **v1.1.6** - Add user token support for user-authenticated requests
|
|
578
|
-
- **v1.1.5** - Make `tenant_id` optional in login methods
|
|
579
|
-
- **v1.1.3** - Add retry with backoff for JWT mint (cold start handling)
|
|
580
|
-
- **v1.1.0** - Fix SDK routes and improve error messaging
|
|
581
|
-
- **v1.0.0** - Initial release with full namespace API
|
|
55
|
+
## Documentation
|
|
56
|
+
- `docs/architecture.md`
|
|
57
|
+
- `docs/namespaces.md`
|
|
58
|
+
- `docs/development.md`
|
|
582
59
|
|
|
583
60
|
## License
|
|
584
|
-
|
|
585
61
|
Proprietary - CareBridge Systems
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Files Namespace -
|
|
2
|
+
* Files Namespace - B2 Worker object storage operations.
|
|
3
3
|
*
|
|
4
4
|
* Provides file upload, download, and management via B2 object storage.
|
|
5
5
|
*/
|
|
@@ -52,7 +52,12 @@ export interface BrowseFileInfo {
|
|
|
52
52
|
export interface StorageStats {
|
|
53
53
|
total_objects: number;
|
|
54
54
|
total_size_bytes: number;
|
|
55
|
-
|
|
55
|
+
categories: Array<{
|
|
56
|
+
name: string;
|
|
57
|
+
object_count: number;
|
|
58
|
+
total_size_bytes: number;
|
|
59
|
+
}>;
|
|
60
|
+
total_categories: number;
|
|
56
61
|
}
|
|
57
62
|
export interface CategoryStats {
|
|
58
63
|
count: number;
|
|
@@ -71,27 +76,22 @@ export interface CreateFolderResult {
|
|
|
71
76
|
exists?: boolean;
|
|
72
77
|
path: string;
|
|
73
78
|
placeholder_id?: string;
|
|
79
|
+
folder_id?: string;
|
|
74
80
|
message?: string;
|
|
75
81
|
}
|
|
76
82
|
export interface DeleteFolderResult {
|
|
77
83
|
deleted: boolean;
|
|
78
84
|
path: string;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
has_compliance?: boolean;
|
|
82
|
-
compliance_count?: number;
|
|
85
|
+
objects_deleted?: number;
|
|
86
|
+
b2_errors?: number;
|
|
83
87
|
message?: string;
|
|
84
88
|
errors?: string[];
|
|
85
89
|
}
|
|
86
90
|
export interface FactoryResetResult {
|
|
87
91
|
reset: boolean;
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
deleted: number;
|
|
92
|
-
retained: number;
|
|
93
|
-
}>;
|
|
94
|
-
initialized_folders?: string[];
|
|
92
|
+
db_objects_deleted: number;
|
|
93
|
+
b2_objects_deleted: number;
|
|
94
|
+
b2_errors: number;
|
|
95
95
|
message?: string;
|
|
96
96
|
errors?: string[];
|
|
97
97
|
}
|
|
@@ -246,7 +246,6 @@ export declare class FilesNamespace {
|
|
|
246
246
|
* Factory reset - delete ALL objects in the project/environment.
|
|
247
247
|
*
|
|
248
248
|
* WARNING: This will permanently delete all files in storage.
|
|
249
|
-
* Compliance objects will be moved to retention unless force=true.
|
|
250
249
|
*
|
|
251
250
|
* @param options - Reset options
|
|
252
251
|
* @param options.force - If true, hard delete even compliance objects
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../src/namespaces/files.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACxC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,QAAQ;IACvB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,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BAAkB,CAAC;CAUhC"}
|
package/dist/namespaces/files.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Files Namespace -
|
|
2
|
+
* Files Namespace - B2 Worker object storage operations.
|
|
3
3
|
*
|
|
4
4
|
* Provides file upload, download, and management via B2 object storage.
|
|
5
5
|
*/
|
|
@@ -16,24 +16,16 @@ export class FilesNamespace {
|
|
|
16
16
|
* @param options - Upload options
|
|
17
17
|
*/
|
|
18
18
|
async upload(data, filename, options = {}) {
|
|
19
|
-
const { contentType, category = 'general', path,
|
|
19
|
+
const { contentType, category = 'general', path, } = options;
|
|
20
20
|
const fileB64 = data.toString('base64');
|
|
21
21
|
const body = {
|
|
22
|
-
|
|
23
|
-
filename,
|
|
22
|
+
content_b64: fileB64,
|
|
23
|
+
path: path || filename,
|
|
24
24
|
category,
|
|
25
|
-
|
|
25
|
+
filename,
|
|
26
26
|
};
|
|
27
27
|
if (contentType)
|
|
28
28
|
body.content_type = contentType;
|
|
29
|
-
if (tags)
|
|
30
|
-
body.tags = tags;
|
|
31
|
-
if (compliance) {
|
|
32
|
-
body.is_compliance = true;
|
|
33
|
-
body.retention_days = retentionDays;
|
|
34
|
-
if (actor)
|
|
35
|
-
body.owner_user_id = actor;
|
|
36
|
-
}
|
|
37
29
|
return this.client.request({
|
|
38
30
|
endpoint: '/api/archivist/upload',
|
|
39
31
|
body,
|
|
@@ -45,16 +37,14 @@ export class FilesNamespace {
|
|
|
45
37
|
* @param options - File identifier and options
|
|
46
38
|
*/
|
|
47
39
|
async download(options) {
|
|
48
|
-
const { id, category, path,
|
|
40
|
+
const { id, category, path, expiresSeconds = 3600 } = options;
|
|
49
41
|
const body = { expires_seconds: expiresSeconds };
|
|
50
42
|
if (id)
|
|
51
|
-
body.
|
|
43
|
+
body.object_id = id;
|
|
52
44
|
if (category)
|
|
53
45
|
body.category = category;
|
|
54
46
|
if (path)
|
|
55
|
-
body.
|
|
56
|
-
if (actor)
|
|
57
|
-
body.actor_user_id = actor;
|
|
47
|
+
body.path = path;
|
|
58
48
|
return this.client.request({
|
|
59
49
|
endpoint: '/api/archivist/download',
|
|
60
50
|
body,
|
|
@@ -66,16 +56,14 @@ export class FilesNamespace {
|
|
|
66
56
|
* @param options - File identifier
|
|
67
57
|
*/
|
|
68
58
|
async fetch(options) {
|
|
69
|
-
const { id, category, path
|
|
70
|
-
const body = {};
|
|
59
|
+
const { id, category, path } = options;
|
|
60
|
+
const body = { return_data: true };
|
|
71
61
|
if (id)
|
|
72
|
-
body.
|
|
62
|
+
body.object_id = id;
|
|
73
63
|
if (category)
|
|
74
64
|
body.category = category;
|
|
75
65
|
if (path)
|
|
76
|
-
body.
|
|
77
|
-
if (actor)
|
|
78
|
-
body.actor_user_id = actor;
|
|
66
|
+
body.path = path;
|
|
79
67
|
return this.client.request({
|
|
80
68
|
endpoint: '/api/archivist/fetch',
|
|
81
69
|
body,
|
|
@@ -106,16 +94,14 @@ export class FilesNamespace {
|
|
|
106
94
|
* @param options - File identifier
|
|
107
95
|
*/
|
|
108
96
|
async delete(options) {
|
|
109
|
-
const { id, category, path
|
|
97
|
+
const { id, category, path } = options;
|
|
110
98
|
const body = {};
|
|
111
99
|
if (id)
|
|
112
|
-
body.
|
|
100
|
+
body.object_id = id;
|
|
113
101
|
if (category)
|
|
114
102
|
body.category = category;
|
|
115
103
|
if (path)
|
|
116
|
-
body.
|
|
117
|
-
if (actor)
|
|
118
|
-
body.actor_user_id = actor;
|
|
104
|
+
body.path = path;
|
|
119
105
|
return this.client.request({
|
|
120
106
|
endpoint: '/api/archivist/delete',
|
|
121
107
|
body,
|
|
@@ -129,11 +115,11 @@ export class FilesNamespace {
|
|
|
129
115
|
*/
|
|
130
116
|
async move(fileId, options) {
|
|
131
117
|
const { newCategory, newPath } = options;
|
|
132
|
-
const body = {
|
|
118
|
+
const body = { object_id: fileId };
|
|
133
119
|
if (newCategory)
|
|
134
120
|
body.new_category = newCategory;
|
|
135
121
|
if (newPath)
|
|
136
|
-
body.
|
|
122
|
+
body.new_path = newPath;
|
|
137
123
|
return this.client.request({
|
|
138
124
|
endpoint: '/api/archivist/move',
|
|
139
125
|
body,
|
|
@@ -147,7 +133,7 @@ export class FilesNamespace {
|
|
|
147
133
|
*/
|
|
148
134
|
async updateMeta(fileId, options) {
|
|
149
135
|
const { tags, description } = options;
|
|
150
|
-
const body = {
|
|
136
|
+
const body = { object_id: fileId };
|
|
151
137
|
if (tags !== undefined)
|
|
152
138
|
body.tags = tags;
|
|
153
139
|
if (description !== undefined)
|
|
@@ -183,7 +169,7 @@ export class FilesNamespace {
|
|
|
183
169
|
async getStorageStats() {
|
|
184
170
|
return this.client.request({
|
|
185
171
|
endpoint: '/api/archivist/stats',
|
|
186
|
-
|
|
172
|
+
body: {},
|
|
187
173
|
});
|
|
188
174
|
}
|
|
189
175
|
/**
|
|
@@ -192,7 +178,7 @@ export class FilesNamespace {
|
|
|
192
178
|
async listCategories() {
|
|
193
179
|
return this.client.request({
|
|
194
180
|
endpoint: '/api/archivist/categories',
|
|
195
|
-
|
|
181
|
+
body: {},
|
|
196
182
|
});
|
|
197
183
|
}
|
|
198
184
|
/**
|
|
@@ -211,10 +197,8 @@ export class FilesNamespace {
|
|
|
211
197
|
* @param options.activeTenant - User's active tenant slug
|
|
212
198
|
*/
|
|
213
199
|
async listViews(options) {
|
|
214
|
-
// Use POST with base64-encoded body (consistent with all other orchestrator endpoints)
|
|
215
200
|
return this.client.request({
|
|
216
201
|
endpoint: '/api/archivist/views',
|
|
217
|
-
method: 'POST',
|
|
218
202
|
body: {
|
|
219
203
|
user_scopes: options?.userScopes || [],
|
|
220
204
|
active_tenant: options?.activeTenant || null,
|
|
@@ -228,8 +212,8 @@ export class FilesNamespace {
|
|
|
228
212
|
*/
|
|
229
213
|
async listCategoriesInView(view) {
|
|
230
214
|
return this.client.request({
|
|
231
|
-
endpoint:
|
|
232
|
-
|
|
215
|
+
endpoint: '/api/archivist/view-categories',
|
|
216
|
+
body: { view },
|
|
233
217
|
});
|
|
234
218
|
}
|
|
235
219
|
/**
|
|
@@ -266,7 +250,6 @@ export class FilesNamespace {
|
|
|
266
250
|
* Factory reset - delete ALL objects in the project/environment.
|
|
267
251
|
*
|
|
268
252
|
* WARNING: This will permanently delete all files in storage.
|
|
269
|
-
* Compliance objects will be moved to retention unless force=true.
|
|
270
253
|
*
|
|
271
254
|
* @param options - Reset options
|
|
272
255
|
* @param options.force - If true, hard delete even compliance objects
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"files.js","sourceRoot":"","sources":["../../src/namespaces/files.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"files.js","sourceRoot":"","sources":["../../src/namespaces/files.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAyHH,MAAM,OAAO,cAAc;IACL;IAApB,YAAoB,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;IAAG,CAAC;IAE7C;;;;;;OAMG;IACH,KAAK,CAAC,MAAM,CACV,IAAY,EACZ,QAAgB,EAChB,UAQI,EAAE;QAEN,MAAM,EACJ,WAAW,EACX,QAAQ,GAAG,SAAS,EACpB,IAAI,GACL,GAAG,OAAO,CAAC;QAEZ,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAExC,MAAM,IAAI,GAA4B;YACpC,WAAW,EAAE,OAAO;YACpB,IAAI,EAAE,IAAI,IAAI,QAAQ;YACtB,QAAQ;YACR,QAAQ;SACT,CAAC;QAEF,IAAI,WAAW;YAAE,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAEjD,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;YACzB,QAAQ,EAAE,uBAAuB;YACjC,IAAI;SACL,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,QAAQ,CACZ,OAA+C;QAE/C,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,cAAc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+
# Architecture
|
|
2
|
+
|
|
3
|
+
## Request Flow
|
|
4
|
+
1. SDK reads `DOMINUS_TOKEN` (PSK) from env or constructor.
|
|
5
|
+
2. Gateway JWT minted via `POST /jwt/mint` (base64 body).
|
|
6
|
+
3. JWT is cached in `dominusCache` (encrypted with PSK) and refreshed before expiry.
|
|
7
|
+
4. All JSON requests are base64-encoded; responses are decoded.
|
|
8
|
+
5. SDK routes `/api/*` to `/svc/*` when using the gateway.
|
|
9
|
+
|
|
10
|
+
## Gateway Routing
|
|
11
|
+
- Default base URL is the gateway (`DOMINUS_GATEWAY_URL`).
|
|
12
|
+
- `DOMINUS_BASE_URL` can override the base (defaults to gateway).
|
|
13
|
+
- `useGateway: true` forces gateway base URL for a request.
|
|
14
|
+
|
|
15
|
+
## Resilience
|
|
16
|
+
- Retries: 3 attempts with exponential backoff + jitter.
|
|
17
|
+
- Circuit breaker: opens after 5 failures, 30s recovery.
|
|
18
|
+
- JWT mint retries on gateway cold starts (401/5xx).
|
|
19
|
+
- Default request timeout: 30s (max 5 min when overridden).
|
|
20
|
+
|
|
21
|
+
## Local JWT Verification
|
|
22
|
+
- `verifyJwtLocally()` fetches JWKS from gateway `/jwt/jwks` and verifies signatures.
|
|
23
|
+
- JWKS cached for 1 hour; stale cache used if refresh fails.
|
|
24
|
+
|
|
25
|
+
## Streaming and Binary
|
|
26
|
+
- SSE streaming via `streamRequest()` (Agent/LLM workflows).
|
|
27
|
+
- Binary uploads/downloads via `binaryUpload()` / `binaryDownload()` for STT/TTS and RAG ingest.
|
|
28
|
+
|
|
29
|
+
## Environment Variables
|
|
30
|
+
- `DOMINUS_TOKEN` (required)
|
|
31
|
+
- `DOMINUS_GATEWAY_URL` (optional)
|
|
32
|
+
- `DOMINUS_BASE_URL` (optional)
|
|
33
|
+
- `DOMINUS_DEBUG=true` (optional)
|
|
34
|
+
- `DOMINUS_HTTP_PROXY` / `DOMINUS_HTTPS_PROXY` (optional, informational)
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Development
|
|
2
|
+
|
|
3
|
+
## Requirements
|
|
4
|
+
- Node.js 18+ (native fetch)
|
|
5
|
+
- TypeScript 5.6+
|
|
6
|
+
|
|
7
|
+
## Commands
|
|
8
|
+
```bash
|
|
9
|
+
npm install
|
|
10
|
+
npm run lint # type-check
|
|
11
|
+
npm run test # node --test
|
|
12
|
+
npm run build # tsc
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Publishing
|
|
16
|
+
Publishing is handled by GitHub Actions on branch push:
|
|
17
|
+
- `development` -> publishes as `dominus-sdk-nodejs-dev`
|
|
18
|
+
- `staging` -> publishes as `dominus-sdk-nodejs-staging`
|
|
19
|
+
- `production` -> publishes as `dominus-sdk-nodejs`
|
|
20
|
+
|
|
21
|
+
Before publishing:
|
|
22
|
+
1. Bump `package.json` version
|
|
23
|
+
2. Ensure `dist/` builds cleanly
|
|
24
|
+
3. Update docs under `docs/`
|
|
25
|
+
|
|
26
|
+
## Adding APIs
|
|
27
|
+
- Add methods in the relevant `src/namespaces/*.ts` file
|
|
28
|
+
- Export types and helpers from `src/index.ts`
|
|
29
|
+
- Use `client.request()` for JSON, `streamRequest()` for SSE, `binaryUpload/Download()` for bytes
|
|
30
|
+
- Always set `method: 'GET'` for GET endpoints
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Namespaces
|
|
2
|
+
|
|
3
|
+
## Core Services
|
|
4
|
+
- `secrets` (Warden): secrets CRUD
|
|
5
|
+
- `db` (Scribe): database CRUD, filters, pagination
|
|
6
|
+
- `secure` (Scribe): secure-table access with audit `reason` + `actor`
|
|
7
|
+
- `redis` (Whisperer): cache, locks, counters, hashes (TTL required)
|
|
8
|
+
- `files` (Archivist): upload/download/list/move/update metadata
|
|
9
|
+
- `auth` (Guardian): users, roles, scopes, tenants, pages/navigation
|
|
10
|
+
- `ddl` (Smith): schema DDL, migrations, provisioning
|
|
11
|
+
- `logs` (Herald): structured logs + queries
|
|
12
|
+
- `portal` (Portal): user login, sessions, profile, navigation
|
|
13
|
+
- `courier` (Courier): email delivery
|
|
14
|
+
- `open` (Scribe Open): direct SQL execution / DSN
|
|
15
|
+
- `health`: service health/ping/warmup
|
|
16
|
+
|
|
17
|
+
## AI + Orchestration
|
|
18
|
+
- `ai.runAgent`, `ai.streamAgent`, `ai.runAgentAsync`
|
|
19
|
+
- `ai.complete`, `ai.completeStream` (multi-provider LLM completions)
|
|
20
|
+
- `ai.rag` (list/ensure/stats/upsert/search/ingest)
|
|
21
|
+
- `ai.artifacts` (create/fetch/list/delete)
|
|
22
|
+
- `ai.results` (async result polling)
|
|
23
|
+
- `ai.workflow` (workflow orchestration in agent-runtime)
|
|
24
|
+
- `ai.tools` (tool registry, default-deny)
|
|
25
|
+
- `ai.stt` / `ai.tts` (speech services)
|
|
26
|
+
- `ai.setup` (pre-flight session setup)
|
|
27
|
+
|
|
28
|
+
## Workflow Manager
|
|
29
|
+
- `workflow` namespace manages workflow CRUD, categories, templates, and execution
|
|
30
|
+
|
|
31
|
+
## Streaming STT
|
|
32
|
+
- `stt` (Oracle) creates streaming transcription sessions with VAD
|
|
33
|
+
|
|
34
|
+
## Admin
|
|
35
|
+
- `admin.reseedAdminCategory()` and `admin.resetAdminCategory()` (destructive)
|