@vizzly/api-client 0.0.41 → 0.0.43

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.
@@ -15,7 +15,6 @@ const Permission_1 = require("./Permission");
15
15
  const FailedToFetchGlobalLibraryAccessTokens_1 = require("../errors/FailedToFetchGlobalLibraryAccessTokens");
16
16
  const Repository_1 = require("./Repository");
17
17
  const FailedToUpdateGlobalLibrary_1 = require("../errors/FailedToUpdateGlobalLibrary");
18
- const errors_1 = require("../errors");
19
18
  class GlobalLibraryRepository {
20
19
  constructor(vizzly) {
21
20
  this.vizzly = vizzly;
@@ -43,38 +42,7 @@ class GlobalLibraryRepository {
43
42
  }
44
43
  fetchGlobalLibraries(params) {
45
44
  return __awaiter(this, void 0, void 0, function* () {
46
- // Now, we fetch the libraries and the access tokens from the access call.
47
- let libs = yield this.fetchGlobalLibraryAccessTokens(params);
48
- // Find the parent library.
49
- const parentLibrary = libs.global_libraries.find((l) => l.parent_global_library_id === null);
50
- // Find any child library.
51
- const childLibrary = libs.global_libraries.find((l) => l.parent_global_library_id != null);
52
- // If libraries have been returned, but no child library exists
53
- // then create the first and only one.
54
- if (libs.global_libraries.length > 0 && parentLibrary && !childLibrary) {
55
- try {
56
- const created = yield this.createGlobalLibrary({
57
- parentGlobalLibraryId: parentLibrary.id,
58
- library: {
59
- customFields: {},
60
- views: [],
61
- },
62
- permissions: [{ scope: 'read_write' }],
63
- });
64
- libs = {
65
- global_libraries: [...libs.global_libraries, created.global_library],
66
- permissions: [...libs.permissions, ...created.permissions],
67
- };
68
- }
69
- catch (e) {
70
- // Only throw if the error is not a permission denied. A permission denied
71
- // is expected if the user only has `read` access on their identity JWT token.
72
- if (!(e instanceof errors_1.PermissionDenied)) {
73
- throw e;
74
- }
75
- }
76
- }
77
- return libs;
45
+ return yield this.fetchGlobalLibraryAccessTokens(params);
78
46
  });
79
47
  }
80
48
  fetchGlobalLibraryAccessTokens(params) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizzly/api-client",
3
- "version": "0.0.41",
3
+ "version": "0.0.43",
4
4
  "private": false,
5
5
  "license": "NONE",
6
6
  "source": "src/index.ts",