@vizzly/api-client 0.0.13 → 0.0.14
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/FailedToFetchVizzlyConfig.d.ts +3 -0
- package/dist/errors/FailedToFetchVizzlyConfig.js +10 -0
- package/dist/errors/index.d.ts +1 -0
- package/dist/errors/index.js +1 -0
- package/dist/models/Authentication.d.ts +1 -0
- package/dist/models/Authentication.js +3 -24
- package/dist/models/VizzlyApi.d.ts +12 -3
- package/dist/models/VizzlyApi.js +8 -1
- package/package.json +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FailedToFetchVizzlyConfig = void 0;
|
|
4
|
+
class FailedToFetchVizzlyConfig extends Error {
|
|
5
|
+
constructor(message) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = 'FailedToFetchVizzlyConfig';
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.FailedToFetchVizzlyConfig = FailedToFetchVizzlyConfig;
|
package/dist/errors/index.d.ts
CHANGED
package/dist/errors/index.js
CHANGED
|
@@ -27,3 +27,4 @@ __exportStar(require("./FailedToResolveDataSets"), exports);
|
|
|
27
27
|
__exportStar(require("./FailedToCreateGlobalLibrary"), exports);
|
|
28
28
|
__exportStar(require("./FailedToDecryptDashboardBeforeClient"), exports);
|
|
29
29
|
__exportStar(require("./FailedToUpdateDashboard"), exports);
|
|
30
|
+
__exportStar(require("./FailedToFetchVizzlyConfig"), exports);
|
|
@@ -3,6 +3,7 @@ export declare class Authentication {
|
|
|
3
3
|
private authParams;
|
|
4
4
|
constructor(authParams: AuthParams);
|
|
5
5
|
updateAuthParams(authParams: Partial<AuthParams>): void;
|
|
6
|
+
clearAuthParams(): void;
|
|
6
7
|
getQueryEngineAccessToken(): string;
|
|
7
8
|
getProjectAdminOverrideToken(): string | undefined;
|
|
8
9
|
getDashboardAccessToken(): string;
|
|
@@ -9,6 +9,9 @@ class Authentication {
|
|
|
9
9
|
updateAuthParams(authParams) {
|
|
10
10
|
this.authParams = Object.assign(Object.assign({}, this.authParams), authParams);
|
|
11
11
|
}
|
|
12
|
+
clearAuthParams() {
|
|
13
|
+
this.authParams = {};
|
|
14
|
+
}
|
|
12
15
|
getQueryEngineAccessToken() {
|
|
13
16
|
if (!this.authParams.queryEngineAccessToken)
|
|
14
17
|
throw new MissingAuthParameter_1.MissingAuthParameter('queryEngineAccessToken');
|
|
@@ -64,30 +67,6 @@ class Authentication {
|
|
|
64
67
|
auth: `Bearer ${this.authParams.appSessionToken}`,
|
|
65
68
|
};
|
|
66
69
|
}
|
|
67
|
-
// Try without this extra logic to fetch the project tokens...
|
|
68
|
-
// else if (request.preFetchProjectAccessTokens && (config.useCookieAuth || !!config.appSessionAuthToken)) {
|
|
69
|
-
// logDebug(
|
|
70
|
-
// 'Fetching project access token from the Vizzly API',
|
|
71
|
-
// request.preFetchProjectAccessTokens.projectId,
|
|
72
|
-
// 'Filtering by',
|
|
73
|
-
// request.preFetchProjectAccessTokens.resourceFilters
|
|
74
|
-
// );
|
|
75
|
-
// const accessToken = await getProjectAccessToken(httpClient(config))(
|
|
76
|
-
// request.preFetchProjectAccessTokens.projectId,
|
|
77
|
-
// config.appSessionAuthToken,
|
|
78
|
-
// request.preFetchProjectAccessTokens.resourceFilters
|
|
79
|
-
// );
|
|
80
|
-
// if (accessToken) {
|
|
81
|
-
// logDebug('Project access token received.');
|
|
82
|
-
// return {
|
|
83
|
-
// auth: `Bearer ${accessToken}`,
|
|
84
|
-
// };
|
|
85
|
-
// } else {
|
|
86
|
-
// logDebug('Failed to receive project access token.');
|
|
87
|
-
// }
|
|
88
|
-
// } else {
|
|
89
|
-
// logDebug('Not pre-fetching project access token.');
|
|
90
|
-
// }
|
|
91
70
|
return {};
|
|
92
71
|
}
|
|
93
72
|
}
|
|
@@ -42,7 +42,9 @@ export declare class VizzlyApi extends Api {
|
|
|
42
42
|
buildCreateGlobalLibraryRequest(params: CreateGlobalLibraryParams): Request<{}>;
|
|
43
43
|
getProjects(): Promise<import("../types").Response<unknown>>;
|
|
44
44
|
buildGetProjectsRequest(): Request<{}>;
|
|
45
|
-
createProjectApiKey(params: nVizzlyApi.CreateProjectApiKeyParams): Promise<import("../types").Response<
|
|
45
|
+
createProjectApiKey(params: nVizzlyApi.CreateProjectApiKeyParams): Promise<import("../types").Response<{
|
|
46
|
+
api_key: string;
|
|
47
|
+
}>>;
|
|
46
48
|
buildCreateProjectApiKeyRequest(params: nVizzlyApi.CreateProjectApiKeyParams): Request<{}>;
|
|
47
49
|
createQueryEngineUser(params: nVizzlyApi.CreateQueryEngineUserParams): Promise<import("../types").Response<unknown>>;
|
|
48
50
|
buildCreateQueryEngineUserRequest(params: nVizzlyApi.CreateQueryEngineUserParams): Request<{}>;
|
|
@@ -61,13 +63,20 @@ export declare class VizzlyApi extends Api {
|
|
|
61
63
|
buildGetManagedQueryEngineKeyPairRequest(params: nVizzlyApi.GetManagedQueryEngineKeyPairParams): Request<{}>;
|
|
62
64
|
getProject(params: nVizzlyApi.GetProjectParams): Promise<import("../types").Response<unknown>>;
|
|
63
65
|
buildGetProjectRequest(params: nVizzlyApi.GetProjectParams): Request<{}>;
|
|
64
|
-
getProjectAccessToken(params: nVizzlyApi.GetProjectAccessTokenParams): Promise<import("../types").Response<
|
|
66
|
+
getProjectAccessToken(params: nVizzlyApi.GetProjectAccessTokenParams): Promise<import("../types").Response<{
|
|
67
|
+
token: {
|
|
68
|
+
max_age: number;
|
|
69
|
+
token: string;
|
|
70
|
+
};
|
|
71
|
+
}>>;
|
|
65
72
|
buildGetProjectAccessTokenRequest(params: nVizzlyApi.GetProjectAccessTokenParams): Request<{}>;
|
|
66
73
|
getQueryEngineUser(params: nVizzlyApi.GetQueryEngineUserParams): Promise<import("../types").Response<unknown>>;
|
|
67
74
|
buildGetQueryEngineUserRequest(params: nVizzlyApi.GetQueryEngineUserParams): Request<{}>;
|
|
68
75
|
getTeamMembers(params: nVizzlyApi.GetTeamMembers): Promise<import("../types").Response<unknown>>;
|
|
69
76
|
buildGetTeamMembersRequest(params: nVizzlyApi.GetTeamMembers): Request<{}>;
|
|
70
|
-
getVizzlyConfig(params: nVizzlyApi.GetVizzlyConfigParams): Promise<
|
|
77
|
+
getVizzlyConfig(params: nVizzlyApi.GetVizzlyConfigParams): Promise<{
|
|
78
|
+
encryptedConfig: string | null;
|
|
79
|
+
}>;
|
|
71
80
|
buildGetVizzlyConfigRequest(params: nVizzlyApi.GetVizzlyConfigParams): Request<{}>;
|
|
72
81
|
saveConnection(params: nVizzlyApi.SaveConnectionParams): Promise<import("../types").Response<unknown>>;
|
|
73
82
|
buildSaveConnectionRequest(params: nVizzlyApi.SaveConnectionParams): Request<{}>;
|
package/dist/models/VizzlyApi.js
CHANGED
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.VizzlyApi = void 0;
|
|
13
13
|
const Api_1 = require("./Api");
|
|
14
14
|
const errors_1 = require("../errors");
|
|
15
|
+
const FailedToFetchVizzlyConfig_1 = require("../errors/FailedToFetchVizzlyConfig");
|
|
15
16
|
class VizzlyApi extends Api_1.Api {
|
|
16
17
|
constructor(auth, host = 'https://api.vizzly.co') {
|
|
17
18
|
super(auth, host);
|
|
@@ -303,7 +304,13 @@ class VizzlyApi extends Api_1.Api {
|
|
|
303
304
|
}
|
|
304
305
|
getVizzlyConfig(params) {
|
|
305
306
|
return __awaiter(this, void 0, void 0, function* () {
|
|
306
|
-
|
|
307
|
+
const response = yield this.execute(this.buildGetVizzlyConfigRequest(params));
|
|
308
|
+
if (response.status === 200) {
|
|
309
|
+
return {
|
|
310
|
+
encryptedConfig: response.body.encrypted_config,
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
throw new FailedToFetchVizzlyConfig_1.FailedToFetchVizzlyConfig(`Failed to fetch the config containing data sets from the Vizzly API. Got status ${response.status}`);
|
|
307
314
|
});
|
|
308
315
|
}
|
|
309
316
|
buildGetVizzlyConfigRequest(params) {
|