@vertesia/client 0.78.0 → 0.79.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 (63) hide show
  1. package/lib/cjs/AppsApi.js +8 -0
  2. package/lib/cjs/AppsApi.js.map +1 -1
  3. package/lib/cjs/InteractionBase.js.map +1 -1
  4. package/lib/cjs/InteractionsApi.js +8 -0
  5. package/lib/cjs/InteractionsApi.js.map +1 -1
  6. package/lib/cjs/RunsApi.js.map +1 -1
  7. package/lib/cjs/client.js +16 -0
  8. package/lib/cjs/client.js.map +1 -1
  9. package/lib/cjs/execute.js +6 -0
  10. package/lib/cjs/execute.js.map +1 -1
  11. package/lib/cjs/store/ObjectsApi.js +31 -14
  12. package/lib/cjs/store/ObjectsApi.js.map +1 -1
  13. package/lib/cjs/store/client.js +17 -1
  14. package/lib/cjs/store/client.js.map +1 -1
  15. package/lib/cjs/store/version.js +6 -0
  16. package/lib/cjs/store/version.js.map +1 -0
  17. package/lib/esm/AppsApi.js +8 -0
  18. package/lib/esm/AppsApi.js.map +1 -1
  19. package/lib/esm/InteractionBase.js.map +1 -1
  20. package/lib/esm/InteractionsApi.js +9 -1
  21. package/lib/esm/InteractionsApi.js.map +1 -1
  22. package/lib/esm/RunsApi.js.map +1 -1
  23. package/lib/esm/client.js +16 -0
  24. package/lib/esm/client.js.map +1 -1
  25. package/lib/esm/execute.js +5 -0
  26. package/lib/esm/execute.js.map +1 -1
  27. package/lib/esm/store/ObjectsApi.js +31 -14
  28. package/lib/esm/store/ObjectsApi.js.map +1 -1
  29. package/lib/esm/store/client.js +17 -1
  30. package/lib/esm/store/client.js.map +1 -1
  31. package/lib/esm/store/version.js +3 -0
  32. package/lib/esm/store/version.js.map +1 -0
  33. package/lib/tsconfig.tsbuildinfo +1 -1
  34. package/lib/types/AppsApi.d.ts +7 -1
  35. package/lib/types/AppsApi.d.ts.map +1 -1
  36. package/lib/types/InteractionBase.d.ts +2 -2
  37. package/lib/types/InteractionBase.d.ts.map +1 -1
  38. package/lib/types/InteractionsApi.d.ts +9 -3
  39. package/lib/types/InteractionsApi.d.ts.map +1 -1
  40. package/lib/types/RunsApi.d.ts +1 -1
  41. package/lib/types/RunsApi.d.ts.map +1 -1
  42. package/lib/types/client.d.ts +5 -0
  43. package/lib/types/client.d.ts.map +1 -1
  44. package/lib/types/execute.d.ts +4 -3
  45. package/lib/types/execute.d.ts.map +1 -1
  46. package/lib/types/store/ObjectsApi.d.ts +6 -4
  47. package/lib/types/store/ObjectsApi.d.ts.map +1 -1
  48. package/lib/types/store/client.d.ts +6 -1
  49. package/lib/types/store/client.d.ts.map +1 -1
  50. package/lib/types/store/version.d.ts +2 -0
  51. package/lib/types/store/version.d.ts.map +1 -0
  52. package/lib/vertesia-client.js +1 -1
  53. package/lib/vertesia-client.js.map +1 -1
  54. package/package.json +4 -4
  55. package/src/AppsApi.ts +10 -1
  56. package/src/InteractionBase.ts +3 -3
  57. package/src/InteractionsApi.ts +17 -8
  58. package/src/RunsApi.ts +1 -1
  59. package/src/client.ts +18 -0
  60. package/src/execute.ts +11 -5
  61. package/src/store/ObjectsApi.ts +40 -13
  62. package/src/store/client.ts +18 -1
  63. package/src/store/version.ts +2 -0
@@ -1,5 +1,6 @@
1
1
  import { ApiTopic, ClientBase } from "@vertesia/api-fetch-client";
2
2
  import {
3
+ ContentObjectApiHeaders,
3
4
  ComplexSearchPayload,
4
5
  ComputeObjectFacetPayload,
5
6
  ContentObject,
@@ -48,7 +49,7 @@ export interface ComputeFacetsResponse {
48
49
  type?: { _id: string; count: number }[];
49
50
  location?: { _id: string; count: number }[];
50
51
  status?: { _id: string; count: number }[];
51
- total?: { count: number }[];
52
+ total?: number;
52
53
  }
53
54
 
54
55
  export interface SearchResponse {
@@ -231,9 +232,18 @@ export class ObjectsApi extends ApiTopic {
231
232
  ) {
232
233
  createPayload.content = await this.upload(payload.content);
233
234
  }
235
+
236
+ const headers: Record<string, string> = {};
237
+ if (options?.processing_priority) {
238
+ headers[ContentObjectApiHeaders.PROCESSING_PRIORITY] = options.processing_priority;
239
+ }
240
+ if (options?.collection_id) {
241
+ headers[ContentObjectApiHeaders.COLLECTION_ID] = options.collection_id;
242
+ }
243
+
234
244
  return await this.post("/", {
235
245
  payload: createPayload,
236
- query: options || {},
246
+ headers: headers,
237
247
  });
238
248
  }
239
249
 
@@ -243,11 +253,16 @@ export class ObjectsApi extends ApiTopic {
243
253
  * For the s3 blobs you must use a hash with the blob #region. Ex: s3://bucket/path/to/file#us-east-1
244
254
  * @param uri
245
255
  * @param payload
256
+ * @param options
246
257
  * @returns
247
258
  */
248
259
  async createFromExternalSource(
249
260
  uri: string,
250
261
  payload: CreateContentObjectPayload = {},
262
+ options?: {
263
+ collection_id?: string;
264
+ processing_priority?: ContentObjectProcessingPriority;
265
+ },
251
266
  ): Promise<ContentObject> {
252
267
  const metadata = await (this.client as ZenoClient).files.getMetadata(
253
268
  uri,
@@ -261,8 +276,18 @@ export class ObjectsApi extends ApiTopic {
261
276
  etag: metadata.etag,
262
277
  },
263
278
  };
279
+
280
+ const headers: Record<string, string> = {};
281
+ if (options?.processing_priority) {
282
+ headers[ContentObjectApiHeaders.PROCESSING_PRIORITY] = options.processing_priority;
283
+ }
284
+ if (options?.collection_id) {
285
+ headers[ContentObjectApiHeaders.COLLECTION_ID] = options.collection_id;
286
+ }
287
+
264
288
  return await this.post("/", {
265
289
  payload: createPayload,
290
+ headers: headers,
266
291
  });
267
292
  }
268
293
 
@@ -298,19 +323,21 @@ export class ObjectsApi extends ApiTopic {
298
323
  updatePayload.content = await this.upload(payload.content);
299
324
  }
300
325
 
326
+ const headers: Record<string, string> = {};
327
+ if (options?.processing_priority) {
328
+ headers[ContentObjectApiHeaders.PROCESSING_PRIORITY] = options.processing_priority;
329
+ }
301
330
  if (options?.createRevision) {
302
- return this.put(`/${id}`, {
303
- payload: updatePayload,
304
- headers: {
305
- "x-create-revision": "true",
306
- "x-revision-label": options.revisionLabel || "",
307
- },
308
- });
309
- } else {
310
- return this.put(`/${id}`, {
311
- payload: updatePayload,
312
- });
331
+ headers[ContentObjectApiHeaders.CREATE_REVISION] = "true";
332
+ if (options.revisionLabel) {
333
+ headers[ContentObjectApiHeaders.REVISION_LABEL] = options.revisionLabel;
334
+ }
313
335
  }
336
+
337
+ return this.put(`/${id}`, {
338
+ payload: updatePayload,
339
+ headers,
340
+ });
314
341
  }
315
342
 
316
343
  /**
@@ -1,14 +1,15 @@
1
1
  import { AbstractFetchClient, RequestError } from "@vertesia/api-fetch-client";
2
2
  import { BulkOperationPayload, BulkOperationResult } from "@vertesia/common";
3
3
  import { AgentsApi } from "./AgentsApi.js";
4
+ import { CollectionsApi } from "./CollectionsApi.js";
4
5
  import { CommandsApi } from "./CommandsApi.js";
5
6
  import { EmbeddingsApi } from "./EmbeddingsApi.js";
6
7
  import { ZenoClientNotFoundError } from "./errors.js";
7
8
  import { FilesApi } from "./FilesApi.js";
8
9
  import { ObjectsApi } from "./ObjectsApi.js";
9
10
  import { TypesApi } from "./TypesApi.js";
11
+ import { VERSION, VERSION_HEADER } from "./version.js";
10
12
  import { WorkflowsApi } from "./WorkflowsApi.js";
11
- import { CollectionsApi } from "./CollectionsApi.js";
12
13
 
13
14
  export interface ZenoClientProps {
14
15
  serverUrl?: string;
@@ -44,6 +45,15 @@ export class ZenoClient extends AbstractFetchClient<ZenoClient> {
44
45
  }
45
46
  }
46
47
 
48
+ withApiVersion(version: string | number | null) {
49
+ if (!version) {
50
+ delete this.headers[VERSION_HEADER];
51
+ } else {
52
+ this.headers[VERSION_HEADER] = String(version);
53
+ }
54
+ return this;
55
+ }
56
+
47
57
  withApiKey(apiKey: string | null) {
48
58
  return this.withAuthCallback(
49
59
  apiKey ? () => Promise.resolve(`Bearer ${apiKey}`) : undefined
@@ -56,6 +66,13 @@ export class ZenoClient extends AbstractFetchClient<ZenoClient> {
56
66
  });
57
67
  }
58
68
 
69
+ get initialHeaders() {
70
+ return {
71
+ ...super.initialHeaders,
72
+ [VERSION_HEADER]: VERSION
73
+ }
74
+ }
75
+
59
76
  objects = new ObjectsApi(this);
60
77
  types = new TypesApi(this);
61
78
  workflows = new WorkflowsApi(this);
@@ -0,0 +1,2 @@
1
+ export const VERSION = '20250925' // YYYYMMDD, client versioning for API endpoints. Increment manually for breaking changes
2
+ export const VERSION_HEADER = 'x-api-version';