@vizzly/api-client 0.0.5 → 0.0.7
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/errors/FailedToDecryptDashboardBeforeClient.d.ts +3 -0
- package/dist/errors/FailedToDecryptDashboardBeforeClient.js +11 -0
- package/dist/errors/index.d.ts +1 -0
- package/dist/errors/index.js +1 -0
- package/dist/models/DashboardRepository.js +8 -1
- 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
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FailedToDecryptDashboardBeforeClient = void 0;
|
|
4
|
+
class FailedToDecryptDashboardBeforeClient extends Error {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(`Vizzly offers dashboard encryption to keep your dashboard configurations secure.
|
|
7
|
+
Please ensure your Vizzly Query Engine is still setup to manage encrypted dashboards.`);
|
|
8
|
+
this.name = 'FailedToDecryptDashboardBeforeClient';
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.FailedToDecryptDashboardBeforeClient = FailedToDecryptDashboardBeforeClient;
|
package/dist/errors/index.d.ts
CHANGED
package/dist/errors/index.js
CHANGED
|
@@ -25,3 +25,4 @@ __exportStar(require("./SQLPreviewError"), exports);
|
|
|
25
25
|
__exportStar(require("./FailedToSetupProject"), exports);
|
|
26
26
|
__exportStar(require("./FailedToResolveDataSets"), exports);
|
|
27
27
|
__exportStar(require("./FailedToCreateGlobalLibrary"), exports);
|
|
28
|
+
__exportStar(require("./FailedToDecryptDashboardBeforeClient"), exports);
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.DashboardRepository = void 0;
|
|
13
13
|
const DashboardQuotaReached_1 = require("../errors/DashboardQuotaReached");
|
|
14
14
|
const FailedToCreateDashboard_1 = require("../errors/FailedToCreateDashboard");
|
|
15
|
+
const FailedToDecryptDashboardBeforeClient_1 = require("../errors/FailedToDecryptDashboardBeforeClient");
|
|
15
16
|
const FailedToFetchDashboardAccessTokens_1 = require("../errors/FailedToFetchDashboardAccessTokens");
|
|
16
17
|
const FailedToFetchDashboards_1 = require("../errors/FailedToFetchDashboards");
|
|
17
18
|
const Permission_1 = require("./Permission");
|
|
@@ -71,8 +72,14 @@ class DashboardRepository {
|
|
|
71
72
|
const vizzlyApi = this.vizzly.getVizzlyAPI();
|
|
72
73
|
dashboardResponse = yield vizzlyApi.execute(vizzlyApi.buildFetchDashboardsRequest(permissions.map((p) => p.token)));
|
|
73
74
|
}
|
|
74
|
-
if (dashboardResponse.status === 200)
|
|
75
|
+
if (dashboardResponse.status === 200) {
|
|
76
|
+
dashboardResponse.body.found.forEach((dashboard) => {
|
|
77
|
+
if (typeof dashboard.definition === 'string') {
|
|
78
|
+
throw new FailedToDecryptDashboardBeforeClient_1.FailedToDecryptDashboardBeforeClient();
|
|
79
|
+
}
|
|
80
|
+
});
|
|
75
81
|
return dashboardResponse.body;
|
|
82
|
+
}
|
|
76
83
|
throw new FailedToFetchDashboards_1.FailedToFetchDashboards(`Failed to fetch dashboards. Got status code ${dashboardResponse.status}.`);
|
|
77
84
|
});
|
|
78
85
|
}
|
|
@@ -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));
|