@vertesia/client 0.24.0-dev.202601221707
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.
- package/LICENSE +13 -0
- package/README.md +110 -0
- package/lib/cjs/AccountApi.js +85 -0
- package/lib/cjs/AccountApi.js.map +1 -0
- package/lib/cjs/AccountsApi.js +16 -0
- package/lib/cjs/AccountsApi.js.map +1 -0
- package/lib/cjs/AnalyticsApi.js +41 -0
- package/lib/cjs/AnalyticsApi.js.map +1 -0
- package/lib/cjs/ApiKeysApi.js +63 -0
- package/lib/cjs/ApiKeysApi.js.map +1 -0
- package/lib/cjs/AppsApi.js +119 -0
- package/lib/cjs/AppsApi.js.map +1 -0
- package/lib/cjs/CommandsApi.js +19 -0
- package/lib/cjs/CommandsApi.js.map +1 -0
- package/lib/cjs/EnvironmentsApi.js +72 -0
- package/lib/cjs/EnvironmentsApi.js.map +1 -0
- package/lib/cjs/GroupsApi.js +78 -0
- package/lib/cjs/GroupsApi.js.map +1 -0
- package/lib/cjs/IamApi.js +53 -0
- package/lib/cjs/IamApi.js.map +1 -0
- package/lib/cjs/InteractionBase.js +44 -0
- package/lib/cjs/InteractionBase.js.map +1 -0
- package/lib/cjs/InteractionCatalogApi.js +64 -0
- package/lib/cjs/InteractionCatalogApi.js.map +1 -0
- package/lib/cjs/InteractionOutput.js +300 -0
- package/lib/cjs/InteractionOutput.js.map +1 -0
- package/lib/cjs/InteractionResult.example.js +57 -0
- package/lib/cjs/InteractionResult.example.js.map +1 -0
- package/lib/cjs/InteractionsApi.js +262 -0
- package/lib/cjs/InteractionsApi.js.map +1 -0
- package/lib/cjs/MCPOAuthApi.js +62 -0
- package/lib/cjs/MCPOAuthApi.js.map +1 -0
- package/lib/cjs/ProjectsApi.js +72 -0
- package/lib/cjs/ProjectsApi.js.map +1 -0
- package/lib/cjs/PromptsApi.js +133 -0
- package/lib/cjs/PromptsApi.js.map +1 -0
- package/lib/cjs/RefsApi.js +14 -0
- package/lib/cjs/RefsApi.js.map +1 -0
- package/lib/cjs/RunsApi.js +113 -0
- package/lib/cjs/RunsApi.js.map +1 -0
- package/lib/cjs/SkillsApi.js +39 -0
- package/lib/cjs/SkillsApi.js.map +1 -0
- package/lib/cjs/StreamSource.js +17 -0
- package/lib/cjs/StreamSource.js.map +1 -0
- package/lib/cjs/TrainingApi.js +54 -0
- package/lib/cjs/TrainingApi.js.map +1 -0
- package/lib/cjs/UsersApi.js +13 -0
- package/lib/cjs/UsersApi.js.map +1 -0
- package/lib/cjs/client.js +360 -0
- package/lib/cjs/client.js.map +1 -0
- package/lib/cjs/execute.js +158 -0
- package/lib/cjs/execute.js.map +1 -0
- package/lib/cjs/index.js +22 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/nodejs/NodeStreamSource.js +45 -0
- package/lib/cjs/nodejs/NodeStreamSource.js.map +1 -0
- package/lib/cjs/nodejs/index.js +18 -0
- package/lib/cjs/nodejs/index.js.map +1 -0
- package/lib/cjs/package.json +3 -0
- package/lib/cjs/store/AnalyzeDocApi.js +56 -0
- package/lib/cjs/store/AnalyzeDocApi.js.map +1 -0
- package/lib/cjs/store/CollectionsApi.js +131 -0
- package/lib/cjs/store/CollectionsApi.js.map +1 -0
- package/lib/cjs/store/CommandsApi.js +17 -0
- package/lib/cjs/store/CommandsApi.js.map +1 -0
- package/lib/cjs/store/DashboardApi.js +182 -0
- package/lib/cjs/store/DashboardApi.js.map +1 -0
- package/lib/cjs/store/DataApi.js +433 -0
- package/lib/cjs/store/DataApi.js.map +1 -0
- package/lib/cjs/store/EmailApi.js +103 -0
- package/lib/cjs/store/EmailApi.js.map +1 -0
- package/lib/cjs/store/EmbeddingsApi.js +29 -0
- package/lib/cjs/store/EmbeddingsApi.js.map +1 -0
- package/lib/cjs/store/FilesApi.js +237 -0
- package/lib/cjs/store/FilesApi.js.map +1 -0
- package/lib/cjs/store/ObjectsApi.js +314 -0
- package/lib/cjs/store/ObjectsApi.js.map +1 -0
- package/lib/cjs/store/PendingAsksApi.js +43 -0
- package/lib/cjs/store/PendingAsksApi.js.map +1 -0
- package/lib/cjs/store/SchedulesApi.js +103 -0
- package/lib/cjs/store/SchedulesApi.js.map +1 -0
- package/lib/cjs/store/ToolsApi.js +21 -0
- package/lib/cjs/store/ToolsApi.js.map +1 -0
- package/lib/cjs/store/TypesApi.js +57 -0
- package/lib/cjs/store/TypesApi.js.map +1 -0
- package/lib/cjs/store/WorkersApi.js +16 -0
- package/lib/cjs/store/WorkersApi.js.map +1 -0
- package/lib/cjs/store/WorkflowsApi.js +596 -0
- package/lib/cjs/store/WorkflowsApi.js.map +1 -0
- package/lib/cjs/store/client.js +81 -0
- package/lib/cjs/store/client.js.map +1 -0
- package/lib/cjs/store/errors.js +11 -0
- package/lib/cjs/store/errors.js.map +1 -0
- package/lib/cjs/store/index.js +27 -0
- package/lib/cjs/store/index.js.map +1 -0
- package/lib/cjs/store/version.js +6 -0
- package/lib/cjs/store/version.js.map +1 -0
- package/lib/esm/AccountApi.js +82 -0
- package/lib/esm/AccountApi.js.map +1 -0
- package/lib/esm/AccountsApi.js +13 -0
- package/lib/esm/AccountsApi.js.map +1 -0
- package/lib/esm/AnalyticsApi.js +38 -0
- package/lib/esm/AnalyticsApi.js.map +1 -0
- package/lib/esm/ApiKeysApi.js +59 -0
- package/lib/esm/ApiKeysApi.js.map +1 -0
- package/lib/esm/AppsApi.js +116 -0
- package/lib/esm/AppsApi.js.map +1 -0
- package/lib/esm/CommandsApi.js +16 -0
- package/lib/esm/CommandsApi.js.map +1 -0
- package/lib/esm/EnvironmentsApi.js +69 -0
- package/lib/esm/EnvironmentsApi.js.map +1 -0
- package/lib/esm/GroupsApi.js +74 -0
- package/lib/esm/GroupsApi.js.map +1 -0
- package/lib/esm/IamApi.js +47 -0
- package/lib/esm/IamApi.js.map +1 -0
- package/lib/esm/InteractionBase.js +40 -0
- package/lib/esm/InteractionBase.js.map +1 -0
- package/lib/esm/InteractionCatalogApi.js +60 -0
- package/lib/esm/InteractionCatalogApi.js.map +1 -0
- package/lib/esm/InteractionOutput.js +293 -0
- package/lib/esm/InteractionOutput.js.map +1 -0
- package/lib/esm/InteractionResult.example.js +55 -0
- package/lib/esm/InteractionResult.example.js.map +1 -0
- package/lib/esm/InteractionsApi.js +259 -0
- package/lib/esm/InteractionsApi.js.map +1 -0
- package/lib/esm/MCPOAuthApi.js +59 -0
- package/lib/esm/MCPOAuthApi.js.map +1 -0
- package/lib/esm/ProjectsApi.js +69 -0
- package/lib/esm/ProjectsApi.js.map +1 -0
- package/lib/esm/PromptsApi.js +130 -0
- package/lib/esm/PromptsApi.js.map +1 -0
- package/lib/esm/RefsApi.js +10 -0
- package/lib/esm/RefsApi.js.map +1 -0
- package/lib/esm/RunsApi.js +109 -0
- package/lib/esm/RunsApi.js.map +1 -0
- package/lib/esm/SkillsApi.js +36 -0
- package/lib/esm/SkillsApi.js.map +1 -0
- package/lib/esm/StreamSource.js +13 -0
- package/lib/esm/StreamSource.js.map +1 -0
- package/lib/esm/TrainingApi.js +51 -0
- package/lib/esm/TrainingApi.js.map +1 -0
- package/lib/esm/UsersApi.js +10 -0
- package/lib/esm/UsersApi.js.map +1 -0
- package/lib/esm/client.js +351 -0
- package/lib/esm/client.js.map +1 -0
- package/lib/esm/execute.js +118 -0
- package/lib/esm/execute.js.map +1 -0
- package/lib/esm/index.js +6 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/nodejs/NodeStreamSource.js +41 -0
- package/lib/esm/nodejs/NodeStreamSource.js.map +1 -0
- package/lib/esm/nodejs/index.js +2 -0
- package/lib/esm/nodejs/index.js.map +1 -0
- package/lib/esm/store/AnalyzeDocApi.js +52 -0
- package/lib/esm/store/AnalyzeDocApi.js.map +1 -0
- package/lib/esm/store/CollectionsApi.js +127 -0
- package/lib/esm/store/CollectionsApi.js.map +1 -0
- package/lib/esm/store/CommandsApi.js +13 -0
- package/lib/esm/store/CommandsApi.js.map +1 -0
- package/lib/esm/store/DashboardApi.js +178 -0
- package/lib/esm/store/DashboardApi.js.map +1 -0
- package/lib/esm/store/DataApi.js +429 -0
- package/lib/esm/store/DataApi.js.map +1 -0
- package/lib/esm/store/EmailApi.js +99 -0
- package/lib/esm/store/EmailApi.js.map +1 -0
- package/lib/esm/store/EmbeddingsApi.js +25 -0
- package/lib/esm/store/EmbeddingsApi.js.map +1 -0
- package/lib/esm/store/FilesApi.js +231 -0
- package/lib/esm/store/FilesApi.js.map +1 -0
- package/lib/esm/store/ObjectsApi.js +309 -0
- package/lib/esm/store/ObjectsApi.js.map +1 -0
- package/lib/esm/store/PendingAsksApi.js +39 -0
- package/lib/esm/store/PendingAsksApi.js.map +1 -0
- package/lib/esm/store/SchedulesApi.js +99 -0
- package/lib/esm/store/SchedulesApi.js.map +1 -0
- package/lib/esm/store/ToolsApi.js +17 -0
- package/lib/esm/store/ToolsApi.js.map +1 -0
- package/lib/esm/store/TypesApi.js +53 -0
- package/lib/esm/store/TypesApi.js.map +1 -0
- package/lib/esm/store/WorkersApi.js +12 -0
- package/lib/esm/store/WorkersApi.js.map +1 -0
- package/lib/esm/store/WorkflowsApi.js +590 -0
- package/lib/esm/store/WorkflowsApi.js.map +1 -0
- package/lib/esm/store/client.js +77 -0
- package/lib/esm/store/client.js.map +1 -0
- package/lib/esm/store/errors.js +7 -0
- package/lib/esm/store/errors.js.map +1 -0
- package/lib/esm/store/index.js +11 -0
- package/lib/esm/store/index.js.map +1 -0
- package/lib/esm/store/version.js +3 -0
- package/lib/esm/store/version.js.map +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/lib/types/AccountApi.d.ts +59 -0
- package/lib/types/AccountApi.d.ts.map +1 -0
- package/lib/types/AccountsApi.d.ts +7 -0
- package/lib/types/AccountsApi.d.ts.map +1 -0
- package/lib/types/AnalyticsApi.d.ts +11 -0
- package/lib/types/AnalyticsApi.d.ts.map +1 -0
- package/lib/types/ApiKeysApi.d.ts +42 -0
- package/lib/types/ApiKeysApi.d.ts.map +1 -0
- package/lib/types/AppsApi.d.ts +65 -0
- package/lib/types/AppsApi.d.ts.map +1 -0
- package/lib/types/CommandsApi.d.ts +10 -0
- package/lib/types/CommandsApi.d.ts.map +1 -0
- package/lib/types/EnvironmentsApi.d.ts +40 -0
- package/lib/types/EnvironmentsApi.d.ts.map +1 -0
- package/lib/types/GroupsApi.d.ts +65 -0
- package/lib/types/GroupsApi.d.ts.map +1 -0
- package/lib/types/IamApi.d.ts +41 -0
- package/lib/types/IamApi.d.ts.map +1 -0
- package/lib/types/InteractionBase.d.ts +22 -0
- package/lib/types/InteractionBase.d.ts.map +1 -0
- package/lib/types/InteractionCatalogApi.d.ts +36 -0
- package/lib/types/InteractionCatalogApi.d.ts.map +1 -0
- package/lib/types/InteractionOutput.d.ts +174 -0
- package/lib/types/InteractionOutput.d.ts.map +1 -0
- package/lib/types/InteractionResult.example.d.ts +6 -0
- package/lib/types/InteractionResult.example.d.ts.map +1 -0
- package/lib/types/InteractionsApi.d.ts +183 -0
- package/lib/types/InteractionsApi.d.ts.map +1 -0
- package/lib/types/MCPOAuthApi.d.ts +45 -0
- package/lib/types/MCPOAuthApi.d.ts.map +1 -0
- package/lib/types/ProjectsApi.d.ts +28 -0
- package/lib/types/ProjectsApi.d.ts.map +1 -0
- package/lib/types/PromptsApi.d.ts +106 -0
- package/lib/types/PromptsApi.d.ts.map +1 -0
- package/lib/types/RefsApi.d.ts +6 -0
- package/lib/types/RefsApi.d.ts.map +1 -0
- package/lib/types/RunsApi.d.ts +79 -0
- package/lib/types/RunsApi.d.ts.map +1 -0
- package/lib/types/SkillsApi.d.ts +26 -0
- package/lib/types/SkillsApi.d.ts.map +1 -0
- package/lib/types/StreamSource.d.ts +7 -0
- package/lib/types/StreamSource.d.ts.map +1 -0
- package/lib/types/TrainingApi.d.ts +27 -0
- package/lib/types/TrainingApi.d.ts.map +1 -0
- package/lib/types/UsersApi.d.ts +6 -0
- package/lib/types/UsersApi.d.ts.map +1 -0
- package/lib/types/client.d.ts +136 -0
- package/lib/types/client.d.ts.map +1 -0
- package/lib/types/execute.d.ts +37 -0
- package/lib/types/execute.d.ts.map +1 -0
- package/lib/types/index.d.ts +10 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/nodejs/NodeStreamSource.d.ts +9 -0
- package/lib/types/nodejs/NodeStreamSource.d.ts.map +1 -0
- package/lib/types/nodejs/index.d.ts +1 -0
- package/lib/types/nodejs/index.d.ts.map +1 -0
- package/lib/types/store/AnalyzeDocApi.d.ts +17 -0
- package/lib/types/store/AnalyzeDocApi.d.ts.map +1 -0
- package/lib/types/store/CollectionsApi.d.ts +82 -0
- package/lib/types/store/CollectionsApi.d.ts.map +1 -0
- package/lib/types/store/CommandsApi.d.ts +10 -0
- package/lib/types/store/CommandsApi.d.ts.map +1 -0
- package/lib/types/store/DashboardApi.d.ts +149 -0
- package/lib/types/store/DashboardApi.d.ts.map +1 -0
- package/lib/types/store/DataApi.d.ts +392 -0
- package/lib/types/store/DataApi.d.ts.map +1 -0
- package/lib/types/store/EmailApi.d.ts +185 -0
- package/lib/types/store/EmailApi.d.ts.map +1 -0
- package/lib/types/store/EmbeddingsApi.d.ts +12 -0
- package/lib/types/store/EmbeddingsApi.d.ts.map +1 -0
- package/lib/types/store/FilesApi.d.ts +110 -0
- package/lib/types/store/FilesApi.d.ts.map +1 -0
- package/lib/types/store/ObjectsApi.d.ts +139 -0
- package/lib/types/store/ObjectsApi.d.ts.map +1 -0
- package/lib/types/store/PendingAsksApi.d.ts +79 -0
- package/lib/types/store/PendingAsksApi.d.ts.map +1 -0
- package/lib/types/store/SchedulesApi.d.ts +89 -0
- package/lib/types/store/SchedulesApi.d.ts.map +1 -0
- package/lib/types/store/ToolsApi.d.ts +13 -0
- package/lib/types/store/ToolsApi.d.ts.map +1 -0
- package/lib/types/store/TypesApi.d.ts +23 -0
- package/lib/types/store/TypesApi.d.ts.map +1 -0
- package/lib/types/store/WorkersApi.d.ts +6 -0
- package/lib/types/store/WorkersApi.d.ts.map +1 -0
- package/lib/types/store/WorkflowsApi.d.ts +167 -0
- package/lib/types/store/WorkflowsApi.d.ts.map +1 -0
- package/lib/types/store/client.d.ts +45 -0
- package/lib/types/store/client.d.ts.map +1 -0
- package/lib/types/store/errors.d.ts +4 -0
- package/lib/types/store/errors.d.ts.map +1 -0
- package/lib/types/store/index.d.ts +10 -0
- package/lib/types/store/index.d.ts.map +1 -0
- package/lib/types/store/version.d.ts +2 -0
- package/lib/types/store/version.d.ts.map +1 -0
- package/lib/vertesia-client.js +2 -0
- package/lib/vertesia-client.js.map +1 -0
- package/package.json +71 -0
- package/src/AccountApi.ts +96 -0
- package/src/AccountsApi.ts +22 -0
- package/src/AnalyticsApi.ts +36 -0
- package/src/ApiKeysApi.ts +67 -0
- package/src/AppsApi.ts +134 -0
- package/src/CommandsApi.ts +23 -0
- package/src/EnvironmentsApi.ts +94 -0
- package/src/GroupsApi.ts +92 -0
- package/src/IamApi.ts +70 -0
- package/src/InteractionBase.ts +44 -0
- package/src/InteractionCatalogApi.ts +72 -0
- package/src/InteractionOutput.test.ts +305 -0
- package/src/InteractionOutput.ts +328 -0
- package/src/InteractionResult.example.ts +72 -0
- package/src/InteractionsApi.ts +308 -0
- package/src/MCPOAuthApi.ts +67 -0
- package/src/ProjectsApi.ts +85 -0
- package/src/PromptsApi.ts +160 -0
- package/src/RefsApi.ts +18 -0
- package/src/RunsApi.ts +151 -0
- package/src/SkillsApi.ts +46 -0
- package/src/StreamSource.ts +3 -0
- package/src/TrainingApi.ts +71 -0
- package/src/UsersApi.ts +18 -0
- package/src/client.test.ts +99 -0
- package/src/client.ts +419 -0
- package/src/execute.ts +126 -0
- package/src/index.ts +10 -0
- package/src/nodejs/NodeStreamSource.ts +43 -0
- package/src/nodejs/index.ts +1 -0
- package/src/store/AnalyzeDocApi.ts +61 -0
- package/src/store/CollectionsApi.ts +166 -0
- package/src/store/CommandsApi.ts +15 -0
- package/src/store/DashboardApi.ts +216 -0
- package/src/store/DataApi.ts +516 -0
- package/src/store/EmailApi.ts +211 -0
- package/src/store/EmbeddingsApi.ts +39 -0
- package/src/store/FilesApi.ts +288 -0
- package/src/store/ObjectsApi.ts +432 -0
- package/src/store/PendingAsksApi.ts +98 -0
- package/src/store/SchedulesApi.ts +114 -0
- package/src/store/ToolsApi.ts +19 -0
- package/src/store/TypesApi.ts +65 -0
- package/src/store/WorkersApi.ts +17 -0
- package/src/store/WorkflowsApi.ts +752 -0
- package/src/store/client.ts +95 -0
- package/src/store/errors.ts +7 -0
- package/src/store/index.ts +11 -0
- package/src/store/version.ts +2 -0
- package/tsconfig.dist.json +20 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { ApiTopic, ClientBase } from "@vertesia/api-fetch-client";
|
|
2
|
+
import { Collection, ComplexCollectionSearchQuery, ComplexSearchPayload, ComputeCollectionFacetPayload, ComputeObjectFacetPayload, ContentObjectItem, ContentObjectStatus, CreateCollectionPayload, DynamicCollection } from "@vertesia/common";
|
|
3
|
+
import { ComputeFacetsResponse, SearchResponse } from "./ObjectsApi.js";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export class CollectionsApi extends ApiTopic {
|
|
7
|
+
|
|
8
|
+
constructor(parent: ClientBase) {
|
|
9
|
+
super(parent, "/api/v1/collections");
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* List collections
|
|
14
|
+
* @param payload: CollectionSearchPayload
|
|
15
|
+
* @returns Collection[] list of collections
|
|
16
|
+
**/
|
|
17
|
+
search(payload: ComplexCollectionSearchQuery): Promise<Collection[]> {
|
|
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
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Get the collection data without members
|
|
34
|
+
* @param collectionId
|
|
35
|
+
* @returns
|
|
36
|
+
*/
|
|
37
|
+
retrieve(collectionId: string): Promise<Collection | DynamicCollection> {
|
|
38
|
+
return this.get(`/${collectionId}`);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
create(payload: CreateCollectionPayload): Promise<Collection> {
|
|
42
|
+
return this.post(`/`, {
|
|
43
|
+
payload
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
update(collectionId: string, payload: Partial<CreateCollectionPayload>): Promise<{ id: string }> {
|
|
48
|
+
return this.put(`/${collectionId}`, {
|
|
49
|
+
payload
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
addMembers(collectionId: string, members: string[]): Promise<{ id: string }> {
|
|
54
|
+
return this.post(`/${collectionId}/members`, {
|
|
55
|
+
payload: {
|
|
56
|
+
action: 'add',
|
|
57
|
+
members
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
listMembers(collectionId: string, payload: {
|
|
63
|
+
limit?: number,
|
|
64
|
+
offset?: number,
|
|
65
|
+
status?: ContentObjectStatus,
|
|
66
|
+
type?: string,
|
|
67
|
+
}): Promise<ContentObjectItem[]> {
|
|
68
|
+
return this.get(`/${collectionId}/members`, {
|
|
69
|
+
query: {
|
|
70
|
+
...payload
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
computeFacets(collectionId: string, query: ComputeObjectFacetPayload): Promise<ComputeFacetsResponse> {
|
|
76
|
+
return this.post(`/${collectionId}/facets`, {
|
|
77
|
+
payload: query
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
searchMembers(collectionId: string, payload: ComplexSearchPayload): Promise<SearchResponse> {
|
|
82
|
+
return this.post(`/${collectionId}/search`, { payload });
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
deleteMembers(collectionId: string, members: string[]): Promise<{ id: string }> {
|
|
86
|
+
return this.post(`/${collectionId}/members`, {
|
|
87
|
+
payload: {
|
|
88
|
+
action: 'delete',
|
|
89
|
+
members
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
addChildren(collectionId: string, children: string[]): Promise<{ count: number }> {
|
|
95
|
+
return this.post(`/${collectionId}/children`, {
|
|
96
|
+
payload: {
|
|
97
|
+
action: 'add',
|
|
98
|
+
children
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
deleteChildren(collectionId: string, children: string[]): Promise<{ count: number }> {
|
|
104
|
+
return this.post(`/${collectionId}/children`, {
|
|
105
|
+
payload: {
|
|
106
|
+
action: 'delete',
|
|
107
|
+
children
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
searchChildren(collectionId: string, query: ComplexCollectionSearchQuery = {}): Promise<Collection[]> {
|
|
113
|
+
return this.post(`/${collectionId}/children/search`, {
|
|
114
|
+
payload: query
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
delete(id: string) {
|
|
119
|
+
return this.del(`/${id}`);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Update collection permissions and propagate to member objects
|
|
124
|
+
* @param collectionId - The collection ID
|
|
125
|
+
* @param permissions - Map of permission types to principal arrays
|
|
126
|
+
* @returns Object with collection id, updated security, and number of objects updated
|
|
127
|
+
*/
|
|
128
|
+
updatePermissions(collectionId: string, permissions: Record<string, string[]>): Promise<{
|
|
129
|
+
id: string;
|
|
130
|
+
security: Record<string, string[]>;
|
|
131
|
+
}> {
|
|
132
|
+
return this.put(`/${collectionId}/permissions`, {
|
|
133
|
+
payload: permissions
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Manually trigger permission propagation from collection to member objects
|
|
139
|
+
* Useful for debugging and fixing permission issues
|
|
140
|
+
* @param collectionId - The collection ID
|
|
141
|
+
* @returns Object with collection id, message, and number of objects updated
|
|
142
|
+
*/
|
|
143
|
+
propagatePermissions(collectionId: string): Promise<{
|
|
144
|
+
id: string;
|
|
145
|
+
message: string;
|
|
146
|
+
security?: Record<string, string[]>;
|
|
147
|
+
}> {
|
|
148
|
+
return this.post(`/${collectionId}/propagate-permissions`);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Manually trigger shared properties propagation from collection to member objects
|
|
153
|
+
* Useful for debugging and fixing shared properties issues
|
|
154
|
+
* @param collectionId - The collection ID
|
|
155
|
+
* @returns Object with collection id, message, and number of objects updated
|
|
156
|
+
*/
|
|
157
|
+
propagateSharedProperties(collectionId: string): Promise<{
|
|
158
|
+
id: string;
|
|
159
|
+
message: string;
|
|
160
|
+
shared_properties: string[]
|
|
161
|
+
}> {
|
|
162
|
+
return this.post(`/${collectionId}/propagate-shared-props`);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ApiTopic, ClientBase } from "@vertesia/api-fetch-client";
|
|
2
|
+
import { EmbeddingsApi } from "./EmbeddingsApi.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated use EmbeddingsApi instead
|
|
6
|
+
* @see EmbeddingsApi
|
|
7
|
+
*/
|
|
8
|
+
export class CommandsApi extends ApiTopic {
|
|
9
|
+
|
|
10
|
+
constructor(parent: ClientBase) {
|
|
11
|
+
super(parent, "/api/v1/commands");
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
embeddings = new EmbeddingsApi(this, "/embeddings");
|
|
15
|
+
}
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { ApiTopic, ClientBase } from "@vertesia/api-fetch-client";
|
|
2
|
+
import {
|
|
3
|
+
CreateDashboardPayload,
|
|
4
|
+
CreateDashboardSnapshotPayload,
|
|
5
|
+
Dashboard,
|
|
6
|
+
DashboardItem,
|
|
7
|
+
DashboardStatus,
|
|
8
|
+
DashboardVersion,
|
|
9
|
+
DashboardVersionItem,
|
|
10
|
+
DataStoreApiHeaders,
|
|
11
|
+
PromoteDashboardVersionPayload,
|
|
12
|
+
UpdateDashboardPayload,
|
|
13
|
+
} from "@vertesia/common";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Client API for managing Vega-based dashboards linked to data stores.
|
|
17
|
+
*
|
|
18
|
+
* Dashboards provide:
|
|
19
|
+
* - Multi-panel Vega/Vega-Lite visualizations
|
|
20
|
+
* - SQL-backed data sources via named queries
|
|
21
|
+
*
|
|
22
|
+
* Note: Rendering is handled by the tools (data_preview_dashboard, data_render_dashboard).
|
|
23
|
+
*/
|
|
24
|
+
export class DashboardApi extends ApiTopic {
|
|
25
|
+
private readonly storeId: string;
|
|
26
|
+
|
|
27
|
+
constructor(parent: ClientBase, storeId: string) {
|
|
28
|
+
super(parent, `/api/v1/data/${storeId}/dashboards`);
|
|
29
|
+
this.storeId = storeId;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Create headers with data store ID for Cloud Run session affinity.
|
|
34
|
+
*/
|
|
35
|
+
private storeHeaders(): Record<string, string> {
|
|
36
|
+
return { [DataStoreApiHeaders.DATA_STORE_ID]: this.storeId };
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// ============================================================
|
|
40
|
+
// Dashboard Operations
|
|
41
|
+
// ============================================================
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* List all dashboards for the data store.
|
|
45
|
+
*
|
|
46
|
+
* @param status - Filter by status (default: 'active')
|
|
47
|
+
* @returns List of dashboards
|
|
48
|
+
*/
|
|
49
|
+
list(status?: DashboardStatus): Promise<DashboardItem[]> {
|
|
50
|
+
const query = status ? `?status=${status}` : '';
|
|
51
|
+
return this.get(`/${query}`, { headers: this.storeHeaders() });
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Create a new dashboard.
|
|
56
|
+
*
|
|
57
|
+
* @param payload - Dashboard configuration with queries and panels
|
|
58
|
+
* @returns The created dashboard
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```typescript
|
|
62
|
+
* const dashboard = await client.data.dashboards(storeId).create({
|
|
63
|
+
* name: 'Sales Overview',
|
|
64
|
+
* queries: [
|
|
65
|
+
* { name: 'revenue', sql: 'SELECT month, SUM(amount) FROM sales GROUP BY month' }
|
|
66
|
+
* ],
|
|
67
|
+
* panels: [
|
|
68
|
+
* {
|
|
69
|
+
* title: 'Monthly Revenue',
|
|
70
|
+
* dataSources: ['revenue'],
|
|
71
|
+
* position: { row: 0, col: 0 },
|
|
72
|
+
* spec: {
|
|
73
|
+
* mark: 'bar',
|
|
74
|
+
* encoding: {
|
|
75
|
+
* x: { field: 'month', type: 'ordinal' },
|
|
76
|
+
* y: { field: 'sum_amount', type: 'quantitative' }
|
|
77
|
+
* }
|
|
78
|
+
* }
|
|
79
|
+
* }
|
|
80
|
+
* ]
|
|
81
|
+
* });
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
create(payload: CreateDashboardPayload): Promise<Dashboard> {
|
|
85
|
+
return this.post("/", { payload, headers: this.storeHeaders() });
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Get a dashboard by ID.
|
|
90
|
+
*
|
|
91
|
+
* @param id - Dashboard ID
|
|
92
|
+
* @returns The dashboard with all details
|
|
93
|
+
*/
|
|
94
|
+
retrieve(id: string): Promise<Dashboard> {
|
|
95
|
+
return this.get(`/${id}`, { headers: this.storeHeaders() });
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Update an existing dashboard.
|
|
100
|
+
*
|
|
101
|
+
* @param id - Dashboard ID
|
|
102
|
+
* @param payload - Fields to update
|
|
103
|
+
* @returns The updated dashboard
|
|
104
|
+
*/
|
|
105
|
+
update(id: string, payload: UpdateDashboardPayload): Promise<Dashboard> {
|
|
106
|
+
return this.put(`/${id}`, { payload, headers: this.storeHeaders() });
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Archive (soft delete) a dashboard.
|
|
111
|
+
*
|
|
112
|
+
* @param id - Dashboard ID
|
|
113
|
+
* @returns Object with the archived dashboard ID
|
|
114
|
+
*/
|
|
115
|
+
delete(id: string): Promise<{ id: string; status: DashboardStatus }> {
|
|
116
|
+
return this.del(`/${id}`, { headers: this.storeHeaders() });
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Archive (soft delete) multiple dashboards.
|
|
121
|
+
*
|
|
122
|
+
* @param ids - Array of dashboard IDs
|
|
123
|
+
* @returns Object with counts of archived and failed dashboards
|
|
124
|
+
*/
|
|
125
|
+
bulkArchive(ids: string[]): Promise<{ archived: number; failed: number }> {
|
|
126
|
+
return this.post('/bulk/archive', { payload: { ids }, headers: this.storeHeaders() });
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Permanently delete multiple dashboards.
|
|
131
|
+
*
|
|
132
|
+
* @param ids - Array of dashboard IDs
|
|
133
|
+
* @returns Object with counts of deleted and failed dashboards
|
|
134
|
+
*/
|
|
135
|
+
bulkDelete(ids: string[]): Promise<{ deleted: number; failed: number }> {
|
|
136
|
+
return this.post('/bulk/delete', { payload: { ids }, headers: this.storeHeaders() });
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// ============================================================
|
|
140
|
+
// Version Operations
|
|
141
|
+
// ============================================================
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* List versions for a dashboard.
|
|
145
|
+
*
|
|
146
|
+
* @param dashboardId - Dashboard ID
|
|
147
|
+
* @param options - Filter options
|
|
148
|
+
* @returns List of version summaries
|
|
149
|
+
*/
|
|
150
|
+
listVersions(
|
|
151
|
+
dashboardId: string,
|
|
152
|
+
options?: { snapshotsOnly?: boolean; limit?: number }
|
|
153
|
+
): Promise<DashboardVersionItem[]> {
|
|
154
|
+
const params = new URLSearchParams();
|
|
155
|
+
if (options?.snapshotsOnly) params.set('snapshots_only', 'true');
|
|
156
|
+
if (options?.limit) params.set('limit', String(options.limit));
|
|
157
|
+
const query = params.toString() ? `?${params}` : '';
|
|
158
|
+
return this.get(`/${dashboardId}/versions${query}`, { headers: this.storeHeaders() });
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Get a specific version with full content.
|
|
163
|
+
*
|
|
164
|
+
* @param dashboardId - Dashboard ID
|
|
165
|
+
* @param versionId - Version ID
|
|
166
|
+
* @returns The version with full content
|
|
167
|
+
*/
|
|
168
|
+
getVersion(dashboardId: string, versionId: string): Promise<DashboardVersion> {
|
|
169
|
+
return this.get(`/${dashboardId}/versions/${versionId}`, { headers: this.storeHeaders() });
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Create a named snapshot from current dashboard state.
|
|
174
|
+
*
|
|
175
|
+
* @param dashboardId - Dashboard ID
|
|
176
|
+
* @param payload - Snapshot name and message
|
|
177
|
+
* @returns The created snapshot version
|
|
178
|
+
*/
|
|
179
|
+
createSnapshot(
|
|
180
|
+
dashboardId: string,
|
|
181
|
+
payload: CreateDashboardSnapshotPayload
|
|
182
|
+
): Promise<DashboardVersionItem> {
|
|
183
|
+
return this.post(`/${dashboardId}/versions`, { payload, headers: this.storeHeaders() });
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Promote a version to be the current/active one.
|
|
188
|
+
* This restores the version's content to the dashboard.
|
|
189
|
+
*
|
|
190
|
+
* @param dashboardId - Dashboard ID
|
|
191
|
+
* @param versionId - Version ID to promote
|
|
192
|
+
* @param payload - Optional promotion message
|
|
193
|
+
* @returns The updated dashboard
|
|
194
|
+
*/
|
|
195
|
+
promoteVersion(
|
|
196
|
+
dashboardId: string,
|
|
197
|
+
versionId: string,
|
|
198
|
+
payload?: PromoteDashboardVersionPayload
|
|
199
|
+
): Promise<Dashboard> {
|
|
200
|
+
return this.post(`/${dashboardId}/versions/${versionId}/promote`, { payload: payload || {}, headers: this.storeHeaders() });
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Enable or disable versioning for a dashboard.
|
|
205
|
+
*
|
|
206
|
+
* @param dashboardId - Dashboard ID
|
|
207
|
+
* @param enabled - Whether versioning should be enabled
|
|
208
|
+
* @returns The updated versioning state
|
|
209
|
+
*/
|
|
210
|
+
setVersioningEnabled(
|
|
211
|
+
dashboardId: string,
|
|
212
|
+
enabled: boolean
|
|
213
|
+
): Promise<{ versioning_enabled: boolean }> {
|
|
214
|
+
return this.put(`/${dashboardId}/versioning`, { payload: { enabled }, headers: this.storeHeaders() });
|
|
215
|
+
}
|
|
216
|
+
}
|