@vertesia/client 0.56.0 → 0.58.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.
Files changed (56) hide show
  1. package/lib/cjs/store/FilesApi.js +29 -19
  2. package/lib/cjs/store/FilesApi.js.map +1 -1
  3. package/lib/cjs/store/ObjectsApi.js +22 -20
  4. package/lib/cjs/store/ObjectsApi.js.map +1 -1
  5. package/lib/cjs/store/WorkflowsApi.js +82 -16
  6. package/lib/cjs/store/WorkflowsApi.js.map +1 -1
  7. package/lib/esm/store/FilesApi.js +29 -19
  8. package/lib/esm/store/FilesApi.js.map +1 -1
  9. package/lib/esm/store/ObjectsApi.js +22 -20
  10. package/lib/esm/store/ObjectsApi.js.map +1 -1
  11. package/lib/esm/store/WorkflowsApi.js +82 -16
  12. package/lib/esm/store/WorkflowsApi.js.map +1 -1
  13. package/lib/tsconfig.tsbuildinfo +1 -1
  14. package/lib/types/AccountApi.d.ts +1 -0
  15. package/lib/types/AccountsApi.d.ts +1 -0
  16. package/lib/types/AnalyticsApi.d.ts +1 -0
  17. package/lib/types/ApiKeysApi.d.ts +1 -0
  18. package/lib/types/CommandsApi.d.ts +1 -0
  19. package/lib/types/EnvironmentsApi.d.ts +1 -0
  20. package/lib/types/IamApi.d.ts +1 -0
  21. package/lib/types/InteractionBase.d.ts +1 -0
  22. package/lib/types/InteractionsApi.d.ts +1 -0
  23. package/lib/types/PluginsApi.d.ts +1 -0
  24. package/lib/types/ProjectsApi.d.ts +1 -0
  25. package/lib/types/PromptsApi.d.ts +1 -0
  26. package/lib/types/RefsApi.d.ts +1 -0
  27. package/lib/types/RunsApi.d.ts +1 -0
  28. package/lib/types/StreamSource.d.ts +1 -0
  29. package/lib/types/TrainingApi.d.ts +1 -0
  30. package/lib/types/UsersApi.d.ts +1 -0
  31. package/lib/types/client.d.ts +1 -0
  32. package/lib/types/execute.d.ts +1 -0
  33. package/lib/types/index.d.ts +1 -0
  34. package/lib/types/nodejs/NodeStreamSource.d.ts +1 -0
  35. package/lib/types/nodejs/index.d.ts +1 -0
  36. package/lib/types/store/AgentsApi.d.ts +1 -0
  37. package/lib/types/store/AnalyzeDocApi.d.ts +1 -0
  38. package/lib/types/store/CollectionsApi.d.ts +1 -0
  39. package/lib/types/store/CommandsApi.d.ts +1 -0
  40. package/lib/types/store/EmbeddingsApi.d.ts +1 -0
  41. package/lib/types/store/FilesApi.d.ts +2 -0
  42. package/lib/types/store/FilesApi.d.ts.map +1 -1
  43. package/lib/types/store/ObjectsApi.d.ts +2 -7
  44. package/lib/types/store/ObjectsApi.d.ts.map +1 -1
  45. package/lib/types/store/TypesApi.d.ts +1 -0
  46. package/lib/types/store/WorkflowsApi.d.ts +1 -0
  47. package/lib/types/store/WorkflowsApi.d.ts.map +1 -1
  48. package/lib/types/store/client.d.ts +1 -0
  49. package/lib/types/store/errors.d.ts +1 -0
  50. package/lib/types/store/index.d.ts +1 -0
  51. package/lib/vertesia-client.js +1 -1
  52. package/lib/vertesia-client.js.map +1 -1
  53. package/package.json +4 -4
  54. package/src/store/FilesApi.ts +83 -55
  55. package/src/store/ObjectsApi.ts +326 -313
  56. package/src/store/WorkflowsApi.ts +91 -17
@@ -1,162 +1,166 @@
1
1
  import { ApiTopic, ClientBase } from "@vertesia/api-fetch-client";
2
2
  import {
3
- ComplexSearchPayload,
4
- ComputeObjectFacetPayload,
5
- ContentObject,
6
- ContentObjectItem,
7
- ContentSource,
8
- CreateContentObjectPayload,
9
- Embedding,
10
- ExportPropertiesPayload,
11
- ExportPropertiesResponse,
12
- FindPayload,
13
- GetFileUrlPayload,
14
- GetFileUrlResponse,
15
- GetRenditionResponse,
16
- GetUploadUrlPayload,
17
- ListWorkflowRunsResponse,
18
- ObjectSearchPayload,
19
- ObjectSearchQuery,
20
- SupportedEmbeddingTypes,
3
+ ComplexSearchPayload,
4
+ ComputeObjectFacetPayload,
5
+ ContentObject,
6
+ ContentObjectItem,
7
+ ContentSource,
8
+ CreateContentObjectPayload,
9
+ Embedding,
10
+ ExportPropertiesPayload,
11
+ ExportPropertiesResponse,
12
+ FindPayload,
13
+ GetFileUrlPayload,
14
+ GetFileUrlResponse,
15
+ GetRenditionParams,
16
+ GetRenditionResponse,
17
+ GetUploadUrlPayload,
18
+ ListWorkflowRunsResponse,
19
+ ObjectSearchPayload,
20
+ ObjectSearchQuery,
21
+ SupportedEmbeddingTypes,
21
22
  } from "@vertesia/common";
22
23
 
23
24
  import { StreamSource } from "../StreamSource.js";
24
- import { ZenoClient } from "./client.js";
25
25
  import { AnalyzeDocApi } from "./AnalyzeDocApi.js";
26
+ import { ZenoClient } from "./client.js";
26
27
 
27
- export interface UploadContentObjectPayload extends Omit<CreateContentObjectPayload, "content"> {
28
- content?:
29
- | StreamSource
30
- | File
31
- | {
32
- // the source URI
33
- source: string;
34
- // the original name of the input file if any
35
- name?: string;
36
- // the mime type of the content source.
37
- type?: string;
38
-
39
- // the target id in the content store
40
- id?: string;
41
- };
28
+ export interface UploadContentObjectPayload
29
+ extends Omit<CreateContentObjectPayload, "content"> {
30
+ content?:
31
+ | StreamSource
32
+ | File
33
+ | {
34
+ // the source URI
35
+ source: string;
36
+ // the original name of the input file if any
37
+ name?: string;
38
+ // the mime type of the content source.
39
+ type?: string;
40
+
41
+ // the target id in the content store
42
+ id?: string;
43
+ };
42
44
  }
43
45
 
44
46
  export interface ComputeFacetsResponse {
45
- type?: { _id: string; count: number }[];
46
- location?: { _id: string; count: number }[];
47
- status?: { _id: string; count: number }[];
48
- total?: { count: number }[];
47
+ type?: { _id: string; count: number }[];
48
+ location?: { _id: string; count: number }[];
49
+ status?: { _id: string; count: number }[];
50
+ total?: { count: number }[];
49
51
  }
50
52
 
51
53
  export class ObjectsApi extends ApiTopic {
52
- constructor(parent: ClientBase) {
53
- super(parent, "/api/v1/objects");
54
- }
55
-
56
- analyze(objectId: string) {
57
- return new AnalyzeDocApi(this, objectId);
58
- }
59
-
60
- getUploadUrl(payload: GetUploadUrlPayload): Promise<GetFileUrlResponse> {
61
- return this.post("/upload-url", {
62
- payload,
63
- });
64
- }
65
-
66
- getDownloadUrl(fileUri: string): Promise<{ url: string }> {
67
- return this.post("/download-url", {
68
- payload: {
69
- file: fileUri,
70
- } satisfies GetFileUrlPayload,
71
- });
72
- }
73
-
74
- getContentSource(objectId: string): Promise<ContentSource> {
75
- return this.get(`/${objectId}/content-source`);
76
- }
77
-
78
- /**
79
- * List objects with revision filtering options
80
- *
81
- * @param payload Search/filter parameters
82
- * @returns Matching content objects
83
- */
84
- list<T = any>(payload: ObjectSearchPayload = {}): Promise<ContentObjectItem<T>[]> {
85
- const limit = payload.limit || 100;
86
- const offset = payload.offset || 0;
87
- const query = payload.query || ({} as ObjectSearchQuery);
88
-
89
- // Add revision filtering options
90
- const showAllRevisions = payload.show_all_revisions === true;
91
- const revisionRoot = payload.from_root;
92
-
93
- return this.get("/", {
94
- query: {
95
- limit,
96
- offset,
97
- ...query,
98
- show_all_revisions: showAllRevisions ? "true" : undefined,
99
- from_root: revisionRoot,
100
- },
101
- });
102
- }
103
-
104
- computeFacets(query: ComputeObjectFacetPayload): Promise<ComputeFacetsResponse> {
105
- return this.post("/facets", {
106
- payload: query,
107
- });
108
- }
109
-
110
- listFolders(path: string = "/") {
111
- path; //TODO
112
- }
113
-
114
- /** Find object based on query */
115
- find(payload: FindPayload): Promise<ContentObject[]> {
116
- return this.post("/find", {
117
- payload,
118
- });
119
- }
120
-
121
- /** Count number of objects matching this query */
122
- count(payload: FindPayload): Promise<{ count: number }> {
123
- return this.post("/count", {
124
- payload,
125
- });
126
- }
127
-
128
- /** Search object — different from find because allow full text search */
129
- search(payload: ComplexSearchPayload): Promise<ContentObjectItem[]> {
130
- return this.post("/search", {
131
- payload,
132
- });
133
- }
134
-
135
- retrieve(id: string, select?: string): Promise<ContentObject> {
136
- return this.get(`/${id}`, {
137
- query: {
138
- select,
139
- },
140
- });
141
- }
142
-
143
- getObjectText(id: string): Promise<{ text: string }> {
144
- return this.get(`/${id}/text`);
145
- }
146
-
147
- async upload(source: StreamSource | File) {
148
- const isStream = source instanceof StreamSource;
149
- // get a signed URL to upload the file a computed mimeType and the file object id.
150
- const { url, id, mime_type } = await this.getUploadUrl({
151
- id: isStream ? source.id : undefined,
152
- name: source.name,
153
- mime_type: source.type,
154
- });
155
-
156
- console.log(`Uploading content to ${url}`, { id, mime_type, isStream, source });
157
-
158
- // upload the file content to the signed URL
159
- /*const res = await this.fetch(url, {
54
+ constructor(parent: ClientBase) {
55
+ super(parent, "/api/v1/objects");
56
+ }
57
+
58
+ analyze(objectId: string) {
59
+ return new AnalyzeDocApi(this, objectId);
60
+ }
61
+
62
+ getUploadUrl(payload: GetUploadUrlPayload): Promise<GetFileUrlResponse> {
63
+ return this.post("/upload-url", {
64
+ payload,
65
+ });
66
+ }
67
+
68
+ getDownloadUrl(fileUri: string): Promise<{ url: string }> {
69
+ return this.post("/download-url", {
70
+ payload: {
71
+ file: fileUri,
72
+ } satisfies GetFileUrlPayload,
73
+ });
74
+ }
75
+
76
+ getContentSource(objectId: string): Promise<ContentSource> {
77
+ return this.get(`/${objectId}/content-source`);
78
+ }
79
+
80
+ /**
81
+ * List objects with revision filtering options
82
+ *
83
+ * @param payload Search/filter parameters
84
+ * @returns Matching content objects
85
+ */
86
+ list<T = any>(
87
+ payload: ObjectSearchPayload = {},
88
+ ): Promise<ContentObjectItem<T>[]> {
89
+ const limit = payload.limit || 100;
90
+ const offset = payload.offset || 0;
91
+ const query = payload.query || ({} as ObjectSearchQuery);
92
+
93
+ // Add revision filtering options
94
+ const showAllRevisions = payload.all_revisions === true;
95
+ const revisionRoot = payload.from_root;
96
+
97
+ return this.get("/", {
98
+ query: {
99
+ limit,
100
+ offset,
101
+ ...query,
102
+ all_revisions: showAllRevisions ? "true" : undefined,
103
+ from_root: revisionRoot,
104
+ },
105
+ });
106
+ }
107
+
108
+ computeFacets(
109
+ query: ComputeObjectFacetPayload,
110
+ ): Promise<ComputeFacetsResponse> {
111
+ return this.post("/facets", {
112
+ payload: query,
113
+ });
114
+ }
115
+
116
+ listFolders(path: string = "/") {
117
+ path; //TODO
118
+ }
119
+
120
+ /** Find object based on query */
121
+ find(payload: FindPayload): Promise<ContentObject[]> {
122
+ return this.post("/find", {
123
+ payload,
124
+ });
125
+ }
126
+
127
+ /** Count number of objects matching this query */
128
+ count(payload: FindPayload): Promise<{ count: number }> {
129
+ return this.post("/count", {
130
+ payload,
131
+ });
132
+ }
133
+
134
+ /** Search object — different from find because allow full text search */
135
+ search(payload: ComplexSearchPayload): Promise<ContentObjectItem[]> {
136
+ return this.post("/search", {
137
+ payload,
138
+ });
139
+ }
140
+
141
+ retrieve(id: string, select?: string): Promise<ContentObject> {
142
+ return this.get(`/${id}`, {
143
+ query: {
144
+ select,
145
+ },
146
+ });
147
+ }
148
+
149
+ getObjectText(id: string): Promise<{ text: string }> {
150
+ return this.get(`/${id}/text`);
151
+ }
152
+
153
+ async upload(source: StreamSource | File) {
154
+ const isStream = source instanceof StreamSource;
155
+ // get a signed URL to upload the file a computed mimeType and the file object id.
156
+ const { url, id, mime_type } = await this.getUploadUrl({
157
+ id: isStream ? source.id : undefined,
158
+ name: source.name,
159
+ mime_type: source.type,
160
+ });
161
+
162
+ // upload the file content to the signed URL
163
+ /*const res = await this.fetch(url, {
160
164
  method: 'PUT',
161
165
  //@ts-ignore: duplex is not in the types. See https://github.com/node-fetch/node-fetch/issues/1769
162
166
  duplex: isStream ? "half" : undefined,
@@ -173,177 +177,186 @@ export class ObjectsApi extends ApiTopic {
173
177
  }
174
178
  });*/
175
179
 
176
- const res = await fetch(url, {
177
- method: "PUT",
178
- body: isStream ? source.stream : source,
179
- //@ts-ignore: duplex is not in the types. See https://github.com/node-fetch/node-fetch/issues/1769
180
- duplex: isStream ? "half" : undefined,
181
- headers: {
182
- "Content-Type": mime_type || "application/octet-stream",
183
- },
184
- })
185
- .then((res: Response) => {
186
- if (res.ok) {
187
- return res;
188
- } else {
189
- console.log(res);
190
- throw new Error(`Failed to upload file: ${res.statusText}`);
191
- }
192
- })
193
- .catch((err) => {
194
- console.error("Failed to upload file", err);
195
- throw err;
196
- });
197
-
198
- //Etag need to be unquoted
199
- //When a server returns an ETag header, it includes the quotes around the actual hash value.
200
- //This is part of the HTTP specification (RFC 7232), which states that ETags should be
201
- //enclosed in double quotes.
202
- const etag = res.headers.get("etag")?.replace(/^"(.*)"$/, "$1");
203
-
204
- return {
205
- source: id,
206
- name: source.name,
207
- type: mime_type,
208
- etag,
209
- };
210
- }
211
-
212
- async create(
213
- payload: UploadContentObjectPayload,
214
- options?: {
215
- collection_id?: string;
216
- },
217
- ): Promise<ContentObject> {
218
- const createPayload: CreateContentObjectPayload = {
219
- ...payload,
220
- };
221
- if (payload.content instanceof StreamSource || payload.content instanceof File) {
222
- createPayload.content = await this.upload(payload.content);
223
- }
224
- return await this.post("/", {
225
- payload: createPayload,
226
- query: options || {},
227
- });
228
- }
229
-
230
- /**
231
- * Create an object which holds a reference to an external blob (i.e. not in the project bucket)
232
- * The uri should starts either with gs:// or s3://. Not other protocols are supported yet.
233
- * For the s3 blobs you must use a hash with the blob #region. Ex: s3://bucket/path/to/file#us-east-1
234
- * @param uri
235
- * @param payload
236
- * @returns
237
- */
238
- async createFromExternalSource(uri: string, payload: CreateContentObjectPayload = {}): Promise<ContentObject> {
239
- const metadata = await (this.client as ZenoClient).files.getMetadata(uri);
240
- const createPayload: CreateContentObjectPayload = {
241
- ...payload,
242
- content: {
243
- source: uri,
244
- name: metadata.name,
245
- type: metadata.contentType,
246
- etag: metadata.etag,
247
- },
248
- };
249
- return await this.post("/", {
250
- payload: createPayload,
251
- });
252
- }
253
-
254
- /**
255
- * Updates an existing object or creates a new revision
256
- * Handles file uploads similar to the create method
257
- *
258
- * @param id The ID of the object to update
259
- * @param payload The changes to apply
260
- * @param options Additional options
261
- * @param options.createRevision Whether to create a new revision instead of updating in place
262
- * @param options.revisionLabel Optional label for the revision (e.g., "v1.2")
263
- * @returns The updated object or newly created revision
264
- */
265
- async update(
266
- id: string,
267
- payload: Partial<CreateContentObjectPayload>,
268
- options?: {
269
- createRevision?: boolean;
270
- revisionLabel?: string;
271
- },
272
- ): Promise<ContentObject> {
273
- const updatePayload: Partial<CreateContentObjectPayload> = {
274
- ...payload,
275
- };
276
-
277
- // Handle file upload if content is provided as File or StreamSource
278
- if (payload.content instanceof StreamSource || payload.content instanceof File) {
279
- updatePayload.content = await this.upload(payload.content);
280
- }
281
-
282
- if (options?.createRevision) {
283
- return this.put(`/${id}`, {
284
- payload: updatePayload,
285
- headers: {
286
- "x-create-revision": "true",
287
- "x-revision-label": options.revisionLabel || "",
288
- },
289
- });
180
+ const res = await fetch(url, {
181
+ method: "PUT",
182
+ body: isStream ? source.stream : source,
183
+ //@ts-ignore: duplex is not in the types. See https://github.com/node-fetch/node-fetch/issues/1769
184
+ duplex: isStream ? "half" : undefined,
185
+ headers: {
186
+ "Content-Type": mime_type || "application/octet-stream",
187
+ },
188
+ })
189
+ .then((res: Response) => {
190
+ if (res.ok) {
191
+ return res;
290
192
  } else {
291
- return this.put(`/${id}`, {
292
- payload: updatePayload,
293
- });
193
+ console.log(res);
194
+ throw new Error(`Failed to upload file: ${res.statusText}`);
294
195
  }
196
+ })
197
+ .catch((err) => {
198
+ console.error("Failed to upload file", err);
199
+ throw err;
200
+ });
201
+
202
+ //Etag need to be unquoted
203
+ //When a server returns an ETag header, it includes the quotes around the actual hash value.
204
+ //This is part of the HTTP specification (RFC 7232), which states that ETags should be
205
+ //enclosed in double quotes.
206
+ const etag = res.headers.get("etag")?.replace(/^"(.*)"$/, "$1");
207
+
208
+ return {
209
+ source: id,
210
+ name: source.name,
211
+ type: mime_type,
212
+ etag,
213
+ };
214
+ }
215
+
216
+ async create(
217
+ payload: UploadContentObjectPayload,
218
+ options?: {
219
+ collection_id?: string;
220
+ },
221
+ ): Promise<ContentObject> {
222
+ const createPayload: CreateContentObjectPayload = {
223
+ ...payload,
224
+ };
225
+ if (
226
+ payload.content instanceof StreamSource ||
227
+ payload.content instanceof File
228
+ ) {
229
+ createPayload.content = await this.upload(payload.content);
295
230
  }
296
-
297
- /**
298
- * Retrieves all revisions of a content object
299
- *
300
- * @param id The ID of any revision in the object's history
301
- * @returns Array of all revisions sharing the same root
302
- */
303
- getRevisions(id: string): Promise<ContentObjectItem[]> {
304
- return this.get(`/${id}/revisions`);
305
- }
306
-
307
- delete(id: string): Promise<{ id: string }> {
308
- return this.del(`/${id}`);
309
- }
310
-
311
- listWorkflowRuns(documentId: string): Promise<ListWorkflowRunsResponse> {
312
- return this.get(`/${documentId}/workflow-runs`);
313
- }
314
-
315
- listRenditions(documentId: string): Promise<ContentObjectItem[]> {
316
- return this.get(`/${documentId}/renditions`);
231
+ return await this.post("/", {
232
+ payload: createPayload,
233
+ query: options || {},
234
+ });
235
+ }
236
+
237
+ /**
238
+ * Create an object which holds a reference to an external blob (i.e. not in the project bucket)
239
+ * The uri should starts either with gs:// or s3://. Not other protocols are supported yet.
240
+ * For the s3 blobs you must use a hash with the blob #region. Ex: s3://bucket/path/to/file#us-east-1
241
+ * @param uri
242
+ * @param payload
243
+ * @returns
244
+ */
245
+ async createFromExternalSource(
246
+ uri: string,
247
+ payload: CreateContentObjectPayload = {},
248
+ ): Promise<ContentObject> {
249
+ const metadata = await (this.client as ZenoClient).files.getMetadata(uri);
250
+ const createPayload: CreateContentObjectPayload = {
251
+ ...payload,
252
+ content: {
253
+ source: uri,
254
+ name: metadata.name,
255
+ type: metadata.contentType,
256
+ etag: metadata.etag,
257
+ },
258
+ };
259
+ return await this.post("/", {
260
+ payload: createPayload,
261
+ });
262
+ }
263
+
264
+ /**
265
+ * Updates an existing object or creates a new revision
266
+ * Handles file uploads similar to the create method
267
+ *
268
+ * @param id The ID of the object to update
269
+ * @param payload The changes to apply
270
+ * @param options Additional options
271
+ * @param options.createRevision Whether to create a new revision instead of updating in place
272
+ * @param options.revisionLabel Optional label for the revision (e.g., "v1.2")
273
+ * @returns The updated object or newly created revision
274
+ */
275
+ async update(
276
+ id: string,
277
+ payload: Partial<CreateContentObjectPayload>,
278
+ options?: {
279
+ createRevision?: boolean;
280
+ revisionLabel?: string;
281
+ },
282
+ ): Promise<ContentObject> {
283
+ const updatePayload: Partial<CreateContentObjectPayload> = {
284
+ ...payload,
285
+ };
286
+
287
+ // Handle file upload if content is provided as File or StreamSource
288
+ if (
289
+ payload.content instanceof StreamSource ||
290
+ payload.content instanceof File
291
+ ) {
292
+ updatePayload.content = await this.upload(payload.content);
317
293
  }
318
294
 
319
- getRendition(documentId: string, options: GetRenditionParams): Promise<GetRenditionResponse> {
320
- const query = {
321
- max_hw: options.max_hw,
322
- generate_if_missing: options.generate_if_missing,
323
- };
324
-
325
- return this.get(`/${documentId}/renditions/${options.format}`, { query });
326
- }
327
-
328
- exportProperties(payload: ExportPropertiesPayload): Promise<ExportPropertiesResponse> {
329
- return this.post("/export", {
330
- payload,
331
- });
332
- }
333
-
334
- setEmbedding(
335
- id: string,
336
- type: SupportedEmbeddingTypes,
337
- payload: Embedding,
338
- ): Promise<Record<SupportedEmbeddingTypes, Embedding>> {
339
- return this.put(`/${id}/embeddings/${type}`, {
340
- payload,
341
- });
295
+ if (options?.createRevision) {
296
+ return this.put(`/${id}`, {
297
+ payload: updatePayload,
298
+ headers: {
299
+ "x-create-revision": "true",
300
+ "x-revision-label": options.revisionLabel || "",
301
+ },
302
+ });
303
+ } else {
304
+ return this.put(`/${id}`, {
305
+ payload: updatePayload,
306
+ });
342
307
  }
343
- }
344
-
345
- interface GetRenditionParams {
346
- format: string;
347
- max_hw?: number;
348
- generate_if_missing?: boolean;
308
+ }
309
+
310
+ /**
311
+ * Retrieves all revisions of a content object
312
+ *
313
+ * @param id The ID of any revision in the object's history
314
+ * @returns Array of all revisions sharing the same root
315
+ */
316
+ getRevisions(id: string): Promise<ContentObjectItem[]> {
317
+ return this.get(`/${id}/revisions`);
318
+ }
319
+
320
+ delete(id: string): Promise<{ id: string }> {
321
+ return this.del(`/${id}`);
322
+ }
323
+
324
+ listWorkflowRuns(documentId: string): Promise<ListWorkflowRunsResponse> {
325
+ return this.get(`/${documentId}/workflow-runs`);
326
+ }
327
+
328
+ listRenditions(documentId: string): Promise<ContentObjectItem[]> {
329
+ return this.get(`/${documentId}/renditions`);
330
+ }
331
+
332
+ getRendition(
333
+ documentId: string,
334
+ options: GetRenditionParams,
335
+ ): Promise<GetRenditionResponse> {
336
+ const query = {
337
+ max_hw: options.max_hw,
338
+ generate_if_missing: options.generate_if_missing,
339
+ as_signed_url: options.sign_url,
340
+ };
341
+
342
+ return this.get(`/${documentId}/renditions/${options.format}`, { query });
343
+ }
344
+
345
+ exportProperties(
346
+ payload: ExportPropertiesPayload,
347
+ ): Promise<ExportPropertiesResponse> {
348
+ return this.post("/export", {
349
+ payload,
350
+ });
351
+ }
352
+
353
+ setEmbedding(
354
+ id: string,
355
+ type: SupportedEmbeddingTypes,
356
+ payload: Embedding,
357
+ ): Promise<Record<SupportedEmbeddingTypes, Embedding>> {
358
+ return this.put(`/${id}/embeddings/${type}`, {
359
+ payload,
360
+ });
361
+ }
349
362
  }