@vizzly/api-client 0.0.27 → 0.0.29
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.
|
@@ -31,6 +31,7 @@ class GlobalLibraryRepository {
|
|
|
31
31
|
else {
|
|
32
32
|
globalLibrary = yield vizzlyApi.createGlobalLibrary(createParams);
|
|
33
33
|
}
|
|
34
|
+
globalLibrary.global_library = GlobalLibraryRepository.upcast(globalLibrary.global_library);
|
|
34
35
|
this.repo.addItem(globalLibrary.global_library, globalLibrary.permissions);
|
|
35
36
|
return globalLibrary;
|
|
36
37
|
});
|
|
@@ -55,7 +56,7 @@ class GlobalLibraryRepository {
|
|
|
55
56
|
}
|
|
56
57
|
if (accessTokens.status === 200) {
|
|
57
58
|
const formattedPermissions = accessTokens.body.permissions.map(Permission_1.Permission.formatGlobalLibraryPermission);
|
|
58
|
-
this.repo.initRepo(accessTokens.body.global_libraries, formattedPermissions);
|
|
59
|
+
this.repo.initRepo(accessTokens.body.global_libraries.map(GlobalLibraryRepository.upcast), formattedPermissions);
|
|
59
60
|
}
|
|
60
61
|
else {
|
|
61
62
|
throw new FailedToFetchGlobalLibraryAccessTokens_1.FailedToFetchGlobalLibraryAccessTokens('Failed to load access tokens for the global library.');
|
|
@@ -78,13 +79,12 @@ class GlobalLibraryRepository {
|
|
|
78
79
|
else {
|
|
79
80
|
updateResponse = yield vizzlyApi.updateGlobalLibrary(params);
|
|
80
81
|
}
|
|
81
|
-
if (updateResponse.status
|
|
82
|
-
this.repo.updateItem(updateResponse.body.global_library);
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
82
|
+
if (updateResponse.status != 200) {
|
|
85
83
|
throw new FailedToUpdateGlobalLibrary_1.FailedToUpdateGlobalLibrary(`Failed to update the global library ${updateResponse.status}`);
|
|
86
84
|
}
|
|
87
|
-
|
|
85
|
+
const globalLibrary = GlobalLibraryRepository.upcast(updateResponse.body.global_library);
|
|
86
|
+
this.repo.updateItem(globalLibrary);
|
|
87
|
+
return globalLibrary;
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
90
|
getChildGlobalLibrariesByParentGlobalLibraryId(parentGlobalLibraryId) {
|
|
@@ -127,5 +127,8 @@ class GlobalLibraryRepository {
|
|
|
127
127
|
});
|
|
128
128
|
return mapping;
|
|
129
129
|
}
|
|
130
|
+
static upcast(globalLibrary) {
|
|
131
|
+
return Object.assign(Object.assign({}, globalLibrary), { library: Object.assign({ views: [], customFields: {} }, (globalLibrary.library || {})) });
|
|
132
|
+
}
|
|
130
133
|
}
|
|
131
134
|
exports.GlobalLibraryRepository = GlobalLibraryRepository;
|
package/dist/models/VizzlyApi.js
CHANGED
|
@@ -72,7 +72,7 @@ class VizzlyApi extends Api_1.Api {
|
|
|
72
72
|
body: {
|
|
73
73
|
dashboardAccessToken: this.auth.getDashboardAccessToken(),
|
|
74
74
|
definition: params.definition,
|
|
75
|
-
meta: params.metadata || {},
|
|
75
|
+
meta: params.metadata || params.meta || {},
|
|
76
76
|
parentDashboardId: params.parentDashboardId,
|
|
77
77
|
permissions: params.permissions,
|
|
78
78
|
},
|
|
@@ -27,7 +27,7 @@ class VizzlyQueryEngineApi extends Api_1.Api {
|
|
|
27
27
|
body: {
|
|
28
28
|
dashboardAccessToken: this.auth.getDashboardAccessToken(),
|
|
29
29
|
definition: params.definition,
|
|
30
|
-
meta: params.metadata,
|
|
30
|
+
meta: params.metadata || params.meta || {},
|
|
31
31
|
parentDashboardId: params.parentDashboardId,
|
|
32
32
|
permissions: params.permissions,
|
|
33
33
|
},
|