@vertesia/client 1.5.0-dev.20260725.083715Z → 1.5.0-dev.20260806.125520Z

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 (154) 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/AccountsApi.d.ts.map +1 -1
  6. package/lib/AnalyticsApi.d.ts.map +1 -1
  7. package/lib/ApiKeysApi.d.ts +3 -3
  8. package/lib/ApiKeysApi.d.ts.map +1 -1
  9. package/lib/ApiKeysApi.js.map +1 -1
  10. package/lib/AppsApi.d.ts +12 -2
  11. package/lib/AppsApi.d.ts.map +1 -1
  12. package/lib/AppsApi.js +20 -1
  13. package/lib/AppsApi.js.map +1 -1
  14. package/lib/AuditTrailApi.d.ts.map +1 -1
  15. package/lib/CommandsApi.d.ts.map +1 -1
  16. package/lib/EnvironmentsApi.d.ts +3 -6
  17. package/lib/EnvironmentsApi.d.ts.map +1 -1
  18. package/lib/EnvironmentsApi.js.map +1 -1
  19. package/lib/GroupsApi.d.ts +2 -0
  20. package/lib/GroupsApi.d.ts.map +1 -1
  21. package/lib/GroupsApi.js.map +1 -1
  22. package/lib/IamApi.d.ts.map +1 -1
  23. package/lib/InteractionBase.d.ts +686 -2
  24. package/lib/InteractionBase.d.ts.map +1 -1
  25. package/lib/InteractionBase.js.map +1 -1
  26. package/lib/InteractionCatalogApi.d.ts.map +1 -1
  27. package/lib/InteractionCatalogApi.js.map +1 -1
  28. package/lib/InteractionOutput.d.ts.map +1 -1
  29. package/lib/InteractionOutput.js.map +1 -1
  30. package/lib/InteractionsApi.d.ts.map +1 -1
  31. package/lib/InteractionsApi.js.map +1 -1
  32. package/lib/InternalSecretsApi.d.ts.map +1 -1
  33. package/lib/OAuthClientsApi.d.ts.map +1 -1
  34. package/lib/OAuthGrantsApi.d.ts +2 -4
  35. package/lib/OAuthGrantsApi.d.ts.map +1 -1
  36. package/lib/OAuthGrantsApi.js.map +1 -1
  37. package/lib/OAuthProvidersApi.d.ts +6 -1
  38. package/lib/OAuthProvidersApi.d.ts.map +1 -1
  39. package/lib/OAuthProvidersApi.js +5 -0
  40. package/lib/OAuthProvidersApi.js.map +1 -1
  41. package/lib/OAuthServerApi.d.ts.map +1 -1
  42. package/lib/OAuthServerApi.js.map +1 -1
  43. package/lib/ProjectsApi.d.ts.map +1 -1
  44. package/lib/PromptsApi.d.ts +19 -30
  45. package/lib/PromptsApi.d.ts.map +1 -1
  46. package/lib/PromptsApi.js +1 -1
  47. package/lib/PromptsApi.js.map +1 -1
  48. package/lib/QuotaApi.d.ts.map +1 -1
  49. package/lib/RefsApi.d.ts.map +1 -1
  50. package/lib/RemoteMcpConnectionsApi.d.ts.map +1 -1
  51. package/lib/RunsApi.d.ts.map +1 -1
  52. package/lib/SecretsApi.d.ts.map +1 -1
  53. package/lib/SkillsApi.d.ts.map +1 -1
  54. package/lib/StreamSource.d.ts.map +1 -1
  55. package/lib/StreamSource.js.map +1 -1
  56. package/lib/ToolsApi.d.ts.map +1 -1
  57. package/lib/TrainingApi.d.ts.map +1 -1
  58. package/lib/TrainingApi.js.map +1 -1
  59. package/lib/UsersApi.d.ts.map +1 -1
  60. package/lib/ViewsApi.d.ts.map +1 -1
  61. package/lib/ViewsApi.js.map +1 -1
  62. package/lib/client.d.ts +10 -2
  63. package/lib/client.d.ts.map +1 -1
  64. package/lib/client.js +1 -0
  65. package/lib/client.js.map +1 -1
  66. package/lib/execute.js.map +1 -1
  67. package/lib/managed-sse.js +1 -1
  68. package/lib/managed-sse.js.map +1 -1
  69. package/lib/nodejs/NodeStreamSource.d.ts.map +1 -1
  70. package/lib/store/AgentsApi.d.ts.map +1 -1
  71. package/lib/store/AgentsApi.js +121 -77
  72. package/lib/store/AgentsApi.js.map +1 -1
  73. package/lib/store/AnalyzeDocApi.d.ts.map +1 -1
  74. package/lib/store/AnalyzeDocApi.js.map +1 -1
  75. package/lib/store/CollectionsApi.d.ts.map +1 -1
  76. package/lib/store/CollectionsApi.js.map +1 -1
  77. package/lib/store/CostApi.d.ts.map +1 -1
  78. package/lib/store/CostApi.js.map +1 -1
  79. package/lib/store/DashboardApi.d.ts.map +1 -1
  80. package/lib/store/DataApi.d.ts.map +1 -1
  81. package/lib/store/EmailApi.d.ts.map +1 -1
  82. package/lib/store/EmbeddingsApi.d.ts.map +1 -1
  83. package/lib/store/EmbeddingsApi.js.map +1 -1
  84. package/lib/store/EventIngestChannelsApi.d.ts.map +1 -1
  85. package/lib/store/EventSubscriptionsApi.d.ts.map +1 -1
  86. package/lib/store/EventsApi.d.ts +2 -1
  87. package/lib/store/EventsApi.d.ts.map +1 -1
  88. package/lib/store/EventsApi.js +3 -0
  89. package/lib/store/EventsApi.js.map +1 -1
  90. package/lib/store/FilesApi.d.ts +4 -0
  91. package/lib/store/FilesApi.d.ts.map +1 -1
  92. package/lib/store/FilesApi.js +48 -23
  93. package/lib/store/FilesApi.js.map +1 -1
  94. package/lib/store/HiveMemoryApi.d.ts.map +1 -1
  95. package/lib/store/IndexingApi.d.ts.map +1 -1
  96. package/lib/store/IndexingApi.js.map +1 -1
  97. package/lib/store/ObjectsApi.d.ts +3 -8
  98. package/lib/store/ObjectsApi.d.ts.map +1 -1
  99. package/lib/store/ObjectsApi.js +2 -2
  100. package/lib/store/ObjectsApi.js.map +1 -1
  101. package/lib/store/PendingAsksApi.d.ts.map +1 -1
  102. package/lib/store/ProcessApi.d.ts.map +1 -1
  103. package/lib/store/QueryApi.d.ts.map +1 -1
  104. package/lib/store/QueryApi.js.map +1 -1
  105. package/lib/store/RenderingApi.d.ts.map +1 -1
  106. package/lib/store/RenderingApi.js.map +1 -1
  107. package/lib/store/SchedulesApi.d.ts.map +1 -1
  108. package/lib/store/TaskApi.d.ts +9 -0
  109. package/lib/store/TaskApi.d.ts.map +1 -1
  110. package/lib/store/TaskApi.js +11 -16
  111. package/lib/store/TaskApi.js.map +1 -1
  112. package/lib/store/TypeCatalogApi.d.ts +21 -7
  113. package/lib/store/TypeCatalogApi.d.ts.map +1 -1
  114. package/lib/store/TypeCatalogApi.js +16 -2
  115. package/lib/store/TypeCatalogApi.js.map +1 -1
  116. package/lib/store/TypesApi.d.ts +2 -2
  117. package/lib/store/TypesApi.d.ts.map +1 -1
  118. package/lib/store/TypesApi.js.map +1 -1
  119. package/lib/store/ViewsApi.d.ts.map +1 -1
  120. package/lib/store/ViewsApi.js.map +1 -1
  121. package/lib/store/WorkflowsApi.d.ts.map +1 -1
  122. package/lib/store/WorkflowsApi.js.map +1 -1
  123. package/lib/store/client.d.ts.map +1 -1
  124. package/lib/store/client.js.map +1 -1
  125. package/lib/store/errors.d.ts.map +1 -1
  126. package/lib/store/signed-url.js.map +1 -1
  127. package/lib/store/version.d.ts +1 -3
  128. package/lib/store/version.d.ts.map +1 -1
  129. package/lib/store/version.js +3 -3
  130. package/lib/store/version.js.map +1 -1
  131. package/lib/vertesia-client.js +10 -10
  132. package/lib/vertesia-client.js.map +1 -1
  133. package/package.json +6 -6
  134. package/src/AccountApi.test.ts +30 -0
  135. package/src/AccountApi.ts +10 -8
  136. package/src/ApiKeysApi.ts +4 -3
  137. package/src/AppsApi.ts +26 -0
  138. package/src/EnvironmentsApi.ts +3 -11
  139. package/src/GroupsApi.ts +2 -0
  140. package/src/OAuthGrantsApi.ts +2 -1
  141. package/src/OAuthProvidersApi.ts +6 -1
  142. package/src/PromptsApi.ts +22 -25
  143. package/src/client.test.ts +16 -0
  144. package/src/client.ts +1 -0
  145. package/src/store/AgentsApi.stream.test.ts +298 -0
  146. package/src/store/AgentsApi.ts +120 -68
  147. package/src/store/EventsApi.ts +8 -0
  148. package/src/store/FilesApi.test.ts +37 -1
  149. package/src/store/FilesApi.ts +49 -20
  150. package/src/store/ObjectsApi.ts +8 -8
  151. package/src/store/TaskApi.ts +11 -11
  152. package/src/store/TypeCatalogApi.ts +21 -7
  153. package/src/store/TypesApi.ts +2 -1
  154. package/src/store/version.ts +7 -3
@@ -28,6 +28,44 @@ const FILE_SIGNING_RETRY_POLICY: IRequestRetryPolicy = {
28
28
  statuses: [502, 503, 504],
29
29
  };
30
30
 
31
+ function fileLocationForError(location: string): string {
32
+ try {
33
+ const url = new URL(location);
34
+ return `${url.protocol}//${url.host}${url.pathname}`;
35
+ } catch {
36
+ return location.split(/[?#]/, 1)[0] || 'unknown file';
37
+ }
38
+ }
39
+
40
+ function sanitizedErrorCause(error: unknown): Error | undefined {
41
+ if (!(error instanceof Error)) {
42
+ return undefined;
43
+ }
44
+ const message = error.message.replace(/https?:\/\/[^\s)\]}>"']+/g, (url) => fileLocationForError(url));
45
+ const cause = new Error(message);
46
+ cause.name = error.name;
47
+ return cause;
48
+ }
49
+
50
+ function fileDownloadFailureReason(status?: number, statusText?: string): string {
51
+ if (status === 404) return 'not found';
52
+ if (status === 403) return 'forbidden';
53
+ if (status) return `failed with status ${status}${statusText ? ` ${statusText}` : ''}`;
54
+ return 'failed';
55
+ }
56
+
57
+ export class FileDownloadError extends Error {
58
+ readonly status?: number;
59
+
60
+ constructor(location: string, status?: number, statusText?: string, cause?: unknown) {
61
+ const safeLocation = fileLocationForError(location);
62
+ const reason = fileDownloadFailureReason(status, statusText);
63
+ super(`File download ${reason}: ${safeLocation}`, { cause: sanitizedErrorCause(cause) });
64
+ this.name = 'FileDownloadError';
65
+ this.status = status;
66
+ }
67
+ }
68
+
31
69
  export function getMemoryFilePath(name: string) {
32
70
  const nameWithExt = name.endsWith('.tar.gz') ? name : `${name}.tar.gz`;
33
71
  return `${MEMORIES_PREFIX}/${nameWithExt}`;
@@ -229,28 +267,19 @@ export class FilesApi extends ApiTopic {
229
267
  const needSign = !location.startsWith('https:');
230
268
  const { url } = needSign ? await this.getDownloadUrl(location) : { url: location };
231
269
 
232
- const res = await fetchSignedUrl(url, {
233
- method: 'GET',
234
- })
235
- .then((res: Response) => {
236
- if (res.ok) {
237
- return res;
238
- } else if (res.status === 404) {
239
- throw new Error(`File at ${url} not found`); //TODO: type fetch error better with a fetch error class
240
- } else if (res.status === 403) {
241
- throw new Error(`File at ${url} is forbidden`);
242
- } else {
243
- console.log(res);
244
- throw new Error(`Failed to download file ${location}: ${res.statusText}`);
245
- }
246
- })
247
- .catch((err) => {
248
- console.error(`Failed to download file ${location}.`, err);
249
- throw err;
250
- });
270
+ let res: Response;
271
+ try {
272
+ res = await fetchSignedUrl(url, { method: 'GET' });
273
+ } catch (error: unknown) {
274
+ throw new FileDownloadError(location, undefined, undefined, error);
275
+ }
276
+
277
+ if (!res.ok) {
278
+ throw new FileDownloadError(location, res.status, res.statusText);
279
+ }
251
280
 
252
281
  if (!res.body) {
253
- throw new Error(`No body in response while downloading file ${location}`);
282
+ throw new FileDownloadError(location);
254
283
  }
255
284
 
256
285
  return res.body;
@@ -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,
@@ -458,23 +460,21 @@ export class ObjectsApi extends ApiTopic {
458
460
  return this.del(`/${idOrIds}`);
459
461
  }
460
462
 
461
- bulkUpdate(updates: Record<string, Record<string, unknown>>): Promise<BulkObjectUpdateResult> {
463
+ bulkUpdate(
464
+ updates: Record<string, Record<string, unknown>>,
465
+ options?: BulkObjectUpdateOptions,
466
+ ): Promise<BulkObjectUpdateResult> {
462
467
  const ids = Object.keys(updates);
463
468
  return this.client.runOperation({
464
469
  name: 'update',
465
470
  ids,
466
- params: updates,
471
+ params: options ? { updates, ...options } : updates,
467
472
  }) as Promise<BulkObjectUpdateResult>;
468
473
  }
469
474
 
470
475
  bulkCreate(
471
476
  objects: CreateContentObjectPayload[],
472
- options?: {
473
- collection_id?: string;
474
- /** @deprecated Events are now always emitted. This suppresses the Temporal-backed delivery targets (workflow, agent, and process) — webhook deliveries still fire. */
475
- skip_workflows?: boolean;
476
- processing_priority?: ContentObjectProcessingPriority;
477
- },
477
+ options?: BulkObjectCreateOptions,
478
478
  ): Promise<BulkObjectCreateResult> {
479
479
  return this.client.runOperation({
480
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
  });
@@ -1,3 +1,7 @@
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';
1
+ // Preserve the public client export while sourcing its value from the same module as the servers
2
+ // and OpenAPI generator.
3
+ export {
4
+ APP_VERSION_HEADER,
5
+ CURRENT_API_VERSION_HEADER_VALUE as VERSION,
6
+ VERSION_HEADER,
7
+ } from '@vertesia/common';