@getmodus/sdk 0.5.0 → 0.7.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 +85 -5
- package/README.md +9 -1
- package/dist/{chunk-H76PTY5G.js → chunk-JMFT5KO5.js} +395 -10
- package/dist/chunk-JMFT5KO5.js.map +1 -0
- package/dist/{conversations-Pe3kNikF.d.cts → conversations-B0_jmEuT.d.cts} +11469 -2916
- package/dist/{conversations-Pe3kNikF.d.ts → conversations-B0_jmEuT.d.ts} +11469 -2916
- package/dist/index.cjs +683 -57
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +373 -55
- package/dist/index.d.ts +373 -55
- package/dist/index.js +290 -49
- package/dist/index.js.map +1 -1
- package/dist/management/index.cjs +1538 -55
- package/dist/management/index.cjs.map +1 -1
- package/dist/management/index.d.cts +747 -9
- package/dist/management/index.d.ts +747 -9
- package/dist/management/index.js +1108 -7
- package/dist/management/index.js.map +1 -1
- package/package.json +2 -3
- package/dist/chunk-H76PTY5G.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { H as HttpClient, M as ModusConfig, c as components, W as WorkflowType, n as OperationId, V as VariationView, P as Page, a as Workflow, C as ContextItem, y as ContextItemDeletion, d as CustomContextItemsResource, z as CreatedContextItem, S as ScopeConversationsResource, h as Scope, i as ModusClientBase, j as ModusOptions } from '../conversations-
|
|
1
|
+
import { H as HttpClient, M as ModusConfig, c as components, W as WorkflowType, n as OperationId, V as VariationView, P as Page, a as Workflow, C as ContextItem, y as ContextItemDeletion, d as CustomContextItemsResource, z as CreatedContextItem, S as ScopeConversationsResource, h as Scope, i as ModusClientBase, j as ModusOptions } from '../conversations-B0_jmEuT.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
|
/**
|
|
@@ -255,8 +280,651 @@ declare class ManagementContextItemsResource {
|
|
|
255
280
|
|
|
256
281
|
type UserFeedback = 'positive' | 'neutral' | 'negative';
|
|
257
282
|
|
|
283
|
+
/** A whole dashboard, including its draft definition and `draftRevision`. */
|
|
284
|
+
type Dashboard = components['schemas']['DashboardDto'];
|
|
285
|
+
/** Every tile and filter on a dashboard draft, plus the current `draftRevision`. */
|
|
286
|
+
type DashboardElementsList = components['schemas']['DashboardElementsListResponseDto'];
|
|
287
|
+
/** One tile or filter in a list result. */
|
|
288
|
+
type DashboardElementSummary = components['schemas']['DashboardElementSummaryDto'];
|
|
289
|
+
/** One element's full draft settings, plus the current `draftRevision`. */
|
|
290
|
+
type DashboardElementResult = components['schemas']['DashboardElementResponseDto'];
|
|
291
|
+
/** `"chart"`, `"kpi"`, `"table"`, `"markdown"` or `"filter"`. */
|
|
292
|
+
type DashboardElementKind = components['schemas']['DashboardElementKind'];
|
|
293
|
+
/** Grid position of an element: `x` (0-11), `y`, `w` (1-12) and `h`. */
|
|
294
|
+
type DashboardElementLayout = components['schemas']['DashboardElementLayoutDto'];
|
|
295
|
+
/** Settings to change on one element; `null` clears a setting that supports clearing. */
|
|
296
|
+
type DashboardElementPatch = components['schemas']['DashboardElementPatchDto'];
|
|
297
|
+
/** One element and its final grid position for `updateLayout()`. */
|
|
298
|
+
type DashboardLayoutElement = components['schemas']['DashboardLayoutElementDto'];
|
|
299
|
+
/** Input for `elements(id).create()`. */
|
|
300
|
+
type CreateDashboardElementInput = components['schemas']['CreateDashboardElementDto'];
|
|
301
|
+
/** Input for `elements(id).update()`. */
|
|
302
|
+
type UpdateDashboardElementInput = components['schemas']['UpdateDashboardElementDto'];
|
|
303
|
+
/** Input for `updateLayout()`. */
|
|
304
|
+
type UpdateDashboardLayoutInput = components['schemas']['UpdateDashboardLayoutDto'];
|
|
305
|
+
/** One published version or draft snapshot of a dashboard, with its full definition. */
|
|
306
|
+
type DashboardVersion = components['schemas']['DashboardVersionDto'];
|
|
307
|
+
/** One saved snapshot of a dashboard draft: its id, author and time. */
|
|
308
|
+
type DashboardDraftSnapshot = components['schemas']['DashboardDraftSnapshotDto'];
|
|
309
|
+
/** Result of `publish()`: the published dashboard and the new version. */
|
|
310
|
+
type DashboardPublishResult = components['schemas']['PublishDashboardResponseDto'];
|
|
311
|
+
/** `"active"` (the published version) or `"draft"` (the working draft). */
|
|
312
|
+
type DashboardView = components['schemas']['DashboardView'];
|
|
313
|
+
/** Input for `create()`. */
|
|
314
|
+
type CreateDashboardInput = components['schemas']['CreateDashboardDto'];
|
|
315
|
+
/** Input for `updateDraft()`. */
|
|
316
|
+
type UpdateDashboardDraftInput = components['schemas']['UpdateDashboardDraftDto'];
|
|
317
|
+
/** Input for `publish()`. */
|
|
318
|
+
type PublishDashboardInput = components['schemas']['PublishDashboardDto'];
|
|
319
|
+
/** Input for `updateAccess()`; all three settings replace the current ones. */
|
|
320
|
+
type UpdateDashboardAccessInput = components['schemas']['UpdateDashboardAccessDto'];
|
|
321
|
+
/** Input for `requestOwnershipTransfer()`. */
|
|
322
|
+
type TransferDashboardOwnershipInput = components['schemas']['TransferDashboardOwnershipDto'];
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Tiles and filters on one dashboard draft.
|
|
326
|
+
*
|
|
327
|
+
* Call path: `mgmt.context.dashboards.elements(dashboardId)`.
|
|
328
|
+
*
|
|
329
|
+
* Every change takes the `draftRevision` it is based on as `expectedRevision`;
|
|
330
|
+
* a stale value is rejected with a `ConflictError`.
|
|
331
|
+
*/
|
|
332
|
+
declare class ManagementDashboardElementsResource {
|
|
333
|
+
private readonly http;
|
|
334
|
+
private readonly config;
|
|
335
|
+
private readonly dashboardId;
|
|
336
|
+
/** @internal */
|
|
337
|
+
constructor(http: HttpClient, config: ModusConfig, dashboardId: string);
|
|
338
|
+
/**
|
|
339
|
+
* List every tile and filter on the dashboard draft.
|
|
340
|
+
*
|
|
341
|
+
* @returns Each element's id, kind, title and grid position, plus the current
|
|
342
|
+
* `draftRevision` to pass as `expectedRevision` on the next change.
|
|
343
|
+
* @throws NotFoundError - The dashboard does not exist or you cannot edit it.
|
|
344
|
+
* @example
|
|
345
|
+
* ```ts
|
|
346
|
+
* const listed = await mgmt.context.dashboards.elements('DASHBOARD_ID').list()
|
|
347
|
+
* listed.elements.map((element) => element.id)
|
|
348
|
+
* ```
|
|
349
|
+
*/
|
|
350
|
+
list(): Promise<DashboardElementsList>;
|
|
351
|
+
/**
|
|
352
|
+
* Get the full draft settings of one tile or filter.
|
|
353
|
+
*
|
|
354
|
+
* @param elementId - Id of the tile or filter, as returned by `list()`.
|
|
355
|
+
* @returns The element's settings and the current `draftRevision`.
|
|
356
|
+
* @throws NotFoundError - The dashboard or the element does not exist, or you cannot
|
|
357
|
+
* edit the dashboard.
|
|
358
|
+
* @example
|
|
359
|
+
* ```ts
|
|
360
|
+
* const result = await mgmt.context.dashboards.elements('DASHBOARD_ID').get('ELEMENT_ID')
|
|
361
|
+
* result.element.title
|
|
362
|
+
* ```
|
|
363
|
+
*/
|
|
364
|
+
get(elementId: string): Promise<DashboardElementResult>;
|
|
365
|
+
/**
|
|
366
|
+
* Add a blank tile or filter to the dashboard draft.
|
|
367
|
+
*
|
|
368
|
+
* Modus assigns the new element's id; configure it afterwards with `update()`.
|
|
369
|
+
*
|
|
370
|
+
* @param input.expectedRevision - The `draftRevision` your change is based on.
|
|
371
|
+
* @param input.kind - `chart`, `kpi`, `table`, `markdown` or `filter`.
|
|
372
|
+
* @param input.title - Title shown on the element.
|
|
373
|
+
* @param input.layout - Grid position with `x` (0-11), `y`, `w` (1-12) and `h`.
|
|
374
|
+
* @returns The created element and the new `draftRevision`.
|
|
375
|
+
* @throws ConflictError - The draft changed since `expectedRevision`; list the
|
|
376
|
+
* elements again and retry with the new revision.
|
|
377
|
+
* @example
|
|
378
|
+
* ```ts
|
|
379
|
+
* const created = await mgmt.context.dashboards.elements('DASHBOARD_ID').create({
|
|
380
|
+
* expectedRevision: 3,
|
|
381
|
+
* kind: 'chart',
|
|
382
|
+
* title: 'Sales by region',
|
|
383
|
+
* layout: { x: 0, y: 4, w: 6, h: 4 },
|
|
384
|
+
* })
|
|
385
|
+
* ```
|
|
386
|
+
*/
|
|
387
|
+
create(input: CreateDashboardElementInput): Promise<DashboardElementResult>;
|
|
388
|
+
/**
|
|
389
|
+
* Change settings of one tile or filter on the dashboard draft.
|
|
390
|
+
*
|
|
391
|
+
* @param elementId - Id of the tile or filter to change.
|
|
392
|
+
* @param input.expectedRevision - The `draftRevision` your change is based on.
|
|
393
|
+
* @param input.patch - The settings to change, for example `{ title: 'Sales' }`
|
|
394
|
+
* or `{ defaultValue: null }`. `null` clears a setting that supports clearing.
|
|
395
|
+
* @returns The whole dashboard after the change, including the new `draftRevision`.
|
|
396
|
+
* @throws ConflictError - The draft changed since `expectedRevision`.
|
|
397
|
+
* @throws NotFoundError - The dashboard or the element does not exist, or you cannot
|
|
398
|
+
* edit the dashboard.
|
|
399
|
+
* @example
|
|
400
|
+
* ```ts
|
|
401
|
+
* const dashboard = await mgmt.context.dashboards
|
|
402
|
+
* .elements('DASHBOARD_ID')
|
|
403
|
+
* .update('ELEMENT_ID', { expectedRevision: 3, patch: { title: 'Revenue' } })
|
|
404
|
+
* ```
|
|
405
|
+
*/
|
|
406
|
+
update(elementId: string, input: UpdateDashboardElementInput): Promise<Dashboard>;
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Dashboards in the Modus knowledge base.
|
|
410
|
+
*
|
|
411
|
+
* Call path: `mgmt.context.dashboards` after `new ModusManagement(...)`.
|
|
412
|
+
*
|
|
413
|
+
* - `list()`, `get()`, `create()`, `updateDraft()`, `publish()`, `delete()` — dashboards.
|
|
414
|
+
* - `listVersions()`, `getVersion()`, `restoreVersion()`, `listDraftSnapshots()` — history.
|
|
415
|
+
* - `updateAccess()` — who can open and edit a dashboard.
|
|
416
|
+
* - `requestOwnershipTransfer()`, `acceptOwnershipTransfer()`, `cancelOwnershipTransfer()`.
|
|
417
|
+
* - `elements(dashboardId)` — list, get, create and update tiles and filters.
|
|
418
|
+
* - `updateLayout(dashboardId, input)` — move or resize several elements at once.
|
|
419
|
+
*/
|
|
420
|
+
declare class ManagementDashboardsResource {
|
|
421
|
+
private readonly http;
|
|
422
|
+
private readonly config;
|
|
423
|
+
/** @internal */
|
|
424
|
+
constructor(http: HttpClient, config: ModusConfig);
|
|
425
|
+
/**
|
|
426
|
+
* List dashboards with their full definitions.
|
|
427
|
+
*
|
|
428
|
+
* @param options.view - `active` (default) lists published dashboards you can open;
|
|
429
|
+
* `draft` lists the drafts of dashboards you can edit.
|
|
430
|
+
* @returns Every matching dashboard. The list is not paginated.
|
|
431
|
+
* @example
|
|
432
|
+
* ```ts
|
|
433
|
+
* const drafts = await mgmt.context.dashboards.list({ view: 'draft' })
|
|
434
|
+
* drafts.map((dashboard) => [dashboard.id, dashboard.draftRevision])
|
|
435
|
+
* ```
|
|
436
|
+
*/
|
|
437
|
+
list(options?: {
|
|
438
|
+
view?: DashboardView;
|
|
439
|
+
}): Promise<Dashboard[]>;
|
|
440
|
+
/**
|
|
441
|
+
* Get one dashboard with its full definition.
|
|
442
|
+
*
|
|
443
|
+
* @param dashboardId - Id of the dashboard.
|
|
444
|
+
* @param options.view - `active` (default) returns the published version; `draft`
|
|
445
|
+
* returns the working draft and requires edit access.
|
|
446
|
+
* @returns The dashboard, including `draftRevision` for the next change.
|
|
447
|
+
* @throws NotFoundError - The dashboard does not exist or you cannot open it.
|
|
448
|
+
* @example
|
|
449
|
+
* ```ts
|
|
450
|
+
* const draft = await mgmt.context.dashboards.get('DASHBOARD_ID', { view: 'draft' })
|
|
451
|
+
* draft.draftRevision
|
|
452
|
+
* ```
|
|
453
|
+
*/
|
|
454
|
+
get(dashboardId: string, options?: {
|
|
455
|
+
view?: DashboardView;
|
|
456
|
+
}): Promise<Dashboard>;
|
|
457
|
+
/**
|
|
458
|
+
* Create a dashboard draft.
|
|
459
|
+
*
|
|
460
|
+
* The new dashboard is not visible to others until you `publish()` it.
|
|
461
|
+
*
|
|
462
|
+
* @param input.title - Dashboard title.
|
|
463
|
+
* @param input.definition - Tiles, filters and layout, for example
|
|
464
|
+
* `{ tiles: [], filters: [] }`. Element ids must be unique.
|
|
465
|
+
* @param input.description - Optional dashboard description.
|
|
466
|
+
* @param input.access - Optional `visibility`, `groupPermissions` and `sharedWith`.
|
|
467
|
+
* Defaults to private.
|
|
468
|
+
* @returns The created dashboard in its draft view.
|
|
469
|
+
* @throws ModusError - The definition or access settings are invalid.
|
|
470
|
+
* @example
|
|
471
|
+
* ```ts
|
|
472
|
+
* const dashboard = await mgmt.context.dashboards.create({
|
|
473
|
+
* title: 'Revenue',
|
|
474
|
+
* definition: { tiles: [], filters: [] },
|
|
475
|
+
* })
|
|
476
|
+
* dashboard.id
|
|
477
|
+
* ```
|
|
478
|
+
*/
|
|
479
|
+
create(input: CreateDashboardInput): Promise<Dashboard>;
|
|
480
|
+
/**
|
|
481
|
+
* Replace the whole draft definition, and optionally the title and description.
|
|
482
|
+
*
|
|
483
|
+
* @param dashboardId - Id of the dashboard.
|
|
484
|
+
* @param input.expectedRevision - The `draftRevision` your change is based on.
|
|
485
|
+
* @param input.definition - The complete new definition. Tiles and filters left
|
|
486
|
+
* out are removed.
|
|
487
|
+
* @param input.title - New title; unchanged when omitted.
|
|
488
|
+
* @param input.description - New description; unchanged when omitted.
|
|
489
|
+
* @returns The dashboard draft after the change, including the new `draftRevision`.
|
|
490
|
+
* @throws ConflictError - The draft changed since `expectedRevision`; get the draft
|
|
491
|
+
* again and retry with the new revision.
|
|
492
|
+
* @throws NotFoundError - The dashboard does not exist or you cannot edit it.
|
|
493
|
+
* @example
|
|
494
|
+
* ```ts
|
|
495
|
+
* const draft = await mgmt.context.dashboards.get('DASHBOARD_ID', { view: 'draft' })
|
|
496
|
+
* await mgmt.context.dashboards.updateDraft('DASHBOARD_ID', {
|
|
497
|
+
* expectedRevision: draft.draftRevision,
|
|
498
|
+
* definition: draft.definition,
|
|
499
|
+
* title: 'Revenue',
|
|
500
|
+
* })
|
|
501
|
+
* ```
|
|
502
|
+
*/
|
|
503
|
+
updateDraft(dashboardId: string, input: UpdateDashboardDraftInput): Promise<Dashboard>;
|
|
504
|
+
/**
|
|
505
|
+
* Publish the draft as a new version that everyone with access sees.
|
|
506
|
+
*
|
|
507
|
+
* Alert workflows defined on the dashboard are updated to match.
|
|
508
|
+
*
|
|
509
|
+
* @param dashboardId - Id of the dashboard.
|
|
510
|
+
* @param input.expectedRevision - The `draftRevision` you reviewed and want to publish.
|
|
511
|
+
* @returns The published `dashboard` and the new `version`.
|
|
512
|
+
* @throws ConflictError - The draft changed since `expectedRevision`.
|
|
513
|
+
* @throws NotFoundError - The dashboard does not exist or you cannot edit it.
|
|
514
|
+
* @example
|
|
515
|
+
* ```ts
|
|
516
|
+
* const result = await mgmt.context.dashboards.publish('DASHBOARD_ID', { expectedRevision: 4 })
|
|
517
|
+
* result.version.versionNumber
|
|
518
|
+
* ```
|
|
519
|
+
*/
|
|
520
|
+
publish(dashboardId: string, input: PublishDashboardInput): Promise<DashboardPublishResult>;
|
|
521
|
+
/**
|
|
522
|
+
* Delete a dashboard and the alert workflows defined on it.
|
|
523
|
+
*
|
|
524
|
+
* A deleted dashboard cannot be restored.
|
|
525
|
+
*
|
|
526
|
+
* @param dashboardId - Id of the dashboard.
|
|
527
|
+
* @throws NotFoundError - The dashboard does not exist or you cannot edit it.
|
|
528
|
+
* @example
|
|
529
|
+
* ```ts
|
|
530
|
+
* await mgmt.context.dashboards.delete('DASHBOARD_ID')
|
|
531
|
+
* ```
|
|
532
|
+
*/
|
|
533
|
+
delete(dashboardId: string): Promise<void>;
|
|
534
|
+
/**
|
|
535
|
+
* List the published versions of a dashboard, newest first.
|
|
536
|
+
*
|
|
537
|
+
* @param dashboardId - Id of the dashboard.
|
|
538
|
+
* @returns Every published version with its full definition. Definitions are
|
|
539
|
+
* returned as stored, so older versions may lack newer fields. The list is
|
|
540
|
+
* not paginated.
|
|
541
|
+
* @throws NotFoundError - The dashboard does not exist or you cannot open it.
|
|
542
|
+
* @example
|
|
543
|
+
* ```ts
|
|
544
|
+
* const versions = await mgmt.context.dashboards.listVersions('DASHBOARD_ID')
|
|
545
|
+
* versions.map((version) => [version.uid, version.versionNumber])
|
|
546
|
+
* ```
|
|
547
|
+
*/
|
|
548
|
+
listVersions(dashboardId: string): Promise<DashboardVersion[]>;
|
|
549
|
+
/**
|
|
550
|
+
* Get a dashboard as it was in one version.
|
|
551
|
+
*
|
|
552
|
+
* @param dashboardId - Id of the dashboard.
|
|
553
|
+
* @param versionId - Id of the version, as returned by `listVersions()`.
|
|
554
|
+
* @returns The dashboard with that version's definition.
|
|
555
|
+
* @throws NotFoundError - The dashboard or the version does not exist, or you cannot
|
|
556
|
+
* open the dashboard.
|
|
557
|
+
* @example
|
|
558
|
+
* ```ts
|
|
559
|
+
* const old = await mgmt.context.dashboards.getVersion('DASHBOARD_ID', 'VERSION_ID')
|
|
560
|
+
* old.selectedVersion.versionNumber
|
|
561
|
+
* ```
|
|
562
|
+
*/
|
|
563
|
+
getVersion(dashboardId: string, versionId: string): Promise<Dashboard>;
|
|
564
|
+
/**
|
|
565
|
+
* Replace the draft with the content of an earlier version.
|
|
566
|
+
*
|
|
567
|
+
* The draft being replaced is kept as a draft snapshot. Call `publish()`
|
|
568
|
+
* afterwards to make the restored content visible.
|
|
569
|
+
*
|
|
570
|
+
* @param dashboardId - Id of the dashboard.
|
|
571
|
+
* @param versionId - Id of the version or draft snapshot to restore.
|
|
572
|
+
* @returns The dashboard draft after the restore.
|
|
573
|
+
* @throws NotFoundError - The dashboard or the version does not exist, or you cannot
|
|
574
|
+
* edit the dashboard.
|
|
575
|
+
* @example
|
|
576
|
+
* ```ts
|
|
577
|
+
* await mgmt.context.dashboards.restoreVersion('DASHBOARD_ID', 'VERSION_ID')
|
|
578
|
+
* ```
|
|
579
|
+
*/
|
|
580
|
+
restoreVersion(dashboardId: string, versionId: string): Promise<Dashboard>;
|
|
581
|
+
/**
|
|
582
|
+
* List recent snapshots of the dashboard draft, newest first.
|
|
583
|
+
*
|
|
584
|
+
* @param dashboardId - Id of the dashboard.
|
|
585
|
+
* @returns Up to 100 snapshots with their id, author and time. Pass an id to
|
|
586
|
+
* `restoreVersion()` to bring that draft back.
|
|
587
|
+
* @throws NotFoundError - The dashboard does not exist or you cannot edit it.
|
|
588
|
+
* @example
|
|
589
|
+
* ```ts
|
|
590
|
+
* const snapshots = await mgmt.context.dashboards.listDraftSnapshots('DASHBOARD_ID')
|
|
591
|
+
* snapshots.map((snapshot) => snapshot.uid)
|
|
592
|
+
* ```
|
|
593
|
+
*/
|
|
594
|
+
listDraftSnapshots(dashboardId: string): Promise<DashboardDraftSnapshot[]>;
|
|
595
|
+
/**
|
|
596
|
+
* Replace who can open and edit a dashboard.
|
|
597
|
+
*
|
|
598
|
+
* All three settings are required and replace the current ones.
|
|
599
|
+
*
|
|
600
|
+
* @param dashboardId - Id of the dashboard.
|
|
601
|
+
* @param input.visibility - `shared` (the owner plus the groups in
|
|
602
|
+
* `groupPermissions`) or `private` (the owner plus the users in `sharedWith`).
|
|
603
|
+
* @param input.groupPermissions - Group id to `{ use, manage }`. Used only when shared.
|
|
604
|
+
* @param input.sharedWith - Users such as `{ email: 'ana@example.com', permission: 'use' }`.
|
|
605
|
+
* Used only when private.
|
|
606
|
+
* @returns The dashboard with its new access settings.
|
|
607
|
+
* @throws NotFoundError - The dashboard does not exist or you cannot edit it.
|
|
608
|
+
* @throws ModusError - A group, user or permission is invalid.
|
|
609
|
+
* @example
|
|
610
|
+
* ```ts
|
|
611
|
+
* await mgmt.context.dashboards.updateAccess('DASHBOARD_ID', {
|
|
612
|
+
* visibility: 'private',
|
|
613
|
+
* groupPermissions: {},
|
|
614
|
+
* sharedWith: [{ email: 'ana@example.com', permission: 'use' }],
|
|
615
|
+
* })
|
|
616
|
+
* ```
|
|
617
|
+
*/
|
|
618
|
+
updateAccess(dashboardId: string, input: UpdateDashboardAccessInput): Promise<Dashboard>;
|
|
619
|
+
/**
|
|
620
|
+
* Ask another member of your organization to take ownership of a dashboard.
|
|
621
|
+
*
|
|
622
|
+
* Only the owner can request a transfer. Ownership moves when the recipient
|
|
623
|
+
* calls `acceptOwnershipTransfer()`.
|
|
624
|
+
*
|
|
625
|
+
* @param dashboardId - Id of the dashboard.
|
|
626
|
+
* @param input.newOwnerUserId - User id of the member who should become the owner.
|
|
627
|
+
* @returns The dashboard with `pendingOwnershipTransfer` set.
|
|
628
|
+
* @throws PermissionDeniedError - You are not the owner.
|
|
629
|
+
* @throws NotFoundError - The dashboard does not exist or you cannot open it.
|
|
630
|
+
* @example
|
|
631
|
+
* ```ts
|
|
632
|
+
* await mgmt.context.dashboards.requestOwnershipTransfer('DASHBOARD_ID', {
|
|
633
|
+
* newOwnerUserId: 'USER_ID',
|
|
634
|
+
* })
|
|
635
|
+
* ```
|
|
636
|
+
*/
|
|
637
|
+
requestOwnershipTransfer(dashboardId: string, input: TransferDashboardOwnershipInput): Promise<Dashboard>;
|
|
638
|
+
/**
|
|
639
|
+
* Accept a pending ownership transfer and become the dashboard owner.
|
|
640
|
+
*
|
|
641
|
+
* Only the requested recipient can accept.
|
|
642
|
+
*
|
|
643
|
+
* @param dashboardId - Id of the dashboard.
|
|
644
|
+
* @returns The dashboard with you as its owner.
|
|
645
|
+
* @throws NotFoundError - The dashboard does not exist, or it has no pending transfer
|
|
646
|
+
* addressed to you.
|
|
647
|
+
* @example
|
|
648
|
+
* ```ts
|
|
649
|
+
* await mgmt.context.dashboards.acceptOwnershipTransfer('DASHBOARD_ID')
|
|
650
|
+
* ```
|
|
651
|
+
*/
|
|
652
|
+
acceptOwnershipTransfer(dashboardId: string): Promise<Dashboard>;
|
|
653
|
+
/**
|
|
654
|
+
* Cancel a pending ownership transfer.
|
|
655
|
+
*
|
|
656
|
+
* Only the owner can cancel.
|
|
657
|
+
*
|
|
658
|
+
* @param dashboardId - Id of the dashboard.
|
|
659
|
+
* @returns The dashboard with no pending transfer.
|
|
660
|
+
* @throws NotFoundError - The dashboard does not exist, you cannot open it, or you are
|
|
661
|
+
* not the owner.
|
|
662
|
+
* @example
|
|
663
|
+
* ```ts
|
|
664
|
+
* await mgmt.context.dashboards.cancelOwnershipTransfer('DASHBOARD_ID')
|
|
665
|
+
* ```
|
|
666
|
+
*/
|
|
667
|
+
cancelOwnershipTransfer(dashboardId: string): Promise<Dashboard>;
|
|
668
|
+
/**
|
|
669
|
+
* Work with the tiles and filters of one dashboard draft.
|
|
670
|
+
*
|
|
671
|
+
* @param dashboardId - Id of the dashboard.
|
|
672
|
+
* @returns A resource bound to that dashboard.
|
|
673
|
+
* @example
|
|
674
|
+
* ```ts
|
|
675
|
+
* await mgmt.context.dashboards.elements('DASHBOARD_ID').list()
|
|
676
|
+
* ```
|
|
677
|
+
*/
|
|
678
|
+
elements(dashboardId: string): ManagementDashboardElementsResource;
|
|
679
|
+
/**
|
|
680
|
+
* Move or resize several tiles and filters in one change.
|
|
681
|
+
*
|
|
682
|
+
* @param dashboardId - Id of the dashboard.
|
|
683
|
+
* @param input.expectedRevision - The `draftRevision` your change is based on.
|
|
684
|
+
* @param input.elements - Every element to place, each with `elementId` and its
|
|
685
|
+
* final `layout`.
|
|
686
|
+
* @returns The whole dashboard after the change, including the new `draftRevision`.
|
|
687
|
+
* @throws ConflictError - The draft changed since `expectedRevision`.
|
|
688
|
+
* @example
|
|
689
|
+
* ```ts
|
|
690
|
+
* await mgmt.context.dashboards.updateLayout('DASHBOARD_ID', {
|
|
691
|
+
* expectedRevision: 3,
|
|
692
|
+
* elements: [{ elementId: 'ELEMENT_ID', layout: { x: 0, y: 0, w: 12, h: 2 } }],
|
|
693
|
+
* })
|
|
694
|
+
* ```
|
|
695
|
+
*/
|
|
696
|
+
updateLayout(dashboardId: string, input: UpdateDashboardLayoutInput): Promise<Dashboard>;
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
type FileUpload = components['schemas']['FileUploadResourceDto'];
|
|
700
|
+
type FileUploadStatus = components['schemas']['FileUploadResourceStatus'];
|
|
701
|
+
type UploadUrlSlot = components['schemas']['UploadUrlResponseDto'];
|
|
702
|
+
type BulkUploadUrlsResult = components['schemas']['BulkUploadUrlsResponseDto'];
|
|
703
|
+
type BulkUploadFromUrlsResult = components['schemas']['BulkUploadFromUrlsResponseDto'];
|
|
704
|
+
type FailedUploadUrl = components['schemas']['FailedUploadUrlDto'];
|
|
705
|
+
type FailedUploadFromUrl = components['schemas']['FailedUploadFromUrlDto'];
|
|
706
|
+
/** `"processing"` (parsing started) or `"ready"` (parsing finished) — target status for `upload()` / `uploadDir()`. */
|
|
707
|
+
type WaitUntil = 'processing' | 'ready';
|
|
708
|
+
/** One file entry for `createUploadUrls()`. */
|
|
709
|
+
interface UploadUrlInput {
|
|
710
|
+
fileName: string;
|
|
711
|
+
contentType: string;
|
|
712
|
+
fileSize: number;
|
|
713
|
+
}
|
|
714
|
+
/** One URL entry for `uploadFromUrls()`. */
|
|
715
|
+
interface UploadFromUrlInput {
|
|
716
|
+
url: string;
|
|
717
|
+
fileName?: string;
|
|
718
|
+
folderPath?: string;
|
|
719
|
+
}
|
|
720
|
+
/** A local file and its optional durable folder label for `uploadFiles()`. */
|
|
721
|
+
interface UploadFileInput {
|
|
722
|
+
path: string;
|
|
723
|
+
folderPath?: string;
|
|
724
|
+
}
|
|
725
|
+
/** A single file that failed during `uploadDir()` (slot creation or PUT/poll). */
|
|
726
|
+
interface UploadDirFailure {
|
|
727
|
+
path: string;
|
|
728
|
+
error: string;
|
|
729
|
+
}
|
|
730
|
+
/** Outcome of `uploadDir()` — successes and per-file failures. */
|
|
731
|
+
interface UploadDirResult {
|
|
732
|
+
uploaded: FileUpload[];
|
|
733
|
+
failed: UploadDirFailure[];
|
|
734
|
+
}
|
|
735
|
+
/** Progress event after each file succeeds or fails in a batch upload. */
|
|
736
|
+
interface UploadProgress {
|
|
737
|
+
completed: number;
|
|
738
|
+
total: number;
|
|
739
|
+
succeeded: number;
|
|
740
|
+
failed: number;
|
|
741
|
+
}
|
|
742
|
+
type UploadProgressCallback = (progress: UploadProgress) => void;
|
|
743
|
+
/** One entry of a bulk finalize request. */
|
|
744
|
+
interface FinalizeInput {
|
|
745
|
+
uploadId: string;
|
|
746
|
+
fileName: string;
|
|
747
|
+
folderPath?: string;
|
|
748
|
+
}
|
|
749
|
+
/** One entry that could not be finalized. */
|
|
750
|
+
interface FinalizeFailure {
|
|
751
|
+
index: number;
|
|
752
|
+
uploadId: string;
|
|
753
|
+
error: string;
|
|
754
|
+
}
|
|
755
|
+
/** Result of `finalizeMany` — partial success, never a partial 4xx. */
|
|
756
|
+
interface BulkFinalizeResult {
|
|
757
|
+
finalized: FileUpload[];
|
|
758
|
+
failed: FinalizeFailure[];
|
|
759
|
+
}
|
|
760
|
+
|
|
258
761
|
/**
|
|
259
|
-
*
|
|
762
|
+
* Durable file uploads for `ModusManagement`.
|
|
763
|
+
*
|
|
764
|
+
* Call path: `mgmt.context.files` after `new ModusManagement(...)`.
|
|
765
|
+
*
|
|
766
|
+
* - `upload(path)` / `uploadDir(dirPath)` — presign + PUT + poll convenience helpers.
|
|
767
|
+
* - `createUploadUrl(s)`, `uploadFromUrl(s)`, `get`, `list` — raw operations.
|
|
768
|
+
*/
|
|
769
|
+
declare class ManagementContextFilesResource {
|
|
770
|
+
private readonly http;
|
|
771
|
+
private readonly config;
|
|
772
|
+
/** @internal */
|
|
773
|
+
constructor(http: HttpClient, config: ModusConfig);
|
|
774
|
+
/**
|
|
775
|
+
* Get a presigned S3 PUT URL for one file.
|
|
776
|
+
*
|
|
777
|
+
* @param input.fileName - Original file name — used to build the S3 object key.
|
|
778
|
+
* @param input.contentType - MIME type. Allowed categories: PDF, images, text,
|
|
779
|
+
* Office/OpenDocument documents, audio, and video.
|
|
780
|
+
* @param input.fileSize - File size in bytes. Rejected above 50MB.
|
|
781
|
+
* @returns Presigned upload slot. PUT the raw bytes to `uploadUrl` within 15
|
|
782
|
+
* minutes, then call `finalize(slot.uploadId, slot.fileName)`. Pass the
|
|
783
|
+
* slot's own `fileName` rather than your local basename — the server may
|
|
784
|
+
* sanitize the requested name when it mints the key, and finalization
|
|
785
|
+
* re-derives the key from `uploadId` and `fileName`.
|
|
786
|
+
*/
|
|
787
|
+
createUploadUrl(input: UploadUrlInput): Promise<UploadUrlSlot>;
|
|
788
|
+
/**
|
|
789
|
+
* Get presigned S3 PUT URLs for up to 100 files in one call.
|
|
790
|
+
*
|
|
791
|
+
* @param files - Files to create upload slots for (max 100).
|
|
792
|
+
* @returns Slots for every file that passed validation, plus per-index
|
|
793
|
+
* failures (bad MIME type, oversize) for the rest — never a partial 4xx.
|
|
794
|
+
*/
|
|
795
|
+
createUploadUrls(files: readonly UploadUrlInput[]): Promise<BulkUploadUrlsResult>;
|
|
796
|
+
/**
|
|
797
|
+
* Fetch one file from a URL and land it as durable context.
|
|
798
|
+
*
|
|
799
|
+
* @param url - Source URL to fetch (SSRF-guarded, 50MB cap, same MIME
|
|
800
|
+
* allow-list as `createUploadUrl`).
|
|
801
|
+
* @param options.fileName - Override file name. Inferred from the URL path when omitted.
|
|
802
|
+
* @returns File upload resource with status `processing` — parsing continues async.
|
|
803
|
+
*/
|
|
804
|
+
uploadFromUrl(url: string, options?: {
|
|
805
|
+
fileName?: string;
|
|
806
|
+
folderPath?: string;
|
|
807
|
+
}): Promise<FileUpload>;
|
|
808
|
+
/**
|
|
809
|
+
* Fetch up to 100 files from URLs in one call.
|
|
810
|
+
*
|
|
811
|
+
* @param urls - URLs to fetch and upload (max 100).
|
|
812
|
+
* @returns File upload resources for every URL that landed, plus per-index
|
|
813
|
+
* failures for the rest — never a partial 4xx.
|
|
814
|
+
*/
|
|
815
|
+
uploadFromUrls(urls: readonly UploadFromUrlInput[]): Promise<BulkUploadFromUrlsResult>;
|
|
816
|
+
/**
|
|
817
|
+
* Fetch one file upload by its id.
|
|
818
|
+
*
|
|
819
|
+
* @param uploadId - Upload id returned by `createUploadUrl` / `uploadFromUrl`.
|
|
820
|
+
* @returns The file upload resource, including its processing `status`.
|
|
821
|
+
*/
|
|
822
|
+
get(uploadId: string): Promise<FileUpload>;
|
|
823
|
+
/**
|
|
824
|
+
* List durable file uploads.
|
|
825
|
+
*
|
|
826
|
+
* @param options.pageSize - Items per page (default 50).
|
|
827
|
+
* @param options.pageToken - Opaque token from a previous page's `nextPageToken`.
|
|
828
|
+
* @returns Page of file uploads. Uploads that only have a pending row (not yet
|
|
829
|
+
* landed) aren't included here — use `get(uploadId)` for those.
|
|
830
|
+
*/
|
|
831
|
+
list(options?: {
|
|
832
|
+
pageSize?: number;
|
|
833
|
+
pageToken?: string;
|
|
834
|
+
}): Promise<Page<FileUpload>>;
|
|
835
|
+
private listPage;
|
|
836
|
+
/**
|
|
837
|
+
* Turn a file already PUT to a presigned URL into durable context.
|
|
838
|
+
*
|
|
839
|
+
* Call this once the PUT completes. The server locates the object from
|
|
840
|
+
* `uploadId` + `fileName` and validates the bytes that actually arrived.
|
|
841
|
+
* Safe to retry — a second call returns the same resource.
|
|
842
|
+
*
|
|
843
|
+
* @param uploadId - Upload id returned by `createUploadUrl`.
|
|
844
|
+
* @param fileName - File name returned alongside it.
|
|
845
|
+
* @returns The file upload resource, status `"processing"`.
|
|
846
|
+
*/
|
|
847
|
+
finalize(uploadId: string, fileName: string, options?: {
|
|
848
|
+
folderPath?: string;
|
|
849
|
+
}): Promise<FileUpload>;
|
|
850
|
+
/**
|
|
851
|
+
* Finalize up to 100 uploads in one call.
|
|
852
|
+
*
|
|
853
|
+
* What makes directory upload cheap: 2000 files cost 20 requests here rather
|
|
854
|
+
* than 2000.
|
|
855
|
+
*
|
|
856
|
+
* @param uploads - Uploads to finalize (max 100).
|
|
857
|
+
* @returns Resources for every upload that finalized, plus per-index
|
|
858
|
+
* failures for the rest — never a partial 4xx.
|
|
859
|
+
*/
|
|
860
|
+
finalizeMany(uploads: readonly FinalizeInput[]): Promise<BulkFinalizeResult>;
|
|
861
|
+
/**
|
|
862
|
+
* Upload an explicit list of local files.
|
|
863
|
+
*
|
|
864
|
+
* Same machinery as `uploadDir`, without the directory walk — use it when
|
|
865
|
+
* the caller already knows which files to send.
|
|
866
|
+
*
|
|
867
|
+
* @param paths - Paths to local files.
|
|
868
|
+
* @param options.concurrency - Max concurrent PUTs (default 10).
|
|
869
|
+
* @param options.waitUntil - `"processing"` (default) or `"ready"`.
|
|
870
|
+
* @param options.onProgress - Optional progress callback after each file.
|
|
871
|
+
*/
|
|
872
|
+
uploadFiles(paths: readonly (string | UploadFileInput)[], options?: {
|
|
873
|
+
concurrency?: number;
|
|
874
|
+
waitUntil?: WaitUntil;
|
|
875
|
+
onProgress?: UploadProgressCallback;
|
|
876
|
+
}): Promise<UploadDirResult>;
|
|
877
|
+
/**
|
|
878
|
+
* Upload a local file and wait for it to reach `"processing"` or `"ready"`.
|
|
879
|
+
*
|
|
880
|
+
* Gets a presigned URL, PUTs the file bytes, then polls `get()` until the
|
|
881
|
+
* upload leaves `"pending"` (or reaches `"ready"`/`"failed"`).
|
|
882
|
+
*
|
|
883
|
+
* @param path - Path to a local file.
|
|
884
|
+
* @param options.waitUntil - `"processing"` (parsing started, default) or
|
|
885
|
+
* `"ready"` (parsing finished).
|
|
886
|
+
* @param options.pollIntervalMs - Milliseconds between status polls.
|
|
887
|
+
* @param options.timeoutMs - Max milliseconds to wait before raising.
|
|
888
|
+
* @returns The file upload resource once it reaches `waitUntil` (or `"failed"`).
|
|
889
|
+
* @throws {ModusError} If the PUT fails, or polling times out.
|
|
890
|
+
*/
|
|
891
|
+
upload(path: string, options?: {
|
|
892
|
+
waitUntil?: WaitUntil;
|
|
893
|
+
pollIntervalMs?: number;
|
|
894
|
+
timeoutMs?: number;
|
|
895
|
+
}): Promise<FileUpload>;
|
|
896
|
+
private pollUntil;
|
|
897
|
+
/**
|
|
898
|
+
* Upload every file in a local directory.
|
|
899
|
+
*
|
|
900
|
+
* Walks `path` (skipping hidden files/directories and symlinks), pages
|
|
901
|
+
* through `createUploadUrls()` in batches of up to 100, then PUTs and polls
|
|
902
|
+
* each file with up to `concurrency` in flight at once. A failure on one
|
|
903
|
+
* file does not stop the others — check `result.failed`.
|
|
904
|
+
*
|
|
905
|
+
* @param path - Path to a local directory.
|
|
906
|
+
* @param options.recursive - Recurse into subdirectories (default `true`).
|
|
907
|
+
* @param options.concurrency - Max concurrent PUT+poll operations (default 10).
|
|
908
|
+
* @param options.waitUntil - `"processing"` (default) or `"ready"` — same as `upload()`.
|
|
909
|
+
* @param options.onProgress - Optional progress callback after each file.
|
|
910
|
+
* @returns `UploadDirResult` with every successful `FileUpload` and every
|
|
911
|
+
* per-file failure (slot creation or PUT/poll), each tagged with its local path.
|
|
912
|
+
*/
|
|
913
|
+
uploadDir(path: string, options?: {
|
|
914
|
+
recursive?: boolean;
|
|
915
|
+
concurrency?: number;
|
|
916
|
+
waitUntil?: WaitUntil;
|
|
917
|
+
onProgress?: UploadProgressCallback;
|
|
918
|
+
}): Promise<UploadDirResult>;
|
|
919
|
+
/** Shared body of `uploadFiles` and `uploadDir`: presign in batches of 100,
|
|
920
|
+
* PUT with bounded concurrency, then bulk-finalize the batch. */
|
|
921
|
+
private uploadPaths;
|
|
922
|
+
private createSlots;
|
|
923
|
+
private uploadBatch;
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
/**
|
|
927
|
+
* Create and update context items (notes, links, saved queries, file uploads).
|
|
260
928
|
*
|
|
261
929
|
* Call path: `mgmt.context` after `new ModusManagement(...)`.
|
|
262
930
|
*/
|
|
@@ -265,6 +933,8 @@ declare class ManagementContextResource {
|
|
|
265
933
|
private readonly config;
|
|
266
934
|
readonly items: ManagementContextItemsResource;
|
|
267
935
|
readonly customItems: CustomContextItemsResource;
|
|
936
|
+
readonly files: ManagementContextFilesResource;
|
|
937
|
+
readonly dashboards: ManagementDashboardsResource;
|
|
268
938
|
/** @internal */
|
|
269
939
|
constructor(http: HttpClient, config: ModusConfig);
|
|
270
940
|
/**
|
|
@@ -275,6 +945,7 @@ declare class ManagementContextResource {
|
|
|
275
945
|
* @returns The created context item.
|
|
276
946
|
* @example
|
|
277
947
|
* ```ts
|
|
948
|
+
* const mgmt = new ModusManagement()
|
|
278
949
|
* const note = await mgmt.context.createNote('Runbook', '# Steps\n1. Check logs')
|
|
279
950
|
* ```
|
|
280
951
|
*/
|
|
@@ -290,6 +961,14 @@ declare class ManagementContextResource {
|
|
|
290
961
|
* @param options.body - New markdown body.
|
|
291
962
|
* @param options.existing - Optional cached item to avoid a GET.
|
|
292
963
|
* @returns The updated context item.
|
|
964
|
+
* @example
|
|
965
|
+
* ```ts
|
|
966
|
+
* const mgmt = new ModusManagement()
|
|
967
|
+
* const item = await mgmt.context.updateNote('PLACEHOLDER_UID', {
|
|
968
|
+
* title: 'Runbook',
|
|
969
|
+
* body: '# Steps\n1. Check logs\n2. Escalate',
|
|
970
|
+
* })
|
|
971
|
+
* ```
|
|
293
972
|
*/
|
|
294
973
|
updateNote(uid: string, options: {
|
|
295
974
|
title: string;
|
|
@@ -307,6 +986,14 @@ declare class ManagementContextResource {
|
|
|
307
986
|
* @param options.query - SQL text.
|
|
308
987
|
* @param options.path - Optional hierarchy path segments.
|
|
309
988
|
* @returns The created context item.
|
|
989
|
+
* @example
|
|
990
|
+
* ```ts
|
|
991
|
+
* const mgmt = new ModusManagement()
|
|
992
|
+
* const query = await mgmt.context.createSavedQuery('Monthly ARR', {
|
|
993
|
+
* connectionId: 'conn_warehouse',
|
|
994
|
+
* query: 'select * from arr_monthly',
|
|
995
|
+
* })
|
|
996
|
+
* ```
|
|
310
997
|
*/
|
|
311
998
|
createSavedQuery(name: string, options: {
|
|
312
999
|
query?: string;
|
|
@@ -322,6 +1009,14 @@ declare class ManagementContextResource {
|
|
|
322
1009
|
* @param options.query - New SQL text.
|
|
323
1010
|
* @param options.existing - Optional cached item to avoid a GET.
|
|
324
1011
|
* @returns The updated context item.
|
|
1012
|
+
* @example
|
|
1013
|
+
* ```ts
|
|
1014
|
+
* const mgmt = new ModusManagement()
|
|
1015
|
+
* const item = await mgmt.context.updateSavedQuery('PLACEHOLDER_UID', {
|
|
1016
|
+
* name: 'Monthly ARR',
|
|
1017
|
+
* query: 'select sum(amount) from arr_monthly',
|
|
1018
|
+
* })
|
|
1019
|
+
* ```
|
|
325
1020
|
*/
|
|
326
1021
|
updateSavedQuery(uid: string, options: {
|
|
327
1022
|
name: string;
|
|
@@ -341,6 +1036,13 @@ declare class ManagementContextResource {
|
|
|
341
1036
|
* @param options.isCrawl - When true, crawl linked pages into context.
|
|
342
1037
|
* @param options.pageLimit - Maximum pages to crawl when `isCrawl` is true.
|
|
343
1038
|
* @returns The created context item.
|
|
1039
|
+
* @example
|
|
1040
|
+
* ```ts
|
|
1041
|
+
* const mgmt = new ModusManagement()
|
|
1042
|
+
* const link = await mgmt.context.createLink('https://docs.example.com/runbook', {
|
|
1043
|
+
* title: 'Ops runbook',
|
|
1044
|
+
* })
|
|
1045
|
+
* ```
|
|
344
1046
|
*/
|
|
345
1047
|
createLink(url: string, options?: {
|
|
346
1048
|
title?: string;
|
|
@@ -357,6 +1059,13 @@ declare class ManagementContextResource {
|
|
|
357
1059
|
* @param options.url - New URL.
|
|
358
1060
|
* @param options.existing - Optional cached item to avoid a GET.
|
|
359
1061
|
* @returns The updated context item.
|
|
1062
|
+
* @example
|
|
1063
|
+
* ```ts
|
|
1064
|
+
* const mgmt = new ModusManagement()
|
|
1065
|
+
* const item = await mgmt.context.updateLink('PLACEHOLDER_UID', {
|
|
1066
|
+
* title: 'Ops runbook (2025)',
|
|
1067
|
+
* })
|
|
1068
|
+
* ```
|
|
360
1069
|
*/
|
|
361
1070
|
updateLink(uid: string, options: {
|
|
362
1071
|
title?: string;
|
|
@@ -606,7 +1315,14 @@ declare class ManagementScopesResource {
|
|
|
606
1315
|
* @param options.search - Case-insensitive substring filter on the scope name.
|
|
607
1316
|
* @param options.view - Variation view: `"active"` (deployed) or `"draft"`.
|
|
608
1317
|
* @param options.managerId - Return only scopes supervised by this manager scope id.
|
|
609
|
-
* @returns A page of scopes.
|
|
1318
|
+
* @returns A page of scopes — use `.autoPagingIter()` for all pages.
|
|
1319
|
+
* @example
|
|
1320
|
+
* ```ts
|
|
1321
|
+
* const mgmt = new ModusManagement()
|
|
1322
|
+
* for await (const scope of (await mgmt.scopes.list()).autoPagingIter()) {
|
|
1323
|
+
* console.log(scope.id, scope.name, scope.status)
|
|
1324
|
+
* }
|
|
1325
|
+
* ```
|
|
610
1326
|
*/
|
|
611
1327
|
list(options?: {
|
|
612
1328
|
pageSize?: number;
|
|
@@ -622,6 +1338,12 @@ declare class ManagementScopesResource {
|
|
|
622
1338
|
* @param scopeId - Scope id.
|
|
623
1339
|
* @param options.view - Variation view: `"active"` (deployed) or `"draft"`.
|
|
624
1340
|
* @returns The scope.
|
|
1341
|
+
* @example
|
|
1342
|
+
* ```ts
|
|
1343
|
+
* const mgmt = new ModusManagement()
|
|
1344
|
+
* const scope = await mgmt.scopes.get('PLACEHOLDER_SCOPE_ID')
|
|
1345
|
+
* console.log(scope.name, scope.status)
|
|
1346
|
+
* ```
|
|
625
1347
|
*/
|
|
626
1348
|
get(scopeId: number | string, options?: {
|
|
627
1349
|
view?: VariationView;
|
|
@@ -638,7 +1360,9 @@ declare class ManagementScopesResource {
|
|
|
638
1360
|
* @returns The created scope (draft).
|
|
639
1361
|
* @example
|
|
640
1362
|
* ```ts
|
|
1363
|
+
* const mgmt = new ModusManagement()
|
|
641
1364
|
* const scope = await mgmt.scopes.create({ name: 'Support assistant', model: 'claude-sonnet-5' })
|
|
1365
|
+
* console.log(scope.id, scope.name)
|
|
642
1366
|
* ```
|
|
643
1367
|
*/
|
|
644
1368
|
create(options: CreateScopeOptions): Promise<Scope>;
|
|
@@ -652,6 +1376,13 @@ declare class ManagementScopesResource {
|
|
|
652
1376
|
* @param options.guardrails - Guardrail labels to set. Fetches the current scope first to merge. Pass `[]` to clear all.
|
|
653
1377
|
* @param options.updateMask - Comma-separated field names to update or clear.
|
|
654
1378
|
* @returns The updated scope.
|
|
1379
|
+
* @example
|
|
1380
|
+
* ```ts
|
|
1381
|
+
* const mgmt = new ModusManagement()
|
|
1382
|
+
* const scope = await mgmt.scopes.update('PLACEHOLDER_SCOPE_ID', {
|
|
1383
|
+
* description: 'Answers billing questions for enterprise customers.',
|
|
1384
|
+
* })
|
|
1385
|
+
* ```
|
|
655
1386
|
*/
|
|
656
1387
|
update(scopeId: number | string, options?: UpdateScopeOptions): Promise<Scope>;
|
|
657
1388
|
/**
|
|
@@ -661,8 +1392,10 @@ declare class ManagementScopesResource {
|
|
|
661
1392
|
* @returns The published scope.
|
|
662
1393
|
* @example
|
|
663
1394
|
* ```ts
|
|
664
|
-
*
|
|
665
|
-
* const
|
|
1395
|
+
* const mgmt = new ModusManagement()
|
|
1396
|
+
* const scope = await mgmt.scopes.create({ name: 'Support assistant' })
|
|
1397
|
+
* const published = await mgmt.scopes.deploy(scope.id)
|
|
1398
|
+
* console.log(published.status)
|
|
666
1399
|
* ```
|
|
667
1400
|
*/
|
|
668
1401
|
deploy(scopeId: number | string): Promise<Scope>;
|
|
@@ -671,6 +1404,11 @@ declare class ManagementScopesResource {
|
|
|
671
1404
|
*
|
|
672
1405
|
* @param scopeId - Scope id.
|
|
673
1406
|
* @returns Resolves when the scope is deleted.
|
|
1407
|
+
* @example
|
|
1408
|
+
* ```ts
|
|
1409
|
+
* const mgmt = new ModusManagement()
|
|
1410
|
+
* await mgmt.scopes.delete('PLACEHOLDER_SCOPE_ID')
|
|
1411
|
+
* ```
|
|
674
1412
|
*/
|
|
675
1413
|
delete(scopeId: number | string): Promise<void>;
|
|
676
1414
|
/**
|
|
@@ -806,4 +1544,4 @@ declare class ModusManagement extends ModusClientBase {
|
|
|
806
1544
|
constructor(options?: ModusOptions);
|
|
807
1545
|
}
|
|
808
1546
|
|
|
809
|
-
export { type AgentSelectionInput, type CreateAgentOptions, type CreateScopeOptions, type CreateSkillOptions, type CreateWorkflowOptions, type Memory, type MemorySearchRequest, type MemorySearchResult, type MemoryUpdate, ModusManagement, ModusOptions, type ToolsetInput, type TriggerInput, type UpdateAgentOptions, type UpdateScopeOptions, type UpdateSkillOptions, type UpdateWorkflowOptions, type UserFeedback, type WorkflowGraphInput };
|
|
1547
|
+
export { type AgentSelectionInput, type BulkUploadFromUrlsResult, type BulkUploadUrlsResult, 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 };
|