@getmodus/sdk 0.6.0 → 0.8.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 +128 -4
- package/README.md +28 -1
- package/dist/{chunk-HEHHN4D6.js → chunk-GFS7CNON.js} +418 -26
- package/dist/chunk-GFS7CNON.js.map +1 -0
- package/dist/{conversations-BRg8gEKX.d.cts → conversations-COA6NW8I.d.cts} +11987 -3565
- package/dist/{conversations-BRg8gEKX.d.ts → conversations-COA6NW8I.d.ts} +11987 -3565
- package/dist/index.cjs +756 -79
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +409 -58
- package/dist/index.d.ts +409 -58
- package/dist/index.js +340 -55
- package/dist/index.js.map +1 -1
- package/dist/management/index.cjs +1443 -106
- package/dist/management/index.cjs.map +1 -1
- package/dist/management/index.d.cts +729 -12
- package/dist/management/index.d.ts +729 -12
- package/dist/management/index.js +1001 -50
- package/dist/management/index.js.map +1 -1
- package/package.json +3 -4
- package/dist/chunk-HEHHN4D6.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { H as HttpClient, M as ModusConfig, c as components, W as WorkflowType,
|
|
1
|
+
import { H as HttpClient, M as ModusConfig, c as components, W as WorkflowType, q as OperationId, V as VariationView, P as Page, a as Workflow, C as ContextItem, m as ContextItemDeletion, n as ContextItemMove, d as CustomContextItemsResource, D as CreatedContextItem, S as ScopeConversationsResource, h as Scope, i as ModusClientBase, j as ModusOptions } from '../conversations-COA6NW8I.cjs';
|
|
2
2
|
|
|
3
3
|
type AgentInterface = components['schemas']['AgentInterfaceDto'];
|
|
4
4
|
type AddAgentInterface = components['schemas']['AddAgentInterfaceDto'];
|
|
@@ -91,6 +91,13 @@ declare class ManagementWorkflowsResource {
|
|
|
91
91
|
* @param options.view - Variation view: `"active"` (deployed) or `"draft"`.
|
|
92
92
|
* @param options.includeVariation - Include variation payload on each list row.
|
|
93
93
|
* @returns A page of workflows.
|
|
94
|
+
* @example
|
|
95
|
+
* ```ts
|
|
96
|
+
* const mgmt = new ModusManagement()
|
|
97
|
+
* for await (const wf of (await mgmt.workflows.list({ search: 'digest' })).autoPagingIter()) {
|
|
98
|
+
* console.log(wf.id, wf.name, wf.status)
|
|
99
|
+
* }
|
|
100
|
+
* ```
|
|
94
101
|
*/
|
|
95
102
|
list(options?: {
|
|
96
103
|
pageSize?: number;
|
|
@@ -107,6 +114,12 @@ declare class ManagementWorkflowsResource {
|
|
|
107
114
|
* @param workflowId - Workflow id.
|
|
108
115
|
* @param options.view - Variation view: `"active"` (deployed) or `"draft"`.
|
|
109
116
|
* @returns The workflow.
|
|
117
|
+
* @example
|
|
118
|
+
* ```ts
|
|
119
|
+
* const mgmt = new ModusManagement()
|
|
120
|
+
* const wf = await mgmt.workflows.get('weekly-digest')
|
|
121
|
+
* console.log(wf.name, wf.status)
|
|
122
|
+
* ```
|
|
110
123
|
*/
|
|
111
124
|
get(workflowId: number | string, options?: {
|
|
112
125
|
view?: VariationView;
|
|
@@ -128,7 +141,8 @@ declare class ManagementWorkflowsResource {
|
|
|
128
141
|
* @returns The created workflow (draft).
|
|
129
142
|
* @example
|
|
130
143
|
* ```ts
|
|
131
|
-
* const
|
|
144
|
+
* const mgmt = new ModusManagement()
|
|
145
|
+
* const wf = await mgmt.workflows.create({ name: 'Daily report', type: 'task' })
|
|
132
146
|
* ```
|
|
133
147
|
*/
|
|
134
148
|
create(options: CreateWorkflowOptions): Promise<Workflow>;
|
|
@@ -142,6 +156,11 @@ declare class ManagementWorkflowsResource {
|
|
|
142
156
|
* @param options.guardrails - Guardrail labels to set. Fetches the current workflow first to merge. Pass `[]` to clear all.
|
|
143
157
|
* @param options.updateMask - Comma-separated field names to update or clear.
|
|
144
158
|
* @returns The updated workflow.
|
|
159
|
+
* @example
|
|
160
|
+
* ```ts
|
|
161
|
+
* const mgmt = new ModusManagement()
|
|
162
|
+
* const wf = await mgmt.workflows.update('PLACEHOLDER_WORKFLOW_ID', { description: 'Runs every morning' })
|
|
163
|
+
* ```
|
|
145
164
|
*/
|
|
146
165
|
update(workflowId: number | string, options?: UpdateWorkflowOptions): Promise<Workflow>;
|
|
147
166
|
/**
|
|
@@ -151,8 +170,9 @@ declare class ManagementWorkflowsResource {
|
|
|
151
170
|
* @returns The published workflow.
|
|
152
171
|
* @example
|
|
153
172
|
* ```ts
|
|
154
|
-
*
|
|
155
|
-
*
|
|
173
|
+
* const mgmt = new ModusManagement()
|
|
174
|
+
* await mgmt.workflows.update('PLACEHOLDER_WORKFLOW_ID', { description: 'Runs every morning' })
|
|
175
|
+
* const published = await mgmt.workflows.deploy('PLACEHOLDER_WORKFLOW_ID')
|
|
156
176
|
* ```
|
|
157
177
|
*/
|
|
158
178
|
deploy(workflowId: number | string): Promise<Workflow>;
|
|
@@ -171,6 +191,11 @@ declare class ManagementWorkflowsResource {
|
|
|
171
191
|
*
|
|
172
192
|
* @param workflowId - Workflow id.
|
|
173
193
|
* @returns Resolves when the workflow is deleted.
|
|
194
|
+
* @example
|
|
195
|
+
* ```ts
|
|
196
|
+
* const mgmt = new ModusManagement()
|
|
197
|
+
* await mgmt.workflows.delete('PLACEHOLDER_WORKFLOW_ID')
|
|
198
|
+
* ```
|
|
174
199
|
*/
|
|
175
200
|
delete(workflowId: number | string): Promise<void>;
|
|
176
201
|
/**
|
|
@@ -206,12 +231,34 @@ declare class ManagementContextItemsResource {
|
|
|
206
231
|
* @param options.pageSize - Items per page (default 25).
|
|
207
232
|
* @param options.pageToken - Token from a previous page's `nextPageToken`.
|
|
208
233
|
* @param options.contextType - Filter to one context type (for example `"note"`).
|
|
234
|
+
* @param options.parentUids - Exact ordered native ancestry chain for direct
|
|
235
|
+
* children. Omit to leave parent unrestricted; pass `[]` for the known-empty
|
|
236
|
+
* root. Native UIDs are exact tokens; for a folder's children send ancestry
|
|
237
|
+
* UIDs plus the last `dataPath` token, not the hashed context-item `uid`.
|
|
238
|
+
* @param options.ancestorUids - Ordered UID ancestry prefix for strict
|
|
239
|
+
* descendants. Omit to leave unrestricted; pass `[]` for every item with
|
|
240
|
+
* non-null ancestry.
|
|
241
|
+
* @param options.connectionIds - Restrict to these connection ids. Omit to
|
|
242
|
+
* leave unfiltered; pass `[]` to match none. The Files root is
|
|
243
|
+
* `connectionIds: ['files']` with `parentUids: []`.
|
|
209
244
|
* @returns A page of context items.
|
|
245
|
+
*
|
|
246
|
+
* @example
|
|
247
|
+
* ```ts
|
|
248
|
+
* const rootFiles = await mgmt.context.items.list({
|
|
249
|
+
* connectionIds: ['files'],
|
|
250
|
+
* contextType: 'file_upload',
|
|
251
|
+
* parentUids: [],
|
|
252
|
+
* })
|
|
253
|
+
* ```
|
|
210
254
|
*/
|
|
211
255
|
list(options?: {
|
|
212
256
|
pageSize?: number;
|
|
213
257
|
pageToken?: string;
|
|
214
258
|
contextType?: string;
|
|
259
|
+
parentUids?: readonly string[];
|
|
260
|
+
ancestorUids?: readonly string[];
|
|
261
|
+
connectionIds?: readonly string[];
|
|
215
262
|
}): Promise<Page<ContextItem>>;
|
|
216
263
|
private listPage;
|
|
217
264
|
/**
|
|
@@ -245,16 +292,461 @@ declare class ManagementContextItemsResource {
|
|
|
245
292
|
updateMask?: string;
|
|
246
293
|
}): Promise<ContextItem>;
|
|
247
294
|
/**
|
|
248
|
-
* Delete a context item.
|
|
295
|
+
* Delete a context item. Deleting a Files folder also deletes all its contents.
|
|
249
296
|
*
|
|
250
297
|
* @param uid - Context item uid.
|
|
251
298
|
* @returns Deletion confirmation details.
|
|
252
299
|
*/
|
|
253
300
|
delete(uid: string): Promise<ContextItemDeletion>;
|
|
301
|
+
/**
|
|
302
|
+
* Move a live file or Files folder.
|
|
303
|
+
*
|
|
304
|
+
* Pass `destinationFolderUid: null` to move to the Files root. The
|
|
305
|
+
* destination folder must already exist. Same-parent moves succeed as a
|
|
306
|
+
* no-op. Does not rename or merge folders.
|
|
307
|
+
*
|
|
308
|
+
* @param uid - Stored context-item uid of the file or folder to move.
|
|
309
|
+
* @param options.destinationFolderUid - Stored context-item uid of the
|
|
310
|
+
* destination folder, or `null` for the Files root.
|
|
311
|
+
* @returns How many items changed parent (`0` is a successful no-op).
|
|
312
|
+
* @throws {NotFoundError} The source is missing or not visible.
|
|
313
|
+
* @throws {ModusError} The destination is missing, not a Files folder, or
|
|
314
|
+
* the move would create a cycle (HTTP 400).
|
|
315
|
+
* @throws {PermissionDeniedError} The destination exists but is not writable
|
|
316
|
+
* for this caller.
|
|
317
|
+
* @throws {ConflictError} A sibling with the same name already exists.
|
|
318
|
+
*
|
|
319
|
+
* @example
|
|
320
|
+
* ```ts
|
|
321
|
+
* const moved = await mgmt.context.items.move('PLACEHOLDER_UID', {
|
|
322
|
+
* destinationFolderUid: 'PLACEHOLDER_FOLDER_UID',
|
|
323
|
+
* })
|
|
324
|
+
* console.log(moved.movedItems)
|
|
325
|
+
* ```
|
|
326
|
+
*/
|
|
327
|
+
move(uid: string, options: {
|
|
328
|
+
destinationFolderUid: string | null;
|
|
329
|
+
}): Promise<ContextItemMove>;
|
|
254
330
|
}
|
|
255
331
|
|
|
256
332
|
type UserFeedback = 'positive' | 'neutral' | 'negative';
|
|
257
333
|
|
|
334
|
+
/** A whole dashboard, including its draft definition and `draftRevision`. */
|
|
335
|
+
type Dashboard = components['schemas']['DashboardDto'];
|
|
336
|
+
/** Every tile and filter on a dashboard draft, plus the current `draftRevision`. */
|
|
337
|
+
type DashboardElementsList = components['schemas']['DashboardElementsListResponseDto'];
|
|
338
|
+
/** One tile or filter in a list result. */
|
|
339
|
+
type DashboardElementSummary = components['schemas']['DashboardElementSummaryDto'];
|
|
340
|
+
/** One element's full draft settings, plus the current `draftRevision`. */
|
|
341
|
+
type DashboardElementResult = components['schemas']['DashboardElementResponseDto'];
|
|
342
|
+
/** `"chart"`, `"kpi"`, `"table"`, `"markdown"` or `"filter"`. */
|
|
343
|
+
type DashboardElementKind = components['schemas']['DashboardElementKind'];
|
|
344
|
+
/** Grid position of an element: `x` (0-11), `y`, `w` (1-12) and `h`. */
|
|
345
|
+
type DashboardElementLayout = components['schemas']['DashboardElementLayoutDto'];
|
|
346
|
+
/** Settings to change on one element; `null` clears a setting that supports clearing. */
|
|
347
|
+
type DashboardElementPatch = components['schemas']['DashboardElementPatchDto'];
|
|
348
|
+
/** One element and its final grid position for `updateLayout()`. */
|
|
349
|
+
type DashboardLayoutElement = components['schemas']['DashboardLayoutElementDto'];
|
|
350
|
+
/** Input for `elements(id).create()`. */
|
|
351
|
+
type CreateDashboardElementInput = components['schemas']['CreateDashboardElementDto'];
|
|
352
|
+
/** Input for `elements(id).update()`. */
|
|
353
|
+
type UpdateDashboardElementInput = components['schemas']['UpdateDashboardElementDto'];
|
|
354
|
+
/** Input for `updateLayout()`. */
|
|
355
|
+
type UpdateDashboardLayoutInput = components['schemas']['UpdateDashboardLayoutDto'];
|
|
356
|
+
/** One published version or draft snapshot of a dashboard, with its full definition. */
|
|
357
|
+
type DashboardVersion = components['schemas']['DashboardVersionDto'];
|
|
358
|
+
/** One saved snapshot of a dashboard draft: its id, author and time. */
|
|
359
|
+
type DashboardDraftSnapshot = components['schemas']['DashboardDraftSnapshotDto'];
|
|
360
|
+
/** Result of `publish()`: the published dashboard and the new version. */
|
|
361
|
+
type DashboardPublishResult = components['schemas']['PublishDashboardResponseDto'];
|
|
362
|
+
/** `"active"` (the published version) or `"draft"` (the working draft). */
|
|
363
|
+
type DashboardView = components['schemas']['DashboardView'];
|
|
364
|
+
/** Input for `create()`. */
|
|
365
|
+
type CreateDashboardInput = components['schemas']['CreateDashboardDto'];
|
|
366
|
+
/** Input for `updateDraft()`. */
|
|
367
|
+
type UpdateDashboardDraftInput = components['schemas']['UpdateDashboardDraftDto'];
|
|
368
|
+
/** Input for `publish()`. */
|
|
369
|
+
type PublishDashboardInput = components['schemas']['PublishDashboardDto'];
|
|
370
|
+
/** Input for `updateAccess()`; all three settings replace the current ones. */
|
|
371
|
+
type UpdateDashboardAccessInput = components['schemas']['UpdateDashboardAccessDto'];
|
|
372
|
+
/** Input for `requestOwnershipTransfer()`. */
|
|
373
|
+
type TransferDashboardOwnershipInput = components['schemas']['TransferDashboardOwnershipDto'];
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* Tiles and filters on one dashboard draft.
|
|
377
|
+
*
|
|
378
|
+
* Call path: `mgmt.context.dashboards.elements(dashboardId)`.
|
|
379
|
+
*
|
|
380
|
+
* Every change takes the `draftRevision` it is based on as `expectedRevision`;
|
|
381
|
+
* a stale value is rejected with a `ConflictError`.
|
|
382
|
+
*/
|
|
383
|
+
declare class ManagementDashboardElementsResource {
|
|
384
|
+
private readonly http;
|
|
385
|
+
private readonly config;
|
|
386
|
+
private readonly dashboardId;
|
|
387
|
+
/** @internal */
|
|
388
|
+
constructor(http: HttpClient, config: ModusConfig, dashboardId: string);
|
|
389
|
+
/**
|
|
390
|
+
* List every tile and filter on the dashboard draft.
|
|
391
|
+
*
|
|
392
|
+
* @returns Each element's id, kind, title and grid position, plus the current
|
|
393
|
+
* `draftRevision` to pass as `expectedRevision` on the next change.
|
|
394
|
+
* @throws NotFoundError - The dashboard does not exist or you cannot edit it.
|
|
395
|
+
* @example
|
|
396
|
+
* ```ts
|
|
397
|
+
* const listed = await mgmt.context.dashboards.elements('DASHBOARD_ID').list()
|
|
398
|
+
* listed.elements.map((element) => element.id)
|
|
399
|
+
* ```
|
|
400
|
+
*/
|
|
401
|
+
list(): Promise<DashboardElementsList>;
|
|
402
|
+
/**
|
|
403
|
+
* Get the full draft settings of one tile or filter.
|
|
404
|
+
*
|
|
405
|
+
* @param elementId - Id of the tile or filter, as returned by `list()`.
|
|
406
|
+
* @returns The element's settings and the current `draftRevision`.
|
|
407
|
+
* @throws NotFoundError - The dashboard or the element does not exist, or you cannot
|
|
408
|
+
* edit the dashboard.
|
|
409
|
+
* @example
|
|
410
|
+
* ```ts
|
|
411
|
+
* const result = await mgmt.context.dashboards.elements('DASHBOARD_ID').get('ELEMENT_ID')
|
|
412
|
+
* result.element.title
|
|
413
|
+
* ```
|
|
414
|
+
*/
|
|
415
|
+
get(elementId: string): Promise<DashboardElementResult>;
|
|
416
|
+
/**
|
|
417
|
+
* Add a blank tile or filter to the dashboard draft.
|
|
418
|
+
*
|
|
419
|
+
* Modus assigns the new element's id; configure it afterwards with `update()`.
|
|
420
|
+
*
|
|
421
|
+
* @param input.expectedRevision - The `draftRevision` your change is based on.
|
|
422
|
+
* @param input.kind - `chart`, `kpi`, `table`, `markdown` or `filter`.
|
|
423
|
+
* @param input.title - Title shown on the element.
|
|
424
|
+
* @param input.layout - Grid position with `x` (0-11), `y`, `w` (1-12) and `h`.
|
|
425
|
+
* @returns The created element and the new `draftRevision`.
|
|
426
|
+
* @throws ConflictError - The draft changed since `expectedRevision`; list the
|
|
427
|
+
* elements again and retry with the new revision.
|
|
428
|
+
* @example
|
|
429
|
+
* ```ts
|
|
430
|
+
* const created = await mgmt.context.dashboards.elements('DASHBOARD_ID').create({
|
|
431
|
+
* expectedRevision: 3,
|
|
432
|
+
* kind: 'chart',
|
|
433
|
+
* title: 'Sales by region',
|
|
434
|
+
* layout: { x: 0, y: 4, w: 6, h: 4 },
|
|
435
|
+
* })
|
|
436
|
+
* ```
|
|
437
|
+
*/
|
|
438
|
+
create(input: CreateDashboardElementInput): Promise<DashboardElementResult>;
|
|
439
|
+
/**
|
|
440
|
+
* Change settings of one tile or filter on the dashboard draft.
|
|
441
|
+
*
|
|
442
|
+
* @param elementId - Id of the tile or filter to change.
|
|
443
|
+
* @param input.expectedRevision - The `draftRevision` your change is based on.
|
|
444
|
+
* @param input.patch - The settings to change, for example `{ title: 'Sales' }`
|
|
445
|
+
* or `{ defaultValue: null }`. `null` clears a setting that supports clearing.
|
|
446
|
+
* @returns The whole dashboard after the change, including the new `draftRevision`.
|
|
447
|
+
* @throws ConflictError - The draft changed since `expectedRevision`.
|
|
448
|
+
* @throws NotFoundError - The dashboard or the element does not exist, or you cannot
|
|
449
|
+
* edit the dashboard.
|
|
450
|
+
* @example
|
|
451
|
+
* ```ts
|
|
452
|
+
* const dashboard = await mgmt.context.dashboards
|
|
453
|
+
* .elements('DASHBOARD_ID')
|
|
454
|
+
* .update('ELEMENT_ID', { expectedRevision: 3, patch: { title: 'Revenue' } })
|
|
455
|
+
* ```
|
|
456
|
+
*/
|
|
457
|
+
update(elementId: string, input: UpdateDashboardElementInput): Promise<Dashboard>;
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Dashboards in the Modus knowledge base.
|
|
461
|
+
*
|
|
462
|
+
* Call path: `mgmt.context.dashboards` after `new ModusManagement(...)`.
|
|
463
|
+
*
|
|
464
|
+
* - `list()`, `get()`, `create()`, `updateDraft()`, `publish()`, `delete()` — dashboards.
|
|
465
|
+
* - `listVersions()`, `getVersion()`, `restoreVersion()`, `listDraftSnapshots()` — history.
|
|
466
|
+
* - `updateAccess()` — who can open and edit a dashboard.
|
|
467
|
+
* - `requestOwnershipTransfer()`, `acceptOwnershipTransfer()`, `cancelOwnershipTransfer()`.
|
|
468
|
+
* - `elements(dashboardId)` — list, get, create and update tiles and filters.
|
|
469
|
+
* - `updateLayout(dashboardId, input)` — move or resize several elements at once.
|
|
470
|
+
*/
|
|
471
|
+
declare class ManagementDashboardsResource {
|
|
472
|
+
private readonly http;
|
|
473
|
+
private readonly config;
|
|
474
|
+
/** @internal */
|
|
475
|
+
constructor(http: HttpClient, config: ModusConfig);
|
|
476
|
+
/**
|
|
477
|
+
* List dashboards with their full definitions.
|
|
478
|
+
*
|
|
479
|
+
* @param options.view - `active` (default) lists published dashboards you can open;
|
|
480
|
+
* `draft` lists the drafts of dashboards you can edit.
|
|
481
|
+
* @returns Every matching dashboard. The list is not paginated.
|
|
482
|
+
* @example
|
|
483
|
+
* ```ts
|
|
484
|
+
* const drafts = await mgmt.context.dashboards.list({ view: 'draft' })
|
|
485
|
+
* drafts.map((dashboard) => [dashboard.id, dashboard.draftRevision])
|
|
486
|
+
* ```
|
|
487
|
+
*/
|
|
488
|
+
list(options?: {
|
|
489
|
+
view?: DashboardView;
|
|
490
|
+
}): Promise<Dashboard[]>;
|
|
491
|
+
/**
|
|
492
|
+
* Get one dashboard with its full definition.
|
|
493
|
+
*
|
|
494
|
+
* @param dashboardId - Id of the dashboard.
|
|
495
|
+
* @param options.view - `active` (default) returns the published version; `draft`
|
|
496
|
+
* returns the working draft and requires edit access.
|
|
497
|
+
* @returns The dashboard, including `draftRevision` for the next change.
|
|
498
|
+
* @throws NotFoundError - The dashboard does not exist or you cannot open it.
|
|
499
|
+
* @example
|
|
500
|
+
* ```ts
|
|
501
|
+
* const draft = await mgmt.context.dashboards.get('DASHBOARD_ID', { view: 'draft' })
|
|
502
|
+
* draft.draftRevision
|
|
503
|
+
* ```
|
|
504
|
+
*/
|
|
505
|
+
get(dashboardId: string, options?: {
|
|
506
|
+
view?: DashboardView;
|
|
507
|
+
}): Promise<Dashboard>;
|
|
508
|
+
/**
|
|
509
|
+
* Create a dashboard draft.
|
|
510
|
+
*
|
|
511
|
+
* The new dashboard is not visible to others until you `publish()` it.
|
|
512
|
+
*
|
|
513
|
+
* @param input.title - Dashboard title.
|
|
514
|
+
* @param input.definition - Tiles, filters and layout, for example
|
|
515
|
+
* `{ tiles: [], filters: [] }`. Element ids must be unique.
|
|
516
|
+
* @param input.description - Optional dashboard description.
|
|
517
|
+
* @param input.access - Optional `visibility`, `groupPermissions` and `sharedWith`.
|
|
518
|
+
* Defaults to private.
|
|
519
|
+
* @returns The created dashboard in its draft view.
|
|
520
|
+
* @throws ModusError - The definition or access settings are invalid.
|
|
521
|
+
* @example
|
|
522
|
+
* ```ts
|
|
523
|
+
* const dashboard = await mgmt.context.dashboards.create({
|
|
524
|
+
* title: 'Revenue',
|
|
525
|
+
* definition: { tiles: [], filters: [] },
|
|
526
|
+
* })
|
|
527
|
+
* dashboard.id
|
|
528
|
+
* ```
|
|
529
|
+
*/
|
|
530
|
+
create(input: CreateDashboardInput): Promise<Dashboard>;
|
|
531
|
+
/**
|
|
532
|
+
* Replace the whole draft definition, and optionally the title and description.
|
|
533
|
+
*
|
|
534
|
+
* @param dashboardId - Id of the dashboard.
|
|
535
|
+
* @param input.expectedRevision - The `draftRevision` your change is based on.
|
|
536
|
+
* @param input.definition - The complete new definition. Tiles and filters left
|
|
537
|
+
* out are removed.
|
|
538
|
+
* @param input.title - New title; unchanged when omitted.
|
|
539
|
+
* @param input.description - New description; unchanged when omitted.
|
|
540
|
+
* @returns The dashboard draft after the change, including the new `draftRevision`.
|
|
541
|
+
* @throws ConflictError - The draft changed since `expectedRevision`; get the draft
|
|
542
|
+
* again and retry with the new revision.
|
|
543
|
+
* @throws NotFoundError - The dashboard does not exist or you cannot edit it.
|
|
544
|
+
* @example
|
|
545
|
+
* ```ts
|
|
546
|
+
* const draft = await mgmt.context.dashboards.get('DASHBOARD_ID', { view: 'draft' })
|
|
547
|
+
* await mgmt.context.dashboards.updateDraft('DASHBOARD_ID', {
|
|
548
|
+
* expectedRevision: draft.draftRevision,
|
|
549
|
+
* definition: draft.definition,
|
|
550
|
+
* title: 'Revenue',
|
|
551
|
+
* })
|
|
552
|
+
* ```
|
|
553
|
+
*/
|
|
554
|
+
updateDraft(dashboardId: string, input: UpdateDashboardDraftInput): Promise<Dashboard>;
|
|
555
|
+
/**
|
|
556
|
+
* Publish the draft as a new version that everyone with access sees.
|
|
557
|
+
*
|
|
558
|
+
* Alert workflows defined on the dashboard are updated to match.
|
|
559
|
+
*
|
|
560
|
+
* @param dashboardId - Id of the dashboard.
|
|
561
|
+
* @param input.expectedRevision - The `draftRevision` you reviewed and want to publish.
|
|
562
|
+
* @returns The published `dashboard` and the new `version`.
|
|
563
|
+
* @throws ConflictError - The draft changed since `expectedRevision`.
|
|
564
|
+
* @throws NotFoundError - The dashboard does not exist or you cannot edit it.
|
|
565
|
+
* @example
|
|
566
|
+
* ```ts
|
|
567
|
+
* const result = await mgmt.context.dashboards.publish('DASHBOARD_ID', { expectedRevision: 4 })
|
|
568
|
+
* result.version.versionNumber
|
|
569
|
+
* ```
|
|
570
|
+
*/
|
|
571
|
+
publish(dashboardId: string, input: PublishDashboardInput): Promise<DashboardPublishResult>;
|
|
572
|
+
/**
|
|
573
|
+
* Delete a dashboard and the alert workflows defined on it.
|
|
574
|
+
*
|
|
575
|
+
* A deleted dashboard cannot be restored.
|
|
576
|
+
*
|
|
577
|
+
* @param dashboardId - Id of the dashboard.
|
|
578
|
+
* @throws NotFoundError - The dashboard does not exist or you cannot edit it.
|
|
579
|
+
* @example
|
|
580
|
+
* ```ts
|
|
581
|
+
* await mgmt.context.dashboards.delete('DASHBOARD_ID')
|
|
582
|
+
* ```
|
|
583
|
+
*/
|
|
584
|
+
delete(dashboardId: string): Promise<void>;
|
|
585
|
+
/**
|
|
586
|
+
* List the published versions of a dashboard, newest first.
|
|
587
|
+
*
|
|
588
|
+
* @param dashboardId - Id of the dashboard.
|
|
589
|
+
* @returns Every published version with its full definition. Definitions are
|
|
590
|
+
* returned as stored, so older versions may lack newer fields. The list is
|
|
591
|
+
* not paginated.
|
|
592
|
+
* @throws NotFoundError - The dashboard does not exist or you cannot open it.
|
|
593
|
+
* @example
|
|
594
|
+
* ```ts
|
|
595
|
+
* const versions = await mgmt.context.dashboards.listVersions('DASHBOARD_ID')
|
|
596
|
+
* versions.map((version) => [version.uid, version.versionNumber])
|
|
597
|
+
* ```
|
|
598
|
+
*/
|
|
599
|
+
listVersions(dashboardId: string): Promise<DashboardVersion[]>;
|
|
600
|
+
/**
|
|
601
|
+
* Get a dashboard as it was in one version.
|
|
602
|
+
*
|
|
603
|
+
* @param dashboardId - Id of the dashboard.
|
|
604
|
+
* @param versionId - Id of the version, as returned by `listVersions()`.
|
|
605
|
+
* @returns The dashboard with that version's definition.
|
|
606
|
+
* @throws NotFoundError - The dashboard or the version does not exist, or you cannot
|
|
607
|
+
* open the dashboard.
|
|
608
|
+
* @example
|
|
609
|
+
* ```ts
|
|
610
|
+
* const old = await mgmt.context.dashboards.getVersion('DASHBOARD_ID', 'VERSION_ID')
|
|
611
|
+
* old.selectedVersion.versionNumber
|
|
612
|
+
* ```
|
|
613
|
+
*/
|
|
614
|
+
getVersion(dashboardId: string, versionId: string): Promise<Dashboard>;
|
|
615
|
+
/**
|
|
616
|
+
* Replace the draft with the content of an earlier version.
|
|
617
|
+
*
|
|
618
|
+
* The draft being replaced is kept as a draft snapshot. Call `publish()`
|
|
619
|
+
* afterwards to make the restored content visible.
|
|
620
|
+
*
|
|
621
|
+
* @param dashboardId - Id of the dashboard.
|
|
622
|
+
* @param versionId - Id of the version or draft snapshot to restore.
|
|
623
|
+
* @returns The dashboard draft after the restore.
|
|
624
|
+
* @throws NotFoundError - The dashboard or the version does not exist, or you cannot
|
|
625
|
+
* edit the dashboard.
|
|
626
|
+
* @example
|
|
627
|
+
* ```ts
|
|
628
|
+
* await mgmt.context.dashboards.restoreVersion('DASHBOARD_ID', 'VERSION_ID')
|
|
629
|
+
* ```
|
|
630
|
+
*/
|
|
631
|
+
restoreVersion(dashboardId: string, versionId: string): Promise<Dashboard>;
|
|
632
|
+
/**
|
|
633
|
+
* List recent snapshots of the dashboard draft, newest first.
|
|
634
|
+
*
|
|
635
|
+
* @param dashboardId - Id of the dashboard.
|
|
636
|
+
* @returns Up to 100 snapshots with their id, author and time. Pass an id to
|
|
637
|
+
* `restoreVersion()` to bring that draft back.
|
|
638
|
+
* @throws NotFoundError - The dashboard does not exist or you cannot edit it.
|
|
639
|
+
* @example
|
|
640
|
+
* ```ts
|
|
641
|
+
* const snapshots = await mgmt.context.dashboards.listDraftSnapshots('DASHBOARD_ID')
|
|
642
|
+
* snapshots.map((snapshot) => snapshot.uid)
|
|
643
|
+
* ```
|
|
644
|
+
*/
|
|
645
|
+
listDraftSnapshots(dashboardId: string): Promise<DashboardDraftSnapshot[]>;
|
|
646
|
+
/**
|
|
647
|
+
* Replace who can open and edit a dashboard.
|
|
648
|
+
*
|
|
649
|
+
* All three settings are required and replace the current ones.
|
|
650
|
+
*
|
|
651
|
+
* @param dashboardId - Id of the dashboard.
|
|
652
|
+
* @param input.visibility - `shared` (the owner plus the groups in
|
|
653
|
+
* `groupPermissions`) or `private` (the owner plus the users in `sharedWith`).
|
|
654
|
+
* @param input.groupPermissions - Group id to `{ use, manage }`. Used only when shared.
|
|
655
|
+
* @param input.sharedWith - Users such as `{ email: 'ana@example.com', permission: 'use' }`.
|
|
656
|
+
* Used only when private.
|
|
657
|
+
* @returns The dashboard with its new access settings.
|
|
658
|
+
* @throws NotFoundError - The dashboard does not exist or you cannot edit it.
|
|
659
|
+
* @throws ModusError - A group, user or permission is invalid.
|
|
660
|
+
* @example
|
|
661
|
+
* ```ts
|
|
662
|
+
* await mgmt.context.dashboards.updateAccess('DASHBOARD_ID', {
|
|
663
|
+
* visibility: 'private',
|
|
664
|
+
* groupPermissions: {},
|
|
665
|
+
* sharedWith: [{ email: 'ana@example.com', permission: 'use' }],
|
|
666
|
+
* })
|
|
667
|
+
* ```
|
|
668
|
+
*/
|
|
669
|
+
updateAccess(dashboardId: string, input: UpdateDashboardAccessInput): Promise<Dashboard>;
|
|
670
|
+
/**
|
|
671
|
+
* Ask another member of your organization to take ownership of a dashboard.
|
|
672
|
+
*
|
|
673
|
+
* Only the owner can request a transfer. Ownership moves when the recipient
|
|
674
|
+
* calls `acceptOwnershipTransfer()`.
|
|
675
|
+
*
|
|
676
|
+
* @param dashboardId - Id of the dashboard.
|
|
677
|
+
* @param input.newOwnerUserId - User id of the member who should become the owner.
|
|
678
|
+
* @returns The dashboard with `pendingOwnershipTransfer` set.
|
|
679
|
+
* @throws PermissionDeniedError - You are not the owner.
|
|
680
|
+
* @throws NotFoundError - The dashboard does not exist or you cannot open it.
|
|
681
|
+
* @example
|
|
682
|
+
* ```ts
|
|
683
|
+
* await mgmt.context.dashboards.requestOwnershipTransfer('DASHBOARD_ID', {
|
|
684
|
+
* newOwnerUserId: 'USER_ID',
|
|
685
|
+
* })
|
|
686
|
+
* ```
|
|
687
|
+
*/
|
|
688
|
+
requestOwnershipTransfer(dashboardId: string, input: TransferDashboardOwnershipInput): Promise<Dashboard>;
|
|
689
|
+
/**
|
|
690
|
+
* Accept a pending ownership transfer and become the dashboard owner.
|
|
691
|
+
*
|
|
692
|
+
* Only the requested recipient can accept.
|
|
693
|
+
*
|
|
694
|
+
* @param dashboardId - Id of the dashboard.
|
|
695
|
+
* @returns The dashboard with you as its owner.
|
|
696
|
+
* @throws NotFoundError - The dashboard does not exist, or it has no pending transfer
|
|
697
|
+
* addressed to you.
|
|
698
|
+
* @example
|
|
699
|
+
* ```ts
|
|
700
|
+
* await mgmt.context.dashboards.acceptOwnershipTransfer('DASHBOARD_ID')
|
|
701
|
+
* ```
|
|
702
|
+
*/
|
|
703
|
+
acceptOwnershipTransfer(dashboardId: string): Promise<Dashboard>;
|
|
704
|
+
/**
|
|
705
|
+
* Cancel a pending ownership transfer.
|
|
706
|
+
*
|
|
707
|
+
* Only the owner can cancel.
|
|
708
|
+
*
|
|
709
|
+
* @param dashboardId - Id of the dashboard.
|
|
710
|
+
* @returns The dashboard with no pending transfer.
|
|
711
|
+
* @throws NotFoundError - The dashboard does not exist, you cannot open it, or you are
|
|
712
|
+
* not the owner.
|
|
713
|
+
* @example
|
|
714
|
+
* ```ts
|
|
715
|
+
* await mgmt.context.dashboards.cancelOwnershipTransfer('DASHBOARD_ID')
|
|
716
|
+
* ```
|
|
717
|
+
*/
|
|
718
|
+
cancelOwnershipTransfer(dashboardId: string): Promise<Dashboard>;
|
|
719
|
+
/**
|
|
720
|
+
* Work with the tiles and filters of one dashboard draft.
|
|
721
|
+
*
|
|
722
|
+
* @param dashboardId - Id of the dashboard.
|
|
723
|
+
* @returns A resource bound to that dashboard.
|
|
724
|
+
* @example
|
|
725
|
+
* ```ts
|
|
726
|
+
* await mgmt.context.dashboards.elements('DASHBOARD_ID').list()
|
|
727
|
+
* ```
|
|
728
|
+
*/
|
|
729
|
+
elements(dashboardId: string): ManagementDashboardElementsResource;
|
|
730
|
+
/**
|
|
731
|
+
* Move or resize several tiles and filters in one change.
|
|
732
|
+
*
|
|
733
|
+
* @param dashboardId - Id of the dashboard.
|
|
734
|
+
* @param input.expectedRevision - The `draftRevision` your change is based on.
|
|
735
|
+
* @param input.elements - Every element to place, each with `elementId` and its
|
|
736
|
+
* final `layout`.
|
|
737
|
+
* @returns The whole dashboard after the change, including the new `draftRevision`.
|
|
738
|
+
* @throws ConflictError - The draft changed since `expectedRevision`.
|
|
739
|
+
* @example
|
|
740
|
+
* ```ts
|
|
741
|
+
* await mgmt.context.dashboards.updateLayout('DASHBOARD_ID', {
|
|
742
|
+
* expectedRevision: 3,
|
|
743
|
+
* elements: [{ elementId: 'ELEMENT_ID', layout: { x: 0, y: 0, w: 12, h: 2 } }],
|
|
744
|
+
* })
|
|
745
|
+
* ```
|
|
746
|
+
*/
|
|
747
|
+
updateLayout(dashboardId: string, input: UpdateDashboardLayoutInput): Promise<Dashboard>;
|
|
748
|
+
}
|
|
749
|
+
|
|
258
750
|
type FileUpload = components['schemas']['FileUploadResourceDto'];
|
|
259
751
|
type FileUploadStatus = components['schemas']['FileUploadResourceStatus'];
|
|
260
752
|
type UploadUrlSlot = components['schemas']['UploadUrlResponseDto'];
|
|
@@ -274,6 +766,12 @@ interface UploadUrlInput {
|
|
|
274
766
|
interface UploadFromUrlInput {
|
|
275
767
|
url: string;
|
|
276
768
|
fileName?: string;
|
|
769
|
+
folderPath?: string;
|
|
770
|
+
}
|
|
771
|
+
/** A local file and its optional durable folder label for `uploadFiles()`. */
|
|
772
|
+
interface UploadFileInput {
|
|
773
|
+
path: string;
|
|
774
|
+
folderPath?: string;
|
|
277
775
|
}
|
|
278
776
|
/** A single file that failed during `uploadDir()` (slot creation or PUT/poll). */
|
|
279
777
|
interface UploadDirFailure {
|
|
@@ -285,7 +783,38 @@ interface UploadDirResult {
|
|
|
285
783
|
uploaded: FileUpload[];
|
|
286
784
|
failed: UploadDirFailure[];
|
|
287
785
|
}
|
|
786
|
+
/** Progress event after each file succeeds or fails in a batch upload. */
|
|
787
|
+
interface UploadProgress {
|
|
788
|
+
completed: number;
|
|
789
|
+
total: number;
|
|
790
|
+
succeeded: number;
|
|
791
|
+
failed: number;
|
|
792
|
+
}
|
|
793
|
+
type UploadProgressCallback = (progress: UploadProgress) => void;
|
|
794
|
+
/** One entry of a bulk finalize request. */
|
|
795
|
+
interface FinalizeInput {
|
|
796
|
+
uploadId: string;
|
|
797
|
+
fileName: string;
|
|
798
|
+
folderPath?: string;
|
|
799
|
+
}
|
|
800
|
+
/** One entry that could not be finalized. */
|
|
801
|
+
interface FinalizeFailure {
|
|
802
|
+
index: number;
|
|
803
|
+
uploadId: string;
|
|
804
|
+
error: string;
|
|
805
|
+
}
|
|
806
|
+
/** Result of `finalizeMany` — partial success, never a partial 4xx. */
|
|
807
|
+
interface BulkFinalizeResult {
|
|
808
|
+
finalized: FileUpload[];
|
|
809
|
+
failed: FinalizeFailure[];
|
|
810
|
+
}
|
|
288
811
|
|
|
812
|
+
type BatchUploadOptions = {
|
|
813
|
+
concurrency?: number;
|
|
814
|
+
waitUntil?: WaitUntil;
|
|
815
|
+
onProgress?: UploadProgressCallback;
|
|
816
|
+
folderPath?: string;
|
|
817
|
+
};
|
|
289
818
|
/**
|
|
290
819
|
* Durable file uploads for `ModusManagement`.
|
|
291
820
|
*
|
|
@@ -293,6 +822,7 @@ interface UploadDirResult {
|
|
|
293
822
|
*
|
|
294
823
|
* - `upload(path)` / `uploadDir(dirPath)` — presign + PUT + poll convenience helpers.
|
|
295
824
|
* - `createUploadUrl(s)`, `uploadFromUrl(s)`, `get`, `list` — raw operations.
|
|
825
|
+
* Hierarchy browsing is available through `mgmt.context.items.list`.
|
|
296
826
|
*/
|
|
297
827
|
declare class ManagementContextFilesResource {
|
|
298
828
|
private readonly http;
|
|
@@ -307,7 +837,10 @@ declare class ManagementContextFilesResource {
|
|
|
307
837
|
* Office/OpenDocument documents, audio, and video.
|
|
308
838
|
* @param input.fileSize - File size in bytes. Rejected above 50MB.
|
|
309
839
|
* @returns Presigned upload slot. PUT the raw bytes to `uploadUrl` within 15
|
|
310
|
-
* minutes,
|
|
840
|
+
* minutes, sending `headers` unchanged, then call `finalize(slot.uploadId, slot.fileName)`. Pass the
|
|
841
|
+
* slot's own `fileName` rather than your local basename — the server may
|
|
842
|
+
* sanitize the requested name when it mints the key, and finalization
|
|
843
|
+
* re-derives the key from `uploadId` and `fileName`.
|
|
311
844
|
*/
|
|
312
845
|
createUploadUrl(input: UploadUrlInput): Promise<UploadUrlSlot>;
|
|
313
846
|
/**
|
|
@@ -324,10 +857,12 @@ declare class ManagementContextFilesResource {
|
|
|
324
857
|
* @param url - Source URL to fetch (SSRF-guarded, 50MB cap, same MIME
|
|
325
858
|
* allow-list as `createUploadUrl`).
|
|
326
859
|
* @param options.fileName - Override file name. Inferred from the URL path when omitted.
|
|
860
|
+
* @param options.folderPath - Root-relative folder to upload under.
|
|
327
861
|
* @returns File upload resource with status `processing` — parsing continues async.
|
|
328
862
|
*/
|
|
329
863
|
uploadFromUrl(url: string, options?: {
|
|
330
864
|
fileName?: string;
|
|
865
|
+
folderPath?: string;
|
|
331
866
|
}): Promise<FileUpload>;
|
|
332
867
|
/**
|
|
333
868
|
* Fetch up to 100 files from URLs in one call.
|
|
@@ -357,24 +892,79 @@ declare class ManagementContextFilesResource {
|
|
|
357
892
|
pageToken?: string;
|
|
358
893
|
}): Promise<Page<FileUpload>>;
|
|
359
894
|
private listPage;
|
|
895
|
+
/**
|
|
896
|
+
* Turn a file already PUT to a presigned URL into durable context.
|
|
897
|
+
*
|
|
898
|
+
* Call this once the PUT completes. The server locates the object from
|
|
899
|
+
* `uploadId` + `fileName` and validates the bytes that actually arrived.
|
|
900
|
+
* Safe to retry — a second call returns the same resource.
|
|
901
|
+
*
|
|
902
|
+
* @param uploadId - Upload id returned by `createUploadUrl`.
|
|
903
|
+
* @param fileName - File name returned alongside it.
|
|
904
|
+
* @returns The file upload resource, status `"processing"`.
|
|
905
|
+
*/
|
|
906
|
+
finalize(uploadId: string, fileName: string, options?: {
|
|
907
|
+
folderPath?: string;
|
|
908
|
+
}): Promise<FileUpload>;
|
|
909
|
+
/**
|
|
910
|
+
* Finalize up to 100 uploads in one call.
|
|
911
|
+
*
|
|
912
|
+
* What makes directory upload cheap: 2000 files cost 20 requests here rather
|
|
913
|
+
* than 2000.
|
|
914
|
+
*
|
|
915
|
+
* @param uploads - Uploads to finalize (max 100).
|
|
916
|
+
* @returns Resources for every upload that finalized, plus per-index
|
|
917
|
+
* failures for the rest — never a partial 4xx.
|
|
918
|
+
*/
|
|
919
|
+
finalizeMany(uploads: readonly FinalizeInput[]): Promise<BulkFinalizeResult>;
|
|
920
|
+
/**
|
|
921
|
+
* Upload an explicit list of local files.
|
|
922
|
+
*
|
|
923
|
+
* Same machinery as `uploadDir`, without the directory walk — use it when
|
|
924
|
+
* the caller already knows which files to send.
|
|
925
|
+
*
|
|
926
|
+
* @param paths - Paths to local files.
|
|
927
|
+
* @param options.concurrency - Max concurrent PUTs (default 10).
|
|
928
|
+
* @param options.waitUntil - `"processing"` (default) or `"ready"`.
|
|
929
|
+
* @param options.onProgress - Optional progress callback after each file.
|
|
930
|
+
* @param options.folderPath - Root-relative folder to upload under. Nested
|
|
931
|
+
* files keep their existing relative folder labels under this prefix.
|
|
932
|
+
* @example
|
|
933
|
+
* ```ts
|
|
934
|
+
* const mgmt = new ModusManagement()
|
|
935
|
+
* const result = await mgmt.context.files.uploadFiles(
|
|
936
|
+
* ['./q3.pdf', './notes.md'],
|
|
937
|
+
* { folderPath: 'reports/2026' },
|
|
938
|
+
* )
|
|
939
|
+
* ```
|
|
940
|
+
*/
|
|
941
|
+
uploadFiles(paths: readonly (string | UploadFileInput)[], options?: BatchUploadOptions): Promise<UploadDirResult>;
|
|
360
942
|
/**
|
|
361
943
|
* Upload a local file and wait for it to reach `"processing"` or `"ready"`.
|
|
362
944
|
*
|
|
363
|
-
* Gets a presigned URL, PUTs the file bytes, then polls `get()`
|
|
364
|
-
* upload leaves `"pending"` (or reaches `"ready"`/`"failed"`).
|
|
945
|
+
* Gets a presigned URL, PUTs the file bytes, then polls `get()`
|
|
946
|
+
* until the upload leaves `"pending"` (or reaches `"ready"`/`"failed"`).
|
|
365
947
|
*
|
|
366
948
|
* @param path - Path to a local file.
|
|
367
949
|
* @param options.waitUntil - `"processing"` (parsing started, default) or
|
|
368
950
|
* `"ready"` (parsing finished).
|
|
369
951
|
* @param options.pollIntervalMs - Milliseconds between status polls.
|
|
370
952
|
* @param options.timeoutMs - Max milliseconds to wait before raising.
|
|
953
|
+
* @param options.folderPath - Root-relative folder to upload under. Example:
|
|
954
|
+
* `{ folderPath: 'reports/2026' }` places `./report.pdf` at `reports/2026`.
|
|
371
955
|
* @returns The file upload resource once it reaches `waitUntil` (or `"failed"`).
|
|
372
956
|
* @throws {ModusError} If the PUT fails, or polling times out.
|
|
957
|
+
* @example
|
|
958
|
+
* ```ts
|
|
959
|
+
* const mgmt = new ModusManagement()
|
|
960
|
+
* const file = await mgmt.context.files.upload('./report.pdf', { folderPath: 'reports/2026' })
|
|
961
|
+
* ```
|
|
373
962
|
*/
|
|
374
963
|
upload(path: string, options?: {
|
|
375
964
|
waitUntil?: WaitUntil;
|
|
376
965
|
pollIntervalMs?: number;
|
|
377
966
|
timeoutMs?: number;
|
|
967
|
+
folderPath?: string;
|
|
378
968
|
}): Promise<FileUpload>;
|
|
379
969
|
private pollUntil;
|
|
380
970
|
/**
|
|
@@ -389,14 +979,29 @@ declare class ManagementContextFilesResource {
|
|
|
389
979
|
* @param options.recursive - Recurse into subdirectories (default `true`).
|
|
390
980
|
* @param options.concurrency - Max concurrent PUT+poll operations (default 10).
|
|
391
981
|
* @param options.waitUntil - `"processing"` (default) or `"ready"` — same as `upload()`.
|
|
982
|
+
* @param options.onProgress - Optional progress callback after each file.
|
|
983
|
+
* @param options.folderPath - Root-relative folder to upload under. Nested
|
|
984
|
+
* files keep their path relative to `path` under this prefix. Example:
|
|
985
|
+
* `uploadDir('./docs', { folderPath: 'reports' })` places `./docs/a.txt` at
|
|
986
|
+
* `reports` and `./docs/nested/b.txt` at `reports/nested`.
|
|
392
987
|
* @returns `UploadDirResult` with every successful `FileUpload` and every
|
|
393
988
|
* per-file failure (slot creation or PUT/poll), each tagged with its local path.
|
|
989
|
+
* @example
|
|
990
|
+
* ```ts
|
|
991
|
+
* const mgmt = new ModusManagement()
|
|
992
|
+
* const result = await mgmt.context.files.uploadDir('./docs', { folderPath: 'reports' })
|
|
993
|
+
* ```
|
|
394
994
|
*/
|
|
395
995
|
uploadDir(path: string, options?: {
|
|
396
996
|
recursive?: boolean;
|
|
397
997
|
concurrency?: number;
|
|
398
998
|
waitUntil?: WaitUntil;
|
|
999
|
+
onProgress?: UploadProgressCallback;
|
|
1000
|
+
folderPath?: string;
|
|
399
1001
|
}): Promise<UploadDirResult>;
|
|
1002
|
+
/** Shared body of `uploadFiles` and `uploadDir`: presign in batches of 100,
|
|
1003
|
+
* PUT with bounded concurrency, then bulk-finalize the batch. */
|
|
1004
|
+
private uploadPaths;
|
|
400
1005
|
private createSlots;
|
|
401
1006
|
private uploadBatch;
|
|
402
1007
|
}
|
|
@@ -412,6 +1017,7 @@ declare class ManagementContextResource {
|
|
|
412
1017
|
readonly items: ManagementContextItemsResource;
|
|
413
1018
|
readonly customItems: CustomContextItemsResource;
|
|
414
1019
|
readonly files: ManagementContextFilesResource;
|
|
1020
|
+
readonly dashboards: ManagementDashboardsResource;
|
|
415
1021
|
/** @internal */
|
|
416
1022
|
constructor(http: HttpClient, config: ModusConfig);
|
|
417
1023
|
/**
|
|
@@ -422,6 +1028,7 @@ declare class ManagementContextResource {
|
|
|
422
1028
|
* @returns The created context item.
|
|
423
1029
|
* @example
|
|
424
1030
|
* ```ts
|
|
1031
|
+
* const mgmt = new ModusManagement()
|
|
425
1032
|
* const note = await mgmt.context.createNote('Runbook', '# Steps\n1. Check logs')
|
|
426
1033
|
* ```
|
|
427
1034
|
*/
|
|
@@ -437,6 +1044,14 @@ declare class ManagementContextResource {
|
|
|
437
1044
|
* @param options.body - New markdown body.
|
|
438
1045
|
* @param options.existing - Optional cached item to avoid a GET.
|
|
439
1046
|
* @returns The updated context item.
|
|
1047
|
+
* @example
|
|
1048
|
+
* ```ts
|
|
1049
|
+
* const mgmt = new ModusManagement()
|
|
1050
|
+
* const item = await mgmt.context.updateNote('PLACEHOLDER_UID', {
|
|
1051
|
+
* title: 'Runbook',
|
|
1052
|
+
* body: '# Steps\n1. Check logs\n2. Escalate',
|
|
1053
|
+
* })
|
|
1054
|
+
* ```
|
|
440
1055
|
*/
|
|
441
1056
|
updateNote(uid: string, options: {
|
|
442
1057
|
title: string;
|
|
@@ -454,6 +1069,14 @@ declare class ManagementContextResource {
|
|
|
454
1069
|
* @param options.query - SQL text.
|
|
455
1070
|
* @param options.path - Optional hierarchy path segments.
|
|
456
1071
|
* @returns The created context item.
|
|
1072
|
+
* @example
|
|
1073
|
+
* ```ts
|
|
1074
|
+
* const mgmt = new ModusManagement()
|
|
1075
|
+
* const query = await mgmt.context.createSavedQuery('Monthly ARR', {
|
|
1076
|
+
* connectionId: 'conn_warehouse',
|
|
1077
|
+
* query: 'select * from arr_monthly',
|
|
1078
|
+
* })
|
|
1079
|
+
* ```
|
|
457
1080
|
*/
|
|
458
1081
|
createSavedQuery(name: string, options: {
|
|
459
1082
|
query?: string;
|
|
@@ -469,6 +1092,14 @@ declare class ManagementContextResource {
|
|
|
469
1092
|
* @param options.query - New SQL text.
|
|
470
1093
|
* @param options.existing - Optional cached item to avoid a GET.
|
|
471
1094
|
* @returns The updated context item.
|
|
1095
|
+
* @example
|
|
1096
|
+
* ```ts
|
|
1097
|
+
* const mgmt = new ModusManagement()
|
|
1098
|
+
* const item = await mgmt.context.updateSavedQuery('PLACEHOLDER_UID', {
|
|
1099
|
+
* name: 'Monthly ARR',
|
|
1100
|
+
* query: 'select sum(amount) from arr_monthly',
|
|
1101
|
+
* })
|
|
1102
|
+
* ```
|
|
472
1103
|
*/
|
|
473
1104
|
updateSavedQuery(uid: string, options: {
|
|
474
1105
|
name: string;
|
|
@@ -488,6 +1119,13 @@ declare class ManagementContextResource {
|
|
|
488
1119
|
* @param options.isCrawl - When true, crawl linked pages into context.
|
|
489
1120
|
* @param options.pageLimit - Maximum pages to crawl when `isCrawl` is true.
|
|
490
1121
|
* @returns The created context item.
|
|
1122
|
+
* @example
|
|
1123
|
+
* ```ts
|
|
1124
|
+
* const mgmt = new ModusManagement()
|
|
1125
|
+
* const link = await mgmt.context.createLink('https://docs.example.com/runbook', {
|
|
1126
|
+
* title: 'Ops runbook',
|
|
1127
|
+
* })
|
|
1128
|
+
* ```
|
|
491
1129
|
*/
|
|
492
1130
|
createLink(url: string, options?: {
|
|
493
1131
|
title?: string;
|
|
@@ -504,6 +1142,13 @@ declare class ManagementContextResource {
|
|
|
504
1142
|
* @param options.url - New URL.
|
|
505
1143
|
* @param options.existing - Optional cached item to avoid a GET.
|
|
506
1144
|
* @returns The updated context item.
|
|
1145
|
+
* @example
|
|
1146
|
+
* ```ts
|
|
1147
|
+
* const mgmt = new ModusManagement()
|
|
1148
|
+
* const item = await mgmt.context.updateLink('PLACEHOLDER_UID', {
|
|
1149
|
+
* title: 'Ops runbook (2025)',
|
|
1150
|
+
* })
|
|
1151
|
+
* ```
|
|
507
1152
|
*/
|
|
508
1153
|
updateLink(uid: string, options: {
|
|
509
1154
|
title?: string;
|
|
@@ -626,6 +1271,40 @@ declare class ScopeEvaluationsResource {
|
|
|
626
1271
|
getRun(runId: string): Promise<EvaluationRunWithResults>;
|
|
627
1272
|
}
|
|
628
1273
|
|
|
1274
|
+
type ScopeInterface = components['schemas']['ScopeInterfaceDto'];
|
|
1275
|
+
type AddScopeInterface = components['schemas']['AddScopeInterfaceDto'];
|
|
1276
|
+
type UpdateScopeInterface = components['schemas']['UpdateScopeInterfaceDto'];
|
|
1277
|
+
declare class ScopeInterfacesResource {
|
|
1278
|
+
private readonly http;
|
|
1279
|
+
private readonly config;
|
|
1280
|
+
private readonly scopeId;
|
|
1281
|
+
constructor(http: HttpClient, config: ModusConfig, scopeId: number | string);
|
|
1282
|
+
/** List the Slack and Microsoft Teams interfaces on this scope. */
|
|
1283
|
+
list(): Promise<ScopeInterface[]>;
|
|
1284
|
+
/**
|
|
1285
|
+
* Add a Slack or Microsoft Teams interface to this scope.
|
|
1286
|
+
*
|
|
1287
|
+
* @param options - Interface type, optional name and config.
|
|
1288
|
+
* @returns The created interface.
|
|
1289
|
+
*/
|
|
1290
|
+
create(options: AddScopeInterface): Promise<ScopeInterface>;
|
|
1291
|
+
/**
|
|
1292
|
+
* Update an interface on this scope.
|
|
1293
|
+
*
|
|
1294
|
+
* @param interfaceId - Interface id.
|
|
1295
|
+
* @param options - Updated name and/or config.
|
|
1296
|
+
* @param updateMask - Optional comma-separated field names to update.
|
|
1297
|
+
* @returns The updated interface.
|
|
1298
|
+
*/
|
|
1299
|
+
update(interfaceId: string, options: UpdateScopeInterface, updateMask?: string): Promise<ScopeInterface>;
|
|
1300
|
+
/**
|
|
1301
|
+
* Remove an interface from this scope.
|
|
1302
|
+
*
|
|
1303
|
+
* @param interfaceId - Interface id.
|
|
1304
|
+
*/
|
|
1305
|
+
delete(interfaceId: string): Promise<void>;
|
|
1306
|
+
}
|
|
1307
|
+
|
|
629
1308
|
type Supervision = components['schemas']['SupervisionDto'];
|
|
630
1309
|
type SetSupervisionRequest = components['schemas']['SetSupervisionRequestDto'];
|
|
631
1310
|
declare class ScopeSupervisionResource {
|
|
@@ -683,6 +1362,7 @@ interface CreateScopeOptions {
|
|
|
683
1362
|
model?: string;
|
|
684
1363
|
connectionSet?: JsonObjectListInput;
|
|
685
1364
|
contextSelections?: JsonObjectListInput;
|
|
1365
|
+
includeOwnLearnings?: boolean;
|
|
686
1366
|
interfaces?: JsonObjectListInput;
|
|
687
1367
|
guardrails?: string[];
|
|
688
1368
|
}
|
|
@@ -745,6 +1425,13 @@ declare class ManagementScopesResource {
|
|
|
745
1425
|
* @returns A supervision resource scoped to the scope.
|
|
746
1426
|
*/
|
|
747
1427
|
supervision(scopeId: number | string): ScopeSupervisionResource;
|
|
1428
|
+
/**
|
|
1429
|
+
* Slack and Microsoft Teams interfaces for a scope.
|
|
1430
|
+
*
|
|
1431
|
+
* @param scopeId - Scope id.
|
|
1432
|
+
* @returns An interfaces resource scoped to the scope.
|
|
1433
|
+
*/
|
|
1434
|
+
interfaces(scopeId: number | string): ScopeInterfacesResource;
|
|
748
1435
|
/**
|
|
749
1436
|
* List scopes in the organization.
|
|
750
1437
|
*
|
|
@@ -753,7 +1440,14 @@ declare class ManagementScopesResource {
|
|
|
753
1440
|
* @param options.search - Case-insensitive substring filter on the scope name.
|
|
754
1441
|
* @param options.view - Variation view: `"active"` (deployed) or `"draft"`.
|
|
755
1442
|
* @param options.managerId - Return only scopes supervised by this manager scope id.
|
|
756
|
-
* @returns A page of scopes.
|
|
1443
|
+
* @returns A page of scopes — use `.autoPagingIter()` for all pages.
|
|
1444
|
+
* @example
|
|
1445
|
+
* ```ts
|
|
1446
|
+
* const mgmt = new ModusManagement()
|
|
1447
|
+
* for await (const scope of (await mgmt.scopes.list()).autoPagingIter()) {
|
|
1448
|
+
* console.log(scope.id, scope.name, scope.status)
|
|
1449
|
+
* }
|
|
1450
|
+
* ```
|
|
757
1451
|
*/
|
|
758
1452
|
list(options?: {
|
|
759
1453
|
pageSize?: number;
|
|
@@ -769,6 +1463,12 @@ declare class ManagementScopesResource {
|
|
|
769
1463
|
* @param scopeId - Scope id.
|
|
770
1464
|
* @param options.view - Variation view: `"active"` (deployed) or `"draft"`.
|
|
771
1465
|
* @returns The scope.
|
|
1466
|
+
* @example
|
|
1467
|
+
* ```ts
|
|
1468
|
+
* const mgmt = new ModusManagement()
|
|
1469
|
+
* const scope = await mgmt.scopes.get('PLACEHOLDER_SCOPE_ID')
|
|
1470
|
+
* console.log(scope.name, scope.status)
|
|
1471
|
+
* ```
|
|
772
1472
|
*/
|
|
773
1473
|
get(scopeId: number | string, options?: {
|
|
774
1474
|
view?: VariationView;
|
|
@@ -781,11 +1481,14 @@ declare class ManagementScopesResource {
|
|
|
781
1481
|
* @param options.instructions - Optional system instructions.
|
|
782
1482
|
* @param options.model - Optional model id.
|
|
783
1483
|
* @param options.toolset - Optional tool selection for the scope.
|
|
1484
|
+
* @param options.includeOwnLearnings - Whether the scope reads what is taught while using it. Defaults to true.
|
|
784
1485
|
* @param options.guardrails - Runtime guardrail labels (for example `"no-pii"`). Omit to create with no guardrails.
|
|
785
1486
|
* @returns The created scope (draft).
|
|
786
1487
|
* @example
|
|
787
1488
|
* ```ts
|
|
1489
|
+
* const mgmt = new ModusManagement()
|
|
788
1490
|
* const scope = await mgmt.scopes.create({ name: 'Support assistant', model: 'claude-sonnet-5' })
|
|
1491
|
+
* console.log(scope.id, scope.name)
|
|
789
1492
|
* ```
|
|
790
1493
|
*/
|
|
791
1494
|
create(options: CreateScopeOptions): Promise<Scope>;
|
|
@@ -799,6 +1502,13 @@ declare class ManagementScopesResource {
|
|
|
799
1502
|
* @param options.guardrails - Guardrail labels to set. Fetches the current scope first to merge. Pass `[]` to clear all.
|
|
800
1503
|
* @param options.updateMask - Comma-separated field names to update or clear.
|
|
801
1504
|
* @returns The updated scope.
|
|
1505
|
+
* @example
|
|
1506
|
+
* ```ts
|
|
1507
|
+
* const mgmt = new ModusManagement()
|
|
1508
|
+
* const scope = await mgmt.scopes.update('PLACEHOLDER_SCOPE_ID', {
|
|
1509
|
+
* description: 'Answers billing questions for enterprise customers.',
|
|
1510
|
+
* })
|
|
1511
|
+
* ```
|
|
802
1512
|
*/
|
|
803
1513
|
update(scopeId: number | string, options?: UpdateScopeOptions): Promise<Scope>;
|
|
804
1514
|
/**
|
|
@@ -808,8 +1518,10 @@ declare class ManagementScopesResource {
|
|
|
808
1518
|
* @returns The published scope.
|
|
809
1519
|
* @example
|
|
810
1520
|
* ```ts
|
|
811
|
-
*
|
|
812
|
-
* const
|
|
1521
|
+
* const mgmt = new ModusManagement()
|
|
1522
|
+
* const scope = await mgmt.scopes.create({ name: 'Support assistant' })
|
|
1523
|
+
* const published = await mgmt.scopes.deploy(scope.id)
|
|
1524
|
+
* console.log(published.status)
|
|
813
1525
|
* ```
|
|
814
1526
|
*/
|
|
815
1527
|
deploy(scopeId: number | string): Promise<Scope>;
|
|
@@ -818,6 +1530,11 @@ declare class ManagementScopesResource {
|
|
|
818
1530
|
*
|
|
819
1531
|
* @param scopeId - Scope id.
|
|
820
1532
|
* @returns Resolves when the scope is deleted.
|
|
1533
|
+
* @example
|
|
1534
|
+
* ```ts
|
|
1535
|
+
* const mgmt = new ModusManagement()
|
|
1536
|
+
* await mgmt.scopes.delete('PLACEHOLDER_SCOPE_ID')
|
|
1537
|
+
* ```
|
|
821
1538
|
*/
|
|
822
1539
|
delete(scopeId: number | string): Promise<void>;
|
|
823
1540
|
/**
|
|
@@ -953,4 +1670,4 @@ declare class ModusManagement extends ModusClientBase {
|
|
|
953
1670
|
constructor(options?: ModusOptions);
|
|
954
1671
|
}
|
|
955
1672
|
|
|
956
|
-
export { type AgentSelectionInput, type BulkUploadFromUrlsResult, type BulkUploadUrlsResult, type CreateAgentOptions, type CreateScopeOptions, type CreateSkillOptions, type CreateWorkflowOptions, type FailedUploadFromUrl, type FailedUploadUrl, type FileUpload, type FileUploadStatus, type Memory, type MemorySearchRequest, type MemorySearchResult, type MemoryUpdate, ModusManagement, ModusOptions, type ToolsetInput, type TriggerInput, type UpdateAgentOptions, type UpdateScopeOptions, type UpdateSkillOptions, type UpdateWorkflowOptions, type UploadDirFailure, type UploadDirResult, type UploadFromUrlInput, type UploadUrlInput, type UploadUrlSlot, type UserFeedback, type WaitUntil, type WorkflowGraphInput };
|
|
1673
|
+
export { type AgentSelectionInput, type BulkUploadFromUrlsResult, type BulkUploadUrlsResult, ContextItemDeletion, ContextItemMove, type CreateAgentOptions, type CreateDashboardElementInput, type CreateDashboardInput, type CreateScopeOptions, type CreateSkillOptions, type CreateWorkflowOptions, type Dashboard, type DashboardDraftSnapshot, type DashboardElementKind, type DashboardElementLayout, type DashboardElementPatch, type DashboardElementResult, type DashboardElementSummary, type DashboardElementsList, type DashboardLayoutElement, type DashboardPublishResult, type DashboardVersion, type DashboardView, type FailedUploadFromUrl, type FailedUploadUrl, type FileUpload, type FileUploadStatus, type FinalizeInput, type Memory, type MemorySearchRequest, type MemorySearchResult, type MemoryUpdate, ModusManagement, ModusOptions, type PublishDashboardInput, type ToolsetInput, type TransferDashboardOwnershipInput, type TriggerInput, type UpdateAgentOptions, type UpdateDashboardAccessInput, type UpdateDashboardDraftInput, type UpdateDashboardElementInput, type UpdateDashboardLayoutInput, type UpdateScopeOptions, type UpdateSkillOptions, type UpdateWorkflowOptions, type UploadDirFailure, type UploadDirResult, type UploadFileInput, type UploadFromUrlInput, type UploadProgress, type UploadProgressCallback, type UploadUrlInput, type UploadUrlSlot, type UserFeedback, type WaitUntil, type WorkflowGraphInput };
|