@vertesia/client 0.67.0 → 0.69.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.
@@ -1,5 +1,5 @@
1
1
  import { ApiTopic, ClientBase } from "@vertesia/api-fetch-client";
2
- import { Collection, CollectionItem, CollectionSearchPayload, ComplexSearchPayload, ComputeObjectFacetPayload, ContentObjectItem, ContentObjectStatus, CreateCollectionPayload, DynamicCollection } from "@vertesia/common";
2
+ import { Collection, CollectionItem, ComplexCollectionSearchQuery, ComplexSearchPayload, ComputeCollectionFacetPayload, ComputeObjectFacetPayload, ContentObjectItem, ContentObjectStatus, CreateCollectionPayload, DynamicCollection } from "@vertesia/common";
3
3
  import { ComputeFacetsResponse } from "./ObjectsApi.js";
4
4
 
5
5
 
@@ -11,16 +11,21 @@ export class CollectionsApi extends ApiTopic {
11
11
 
12
12
  /**
13
13
  * List collections
14
- * @param payload
15
- * @returns
16
- */
17
- list(payload: CollectionSearchPayload = {}): Promise<CollectionItem[]> {
18
- return this.get("/", {
19
- query: {
20
- limit: 100,
21
- offset: 0,
22
- ...payload
23
- }
14
+ * @param payload: CollectionSearchPayload
15
+ * @returns CollectionItem[] list of collections
16
+ **/
17
+ search(payload: ComplexCollectionSearchQuery): Promise<CollectionItem[]> {
18
+ return this.post("/search", { payload });
19
+ }
20
+
21
+ /**
22
+ * Compute facets for List collections
23
+ * @param query: ComputeCollectionFacetPayload
24
+ * @returns ComputeFacetsResponse list of facets
25
+ **/
26
+ computeListFacets(query: ComputeCollectionFacetPayload): Promise<ComputeFacetsResponse> {
27
+ return this.post("/facets", {
28
+ payload: query
24
29
  });
25
30
  }
26
31
 
@@ -90,4 +95,4 @@ export class CollectionsApi extends ApiTopic {
90
95
  return this.del(`/${id}`);
91
96
  }
92
97
 
93
- }
98
+ }
@@ -176,8 +176,12 @@ export class WorkflowsApi extends ApiTopic {
176
176
 
177
177
  if (onMessage) onMessage(message, exit);
178
178
 
179
- // Only close the stream when the main workstream completes
180
- if (message.type === AgentMessageType.COMPLETE && (!message.workstream_id || message.workstream_id === 'main')) {
179
+ const streamIsOver = message.type === AgentMessageType.TERMINATED ||
180
+ (message.type === AgentMessageType.COMPLETE &&
181
+ (!message.workstream_id || message.workstream_id === 'main'));
182
+
183
+ // Only close the stream when the main workstream completes or terminates
184
+ if (streamIsOver) {
181
185
  console.log("Closing stream due to COMPLETE message from main workstream");
182
186
  if (!isClosed) {
183
187
  isClosed = true;