@vizzly/api-client 0.0.6 → 0.0.8
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/dist/models/Api.d.ts +1 -0
- package/dist/models/Api.js +3 -0
- package/dist/models/GlobalLibraryRepository.d.ts +3 -2
- package/dist/models/GlobalLibraryRepository.js +12 -3
- package/dist/models/VizzlyQueryEngineApi.d.ts +11 -0
- package/dist/models/VizzlyQueryEngineApi.js +14 -0
- package/package.json +1 -1
package/dist/models/Api.d.ts
CHANGED
package/dist/models/Api.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreateGlobalLibraryParams, GlobalLibrary, GlobalLibraryPermission, UpdateGlobalLibraryParams } from '../types';
|
|
1
|
+
import { CreateGlobalLibraryParams, GlobalLibrary, GlobalLibraryPermission, Response, UpdateGlobalLibraryParams } from '../types';
|
|
2
2
|
import { Vizzly } from './Vizzly';
|
|
3
3
|
export declare class GlobalLibraryRepository {
|
|
4
4
|
private vizzly;
|
|
@@ -10,11 +10,12 @@ export declare class GlobalLibraryRepository {
|
|
|
10
10
|
}>;
|
|
11
11
|
fetchGlobalLibraries(): Promise<{
|
|
12
12
|
found: GlobalLibrary[];
|
|
13
|
+
not_found: string[];
|
|
13
14
|
}>;
|
|
14
15
|
fetchGlobalLibraryAccessTokens(): Promise<{
|
|
15
16
|
permissions: GlobalLibraryPermission[];
|
|
16
17
|
}>;
|
|
17
|
-
updateGlobalLibrary(params: UpdateGlobalLibraryParams): Promise<
|
|
18
|
+
updateGlobalLibrary(params: UpdateGlobalLibraryParams): Promise<Response<{
|
|
18
19
|
global_library: GlobalLibrary;
|
|
19
20
|
}>>;
|
|
20
21
|
getChildGlobalLibrariesByParentGlobalLibraryId(parentGlobalLibraryId: string): Promise<GlobalLibrary[]>;
|
|
@@ -33,11 +33,20 @@ class GlobalLibraryRepository {
|
|
|
33
33
|
}
|
|
34
34
|
fetchGlobalLibraries() {
|
|
35
35
|
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
let globalLibraries;
|
|
36
37
|
const vizzlyApi = this.vizzly.getVizzlyAPI();
|
|
37
38
|
const accessTokens = yield this.fetchGlobalLibraryAccessTokens();
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
if (this.vizzly.implementationStrategy.shouldPersistViaQueryEngine()) {
|
|
40
|
+
const vizzlyQueryEngineApi = this.vizzly.getVizzlyQueryEngineAPI();
|
|
41
|
+
globalLibraries = yield vizzlyQueryEngineApi.fetchGlobalLibraries({
|
|
42
|
+
globalLibraryAccessTokens: accessTokens.permissions.map((p) => p.token),
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
globalLibraries = yield vizzlyApi.fetchGlobalLibraries({
|
|
47
|
+
globalLibraryAccessTokens: accessTokens.permissions.map((p) => p.token),
|
|
48
|
+
});
|
|
49
|
+
}
|
|
41
50
|
if (globalLibraries.status === 200)
|
|
42
51
|
return globalLibraries.body;
|
|
43
52
|
throw new FailedToFetchGlobalLibraries_1.FailedToFetchGlobalLibraries(`Failed to fetch global libraries. Got status ${globalLibraries.status}`);
|
|
@@ -46,6 +46,17 @@ export declare class VizzlyQueryEngineApi extends Api {
|
|
|
46
46
|
permissions: Array<GlobalLibraryPermission>;
|
|
47
47
|
}>;
|
|
48
48
|
buildCreateGlobalLibraryRequest(params: CreateGlobalLibraryParams): Request<{}>;
|
|
49
|
+
fetchGlobalLibraries(params: {
|
|
50
|
+
globalLibraryAccessTokens: string[];
|
|
51
|
+
}): Promise<import("../types").Response<{
|
|
52
|
+
found: GlobalLibrary[];
|
|
53
|
+
not_found: string[];
|
|
54
|
+
}>>;
|
|
55
|
+
buildFetchGlobalLibrariesRequest(params: {
|
|
56
|
+
globalLibraryAccessTokens: string[];
|
|
57
|
+
}): Request<{
|
|
58
|
+
globalLibraryAccessTokens: string[];
|
|
59
|
+
}>;
|
|
49
60
|
updateGlobalLibrary(params: UpdateGlobalLibraryParams): Promise<import("../types").Response<{
|
|
50
61
|
global_library: GlobalLibrary;
|
|
51
62
|
}>>;
|
|
@@ -281,6 +281,20 @@ class VizzlyQueryEngineApi extends Api_1.Api {
|
|
|
281
281
|
},
|
|
282
282
|
};
|
|
283
283
|
}
|
|
284
|
+
fetchGlobalLibraries(params) {
|
|
285
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
286
|
+
return yield this.execute(this.buildFetchGlobalLibrariesRequest(params));
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
buildFetchGlobalLibrariesRequest(params) {
|
|
290
|
+
return {
|
|
291
|
+
path: '/api/v1/get-global-libraries',
|
|
292
|
+
method: 'post',
|
|
293
|
+
body: {
|
|
294
|
+
globalLibraryAccessTokens: params.globalLibraryAccessTokens,
|
|
295
|
+
},
|
|
296
|
+
};
|
|
297
|
+
}
|
|
284
298
|
updateGlobalLibrary(params) {
|
|
285
299
|
return __awaiter(this, void 0, void 0, function* () {
|
|
286
300
|
return yield this.execute(this.buildUpdateGlobalLibraryRequest(params));
|