@getmodus/sdk 0.8.0 → 0.9.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/CHANGELOG.md +26 -0
- package/dist/{chunk-GFS7CNON.js → chunk-SP4UYRYG.js} +58 -24
- package/dist/chunk-SP4UYRYG.js.map +1 -0
- package/dist/{conversations-COA6NW8I.d.cts → conversations-D7ffhHIh.d.cts} +380 -50
- package/dist/{conversations-COA6NW8I.d.ts → conversations-D7ffhHIh.d.ts} +380 -50
- package/dist/index.cjs +297 -201
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +182 -100
- package/dist/index.d.ts +182 -100
- package/dist/index.js +212 -150
- package/dist/index.js.map +1 -1
- package/dist/management/index.cjs +895 -624
- package/dist/management/index.cjs.map +1 -1
- package/dist/management/index.d.cts +644 -382
- package/dist/management/index.d.ts +644 -382
- package/dist/management/index.js +879 -642
- package/dist/management/index.js.map +1 -1
- package/package.json +8 -8
- package/dist/chunk-GFS7CNON.js.map +0 -1
package/dist/management/index.js
CHANGED
|
@@ -10,7 +10,141 @@ import {
|
|
|
10
10
|
omitUndefined,
|
|
11
11
|
validateId,
|
|
12
12
|
validatePageSize
|
|
13
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-SP4UYRYG.js";
|
|
14
|
+
|
|
15
|
+
// src/_generated/resources/management/workflows.ts
|
|
16
|
+
var WorkflowsResourceBase = class {
|
|
17
|
+
/** @internal */
|
|
18
|
+
constructor(http, config) {
|
|
19
|
+
this.http = http;
|
|
20
|
+
this.config = config;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* List workflows.
|
|
24
|
+
*
|
|
25
|
+
* Returns a paginated page of workflows the caller can at least `use`. Workflows the caller
|
|
26
|
+
* cannot see are filtered out. Pagination uses an opaque token returned in `nextPageToken`.
|
|
27
|
+
*
|
|
28
|
+
* **Requires:** `workflows:read`
|
|
29
|
+
*
|
|
30
|
+
* @param options.pageSize - Items per page. Defaults to 25.
|
|
31
|
+
* @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit
|
|
32
|
+
* for the first page.
|
|
33
|
+
* @param options.search - Case-insensitive substring filter on workflow name.
|
|
34
|
+
* @param options.type - Filter by workflow type.
|
|
35
|
+
* @param options.view - Variation view. `active` reads deployed; `draft` reads the latest builder
|
|
36
|
+
* snapshot.
|
|
37
|
+
* @param options.includeVariation - Include the requested variation payload (`trigger`,
|
|
38
|
+
* `workflowStructure`, `agentSelection`) on list rows.
|
|
39
|
+
* @returns A page of workflows.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```ts
|
|
43
|
+
* const mgmt = new ModusManagement()
|
|
44
|
+
* for await (const wf of (await mgmt.workflows.list({ search: 'digest' })).autoPagingIter()) {
|
|
45
|
+
* console.log(wf.id, wf.name, wf.status)
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
list(options = {}) {
|
|
50
|
+
const pageSize = options.pageSize ?? 25;
|
|
51
|
+
validatePageSize(pageSize);
|
|
52
|
+
return this.listPage(pageSize, options.pageToken, options.search, options.type, options.view, options.includeVariation);
|
|
53
|
+
}
|
|
54
|
+
async listPage(pageSize, pageToken, search, type, view, includeVariation) {
|
|
55
|
+
const extra = {};
|
|
56
|
+
if (search !== void 0) extra.search = search;
|
|
57
|
+
if (type !== void 0) extra.type = type;
|
|
58
|
+
if (view !== void 0) extra.view = view;
|
|
59
|
+
if (includeVariation !== void 0) extra.includeVariation = includeVariation;
|
|
60
|
+
const data = asRecord(
|
|
61
|
+
await invokeWithRetry(this.config, this.http, "WorkflowsController_list", {
|
|
62
|
+
query: aipListParams(pageSize, pageToken, extra)
|
|
63
|
+
})
|
|
64
|
+
);
|
|
65
|
+
return buildAipPage(
|
|
66
|
+
data,
|
|
67
|
+
"workflows",
|
|
68
|
+
(raw) => raw,
|
|
69
|
+
(token) => this.listPage(pageSize, token, search, type, view, includeVariation)
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Delete a workflow.
|
|
74
|
+
*
|
|
75
|
+
* Deletes a workflow and stops its schedule. The workflow can be restored later with POST
|
|
76
|
+
* /workflows/{id}/restore. Deleting an already-deleted workflow is a no-op.
|
|
77
|
+
*
|
|
78
|
+
* **Requires:** `workflows:write`
|
|
79
|
+
*
|
|
80
|
+
* @param workflowId - Numeric workflow id.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```ts
|
|
84
|
+
* const mgmt = new ModusManagement()
|
|
85
|
+
* await mgmt.workflows.delete('PLACEHOLDER_WORKFLOW_ID')
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
async delete(workflowId) {
|
|
89
|
+
validateId(workflowId, "workflow_id");
|
|
90
|
+
await invokeWithRetry(this.config, this.http, "WorkflowsController_delete", {
|
|
91
|
+
pathParams: { id: workflowId }
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Restore a deleted workflow.
|
|
96
|
+
*
|
|
97
|
+
* Restores a previously deleted workflow and returns it. The workflow’s schedule is not resumed
|
|
98
|
+
* automatically — re-enable it if it should run again. Restoring an active workflow returns it
|
|
99
|
+
* unchanged.
|
|
100
|
+
*
|
|
101
|
+
* **Requires:** `workflows:write`
|
|
102
|
+
*
|
|
103
|
+
* @param workflowId - Numeric workflow id.
|
|
104
|
+
*/
|
|
105
|
+
async restore(workflowId) {
|
|
106
|
+
validateId(workflowId, "workflow_id");
|
|
107
|
+
const data = await invokeWithRetry(this.config, this.http, "WorkflowsController_restore", {
|
|
108
|
+
pathParams: { id: workflowId },
|
|
109
|
+
jsonBody: {}
|
|
110
|
+
});
|
|
111
|
+
return data;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Cancel ownership transfer.
|
|
115
|
+
*
|
|
116
|
+
* Cancels a pending ownership transfer. The current owner may cancel; the pending recipient may
|
|
117
|
+
* decline.
|
|
118
|
+
*
|
|
119
|
+
* **Requires:** `workflows:write`
|
|
120
|
+
*
|
|
121
|
+
* @param workflowId - Numeric workflow id.
|
|
122
|
+
*/
|
|
123
|
+
async cancelOwnershipTransfer(workflowId) {
|
|
124
|
+
validateId(workflowId, "workflow_id");
|
|
125
|
+
const data = await invokeWithRetry(this.config, this.http, "WorkflowsController_cancelOwnershipTransfer", {
|
|
126
|
+
pathParams: { id: workflowId }
|
|
127
|
+
});
|
|
128
|
+
return data;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Accept ownership transfer.
|
|
132
|
+
*
|
|
133
|
+
* Accepts a pending ownership transfer. Only the pending recipient may invoke this action.
|
|
134
|
+
*
|
|
135
|
+
* **Requires:** `workflows:write`
|
|
136
|
+
*
|
|
137
|
+
* @param workflowId - Numeric workflow id.
|
|
138
|
+
*/
|
|
139
|
+
async acceptOwnershipTransfer(workflowId) {
|
|
140
|
+
validateId(workflowId, "workflow_id");
|
|
141
|
+
const data = await invokeWithRetry(this.config, this.http, "WorkflowsController_acceptOwnershipTransfer", {
|
|
142
|
+
pathParams: { id: workflowId },
|
|
143
|
+
jsonBody: {}
|
|
144
|
+
});
|
|
145
|
+
return data;
|
|
146
|
+
}
|
|
147
|
+
};
|
|
14
148
|
|
|
15
149
|
// src/_query.ts
|
|
16
150
|
function updateMaskQuery(updateMask) {
|
|
@@ -54,14 +188,22 @@ async function accessConfigBodyForUpdate(guardrails, loadResource) {
|
|
|
54
188
|
return accessConfigWireForUpdate(existing, guardrails);
|
|
55
189
|
}
|
|
56
190
|
|
|
57
|
-
// src/management/workflows/interfaces.ts
|
|
58
|
-
var
|
|
191
|
+
// src/_generated/resources/management/workflows/interfaces.ts
|
|
192
|
+
var WorkflowsInterfacesResourceBase = class {
|
|
193
|
+
/** @internal */
|
|
59
194
|
constructor(http, config, workflowId) {
|
|
60
195
|
this.http = http;
|
|
61
196
|
this.config = config;
|
|
62
197
|
this.workflowId = workflowId;
|
|
63
198
|
}
|
|
64
|
-
/**
|
|
199
|
+
/**
|
|
200
|
+
* List interfaces attached to a workflow.
|
|
201
|
+
*
|
|
202
|
+
* Returns every Slack, MCP, or Teams interface bound to the workflow. Requires manage permission
|
|
203
|
+
* on the workflow.
|
|
204
|
+
*
|
|
205
|
+
* **Requires:** `workflows:read`
|
|
206
|
+
*/
|
|
65
207
|
async list() {
|
|
66
208
|
validateId(this.workflowId, "workflow_id");
|
|
67
209
|
const data = await invokeWithRetry(this.config, this.http, "WorkflowInterfacesController_list", {
|
|
@@ -69,6 +211,40 @@ var WorkflowInterfacesResource = class {
|
|
|
69
211
|
});
|
|
70
212
|
return data.interfaces;
|
|
71
213
|
}
|
|
214
|
+
/**
|
|
215
|
+
* Remove every interface from a workflow.
|
|
216
|
+
*
|
|
217
|
+
* Deletes all interface rows attached to the workflow. Useful when recreating the interface set
|
|
218
|
+
* from scratch.
|
|
219
|
+
*
|
|
220
|
+
* **Requires:** `workflows:write`
|
|
221
|
+
*/
|
|
222
|
+
async deleteAll() {
|
|
223
|
+
validateId(this.workflowId, "workflow_id");
|
|
224
|
+
await invokeWithRetry(this.config, this.http, "WorkflowInterfacesController_deleteAll", {
|
|
225
|
+
pathParams: { id: this.workflowId }
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Remove a workflow interface.
|
|
230
|
+
*
|
|
231
|
+
* Deletes one interface row. For MCP interfaces, bound MCP tokens are revoked best-effort.
|
|
232
|
+
*
|
|
233
|
+
* **Requires:** `workflows:write`
|
|
234
|
+
*
|
|
235
|
+
* @param interfaceId - Interface row id (UUID).
|
|
236
|
+
*/
|
|
237
|
+
async delete(interfaceId) {
|
|
238
|
+
validateId(this.workflowId, "workflow_id");
|
|
239
|
+
validateId(interfaceId, "interface_id");
|
|
240
|
+
await invokeWithRetry(this.config, this.http, "WorkflowInterfacesController_delete", {
|
|
241
|
+
pathParams: { id: this.workflowId, interfaceId }
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
// src/management/workflows/interfaces.ts
|
|
247
|
+
var WorkflowInterfacesResource = class extends WorkflowsInterfacesResourceBase {
|
|
72
248
|
/**
|
|
73
249
|
* Add an interface to this workflow.
|
|
74
250
|
*
|
|
@@ -99,25 +275,6 @@ var WorkflowInterfacesResource = class {
|
|
|
99
275
|
jsonBody: updateMask === void 0 ? omitUndefined(options) : options
|
|
100
276
|
});
|
|
101
277
|
}
|
|
102
|
-
/**
|
|
103
|
-
* Delete an interface from this workflow.
|
|
104
|
-
*
|
|
105
|
-
* @param interfaceId - Interface id.
|
|
106
|
-
*/
|
|
107
|
-
async delete(interfaceId) {
|
|
108
|
-
validateId(this.workflowId, "workflow_id");
|
|
109
|
-
validateId(interfaceId, "interface_id");
|
|
110
|
-
await invokeWithRetry(this.config, this.http, "WorkflowInterfacesController_delete", {
|
|
111
|
-
pathParams: { id: this.workflowId, interfaceId }
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
/** Delete every interface from this workflow. */
|
|
115
|
-
async deleteAll() {
|
|
116
|
-
validateId(this.workflowId, "workflow_id");
|
|
117
|
-
await invokeWithRetry(this.config, this.http, "WorkflowInterfacesController_deleteAll", {
|
|
118
|
-
pathParams: { id: this.workflowId }
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
278
|
};
|
|
122
279
|
|
|
123
280
|
// src/management/workflows/agents.ts
|
|
@@ -134,66 +291,14 @@ var MANAGEMENT_WORKFLOW_OPERATIONS = {
|
|
|
134
291
|
acceptOwnershipTransfer: "WorkflowsController_acceptOwnershipTransfer",
|
|
135
292
|
toggle: "WorkflowsController_toggle"
|
|
136
293
|
};
|
|
137
|
-
function workflowsListParams(pageSize, pageToken, search, type, view, includeVariation) {
|
|
138
|
-
const extra = {};
|
|
139
|
-
if (search !== void 0) extra.search = search;
|
|
140
|
-
if (type !== void 0) extra.type = type;
|
|
141
|
-
if (view !== void 0) extra.view = view;
|
|
142
|
-
if (includeVariation !== void 0) extra.includeVariation = includeVariation;
|
|
143
|
-
return aipListParams(pageSize, pageToken, extra);
|
|
144
|
-
}
|
|
145
294
|
function parseWorkflow(raw) {
|
|
146
295
|
return raw;
|
|
147
296
|
}
|
|
148
|
-
var ManagementWorkflowsResource = class {
|
|
149
|
-
constructor(
|
|
150
|
-
|
|
151
|
-
this.config = config;
|
|
297
|
+
var ManagementWorkflowsResource = class extends WorkflowsResourceBase {
|
|
298
|
+
constructor() {
|
|
299
|
+
super(...arguments);
|
|
152
300
|
this.ops = MANAGEMENT_WORKFLOW_OPERATIONS;
|
|
153
301
|
}
|
|
154
|
-
/**
|
|
155
|
-
* List workflows in the organization.
|
|
156
|
-
*
|
|
157
|
-
* @param options.pageSize - Maximum items per page (default 25).
|
|
158
|
-
* @param options.pageToken - Token from a previous page's `nextPageToken`; omit for the first page.
|
|
159
|
-
* @param options.search - Case-insensitive substring filter on the workflow name.
|
|
160
|
-
* @param options.type - Filter by workflow type: `"task"` or `"workflow"`.
|
|
161
|
-
* @param options.view - Variation view: `"active"` (deployed) or `"draft"`.
|
|
162
|
-
* @param options.includeVariation - Include variation payload on each list row.
|
|
163
|
-
* @returns A page of workflows.
|
|
164
|
-
* @example
|
|
165
|
-
* ```ts
|
|
166
|
-
* const mgmt = new ModusManagement()
|
|
167
|
-
* for await (const wf of (await mgmt.workflows.list({ search: 'digest' })).autoPagingIter()) {
|
|
168
|
-
* console.log(wf.id, wf.name, wf.status)
|
|
169
|
-
* }
|
|
170
|
-
* ```
|
|
171
|
-
*/
|
|
172
|
-
list(options = {}) {
|
|
173
|
-
const pageSize = options.pageSize ?? 25;
|
|
174
|
-
validatePageSize(pageSize);
|
|
175
|
-
return this.listPage(
|
|
176
|
-
pageSize,
|
|
177
|
-
options.pageToken,
|
|
178
|
-
options.search,
|
|
179
|
-
options.type,
|
|
180
|
-
options.view,
|
|
181
|
-
options.includeVariation
|
|
182
|
-
);
|
|
183
|
-
}
|
|
184
|
-
async listPage(pageSize, pageToken, search, type, view, includeVariation) {
|
|
185
|
-
const data = asRecord(
|
|
186
|
-
await invokeWithRetry(this.config, this.http, this.ops.list, {
|
|
187
|
-
query: workflowsListParams(pageSize, pageToken, search, type, view, includeVariation)
|
|
188
|
-
})
|
|
189
|
-
);
|
|
190
|
-
return buildAipPage(
|
|
191
|
-
data,
|
|
192
|
-
"workflows",
|
|
193
|
-
parseWorkflow,
|
|
194
|
-
(token) => this.listPage(pageSize, token, search, type, view, includeVariation)
|
|
195
|
-
);
|
|
196
|
-
}
|
|
197
302
|
/**
|
|
198
303
|
* Retrieve a workflow with full configuration.
|
|
199
304
|
*
|
|
@@ -334,37 +439,6 @@ var ManagementWorkflowsResource = class {
|
|
|
334
439
|
});
|
|
335
440
|
return parseWorkflow(data);
|
|
336
441
|
}
|
|
337
|
-
/**
|
|
338
|
-
* Delete a workflow.
|
|
339
|
-
*
|
|
340
|
-
* @param workflowId - Workflow id.
|
|
341
|
-
* @returns Resolves when the workflow is deleted.
|
|
342
|
-
* @example
|
|
343
|
-
* ```ts
|
|
344
|
-
* const mgmt = new ModusManagement()
|
|
345
|
-
* await mgmt.workflows.delete('PLACEHOLDER_WORKFLOW_ID')
|
|
346
|
-
* ```
|
|
347
|
-
*/
|
|
348
|
-
async delete(workflowId) {
|
|
349
|
-
validateId(workflowId, "workflow_id");
|
|
350
|
-
await invokeWithRetry(this.config, this.http, this.ops.delete, {
|
|
351
|
-
pathParams: { id: workflowId }
|
|
352
|
-
});
|
|
353
|
-
}
|
|
354
|
-
/**
|
|
355
|
-
* Restore a previously deleted workflow.
|
|
356
|
-
*
|
|
357
|
-
* @param workflowId - Workflow id.
|
|
358
|
-
* @returns The restored workflow.
|
|
359
|
-
*/
|
|
360
|
-
async restore(workflowId) {
|
|
361
|
-
validateId(workflowId, "workflow_id");
|
|
362
|
-
const data = await invokeWithRetry(this.config, this.http, this.ops.restore, {
|
|
363
|
-
pathParams: { id: workflowId },
|
|
364
|
-
jsonBody: {}
|
|
365
|
-
});
|
|
366
|
-
return parseWorkflow(data);
|
|
367
|
-
}
|
|
368
442
|
/**
|
|
369
443
|
* Start transferring ownership of a workflow to another organization member.
|
|
370
444
|
*
|
|
@@ -385,28 +459,6 @@ var ManagementWorkflowsResource = class {
|
|
|
385
459
|
);
|
|
386
460
|
return parseWorkflow(data);
|
|
387
461
|
}
|
|
388
|
-
/** Cancel a pending workflow ownership transfer. */
|
|
389
|
-
async cancelOwnershipTransfer(workflowId) {
|
|
390
|
-
validateId(workflowId, "workflow_id");
|
|
391
|
-
const data = await invokeWithRetry(
|
|
392
|
-
this.config,
|
|
393
|
-
this.http,
|
|
394
|
-
this.ops.cancelOwnershipTransfer,
|
|
395
|
-
{ pathParams: { id: workflowId } }
|
|
396
|
-
);
|
|
397
|
-
return parseWorkflow(data);
|
|
398
|
-
}
|
|
399
|
-
/** Accept a pending workflow ownership transfer. */
|
|
400
|
-
async acceptOwnershipTransfer(workflowId) {
|
|
401
|
-
validateId(workflowId, "workflow_id");
|
|
402
|
-
const data = await invokeWithRetry(
|
|
403
|
-
this.config,
|
|
404
|
-
this.http,
|
|
405
|
-
this.ops.acceptOwnershipTransfer,
|
|
406
|
-
{ pathParams: { id: workflowId }, jsonBody: {} }
|
|
407
|
-
);
|
|
408
|
-
return parseWorkflow(data);
|
|
409
|
-
}
|
|
410
462
|
};
|
|
411
463
|
|
|
412
464
|
// src/types/context.ts
|
|
@@ -497,8 +549,174 @@ async function resolveAndUpdateLink(items, uid, options) {
|
|
|
497
549
|
});
|
|
498
550
|
}
|
|
499
551
|
|
|
500
|
-
// src/management/context/dashboards.ts
|
|
501
|
-
var
|
|
552
|
+
// src/_generated/resources/management/context/dashboards.ts
|
|
553
|
+
var ContextDashboardsResourceBase = class {
|
|
554
|
+
/** @internal */
|
|
555
|
+
constructor(http, config) {
|
|
556
|
+
this.http = http;
|
|
557
|
+
this.config = config;
|
|
558
|
+
}
|
|
559
|
+
/**
|
|
560
|
+
* Delete a dashboard.
|
|
561
|
+
*
|
|
562
|
+
* Removes the dashboard from every listing and deletes its alert workflows. It cannot be restored
|
|
563
|
+
* through the API.
|
|
564
|
+
*
|
|
565
|
+
* **Requires:** `context:write`
|
|
566
|
+
*
|
|
567
|
+
* @param dashboardId - Dashboard id, as shown in the app URL.
|
|
568
|
+
*
|
|
569
|
+
* @example
|
|
570
|
+
* ```ts
|
|
571
|
+
* await mgmt.context.dashboards.delete('DASHBOARD_ID')
|
|
572
|
+
* ```
|
|
573
|
+
*/
|
|
574
|
+
async delete(dashboardId) {
|
|
575
|
+
validateId(dashboardId, "dashboardId");
|
|
576
|
+
await invokeWithRetry(this.config, this.http, "DashboardsController_delete", {
|
|
577
|
+
pathParams: { dashboardId }
|
|
578
|
+
});
|
|
579
|
+
}
|
|
580
|
+
/**
|
|
581
|
+
* List dashboard draft snapshots.
|
|
582
|
+
*
|
|
583
|
+
* Returns ids and timestamps of the most recent draft snapshots. Editors only.
|
|
584
|
+
*
|
|
585
|
+
* **Requires:** `context:read`
|
|
586
|
+
*
|
|
587
|
+
* @param dashboardId - Dashboard id, as shown in the app URL.
|
|
588
|
+
*
|
|
589
|
+
* @example
|
|
590
|
+
* ```ts
|
|
591
|
+
* const snapshots = await mgmt.context.dashboards.listDraftSnapshots('DASHBOARD_ID')
|
|
592
|
+
* snapshots.map((snapshot) => snapshot.uid)
|
|
593
|
+
* ```
|
|
594
|
+
*/
|
|
595
|
+
async listDraftSnapshots(dashboardId) {
|
|
596
|
+
validateId(dashboardId, "dashboardId");
|
|
597
|
+
const data = await invokeWithRetry(this.config, this.http, "DashboardsController_listDraftSnapshots", {
|
|
598
|
+
pathParams: { dashboardId }
|
|
599
|
+
});
|
|
600
|
+
return asRecord(data).snapshots;
|
|
601
|
+
}
|
|
602
|
+
/**
|
|
603
|
+
* Cancel an ownership transfer.
|
|
604
|
+
*
|
|
605
|
+
* Owner only. Clears the pending transfer and returns the dashboard.
|
|
606
|
+
*
|
|
607
|
+
* **Requires:** `context:write`
|
|
608
|
+
*
|
|
609
|
+
* @param dashboardId - Dashboard id, as shown in the app URL.
|
|
610
|
+
*
|
|
611
|
+
* @example
|
|
612
|
+
* ```ts
|
|
613
|
+
* await mgmt.context.dashboards.cancelOwnershipTransfer('DASHBOARD_ID')
|
|
614
|
+
* ```
|
|
615
|
+
*/
|
|
616
|
+
async cancelOwnershipTransfer(dashboardId) {
|
|
617
|
+
validateId(dashboardId, "dashboardId");
|
|
618
|
+
const data = await invokeWithRetry(this.config, this.http, "DashboardsController_cancelOwnership", {
|
|
619
|
+
pathParams: { dashboardId }
|
|
620
|
+
});
|
|
621
|
+
return asRecord(data);
|
|
622
|
+
}
|
|
623
|
+
/**
|
|
624
|
+
* Accept an ownership transfer.
|
|
625
|
+
*
|
|
626
|
+
* Recipient only. Makes you the owner and clears the pending transfer.
|
|
627
|
+
*
|
|
628
|
+
* **Requires:** `context:write`
|
|
629
|
+
*
|
|
630
|
+
* @param dashboardId - Dashboard id, as shown in the app URL.
|
|
631
|
+
*
|
|
632
|
+
* @example
|
|
633
|
+
* ```ts
|
|
634
|
+
* await mgmt.context.dashboards.acceptOwnershipTransfer('DASHBOARD_ID')
|
|
635
|
+
* ```
|
|
636
|
+
*/
|
|
637
|
+
async acceptOwnershipTransfer(dashboardId) {
|
|
638
|
+
validateId(dashboardId, "dashboardId");
|
|
639
|
+
const data = await invokeWithRetry(this.config, this.http, "DashboardsController_acceptOwnership", {
|
|
640
|
+
pathParams: { dashboardId }
|
|
641
|
+
});
|
|
642
|
+
return asRecord(data);
|
|
643
|
+
}
|
|
644
|
+
/**
|
|
645
|
+
* List dashboard versions.
|
|
646
|
+
*
|
|
647
|
+
* Returns the published versions, newest first, each with its full definition. Draft snapshots
|
|
648
|
+
* are not included. The response is not paginated and can be large.
|
|
649
|
+
*
|
|
650
|
+
* **Requires:** `context:read`
|
|
651
|
+
*
|
|
652
|
+
* @param dashboardId - Dashboard id, as shown in the app URL.
|
|
653
|
+
*
|
|
654
|
+
* @example
|
|
655
|
+
* ```ts
|
|
656
|
+
* const versions = await mgmt.context.dashboards.listVersions('DASHBOARD_ID')
|
|
657
|
+
* versions.map((version) => [version.uid, version.versionNumber])
|
|
658
|
+
* ```
|
|
659
|
+
*/
|
|
660
|
+
async listVersions(dashboardId) {
|
|
661
|
+
validateId(dashboardId, "dashboardId");
|
|
662
|
+
const data = await invokeWithRetry(this.config, this.http, "DashboardsController_listVersions", {
|
|
663
|
+
pathParams: { dashboardId }
|
|
664
|
+
});
|
|
665
|
+
return asRecord(data).versions;
|
|
666
|
+
}
|
|
667
|
+
/**
|
|
668
|
+
* Get a dashboard version.
|
|
669
|
+
*
|
|
670
|
+
* Returns the dashboard as it was in the given version. For a draft snapshot (editors only) the
|
|
671
|
+
* view is reported as active and selectedVersion.versionNumber is null.
|
|
672
|
+
*
|
|
673
|
+
* **Requires:** `context:read`
|
|
674
|
+
*
|
|
675
|
+
* @param dashboardId - Dashboard id, as shown in the app URL.
|
|
676
|
+
* @param versionId - Version id, or a draft snapshot id for editors.
|
|
677
|
+
*
|
|
678
|
+
* @example
|
|
679
|
+
* ```ts
|
|
680
|
+
* const old = await mgmt.context.dashboards.getVersion('DASHBOARD_ID', 'VERSION_ID')
|
|
681
|
+
* old.selectedVersion.versionNumber
|
|
682
|
+
* ```
|
|
683
|
+
*/
|
|
684
|
+
async getVersion(dashboardId, versionId) {
|
|
685
|
+
validateId(dashboardId, "dashboardId");
|
|
686
|
+
validateId(versionId, "versionId");
|
|
687
|
+
const data = await invokeWithRetry(this.config, this.http, "DashboardsController_getVersion", {
|
|
688
|
+
pathParams: { dashboardId, versionId }
|
|
689
|
+
});
|
|
690
|
+
return asRecord(data);
|
|
691
|
+
}
|
|
692
|
+
/**
|
|
693
|
+
* Restore a dashboard version.
|
|
694
|
+
*
|
|
695
|
+
* Replaces the current draft with the content of the given version. The outgoing draft is kept as
|
|
696
|
+
* a draft snapshot. Returns the draft view.
|
|
697
|
+
*
|
|
698
|
+
* **Requires:** `context:write`
|
|
699
|
+
*
|
|
700
|
+
* @param dashboardId - Dashboard id, as shown in the app URL.
|
|
701
|
+
* @param versionId - Version id, or a draft snapshot id for editors.
|
|
702
|
+
*
|
|
703
|
+
* @example
|
|
704
|
+
* ```ts
|
|
705
|
+
* await mgmt.context.dashboards.restoreVersion('DASHBOARD_ID', 'VERSION_ID')
|
|
706
|
+
* ```
|
|
707
|
+
*/
|
|
708
|
+
async restoreVersion(dashboardId, versionId) {
|
|
709
|
+
validateId(dashboardId, "dashboardId");
|
|
710
|
+
validateId(versionId, "versionId");
|
|
711
|
+
const data = await invokeWithRetry(this.config, this.http, "DashboardsController_restore", {
|
|
712
|
+
pathParams: { dashboardId, versionId }
|
|
713
|
+
});
|
|
714
|
+
return asRecord(data);
|
|
715
|
+
}
|
|
716
|
+
};
|
|
717
|
+
|
|
718
|
+
// src/_generated/resources/management/context/dashboards/elements.ts
|
|
719
|
+
var ContextDashboardsElementsResourceBase = class {
|
|
502
720
|
/** @internal */
|
|
503
721
|
constructor(http, config, dashboardId) {
|
|
504
722
|
this.http = http;
|
|
@@ -506,11 +724,14 @@ var ManagementDashboardElementsResource = class {
|
|
|
506
724
|
this.dashboardId = dashboardId;
|
|
507
725
|
}
|
|
508
726
|
/**
|
|
509
|
-
* List
|
|
727
|
+
* List dashboard elements.
|
|
728
|
+
*
|
|
729
|
+
* Lists every tile and filter on the dashboard draft with id, kind, title and layout. Filters
|
|
730
|
+
* also carry sqlReferences, the exact templates tile SQL must use to reference them. Returns the
|
|
731
|
+
* current draftRevision.
|
|
732
|
+
*
|
|
733
|
+
* **Requires:** `context:read`
|
|
510
734
|
*
|
|
511
|
-
* @returns Each element's id, kind, title and grid position, plus the current
|
|
512
|
-
* `draftRevision` to pass as `expectedRevision` on the next change.
|
|
513
|
-
* @throws NotFoundError - The dashboard does not exist or you cannot edit it.
|
|
514
735
|
* @example
|
|
515
736
|
* ```ts
|
|
516
737
|
* const listed = await mgmt.context.dashboards.elements('DASHBOARD_ID').list()
|
|
@@ -518,19 +739,21 @@ var ManagementDashboardElementsResource = class {
|
|
|
518
739
|
* ```
|
|
519
740
|
*/
|
|
520
741
|
async list() {
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
);
|
|
742
|
+
const data = await invokeWithRetry(this.config, this.http, "DashboardsController_listElements", {
|
|
743
|
+
pathParams: { dashboardId: this.dashboardId }
|
|
744
|
+
});
|
|
745
|
+
return asRecord(data);
|
|
526
746
|
}
|
|
527
747
|
/**
|
|
528
|
-
* Get
|
|
748
|
+
* Get a dashboard element.
|
|
749
|
+
*
|
|
750
|
+
* Returns the full draft configuration of one dashboard element, including SQL, chart settings
|
|
751
|
+
* and filter options, with the current draftRevision.
|
|
752
|
+
*
|
|
753
|
+
* **Requires:** `context:read`
|
|
754
|
+
*
|
|
755
|
+
* @param elementId - The dashboard element id to read.
|
|
529
756
|
*
|
|
530
|
-
* @param elementId - Id of the tile or filter, as returned by `list()`.
|
|
531
|
-
* @returns The element's settings and the current `draftRevision`.
|
|
532
|
-
* @throws NotFoundError - The dashboard or the element does not exist, or you cannot
|
|
533
|
-
* edit the dashboard.
|
|
534
757
|
* @example
|
|
535
758
|
* ```ts
|
|
536
759
|
* const result = await mgmt.context.dashboards.elements('DASHBOARD_ID').get('ELEMENT_ID')
|
|
@@ -539,11 +762,18 @@ var ManagementDashboardElementsResource = class {
|
|
|
539
762
|
*/
|
|
540
763
|
async get(elementId) {
|
|
541
764
|
validateId(elementId, "elementId");
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
765
|
+
const data = await invokeWithRetry(this.config, this.http, "DashboardsController_getElement", {
|
|
766
|
+
pathParams: { dashboardId: this.dashboardId, elementId }
|
|
767
|
+
});
|
|
768
|
+
return asRecord(data);
|
|
769
|
+
}
|
|
770
|
+
};
|
|
771
|
+
|
|
772
|
+
// src/management/context/dashboards.ts
|
|
773
|
+
var ManagementDashboardElementsResource = class extends ContextDashboardsElementsResourceBase {
|
|
774
|
+
/** @internal */
|
|
775
|
+
constructor(http, config, dashboardId) {
|
|
776
|
+
super(http, config, dashboardId);
|
|
547
777
|
}
|
|
548
778
|
/**
|
|
549
779
|
* Add a blank tile or filter to the dashboard draft.
|
|
@@ -608,11 +838,10 @@ var ManagementDashboardElementsResource = class {
|
|
|
608
838
|
);
|
|
609
839
|
}
|
|
610
840
|
};
|
|
611
|
-
var ManagementDashboardsResource = class {
|
|
841
|
+
var ManagementDashboardsResource = class extends ContextDashboardsResourceBase {
|
|
612
842
|
/** @internal */
|
|
613
843
|
constructor(http, config) {
|
|
614
|
-
|
|
615
|
-
this.config = config;
|
|
844
|
+
super(http, config);
|
|
616
845
|
}
|
|
617
846
|
/**
|
|
618
847
|
* List dashboards with their full definitions.
|
|
@@ -671,198 +900,87 @@ var ManagementDashboardsResource = class {
|
|
|
671
900
|
* @returns The created dashboard in its draft view.
|
|
672
901
|
* @throws ModusError - The definition or access settings are invalid.
|
|
673
902
|
* @example
|
|
674
|
-
* ```ts
|
|
675
|
-
* const dashboard = await mgmt.context.dashboards.create({
|
|
676
|
-
* title: 'Revenue',
|
|
677
|
-
* definition: { tiles: [], filters: [] },
|
|
678
|
-
* })
|
|
679
|
-
* dashboard.id
|
|
680
|
-
* ```
|
|
681
|
-
*/
|
|
682
|
-
async create(input) {
|
|
683
|
-
return asRecord(
|
|
684
|
-
await invokeWithRetry(this.config, this.http, "DashboardsController_create", {
|
|
685
|
-
jsonBody: {
|
|
686
|
-
title: input.title,
|
|
687
|
-
description: input.description,
|
|
688
|
-
definition: input.definition,
|
|
689
|
-
access: input.access
|
|
690
|
-
}
|
|
691
|
-
})
|
|
692
|
-
);
|
|
693
|
-
}
|
|
694
|
-
/**
|
|
695
|
-
* Replace the whole draft definition, and optionally the title and description.
|
|
696
|
-
*
|
|
697
|
-
* @param dashboardId - Id of the dashboard.
|
|
698
|
-
* @param input.expectedRevision - The `draftRevision` your change is based on.
|
|
699
|
-
* @param input.definition - The complete new definition. Tiles and filters left
|
|
700
|
-
* out are removed.
|
|
701
|
-
* @param input.title - New title; unchanged when omitted.
|
|
702
|
-
* @param input.description - New description; unchanged when omitted.
|
|
703
|
-
* @returns The dashboard draft after the change, including the new `draftRevision`.
|
|
704
|
-
* @throws ConflictError - The draft changed since `expectedRevision`; get the draft
|
|
705
|
-
* again and retry with the new revision.
|
|
706
|
-
* @throws NotFoundError - The dashboard does not exist or you cannot edit it.
|
|
707
|
-
* @example
|
|
708
|
-
* ```ts
|
|
709
|
-
* const draft = await mgmt.context.dashboards.get('DASHBOARD_ID', { view: 'draft' })
|
|
710
|
-
* await mgmt.context.dashboards.updateDraft('DASHBOARD_ID', {
|
|
711
|
-
* expectedRevision: draft.draftRevision,
|
|
712
|
-
* definition: draft.definition,
|
|
713
|
-
* title: 'Revenue',
|
|
714
|
-
* })
|
|
715
|
-
* ```
|
|
716
|
-
*/
|
|
717
|
-
async updateDraft(dashboardId, input) {
|
|
718
|
-
validateId(dashboardId, "dashboardId");
|
|
719
|
-
return asRecord(
|
|
720
|
-
await invokeWithRetry(this.config, this.http, "DashboardsController_updateDraft", {
|
|
721
|
-
pathParams: { dashboardId },
|
|
722
|
-
jsonBody: {
|
|
723
|
-
expectedRevision: input.expectedRevision,
|
|
724
|
-
title: input.title,
|
|
725
|
-
description: input.description,
|
|
726
|
-
definition: input.definition
|
|
727
|
-
}
|
|
728
|
-
})
|
|
729
|
-
);
|
|
730
|
-
}
|
|
731
|
-
/**
|
|
732
|
-
* Publish the draft as a new version that everyone with access sees.
|
|
733
|
-
*
|
|
734
|
-
* Alert workflows defined on the dashboard are updated to match.
|
|
735
|
-
*
|
|
736
|
-
* @param dashboardId - Id of the dashboard.
|
|
737
|
-
* @param input.expectedRevision - The `draftRevision` you reviewed and want to publish.
|
|
738
|
-
* @returns The published `dashboard` and the new `version`.
|
|
739
|
-
* @throws ConflictError - The draft changed since `expectedRevision`.
|
|
740
|
-
* @throws NotFoundError - The dashboard does not exist or you cannot edit it.
|
|
741
|
-
* @example
|
|
742
|
-
* ```ts
|
|
743
|
-
* const result = await mgmt.context.dashboards.publish('DASHBOARD_ID', { expectedRevision: 4 })
|
|
744
|
-
* result.version.versionNumber
|
|
745
|
-
* ```
|
|
746
|
-
*/
|
|
747
|
-
async publish(dashboardId, input) {
|
|
748
|
-
validateId(dashboardId, "dashboardId");
|
|
749
|
-
return asRecord(
|
|
750
|
-
await invokeWithRetry(this.config, this.http, "DashboardsController_publish", {
|
|
751
|
-
pathParams: { dashboardId },
|
|
752
|
-
jsonBody: { expectedRevision: input.expectedRevision }
|
|
753
|
-
})
|
|
754
|
-
);
|
|
755
|
-
}
|
|
756
|
-
/**
|
|
757
|
-
* Delete a dashboard and the alert workflows defined on it.
|
|
758
|
-
*
|
|
759
|
-
* A deleted dashboard cannot be restored.
|
|
760
|
-
*
|
|
761
|
-
* @param dashboardId - Id of the dashboard.
|
|
762
|
-
* @throws NotFoundError - The dashboard does not exist or you cannot edit it.
|
|
763
|
-
* @example
|
|
764
|
-
* ```ts
|
|
765
|
-
* await mgmt.context.dashboards.delete('DASHBOARD_ID')
|
|
766
|
-
* ```
|
|
767
|
-
*/
|
|
768
|
-
async delete(dashboardId) {
|
|
769
|
-
validateId(dashboardId, "dashboardId");
|
|
770
|
-
await invokeWithRetry(this.config, this.http, "DashboardsController_delete", {
|
|
771
|
-
pathParams: { dashboardId }
|
|
772
|
-
});
|
|
773
|
-
}
|
|
774
|
-
/**
|
|
775
|
-
* List the published versions of a dashboard, newest first.
|
|
776
|
-
*
|
|
777
|
-
* @param dashboardId - Id of the dashboard.
|
|
778
|
-
* @returns Every published version with its full definition. Definitions are
|
|
779
|
-
* returned as stored, so older versions may lack newer fields. The list is
|
|
780
|
-
* not paginated.
|
|
781
|
-
* @throws NotFoundError - The dashboard does not exist or you cannot open it.
|
|
782
|
-
* @example
|
|
783
|
-
* ```ts
|
|
784
|
-
* const versions = await mgmt.context.dashboards.listVersions('DASHBOARD_ID')
|
|
785
|
-
* versions.map((version) => [version.uid, version.versionNumber])
|
|
786
|
-
* ```
|
|
787
|
-
*/
|
|
788
|
-
async listVersions(dashboardId) {
|
|
789
|
-
validateId(dashboardId, "dashboardId");
|
|
790
|
-
const data = asRecord(
|
|
791
|
-
await invokeWithRetry(this.config, this.http, "DashboardsController_listVersions", {
|
|
792
|
-
pathParams: { dashboardId }
|
|
793
|
-
})
|
|
794
|
-
);
|
|
795
|
-
return data.versions;
|
|
796
|
-
}
|
|
797
|
-
/**
|
|
798
|
-
* Get a dashboard as it was in one version.
|
|
799
|
-
*
|
|
800
|
-
* @param dashboardId - Id of the dashboard.
|
|
801
|
-
* @param versionId - Id of the version, as returned by `listVersions()`.
|
|
802
|
-
* @returns The dashboard with that version's definition.
|
|
803
|
-
* @throws NotFoundError - The dashboard or the version does not exist, or you cannot
|
|
804
|
-
* open the dashboard.
|
|
805
|
-
* @example
|
|
806
|
-
* ```ts
|
|
807
|
-
* const old = await mgmt.context.dashboards.getVersion('DASHBOARD_ID', 'VERSION_ID')
|
|
808
|
-
* old.selectedVersion.versionNumber
|
|
903
|
+
* ```ts
|
|
904
|
+
* const dashboard = await mgmt.context.dashboards.create({
|
|
905
|
+
* title: 'Revenue',
|
|
906
|
+
* definition: { tiles: [], filters: [] },
|
|
907
|
+
* })
|
|
908
|
+
* dashboard.id
|
|
809
909
|
* ```
|
|
810
910
|
*/
|
|
811
|
-
async
|
|
812
|
-
validateId(dashboardId, "dashboardId");
|
|
813
|
-
validateId(versionId, "versionId");
|
|
911
|
+
async create(input) {
|
|
814
912
|
return asRecord(
|
|
815
|
-
await invokeWithRetry(this.config, this.http, "
|
|
816
|
-
|
|
913
|
+
await invokeWithRetry(this.config, this.http, "DashboardsController_create", {
|
|
914
|
+
jsonBody: {
|
|
915
|
+
title: input.title,
|
|
916
|
+
description: input.description,
|
|
917
|
+
definition: input.definition,
|
|
918
|
+
access: input.access
|
|
919
|
+
}
|
|
817
920
|
})
|
|
818
921
|
);
|
|
819
922
|
}
|
|
820
923
|
/**
|
|
821
|
-
* Replace the draft
|
|
822
|
-
*
|
|
823
|
-
* The draft being replaced is kept as a draft snapshot. Call `publish()`
|
|
824
|
-
* afterwards to make the restored content visible.
|
|
924
|
+
* Replace the whole draft definition, and optionally the title and description.
|
|
825
925
|
*
|
|
826
926
|
* @param dashboardId - Id of the dashboard.
|
|
827
|
-
* @param
|
|
828
|
-
* @
|
|
829
|
-
*
|
|
830
|
-
*
|
|
927
|
+
* @param input.expectedRevision - The `draftRevision` your change is based on.
|
|
928
|
+
* @param input.definition - The complete new definition. Tiles and filters left
|
|
929
|
+
* out are removed.
|
|
930
|
+
* @param input.title - New title; unchanged when omitted.
|
|
931
|
+
* @param input.description - New description; unchanged when omitted.
|
|
932
|
+
* @returns The dashboard draft after the change, including the new `draftRevision`.
|
|
933
|
+
* @throws ConflictError - The draft changed since `expectedRevision`; get the draft
|
|
934
|
+
* again and retry with the new revision.
|
|
935
|
+
* @throws NotFoundError - The dashboard does not exist or you cannot edit it.
|
|
831
936
|
* @example
|
|
832
937
|
* ```ts
|
|
833
|
-
* await mgmt.context.dashboards.
|
|
938
|
+
* const draft = await mgmt.context.dashboards.get('DASHBOARD_ID', { view: 'draft' })
|
|
939
|
+
* await mgmt.context.dashboards.updateDraft('DASHBOARD_ID', {
|
|
940
|
+
* expectedRevision: draft.draftRevision,
|
|
941
|
+
* definition: draft.definition,
|
|
942
|
+
* title: 'Revenue',
|
|
943
|
+
* })
|
|
834
944
|
* ```
|
|
835
945
|
*/
|
|
836
|
-
async
|
|
946
|
+
async updateDraft(dashboardId, input) {
|
|
837
947
|
validateId(dashboardId, "dashboardId");
|
|
838
|
-
validateId(versionId, "versionId");
|
|
839
948
|
return asRecord(
|
|
840
|
-
await invokeWithRetry(this.config, this.http, "
|
|
841
|
-
pathParams: { dashboardId
|
|
949
|
+
await invokeWithRetry(this.config, this.http, "DashboardsController_updateDraft", {
|
|
950
|
+
pathParams: { dashboardId },
|
|
951
|
+
jsonBody: {
|
|
952
|
+
expectedRevision: input.expectedRevision,
|
|
953
|
+
title: input.title,
|
|
954
|
+
description: input.description,
|
|
955
|
+
definition: input.definition
|
|
956
|
+
}
|
|
842
957
|
})
|
|
843
958
|
);
|
|
844
959
|
}
|
|
845
960
|
/**
|
|
846
|
-
*
|
|
961
|
+
* Publish the draft as a new version that everyone with access sees.
|
|
962
|
+
*
|
|
963
|
+
* Alert workflows defined on the dashboard are updated to match.
|
|
847
964
|
*
|
|
848
965
|
* @param dashboardId - Id of the dashboard.
|
|
849
|
-
* @
|
|
850
|
-
*
|
|
966
|
+
* @param input.expectedRevision - The `draftRevision` you reviewed and want to publish.
|
|
967
|
+
* @returns The published `dashboard` and the new `version`.
|
|
968
|
+
* @throws ConflictError - The draft changed since `expectedRevision`.
|
|
851
969
|
* @throws NotFoundError - The dashboard does not exist or you cannot edit it.
|
|
852
970
|
* @example
|
|
853
971
|
* ```ts
|
|
854
|
-
* const
|
|
855
|
-
*
|
|
972
|
+
* const result = await mgmt.context.dashboards.publish('DASHBOARD_ID', { expectedRevision: 4 })
|
|
973
|
+
* result.version.versionNumber
|
|
856
974
|
* ```
|
|
857
975
|
*/
|
|
858
|
-
async
|
|
976
|
+
async publish(dashboardId, input) {
|
|
859
977
|
validateId(dashboardId, "dashboardId");
|
|
860
|
-
|
|
861
|
-
await invokeWithRetry(this.config, this.http, "
|
|
862
|
-
pathParams: { dashboardId }
|
|
978
|
+
return asRecord(
|
|
979
|
+
await invokeWithRetry(this.config, this.http, "DashboardsController_publish", {
|
|
980
|
+
pathParams: { dashboardId },
|
|
981
|
+
jsonBody: { expectedRevision: input.expectedRevision }
|
|
863
982
|
})
|
|
864
983
|
);
|
|
865
|
-
return data.snapshots;
|
|
866
984
|
}
|
|
867
985
|
/**
|
|
868
986
|
* Replace who can open and edit a dashboard.
|
|
@@ -928,50 +1046,6 @@ var ManagementDashboardsResource = class {
|
|
|
928
1046
|
})
|
|
929
1047
|
);
|
|
930
1048
|
}
|
|
931
|
-
/**
|
|
932
|
-
* Accept a pending ownership transfer and become the dashboard owner.
|
|
933
|
-
*
|
|
934
|
-
* Only the requested recipient can accept.
|
|
935
|
-
*
|
|
936
|
-
* @param dashboardId - Id of the dashboard.
|
|
937
|
-
* @returns The dashboard with you as its owner.
|
|
938
|
-
* @throws NotFoundError - The dashboard does not exist, or it has no pending transfer
|
|
939
|
-
* addressed to you.
|
|
940
|
-
* @example
|
|
941
|
-
* ```ts
|
|
942
|
-
* await mgmt.context.dashboards.acceptOwnershipTransfer('DASHBOARD_ID')
|
|
943
|
-
* ```
|
|
944
|
-
*/
|
|
945
|
-
async acceptOwnershipTransfer(dashboardId) {
|
|
946
|
-
validateId(dashboardId, "dashboardId");
|
|
947
|
-
return asRecord(
|
|
948
|
-
await invokeWithRetry(this.config, this.http, "DashboardsController_acceptOwnership", {
|
|
949
|
-
pathParams: { dashboardId }
|
|
950
|
-
})
|
|
951
|
-
);
|
|
952
|
-
}
|
|
953
|
-
/**
|
|
954
|
-
* Cancel a pending ownership transfer.
|
|
955
|
-
*
|
|
956
|
-
* Only the owner can cancel.
|
|
957
|
-
*
|
|
958
|
-
* @param dashboardId - Id of the dashboard.
|
|
959
|
-
* @returns The dashboard with no pending transfer.
|
|
960
|
-
* @throws NotFoundError - The dashboard does not exist, you cannot open it, or you are
|
|
961
|
-
* not the owner.
|
|
962
|
-
* @example
|
|
963
|
-
* ```ts
|
|
964
|
-
* await mgmt.context.dashboards.cancelOwnershipTransfer('DASHBOARD_ID')
|
|
965
|
-
* ```
|
|
966
|
-
*/
|
|
967
|
-
async cancelOwnershipTransfer(dashboardId) {
|
|
968
|
-
validateId(dashboardId, "dashboardId");
|
|
969
|
-
return asRecord(
|
|
970
|
-
await invokeWithRetry(this.config, this.http, "DashboardsController_cancelOwnership", {
|
|
971
|
-
pathParams: { dashboardId }
|
|
972
|
-
})
|
|
973
|
-
);
|
|
974
|
-
}
|
|
975
1049
|
/**
|
|
976
1050
|
* Work with the tiles and filters of one dashboard draft.
|
|
977
1051
|
*
|
|
@@ -1017,8 +1091,66 @@ var ManagementDashboardsResource = class {
|
|
|
1017
1091
|
// src/management/context/files.ts
|
|
1018
1092
|
import { readdir, readFile, stat } from "fs/promises";
|
|
1019
1093
|
import { dirname, join, relative } from "path";
|
|
1094
|
+
|
|
1095
|
+
// src/_generated/resources/management/context/files.ts
|
|
1096
|
+
var ContextFilesResourceBase = class {
|
|
1097
|
+
/** @internal */
|
|
1098
|
+
constructor(http, config) {
|
|
1099
|
+
this.http = http;
|
|
1100
|
+
this.config = config;
|
|
1101
|
+
}
|
|
1102
|
+
/**
|
|
1103
|
+
* List file uploads.
|
|
1104
|
+
*
|
|
1105
|
+
* Returns a page of durable landed file uploads. Uploads that have not landed yet are visible via
|
|
1106
|
+
* `GET /context/files/{uploadId}`, not this list.
|
|
1107
|
+
*
|
|
1108
|
+
* **Requires:** `context:read`
|
|
1109
|
+
*
|
|
1110
|
+
* @param options.pageSize - Items per page. Defaults to 50.
|
|
1111
|
+
* @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit
|
|
1112
|
+
* for the first page.
|
|
1113
|
+
* @returns A page of files.
|
|
1114
|
+
*/
|
|
1115
|
+
list(options = {}) {
|
|
1116
|
+
const pageSize = options.pageSize ?? 50;
|
|
1117
|
+
validatePageSize(pageSize, 200);
|
|
1118
|
+
return this.listPage(pageSize, options.pageToken);
|
|
1119
|
+
}
|
|
1120
|
+
async listPage(pageSize, pageToken) {
|
|
1121
|
+
const data = asRecord(
|
|
1122
|
+
await invokeWithRetry(this.config, this.http, "ContextFilesController_list", {
|
|
1123
|
+
query: aipListParams(pageSize, pageToken)
|
|
1124
|
+
})
|
|
1125
|
+
);
|
|
1126
|
+
return buildAipPage(
|
|
1127
|
+
data,
|
|
1128
|
+
"files",
|
|
1129
|
+
(raw) => raw,
|
|
1130
|
+
(token) => this.listPage(pageSize, token)
|
|
1131
|
+
);
|
|
1132
|
+
}
|
|
1133
|
+
/**
|
|
1134
|
+
* Get a file upload.
|
|
1135
|
+
*
|
|
1136
|
+
* Returns status + metadata for one upload. Prefers the durable landed context item; falls back
|
|
1137
|
+
* to in-flight upload status while the object has not landed yet. 404 if neither exists.
|
|
1138
|
+
*
|
|
1139
|
+
* **Requires:** `context:read`
|
|
1140
|
+
*
|
|
1141
|
+
* @param uploadId - Upload id returned by `createUploadUrl` / `createUploadUrls`.
|
|
1142
|
+
*/
|
|
1143
|
+
async get(uploadId) {
|
|
1144
|
+
validateId(uploadId, "uploadId");
|
|
1145
|
+
const data = await invokeWithRetry(this.config, this.http, "ContextFilesController_get", {
|
|
1146
|
+
pathParams: { uploadId }
|
|
1147
|
+
});
|
|
1148
|
+
return asRecord(data);
|
|
1149
|
+
}
|
|
1150
|
+
};
|
|
1151
|
+
|
|
1152
|
+
// src/management/context/files.ts
|
|
1020
1153
|
var MAX_BULK_UPLOAD_FILES = 100;
|
|
1021
|
-
var DEFAULT_LIST_PAGE_SIZE = 50;
|
|
1022
1154
|
var DEFAULT_PUT_TIMEOUT_MS = 6e4;
|
|
1023
1155
|
var DEFAULT_POLL_INTERVAL_MS = 500;
|
|
1024
1156
|
var DEFAULT_UPLOAD_TIMEOUT_MS = 12e4;
|
|
@@ -1136,11 +1268,10 @@ function assignSlots(batch, result, failed) {
|
|
|
1136
1268
|
}
|
|
1137
1269
|
return assignments;
|
|
1138
1270
|
}
|
|
1139
|
-
var ManagementContextFilesResource = class {
|
|
1271
|
+
var ManagementContextFilesResource = class extends ContextFilesResourceBase {
|
|
1140
1272
|
/** @internal */
|
|
1141
1273
|
constructor(http, config) {
|
|
1142
|
-
|
|
1143
|
-
this.config = config;
|
|
1274
|
+
super(http, config);
|
|
1144
1275
|
}
|
|
1145
1276
|
/**
|
|
1146
1277
|
* Get a presigned S3 PUT URL for one file.
|
|
@@ -1212,41 +1343,6 @@ var ManagementContextFilesResource = class {
|
|
|
1212
1343
|
})
|
|
1213
1344
|
);
|
|
1214
1345
|
}
|
|
1215
|
-
/**
|
|
1216
|
-
* Fetch one file upload by its id.
|
|
1217
|
-
*
|
|
1218
|
-
* @param uploadId - Upload id returned by `createUploadUrl` / `uploadFromUrl`.
|
|
1219
|
-
* @returns The file upload resource, including its processing `status`.
|
|
1220
|
-
*/
|
|
1221
|
-
async get(uploadId) {
|
|
1222
|
-
validateId(uploadId, "uploadId");
|
|
1223
|
-
return asRecord(
|
|
1224
|
-
await invokeWithRetry(this.config, this.http, "ContextFilesController_get", {
|
|
1225
|
-
pathParams: { uploadId }
|
|
1226
|
-
})
|
|
1227
|
-
);
|
|
1228
|
-
}
|
|
1229
|
-
/**
|
|
1230
|
-
* List durable file uploads.
|
|
1231
|
-
*
|
|
1232
|
-
* @param options.pageSize - Items per page (default 50).
|
|
1233
|
-
* @param options.pageToken - Opaque token from a previous page's `nextPageToken`.
|
|
1234
|
-
* @returns Page of file uploads. Uploads that only have a pending row (not yet
|
|
1235
|
-
* landed) aren't included here — use `get(uploadId)` for those.
|
|
1236
|
-
*/
|
|
1237
|
-
list(options = {}) {
|
|
1238
|
-
const pageSize = options.pageSize ?? DEFAULT_LIST_PAGE_SIZE;
|
|
1239
|
-
validatePageSize(pageSize, 200);
|
|
1240
|
-
return this.listPage(pageSize, options.pageToken);
|
|
1241
|
-
}
|
|
1242
|
-
async listPage(pageSize, pageToken) {
|
|
1243
|
-
const data = asRecord(
|
|
1244
|
-
await invokeWithRetry(this.config, this.http, "ContextFilesController_list", {
|
|
1245
|
-
query: aipListParams(pageSize, pageToken)
|
|
1246
|
-
})
|
|
1247
|
-
);
|
|
1248
|
-
return buildAipPage(data, "files", (raw) => raw, (token) => this.listPage(pageSize, token));
|
|
1249
|
-
}
|
|
1250
1346
|
/**
|
|
1251
1347
|
* Turn a file already PUT to a presigned URL into durable context.
|
|
1252
1348
|
*
|
|
@@ -1860,31 +1956,191 @@ var ManagementContextResource = class {
|
|
|
1860
1956
|
updateLink(uid, options) {
|
|
1861
1957
|
return resolveAndUpdateLink(this.items, uid, options);
|
|
1862
1958
|
}
|
|
1863
|
-
/** @internal */
|
|
1864
|
-
async create(operationId, payload) {
|
|
1865
|
-
const data = await invokeWithRetry(this.config, this.http, operationId, {
|
|
1866
|
-
jsonBody: payload
|
|
1959
|
+
/** @internal */
|
|
1960
|
+
async create(operationId, payload) {
|
|
1961
|
+
const data = await invokeWithRetry(this.config, this.http, operationId, {
|
|
1962
|
+
jsonBody: payload
|
|
1963
|
+
});
|
|
1964
|
+
return withCreatedUid(data);
|
|
1965
|
+
}
|
|
1966
|
+
};
|
|
1967
|
+
|
|
1968
|
+
// src/_generated/resources/management/scopes.ts
|
|
1969
|
+
var ScopesResourceBase = class {
|
|
1970
|
+
/** @internal */
|
|
1971
|
+
constructor(http, config) {
|
|
1972
|
+
this.http = http;
|
|
1973
|
+
this.config = config;
|
|
1974
|
+
}
|
|
1975
|
+
/**
|
|
1976
|
+
* List scopes.
|
|
1977
|
+
*
|
|
1978
|
+
* Returns a paginated page of scopes the caller can at least `use`. Scopes the caller cannot see
|
|
1979
|
+
* are filtered out. Pagination uses an opaque token returned in `nextPageToken`.
|
|
1980
|
+
*
|
|
1981
|
+
* **Requires:** `scopes:read`
|
|
1982
|
+
*
|
|
1983
|
+
* @param options.pageSize - Items per page. Defaults to 25.
|
|
1984
|
+
* @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit
|
|
1985
|
+
* for the first page.
|
|
1986
|
+
* @param options.search - Case-insensitive substring filter on scope name.
|
|
1987
|
+
* @param options.view - Variation view. `active` reads deployed; `draft` reads the latest builder
|
|
1988
|
+
* snapshot.
|
|
1989
|
+
* @param options.managerId - Return only scopes supervised by this manager scope id.
|
|
1990
|
+
* @returns A page of scopes.
|
|
1991
|
+
*
|
|
1992
|
+
* @example
|
|
1993
|
+
* ```ts
|
|
1994
|
+
* const mgmt = new ModusManagement()
|
|
1995
|
+
* for await (const scope of (await mgmt.scopes.list()).autoPagingIter()) {
|
|
1996
|
+
* console.log(scope.id, scope.name, scope.status)
|
|
1997
|
+
* }
|
|
1998
|
+
* ```
|
|
1999
|
+
*/
|
|
2000
|
+
list(options = {}) {
|
|
2001
|
+
const pageSize = options.pageSize ?? 25;
|
|
2002
|
+
validatePageSize(pageSize);
|
|
2003
|
+
return this.listPage(pageSize, options.pageToken, options.search, options.view, options.managerId);
|
|
2004
|
+
}
|
|
2005
|
+
async listPage(pageSize, pageToken, search, view, managerId) {
|
|
2006
|
+
const extra = {};
|
|
2007
|
+
if (search !== void 0) extra.search = search;
|
|
2008
|
+
if (view !== void 0) extra.view = view;
|
|
2009
|
+
if (managerId !== void 0) extra.managerId = managerId;
|
|
2010
|
+
const data = asRecord(
|
|
2011
|
+
await invokeWithRetry(this.config, this.http, "ScopesController_list", {
|
|
2012
|
+
query: aipListParams(pageSize, pageToken, extra)
|
|
2013
|
+
})
|
|
2014
|
+
);
|
|
2015
|
+
return buildAipPage(
|
|
2016
|
+
data,
|
|
2017
|
+
"scopes",
|
|
2018
|
+
(raw) => raw,
|
|
2019
|
+
(token) => this.listPage(pageSize, token, search, view, managerId)
|
|
2020
|
+
);
|
|
2021
|
+
}
|
|
2022
|
+
/**
|
|
2023
|
+
* Get a scope.
|
|
2024
|
+
*
|
|
2025
|
+
* Returns a scope. `view=active` (default) returns the deployed version; `view=draft` returns the
|
|
2026
|
+
* latest unpublished edits. Returns 404 if you cannot access the scope.
|
|
2027
|
+
*
|
|
2028
|
+
* **Requires:** `scopes:read`
|
|
2029
|
+
*
|
|
2030
|
+
* @param scopeId - Numeric scope id.
|
|
2031
|
+
* @param options.view - Which variation snapshot to read. Defaults to `active`.
|
|
2032
|
+
*
|
|
2033
|
+
* @example
|
|
2034
|
+
* ```ts
|
|
2035
|
+
* const mgmt = new ModusManagement()
|
|
2036
|
+
* const scope = await mgmt.scopes.get('PLACEHOLDER_SCOPE_ID')
|
|
2037
|
+
* console.log(scope.name, scope.status)
|
|
2038
|
+
* ```
|
|
2039
|
+
*/
|
|
2040
|
+
async get(scopeId, options = {}) {
|
|
2041
|
+
validateId(scopeId, "scope_id");
|
|
2042
|
+
const data = await invokeWithRetry(this.config, this.http, "ScopesController_get", {
|
|
2043
|
+
pathParams: { id: scopeId },
|
|
2044
|
+
query: { view: options.view }
|
|
2045
|
+
});
|
|
2046
|
+
return data;
|
|
2047
|
+
}
|
|
2048
|
+
/**
|
|
2049
|
+
* Delete a scope.
|
|
2050
|
+
*
|
|
2051
|
+
* Deletes a scope. The scope can be restored later with POST /scopes/{id}/restore. Deleting an
|
|
2052
|
+
* already-deleted scope is a no-op.
|
|
2053
|
+
*
|
|
2054
|
+
* **Requires:** `scopes:write`
|
|
2055
|
+
*
|
|
2056
|
+
* @param scopeId - Numeric scope id.
|
|
2057
|
+
*
|
|
2058
|
+
* @example
|
|
2059
|
+
* ```ts
|
|
2060
|
+
* const mgmt = new ModusManagement()
|
|
2061
|
+
* await mgmt.scopes.delete('PLACEHOLDER_SCOPE_ID')
|
|
2062
|
+
* ```
|
|
2063
|
+
*/
|
|
2064
|
+
async delete(scopeId) {
|
|
2065
|
+
validateId(scopeId, "scope_id");
|
|
2066
|
+
await invokeWithRetry(this.config, this.http, "ScopesController_delete", {
|
|
2067
|
+
pathParams: { id: scopeId }
|
|
2068
|
+
});
|
|
2069
|
+
}
|
|
2070
|
+
/**
|
|
2071
|
+
* Restore a deleted scope.
|
|
2072
|
+
*
|
|
2073
|
+
* Restores a previously deleted scope and returns it. Restoring a scope that is already active
|
|
2074
|
+
* returns it unchanged.
|
|
2075
|
+
*
|
|
2076
|
+
* **Requires:** `scopes:write`
|
|
2077
|
+
*
|
|
2078
|
+
* @param scopeId - Numeric scope id.
|
|
2079
|
+
*/
|
|
2080
|
+
async restore(scopeId) {
|
|
2081
|
+
validateId(scopeId, "scope_id");
|
|
2082
|
+
const data = await invokeWithRetry(this.config, this.http, "ScopesController_restore", {
|
|
2083
|
+
pathParams: { id: scopeId },
|
|
2084
|
+
jsonBody: {}
|
|
2085
|
+
});
|
|
2086
|
+
return data;
|
|
2087
|
+
}
|
|
2088
|
+
/**
|
|
2089
|
+
* Cancel ownership transfer.
|
|
2090
|
+
*
|
|
2091
|
+
* Cancels a pending ownership transfer. The current owner may cancel; the pending recipient may
|
|
2092
|
+
* decline.
|
|
2093
|
+
*
|
|
2094
|
+
* **Requires:** `scopes:write`
|
|
2095
|
+
*
|
|
2096
|
+
* @param scopeId - Numeric scope id.
|
|
2097
|
+
*/
|
|
2098
|
+
async cancelOwnershipTransfer(scopeId) {
|
|
2099
|
+
validateId(scopeId, "scope_id");
|
|
2100
|
+
const data = await invokeWithRetry(this.config, this.http, "ScopesController_cancelOwnershipTransfer", {
|
|
2101
|
+
pathParams: { id: scopeId }
|
|
2102
|
+
});
|
|
2103
|
+
return data;
|
|
2104
|
+
}
|
|
2105
|
+
/**
|
|
2106
|
+
* Accept ownership transfer.
|
|
2107
|
+
*
|
|
2108
|
+
* Accepts a pending ownership transfer. Only the pending recipient may invoke this action.
|
|
2109
|
+
*
|
|
2110
|
+
* **Requires:** `scopes:write`
|
|
2111
|
+
*
|
|
2112
|
+
* @param scopeId - Numeric scope id.
|
|
2113
|
+
*/
|
|
2114
|
+
async acceptOwnershipTransfer(scopeId) {
|
|
2115
|
+
validateId(scopeId, "scope_id");
|
|
2116
|
+
const data = await invokeWithRetry(this.config, this.http, "ScopesController_acceptOwnershipTransfer", {
|
|
2117
|
+
pathParams: { id: scopeId },
|
|
2118
|
+
jsonBody: {}
|
|
1867
2119
|
});
|
|
1868
|
-
return
|
|
2120
|
+
return data;
|
|
1869
2121
|
}
|
|
1870
2122
|
};
|
|
1871
2123
|
|
|
1872
|
-
// src/management/scopes/memories.ts
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
}
|
|
1876
|
-
var ScopeMemoriesResource = class {
|
|
2124
|
+
// src/_generated/resources/management/scopes/memories.ts
|
|
2125
|
+
var ScopesMemoriesResourceBase = class {
|
|
2126
|
+
/** @internal */
|
|
1877
2127
|
constructor(http, config, scopeId) {
|
|
1878
2128
|
this.http = http;
|
|
1879
2129
|
this.config = config;
|
|
1880
2130
|
this.scopeId = scopeId;
|
|
1881
2131
|
}
|
|
1882
2132
|
/**
|
|
1883
|
-
* List memories
|
|
2133
|
+
* List scope memories.
|
|
1884
2134
|
*
|
|
1885
|
-
*
|
|
1886
|
-
*
|
|
1887
|
-
*
|
|
2135
|
+
* Returns a page of the scope’s memories (up to 1000 total). Pass `nextPageToken` as `pageToken`
|
|
2136
|
+
* to fetch the next page. Optional `userId` filters to one end user.
|
|
2137
|
+
*
|
|
2138
|
+
* **Requires:** `scopes:read`
|
|
2139
|
+
*
|
|
2140
|
+
* @param options.pageSize - Items per page. Defaults to 25.
|
|
2141
|
+
* @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit
|
|
2142
|
+
* for the first page.
|
|
2143
|
+
* @param options.userId - Narrow results to memories tagged with this end-user id.
|
|
1888
2144
|
* @returns A page of memories.
|
|
1889
2145
|
*/
|
|
1890
2146
|
list(options = {}) {
|
|
@@ -1905,15 +2161,20 @@ var ScopeMemoriesResource = class {
|
|
|
1905
2161
|
return buildAipPage(
|
|
1906
2162
|
data,
|
|
1907
2163
|
"memories",
|
|
1908
|
-
|
|
2164
|
+
(raw) => raw,
|
|
1909
2165
|
(token) => this.listPage(pageSize, token, userId)
|
|
1910
2166
|
);
|
|
1911
2167
|
}
|
|
1912
2168
|
/**
|
|
1913
|
-
* Search
|
|
2169
|
+
* Search scope memories.
|
|
2170
|
+
*
|
|
2171
|
+
* Returns memories ranked by semantic similarity to the supplied `query`. Caller must at least
|
|
2172
|
+
* `use` the scope. Optional `userId` and `limit` body fields narrow the result set (legacy parity
|
|
2173
|
+
* with `search-memories`).
|
|
1914
2174
|
*
|
|
1915
|
-
*
|
|
1916
|
-
*
|
|
2175
|
+
* **Requires:** `scopes:read`
|
|
2176
|
+
*
|
|
2177
|
+
* @param request - Request body; see `MemorySearchRequest`.
|
|
1917
2178
|
*/
|
|
1918
2179
|
async search(request) {
|
|
1919
2180
|
validateId(this.scopeId, "scope_id");
|
|
@@ -1924,12 +2185,17 @@ var ScopeMemoriesResource = class {
|
|
|
1924
2185
|
return data;
|
|
1925
2186
|
}
|
|
1926
2187
|
/**
|
|
1927
|
-
* Update
|
|
2188
|
+
* Update a memory.
|
|
2189
|
+
*
|
|
2190
|
+
* Updates one memory. Supply at least one of `memory` or `metadata`. Use `updateMask` to limit
|
|
2191
|
+
* which fields change.
|
|
1928
2192
|
*
|
|
1929
|
-
*
|
|
1930
|
-
*
|
|
1931
|
-
* @param
|
|
1932
|
-
* @
|
|
2193
|
+
* **Requires:** `scopes:write`
|
|
2194
|
+
*
|
|
2195
|
+
* @param memoryId - Opaque memory id as returned by the list / search endpoints.
|
|
2196
|
+
* @param update - Request body; see `MemoryUpdate`.
|
|
2197
|
+
* @param options.updateMask - Comma-separated list of fields to update. Omit to update all
|
|
2198
|
+
* provided fields.
|
|
1933
2199
|
*/
|
|
1934
2200
|
async update(memoryId, update, options = {}) {
|
|
1935
2201
|
validateId(memoryId, "memory_id");
|
|
@@ -1939,9 +2205,17 @@ var ScopeMemoriesResource = class {
|
|
|
1939
2205
|
query: updateMaskQuery(options.updateMask),
|
|
1940
2206
|
jsonBody: omitUndefined(update)
|
|
1941
2207
|
});
|
|
1942
|
-
return
|
|
2208
|
+
return data;
|
|
1943
2209
|
}
|
|
1944
|
-
/**
|
|
2210
|
+
/**
|
|
2211
|
+
* Delete a memory.
|
|
2212
|
+
*
|
|
2213
|
+
* Deletes one memory. Deleting an already-deleted memory is a no-op.
|
|
2214
|
+
*
|
|
2215
|
+
* **Requires:** `scopes:write`
|
|
2216
|
+
*
|
|
2217
|
+
* @param memoryId - Opaque memory id as returned by the list / search endpoints.
|
|
2218
|
+
*/
|
|
1945
2219
|
async delete(memoryId) {
|
|
1946
2220
|
validateId(memoryId, "memory_id");
|
|
1947
2221
|
validateId(this.scopeId, "scope_id");
|
|
@@ -1951,32 +2225,42 @@ var ScopeMemoriesResource = class {
|
|
|
1951
2225
|
}
|
|
1952
2226
|
};
|
|
1953
2227
|
|
|
1954
|
-
// src/management/scopes/
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
var ScopeEvaluationsResource = class {
|
|
2228
|
+
// src/management/scopes/memories.ts
|
|
2229
|
+
var ScopeMemoriesResource = class extends ScopesMemoriesResourceBase {
|
|
2230
|
+
};
|
|
2231
|
+
|
|
2232
|
+
// src/_generated/resources/management/scopes/evaluations.ts
|
|
2233
|
+
var ScopesEvaluationsResourceBase = class {
|
|
2234
|
+
/** @internal */
|
|
1962
2235
|
constructor(http, config, scopeId) {
|
|
1963
2236
|
this.http = http;
|
|
1964
2237
|
this.config = config;
|
|
1965
2238
|
this.scopeId = scopeId;
|
|
1966
2239
|
}
|
|
1967
|
-
/**
|
|
2240
|
+
/**
|
|
2241
|
+
* Get evaluation configuration.
|
|
2242
|
+
*
|
|
2243
|
+
* Returns the evaluation configuration for a scope, including judge settings, schedule cadence,
|
|
2244
|
+
* and notification preferences.
|
|
2245
|
+
*
|
|
2246
|
+
* **Requires:** `scopes:read`
|
|
2247
|
+
*/
|
|
1968
2248
|
async getConfig() {
|
|
1969
2249
|
validateId(this.scopeId, "scope_id");
|
|
1970
2250
|
const data = await invokeWithRetry(this.config, this.http, "EvaluationsController_getConfig", {
|
|
1971
2251
|
pathParams: { id: this.scopeId }
|
|
1972
2252
|
});
|
|
1973
|
-
return
|
|
2253
|
+
return data;
|
|
1974
2254
|
}
|
|
1975
2255
|
/**
|
|
1976
|
-
* Update
|
|
2256
|
+
* Update evaluation configuration.
|
|
2257
|
+
*
|
|
2258
|
+
* Updates the evaluation configuration for a scope. Changes to the schedule cadence are synced
|
|
2259
|
+
* automatically.
|
|
1977
2260
|
*
|
|
1978
|
-
*
|
|
1979
|
-
*
|
|
2261
|
+
* **Requires:** `scopes:write`
|
|
2262
|
+
*
|
|
2263
|
+
* @param update - Request body; see `UpdateEvaluationConfig`.
|
|
1980
2264
|
*/
|
|
1981
2265
|
async updateConfig(update) {
|
|
1982
2266
|
validateId(this.scopeId, "scope_id");
|
|
@@ -1984,12 +2268,17 @@ var ScopeEvaluationsResource = class {
|
|
|
1984
2268
|
pathParams: { id: this.scopeId },
|
|
1985
2269
|
jsonBody: omitUndefined(update)
|
|
1986
2270
|
});
|
|
1987
|
-
return
|
|
2271
|
+
return data;
|
|
1988
2272
|
}
|
|
1989
2273
|
/**
|
|
1990
|
-
* Trigger
|
|
2274
|
+
* Trigger evaluation run.
|
|
1991
2275
|
*
|
|
1992
|
-
*
|
|
2276
|
+
* Triggers a manual evaluation run for the scope. The run executes asynchronously.
|
|
2277
|
+
*
|
|
2278
|
+
* **Requires:** `scopes:write`
|
|
2279
|
+
*
|
|
2280
|
+
* @returns Evaluation run accepted and queued. The run executes asynchronously; poll `GET
|
|
2281
|
+
* /scopes/{id}/evaluations/runs/{runId}` for status.
|
|
1993
2282
|
*/
|
|
1994
2283
|
async triggerRun() {
|
|
1995
2284
|
validateId(this.scopeId, "scope_id");
|
|
@@ -1999,11 +2288,14 @@ var ScopeEvaluationsResource = class {
|
|
|
1999
2288
|
return data;
|
|
2000
2289
|
}
|
|
2001
2290
|
/**
|
|
2002
|
-
* List evaluation runs
|
|
2291
|
+
* List evaluation runs.
|
|
2003
2292
|
*
|
|
2004
|
-
*
|
|
2005
|
-
*
|
|
2006
|
-
*
|
|
2293
|
+
* Returns a paginated list of evaluation runs for the scope, ordered by most recent first.
|
|
2294
|
+
*
|
|
2295
|
+
* **Requires:** `scopes:read`
|
|
2296
|
+
*
|
|
2297
|
+
* @param options.pageSize - Items per page. Defaults to 25.
|
|
2298
|
+
* @returns A page of runs.
|
|
2007
2299
|
*/
|
|
2008
2300
|
listRuns(options = {}) {
|
|
2009
2301
|
const pageSize = options.pageSize ?? 25;
|
|
@@ -2018,13 +2310,21 @@ var ScopeEvaluationsResource = class {
|
|
|
2018
2310
|
query: aipListParams(pageSize, pageToken)
|
|
2019
2311
|
})
|
|
2020
2312
|
);
|
|
2021
|
-
return buildAipPage(
|
|
2313
|
+
return buildAipPage(
|
|
2314
|
+
data,
|
|
2315
|
+
"runs",
|
|
2316
|
+
(raw) => raw,
|
|
2317
|
+
(token) => this.listRunsPage(pageSize, token)
|
|
2318
|
+
);
|
|
2022
2319
|
}
|
|
2023
2320
|
/**
|
|
2024
|
-
*
|
|
2321
|
+
* Get evaluation run.
|
|
2322
|
+
*
|
|
2323
|
+
* Returns details of an evaluation run including all per-case results.
|
|
2025
2324
|
*
|
|
2026
|
-
*
|
|
2027
|
-
*
|
|
2325
|
+
* **Requires:** `scopes:read`
|
|
2326
|
+
*
|
|
2327
|
+
* @param runId - Run ID.
|
|
2028
2328
|
*/
|
|
2029
2329
|
async getRun(runId) {
|
|
2030
2330
|
validateId(this.scopeId, "scope_id");
|
|
@@ -2036,14 +2336,26 @@ var ScopeEvaluationsResource = class {
|
|
|
2036
2336
|
}
|
|
2037
2337
|
};
|
|
2038
2338
|
|
|
2039
|
-
// src/management/scopes/
|
|
2040
|
-
var
|
|
2339
|
+
// src/management/scopes/evaluations.ts
|
|
2340
|
+
var ScopeEvaluationsResource = class extends ScopesEvaluationsResourceBase {
|
|
2341
|
+
};
|
|
2342
|
+
|
|
2343
|
+
// src/_generated/resources/management/scopes/interfaces.ts
|
|
2344
|
+
var ScopesInterfacesResourceBase = class {
|
|
2345
|
+
/** @internal */
|
|
2041
2346
|
constructor(http, config, scopeId) {
|
|
2042
2347
|
this.http = http;
|
|
2043
2348
|
this.config = config;
|
|
2044
2349
|
this.scopeId = scopeId;
|
|
2045
2350
|
}
|
|
2046
|
-
/**
|
|
2351
|
+
/**
|
|
2352
|
+
* List the chat interfaces of a scope.
|
|
2353
|
+
*
|
|
2354
|
+
* Returns the chat interfaces (at most one per chat platform) that let people use this scope from
|
|
2355
|
+
* chat. Requires manage permission on the scope, because the config lists allowed emails.
|
|
2356
|
+
*
|
|
2357
|
+
* **Requires:** `scopes:read`
|
|
2358
|
+
*/
|
|
2047
2359
|
async list() {
|
|
2048
2360
|
validateId(this.scopeId, "scope_id");
|
|
2049
2361
|
const data = await invokeWithRetry(this.config, this.http, "ScopeInterfacesController_list", {
|
|
@@ -2051,6 +2363,27 @@ var ScopeInterfacesResource = class {
|
|
|
2051
2363
|
});
|
|
2052
2364
|
return data.interfaces;
|
|
2053
2365
|
}
|
|
2366
|
+
/**
|
|
2367
|
+
* Remove a scope interface.
|
|
2368
|
+
*
|
|
2369
|
+
* Removes one chat interface from the scope. Mentions on that chat platform stop reaching this
|
|
2370
|
+
* scope immediately.
|
|
2371
|
+
*
|
|
2372
|
+
* **Requires:** `scopes:write`
|
|
2373
|
+
*
|
|
2374
|
+
* @param interfaceId - Interface id (UUID).
|
|
2375
|
+
*/
|
|
2376
|
+
async delete(interfaceId) {
|
|
2377
|
+
validateId(this.scopeId, "scope_id");
|
|
2378
|
+
validateId(interfaceId, "interface_id");
|
|
2379
|
+
await invokeWithRetry(this.config, this.http, "ScopeInterfacesController_delete", {
|
|
2380
|
+
pathParams: { id: this.scopeId, interfaceId }
|
|
2381
|
+
});
|
|
2382
|
+
}
|
|
2383
|
+
};
|
|
2384
|
+
|
|
2385
|
+
// src/management/scopes/interfaces.ts
|
|
2386
|
+
var ScopeInterfacesResource = class extends ScopesInterfacesResourceBase {
|
|
2054
2387
|
/**
|
|
2055
2388
|
* Add a Slack or Microsoft Teams interface to this scope.
|
|
2056
2389
|
*
|
|
@@ -2081,67 +2414,79 @@ var ScopeInterfacesResource = class {
|
|
|
2081
2414
|
jsonBody: updateMask === void 0 ? omitUndefined(options) : options
|
|
2082
2415
|
});
|
|
2083
2416
|
}
|
|
2084
|
-
/**
|
|
2085
|
-
* Remove an interface from this scope.
|
|
2086
|
-
*
|
|
2087
|
-
* @param interfaceId - Interface id.
|
|
2088
|
-
*/
|
|
2089
|
-
async delete(interfaceId) {
|
|
2090
|
-
validateId(this.scopeId, "scope_id");
|
|
2091
|
-
validateId(interfaceId, "interface_id");
|
|
2092
|
-
await invokeWithRetry(this.config, this.http, "ScopeInterfacesController_delete", {
|
|
2093
|
-
pathParams: { id: this.scopeId, interfaceId }
|
|
2094
|
-
});
|
|
2095
|
-
}
|
|
2096
2417
|
};
|
|
2097
2418
|
|
|
2098
|
-
// src/management/scopes/supervision.ts
|
|
2099
|
-
var
|
|
2419
|
+
// src/_generated/resources/management/scopes/supervision.ts
|
|
2420
|
+
var ScopesSupervisionResourceBase = class {
|
|
2421
|
+
/** @internal */
|
|
2100
2422
|
constructor(http, config, scopeId) {
|
|
2101
2423
|
this.http = http;
|
|
2102
2424
|
this.config = config;
|
|
2103
2425
|
this.scopeId = scopeId;
|
|
2104
2426
|
}
|
|
2105
2427
|
/**
|
|
2106
|
-
*
|
|
2428
|
+
* Read the scope subordinate supervision list.
|
|
2107
2429
|
*
|
|
2108
|
-
*
|
|
2109
|
-
*
|
|
2430
|
+
* Returns the list of subordinate scope ids managed by this scope. `?view=active` (default) reads
|
|
2431
|
+
* the deployed supervision set; `?view=draft` reads the most recent builder snapshot. Returns 404
|
|
2432
|
+
* when the caller cannot at least `use` the scope.
|
|
2433
|
+
*
|
|
2434
|
+
* **Requires:** `scopes:read`
|
|
2435
|
+
*
|
|
2436
|
+
* @param options.view - Which variation snapshot to read. Defaults to `active`.
|
|
2110
2437
|
*/
|
|
2111
2438
|
async get(options = {}) {
|
|
2112
2439
|
validateId(this.scopeId, "scope_id");
|
|
2113
|
-
|
|
2440
|
+
const data = await invokeWithRetry(this.config, this.http, "ScopeSupervisionController_get", {
|
|
2114
2441
|
pathParams: { id: this.scopeId },
|
|
2115
|
-
query:
|
|
2442
|
+
query: { view: options.view }
|
|
2116
2443
|
});
|
|
2444
|
+
return data;
|
|
2117
2445
|
}
|
|
2118
2446
|
/**
|
|
2119
|
-
* Replace
|
|
2447
|
+
* Replace draft subordinate supervision list.
|
|
2448
|
+
*
|
|
2449
|
+
* Writes the supplied subordinate id list into the draft variation. Replaces the previous list
|
|
2450
|
+
* fully — supply an empty array to clear all subordinates. Requires manage permission on the
|
|
2451
|
+
* supervisor; the change is not visible to runners until the scope is deployed.
|
|
2120
2452
|
*
|
|
2121
|
-
*
|
|
2122
|
-
*
|
|
2453
|
+
* **Requires:** `scopes:write`
|
|
2454
|
+
*
|
|
2455
|
+
* @param request - Request body; see `SetSupervisionRequest`.
|
|
2123
2456
|
*/
|
|
2124
2457
|
async set(request) {
|
|
2125
|
-
|
|
2458
|
+
validateId(this.scopeId, "scope_id");
|
|
2459
|
+
const data = await invokeWithRetry(this.config, this.http, "ScopeSupervisionController_set", {
|
|
2460
|
+
pathParams: { id: this.scopeId },
|
|
2461
|
+
jsonBody: request
|
|
2462
|
+
});
|
|
2463
|
+
return data;
|
|
2126
2464
|
}
|
|
2127
2465
|
/**
|
|
2128
|
-
* Replace
|
|
2466
|
+
* Replace active subordinate supervision list.
|
|
2467
|
+
*
|
|
2468
|
+
* Writes directly into the active variation supervision set, bypassing the draft deploy cycle.
|
|
2469
|
+
* Requires `scopes:write` plus manage permission on the supervisor. Use to correct a live
|
|
2470
|
+
* supervision graph without going through the builder.
|
|
2471
|
+
*
|
|
2472
|
+
* **Requires:** `scopes:write`
|
|
2129
2473
|
*
|
|
2130
|
-
* @param request -
|
|
2131
|
-
* @returns The updated supervision configuration.
|
|
2474
|
+
* @param request - Request body; see `SetSupervisionRequest`.
|
|
2132
2475
|
*/
|
|
2133
2476
|
async setActive(request) {
|
|
2134
|
-
return this.write("ScopeSupervisionController_setActive", request);
|
|
2135
|
-
}
|
|
2136
|
-
async write(operation, request) {
|
|
2137
2477
|
validateId(this.scopeId, "scope_id");
|
|
2138
|
-
|
|
2478
|
+
const data = await invokeWithRetry(this.config, this.http, "ScopeSupervisionController_setActive", {
|
|
2139
2479
|
pathParams: { id: this.scopeId },
|
|
2140
2480
|
jsonBody: request
|
|
2141
2481
|
});
|
|
2482
|
+
return data;
|
|
2142
2483
|
}
|
|
2143
2484
|
};
|
|
2144
2485
|
|
|
2486
|
+
// src/management/scopes/supervision.ts
|
|
2487
|
+
var ScopeSupervisionResource = class extends ScopesSupervisionResourceBase {
|
|
2488
|
+
};
|
|
2489
|
+
|
|
2145
2490
|
// src/management/scopes/skills.ts
|
|
2146
2491
|
var MANAGEMENT_SCOPE_OPERATIONS = {
|
|
2147
2492
|
list: "ScopesController_list",
|
|
@@ -2157,21 +2502,12 @@ var MANAGEMENT_SCOPE_OPERATIONS = {
|
|
|
2157
2502
|
patchMcpConfig: "ScopesController_patchMcpConfig",
|
|
2158
2503
|
getVariation: "ScopesController_getVariation"
|
|
2159
2504
|
};
|
|
2160
|
-
function scopesListParams(pageSize, pageToken, search, view, managerId) {
|
|
2161
|
-
const extra = {};
|
|
2162
|
-
if (search !== void 0) extra.search = search;
|
|
2163
|
-
if (view !== void 0) extra.view = view;
|
|
2164
|
-
if (managerId !== void 0) extra.managerId = managerId;
|
|
2165
|
-
return aipListParams(pageSize, pageToken, extra);
|
|
2166
|
-
}
|
|
2167
2505
|
function parseScope(raw) {
|
|
2168
2506
|
return raw;
|
|
2169
2507
|
}
|
|
2170
|
-
var ManagementScopesResource = class {
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
this.http = http;
|
|
2174
|
-
this.config = config;
|
|
2508
|
+
var ManagementScopesResource = class extends ScopesResourceBase {
|
|
2509
|
+
constructor() {
|
|
2510
|
+
super(...arguments);
|
|
2175
2511
|
this.ops = MANAGEMENT_SCOPE_OPERATIONS;
|
|
2176
2512
|
}
|
|
2177
2513
|
/**
|
|
@@ -2219,69 +2555,6 @@ var ManagementScopesResource = class {
|
|
|
2219
2555
|
interfaces(scopeId) {
|
|
2220
2556
|
return new ScopeInterfacesResource(this.http, this.config, scopeId);
|
|
2221
2557
|
}
|
|
2222
|
-
/**
|
|
2223
|
-
* List scopes in the organization.
|
|
2224
|
-
*
|
|
2225
|
-
* @param options.pageSize - Maximum items per page (default 25).
|
|
2226
|
-
* @param options.pageToken - Token from a previous page's `nextPageToken`; omit for the first page.
|
|
2227
|
-
* @param options.search - Case-insensitive substring filter on the scope name.
|
|
2228
|
-
* @param options.view - Variation view: `"active"` (deployed) or `"draft"`.
|
|
2229
|
-
* @param options.managerId - Return only scopes supervised by this manager scope id.
|
|
2230
|
-
* @returns A page of scopes — use `.autoPagingIter()` for all pages.
|
|
2231
|
-
* @example
|
|
2232
|
-
* ```ts
|
|
2233
|
-
* const mgmt = new ModusManagement()
|
|
2234
|
-
* for await (const scope of (await mgmt.scopes.list()).autoPagingIter()) {
|
|
2235
|
-
* console.log(scope.id, scope.name, scope.status)
|
|
2236
|
-
* }
|
|
2237
|
-
* ```
|
|
2238
|
-
*/
|
|
2239
|
-
list(options = {}) {
|
|
2240
|
-
const pageSize = options.pageSize ?? 25;
|
|
2241
|
-
validatePageSize(pageSize);
|
|
2242
|
-
return this.listPage(
|
|
2243
|
-
pageSize,
|
|
2244
|
-
options.pageToken,
|
|
2245
|
-
options.search,
|
|
2246
|
-
options.view,
|
|
2247
|
-
options.managerId
|
|
2248
|
-
);
|
|
2249
|
-
}
|
|
2250
|
-
async listPage(pageSize, pageToken, search, view, managerId) {
|
|
2251
|
-
const data = asRecord(
|
|
2252
|
-
await invokeWithRetry(this.config, this.http, this.ops.list, {
|
|
2253
|
-
query: scopesListParams(pageSize, pageToken, search, view, managerId)
|
|
2254
|
-
})
|
|
2255
|
-
);
|
|
2256
|
-
return buildAipPage(
|
|
2257
|
-
data,
|
|
2258
|
-
"scopes",
|
|
2259
|
-
parseScope,
|
|
2260
|
-
(token) => this.listPage(pageSize, token, search, view, managerId)
|
|
2261
|
-
);
|
|
2262
|
-
}
|
|
2263
|
-
/**
|
|
2264
|
-
* Retrieve a scope with full configuration.
|
|
2265
|
-
*
|
|
2266
|
-
* @param scopeId - Scope id.
|
|
2267
|
-
* @param options.view - Variation view: `"active"` (deployed) or `"draft"`.
|
|
2268
|
-
* @returns The scope.
|
|
2269
|
-
* @example
|
|
2270
|
-
* ```ts
|
|
2271
|
-
* const mgmt = new ModusManagement()
|
|
2272
|
-
* const scope = await mgmt.scopes.get('PLACEHOLDER_SCOPE_ID')
|
|
2273
|
-
* console.log(scope.name, scope.status)
|
|
2274
|
-
* ```
|
|
2275
|
-
*/
|
|
2276
|
-
async get(scopeId, options = {}) {
|
|
2277
|
-
validateId(scopeId, "scope_id");
|
|
2278
|
-
const query = options.view !== void 0 ? { view: options.view } : void 0;
|
|
2279
|
-
const data = await invokeWithRetry(this.config, this.http, this.ops.get, {
|
|
2280
|
-
pathParams: { id: scopeId },
|
|
2281
|
-
query
|
|
2282
|
-
});
|
|
2283
|
-
return parseScope(data);
|
|
2284
|
-
}
|
|
2285
2558
|
/**
|
|
2286
2559
|
* Create a new scope in the organization.
|
|
2287
2560
|
*
|
|
@@ -2393,37 +2666,6 @@ var ManagementScopesResource = class {
|
|
|
2393
2666
|
);
|
|
2394
2667
|
return parseScope(data.scope);
|
|
2395
2668
|
}
|
|
2396
|
-
/**
|
|
2397
|
-
* Delete a scope.
|
|
2398
|
-
*
|
|
2399
|
-
* @param scopeId - Scope id.
|
|
2400
|
-
* @returns Resolves when the scope is deleted.
|
|
2401
|
-
* @example
|
|
2402
|
-
* ```ts
|
|
2403
|
-
* const mgmt = new ModusManagement()
|
|
2404
|
-
* await mgmt.scopes.delete('PLACEHOLDER_SCOPE_ID')
|
|
2405
|
-
* ```
|
|
2406
|
-
*/
|
|
2407
|
-
async delete(scopeId) {
|
|
2408
|
-
validateId(scopeId, "scope_id");
|
|
2409
|
-
await invokeWithRetry(this.config, this.http, this.ops.delete, {
|
|
2410
|
-
pathParams: { id: scopeId }
|
|
2411
|
-
});
|
|
2412
|
-
}
|
|
2413
|
-
/**
|
|
2414
|
-
* Restore a previously deleted scope.
|
|
2415
|
-
*
|
|
2416
|
-
* @param scopeId - Scope id.
|
|
2417
|
-
* @returns The restored scope.
|
|
2418
|
-
*/
|
|
2419
|
-
async restore(scopeId) {
|
|
2420
|
-
validateId(scopeId, "scope_id");
|
|
2421
|
-
const data = await invokeWithRetry(this.config, this.http, this.ops.restore, {
|
|
2422
|
-
pathParams: { id: scopeId },
|
|
2423
|
-
jsonBody: {}
|
|
2424
|
-
});
|
|
2425
|
-
return parseScope(data);
|
|
2426
|
-
}
|
|
2427
2669
|
/**
|
|
2428
2670
|
* Start transferring ownership of a scope to another organization member.
|
|
2429
2671
|
*
|
|
@@ -2444,28 +2686,6 @@ var ManagementScopesResource = class {
|
|
|
2444
2686
|
);
|
|
2445
2687
|
return parseScope(data);
|
|
2446
2688
|
}
|
|
2447
|
-
/** Cancel a pending scope ownership transfer. */
|
|
2448
|
-
async cancelOwnershipTransfer(scopeId) {
|
|
2449
|
-
validateId(scopeId, "scope_id");
|
|
2450
|
-
const data = await invokeWithRetry(
|
|
2451
|
-
this.config,
|
|
2452
|
-
this.http,
|
|
2453
|
-
this.ops.cancelOwnershipTransfer,
|
|
2454
|
-
{ pathParams: { id: scopeId } }
|
|
2455
|
-
);
|
|
2456
|
-
return parseScope(data);
|
|
2457
|
-
}
|
|
2458
|
-
/** Accept a pending scope ownership transfer. */
|
|
2459
|
-
async acceptOwnershipTransfer(scopeId) {
|
|
2460
|
-
validateId(scopeId, "scope_id");
|
|
2461
|
-
const data = await invokeWithRetry(
|
|
2462
|
-
this.config,
|
|
2463
|
-
this.http,
|
|
2464
|
-
this.ops.acceptOwnershipTransfer,
|
|
2465
|
-
{ pathParams: { id: scopeId }, jsonBody: {} }
|
|
2466
|
-
);
|
|
2467
|
-
return parseScope(data);
|
|
2468
|
-
}
|
|
2469
2689
|
/**
|
|
2470
2690
|
* Update MCP server configuration for a scope.
|
|
2471
2691
|
*
|
|
@@ -2496,12 +2716,35 @@ var ManagementScopesResource = class {
|
|
|
2496
2716
|
}
|
|
2497
2717
|
};
|
|
2498
2718
|
|
|
2499
|
-
// src/management/usage.ts
|
|
2500
|
-
var
|
|
2719
|
+
// src/_generated/resources/management/usage.ts
|
|
2720
|
+
var UsageResourceBase = class {
|
|
2721
|
+
/** @internal */
|
|
2501
2722
|
constructor(http, config) {
|
|
2502
2723
|
this.http = http;
|
|
2503
2724
|
this.config = config;
|
|
2504
2725
|
}
|
|
2726
|
+
/**
|
|
2727
|
+
* List usage users.
|
|
2728
|
+
*
|
|
2729
|
+
* Returns the distinct acting-user emails that appear in your organization's LLM usage over the
|
|
2730
|
+
* `[since, until)` window. Feeds the usage page's user filter (includes non-Modus Slack/Teams
|
|
2731
|
+
* users). Scoped to your organization.
|
|
2732
|
+
*
|
|
2733
|
+
* **Requires:** `usage:read`
|
|
2734
|
+
*
|
|
2735
|
+
* @param options.since - ISO8601 start of the query window (inclusive).
|
|
2736
|
+
* @param options.until - ISO8601 end of the query window (exclusive).
|
|
2737
|
+
*/
|
|
2738
|
+
async listUsers(options) {
|
|
2739
|
+
const data = await invokeWithRetry(this.config, this.http, "UsageController_listUsers", {
|
|
2740
|
+
query: { since: options.since, until: options.until }
|
|
2741
|
+
});
|
|
2742
|
+
return data;
|
|
2743
|
+
}
|
|
2744
|
+
};
|
|
2745
|
+
|
|
2746
|
+
// src/management/usage.ts
|
|
2747
|
+
var ManagementUsageResource = class extends UsageResourceBase {
|
|
2505
2748
|
/**
|
|
2506
2749
|
* List usage metrics for your organization over a time window.
|
|
2507
2750
|
*
|
|
@@ -2525,42 +2768,27 @@ var ManagementUsageResource = class {
|
|
|
2525
2768
|
const data = await invokeWithRetry(this.config, this.http, "UsageController_list", { query });
|
|
2526
2769
|
return data;
|
|
2527
2770
|
}
|
|
2528
|
-
/**
|
|
2529
|
-
* List distinct acting-user emails observed in a time window.
|
|
2530
|
-
*
|
|
2531
|
-
* @param options.since - Start of the window (ISO 8601, inclusive).
|
|
2532
|
-
* @param options.until - End of the window (ISO 8601, exclusive).
|
|
2533
|
-
* @returns User emails seen in usage during the window.
|
|
2534
|
-
* @throws {UnprocessableError} When the request is rejected by the API.
|
|
2535
|
-
* @throws {AuthenticationError} When the API key is invalid or missing.
|
|
2536
|
-
*/
|
|
2537
|
-
async listUsers(options) {
|
|
2538
|
-
const query = {
|
|
2539
|
-
since: options.since,
|
|
2540
|
-
until: options.until
|
|
2541
|
-
};
|
|
2542
|
-
const data = await invokeWithRetry(this.config, this.http, "UsageController_listUsers", {
|
|
2543
|
-
query
|
|
2544
|
-
});
|
|
2545
|
-
return data;
|
|
2546
|
-
}
|
|
2547
2771
|
};
|
|
2548
2772
|
|
|
2549
|
-
// src/management/tools.ts
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
}
|
|
2553
|
-
var ManagementToolsResource = class {
|
|
2773
|
+
// src/_generated/resources/management/tools.ts
|
|
2774
|
+
var ToolsResourceBase = class {
|
|
2775
|
+
/** @internal */
|
|
2554
2776
|
constructor(http, config) {
|
|
2555
2777
|
this.http = http;
|
|
2556
2778
|
this.config = config;
|
|
2557
2779
|
}
|
|
2558
2780
|
/**
|
|
2559
|
-
* List
|
|
2781
|
+
* List available tools.
|
|
2560
2782
|
*
|
|
2561
|
-
*
|
|
2562
|
-
*
|
|
2563
|
-
*
|
|
2783
|
+
* Returns a page of known tool/integration surfaces a scope can select in its toolset, with the
|
|
2784
|
+
* fixed actions for built-in tools.
|
|
2785
|
+
*
|
|
2786
|
+
* **Requires:** `scopes:read`
|
|
2787
|
+
*
|
|
2788
|
+
* @param options.pageSize - Items per page. Defaults to 25.
|
|
2789
|
+
* @param options.pageToken - Opaque page token from a previous response's `nextPageToken`. Omit
|
|
2790
|
+
* for the first page.
|
|
2791
|
+
* @returns A page of tools.
|
|
2564
2792
|
*/
|
|
2565
2793
|
list(options = {}) {
|
|
2566
2794
|
const pageSize = options.pageSize ?? 25;
|
|
@@ -2573,10 +2801,19 @@ var ManagementToolsResource = class {
|
|
|
2573
2801
|
query: aipListParams(pageSize, pageToken)
|
|
2574
2802
|
})
|
|
2575
2803
|
);
|
|
2576
|
-
return buildAipPage(
|
|
2804
|
+
return buildAipPage(
|
|
2805
|
+
data,
|
|
2806
|
+
"tools",
|
|
2807
|
+
(raw) => raw,
|
|
2808
|
+
(token) => this.listPage(pageSize, token)
|
|
2809
|
+
);
|
|
2577
2810
|
}
|
|
2578
2811
|
};
|
|
2579
2812
|
|
|
2813
|
+
// src/management/tools.ts
|
|
2814
|
+
var ManagementToolsResource = class extends ToolsResourceBase {
|
|
2815
|
+
};
|
|
2816
|
+
|
|
2580
2817
|
// src/management/users.ts
|
|
2581
2818
|
var ManagementUsersResource = class {
|
|
2582
2819
|
constructor(http, config) {
|