dominus-sdk-nodejs 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 (98) hide show
  1. package/README.md +7 -21
  2. package/dist/index.d.ts +14 -22
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +14 -23
  5. package/dist/index.js.map +1 -1
  6. package/dist/lib/cache.d.ts +1 -1
  7. package/dist/lib/cache.d.ts.map +1 -1
  8. package/dist/lib/cache.js +2 -2
  9. package/dist/lib/cache.js.map +1 -1
  10. package/dist/lib/client.d.ts +32 -22
  11. package/dist/lib/client.d.ts.map +1 -1
  12. package/dist/lib/client.js +110 -81
  13. package/dist/lib/client.js.map +1 -1
  14. package/dist/lib/config.d.ts +7 -0
  15. package/dist/lib/config.d.ts.map +1 -1
  16. package/dist/lib/config.js +10 -5
  17. package/dist/lib/config.js.map +1 -1
  18. package/dist/lib/crypto.d.ts +3 -3
  19. package/dist/lib/crypto.js +3 -3
  20. package/dist/lib/errors.d.ts +12 -0
  21. package/dist/lib/errors.d.ts.map +1 -1
  22. package/dist/lib/errors.js +82 -1
  23. package/dist/lib/errors.js.map +1 -1
  24. package/dist/namespaces/ai.d.ts +4 -4
  25. package/dist/namespaces/artifacts.d.ts +15 -5
  26. package/dist/namespaces/artifacts.d.ts.map +1 -1
  27. package/dist/namespaces/artifacts.js +14 -7
  28. package/dist/namespaces/artifacts.js.map +1 -1
  29. package/dist/namespaces/auth.d.ts.map +1 -1
  30. package/dist/namespaces/auth.js +4 -5
  31. package/dist/namespaces/auth.js.map +1 -1
  32. package/dist/namespaces/authority.d.ts +441 -0
  33. package/dist/namespaces/authority.d.ts.map +1 -0
  34. package/dist/namespaces/authority.js +816 -0
  35. package/dist/namespaces/authority.js.map +1 -0
  36. package/dist/namespaces/db.d.ts +38 -2
  37. package/dist/namespaces/db.d.ts.map +1 -1
  38. package/dist/namespaces/db.js +50 -6
  39. package/dist/namespaces/db.js.map +1 -1
  40. package/dist/namespaces/files.d.ts +10 -2
  41. package/dist/namespaces/files.d.ts.map +1 -1
  42. package/dist/namespaces/files.js +9 -3
  43. package/dist/namespaces/files.js.map +1 -1
  44. package/dist/namespaces/health.d.ts +2 -6
  45. package/dist/namespaces/health.d.ts.map +1 -1
  46. package/dist/namespaces/health.js +9 -15
  47. package/dist/namespaces/health.js.map +1 -1
  48. package/dist/namespaces/logs.d.ts +2 -0
  49. package/dist/namespaces/logs.d.ts.map +1 -1
  50. package/dist/namespaces/logs.js +3 -1
  51. package/dist/namespaces/logs.js.map +1 -1
  52. package/dist/namespaces/portal.d.ts +1 -1
  53. package/dist/namespaces/portal.js +1 -1
  54. package/dist/namespaces/secrets.d.ts +34 -1
  55. package/dist/namespaces/secrets.d.ts.map +1 -1
  56. package/dist/namespaces/secrets.js +68 -4
  57. package/dist/namespaces/secrets.js.map +1 -1
  58. package/dist/namespaces/sync.d.ts +5 -1
  59. package/dist/namespaces/sync.d.ts.map +1 -1
  60. package/dist/namespaces/sync.js +4 -2
  61. package/dist/namespaces/sync.js.map +1 -1
  62. package/dist/namespaces/workflow.d.ts +10 -4
  63. package/dist/namespaces/workflow.d.ts.map +1 -1
  64. package/dist/namespaces/workflow.js +20 -26
  65. package/dist/namespaces/workflow.js.map +1 -1
  66. package/docs/architecture.md +7 -9
  67. package/docs/routes-services.md +15 -12
  68. package/docs/usage-reference.md +27 -27
  69. package/docs/workflow-hard-cut-release.md +6 -5
  70. package/package.json +4 -4
  71. package/dist/namespaces/open.d.ts +0 -27
  72. package/dist/namespaces/open.d.ts.map +0 -1
  73. package/dist/namespaces/open.js +0 -46
  74. package/dist/namespaces/open.js.map +0 -1
  75. package/dist/namespaces/oracle/OracleSession.d.ts +0 -92
  76. package/dist/namespaces/oracle/OracleSession.d.ts.map +0 -1
  77. package/dist/namespaces/oracle/OracleSession.js +0 -219
  78. package/dist/namespaces/oracle/OracleSession.js.map +0 -1
  79. package/dist/namespaces/oracle/index.d.ts +0 -78
  80. package/dist/namespaces/oracle/index.d.ts.map +0 -1
  81. package/dist/namespaces/oracle/index.js +0 -87
  82. package/dist/namespaces/oracle/index.js.map +0 -1
  83. package/dist/namespaces/oracle/internal/AudioCapture.d.ts +0 -42
  84. package/dist/namespaces/oracle/internal/AudioCapture.d.ts.map +0 -1
  85. package/dist/namespaces/oracle/internal/AudioCapture.js +0 -316
  86. package/dist/namespaces/oracle/internal/AudioCapture.js.map +0 -1
  87. package/dist/namespaces/oracle/internal/OracleWebSocket.d.ts +0 -81
  88. package/dist/namespaces/oracle/internal/OracleWebSocket.d.ts.map +0 -1
  89. package/dist/namespaces/oracle/internal/OracleWebSocket.js +0 -209
  90. package/dist/namespaces/oracle/internal/OracleWebSocket.js.map +0 -1
  91. package/dist/namespaces/oracle/internal/VADGate.d.ts +0 -76
  92. package/dist/namespaces/oracle/internal/VADGate.d.ts.map +0 -1
  93. package/dist/namespaces/oracle/internal/VADGate.js +0 -260
  94. package/dist/namespaces/oracle/internal/VADGate.js.map +0 -1
  95. package/dist/namespaces/oracle/types.d.ts +0 -98
  96. package/dist/namespaces/oracle/types.d.ts.map +0 -1
  97. package/dist/namespaces/oracle/types.js +0 -28
  98. package/dist/namespaces/oracle/types.js.map +0 -1
@@ -0,0 +1,816 @@
1
+ /**
2
+ * Authority Namespace - Dominus Authority service surface.
3
+ *
4
+ * This namespace (`dominus.authority.*`) is the canonical SDK entry point
5
+ * for the dominus-authority service. Public scope vocabulary is `appSlug` /
6
+ * `env` / `targetOrgId` / `targetAppSlug` / `targetEnv` with shared/storage
7
+ * helpers renamed to match the same cutover.
8
+ *
9
+ * All methods route through the gateway (`useGateway: true`) which maps
10
+ * `/api/authority/*` -> `/svc/authority/*` upstream to dominus-authority.
11
+ *
12
+ * Run launch is intentionally also exposed as `dominus.workflow.ensure(...)`.
13
+ * Both call `/api/authority/runs/ensure`. Use `dominus.workflow.ensure` from
14
+ * application code for the canonical "launch a saved workflow" path; use
15
+ * `dominus.authority.ensureRun` when you want to think in Authority terms
16
+ * (run lifecycle, run dossiers, retries, cancels).
17
+ */
18
+ // ========================================
19
+ // Helpers
20
+ // ========================================
21
+ function compactObject(input) {
22
+ const out = {};
23
+ for (const [k, v] of Object.entries(input)) {
24
+ if (v === undefined || v === null)
25
+ continue;
26
+ if (typeof v === 'string' && v === '')
27
+ continue;
28
+ out[k] = v;
29
+ }
30
+ return out;
31
+ }
32
+ function buildQueryString(params) {
33
+ const search = new URLSearchParams();
34
+ for (const [k, v] of Object.entries(params)) {
35
+ if (v === undefined || v === null)
36
+ continue;
37
+ if (typeof v === 'string' && v === '')
38
+ continue;
39
+ search.set(k, String(v));
40
+ }
41
+ const qs = search.toString();
42
+ return qs ? `?${qs}` : '';
43
+ }
44
+ function withInitiator(opts) {
45
+ const out = {};
46
+ if (opts.initiatorType)
47
+ out.initiator_type = opts.initiatorType;
48
+ if (opts.initiatorId)
49
+ out.initiator_id = opts.initiatorId;
50
+ if (opts.idempotencyKey)
51
+ out.idempotency_key = opts.idempotencyKey;
52
+ return out;
53
+ }
54
+ function withScope(opts) {
55
+ const out = {};
56
+ if (opts.appSlug)
57
+ out.project_slug = opts.appSlug;
58
+ if (opts.env)
59
+ out.environment = opts.env;
60
+ if (opts.targetOrgId)
61
+ out.target_project_id = opts.targetOrgId;
62
+ if (opts.targetAppSlug)
63
+ out.target_project_slug = opts.targetAppSlug;
64
+ if (opts.targetEnv)
65
+ out.target_environment = opts.targetEnv;
66
+ if (opts.sharedAppSlug)
67
+ out.shared_project_slug = opts.sharedAppSlug;
68
+ return out;
69
+ }
70
+ // ========================================
71
+ // Namespace
72
+ // ========================================
73
+ export class AuthorityNamespace {
74
+ client;
75
+ constructor(client) {
76
+ this.client = client;
77
+ }
78
+ // ----- Runs -----
79
+ /**
80
+ * Ensure (and optionally launch) an Authority-backed workflow run.
81
+ *
82
+ * Calls `POST /api/authority/runs/ensure`.
83
+ */
84
+ async ensureRun(options) {
85
+ if (!options.workflowId && !options.workflowRef) {
86
+ throw new Error('ensureRun requires workflowId or workflowRef');
87
+ }
88
+ if (options.mode === 'streaming') {
89
+ throw new Error('Authority runs do not support streaming mode; use blocking, async, or ensure_only');
90
+ }
91
+ const body = compactObject({
92
+ workflow_id: options.workflowId,
93
+ workflow_ref: options.workflowRef,
94
+ instance_id: options.instanceId,
95
+ instance_key: options.instanceKey,
96
+ group: options.group,
97
+ owner: options.owner,
98
+ subject: options.subject,
99
+ company: options.company,
100
+ mode: options.mode ?? 'async',
101
+ bindings: options.bindings,
102
+ inputs: options.inputs,
103
+ context: options.context,
104
+ ...withInitiator(options),
105
+ ...withScope(options),
106
+ });
107
+ return this.client.request({
108
+ endpoint: '/api/authority/runs/ensure',
109
+ method: 'POST',
110
+ body,
111
+ useGateway: true,
112
+ });
113
+ }
114
+ /**
115
+ * Get an Authority-backed run by id.
116
+ *
117
+ * Calls `GET /api/authority/runs/{run_id}`.
118
+ */
119
+ async getRun(runId) {
120
+ return this.client.request({
121
+ endpoint: `/api/authority/runs/${encodeURIComponent(runId)}`,
122
+ method: 'GET',
123
+ useGateway: true,
124
+ });
125
+ }
126
+ /**
127
+ * List Authority-backed runs, optionally filtered by workflow / status / group / owner.
128
+ *
129
+ * Calls `GET /api/authority/runs`.
130
+ */
131
+ async listRuns(options = {}) {
132
+ const qs = buildQueryString({
133
+ workflow_id: options.workflowId,
134
+ status: options.status,
135
+ group: options.group,
136
+ owner: options.owner,
137
+ target_project_id: options.targetOrgId,
138
+ target_environment: options.targetEnv,
139
+ project_slug: options.appSlug,
140
+ environment: options.env,
141
+ limit: options.limit ?? 50,
142
+ offset: options.offset ?? 0,
143
+ });
144
+ return this.client.request({
145
+ endpoint: `/api/authority/runs${qs}`,
146
+ method: 'GET',
147
+ useGateway: true,
148
+ });
149
+ }
150
+ /**
151
+ * Cancel a running Authority-backed run.
152
+ *
153
+ * Calls `POST /api/authority/runs/{run_id}/cancel`.
154
+ */
155
+ async cancelRun(runId, options = {}) {
156
+ const body = compactObject({
157
+ reason: options.reason,
158
+ mode: options.mode,
159
+ execution_mode: options.executionMode,
160
+ company: options.company,
161
+ subject: options.subject,
162
+ metadata: options.metadata,
163
+ ...withInitiator(options),
164
+ ...withScope(options),
165
+ });
166
+ return this.client.request({
167
+ endpoint: `/api/authority/runs/${encodeURIComponent(runId)}/cancel`,
168
+ method: 'POST',
169
+ body,
170
+ useGateway: true,
171
+ });
172
+ }
173
+ /**
174
+ * Retry a failed or finished Authority-backed run.
175
+ *
176
+ * Calls `POST /api/authority/runs/{run_id}/retry`.
177
+ */
178
+ async retryRun(runId, options = {}) {
179
+ const body = compactObject({
180
+ reason: options.reason,
181
+ mode: options.mode,
182
+ trigger_artifact: options.triggerArtifact,
183
+ company: options.company,
184
+ subject: options.subject,
185
+ branch: options.branch,
186
+ sha: options.sha,
187
+ service_type: options.serviceType,
188
+ metadata: options.metadata,
189
+ ...withInitiator(options),
190
+ ...withScope(options),
191
+ });
192
+ return this.client.request({
193
+ endpoint: `/api/authority/runs/${encodeURIComponent(runId)}/retry`,
194
+ method: 'POST',
195
+ body,
196
+ useGateway: true,
197
+ });
198
+ }
199
+ /**
200
+ * Nudge an Authority-backed run (kick a wake/poll cycle).
201
+ *
202
+ * Calls `POST /api/authority/runs/{run_id}/nudge`.
203
+ */
204
+ async nudgeRun(runId, options = {}) {
205
+ const body = compactObject({
206
+ reason: options.reason,
207
+ mode: options.mode,
208
+ trigger_artifact: options.triggerArtifact,
209
+ company: options.company,
210
+ subject: options.subject,
211
+ metadata: options.metadata,
212
+ ...withInitiator(options),
213
+ ...withScope(options),
214
+ });
215
+ return this.client.request({
216
+ endpoint: `/api/authority/runs/${encodeURIComponent(runId)}/nudge`,
217
+ method: 'POST',
218
+ body,
219
+ useGateway: true,
220
+ });
221
+ }
222
+ /**
223
+ * Get the timeline of state transitions for an Authority-backed run.
224
+ *
225
+ * Calls `GET /api/authority/runs/{run_id}/timeline`.
226
+ */
227
+ async getRunTimeline(runId) {
228
+ return this.client.request({
229
+ endpoint: `/api/authority/runs/${encodeURIComponent(runId)}/timeline`,
230
+ method: 'GET',
231
+ useGateway: true,
232
+ });
233
+ }
234
+ /**
235
+ * Get the full Authority dossier for a run (state + timeline + artifacts + child runs).
236
+ *
237
+ * Calls `GET /api/authority/dossiers/run/{run_id}`.
238
+ */
239
+ async getRunDossier(runId) {
240
+ return this.client.request({
241
+ endpoint: `/api/authority/dossiers/run/${encodeURIComponent(runId)}`,
242
+ method: 'GET',
243
+ useGateway: true,
244
+ });
245
+ }
246
+ // ----- Workflows (publication / bindings) -----
247
+ /**
248
+ * Publish a workflow definition into the Authority workflow registry.
249
+ *
250
+ * Calls `POST /api/authority/workflows/publish`.
251
+ */
252
+ async publishWorkflow(options) {
253
+ if (!options.workflowRef) {
254
+ throw new Error('publishWorkflow requires workflowRef');
255
+ }
256
+ const body = compactObject({
257
+ workflow_ref: options.workflowRef,
258
+ workflow_id: options.workflowId,
259
+ version: options.version,
260
+ status: options.status,
261
+ pinned: options.pinned,
262
+ bindings: options.bindings,
263
+ metadata: options.metadata,
264
+ ...withInitiator(options),
265
+ ...withScope(options),
266
+ });
267
+ return this.client.request({
268
+ endpoint: '/api/authority/workflows/publish',
269
+ method: 'POST',
270
+ body,
271
+ useGateway: true,
272
+ });
273
+ }
274
+ /**
275
+ * List Authority workflow bindings.
276
+ *
277
+ * Calls `GET /api/authority/workflow-bindings`.
278
+ */
279
+ async listBindings(options = {}) {
280
+ const qs = buildQueryString({
281
+ workflow_ref: options.workflowRef,
282
+ workflow_id: options.workflowId,
283
+ status: options.status,
284
+ project_slug: options.appSlug,
285
+ environment: options.env,
286
+ target_project_id: options.targetOrgId,
287
+ target_environment: options.targetEnv,
288
+ limit: options.limit ?? 50,
289
+ offset: options.offset ?? 0,
290
+ });
291
+ return this.client.request({
292
+ endpoint: `/api/authority/workflow-bindings${qs}`,
293
+ method: 'GET',
294
+ useGateway: true,
295
+ });
296
+ }
297
+ /**
298
+ * List Authority workflow publications.
299
+ *
300
+ * Calls `GET /api/authority/workflow-publications`.
301
+ */
302
+ async listPublications(options = {}) {
303
+ const qs = buildQueryString({
304
+ workflow_ref: options.workflowRef,
305
+ status: options.status,
306
+ project_slug: options.appSlug,
307
+ environment: options.env,
308
+ target_project_id: options.targetOrgId,
309
+ target_environment: options.targetEnv,
310
+ limit: options.limit ?? 50,
311
+ offset: options.offset ?? 0,
312
+ });
313
+ return this.client.request({
314
+ endpoint: `/api/authority/workflow-publications${qs}`,
315
+ method: 'GET',
316
+ useGateway: true,
317
+ });
318
+ }
319
+ // ----- Companies -----
320
+ /**
321
+ * Create a new company under Authority scope.
322
+ *
323
+ * Calls `POST /api/authority/companies`.
324
+ */
325
+ async createCompany(options) {
326
+ if (!options.companySlug) {
327
+ throw new Error('createCompany requires companySlug');
328
+ }
329
+ const body = compactObject({
330
+ company_slug: options.companySlug,
331
+ display_name: options.displayName,
332
+ description: options.description,
333
+ bootstrap_status: options.bootstrapStatus,
334
+ bootstrap_run_id: options.bootstrapRunId,
335
+ metadata: options.metadata,
336
+ ...withInitiator(options),
337
+ ...withScope(options),
338
+ });
339
+ return this.client.request({
340
+ endpoint: '/api/authority/companies',
341
+ method: 'POST',
342
+ body,
343
+ useGateway: true,
344
+ });
345
+ }
346
+ /**
347
+ * Get an Authority company by slug.
348
+ *
349
+ * Calls `GET /api/authority/companies/{company}`.
350
+ */
351
+ async getCompany(companySlug, options = {}) {
352
+ const qs = buildQueryString({
353
+ project_slug: options.appSlug,
354
+ environment: options.env,
355
+ target_project_id: options.targetOrgId,
356
+ target_environment: options.targetEnv,
357
+ });
358
+ return this.client.request({
359
+ endpoint: `/api/authority/companies/${encodeURIComponent(companySlug)}${qs}`,
360
+ method: 'GET',
361
+ useGateway: true,
362
+ });
363
+ }
364
+ /**
365
+ * List Authority companies.
366
+ *
367
+ * Calls `GET /api/authority/companies`.
368
+ */
369
+ async listCompanies(options = {}) {
370
+ const qs = buildQueryString({
371
+ project_slug: options.appSlug,
372
+ environment: options.env,
373
+ target_project_id: options.targetOrgId,
374
+ target_environment: options.targetEnv,
375
+ status: options.status,
376
+ limit: options.limit ?? 100,
377
+ offset: options.offset ?? 0,
378
+ });
379
+ return this.client.request({
380
+ endpoint: `/api/authority/companies${qs}`,
381
+ method: 'GET',
382
+ useGateway: true,
383
+ });
384
+ }
385
+ /**
386
+ * Trigger or replay the bootstrap workflow for a company.
387
+ *
388
+ * Calls `POST /api/authority/companies/{company}/bootstrap`.
389
+ */
390
+ async bootstrapCompany(companySlug, options = {}) {
391
+ const body = compactObject({
392
+ action: options.action,
393
+ run_id: options.runId,
394
+ reason: options.reason,
395
+ shared_project_slug: options.sharedAppSlug,
396
+ region: options.region,
397
+ system: options.system,
398
+ github_mode: options.githubMode,
399
+ overwrite_existing: options.overwriteExisting,
400
+ owner_email: options.ownerEmail,
401
+ execution_mode: options.executionMode,
402
+ include: options.include,
403
+ rollback_include: options.rollbackInclude,
404
+ delete_repo: options.deleteRepo,
405
+ metadata: options.metadata,
406
+ display_name: options.displayName,
407
+ description: options.description,
408
+ ...withInitiator(options),
409
+ ...withScope(options),
410
+ });
411
+ return this.client.request({
412
+ endpoint: `/api/authority/companies/${encodeURIComponent(companySlug)}/bootstrap`,
413
+ method: 'POST',
414
+ body,
415
+ useGateway: true,
416
+ });
417
+ }
418
+ /**
419
+ * Get the bootstrap state / steps for a company.
420
+ *
421
+ * Calls `GET /api/authority/companies/{company}/bootstrap`.
422
+ */
423
+ async getCompanyBootstrap(companySlug, options = {}) {
424
+ const qs = buildQueryString({
425
+ project_slug: options.appSlug,
426
+ environment: options.env,
427
+ target_project_id: options.targetOrgId,
428
+ target_environment: options.targetEnv,
429
+ run_id: options.runId,
430
+ });
431
+ return this.client.request({
432
+ endpoint: `/api/authority/companies/${encodeURIComponent(companySlug)}/bootstrap${qs}`,
433
+ method: 'GET',
434
+ useGateway: true,
435
+ });
436
+ }
437
+ /**
438
+ * Get the full Authority dossier for a company.
439
+ *
440
+ * Calls `GET /api/authority/dossiers/company/{company}`.
441
+ */
442
+ async getCompanyDossier(companySlug, options = {}) {
443
+ const qs = buildQueryString({
444
+ project_slug: options.appSlug,
445
+ environment: options.env,
446
+ target_project_id: options.targetOrgId,
447
+ target_environment: options.targetEnv,
448
+ });
449
+ return this.client.request({
450
+ endpoint: `/api/authority/dossiers/company/${encodeURIComponent(companySlug)}${qs}`,
451
+ method: 'GET',
452
+ useGateway: true,
453
+ });
454
+ }
455
+ // ----- Deploys -----
456
+ /**
457
+ * Register a new deploy in Authority.
458
+ *
459
+ * Calls `POST /api/authority/deploys/registrations`.
460
+ */
461
+ async registerDeploy(options) {
462
+ if (!options.repoFullName) {
463
+ throw new Error('registerDeploy requires repoFullName');
464
+ }
465
+ const body = compactObject({
466
+ deploy_id: options.deployId,
467
+ repo_full_name: options.repoFullName,
468
+ branch: options.branch,
469
+ sha: options.sha,
470
+ service_type: options.serviceType,
471
+ company: options.company,
472
+ subject: options.subject,
473
+ metadata: options.metadata,
474
+ ...withInitiator(options),
475
+ ...withScope(options),
476
+ });
477
+ return this.client.request({
478
+ endpoint: '/api/authority/deploys/registrations',
479
+ method: 'POST',
480
+ body,
481
+ useGateway: true,
482
+ });
483
+ }
484
+ /**
485
+ * Get a deploy by id.
486
+ *
487
+ * Calls `GET /api/authority/deploys/{deploy_id}`.
488
+ */
489
+ async getDeploy(deployId) {
490
+ return this.client.request({
491
+ endpoint: `/api/authority/deploys/${encodeURIComponent(deployId)}`,
492
+ method: 'GET',
493
+ useGateway: true,
494
+ });
495
+ }
496
+ /**
497
+ * List deploys with optional filters.
498
+ *
499
+ * Calls `GET /api/authority/deploys`.
500
+ */
501
+ async listDeploys(options = {}) {
502
+ const qs = buildQueryString({
503
+ project_slug: options.appSlug,
504
+ environment: options.env,
505
+ target_project_id: options.targetOrgId,
506
+ target_environment: options.targetEnv,
507
+ repo_full_name: options.repoFullName,
508
+ status: options.status,
509
+ limit: options.limit ?? 50,
510
+ offset: options.offset ?? 0,
511
+ });
512
+ return this.client.request({
513
+ endpoint: `/api/authority/deploys${qs}`,
514
+ method: 'GET',
515
+ useGateway: true,
516
+ });
517
+ }
518
+ /**
519
+ * Trigger a rollout for a previously registered deploy.
520
+ *
521
+ * Calls `POST /api/authority/deploys/{deploy_id}/rollouts`.
522
+ */
523
+ async rolloutDeploy(deployId, options = {}) {
524
+ const body = compactObject({
525
+ repo_full_name: options.repoFullName,
526
+ branch: options.branch,
527
+ sha: options.sha,
528
+ service_type: options.serviceType,
529
+ reason: options.reason,
530
+ company: options.company,
531
+ subject: options.subject,
532
+ metadata: options.metadata,
533
+ ...withInitiator(options),
534
+ ...withScope(options),
535
+ });
536
+ return this.client.request({
537
+ endpoint: `/api/authority/deploys/${encodeURIComponent(deployId)}/rollouts`,
538
+ method: 'POST',
539
+ body,
540
+ useGateway: true,
541
+ });
542
+ }
543
+ /**
544
+ * Get the full Authority dossier for a deploy.
545
+ *
546
+ * Calls `GET /api/authority/dossiers/deploy/{deploy_id}`.
547
+ *
548
+ * Note: this endpoint mirrors the MCP `authority_get_deploy_dossier` tool.
549
+ * If the dossier route is not yet enabled in dominus-authority, the gateway
550
+ * will return 404 — the SDK surface is intentionally aligned with MCP.
551
+ */
552
+ async getDeployDossier(deployId) {
553
+ return this.client.request({
554
+ endpoint: `/api/authority/dossiers/deploy/${encodeURIComponent(deployId)}`,
555
+ method: 'GET',
556
+ useGateway: true,
557
+ });
558
+ }
559
+ // ----- Managed clients -----
560
+ /**
561
+ * Create a managed client class (e.g. "envoy", "scribe").
562
+ *
563
+ * Calls `POST /api/authority/clients/classes`.
564
+ */
565
+ async createClientClass(options) {
566
+ if (!options.slug) {
567
+ throw new Error('createClientClass requires slug');
568
+ }
569
+ const body = compactObject({
570
+ slug: options.slug,
571
+ name: options.name,
572
+ description: options.description,
573
+ metadata: options.metadata,
574
+ ...withInitiator(options),
575
+ ...withScope(options),
576
+ });
577
+ return this.client.request({
578
+ endpoint: '/api/authority/clients/classes',
579
+ method: 'POST',
580
+ body,
581
+ useGateway: true,
582
+ });
583
+ }
584
+ /**
585
+ * Create a managed client variant under a class (channel/arch/runtime tuple).
586
+ *
587
+ * Calls `POST /api/authority/clients/variants`.
588
+ */
589
+ async createClientVariant(options) {
590
+ if (!options.classSlug)
591
+ throw new Error('createClientVariant requires classSlug');
592
+ if (!options.slug)
593
+ throw new Error('createClientVariant requires slug');
594
+ const body = compactObject({
595
+ class_slug: options.classSlug,
596
+ slug: options.slug,
597
+ name: options.name,
598
+ channel: options.channel,
599
+ architecture: options.architecture,
600
+ runtime_family: options.runtimeFamily,
601
+ installer_format: options.installerFormat,
602
+ status: options.status,
603
+ metadata: options.metadata,
604
+ ...withInitiator(options),
605
+ ...withScope(options),
606
+ });
607
+ return this.client.request({
608
+ endpoint: '/api/authority/clients/variants',
609
+ method: 'POST',
610
+ body,
611
+ useGateway: true,
612
+ });
613
+ }
614
+ /**
615
+ * Publish a new managed-client release for a variant.
616
+ *
617
+ * Calls `POST /api/authority/clients/releases`.
618
+ */
619
+ async publishClientRelease(options) {
620
+ if (!options.variantSlug)
621
+ throw new Error('publishClientRelease requires variantSlug');
622
+ if (!options.version)
623
+ throw new Error('publishClientRelease requires version');
624
+ if (!options.manifestPath)
625
+ throw new Error('publishClientRelease requires manifestPath');
626
+ const body = compactObject({
627
+ variant_slug: options.variantSlug,
628
+ version: options.version,
629
+ status: options.status ?? 'published',
630
+ storage_project_slug: options.storageAppSlug,
631
+ storage_environment: options.storageEnv,
632
+ storage_category: options.storageCategory,
633
+ manifest_path: options.manifestPath,
634
+ bootstrapper_path: options.bootstrapperPath,
635
+ artifact_manifest_path: options.artifactManifestPath,
636
+ checksums: options.checksums,
637
+ metadata: options.metadata,
638
+ ...withInitiator(options),
639
+ ...withScope(options),
640
+ });
641
+ return this.client.request({
642
+ endpoint: '/api/authority/clients/releases',
643
+ method: 'POST',
644
+ body,
645
+ useGateway: true,
646
+ });
647
+ }
648
+ /**
649
+ * Create a one-shot bootstrap session that an installer can redeem.
650
+ *
651
+ * Calls `POST /api/authority/clients/bootstrap-sessions`.
652
+ */
653
+ async createClientBootstrapSession(options) {
654
+ if (!options.releaseId) {
655
+ throw new Error('createClientBootstrapSession requires releaseId');
656
+ }
657
+ const body = compactObject({
658
+ release_id: options.releaseId,
659
+ company: options.company,
660
+ subject: options.subject,
661
+ ttl_hours: options.ttlHours,
662
+ metadata: options.metadata,
663
+ ...withInitiator(options),
664
+ ...withScope(options),
665
+ });
666
+ return this.client.request({
667
+ endpoint: '/api/authority/clients/bootstrap-sessions',
668
+ method: 'POST',
669
+ body,
670
+ useGateway: true,
671
+ });
672
+ }
673
+ /**
674
+ * Get a managed client installation by id.
675
+ *
676
+ * Calls `GET /api/authority/clients/installations/{installation_id}`.
677
+ */
678
+ async getClientInstallation(installationId) {
679
+ return this.client.request({
680
+ endpoint: `/api/authority/clients/installations/${encodeURIComponent(installationId)}`,
681
+ method: 'GET',
682
+ useGateway: true,
683
+ });
684
+ }
685
+ /**
686
+ * List managed client installations.
687
+ *
688
+ * Calls `GET /api/authority/clients/installations`.
689
+ */
690
+ async listClientInstallations(options = {}) {
691
+ const qs = buildQueryString({
692
+ project_slug: options.appSlug,
693
+ environment: options.env,
694
+ target_project_id: options.targetOrgId,
695
+ target_environment: options.targetEnv,
696
+ status: options.status,
697
+ variant_slug: options.variantSlug,
698
+ company: options.company,
699
+ limit: options.limit,
700
+ offset: options.offset,
701
+ });
702
+ return this.client.request({
703
+ endpoint: `/api/authority/clients/installations${qs}`,
704
+ method: 'GET',
705
+ useGateway: true,
706
+ });
707
+ }
708
+ /**
709
+ * Revoke a managed client installation.
710
+ *
711
+ * Calls `POST /api/authority/clients/installations/{installation_id}/revoke`.
712
+ */
713
+ async revokeClientInstallation(installationId, options = {}) {
714
+ const body = compactObject({
715
+ reason: options.reason,
716
+ metadata: options.metadata,
717
+ ...withInitiator(options),
718
+ });
719
+ return this.client.request({
720
+ endpoint: `/api/authority/clients/installations/${encodeURIComponent(installationId)}/revoke`,
721
+ method: 'POST',
722
+ body,
723
+ useGateway: true,
724
+ });
725
+ }
726
+ /**
727
+ * Rotate the credentials for a managed client installation.
728
+ *
729
+ * Calls `POST /api/authority/clients/installations/{installation_id}/rotate-credentials`.
730
+ */
731
+ async rotateClientCredentials(installationId, options = {}) {
732
+ const body = compactObject({
733
+ reason: options.reason,
734
+ metadata: options.metadata,
735
+ ...withInitiator(options),
736
+ });
737
+ return this.client.request({
738
+ endpoint: `/api/authority/clients/installations/${encodeURIComponent(installationId)}/rotate-credentials`,
739
+ method: 'POST',
740
+ body,
741
+ useGateway: true,
742
+ });
743
+ }
744
+ // ----- Timelines -----
745
+ /**
746
+ * Query the Authority timelines store.
747
+ *
748
+ * Calls `POST /api/authority/timelines/query`.
749
+ */
750
+ async queryTimelines(options = {}) {
751
+ const body = compactObject({
752
+ subject: options.subject,
753
+ company: options.company,
754
+ run_id: options.runId,
755
+ filters: options.filters,
756
+ window_hours: options.windowHours,
757
+ limit: options.limit,
758
+ ...withInitiator(options),
759
+ ...withScope(options),
760
+ });
761
+ return this.client.request({
762
+ endpoint: '/api/authority/timelines/query',
763
+ method: 'POST',
764
+ body,
765
+ useGateway: true,
766
+ });
767
+ }
768
+ // ----- Context -----
769
+ /**
770
+ * Get the current Authority context for the calling token.
771
+ *
772
+ * Calls `GET /api/authority/context/current`.
773
+ */
774
+ async contextCurrent() {
775
+ return this.client.request({
776
+ endpoint: '/api/authority/context/current',
777
+ method: 'GET',
778
+ useGateway: true,
779
+ });
780
+ }
781
+ /**
782
+ * Resolve the rrc.v1 routing contract from optional org/app/env/company selectors.
783
+ *
784
+ * Calls `POST /api/authority/context/resolve`.
785
+ */
786
+ async contextResolve(options = {}) {
787
+ const body = {};
788
+ if (options.orgId !== undefined)
789
+ body.org_id = options.orgId;
790
+ if (options.appSlug !== undefined)
791
+ body.app_slug = options.appSlug;
792
+ if (options.env !== undefined)
793
+ body.env = options.env;
794
+ if (options.company !== undefined)
795
+ body.company = options.company;
796
+ if (options.tenant !== undefined)
797
+ body.tenant = options.tenant;
798
+ if (options.scopeMode !== undefined)
799
+ body.scope_mode = options.scopeMode;
800
+ if (options.useShared !== undefined)
801
+ body.use_shared = options.useShared;
802
+ if (options.targetOrgId !== undefined)
803
+ body.target_org_id = options.targetOrgId;
804
+ if (options.targetAppSlug !== undefined)
805
+ body.target_app_slug = options.targetAppSlug;
806
+ if (options.targetEnv !== undefined)
807
+ body.target_env = options.targetEnv;
808
+ return this.client.request({
809
+ endpoint: '/api/authority/context/resolve',
810
+ method: 'POST',
811
+ body,
812
+ useGateway: true,
813
+ });
814
+ }
815
+ }
816
+ //# sourceMappingURL=authority.js.map