@eluvio/elv-client-js 4.2.4 → 4.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 (41) hide show
  1. package/dist/ElvClient-min.js +1 -1
  2. package/dist/ElvClient-node-min.js +1 -1
  3. package/dist/ElvFrameClient-min.js +1 -1
  4. package/dist/ElvPermissionsClient-min.js +1 -1
  5. package/dist/ElvWalletClient-min.js +1 -1
  6. package/dist/ElvWalletClient-node-min.js +1 -1
  7. package/dist/src/AuthorizationClient.js +710 -709
  8. package/dist/src/ContentObjectAudit.js +56 -56
  9. package/dist/src/ContentObjectVerification.js +281 -0
  10. package/dist/src/Crypto.js +85 -85
  11. package/dist/src/ElvClient.js +499 -529
  12. package/dist/src/ElvWallet.js +28 -30
  13. package/dist/src/EthClient.js +311 -311
  14. package/dist/src/FrameClient.js +64 -63
  15. package/dist/src/HttpClient.js +60 -60
  16. package/dist/src/Id.js +2 -1
  17. package/dist/src/PermissionsClient.js +487 -499
  18. package/dist/src/RemoteSigner.js +83 -82
  19. package/dist/src/UserProfileClient.js +374 -392
  20. package/dist/src/Utils.js +66 -69
  21. package/dist/src/Validation.js +10 -10
  22. package/dist/src/client/ABRPublishing.js +238 -238
  23. package/dist/src/client/AccessGroups.js +474 -477
  24. package/dist/src/client/ContentAccess.js +1709 -1705
  25. package/dist/src/client/ContentManagement.js +871 -871
  26. package/dist/src/client/Contracts.js +578 -575
  27. package/dist/src/client/Files.js +684 -700
  28. package/dist/src/client/LiveConf.js +3 -1
  29. package/dist/src/client/LiveStream.js +693 -694
  30. package/dist/src/client/NFT.js +14 -14
  31. package/dist/src/client/NTP.js +84 -84
  32. package/dist/src/client/Shares.js +60 -53
  33. package/dist/src/walletClient/ClientMethods.js +951 -977
  34. package/dist/src/walletClient/Notifications.js +14 -14
  35. package/dist/src/walletClient/Profile.js +66 -66
  36. package/dist/src/walletClient/Utils.js +15 -15
  37. package/dist/src/walletClient/index.js +562 -572
  38. package/package.json +1 -1
  39. package/src/Utils.js +1 -4
  40. package/src/client/ABRPublishing.js +1 -1
  41. package/src/client/LiveStream.js +77 -50
@@ -124,7 +124,7 @@ var PermissionsClient = /*#__PURE__*/function () {
124
124
  this.drafts = {};
125
125
  this.offline = options.offline;
126
126
  }
127
- return _createClass(PermissionsClient, [{
127
+ _createClass(PermissionsClient, [{
128
128
  key: "FormatDate",
129
129
  value: function FormatDate(date) {
130
130
  if (!date) {
@@ -176,150 +176,150 @@ var PermissionsClient = /*#__PURE__*/function () {
176
176
  }, {
177
177
  key: "FormatPermission",
178
178
  value: function () {
179
- var _FormatPermission = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
180
- var policyId, policyWriteToken, permission, subjectSource, subjectType, subjectId, subjectName, subjectNTPId, id, cachedName, contentSpaceLibraryId, permissionSpec, _t, _t2, _t3, _t4, _t5, _t6, _t7, _t8, _t9, _t0, _t1, _t10, _t11, _t12, _t13, _t14, _t15, _t16;
181
- return _regeneratorRuntime.wrap(function (_context) {
179
+ var _FormatPermission = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
180
+ var policyId, policyWriteToken, permission, subjectSource, subjectType, subjectId, subjectName, subjectNTPId, id, cachedName, contentSpaceLibraryId, permissionSpec;
181
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
182
182
  while (1) switch (_context.prev = _context.next) {
183
183
  case 0:
184
184
  policyId = _ref.policyId, policyWriteToken = _ref.policyWriteToken, permission = _ref.permission;
185
185
  subjectSource = permission.subject.type.startsWith("oauth") ? "oauth" : "fabric";
186
- _t = permission.subject.type;
187
- _context.next = _t === "otp" ? 1 : _t === "otp_subject" ? 2 : _t === "group" ? 3 : _t === "oauth_group" ? 3 : _t === "user" ? 4 : _t === "oauth_user" ? 4 : 5;
186
+ _context.t0 = permission.subject.type;
187
+ _context.next = _context.t0 === "otp" ? 5 : _context.t0 === "otp_subject" ? 8 : _context.t0 === "group" ? 13 : _context.t0 === "oauth_group" ? 13 : _context.t0 === "user" ? 16 : _context.t0 === "oauth_user" ? 16 : 19;
188
188
  break;
189
- case 1:
189
+ case 5:
190
190
  subjectType = "ntp";
191
191
  subjectId = permission.subject.id;
192
- return _context.abrupt("continue", 6);
193
- case 2:
192
+ return _context.abrupt("break", 20);
193
+ case 8:
194
194
  subjectType = "ntp_subject";
195
195
  subjectId = permission.subject.id;
196
196
  subjectName = subjectId;
197
197
  subjectNTPId = permission.subject.otp_id;
198
- return _context.abrupt("continue", 6);
199
- case 3:
198
+ return _context.abrupt("break", 20);
199
+ case 13:
200
200
  subjectType = "group";
201
201
  subjectId = subjectSource === "oauth" ? permission.subject.oauth_id : this.client.utils.HashToAddress(permission.subject.id);
202
- return _context.abrupt("continue", 6);
203
- case 4:
202
+ return _context.abrupt("break", 20);
203
+ case 16:
204
204
  subjectType = "user";
205
205
  subjectId = subjectSource === "oauth" ? permission.subject.oauth_id : this.client.utils.HashToAddress(permission.subject.id);
206
- return _context.abrupt("continue", 6);
207
- case 5:
206
+ return _context.abrupt("break", 20);
207
+ case 19:
208
208
  throw Error("Unknown subject type: " + permission.subject.type);
209
- case 6:
209
+ case 20:
210
210
  id = permission.subject.oauth_id || permission.subject.id;
211
211
  cachedName = this.subjectNames[id];
212
212
  subjectName = subjectName || cachedName || permission.subject.id;
213
213
  if (!(!cachedName && subjectSource === "fabric")) {
214
- _context.next = 20;
214
+ _context.next = 74;
215
215
  break;
216
216
  }
217
217
  if (!(subjectType === "group")) {
218
- _context.next = 10;
218
+ _context.next = 36;
219
219
  break;
220
220
  }
221
- _context.next = 7;
221
+ _context.next = 27;
222
222
  return this.client.ContentSpaceId();
223
- case 7:
223
+ case 27:
224
224
  contentSpaceLibraryId = _context.sent.replace("ispc", "ilib");
225
- _context.next = 8;
225
+ _context.next = 30;
226
226
  return this.client.ContentObjectMetadata({
227
227
  libraryId: contentSpaceLibraryId,
228
228
  objectId: this.client.utils.AddressToObjectId(subjectId),
229
229
  metadataSubtree: UrlJoin("public", "name")
230
230
  });
231
- case 8:
232
- _t2 = _context.sent;
233
- if (_t2) {
234
- _context.next = 9;
231
+ case 30:
232
+ _context.t1 = _context.sent;
233
+ if (_context.t1) {
234
+ _context.next = 33;
235
235
  break;
236
236
  }
237
- _t2 = subjectId;
238
- case 9:
239
- subjectName = _t2;
240
- _context.next = 20;
237
+ _context.t1 = subjectId;
238
+ case 33:
239
+ subjectName = _context.t1;
240
+ _context.next = 74;
241
241
  break;
242
- case 10:
242
+ case 36:
243
243
  if (!(subjectType === "user")) {
244
- _context.next = 15;
244
+ _context.next = 56;
245
245
  break;
246
246
  }
247
- _t5 = this.client;
248
- _context.next = 11;
247
+ _context.t4 = this.client;
248
+ _context.next = 40;
249
249
  return this.client.ContentObjectLibraryId({
250
250
  objectId: policyId
251
251
  });
252
- case 11:
253
- _t6 = _context.sent;
254
- _t7 = policyId;
255
- _t8 = policyWriteToken;
256
- _t9 = UrlJoin("auth_policy_settings", "fabric_users", subjectId);
257
- _t0 = {
258
- libraryId: _t6,
259
- objectId: _t7,
260
- writeToken: _t8,
261
- metadataSubtree: _t9
252
+ case 40:
253
+ _context.t5 = _context.sent;
254
+ _context.t6 = policyId;
255
+ _context.t7 = policyWriteToken;
256
+ _context.t8 = UrlJoin("auth_policy_settings", "fabric_users", subjectId);
257
+ _context.t9 = {
258
+ libraryId: _context.t5,
259
+ objectId: _context.t6,
260
+ writeToken: _context.t7,
261
+ metadataSubtree: _context.t8
262
262
  };
263
- _context.next = 12;
264
- return _t5.ContentObjectMetadata.call(_t5, _t0);
265
- case 12:
266
- _t4 = _context.sent;
267
- if (_t4) {
268
- _context.next = 13;
263
+ _context.next = 47;
264
+ return _context.t4.ContentObjectMetadata.call(_context.t4, _context.t9);
265
+ case 47:
266
+ _context.t3 = _context.sent;
267
+ if (_context.t3) {
268
+ _context.next = 50;
269
269
  break;
270
270
  }
271
- _t4 = {};
272
- case 13:
273
- _t3 = _t4.name;
274
- if (_t3) {
275
- _context.next = 14;
271
+ _context.t3 = {};
272
+ case 50:
273
+ _context.t2 = _context.t3.name;
274
+ if (_context.t2) {
275
+ _context.next = 53;
276
276
  break;
277
277
  }
278
- _t3 = subjectId;
279
- case 14:
280
- subjectName = _t3;
281
- _context.next = 20;
278
+ _context.t2 = subjectId;
279
+ case 53:
280
+ subjectName = _context.t2;
281
+ _context.next = 74;
282
282
  break;
283
- case 15:
283
+ case 56:
284
284
  if (!(subjectType === "ntp")) {
285
- _context.next = 20;
285
+ _context.next = 74;
286
286
  break;
287
287
  }
288
- _t11 = this.client;
289
- _context.next = 16;
288
+ _context.t12 = this.client;
289
+ _context.next = 60;
290
290
  return this.client.ContentObjectLibraryId({
291
291
  objectId: policyId
292
292
  });
293
- case 16:
294
- _t12 = _context.sent;
295
- _t13 = policyId;
296
- _t14 = policyWriteToken;
297
- _t15 = UrlJoin("auth_policy_settings", "ntp_instances", subjectId);
298
- _t16 = {
299
- libraryId: _t12,
300
- objectId: _t13,
301
- writeToken: _t14,
302
- metadataSubtree: _t15
293
+ case 60:
294
+ _context.t13 = _context.sent;
295
+ _context.t14 = policyId;
296
+ _context.t15 = policyWriteToken;
297
+ _context.t16 = UrlJoin("auth_policy_settings", "ntp_instances", subjectId);
298
+ _context.t17 = {
299
+ libraryId: _context.t13,
300
+ objectId: _context.t14,
301
+ writeToken: _context.t15,
302
+ metadataSubtree: _context.t16
303
303
  };
304
- _context.next = 17;
305
- return _t11.ContentObjectMetadata.call(_t11, _t16);
306
- case 17:
307
- _t10 = _context.sent;
308
- if (_t10) {
309
- _context.next = 18;
304
+ _context.next = 67;
305
+ return _context.t12.ContentObjectMetadata.call(_context.t12, _context.t17);
306
+ case 67:
307
+ _context.t11 = _context.sent;
308
+ if (_context.t11) {
309
+ _context.next = 70;
310
310
  break;
311
311
  }
312
- _t10 = {};
313
- case 18:
314
- _t1 = _t10.name;
315
- if (_t1) {
316
- _context.next = 19;
312
+ _context.t11 = {};
313
+ case 70:
314
+ _context.t10 = _context.t11.name;
315
+ if (_context.t10) {
316
+ _context.next = 73;
317
317
  break;
318
318
  }
319
- _t1 = subjectId;
320
- case 19:
321
- subjectName = _t1;
322
- case 20:
319
+ _context.t10 = subjectId;
320
+ case 73:
321
+ subjectName = _context.t10;
322
+ case 74:
323
323
  this.subjectNames[id] = subjectName;
324
324
  permissionSpec = {
325
325
  profileName: permission.profile,
@@ -338,7 +338,7 @@ var PermissionsClient = /*#__PURE__*/function () {
338
338
  permissionSpec.end = permission.end;
339
339
  }
340
340
  return _context.abrupt("return", permissionSpec);
341
- case 21:
341
+ case 80:
342
342
  case "end":
343
343
  return _context.stop();
344
344
  }
@@ -362,38 +362,38 @@ var PermissionsClient = /*#__PURE__*/function () {
362
362
  */
363
363
  }, {
364
364
  key: "OpenOfflineDraft",
365
- value: (function () {
366
- var _OpenOfflineDraft = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref2) {
365
+ value: function () {
366
+ var _OpenOfflineDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref2) {
367
367
  var policyId, policyLibraryId, policyWriteToken, meta;
368
- return _regeneratorRuntime.wrap(function (_context2) {
368
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
369
369
  while (1) switch (_context2.prev = _context2.next) {
370
370
  case 0:
371
371
  policyId = _ref2.policyId, policyLibraryId = _ref2.policyLibraryId, policyWriteToken = _ref2.policyWriteToken;
372
372
  if (!(policyLibraryId == null)) {
373
- _context2.next = 2;
373
+ _context2.next = 5;
374
374
  break;
375
375
  }
376
- _context2.next = 1;
376
+ _context2.next = 4;
377
377
  return this.client.ContentObjectLibraryId({
378
378
  objectId: policyId
379
379
  });
380
- case 1:
380
+ case 4:
381
381
  policyLibraryId = _context2.sent;
382
- case 2:
383
- _context2.next = 3;
382
+ case 5:
383
+ _context2.next = 7;
384
384
  return this.client.ContentObjectMetadata({
385
385
  libraryId: policyLibraryId,
386
386
  objectId: policyId,
387
387
  writeToken: policyWriteToken
388
388
  });
389
- case 3:
389
+ case 7:
390
390
  meta = _context2.sent;
391
391
  this.drafts[policyId] = {
392
392
  meta: meta,
393
393
  policyLibraryId: policyLibraryId,
394
394
  policyWriteToken: policyWriteToken
395
395
  };
396
- case 4:
396
+ case 9:
397
397
  case "end":
398
398
  return _context2.stop();
399
399
  }
@@ -412,32 +412,31 @@ var PermissionsClient = /*#__PURE__*/function () {
412
412
  * @namedParams
413
413
  * @param {string} policyId - Object ID of the policy
414
414
  */
415
- )
416
415
  }, {
417
416
  key: "CloseOfflineDraft",
418
- value: (function () {
419
- var _CloseOfflineDraft = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref3) {
417
+ value: function () {
418
+ var _CloseOfflineDraft = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref3) {
420
419
  var policyId;
421
- return _regeneratorRuntime.wrap(function (_context3) {
420
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
422
421
  while (1) switch (_context3.prev = _context3.next) {
423
422
  case 0:
424
423
  policyId = _ref3.policyId;
425
424
  if (!(this.drafts[policyId] == null)) {
426
- _context3.next = 1;
425
+ _context3.next = 3;
427
426
  break;
428
427
  }
429
428
  throw Error("No draft open for policyId: " + policyId);
430
- case 1:
431
- _context3.next = 2;
429
+ case 3:
430
+ _context3.next = 5;
432
431
  return this.client.ReplaceMetadata({
433
432
  libraryId: this.drafts[policyId].policyLibraryId,
434
433
  objectId: policyId,
435
434
  writeToken: this.drafts[policyId].policyWriteToken,
436
435
  metadata: this.drafts[policyId].meta
437
436
  });
438
- case 2:
437
+ case 5:
439
438
  this.drafts[policyId] = null;
440
- case 3:
439
+ case 6:
441
440
  case "end":
442
441
  return _context3.stop();
443
442
  }
@@ -458,45 +457,44 @@ var PermissionsClient = /*#__PURE__*/function () {
458
457
  * @param {string=} policyWriteToken - Write token for the policy object - if specified, info will be retrieved from the write draft instead of the last finalized policy object
459
458
  * @return {Promise<Object>} - A mapping of item objectId to the display name of the item
460
459
  */
461
- )
462
460
  }, {
463
461
  key: "PolicyItems",
464
- value: (function () {
465
- var _PolicyItems = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref4) {
466
- var policyId, policyWriteToken, _t17, _t18, _t19, _t20, _t21, _t22, _t23;
467
- return _regeneratorRuntime.wrap(function (_context4) {
462
+ value: function () {
463
+ var _PolicyItems = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref4) {
464
+ var policyId, policyWriteToken;
465
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
468
466
  while (1) switch (_context4.prev = _context4.next) {
469
467
  case 0:
470
468
  policyId = _ref4.policyId, policyWriteToken = _ref4.policyWriteToken;
471
- _t18 = this.client;
472
- _context4.next = 1;
469
+ _context4.t1 = this.client;
470
+ _context4.next = 4;
473
471
  return this.client.ContentObjectLibraryId({
474
472
  objectId: policyId
475
473
  });
476
- case 1:
477
- _t19 = _context4.sent;
478
- _t20 = policyId;
479
- _t21 = policyWriteToken;
480
- _t22 = ["*/display_title"];
481
- _t23 = {
482
- libraryId: _t19,
483
- objectId: _t20,
484
- writeToken: _t21,
474
+ case 4:
475
+ _context4.t2 = _context4.sent;
476
+ _context4.t3 = policyId;
477
+ _context4.t4 = policyWriteToken;
478
+ _context4.t5 = ["*/display_title"];
479
+ _context4.t6 = {
480
+ libraryId: _context4.t2,
481
+ objectId: _context4.t3,
482
+ writeToken: _context4.t4,
485
483
  metadataSubtree: "auth_policy_spec",
486
- select: _t22
484
+ select: _context4.t5
487
485
  };
488
- _context4.next = 2;
489
- return _t18.ContentObjectMetadata.call(_t18, _t23);
490
- case 2:
491
- _t17 = _context4.sent;
492
- if (_t17) {
493
- _context4.next = 3;
486
+ _context4.next = 11;
487
+ return _context4.t1.ContentObjectMetadata.call(_context4.t1, _context4.t6);
488
+ case 11:
489
+ _context4.t0 = _context4.sent;
490
+ if (_context4.t0) {
491
+ _context4.next = 14;
494
492
  break;
495
493
  }
496
- _t17 = {};
497
- case 3:
498
- return _context4.abrupt("return", _t17);
499
- case 4:
494
+ _context4.t0 = {};
495
+ case 14:
496
+ return _context4.abrupt("return", _context4.t0);
497
+ case 15:
500
498
  case "end":
501
499
  return _context4.stop();
502
500
  }
@@ -517,43 +515,42 @@ var PermissionsClient = /*#__PURE__*/function () {
517
515
  * @param {string} itemId - Object ID of the item
518
516
  * @return {Promise<Object | undefined>} - The policy for the specified item. If none exists, returns undefined
519
517
  */
520
- )
521
518
  }, {
522
519
  key: "ItemPolicy",
523
- value: (function () {
524
- var _ItemPolicy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref5) {
520
+ value: function () {
521
+ var _ItemPolicy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref5) {
525
522
  var policyId, policyWriteToken, itemId, profiles, permissions;
526
- return _regeneratorRuntime.wrap(function (_context5) {
523
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
527
524
  while (1) switch (_context5.prev = _context5.next) {
528
525
  case 0:
529
526
  policyId = _ref5.policyId, policyWriteToken = _ref5.policyWriteToken, itemId = _ref5.itemId;
530
- _context5.next = 1;
527
+ _context5.next = 3;
531
528
  return this.ItemProfiles({
532
529
  policyId: policyId,
533
530
  policyWriteToken: policyWriteToken,
534
531
  itemId: itemId
535
532
  });
536
- case 1:
533
+ case 3:
537
534
  profiles = _context5.sent;
538
- _context5.next = 2;
535
+ _context5.next = 6;
539
536
  return this.ItemPermissions({
540
537
  policyId: policyId,
541
538
  policyWriteToken: policyWriteToken,
542
539
  itemId: itemId
543
540
  });
544
- case 2:
541
+ case 6:
545
542
  permissions = _context5.sent;
546
543
  if (!(!profiles || !permissions)) {
547
- _context5.next = 3;
544
+ _context5.next = 9;
548
545
  break;
549
546
  }
550
547
  return _context5.abrupt("return");
551
- case 3:
548
+ case 9:
552
549
  return _context5.abrupt("return", {
553
550
  profiles: profiles,
554
551
  permissions: permissions
555
552
  });
556
- case 4:
553
+ case 10:
557
554
  case "end":
558
555
  return _context5.stop();
559
556
  }
@@ -574,14 +571,13 @@ var PermissionsClient = /*#__PURE__*/function () {
574
571
  * @param {string} itemId - Object ID of the item
575
572
  * @param {object=} profiles={} - Profiles to create
576
573
  */
577
- )
578
574
  }, {
579
575
  key: "CreateItemPolicy",
580
- value: (function () {
581
- var _CreateItemPolicy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref6) {
576
+ value: function () {
577
+ var _CreateItemPolicy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref6) {
582
578
  var _this2 = this;
583
- var policyId, policyWriteToken, itemId, _ref6$profiles, profiles, metadata, assetMetadata, displayTitle, itemSpec, _t24, _t25, _t26, _t27, _t28, _t29, _t30, _t31, _t32, _t33, _t34, _t35, _t36;
584
- return _regeneratorRuntime.wrap(function (_context6) {
579
+ var policyId, policyWriteToken, itemId, _ref6$profiles, profiles, metadata, assetMetadata, displayTitle, itemSpec;
580
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
585
581
  while (1) switch (_context6.prev = _context6.next) {
586
582
  case 0:
587
583
  policyId = _ref6.policyId, policyWriteToken = _ref6.policyWriteToken, itemId = _ref6.itemId, _ref6$profiles = _ref6.profiles, profiles = _ref6$profiles === void 0 ? {} : _ref6$profiles;
@@ -589,31 +585,31 @@ var PermissionsClient = /*#__PURE__*/function () {
589
585
  ValidatePresence("policyWriteToken", policyWriteToken);
590
586
  ValidatePresence("itemId", itemId);
591
587
  ValidatePresence("profiles", profiles);
592
- _t25 = this.client;
593
- _context6.next = 1;
588
+ _context6.t1 = this.client;
589
+ _context6.next = 8;
594
590
  return this.client.ContentObjectLibraryId({
595
591
  objectId: itemId
596
592
  });
597
- case 1:
598
- _t26 = _context6.sent;
599
- _t27 = itemId;
600
- _t28 = ["public/name", "public/asset_metadata/title", "public/asset_metadata/display_title"];
601
- _t29 = {
602
- libraryId: _t26,
603
- objectId: _t27,
604
- select: _t28
593
+ case 8:
594
+ _context6.t2 = _context6.sent;
595
+ _context6.t3 = itemId;
596
+ _context6.t4 = ["public/name", "public/asset_metadata/title", "public/asset_metadata/display_title"];
597
+ _context6.t5 = {
598
+ libraryId: _context6.t2,
599
+ objectId: _context6.t3,
600
+ select: _context6.t4
605
601
  };
606
- _context6.next = 2;
607
- return _t25.ContentObjectMetadata.call(_t25, _t29);
608
- case 2:
609
- _t24 = _context6.sent;
610
- if (_t24) {
611
- _context6.next = 3;
602
+ _context6.next = 14;
603
+ return _context6.t1.ContentObjectMetadata.call(_context6.t1, _context6.t5);
604
+ case 14:
605
+ _context6.t0 = _context6.sent;
606
+ if (_context6.t0) {
607
+ _context6.next = 17;
612
608
  break;
613
609
  }
614
- _t24 = {};
615
- case 3:
616
- metadata = _t24;
610
+ _context6.t0 = {};
611
+ case 17:
612
+ metadata = _context6.t0;
617
613
  assetMetadata = (metadata["public"] || {}).asset_metadata || {};
618
614
  displayTitle = assetMetadata.display_title || assetMetadata.title || (metadata["public"] || {}).name;
619
615
  itemSpec = {
@@ -624,27 +620,27 @@ var PermissionsClient = /*#__PURE__*/function () {
624
620
  Object.keys(profiles).forEach(function (profileName) {
625
621
  itemSpec.profiles[profileName] = _this2.FormatProfile(profiles[profileName]);
626
622
  });
627
- _t30 = this.client;
628
- _context6.next = 4;
623
+ _context6.t6 = this.client;
624
+ _context6.next = 25;
629
625
  return this.client.ContentObjectLibraryId({
630
626
  objectId: policyId
631
627
  });
632
- case 4:
633
- _t31 = _context6.sent;
634
- _t32 = policyId;
635
- _t33 = policyWriteToken;
636
- _t34 = UrlJoin("auth_policy_spec", itemId);
637
- _t35 = itemSpec;
638
- _t36 = {
639
- libraryId: _t31,
640
- objectId: _t32,
641
- writeToken: _t33,
642
- metadataSubtree: _t34,
643
- metadata: _t35
628
+ case 25:
629
+ _context6.t7 = _context6.sent;
630
+ _context6.t8 = policyId;
631
+ _context6.t9 = policyWriteToken;
632
+ _context6.t10 = UrlJoin("auth_policy_spec", itemId);
633
+ _context6.t11 = itemSpec;
634
+ _context6.t12 = {
635
+ libraryId: _context6.t7,
636
+ objectId: _context6.t8,
637
+ writeToken: _context6.t9,
638
+ metadataSubtree: _context6.t10,
639
+ metadata: _context6.t11
644
640
  };
645
- _context6.next = 5;
646
- return _t30.ReplaceMetadata.call(_t30, _t36);
647
- case 5:
641
+ _context6.next = 33;
642
+ return _context6.t6.ReplaceMetadata.call(_context6.t6, _context6.t12);
643
+ case 33:
648
644
  case "end":
649
645
  return _context6.stop();
650
646
  }
@@ -664,38 +660,37 @@ var PermissionsClient = /*#__PURE__*/function () {
664
660
  * @param {string} policyWriteToken - Write token for the policy
665
661
  * @param {string} itemId - Object ID of the item
666
662
  */
667
- )
668
663
  }, {
669
664
  key: "RemoveItemPolicy",
670
- value: (function () {
671
- var _RemoveItemPolicy = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref7) {
672
- var policyId, policyWriteToken, itemId, _t37, _t38, _t39, _t40, _t41, _t42;
673
- return _regeneratorRuntime.wrap(function (_context7) {
665
+ value: function () {
666
+ var _RemoveItemPolicy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref7) {
667
+ var policyId, policyWriteToken, itemId;
668
+ return _regeneratorRuntime.wrap(function _callee7$(_context7) {
674
669
  while (1) switch (_context7.prev = _context7.next) {
675
670
  case 0:
676
671
  policyId = _ref7.policyId, policyWriteToken = _ref7.policyWriteToken, itemId = _ref7.itemId;
677
672
  ValidatePresence("policyId", policyId);
678
673
  ValidatePresence("policyWriteToken", policyWriteToken);
679
674
  ValidatePresence("itemId", itemId);
680
- _t37 = this.client;
681
- _context7.next = 1;
675
+ _context7.t0 = this.client;
676
+ _context7.next = 7;
682
677
  return this.client.ContentObjectLibraryId({
683
678
  objectId: policyId
684
679
  });
685
- case 1:
686
- _t38 = _context7.sent;
687
- _t39 = policyId;
688
- _t40 = policyWriteToken;
689
- _t41 = UrlJoin("auth_policy_spec", itemId);
690
- _t42 = {
691
- libraryId: _t38,
692
- objectId: _t39,
693
- writeToken: _t40,
694
- metadataSubtree: _t41
680
+ case 7:
681
+ _context7.t1 = _context7.sent;
682
+ _context7.t2 = policyId;
683
+ _context7.t3 = policyWriteToken;
684
+ _context7.t4 = UrlJoin("auth_policy_spec", itemId);
685
+ _context7.t5 = {
686
+ libraryId: _context7.t1,
687
+ objectId: _context7.t2,
688
+ writeToken: _context7.t3,
689
+ metadataSubtree: _context7.t4
695
690
  };
696
- _context7.next = 2;
697
- return _t37.DeleteMetadata.call(_t37, _t42);
698
- case 2:
691
+ _context7.next = 14;
692
+ return _context7.t0.DeleteMetadata.call(_context7.t0, _context7.t5);
693
+ case 14:
699
694
  case "end":
700
695
  return _context7.stop();
701
696
  }
@@ -717,37 +712,36 @@ var PermissionsClient = /*#__PURE__*/function () {
717
712
  * @param {string} itemId - Object ID of the item
718
713
  * @param {string=} profileName - The name of the profile. If not specified, all profiles will be returned
719
714
  */
720
- )
721
715
  }, {
722
716
  key: "ItemProfiles",
723
- value: (function () {
724
- var _ItemProfiles = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref8) {
725
- var policyId, policyWriteToken, itemId, profileName, _t43, _t44, _t45, _t46, _t47, _t48;
726
- return _regeneratorRuntime.wrap(function (_context8) {
717
+ value: function () {
718
+ var _ItemProfiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref8) {
719
+ var policyId, policyWriteToken, itemId, profileName;
720
+ return _regeneratorRuntime.wrap(function _callee8$(_context8) {
727
721
  while (1) switch (_context8.prev = _context8.next) {
728
722
  case 0:
729
723
  policyId = _ref8.policyId, policyWriteToken = _ref8.policyWriteToken, itemId = _ref8.itemId, profileName = _ref8.profileName;
730
- _t43 = this.client;
731
- _context8.next = 1;
724
+ _context8.t0 = this.client;
725
+ _context8.next = 4;
732
726
  return this.client.ContentObjectLibraryId({
733
727
  objectId: policyId
734
728
  });
735
- case 1:
736
- _t44 = _context8.sent;
737
- _t45 = policyId;
738
- _t46 = policyWriteToken;
739
- _t47 = UrlJoin("auth_policy_spec", itemId, "profiles", profileName || "");
740
- _t48 = {
741
- libraryId: _t44,
742
- objectId: _t45,
743
- writeToken: _t46,
744
- metadataSubtree: _t47
729
+ case 4:
730
+ _context8.t1 = _context8.sent;
731
+ _context8.t2 = policyId;
732
+ _context8.t3 = policyWriteToken;
733
+ _context8.t4 = UrlJoin("auth_policy_spec", itemId, "profiles", profileName || "");
734
+ _context8.t5 = {
735
+ libraryId: _context8.t1,
736
+ objectId: _context8.t2,
737
+ writeToken: _context8.t3,
738
+ metadataSubtree: _context8.t4
745
739
  };
746
- _context8.next = 2;
747
- return _t43.ContentObjectMetadata.call(_t43, _t48);
748
- case 2:
740
+ _context8.next = 11;
741
+ return _context8.t0.ContentObjectMetadata.call(_context8.t0, _context8.t5);
742
+ case 11:
749
743
  return _context8.abrupt("return", _context8.sent);
750
- case 3:
744
+ case 12:
751
745
  case "end":
752
746
  return _context8.stop();
753
747
  }
@@ -770,13 +764,12 @@ var PermissionsClient = /*#__PURE__*/function () {
770
764
  * @param {object} profileSpec - Specification for the profile. If not provided, profile
771
765
  * will default to no access for both assets and offerings
772
766
  */
773
- )
774
767
  }, {
775
768
  key: "SetProfile",
776
- value: (function () {
777
- var _SetProfile = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(_ref9) {
778
- var policyId, policyWriteToken, itemId, profileName, profileSpec, _t49, _t50, _t51, _t52, _t53, _t54, _t55;
779
- return _regeneratorRuntime.wrap(function (_context9) {
769
+ value: function () {
770
+ var _SetProfile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(_ref9) {
771
+ var policyId, policyWriteToken, itemId, profileName, profileSpec;
772
+ return _regeneratorRuntime.wrap(function _callee9$(_context9) {
780
773
  while (1) switch (_context9.prev = _context9.next) {
781
774
  case 0:
782
775
  policyId = _ref9.policyId, policyWriteToken = _ref9.policyWriteToken, itemId = _ref9.itemId, profileName = _ref9.profileName, profileSpec = _ref9.profileSpec;
@@ -785,27 +778,27 @@ var PermissionsClient = /*#__PURE__*/function () {
785
778
  ValidatePresence("itemId", itemId);
786
779
  ValidatePresence("profileName", profileName);
787
780
  ValidatePresence("profileSpec", profileSpec);
788
- _t49 = this.client;
789
- _context9.next = 1;
781
+ _context9.t0 = this.client;
782
+ _context9.next = 9;
790
783
  return this.client.ContentObjectLibraryId({
791
784
  objectId: policyId
792
785
  });
793
- case 1:
794
- _t50 = _context9.sent;
795
- _t51 = policyId;
796
- _t52 = policyWriteToken;
797
- _t53 = UrlJoin("auth_policy_spec", itemId, "profiles", profileName);
798
- _t54 = this.FormatProfile(profileSpec);
799
- _t55 = {
800
- libraryId: _t50,
801
- objectId: _t51,
802
- writeToken: _t52,
803
- metadataSubtree: _t53,
804
- metadata: _t54
786
+ case 9:
787
+ _context9.t1 = _context9.sent;
788
+ _context9.t2 = policyId;
789
+ _context9.t3 = policyWriteToken;
790
+ _context9.t4 = UrlJoin("auth_policy_spec", itemId, "profiles", profileName);
791
+ _context9.t5 = this.FormatProfile(profileSpec);
792
+ _context9.t6 = {
793
+ libraryId: _context9.t1,
794
+ objectId: _context9.t2,
795
+ writeToken: _context9.t3,
796
+ metadataSubtree: _context9.t4,
797
+ metadata: _context9.t5
805
798
  };
806
- _context9.next = 2;
807
- return _t49.ReplaceMetadata.call(_t49, _t55);
808
- case 2:
799
+ _context9.next = 17;
800
+ return _context9.t0.ReplaceMetadata.call(_context9.t0, _context9.t6);
801
+ case 17:
809
802
  case "end":
810
803
  return _context9.stop();
811
804
  }
@@ -828,45 +821,44 @@ var PermissionsClient = /*#__PURE__*/function () {
828
821
  * @param {object} profileSpec - Specification for the profile. If not provided, profile
829
822
  * will default to no access for both assets and offerings
830
823
  */
831
- )
832
824
  }, {
833
825
  key: "RemoveProfile",
834
- value: (function () {
835
- var _RemoveProfile = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee0(_ref0) {
836
- var policyId, policyWriteToken, itemId, profileName, _t56, _t57, _t58, _t59, _t60, _t61;
837
- return _regeneratorRuntime.wrap(function (_context0) {
838
- while (1) switch (_context0.prev = _context0.next) {
826
+ value: function () {
827
+ var _RemoveProfile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(_ref10) {
828
+ var policyId, policyWriteToken, itemId, profileName;
829
+ return _regeneratorRuntime.wrap(function _callee10$(_context10) {
830
+ while (1) switch (_context10.prev = _context10.next) {
839
831
  case 0:
840
- policyId = _ref0.policyId, policyWriteToken = _ref0.policyWriteToken, itemId = _ref0.itemId, profileName = _ref0.profileName;
832
+ policyId = _ref10.policyId, policyWriteToken = _ref10.policyWriteToken, itemId = _ref10.itemId, profileName = _ref10.profileName;
841
833
  ValidatePresence("policyId", policyId);
842
834
  ValidatePresence("policyWriteToken", policyWriteToken);
843
835
  ValidatePresence("itemId", itemId);
844
836
  ValidatePresence("profileName", profileName);
845
- _t56 = this.client;
846
- _context0.next = 1;
837
+ _context10.t0 = this.client;
838
+ _context10.next = 8;
847
839
  return this.client.ContentObjectLibraryId({
848
840
  objectId: policyId
849
841
  });
850
- case 1:
851
- _t57 = _context0.sent;
852
- _t58 = policyId;
853
- _t59 = policyWriteToken;
854
- _t60 = UrlJoin("auth_policy_spec", itemId, "profiles", profileName);
855
- _t61 = {
856
- libraryId: _t57,
857
- objectId: _t58,
858
- writeToken: _t59,
859
- metadataSubtree: _t60
842
+ case 8:
843
+ _context10.t1 = _context10.sent;
844
+ _context10.t2 = policyId;
845
+ _context10.t3 = policyWriteToken;
846
+ _context10.t4 = UrlJoin("auth_policy_spec", itemId, "profiles", profileName);
847
+ _context10.t5 = {
848
+ libraryId: _context10.t1,
849
+ objectId: _context10.t2,
850
+ writeToken: _context10.t3,
851
+ metadataSubtree: _context10.t4
860
852
  };
861
- _context0.next = 2;
862
- return _t56.DeleteMetadata.call(_t56, _t61);
863
- case 2:
853
+ _context10.next = 15;
854
+ return _context10.t0.DeleteMetadata.call(_context10.t0, _context10.t5);
855
+ case 15:
864
856
  case "end":
865
- return _context0.stop();
857
+ return _context10.stop();
866
858
  }
867
- }, _callee0, this);
859
+ }, _callee10, this);
868
860
  }));
869
- function RemoveProfile(_x0) {
861
+ function RemoveProfile(_x10) {
870
862
  return _RemoveProfile.apply(this, arguments);
871
863
  }
872
864
  return RemoveProfile;
@@ -883,72 +875,71 @@ var PermissionsClient = /*#__PURE__*/function () {
883
875
  *
884
876
  * @return {Promise<Array>} - The list of permissions for the specified item
885
877
  */
886
- )
887
878
  }, {
888
879
  key: "ItemPermissions",
889
- value: (function () {
890
- var _ItemPermissions = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee10(_ref1) {
880
+ value: function () {
881
+ var _ItemPermissions = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(_ref11) {
891
882
  var _this3 = this;
892
- var policyId, policyWriteToken, itemId, libraryId, permissions, _t62;
893
- return _regeneratorRuntime.wrap(function (_context10) {
894
- while (1) switch (_context10.prev = _context10.next) {
883
+ var policyId, policyWriteToken, itemId, libraryId, permissions;
884
+ return _regeneratorRuntime.wrap(function _callee12$(_context12) {
885
+ while (1) switch (_context12.prev = _context12.next) {
895
886
  case 0:
896
- policyId = _ref1.policyId, policyWriteToken = _ref1.policyWriteToken, itemId = _ref1.itemId;
897
- _context10.next = 1;
887
+ policyId = _ref11.policyId, policyWriteToken = _ref11.policyWriteToken, itemId = _ref11.itemId;
888
+ _context12.next = 3;
898
889
  return this.client.ContentObjectLibraryId({
899
890
  objectId: policyId
900
891
  });
901
- case 1:
902
- libraryId = _context10.sent;
903
- _context10.next = 2;
892
+ case 3:
893
+ libraryId = _context12.sent;
894
+ _context12.next = 6;
904
895
  return this.client.ContentObjectMetadata({
905
896
  libraryId: libraryId,
906
897
  objectId: policyId,
907
898
  writeToken: policyWriteToken,
908
899
  metadataSubtree: UrlJoin("auth_policy_spec", itemId, "permissions")
909
900
  });
910
- case 2:
911
- _t62 = _context10.sent;
912
- if (_t62) {
913
- _context10.next = 3;
901
+ case 6:
902
+ _context12.t0 = _context12.sent;
903
+ if (_context12.t0) {
904
+ _context12.next = 9;
914
905
  break;
915
906
  }
916
- _t62 = [];
917
- case 3:
918
- permissions = _t62;
919
- _context10.next = 4;
920
- return Promise.all(permissions.map(/*#__PURE__*/function () {
921
- var _ref10 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee1(permission) {
922
- return _regeneratorRuntime.wrap(function (_context1) {
923
- while (1) switch (_context1.prev = _context1.next) {
907
+ _context12.t0 = [];
908
+ case 9:
909
+ permissions = _context12.t0;
910
+ _context12.next = 12;
911
+ return Promise.all(permissions.map( /*#__PURE__*/function () {
912
+ var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(permission) {
913
+ return _regeneratorRuntime.wrap(function _callee11$(_context11) {
914
+ while (1) switch (_context11.prev = _context11.next) {
924
915
  case 0:
925
- _context1.next = 1;
916
+ _context11.next = 2;
926
917
  return _this3.FormatPermission({
927
918
  policyId: policyId,
928
919
  policyWriteToken: policyWriteToken,
929
920
  permission: permission
930
921
  });
931
- case 1:
932
- return _context1.abrupt("return", _context1.sent);
933
922
  case 2:
923
+ return _context11.abrupt("return", _context11.sent);
924
+ case 3:
934
925
  case "end":
935
- return _context1.stop();
926
+ return _context11.stop();
936
927
  }
937
- }, _callee1);
928
+ }, _callee11);
938
929
  }));
939
- return function (_x10) {
940
- return _ref10.apply(this, arguments);
930
+ return function (_x12) {
931
+ return _ref12.apply(this, arguments);
941
932
  };
942
933
  }()));
943
- case 4:
944
- return _context10.abrupt("return", _context10.sent);
945
- case 5:
934
+ case 12:
935
+ return _context12.abrupt("return", _context12.sent);
936
+ case 13:
946
937
  case "end":
947
- return _context10.stop();
938
+ return _context12.stop();
948
939
  }
949
- }, _callee10, this);
940
+ }, _callee12, this);
950
941
  }));
951
- function ItemPermissions(_x1) {
942
+ function ItemPermissions(_x11) {
952
943
  return _ItemPermissions.apply(this, arguments);
953
944
  }
954
945
  return ItemPermissions;
@@ -970,16 +961,15 @@ var PermissionsClient = /*#__PURE__*/function () {
970
961
  * @param {string | number} start - The start time for the permission
971
962
  * @param {string | number} end - The end time for the permission
972
963
  */
973
- )
974
964
  }, {
975
965
  key: "SetPermission",
976
- value: (function () {
977
- var _SetPermission = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee11(_ref11) {
978
- var policyId, policyWriteToken, itemId, _ref11$subjectSource, subjectSource, _ref11$subjectType, subjectType, subjectName, subjectId, subjectNTPId, profileName, start, end, offlineDraft, policyLibraryId, existingPermissions, index, permissionSpec, subjectInfo, newMeta, userInfo, _newMeta, _userInfo;
979
- return _regeneratorRuntime.wrap(function (_context11) {
980
- while (1) switch (_context11.prev = _context11.next) {
966
+ value: function () {
967
+ var _SetPermission = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(_ref13) {
968
+ var policyId, policyWriteToken, itemId, _ref13$subjectSource, subjectSource, _ref13$subjectType, subjectType, subjectName, subjectId, subjectNTPId, profileName, start, end, offlineDraft, policyLibraryId, existingPermissions, index, permissionSpec, subjectInfo, newMeta, userInfo, _newMeta, _userInfo;
969
+ return _regeneratorRuntime.wrap(function _callee13$(_context13) {
970
+ while (1) switch (_context13.prev = _context13.next) {
981
971
  case 0:
982
- policyId = _ref11.policyId, policyWriteToken = _ref11.policyWriteToken, itemId = _ref11.itemId, _ref11$subjectSource = _ref11.subjectSource, subjectSource = _ref11$subjectSource === void 0 ? "fabric" : _ref11$subjectSource, _ref11$subjectType = _ref11.subjectType, subjectType = _ref11$subjectType === void 0 ? "group" : _ref11$subjectType, subjectName = _ref11.subjectName, subjectId = _ref11.subjectId, subjectNTPId = _ref11.subjectNTPId, profileName = _ref11.profileName, start = _ref11.start, end = _ref11.end;
972
+ policyId = _ref13.policyId, policyWriteToken = _ref13.policyWriteToken, itemId = _ref13.itemId, _ref13$subjectSource = _ref13.subjectSource, subjectSource = _ref13$subjectSource === void 0 ? "fabric" : _ref13$subjectSource, _ref13$subjectType = _ref13.subjectType, subjectType = _ref13$subjectType === void 0 ? "group" : _ref13$subjectType, subjectName = _ref13.subjectName, subjectId = _ref13.subjectId, subjectNTPId = _ref13.subjectNTPId, profileName = _ref13.profileName, start = _ref13.start, end = _ref13.end;
983
973
  ValidatePresence("policyId", policyId);
984
974
  ValidatePresence("policyWriteToken", policyWriteToken);
985
975
  ValidatePresence("itemId", itemId);
@@ -994,16 +984,16 @@ var PermissionsClient = /*#__PURE__*/function () {
994
984
  offlineDraft = this.offline && this.drafts[policyId] != null;
995
985
  policyLibraryId = null;
996
986
  if (offlineDraft) {
997
- _context11.next = 2;
987
+ _context13.next = 16;
998
988
  break;
999
989
  }
1000
- _context11.next = 1;
990
+ _context13.next = 15;
1001
991
  return this.client.ContentObjectLibraryId({
1002
992
  objectId: policyId
1003
993
  });
1004
- case 1:
1005
- policyLibraryId = _context11.sent;
1006
- case 2:
994
+ case 15:
995
+ policyLibraryId = _context13.sent;
996
+ case 16:
1007
997
  // Allow address to be passed in for fabric subjects, though spec requires iusr/igrp hash
1008
998
  if (subjectSource === "fabric") {
1009
999
  if (subjectType === "group") {
@@ -1017,35 +1007,35 @@ var PermissionsClient = /*#__PURE__*/function () {
1017
1007
  }
1018
1008
  }
1019
1009
  if (!offlineDraft) {
1020
- _context11.next = 3;
1010
+ _context13.next = 21;
1021
1011
  break;
1022
1012
  }
1023
1013
  existingPermissions = this.drafts[policyId].meta["auth_policy_spec"][itemId];
1024
- _context11.next = 5;
1014
+ _context13.next = 24;
1025
1015
  break;
1026
- case 3:
1027
- _context11.next = 4;
1016
+ case 21:
1017
+ _context13.next = 23;
1028
1018
  return this.client.ContentObjectMetadata({
1029
1019
  libraryId: policyLibraryId,
1030
1020
  objectId: policyId,
1031
1021
  writeToken: policyWriteToken,
1032
1022
  metadataSubtree: UrlJoin("auth_policy_spec", itemId)
1033
1023
  });
1034
- case 4:
1035
- existingPermissions = _context11.sent;
1036
- case 5:
1024
+ case 23:
1025
+ existingPermissions = _context13.sent;
1026
+ case 24:
1037
1027
  if (existingPermissions) {
1038
- _context11.next = 6;
1028
+ _context13.next = 26;
1039
1029
  break;
1040
1030
  }
1041
1031
  throw Error("Unable to add permissions to uninitialized item");
1042
- case 6:
1032
+ case 26:
1043
1033
  if (existingPermissions.profiles[profileName]) {
1044
- _context11.next = 7;
1034
+ _context13.next = 28;
1045
1035
  break;
1046
1036
  }
1047
1037
  throw Error("Profile '".concat(profileName, "' does not exist"));
1048
- case 7:
1038
+ case 28:
1049
1039
  index = existingPermissions.permissions.findIndex(function (permission) {
1050
1040
  if (subjectSource === "fabric") {
1051
1041
  return permission.subject.id === subjectId;
@@ -1066,44 +1056,44 @@ var PermissionsClient = /*#__PURE__*/function () {
1066
1056
  permissionSpec.end = end;
1067
1057
  }
1068
1058
  if (!(subjectSource === "fabric")) {
1069
- _context11.next = 13;
1059
+ _context13.next = 53;
1070
1060
  break;
1071
1061
  }
1072
1062
  if (!(subjectType === "group")) {
1073
- _context11.next = 8;
1063
+ _context13.next = 38;
1074
1064
  break;
1075
1065
  }
1076
1066
  subjectInfo = {
1077
1067
  id: subjectId,
1078
1068
  type: "group"
1079
1069
  };
1080
- _context11.next = 12;
1070
+ _context13.next = 51;
1081
1071
  break;
1082
- case 8:
1072
+ case 38:
1083
1073
  if (!(subjectType === "user")) {
1084
- _context11.next = 9;
1074
+ _context13.next = 42;
1085
1075
  break;
1086
1076
  }
1087
1077
  subjectInfo = {
1088
1078
  id: subjectId,
1089
1079
  type: "user"
1090
1080
  };
1091
- _context11.next = 12;
1081
+ _context13.next = 51;
1092
1082
  break;
1093
- case 9:
1083
+ case 42:
1094
1084
  if (!(subjectType === "ntp")) {
1095
- _context11.next = 10;
1085
+ _context13.next = 46;
1096
1086
  break;
1097
1087
  }
1098
1088
  subjectInfo = {
1099
1089
  id: subjectId,
1100
1090
  type: "otp"
1101
1091
  };
1102
- _context11.next = 12;
1092
+ _context13.next = 51;
1103
1093
  break;
1104
- case 10:
1094
+ case 46:
1105
1095
  if (!(subjectType === "ntp_subject")) {
1106
- _context11.next = 11;
1096
+ _context13.next = 50;
1107
1097
  break;
1108
1098
  }
1109
1099
  subjectInfo = {
@@ -1111,20 +1101,20 @@ var PermissionsClient = /*#__PURE__*/function () {
1111
1101
  otp_id: subjectNTPId,
1112
1102
  type: "otp_subject"
1113
1103
  };
1114
- _context11.next = 12;
1104
+ _context13.next = 51;
1115
1105
  break;
1116
- case 11:
1106
+ case 50:
1117
1107
  throw Error("Invalid subject type: ".concat(subjectType));
1118
- case 12:
1119
- _context11.next = 18;
1108
+ case 51:
1109
+ _context13.next = 66;
1120
1110
  break;
1121
- case 13:
1111
+ case 53:
1122
1112
  if (!(subjectSource === "oauth")) {
1123
- _context11.next = 17;
1113
+ _context13.next = 65;
1124
1114
  break;
1125
1115
  }
1126
1116
  if (!(subjectType === "group")) {
1127
- _context11.next = 14;
1117
+ _context13.next = 58;
1128
1118
  break;
1129
1119
  }
1130
1120
  subjectInfo = {
@@ -1132,11 +1122,11 @@ var PermissionsClient = /*#__PURE__*/function () {
1132
1122
  oauth_id: subjectId,
1133
1123
  type: "oauth_group"
1134
1124
  };
1135
- _context11.next = 16;
1125
+ _context13.next = 63;
1136
1126
  break;
1137
- case 14:
1127
+ case 58:
1138
1128
  if (!(subjectType === "user")) {
1139
- _context11.next = 15;
1129
+ _context13.next = 62;
1140
1130
  break;
1141
1131
  }
1142
1132
  subjectInfo = {
@@ -1144,23 +1134,23 @@ var PermissionsClient = /*#__PURE__*/function () {
1144
1134
  oauth_id: subjectId,
1145
1135
  type: "oauth_user"
1146
1136
  };
1147
- _context11.next = 16;
1137
+ _context13.next = 63;
1148
1138
  break;
1149
- case 15:
1139
+ case 62:
1150
1140
  throw Error("Invalid subject type: ".concat(subjectType));
1151
- case 16:
1152
- _context11.next = 18;
1141
+ case 63:
1142
+ _context13.next = 66;
1153
1143
  break;
1154
- case 17:
1144
+ case 65:
1155
1145
  throw Error("Invalid subject source: ".concat(subjectSource));
1156
- case 18:
1146
+ case 66:
1157
1147
  permissionSpec.subject = subjectInfo;
1158
1148
  existingPermissions.permissions[index] = permissionSpec;
1159
1149
  if (offlineDraft) {
1160
- _context11.next = 19;
1150
+ _context13.next = 71;
1161
1151
  break;
1162
1152
  }
1163
- _context11.next = 19;
1153
+ _context13.next = 71;
1164
1154
  return this.client.ReplaceMetadata({
1165
1155
  libraryId: policyLibraryId,
1166
1156
  objectId: policyId,
@@ -1168,9 +1158,9 @@ var PermissionsClient = /*#__PURE__*/function () {
1168
1158
  metadataSubtree: UrlJoin("auth_policy_spec", itemId, "permissions"),
1169
1159
  metadata: existingPermissions.permissions
1170
1160
  });
1171
- case 19:
1161
+ case 71:
1172
1162
  if (!(subjectSource === "fabric" && subjectType === "user")) {
1173
- _context11.next = 23;
1163
+ _context13.next = 85;
1174
1164
  break;
1175
1165
  }
1176
1166
  newMeta = {
@@ -1178,27 +1168,27 @@ var PermissionsClient = /*#__PURE__*/function () {
1178
1168
  name: subjectName
1179
1169
  };
1180
1170
  if (!offlineDraft) {
1181
- _context11.next = 20;
1171
+ _context13.next = 77;
1182
1172
  break;
1183
1173
  }
1184
1174
  this.drafts[policyId].meta["auth_policy_settings"]["fabric_users"][this.client.utils.HashToAddress(subjectId)] = newMeta;
1185
- _context11.next = 22;
1175
+ _context13.next = 83;
1186
1176
  break;
1187
- case 20:
1188
- _context11.next = 21;
1177
+ case 77:
1178
+ _context13.next = 79;
1189
1179
  return this.client.ContentObjectMetadata({
1190
1180
  libraryId: policyLibraryId,
1191
1181
  objectId: policyId,
1192
1182
  writeToken: policyWriteToken,
1193
1183
  metadataSubtree: UrlJoin("auth_policy_settings", "fabric_users", this.client.utils.HashToAddress(subjectId))
1194
1184
  });
1195
- case 21:
1196
- userInfo = _context11.sent;
1185
+ case 79:
1186
+ userInfo = _context13.sent;
1197
1187
  if (userInfo) {
1198
- _context11.next = 22;
1188
+ _context13.next = 83;
1199
1189
  break;
1200
1190
  }
1201
- _context11.next = 22;
1191
+ _context13.next = 83;
1202
1192
  return this.client.ReplaceMetadata({
1203
1193
  libraryId: policyLibraryId,
1204
1194
  objectId: policyId,
@@ -1206,12 +1196,12 @@ var PermissionsClient = /*#__PURE__*/function () {
1206
1196
  metadataSubtree: UrlJoin("auth_policy_settings", "fabric_users", this.client.utils.HashToAddress(subjectId)),
1207
1197
  metadata: newMeta
1208
1198
  });
1209
- case 22:
1210
- _context11.next = 26;
1199
+ case 83:
1200
+ _context13.next = 97;
1211
1201
  break;
1212
- case 23:
1202
+ case 85:
1213
1203
  if (!(subjectSource === "fabric" && subjectType === "ntp")) {
1214
- _context11.next = 26;
1204
+ _context13.next = 97;
1215
1205
  break;
1216
1206
  }
1217
1207
  _newMeta = {
@@ -1221,27 +1211,27 @@ var PermissionsClient = /*#__PURE__*/function () {
1221
1211
  type: "ntpInstance"
1222
1212
  };
1223
1213
  if (!offlineDraft) {
1224
- _context11.next = 24;
1214
+ _context13.next = 91;
1225
1215
  break;
1226
1216
  }
1227
1217
  this.drafts[policyId].meta["auth_policy_settings"]["ntp_instances"][subjectId] = _newMeta;
1228
- _context11.next = 26;
1218
+ _context13.next = 97;
1229
1219
  break;
1230
- case 24:
1231
- _context11.next = 25;
1220
+ case 91:
1221
+ _context13.next = 93;
1232
1222
  return this.client.ContentObjectMetadata({
1233
1223
  libraryId: policyLibraryId,
1234
1224
  objectId: policyId,
1235
1225
  writeToken: policyWriteToken,
1236
1226
  metadataSubtree: UrlJoin("auth_policy_settings", "ntp_instances", subjectId)
1237
1227
  });
1238
- case 25:
1239
- _userInfo = _context11.sent;
1228
+ case 93:
1229
+ _userInfo = _context13.sent;
1240
1230
  if (_userInfo) {
1241
- _context11.next = 26;
1231
+ _context13.next = 97;
1242
1232
  break;
1243
1233
  }
1244
- _context11.next = 26;
1234
+ _context13.next = 97;
1245
1235
  return this.client.ReplaceMetadata({
1246
1236
  libraryId: policyLibraryId,
1247
1237
  objectId: policyId,
@@ -1249,13 +1239,13 @@ var PermissionsClient = /*#__PURE__*/function () {
1249
1239
  metadataSubtree: UrlJoin("auth_policy_settings", "ntp_instances", subjectId),
1250
1240
  metadata: _newMeta
1251
1241
  });
1252
- case 26:
1242
+ case 97:
1253
1243
  case "end":
1254
- return _context11.stop();
1244
+ return _context13.stop();
1255
1245
  }
1256
- }, _callee11, this);
1246
+ }, _callee13, this);
1257
1247
  }));
1258
- function SetPermission(_x11) {
1248
+ function SetPermission(_x13) {
1259
1249
  return _SetPermission.apply(this, arguments);
1260
1250
  }
1261
1251
  return SetPermission;
@@ -1270,97 +1260,96 @@ var PermissionsClient = /*#__PURE__*/function () {
1270
1260
  * @param {string} itemId - Object ID of the item
1271
1261
  * @param {string} subjectId - The ID of the subject
1272
1262
  */
1273
- )
1274
1263
  }, {
1275
1264
  key: "RemovePermission",
1276
- value: (function () {
1277
- var _RemovePermission = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee13(_ref12) {
1265
+ value: function () {
1266
+ var _RemovePermission = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(_ref14) {
1278
1267
  var _this4 = this;
1279
- var policyId, policyWriteToken, itemId, subjectId, policyLibraryId, permissions, id, _t63;
1280
- return _regeneratorRuntime.wrap(function (_context13) {
1281
- while (1) switch (_context13.prev = _context13.next) {
1268
+ var policyId, policyWriteToken, itemId, subjectId, policyLibraryId, permissions, id;
1269
+ return _regeneratorRuntime.wrap(function _callee15$(_context15) {
1270
+ while (1) switch (_context15.prev = _context15.next) {
1282
1271
  case 0:
1283
- policyId = _ref12.policyId, policyWriteToken = _ref12.policyWriteToken, itemId = _ref12.itemId, subjectId = _ref12.subjectId;
1272
+ policyId = _ref14.policyId, policyWriteToken = _ref14.policyWriteToken, itemId = _ref14.itemId, subjectId = _ref14.subjectId;
1284
1273
  ValidatePresence("policyId", policyId);
1285
1274
  ValidatePresence("policyWriteToken", policyWriteToken);
1286
1275
  ValidatePresence("itemId", itemId);
1287
1276
  ValidatePresence("subjectId", subjectId);
1288
- _context13.next = 1;
1277
+ _context15.next = 7;
1289
1278
  return this.client.ContentObjectLibraryId({
1290
1279
  objectId: policyId
1291
1280
  });
1292
- case 1:
1293
- policyLibraryId = _context13.sent;
1294
- _context13.next = 2;
1281
+ case 7:
1282
+ policyLibraryId = _context15.sent;
1283
+ _context15.next = 10;
1295
1284
  return this.client.ContentObjectMetadata({
1296
1285
  libraryId: policyLibraryId,
1297
1286
  objectId: policyId,
1298
1287
  writeToken: policyWriteToken,
1299
1288
  metadataSubtree: UrlJoin("auth_policy_spec", itemId, "permissions")
1300
1289
  });
1301
- case 2:
1302
- permissions = _context13.sent;
1290
+ case 10:
1291
+ permissions = _context15.sent;
1303
1292
  if (permissions) {
1304
- _context13.next = 3;
1293
+ _context15.next = 13;
1305
1294
  break;
1306
1295
  }
1307
- return _context13.abrupt("return");
1308
- case 3:
1296
+ return _context15.abrupt("return");
1297
+ case 13:
1309
1298
  if (!subjectId.startsWith("0x")) {
1310
- _context13.next = 6;
1299
+ _context15.next = 23;
1311
1300
  break;
1312
1301
  }
1313
1302
  id = this.client.utils.AddressToObjectId(subjectId);
1314
- _context13.next = 4;
1303
+ _context15.next = 17;
1315
1304
  return this.client.AccessType({
1316
1305
  id: id
1317
1306
  });
1318
- case 4:
1319
- _t63 = _context13.sent;
1320
- if (!(_t63 === "group")) {
1321
- _context13.next = 5;
1307
+ case 17:
1308
+ _context15.t0 = _context15.sent;
1309
+ if (!(_context15.t0 === "group")) {
1310
+ _context15.next = 22;
1322
1311
  break;
1323
1312
  }
1324
1313
  subjectId = "igrp".concat(this.client.utils.AddressToHash(subjectId));
1325
- _context13.next = 6;
1314
+ _context15.next = 23;
1326
1315
  break;
1327
- case 5:
1316
+ case 22:
1328
1317
  subjectId = "iusr".concat(this.client.utils.AddressToHash(subjectId));
1329
- case 6:
1330
- _context13.next = 7;
1331
- return Promise.all(permissions.map(/*#__PURE__*/function () {
1332
- var _ref13 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee12(permission, index) {
1333
- return _regeneratorRuntime.wrap(function (_context12) {
1334
- while (1) switch (_context12.prev = _context12.next) {
1318
+ case 23:
1319
+ _context15.next = 25;
1320
+ return Promise.all(permissions.map( /*#__PURE__*/function () {
1321
+ var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(permission, index) {
1322
+ return _regeneratorRuntime.wrap(function _callee14$(_context14) {
1323
+ while (1) switch (_context14.prev = _context14.next) {
1335
1324
  case 0:
1336
1325
  if (!(permission.subject.id === subjectId || permission.subject.oauth_id === subjectId)) {
1337
- _context12.next = 1;
1326
+ _context14.next = 3;
1338
1327
  break;
1339
1328
  }
1340
- _context12.next = 1;
1329
+ _context14.next = 3;
1341
1330
  return _this4.client.DeleteMetadata({
1342
1331
  libraryId: policyLibraryId,
1343
1332
  objectId: policyId,
1344
1333
  writeToken: policyWriteToken,
1345
1334
  metadataSubtree: UrlJoin("auth_policy_spec", itemId, "permissions", index.toString())
1346
1335
  });
1347
- case 1:
1336
+ case 3:
1348
1337
  case "end":
1349
- return _context12.stop();
1338
+ return _context14.stop();
1350
1339
  }
1351
- }, _callee12);
1340
+ }, _callee14);
1352
1341
  }));
1353
- return function (_x13, _x14) {
1354
- return _ref13.apply(this, arguments);
1342
+ return function (_x15, _x16) {
1343
+ return _ref15.apply(this, arguments);
1355
1344
  };
1356
1345
  }()));
1357
- case 7:
1346
+ case 25:
1358
1347
  case "end":
1359
- return _context13.stop();
1348
+ return _context15.stop();
1360
1349
  }
1361
- }, _callee13, this);
1350
+ }, _callee15, this);
1362
1351
  }));
1363
- function RemovePermission(_x12) {
1352
+ function RemovePermission(_x14) {
1364
1353
  return _RemovePermission.apply(this, arguments);
1365
1354
  }
1366
1355
  return RemovePermission;
@@ -1376,112 +1365,111 @@ var PermissionsClient = /*#__PURE__*/function () {
1376
1365
  *
1377
1366
  * @returns {Object} - All permissions pertaining to the given subject. Format of result for each item is identical to the format of `ItemPolicy`
1378
1367
  */
1379
- )
1380
1368
  }, {
1381
1369
  key: "SubjectPermissions",
1382
- value: (function () {
1383
- var _SubjectPermissions = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee15(_ref14) {
1370
+ value: function () {
1371
+ var _SubjectPermissions = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17(_ref16) {
1384
1372
  var _this5 = this;
1385
- var policyId, policyWriteToken, subjectId, id, policyLibraryId, policy, allSubjectPermissions, _i, _Object$keys, itemId, itemPermissions, subjectPermissions, _t64;
1386
- return _regeneratorRuntime.wrap(function (_context15) {
1387
- while (1) switch (_context15.prev = _context15.next) {
1373
+ var policyId, policyWriteToken, subjectId, id, policyLibraryId, policy, allSubjectPermissions, _i, _Object$keys, itemId, itemPermissions, subjectPermissions;
1374
+ return _regeneratorRuntime.wrap(function _callee17$(_context17) {
1375
+ while (1) switch (_context17.prev = _context17.next) {
1388
1376
  case 0:
1389
- policyId = _ref14.policyId, policyWriteToken = _ref14.policyWriteToken, subjectId = _ref14.subjectId;
1377
+ policyId = _ref16.policyId, policyWriteToken = _ref16.policyWriteToken, subjectId = _ref16.subjectId;
1390
1378
  ValidatePresence("policyId", policyId);
1391
1379
  ValidatePresence("subjectId", subjectId);
1392
1380
 
1393
1381
  // Convert address to appropriate ID
1394
1382
  if (!subjectId.startsWith("0x")) {
1395
- _context15.next = 3;
1383
+ _context17.next = 13;
1396
1384
  break;
1397
1385
  }
1398
1386
  id = this.client.utils.AddressToObjectId(subjectId);
1399
- _context15.next = 1;
1387
+ _context17.next = 7;
1400
1388
  return this.client.AccessType({
1401
1389
  id: id
1402
1390
  });
1403
- case 1:
1404
- _t64 = _context15.sent;
1405
- if (!(_t64 === "group")) {
1406
- _context15.next = 2;
1391
+ case 7:
1392
+ _context17.t0 = _context17.sent;
1393
+ if (!(_context17.t0 === "group")) {
1394
+ _context17.next = 12;
1407
1395
  break;
1408
1396
  }
1409
1397
  subjectId = "igrp".concat(this.client.utils.AddressToHash(subjectId));
1410
- _context15.next = 3;
1398
+ _context17.next = 13;
1411
1399
  break;
1412
- case 2:
1400
+ case 12:
1413
1401
  subjectId = "iusr".concat(this.client.utils.AddressToHash(subjectId));
1414
- case 3:
1415
- _context15.next = 4;
1402
+ case 13:
1403
+ _context17.next = 15;
1416
1404
  return this.client.ContentObjectLibraryId({
1417
1405
  objectId: policyId
1418
1406
  });
1419
- case 4:
1420
- policyLibraryId = _context15.sent;
1421
- _context15.next = 5;
1407
+ case 15:
1408
+ policyLibraryId = _context17.sent;
1409
+ _context17.next = 18;
1422
1410
  return this.client.ContentObjectMetadata({
1423
1411
  libraryId: policyLibraryId,
1424
1412
  objectId: policyId,
1425
1413
  writeToken: policyWriteToken,
1426
1414
  metadataSubtree: UrlJoin("auth_policy_spec")
1427
1415
  });
1428
- case 5:
1429
- policy = _context15.sent;
1416
+ case 18:
1417
+ policy = _context17.sent;
1430
1418
  allSubjectPermissions = {};
1431
1419
  _i = 0, _Object$keys = Object.keys(policy);
1432
- case 6:
1420
+ case 21:
1433
1421
  if (!(_i < _Object$keys.length)) {
1434
- _context15.next = 9;
1422
+ _context17.next = 31;
1435
1423
  break;
1436
1424
  }
1437
1425
  itemId = _Object$keys[_i];
1438
1426
  itemPermissions = policy[itemId].permissions || [];
1439
- _context15.next = 7;
1427
+ _context17.next = 26;
1440
1428
  return Promise.all(itemPermissions.filter(function (permission) {
1441
1429
  return (permission.subject || {}).oauth_id === subjectId || (permission.subject || {}).id === subjectId;
1442
- }).map(/*#__PURE__*/function () {
1443
- var _ref15 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee14(permission) {
1444
- return _regeneratorRuntime.wrap(function (_context14) {
1445
- while (1) switch (_context14.prev = _context14.next) {
1430
+ }).map( /*#__PURE__*/function () {
1431
+ var _ref17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(permission) {
1432
+ return _regeneratorRuntime.wrap(function _callee16$(_context16) {
1433
+ while (1) switch (_context16.prev = _context16.next) {
1446
1434
  case 0:
1447
- _context14.next = 1;
1435
+ _context16.next = 2;
1448
1436
  return _this5.FormatPermission({
1449
1437
  policyId: policyId,
1450
1438
  policyWriteToken: policyWriteToken,
1451
1439
  permission: permission
1452
1440
  });
1453
- case 1:
1454
- return _context14.abrupt("return", _context14.sent);
1455
1441
  case 2:
1442
+ return _context16.abrupt("return", _context16.sent);
1443
+ case 3:
1456
1444
  case "end":
1457
- return _context14.stop();
1445
+ return _context16.stop();
1458
1446
  }
1459
- }, _callee14);
1447
+ }, _callee16);
1460
1448
  }));
1461
- return function (_x16) {
1462
- return _ref15.apply(this, arguments);
1449
+ return function (_x18) {
1450
+ return _ref17.apply(this, arguments);
1463
1451
  };
1464
1452
  }()));
1465
- case 7:
1466
- subjectPermissions = _context15.sent;
1453
+ case 26:
1454
+ subjectPermissions = _context17.sent;
1467
1455
  if (subjectPermissions.length > 0) {
1468
1456
  allSubjectPermissions[itemId] = _objectSpread(_objectSpread({}, policy[itemId]), {}, {
1469
1457
  permissions: subjectPermissions
1470
1458
  });
1471
1459
  }
1472
- case 8:
1460
+ case 28:
1473
1461
  _i++;
1474
- _context15.next = 6;
1462
+ _context17.next = 21;
1475
1463
  break;
1476
- case 9:
1477
- return _context15.abrupt("return", allSubjectPermissions);
1478
- case 10:
1464
+ case 31:
1465
+ return _context17.abrupt("return", allSubjectPermissions);
1466
+ case 32:
1479
1467
  case "end":
1480
- return _context15.stop();
1468
+ return _context17.stop();
1481
1469
  }
1482
- }, _callee15, this);
1470
+ }, _callee17, this);
1483
1471
  }));
1484
- function SubjectPermissions(_x15) {
1472
+ function SubjectPermissions(_x17) {
1485
1473
  return _SubjectPermissions.apply(this, arguments);
1486
1474
  }
1487
1475
  return SubjectPermissions;
@@ -1495,62 +1483,62 @@ var PermissionsClient = /*#__PURE__*/function () {
1495
1483
  * @param {string} policyWriteToken - Write token for the policy
1496
1484
  * @param {string} subjectId - The ID of the subject
1497
1485
  */
1498
- )
1499
1486
  }, {
1500
1487
  key: "RemoveSubjectPermissions",
1501
- value: (function () {
1502
- var _RemoveSubjectPermissions = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee17(_ref16) {
1488
+ value: function () {
1489
+ var _RemoveSubjectPermissions = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19(_ref18) {
1503
1490
  var _this6 = this;
1504
1491
  var policyId, policyWriteToken, subjectId, subjectPermissions;
1505
- return _regeneratorRuntime.wrap(function (_context17) {
1506
- while (1) switch (_context17.prev = _context17.next) {
1492
+ return _regeneratorRuntime.wrap(function _callee19$(_context19) {
1493
+ while (1) switch (_context19.prev = _context19.next) {
1507
1494
  case 0:
1508
- policyId = _ref16.policyId, policyWriteToken = _ref16.policyWriteToken, subjectId = _ref16.subjectId;
1495
+ policyId = _ref18.policyId, policyWriteToken = _ref18.policyWriteToken, subjectId = _ref18.subjectId;
1509
1496
  ValidatePresence("policyId", policyId);
1510
1497
  ValidatePresence("policyWriteToken", policyWriteToken);
1511
1498
  ValidatePresence("subjectId", subjectId);
1512
- _context17.next = 1;
1499
+ _context19.next = 6;
1513
1500
  return this.SubjectPermissions({
1514
1501
  policyId: policyId,
1515
1502
  policyWriteToken: policyWriteToken,
1516
1503
  subjectId: subjectId
1517
1504
  });
1518
- case 1:
1519
- subjectPermissions = _context17.sent;
1520
- _context17.next = 2;
1505
+ case 6:
1506
+ subjectPermissions = _context19.sent;
1507
+ _context19.next = 9;
1521
1508
  return this.client.utils.LimitedMap(5, Object.keys(subjectPermissions), /*#__PURE__*/function () {
1522
- var _ref17 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee16(itemId) {
1523
- return _regeneratorRuntime.wrap(function (_context16) {
1524
- while (1) switch (_context16.prev = _context16.next) {
1509
+ var _ref19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(itemId) {
1510
+ return _regeneratorRuntime.wrap(function _callee18$(_context18) {
1511
+ while (1) switch (_context18.prev = _context18.next) {
1525
1512
  case 0:
1526
- _context16.next = 1;
1513
+ _context18.next = 2;
1527
1514
  return _this6.RemovePermission({
1528
1515
  policyId: policyId,
1529
1516
  policyWriteToken: policyWriteToken,
1530
1517
  subjectId: subjectId,
1531
1518
  itemId: itemId
1532
1519
  });
1533
- case 1:
1520
+ case 2:
1534
1521
  case "end":
1535
- return _context16.stop();
1522
+ return _context18.stop();
1536
1523
  }
1537
- }, _callee16);
1524
+ }, _callee18);
1538
1525
  }));
1539
- return function (_x18) {
1540
- return _ref17.apply(this, arguments);
1526
+ return function (_x20) {
1527
+ return _ref19.apply(this, arguments);
1541
1528
  };
1542
1529
  }());
1543
- case 2:
1530
+ case 9:
1544
1531
  case "end":
1545
- return _context17.stop();
1532
+ return _context19.stop();
1546
1533
  }
1547
- }, _callee17, this);
1534
+ }, _callee19, this);
1548
1535
  }));
1549
- function RemoveSubjectPermissions(_x17) {
1536
+ function RemoveSubjectPermissions(_x19) {
1550
1537
  return _RemoveSubjectPermissions.apply(this, arguments);
1551
1538
  }
1552
1539
  return RemoveSubjectPermissions;
1553
- }())
1540
+ }()
1554
1541
  }]);
1542
+ return PermissionsClient;
1555
1543
  }();
1556
1544
  module.exports = PermissionsClient;