@vertesia/client 0.74.0 → 0.76.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 (38) hide show
  1. package/lib/cjs/ApiKeysApi.js +2 -2
  2. package/lib/cjs/ApiKeysApi.js.map +1 -1
  3. package/lib/cjs/AppsApi.js +8 -0
  4. package/lib/cjs/AppsApi.js.map +1 -1
  5. package/lib/cjs/store/CollectionsApi.js +20 -0
  6. package/lib/cjs/store/CollectionsApi.js.map +1 -1
  7. package/lib/cjs/store/ObjectsApi.js +2 -5
  8. package/lib/cjs/store/ObjectsApi.js.map +1 -1
  9. package/lib/esm/ApiKeysApi.js +2 -2
  10. package/lib/esm/ApiKeysApi.js.map +1 -1
  11. package/lib/esm/AppsApi.js +8 -0
  12. package/lib/esm/AppsApi.js.map +1 -1
  13. package/lib/esm/store/CollectionsApi.js +20 -0
  14. package/lib/esm/store/CollectionsApi.js.map +1 -1
  15. package/lib/esm/store/ObjectsApi.js +2 -5
  16. package/lib/esm/store/ObjectsApi.js.map +1 -1
  17. package/lib/tsconfig.tsbuildinfo +1 -1
  18. package/lib/types/ApiKeysApi.d.ts +1 -1
  19. package/lib/types/ApiKeysApi.d.ts.map +1 -1
  20. package/lib/types/AppsApi.d.ts +2 -1
  21. package/lib/types/AppsApi.d.ts.map +1 -1
  22. package/lib/types/InteractionsApi.d.ts +2 -2
  23. package/lib/types/InteractionsApi.d.ts.map +1 -1
  24. package/lib/types/store/CollectionsApi.d.ts +25 -2
  25. package/lib/types/store/CollectionsApi.d.ts.map +1 -1
  26. package/lib/types/store/FilesApi.d.ts +1 -1
  27. package/lib/types/store/FilesApi.d.ts.map +1 -1
  28. package/lib/types/store/ObjectsApi.d.ts +5 -1
  29. package/lib/types/store/ObjectsApi.d.ts.map +1 -1
  30. package/lib/vertesia-client.js +1 -1
  31. package/lib/vertesia-client.js.map +1 -1
  32. package/package.json +3 -3
  33. package/src/ApiKeysApi.ts +2 -2
  34. package/src/AppsApi.ts +8 -0
  35. package/src/InteractionsApi.ts +2 -2
  36. package/src/store/CollectionsApi.ts +33 -2
  37. package/src/store/FilesApi.ts +1 -1
  38. package/src/store/ObjectsApi.ts +8 -7
@@ -1,6 +1,6 @@
1
1
  import { ApiTopic, ClientBase } from "@vertesia/api-fetch-client";
2
2
  import { Collection, CollectionItem, ComplexCollectionSearchQuery, ComplexSearchPayload, ComputeCollectionFacetPayload, ComputeObjectFacetPayload, ContentObjectItem, ContentObjectStatus, CreateCollectionPayload, DynamicCollection } from "@vertesia/common";
3
- import { ComputeFacetsResponse } from "./ObjectsApi.js";
3
+ import { ComputeFacetsResponse, SearchResponse } from "./ObjectsApi.js";
4
4
 
5
5
 
6
6
  export class CollectionsApi extends ApiTopic {
@@ -78,7 +78,7 @@ export class CollectionsApi extends ApiTopic {
78
78
  });
79
79
  }
80
80
 
81
- searchMembers(collectionId: string, payload: ComplexSearchPayload): Promise<ContentObjectItem[]> {
81
+ searchMembers(collectionId: string, payload: ComplexSearchPayload): Promise<SearchResponse> {
82
82
  return this.post(`/${collectionId}/search`, { payload });
83
83
  }
84
84
 
@@ -95,4 +95,35 @@ export class CollectionsApi extends ApiTopic {
95
95
  return this.del(`/${id}`);
96
96
  }
97
97
 
98
+ /**
99
+ * Update collection permissions and propagate to member objects
100
+ * @param collectionId - The collection ID
101
+ * @param permissions - Map of permission types to principal arrays
102
+ * @returns Object with collection id, updated security, and number of objects updated
103
+ */
104
+ updatePermissions(collectionId: string, permissions: Record<string, string[]>): Promise<{
105
+ id: string;
106
+ security: Record<string, string[]>;
107
+ objectsUpdated: number;
108
+ }> {
109
+ return this.put(`/${collectionId}/permissions`, {
110
+ payload: permissions
111
+ });
112
+ }
113
+
114
+ /**
115
+ * Manually trigger permission propagation from collection to member objects
116
+ * Useful for debugging and fixing permission issues
117
+ * @param collectionId - The collection ID
118
+ * @returns Object with collection id, message, and number of objects updated
119
+ */
120
+ propagatePermissions(collectionId: string): Promise<{
121
+ id: string;
122
+ message: string;
123
+ security?: Record<string, string[]>;
124
+ objectsUpdated: number;
125
+ }> {
126
+ return this.post(`/${collectionId}/propagate-permissions`);
127
+ }
128
+
98
129
  }
@@ -106,7 +106,7 @@ export class FilesApi extends ApiTopic {
106
106
  * @param location can be a relative path in the project, a reference to a cloud storage, or a accessible HTTPS URL (typically signed URL)
107
107
  * @returns ReadableStream
108
108
  */
109
- async downloadFile(location: string): Promise<ReadableStream<Uint8Array>> {
109
+ async downloadFile(location: string): Promise<ReadableStream<Uint8Array<ArrayBuffer>>> {
110
110
  //if start with HTTPS, no download url needed - assume it's signed already
111
111
  const needSign = !location.startsWith("https:");
112
112
  const { url } = needSign
@@ -50,6 +50,11 @@ export interface ComputeFacetsResponse {
50
50
  total?: { count: number }[];
51
51
  }
52
52
 
53
+ export interface SearchResponse {
54
+ results: ContentObjectItem[];
55
+ facets: ComputeFacetsResponse;
56
+ }
57
+
53
58
  export class ObjectsApi extends ApiTopic {
54
59
  constructor(parent: ClientBase) {
55
60
  super(parent, "/api/v1/objects");
@@ -90,17 +95,13 @@ export class ObjectsApi extends ApiTopic {
90
95
  const offset = payload.offset || 0;
91
96
  const query = payload.query || ({} as ObjectSearchQuery);
92
97
 
93
- // Add revision filtering options
94
- const showAllRevisions = payload.all_revisions === true;
95
- const revisionRoot = payload.from_root;
96
-
97
98
  return this.get("/", {
98
99
  query: {
99
100
  limit,
100
101
  offset,
101
102
  ...query,
102
- all_revisions: showAllRevisions ? "true" : undefined,
103
- from_root: revisionRoot,
103
+ all_revisions: payload.all_revisions,
104
+ from_root: payload.from_root || undefined,
104
105
  },
105
106
  });
106
107
  }
@@ -132,7 +133,7 @@ export class ObjectsApi extends ApiTopic {
132
133
  }
133
134
 
134
135
  /** Search object — different from find because allow full text search */
135
- search(payload: ComplexSearchPayload): Promise<ContentObjectItem[]> {
136
+ search(payload: ComplexSearchPayload): Promise<SearchResponse> {
136
137
  return this.post("/search", {
137
138
  payload,
138
139
  });