@eluvio/elv-client-js 4.2.6 → 4.2.7

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