@nvisy/sdk 0.50.0 → 0.51.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 +65 -1
- package/dist/{client-ClO429Iv.d.ts → client-SotZfT6b.d.ts} +354 -356
- package/dist/client-SotZfT6b.d.ts.map +1 -0
- package/dist/datatypes/index.d.ts +2 -2
- package/dist/{error-DRb1GHg6.js → error-DTQ8nnQc.js} +2 -2
- package/dist/{error-DRb1GHg6.js.map → error-DTQ8nnQc.js.map} +1 -1
- package/dist/{errors-BoBDbzst.d.ts → errors-ClHc4LMK.d.ts} +2 -2
- package/dist/{errors-BoBDbzst.d.ts.map → errors-ClHc4LMK.d.ts.map} +1 -1
- package/dist/{index-QQU6h-4Y.d.ts → index-BxYFvgTy.d.ts} +4127 -3126
- package/dist/index-BxYFvgTy.d.ts.map +1 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +15 -20
- package/dist/index.js.map +1 -1
- package/dist/services/index.d.ts +2 -2
- package/dist/services/index.js +2 -2
- package/dist/{services-DUixyxF2.js → services-CFFmQDgA.js} +656 -637
- package/dist/services-CFFmQDgA.js.map +1 -0
- package/dist/standalone/index.d.ts +1 -1
- package/dist/standalone/index.js +1 -1
- package/dist/webhooks/index.d.ts +2 -2
- package/package.json +1 -1
- package/dist/client-ClO429Iv.d.ts.map +0 -1
- package/dist/index-QQU6h-4Y.d.ts.map +0 -1
- package/dist/services-DUixyxF2.js.map +0 -1
|
@@ -37,28 +37,28 @@ var Account = class {
|
|
|
37
37
|
await this.#api.DELETE("/account/");
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
|
-
* Get a public account profile by
|
|
41
|
-
* @param
|
|
40
|
+
* Get a public account profile by account id
|
|
41
|
+
* @param accountId - Account id
|
|
42
42
|
* @returns Promise that resolves with the public account details
|
|
43
43
|
* @throws {ApiError} if the request fails
|
|
44
44
|
*/
|
|
45
|
-
async getPublicAccount(
|
|
46
|
-
const { data } = await this.#api.GET("/accounts/{
|
|
45
|
+
async getPublicAccount(accountId) {
|
|
46
|
+
const { data } = await this.#api.GET("/accounts/{accountId}/", { params: { path: { accountId } } });
|
|
47
47
|
return data;
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
50
|
* Upload an account's avatar image
|
|
51
|
-
* @param
|
|
51
|
+
* @param accountId - Account id
|
|
52
52
|
* @param avatar - Avatar image to upload
|
|
53
53
|
* @returns Promise that resolves with the updated account
|
|
54
54
|
* @throws {ApiError} if the request fails
|
|
55
55
|
*/
|
|
56
|
-
async uploadAvatar(
|
|
56
|
+
async uploadAvatar(accountId, avatar) {
|
|
57
57
|
const formData = new FormData();
|
|
58
58
|
const name = avatar instanceof File ? avatar.name : "avatar";
|
|
59
59
|
formData.append("avatar", avatar, name);
|
|
60
|
-
const { data } = await this.#api.PUT("/accounts/{
|
|
61
|
-
params: { path: {
|
|
60
|
+
const { data } = await this.#api.PUT("/accounts/{accountId}/avatar/", {
|
|
61
|
+
params: { path: { accountId } },
|
|
62
62
|
body: formData,
|
|
63
63
|
bodySerializer: (formData) => formData,
|
|
64
64
|
headers: { "Content-Type": null }
|
|
@@ -67,12 +67,12 @@ var Account = class {
|
|
|
67
67
|
}
|
|
68
68
|
/**
|
|
69
69
|
* Delete an account's avatar image
|
|
70
|
-
* @param
|
|
70
|
+
* @param accountId - Account id
|
|
71
71
|
* @returns Promise that resolves when the avatar is deleted
|
|
72
72
|
* @throws {ApiError} if the request fails
|
|
73
73
|
*/
|
|
74
|
-
async deleteAvatar(
|
|
75
|
-
await this.#api.DELETE("/accounts/{
|
|
74
|
+
async deleteAvatar(accountId) {
|
|
75
|
+
await this.#api.DELETE("/accounts/{accountId}/avatar/", { params: { path: { accountId } } });
|
|
76
76
|
}
|
|
77
77
|
/**
|
|
78
78
|
* List the account's sign-in methods: its password and linked providers.
|
|
@@ -172,31 +172,31 @@ var Activities = class {
|
|
|
172
172
|
}
|
|
173
173
|
/**
|
|
174
174
|
* List activities for a workspace
|
|
175
|
-
* @param
|
|
175
|
+
* @param workspaceId - Workspace id
|
|
176
176
|
* @param query - Optional filters and pagination (type, actor, from, to,
|
|
177
177
|
* limit, after, includeCount)
|
|
178
178
|
* @returns Promise that resolves with a paginated list of activities
|
|
179
179
|
* @throws {ApiError} if the request fails
|
|
180
180
|
*/
|
|
181
|
-
async listActivities(
|
|
182
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
183
|
-
path: {
|
|
181
|
+
async listActivities(workspaceId, query) {
|
|
182
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/activities/", { params: {
|
|
183
|
+
path: { workspaceId },
|
|
184
184
|
query
|
|
185
185
|
} });
|
|
186
186
|
return data;
|
|
187
187
|
}
|
|
188
188
|
/**
|
|
189
189
|
* Export the workspace's activity log as a file.
|
|
190
|
-
* @param
|
|
190
|
+
* @param workspaceId - Workspace id
|
|
191
191
|
* @param query - Optional filters (type, actor), date window (from, to), and
|
|
192
192
|
* output format (`csv` default, or `json`)
|
|
193
193
|
* @returns Promise that resolves with the file response
|
|
194
194
|
* @throws {ApiError} if the request fails
|
|
195
195
|
*/
|
|
196
|
-
async exportActivities(
|
|
197
|
-
const { response } = await this.#api.GET("/workspaces/{
|
|
196
|
+
async exportActivities(workspaceId, query) {
|
|
197
|
+
const { response } = await this.#api.GET("/workspaces/{workspaceId}/activities/export", {
|
|
198
198
|
params: {
|
|
199
|
-
path: {
|
|
199
|
+
path: { workspaceId },
|
|
200
200
|
query
|
|
201
201
|
},
|
|
202
202
|
parseAs: "stream"
|
|
@@ -217,24 +217,24 @@ var Analytics = class {
|
|
|
217
217
|
}
|
|
218
218
|
/**
|
|
219
219
|
* Get aggregate analytics for a workspace: storage, detection health, usage.
|
|
220
|
-
* @param
|
|
220
|
+
* @param workspaceId - Workspace id
|
|
221
221
|
* @returns Promise that resolves with the workspace analytics
|
|
222
222
|
* @throws {ApiError} if the request fails
|
|
223
223
|
*/
|
|
224
|
-
async getAnalytics(
|
|
225
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
224
|
+
async getAnalytics(workspaceId) {
|
|
225
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/analytics/", { params: { path: { workspaceId } } });
|
|
226
226
|
return data;
|
|
227
227
|
}
|
|
228
228
|
/**
|
|
229
229
|
* Get a workspace's daily detection activity over a date window.
|
|
230
|
-
* @param
|
|
230
|
+
* @param workspaceId - Workspace id
|
|
231
231
|
* @param query - Optional date window (`from` / `to`, YYYY-MM-DD)
|
|
232
232
|
* @returns Promise that resolves with the detection time series
|
|
233
233
|
* @throws {ApiError} if the request fails
|
|
234
234
|
*/
|
|
235
|
-
async getDetectionTimeSeries(
|
|
236
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
237
|
-
path: {
|
|
235
|
+
async getDetectionTimeSeries(workspaceId, query) {
|
|
236
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/analytics/detections/timeseries/", { params: {
|
|
237
|
+
path: { workspaceId },
|
|
238
238
|
query
|
|
239
239
|
} });
|
|
240
240
|
return data;
|
|
@@ -306,97 +306,6 @@ var ApiTokens = class {
|
|
|
306
306
|
}
|
|
307
307
|
};
|
|
308
308
|
|
|
309
|
-
//#endregion
|
|
310
|
-
//#region src/services/assignments.ts
|
|
311
|
-
/**
|
|
312
|
-
* Service for file assignments: assigning a file to a reviewer and tracking its
|
|
313
|
-
* review status (`assigned` → `in_review` → `done`).
|
|
314
|
-
*/
|
|
315
|
-
var Assignments = class {
|
|
316
|
-
#api;
|
|
317
|
-
constructor(api) {
|
|
318
|
-
this.#api = api;
|
|
319
|
-
}
|
|
320
|
-
/**
|
|
321
|
-
* List the assignments on a file, most recent first.
|
|
322
|
-
* @param workspaceSlug - Workspace slug
|
|
323
|
-
* @param fileId - File ID
|
|
324
|
-
* @returns Promise that resolves with the file's assignments
|
|
325
|
-
* @throws {ApiError} if the request fails
|
|
326
|
-
*/
|
|
327
|
-
async listFileAssignments(workspaceSlug, fileId) {
|
|
328
|
-
const { data } = await this.#api.GET("/workspaces/{workspaceSlug}/files/{fileId}/assignments/", { params: { path: {
|
|
329
|
-
workspaceSlug,
|
|
330
|
-
fileId
|
|
331
|
-
} } });
|
|
332
|
-
return data;
|
|
333
|
-
}
|
|
334
|
-
/**
|
|
335
|
-
* Assign a file to a reviewer.
|
|
336
|
-
* @param workspaceSlug - Workspace slug
|
|
337
|
-
* @param fileId - File ID
|
|
338
|
-
* @param assignment - Assignment creation request
|
|
339
|
-
* @returns Promise that resolves with the created assignment
|
|
340
|
-
* @throws {ApiError} if the request fails
|
|
341
|
-
*/
|
|
342
|
-
async createAssignment(workspaceSlug, fileId, assignment) {
|
|
343
|
-
const { data } = await this.#api.POST("/workspaces/{workspaceSlug}/files/{fileId}/assignments/", {
|
|
344
|
-
params: { path: {
|
|
345
|
-
workspaceSlug,
|
|
346
|
-
fileId
|
|
347
|
-
} },
|
|
348
|
-
body: assignment
|
|
349
|
-
});
|
|
350
|
-
return data;
|
|
351
|
-
}
|
|
352
|
-
/**
|
|
353
|
-
* List a workspace's assignments, most recent first.
|
|
354
|
-
* @param workspaceSlug - Workspace slug
|
|
355
|
-
* @param query - Optional pagination and filters (assignee, status, fileId,
|
|
356
|
-
* limit, after)
|
|
357
|
-
* @returns Promise that resolves with a paginated list of assignments
|
|
358
|
-
* @throws {ApiError} if the request fails
|
|
359
|
-
*/
|
|
360
|
-
async listAssignments(workspaceSlug, query) {
|
|
361
|
-
const { data } = await this.#api.GET("/workspaces/{workspaceSlug}/assignments/", { params: {
|
|
362
|
-
path: { workspaceSlug },
|
|
363
|
-
query
|
|
364
|
-
} });
|
|
365
|
-
return data;
|
|
366
|
-
}
|
|
367
|
-
/**
|
|
368
|
-
* Update an assignment (e.g. change its review status).
|
|
369
|
-
* @param workspaceSlug - Workspace slug
|
|
370
|
-
* @param assignmentId - Assignment ID
|
|
371
|
-
* @param updates - Assignment update request
|
|
372
|
-
* @returns Promise that resolves with the updated assignment
|
|
373
|
-
* @throws {ApiError} if the request fails
|
|
374
|
-
*/
|
|
375
|
-
async updateAssignment(workspaceSlug, assignmentId, updates) {
|
|
376
|
-
const { data } = await this.#api.PATCH("/workspaces/{workspaceSlug}/assignments/{assignmentId}/", {
|
|
377
|
-
params: { path: {
|
|
378
|
-
workspaceSlug,
|
|
379
|
-
assignmentId
|
|
380
|
-
} },
|
|
381
|
-
body: updates
|
|
382
|
-
});
|
|
383
|
-
return data;
|
|
384
|
-
}
|
|
385
|
-
/**
|
|
386
|
-
* Delete an assignment.
|
|
387
|
-
* @param workspaceSlug - Workspace slug
|
|
388
|
-
* @param assignmentId - Assignment ID
|
|
389
|
-
* @returns Promise that resolves when the assignment is deleted
|
|
390
|
-
* @throws {ApiError} if the request fails
|
|
391
|
-
*/
|
|
392
|
-
async deleteAssignment(workspaceSlug, assignmentId) {
|
|
393
|
-
await this.#api.DELETE("/workspaces/{workspaceSlug}/assignments/{assignmentId}/", { params: { path: {
|
|
394
|
-
workspaceSlug,
|
|
395
|
-
assignmentId
|
|
396
|
-
} } });
|
|
397
|
-
}
|
|
398
|
-
};
|
|
399
|
-
|
|
400
309
|
//#endregion
|
|
401
310
|
//#region src/services/auth.ts
|
|
402
311
|
/**
|
|
@@ -481,12 +390,13 @@ var Auth = class {
|
|
|
481
390
|
};
|
|
482
391
|
|
|
483
392
|
//#endregion
|
|
484
|
-
//#region src/services/
|
|
393
|
+
//#region src/services/capabilities.ts
|
|
485
394
|
/**
|
|
486
|
-
* Service for reading the deployment's
|
|
487
|
-
*
|
|
395
|
+
* Service for reading the deployment's capabilities: the label taxonomy, the
|
|
396
|
+
* registered recognizers, the connectors it can create, and the auth methods
|
|
397
|
+
* it offers. Read-only; served by the `/capabilities/*` endpoints.
|
|
488
398
|
*/
|
|
489
|
-
var
|
|
399
|
+
var Capabilities = class {
|
|
490
400
|
#api;
|
|
491
401
|
constructor(api) {
|
|
492
402
|
this.#api = api;
|
|
@@ -496,7 +406,7 @@ var Catalog = class {
|
|
|
496
406
|
* @returns Promise that resolves with the label catalog.
|
|
497
407
|
*/
|
|
498
408
|
async listLabels() {
|
|
499
|
-
const { data } = await this.#api.GET("/
|
|
409
|
+
const { data } = await this.#api.GET("/capabilities/labels/");
|
|
500
410
|
return data;
|
|
501
411
|
}
|
|
502
412
|
/**
|
|
@@ -504,7 +414,7 @@ var Catalog = class {
|
|
|
504
414
|
* @returns Promise that resolves with the recognizer catalog.
|
|
505
415
|
*/
|
|
506
416
|
async listRecognizers() {
|
|
507
|
-
const { data } = await this.#api.GET("/
|
|
417
|
+
const { data } = await this.#api.GET("/capabilities/recognizers/");
|
|
508
418
|
return data;
|
|
509
419
|
}
|
|
510
420
|
/**
|
|
@@ -515,177 +425,20 @@ var Catalog = class {
|
|
|
515
425
|
* credentials and are always available. Use it to render the connect UI
|
|
516
426
|
* without probing.
|
|
517
427
|
*
|
|
518
|
-
* @returns Promise that resolves with the connector
|
|
428
|
+
* @returns Promise that resolves with the connector capabilities.
|
|
519
429
|
*/
|
|
520
430
|
async listConnectors() {
|
|
521
|
-
const { data } = await this.#api.GET("/
|
|
522
|
-
return data;
|
|
523
|
-
}
|
|
524
|
-
};
|
|
525
|
-
|
|
526
|
-
//#endregion
|
|
527
|
-
//#region src/services/sse.ts
|
|
528
|
-
/** Parse one already-split frame (its lines) into an event, or null if empty. */
|
|
529
|
-
function parseFrame(frame) {
|
|
530
|
-
let event = "message";
|
|
531
|
-
const data = [];
|
|
532
|
-
for (const line of frame.split("\n")) {
|
|
533
|
-
if (line === "" || line.startsWith(":")) continue;
|
|
534
|
-
const colon = line.indexOf(":");
|
|
535
|
-
const field = colon === -1 ? line : line.slice(0, colon);
|
|
536
|
-
let value = colon === -1 ? "" : line.slice(colon + 1);
|
|
537
|
-
if (value.startsWith(" ")) value = value.slice(1);
|
|
538
|
-
if (field === "event") event = value;
|
|
539
|
-
else if (field === "data") data.push(value);
|
|
540
|
-
}
|
|
541
|
-
if (data.length === 0) return null;
|
|
542
|
-
return {
|
|
543
|
-
event,
|
|
544
|
-
data: data.join("\n")
|
|
545
|
-
};
|
|
546
|
-
}
|
|
547
|
-
/**
|
|
548
|
-
* Decode a byte stream into SSE events.
|
|
549
|
-
*
|
|
550
|
-
* @param stream - the response body, a stream of UTF-8 bytes
|
|
551
|
-
* @yields each complete SSE event as it arrives
|
|
552
|
-
*/
|
|
553
|
-
async function* parseSseStream(stream) {
|
|
554
|
-
const decoder = new TextDecoder();
|
|
555
|
-
let buffer = "";
|
|
556
|
-
const reader = stream.getReader();
|
|
557
|
-
try {
|
|
558
|
-
while (true) {
|
|
559
|
-
const { done, value } = await reader.read();
|
|
560
|
-
if (done) break;
|
|
561
|
-
buffer += decoder.decode(value, { stream: true });
|
|
562
|
-
buffer = buffer.replace(/\r\n|\r/g, "\n");
|
|
563
|
-
let sep = buffer.indexOf("\n\n");
|
|
564
|
-
while (sep !== -1) {
|
|
565
|
-
const frame = buffer.slice(0, sep);
|
|
566
|
-
buffer = buffer.slice(sep + 2);
|
|
567
|
-
const parsed = parseFrame(frame);
|
|
568
|
-
if (parsed) yield parsed;
|
|
569
|
-
sep = buffer.indexOf("\n\n");
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
buffer += decoder.decode();
|
|
573
|
-
const parsed = parseFrame(buffer.replace(/\r\n|\r/g, "\n"));
|
|
574
|
-
if (parsed) yield parsed;
|
|
575
|
-
} finally {
|
|
576
|
-
reader.releaseLock();
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
//#endregion
|
|
581
|
-
//#region src/services/chat.ts
|
|
582
|
-
/**
|
|
583
|
-
* Service for the workspace assistant chat: sessions and streamed messages.
|
|
584
|
-
*/
|
|
585
|
-
var Chat = class {
|
|
586
|
-
#api;
|
|
587
|
-
constructor(api) {
|
|
588
|
-
this.#api = api;
|
|
589
|
-
}
|
|
590
|
-
/**
|
|
591
|
-
* List the workspace's chat sessions, most recently active first.
|
|
592
|
-
* @param workspaceSlug - Workspace slug
|
|
593
|
-
* @param query - Optional pagination (limit, after)
|
|
594
|
-
* @returns Promise that resolves with a paginated list of chat sessions
|
|
595
|
-
* @throws {ApiError} if the request fails
|
|
596
|
-
*/
|
|
597
|
-
async listSessions(workspaceSlug, query) {
|
|
598
|
-
const { data } = await this.#api.GET("/workspaces/{workspaceSlug}/chat/sessions/", { params: {
|
|
599
|
-
path: { workspaceSlug },
|
|
600
|
-
query
|
|
601
|
-
} });
|
|
431
|
+
const { data } = await this.#api.GET("/capabilities/connectors/");
|
|
602
432
|
return data;
|
|
603
433
|
}
|
|
604
434
|
/**
|
|
605
|
-
*
|
|
606
|
-
* @
|
|
607
|
-
* @param session - Session creation request
|
|
608
|
-
* @returns Promise that resolves with the created chat session
|
|
609
|
-
* @throws {ApiError} if the request fails
|
|
610
|
-
*/
|
|
611
|
-
async createSession(workspaceSlug, session) {
|
|
612
|
-
const { data } = await this.#api.POST("/workspaces/{workspaceSlug}/chat/sessions/", {
|
|
613
|
-
params: { path: { workspaceSlug } },
|
|
614
|
-
body: session
|
|
615
|
-
});
|
|
616
|
-
return data;
|
|
617
|
-
}
|
|
618
|
-
/**
|
|
619
|
-
* Soft-delete a chat session.
|
|
620
|
-
* @param workspaceSlug - Workspace slug
|
|
621
|
-
* @param sessionId - Session ID
|
|
622
|
-
* @throws {ApiError} if the request fails
|
|
623
|
-
*/
|
|
624
|
-
async deleteSession(workspaceSlug, sessionId) {
|
|
625
|
-
await this.#api.DELETE("/workspaces/{workspaceSlug}/chat/sessions/{sessionId}/", { params: { path: {
|
|
626
|
-
workspaceSlug,
|
|
627
|
-
sessionId
|
|
628
|
-
} } });
|
|
629
|
-
}
|
|
630
|
-
/**
|
|
631
|
-
* List a session's messages in chronological order.
|
|
632
|
-
* @param workspaceSlug - Workspace slug
|
|
633
|
-
* @param sessionId - Session ID
|
|
634
|
-
* @returns Promise that resolves with the session's messages
|
|
635
|
-
* @throws {ApiError} if the request fails
|
|
435
|
+
* List which authentication methods this deployment offers.
|
|
436
|
+
* @returns Promise that resolves with the auth capabilities.
|
|
636
437
|
*/
|
|
637
|
-
async
|
|
638
|
-
const { data } = await this.#api.GET("/
|
|
639
|
-
workspaceSlug,
|
|
640
|
-
sessionId
|
|
641
|
-
} } });
|
|
438
|
+
async getAuthCapabilities() {
|
|
439
|
+
const { data } = await this.#api.GET("/capabilities/auth/");
|
|
642
440
|
return data;
|
|
643
441
|
}
|
|
644
|
-
/**
|
|
645
|
-
* Open the raw Server-Sent Events stream of the assistant's reply.
|
|
646
|
-
*
|
|
647
|
-
* Returns the underlying `Response` so callers can handle the
|
|
648
|
-
* `text/event-stream` body themselves. Most callers want
|
|
649
|
-
* {@link streamMessage}, which parses each frame into a typed
|
|
650
|
-
* {@link ChatToken}.
|
|
651
|
-
*
|
|
652
|
-
* @param workspaceSlug - Workspace slug
|
|
653
|
-
* @param sessionId - Session ID
|
|
654
|
-
* @param message - The message to send
|
|
655
|
-
* @returns Promise that resolves with the event-stream response
|
|
656
|
-
* @throws {ApiError} if the request fails
|
|
657
|
-
*/
|
|
658
|
-
async sendMessage(workspaceSlug, sessionId, message) {
|
|
659
|
-
const { response } = await this.#api.POST("/workspaces/{workspaceSlug}/chat/sessions/{sessionId}/messages/", {
|
|
660
|
-
params: { path: {
|
|
661
|
-
workspaceSlug,
|
|
662
|
-
sessionId
|
|
663
|
-
} },
|
|
664
|
-
body: message,
|
|
665
|
-
parseAs: "stream"
|
|
666
|
-
});
|
|
667
|
-
return response;
|
|
668
|
-
}
|
|
669
|
-
/**
|
|
670
|
-
* Send a message and stream the assistant's reply as Server-Sent Events.
|
|
671
|
-
*
|
|
672
|
-
* Yields each {@link ChatToken} delta as it arrives, until the reply ends.
|
|
673
|
-
* Break out of the loop to stop reading. For the raw response, use
|
|
674
|
-
* {@link sendMessage}.
|
|
675
|
-
*
|
|
676
|
-
* @param workspaceSlug - Workspace slug
|
|
677
|
-
* @param sessionId - Session ID
|
|
678
|
-
* @param message - The message to send
|
|
679
|
-
* @yields each {@link ChatToken} delta as it arrives
|
|
680
|
-
* @throws {ApiError} if the request fails to open
|
|
681
|
-
* @throws {NvisyError} if the response has no readable body
|
|
682
|
-
*/
|
|
683
|
-
async *streamMessage(workspaceSlug, sessionId, message) {
|
|
684
|
-
const response = await this.sendMessage(workspaceSlug, sessionId, message);
|
|
685
|
-
if (!response.body) throw new NvisyError("Chat stream response has no body");
|
|
686
|
-
for await (const event of parseSseStream(response.body)) if (event.event === "token") yield JSON.parse(event.data);
|
|
687
|
-
else if (event.event === "error") throw new NvisyError(event.data);
|
|
688
|
-
}
|
|
689
442
|
};
|
|
690
443
|
|
|
691
444
|
//#endregion
|
|
@@ -700,58 +453,58 @@ var Connections = class {
|
|
|
700
453
|
}
|
|
701
454
|
/**
|
|
702
455
|
* List connections in a workspace
|
|
703
|
-
* @param
|
|
456
|
+
* @param workspaceId - Workspace id
|
|
704
457
|
* @param query - Optional query parameters (provider, limit, after)
|
|
705
458
|
* @returns Promise that resolves with a paginated list of connections
|
|
706
459
|
* @throws {ApiError} if the request fails
|
|
707
460
|
*/
|
|
708
|
-
async listConnections(
|
|
709
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
710
|
-
path: {
|
|
461
|
+
async listConnections(workspaceId, query) {
|
|
462
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/connections/", { params: {
|
|
463
|
+
path: { workspaceId },
|
|
711
464
|
query
|
|
712
465
|
} });
|
|
713
466
|
return data;
|
|
714
467
|
}
|
|
715
468
|
/**
|
|
716
469
|
* Create a connection in a workspace
|
|
717
|
-
* @param
|
|
470
|
+
* @param workspaceId - Workspace id
|
|
718
471
|
* @param connection - Connection creation request
|
|
719
472
|
* @returns Promise that resolves with the created connection
|
|
720
473
|
* @throws {ApiError} if the request fails
|
|
721
474
|
*/
|
|
722
|
-
async createConnection(
|
|
723
|
-
const { data } = await this.#api.POST("/workspaces/{
|
|
724
|
-
params: { path: {
|
|
475
|
+
async createConnection(workspaceId, connection) {
|
|
476
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/connections/", {
|
|
477
|
+
params: { path: { workspaceId } },
|
|
725
478
|
body: connection
|
|
726
479
|
});
|
|
727
480
|
return data;
|
|
728
481
|
}
|
|
729
482
|
/**
|
|
730
483
|
* Get connection details by ID
|
|
731
|
-
* @param
|
|
484
|
+
* @param workspaceId - Workspace id
|
|
732
485
|
* @param connectionId - Connection ID
|
|
733
486
|
* @returns Promise that resolves with the connection details
|
|
734
487
|
* @throws {ApiError} if the request fails
|
|
735
488
|
*/
|
|
736
|
-
async getConnection(
|
|
737
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
738
|
-
|
|
489
|
+
async getConnection(workspaceId, connectionId) {
|
|
490
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/connections/{connectionId}/", { params: { path: {
|
|
491
|
+
workspaceId,
|
|
739
492
|
connectionId
|
|
740
493
|
} } });
|
|
741
494
|
return data;
|
|
742
495
|
}
|
|
743
496
|
/**
|
|
744
497
|
* Update a connection
|
|
745
|
-
* @param
|
|
498
|
+
* @param workspaceId - Workspace id
|
|
746
499
|
* @param connectionId - Connection ID
|
|
747
500
|
* @param updates - Connection update request
|
|
748
501
|
* @returns Promise that resolves with the updated connection
|
|
749
502
|
* @throws {ApiError} if the request fails
|
|
750
503
|
*/
|
|
751
|
-
async updateConnection(
|
|
752
|
-
const { data } = await this.#api.PATCH("/workspaces/{
|
|
504
|
+
async updateConnection(workspaceId, connectionId, updates) {
|
|
505
|
+
const { data } = await this.#api.PATCH("/workspaces/{workspaceId}/connections/{connectionId}/", {
|
|
753
506
|
params: { path: {
|
|
754
|
-
|
|
507
|
+
workspaceId,
|
|
755
508
|
connectionId
|
|
756
509
|
} },
|
|
757
510
|
body: updates
|
|
@@ -760,27 +513,27 @@ var Connections = class {
|
|
|
760
513
|
}
|
|
761
514
|
/**
|
|
762
515
|
* Delete a connection
|
|
763
|
-
* @param
|
|
516
|
+
* @param workspaceId - Workspace id
|
|
764
517
|
* @param connectionId - Connection ID
|
|
765
518
|
* @returns Promise that resolves when the connection is deleted
|
|
766
519
|
* @throws {ApiError} if the request fails
|
|
767
520
|
*/
|
|
768
|
-
async deleteConnection(
|
|
769
|
-
await this.#api.DELETE("/workspaces/{
|
|
770
|
-
|
|
521
|
+
async deleteConnection(workspaceId, connectionId) {
|
|
522
|
+
await this.#api.DELETE("/workspaces/{workspaceId}/connections/{connectionId}/", { params: { path: {
|
|
523
|
+
workspaceId,
|
|
771
524
|
connectionId
|
|
772
525
|
} } });
|
|
773
526
|
}
|
|
774
527
|
/**
|
|
775
528
|
* Verify a connection's configuration and credentials
|
|
776
|
-
* @param
|
|
529
|
+
* @param workspaceId - Workspace id
|
|
777
530
|
* @param connectionId - Connection ID
|
|
778
531
|
* @returns Promise that resolves with the verification result
|
|
779
532
|
* @throws {ApiError} if the request fails
|
|
780
533
|
*/
|
|
781
|
-
async verifyConnection(
|
|
782
|
-
const { data } = await this.#api.POST("/workspaces/{
|
|
783
|
-
|
|
534
|
+
async verifyConnection(workspaceId, connectionId) {
|
|
535
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/connections/{connectionId}/verify/", { params: { path: {
|
|
536
|
+
workspaceId,
|
|
784
537
|
connectionId
|
|
785
538
|
} } });
|
|
786
539
|
return data;
|
|
@@ -792,16 +545,16 @@ var Connections = class {
|
|
|
792
545
|
* provider redirects back and the connection is created. Navigate the
|
|
793
546
|
* browser to the URL (a full-page redirect, not a fetch) to continue.
|
|
794
547
|
*
|
|
795
|
-
* @param
|
|
548
|
+
* @param workspaceId - Workspace id
|
|
796
549
|
* @param provider - The file-service provider to connect
|
|
797
550
|
* @param request - Display name for the connection and optional sync root
|
|
798
551
|
* @returns Promise that resolves with the provider authorize URL
|
|
799
552
|
* @throws {ApiError} if the request fails
|
|
800
553
|
*/
|
|
801
|
-
async startFileServiceOAuth(
|
|
802
|
-
const { data } = await this.#api.POST("/workspaces/{
|
|
554
|
+
async startFileServiceOAuth(workspaceId, provider, request) {
|
|
555
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/connections/oauth/{provider}/start/", {
|
|
803
556
|
params: { path: {
|
|
804
|
-
|
|
557
|
+
workspaceId,
|
|
805
558
|
provider
|
|
806
559
|
} },
|
|
807
560
|
body: request
|
|
@@ -815,16 +568,16 @@ var Connections = class {
|
|
|
815
568
|
* already-imported files are skipped. Returns the created sync — poll it for
|
|
816
569
|
* completion.
|
|
817
570
|
*
|
|
818
|
-
* @param
|
|
571
|
+
* @param workspaceId - Workspace id
|
|
819
572
|
* @param connectionId - Connection ID
|
|
820
573
|
* @param request - The picker-selected files to import
|
|
821
574
|
* @returns Promise that resolves with the created connection sync
|
|
822
575
|
* @throws {ApiError} if the request fails
|
|
823
576
|
*/
|
|
824
|
-
async importFiles(
|
|
825
|
-
const { data } = await this.#api.POST("/workspaces/{
|
|
577
|
+
async importFiles(workspaceId, connectionId, request) {
|
|
578
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/connections/{connectionId}/import/", {
|
|
826
579
|
params: { path: {
|
|
827
|
-
|
|
580
|
+
workspaceId,
|
|
828
581
|
connectionId
|
|
829
582
|
} },
|
|
830
583
|
body: request
|
|
@@ -838,16 +591,16 @@ var Connections = class {
|
|
|
838
591
|
* file, never overwriting the source. Returns the created sync — poll it for
|
|
839
592
|
* completion.
|
|
840
593
|
*
|
|
841
|
-
* @param
|
|
594
|
+
* @param workspaceId - Workspace id
|
|
842
595
|
* @param connectionId - Connection ID
|
|
843
596
|
* @param request - The workspace file ids to export
|
|
844
597
|
* @returns Promise that resolves with the created connection sync
|
|
845
598
|
* @throws {ApiError} if the request fails
|
|
846
599
|
*/
|
|
847
|
-
async exportFiles(
|
|
848
|
-
const { data } = await this.#api.POST("/workspaces/{
|
|
600
|
+
async exportFiles(workspaceId, connectionId, request) {
|
|
601
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/connections/{connectionId}/export/", {
|
|
849
602
|
params: { path: {
|
|
850
|
-
|
|
603
|
+
workspaceId,
|
|
851
604
|
connectionId
|
|
852
605
|
} },
|
|
853
606
|
body: request
|
|
@@ -861,16 +614,16 @@ var Connections = class {
|
|
|
861
614
|
* minted from the connection's stored credentials and is short-lived; the
|
|
862
615
|
* refresh token is never returned.
|
|
863
616
|
*
|
|
864
|
-
* @param
|
|
617
|
+
* @param workspaceId - Workspace id
|
|
865
618
|
* @param connectionId - Connection ID
|
|
866
619
|
* @param request - Optional picker resource (defaults to the connection's)
|
|
867
620
|
* @returns Promise that resolves with the short-lived picker token
|
|
868
621
|
* @throws {ApiError} if the request fails
|
|
869
622
|
*/
|
|
870
|
-
async getPickerToken(
|
|
871
|
-
const { data } = await this.#api.POST("/workspaces/{
|
|
623
|
+
async getPickerToken(workspaceId, connectionId, request = {}) {
|
|
624
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/connections/{connectionId}/picker-token/", {
|
|
872
625
|
params: { path: {
|
|
873
|
-
|
|
626
|
+
workspaceId,
|
|
874
627
|
connectionId
|
|
875
628
|
} },
|
|
876
629
|
body: request
|
|
@@ -879,6 +632,60 @@ var Connections = class {
|
|
|
879
632
|
}
|
|
880
633
|
};
|
|
881
634
|
|
|
635
|
+
//#endregion
|
|
636
|
+
//#region src/services/sse.ts
|
|
637
|
+
/** Parse one already-split frame (its lines) into an event, or null if empty. */
|
|
638
|
+
function parseFrame(frame) {
|
|
639
|
+
let event = "message";
|
|
640
|
+
const data = [];
|
|
641
|
+
for (const line of frame.split("\n")) {
|
|
642
|
+
if (line === "" || line.startsWith(":")) continue;
|
|
643
|
+
const colon = line.indexOf(":");
|
|
644
|
+
const field = colon === -1 ? line : line.slice(0, colon);
|
|
645
|
+
let value = colon === -1 ? "" : line.slice(colon + 1);
|
|
646
|
+
if (value.startsWith(" ")) value = value.slice(1);
|
|
647
|
+
if (field === "event") event = value;
|
|
648
|
+
else if (field === "data") data.push(value);
|
|
649
|
+
}
|
|
650
|
+
if (data.length === 0) return null;
|
|
651
|
+
return {
|
|
652
|
+
event,
|
|
653
|
+
data: data.join("\n")
|
|
654
|
+
};
|
|
655
|
+
}
|
|
656
|
+
/**
|
|
657
|
+
* Decode a byte stream into SSE events.
|
|
658
|
+
*
|
|
659
|
+
* @param stream - the response body, a stream of UTF-8 bytes
|
|
660
|
+
* @yields each complete SSE event as it arrives
|
|
661
|
+
*/
|
|
662
|
+
async function* parseSseStream(stream) {
|
|
663
|
+
const decoder = new TextDecoder();
|
|
664
|
+
let buffer = "";
|
|
665
|
+
const reader = stream.getReader();
|
|
666
|
+
try {
|
|
667
|
+
while (true) {
|
|
668
|
+
const { done, value } = await reader.read();
|
|
669
|
+
if (done) break;
|
|
670
|
+
buffer += decoder.decode(value, { stream: true });
|
|
671
|
+
buffer = buffer.replace(/\r\n|\r/g, "\n");
|
|
672
|
+
let sep = buffer.indexOf("\n\n");
|
|
673
|
+
while (sep !== -1) {
|
|
674
|
+
const frame = buffer.slice(0, sep);
|
|
675
|
+
buffer = buffer.slice(sep + 2);
|
|
676
|
+
const parsed = parseFrame(frame);
|
|
677
|
+
if (parsed) yield parsed;
|
|
678
|
+
sep = buffer.indexOf("\n\n");
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
buffer += decoder.decode();
|
|
682
|
+
const parsed = parseFrame(buffer.replace(/\r\n|\r/g, "\n"));
|
|
683
|
+
if (parsed) yield parsed;
|
|
684
|
+
} finally {
|
|
685
|
+
reader.releaseLock();
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
|
|
882
689
|
//#endregion
|
|
883
690
|
//#region src/services/detections.ts
|
|
884
691
|
/**
|
|
@@ -892,33 +699,33 @@ var Detections = class {
|
|
|
892
699
|
}
|
|
893
700
|
/**
|
|
894
701
|
* List all detections in a workspace
|
|
895
|
-
* @param
|
|
702
|
+
* @param workspaceId - Workspace id
|
|
896
703
|
* @param query - Optional pagination and filters (status, fileId,
|
|
897
704
|
* pipelineId, triggerType, triggeredBy, limit, after)
|
|
898
705
|
* @returns Promise that resolves with a paginated list of detections
|
|
899
706
|
* @throws {ApiError} if the request fails
|
|
900
707
|
*/
|
|
901
|
-
async listDetections(
|
|
902
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
903
|
-
path: {
|
|
708
|
+
async listDetections(workspaceId, query) {
|
|
709
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/pipelines/detections/", { params: {
|
|
710
|
+
path: { workspaceId },
|
|
904
711
|
query
|
|
905
712
|
} });
|
|
906
713
|
return data;
|
|
907
714
|
}
|
|
908
715
|
/**
|
|
909
716
|
* List detections for a specific pipeline
|
|
910
|
-
* @param
|
|
911
|
-
* @param
|
|
717
|
+
* @param workspaceId - Workspace id
|
|
718
|
+
* @param pipelineId - Pipeline id
|
|
912
719
|
* @param query - Optional pagination and filters (status, fileId,
|
|
913
720
|
* triggerType, triggeredBy, limit, after)
|
|
914
721
|
* @returns Promise that resolves with a paginated list of detections
|
|
915
722
|
* @throws {ApiError} if the request fails
|
|
916
723
|
*/
|
|
917
|
-
async listPipelineDetections(
|
|
918
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
724
|
+
async listPipelineDetections(workspaceId, pipelineId, query) {
|
|
725
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/pipelines/{pipelineId}/detections/", { params: {
|
|
919
726
|
path: {
|
|
920
|
-
|
|
921
|
-
|
|
727
|
+
workspaceId,
|
|
728
|
+
pipelineId
|
|
922
729
|
},
|
|
923
730
|
query
|
|
924
731
|
} });
|
|
@@ -926,46 +733,60 @@ var Detections = class {
|
|
|
926
733
|
}
|
|
927
734
|
/**
|
|
928
735
|
* Start a new detection over a file for a pipeline
|
|
929
|
-
* @param
|
|
930
|
-
* @param
|
|
736
|
+
* @param workspaceId - Workspace id
|
|
737
|
+
* @param pipelineId - Pipeline id
|
|
931
738
|
* @param detection - Detection creation request
|
|
932
739
|
* @returns Promise that resolves with the created detection
|
|
933
740
|
* @throws {ApiError} if the request fails
|
|
934
741
|
*/
|
|
935
|
-
async createDetection(
|
|
936
|
-
const { data } = await this.#api.POST("/workspaces/{
|
|
742
|
+
async createDetection(workspaceId, pipelineId, detection) {
|
|
743
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/pipelines/{pipelineId}/detections/", {
|
|
937
744
|
params: { path: {
|
|
938
|
-
|
|
939
|
-
|
|
745
|
+
workspaceId,
|
|
746
|
+
pipelineId
|
|
940
747
|
} },
|
|
941
748
|
body: detection
|
|
942
749
|
});
|
|
943
750
|
return data;
|
|
944
751
|
}
|
|
945
752
|
/**
|
|
753
|
+
* Start an ad-hoc detection over a document without a saved pipeline.
|
|
754
|
+
* @param workspaceId - Workspace id
|
|
755
|
+
* @param detection - Ad-hoc detection creation request
|
|
756
|
+
* @returns Promise that resolves with the created detection
|
|
757
|
+
* @throws {ApiError} if the request fails
|
|
758
|
+
*/
|
|
759
|
+
async createAdhocDetection(workspaceId, detection) {
|
|
760
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/detections/", {
|
|
761
|
+
params: { path: { workspaceId } },
|
|
762
|
+
body: detection
|
|
763
|
+
});
|
|
764
|
+
return data;
|
|
765
|
+
}
|
|
766
|
+
/**
|
|
946
767
|
* Get detection details by ID
|
|
947
|
-
* @param
|
|
768
|
+
* @param workspaceId - Workspace id
|
|
948
769
|
* @param detectionId - Detection ID
|
|
949
770
|
* @returns Promise that resolves with the detection details
|
|
950
771
|
* @throws {ApiError} if the request fails
|
|
951
772
|
*/
|
|
952
|
-
async getDetection(
|
|
953
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
954
|
-
|
|
773
|
+
async getDetection(workspaceId, detectionId) {
|
|
774
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/detections/{detectionId}/", { params: { path: {
|
|
775
|
+
workspaceId,
|
|
955
776
|
detectionId
|
|
956
777
|
} } });
|
|
957
778
|
return data;
|
|
958
779
|
}
|
|
959
780
|
/**
|
|
960
781
|
* Get a detection's analysis (audit)
|
|
961
|
-
* @param
|
|
782
|
+
* @param workspaceId - Workspace id
|
|
962
783
|
* @param detectionId - Detection ID
|
|
963
784
|
* @returns Promise that resolves with the audit
|
|
964
785
|
* @throws {ApiError} if the request fails
|
|
965
786
|
*/
|
|
966
|
-
async getAnalysis(
|
|
967
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
968
|
-
|
|
787
|
+
async getAnalysis(workspaceId, detectionId) {
|
|
788
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/detections/{detectionId}/analysis/", { params: { path: {
|
|
789
|
+
workspaceId,
|
|
969
790
|
detectionId
|
|
970
791
|
} } });
|
|
971
792
|
return data;
|
|
@@ -978,14 +799,14 @@ var Detections = class {
|
|
|
978
799
|
* can search the extracted content and add entities the analysis missed. A
|
|
979
800
|
* detection whose analysis ran no enricher has no intermediates and 404s.
|
|
980
801
|
*
|
|
981
|
-
* @param
|
|
802
|
+
* @param workspaceId - Workspace id
|
|
982
803
|
* @param detectionId - Detection ID
|
|
983
804
|
* @returns Promise that resolves with the artifact set
|
|
984
805
|
* @throws {ApiError} if the request fails (404 when there are none)
|
|
985
806
|
*/
|
|
986
|
-
async getIntermediates(
|
|
987
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
988
|
-
|
|
807
|
+
async getIntermediates(workspaceId, detectionId) {
|
|
808
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/detections/{detectionId}/intermediates/", { params: { path: {
|
|
809
|
+
workspaceId,
|
|
989
810
|
detectionId
|
|
990
811
|
} } });
|
|
991
812
|
return data;
|
|
@@ -996,17 +817,17 @@ var Detections = class {
|
|
|
996
817
|
* `format` is `csv` (default) — a zip of entities.csv, provenance.csv, and
|
|
997
818
|
* reviews.csv — or `json`, a pretty-printed JSON file.
|
|
998
819
|
*
|
|
999
|
-
* @param
|
|
820
|
+
* @param workspaceId - Workspace id
|
|
1000
821
|
* @param detectionId - Detection ID
|
|
1001
822
|
* @param query - Optional output format (`csv` default, or `json`)
|
|
1002
823
|
* @returns Promise that resolves with the file response
|
|
1003
824
|
* @throws {ApiError} if the request fails
|
|
1004
825
|
*/
|
|
1005
|
-
async downloadAudit(
|
|
1006
|
-
const { response } = await this.#api.GET("/workspaces/{
|
|
826
|
+
async downloadAudit(workspaceId, detectionId, query) {
|
|
827
|
+
const { response } = await this.#api.GET("/workspaces/{workspaceId}/detections/{detectionId}/audit/", {
|
|
1007
828
|
params: {
|
|
1008
829
|
path: {
|
|
1009
|
-
|
|
830
|
+
workspaceId,
|
|
1010
831
|
detectionId
|
|
1011
832
|
},
|
|
1012
833
|
query
|
|
@@ -1023,15 +844,15 @@ var Detections = class {
|
|
|
1023
844
|
* {@link streamEvents}, which parses each frame into a typed
|
|
1024
845
|
* {@link DetectionStatusEvent}.
|
|
1025
846
|
*
|
|
1026
|
-
* @param
|
|
847
|
+
* @param workspaceId - Workspace id
|
|
1027
848
|
* @param detectionId - Detection ID
|
|
1028
849
|
* @returns Promise that resolves with the event-stream response
|
|
1029
850
|
* @throws {ApiError} if the request fails
|
|
1030
851
|
*/
|
|
1031
|
-
async events(
|
|
1032
|
-
const { response } = await this.#api.GET("/workspaces/{
|
|
852
|
+
async events(workspaceId, detectionId) {
|
|
853
|
+
const { response } = await this.#api.GET("/workspaces/{workspaceId}/detections/{detectionId}/events/", {
|
|
1033
854
|
params: { path: {
|
|
1034
|
-
|
|
855
|
+
workspaceId,
|
|
1035
856
|
detectionId
|
|
1036
857
|
} },
|
|
1037
858
|
parseAs: "stream"
|
|
@@ -1045,29 +866,29 @@ var Detections = class {
|
|
|
1045
866
|
* once the detection settles. Break out of the loop to close the stream
|
|
1046
867
|
* early. For the raw response, use {@link events}.
|
|
1047
868
|
*
|
|
1048
|
-
* @param
|
|
869
|
+
* @param workspaceId - Workspace id
|
|
1049
870
|
* @param detectionId - Detection ID
|
|
1050
871
|
* @yields each {@link DetectionStatusEvent} as it arrives
|
|
1051
872
|
* @throws {ApiError} if the request fails to open
|
|
1052
873
|
* @throws {NvisyError} if the response has no readable body
|
|
1053
874
|
*/
|
|
1054
|
-
async *streamEvents(
|
|
1055
|
-
const response = await this.events(
|
|
875
|
+
async *streamEvents(workspaceId, detectionId) {
|
|
876
|
+
const response = await this.events(workspaceId, detectionId);
|
|
1056
877
|
if (!response.body) throw new NvisyError("Event stream response has no body");
|
|
1057
878
|
for await (const event of parseSseStream(response.body)) if (event.event === "status") yield JSON.parse(event.data);
|
|
1058
879
|
}
|
|
1059
880
|
/**
|
|
1060
881
|
* List the redactions produced from a detection
|
|
1061
|
-
* @param
|
|
882
|
+
* @param workspaceId - Workspace id
|
|
1062
883
|
* @param detectionId - Detection ID
|
|
1063
884
|
* @param query - Optional pagination (limit, after)
|
|
1064
885
|
* @returns Promise that resolves with a paginated list of redactions
|
|
1065
886
|
* @throws {ApiError} if the request fails
|
|
1066
887
|
*/
|
|
1067
|
-
async listRedactions(
|
|
1068
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
888
|
+
async listRedactions(workspaceId, detectionId, query) {
|
|
889
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/detections/{detectionId}/redactions/", { params: {
|
|
1069
890
|
path: {
|
|
1070
|
-
|
|
891
|
+
workspaceId,
|
|
1071
892
|
detectionId
|
|
1072
893
|
},
|
|
1073
894
|
query
|
|
@@ -1076,16 +897,16 @@ var Detections = class {
|
|
|
1076
897
|
}
|
|
1077
898
|
/**
|
|
1078
899
|
* Redact a detection, producing a redaction result
|
|
1079
|
-
* @param
|
|
900
|
+
* @param workspaceId - Workspace id
|
|
1080
901
|
* @param detectionId - Detection ID
|
|
1081
902
|
* @param redaction - Redaction request (optional reviewer edits)
|
|
1082
903
|
* @returns Promise that resolves with the created redaction result
|
|
1083
904
|
* @throws {ApiError} if the request fails
|
|
1084
905
|
*/
|
|
1085
|
-
async createRedaction(
|
|
1086
|
-
const { data } = await this.#api.POST("/workspaces/{
|
|
906
|
+
async createRedaction(workspaceId, detectionId, redaction) {
|
|
907
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/detections/{detectionId}/redactions/", {
|
|
1087
908
|
params: { path: {
|
|
1088
|
-
|
|
909
|
+
workspaceId,
|
|
1089
910
|
detectionId
|
|
1090
911
|
} },
|
|
1091
912
|
body: redaction
|
|
@@ -1095,31 +916,31 @@ var Detections = class {
|
|
|
1095
916
|
};
|
|
1096
917
|
|
|
1097
918
|
//#endregion
|
|
1098
|
-
//#region src/services/
|
|
919
|
+
//#region src/services/documents.ts
|
|
1099
920
|
/**
|
|
1100
|
-
* Service for handling
|
|
921
|
+
* Service for handling document operations, including review assignment.
|
|
1101
922
|
*/
|
|
1102
|
-
var
|
|
923
|
+
var Documents = class {
|
|
1103
924
|
#api;
|
|
1104
925
|
constructor(api) {
|
|
1105
926
|
this.#api = api;
|
|
1106
927
|
}
|
|
1107
928
|
/**
|
|
1108
|
-
* Upload one or more
|
|
1109
|
-
* @param
|
|
1110
|
-
* @param
|
|
1111
|
-
* @returns Promise that resolves with the uploaded
|
|
929
|
+
* Upload one or more documents to a workspace
|
|
930
|
+
* @param workspaceId - Workspace id
|
|
931
|
+
* @param documents - Document or array of documents to upload
|
|
932
|
+
* @returns Promise that resolves with the uploaded document metadata
|
|
1112
933
|
* @throws {ApiError} if the request fails
|
|
1113
934
|
*/
|
|
1114
|
-
async
|
|
935
|
+
async uploadDocuments(workspaceId, documents) {
|
|
1115
936
|
const formData = new FormData();
|
|
1116
|
-
const
|
|
1117
|
-
for (const
|
|
1118
|
-
const name =
|
|
1119
|
-
formData.append("
|
|
937
|
+
const documentArray = Array.isArray(documents) ? documents : [documents];
|
|
938
|
+
for (const document of documentArray) {
|
|
939
|
+
const name = document instanceof File ? document.name : "document";
|
|
940
|
+
formData.append("documents", document, name);
|
|
1120
941
|
}
|
|
1121
|
-
const { data } = await this.#api.POST("/workspaces/{
|
|
1122
|
-
params: { path: {
|
|
942
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/documents/", {
|
|
943
|
+
params: { path: { workspaceId } },
|
|
1123
944
|
body: formData,
|
|
1124
945
|
bodySerializer: (formData) => formData,
|
|
1125
946
|
headers: { "Content-Type": null }
|
|
@@ -1127,101 +948,133 @@ var Files = class {
|
|
|
1127
948
|
return data;
|
|
1128
949
|
}
|
|
1129
950
|
/**
|
|
1130
|
-
* List
|
|
1131
|
-
* @param
|
|
951
|
+
* List documents in a workspace
|
|
952
|
+
* @param workspaceId - Workspace id
|
|
1132
953
|
* @param query - Optional query parameters (formats, modality, hash, search,
|
|
1133
954
|
* limit, after)
|
|
1134
|
-
* @returns Promise that resolves with a paginated list of
|
|
955
|
+
* @returns Promise that resolves with a paginated list of documents
|
|
1135
956
|
* @throws {ApiError} if the request fails
|
|
1136
957
|
*/
|
|
1137
|
-
async
|
|
1138
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
1139
|
-
path: {
|
|
958
|
+
async listDocuments(workspaceId, query) {
|
|
959
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/documents/", { params: {
|
|
960
|
+
path: { workspaceId },
|
|
1140
961
|
query
|
|
1141
962
|
} });
|
|
1142
963
|
return data;
|
|
1143
964
|
}
|
|
1144
965
|
/**
|
|
1145
|
-
* Get
|
|
1146
|
-
* @param
|
|
1147
|
-
* @param
|
|
1148
|
-
* @returns Promise that resolves with the
|
|
966
|
+
* Get document metadata by ID
|
|
967
|
+
* @param workspaceId - Workspace id
|
|
968
|
+
* @param documentId - Document ID
|
|
969
|
+
* @returns Promise that resolves with the document metadata
|
|
1149
970
|
* @throws {ApiError} if the request fails
|
|
1150
971
|
*/
|
|
1151
|
-
async
|
|
1152
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
1153
|
-
|
|
1154
|
-
|
|
972
|
+
async getDocument(workspaceId, documentId) {
|
|
973
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/documents/{documentId}/", { params: { path: {
|
|
974
|
+
workspaceId,
|
|
975
|
+
documentId
|
|
1155
976
|
} } });
|
|
1156
977
|
return data;
|
|
1157
978
|
}
|
|
1158
979
|
/**
|
|
1159
|
-
* Download a
|
|
1160
|
-
* @param
|
|
1161
|
-
* @param
|
|
1162
|
-
* @returns Promise that resolves with the
|
|
980
|
+
* Download a document by ID
|
|
981
|
+
* @param workspaceId - Workspace id
|
|
982
|
+
* @param documentId - Document ID
|
|
983
|
+
* @returns Promise that resolves with the document response
|
|
1163
984
|
* @throws {ApiError} if the request fails
|
|
1164
985
|
*/
|
|
1165
|
-
async
|
|
1166
|
-
const { response } = await this.#api.GET("/workspaces/{
|
|
986
|
+
async downloadDocument(workspaceId, documentId) {
|
|
987
|
+
const { response } = await this.#api.GET("/workspaces/{workspaceId}/documents/{documentId}/content/", {
|
|
1167
988
|
params: { path: {
|
|
1168
|
-
|
|
1169
|
-
|
|
989
|
+
workspaceId,
|
|
990
|
+
documentId
|
|
1170
991
|
} },
|
|
1171
992
|
parseAs: "stream"
|
|
1172
993
|
});
|
|
1173
994
|
return response;
|
|
1174
995
|
}
|
|
1175
996
|
/**
|
|
1176
|
-
* Update a
|
|
1177
|
-
* @param
|
|
1178
|
-
* @param
|
|
1179
|
-
* @param updates -
|
|
1180
|
-
* @returns Promise that resolves with the updated
|
|
997
|
+
* Update a document's metadata
|
|
998
|
+
* @param workspaceId - Workspace id
|
|
999
|
+
* @param documentId - Document ID
|
|
1000
|
+
* @param updates - Document update request
|
|
1001
|
+
* @returns Promise that resolves with the updated document
|
|
1181
1002
|
* @throws {ApiError} if the request fails
|
|
1182
1003
|
*/
|
|
1183
|
-
async
|
|
1184
|
-
const { data } = await this.#api.PATCH("/workspaces/{
|
|
1004
|
+
async updateDocument(workspaceId, documentId, updates) {
|
|
1005
|
+
const { data } = await this.#api.PATCH("/workspaces/{workspaceId}/documents/{documentId}/", {
|
|
1185
1006
|
params: { path: {
|
|
1186
|
-
|
|
1187
|
-
|
|
1007
|
+
workspaceId,
|
|
1008
|
+
documentId
|
|
1188
1009
|
} },
|
|
1189
1010
|
body: updates
|
|
1190
1011
|
});
|
|
1191
1012
|
return data;
|
|
1192
1013
|
}
|
|
1193
1014
|
/**
|
|
1194
|
-
* Delete a
|
|
1195
|
-
* @param
|
|
1196
|
-
* @param
|
|
1197
|
-
* @returns Promise that resolves when the
|
|
1015
|
+
* Delete a document
|
|
1016
|
+
* @param workspaceId - Workspace id
|
|
1017
|
+
* @param documentId - Document ID
|
|
1018
|
+
* @returns Promise that resolves when the document is deleted
|
|
1198
1019
|
* @throws {ApiError} if the request fails
|
|
1199
1020
|
*/
|
|
1200
|
-
async
|
|
1201
|
-
await this.#api.DELETE("/workspaces/{
|
|
1202
|
-
|
|
1203
|
-
|
|
1021
|
+
async deleteDocument(workspaceId, documentId) {
|
|
1022
|
+
await this.#api.DELETE("/workspaces/{workspaceId}/documents/{documentId}/", { params: { path: {
|
|
1023
|
+
workspaceId,
|
|
1024
|
+
documentId
|
|
1204
1025
|
} } });
|
|
1205
1026
|
}
|
|
1206
1027
|
/**
|
|
1207
|
-
* Delete several
|
|
1028
|
+
* Delete several documents in one call.
|
|
1208
1029
|
*
|
|
1209
|
-
* Idempotent: ids resolving to live
|
|
1210
|
-
* returned in `deleted`; unknown, already-deleted, or out-of-workspace
|
|
1211
|
-
* are returned in `skipped`. Deletion is permanent.
|
|
1030
|
+
* Idempotent: ids resolving to live documents in the workspace are removed
|
|
1031
|
+
* and returned in `deleted`; unknown, already-deleted, or out-of-workspace
|
|
1032
|
+
* ids are returned in `skipped`. Deletion is permanent.
|
|
1212
1033
|
*
|
|
1213
|
-
* @param
|
|
1214
|
-
* @param
|
|
1034
|
+
* @param workspaceId - Workspace id
|
|
1035
|
+
* @param documentIds - The document IDs to delete
|
|
1215
1036
|
* @returns Promise that resolves with the deleted and skipped ids
|
|
1216
1037
|
* @throws {ApiError} if the request fails
|
|
1217
1038
|
*/
|
|
1218
|
-
async
|
|
1219
|
-
const { data } = await this.#api.POST("/workspaces/{
|
|
1220
|
-
params: { path: {
|
|
1221
|
-
body: {
|
|
1039
|
+
async deleteDocuments(workspaceId, documentIds) {
|
|
1040
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/documents/delete/", {
|
|
1041
|
+
params: { path: { workspaceId } },
|
|
1042
|
+
body: { documentIds }
|
|
1222
1043
|
});
|
|
1223
1044
|
return data;
|
|
1224
1045
|
}
|
|
1046
|
+
/**
|
|
1047
|
+
* Assign a document for review, opening a review thread.
|
|
1048
|
+
* @param workspaceId - Workspace id
|
|
1049
|
+
* @param documentId - Document ID
|
|
1050
|
+
* @param assignment - Review assignment request
|
|
1051
|
+
* @returns Promise that resolves with the review thread
|
|
1052
|
+
* @throws {ApiError} if the request fails
|
|
1053
|
+
*/
|
|
1054
|
+
async assignReview(workspaceId, documentId, assignment) {
|
|
1055
|
+
const { data } = await this.#api.PUT("/workspaces/{workspaceId}/documents/{documentId}/review/assign/", {
|
|
1056
|
+
params: { path: {
|
|
1057
|
+
workspaceId,
|
|
1058
|
+
documentId
|
|
1059
|
+
} },
|
|
1060
|
+
body: assignment
|
|
1061
|
+
});
|
|
1062
|
+
return data;
|
|
1063
|
+
}
|
|
1064
|
+
/**
|
|
1065
|
+
* Mark a document's review as verified (resolved).
|
|
1066
|
+
* @param workspaceId - Workspace id
|
|
1067
|
+
* @param documentId - Document ID
|
|
1068
|
+
* @returns Promise that resolves with the review thread
|
|
1069
|
+
* @throws {ApiError} if the request fails
|
|
1070
|
+
*/
|
|
1071
|
+
async verifyReview(workspaceId, documentId) {
|
|
1072
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/documents/{documentId}/review/verify/", { params: { path: {
|
|
1073
|
+
workspaceId,
|
|
1074
|
+
documentId
|
|
1075
|
+
} } });
|
|
1076
|
+
return data;
|
|
1077
|
+
}
|
|
1225
1078
|
};
|
|
1226
1079
|
|
|
1227
1080
|
//#endregion
|
|
@@ -1241,52 +1094,52 @@ var Invites = class {
|
|
|
1241
1094
|
* @returns Promise that resolves with a paginated list of invitations
|
|
1242
1095
|
* @throws {ApiError} if the request fails
|
|
1243
1096
|
*/
|
|
1244
|
-
async listInvites(
|
|
1245
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
1246
|
-
path: {
|
|
1097
|
+
async listInvites(workspaceId, query) {
|
|
1098
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/invites/", { params: {
|
|
1099
|
+
path: { workspaceId },
|
|
1247
1100
|
query
|
|
1248
1101
|
} });
|
|
1249
1102
|
return data;
|
|
1250
1103
|
}
|
|
1251
1104
|
/**
|
|
1252
1105
|
* Send an invitation to join a workspace
|
|
1253
|
-
* @param
|
|
1106
|
+
* @param workspaceId - Workspace id
|
|
1254
1107
|
* @param invite - Invitation request
|
|
1255
1108
|
* @returns Promise that resolves with the sent invitation
|
|
1256
1109
|
* @throws {ApiError} if the request fails
|
|
1257
1110
|
*/
|
|
1258
|
-
async sendInvite(
|
|
1259
|
-
const { data } = await this.#api.POST("/workspaces/{
|
|
1260
|
-
params: { path: {
|
|
1111
|
+
async sendInvite(workspaceId, invite) {
|
|
1112
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/invites/", {
|
|
1113
|
+
params: { path: { workspaceId } },
|
|
1261
1114
|
body: invite
|
|
1262
1115
|
});
|
|
1263
1116
|
return data;
|
|
1264
1117
|
}
|
|
1265
1118
|
/**
|
|
1266
1119
|
* Cancel a pending invitation
|
|
1267
|
-
* @param
|
|
1120
|
+
* @param workspaceId - Workspace id
|
|
1268
1121
|
* @param inviteId - Invite ID
|
|
1269
1122
|
* @returns Promise that resolves when the invitation is canceled
|
|
1270
1123
|
* @throws {ApiError} if the request fails
|
|
1271
1124
|
*/
|
|
1272
|
-
async cancelInvite(
|
|
1273
|
-
await this.#api.DELETE("/workspaces/{
|
|
1274
|
-
|
|
1125
|
+
async cancelInvite(workspaceId, inviteId) {
|
|
1126
|
+
await this.#api.DELETE("/workspaces/{workspaceId}/invites/{inviteId}/", { params: { path: {
|
|
1127
|
+
workspaceId,
|
|
1275
1128
|
inviteId
|
|
1276
1129
|
} } });
|
|
1277
1130
|
}
|
|
1278
1131
|
/**
|
|
1279
1132
|
* Reply to an invitation (accept or decline)
|
|
1280
|
-
* @param
|
|
1133
|
+
* @param workspaceId - Workspace id
|
|
1281
1134
|
* @param inviteId - Invite ID
|
|
1282
1135
|
* @param reply - Reply request
|
|
1283
1136
|
* @returns Promise that resolves with the updated invitation
|
|
1284
1137
|
* @throws {ApiError} if the request fails
|
|
1285
1138
|
*/
|
|
1286
|
-
async replyToInvite(
|
|
1287
|
-
const { data } = await this.#api.POST("/workspaces/{
|
|
1139
|
+
async replyToInvite(workspaceId, inviteId, reply) {
|
|
1140
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/invites/{inviteId}/", {
|
|
1288
1141
|
params: { path: {
|
|
1289
|
-
|
|
1142
|
+
workspaceId,
|
|
1290
1143
|
inviteId
|
|
1291
1144
|
} },
|
|
1292
1145
|
body: reply
|
|
@@ -1295,14 +1148,14 @@ var Invites = class {
|
|
|
1295
1148
|
}
|
|
1296
1149
|
/**
|
|
1297
1150
|
* Generate a shareable invite code for a workspace
|
|
1298
|
-
* @param
|
|
1151
|
+
* @param workspaceId - Workspace id
|
|
1299
1152
|
* @param options - Invite code generation options
|
|
1300
1153
|
* @returns Promise that resolves with the generated invite code
|
|
1301
1154
|
* @throws {ApiError} if the request fails
|
|
1302
1155
|
*/
|
|
1303
|
-
async generateInviteCode(
|
|
1304
|
-
const { data } = await this.#api.POST("/workspaces/{
|
|
1305
|
-
params: { path: {
|
|
1156
|
+
async generateInviteCode(workspaceId, options) {
|
|
1157
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/invites/code/", {
|
|
1158
|
+
params: { path: { workspaceId } },
|
|
1306
1159
|
body: options
|
|
1307
1160
|
});
|
|
1308
1161
|
return data;
|
|
@@ -1310,16 +1163,16 @@ var Invites = class {
|
|
|
1310
1163
|
/**
|
|
1311
1164
|
* Reply to an invite code (accept or decline)
|
|
1312
1165
|
* @param inviteCode - The invite code
|
|
1313
|
-
* @param reply -
|
|
1166
|
+
* @param reply - Reply request (accept or decline the invitation)
|
|
1314
1167
|
* @returns Promise that resolves with the member details if accepted, null if declined
|
|
1315
1168
|
* @throws {ApiError} if the request fails
|
|
1316
1169
|
*/
|
|
1317
1170
|
async replyToInviteCode(inviteCode, reply) {
|
|
1318
1171
|
const { data } = await this.#api.POST("/invites/code/{inviteCode}/", {
|
|
1319
1172
|
params: { path: { inviteCode } },
|
|
1320
|
-
body: reply
|
|
1173
|
+
body: reply
|
|
1321
1174
|
});
|
|
1322
|
-
return data;
|
|
1175
|
+
return data ?? null;
|
|
1323
1176
|
}
|
|
1324
1177
|
/**
|
|
1325
1178
|
* Preview an invite code without joining
|
|
@@ -1345,45 +1198,45 @@ var Members = class {
|
|
|
1345
1198
|
}
|
|
1346
1199
|
/**
|
|
1347
1200
|
* List members of a workspace
|
|
1348
|
-
* @param
|
|
1201
|
+
* @param workspaceId - Workspace id
|
|
1349
1202
|
* @param query - Optional query parameters (role, has2fa, sortBy, order, limit, after)
|
|
1350
1203
|
* @returns Promise that resolves with a paginated list of members
|
|
1351
1204
|
* @throws {ApiError} if the request fails
|
|
1352
1205
|
*/
|
|
1353
|
-
async listMembers(
|
|
1354
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
1355
|
-
path: {
|
|
1206
|
+
async listMembers(workspaceId, query) {
|
|
1207
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/members/", { params: {
|
|
1208
|
+
path: { workspaceId },
|
|
1356
1209
|
query
|
|
1357
1210
|
} });
|
|
1358
1211
|
return data;
|
|
1359
1212
|
}
|
|
1360
1213
|
/**
|
|
1361
|
-
* Get member details by
|
|
1362
|
-
* @param
|
|
1363
|
-
* @param
|
|
1214
|
+
* Get member details by account id
|
|
1215
|
+
* @param workspaceId - Workspace id
|
|
1216
|
+
* @param accountId - Member account id
|
|
1364
1217
|
* @returns Promise that resolves with the member details
|
|
1365
1218
|
* @throws {ApiError} if the request fails
|
|
1366
1219
|
*/
|
|
1367
|
-
async getMember(
|
|
1368
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
1369
|
-
|
|
1370
|
-
|
|
1220
|
+
async getMember(workspaceId, accountId) {
|
|
1221
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/members/{accountId}/", { params: { path: {
|
|
1222
|
+
workspaceId,
|
|
1223
|
+
accountId
|
|
1371
1224
|
} } });
|
|
1372
1225
|
return data;
|
|
1373
1226
|
}
|
|
1374
1227
|
/**
|
|
1375
1228
|
* Update a member's role
|
|
1376
|
-
* @param
|
|
1377
|
-
* @param
|
|
1229
|
+
* @param workspaceId - Workspace id
|
|
1230
|
+
* @param accountId - Member account id
|
|
1378
1231
|
* @param updates - New role for the member
|
|
1379
1232
|
* @returns Promise that resolves with the updated member
|
|
1380
1233
|
* @throws {ApiError} if the request fails
|
|
1381
1234
|
*/
|
|
1382
|
-
async updateMember(
|
|
1383
|
-
const { data } = await this.#api.PATCH("/workspaces/{
|
|
1235
|
+
async updateMember(workspaceId, accountId, updates) {
|
|
1236
|
+
const { data } = await this.#api.PATCH("/workspaces/{workspaceId}/members/{accountId}/", {
|
|
1384
1237
|
params: { path: {
|
|
1385
|
-
|
|
1386
|
-
|
|
1238
|
+
workspaceId,
|
|
1239
|
+
accountId
|
|
1387
1240
|
} },
|
|
1388
1241
|
body: updates
|
|
1389
1242
|
});
|
|
@@ -1391,25 +1244,25 @@ var Members = class {
|
|
|
1391
1244
|
}
|
|
1392
1245
|
/**
|
|
1393
1246
|
* Remove a member from a workspace
|
|
1394
|
-
* @param
|
|
1395
|
-
* @param
|
|
1247
|
+
* @param workspaceId - Workspace id
|
|
1248
|
+
* @param accountId - Member account id
|
|
1396
1249
|
* @returns Promise that resolves when the member is removed
|
|
1397
1250
|
* @throws {ApiError} if the request fails
|
|
1398
1251
|
*/
|
|
1399
|
-
async removeMember(
|
|
1400
|
-
await this.#api.DELETE("/workspaces/{
|
|
1401
|
-
|
|
1402
|
-
|
|
1252
|
+
async removeMember(workspaceId, accountId) {
|
|
1253
|
+
await this.#api.DELETE("/workspaces/{workspaceId}/members/{accountId}/", { params: { path: {
|
|
1254
|
+
workspaceId,
|
|
1255
|
+
accountId
|
|
1403
1256
|
} } });
|
|
1404
1257
|
}
|
|
1405
1258
|
/**
|
|
1406
1259
|
* Leave a workspace
|
|
1407
|
-
* @param
|
|
1260
|
+
* @param workspaceId - Workspace id
|
|
1408
1261
|
* @returns Promise that resolves when the member has left
|
|
1409
1262
|
* @throws {ApiError} if the request fails
|
|
1410
1263
|
*/
|
|
1411
|
-
async leaveWorkspace(
|
|
1412
|
-
await this.#api.POST("/workspaces/{
|
|
1264
|
+
async leaveWorkspace(workspaceId) {
|
|
1265
|
+
await this.#api.POST("/workspaces/{workspaceId}/members/leave/", { params: { path: { workspaceId } } });
|
|
1413
1266
|
}
|
|
1414
1267
|
};
|
|
1415
1268
|
|
|
@@ -1504,59 +1357,59 @@ var Pipelines = class {
|
|
|
1504
1357
|
}
|
|
1505
1358
|
/**
|
|
1506
1359
|
* List pipelines in a workspace
|
|
1507
|
-
* @param
|
|
1360
|
+
* @param workspaceId - Workspace id
|
|
1508
1361
|
* @param query - Optional query parameters (search, status, limit, after)
|
|
1509
1362
|
* @returns Promise that resolves with a paginated list of pipeline summaries
|
|
1510
1363
|
* @throws {ApiError} if the request fails
|
|
1511
1364
|
*/
|
|
1512
|
-
async listPipelines(
|
|
1513
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
1514
|
-
path: {
|
|
1365
|
+
async listPipelines(workspaceId, query) {
|
|
1366
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/pipelines/", { params: {
|
|
1367
|
+
path: { workspaceId },
|
|
1515
1368
|
query
|
|
1516
1369
|
} });
|
|
1517
1370
|
return data;
|
|
1518
1371
|
}
|
|
1519
1372
|
/**
|
|
1520
1373
|
* Create a pipeline in a workspace
|
|
1521
|
-
* @param
|
|
1374
|
+
* @param workspaceId - Workspace id
|
|
1522
1375
|
* @param pipeline - Pipeline creation request
|
|
1523
1376
|
* @returns Promise that resolves with the created pipeline
|
|
1524
1377
|
* @throws {ApiError} if the request fails
|
|
1525
1378
|
*/
|
|
1526
|
-
async createPipeline(
|
|
1527
|
-
const { data } = await this.#api.POST("/workspaces/{
|
|
1528
|
-
params: { path: {
|
|
1379
|
+
async createPipeline(workspaceId, pipeline) {
|
|
1380
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/pipelines/", {
|
|
1381
|
+
params: { path: { workspaceId } },
|
|
1529
1382
|
body: pipeline
|
|
1530
1383
|
});
|
|
1531
1384
|
return data;
|
|
1532
1385
|
}
|
|
1533
1386
|
/**
|
|
1534
|
-
* Get pipeline details by
|
|
1535
|
-
* @param
|
|
1536
|
-
* @param
|
|
1387
|
+
* Get pipeline details by id
|
|
1388
|
+
* @param workspaceId - Workspace id
|
|
1389
|
+
* @param pipelineId - Pipeline id
|
|
1537
1390
|
* @returns Promise that resolves with the pipeline details
|
|
1538
1391
|
* @throws {ApiError} if the request fails
|
|
1539
1392
|
*/
|
|
1540
|
-
async getPipeline(
|
|
1541
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
1542
|
-
|
|
1543
|
-
|
|
1393
|
+
async getPipeline(workspaceId, pipelineId) {
|
|
1394
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/pipelines/{pipelineId}/", { params: { path: {
|
|
1395
|
+
workspaceId,
|
|
1396
|
+
pipelineId
|
|
1544
1397
|
} } });
|
|
1545
1398
|
return data;
|
|
1546
1399
|
}
|
|
1547
1400
|
/**
|
|
1548
1401
|
* Update a pipeline
|
|
1549
|
-
* @param
|
|
1550
|
-
* @param
|
|
1402
|
+
* @param workspaceId - Workspace id
|
|
1403
|
+
* @param pipelineId - Pipeline id
|
|
1551
1404
|
* @param updates - Pipeline update request
|
|
1552
1405
|
* @returns Promise that resolves with the updated pipeline
|
|
1553
1406
|
* @throws {ApiError} if the request fails
|
|
1554
1407
|
*/
|
|
1555
|
-
async updatePipeline(
|
|
1556
|
-
const { data } = await this.#api.PATCH("/workspaces/{
|
|
1408
|
+
async updatePipeline(workspaceId, pipelineId, updates) {
|
|
1409
|
+
const { data } = await this.#api.PATCH("/workspaces/{workspaceId}/pipelines/{pipelineId}/", {
|
|
1557
1410
|
params: { path: {
|
|
1558
|
-
|
|
1559
|
-
|
|
1411
|
+
workspaceId,
|
|
1412
|
+
pipelineId
|
|
1560
1413
|
} },
|
|
1561
1414
|
body: updates
|
|
1562
1415
|
});
|
|
@@ -1564,15 +1417,15 @@ var Pipelines = class {
|
|
|
1564
1417
|
}
|
|
1565
1418
|
/**
|
|
1566
1419
|
* Delete a pipeline
|
|
1567
|
-
* @param
|
|
1568
|
-
* @param
|
|
1420
|
+
* @param workspaceId - Workspace id
|
|
1421
|
+
* @param pipelineId - Pipeline id
|
|
1569
1422
|
* @returns Promise that resolves when the pipeline is deleted
|
|
1570
1423
|
* @throws {ApiError} if the request fails
|
|
1571
1424
|
*/
|
|
1572
|
-
async deletePipeline(
|
|
1573
|
-
await this.#api.DELETE("/workspaces/{
|
|
1574
|
-
|
|
1575
|
-
|
|
1425
|
+
async deletePipeline(workspaceId, pipelineId) {
|
|
1426
|
+
await this.#api.DELETE("/workspaces/{workspaceId}/pipelines/{pipelineId}/", { params: { path: {
|
|
1427
|
+
workspaceId,
|
|
1428
|
+
pipelineId
|
|
1576
1429
|
} } });
|
|
1577
1430
|
}
|
|
1578
1431
|
};
|
|
@@ -1589,59 +1442,59 @@ var Policies = class {
|
|
|
1589
1442
|
}
|
|
1590
1443
|
/**
|
|
1591
1444
|
* List policies in a workspace
|
|
1592
|
-
* @param
|
|
1445
|
+
* @param workspaceId - Workspace id
|
|
1593
1446
|
* @param query - Optional pagination parameters (limit, after)
|
|
1594
1447
|
* @returns Promise that resolves with a paginated list of policies
|
|
1595
1448
|
* @throws {ApiError} if the request fails
|
|
1596
1449
|
*/
|
|
1597
|
-
async listPolicies(
|
|
1598
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
1599
|
-
path: {
|
|
1450
|
+
async listPolicies(workspaceId, query) {
|
|
1451
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/policies/", { params: {
|
|
1452
|
+
path: { workspaceId },
|
|
1600
1453
|
query
|
|
1601
1454
|
} });
|
|
1602
1455
|
return data;
|
|
1603
1456
|
}
|
|
1604
1457
|
/**
|
|
1605
1458
|
* Create a policy in a workspace
|
|
1606
|
-
* @param
|
|
1459
|
+
* @param workspaceId - Workspace id
|
|
1607
1460
|
* @param policy - Policy creation request
|
|
1608
1461
|
* @returns Promise that resolves with the created policy
|
|
1609
1462
|
* @throws {ApiError} if the request fails
|
|
1610
1463
|
*/
|
|
1611
|
-
async createPolicy(
|
|
1612
|
-
const { data } = await this.#api.POST("/workspaces/{
|
|
1613
|
-
params: { path: {
|
|
1464
|
+
async createPolicy(workspaceId, policy) {
|
|
1465
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/policies/", {
|
|
1466
|
+
params: { path: { workspaceId } },
|
|
1614
1467
|
body: policy
|
|
1615
1468
|
});
|
|
1616
1469
|
return data;
|
|
1617
1470
|
}
|
|
1618
1471
|
/**
|
|
1619
|
-
* Get policy details by
|
|
1620
|
-
* @param
|
|
1621
|
-
* @param
|
|
1472
|
+
* Get policy details by id
|
|
1473
|
+
* @param workspaceId - Workspace id
|
|
1474
|
+
* @param policyId - Policy id
|
|
1622
1475
|
* @returns Promise that resolves with the policy details
|
|
1623
1476
|
* @throws {ApiError} if the request fails
|
|
1624
1477
|
*/
|
|
1625
|
-
async getPolicy(
|
|
1626
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
1627
|
-
|
|
1628
|
-
|
|
1478
|
+
async getPolicy(workspaceId, policyId) {
|
|
1479
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/policies/{policyId}/", { params: { path: {
|
|
1480
|
+
workspaceId,
|
|
1481
|
+
policyId
|
|
1629
1482
|
} } });
|
|
1630
1483
|
return data;
|
|
1631
1484
|
}
|
|
1632
1485
|
/**
|
|
1633
1486
|
* Update a policy
|
|
1634
|
-
* @param
|
|
1635
|
-
* @param
|
|
1487
|
+
* @param workspaceId - Workspace id
|
|
1488
|
+
* @param policyId - Policy id
|
|
1636
1489
|
* @param updates - Policy update request
|
|
1637
1490
|
* @returns Promise that resolves with the updated policy
|
|
1638
1491
|
* @throws {ApiError} if the request fails
|
|
1639
1492
|
*/
|
|
1640
|
-
async updatePolicy(
|
|
1641
|
-
const { data } = await this.#api.PATCH("/workspaces/{
|
|
1493
|
+
async updatePolicy(workspaceId, policyId, updates) {
|
|
1494
|
+
const { data } = await this.#api.PATCH("/workspaces/{workspaceId}/policies/{policyId}/", {
|
|
1642
1495
|
params: { path: {
|
|
1643
|
-
|
|
1644
|
-
|
|
1496
|
+
workspaceId,
|
|
1497
|
+
policyId
|
|
1645
1498
|
} },
|
|
1646
1499
|
body: updates
|
|
1647
1500
|
});
|
|
@@ -1649,15 +1502,15 @@ var Policies = class {
|
|
|
1649
1502
|
}
|
|
1650
1503
|
/**
|
|
1651
1504
|
* Delete a policy
|
|
1652
|
-
* @param
|
|
1653
|
-
* @param
|
|
1505
|
+
* @param workspaceId - Workspace id
|
|
1506
|
+
* @param policyId - Policy id
|
|
1654
1507
|
* @returns Promise that resolves when the policy is deleted
|
|
1655
1508
|
* @throws {ApiError} if the request fails
|
|
1656
1509
|
*/
|
|
1657
|
-
async deletePolicy(
|
|
1658
|
-
await this.#api.DELETE("/workspaces/{
|
|
1659
|
-
|
|
1660
|
-
|
|
1510
|
+
async deletePolicy(workspaceId, policyId) {
|
|
1511
|
+
await this.#api.DELETE("/workspaces/{workspaceId}/policies/{policyId}/", { params: { path: {
|
|
1512
|
+
workspaceId,
|
|
1513
|
+
policyId
|
|
1661
1514
|
} } });
|
|
1662
1515
|
}
|
|
1663
1516
|
};
|
|
@@ -1676,58 +1529,58 @@ var Providers = class {
|
|
|
1676
1529
|
}
|
|
1677
1530
|
/**
|
|
1678
1531
|
* List a workspace's inference providers
|
|
1679
|
-
* @param
|
|
1532
|
+
* @param workspaceId - Workspace id
|
|
1680
1533
|
* @param query - Optional pagination and filters (provider, limit, after)
|
|
1681
1534
|
* @returns Promise that resolves with a paginated list of providers
|
|
1682
1535
|
* @throws {ApiError} if the request fails
|
|
1683
1536
|
*/
|
|
1684
|
-
async listProviders(
|
|
1685
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
1686
|
-
path: {
|
|
1537
|
+
async listProviders(workspaceId, query) {
|
|
1538
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/providers/", { params: {
|
|
1539
|
+
path: { workspaceId },
|
|
1687
1540
|
query
|
|
1688
1541
|
} });
|
|
1689
1542
|
return data;
|
|
1690
1543
|
}
|
|
1691
1544
|
/**
|
|
1692
1545
|
* Create an inference provider in a workspace
|
|
1693
|
-
* @param
|
|
1546
|
+
* @param workspaceId - Workspace id
|
|
1694
1547
|
* @param provider - Provider creation request
|
|
1695
1548
|
* @returns Promise that resolves with the created provider
|
|
1696
1549
|
* @throws {ApiError} if the request fails
|
|
1697
1550
|
*/
|
|
1698
|
-
async createProvider(
|
|
1699
|
-
const { data } = await this.#api.POST("/workspaces/{
|
|
1700
|
-
params: { path: {
|
|
1551
|
+
async createProvider(workspaceId, provider) {
|
|
1552
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/providers/", {
|
|
1553
|
+
params: { path: { workspaceId } },
|
|
1701
1554
|
body: provider
|
|
1702
1555
|
});
|
|
1703
1556
|
return data;
|
|
1704
1557
|
}
|
|
1705
1558
|
/**
|
|
1706
1559
|
* Get provider details by ID
|
|
1707
|
-
* @param
|
|
1560
|
+
* @param workspaceId - Workspace id
|
|
1708
1561
|
* @param providerId - Provider ID
|
|
1709
1562
|
* @returns Promise that resolves with the provider details
|
|
1710
1563
|
* @throws {ApiError} if the request fails
|
|
1711
1564
|
*/
|
|
1712
|
-
async getProvider(
|
|
1713
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
1714
|
-
|
|
1565
|
+
async getProvider(workspaceId, providerId) {
|
|
1566
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/providers/{providerId}/", { params: { path: {
|
|
1567
|
+
workspaceId,
|
|
1715
1568
|
providerId
|
|
1716
1569
|
} } });
|
|
1717
1570
|
return data;
|
|
1718
1571
|
}
|
|
1719
1572
|
/**
|
|
1720
1573
|
* Update an inference provider
|
|
1721
|
-
* @param
|
|
1574
|
+
* @param workspaceId - Workspace id
|
|
1722
1575
|
* @param providerId - Provider ID
|
|
1723
1576
|
* @param updates - Provider update request
|
|
1724
1577
|
* @returns Promise that resolves with the updated provider
|
|
1725
1578
|
* @throws {ApiError} if the request fails
|
|
1726
1579
|
*/
|
|
1727
|
-
async updateProvider(
|
|
1728
|
-
const { data } = await this.#api.PATCH("/workspaces/{
|
|
1580
|
+
async updateProvider(workspaceId, providerId, updates) {
|
|
1581
|
+
const { data } = await this.#api.PATCH("/workspaces/{workspaceId}/providers/{providerId}/", {
|
|
1729
1582
|
params: { path: {
|
|
1730
|
-
|
|
1583
|
+
workspaceId,
|
|
1731
1584
|
providerId
|
|
1732
1585
|
} },
|
|
1733
1586
|
body: updates
|
|
@@ -1736,27 +1589,27 @@ var Providers = class {
|
|
|
1736
1589
|
}
|
|
1737
1590
|
/**
|
|
1738
1591
|
* Delete an inference provider
|
|
1739
|
-
* @param
|
|
1592
|
+
* @param workspaceId - Workspace id
|
|
1740
1593
|
* @param providerId - Provider ID
|
|
1741
1594
|
* @returns Promise that resolves when the provider is deleted
|
|
1742
1595
|
* @throws {ApiError} if the request fails
|
|
1743
1596
|
*/
|
|
1744
|
-
async deleteProvider(
|
|
1745
|
-
await this.#api.DELETE("/workspaces/{
|
|
1746
|
-
|
|
1597
|
+
async deleteProvider(workspaceId, providerId) {
|
|
1598
|
+
await this.#api.DELETE("/workspaces/{workspaceId}/providers/{providerId}/", { params: { path: {
|
|
1599
|
+
workspaceId,
|
|
1747
1600
|
providerId
|
|
1748
1601
|
} } });
|
|
1749
1602
|
}
|
|
1750
1603
|
/**
|
|
1751
1604
|
* Verify an inference provider's configuration and credentials
|
|
1752
|
-
* @param
|
|
1605
|
+
* @param workspaceId - Workspace id
|
|
1753
1606
|
* @param providerId - Provider ID
|
|
1754
1607
|
* @returns Promise that resolves with the verification result
|
|
1755
1608
|
* @throws {ApiError} if the request fails
|
|
1756
1609
|
*/
|
|
1757
|
-
async verifyProvider(
|
|
1758
|
-
const { data } = await this.#api.POST("/workspaces/{
|
|
1759
|
-
|
|
1610
|
+
async verifyProvider(workspaceId, providerId) {
|
|
1611
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/providers/{providerId}/verify/", { params: { path: {
|
|
1612
|
+
workspaceId,
|
|
1760
1613
|
providerId
|
|
1761
1614
|
} } });
|
|
1762
1615
|
return data;
|
|
@@ -1776,14 +1629,14 @@ var Redactions = class {
|
|
|
1776
1629
|
}
|
|
1777
1630
|
/**
|
|
1778
1631
|
* Get a redaction's review audit
|
|
1779
|
-
* @param
|
|
1632
|
+
* @param workspaceId - Workspace id
|
|
1780
1633
|
* @param redactionId - Redaction ID
|
|
1781
1634
|
* @returns Promise that resolves with the audit
|
|
1782
1635
|
* @throws {ApiError} if the request fails
|
|
1783
1636
|
*/
|
|
1784
|
-
async getReview(
|
|
1785
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
1786
|
-
|
|
1637
|
+
async getReview(workspaceId, redactionId) {
|
|
1638
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/redactions/{redactionId}/review", { params: { path: {
|
|
1639
|
+
workspaceId,
|
|
1787
1640
|
redactionId
|
|
1788
1641
|
} } });
|
|
1789
1642
|
return data;
|
|
@@ -1822,14 +1675,14 @@ var Syncs = class {
|
|
|
1822
1675
|
}
|
|
1823
1676
|
/**
|
|
1824
1677
|
* List all syncs across a workspace's connections
|
|
1825
|
-
* @param
|
|
1678
|
+
* @param workspaceId - Workspace id
|
|
1826
1679
|
* @param query - Optional query parameters (provider, status, limit, after)
|
|
1827
1680
|
* @returns Promise that resolves with a paginated list of connection syncs
|
|
1828
1681
|
* @throws {ApiError} if the request fails
|
|
1829
1682
|
*/
|
|
1830
|
-
async listWorkspaceSyncs(
|
|
1831
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
1832
|
-
path: {
|
|
1683
|
+
async listWorkspaceSyncs(workspaceId, query) {
|
|
1684
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/syncs/", { params: {
|
|
1685
|
+
path: { workspaceId },
|
|
1833
1686
|
query
|
|
1834
1687
|
} });
|
|
1835
1688
|
return data;
|
|
@@ -1842,30 +1695,30 @@ var Syncs = class {
|
|
|
1842
1695
|
* use {@link Connections.importFiles} and {@link Connections.exportFiles}
|
|
1843
1696
|
* instead. Returns the created sync — poll it for completion.
|
|
1844
1697
|
*
|
|
1845
|
-
* @param
|
|
1698
|
+
* @param workspaceId - Workspace id
|
|
1846
1699
|
* @param connectionId - Connection ID
|
|
1847
1700
|
* @returns Promise that resolves with the started connection sync
|
|
1848
1701
|
* @throws {ApiError} if the request fails
|
|
1849
1702
|
*/
|
|
1850
|
-
async startSync(
|
|
1851
|
-
const { data } = await this.#api.POST("/workspaces/{
|
|
1852
|
-
|
|
1703
|
+
async startSync(workspaceId, connectionId) {
|
|
1704
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/connections/{connectionId}/sync/", { params: { path: {
|
|
1705
|
+
workspaceId,
|
|
1853
1706
|
connectionId
|
|
1854
1707
|
} } });
|
|
1855
1708
|
return data;
|
|
1856
1709
|
}
|
|
1857
1710
|
/**
|
|
1858
1711
|
* List syncs for a connection
|
|
1859
|
-
* @param
|
|
1712
|
+
* @param workspaceId - Workspace id
|
|
1860
1713
|
* @param connectionId - Connection ID
|
|
1861
1714
|
* @param query - Optional pagination parameters (limit, after)
|
|
1862
1715
|
* @returns Promise that resolves with a paginated list of connection syncs
|
|
1863
1716
|
* @throws {ApiError} if the request fails
|
|
1864
1717
|
*/
|
|
1865
|
-
async listSyncs(
|
|
1866
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
1718
|
+
async listSyncs(workspaceId, connectionId, query) {
|
|
1719
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/connections/{connectionId}/syncs/", { params: {
|
|
1867
1720
|
path: {
|
|
1868
|
-
|
|
1721
|
+
workspaceId,
|
|
1869
1722
|
connectionId
|
|
1870
1723
|
},
|
|
1871
1724
|
query
|
|
@@ -1874,15 +1727,15 @@ var Syncs = class {
|
|
|
1874
1727
|
}
|
|
1875
1728
|
/**
|
|
1876
1729
|
* Get a connection sync by ID
|
|
1877
|
-
* @param
|
|
1730
|
+
* @param workspaceId - Workspace id
|
|
1878
1731
|
* @param connectionId - Connection ID
|
|
1879
1732
|
* @param syncId - Sync ID
|
|
1880
1733
|
* @returns Promise that resolves with the connection sync details
|
|
1881
1734
|
* @throws {ApiError} if the request fails
|
|
1882
1735
|
*/
|
|
1883
|
-
async getSync(
|
|
1884
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
1885
|
-
|
|
1736
|
+
async getSync(workspaceId, connectionId, syncId) {
|
|
1737
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/connections/{connectionId}/syncs/{syncId}/", { params: { path: {
|
|
1738
|
+
workspaceId,
|
|
1886
1739
|
connectionId,
|
|
1887
1740
|
syncId
|
|
1888
1741
|
} } });
|
|
@@ -1890,15 +1743,15 @@ var Syncs = class {
|
|
|
1890
1743
|
}
|
|
1891
1744
|
/**
|
|
1892
1745
|
* Cancel a running connection sync
|
|
1893
|
-
* @param
|
|
1746
|
+
* @param workspaceId - Workspace id
|
|
1894
1747
|
* @param connectionId - Connection ID
|
|
1895
1748
|
* @param syncId - Sync ID
|
|
1896
1749
|
* @returns Promise that resolves with the canceled connection sync
|
|
1897
1750
|
* @throws {ApiError} if the request fails
|
|
1898
1751
|
*/
|
|
1899
|
-
async cancelSync(
|
|
1900
|
-
const { data } = await this.#api.POST("/workspaces/{
|
|
1901
|
-
|
|
1752
|
+
async cancelSync(workspaceId, connectionId, syncId) {
|
|
1753
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/connections/{connectionId}/syncs/{syncId}/cancel/", { params: { path: {
|
|
1754
|
+
workspaceId,
|
|
1902
1755
|
connectionId,
|
|
1903
1756
|
syncId
|
|
1904
1757
|
} } });
|
|
@@ -1906,6 +1759,172 @@ var Syncs = class {
|
|
|
1906
1759
|
}
|
|
1907
1760
|
};
|
|
1908
1761
|
|
|
1762
|
+
//#endregion
|
|
1763
|
+
//#region src/services/threads.ts
|
|
1764
|
+
/**
|
|
1765
|
+
* Service for discussion threads and the comments within them.
|
|
1766
|
+
*/
|
|
1767
|
+
var Threads = class {
|
|
1768
|
+
#api;
|
|
1769
|
+
constructor(api) {
|
|
1770
|
+
this.#api = api;
|
|
1771
|
+
}
|
|
1772
|
+
/**
|
|
1773
|
+
* List a workspace's threads
|
|
1774
|
+
* @param workspaceId - Workspace id
|
|
1775
|
+
* @param query - Optional pagination and filters (status, limit, after)
|
|
1776
|
+
* @returns Promise that resolves with a paginated list of threads
|
|
1777
|
+
* @throws {ApiError} if the request fails
|
|
1778
|
+
*/
|
|
1779
|
+
async listThreads(workspaceId, query) {
|
|
1780
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/threads/", { params: {
|
|
1781
|
+
path: { workspaceId },
|
|
1782
|
+
query
|
|
1783
|
+
} });
|
|
1784
|
+
return data;
|
|
1785
|
+
}
|
|
1786
|
+
/**
|
|
1787
|
+
* Open a new thread in a workspace
|
|
1788
|
+
* @param workspaceId - Workspace id
|
|
1789
|
+
* @param thread - Thread creation request
|
|
1790
|
+
* @returns Promise that resolves with the created thread
|
|
1791
|
+
* @throws {ApiError} if the request fails
|
|
1792
|
+
*/
|
|
1793
|
+
async openThread(workspaceId, thread) {
|
|
1794
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/threads/", {
|
|
1795
|
+
params: { path: { workspaceId } },
|
|
1796
|
+
body: thread
|
|
1797
|
+
});
|
|
1798
|
+
return data;
|
|
1799
|
+
}
|
|
1800
|
+
/**
|
|
1801
|
+
* Rename a thread
|
|
1802
|
+
* @param workspaceId - Workspace id
|
|
1803
|
+
* @param threadId - Thread ID
|
|
1804
|
+
* @param updates - Thread rename request
|
|
1805
|
+
* @returns Promise that resolves with the updated thread
|
|
1806
|
+
* @throws {ApiError} if the request fails
|
|
1807
|
+
*/
|
|
1808
|
+
async renameThread(workspaceId, threadId, updates) {
|
|
1809
|
+
const { data } = await this.#api.PATCH("/workspaces/{workspaceId}/threads/{threadId}/", {
|
|
1810
|
+
params: { path: {
|
|
1811
|
+
workspaceId,
|
|
1812
|
+
threadId
|
|
1813
|
+
} },
|
|
1814
|
+
body: updates
|
|
1815
|
+
});
|
|
1816
|
+
return data;
|
|
1817
|
+
}
|
|
1818
|
+
/**
|
|
1819
|
+
* Delete a thread
|
|
1820
|
+
* @param workspaceId - Workspace id
|
|
1821
|
+
* @param threadId - Thread ID
|
|
1822
|
+
* @returns Promise that resolves when the thread is deleted
|
|
1823
|
+
* @throws {ApiError} if the request fails
|
|
1824
|
+
*/
|
|
1825
|
+
async deleteThread(workspaceId, threadId) {
|
|
1826
|
+
await this.#api.DELETE("/workspaces/{workspaceId}/threads/{threadId}/", { params: { path: {
|
|
1827
|
+
workspaceId,
|
|
1828
|
+
threadId
|
|
1829
|
+
} } });
|
|
1830
|
+
}
|
|
1831
|
+
/**
|
|
1832
|
+
* Close a thread, ending the discussion.
|
|
1833
|
+
* @param workspaceId - Workspace id
|
|
1834
|
+
* @param threadId - Thread ID
|
|
1835
|
+
* @returns Promise that resolves with the closed thread
|
|
1836
|
+
* @throws {ApiError} if the request fails
|
|
1837
|
+
*/
|
|
1838
|
+
async closeThread(workspaceId, threadId) {
|
|
1839
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/threads/{threadId}/close/", { params: { path: {
|
|
1840
|
+
workspaceId,
|
|
1841
|
+
threadId
|
|
1842
|
+
} } });
|
|
1843
|
+
return data;
|
|
1844
|
+
}
|
|
1845
|
+
/**
|
|
1846
|
+
* Reopen a closed thread.
|
|
1847
|
+
* @param workspaceId - Workspace id
|
|
1848
|
+
* @param threadId - Thread ID
|
|
1849
|
+
* @returns Promise that resolves with the reopened thread
|
|
1850
|
+
* @throws {ApiError} if the request fails
|
|
1851
|
+
*/
|
|
1852
|
+
async reopenThread(workspaceId, threadId) {
|
|
1853
|
+
const { data } = await this.#api.DELETE("/workspaces/{workspaceId}/threads/{threadId}/close/", { params: { path: {
|
|
1854
|
+
workspaceId,
|
|
1855
|
+
threadId
|
|
1856
|
+
} } });
|
|
1857
|
+
return data;
|
|
1858
|
+
}
|
|
1859
|
+
/**
|
|
1860
|
+
* List a thread's timeline: comments interleaved with lifecycle events.
|
|
1861
|
+
* @param workspaceId - Workspace id
|
|
1862
|
+
* @param threadId - Thread ID
|
|
1863
|
+
* @param query - Optional pagination parameters (limit, after)
|
|
1864
|
+
* @returns Promise that resolves with a paginated timeline
|
|
1865
|
+
* @throws {ApiError} if the request fails
|
|
1866
|
+
*/
|
|
1867
|
+
async listTimeline(workspaceId, threadId, query) {
|
|
1868
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/threads/{threadId}/timeline/", { params: {
|
|
1869
|
+
path: {
|
|
1870
|
+
workspaceId,
|
|
1871
|
+
threadId
|
|
1872
|
+
},
|
|
1873
|
+
query
|
|
1874
|
+
} });
|
|
1875
|
+
return data;
|
|
1876
|
+
}
|
|
1877
|
+
/**
|
|
1878
|
+
* Post a comment to a thread
|
|
1879
|
+
* @param workspaceId - Workspace id
|
|
1880
|
+
* @param threadId - Thread ID
|
|
1881
|
+
* @param comment - Comment creation request
|
|
1882
|
+
* @returns Promise that resolves with the created comment
|
|
1883
|
+
* @throws {ApiError} if the request fails
|
|
1884
|
+
*/
|
|
1885
|
+
async createComment(workspaceId, threadId, comment) {
|
|
1886
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/threads/{threadId}/comments/", {
|
|
1887
|
+
params: { path: {
|
|
1888
|
+
workspaceId,
|
|
1889
|
+
threadId
|
|
1890
|
+
} },
|
|
1891
|
+
body: comment
|
|
1892
|
+
});
|
|
1893
|
+
return data;
|
|
1894
|
+
}
|
|
1895
|
+
/**
|
|
1896
|
+
* Edit a comment
|
|
1897
|
+
* @param workspaceId - Workspace id
|
|
1898
|
+
* @param commentId - Comment ID
|
|
1899
|
+
* @param updates - Comment update request
|
|
1900
|
+
* @returns Promise that resolves with the updated comment
|
|
1901
|
+
* @throws {ApiError} if the request fails
|
|
1902
|
+
*/
|
|
1903
|
+
async updateComment(workspaceId, commentId, updates) {
|
|
1904
|
+
const { data } = await this.#api.PATCH("/workspaces/{workspaceId}/comments/{commentId}/", {
|
|
1905
|
+
params: { path: {
|
|
1906
|
+
workspaceId,
|
|
1907
|
+
commentId
|
|
1908
|
+
} },
|
|
1909
|
+
body: updates
|
|
1910
|
+
});
|
|
1911
|
+
return data;
|
|
1912
|
+
}
|
|
1913
|
+
/**
|
|
1914
|
+
* Delete a comment
|
|
1915
|
+
* @param workspaceId - Workspace id
|
|
1916
|
+
* @param commentId - Comment ID
|
|
1917
|
+
* @returns Promise that resolves when the comment is deleted
|
|
1918
|
+
* @throws {ApiError} if the request fails
|
|
1919
|
+
*/
|
|
1920
|
+
async deleteComment(workspaceId, commentId) {
|
|
1921
|
+
await this.#api.DELETE("/workspaces/{workspaceId}/comments/{commentId}/", { params: { path: {
|
|
1922
|
+
workspaceId,
|
|
1923
|
+
commentId
|
|
1924
|
+
} } });
|
|
1925
|
+
}
|
|
1926
|
+
};
|
|
1927
|
+
|
|
1909
1928
|
//#endregion
|
|
1910
1929
|
//#region src/services/webhooks.ts
|
|
1911
1930
|
/**
|
|
@@ -1918,58 +1937,58 @@ var Webhooks = class {
|
|
|
1918
1937
|
}
|
|
1919
1938
|
/**
|
|
1920
1939
|
* List all webhooks in a workspace
|
|
1921
|
-
* @param
|
|
1940
|
+
* @param workspaceId - Workspace id
|
|
1922
1941
|
* @param query - Optional pagination parameters (limit, after)
|
|
1923
1942
|
* @returns Promise that resolves with a paginated list of webhooks
|
|
1924
1943
|
* @throws {ApiError} if the request fails
|
|
1925
1944
|
*/
|
|
1926
|
-
async listWebhooks(
|
|
1927
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
1928
|
-
path: {
|
|
1945
|
+
async listWebhooks(workspaceId, query) {
|
|
1946
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/webhooks/", { params: {
|
|
1947
|
+
path: { workspaceId },
|
|
1929
1948
|
query
|
|
1930
1949
|
} });
|
|
1931
1950
|
return data;
|
|
1932
1951
|
}
|
|
1933
1952
|
/**
|
|
1934
1953
|
* Create a new webhook
|
|
1935
|
-
* @param
|
|
1954
|
+
* @param workspaceId - Workspace id
|
|
1936
1955
|
* @param webhook - Webhook creation request
|
|
1937
1956
|
* @returns Promise that resolves with the created webhook (including secret)
|
|
1938
1957
|
* @throws {ApiError} if the request fails
|
|
1939
1958
|
*/
|
|
1940
|
-
async createWebhook(
|
|
1941
|
-
const { data } = await this.#api.POST("/workspaces/{
|
|
1942
|
-
params: { path: {
|
|
1959
|
+
async createWebhook(workspaceId, webhook) {
|
|
1960
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/webhooks/", {
|
|
1961
|
+
params: { path: { workspaceId } },
|
|
1943
1962
|
body: webhook
|
|
1944
1963
|
});
|
|
1945
1964
|
return data;
|
|
1946
1965
|
}
|
|
1947
1966
|
/**
|
|
1948
|
-
* Get a specific webhook by
|
|
1949
|
-
* @param
|
|
1967
|
+
* Get a specific webhook by id
|
|
1968
|
+
* @param workspaceId - Workspace id
|
|
1950
1969
|
* @param webhookId - Webhook ID
|
|
1951
1970
|
* @returns Promise that resolves with the webhook details
|
|
1952
1971
|
* @throws {ApiError} if the request fails
|
|
1953
1972
|
*/
|
|
1954
|
-
async getWebhook(
|
|
1955
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
1956
|
-
|
|
1973
|
+
async getWebhook(workspaceId, webhookId) {
|
|
1974
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/webhooks/{webhookId}/", { params: { path: {
|
|
1975
|
+
workspaceId,
|
|
1957
1976
|
webhookId
|
|
1958
1977
|
} } });
|
|
1959
1978
|
return data;
|
|
1960
1979
|
}
|
|
1961
1980
|
/**
|
|
1962
1981
|
* Update an existing webhook
|
|
1963
|
-
* @param
|
|
1982
|
+
* @param workspaceId - Workspace id
|
|
1964
1983
|
* @param webhookId - Webhook ID
|
|
1965
1984
|
* @param updates - Webhook update request
|
|
1966
1985
|
* @returns Promise that resolves with the updated webhook
|
|
1967
1986
|
* @throws {ApiError} if the request fails
|
|
1968
1987
|
*/
|
|
1969
|
-
async updateWebhook(
|
|
1970
|
-
const { data } = await this.#api.PATCH("/workspaces/{
|
|
1988
|
+
async updateWebhook(workspaceId, webhookId, updates) {
|
|
1989
|
+
const { data } = await this.#api.PATCH("/workspaces/{workspaceId}/webhooks/{webhookId}/", {
|
|
1971
1990
|
params: { path: {
|
|
1972
|
-
|
|
1991
|
+
workspaceId,
|
|
1973
1992
|
webhookId
|
|
1974
1993
|
} },
|
|
1975
1994
|
body: updates
|
|
@@ -1978,29 +1997,29 @@ var Webhooks = class {
|
|
|
1978
1997
|
}
|
|
1979
1998
|
/**
|
|
1980
1999
|
* Delete a webhook
|
|
1981
|
-
* @param
|
|
2000
|
+
* @param workspaceId - Workspace id
|
|
1982
2001
|
* @param webhookId - Webhook ID
|
|
1983
2002
|
* @returns Promise that resolves when the webhook is deleted
|
|
1984
2003
|
* @throws {ApiError} if the request fails
|
|
1985
2004
|
*/
|
|
1986
|
-
async deleteWebhook(
|
|
1987
|
-
await this.#api.DELETE("/workspaces/{
|
|
1988
|
-
|
|
2005
|
+
async deleteWebhook(workspaceId, webhookId) {
|
|
2006
|
+
await this.#api.DELETE("/workspaces/{workspaceId}/webhooks/{webhookId}/", { params: { path: {
|
|
2007
|
+
workspaceId,
|
|
1989
2008
|
webhookId
|
|
1990
2009
|
} } });
|
|
1991
2010
|
}
|
|
1992
2011
|
/**
|
|
1993
2012
|
* Test a webhook by sending a test payload
|
|
1994
|
-
* @param
|
|
2013
|
+
* @param workspaceId - Workspace id
|
|
1995
2014
|
* @param webhookId - Webhook ID
|
|
1996
2015
|
* @param options - Test webhook options
|
|
1997
2016
|
* @returns Promise that resolves with the test result
|
|
1998
2017
|
* @throws {ApiError} if the request fails
|
|
1999
2018
|
*/
|
|
2000
|
-
async testWebhook(
|
|
2001
|
-
const { data } = await this.#api.POST("/workspaces/{
|
|
2019
|
+
async testWebhook(workspaceId, webhookId, options) {
|
|
2020
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/webhooks/{webhookId}/test/", {
|
|
2002
2021
|
params: { path: {
|
|
2003
|
-
|
|
2022
|
+
workspaceId,
|
|
2004
2023
|
webhookId
|
|
2005
2024
|
} },
|
|
2006
2025
|
body: options ?? {}
|
|
@@ -2031,12 +2050,12 @@ var Workspaces = class {
|
|
|
2031
2050
|
}
|
|
2032
2051
|
/**
|
|
2033
2052
|
* Get workspace details by ID
|
|
2034
|
-
* @param
|
|
2053
|
+
* @param workspaceId - Workspace id
|
|
2035
2054
|
* @returns Promise that resolves with the workspace details
|
|
2036
2055
|
* @throws {ApiError} if the request fails
|
|
2037
2056
|
*/
|
|
2038
|
-
async getWorkspace(
|
|
2039
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
2057
|
+
async getWorkspace(workspaceId) {
|
|
2058
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/", { params: { path: { workspaceId } } });
|
|
2040
2059
|
return data;
|
|
2041
2060
|
}
|
|
2042
2061
|
/**
|
|
@@ -2051,64 +2070,64 @@ var Workspaces = class {
|
|
|
2051
2070
|
}
|
|
2052
2071
|
/**
|
|
2053
2072
|
* Update an existing workspace
|
|
2054
|
-
* @param
|
|
2073
|
+
* @param workspaceId - Workspace id
|
|
2055
2074
|
* @param updates - Workspace update request
|
|
2056
2075
|
* @returns Promise that resolves with the updated workspace
|
|
2057
2076
|
* @throws {ApiError} if the request fails
|
|
2058
2077
|
*/
|
|
2059
|
-
async updateWorkspace(
|
|
2060
|
-
const { data } = await this.#api.PATCH("/workspaces/{
|
|
2061
|
-
params: { path: {
|
|
2078
|
+
async updateWorkspace(workspaceId, updates) {
|
|
2079
|
+
const { data } = await this.#api.PATCH("/workspaces/{workspaceId}/", {
|
|
2080
|
+
params: { path: { workspaceId } },
|
|
2062
2081
|
body: updates
|
|
2063
2082
|
});
|
|
2064
2083
|
return data;
|
|
2065
2084
|
}
|
|
2066
2085
|
/**
|
|
2067
2086
|
* Delete a workspace
|
|
2068
|
-
* @param
|
|
2087
|
+
* @param workspaceId - Workspace id
|
|
2069
2088
|
* @returns Promise that resolves when the workspace is deleted
|
|
2070
2089
|
* @throws {ApiError} if the request fails
|
|
2071
2090
|
*/
|
|
2072
|
-
async deleteWorkspace(
|
|
2073
|
-
await this.#api.DELETE("/workspaces/{
|
|
2091
|
+
async deleteWorkspace(workspaceId) {
|
|
2092
|
+
await this.#api.DELETE("/workspaces/{workspaceId}/", { params: { path: { workspaceId } } });
|
|
2074
2093
|
}
|
|
2075
2094
|
/**
|
|
2076
2095
|
* Get notification settings for the authenticated user in a workspace
|
|
2077
|
-
* @param
|
|
2096
|
+
* @param workspaceId - Workspace id
|
|
2078
2097
|
* @returns Promise that resolves with the notification settings
|
|
2079
2098
|
* @throws {ApiError} if the request fails
|
|
2080
2099
|
*/
|
|
2081
|
-
async getNotificationSettings(
|
|
2082
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
2100
|
+
async getNotificationSettings(workspaceId) {
|
|
2101
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/notifications/", { params: { path: { workspaceId } } });
|
|
2083
2102
|
return data;
|
|
2084
2103
|
}
|
|
2085
2104
|
/**
|
|
2086
2105
|
* Update notification settings for the authenticated user in a workspace
|
|
2087
|
-
* @param
|
|
2106
|
+
* @param workspaceId - Workspace id
|
|
2088
2107
|
* @param settings - Notification settings update request
|
|
2089
2108
|
* @returns Promise that resolves with the updated notification settings
|
|
2090
2109
|
* @throws {ApiError} if the request fails
|
|
2091
2110
|
*/
|
|
2092
|
-
async updateNotificationSettings(
|
|
2093
|
-
const { data } = await this.#api.PATCH("/workspaces/{
|
|
2094
|
-
params: { path: {
|
|
2111
|
+
async updateNotificationSettings(workspaceId, settings) {
|
|
2112
|
+
const { data } = await this.#api.PATCH("/workspaces/{workspaceId}/notifications/", {
|
|
2113
|
+
params: { path: { workspaceId } },
|
|
2095
2114
|
body: settings
|
|
2096
2115
|
});
|
|
2097
2116
|
return data;
|
|
2098
2117
|
}
|
|
2099
2118
|
/**
|
|
2100
2119
|
* Upload a workspace's avatar image
|
|
2101
|
-
* @param
|
|
2120
|
+
* @param workspaceId - Workspace id
|
|
2102
2121
|
* @param avatar - Avatar image to upload
|
|
2103
2122
|
* @returns Promise that resolves when the avatar is uploaded
|
|
2104
2123
|
* @throws {ApiError} if the request fails
|
|
2105
2124
|
*/
|
|
2106
|
-
async uploadAvatar(
|
|
2125
|
+
async uploadAvatar(workspaceId, avatar) {
|
|
2107
2126
|
const formData = new FormData();
|
|
2108
2127
|
const name = avatar instanceof File ? avatar.name : "avatar";
|
|
2109
2128
|
formData.append("avatar", avatar, name);
|
|
2110
|
-
await this.#api.PUT("/workspaces/{
|
|
2111
|
-
params: { path: {
|
|
2129
|
+
await this.#api.PUT("/workspaces/{workspaceId}/avatar/", {
|
|
2130
|
+
params: { path: { workspaceId } },
|
|
2112
2131
|
body: formData,
|
|
2113
2132
|
bodySerializer: (formData) => formData,
|
|
2114
2133
|
headers: { "Content-Type": null }
|
|
@@ -2116,15 +2135,15 @@ var Workspaces = class {
|
|
|
2116
2135
|
}
|
|
2117
2136
|
/**
|
|
2118
2137
|
* Delete a workspace's avatar image
|
|
2119
|
-
* @param
|
|
2138
|
+
* @param workspaceId - Workspace id
|
|
2120
2139
|
* @returns Promise that resolves when the avatar is deleted
|
|
2121
2140
|
* @throws {ApiError} if the request fails
|
|
2122
2141
|
*/
|
|
2123
|
-
async deleteAvatar(
|
|
2124
|
-
await this.#api.DELETE("/workspaces/{
|
|
2142
|
+
async deleteAvatar(workspaceId) {
|
|
2143
|
+
await this.#api.DELETE("/workspaces/{workspaceId}/avatar/", { params: { path: { workspaceId } } });
|
|
2125
2144
|
}
|
|
2126
2145
|
};
|
|
2127
2146
|
|
|
2128
2147
|
//#endregion
|
|
2129
|
-
export {
|
|
2130
|
-
//# sourceMappingURL=services-
|
|
2148
|
+
export { Auth as _, Status as a, Activities as b, Policies as c, Members as d, Invites as f, Capabilities as g, Connections as h, Syncs as i, Pipelines as l, Detections as m, Webhooks as n, Redactions as o, Documents as p, Threads as r, Providers as s, Workspaces as t, Notifications as u, ApiTokens as v, Account as x, Analytics as y };
|
|
2149
|
+
//# sourceMappingURL=services-CFFmQDgA.js.map
|