@vertesia/client 1.5.0-dev.20260722.120446Z → 1.5.0-dev.20260804.124748Z

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 (85) hide show
  1. package/lib/AccountApi.d.ts +10 -7
  2. package/lib/AccountApi.d.ts.map +1 -1
  3. package/lib/AccountApi.js +7 -4
  4. package/lib/AccountApi.js.map +1 -1
  5. package/lib/ApiKeysApi.d.ts +3 -3
  6. package/lib/ApiKeysApi.d.ts.map +1 -1
  7. package/lib/ApiKeysApi.js.map +1 -1
  8. package/lib/AppsApi.d.ts +7 -1
  9. package/lib/AppsApi.d.ts.map +1 -1
  10. package/lib/AppsApi.js +12 -0
  11. package/lib/AppsApi.js.map +1 -1
  12. package/lib/EnvironmentsApi.d.ts +3 -6
  13. package/lib/EnvironmentsApi.d.ts.map +1 -1
  14. package/lib/EnvironmentsApi.js.map +1 -1
  15. package/lib/GroupsApi.d.ts +2 -0
  16. package/lib/GroupsApi.d.ts.map +1 -1
  17. package/lib/GroupsApi.js.map +1 -1
  18. package/lib/InteractionBase.d.ts +686 -2
  19. package/lib/InteractionBase.d.ts.map +1 -1
  20. package/lib/OAuthGrantsApi.d.ts +2 -4
  21. package/lib/OAuthGrantsApi.d.ts.map +1 -1
  22. package/lib/OAuthGrantsApi.js.map +1 -1
  23. package/lib/OAuthProvidersApi.d.ts +6 -1
  24. package/lib/OAuthProvidersApi.d.ts.map +1 -1
  25. package/lib/OAuthProvidersApi.js +5 -0
  26. package/lib/OAuthProvidersApi.js.map +1 -1
  27. package/lib/PromptsApi.d.ts +19 -30
  28. package/lib/PromptsApi.d.ts.map +1 -1
  29. package/lib/PromptsApi.js +1 -1
  30. package/lib/PromptsApi.js.map +1 -1
  31. package/lib/client.d.ts +10 -2
  32. package/lib/client.d.ts.map +1 -1
  33. package/lib/store/AgentsApi.d.ts +5 -1
  34. package/lib/store/AgentsApi.d.ts.map +1 -1
  35. package/lib/store/AgentsApi.js +129 -77
  36. package/lib/store/AgentsApi.js.map +1 -1
  37. package/lib/store/FilesApi.d.ts.map +1 -1
  38. package/lib/store/FilesApi.js +10 -4
  39. package/lib/store/FilesApi.js.map +1 -1
  40. package/lib/store/ObjectsApi.d.ts +3 -8
  41. package/lib/store/ObjectsApi.d.ts.map +1 -1
  42. package/lib/store/ObjectsApi.js +5 -4
  43. package/lib/store/ObjectsApi.js.map +1 -1
  44. package/lib/store/TaskApi.d.ts +9 -0
  45. package/lib/store/TaskApi.d.ts.map +1 -1
  46. package/lib/store/TaskApi.js +11 -16
  47. package/lib/store/TaskApi.js.map +1 -1
  48. package/lib/store/TypeCatalogApi.d.ts +21 -7
  49. package/lib/store/TypeCatalogApi.d.ts.map +1 -1
  50. package/lib/store/TypeCatalogApi.js +16 -2
  51. package/lib/store/TypeCatalogApi.js.map +1 -1
  52. package/lib/store/TypesApi.d.ts +2 -2
  53. package/lib/store/TypesApi.d.ts.map +1 -1
  54. package/lib/store/TypesApi.js.map +1 -1
  55. package/lib/store/uploadMimeType.d.ts +3 -0
  56. package/lib/store/uploadMimeType.d.ts.map +1 -0
  57. package/lib/store/uploadMimeType.js +11 -0
  58. package/lib/store/uploadMimeType.js.map +1 -0
  59. package/lib/store/version.d.ts +1 -2
  60. package/lib/store/version.d.ts.map +1 -1
  61. package/lib/store/version.js +3 -2
  62. package/lib/store/version.js.map +1 -1
  63. package/lib/vertesia-client.js +10 -10
  64. package/lib/vertesia-client.js.map +1 -1
  65. package/package.json +6 -6
  66. package/src/AccountApi.test.ts +30 -0
  67. package/src/AccountApi.ts +10 -8
  68. package/src/ApiKeysApi.ts +4 -3
  69. package/src/AppsApi.test.ts +14 -6
  70. package/src/AppsApi.ts +19 -0
  71. package/src/EnvironmentsApi.ts +3 -11
  72. package/src/GroupsApi.ts +2 -0
  73. package/src/OAuthGrantsApi.ts +2 -1
  74. package/src/OAuthProvidersApi.ts +6 -1
  75. package/src/PromptsApi.ts +22 -25
  76. package/src/store/AgentsApi.stream.test.ts +298 -0
  77. package/src/store/AgentsApi.ts +137 -68
  78. package/src/store/FilesApi.ts +10 -4
  79. package/src/store/ObjectsApi.ts +11 -10
  80. package/src/store/TaskApi.ts +11 -11
  81. package/src/store/TypeCatalogApi.ts +21 -7
  82. package/src/store/TypesApi.ts +2 -1
  83. package/src/store/uploadMimeType.test.ts +22 -0
  84. package/src/store/uploadMimeType.ts +16 -0
  85. package/src/store/version.ts +3 -2
@@ -1,7 +1,9 @@
1
1
  import { ApiTopic } from '@vertesia/api-fetch-client';
2
2
  import {
3
+ type BulkObjectCreateOptions,
3
4
  type BulkObjectCreateResult,
4
5
  type BulkObjectDeleteResult,
6
+ type BulkObjectUpdateOptions,
5
7
  type BulkObjectUpdateResult,
6
8
  type Collection,
7
9
  type ComplexSearchPayload,
@@ -56,6 +58,7 @@ import { StreamSource } from '../StreamSource.js';
56
58
  import { AnalyzeDocApi } from './AnalyzeDocApi.js';
57
59
  import type { ZenoClient } from './client.js';
58
60
  import { fetchSignedUrl } from './signed-url.js';
61
+ import { getUploadMimeTypeHint, resolveUploadMimeType } from './uploadMimeType.js';
59
62
 
60
63
  type ContentObjectWritePayload = Omit<CreateContentObjectPayload, 'content'> & {
61
64
  content?: ContentSource | File | StreamSource;
@@ -259,9 +262,9 @@ export class ObjectsApi extends ApiTopic {
259
262
  const { url, id, mime_type } = await this.getUploadUrl({
260
263
  id: isStream ? source.id : undefined,
261
264
  name: source.name,
262
- mime_type: source.type,
265
+ mime_type: getUploadMimeTypeHint(source.type),
263
266
  });
264
- const sourceMimeType = source.type || mime_type;
267
+ const sourceMimeType = resolveUploadMimeType(source.type, mime_type);
265
268
 
266
269
  // upload the file content to the signed URL
267
270
  const res = await fetchSignedUrl(url, {
@@ -457,23 +460,21 @@ export class ObjectsApi extends ApiTopic {
457
460
  return this.del(`/${idOrIds}`);
458
461
  }
459
462
 
460
- bulkUpdate(updates: Record<string, Record<string, unknown>>): Promise<BulkObjectUpdateResult> {
463
+ bulkUpdate(
464
+ updates: Record<string, Record<string, unknown>>,
465
+ options?: BulkObjectUpdateOptions,
466
+ ): Promise<BulkObjectUpdateResult> {
461
467
  const ids = Object.keys(updates);
462
468
  return this.client.runOperation({
463
469
  name: 'update',
464
470
  ids,
465
- params: updates,
471
+ params: options ? { updates, ...options } : updates,
466
472
  }) as Promise<BulkObjectUpdateResult>;
467
473
  }
468
474
 
469
475
  bulkCreate(
470
476
  objects: CreateContentObjectPayload[],
471
- options?: {
472
- collection_id?: string;
473
- /** @deprecated Events are now always emitted. This suppresses the Temporal-backed delivery targets (workflow, agent, and process) — webhook deliveries still fire. */
474
- skip_workflows?: boolean;
475
- processing_priority?: ContentObjectProcessingPriority;
476
- },
477
+ options?: BulkObjectCreateOptions,
477
478
  ): Promise<BulkObjectCreateResult> {
478
479
  return this.client.runOperation({
479
480
  name: 'create',
@@ -6,17 +6,17 @@ export class TaskApi extends ApiTopic {
6
6
  super(parent, '/api/v1/tasks');
7
7
  }
8
8
 
9
- list(query?: ListTasksQuery): Promise<Task[]> {
10
- const params: Record<string, string> = {};
11
- if (query?.status) {
12
- params.status = Array.isArray(query.status) ? query.status.join(',') : query.status;
13
- }
14
- if (query?.assignee) params.assignee = query.assignee;
15
- if (query?.run_id) params.run_id = query.run_id;
16
- if (query?.source_type) params.source_type = query.source_type;
17
- if (query?.limit != null) params.limit = String(query.limit);
18
- if (query?.offset != null) params.offset = String(query.offset);
19
- return this.get('/', { query: params });
9
+ /**
10
+ * Lists tasks.
11
+ *
12
+ * `status` accepts one value or several, and several go out as a repeated key
13
+ * (`status=a&status=b`) — which is what the parameter publishes: `style: form`, `explode: true`.
14
+ * This used to comma-join the array before sending it. Servers still split each occurrence on
15
+ * commas so SDKs pinned to an older version keep working, but that form was never in the spec,
16
+ * so newly published clients send the declared one.
17
+ */
18
+ list(query: ListTasksQuery = {}): Promise<Task[]> {
19
+ return this.get('/', { query });
20
20
  }
21
21
 
22
22
  retrieve(id: string): Promise<Task> {
@@ -1,5 +1,5 @@
1
1
  import { ApiTopic, type ClientBase } from '@vertesia/api-fetch-client';
2
- import type { ContentObjectTypeItem, ContentObjectTypeRef } from '@vertesia/common';
2
+ import type { ContentObjectTypeCatalogEntry, ContentObjectTypeItem, ContentObjectTypeRef } from '@vertesia/common';
3
3
 
4
4
  export class TypeCatalogApi extends ApiTopic {
5
5
  constructor(parent: ClientBase) {
@@ -7,18 +7,22 @@ export class TypeCatalogApi extends ApiTopic {
7
7
  }
8
8
 
9
9
  /**
10
- * List all content types (system + app + stored)
10
+ * List all content types (system + app + stored).
11
+ *
12
+ * Returns `ContentObjectTypeCatalogEntry`, not `ContentObjectTypeItem`, for the same reason
13
+ * {@link resolve} does: the listing includes system and app types, which are declared in code
14
+ * rather than authored, so they carry none of the four audit fields.
11
15
  */
12
16
  list(
13
17
  query: { tag?: string; limit?: number; offset?: number; layout?: boolean; schema?: boolean } = {},
14
- ): Promise<ContentObjectTypeItem[]> {
18
+ ): Promise<ContentObjectTypeCatalogEntry[]> {
15
19
  return this.get('/', { query });
16
20
  }
17
21
 
18
22
  /**
19
23
  * List system types only
20
24
  */
21
- listSysTypes(tag?: string): Promise<ContentObjectTypeItem[]> {
25
+ listSysTypes(tag?: string): Promise<ContentObjectTypeCatalogEntry[]> {
22
26
  return this.get('/sys', {
23
27
  query: { tag },
24
28
  });
@@ -27,14 +31,17 @@ export class TypeCatalogApi extends ApiTopic {
27
31
  /**
28
32
  * List all app types from all installed apps
29
33
  */
30
- listAppTypes(tag?: string): Promise<ContentObjectTypeItem[]> {
34
+ listAppTypes(tag?: string): Promise<ContentObjectTypeCatalogEntry[]> {
31
35
  return this.get('/apps', {
32
36
  query: { tag },
33
37
  });
34
38
  }
35
39
 
36
40
  /**
37
- * List stored types only
41
+ * List stored types only.
42
+ *
43
+ * Stored types are real records, so this one does return `ContentObjectTypeItem` with its audit
44
+ * fields required.
38
45
  */
39
46
  listStoredTypes(
40
47
  query: { tag?: string; limit?: number; offset?: number; layout?: boolean; schema?: boolean } = {},
@@ -47,9 +54,16 @@ export class TypeCatalogApi extends ApiTopic {
47
54
  /**
48
55
  * Resolve a type to its full definition.
49
56
  * Accepts a string (type ID or code) or a ContentObjectTypeRef.
57
+ *
58
+ * Returns a `ContentObjectTypeCatalogEntry`, which is what the endpoint publishes and is NOT
59
+ * `ContentObjectTypeItem`: the catalog resolves in-code types contributed by plugins, which no
60
+ * user created and no user has modified, so its four audit fields are optional. Declaring the
61
+ * stored type here told callers `created_by` was always a string when resolving `sys:Invoice`
62
+ * hands back a record that has none.
63
+ *
50
64
  * @param typeOrRef Type identifier string, or a ContentObjectTypeRef from a content object
51
65
  */
52
- resolve(typeOrRef: string | ContentObjectTypeRef): Promise<ContentObjectTypeItem> {
66
+ resolve(typeOrRef: string | ContentObjectTypeRef): Promise<ContentObjectTypeCatalogEntry> {
53
67
  const typeId = typeof typeOrRef === 'string' ? typeOrRef : typeOrRef.id;
54
68
  return this.get(`/resolve/${typeId}`);
55
69
  }
@@ -6,6 +6,7 @@ import type {
6
6
  FindPayload,
7
7
  ObjectTypeSearchPayload,
8
8
  ObjectTypeSearchQuery,
9
+ UpdateContentObjectTypePayload,
9
10
  } from '@vertesia/common';
10
11
  import { TypeCatalogApi } from './TypeCatalogApi.js';
11
12
 
@@ -58,7 +59,7 @@ export class TypesApi extends ApiTopic {
58
59
  return this.get(`/name/${typeName}`);
59
60
  }
60
61
 
61
- update(typeId: string, payload: Partial<CreateContentObjectTypePayload>): Promise<ContentObjectType> {
62
+ update(typeId: string, payload: UpdateContentObjectTypePayload): Promise<ContentObjectType> {
62
63
  return this.put(`/${typeId}`, {
63
64
  payload,
64
65
  });
@@ -0,0 +1,22 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { getUploadMimeTypeHint, resolveUploadMimeType } from './uploadMimeType.js';
3
+
4
+ describe('upload MIME type resolution', () => {
5
+ it('keeps a specific browser-provided content type', () => {
6
+ expect(getUploadMimeTypeHint('text/plain')).toBe('text/plain');
7
+ expect(resolveUploadMimeType('text/plain', 'text/markdown')).toBe('text/plain');
8
+ });
9
+
10
+ it('uses filename inference when the browser reports generic binary content', () => {
11
+ expect(getUploadMimeTypeHint('application/octet-stream')).toBeUndefined();
12
+ expect(resolveUploadMimeType('application/octet-stream', 'text/markdown')).toBe('text/markdown');
13
+ });
14
+
15
+ it('uses filename inference when the browser omits the content type', () => {
16
+ expect(resolveUploadMimeType('', 'text/markdown')).toBe('text/markdown');
17
+ });
18
+
19
+ it('retains octet-stream when no more specific type can be inferred', () => {
20
+ expect(resolveUploadMimeType('application/octet-stream', undefined)).toBe('application/octet-stream');
21
+ });
22
+ });
@@ -0,0 +1,16 @@
1
+ const GENERIC_BINARY_CONTENT_TYPE = 'application/octet-stream';
2
+
3
+ function normalizedContentType(contentType: string | undefined): string | undefined {
4
+ return contentType?.split(';', 1)[0]?.trim().toLowerCase() || undefined;
5
+ }
6
+
7
+ export function getUploadMimeTypeHint(contentType: string | undefined): string | undefined {
8
+ return normalizedContentType(contentType) === GENERIC_BINARY_CONTENT_TYPE ? undefined : contentType || undefined;
9
+ }
10
+
11
+ export function resolveUploadMimeType(
12
+ sourceContentType: string | undefined,
13
+ inferredContentType: string | undefined,
14
+ ): string | undefined {
15
+ return getUploadMimeTypeHint(sourceContentType) || inferredContentType || sourceContentType || undefined;
16
+ }
@@ -1,3 +1,4 @@
1
1
  export const VERSION = '20260319'; // YYYYMMDD, client versioning for API endpoints. Increment manually for breaking changes
2
- export const VERSION_HEADER = 'x-api-version';
3
- export { APP_VERSION_HEADER } from '@vertesia/common';
2
+ // Re-exported, not redeclared: the servers read the same constant when deciding how strictly to
3
+ // hold a request to its schema, so a name only this side knew could not stay a negotiation.
4
+ export { APP_VERSION_HEADER, VERSION_HEADER } from '@vertesia/common';