@eluvio/elv-client-js 3.2.2 → 3.2.6

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.
Files changed (35) hide show
  1. package/dist/ElvClient-min.js +15 -11
  2. package/dist/ElvClient-node-min.js +17 -13
  3. package/dist/ElvFrameClient-min.js +12 -8
  4. package/dist/ElvPermissionsClient-min.js +13 -9
  5. package/dist/ElvWalletClient-min.js +58 -0
  6. package/dist/ElvWalletClient-node-min.js +78 -0
  7. package/dist/src/AuthorizationClient.js +2248 -1990
  8. package/dist/src/ContentObjectVerification.js +164 -173
  9. package/dist/src/Crypto.js +376 -324
  10. package/dist/src/ElvClient.js +1182 -1019
  11. package/dist/src/ElvWallet.js +119 -95
  12. package/dist/src/EthClient.js +1040 -896
  13. package/dist/src/FrameClient.js +331 -300
  14. package/dist/src/HttpClient.js +153 -147
  15. package/dist/src/Id.js +1 -3
  16. package/dist/src/PermissionsClient.js +1294 -1168
  17. package/dist/src/RemoteSigner.js +263 -211
  18. package/dist/src/UserProfileClient.js +1164 -1023
  19. package/dist/src/Utils.js +209 -181
  20. package/dist/src/client/ABRPublishing.js +895 -858
  21. package/dist/src/client/AccessGroups.js +1102 -959
  22. package/dist/src/client/ContentAccess.js +3724 -3431
  23. package/dist/src/client/ContentManagement.js +2252 -2068
  24. package/dist/src/client/Contracts.js +647 -563
  25. package/dist/src/client/Files.js +1886 -1757
  26. package/dist/src/client/NFT.js +126 -112
  27. package/dist/src/client/NTP.js +478 -422
  28. package/dist/src/walletClient/ClientMethods.js +1029 -879
  29. package/dist/src/walletClient/Utils.js +84 -70
  30. package/dist/src/walletClient/index.js +1203 -1087
  31. package/package.json +4 -2
  32. package/src/Utils.js +0 -1
  33. package/src/walletClient/ClientMethods.js +34 -2
  34. package/src/walletClient/index.js +3 -3
  35. package/utilities/ProductionMasterCreate.js +2 -2
@@ -4,9 +4,11 @@ var _toConsumableArray = require("@babel/runtime/helpers/toConsumableArray");
4
4
 
5
5
  var _regeneratorRuntime = require("@babel/runtime/regenerator");
6
6
 
7
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
7
+ var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
8
8
 
9
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
9
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
10
+
11
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
10
12
 
11
13
  /**
12
14
  * Methods for accessing and managing access groups
@@ -33,66 +35,70 @@ var _require = require("../Validation"),
33
35
  */
34
36
 
35
37
 
36
- exports.ListAccessGroups = function _callee2() {
38
+ exports.ListAccessGroups = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
37
39
  var _this = this;
38
40
 
39
41
  var addresses, groups;
40
- return _regeneratorRuntime.async(function _callee2$(_context2) {
42
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
41
43
  while (1) {
42
44
  switch (_context2.prev = _context2.next) {
43
45
  case 0:
44
46
  _context2.next = 2;
45
- return _regeneratorRuntime.awrap(this.Collection({
47
+ return this.Collection({
46
48
  collectionType: "accessGroups"
47
- }));
49
+ });
48
50
 
49
51
  case 2:
50
- _context2.t0 = function (address) {
52
+ addresses = _context2.sent.map(function (address) {
51
53
  return _this.utils.FormatAddress(address);
52
- };
53
-
54
- addresses = _context2.sent.map(_context2.t0);
55
- _context2.next = 6;
56
- return _regeneratorRuntime.awrap(this.utils.LimitedMap(5, addresses, function _callee(address) {
57
- var id, meta;
58
- return _regeneratorRuntime.async(function _callee$(_context) {
59
- while (1) {
60
- switch (_context.prev = _context.next) {
61
- case 0:
62
- id = _this.utils.AddressToHash(address);
63
- _context.next = 3;
64
- return _regeneratorRuntime.awrap(_this.ContentObjectMetadata({
65
- libraryId: _this.contentSpaceLibraryId,
66
- objectId: "iq__".concat(id)
67
- }));
68
-
69
- case 3:
70
- _context.t0 = _context.sent;
71
-
72
- if (_context.t0) {
73
- _context.next = 6;
74
- break;
75
- }
76
-
77
- _context.t0 = {};
78
-
79
- case 6:
80
- meta = _context.t0;
81
- return _context.abrupt("return", {
82
- address: address,
83
- id: "igrp".concat(id),
84
- meta: meta
85
- });
86
-
87
- case 8:
88
- case "end":
89
- return _context.stop();
54
+ });
55
+ _context2.next = 5;
56
+ return this.utils.LimitedMap(5, addresses, /*#__PURE__*/function () {
57
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(address) {
58
+ var id, meta;
59
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
60
+ while (1) {
61
+ switch (_context.prev = _context.next) {
62
+ case 0:
63
+ id = _this.utils.AddressToHash(address);
64
+ _context.next = 3;
65
+ return _this.ContentObjectMetadata({
66
+ libraryId: _this.contentSpaceLibraryId,
67
+ objectId: "iq__".concat(id)
68
+ });
69
+
70
+ case 3:
71
+ _context.t0 = _context.sent;
72
+
73
+ if (_context.t0) {
74
+ _context.next = 6;
75
+ break;
76
+ }
77
+
78
+ _context.t0 = {};
79
+
80
+ case 6:
81
+ meta = _context.t0;
82
+ return _context.abrupt("return", {
83
+ address: address,
84
+ id: "igrp".concat(id),
85
+ meta: meta
86
+ });
87
+
88
+ case 8:
89
+ case "end":
90
+ return _context.stop();
91
+ }
90
92
  }
91
- }
92
- });
93
- }));
93
+ }, _callee);
94
+ }));
95
+
96
+ return function (_x) {
97
+ return _ref2.apply(this, arguments);
98
+ };
99
+ }());
94
100
 
95
- case 6:
101
+ case 5:
96
102
  groups = _context2.sent;
97
103
  return _context2.abrupt("return", groups.sort(function (a, b) {
98
104
  var name1 = (a.meta["public"] || {}).name || "zz__".concat(a.address);
@@ -100,99 +106,105 @@ exports.ListAccessGroups = function _callee2() {
100
106
  return name1 < name2 ? -1 : 1;
101
107
  }));
102
108
 
103
- case 8:
109
+ case 7:
104
110
  case "end":
105
111
  return _context2.stop();
106
112
  }
107
113
  }
108
- }, null, this);
109
- };
110
-
111
- exports.SetGroupPermission = function _callee3(_ref) {
112
- var groupAddress, objectId, permission, _ref$remove, remove, groupInfo, objectInfo, event;
113
-
114
- return _regeneratorRuntime.async(function _callee3$(_context3) {
115
- while (1) {
116
- switch (_context3.prev = _context3.next) {
117
- case 0:
118
- groupAddress = _ref.groupAddress, objectId = _ref.objectId, permission = _ref.permission, _ref$remove = _ref.remove, remove = _ref$remove === void 0 ? false : _ref$remove;
119
- _context3.next = 3;
120
- return _regeneratorRuntime.awrap(this.authClient.ContractInfo({
121
- address: groupAddress
122
- }));
114
+ }, _callee2, this);
115
+ }));
116
+
117
+ exports.SetGroupPermission = /*#__PURE__*/function () {
118
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref3) {
119
+ var groupAddress, objectId, permission, _ref3$remove, remove, groupInfo, objectInfo, event;
120
+
121
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
122
+ while (1) {
123
+ switch (_context3.prev = _context3.next) {
124
+ case 0:
125
+ groupAddress = _ref3.groupAddress, objectId = _ref3.objectId, permission = _ref3.permission, _ref3$remove = _ref3.remove, remove = _ref3$remove === void 0 ? false : _ref3$remove;
126
+ _context3.next = 3;
127
+ return this.authClient.ContractInfo({
128
+ address: groupAddress
129
+ });
123
130
 
124
- case 3:
125
- groupInfo = _context3.sent;
126
- _context3.next = 6;
127
- return _regeneratorRuntime.awrap(this.authClient.ContractInfo({
128
- id: objectId
129
- }));
131
+ case 3:
132
+ groupInfo = _context3.sent;
133
+ _context3.next = 6;
134
+ return this.authClient.ContractInfo({
135
+ id: objectId
136
+ });
130
137
 
131
- case 6:
132
- objectInfo = _context3.sent;
138
+ case 6:
139
+ objectInfo = _context3.sent;
133
140
 
134
- if (!(Object.keys(groupInfo).length === 0)) {
135
- _context3.next = 9;
136
- break;
137
- }
141
+ if (!(Object.keys(groupInfo).length === 0)) {
142
+ _context3.next = 9;
143
+ break;
144
+ }
138
145
 
139
- throw Error("No information returned for group address ".concat(groupAddress));
146
+ throw Error("No information returned for group address ".concat(groupAddress));
140
147
 
141
- case 9:
142
- if (!(!objectInfo.isV3 && objectInfo.accessType === this.authClient.ACCESS_TYPES.GROUP)) {
143
- _context3.next = 17;
144
- break;
145
- }
148
+ case 9:
149
+ if (!(!objectInfo.isV3 && objectInfo.accessType === this.authClient.ACCESS_TYPES.GROUP)) {
150
+ _context3.next = 17;
151
+ break;
152
+ }
146
153
 
147
- if (!groupInfo.isV3) {
148
- _context3.next = 12;
149
- break;
150
- }
154
+ if (!groupInfo.isV3) {
155
+ _context3.next = 12;
156
+ break;
157
+ }
151
158
 
152
- throw Error("Unable to map V3 group to V2 object");
159
+ throw Error("Unable to map V3 group to V2 object");
153
160
 
154
- case 12:
155
- _context3.next = 14;
156
- return _regeneratorRuntime.awrap(this.CallContractMethodAndWait({
157
- contractAddress: groupAddress,
158
- methodName: "setAccessGroupRights",
159
- methodArgs: [this.utils.HashToAddress(objectId), permission === "manage" ? 2 : permission === "access" ? 1 : 0, permission === "none" || remove ? 0 : 2]
160
- }));
161
+ case 12:
162
+ _context3.next = 14;
163
+ return this.CallContractMethodAndWait({
164
+ contractAddress: groupAddress,
165
+ methodName: "setAccessGroupRights",
166
+ methodArgs: [this.utils.HashToAddress(objectId), permission === "manage" ? 2 : permission === "access" ? 1 : 0, permission === "none" || remove ? 0 : 2]
167
+ });
161
168
 
162
- case 14:
163
- event = _context3.sent;
164
- _context3.next = 20;
165
- break;
169
+ case 14:
170
+ event = _context3.sent;
171
+ _context3.next = 20;
172
+ break;
166
173
 
167
- case 17:
168
- _context3.next = 19;
169
- return _regeneratorRuntime.awrap(this.CallContractMethodAndWait({
170
- contractAddress: this.utils.HashToAddress(objectId),
171
- methodName: "setRights",
172
- methodArgs: [groupAddress, permission === "manage" ? 2 : permission === "access" ? 1 : 0, permission === "none" || remove ? 0 : 2]
173
- }));
174
+ case 17:
175
+ _context3.next = 19;
176
+ return this.CallContractMethodAndWait({
177
+ contractAddress: this.utils.HashToAddress(objectId),
178
+ methodName: "setRights",
179
+ methodArgs: [groupAddress, permission === "manage" ? 2 : permission === "access" ? 1 : 0, permission === "none" || remove ? 0 : 2]
180
+ });
174
181
 
175
- case 19:
176
- event = _context3.sent;
182
+ case 19:
183
+ event = _context3.sent;
177
184
 
178
- case 20:
179
- _context3.next = 22;
180
- return _regeneratorRuntime.awrap(this.ExtractEventFromLogs({
181
- abi: groupInfo.abi,
182
- event: event,
183
- eventName: "RightsChanged"
184
- }));
185
+ case 20:
186
+ _context3.next = 22;
187
+ return this.ExtractEventFromLogs({
188
+ abi: groupInfo.abi,
189
+ event: event,
190
+ eventName: "RightsChanged"
191
+ });
185
192
 
186
- case 22:
187
- return _context3.abrupt("return", _context3.sent);
193
+ case 22:
194
+ return _context3.abrupt("return", _context3.sent);
188
195
 
189
- case 23:
190
- case "end":
191
- return _context3.stop();
196
+ case 23:
197
+ case "end":
198
+ return _context3.stop();
199
+ }
192
200
  }
193
- }
194
- }, null, this);
195
- };
201
+ }, _callee3, this);
202
+ }));
203
+
204
+ return function (_x2) {
205
+ return _ref4.apply(this, arguments);
206
+ };
207
+ }();
196
208
  /**
197
209
  * Returns the address of the owner of the specified content object
198
210
  *
@@ -205,30 +217,36 @@ exports.SetGroupPermission = function _callee3(_ref) {
205
217
  */
206
218
 
207
219
 
208
- exports.AccessGroupOwner = function _callee4(_ref2) {
209
- var contractAddress;
210
- return _regeneratorRuntime.async(function _callee4$(_context4) {
211
- while (1) {
212
- switch (_context4.prev = _context4.next) {
213
- case 0:
214
- contractAddress = _ref2.contractAddress;
215
- contractAddress = ValidateAddress(contractAddress);
216
- this.Log("Retrieving owner of access group ".concat(contractAddress));
217
- _context4.next = 5;
218
- return _regeneratorRuntime.awrap(this.authClient.Owner({
219
- address: contractAddress
220
- }));
220
+ exports.AccessGroupOwner = /*#__PURE__*/function () {
221
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref5) {
222
+ var contractAddress;
223
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
224
+ while (1) {
225
+ switch (_context4.prev = _context4.next) {
226
+ case 0:
227
+ contractAddress = _ref5.contractAddress;
228
+ contractAddress = ValidateAddress(contractAddress);
229
+ this.Log("Retrieving owner of access group ".concat(contractAddress));
230
+ _context4.next = 5;
231
+ return this.authClient.Owner({
232
+ address: contractAddress
233
+ });
221
234
 
222
- case 5:
223
- return _context4.abrupt("return", _context4.sent);
235
+ case 5:
236
+ return _context4.abrupt("return", _context4.sent);
224
237
 
225
- case 6:
226
- case "end":
227
- return _context4.stop();
238
+ case 6:
239
+ case "end":
240
+ return _context4.stop();
241
+ }
228
242
  }
229
- }
230
- }, null, this);
231
- };
243
+ }, _callee4, this);
244
+ }));
245
+
246
+ return function (_x3) {
247
+ return _ref6.apply(this, arguments);
248
+ };
249
+ }();
232
250
  /**
233
251
  * Get a list of addresses of members of the specified group
234
252
  *
@@ -241,61 +259,73 @@ exports.AccessGroupOwner = function _callee4(_ref2) {
241
259
  */
242
260
 
243
261
 
244
- exports.AccessGroupMembers = function _callee6(_ref3) {
245
- var _this2 = this;
246
-
247
- var contractAddress, length;
248
- return _regeneratorRuntime.async(function _callee6$(_context6) {
249
- while (1) {
250
- switch (_context6.prev = _context6.next) {
251
- case 0:
252
- contractAddress = _ref3.contractAddress;
253
- contractAddress = ValidateAddress(contractAddress);
254
- this.Log("Retrieving members for group ".concat(contractAddress));
255
- _context6.next = 5;
256
- return _regeneratorRuntime.awrap(this.CallContractMethod({
257
- contractAddress: contractAddress,
258
- methodName: "membersNum"
259
- }));
260
-
261
- case 5:
262
- length = _context6.sent.toNumber();
263
- _context6.next = 8;
264
- return _regeneratorRuntime.awrap(Promise.all(_toConsumableArray(Array(length)).map(function _callee5(_, i) {
265
- return _regeneratorRuntime.async(function _callee5$(_context5) {
266
- while (1) {
267
- switch (_context5.prev = _context5.next) {
268
- case 0:
269
- _context5.t0 = _this2.utils;
270
- _context5.next = 3;
271
- return _regeneratorRuntime.awrap(_this2.CallContractMethod({
272
- contractAddress: contractAddress,
273
- methodName: "membersList",
274
- methodArgs: [i]
275
- }));
276
-
277
- case 3:
278
- _context5.t1 = _context5.sent;
279
- return _context5.abrupt("return", _context5.t0.FormatAddress.call(_context5.t0, _context5.t1));
280
-
281
- case 5:
282
- case "end":
283
- return _context5.stop();
284
- }
285
- }
262
+ exports.AccessGroupMembers = /*#__PURE__*/function () {
263
+ var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref7) {
264
+ var _this2 = this;
265
+
266
+ var contractAddress, length;
267
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
268
+ while (1) {
269
+ switch (_context6.prev = _context6.next) {
270
+ case 0:
271
+ contractAddress = _ref7.contractAddress;
272
+ contractAddress = ValidateAddress(contractAddress);
273
+ this.Log("Retrieving members for group ".concat(contractAddress));
274
+ _context6.next = 5;
275
+ return this.CallContractMethod({
276
+ contractAddress: contractAddress,
277
+ methodName: "membersNum"
286
278
  });
287
- })));
288
-
289
- case 8:
290
- return _context6.abrupt("return", _context6.sent);
291
279
 
292
- case 9:
293
- case "end":
294
- return _context6.stop();
280
+ case 5:
281
+ length = _context6.sent.toNumber();
282
+ _context6.next = 8;
283
+ return Promise.all(_toConsumableArray(Array(length)).map( /*#__PURE__*/function () {
284
+ var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_, i) {
285
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
286
+ while (1) {
287
+ switch (_context5.prev = _context5.next) {
288
+ case 0:
289
+ _context5.t0 = _this2.utils;
290
+ _context5.next = 3;
291
+ return _this2.CallContractMethod({
292
+ contractAddress: contractAddress,
293
+ methodName: "membersList",
294
+ methodArgs: [i]
295
+ });
296
+
297
+ case 3:
298
+ _context5.t1 = _context5.sent;
299
+ return _context5.abrupt("return", _context5.t0.FormatAddress.call(_context5.t0, _context5.t1));
300
+
301
+ case 5:
302
+ case "end":
303
+ return _context5.stop();
304
+ }
305
+ }
306
+ }, _callee5);
307
+ }));
308
+
309
+ return function (_x5, _x6) {
310
+ return _ref9.apply(this, arguments);
311
+ };
312
+ }()));
313
+
314
+ case 8:
315
+ return _context6.abrupt("return", _context6.sent);
316
+
317
+ case 9:
318
+ case "end":
319
+ return _context6.stop();
320
+ }
295
321
  }
296
- }
297
- }, null, this);
298
- };
322
+ }, _callee6, this);
323
+ }));
324
+
325
+ return function (_x4) {
326
+ return _ref8.apply(this, arguments);
327
+ };
328
+ }();
299
329
  /**
300
330
  * Get a list of addresses of managers of the specified group
301
331
  *
@@ -308,61 +338,73 @@ exports.AccessGroupMembers = function _callee6(_ref3) {
308
338
  */
309
339
 
310
340
 
311
- exports.AccessGroupManagers = function _callee8(_ref4) {
312
- var _this3 = this;
313
-
314
- var contractAddress, length;
315
- return _regeneratorRuntime.async(function _callee8$(_context8) {
316
- while (1) {
317
- switch (_context8.prev = _context8.next) {
318
- case 0:
319
- contractAddress = _ref4.contractAddress;
320
- contractAddress = ValidateAddress(contractAddress);
321
- this.Log("Retrieving managers for group ".concat(contractAddress));
322
- _context8.next = 5;
323
- return _regeneratorRuntime.awrap(this.CallContractMethod({
324
- contractAddress: contractAddress,
325
- methodName: "managersNum"
326
- }));
327
-
328
- case 5:
329
- length = _context8.sent.toNumber();
330
- _context8.next = 8;
331
- return _regeneratorRuntime.awrap(Promise.all(_toConsumableArray(Array(length)).map(function _callee7(_, i) {
332
- return _regeneratorRuntime.async(function _callee7$(_context7) {
333
- while (1) {
334
- switch (_context7.prev = _context7.next) {
335
- case 0:
336
- _context7.t0 = _this3.utils;
337
- _context7.next = 3;
338
- return _regeneratorRuntime.awrap(_this3.CallContractMethod({
339
- contractAddress: contractAddress,
340
- methodName: "managersList",
341
- methodArgs: [i]
342
- }));
343
-
344
- case 3:
345
- _context7.t1 = _context7.sent;
346
- return _context7.abrupt("return", _context7.t0.FormatAddress.call(_context7.t0, _context7.t1));
347
-
348
- case 5:
349
- case "end":
350
- return _context7.stop();
351
- }
352
- }
341
+ exports.AccessGroupManagers = /*#__PURE__*/function () {
342
+ var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref10) {
343
+ var _this3 = this;
344
+
345
+ var contractAddress, length;
346
+ return _regeneratorRuntime.wrap(function _callee8$(_context8) {
347
+ while (1) {
348
+ switch (_context8.prev = _context8.next) {
349
+ case 0:
350
+ contractAddress = _ref10.contractAddress;
351
+ contractAddress = ValidateAddress(contractAddress);
352
+ this.Log("Retrieving managers for group ".concat(contractAddress));
353
+ _context8.next = 5;
354
+ return this.CallContractMethod({
355
+ contractAddress: contractAddress,
356
+ methodName: "managersNum"
353
357
  });
354
- })));
355
358
 
356
- case 8:
357
- return _context8.abrupt("return", _context8.sent);
358
-
359
- case 9:
360
- case "end":
361
- return _context8.stop();
359
+ case 5:
360
+ length = _context8.sent.toNumber();
361
+ _context8.next = 8;
362
+ return Promise.all(_toConsumableArray(Array(length)).map( /*#__PURE__*/function () {
363
+ var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_, i) {
364
+ return _regeneratorRuntime.wrap(function _callee7$(_context7) {
365
+ while (1) {
366
+ switch (_context7.prev = _context7.next) {
367
+ case 0:
368
+ _context7.t0 = _this3.utils;
369
+ _context7.next = 3;
370
+ return _this3.CallContractMethod({
371
+ contractAddress: contractAddress,
372
+ methodName: "managersList",
373
+ methodArgs: [i]
374
+ });
375
+
376
+ case 3:
377
+ _context7.t1 = _context7.sent;
378
+ return _context7.abrupt("return", _context7.t0.FormatAddress.call(_context7.t0, _context7.t1));
379
+
380
+ case 5:
381
+ case "end":
382
+ return _context7.stop();
383
+ }
384
+ }
385
+ }, _callee7);
386
+ }));
387
+
388
+ return function (_x8, _x9) {
389
+ return _ref12.apply(this, arguments);
390
+ };
391
+ }()));
392
+
393
+ case 8:
394
+ return _context8.abrupt("return", _context8.sent);
395
+
396
+ case 9:
397
+ case "end":
398
+ return _context8.stop();
399
+ }
362
400
  }
363
- }
364
- }, null, this);
365
- };
401
+ }, _callee8, this);
402
+ }));
403
+
404
+ return function (_x7) {
405
+ return _ref11.apply(this, arguments);
406
+ };
407
+ }();
366
408
  /**
367
409
  * Create a access group
368
410
  *
@@ -379,43 +421,43 @@ exports.AccessGroupManagers = function _callee8(_ref4) {
379
421
  */
380
422
 
381
423
 
382
- exports.CreateAccessGroup = function _callee9() {
383
- var _ref5,
424
+ exports.CreateAccessGroup = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
425
+ var _ref14,
384
426
  name,
385
427
  description,
386
- _ref5$metadata,
428
+ _ref14$metadata,
387
429
  metadata,
388
- _ref6,
430
+ _yield$this$authClien,
389
431
  contractAddress,
390
432
  objectId,
391
433
  editResponse,
392
434
  _args9 = arguments;
393
435
 
394
- return _regeneratorRuntime.async(function _callee9$(_context9) {
436
+ return _regeneratorRuntime.wrap(function _callee9$(_context9) {
395
437
  while (1) {
396
438
  switch (_context9.prev = _context9.next) {
397
439
  case 0:
398
- _ref5 = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : {}, name = _ref5.name, description = _ref5.description, _ref5$metadata = _ref5.metadata, metadata = _ref5$metadata === void 0 ? {} : _ref5$metadata;
440
+ _ref14 = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : {}, name = _ref14.name, description = _ref14.description, _ref14$metadata = _ref14.metadata, metadata = _ref14$metadata === void 0 ? {} : _ref14$metadata;
399
441
  this.Log("Creating access group: ".concat(name || "", " ").concat(description || ""));
400
442
  _context9.next = 4;
401
- return _regeneratorRuntime.awrap(this.authClient.CreateAccessGroup());
443
+ return this.authClient.CreateAccessGroup();
402
444
 
403
445
  case 4:
404
- _ref6 = _context9.sent;
405
- contractAddress = _ref6.contractAddress;
446
+ _yield$this$authClien = _context9.sent;
447
+ contractAddress = _yield$this$authClien.contractAddress;
406
448
  contractAddress = this.utils.FormatAddress(contractAddress);
407
449
  objectId = this.utils.AddressToObjectId(contractAddress);
408
450
  this.Log("Access group: ".concat(contractAddress, " ").concat(objectId));
409
451
  _context9.next = 11;
410
- return _regeneratorRuntime.awrap(this.EditContentObject({
452
+ return this.EditContentObject({
411
453
  libraryId: this.contentSpaceLibraryId,
412
454
  objectId: objectId
413
- }));
455
+ });
414
456
 
415
457
  case 11:
416
458
  editResponse = _context9.sent;
417
459
  _context9.next = 14;
418
- return _regeneratorRuntime.awrap(this.ReplaceMetadata({
460
+ return this.ReplaceMetadata({
419
461
  libraryId: this.contentSpaceLibraryId,
420
462
  objectId: objectId,
421
463
  writeToken: editResponse.write_token,
@@ -427,16 +469,16 @@ exports.CreateAccessGroup = function _callee9() {
427
469
  name: name,
428
470
  description: description
429
471
  }, metadata)
430
- }));
472
+ });
431
473
 
432
474
  case 14:
433
475
  _context9.next = 16;
434
- return _regeneratorRuntime.awrap(this.FinalizeContentObject({
476
+ return this.FinalizeContentObject({
435
477
  libraryId: this.contentSpaceLibraryId,
436
478
  objectId: objectId,
437
479
  writeToken: editResponse.write_token,
438
480
  commitMessage: "Create access group"
439
- }));
481
+ });
440
482
 
441
483
  case 16:
442
484
  return _context9.abrupt("return", contractAddress);
@@ -446,8 +488,8 @@ exports.CreateAccessGroup = function _callee9() {
446
488
  return _context9.stop();
447
489
  }
448
490
  }
449
- }, null, this);
450
- };
491
+ }, _callee9, this);
492
+ }));
451
493
  /**
452
494
  * NOT YET SUPPORTED - Delete an access group
453
495
  *
@@ -459,104 +501,115 @@ exports.CreateAccessGroup = function _callee9() {
459
501
  * @param {string} contractAddress - The address of the access group contract
460
502
  */
461
503
 
462
-
463
- exports.DeleteAccessGroup = function _callee10(_ref7) {
464
- var contractAddress;
465
- return _regeneratorRuntime.async(function _callee10$(_context10) {
466
- while (1) {
467
- switch (_context10.prev = _context10.next) {
468
- case 0:
469
- contractAddress = _ref7.contractAddress;
470
- throw Error("Not supported");
471
-
472
- case 6:
473
- case "end":
474
- return _context10.stop();
504
+ exports.DeleteAccessGroup = /*#__PURE__*/function () {
505
+ var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(_ref15) {
506
+ var contractAddress;
507
+ return _regeneratorRuntime.wrap(function _callee10$(_context10) {
508
+ while (1) {
509
+ switch (_context10.prev = _context10.next) {
510
+ case 0:
511
+ contractAddress = _ref15.contractAddress;
512
+ throw Error("Not supported");
513
+
514
+ case 6:
515
+ case "end":
516
+ return _context10.stop();
517
+ }
475
518
  }
476
- }
477
- }, null, this);
478
- };
479
-
480
- exports.AccessGroupMembershipMethod = function _callee11(_ref8) {
481
- var contractAddress, memberAddress, methodName, eventName, isManager, event, abi, candidate;
482
- return _regeneratorRuntime.async(function _callee11$(_context11) {
483
- while (1) {
484
- switch (_context11.prev = _context11.next) {
485
- case 0:
486
- contractAddress = _ref8.contractAddress, memberAddress = _ref8.memberAddress, methodName = _ref8.methodName, eventName = _ref8.eventName;
487
- contractAddress = ValidateAddress(contractAddress);
488
- memberAddress = ValidateAddress(memberAddress); // Ensure caller is the member being acted upon or a manager/owner of the group
489
-
490
- if (this.utils.EqualAddress(this.signer.address, memberAddress)) {
491
- _context11.next = 9;
492
- break;
493
- }
494
-
495
- _context11.next = 6;
496
- return _regeneratorRuntime.awrap(this.CallContractMethod({
497
- contractAddress: contractAddress,
498
- methodName: "hasManagerAccess",
499
- methodArgs: [this.utils.FormatAddress(this.signer.address)]
500
- }));
501
-
502
- case 6:
503
- isManager = _context11.sent;
519
+ }, _callee10, this);
520
+ }));
521
+
522
+ return function (_x10) {
523
+ return _ref16.apply(this, arguments);
524
+ };
525
+ }();
526
+
527
+ exports.AccessGroupMembershipMethod = /*#__PURE__*/function () {
528
+ var _ref18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(_ref17) {
529
+ var contractAddress, memberAddress, methodName, eventName, isManager, event, abi, candidate;
530
+ return _regeneratorRuntime.wrap(function _callee11$(_context11) {
531
+ while (1) {
532
+ switch (_context11.prev = _context11.next) {
533
+ case 0:
534
+ contractAddress = _ref17.contractAddress, memberAddress = _ref17.memberAddress, methodName = _ref17.methodName, eventName = _ref17.eventName;
535
+ contractAddress = ValidateAddress(contractAddress);
536
+ memberAddress = ValidateAddress(memberAddress); // Ensure caller is the member being acted upon or a manager/owner of the group
537
+
538
+ if (this.utils.EqualAddress(this.signer.address, memberAddress)) {
539
+ _context11.next = 9;
540
+ break;
541
+ }
542
+
543
+ _context11.next = 6;
544
+ return this.CallContractMethod({
545
+ contractAddress: contractAddress,
546
+ methodName: "hasManagerAccess",
547
+ methodArgs: [this.utils.FormatAddress(this.signer.address)]
548
+ });
504
549
 
505
- if (isManager) {
506
- _context11.next = 9;
507
- break;
508
- }
509
-
510
- throw Error("Manager access required");
511
-
512
- case 9:
513
- this.Log("Calling ".concat(methodName, " on group ").concat(contractAddress, " for user ").concat(memberAddress));
514
- _context11.next = 12;
515
- return _regeneratorRuntime.awrap(this.CallContractMethodAndWait({
516
- contractAddress: contractAddress,
517
- methodName: methodName,
518
- methodArgs: [memberAddress],
519
- eventName: eventName,
520
- eventValue: "candidate"
521
- }));
550
+ case 6:
551
+ isManager = _context11.sent;
552
+
553
+ if (isManager) {
554
+ _context11.next = 9;
555
+ break;
556
+ }
557
+
558
+ throw Error("Manager access required");
559
+
560
+ case 9:
561
+ this.Log("Calling ".concat(methodName, " on group ").concat(contractAddress, " for user ").concat(memberAddress));
562
+ _context11.next = 12;
563
+ return this.CallContractMethodAndWait({
564
+ contractAddress: contractAddress,
565
+ methodName: methodName,
566
+ methodArgs: [memberAddress],
567
+ eventName: eventName,
568
+ eventValue: "candidate"
569
+ });
522
570
 
523
- case 12:
524
- event = _context11.sent;
525
- _context11.next = 15;
526
- return _regeneratorRuntime.awrap(this.ContractAbi({
527
- contractAddress: contractAddress
528
- }));
571
+ case 12:
572
+ event = _context11.sent;
573
+ _context11.next = 15;
574
+ return this.ContractAbi({
575
+ contractAddress: contractAddress
576
+ });
529
577
 
530
- case 15:
531
- abi = _context11.sent;
532
- candidate = this.ExtractValueFromEvent({
533
- abi: abi,
534
- event: event,
535
- eventName: eventName,
536
- eventValue: "candidate"
537
- });
578
+ case 15:
579
+ abi = _context11.sent;
580
+ candidate = this.ExtractValueFromEvent({
581
+ abi: abi,
582
+ event: event,
583
+ eventName: eventName,
584
+ eventValue: "candidate"
585
+ });
538
586
 
539
- if (!(this.utils.FormatAddress(candidate) !== this.utils.FormatAddress(memberAddress))) {
540
- _context11.next = 21;
541
- break;
542
- }
587
+ if (!(this.utils.FormatAddress(candidate) !== this.utils.FormatAddress(memberAddress))) {
588
+ _context11.next = 21;
589
+ break;
590
+ }
543
591
 
544
- // eslint-disable-next-line no-console
545
- console.error("Mismatch: " + candidate + " :: " + memberAddress); // eslint-disable-next-line no-console
592
+ // eslint-disable-next-line no-console
593
+ console.error("Mismatch: " + candidate + " :: " + memberAddress); // eslint-disable-next-line no-console
546
594
 
547
- console.error("Is target user address wallet created?");
548
- throw Error("Access group method " + methodName + " failed. Is target user address wallet created?");
595
+ console.error("Is target user address wallet created?");
596
+ throw Error("Access group method " + methodName + " failed. Is target user address wallet created?");
549
597
 
550
- case 21:
551
- return _context11.abrupt("return", event.transactionHash);
598
+ case 21:
599
+ return _context11.abrupt("return", event.transactionHash);
552
600
 
553
- case 22:
554
- case "end":
555
- return _context11.stop();
601
+ case 22:
602
+ case "end":
603
+ return _context11.stop();
604
+ }
556
605
  }
557
- }
558
- }, null, this);
559
- };
606
+ }, _callee11, this);
607
+ }));
608
+
609
+ return function (_x11) {
610
+ return _ref18.apply(this, arguments);
611
+ };
612
+ }();
560
613
  /**
561
614
  * Add a member to the access group at the specified contract address. This client's signer must
562
615
  * be a manager of the access group.
@@ -571,33 +624,39 @@ exports.AccessGroupMembershipMethod = function _callee11(_ref8) {
571
624
  */
572
625
 
573
626
 
574
- exports.AddAccessGroupMember = function _callee12(_ref9) {
575
- var contractAddress, memberAddress;
576
- return _regeneratorRuntime.async(function _callee12$(_context12) {
577
- while (1) {
578
- switch (_context12.prev = _context12.next) {
579
- case 0:
580
- contractAddress = _ref9.contractAddress, memberAddress = _ref9.memberAddress;
581
- contractAddress = ValidateAddress(contractAddress);
582
- memberAddress = ValidateAddress(memberAddress);
583
- _context12.next = 5;
584
- return _regeneratorRuntime.awrap(this.AccessGroupMembershipMethod({
585
- contractAddress: contractAddress,
586
- memberAddress: memberAddress,
587
- methodName: "grantAccess",
588
- eventName: "MemberAdded"
589
- }));
627
+ exports.AddAccessGroupMember = /*#__PURE__*/function () {
628
+ var _ref20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(_ref19) {
629
+ var contractAddress, memberAddress;
630
+ return _regeneratorRuntime.wrap(function _callee12$(_context12) {
631
+ while (1) {
632
+ switch (_context12.prev = _context12.next) {
633
+ case 0:
634
+ contractAddress = _ref19.contractAddress, memberAddress = _ref19.memberAddress;
635
+ contractAddress = ValidateAddress(contractAddress);
636
+ memberAddress = ValidateAddress(memberAddress);
637
+ _context12.next = 5;
638
+ return this.AccessGroupMembershipMethod({
639
+ contractAddress: contractAddress,
640
+ memberAddress: memberAddress,
641
+ methodName: "grantAccess",
642
+ eventName: "MemberAdded"
643
+ });
590
644
 
591
- case 5:
592
- return _context12.abrupt("return", _context12.sent);
645
+ case 5:
646
+ return _context12.abrupt("return", _context12.sent);
593
647
 
594
- case 6:
595
- case "end":
596
- return _context12.stop();
648
+ case 6:
649
+ case "end":
650
+ return _context12.stop();
651
+ }
597
652
  }
598
- }
599
- }, null, this);
600
- };
653
+ }, _callee12, this);
654
+ }));
655
+
656
+ return function (_x12) {
657
+ return _ref20.apply(this, arguments);
658
+ };
659
+ }();
601
660
  /**
602
661
  * Remove a member from the access group at the specified contract address. This client's signer must
603
662
  * be a manager of the access group.
@@ -612,33 +671,39 @@ exports.AddAccessGroupMember = function _callee12(_ref9) {
612
671
  */
613
672
 
614
673
 
615
- exports.RemoveAccessGroupMember = function _callee13(_ref10) {
616
- var contractAddress, memberAddress;
617
- return _regeneratorRuntime.async(function _callee13$(_context13) {
618
- while (1) {
619
- switch (_context13.prev = _context13.next) {
620
- case 0:
621
- contractAddress = _ref10.contractAddress, memberAddress = _ref10.memberAddress;
622
- contractAddress = ValidateAddress(contractAddress);
623
- memberAddress = ValidateAddress(memberAddress);
624
- _context13.next = 5;
625
- return _regeneratorRuntime.awrap(this.AccessGroupMembershipMethod({
626
- contractAddress: contractAddress,
627
- memberAddress: memberAddress,
628
- methodName: "revokeAccess",
629
- eventName: "MemberRevoked"
630
- }));
674
+ exports.RemoveAccessGroupMember = /*#__PURE__*/function () {
675
+ var _ref22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(_ref21) {
676
+ var contractAddress, memberAddress;
677
+ return _regeneratorRuntime.wrap(function _callee13$(_context13) {
678
+ while (1) {
679
+ switch (_context13.prev = _context13.next) {
680
+ case 0:
681
+ contractAddress = _ref21.contractAddress, memberAddress = _ref21.memberAddress;
682
+ contractAddress = ValidateAddress(contractAddress);
683
+ memberAddress = ValidateAddress(memberAddress);
684
+ _context13.next = 5;
685
+ return this.AccessGroupMembershipMethod({
686
+ contractAddress: contractAddress,
687
+ memberAddress: memberAddress,
688
+ methodName: "revokeAccess",
689
+ eventName: "MemberRevoked"
690
+ });
631
691
 
632
- case 5:
633
- return _context13.abrupt("return", _context13.sent);
692
+ case 5:
693
+ return _context13.abrupt("return", _context13.sent);
634
694
 
635
- case 6:
636
- case "end":
637
- return _context13.stop();
695
+ case 6:
696
+ case "end":
697
+ return _context13.stop();
698
+ }
638
699
  }
639
- }
640
- }, null, this);
641
- };
700
+ }, _callee13, this);
701
+ }));
702
+
703
+ return function (_x13) {
704
+ return _ref22.apply(this, arguments);
705
+ };
706
+ }();
642
707
  /**
643
708
  * Add a manager to the access group at the specified contract address. This client's signer must
644
709
  * be a manager of the access group.
@@ -653,33 +718,39 @@ exports.RemoveAccessGroupMember = function _callee13(_ref10) {
653
718
  */
654
719
 
655
720
 
656
- exports.AddAccessGroupManager = function _callee14(_ref11) {
657
- var contractAddress, memberAddress;
658
- return _regeneratorRuntime.async(function _callee14$(_context14) {
659
- while (1) {
660
- switch (_context14.prev = _context14.next) {
661
- case 0:
662
- contractAddress = _ref11.contractAddress, memberAddress = _ref11.memberAddress;
663
- contractAddress = ValidateAddress(contractAddress);
664
- memberAddress = ValidateAddress(memberAddress);
665
- _context14.next = 5;
666
- return _regeneratorRuntime.awrap(this.AccessGroupMembershipMethod({
667
- contractAddress: contractAddress,
668
- memberAddress: memberAddress,
669
- methodName: "grantManagerAccess",
670
- eventName: "ManagerAccessGranted"
671
- }));
721
+ exports.AddAccessGroupManager = /*#__PURE__*/function () {
722
+ var _ref24 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(_ref23) {
723
+ var contractAddress, memberAddress;
724
+ return _regeneratorRuntime.wrap(function _callee14$(_context14) {
725
+ while (1) {
726
+ switch (_context14.prev = _context14.next) {
727
+ case 0:
728
+ contractAddress = _ref23.contractAddress, memberAddress = _ref23.memberAddress;
729
+ contractAddress = ValidateAddress(contractAddress);
730
+ memberAddress = ValidateAddress(memberAddress);
731
+ _context14.next = 5;
732
+ return this.AccessGroupMembershipMethod({
733
+ contractAddress: contractAddress,
734
+ memberAddress: memberAddress,
735
+ methodName: "grantManagerAccess",
736
+ eventName: "ManagerAccessGranted"
737
+ });
672
738
 
673
- case 5:
674
- return _context14.abrupt("return", _context14.sent);
739
+ case 5:
740
+ return _context14.abrupt("return", _context14.sent);
675
741
 
676
- case 6:
677
- case "end":
678
- return _context14.stop();
742
+ case 6:
743
+ case "end":
744
+ return _context14.stop();
745
+ }
679
746
  }
680
- }
681
- }, null, this);
682
- };
747
+ }, _callee14, this);
748
+ }));
749
+
750
+ return function (_x14) {
751
+ return _ref24.apply(this, arguments);
752
+ };
753
+ }();
683
754
  /**
684
755
  * Remove a manager from the access group at the specified contract address. This client's signer must
685
756
  * be a manager of the access group.
@@ -694,33 +765,39 @@ exports.AddAccessGroupManager = function _callee14(_ref11) {
694
765
  */
695
766
 
696
767
 
697
- exports.RemoveAccessGroupManager = function _callee15(_ref12) {
698
- var contractAddress, memberAddress;
699
- return _regeneratorRuntime.async(function _callee15$(_context15) {
700
- while (1) {
701
- switch (_context15.prev = _context15.next) {
702
- case 0:
703
- contractAddress = _ref12.contractAddress, memberAddress = _ref12.memberAddress;
704
- contractAddress = ValidateAddress(contractAddress);
705
- memberAddress = ValidateAddress(memberAddress);
706
- _context15.next = 5;
707
- return _regeneratorRuntime.awrap(this.AccessGroupMembershipMethod({
708
- contractAddress: contractAddress,
709
- memberAddress: memberAddress,
710
- methodName: "revokeManagerAccess",
711
- eventName: "ManagerAccessRevoked"
712
- }));
768
+ exports.RemoveAccessGroupManager = /*#__PURE__*/function () {
769
+ var _ref26 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(_ref25) {
770
+ var contractAddress, memberAddress;
771
+ return _regeneratorRuntime.wrap(function _callee15$(_context15) {
772
+ while (1) {
773
+ switch (_context15.prev = _context15.next) {
774
+ case 0:
775
+ contractAddress = _ref25.contractAddress, memberAddress = _ref25.memberAddress;
776
+ contractAddress = ValidateAddress(contractAddress);
777
+ memberAddress = ValidateAddress(memberAddress);
778
+ _context15.next = 5;
779
+ return this.AccessGroupMembershipMethod({
780
+ contractAddress: contractAddress,
781
+ memberAddress: memberAddress,
782
+ methodName: "revokeManagerAccess",
783
+ eventName: "ManagerAccessRevoked"
784
+ });
713
785
 
714
- case 5:
715
- return _context15.abrupt("return", _context15.sent);
786
+ case 5:
787
+ return _context15.abrupt("return", _context15.sent);
716
788
 
717
- case 6:
718
- case "end":
719
- return _context15.stop();
789
+ case 6:
790
+ case "end":
791
+ return _context15.stop();
792
+ }
720
793
  }
721
- }
722
- }, null, this);
723
- };
794
+ }, _callee15, this);
795
+ }));
796
+
797
+ return function (_x15) {
798
+ return _ref26.apply(this, arguments);
799
+ };
800
+ }();
724
801
  /**
725
802
  * List all of the groups with permissions on the specified library.
726
803
  *
@@ -735,108 +812,126 @@ exports.RemoveAccessGroupManager = function _callee15(_ref12) {
735
812
  */
736
813
 
737
814
 
738
- exports.ContentLibraryGroupPermissions = function _callee18(_ref13) {
739
- var _this4 = this;
815
+ exports.ContentLibraryGroupPermissions = /*#__PURE__*/function () {
816
+ var _ref28 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(_ref27) {
817
+ var _this4 = this;
740
818
 
741
- var libraryId, _ref13$permissions, permissions, libraryPermissions;
819
+ var libraryId, _ref27$permissions, permissions, libraryPermissions;
742
820
 
743
- return _regeneratorRuntime.async(function _callee18$(_context18) {
744
- while (1) {
745
- switch (_context18.prev = _context18.next) {
746
- case 0:
747
- libraryId = _ref13.libraryId, _ref13$permissions = _ref13.permissions, permissions = _ref13$permissions === void 0 ? [] : _ref13$permissions;
748
- ValidateLibrary(libraryId);
749
- libraryPermissions = {};
750
-
751
- if (!permissions || permissions.length === 0) {
752
- permissions = ["accessor", "contributor", "reviewer"];
753
- } else {
754
- // Format and validate specified permissions
755
- permissions = permissions.map(function (permission) {
756
- permission = permission.toLowerCase();
757
-
758
- if (!["accessor", "contributor", "reviewer"].includes(permission)) {
759
- throw Error("Invalid permission: ".concat(permission));
760
- }
761
-
762
- return permission;
763
- });
764
- }
765
-
766
- this.Log("Retrieving ".concat(permissions.join(", "), " group(s) for library ").concat(libraryId));
767
- _context18.next = 7;
768
- return _regeneratorRuntime.awrap(Promise.all(permissions.map(function _callee17(type) {
769
- var numGroups, accessGroupAddresses;
770
- return _regeneratorRuntime.async(function _callee17$(_context17) {
771
- while (1) {
772
- switch (_context17.prev = _context17.next) {
773
- case 0:
774
- _context17.next = 2;
775
- return _regeneratorRuntime.awrap(_this4.CallContractMethod({
776
- contractAddress: _this4.utils.HashToAddress(libraryId),
777
- methodName: type + "GroupsLength"
778
- }));
779
-
780
- case 2:
781
- numGroups = _context17.sent;
782
- numGroups = parseInt(numGroups._hex, 16);
783
- _context17.next = 6;
784
- return _regeneratorRuntime.awrap(_this4.utils.LimitedMap(3, _toConsumableArray(Array(numGroups).keys()), function _callee16(i) {
785
- return _regeneratorRuntime.async(function _callee16$(_context16) {
786
- while (1) {
787
- switch (_context16.prev = _context16.next) {
788
- case 0:
789
- _context16.prev = 0;
790
- _context16.t0 = _this4.utils;
791
- _context16.next = 4;
792
- return _regeneratorRuntime.awrap(_this4.CallContractMethod({
793
- contractAddress: _this4.utils.HashToAddress(libraryId),
794
- methodName: type + "Groups",
795
- methodArgs: [i]
796
- }));
797
-
798
- case 4:
799
- _context16.t1 = _context16.sent;
800
- return _context16.abrupt("return", _context16.t0.FormatAddress.call(_context16.t0, _context16.t1));
801
-
802
- case 8:
803
- _context16.prev = 8;
804
- _context16.t2 = _context16["catch"](0);
805
- // eslint-disable-next-line no-console
806
- console.error(_context16.t2);
807
-
808
- case 11:
809
- case "end":
810
- return _context16.stop();
811
- }
812
- }
813
- }, null, null, [[0, 8]]);
814
- }));
815
-
816
- case 6:
817
- accessGroupAddresses = _context17.sent;
818
- accessGroupAddresses.forEach(function (address) {
819
- return libraryPermissions[address] = [].concat(_toConsumableArray(libraryPermissions[address] || []), [type]).sort();
820
- });
821
-
822
- case 8:
823
- case "end":
824
- return _context17.stop();
825
- }
826
- }
827
- });
828
- })));
821
+ return _regeneratorRuntime.wrap(function _callee18$(_context18) {
822
+ while (1) {
823
+ switch (_context18.prev = _context18.next) {
824
+ case 0:
825
+ libraryId = _ref27.libraryId, _ref27$permissions = _ref27.permissions, permissions = _ref27$permissions === void 0 ? [] : _ref27$permissions;
826
+ ValidateLibrary(libraryId);
827
+ libraryPermissions = {};
829
828
 
830
- case 7:
831
- return _context18.abrupt("return", libraryPermissions);
829
+ if (!permissions || permissions.length === 0) {
830
+ permissions = ["accessor", "contributor", "reviewer"];
831
+ } else {
832
+ // Format and validate specified permissions
833
+ permissions = permissions.map(function (permission) {
834
+ permission = permission.toLowerCase();
832
835
 
833
- case 8:
834
- case "end":
835
- return _context18.stop();
836
+ if (!["accessor", "contributor", "reviewer"].includes(permission)) {
837
+ throw Error("Invalid permission: ".concat(permission));
838
+ }
839
+
840
+ return permission;
841
+ });
842
+ }
843
+
844
+ this.Log("Retrieving ".concat(permissions.join(", "), " group(s) for library ").concat(libraryId));
845
+ _context18.next = 7;
846
+ return Promise.all(permissions.map( /*#__PURE__*/function () {
847
+ var _ref29 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17(type) {
848
+ var numGroups, accessGroupAddresses;
849
+ return _regeneratorRuntime.wrap(function _callee17$(_context17) {
850
+ while (1) {
851
+ switch (_context17.prev = _context17.next) {
852
+ case 0:
853
+ _context17.next = 2;
854
+ return _this4.CallContractMethod({
855
+ contractAddress: _this4.utils.HashToAddress(libraryId),
856
+ methodName: type + "GroupsLength"
857
+ });
858
+
859
+ case 2:
860
+ numGroups = _context17.sent;
861
+ numGroups = parseInt(numGroups._hex, 16);
862
+ _context17.next = 6;
863
+ return _this4.utils.LimitedMap(3, _toConsumableArray(Array(numGroups).keys()), /*#__PURE__*/function () {
864
+ var _ref30 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(i) {
865
+ return _regeneratorRuntime.wrap(function _callee16$(_context16) {
866
+ while (1) {
867
+ switch (_context16.prev = _context16.next) {
868
+ case 0:
869
+ _context16.prev = 0;
870
+ _context16.t0 = _this4.utils;
871
+ _context16.next = 4;
872
+ return _this4.CallContractMethod({
873
+ contractAddress: _this4.utils.HashToAddress(libraryId),
874
+ methodName: type + "Groups",
875
+ methodArgs: [i]
876
+ });
877
+
878
+ case 4:
879
+ _context16.t1 = _context16.sent;
880
+ return _context16.abrupt("return", _context16.t0.FormatAddress.call(_context16.t0, _context16.t1));
881
+
882
+ case 8:
883
+ _context16.prev = 8;
884
+ _context16.t2 = _context16["catch"](0);
885
+ // eslint-disable-next-line no-console
886
+ console.error(_context16.t2);
887
+
888
+ case 11:
889
+ case "end":
890
+ return _context16.stop();
891
+ }
892
+ }
893
+ }, _callee16, null, [[0, 8]]);
894
+ }));
895
+
896
+ return function (_x18) {
897
+ return _ref30.apply(this, arguments);
898
+ };
899
+ }());
900
+
901
+ case 6:
902
+ accessGroupAddresses = _context17.sent;
903
+ accessGroupAddresses.forEach(function (address) {
904
+ return libraryPermissions[address] = [].concat(_toConsumableArray(libraryPermissions[address] || []), [type]).sort();
905
+ });
906
+
907
+ case 8:
908
+ case "end":
909
+ return _context17.stop();
910
+ }
911
+ }
912
+ }, _callee17);
913
+ }));
914
+
915
+ return function (_x17) {
916
+ return _ref29.apply(this, arguments);
917
+ };
918
+ }()));
919
+
920
+ case 7:
921
+ return _context18.abrupt("return", libraryPermissions);
922
+
923
+ case 8:
924
+ case "end":
925
+ return _context18.stop();
926
+ }
836
927
  }
837
- }
838
- }, null, this);
839
- };
928
+ }, _callee18, this);
929
+ }));
930
+
931
+ return function (_x16) {
932
+ return _ref28.apply(this, arguments);
933
+ };
934
+ }();
840
935
  /**
841
936
  * Add accessor, contributor or reviewer permissions for the specified group on the specified library
842
937
  *
@@ -849,74 +944,80 @@ exports.ContentLibraryGroupPermissions = function _callee18(_ref13) {
849
944
  */
850
945
 
851
946
 
852
- exports.AddContentLibraryGroup = function _callee19(_ref14) {
853
- var libraryId, groupAddress, permission, existingPermissions, event, abi;
854
- return _regeneratorRuntime.async(function _callee19$(_context19) {
855
- while (1) {
856
- switch (_context19.prev = _context19.next) {
857
- case 0:
858
- libraryId = _ref14.libraryId, groupAddress = _ref14.groupAddress, permission = _ref14.permission;
859
- ValidateLibrary(libraryId);
860
- groupAddress = ValidateAddress(groupAddress);
861
-
862
- if (["accessor", "contributor", "reviewer"].includes(permission.toLowerCase())) {
863
- _context19.next = 5;
864
- break;
865
- }
866
-
867
- throw Error("Invalid group type: ".concat(permission));
868
-
869
- case 5:
870
- this.Log("Adding ".concat(permission, " group ").concat(groupAddress, " to library ").concat(libraryId));
871
- _context19.next = 8;
872
- return _regeneratorRuntime.awrap(this.ContentLibraryGroupPermissions({
873
- libraryId: libraryId,
874
- permissions: [permission]
875
- }));
947
+ exports.AddContentLibraryGroup = /*#__PURE__*/function () {
948
+ var _ref32 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19(_ref31) {
949
+ var libraryId, groupAddress, permission, existingPermissions, event, abi;
950
+ return _regeneratorRuntime.wrap(function _callee19$(_context19) {
951
+ while (1) {
952
+ switch (_context19.prev = _context19.next) {
953
+ case 0:
954
+ libraryId = _ref31.libraryId, groupAddress = _ref31.groupAddress, permission = _ref31.permission;
955
+ ValidateLibrary(libraryId);
956
+ groupAddress = ValidateAddress(groupAddress);
957
+
958
+ if (["accessor", "contributor", "reviewer"].includes(permission.toLowerCase())) {
959
+ _context19.next = 5;
960
+ break;
961
+ }
962
+
963
+ throw Error("Invalid group type: ".concat(permission));
964
+
965
+ case 5:
966
+ this.Log("Adding ".concat(permission, " group ").concat(groupAddress, " to library ").concat(libraryId));
967
+ _context19.next = 8;
968
+ return this.ContentLibraryGroupPermissions({
969
+ libraryId: libraryId,
970
+ permissions: [permission]
971
+ });
876
972
 
877
- case 8:
878
- existingPermissions = _context19.sent;
973
+ case 8:
974
+ existingPermissions = _context19.sent;
879
975
 
880
- if (!existingPermissions[groupAddress]) {
881
- _context19.next = 11;
882
- break;
883
- }
976
+ if (!existingPermissions[groupAddress]) {
977
+ _context19.next = 11;
978
+ break;
979
+ }
884
980
 
885
- return _context19.abrupt("return");
981
+ return _context19.abrupt("return");
886
982
 
887
- case 11:
888
- // Capitalize permission to match method and event names
889
- permission = permission.charAt(0).toUpperCase() + permission.substr(1).toLowerCase();
890
- _context19.next = 14;
891
- return _regeneratorRuntime.awrap(this.CallContractMethodAndWait({
892
- contractAddress: this.utils.HashToAddress(libraryId),
893
- methodName: "add".concat(permission, "Group"),
894
- methodArgs: [groupAddress]
895
- }));
983
+ case 11:
984
+ // Capitalize permission to match method and event names
985
+ permission = permission.charAt(0).toUpperCase() + permission.substr(1).toLowerCase();
986
+ _context19.next = 14;
987
+ return this.CallContractMethodAndWait({
988
+ contractAddress: this.utils.HashToAddress(libraryId),
989
+ methodName: "add".concat(permission, "Group"),
990
+ methodArgs: [groupAddress]
991
+ });
896
992
 
897
- case 14:
898
- event = _context19.sent;
899
- _context19.next = 17;
900
- return _regeneratorRuntime.awrap(this.ContractAbi({
901
- id: libraryId
902
- }));
993
+ case 14:
994
+ event = _context19.sent;
995
+ _context19.next = 17;
996
+ return this.ContractAbi({
997
+ id: libraryId
998
+ });
903
999
 
904
- case 17:
905
- abi = _context19.sent;
906
- _context19.next = 20;
907
- return _regeneratorRuntime.awrap(this.ExtractEventFromLogs({
908
- abi: abi,
909
- event: event,
910
- eventName: "".concat(permission, "GroupAdded")
911
- }));
1000
+ case 17:
1001
+ abi = _context19.sent;
1002
+ _context19.next = 20;
1003
+ return this.ExtractEventFromLogs({
1004
+ abi: abi,
1005
+ event: event,
1006
+ eventName: "".concat(permission, "GroupAdded")
1007
+ });
912
1008
 
913
- case 20:
914
- case "end":
915
- return _context19.stop();
1009
+ case 20:
1010
+ case "end":
1011
+ return _context19.stop();
1012
+ }
916
1013
  }
917
- }
918
- }, null, this);
919
- };
1014
+ }, _callee19, this);
1015
+ }));
1016
+
1017
+ return function (_x19) {
1018
+ return _ref32.apply(this, arguments);
1019
+ };
1020
+ }();
920
1021
  /**
921
1022
  * Remove accessor, contributor or reviewer permissions for the specified group on the specified library
922
1023
  *
@@ -929,74 +1030,80 @@ exports.AddContentLibraryGroup = function _callee19(_ref14) {
929
1030
  */
930
1031
 
931
1032
 
932
- exports.RemoveContentLibraryGroup = function _callee20(_ref15) {
933
- var libraryId, groupAddress, permission, existingPermissions, event, abi;
934
- return _regeneratorRuntime.async(function _callee20$(_context20) {
935
- while (1) {
936
- switch (_context20.prev = _context20.next) {
937
- case 0:
938
- libraryId = _ref15.libraryId, groupAddress = _ref15.groupAddress, permission = _ref15.permission;
939
- ValidateLibrary(libraryId);
940
- groupAddress = ValidateAddress(groupAddress);
941
-
942
- if (["accessor", "contributor", "reviewer"].includes(permission.toLowerCase())) {
943
- _context20.next = 5;
944
- break;
945
- }
946
-
947
- throw Error("Invalid group type: ".concat(permission));
1033
+ exports.RemoveContentLibraryGroup = /*#__PURE__*/function () {
1034
+ var _ref34 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20(_ref33) {
1035
+ var libraryId, groupAddress, permission, existingPermissions, event, abi;
1036
+ return _regeneratorRuntime.wrap(function _callee20$(_context20) {
1037
+ while (1) {
1038
+ switch (_context20.prev = _context20.next) {
1039
+ case 0:
1040
+ libraryId = _ref33.libraryId, groupAddress = _ref33.groupAddress, permission = _ref33.permission;
1041
+ ValidateLibrary(libraryId);
1042
+ groupAddress = ValidateAddress(groupAddress);
1043
+
1044
+ if (["accessor", "contributor", "reviewer"].includes(permission.toLowerCase())) {
1045
+ _context20.next = 5;
1046
+ break;
1047
+ }
1048
+
1049
+ throw Error("Invalid group type: ".concat(permission));
1050
+
1051
+ case 5:
1052
+ this.Log("Removing ".concat(permission, " group ").concat(groupAddress, " from library ").concat(libraryId));
1053
+ _context20.next = 8;
1054
+ return this.ContentLibraryGroupPermissions({
1055
+ libraryId: libraryId,
1056
+ permissions: [permission]
1057
+ });
948
1058
 
949
- case 5:
950
- this.Log("Removing ".concat(permission, " group ").concat(groupAddress, " from library ").concat(libraryId));
951
- _context20.next = 8;
952
- return _regeneratorRuntime.awrap(this.ContentLibraryGroupPermissions({
953
- libraryId: libraryId,
954
- permissions: [permission]
955
- }));
1059
+ case 8:
1060
+ existingPermissions = _context20.sent;
956
1061
 
957
- case 8:
958
- existingPermissions = _context20.sent;
1062
+ if (existingPermissions[groupAddress]) {
1063
+ _context20.next = 11;
1064
+ break;
1065
+ }
959
1066
 
960
- if (existingPermissions[groupAddress]) {
961
- _context20.next = 11;
962
- break;
963
- }
1067
+ return _context20.abrupt("return");
964
1068
 
965
- return _context20.abrupt("return");
966
-
967
- case 11:
968
- // Capitalize permission to match method and event names
969
- permission = permission.charAt(0).toUpperCase() + permission.substr(1).toLowerCase();
970
- _context20.next = 14;
971
- return _regeneratorRuntime.awrap(this.CallContractMethodAndWait({
972
- contractAddress: this.utils.HashToAddress(libraryId),
973
- methodName: "remove".concat(permission, "Group"),
974
- methodArgs: [groupAddress]
975
- }));
1069
+ case 11:
1070
+ // Capitalize permission to match method and event names
1071
+ permission = permission.charAt(0).toUpperCase() + permission.substr(1).toLowerCase();
1072
+ _context20.next = 14;
1073
+ return this.CallContractMethodAndWait({
1074
+ contractAddress: this.utils.HashToAddress(libraryId),
1075
+ methodName: "remove".concat(permission, "Group"),
1076
+ methodArgs: [groupAddress]
1077
+ });
976
1078
 
977
- case 14:
978
- event = _context20.sent;
979
- _context20.next = 17;
980
- return _regeneratorRuntime.awrap(this.ContractAbi({
981
- id: libraryId
982
- }));
1079
+ case 14:
1080
+ event = _context20.sent;
1081
+ _context20.next = 17;
1082
+ return this.ContractAbi({
1083
+ id: libraryId
1084
+ });
983
1085
 
984
- case 17:
985
- abi = _context20.sent;
986
- _context20.next = 20;
987
- return _regeneratorRuntime.awrap(this.ExtractEventFromLogs({
988
- abi: abi,
989
- event: event,
990
- eventName: "".concat(permission, "GroupRemoved")
991
- }));
1086
+ case 17:
1087
+ abi = _context20.sent;
1088
+ _context20.next = 20;
1089
+ return this.ExtractEventFromLogs({
1090
+ abi: abi,
1091
+ event: event,
1092
+ eventName: "".concat(permission, "GroupRemoved")
1093
+ });
992
1094
 
993
- case 20:
994
- case "end":
995
- return _context20.stop();
1095
+ case 20:
1096
+ case "end":
1097
+ return _context20.stop();
1098
+ }
996
1099
  }
997
- }
998
- }, null, this);
999
- };
1100
+ }, _callee20, this);
1101
+ }));
1102
+
1103
+ return function (_x20) {
1104
+ return _ref34.apply(this, arguments);
1105
+ };
1106
+ }();
1000
1107
  /**
1001
1108
  * List all of the groups with permissions on the specified object or content type
1002
1109
  *
@@ -1010,125 +1117,137 @@ exports.RemoveContentLibraryGroup = function _callee20(_ref15) {
1010
1117
  */
1011
1118
 
1012
1119
 
1013
- exports.ContentObjectGroupPermissions = function _callee22(_ref16) {
1014
- var _this5 = this;
1015
-
1016
- var objectId, contractAddress, groupAddresses, rightsMethod, groupPermissions;
1017
- return _regeneratorRuntime.async(function _callee22$(_context22) {
1018
- while (1) {
1019
- switch (_context22.prev = _context22.next) {
1020
- case 0:
1021
- objectId = _ref16.objectId;
1022
- ValidateObject(objectId);
1023
- this.Log("Retrieving group permissions for object ".concat(objectId));
1024
- contractAddress = this.utils.HashToAddress(objectId); // Access indexor only available on access groups, so must ask each access group
1025
- // we belong to about this object
1026
-
1027
- _context22.next = 6;
1028
- return _regeneratorRuntime.awrap(this.Collection({
1029
- collectionType: "accessGroups"
1030
- }));
1031
-
1032
- case 6:
1033
- groupAddresses = _context22.sent;
1034
- _context22.next = 9;
1035
- return _regeneratorRuntime.awrap(this.AccessType({
1036
- id: objectId
1037
- }));
1038
-
1039
- case 9:
1040
- _context22.t0 = _context22.sent;
1041
- _context22.next = _context22.t0 === this.authClient.ACCESS_TYPES.OBJECT ? 12 : _context22.t0 === this.authClient.ACCESS_TYPES.TYPE ? 14 : _context22.t0 === this.authClient.ACCESS_TYPES.GROUP ? 16 : _context22.t0 === this.authClient.ACCESS_TYPES.LIBRARY ? 18 : 19;
1042
- break;
1043
-
1044
- case 12:
1045
- rightsMethod = "getContentObjectRights";
1046
- return _context22.abrupt("break", 19);
1047
-
1048
- case 14:
1049
- rightsMethod = "getContentTypeRights";
1050
- return _context22.abrupt("break", 19);
1120
+ exports.ContentObjectGroupPermissions = /*#__PURE__*/function () {
1121
+ var _ref36 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee22(_ref35) {
1122
+ var _this5 = this;
1123
+
1124
+ var objectId, contractAddress, groupAddresses, rightsMethod, groupPermissions;
1125
+ return _regeneratorRuntime.wrap(function _callee22$(_context22) {
1126
+ while (1) {
1127
+ switch (_context22.prev = _context22.next) {
1128
+ case 0:
1129
+ objectId = _ref35.objectId;
1130
+ ValidateObject(objectId);
1131
+ this.Log("Retrieving group permissions for object ".concat(objectId));
1132
+ contractAddress = this.utils.HashToAddress(objectId); // Access indexor only available on access groups, so must ask each access group
1133
+ // we belong to about this object
1134
+
1135
+ _context22.next = 6;
1136
+ return this.Collection({
1137
+ collectionType: "accessGroups"
1138
+ });
1051
1139
 
1052
- case 16:
1053
- rightsMethod = "getAccessGroupRights";
1054
- return _context22.abrupt("break", 19);
1055
-
1056
- case 18:
1057
- rightsMethod = "getLibraryRights";
1058
-
1059
- case 19:
1060
- groupPermissions = {};
1061
- _context22.next = 22;
1062
- return _regeneratorRuntime.awrap(Promise.all(groupAddresses.map(function _callee21(groupAddress) {
1063
- var permission, permissions;
1064
- return _regeneratorRuntime.async(function _callee21$(_context21) {
1065
- while (1) {
1066
- switch (_context21.prev = _context21.next) {
1067
- case 0:
1068
- _context21.prev = 0;
1069
- groupAddress = _this5.utils.FormatAddress(groupAddress);
1070
- _context21.next = 4;
1071
- return _regeneratorRuntime.awrap(_this5.CallContractMethod({
1072
- contractAddress: groupAddress,
1073
- methodName: rightsMethod,
1074
- methodArgs: [contractAddress]
1075
- }));
1076
-
1077
- case 4:
1078
- permission = _context21.sent;
1079
-
1080
- if (!(permission === 0)) {
1081
- _context21.next = 7;
1082
- break;
1083
- }
1140
+ case 6:
1141
+ groupAddresses = _context22.sent;
1142
+ _context22.next = 9;
1143
+ return this.AccessType({
1144
+ id: objectId
1145
+ });
1084
1146
 
1085
- return _context21.abrupt("return");
1147
+ case 9:
1148
+ _context22.t0 = _context22.sent;
1149
+ _context22.next = _context22.t0 === this.authClient.ACCESS_TYPES.OBJECT ? 12 : _context22.t0 === this.authClient.ACCESS_TYPES.TYPE ? 14 : _context22.t0 === this.authClient.ACCESS_TYPES.GROUP ? 16 : _context22.t0 === this.authClient.ACCESS_TYPES.LIBRARY ? 18 : 19;
1150
+ break;
1086
1151
 
1087
- case 7:
1088
- permissions = [];
1152
+ case 12:
1153
+ rightsMethod = "getContentObjectRights";
1154
+ return _context22.abrupt("break", 19);
1155
+
1156
+ case 14:
1157
+ rightsMethod = "getContentTypeRights";
1158
+ return _context22.abrupt("break", 19);
1159
+
1160
+ case 16:
1161
+ rightsMethod = "getAccessGroupRights";
1162
+ return _context22.abrupt("break", 19);
1163
+
1164
+ case 18:
1165
+ rightsMethod = "getLibraryRights";
1166
+
1167
+ case 19:
1168
+ groupPermissions = {};
1169
+ _context22.next = 22;
1170
+ return Promise.all(groupAddresses.map( /*#__PURE__*/function () {
1171
+ var _ref37 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(groupAddress) {
1172
+ var permission, permissions;
1173
+ return _regeneratorRuntime.wrap(function _callee21$(_context21) {
1174
+ while (1) {
1175
+ switch (_context21.prev = _context21.next) {
1176
+ case 0:
1177
+ _context21.prev = 0;
1178
+ groupAddress = _this5.utils.FormatAddress(groupAddress);
1179
+ _context21.next = 4;
1180
+ return _this5.CallContractMethod({
1181
+ contractAddress: groupAddress,
1182
+ methodName: rightsMethod,
1183
+ methodArgs: [contractAddress]
1184
+ });
1185
+
1186
+ case 4:
1187
+ permission = _context21.sent;
1188
+
1189
+ if (!(permission === 0)) {
1190
+ _context21.next = 7;
1191
+ break;
1192
+ }
1089
1193
 
1090
- if (permission >= 100) {
1091
- permissions.push("manage");
1092
- }
1194
+ return _context21.abrupt("return");
1093
1195
 
1094
- if (permission % 100 >= 10) {
1095
- permissions.push("access");
1096
- }
1196
+ case 7:
1197
+ permissions = [];
1097
1198
 
1098
- if (permission % 10 > 0) {
1099
- permissions.push("see");
1100
- }
1199
+ if (permission >= 100) {
1200
+ permissions.push("manage");
1201
+ }
1101
1202
 
1102
- groupPermissions[groupAddress] = permissions;
1103
- _context21.next = 18;
1104
- break;
1203
+ if (permission % 100 >= 10) {
1204
+ permissions.push("access");
1205
+ }
1105
1206
 
1106
- case 14:
1107
- _context21.prev = 14;
1108
- _context21.t0 = _context21["catch"](0);
1207
+ if (permission % 10 > 0) {
1208
+ permissions.push("see");
1209
+ }
1109
1210
 
1110
- _this5.Log("Failed to retrieve group permissions for ".concat(groupAddress), true);
1211
+ groupPermissions[groupAddress] = permissions;
1212
+ _context21.next = 18;
1213
+ break;
1111
1214
 
1112
- _this5.Log(_context21.t0, true);
1215
+ case 14:
1216
+ _context21.prev = 14;
1217
+ _context21.t0 = _context21["catch"](0);
1113
1218
 
1114
- case 18:
1115
- case "end":
1116
- return _context21.stop();
1117
- }
1118
- }
1119
- }, null, null, [[0, 14]]);
1120
- })));
1219
+ _this5.Log("Failed to retrieve group permissions for ".concat(groupAddress), true);
1121
1220
 
1122
- case 22:
1123
- return _context22.abrupt("return", groupPermissions);
1221
+ _this5.Log(_context21.t0, true);
1124
1222
 
1125
- case 23:
1126
- case "end":
1127
- return _context22.stop();
1223
+ case 18:
1224
+ case "end":
1225
+ return _context21.stop();
1226
+ }
1227
+ }
1228
+ }, _callee21, null, [[0, 14]]);
1229
+ }));
1230
+
1231
+ return function (_x22) {
1232
+ return _ref37.apply(this, arguments);
1233
+ };
1234
+ }()));
1235
+
1236
+ case 22:
1237
+ return _context22.abrupt("return", groupPermissions);
1238
+
1239
+ case 23:
1240
+ case "end":
1241
+ return _context22.stop();
1242
+ }
1128
1243
  }
1129
- }
1130
- }, null, this);
1131
- };
1244
+ }, _callee22, this);
1245
+ }));
1246
+
1247
+ return function (_x21) {
1248
+ return _ref36.apply(this, arguments);
1249
+ };
1250
+ }();
1132
1251
  /**
1133
1252
  * Add a permission on the specified group for the specified object or content type
1134
1253
  *
@@ -1141,53 +1260,59 @@ exports.ContentObjectGroupPermissions = function _callee22(_ref16) {
1141
1260
  */
1142
1261
 
1143
1262
 
1144
- exports.AddContentObjectGroupPermission = function _callee23(_ref17) {
1145
- var objectId, groupAddress, permission;
1146
- return _regeneratorRuntime.async(function _callee23$(_context23) {
1147
- while (1) {
1148
- switch (_context23.prev = _context23.next) {
1149
- case 0:
1150
- objectId = _ref17.objectId, groupAddress = _ref17.groupAddress, permission = _ref17.permission;
1151
- ValidatePresence("permission", permission);
1152
- ValidateObject(objectId);
1153
- groupAddress = ValidateAddress(groupAddress);
1154
-
1155
- if (!this.utils.EqualAddress(groupAddress, this.utils.HashToAddress(objectId))) {
1156
- _context23.next = 6;
1157
- break;
1158
- }
1159
-
1160
- throw Error("Group rights cannot be set on the same group");
1161
-
1162
- case 6:
1163
- permission = permission.toLowerCase();
1164
-
1165
- if (["see", "access", "manage"].includes(permission)) {
1166
- _context23.next = 9;
1167
- break;
1168
- }
1169
-
1170
- throw Error("Invalid permission type: ".concat(permission));
1171
-
1172
- case 9:
1173
- this.Log("Adding ".concat(permission, " permission to group ").concat(groupAddress, " for ").concat(objectId));
1174
- _context23.next = 12;
1175
- return _regeneratorRuntime.awrap(this.SetGroupPermission({
1176
- groupAddress: groupAddress,
1177
- objectId: objectId,
1178
- permission: permission
1179
- }));
1263
+ exports.AddContentObjectGroupPermission = /*#__PURE__*/function () {
1264
+ var _ref39 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee23(_ref38) {
1265
+ var objectId, groupAddress, permission;
1266
+ return _regeneratorRuntime.wrap(function _callee23$(_context23) {
1267
+ while (1) {
1268
+ switch (_context23.prev = _context23.next) {
1269
+ case 0:
1270
+ objectId = _ref38.objectId, groupAddress = _ref38.groupAddress, permission = _ref38.permission;
1271
+ ValidatePresence("permission", permission);
1272
+ ValidateObject(objectId);
1273
+ groupAddress = ValidateAddress(groupAddress);
1274
+
1275
+ if (!this.utils.EqualAddress(groupAddress, this.utils.HashToAddress(objectId))) {
1276
+ _context23.next = 6;
1277
+ break;
1278
+ }
1279
+
1280
+ throw Error("Group rights cannot be set on the same group");
1281
+
1282
+ case 6:
1283
+ permission = permission.toLowerCase();
1284
+
1285
+ if (["see", "access", "manage"].includes(permission)) {
1286
+ _context23.next = 9;
1287
+ break;
1288
+ }
1289
+
1290
+ throw Error("Invalid permission type: ".concat(permission));
1291
+
1292
+ case 9:
1293
+ this.Log("Adding ".concat(permission, " permission to group ").concat(groupAddress, " for ").concat(objectId));
1294
+ _context23.next = 12;
1295
+ return this.SetGroupPermission({
1296
+ groupAddress: groupAddress,
1297
+ objectId: objectId,
1298
+ permission: permission
1299
+ });
1180
1300
 
1181
- case 12:
1182
- return _context23.abrupt("return", _context23.sent);
1301
+ case 12:
1302
+ return _context23.abrupt("return", _context23.sent);
1183
1303
 
1184
- case 13:
1185
- case "end":
1186
- return _context23.stop();
1304
+ case 13:
1305
+ case "end":
1306
+ return _context23.stop();
1307
+ }
1187
1308
  }
1188
- }
1189
- }, null, this);
1190
- };
1309
+ }, _callee23, this);
1310
+ }));
1311
+
1312
+ return function (_x23) {
1313
+ return _ref39.apply(this, arguments);
1314
+ };
1315
+ }();
1191
1316
  /**
1192
1317
  * Remove a permission on the specified group for the specified object or content type
1193
1318
  *
@@ -1200,45 +1325,51 @@ exports.AddContentObjectGroupPermission = function _callee23(_ref17) {
1200
1325
  */
1201
1326
 
1202
1327
 
1203
- exports.RemoveContentObjectGroupPermission = function _callee24(_ref18) {
1204
- var objectId, groupAddress, permission;
1205
- return _regeneratorRuntime.async(function _callee24$(_context24) {
1206
- while (1) {
1207
- switch (_context24.prev = _context24.next) {
1208
- case 0:
1209
- objectId = _ref18.objectId, groupAddress = _ref18.groupAddress, permission = _ref18.permission;
1210
- ValidatePresence("permission", permission);
1211
- ValidateObject(objectId);
1212
- groupAddress = ValidateAddress(groupAddress);
1213
- permission = permission.toLowerCase();
1214
-
1215
- if (["see", "access", "manage"].includes(permission)) {
1216
- _context24.next = 7;
1217
- break;
1218
- }
1219
-
1220
- throw Error("Invalid permission type: ".concat(permission));
1221
-
1222
- case 7:
1223
- this.Log("Removing ".concat(permission, " permission from group ").concat(groupAddress, " for ").concat(objectId));
1224
- _context24.next = 10;
1225
- return _regeneratorRuntime.awrap(this.SetGroupPermission({
1226
- groupAddress: groupAddress,
1227
- objectId: objectId,
1228
- permission: permission,
1229
- remove: true
1230
- }));
1328
+ exports.RemoveContentObjectGroupPermission = /*#__PURE__*/function () {
1329
+ var _ref41 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24(_ref40) {
1330
+ var objectId, groupAddress, permission;
1331
+ return _regeneratorRuntime.wrap(function _callee24$(_context24) {
1332
+ while (1) {
1333
+ switch (_context24.prev = _context24.next) {
1334
+ case 0:
1335
+ objectId = _ref40.objectId, groupAddress = _ref40.groupAddress, permission = _ref40.permission;
1336
+ ValidatePresence("permission", permission);
1337
+ ValidateObject(objectId);
1338
+ groupAddress = ValidateAddress(groupAddress);
1339
+ permission = permission.toLowerCase();
1340
+
1341
+ if (["see", "access", "manage"].includes(permission)) {
1342
+ _context24.next = 7;
1343
+ break;
1344
+ }
1345
+
1346
+ throw Error("Invalid permission type: ".concat(permission));
1347
+
1348
+ case 7:
1349
+ this.Log("Removing ".concat(permission, " permission from group ").concat(groupAddress, " for ").concat(objectId));
1350
+ _context24.next = 10;
1351
+ return this.SetGroupPermission({
1352
+ groupAddress: groupAddress,
1353
+ objectId: objectId,
1354
+ permission: permission,
1355
+ remove: true
1356
+ });
1231
1357
 
1232
- case 10:
1233
- return _context24.abrupt("return", _context24.sent);
1358
+ case 10:
1359
+ return _context24.abrupt("return", _context24.sent);
1234
1360
 
1235
- case 11:
1236
- case "end":
1237
- return _context24.stop();
1361
+ case 11:
1362
+ case "end":
1363
+ return _context24.stop();
1364
+ }
1238
1365
  }
1239
- }
1240
- }, null, this);
1241
- };
1366
+ }, _callee24, this);
1367
+ }));
1368
+
1369
+ return function (_x24) {
1370
+ return _ref41.apply(this, arguments);
1371
+ };
1372
+ }();
1242
1373
  /**
1243
1374
  * Link the specified group to an OAuth provider with the specified credentials
1244
1375
  *
@@ -1248,104 +1379,110 @@ exports.RemoveContentObjectGroupPermission = function _callee24(_ref18) {
1248
1379
  */
1249
1380
 
1250
1381
 
1251
- exports.LinkAccessGroupToOauth = function _callee25(_ref19) {
1252
- var groupAddress, kmsId, oauthConfig, _ref20, publicKey, kmsKey, kmsConfig, userKey, userConfig, objectId, writeToken;
1382
+ exports.LinkAccessGroupToOauth = /*#__PURE__*/function () {
1383
+ var _ref43 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(_ref42) {
1384
+ var groupAddress, kmsId, oauthConfig, _yield$this$authClien2, publicKey, kmsKey, kmsConfig, userKey, userConfig, objectId, writeToken;
1253
1385
 
1254
- return _regeneratorRuntime.async(function _callee25$(_context25) {
1255
- while (1) {
1256
- switch (_context25.prev = _context25.next) {
1257
- case 0:
1258
- groupAddress = _ref19.groupAddress, kmsId = _ref19.kmsId, oauthConfig = _ref19.oauthConfig;
1259
- ValidateAddress(groupAddress);
1260
- ValidatePresence("kmsId", kmsId);
1261
- ValidatePresence("oauthConfig", oauthConfig);
1262
-
1263
- if (typeof oauthConfig === "string") {
1264
- oauthConfig = JSON.parse(oauthConfig);
1265
- }
1266
-
1267
- _context25.next = 7;
1268
- return _regeneratorRuntime.awrap(this.authClient.KMSInfo({
1269
- kmsId: kmsId
1270
- }));
1386
+ return _regeneratorRuntime.wrap(function _callee25$(_context25) {
1387
+ while (1) {
1388
+ switch (_context25.prev = _context25.next) {
1389
+ case 0:
1390
+ groupAddress = _ref42.groupAddress, kmsId = _ref42.kmsId, oauthConfig = _ref42.oauthConfig;
1391
+ ValidateAddress(groupAddress);
1392
+ ValidatePresence("kmsId", kmsId);
1393
+ ValidatePresence("oauthConfig", oauthConfig);
1271
1394
 
1272
- case 7:
1273
- _ref20 = _context25.sent;
1274
- publicKey = _ref20.publicKey;
1275
- kmsKey = "eluv.jwtv.".concat(kmsId);
1276
- _context25.next = 12;
1277
- return _regeneratorRuntime.awrap(this.Crypto.EncryptConk(oauthConfig, publicKey));
1278
-
1279
- case 12:
1280
- kmsConfig = _context25.sent;
1281
- userKey = "eluv.jwtv.iusr".concat(this.utils.AddressToHash(this.signer.address));
1282
- _context25.next = 16;
1283
- return _regeneratorRuntime.awrap(this.EncryptECIES({
1284
- message: oauthConfig
1285
- }));
1395
+ if (typeof oauthConfig === "string") {
1396
+ oauthConfig = JSON.parse(oauthConfig);
1397
+ }
1286
1398
 
1287
- case 16:
1288
- userConfig = _context25.sent;
1289
- objectId = this.utils.AddressToObjectId(groupAddress);
1290
- _context25.next = 20;
1291
- return _regeneratorRuntime.awrap(this.EditContentObject({
1292
- libraryId: this.contentSpaceLibraryId,
1293
- objectId: objectId
1294
- }));
1399
+ _context25.next = 7;
1400
+ return this.authClient.KMSInfo({
1401
+ kmsId: kmsId
1402
+ });
1295
1403
 
1296
- case 20:
1297
- writeToken = _context25.sent.write_token;
1298
- _context25.next = 23;
1299
- return _regeneratorRuntime.awrap(this.ReplaceMetadata({
1300
- libraryId: this.contentSpaceLibraryId,
1301
- objectId: objectId,
1302
- writeToken: writeToken,
1303
- metadataSubtree: kmsKey,
1304
- metadata: kmsConfig
1305
- }));
1404
+ case 7:
1405
+ _yield$this$authClien2 = _context25.sent;
1406
+ publicKey = _yield$this$authClien2.publicKey;
1407
+ kmsKey = "eluv.jwtv.".concat(kmsId);
1408
+ _context25.next = 12;
1409
+ return this.Crypto.EncryptConk(oauthConfig, publicKey);
1410
+
1411
+ case 12:
1412
+ kmsConfig = _context25.sent;
1413
+ userKey = "eluv.jwtv.iusr".concat(this.utils.AddressToHash(this.signer.address));
1414
+ _context25.next = 16;
1415
+ return this.EncryptECIES({
1416
+ message: oauthConfig
1417
+ });
1306
1418
 
1307
- case 23:
1308
- _context25.next = 25;
1309
- return _regeneratorRuntime.awrap(this.ReplaceMetadata({
1310
- libraryId: this.contentSpaceLibraryId,
1311
- objectId: objectId,
1312
- writeToken: writeToken,
1313
- metadataSubtree: userKey,
1314
- metadata: userConfig
1315
- }));
1419
+ case 16:
1420
+ userConfig = _context25.sent;
1421
+ objectId = this.utils.AddressToObjectId(groupAddress);
1422
+ _context25.next = 20;
1423
+ return this.EditContentObject({
1424
+ libraryId: this.contentSpaceLibraryId,
1425
+ objectId: objectId
1426
+ });
1316
1427
 
1317
- case 25:
1318
- _context25.next = 27;
1319
- return _regeneratorRuntime.awrap(this.FinalizeContentObject({
1320
- libraryId: this.contentSpaceLibraryId,
1321
- objectId: objectId,
1322
- writeToken: writeToken,
1323
- commitMessage: "Bind access group to OAuth"
1324
- }));
1428
+ case 20:
1429
+ writeToken = _context25.sent.write_token;
1430
+ _context25.next = 23;
1431
+ return this.ReplaceMetadata({
1432
+ libraryId: this.contentSpaceLibraryId,
1433
+ objectId: objectId,
1434
+ writeToken: writeToken,
1435
+ metadataSubtree: kmsKey,
1436
+ metadata: kmsConfig
1437
+ });
1325
1438
 
1326
- case 27:
1327
- _context25.next = 29;
1328
- return _regeneratorRuntime.awrap(this.CallContractMethodAndWait({
1329
- contractAddress: groupAddress,
1330
- methodName: "setOAuthEnabled",
1331
- methodArgs: [false]
1332
- }));
1439
+ case 23:
1440
+ _context25.next = 25;
1441
+ return this.ReplaceMetadata({
1442
+ libraryId: this.contentSpaceLibraryId,
1443
+ objectId: objectId,
1444
+ writeToken: writeToken,
1445
+ metadataSubtree: userKey,
1446
+ metadata: userConfig
1447
+ });
1333
1448
 
1334
- case 29:
1335
- _context25.next = 31;
1336
- return _regeneratorRuntime.awrap(this.CallContractMethodAndWait({
1337
- contractAddress: groupAddress,
1338
- methodName: "setOAuthEnabled",
1339
- methodArgs: [true]
1340
- }));
1449
+ case 25:
1450
+ _context25.next = 27;
1451
+ return this.FinalizeContentObject({
1452
+ libraryId: this.contentSpaceLibraryId,
1453
+ objectId: objectId,
1454
+ writeToken: writeToken,
1455
+ commitMessage: "Bind access group to OAuth"
1456
+ });
1341
1457
 
1342
- case 31:
1343
- case "end":
1344
- return _context25.stop();
1458
+ case 27:
1459
+ _context25.next = 29;
1460
+ return this.CallContractMethodAndWait({
1461
+ contractAddress: groupAddress,
1462
+ methodName: "setOAuthEnabled",
1463
+ methodArgs: [false]
1464
+ });
1465
+
1466
+ case 29:
1467
+ _context25.next = 31;
1468
+ return this.CallContractMethodAndWait({
1469
+ contractAddress: groupAddress,
1470
+ methodName: "setOAuthEnabled",
1471
+ methodArgs: [true]
1472
+ });
1473
+
1474
+ case 31:
1475
+ case "end":
1476
+ return _context25.stop();
1477
+ }
1345
1478
  }
1346
- }
1347
- }, null, this);
1348
- };
1479
+ }, _callee25, this);
1480
+ }));
1481
+
1482
+ return function (_x25) {
1483
+ return _ref43.apply(this, arguments);
1484
+ };
1485
+ }();
1349
1486
  /**
1350
1487
  * Disable the OAuth linking on the specified access group
1351
1488
  *
@@ -1353,25 +1490,31 @@ exports.LinkAccessGroupToOauth = function _callee25(_ref19) {
1353
1490
  */
1354
1491
 
1355
1492
 
1356
- exports.UnlinkAccessGroupFromOauth = function _callee26(_ref21) {
1357
- var groupAddress;
1358
- return _regeneratorRuntime.async(function _callee26$(_context26) {
1359
- while (1) {
1360
- switch (_context26.prev = _context26.next) {
1361
- case 0:
1362
- groupAddress = _ref21.groupAddress;
1363
- ValidateAddress(groupAddress);
1364
- _context26.next = 4;
1365
- return _regeneratorRuntime.awrap(this.CallContractMethodAndWait({
1366
- contractAddress: groupAddress,
1367
- methodName: "setOAuthEnabled",
1368
- methodArgs: [false]
1369
- }));
1493
+ exports.UnlinkAccessGroupFromOauth = /*#__PURE__*/function () {
1494
+ var _ref45 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee26(_ref44) {
1495
+ var groupAddress;
1496
+ return _regeneratorRuntime.wrap(function _callee26$(_context26) {
1497
+ while (1) {
1498
+ switch (_context26.prev = _context26.next) {
1499
+ case 0:
1500
+ groupAddress = _ref44.groupAddress;
1501
+ ValidateAddress(groupAddress);
1502
+ _context26.next = 4;
1503
+ return this.CallContractMethodAndWait({
1504
+ contractAddress: groupAddress,
1505
+ methodName: "setOAuthEnabled",
1506
+ methodArgs: [false]
1507
+ });
1370
1508
 
1371
- case 4:
1372
- case "end":
1373
- return _context26.stop();
1509
+ case 4:
1510
+ case "end":
1511
+ return _context26.stop();
1512
+ }
1374
1513
  }
1375
- }
1376
- }, null, this);
1377
- };
1514
+ }, _callee26, this);
1515
+ }));
1516
+
1517
+ return function (_x26) {
1518
+ return _ref45.apply(this, arguments);
1519
+ };
1520
+ }();