@vizzly/api-client 0.0.1
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/README.md +1 -0
- package/dist/errors/DashboardQuotaReached.d.ts +3 -0
- package/dist/errors/DashboardQuotaReached.js +10 -0
- package/dist/errors/FailedToCreateDashboard.d.ts +3 -0
- package/dist/errors/FailedToCreateDashboard.js +10 -0
- package/dist/errors/FailedToFetchDashboardAccessTokens.d.ts +3 -0
- package/dist/errors/FailedToFetchDashboardAccessTokens.js +10 -0
- package/dist/errors/FailedToFetchDashboards.d.ts +3 -0
- package/dist/errors/FailedToFetchDashboards.js +10 -0
- package/dist/errors/FailedToFetchGlobalLibraries.d.ts +3 -0
- package/dist/errors/FailedToFetchGlobalLibraries.js +10 -0
- package/dist/errors/FailedToFetchGlobalLibraryAccessTokens.d.ts +3 -0
- package/dist/errors/FailedToFetchGlobalLibraryAccessTokens.js +10 -0
- package/dist/errors/FailedToResolveDataSets.d.ts +3 -0
- package/dist/errors/FailedToResolveDataSets.js +10 -0
- package/dist/errors/FailedToSetupProject.d.ts +3 -0
- package/dist/errors/FailedToSetupProject.js +10 -0
- package/dist/errors/MissingAuthParameter.d.ts +4 -0
- package/dist/errors/MissingAuthParameter.js +9 -0
- package/dist/errors/MissingRequiredVizzlyQueryEngineApi.d.ts +2 -0
- package/dist/errors/MissingRequiredVizzlyQueryEngineApi.js +6 -0
- package/dist/errors/SQLPreviewError.d.ts +4 -0
- package/dist/errors/SQLPreviewError.js +11 -0
- package/dist/errors/ValidationError.d.ts +3 -0
- package/dist/errors/ValidationError.js +10 -0
- package/dist/errors/index.d.ts +10 -0
- package/dist/errors/index.js +26 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +37 -0
- package/dist/interfaces/iSerialize.d.ts +10 -0
- package/dist/interfaces/iSerialize.js +1 -0
- package/dist/models/Api.d.ts +9 -0
- package/dist/models/Api.js +47 -0
- package/dist/models/Authentication.d.ts +16 -0
- package/dist/models/Authentication.js +98 -0
- package/dist/models/Dashboard.d.ts +24 -0
- package/dist/models/Dashboard.js +156 -0
- package/dist/models/DashboardRepository.d.ts +41 -0
- package/dist/models/DashboardRepository.js +92 -0
- package/dist/models/GlobalLibraryRepository.d.ts +35 -0
- package/dist/models/GlobalLibraryRepository.js +106 -0
- package/dist/models/ImplementationStrategy.d.ts +9 -0
- package/dist/models/ImplementationStrategy.js +18 -0
- package/dist/models/Permission.d.ts +26 -0
- package/dist/models/Permission.js +22 -0
- package/dist/models/Vizzly.d.ts +17 -0
- package/dist/models/Vizzly.js +39 -0
- package/dist/models/VizzlyApi.d.ts +77 -0
- package/dist/models/VizzlyApi.js +423 -0
- package/dist/models/VizzlyAppApi.d.ts +54 -0
- package/dist/models/VizzlyAppApi.js +348 -0
- package/dist/models/VizzlyQueryEngineApi.d.ts +50 -0
- package/dist/models/VizzlyQueryEngineApi.js +311 -0
- package/dist/types/dashboard.d.ts +23 -0
- package/dist/types/dashboard.js +2 -0
- package/dist/types.d.ts +405 -0
- package/dist/types.js +17 -0
- package/package.json +37 -0
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.VizzlyQueryEngineApi = void 0;
|
|
13
|
+
const Api_1 = require("./Api");
|
|
14
|
+
const SQLPreviewError_1 = require("../errors/SQLPreviewError");
|
|
15
|
+
const FailedToResolveDataSets_1 = require("../errors/FailedToResolveDataSets");
|
|
16
|
+
const FailedToSetupProject_1 = require("../errors/FailedToSetupProject");
|
|
17
|
+
class VizzlyQueryEngineApi extends Api_1.Api {
|
|
18
|
+
constructor(auth, host, extraHeaders) {
|
|
19
|
+
super(auth, host, extraHeaders);
|
|
20
|
+
}
|
|
21
|
+
buildCreateDashboardRequest(params) {
|
|
22
|
+
return {
|
|
23
|
+
path: '/api/v1/dashboard',
|
|
24
|
+
method: 'post',
|
|
25
|
+
body: {
|
|
26
|
+
dashboardAccessToken: this.auth.getDashboardAccessToken(),
|
|
27
|
+
definition: params.definition,
|
|
28
|
+
meta: params.metadata,
|
|
29
|
+
parentDashboardId: params.parentDashboardId,
|
|
30
|
+
permissions: params.permissions,
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
buildFetchDashboardsRequest(dashboardSessionAccessTokens) {
|
|
35
|
+
return {
|
|
36
|
+
path: '/api/v1/get-dashboards',
|
|
37
|
+
method: 'post',
|
|
38
|
+
body: {
|
|
39
|
+
dashboardAccessTokens: dashboardSessionAccessTokens,
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
createConfigFromUpload(createConfigFromUploadParams) {
|
|
44
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
return yield this.execute(this.buildCreateConfigFromUploadRequest(createConfigFromUploadParams));
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
buildCreateConfigFromUploadRequest(params) {
|
|
49
|
+
return {
|
|
50
|
+
path: `/api/v1/create-config-from-upload`,
|
|
51
|
+
method: 'post',
|
|
52
|
+
body: {
|
|
53
|
+
queryEngineAccessToken: this.auth.getQueryEngineAccessToken(),
|
|
54
|
+
table: params.table,
|
|
55
|
+
fieldPublicNames: params.fieldPublicNames,
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
createResults(params) {
|
|
60
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
return yield this.execute(this.buildCreateResultsRequest(params));
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
buildCreateResultsRequest(params) {
|
|
65
|
+
return {
|
|
66
|
+
path: `/api/v1/create-results`,
|
|
67
|
+
method: 'post',
|
|
68
|
+
body: {
|
|
69
|
+
queries: params.queries,
|
|
70
|
+
virtualFields: {},
|
|
71
|
+
identityConfigIntegritySignature: this.auth.getDataAccessToken(),
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
createSqlPreview(params) {
|
|
76
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
+
var _a;
|
|
78
|
+
const response = yield this.execute(this.buildCreateSqlPreviewRequest(params));
|
|
79
|
+
if (response.status === 200)
|
|
80
|
+
return response;
|
|
81
|
+
throw new SQLPreviewError_1.SQLPreviewError(((_a = response === null || response === void 0 ? void 0 : response.body) === null || _a === void 0 ? void 0 : _a.message) || 'Unknown SQL error');
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
buildCreateSqlPreviewRequest(params) {
|
|
85
|
+
return {
|
|
86
|
+
path: `/api/v1/create-sql-preview`,
|
|
87
|
+
method: 'post',
|
|
88
|
+
body: {
|
|
89
|
+
sql: params.sql,
|
|
90
|
+
parameters: params.parameters,
|
|
91
|
+
limit: params.limit,
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
createQueryEngineUser(params) {
|
|
96
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
97
|
+
return yield this.execute(this.buildCreateQueryEngineUserRequest(params));
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
buildCreateQueryEngineUserRequest(params) {
|
|
101
|
+
return {
|
|
102
|
+
path: `/api/v1/query-engine-user`,
|
|
103
|
+
method: 'post',
|
|
104
|
+
body: {
|
|
105
|
+
email: params.email,
|
|
106
|
+
password: params.password,
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
fetchDataSets() {
|
|
111
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
+
const request = this.buildFetchDataSetsRequest();
|
|
113
|
+
const result = yield this.execute(request);
|
|
114
|
+
if (result.status === 200)
|
|
115
|
+
return result;
|
|
116
|
+
throw new FailedToResolveDataSets_1.FailedToResolveDataSets(`Failed to resolve data sets from ${request.path}. Received status ${result.status}`);
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
buildFetchDataSetsRequest() {
|
|
120
|
+
return {
|
|
121
|
+
path: `/api/v1/resolve-data-sets`,
|
|
122
|
+
method: 'post',
|
|
123
|
+
body: {
|
|
124
|
+
integritySignature: this.auth.getDataAccessToken(),
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
fetchSelfHostedQueryEngineConfig() {
|
|
129
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
130
|
+
return this.execute(this.buildFetchSelfHostedQueryEngineConfigRequest());
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
buildFetchSelfHostedQueryEngineConfigRequest() {
|
|
134
|
+
return {
|
|
135
|
+
path: `/api/v1/support`,
|
|
136
|
+
method: 'post',
|
|
137
|
+
body: {},
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
fetchProject() {
|
|
141
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
142
|
+
return this.execute(this.buildFetchProjectRequest());
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
buildFetchProjectRequest() {
|
|
146
|
+
return {
|
|
147
|
+
path: `/api/v1/project`,
|
|
148
|
+
method: 'get',
|
|
149
|
+
body: {},
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
getStarted(params) {
|
|
153
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
154
|
+
const response = yield this.execute(this.buildGetStartedRequest(params));
|
|
155
|
+
if (response.status != 200) {
|
|
156
|
+
throw new FailedToSetupProject_1.FailedToSetupProject(typeof response.body === 'object' && response.body.reason && 'reason' in response.body
|
|
157
|
+
? response.body.reason
|
|
158
|
+
: 'Failed to create the first user.');
|
|
159
|
+
}
|
|
160
|
+
return response;
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
buildGetStartedRequest(params) {
|
|
164
|
+
return {
|
|
165
|
+
path: `/api/v2/get-started`,
|
|
166
|
+
method: 'post',
|
|
167
|
+
body: {
|
|
168
|
+
email: params.email,
|
|
169
|
+
password: params.password,
|
|
170
|
+
},
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
getTeamMembers() {
|
|
174
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
175
|
+
return this.execute(this.buildGetTeamMembersRequest());
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
buildGetTeamMembersRequest() {
|
|
179
|
+
return {
|
|
180
|
+
path: `/api/v1/team-members`,
|
|
181
|
+
method: 'get',
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
isVizzly() {
|
|
185
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
186
|
+
return this.execute(this.buildIsVizzlyRequest());
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
buildIsVizzlyRequest() {
|
|
190
|
+
return {
|
|
191
|
+
path: `/api/is-vizzly`,
|
|
192
|
+
method: 'get',
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
saveConfig(params) {
|
|
196
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
197
|
+
return yield this.execute(this.buildSaveConfigRequest(params));
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
buildSaveConfigRequest(params) {
|
|
201
|
+
return {
|
|
202
|
+
path: `/api/v1/save-config`,
|
|
203
|
+
method: 'post',
|
|
204
|
+
body: {
|
|
205
|
+
config: params.config,
|
|
206
|
+
},
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
saveConnection(params) {
|
|
210
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
211
|
+
return yield this.execute(this.buildSaveConnectionRequest(params));
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
buildSaveConnectionRequest(params) {
|
|
215
|
+
return {
|
|
216
|
+
path: `/api/v1/save-connection`,
|
|
217
|
+
method: 'post',
|
|
218
|
+
body: {
|
|
219
|
+
connection: params.connection,
|
|
220
|
+
client: params.client,
|
|
221
|
+
},
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
signInWithQueryEngineAccessToken() {
|
|
225
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
226
|
+
return this.execute(this.buildSignInWithQueryEngineAccessTokenRequest());
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
buildSignInWithQueryEngineAccessTokenRequest() {
|
|
230
|
+
return {
|
|
231
|
+
path: `/api/v1/sign-in`,
|
|
232
|
+
method: 'post',
|
|
233
|
+
body: {},
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
signInWithEmailAndPassword(params) {
|
|
237
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
238
|
+
return yield this.execute(this.buildSignInWithEmailAndPasswordRequest(params));
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
buildSignInWithEmailAndPasswordRequest(params) {
|
|
242
|
+
return {
|
|
243
|
+
path: `/api/v1/sign-in`,
|
|
244
|
+
method: 'post',
|
|
245
|
+
body: {
|
|
246
|
+
email: params.email,
|
|
247
|
+
password: params.password,
|
|
248
|
+
},
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
status() {
|
|
252
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
253
|
+
return this.execute(this.buildStatusRequest());
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
buildStatusRequest() {
|
|
257
|
+
return {
|
|
258
|
+
path: `/api/status`,
|
|
259
|
+
method: 'post',
|
|
260
|
+
body: {},
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
updateDashboard(params) {
|
|
264
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
265
|
+
return yield this.execute(this.buildUpdateDashboardRequest(params));
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
buildUpdateDashboardRequest(params) {
|
|
269
|
+
return {
|
|
270
|
+
path: `/api/v1/dashboard`,
|
|
271
|
+
method: 'put',
|
|
272
|
+
body: {
|
|
273
|
+
dashboardSessionToken: params.dashboardSessionToken,
|
|
274
|
+
definition: params.definition,
|
|
275
|
+
meta: params.meta,
|
|
276
|
+
deleted: params.deleted,
|
|
277
|
+
},
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
updateQueryEngineUser(params) {
|
|
281
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
282
|
+
return yield this.execute(this.buildUpdateQueryEngineUserRequest(params));
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
buildUpdateQueryEngineUserRequest(params) {
|
|
286
|
+
return {
|
|
287
|
+
path: `/api/v1/query-engine-user`,
|
|
288
|
+
method: 'put',
|
|
289
|
+
body: {
|
|
290
|
+
queryEngineUserId: params.queryEngineUserId,
|
|
291
|
+
password: params.password,
|
|
292
|
+
},
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
uploadDataToVizzlyCloud(params) {
|
|
296
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
297
|
+
return yield this.execute(this.buildUploadDataToVizzlyCloudRequest(params));
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
buildUploadDataToVizzlyCloudRequest(params) {
|
|
301
|
+
return {
|
|
302
|
+
path: `/api/v1/ingest`,
|
|
303
|
+
method: 'post',
|
|
304
|
+
body: {
|
|
305
|
+
queryEngineAccessToken: this.auth.getQueryEngineAccessToken(),
|
|
306
|
+
ingest: params.ingest,
|
|
307
|
+
},
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
exports.VizzlyQueryEngineApi = VizzlyQueryEngineApi;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type Dashboard = {
|
|
2
|
+
definition: DashboardDefinition;
|
|
3
|
+
created_at: string;
|
|
4
|
+
id: string;
|
|
5
|
+
metadata: Object;
|
|
6
|
+
organisation_id: string;
|
|
7
|
+
parent_dashboard_id: string | null;
|
|
8
|
+
updated_at: string;
|
|
9
|
+
webhook_id: string | null;
|
|
10
|
+
};
|
|
11
|
+
export type DashboardDefinition = {
|
|
12
|
+
display: any;
|
|
13
|
+
componentLibrary: Array<{
|
|
14
|
+
attributes: {
|
|
15
|
+
viewId: string;
|
|
16
|
+
protectedByOrganisation?: boolean;
|
|
17
|
+
};
|
|
18
|
+
}>;
|
|
19
|
+
globalFilters: Array<any>;
|
|
20
|
+
customFields: {
|
|
21
|
+
[dataSetId: string]: Array<any>;
|
|
22
|
+
};
|
|
23
|
+
};
|