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