@nvisy/sdk 0.50.0 → 0.52.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 +90 -1
- package/dist/{client-ClO429Iv.d.ts → client-CSxuXX5e.d.ts} +377 -357
- package/dist/client-CSxuXX5e.d.ts.map +1 -0
- package/dist/datatypes/index.d.ts +2 -2
- package/dist/{error-DRb1GHg6.js → error-Bc6Sg_y-.js} +3 -3
- package/dist/{error-DRb1GHg6.js.map → error-Bc6Sg_y-.js.map} +1 -1
- package/dist/{errors-BoBDbzst.d.ts → errors-CcTfWeEE.d.ts} +2 -7
- package/dist/errors-CcTfWeEE.d.ts.map +1 -0
- package/dist/{errors-D2J3LbE-.js → errors-ChRSBkhj.js} +2 -9
- package/dist/errors-ChRSBkhj.js.map +1 -0
- package/dist/{index-QQU6h-4Y.d.ts → index-DmLbi0Gi.d.ts} +6656 -5203
- package/dist/index-DmLbi0Gi.d.ts.map +1 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +16 -21
- 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-Bt15MerP.js} +715 -668
- package/dist/services-Bt15MerP.js.map +1 -0
- package/dist/standalone/index.d.ts +4 -13
- package/dist/standalone/index.d.ts.map +1 -1
- package/dist/standalone/index.js +6 -7
- package/dist/standalone/index.js.map +1 -1
- package/dist/webhooks/index.d.ts +2 -2
- package/dist/webhooks/index.js +1 -1
- package/package.json +3 -3
- package/dist/client-ClO429Iv.d.ts.map +0 -1
- package/dist/errors-BoBDbzst.d.ts.map +0 -1
- package/dist/errors-D2J3LbE-.js.map +0 -1
- package/dist/index-QQU6h-4Y.d.ts.map +0 -1
- package/dist/services-DUixyxF2.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as NvisyError } from "./errors-
|
|
1
|
+
import { n as NvisyError } from "./errors-ChRSBkhj.js";
|
|
2
2
|
|
|
3
3
|
//#region src/services/account.ts
|
|
4
4
|
/**
|
|
@@ -15,7 +15,7 @@ var Account = class {
|
|
|
15
15
|
* @throws {ApiError} if the request fails
|
|
16
16
|
*/
|
|
17
17
|
async getAccount() {
|
|
18
|
-
const { data } = await this.#api.GET("/account
|
|
18
|
+
const { data } = await this.#api.GET("/account");
|
|
19
19
|
return data;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
@@ -25,7 +25,7 @@ var Account = class {
|
|
|
25
25
|
* @throws {ApiError} if the request fails
|
|
26
26
|
*/
|
|
27
27
|
async updateAccount(updates) {
|
|
28
|
-
const { data } = await this.#api.PATCH("/account
|
|
28
|
+
const { data } = await this.#api.PATCH("/account", { body: updates });
|
|
29
29
|
return data;
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
@@ -34,31 +34,31 @@ var Account = class {
|
|
|
34
34
|
* @throws {ApiError} if the request fails
|
|
35
35
|
*/
|
|
36
36
|
async deleteAccount() {
|
|
37
|
-
await this.#api.DELETE("/account
|
|
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.
|
|
@@ -80,7 +80,7 @@ var Account = class {
|
|
|
80
80
|
* @throws {ApiError} if the request fails
|
|
81
81
|
*/
|
|
82
82
|
async listIdentities() {
|
|
83
|
-
const { data } = await this.#api.GET("/account/identities
|
|
83
|
+
const { data } = await this.#api.GET("/account/identities");
|
|
84
84
|
return data;
|
|
85
85
|
}
|
|
86
86
|
/**
|
|
@@ -95,7 +95,7 @@ var Account = class {
|
|
|
95
95
|
* @throws {ApiError} if the request fails
|
|
96
96
|
*/
|
|
97
97
|
async setPassword(request) {
|
|
98
|
-
await this.#api.PUT("/account/identities/password
|
|
98
|
+
await this.#api.PUT("/account/identities/password", { body: request });
|
|
99
99
|
}
|
|
100
100
|
/**
|
|
101
101
|
* Remove the account's password, leaving only its linked providers.
|
|
@@ -106,7 +106,7 @@ var Account = class {
|
|
|
106
106
|
* @throws {ApiError} if the request fails
|
|
107
107
|
*/
|
|
108
108
|
async removePassword() {
|
|
109
|
-
await this.#api.DELETE("/account/identities/password
|
|
109
|
+
await this.#api.DELETE("/account/identities/password");
|
|
110
110
|
}
|
|
111
111
|
/**
|
|
112
112
|
* Begin linking an OIDC provider to the account.
|
|
@@ -121,7 +121,7 @@ var Account = class {
|
|
|
121
121
|
* @throws {ApiError} if the request fails
|
|
122
122
|
*/
|
|
123
123
|
async linkIdentity(provider, query) {
|
|
124
|
-
const { data } = await this.#api.POST("/account/identities/{provider}
|
|
124
|
+
const { data } = await this.#api.POST("/account/identities/{provider}", { params: {
|
|
125
125
|
path: { provider },
|
|
126
126
|
query
|
|
127
127
|
} });
|
|
@@ -137,7 +137,7 @@ var Account = class {
|
|
|
137
137
|
* @throws {ApiError} if the request fails
|
|
138
138
|
*/
|
|
139
139
|
async unlinkIdentity(provider) {
|
|
140
|
-
await this.#api.DELETE("/account/identities/{provider}
|
|
140
|
+
await this.#api.DELETE("/account/identities/{provider}", { params: { path: { provider } } });
|
|
141
141
|
}
|
|
142
142
|
/**
|
|
143
143
|
* Begin a step-up re-authentication with an already-linked provider.
|
|
@@ -152,7 +152,7 @@ var Account = class {
|
|
|
152
152
|
* @throws {ApiError} if the request fails
|
|
153
153
|
*/
|
|
154
154
|
async reauth(provider, query) {
|
|
155
|
-
const { data } = await this.#api.GET("/auth/{provider}/reauth
|
|
155
|
+
const { data } = await this.#api.GET("/auth/{provider}/reauth", { params: {
|
|
156
156
|
path: { provider },
|
|
157
157
|
query
|
|
158
158
|
} });
|
|
@@ -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;
|
|
@@ -258,7 +258,7 @@ var ApiTokens = class {
|
|
|
258
258
|
* @throws {ApiError} if the request fails
|
|
259
259
|
*/
|
|
260
260
|
async listApiTokens(query) {
|
|
261
|
-
const { data } = await this.#api.GET("/api-tokens
|
|
261
|
+
const { data } = await this.#api.GET("/api-tokens", { params: { query } });
|
|
262
262
|
return data;
|
|
263
263
|
}
|
|
264
264
|
/**
|
|
@@ -268,7 +268,7 @@ var ApiTokens = class {
|
|
|
268
268
|
* @throws {ApiError} if the request fails
|
|
269
269
|
*/
|
|
270
270
|
async getApiToken(tokenId) {
|
|
271
|
-
const { data } = await this.#api.GET("/api-tokens/{tokenId}
|
|
271
|
+
const { data } = await this.#api.GET("/api-tokens/{tokenId}", { params: { path: { tokenId } } });
|
|
272
272
|
return data;
|
|
273
273
|
}
|
|
274
274
|
/**
|
|
@@ -278,7 +278,7 @@ var ApiTokens = class {
|
|
|
278
278
|
* @throws {ApiError} if the request fails
|
|
279
279
|
*/
|
|
280
280
|
async createApiToken(token) {
|
|
281
|
-
const { data } = await this.#api.POST("/api-tokens
|
|
281
|
+
const { data } = await this.#api.POST("/api-tokens", { body: token });
|
|
282
282
|
return data;
|
|
283
283
|
}
|
|
284
284
|
/**
|
|
@@ -289,7 +289,7 @@ var ApiTokens = class {
|
|
|
289
289
|
* @throws {ApiError} if the request fails
|
|
290
290
|
*/
|
|
291
291
|
async updateApiToken(tokenId, updates) {
|
|
292
|
-
const { data } = await this.#api.PATCH("/api-tokens/{tokenId}
|
|
292
|
+
const { data } = await this.#api.PATCH("/api-tokens/{tokenId}", {
|
|
293
293
|
params: { path: { tokenId } },
|
|
294
294
|
body: updates
|
|
295
295
|
});
|
|
@@ -302,98 +302,7 @@ var ApiTokens = class {
|
|
|
302
302
|
* @throws {ApiError} if the request fails
|
|
303
303
|
*/
|
|
304
304
|
async revokeApiToken(tokenId) {
|
|
305
|
-
await this.#api.DELETE("/api-tokens/{tokenId}
|
|
306
|
-
}
|
|
307
|
-
};
|
|
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
|
-
} } });
|
|
305
|
+
await this.#api.DELETE("/api-tokens/{tokenId}", { params: { path: { tokenId } } });
|
|
397
306
|
}
|
|
398
307
|
};
|
|
399
308
|
|
|
@@ -419,7 +328,7 @@ var Auth = class {
|
|
|
419
328
|
* @throws {ApiError} if the request fails
|
|
420
329
|
*/
|
|
421
330
|
async loginAccount(credentials) {
|
|
422
|
-
await this.#api.POST("/auth/login
|
|
331
|
+
await this.#api.POST("/auth/login", { body: credentials });
|
|
423
332
|
}
|
|
424
333
|
/**
|
|
425
334
|
* Sign up a new account, starting a browser session.
|
|
@@ -433,7 +342,7 @@ var Auth = class {
|
|
|
433
342
|
* @throws {ApiError} if the request fails
|
|
434
343
|
*/
|
|
435
344
|
async signupAccount(credentials) {
|
|
436
|
-
await this.#api.POST("/auth/signup
|
|
345
|
+
await this.#api.POST("/auth/signup", { body: credentials });
|
|
437
346
|
}
|
|
438
347
|
/**
|
|
439
348
|
* Logout, invalidating the current session and clearing its cookies.
|
|
@@ -441,7 +350,7 @@ var Auth = class {
|
|
|
441
350
|
* @throws {ApiError} if the request fails
|
|
442
351
|
*/
|
|
443
352
|
async logoutAccount() {
|
|
444
|
-
await this.#api.POST("/auth/logout
|
|
353
|
+
await this.#api.POST("/auth/logout");
|
|
445
354
|
}
|
|
446
355
|
/**
|
|
447
356
|
* Begin an OpenID Connect sign-in with a provider.
|
|
@@ -456,7 +365,7 @@ var Auth = class {
|
|
|
456
365
|
* @throws {ApiError} if the request fails
|
|
457
366
|
*/
|
|
458
367
|
async startOidcSignIn(provider, query) {
|
|
459
|
-
const { data } = await this.#api.GET("/auth/{provider}/start
|
|
368
|
+
const { data } = await this.#api.GET("/auth/{provider}/start", { params: {
|
|
460
369
|
path: { provider },
|
|
461
370
|
query
|
|
462
371
|
} });
|
|
@@ -475,18 +384,19 @@ var Auth = class {
|
|
|
475
384
|
* @throws {ApiError} if the request fails
|
|
476
385
|
*/
|
|
477
386
|
async mintDesktopToken(request) {
|
|
478
|
-
const { data } = await this.#api.POST("/auth/desktop/token
|
|
387
|
+
const { data } = await this.#api.POST("/auth/desktop/token", { body: request });
|
|
479
388
|
return data;
|
|
480
389
|
}
|
|
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
|
|
435
|
+
* List which authentication methods this deployment offers.
|
|
436
|
+
* @returns Promise that resolves with the auth capabilities.
|
|
610
437
|
*/
|
|
611
|
-
async
|
|
612
|
-
const { data } = await this.#api.
|
|
613
|
-
params: { path: { workspaceSlug } },
|
|
614
|
-
body: session
|
|
615
|
-
});
|
|
438
|
+
async getAuthCapabilities() {
|
|
439
|
+
const { data } = await this.#api.GET("/capabilities/auth");
|
|
616
440
|
return data;
|
|
617
441
|
}
|
|
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
|
|
636
|
-
*/
|
|
637
|
-
async listMessages(workspaceSlug, sessionId) {
|
|
638
|
-
const { data } = await this.#api.GET("/workspaces/{workspaceSlug}/chat/sessions/{sessionId}/messages/", { params: { path: {
|
|
639
|
-
workspaceSlug,
|
|
640
|
-
sessionId
|
|
641
|
-
} } });
|
|
642
|
-
return data;
|
|
643
|
-
}
|
|
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
|
-
const { data } = await this.#api.POST("/invites/code/{inviteCode}
|
|
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
|
|
@@ -1328,7 +1181,7 @@ var Invites = class {
|
|
|
1328
1181
|
* @throws {ApiError} if the request fails
|
|
1329
1182
|
*/
|
|
1330
1183
|
async previewInvite(inviteCode) {
|
|
1331
|
-
const { data } = await this.#api.GET("/invites/code/{inviteCode}
|
|
1184
|
+
const { data } = await this.#api.GET("/invites/code/{inviteCode}", { params: { path: { inviteCode } } });
|
|
1332
1185
|
return data;
|
|
1333
1186
|
}
|
|
1334
1187
|
};
|
|
@@ -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
|
|
|
@@ -1430,7 +1283,7 @@ var Notifications = class {
|
|
|
1430
1283
|
* @throws {ApiError} if the request fails
|
|
1431
1284
|
*/
|
|
1432
1285
|
async listNotifications(query) {
|
|
1433
|
-
const { data } = await this.#api.GET("/notifications
|
|
1286
|
+
const { data } = await this.#api.GET("/notifications", { params: { query } });
|
|
1434
1287
|
return data;
|
|
1435
1288
|
}
|
|
1436
1289
|
/**
|
|
@@ -1439,7 +1292,7 @@ var Notifications = class {
|
|
|
1439
1292
|
* @throws {ApiError} if the request fails
|
|
1440
1293
|
*/
|
|
1441
1294
|
async getUnreadNotificationsStatus() {
|
|
1442
|
-
const { data } = await this.#api.GET("/notifications/unread
|
|
1295
|
+
const { data } = await this.#api.GET("/notifications/unread");
|
|
1443
1296
|
return data;
|
|
1444
1297
|
}
|
|
1445
1298
|
/**
|
|
@@ -1448,7 +1301,7 @@ var Notifications = class {
|
|
|
1448
1301
|
* @throws {ApiError} if the request fails
|
|
1449
1302
|
*/
|
|
1450
1303
|
async markAllRead() {
|
|
1451
|
-
const { data } = await this.#api.POST("/notifications/read
|
|
1304
|
+
const { data } = await this.#api.POST("/notifications/read");
|
|
1452
1305
|
return data;
|
|
1453
1306
|
}
|
|
1454
1307
|
/**
|
|
@@ -1457,7 +1310,7 @@ var Notifications = class {
|
|
|
1457
1310
|
* @throws {ApiError} if the request fails
|
|
1458
1311
|
*/
|
|
1459
1312
|
async markRead(notificationId) {
|
|
1460
|
-
await this.#api.POST("/notifications/{notificationId}/read
|
|
1313
|
+
await this.#api.POST("/notifications/{notificationId}/read", { params: { path: { notificationId } } });
|
|
1461
1314
|
}
|
|
1462
1315
|
/**
|
|
1463
1316
|
* Open the raw Server-Sent Events stream of the account's unread count.
|
|
@@ -1471,7 +1324,7 @@ var Notifications = class {
|
|
|
1471
1324
|
* @throws {ApiError} if the request fails
|
|
1472
1325
|
*/
|
|
1473
1326
|
async events() {
|
|
1474
|
-
const { response } = await this.#api.GET("/notifications/unread/events
|
|
1327
|
+
const { response } = await this.#api.GET("/notifications/unread/events", { parseAs: "stream" });
|
|
1475
1328
|
return response;
|
|
1476
1329
|
}
|
|
1477
1330
|
/**
|
|
@@ -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;
|
|
@@ -1801,11 +1654,39 @@ var Status = class {
|
|
|
1801
1654
|
this.#api = api;
|
|
1802
1655
|
}
|
|
1803
1656
|
/**
|
|
1804
|
-
* Check the health status of the API
|
|
1657
|
+
* Check the health status of the API.
|
|
1658
|
+
*
|
|
1659
|
+
* Reports the server's health and that of its dependencies. Returns `Health`
|
|
1660
|
+
* for both the healthy/degraded (200) and unhealthy (503) cases.
|
|
1661
|
+
*
|
|
1805
1662
|
* @returns Promise that resolves with the API health status
|
|
1806
1663
|
*/
|
|
1807
1664
|
async checkHealth() {
|
|
1808
|
-
const { data, error } = await this.#api.GET("/health
|
|
1665
|
+
const { data, error } = await this.#api.GET("/health");
|
|
1666
|
+
return data ?? error;
|
|
1667
|
+
}
|
|
1668
|
+
/**
|
|
1669
|
+
* Liveness probe: resolves if the process is running. Probes no dependencies.
|
|
1670
|
+
*
|
|
1671
|
+
* Returns the raw `Response` (the endpoint has no body); a non-2xx status
|
|
1672
|
+
* throws via the error middleware.
|
|
1673
|
+
*
|
|
1674
|
+
* @returns Promise that resolves with the probe response
|
|
1675
|
+
* @throws {ApiError} if the process is not live
|
|
1676
|
+
*/
|
|
1677
|
+
async checkLiveness() {
|
|
1678
|
+
const { response } = await this.#api.GET("/health/live");
|
|
1679
|
+
return response;
|
|
1680
|
+
}
|
|
1681
|
+
/**
|
|
1682
|
+
* Readiness probe: reports the server's health and that of its dependencies,
|
|
1683
|
+
* served from a short-lived cache. Returns `Health` for both the
|
|
1684
|
+
* healthy/degraded (200) and unhealthy (503) cases. Safe to poll frequently.
|
|
1685
|
+
*
|
|
1686
|
+
* @returns Promise that resolves with the API health status
|
|
1687
|
+
*/
|
|
1688
|
+
async checkReadiness() {
|
|
1689
|
+
const { data, error } = await this.#api.GET("/health/ready");
|
|
1809
1690
|
return data ?? error;
|
|
1810
1691
|
}
|
|
1811
1692
|
};
|
|
@@ -1822,14 +1703,14 @@ var Syncs = class {
|
|
|
1822
1703
|
}
|
|
1823
1704
|
/**
|
|
1824
1705
|
* List all syncs across a workspace's connections
|
|
1825
|
-
* @param
|
|
1706
|
+
* @param workspaceId - Workspace id
|
|
1826
1707
|
* @param query - Optional query parameters (provider, status, limit, after)
|
|
1827
1708
|
* @returns Promise that resolves with a paginated list of connection syncs
|
|
1828
1709
|
* @throws {ApiError} if the request fails
|
|
1829
1710
|
*/
|
|
1830
|
-
async listWorkspaceSyncs(
|
|
1831
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
1832
|
-
path: {
|
|
1711
|
+
async listWorkspaceSyncs(workspaceId, query) {
|
|
1712
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/syncs", { params: {
|
|
1713
|
+
path: { workspaceId },
|
|
1833
1714
|
query
|
|
1834
1715
|
} });
|
|
1835
1716
|
return data;
|
|
@@ -1842,30 +1723,30 @@ var Syncs = class {
|
|
|
1842
1723
|
* use {@link Connections.importFiles} and {@link Connections.exportFiles}
|
|
1843
1724
|
* instead. Returns the created sync — poll it for completion.
|
|
1844
1725
|
*
|
|
1845
|
-
* @param
|
|
1726
|
+
* @param workspaceId - Workspace id
|
|
1846
1727
|
* @param connectionId - Connection ID
|
|
1847
1728
|
* @returns Promise that resolves with the started connection sync
|
|
1848
1729
|
* @throws {ApiError} if the request fails
|
|
1849
1730
|
*/
|
|
1850
|
-
async startSync(
|
|
1851
|
-
const { data } = await this.#api.POST("/workspaces/{
|
|
1852
|
-
|
|
1731
|
+
async startSync(workspaceId, connectionId) {
|
|
1732
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/connections/{connectionId}/sync", { params: { path: {
|
|
1733
|
+
workspaceId,
|
|
1853
1734
|
connectionId
|
|
1854
1735
|
} } });
|
|
1855
1736
|
return data;
|
|
1856
1737
|
}
|
|
1857
1738
|
/**
|
|
1858
1739
|
* List syncs for a connection
|
|
1859
|
-
* @param
|
|
1740
|
+
* @param workspaceId - Workspace id
|
|
1860
1741
|
* @param connectionId - Connection ID
|
|
1861
1742
|
* @param query - Optional pagination parameters (limit, after)
|
|
1862
1743
|
* @returns Promise that resolves with a paginated list of connection syncs
|
|
1863
1744
|
* @throws {ApiError} if the request fails
|
|
1864
1745
|
*/
|
|
1865
|
-
async listSyncs(
|
|
1866
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
1746
|
+
async listSyncs(workspaceId, connectionId, query) {
|
|
1747
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/connections/{connectionId}/syncs", { params: {
|
|
1867
1748
|
path: {
|
|
1868
|
-
|
|
1749
|
+
workspaceId,
|
|
1869
1750
|
connectionId
|
|
1870
1751
|
},
|
|
1871
1752
|
query
|
|
@@ -1874,15 +1755,15 @@ var Syncs = class {
|
|
|
1874
1755
|
}
|
|
1875
1756
|
/**
|
|
1876
1757
|
* Get a connection sync by ID
|
|
1877
|
-
* @param
|
|
1758
|
+
* @param workspaceId - Workspace id
|
|
1878
1759
|
* @param connectionId - Connection ID
|
|
1879
1760
|
* @param syncId - Sync ID
|
|
1880
1761
|
* @returns Promise that resolves with the connection sync details
|
|
1881
1762
|
* @throws {ApiError} if the request fails
|
|
1882
1763
|
*/
|
|
1883
|
-
async getSync(
|
|
1884
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
1885
|
-
|
|
1764
|
+
async getSync(workspaceId, connectionId, syncId) {
|
|
1765
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/connections/{connectionId}/syncs/{syncId}", { params: { path: {
|
|
1766
|
+
workspaceId,
|
|
1886
1767
|
connectionId,
|
|
1887
1768
|
syncId
|
|
1888
1769
|
} } });
|
|
@@ -1890,15 +1771,15 @@ var Syncs = class {
|
|
|
1890
1771
|
}
|
|
1891
1772
|
/**
|
|
1892
1773
|
* Cancel a running connection sync
|
|
1893
|
-
* @param
|
|
1774
|
+
* @param workspaceId - Workspace id
|
|
1894
1775
|
* @param connectionId - Connection ID
|
|
1895
1776
|
* @param syncId - Sync ID
|
|
1896
1777
|
* @returns Promise that resolves with the canceled connection sync
|
|
1897
1778
|
* @throws {ApiError} if the request fails
|
|
1898
1779
|
*/
|
|
1899
|
-
async cancelSync(
|
|
1900
|
-
const { data } = await this.#api.POST("/workspaces/{
|
|
1901
|
-
|
|
1780
|
+
async cancelSync(workspaceId, connectionId, syncId) {
|
|
1781
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/connections/{connectionId}/syncs/{syncId}/cancel", { params: { path: {
|
|
1782
|
+
workspaceId,
|
|
1902
1783
|
connectionId,
|
|
1903
1784
|
syncId
|
|
1904
1785
|
} } });
|
|
@@ -1906,6 +1787,172 @@ var Syncs = class {
|
|
|
1906
1787
|
}
|
|
1907
1788
|
};
|
|
1908
1789
|
|
|
1790
|
+
//#endregion
|
|
1791
|
+
//#region src/services/threads.ts
|
|
1792
|
+
/**
|
|
1793
|
+
* Service for discussion threads and the comments within them.
|
|
1794
|
+
*/
|
|
1795
|
+
var Threads = class {
|
|
1796
|
+
#api;
|
|
1797
|
+
constructor(api) {
|
|
1798
|
+
this.#api = api;
|
|
1799
|
+
}
|
|
1800
|
+
/**
|
|
1801
|
+
* List a workspace's threads
|
|
1802
|
+
* @param workspaceId - Workspace id
|
|
1803
|
+
* @param query - Optional pagination and filters (status, limit, after)
|
|
1804
|
+
* @returns Promise that resolves with a paginated list of threads
|
|
1805
|
+
* @throws {ApiError} if the request fails
|
|
1806
|
+
*/
|
|
1807
|
+
async listThreads(workspaceId, query) {
|
|
1808
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/threads", { params: {
|
|
1809
|
+
path: { workspaceId },
|
|
1810
|
+
query
|
|
1811
|
+
} });
|
|
1812
|
+
return data;
|
|
1813
|
+
}
|
|
1814
|
+
/**
|
|
1815
|
+
* Open a new thread in a workspace
|
|
1816
|
+
* @param workspaceId - Workspace id
|
|
1817
|
+
* @param thread - Thread creation request
|
|
1818
|
+
* @returns Promise that resolves with the created thread
|
|
1819
|
+
* @throws {ApiError} if the request fails
|
|
1820
|
+
*/
|
|
1821
|
+
async openThread(workspaceId, thread) {
|
|
1822
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/threads", {
|
|
1823
|
+
params: { path: { workspaceId } },
|
|
1824
|
+
body: thread
|
|
1825
|
+
});
|
|
1826
|
+
return data;
|
|
1827
|
+
}
|
|
1828
|
+
/**
|
|
1829
|
+
* Rename a thread
|
|
1830
|
+
* @param workspaceId - Workspace id
|
|
1831
|
+
* @param threadId - Thread ID
|
|
1832
|
+
* @param updates - Thread rename request
|
|
1833
|
+
* @returns Promise that resolves with the updated thread
|
|
1834
|
+
* @throws {ApiError} if the request fails
|
|
1835
|
+
*/
|
|
1836
|
+
async renameThread(workspaceId, threadId, updates) {
|
|
1837
|
+
const { data } = await this.#api.PATCH("/workspaces/{workspaceId}/threads/{threadId}", {
|
|
1838
|
+
params: { path: {
|
|
1839
|
+
workspaceId,
|
|
1840
|
+
threadId
|
|
1841
|
+
} },
|
|
1842
|
+
body: updates
|
|
1843
|
+
});
|
|
1844
|
+
return data;
|
|
1845
|
+
}
|
|
1846
|
+
/**
|
|
1847
|
+
* Delete a thread
|
|
1848
|
+
* @param workspaceId - Workspace id
|
|
1849
|
+
* @param threadId - Thread ID
|
|
1850
|
+
* @returns Promise that resolves when the thread is deleted
|
|
1851
|
+
* @throws {ApiError} if the request fails
|
|
1852
|
+
*/
|
|
1853
|
+
async deleteThread(workspaceId, threadId) {
|
|
1854
|
+
await this.#api.DELETE("/workspaces/{workspaceId}/threads/{threadId}", { params: { path: {
|
|
1855
|
+
workspaceId,
|
|
1856
|
+
threadId
|
|
1857
|
+
} } });
|
|
1858
|
+
}
|
|
1859
|
+
/**
|
|
1860
|
+
* Close a thread, ending the discussion.
|
|
1861
|
+
* @param workspaceId - Workspace id
|
|
1862
|
+
* @param threadId - Thread ID
|
|
1863
|
+
* @returns Promise that resolves with the closed thread
|
|
1864
|
+
* @throws {ApiError} if the request fails
|
|
1865
|
+
*/
|
|
1866
|
+
async closeThread(workspaceId, threadId) {
|
|
1867
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/threads/{threadId}/close", { params: { path: {
|
|
1868
|
+
workspaceId,
|
|
1869
|
+
threadId
|
|
1870
|
+
} } });
|
|
1871
|
+
return data;
|
|
1872
|
+
}
|
|
1873
|
+
/**
|
|
1874
|
+
* Reopen a closed thread.
|
|
1875
|
+
* @param workspaceId - Workspace id
|
|
1876
|
+
* @param threadId - Thread ID
|
|
1877
|
+
* @returns Promise that resolves with the reopened thread
|
|
1878
|
+
* @throws {ApiError} if the request fails
|
|
1879
|
+
*/
|
|
1880
|
+
async reopenThread(workspaceId, threadId) {
|
|
1881
|
+
const { data } = await this.#api.DELETE("/workspaces/{workspaceId}/threads/{threadId}/close", { params: { path: {
|
|
1882
|
+
workspaceId,
|
|
1883
|
+
threadId
|
|
1884
|
+
} } });
|
|
1885
|
+
return data;
|
|
1886
|
+
}
|
|
1887
|
+
/**
|
|
1888
|
+
* List a thread's timeline: comments interleaved with lifecycle events.
|
|
1889
|
+
* @param workspaceId - Workspace id
|
|
1890
|
+
* @param threadId - Thread ID
|
|
1891
|
+
* @param query - Optional pagination parameters (limit, after)
|
|
1892
|
+
* @returns Promise that resolves with a paginated timeline
|
|
1893
|
+
* @throws {ApiError} if the request fails
|
|
1894
|
+
*/
|
|
1895
|
+
async listTimeline(workspaceId, threadId, query) {
|
|
1896
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/threads/{threadId}/timeline", { params: {
|
|
1897
|
+
path: {
|
|
1898
|
+
workspaceId,
|
|
1899
|
+
threadId
|
|
1900
|
+
},
|
|
1901
|
+
query
|
|
1902
|
+
} });
|
|
1903
|
+
return data;
|
|
1904
|
+
}
|
|
1905
|
+
/**
|
|
1906
|
+
* Post a comment to a thread
|
|
1907
|
+
* @param workspaceId - Workspace id
|
|
1908
|
+
* @param threadId - Thread ID
|
|
1909
|
+
* @param comment - Comment creation request
|
|
1910
|
+
* @returns Promise that resolves with the created comment
|
|
1911
|
+
* @throws {ApiError} if the request fails
|
|
1912
|
+
*/
|
|
1913
|
+
async createComment(workspaceId, threadId, comment) {
|
|
1914
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/threads/{threadId}/comments", {
|
|
1915
|
+
params: { path: {
|
|
1916
|
+
workspaceId,
|
|
1917
|
+
threadId
|
|
1918
|
+
} },
|
|
1919
|
+
body: comment
|
|
1920
|
+
});
|
|
1921
|
+
return data;
|
|
1922
|
+
}
|
|
1923
|
+
/**
|
|
1924
|
+
* Edit a comment
|
|
1925
|
+
* @param workspaceId - Workspace id
|
|
1926
|
+
* @param commentId - Comment ID
|
|
1927
|
+
* @param updates - Comment update request
|
|
1928
|
+
* @returns Promise that resolves with the updated comment
|
|
1929
|
+
* @throws {ApiError} if the request fails
|
|
1930
|
+
*/
|
|
1931
|
+
async updateComment(workspaceId, commentId, updates) {
|
|
1932
|
+
const { data } = await this.#api.PATCH("/workspaces/{workspaceId}/comments/{commentId}", {
|
|
1933
|
+
params: { path: {
|
|
1934
|
+
workspaceId,
|
|
1935
|
+
commentId
|
|
1936
|
+
} },
|
|
1937
|
+
body: updates
|
|
1938
|
+
});
|
|
1939
|
+
return data;
|
|
1940
|
+
}
|
|
1941
|
+
/**
|
|
1942
|
+
* Delete a comment
|
|
1943
|
+
* @param workspaceId - Workspace id
|
|
1944
|
+
* @param commentId - Comment ID
|
|
1945
|
+
* @returns Promise that resolves when the comment is deleted
|
|
1946
|
+
* @throws {ApiError} if the request fails
|
|
1947
|
+
*/
|
|
1948
|
+
async deleteComment(workspaceId, commentId) {
|
|
1949
|
+
await this.#api.DELETE("/workspaces/{workspaceId}/comments/{commentId}", { params: { path: {
|
|
1950
|
+
workspaceId,
|
|
1951
|
+
commentId
|
|
1952
|
+
} } });
|
|
1953
|
+
}
|
|
1954
|
+
};
|
|
1955
|
+
|
|
1909
1956
|
//#endregion
|
|
1910
1957
|
//#region src/services/webhooks.ts
|
|
1911
1958
|
/**
|
|
@@ -1918,58 +1965,58 @@ var Webhooks = class {
|
|
|
1918
1965
|
}
|
|
1919
1966
|
/**
|
|
1920
1967
|
* List all webhooks in a workspace
|
|
1921
|
-
* @param
|
|
1968
|
+
* @param workspaceId - Workspace id
|
|
1922
1969
|
* @param query - Optional pagination parameters (limit, after)
|
|
1923
1970
|
* @returns Promise that resolves with a paginated list of webhooks
|
|
1924
1971
|
* @throws {ApiError} if the request fails
|
|
1925
1972
|
*/
|
|
1926
|
-
async listWebhooks(
|
|
1927
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
1928
|
-
path: {
|
|
1973
|
+
async listWebhooks(workspaceId, query) {
|
|
1974
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/webhooks", { params: {
|
|
1975
|
+
path: { workspaceId },
|
|
1929
1976
|
query
|
|
1930
1977
|
} });
|
|
1931
1978
|
return data;
|
|
1932
1979
|
}
|
|
1933
1980
|
/**
|
|
1934
1981
|
* Create a new webhook
|
|
1935
|
-
* @param
|
|
1982
|
+
* @param workspaceId - Workspace id
|
|
1936
1983
|
* @param webhook - Webhook creation request
|
|
1937
1984
|
* @returns Promise that resolves with the created webhook (including secret)
|
|
1938
1985
|
* @throws {ApiError} if the request fails
|
|
1939
1986
|
*/
|
|
1940
|
-
async createWebhook(
|
|
1941
|
-
const { data } = await this.#api.POST("/workspaces/{
|
|
1942
|
-
params: { path: {
|
|
1987
|
+
async createWebhook(workspaceId, webhook) {
|
|
1988
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/webhooks", {
|
|
1989
|
+
params: { path: { workspaceId } },
|
|
1943
1990
|
body: webhook
|
|
1944
1991
|
});
|
|
1945
1992
|
return data;
|
|
1946
1993
|
}
|
|
1947
1994
|
/**
|
|
1948
|
-
* Get a specific webhook by
|
|
1949
|
-
* @param
|
|
1995
|
+
* Get a specific webhook by id
|
|
1996
|
+
* @param workspaceId - Workspace id
|
|
1950
1997
|
* @param webhookId - Webhook ID
|
|
1951
1998
|
* @returns Promise that resolves with the webhook details
|
|
1952
1999
|
* @throws {ApiError} if the request fails
|
|
1953
2000
|
*/
|
|
1954
|
-
async getWebhook(
|
|
1955
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
1956
|
-
|
|
2001
|
+
async getWebhook(workspaceId, webhookId) {
|
|
2002
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/webhooks/{webhookId}", { params: { path: {
|
|
2003
|
+
workspaceId,
|
|
1957
2004
|
webhookId
|
|
1958
2005
|
} } });
|
|
1959
2006
|
return data;
|
|
1960
2007
|
}
|
|
1961
2008
|
/**
|
|
1962
2009
|
* Update an existing webhook
|
|
1963
|
-
* @param
|
|
2010
|
+
* @param workspaceId - Workspace id
|
|
1964
2011
|
* @param webhookId - Webhook ID
|
|
1965
2012
|
* @param updates - Webhook update request
|
|
1966
2013
|
* @returns Promise that resolves with the updated webhook
|
|
1967
2014
|
* @throws {ApiError} if the request fails
|
|
1968
2015
|
*/
|
|
1969
|
-
async updateWebhook(
|
|
1970
|
-
const { data } = await this.#api.PATCH("/workspaces/{
|
|
2016
|
+
async updateWebhook(workspaceId, webhookId, updates) {
|
|
2017
|
+
const { data } = await this.#api.PATCH("/workspaces/{workspaceId}/webhooks/{webhookId}", {
|
|
1971
2018
|
params: { path: {
|
|
1972
|
-
|
|
2019
|
+
workspaceId,
|
|
1973
2020
|
webhookId
|
|
1974
2021
|
} },
|
|
1975
2022
|
body: updates
|
|
@@ -1978,29 +2025,29 @@ var Webhooks = class {
|
|
|
1978
2025
|
}
|
|
1979
2026
|
/**
|
|
1980
2027
|
* Delete a webhook
|
|
1981
|
-
* @param
|
|
2028
|
+
* @param workspaceId - Workspace id
|
|
1982
2029
|
* @param webhookId - Webhook ID
|
|
1983
2030
|
* @returns Promise that resolves when the webhook is deleted
|
|
1984
2031
|
* @throws {ApiError} if the request fails
|
|
1985
2032
|
*/
|
|
1986
|
-
async deleteWebhook(
|
|
1987
|
-
await this.#api.DELETE("/workspaces/{
|
|
1988
|
-
|
|
2033
|
+
async deleteWebhook(workspaceId, webhookId) {
|
|
2034
|
+
await this.#api.DELETE("/workspaces/{workspaceId}/webhooks/{webhookId}", { params: { path: {
|
|
2035
|
+
workspaceId,
|
|
1989
2036
|
webhookId
|
|
1990
2037
|
} } });
|
|
1991
2038
|
}
|
|
1992
2039
|
/**
|
|
1993
2040
|
* Test a webhook by sending a test payload
|
|
1994
|
-
* @param
|
|
2041
|
+
* @param workspaceId - Workspace id
|
|
1995
2042
|
* @param webhookId - Webhook ID
|
|
1996
2043
|
* @param options - Test webhook options
|
|
1997
2044
|
* @returns Promise that resolves with the test result
|
|
1998
2045
|
* @throws {ApiError} if the request fails
|
|
1999
2046
|
*/
|
|
2000
|
-
async testWebhook(
|
|
2001
|
-
const { data } = await this.#api.POST("/workspaces/{
|
|
2047
|
+
async testWebhook(workspaceId, webhookId, options) {
|
|
2048
|
+
const { data } = await this.#api.POST("/workspaces/{workspaceId}/webhooks/{webhookId}/test", {
|
|
2002
2049
|
params: { path: {
|
|
2003
|
-
|
|
2050
|
+
workspaceId,
|
|
2004
2051
|
webhookId
|
|
2005
2052
|
} },
|
|
2006
2053
|
body: options ?? {}
|
|
@@ -2026,17 +2073,17 @@ var Workspaces = class {
|
|
|
2026
2073
|
* @throws {ApiError} if the request fails
|
|
2027
2074
|
*/
|
|
2028
2075
|
async listWorkspaces(query) {
|
|
2029
|
-
const { data } = await this.#api.GET("/workspaces
|
|
2076
|
+
const { data } = await this.#api.GET("/workspaces", { params: { query } });
|
|
2030
2077
|
return data;
|
|
2031
2078
|
}
|
|
2032
2079
|
/**
|
|
2033
2080
|
* Get workspace details by ID
|
|
2034
|
-
* @param
|
|
2081
|
+
* @param workspaceId - Workspace id
|
|
2035
2082
|
* @returns Promise that resolves with the workspace details
|
|
2036
2083
|
* @throws {ApiError} if the request fails
|
|
2037
2084
|
*/
|
|
2038
|
-
async getWorkspace(
|
|
2039
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
2085
|
+
async getWorkspace(workspaceId) {
|
|
2086
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}", { params: { path: { workspaceId } } });
|
|
2040
2087
|
return data;
|
|
2041
2088
|
}
|
|
2042
2089
|
/**
|
|
@@ -2046,69 +2093,69 @@ var Workspaces = class {
|
|
|
2046
2093
|
* @throws {ApiError} if the request fails
|
|
2047
2094
|
*/
|
|
2048
2095
|
async createWorkspace(workspace) {
|
|
2049
|
-
const { data } = await this.#api.POST("/workspaces
|
|
2096
|
+
const { data } = await this.#api.POST("/workspaces", { body: workspace });
|
|
2050
2097
|
return data;
|
|
2051
2098
|
}
|
|
2052
2099
|
/**
|
|
2053
2100
|
* Update an existing workspace
|
|
2054
|
-
* @param
|
|
2101
|
+
* @param workspaceId - Workspace id
|
|
2055
2102
|
* @param updates - Workspace update request
|
|
2056
2103
|
* @returns Promise that resolves with the updated workspace
|
|
2057
2104
|
* @throws {ApiError} if the request fails
|
|
2058
2105
|
*/
|
|
2059
|
-
async updateWorkspace(
|
|
2060
|
-
const { data } = await this.#api.PATCH("/workspaces/{
|
|
2061
|
-
params: { path: {
|
|
2106
|
+
async updateWorkspace(workspaceId, updates) {
|
|
2107
|
+
const { data } = await this.#api.PATCH("/workspaces/{workspaceId}", {
|
|
2108
|
+
params: { path: { workspaceId } },
|
|
2062
2109
|
body: updates
|
|
2063
2110
|
});
|
|
2064
2111
|
return data;
|
|
2065
2112
|
}
|
|
2066
2113
|
/**
|
|
2067
2114
|
* Delete a workspace
|
|
2068
|
-
* @param
|
|
2115
|
+
* @param workspaceId - Workspace id
|
|
2069
2116
|
* @returns Promise that resolves when the workspace is deleted
|
|
2070
2117
|
* @throws {ApiError} if the request fails
|
|
2071
2118
|
*/
|
|
2072
|
-
async deleteWorkspace(
|
|
2073
|
-
await this.#api.DELETE("/workspaces/{
|
|
2119
|
+
async deleteWorkspace(workspaceId) {
|
|
2120
|
+
await this.#api.DELETE("/workspaces/{workspaceId}", { params: { path: { workspaceId } } });
|
|
2074
2121
|
}
|
|
2075
2122
|
/**
|
|
2076
2123
|
* Get notification settings for the authenticated user in a workspace
|
|
2077
|
-
* @param
|
|
2124
|
+
* @param workspaceId - Workspace id
|
|
2078
2125
|
* @returns Promise that resolves with the notification settings
|
|
2079
2126
|
* @throws {ApiError} if the request fails
|
|
2080
2127
|
*/
|
|
2081
|
-
async getNotificationSettings(
|
|
2082
|
-
const { data } = await this.#api.GET("/workspaces/{
|
|
2128
|
+
async getNotificationSettings(workspaceId) {
|
|
2129
|
+
const { data } = await this.#api.GET("/workspaces/{workspaceId}/notifications", { params: { path: { workspaceId } } });
|
|
2083
2130
|
return data;
|
|
2084
2131
|
}
|
|
2085
2132
|
/**
|
|
2086
2133
|
* Update notification settings for the authenticated user in a workspace
|
|
2087
|
-
* @param
|
|
2134
|
+
* @param workspaceId - Workspace id
|
|
2088
2135
|
* @param settings - Notification settings update request
|
|
2089
2136
|
* @returns Promise that resolves with the updated notification settings
|
|
2090
2137
|
* @throws {ApiError} if the request fails
|
|
2091
2138
|
*/
|
|
2092
|
-
async updateNotificationSettings(
|
|
2093
|
-
const { data } = await this.#api.PATCH("/workspaces/{
|
|
2094
|
-
params: { path: {
|
|
2139
|
+
async updateNotificationSettings(workspaceId, settings) {
|
|
2140
|
+
const { data } = await this.#api.PATCH("/workspaces/{workspaceId}/notifications", {
|
|
2141
|
+
params: { path: { workspaceId } },
|
|
2095
2142
|
body: settings
|
|
2096
2143
|
});
|
|
2097
2144
|
return data;
|
|
2098
2145
|
}
|
|
2099
2146
|
/**
|
|
2100
2147
|
* Upload a workspace's avatar image
|
|
2101
|
-
* @param
|
|
2148
|
+
* @param workspaceId - Workspace id
|
|
2102
2149
|
* @param avatar - Avatar image to upload
|
|
2103
2150
|
* @returns Promise that resolves when the avatar is uploaded
|
|
2104
2151
|
* @throws {ApiError} if the request fails
|
|
2105
2152
|
*/
|
|
2106
|
-
async uploadAvatar(
|
|
2153
|
+
async uploadAvatar(workspaceId, avatar) {
|
|
2107
2154
|
const formData = new FormData();
|
|
2108
2155
|
const name = avatar instanceof File ? avatar.name : "avatar";
|
|
2109
2156
|
formData.append("avatar", avatar, name);
|
|
2110
|
-
await this.#api.PUT("/workspaces/{
|
|
2111
|
-
params: { path: {
|
|
2157
|
+
await this.#api.PUT("/workspaces/{workspaceId}/avatar", {
|
|
2158
|
+
params: { path: { workspaceId } },
|
|
2112
2159
|
body: formData,
|
|
2113
2160
|
bodySerializer: (formData) => formData,
|
|
2114
2161
|
headers: { "Content-Type": null }
|
|
@@ -2116,15 +2163,15 @@ var Workspaces = class {
|
|
|
2116
2163
|
}
|
|
2117
2164
|
/**
|
|
2118
2165
|
* Delete a workspace's avatar image
|
|
2119
|
-
* @param
|
|
2166
|
+
* @param workspaceId - Workspace id
|
|
2120
2167
|
* @returns Promise that resolves when the avatar is deleted
|
|
2121
2168
|
* @throws {ApiError} if the request fails
|
|
2122
2169
|
*/
|
|
2123
|
-
async deleteAvatar(
|
|
2124
|
-
await this.#api.DELETE("/workspaces/{
|
|
2170
|
+
async deleteAvatar(workspaceId) {
|
|
2171
|
+
await this.#api.DELETE("/workspaces/{workspaceId}/avatar", { params: { path: { workspaceId } } });
|
|
2125
2172
|
}
|
|
2126
2173
|
};
|
|
2127
2174
|
|
|
2128
2175
|
//#endregion
|
|
2129
|
-
export {
|
|
2130
|
-
//# sourceMappingURL=services-
|
|
2176
|
+
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 };
|
|
2177
|
+
//# sourceMappingURL=services-Bt15MerP.js.map
|