@eluvio/elv-client-js 4.0.46 → 4.0.47

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.
@@ -3245,6 +3245,175 @@ exports.ContentObjectImageUrl = /*#__PURE__*/function () {
3245
3245
  };
3246
3246
  }();
3247
3247
 
3248
+ /**
3249
+ * Get an embed URL for the specified object
3250
+ *
3251
+ * @methodGroup URL Generation
3252
+ * @namedParams
3253
+ * @param {string} objectId - ID of the object
3254
+ * @param {string} versionHash - Version hash of the object
3255
+ * @param {number} duration - Time until the token expires, in milliseconds (1 day = 24 * 60 * 60 * 1000 = 86400000)
3256
+ * @param {Object} options - Additional video/player options
3257
+ * autoplay - If enabled, video will autoplay
3258
+ * capLevelToPlayerSize - Caps video quality to player size
3259
+ * clipEnd - End time for the video
3260
+ * clipStart - Start time for the video
3261
+ * controls - Sets the player control visibility. Values: browserDefault | autoHide | show | hide | hideWithVolume. Defaults to autoHide
3262
+ * description - Sets the page description
3263
+ * directLink - If enabled, sets direct link
3264
+ * linkPath - Video link path
3265
+ * loop - If enabled, video will loop
3266
+ * muted - Mutes the player
3267
+ * offerings - Offerings to play, as an array
3268
+ * posterUrl - URL of the player poster image
3269
+ * protocols - Video protocols, as an array
3270
+ * showShare - Show social media share buttons
3271
+ * showTitle - Shows the video title, which is set from the title option (if set) or the metadata
3272
+ * title - Sets the page title
3273
+ * viewRecordKey - Contains record key
3274
+ *
3275
+ * @returns {Promise<string>} - Will return an embed URL
3276
+ */
3277
+ exports.EmbedUrl = /*#__PURE__*/function () {
3278
+ var _ref73 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee41(_ref72) {
3279
+ var objectId, versionHash, _ref72$duration, duration, _ref72$options, options, controlsMap, embedUrl, networkInfo, networkName, permission, data, _i, _Object$keys, option, token;
3280
+ return _regeneratorRuntime.wrap(function _callee41$(_context41) {
3281
+ while (1) switch (_context41.prev = _context41.next) {
3282
+ case 0:
3283
+ objectId = _ref72.objectId, versionHash = _ref72.versionHash, _ref72$duration = _ref72.duration, duration = _ref72$duration === void 0 ? 86400000 : _ref72$duration, _ref72$options = _ref72.options, options = _ref72$options === void 0 ? {} : _ref72$options;
3284
+ if (versionHash) {
3285
+ ValidateVersion(versionHash);
3286
+ } else if (objectId) {
3287
+ ValidateObject(objectId);
3288
+ }
3289
+
3290
+ // Default options
3291
+ options.controls = options.controls === undefined ? "autoHide" : options.controls;
3292
+ controlsMap = {
3293
+ autoHide: "h",
3294
+ browserDefault: "d",
3295
+ show: "s",
3296
+ hideWithVolume: "hv"
3297
+ };
3298
+ embedUrl = new URL("https://embed.v3.contentfabric.io");
3299
+ _context41.next = 7;
3300
+ return this.NetworkInfo();
3301
+ case 7:
3302
+ networkInfo = _context41.sent;
3303
+ networkName = networkInfo.name === "demov3" ? "demo" : networkInfo.name === "test" && networkInfo.id === 955205 ? "testv4" : networkInfo.name;
3304
+ _context41.next = 11;
3305
+ return this.Permission({
3306
+ objectId: objectId ? objectId : this.utils.DecodeVersionHash(versionHash).objectId
3307
+ });
3308
+ case 11:
3309
+ permission = _context41.sent;
3310
+ embedUrl.searchParams.set("p", "");
3311
+ embedUrl.searchParams.set("net", networkName);
3312
+ if (versionHash) {
3313
+ embedUrl.searchParams.set("vid", versionHash);
3314
+ } else if (objectId) {
3315
+ embedUrl.searchParams.set("oid", objectId);
3316
+ }
3317
+ data = {};
3318
+ _i = 0, _Object$keys = Object.keys(options);
3319
+ case 17:
3320
+ if (!(_i < _Object$keys.length)) {
3321
+ _context41.next = 59;
3322
+ break;
3323
+ }
3324
+ option = _Object$keys[_i];
3325
+ _context41.t0 = option;
3326
+ _context41.next = _context41.t0 === "autoplay" ? 22 : _context41.t0 === "capLevelToPlayerSize" ? 24 : _context41.t0 === "clipEnd" ? 26 : _context41.t0 === "clipStart" ? 28 : _context41.t0 === "controls" ? 30 : _context41.t0 === "description" ? 32 : _context41.t0 === "directLink" ? 34 : _context41.t0 === "linkPath" ? 36 : _context41.t0 === "loop" ? 38 : _context41.t0 === "muted" ? 40 : _context41.t0 === "offerings" ? 42 : _context41.t0 === "posterUrl" ? 44 : _context41.t0 === "protocols" ? 46 : _context41.t0 === "showShare" ? 48 : _context41.t0 === "showTitle" ? 50 : _context41.t0 === "title" ? 52 : _context41.t0 === "viewRecordKey" ? 54 : 56;
3327
+ break;
3328
+ case 22:
3329
+ embedUrl.searchParams.set("ap", "");
3330
+ return _context41.abrupt("break", 56);
3331
+ case 24:
3332
+ embedUrl.searchParams.set("cap", "");
3333
+ return _context41.abrupt("break", 56);
3334
+ case 26:
3335
+ embedUrl.searchParams.set("end", options.clipEnd);
3336
+ return _context41.abrupt("break", 56);
3337
+ case 28:
3338
+ embedUrl.searchParams.set("start", options.clipStart);
3339
+ return _context41.abrupt("break", 56);
3340
+ case 30:
3341
+ if (options.controls !== "hide") {
3342
+ embedUrl.searchParams.set("ct", controlsMap[options.controls]);
3343
+ }
3344
+ return _context41.abrupt("break", 56);
3345
+ case 32:
3346
+ data["og:description"] = options.description;
3347
+ return _context41.abrupt("break", 56);
3348
+ case 34:
3349
+ embedUrl.searchParams.set("dr", "");
3350
+ return _context41.abrupt("break", 56);
3351
+ case 36:
3352
+ embedUrl.searchParams.set("ln", this.utils.B64(options.linkPath));
3353
+ return _context41.abrupt("break", 56);
3354
+ case 38:
3355
+ embedUrl.searchParams.set("lp", "");
3356
+ return _context41.abrupt("break", 56);
3357
+ case 40:
3358
+ embedUrl.searchParams.set("m", "");
3359
+ return _context41.abrupt("break", 56);
3360
+ case 42:
3361
+ embedUrl.searchParams.set("off", options.offerings.join(","));
3362
+ return _context41.abrupt("break", 56);
3363
+ case 44:
3364
+ embedUrl.searchParams.set("pst", options.posterUrl);
3365
+ return _context41.abrupt("break", 56);
3366
+ case 46:
3367
+ embedUrl.searchParams.set("ptc", options.protocols.join(","));
3368
+ return _context41.abrupt("break", 56);
3369
+ case 48:
3370
+ embedUrl.searchParams.set("sh", "");
3371
+ return _context41.abrupt("break", 56);
3372
+ case 50:
3373
+ embedUrl.searchParams.set("st", "");
3374
+ return _context41.abrupt("break", 56);
3375
+ case 52:
3376
+ data["og:title"] = options.title;
3377
+ return _context41.abrupt("break", 56);
3378
+ case 54:
3379
+ embedUrl.searchParams.set("vrk", options.viewRecordKey);
3380
+ return _context41.abrupt("break", 56);
3381
+ case 56:
3382
+ _i++;
3383
+ _context41.next = 17;
3384
+ break;
3385
+ case 59:
3386
+ if (Object.keys(data).length > 0) {
3387
+ embedUrl.searchParams.set("data", this.utils.B64(JSON.stringify({
3388
+ meta_tags: data
3389
+ })));
3390
+ }
3391
+ if (!["owner", "editable", "viewable"].includes(permission)) {
3392
+ _context41.next = 65;
3393
+ break;
3394
+ }
3395
+ _context41.next = 63;
3396
+ return this.CreateSignedToken({
3397
+ objectId: objectId,
3398
+ versionHash: versionHash,
3399
+ duration: duration
3400
+ });
3401
+ case 63:
3402
+ token = _context41.sent;
3403
+ embedUrl.searchParams.set("ath", token);
3404
+ case 65:
3405
+ return _context41.abrupt("return", embedUrl.toString());
3406
+ case 66:
3407
+ case "end":
3408
+ return _context41.stop();
3409
+ }
3410
+ }, _callee41, this);
3411
+ }));
3412
+ return function (_x40) {
3413
+ return _ref73.apply(this, arguments);
3414
+ };
3415
+ }();
3416
+
3248
3417
  /* Links */
3249
3418
 
3250
3419
  /**
@@ -3261,13 +3430,13 @@ exports.ContentObjectImageUrl = /*#__PURE__*/function () {
3261
3430
  * @returns {Promise<Object>} - Description of created object
3262
3431
  */
3263
3432
  exports.ContentObjectGraph = /*#__PURE__*/function () {
3264
- var _ref73 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee42(_ref72) {
3433
+ var _ref75 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee43(_ref74) {
3265
3434
  var _this10 = this;
3266
- var libraryId, objectId, versionHash, _ref72$autoUpdate, autoUpdate, select, path, errorInfo, cycles, info;
3267
- return _regeneratorRuntime.wrap(function _callee42$(_context42) {
3268
- while (1) switch (_context42.prev = _context42.next) {
3435
+ var libraryId, objectId, versionHash, _ref74$autoUpdate, autoUpdate, select, path, errorInfo, cycles, info;
3436
+ return _regeneratorRuntime.wrap(function _callee43$(_context43) {
3437
+ while (1) switch (_context43.prev = _context43.next) {
3269
3438
  case 0:
3270
- libraryId = _ref72.libraryId, objectId = _ref72.objectId, versionHash = _ref72.versionHash, _ref72$autoUpdate = _ref72.autoUpdate, autoUpdate = _ref72$autoUpdate === void 0 ? false : _ref72$autoUpdate, select = _ref72.select;
3439
+ libraryId = _ref74.libraryId, objectId = _ref74.objectId, versionHash = _ref74.versionHash, _ref74$autoUpdate = _ref74.autoUpdate, autoUpdate = _ref74$autoUpdate === void 0 ? false : _ref74$autoUpdate, select = _ref74.select;
3271
3440
  ValidateParameters({
3272
3441
  libraryId: libraryId,
3273
3442
  objectId: objectId,
@@ -3278,133 +3447,133 @@ exports.ContentObjectGraph = /*#__PURE__*/function () {
3278
3447
  objectId = this.utils.DecodeVersionHash(versionHash).objectId;
3279
3448
  }
3280
3449
  path = UrlJoin("q", versionHash || objectId, "links");
3281
- _context42.prev = 5;
3282
- _context42.t0 = this.utils;
3283
- _context42.t1 = this.HttpClient;
3284
- _context42.next = 10;
3450
+ _context43.prev = 5;
3451
+ _context43.t0 = this.utils;
3452
+ _context43.t1 = this.HttpClient;
3453
+ _context43.next = 10;
3285
3454
  return this.authClient.AuthorizationHeader({
3286
3455
  libraryId: libraryId,
3287
3456
  objectId: objectId,
3288
3457
  versionHash: versionHash
3289
3458
  });
3290
3459
  case 10:
3291
- _context42.t2 = _context42.sent;
3292
- _context42.t3 = {
3460
+ _context43.t2 = _context43.sent;
3461
+ _context43.t3 = {
3293
3462
  auto_update: autoUpdate,
3294
3463
  select: select
3295
3464
  };
3296
- _context42.t4 = path;
3297
- _context42.t5 = {
3298
- headers: _context42.t2,
3299
- queryParams: _context42.t3,
3465
+ _context43.t4 = path;
3466
+ _context43.t5 = {
3467
+ headers: _context43.t2,
3468
+ queryParams: _context43.t3,
3300
3469
  method: "GET",
3301
- path: _context42.t4
3470
+ path: _context43.t4
3302
3471
  };
3303
- _context42.t6 = _context42.t1.Request.call(_context42.t1, _context42.t5);
3304
- _context42.next = 17;
3305
- return _context42.t0.ResponseToJson.call(_context42.t0, _context42.t6);
3472
+ _context43.t6 = _context43.t1.Request.call(_context43.t1, _context43.t5);
3473
+ _context43.next = 17;
3474
+ return _context43.t0.ResponseToJson.call(_context43.t0, _context43.t6);
3306
3475
  case 17:
3307
- return _context42.abrupt("return", _context42.sent);
3476
+ return _context43.abrupt("return", _context43.sent);
3308
3477
  case 20:
3309
- _context42.prev = 20;
3310
- _context42.t7 = _context42["catch"](5);
3311
- _context42.prev = 22;
3312
- cycles = _context42.t7.body.errors[0].cause.cause.cause.cycle;
3478
+ _context43.prev = 20;
3479
+ _context43.t7 = _context43["catch"](5);
3480
+ _context43.prev = 22;
3481
+ cycles = _context43.t7.body.errors[0].cause.cause.cause.cycle;
3313
3482
  if (!(!cycles || cycles.length === 0)) {
3314
- _context42.next = 26;
3483
+ _context43.next = 26;
3315
3484
  break;
3316
3485
  }
3317
- throw _context42.t7;
3486
+ throw _context43.t7;
3318
3487
  case 26:
3319
3488
  info = {};
3320
- _context42.next = 29;
3489
+ _context43.next = 29;
3321
3490
  return Promise.all(cycles.map( /*#__PURE__*/function () {
3322
- var _ref74 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee41(cycleHash) {
3491
+ var _ref76 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee42(cycleHash) {
3323
3492
  var cycleId, name;
3324
- return _regeneratorRuntime.wrap(function _callee41$(_context41) {
3325
- while (1) switch (_context41.prev = _context41.next) {
3493
+ return _regeneratorRuntime.wrap(function _callee42$(_context42) {
3494
+ while (1) switch (_context42.prev = _context42.next) {
3326
3495
  case 0:
3327
3496
  if (!info[cycleHash]) {
3328
- _context41.next = 2;
3497
+ _context42.next = 2;
3329
3498
  break;
3330
3499
  }
3331
- return _context41.abrupt("return");
3500
+ return _context42.abrupt("return");
3332
3501
  case 2:
3333
3502
  cycleId = _this10.utils.DecodeVersionHash(cycleHash).objectId;
3334
- _context41.next = 5;
3503
+ _context42.next = 5;
3335
3504
  return _this10.ContentObjectMetadata({
3336
3505
  versionHash: cycleHash,
3337
3506
  metadataSubtree: "public/asset_metadata/display_title"
3338
3507
  });
3339
3508
  case 5:
3340
- _context41.t2 = _context41.sent;
3341
- if (_context41.t2) {
3342
- _context41.next = 10;
3509
+ _context42.t2 = _context42.sent;
3510
+ if (_context42.t2) {
3511
+ _context42.next = 10;
3343
3512
  break;
3344
3513
  }
3345
- _context41.next = 9;
3514
+ _context42.next = 9;
3346
3515
  return _this10.ContentObjectMetadata({
3347
3516
  versionHash: cycleHash,
3348
3517
  metadataSubtree: "public/name"
3349
3518
  });
3350
3519
  case 9:
3351
- _context41.t2 = _context41.sent;
3520
+ _context42.t2 = _context42.sent;
3352
3521
  case 10:
3353
- _context41.t1 = _context41.t2;
3354
- if (_context41.t1) {
3355
- _context41.next = 15;
3522
+ _context42.t1 = _context42.t2;
3523
+ if (_context42.t1) {
3524
+ _context42.next = 15;
3356
3525
  break;
3357
3526
  }
3358
- _context41.next = 14;
3527
+ _context42.next = 14;
3359
3528
  return _this10.ContentObjectMetadata({
3360
3529
  versionHash: cycleHash,
3361
3530
  metadataSubtree: "name"
3362
3531
  });
3363
3532
  case 14:
3364
- _context41.t1 = _context41.sent;
3533
+ _context42.t1 = _context42.sent;
3365
3534
  case 15:
3366
- _context41.t0 = _context41.t1;
3367
- if (_context41.t0) {
3368
- _context41.next = 18;
3535
+ _context42.t0 = _context42.t1;
3536
+ if (_context42.t0) {
3537
+ _context42.next = 18;
3369
3538
  break;
3370
3539
  }
3371
- _context41.t0 = cycleId;
3540
+ _context42.t0 = cycleId;
3372
3541
  case 18:
3373
- name = _context41.t0;
3542
+ name = _context42.t0;
3374
3543
  info[cycleHash] = {
3375
3544
  name: name,
3376
3545
  objectId: cycleId
3377
3546
  };
3378
3547
  case 20:
3379
3548
  case "end":
3380
- return _context41.stop();
3549
+ return _context42.stop();
3381
3550
  }
3382
- }, _callee41);
3551
+ }, _callee42);
3383
3552
  }));
3384
- return function (_x41) {
3385
- return _ref74.apply(this, arguments);
3553
+ return function (_x42) {
3554
+ return _ref76.apply(this, arguments);
3386
3555
  };
3387
3556
  }()));
3388
3557
  case 29:
3389
3558
  errorInfo = cycles.map(function (cycleHash) {
3390
3559
  return "".concat(info[cycleHash].name, " (").concat(info[cycleHash].objectId, ")");
3391
3560
  });
3392
- _context42.next = 35;
3561
+ _context43.next = 35;
3393
3562
  break;
3394
3563
  case 32:
3395
- _context42.prev = 32;
3396
- _context42.t8 = _context42["catch"](22);
3397
- throw _context42.t7;
3564
+ _context43.prev = 32;
3565
+ _context43.t8 = _context43["catch"](22);
3566
+ throw _context43.t7;
3398
3567
  case 35:
3399
3568
  throw new Error("Cycle found in links: ".concat(errorInfo.join(" -> ")));
3400
3569
  case 36:
3401
3570
  case "end":
3402
- return _context42.stop();
3571
+ return _context43.stop();
3403
3572
  }
3404
- }, _callee42, this, [[5, 20], [22, 32]]);
3573
+ }, _callee43, this, [[5, 20], [22, 32]]);
3405
3574
  }));
3406
- return function (_x40) {
3407
- return _ref73.apply(this, arguments);
3575
+ return function (_x41) {
3576
+ return _ref75.apply(this, arguments);
3408
3577
  };
3409
3578
  }();
3410
3579
 
@@ -3424,12 +3593,12 @@ exports.ContentObjectGraph = /*#__PURE__*/function () {
3424
3593
  * @returns {Promise<string>} - Version hash of the link's target
3425
3594
  */
3426
3595
  exports.LinkTarget = /*#__PURE__*/function () {
3427
- var _ref76 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee43(_ref75) {
3596
+ var _ref78 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee44(_ref77) {
3428
3597
  var libraryId, objectId, versionHash, writeToken, linkPath, authorizationToken, linkInfo, targetHash, subPath;
3429
- return _regeneratorRuntime.wrap(function _callee43$(_context43) {
3430
- while (1) switch (_context43.prev = _context43.next) {
3598
+ return _regeneratorRuntime.wrap(function _callee44$(_context44) {
3599
+ while (1) switch (_context44.prev = _context44.next) {
3431
3600
  case 0:
3432
- libraryId = _ref75.libraryId, objectId = _ref75.objectId, versionHash = _ref75.versionHash, writeToken = _ref75.writeToken, linkPath = _ref75.linkPath, authorizationToken = _ref75.authorizationToken, linkInfo = _ref75.linkInfo;
3601
+ libraryId = _ref77.libraryId, objectId = _ref77.objectId, versionHash = _ref77.versionHash, writeToken = _ref77.writeToken, linkPath = _ref77.linkPath, authorizationToken = _ref77.authorizationToken, linkInfo = _ref77.linkInfo;
3433
3602
  ValidateParameters({
3434
3603
  libraryId: libraryId,
3435
3604
  objectId: objectId,
@@ -3442,21 +3611,21 @@ exports.LinkTarget = /*#__PURE__*/function () {
3442
3611
  objectId = this.utils.DecodeVersionHash(versionHash).objectId;
3443
3612
  }
3444
3613
  if (!(writeToken && !libraryId)) {
3445
- _context43.next = 8;
3614
+ _context44.next = 8;
3446
3615
  break;
3447
3616
  }
3448
- _context43.next = 7;
3617
+ _context44.next = 7;
3449
3618
  return this.ContentObjectLibraryId({
3450
3619
  objectId: objectId
3451
3620
  });
3452
3621
  case 7:
3453
- libraryId = _context43.sent;
3622
+ libraryId = _context44.sent;
3454
3623
  case 8:
3455
3624
  if (linkInfo) {
3456
- _context43.next = 12;
3625
+ _context44.next = 12;
3457
3626
  break;
3458
3627
  }
3459
- _context43.next = 11;
3628
+ _context44.next = 11;
3460
3629
  return this.ContentObjectMetadata({
3461
3630
  libraryId: libraryId,
3462
3631
  objectId: objectId,
@@ -3469,10 +3638,10 @@ exports.LinkTarget = /*#__PURE__*/function () {
3469
3638
  authorizationToken: authorizationToken
3470
3639
  });
3471
3640
  case 11:
3472
- linkInfo = _context43.sent;
3641
+ linkInfo = _context44.sent;
3473
3642
  case 12:
3474
3643
  if (!(linkInfo && linkInfo["/"])) {
3475
- _context43.next = 27;
3644
+ _context44.next = 27;
3476
3645
  break;
3477
3646
  }
3478
3647
  /* For absolute links - extract the hash from the link itself. Otherwise use "container" */
@@ -3481,32 +3650,32 @@ exports.LinkTarget = /*#__PURE__*/function () {
3481
3650
  targetHash = linkInfo["."].container;
3482
3651
  }
3483
3652
  if (!targetHash) {
3484
- _context43.next = 19;
3653
+ _context44.next = 19;
3485
3654
  break;
3486
3655
  }
3487
- return _context43.abrupt("return", targetHash);
3656
+ return _context44.abrupt("return", targetHash);
3488
3657
  case 19:
3489
3658
  if (!versionHash) {
3490
- _context43.next = 21;
3659
+ _context44.next = 21;
3491
3660
  break;
3492
3661
  }
3493
- return _context43.abrupt("return", versionHash);
3662
+ return _context44.abrupt("return", versionHash);
3494
3663
  case 21:
3495
- _context43.t0 = versionHash;
3496
- if (_context43.t0) {
3497
- _context43.next = 26;
3664
+ _context44.t0 = versionHash;
3665
+ if (_context44.t0) {
3666
+ _context44.next = 26;
3498
3667
  break;
3499
3668
  }
3500
- _context43.next = 25;
3669
+ _context44.next = 25;
3501
3670
  return this.LatestVersionHash({
3502
3671
  objectId: objectId
3503
3672
  });
3504
3673
  case 25:
3505
- _context43.t0 = _context43.sent;
3674
+ _context44.t0 = _context44.sent;
3506
3675
  case 26:
3507
- return _context43.abrupt("return", _context43.t0);
3676
+ return _context44.abrupt("return", _context44.t0);
3508
3677
  case 27:
3509
- _context43.next = 29;
3678
+ _context44.next = 29;
3510
3679
  return this.ContentObjectMetadata({
3511
3680
  libraryId: libraryId,
3512
3681
  objectId: objectId,
@@ -3517,50 +3686,50 @@ exports.LinkTarget = /*#__PURE__*/function () {
3517
3686
  authorizationToken: authorizationToken
3518
3687
  });
3519
3688
  case 29:
3520
- linkInfo = _context43.sent;
3689
+ linkInfo = _context44.sent;
3521
3690
  if (!(!linkInfo || !linkInfo["."])) {
3522
- _context43.next = 49;
3691
+ _context44.next = 49;
3523
3692
  break;
3524
3693
  }
3525
3694
  if (!(_typeof(linkInfo) === "object")) {
3526
- _context43.next = 38;
3695
+ _context44.next = 38;
3527
3696
  break;
3528
3697
  }
3529
- _context43.t1 = versionHash;
3530
- if (_context43.t1) {
3531
- _context43.next = 37;
3698
+ _context44.t1 = versionHash;
3699
+ if (_context44.t1) {
3700
+ _context44.next = 37;
3532
3701
  break;
3533
3702
  }
3534
- _context43.next = 36;
3703
+ _context44.next = 36;
3535
3704
  return this.LatestVersionHash({
3536
3705
  objectId: objectId
3537
3706
  });
3538
3707
  case 36:
3539
- _context43.t1 = _context43.sent;
3708
+ _context44.t1 = _context44.sent;
3540
3709
  case 37:
3541
- return _context43.abrupt("return", _context43.t1);
3710
+ return _context44.abrupt("return", _context44.t1);
3542
3711
  case 38:
3543
3712
  // linkPath is not a direct link, but points to a literal value - back up one path element to find the container
3544
3713
  subPath = linkPath.split("/").slice(0, -1).join("/");
3545
3714
  if (subPath) {
3546
- _context43.next = 46;
3715
+ _context44.next = 46;
3547
3716
  break;
3548
3717
  }
3549
- _context43.t2 = versionHash;
3550
- if (_context43.t2) {
3551
- _context43.next = 45;
3718
+ _context44.t2 = versionHash;
3719
+ if (_context44.t2) {
3720
+ _context44.next = 45;
3552
3721
  break;
3553
3722
  }
3554
- _context43.next = 44;
3723
+ _context44.next = 44;
3555
3724
  return this.LatestVersionHash({
3556
3725
  objectId: objectId
3557
3726
  });
3558
3727
  case 44:
3559
- _context43.t2 = _context43.sent;
3728
+ _context44.t2 = _context44.sent;
3560
3729
  case 45:
3561
- return _context43.abrupt("return", _context43.t2);
3730
+ return _context44.abrupt("return", _context44.t2);
3562
3731
  case 46:
3563
- _context43.next = 48;
3732
+ _context44.next = 48;
3564
3733
  return this.ContentObjectMetadata({
3565
3734
  libraryId: libraryId,
3566
3735
  objectId: objectId,
@@ -3571,17 +3740,17 @@ exports.LinkTarget = /*#__PURE__*/function () {
3571
3740
  authorizationToken: authorizationToken
3572
3741
  });
3573
3742
  case 48:
3574
- linkInfo = _context43.sent;
3743
+ linkInfo = _context44.sent;
3575
3744
  case 49:
3576
- return _context43.abrupt("return", linkInfo["."].source);
3745
+ return _context44.abrupt("return", linkInfo["."].source);
3577
3746
  case 50:
3578
3747
  case "end":
3579
- return _context43.stop();
3748
+ return _context44.stop();
3580
3749
  }
3581
- }, _callee43, this);
3750
+ }, _callee44, this);
3582
3751
  }));
3583
- return function (_x42) {
3584
- return _ref76.apply(this, arguments);
3752
+ return function (_x43) {
3753
+ return _ref78.apply(this, arguments);
3585
3754
  };
3586
3755
  }();
3587
3756
 
@@ -3604,12 +3773,12 @@ exports.LinkTarget = /*#__PURE__*/function () {
3604
3773
  * @returns {Promise<string>} - URL to the specified file with authorization token
3605
3774
  */
3606
3775
  exports.LinkUrl = /*#__PURE__*/function () {
3607
- var _ref78 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee44(_ref77) {
3608
- var libraryId, objectId, versionHash, writeToken, linkPath, mimeType, authorizationToken, _ref77$queryParams, queryParams, _ref77$channelAuth, channelAuth, _ref77$noAuth, noAuth, path, authorization;
3609
- return _regeneratorRuntime.wrap(function _callee44$(_context44) {
3610
- while (1) switch (_context44.prev = _context44.next) {
3776
+ var _ref80 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee45(_ref79) {
3777
+ var libraryId, objectId, versionHash, writeToken, linkPath, mimeType, authorizationToken, _ref79$queryParams, queryParams, _ref79$channelAuth, channelAuth, _ref79$noAuth, noAuth, path, authorization;
3778
+ return _regeneratorRuntime.wrap(function _callee45$(_context45) {
3779
+ while (1) switch (_context45.prev = _context45.next) {
3611
3780
  case 0:
3612
- libraryId = _ref77.libraryId, objectId = _ref77.objectId, versionHash = _ref77.versionHash, writeToken = _ref77.writeToken, linkPath = _ref77.linkPath, mimeType = _ref77.mimeType, authorizationToken = _ref77.authorizationToken, _ref77$queryParams = _ref77.queryParams, queryParams = _ref77$queryParams === void 0 ? {} : _ref77$queryParams, _ref77$channelAuth = _ref77.channelAuth, channelAuth = _ref77$channelAuth === void 0 ? false : _ref77$channelAuth, _ref77$noAuth = _ref77.noAuth, noAuth = _ref77$noAuth === void 0 ? false : _ref77$noAuth;
3781
+ libraryId = _ref79.libraryId, objectId = _ref79.objectId, versionHash = _ref79.versionHash, writeToken = _ref79.writeToken, linkPath = _ref79.linkPath, mimeType = _ref79.mimeType, authorizationToken = _ref79.authorizationToken, _ref79$queryParams = _ref79.queryParams, queryParams = _ref79$queryParams === void 0 ? {} : _ref79$queryParams, _ref79$channelAuth = _ref79.channelAuth, channelAuth = _ref79$channelAuth === void 0 ? false : _ref79$channelAuth, _ref79$noAuth = _ref79.noAuth, noAuth = _ref79$noAuth === void 0 ? false : _ref79$noAuth;
3613
3782
  ValidateParameters({
3614
3783
  libraryId: libraryId,
3615
3784
  objectId: objectId,
@@ -3619,7 +3788,7 @@ exports.LinkUrl = /*#__PURE__*/function () {
3619
3788
  ValidateWriteToken(writeToken);
3620
3789
  }
3621
3790
  if (linkPath) {
3622
- _context44.next = 5;
3791
+ _context45.next = 5;
3623
3792
  break;
3624
3793
  }
3625
3794
  throw Error("Link path not specified");
@@ -3633,8 +3802,8 @@ exports.LinkUrl = /*#__PURE__*/function () {
3633
3802
  path = UrlJoin("q", versionHash, "meta", linkPath);
3634
3803
  }
3635
3804
  authorization = [authorizationToken];
3636
- _context44.t0 = authorization;
3637
- _context44.next = 11;
3805
+ _context45.t0 = authorization;
3806
+ _context45.next = 11;
3638
3807
  return this.MetadataAuth({
3639
3808
  libraryId: libraryId,
3640
3809
  objectId: objectId,
@@ -3644,8 +3813,8 @@ exports.LinkUrl = /*#__PURE__*/function () {
3644
3813
  noAuth: noAuth
3645
3814
  });
3646
3815
  case 11:
3647
- _context44.t1 = _context44.sent;
3648
- _context44.t0.push.call(_context44.t0, _context44.t1);
3816
+ _context45.t1 = _context45.sent;
3817
+ _context45.t0.push.call(_context45.t0, _context45.t1);
3649
3818
  if (queryParams.authorization) {
3650
3819
  authorization.push(queryParams.authorization);
3651
3820
  }
@@ -3658,18 +3827,18 @@ exports.LinkUrl = /*#__PURE__*/function () {
3658
3827
  if (mimeType) {
3659
3828
  queryParams["header-accept"] = mimeType;
3660
3829
  }
3661
- return _context44.abrupt("return", this.HttpClient.URL({
3830
+ return _context45.abrupt("return", this.HttpClient.URL({
3662
3831
  path: path,
3663
3832
  queryParams: queryParams
3664
3833
  }));
3665
3834
  case 17:
3666
3835
  case "end":
3667
- return _context44.stop();
3836
+ return _context45.stop();
3668
3837
  }
3669
- }, _callee44, this);
3838
+ }, _callee45, this);
3670
3839
  }));
3671
- return function (_x43) {
3672
- return _ref78.apply(this, arguments);
3840
+ return function (_x44) {
3841
+ return _ref80.apply(this, arguments);
3673
3842
  };
3674
3843
  }();
3675
3844
 
@@ -3688,13 +3857,13 @@ exports.LinkUrl = /*#__PURE__*/function () {
3688
3857
  * @param {boolean=} channelAuth=false - If specified, state channel authorization will be performed instead of access request authorization
3689
3858
  */
3690
3859
  exports.LinkData = /*#__PURE__*/function () {
3691
- var _ref80 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee45(_ref79) {
3692
- var libraryId, objectId, versionHash, writeToken, linkPath, _ref79$queryParams, queryParams, _ref79$format, format, channelAuth, linkUrl;
3693
- return _regeneratorRuntime.wrap(function _callee45$(_context45) {
3694
- while (1) switch (_context45.prev = _context45.next) {
3860
+ var _ref82 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee46(_ref81) {
3861
+ var libraryId, objectId, versionHash, writeToken, linkPath, _ref81$queryParams, queryParams, _ref81$format, format, channelAuth, linkUrl;
3862
+ return _regeneratorRuntime.wrap(function _callee46$(_context46) {
3863
+ while (1) switch (_context46.prev = _context46.next) {
3695
3864
  case 0:
3696
- libraryId = _ref79.libraryId, objectId = _ref79.objectId, versionHash = _ref79.versionHash, writeToken = _ref79.writeToken, linkPath = _ref79.linkPath, _ref79$queryParams = _ref79.queryParams, queryParams = _ref79$queryParams === void 0 ? {} : _ref79$queryParams, _ref79$format = _ref79.format, format = _ref79$format === void 0 ? "json" : _ref79$format, channelAuth = _ref79.channelAuth;
3697
- _context45.next = 3;
3865
+ libraryId = _ref81.libraryId, objectId = _ref81.objectId, versionHash = _ref81.versionHash, writeToken = _ref81.writeToken, linkPath = _ref81.linkPath, _ref81$queryParams = _ref81.queryParams, queryParams = _ref81$queryParams === void 0 ? {} : _ref81$queryParams, _ref81$format = _ref81.format, format = _ref81$format === void 0 ? "json" : _ref81$format, channelAuth = _ref81.channelAuth;
3866
+ _context46.next = 3;
3698
3867
  return this.LinkUrl({
3699
3868
  libraryId: libraryId,
3700
3869
  objectId: objectId,
@@ -3705,39 +3874,39 @@ exports.LinkData = /*#__PURE__*/function () {
3705
3874
  channelAuth: channelAuth
3706
3875
  });
3707
3876
  case 3:
3708
- linkUrl = _context45.sent;
3709
- _context45.t0 = this.utils;
3710
- _context45.t1 = format;
3711
- _context45.next = 8;
3877
+ linkUrl = _context46.sent;
3878
+ _context46.t0 = this.utils;
3879
+ _context46.t1 = format;
3880
+ _context46.next = 8;
3712
3881
  return HttpClient.Fetch(linkUrl);
3713
3882
  case 8:
3714
- _context45.t2 = _context45.sent;
3715
- return _context45.abrupt("return", _context45.t0.ResponseToFormat.call(_context45.t0, _context45.t1, _context45.t2));
3883
+ _context46.t2 = _context46.sent;
3884
+ return _context46.abrupt("return", _context46.t0.ResponseToFormat.call(_context46.t0, _context46.t1, _context46.t2));
3716
3885
  case 10:
3717
3886
  case "end":
3718
- return _context45.stop();
3887
+ return _context46.stop();
3719
3888
  }
3720
- }, _callee45, this);
3889
+ }, _callee46, this);
3721
3890
  }));
3722
- return function (_x44) {
3723
- return _ref80.apply(this, arguments);
3891
+ return function (_x45) {
3892
+ return _ref82.apply(this, arguments);
3724
3893
  };
3725
3894
  }();
3726
3895
 
3727
3896
  /* Encryption */
3728
3897
 
3729
3898
  exports.CreateEncryptionConk = /*#__PURE__*/function () {
3730
- var _ref82 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee46(_ref81) {
3731
- var libraryId, objectId, versionHash, writeToken, _ref81$createKMSConk, createKMSConk, capKey, existingUserCap, kmsAddress, kmsPublicKey, kmsCapKey, existingKMSCap;
3732
- return _regeneratorRuntime.wrap(function _callee46$(_context46) {
3733
- while (1) switch (_context46.prev = _context46.next) {
3899
+ var _ref84 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee47(_ref83) {
3900
+ var libraryId, objectId, versionHash, writeToken, _ref83$createKMSConk, createKMSConk, capKey, existingUserCap, kmsAddress, kmsPublicKey, kmsCapKey, existingKMSCap;
3901
+ return _regeneratorRuntime.wrap(function _callee47$(_context47) {
3902
+ while (1) switch (_context47.prev = _context47.next) {
3734
3903
  case 0:
3735
- libraryId = _ref81.libraryId, objectId = _ref81.objectId, versionHash = _ref81.versionHash, writeToken = _ref81.writeToken, _ref81$createKMSConk = _ref81.createKMSConk, createKMSConk = _ref81$createKMSConk === void 0 ? true : _ref81$createKMSConk;
3904
+ libraryId = _ref83.libraryId, objectId = _ref83.objectId, versionHash = _ref83.versionHash, writeToken = _ref83.writeToken, _ref83$createKMSConk = _ref83.createKMSConk, createKMSConk = _ref83$createKMSConk === void 0 ? true : _ref83$createKMSConk;
3736
3905
  if (!this.signer.remoteSigner) {
3737
- _context46.next = 3;
3906
+ _context47.next = 3;
3738
3907
  break;
3739
3908
  }
3740
- return _context46.abrupt("return");
3909
+ return _context47.abrupt("return");
3741
3910
  case 3:
3742
3911
  ValidateParameters({
3743
3912
  libraryId: libraryId,
@@ -3749,18 +3918,18 @@ exports.CreateEncryptionConk = /*#__PURE__*/function () {
3749
3918
  objectId = client.DecodeVersionHash(versionHash).objectId;
3750
3919
  }
3751
3920
  if (libraryId) {
3752
- _context46.next = 10;
3921
+ _context47.next = 10;
3753
3922
  break;
3754
3923
  }
3755
- _context46.next = 9;
3924
+ _context47.next = 9;
3756
3925
  return this.ContentObjectLibraryId({
3757
3926
  objectId: objectId
3758
3927
  });
3759
3928
  case 9:
3760
- libraryId = _context46.sent;
3929
+ libraryId = _context47.sent;
3761
3930
  case 10:
3762
3931
  capKey = "eluv.caps.iusr".concat(this.utils.AddressToHash(this.signer.address));
3763
- _context46.next = 13;
3932
+ _context47.next = 13;
3764
3933
  return this.ContentObjectMetadata({
3765
3934
  libraryId: libraryId,
3766
3935
  objectId: objectId,
@@ -3768,63 +3937,63 @@ exports.CreateEncryptionConk = /*#__PURE__*/function () {
3768
3937
  metadataSubtree: capKey
3769
3938
  });
3770
3939
  case 13:
3771
- existingUserCap = _context46.sent;
3940
+ existingUserCap = _context47.sent;
3772
3941
  if (!existingUserCap) {
3773
- _context46.next = 20;
3942
+ _context47.next = 20;
3774
3943
  break;
3775
3944
  }
3776
- _context46.next = 17;
3945
+ _context47.next = 17;
3777
3946
  return this.Crypto.DecryptCap(existingUserCap, this.signer._signingKey().privateKey);
3778
3947
  case 17:
3779
- this.encryptionConks[objectId] = _context46.sent;
3780
- _context46.next = 34;
3948
+ this.encryptionConks[objectId] = _context47.sent;
3949
+ _context47.next = 34;
3781
3950
  break;
3782
3951
  case 20:
3783
- _context46.next = 22;
3952
+ _context47.next = 22;
3784
3953
  return this.Crypto.GeneratePrimaryConk({
3785
3954
  spaceId: this.contentSpaceId,
3786
3955
  objectId: objectId
3787
3956
  });
3788
3957
  case 22:
3789
- this.encryptionConks[objectId] = _context46.sent;
3790
- _context46.t0 = this;
3791
- _context46.t1 = libraryId;
3792
- _context46.t2 = objectId;
3793
- _context46.t3 = writeToken;
3794
- _context46.t4 = capKey;
3795
- _context46.next = 30;
3958
+ this.encryptionConks[objectId] = _context47.sent;
3959
+ _context47.t0 = this;
3960
+ _context47.t1 = libraryId;
3961
+ _context47.t2 = objectId;
3962
+ _context47.t3 = writeToken;
3963
+ _context47.t4 = capKey;
3964
+ _context47.next = 30;
3796
3965
  return this.Crypto.EncryptConk(this.encryptionConks[objectId], this.signer._signingKey().publicKey);
3797
3966
  case 30:
3798
- _context46.t5 = _context46.sent;
3799
- _context46.t6 = {
3800
- libraryId: _context46.t1,
3801
- objectId: _context46.t2,
3802
- writeToken: _context46.t3,
3803
- metadataSubtree: _context46.t4,
3804
- metadata: _context46.t5
3967
+ _context47.t5 = _context47.sent;
3968
+ _context47.t6 = {
3969
+ libraryId: _context47.t1,
3970
+ objectId: _context47.t2,
3971
+ writeToken: _context47.t3,
3972
+ metadataSubtree: _context47.t4,
3973
+ metadata: _context47.t5
3805
3974
  };
3806
- _context46.next = 34;
3807
- return _context46.t0.ReplaceMetadata.call(_context46.t0, _context46.t6);
3975
+ _context47.next = 34;
3976
+ return _context47.t0.ReplaceMetadata.call(_context47.t0, _context47.t6);
3808
3977
  case 34:
3809
3978
  if (!createKMSConk) {
3810
- _context46.next = 64;
3979
+ _context47.next = 64;
3811
3980
  break;
3812
3981
  }
3813
- _context46.prev = 35;
3814
- _context46.next = 38;
3982
+ _context47.prev = 35;
3983
+ _context47.next = 38;
3815
3984
  return this.authClient.KMSAddress({
3816
3985
  objectId: objectId
3817
3986
  });
3818
3987
  case 38:
3819
- kmsAddress = _context46.sent;
3820
- _context46.next = 41;
3988
+ kmsAddress = _context47.sent;
3989
+ _context47.next = 41;
3821
3990
  return this.authClient.KMSInfo({
3822
3991
  objectId: objectId
3823
3992
  });
3824
3993
  case 41:
3825
- kmsPublicKey = _context46.sent.publicKey;
3994
+ kmsPublicKey = _context47.sent.publicKey;
3826
3995
  kmsCapKey = "eluv.caps.ikms".concat(this.utils.AddressToHash(kmsAddress));
3827
- _context46.next = 45;
3996
+ _context47.next = 45;
3828
3997
  return this.ContentObjectMetadata({
3829
3998
  libraryId: libraryId,
3830
3999
  // Cap may only exist in draft
@@ -3833,49 +4002,49 @@ exports.CreateEncryptionConk = /*#__PURE__*/function () {
3833
4002
  metadataSubtree: kmsCapKey
3834
4003
  });
3835
4004
  case 45:
3836
- existingKMSCap = _context46.sent;
4005
+ existingKMSCap = _context47.sent;
3837
4006
  if (existingKMSCap) {
3838
- _context46.next = 58;
4007
+ _context47.next = 58;
3839
4008
  break;
3840
4009
  }
3841
- _context46.t7 = this;
3842
- _context46.t8 = libraryId;
3843
- _context46.t9 = objectId;
3844
- _context46.t10 = writeToken;
3845
- _context46.t11 = kmsCapKey;
3846
- _context46.next = 54;
4010
+ _context47.t7 = this;
4011
+ _context47.t8 = libraryId;
4012
+ _context47.t9 = objectId;
4013
+ _context47.t10 = writeToken;
4014
+ _context47.t11 = kmsCapKey;
4015
+ _context47.next = 54;
3847
4016
  return this.Crypto.EncryptConk(this.encryptionConks[objectId], kmsPublicKey);
3848
4017
  case 54:
3849
- _context46.t12 = _context46.sent;
3850
- _context46.t13 = {
3851
- libraryId: _context46.t8,
3852
- objectId: _context46.t9,
3853
- writeToken: _context46.t10,
3854
- metadataSubtree: _context46.t11,
3855
- metadata: _context46.t12
4018
+ _context47.t12 = _context47.sent;
4019
+ _context47.t13 = {
4020
+ libraryId: _context47.t8,
4021
+ objectId: _context47.t9,
4022
+ writeToken: _context47.t10,
4023
+ metadataSubtree: _context47.t11,
4024
+ metadata: _context47.t12
3856
4025
  };
3857
- _context46.next = 58;
3858
- return _context46.t7.ReplaceMetadata.call(_context46.t7, _context46.t13);
4026
+ _context47.next = 58;
4027
+ return _context47.t7.ReplaceMetadata.call(_context47.t7, _context47.t13);
3859
4028
  case 58:
3860
- _context46.next = 64;
4029
+ _context47.next = 64;
3861
4030
  break;
3862
4031
  case 60:
3863
- _context46.prev = 60;
3864
- _context46.t14 = _context46["catch"](35);
4032
+ _context47.prev = 60;
4033
+ _context47.t14 = _context47["catch"](35);
3865
4034
  // eslint-disable-next-line no-console
3866
4035
  console.error("Failed to create encryption cap for KMS:");
3867
4036
  // eslint-disable-next-line no-console
3868
- console.error(_context46.t14);
4037
+ console.error(_context47.t14);
3869
4038
  case 64:
3870
- return _context46.abrupt("return", this.encryptionConks[objectId]);
4039
+ return _context47.abrupt("return", this.encryptionConks[objectId]);
3871
4040
  case 65:
3872
4041
  case "end":
3873
- return _context46.stop();
4042
+ return _context47.stop();
3874
4043
  }
3875
- }, _callee46, this, [[35, 60]]);
4044
+ }, _callee47, this, [[35, 60]]);
3876
4045
  }));
3877
- return function (_x45) {
3878
- return _ref82.apply(this, arguments);
4046
+ return function (_x46) {
4047
+ return _ref84.apply(this, arguments);
3879
4048
  };
3880
4049
  }();
3881
4050
 
@@ -3897,12 +4066,12 @@ exports.CreateEncryptionConk = /*#__PURE__*/function () {
3897
4066
  * @return Promise<Object> - The encryption conk for the object
3898
4067
  */
3899
4068
  exports.EncryptionConk = /*#__PURE__*/function () {
3900
- var _ref84 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee47(_ref83) {
3901
- var libraryId, objectId, versionHash, writeToken, _ref83$download, download, owner, ownerCapKey, ownerCap, capKey, existingUserCap;
3902
- return _regeneratorRuntime.wrap(function _callee47$(_context47) {
3903
- while (1) switch (_context47.prev = _context47.next) {
4069
+ var _ref86 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee48(_ref85) {
4070
+ var libraryId, objectId, versionHash, writeToken, _ref85$download, download, owner, ownerCapKey, ownerCap, capKey, existingUserCap;
4071
+ return _regeneratorRuntime.wrap(function _callee48$(_context48) {
4072
+ while (1) switch (_context48.prev = _context48.next) {
3904
4073
  case 0:
3905
- libraryId = _ref83.libraryId, objectId = _ref83.objectId, versionHash = _ref83.versionHash, writeToken = _ref83.writeToken, _ref83$download = _ref83.download, download = _ref83$download === void 0 ? false : _ref83$download;
4074
+ libraryId = _ref85.libraryId, objectId = _ref85.objectId, versionHash = _ref85.versionHash, writeToken = _ref85.writeToken, _ref85$download = _ref85.download, download = _ref85$download === void 0 ? false : _ref85$download;
3906
4075
  ValidateParameters({
3907
4076
  libraryId: libraryId,
3908
4077
  objectId: objectId,
@@ -3914,14 +4083,14 @@ exports.EncryptionConk = /*#__PURE__*/function () {
3914
4083
  if (!objectId) {
3915
4084
  objectId = client.DecodeVersionHash(versionHash).objectId;
3916
4085
  }
3917
- _context47.next = 6;
4086
+ _context48.next = 6;
3918
4087
  return this.authClient.Owner({
3919
4088
  id: objectId
3920
4089
  });
3921
4090
  case 6:
3922
- owner = _context47.sent;
4091
+ owner = _context48.sent;
3923
4092
  ownerCapKey = "eluv.caps.iusr".concat(this.utils.AddressToHash(this.signer.address));
3924
- _context47.next = 10;
4093
+ _context48.next = 10;
3925
4094
  return this.ContentObjectMetadata({
3926
4095
  libraryId: libraryId,
3927
4096
  objectId: objectId,
@@ -3929,39 +4098,39 @@ exports.EncryptionConk = /*#__PURE__*/function () {
3929
4098
  metadataSubtree: ownerCapKey
3930
4099
  });
3931
4100
  case 10:
3932
- ownerCap = _context47.sent;
4101
+ ownerCap = _context48.sent;
3933
4102
  if (!(!this.utils.EqualAddress(owner, this.signer.address) && !ownerCap)) {
3934
- _context47.next = 21;
4103
+ _context48.next = 21;
3935
4104
  break;
3936
4105
  }
3937
4106
  if (!download) {
3938
- _context47.next = 18;
4107
+ _context48.next = 18;
3939
4108
  break;
3940
4109
  }
3941
- _context47.next = 15;
4110
+ _context48.next = 15;
3942
4111
  return this.authClient.ReEncryptionConk({
3943
4112
  libraryId: libraryId,
3944
4113
  objectId: objectId,
3945
4114
  versionHash: versionHash
3946
4115
  });
3947
4116
  case 15:
3948
- return _context47.abrupt("return", _context47.sent);
4117
+ return _context48.abrupt("return", _context48.sent);
3949
4118
  case 18:
3950
- _context47.next = 20;
4119
+ _context48.next = 20;
3951
4120
  return this.authClient.EncryptionConk({
3952
4121
  libraryId: libraryId,
3953
4122
  objectId: objectId,
3954
4123
  versionHash: versionHash
3955
4124
  });
3956
4125
  case 20:
3957
- return _context47.abrupt("return", _context47.sent);
4126
+ return _context48.abrupt("return", _context48.sent);
3958
4127
  case 21:
3959
4128
  if (this.encryptionConks[objectId]) {
3960
- _context47.next = 38;
4129
+ _context48.next = 38;
3961
4130
  break;
3962
4131
  }
3963
4132
  capKey = "eluv.caps.iusr".concat(this.utils.AddressToHash(this.signer.address));
3964
- _context47.next = 25;
4133
+ _context48.next = 25;
3965
4134
  return this.ContentObjectMetadata({
3966
4135
  libraryId: libraryId,
3967
4136
  objectId: objectId,
@@ -3971,23 +4140,23 @@ exports.EncryptionConk = /*#__PURE__*/function () {
3971
4140
  metadataSubtree: capKey
3972
4141
  });
3973
4142
  case 25:
3974
- existingUserCap = _context47.sent;
4143
+ existingUserCap = _context48.sent;
3975
4144
  if (!existingUserCap) {
3976
- _context47.next = 32;
4145
+ _context48.next = 32;
3977
4146
  break;
3978
4147
  }
3979
- _context47.next = 29;
4148
+ _context48.next = 29;
3980
4149
  return this.Crypto.DecryptCap(existingUserCap, this.signer._signingKey().privateKey);
3981
4150
  case 29:
3982
- this.encryptionConks[objectId] = _context47.sent;
3983
- _context47.next = 38;
4151
+ this.encryptionConks[objectId] = _context48.sent;
4152
+ _context48.next = 38;
3984
4153
  break;
3985
4154
  case 32:
3986
4155
  if (!writeToken) {
3987
- _context47.next = 37;
4156
+ _context48.next = 37;
3988
4157
  break;
3989
4158
  }
3990
- _context47.next = 35;
4159
+ _context48.next = 35;
3991
4160
  return this.CreateEncryptionConk({
3992
4161
  libraryId: libraryId,
3993
4162
  objectId: objectId,
@@ -3996,20 +4165,20 @@ exports.EncryptionConk = /*#__PURE__*/function () {
3996
4165
  createKMSConk: false
3997
4166
  });
3998
4167
  case 35:
3999
- _context47.next = 38;
4168
+ _context48.next = 38;
4000
4169
  break;
4001
4170
  case 37:
4002
4171
  throw "No encryption conk present for " + objectId;
4003
4172
  case 38:
4004
- return _context47.abrupt("return", this.encryptionConks[objectId]);
4173
+ return _context48.abrupt("return", this.encryptionConks[objectId]);
4005
4174
  case 39:
4006
4175
  case "end":
4007
- return _context47.stop();
4176
+ return _context48.stop();
4008
4177
  }
4009
- }, _callee47, this);
4178
+ }, _callee48, this);
4010
4179
  }));
4011
- return function (_x46) {
4012
- return _ref84.apply(this, arguments);
4180
+ return function (_x47) {
4181
+ return _ref86.apply(this, arguments);
4013
4182
  };
4014
4183
  }();
4015
4184
 
@@ -4027,37 +4196,37 @@ exports.EncryptionConk = /*#__PURE__*/function () {
4027
4196
  * @return {Promise<ArrayBuffer>}
4028
4197
  */
4029
4198
  exports.Encrypt = /*#__PURE__*/function () {
4030
- var _ref86 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee48(_ref85) {
4199
+ var _ref88 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee49(_ref87) {
4031
4200
  var libraryId, objectId, writeToken, chunk, conk, data;
4032
- return _regeneratorRuntime.wrap(function _callee48$(_context48) {
4033
- while (1) switch (_context48.prev = _context48.next) {
4201
+ return _regeneratorRuntime.wrap(function _callee49$(_context49) {
4202
+ while (1) switch (_context49.prev = _context49.next) {
4034
4203
  case 0:
4035
- libraryId = _ref85.libraryId, objectId = _ref85.objectId, writeToken = _ref85.writeToken, chunk = _ref85.chunk;
4204
+ libraryId = _ref87.libraryId, objectId = _ref87.objectId, writeToken = _ref87.writeToken, chunk = _ref87.chunk;
4036
4205
  ValidateParameters({
4037
4206
  libraryId: libraryId,
4038
4207
  objectId: objectId
4039
4208
  });
4040
- _context48.next = 4;
4209
+ _context49.next = 4;
4041
4210
  return this.EncryptionConk({
4042
4211
  libraryId: libraryId,
4043
4212
  objectId: objectId,
4044
4213
  writeToken: writeToken
4045
4214
  });
4046
4215
  case 4:
4047
- conk = _context48.sent;
4048
- _context48.next = 7;
4216
+ conk = _context49.sent;
4217
+ _context49.next = 7;
4049
4218
  return this.Crypto.Encrypt(conk, chunk);
4050
4219
  case 7:
4051
- data = _context48.sent;
4052
- return _context48.abrupt("return", data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength));
4220
+ data = _context49.sent;
4221
+ return _context49.abrupt("return", data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength));
4053
4222
  case 9:
4054
4223
  case "end":
4055
- return _context48.stop();
4224
+ return _context49.stop();
4056
4225
  }
4057
- }, _callee48, this);
4226
+ }, _callee49, this);
4058
4227
  }));
4059
- return function (_x47) {
4060
- return _ref86.apply(this, arguments);
4228
+ return function (_x48) {
4229
+ return _ref88.apply(this, arguments);
4061
4230
  };
4062
4231
  }();
4063
4232
 
@@ -4075,17 +4244,17 @@ exports.Encrypt = /*#__PURE__*/function () {
4075
4244
  * @return {Promise<ArrayBuffer>}
4076
4245
  */
4077
4246
  exports.Decrypt = /*#__PURE__*/function () {
4078
- var _ref88 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee49(_ref87) {
4247
+ var _ref90 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee50(_ref89) {
4079
4248
  var libraryId, objectId, writeToken, chunk, conk, data;
4080
- return _regeneratorRuntime.wrap(function _callee49$(_context49) {
4081
- while (1) switch (_context49.prev = _context49.next) {
4249
+ return _regeneratorRuntime.wrap(function _callee50$(_context50) {
4250
+ while (1) switch (_context50.prev = _context50.next) {
4082
4251
  case 0:
4083
- libraryId = _ref87.libraryId, objectId = _ref87.objectId, writeToken = _ref87.writeToken, chunk = _ref87.chunk;
4252
+ libraryId = _ref89.libraryId, objectId = _ref89.objectId, writeToken = _ref89.writeToken, chunk = _ref89.chunk;
4084
4253
  ValidateParameters({
4085
4254
  libraryId: libraryId,
4086
4255
  objectId: objectId
4087
4256
  });
4088
- _context49.next = 4;
4257
+ _context50.next = 4;
4089
4258
  return this.EncryptionConk({
4090
4259
  libraryId: libraryId,
4091
4260
  objectId: objectId,
@@ -4093,20 +4262,20 @@ exports.Decrypt = /*#__PURE__*/function () {
4093
4262
  download: true
4094
4263
  });
4095
4264
  case 4:
4096
- conk = _context49.sent;
4097
- _context49.next = 7;
4265
+ conk = _context50.sent;
4266
+ _context50.next = 7;
4098
4267
  return this.Crypto.Decrypt(conk, chunk);
4099
4268
  case 7:
4100
- data = _context49.sent;
4101
- return _context49.abrupt("return", data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength));
4269
+ data = _context50.sent;
4270
+ return _context50.abrupt("return", data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength));
4102
4271
  case 9:
4103
4272
  case "end":
4104
- return _context49.stop();
4273
+ return _context50.stop();
4105
4274
  }
4106
- }, _callee49, this);
4275
+ }, _callee50, this);
4107
4276
  }));
4108
- return function (_x48) {
4109
- return _ref88.apply(this, arguments);
4277
+ return function (_x49) {
4278
+ return _ref90.apply(this, arguments);
4110
4279
  };
4111
4280
  }();
4112
4281
 
@@ -4122,24 +4291,24 @@ exports.Decrypt = /*#__PURE__*/function () {
4122
4291
  * @return {Promise<string>} - Contract type of the item - "space", "library", "type", "object", "wallet", "group", or "other"
4123
4292
  */
4124
4293
  exports.AccessType = /*#__PURE__*/function () {
4125
- var _ref90 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee50(_ref89) {
4294
+ var _ref92 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee51(_ref91) {
4126
4295
  var id;
4127
- return _regeneratorRuntime.wrap(function _callee50$(_context50) {
4128
- while (1) switch (_context50.prev = _context50.next) {
4296
+ return _regeneratorRuntime.wrap(function _callee51$(_context51) {
4297
+ while (1) switch (_context51.prev = _context51.next) {
4129
4298
  case 0:
4130
- id = _ref89.id;
4131
- _context50.next = 3;
4299
+ id = _ref91.id;
4300
+ _context51.next = 3;
4132
4301
  return this.authClient.AccessType(id);
4133
4302
  case 3:
4134
- return _context50.abrupt("return", _context50.sent);
4303
+ return _context51.abrupt("return", _context51.sent);
4135
4304
  case 4:
4136
4305
  case "end":
4137
- return _context50.stop();
4306
+ return _context51.stop();
4138
4307
  }
4139
- }, _callee50, this);
4308
+ }, _callee51, this);
4140
4309
  }));
4141
- return function (_x49) {
4142
- return _ref90.apply(this, arguments);
4310
+ return function (_x50) {
4311
+ return _ref92.apply(this, arguments);
4143
4312
  };
4144
4313
  }();
4145
4314
 
@@ -4155,12 +4324,12 @@ exports.AccessType = /*#__PURE__*/function () {
4155
4324
  *
4156
4325
  * @return {Promise<Object>} - Info about the access charge and whether or not the object is accessible to the current user */
4157
4326
  exports.AccessInfo = /*#__PURE__*/function () {
4158
- var _ref92 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee51(_ref91) {
4327
+ var _ref94 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee52(_ref93) {
4159
4328
  var objectId, args, info;
4160
- return _regeneratorRuntime.wrap(function _callee51$(_context51) {
4161
- while (1) switch (_context51.prev = _context51.next) {
4329
+ return _regeneratorRuntime.wrap(function _callee52$(_context52) {
4330
+ while (1) switch (_context52.prev = _context52.next) {
4162
4331
  case 0:
4163
- objectId = _ref91.objectId, args = _ref91.args;
4332
+ objectId = _ref93.objectId, args = _ref93.args;
4164
4333
  ValidateObject(objectId);
4165
4334
  if (!args) {
4166
4335
  args = [0,
@@ -4172,16 +4341,16 @@ exports.AccessInfo = /*#__PURE__*/function () {
4172
4341
  }
4173
4342
 
4174
4343
  this.Log("Retrieving access info: ".concat(objectId));
4175
- _context51.next = 6;
4344
+ _context52.next = 6;
4176
4345
  return this.ethClient.CallContractMethod({
4177
4346
  contractAddress: this.utils.HashToAddress(objectId),
4178
4347
  methodName: "getAccessInfo",
4179
4348
  methodArgs: args
4180
4349
  });
4181
4350
  case 6:
4182
- info = _context51.sent;
4351
+ info = _context52.sent;
4183
4352
  this.Log(info);
4184
- return _context51.abrupt("return", {
4353
+ return _context52.abrupt("return", {
4185
4354
  visibilityCode: info[0],
4186
4355
  visible: info[0] >= 1,
4187
4356
  accessible: info[0] >= 10,
@@ -4192,12 +4361,12 @@ exports.AccessInfo = /*#__PURE__*/function () {
4192
4361
  });
4193
4362
  case 9:
4194
4363
  case "end":
4195
- return _context51.stop();
4364
+ return _context52.stop();
4196
4365
  }
4197
- }, _callee51, this);
4366
+ }, _callee52, this);
4198
4367
  }));
4199
- return function (_x50) {
4200
- return _ref92.apply(this, arguments);
4368
+ return function (_x51) {
4369
+ return _ref94.apply(this, arguments);
4201
4370
  };
4202
4371
  }();
4203
4372
 
@@ -4225,12 +4394,12 @@ exports.AccessInfo = /*#__PURE__*/function () {
4225
4394
  * @return {Promise<Object>} - Resultant AccessRequest or UpdateRequest event
4226
4395
  */
4227
4396
  exports.AccessRequest = /*#__PURE__*/function () {
4228
- var _ref94 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee52(_ref93) {
4229
- var libraryId, objectId, versionHash, _ref93$args, args, _ref93$update, update, _ref93$noCache, noCache;
4230
- return _regeneratorRuntime.wrap(function _callee52$(_context52) {
4231
- while (1) switch (_context52.prev = _context52.next) {
4397
+ var _ref96 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee53(_ref95) {
4398
+ var libraryId, objectId, versionHash, _ref95$args, args, _ref95$update, update, _ref95$noCache, noCache;
4399
+ return _regeneratorRuntime.wrap(function _callee53$(_context53) {
4400
+ while (1) switch (_context53.prev = _context53.next) {
4232
4401
  case 0:
4233
- libraryId = _ref93.libraryId, objectId = _ref93.objectId, versionHash = _ref93.versionHash, _ref93$args = _ref93.args, args = _ref93$args === void 0 ? [] : _ref93$args, _ref93$update = _ref93.update, update = _ref93$update === void 0 ? false : _ref93$update, _ref93$noCache = _ref93.noCache, noCache = _ref93$noCache === void 0 ? false : _ref93$noCache;
4402
+ libraryId = _ref95.libraryId, objectId = _ref95.objectId, versionHash = _ref95.versionHash, _ref95$args = _ref95.args, args = _ref95$args === void 0 ? [] : _ref95$args, _ref95$update = _ref95.update, update = _ref95$update === void 0 ? false : _ref95$update, _ref95$noCache = _ref95.noCache, noCache = _ref95$noCache === void 0 ? false : _ref95$noCache;
4234
4403
  ValidateParameters({
4235
4404
  libraryId: libraryId,
4236
4405
  objectId: objectId,
@@ -4239,7 +4408,7 @@ exports.AccessRequest = /*#__PURE__*/function () {
4239
4408
  if (versionHash) {
4240
4409
  objectId = this.utils.DecodeVersionHash(versionHash).objectId;
4241
4410
  }
4242
- _context52.next = 5;
4411
+ _context53.next = 5;
4243
4412
  return this.authClient.MakeAccessRequest({
4244
4413
  libraryId: libraryId,
4245
4414
  objectId: objectId,
@@ -4250,15 +4419,15 @@ exports.AccessRequest = /*#__PURE__*/function () {
4250
4419
  noCache: noCache
4251
4420
  });
4252
4421
  case 5:
4253
- return _context52.abrupt("return", _context52.sent);
4422
+ return _context53.abrupt("return", _context53.sent);
4254
4423
  case 6:
4255
4424
  case "end":
4256
- return _context52.stop();
4425
+ return _context53.stop();
4257
4426
  }
4258
- }, _callee52, this);
4427
+ }, _callee53, this);
4259
4428
  }));
4260
- return function (_x51) {
4261
- return _ref94.apply(this, arguments);
4429
+ return function (_x52) {
4430
+ return _ref96.apply(this, arguments);
4262
4431
  };
4263
4432
  }();
4264
4433
 
@@ -4270,8 +4439,8 @@ exports.AccessRequest = /*#__PURE__*/function () {
4270
4439
  * @param {Object=} context - Additional context to include in state channel requests
4271
4440
  * - Note: Context must be a map of string->string
4272
4441
  */
4273
- exports.SetAuthContext = function (_ref95) {
4274
- var context = _ref95.context;
4442
+ exports.SetAuthContext = function (_ref97) {
4443
+ var context = _ref97.context;
4275
4444
  if (context && Object.values(context).find(function (value) {
4276
4445
  return typeof value !== "string";
4277
4446
  })) {
@@ -4295,34 +4464,34 @@ exports.SetAuthContext = function (_ref95) {
4295
4464
  * @return {Promise<string>} - The state channel token
4296
4465
  */
4297
4466
  exports.GenerateStateChannelToken = /*#__PURE__*/function () {
4298
- var _ref97 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee53(_ref96) {
4299
- var objectId, versionHash, context, _ref96$noCache, noCache;
4300
- return _regeneratorRuntime.wrap(function _callee53$(_context53) {
4301
- while (1) switch (_context53.prev = _context53.next) {
4467
+ var _ref99 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee54(_ref98) {
4468
+ var objectId, versionHash, context, _ref98$noCache, noCache;
4469
+ return _regeneratorRuntime.wrap(function _callee54$(_context54) {
4470
+ while (1) switch (_context54.prev = _context54.next) {
4302
4471
  case 0:
4303
- objectId = _ref96.objectId, versionHash = _ref96.versionHash, context = _ref96.context, _ref96$noCache = _ref96.noCache, noCache = _ref96$noCache === void 0 ? false : _ref96$noCache;
4472
+ objectId = _ref98.objectId, versionHash = _ref98.versionHash, context = _ref98.context, _ref98$noCache = _ref98.noCache, noCache = _ref98$noCache === void 0 ? false : _ref98$noCache;
4304
4473
  versionHash ? ValidateVersion(versionHash) : ValidateObject(objectId);
4305
4474
  if (!versionHash) {
4306
- _context53.next = 6;
4475
+ _context54.next = 6;
4307
4476
  break;
4308
4477
  }
4309
4478
  objectId = this.utils.DecodeVersionHash(versionHash).objectId;
4310
- _context53.next = 10;
4479
+ _context54.next = 10;
4311
4480
  break;
4312
4481
  case 6:
4313
4482
  if (this.stateChannelAccess[objectId]) {
4314
- _context53.next = 10;
4483
+ _context54.next = 10;
4315
4484
  break;
4316
4485
  }
4317
- _context53.next = 9;
4486
+ _context54.next = 9;
4318
4487
  return this.LatestVersionHash({
4319
4488
  objectId: objectId
4320
4489
  });
4321
4490
  case 9:
4322
- versionHash = _context53.sent;
4491
+ versionHash = _context54.sent;
4323
4492
  case 10:
4324
4493
  this.stateChannelAccess[objectId] = versionHash;
4325
- _context53.next = 13;
4494
+ _context54.next = 13;
4326
4495
  return this.authClient.AuthorizationToken({
4327
4496
  objectId: objectId,
4328
4497
  channelAuth: true,
@@ -4331,15 +4500,15 @@ exports.GenerateStateChannelToken = /*#__PURE__*/function () {
4331
4500
  noCache: noCache
4332
4501
  });
4333
4502
  case 13:
4334
- return _context53.abrupt("return", _context53.sent);
4503
+ return _context54.abrupt("return", _context54.sent);
4335
4504
  case 14:
4336
4505
  case "end":
4337
- return _context53.stop();
4506
+ return _context54.stop();
4338
4507
  }
4339
- }, _callee53, this);
4508
+ }, _callee54, this);
4340
4509
  }));
4341
- return function (_x52) {
4342
- return _ref97.apply(this, arguments);
4510
+ return function (_x53) {
4511
+ return _ref99.apply(this, arguments);
4343
4512
  };
4344
4513
  }();
4345
4514
 
@@ -4353,38 +4522,38 @@ exports.GenerateStateChannelToken = /*#__PURE__*/function () {
4353
4522
  * @param {number} percentComplete - Completion percentage of the content
4354
4523
  */
4355
4524
  exports.FinalizeStateChannelAccess = /*#__PURE__*/function () {
4356
- var _ref99 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee54(_ref98) {
4525
+ var _ref101 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee55(_ref100) {
4357
4526
  var objectId, versionHash, percentComplete;
4358
- return _regeneratorRuntime.wrap(function _callee54$(_context54) {
4359
- while (1) switch (_context54.prev = _context54.next) {
4527
+ return _regeneratorRuntime.wrap(function _callee55$(_context55) {
4528
+ while (1) switch (_context55.prev = _context55.next) {
4360
4529
  case 0:
4361
- objectId = _ref98.objectId, versionHash = _ref98.versionHash, percentComplete = _ref98.percentComplete;
4530
+ objectId = _ref100.objectId, versionHash = _ref100.versionHash, percentComplete = _ref100.percentComplete;
4362
4531
  versionHash ? ValidateVersion(versionHash) : ValidateObject(objectId);
4363
4532
  if (!versionHash) {
4364
- _context54.next = 6;
4533
+ _context55.next = 6;
4365
4534
  break;
4366
4535
  }
4367
4536
  objectId = this.utils.DecodeVersionHash(versionHash).objectId;
4368
- _context54.next = 13;
4537
+ _context55.next = 13;
4369
4538
  break;
4370
4539
  case 6:
4371
4540
  if (!this.stateChannelAccess[objectId]) {
4372
- _context54.next = 10;
4541
+ _context55.next = 10;
4373
4542
  break;
4374
4543
  }
4375
4544
  versionHash = this.stateChannelAccess[objectId];
4376
- _context54.next = 13;
4545
+ _context55.next = 13;
4377
4546
  break;
4378
4547
  case 10:
4379
- _context54.next = 12;
4548
+ _context55.next = 12;
4380
4549
  return this.LatestVersionHash({
4381
4550
  objectId: objectId
4382
4551
  });
4383
4552
  case 12:
4384
- versionHash = _context54.sent;
4553
+ versionHash = _context55.sent;
4385
4554
  case 13:
4386
4555
  this.stateChannelAccess[objectId] = undefined;
4387
- _context54.next = 16;
4556
+ _context55.next = 16;
4388
4557
  return this.authClient.ChannelContentFinalize({
4389
4558
  objectId: objectId,
4390
4559
  versionHash: versionHash,
@@ -4392,12 +4561,12 @@ exports.FinalizeStateChannelAccess = /*#__PURE__*/function () {
4392
4561
  });
4393
4562
  case 16:
4394
4563
  case "end":
4395
- return _context54.stop();
4564
+ return _context55.stop();
4396
4565
  }
4397
- }, _callee54, this);
4566
+ }, _callee55, this);
4398
4567
  }));
4399
- return function (_x53) {
4400
- return _ref99.apply(this, arguments);
4568
+ return function (_x54) {
4569
+ return _ref101.apply(this, arguments);
4401
4570
  };
4402
4571
  }();
4403
4572
 
@@ -4414,34 +4583,34 @@ exports.FinalizeStateChannelAccess = /*#__PURE__*/function () {
4414
4583
  * @returns {Promise<Object>} - Transaction log of the AccessComplete event
4415
4584
  */
4416
4585
  exports.ContentObjectAccessComplete = /*#__PURE__*/function () {
4417
- var _ref101 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee55(_ref100) {
4418
- var objectId, _ref100$score, score;
4419
- return _regeneratorRuntime.wrap(function _callee55$(_context55) {
4420
- while (1) switch (_context55.prev = _context55.next) {
4586
+ var _ref103 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee56(_ref102) {
4587
+ var objectId, _ref102$score, score;
4588
+ return _regeneratorRuntime.wrap(function _callee56$(_context56) {
4589
+ while (1) switch (_context56.prev = _context56.next) {
4421
4590
  case 0:
4422
- objectId = _ref100.objectId, _ref100$score = _ref100.score, score = _ref100$score === void 0 ? 100 : _ref100$score;
4591
+ objectId = _ref102.objectId, _ref102$score = _ref102.score, score = _ref102$score === void 0 ? 100 : _ref102$score;
4423
4592
  ValidateObject(objectId);
4424
4593
  if (!(score < 0 || score > 100)) {
4425
- _context55.next = 4;
4594
+ _context56.next = 4;
4426
4595
  break;
4427
4596
  }
4428
4597
  throw Error("Invalid AccessComplete score: " + score);
4429
4598
  case 4:
4430
- _context55.next = 6;
4599
+ _context56.next = 6;
4431
4600
  return this.authClient.AccessComplete({
4432
4601
  id: objectId,
4433
4602
  score: score
4434
4603
  });
4435
4604
  case 6:
4436
- return _context55.abrupt("return", _context55.sent);
4605
+ return _context56.abrupt("return", _context56.sent);
4437
4606
  case 7:
4438
4607
  case "end":
4439
- return _context55.stop();
4608
+ return _context56.stop();
4440
4609
  }
4441
- }, _callee55, this);
4610
+ }, _callee56, this);
4442
4611
  }));
4443
- return function (_x54) {
4444
- return _ref101.apply(this, arguments);
4612
+ return function (_x55) {
4613
+ return _ref103.apply(this, arguments);
4445
4614
  };
4446
4615
  }();
4447
4616
 
@@ -4463,62 +4632,62 @@ exports.ContentObjectAccessComplete = /*#__PURE__*/function () {
4463
4632
  * @return {Promise<Array<string>>} - List of addresses of available items
4464
4633
  */
4465
4634
  exports.Collection = /*#__PURE__*/function () {
4466
- var _ref103 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee56(_ref102) {
4635
+ var _ref105 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee57(_ref104) {
4467
4636
  var collectionType, validCollectionTypes, walletAddress;
4468
- return _regeneratorRuntime.wrap(function _callee56$(_context56) {
4469
- while (1) switch (_context56.prev = _context56.next) {
4637
+ return _regeneratorRuntime.wrap(function _callee57$(_context57) {
4638
+ while (1) switch (_context57.prev = _context57.next) {
4470
4639
  case 0:
4471
- collectionType = _ref102.collectionType;
4640
+ collectionType = _ref104.collectionType;
4472
4641
  validCollectionTypes = ["accessGroups", "contentObjects", "contentTypes", "contracts", "libraries"];
4473
4642
  if (validCollectionTypes.includes(collectionType)) {
4474
- _context56.next = 4;
4643
+ _context57.next = 4;
4475
4644
  break;
4476
4645
  }
4477
4646
  throw new Error("Invalid collection type: " + collectionType);
4478
4647
  case 4:
4479
4648
  if (!this.signer) {
4480
- _context56.next = 10;
4649
+ _context57.next = 10;
4481
4650
  break;
4482
4651
  }
4483
- _context56.next = 7;
4652
+ _context57.next = 7;
4484
4653
  return this.userProfileClient.WalletAddress();
4485
4654
  case 7:
4486
- _context56.t0 = _context56.sent;
4487
- _context56.next = 11;
4655
+ _context57.t0 = _context57.sent;
4656
+ _context57.next = 11;
4488
4657
  break;
4489
4658
  case 10:
4490
- _context56.t0 = undefined;
4659
+ _context57.t0 = undefined;
4491
4660
  case 11:
4492
- walletAddress = _context56.t0;
4661
+ walletAddress = _context57.t0;
4493
4662
  if (walletAddress) {
4494
- _context56.next = 14;
4663
+ _context57.next = 14;
4495
4664
  break;
4496
4665
  }
4497
4666
  throw new Error("Unable to get collection: User wallet doesn't exist");
4498
4667
  case 14:
4499
4668
  this.Log("Retrieving ".concat(collectionType, " contract collection for user ").concat(this.signer.address));
4500
- _context56.next = 17;
4669
+ _context57.next = 17;
4501
4670
  return this.ethClient.MakeProviderCall({
4502
4671
  methodName: "send",
4503
4672
  args: ["elv_getWalletCollection", [this.contentSpaceId, "iusr".concat(this.utils.AddressToHash(this.signer.address)), collectionType]]
4504
4673
  });
4505
4674
  case 17:
4506
- _context56.t1 = _context56.sent;
4507
- if (_context56.t1) {
4508
- _context56.next = 20;
4675
+ _context57.t1 = _context57.sent;
4676
+ if (_context57.t1) {
4677
+ _context57.next = 20;
4509
4678
  break;
4510
4679
  }
4511
- _context56.t1 = [];
4680
+ _context57.t1 = [];
4512
4681
  case 20:
4513
- return _context56.abrupt("return", _context56.t1);
4682
+ return _context57.abrupt("return", _context57.t1);
4514
4683
  case 21:
4515
4684
  case "end":
4516
- return _context56.stop();
4685
+ return _context57.stop();
4517
4686
  }
4518
- }, _callee56, this);
4687
+ }, _callee57, this);
4519
4688
  }));
4520
- return function (_x55) {
4521
- return _ref103.apply(this, arguments);
4689
+ return function (_x56) {
4690
+ return _ref105.apply(this, arguments);
4522
4691
  };
4523
4692
  }();
4524
4693
 
@@ -4536,18 +4705,18 @@ exports.Collection = /*#__PURE__*/function () {
4536
4705
  * @returns {Promise<Object>} - Response describing verification results
4537
4706
  */
4538
4707
  exports.VerifyContentObject = /*#__PURE__*/function () {
4539
- var _ref105 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee57(_ref104) {
4708
+ var _ref107 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee58(_ref106) {
4540
4709
  var libraryId, objectId, versionHash;
4541
- return _regeneratorRuntime.wrap(function _callee57$(_context57) {
4542
- while (1) switch (_context57.prev = _context57.next) {
4710
+ return _regeneratorRuntime.wrap(function _callee58$(_context58) {
4711
+ while (1) switch (_context58.prev = _context58.next) {
4543
4712
  case 0:
4544
- libraryId = _ref104.libraryId, objectId = _ref104.objectId, versionHash = _ref104.versionHash;
4713
+ libraryId = _ref106.libraryId, objectId = _ref106.objectId, versionHash = _ref106.versionHash;
4545
4714
  ValidateParameters({
4546
4715
  libraryId: libraryId,
4547
4716
  objectId: objectId,
4548
4717
  versionHash: versionHash
4549
4718
  });
4550
- _context57.next = 4;
4719
+ _context58.next = 4;
4551
4720
  return ContentObjectVerification.VerifyContentObject({
4552
4721
  client: this,
4553
4722
  libraryId: libraryId,
@@ -4555,15 +4724,15 @@ exports.VerifyContentObject = /*#__PURE__*/function () {
4555
4724
  versionHash: versionHash
4556
4725
  });
4557
4726
  case 4:
4558
- return _context57.abrupt("return", _context57.sent);
4727
+ return _context58.abrupt("return", _context58.sent);
4559
4728
  case 5:
4560
4729
  case "end":
4561
- return _context57.stop();
4730
+ return _context58.stop();
4562
4731
  }
4563
- }, _callee57, this);
4732
+ }, _callee58, this);
4564
4733
  }));
4565
- return function (_x56) {
4566
- return _ref105.apply(this, arguments);
4734
+ return function (_x57) {
4735
+ return _ref107.apply(this, arguments);
4567
4736
  };
4568
4737
  }();
4569
4738
 
@@ -4580,12 +4749,12 @@ exports.VerifyContentObject = /*#__PURE__*/function () {
4580
4749
  * @returns {Promise<Object>} - Response containing proof information
4581
4750
  */
4582
4751
  exports.Proofs = /*#__PURE__*/function () {
4583
- var _ref107 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee58(_ref106) {
4752
+ var _ref109 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee59(_ref108) {
4584
4753
  var libraryId, objectId, versionHash, partHash, path;
4585
- return _regeneratorRuntime.wrap(function _callee58$(_context58) {
4586
- while (1) switch (_context58.prev = _context58.next) {
4754
+ return _regeneratorRuntime.wrap(function _callee59$(_context59) {
4755
+ while (1) switch (_context59.prev = _context59.next) {
4587
4756
  case 0:
4588
- libraryId = _ref106.libraryId, objectId = _ref106.objectId, versionHash = _ref106.versionHash, partHash = _ref106.partHash;
4757
+ libraryId = _ref108.libraryId, objectId = _ref108.objectId, versionHash = _ref108.versionHash, partHash = _ref108.partHash;
4589
4758
  ValidateParameters({
4590
4759
  libraryId: libraryId,
4591
4760
  objectId: objectId,
@@ -4596,32 +4765,32 @@ exports.Proofs = /*#__PURE__*/function () {
4596
4765
  objectId = this.utils.DecodeVersionHash(versionHash).objectId;
4597
4766
  }
4598
4767
  path = UrlJoin("q", versionHash || objectId, "data", partHash, "proofs");
4599
- _context58.t0 = this.utils;
4600
- _context58.t1 = this.HttpClient;
4601
- _context58.next = 9;
4768
+ _context59.t0 = this.utils;
4769
+ _context59.t1 = this.HttpClient;
4770
+ _context59.next = 9;
4602
4771
  return this.authClient.AuthorizationHeader({
4603
4772
  libraryId: libraryId,
4604
4773
  objectId: objectId,
4605
4774
  versionHash: versionHash
4606
4775
  });
4607
4776
  case 9:
4608
- _context58.t2 = _context58.sent;
4609
- _context58.t3 = path;
4610
- _context58.t4 = {
4611
- headers: _context58.t2,
4777
+ _context59.t2 = _context59.sent;
4778
+ _context59.t3 = path;
4779
+ _context59.t4 = {
4780
+ headers: _context59.t2,
4612
4781
  method: "GET",
4613
- path: _context58.t3
4782
+ path: _context59.t3
4614
4783
  };
4615
- _context58.t5 = _context58.t1.Request.call(_context58.t1, _context58.t4);
4616
- return _context58.abrupt("return", _context58.t0.ResponseToJson.call(_context58.t0, _context58.t5));
4784
+ _context59.t5 = _context59.t1.Request.call(_context59.t1, _context59.t4);
4785
+ return _context59.abrupt("return", _context59.t0.ResponseToJson.call(_context59.t0, _context59.t5));
4617
4786
  case 14:
4618
4787
  case "end":
4619
- return _context58.stop();
4788
+ return _context59.stop();
4620
4789
  }
4621
- }, _callee58, this);
4790
+ }, _callee59, this);
4622
4791
  }));
4623
- return function (_x57) {
4624
- return _ref107.apply(this, arguments);
4792
+ return function (_x58) {
4793
+ return _ref109.apply(this, arguments);
4625
4794
  };
4626
4795
  }();
4627
4796
 
@@ -4638,12 +4807,12 @@ exports.Proofs = /*#__PURE__*/function () {
4638
4807
  * @returns {Promise<Format>} - Response containing the CBOR response in the specified format
4639
4808
  */
4640
4809
  exports.QParts = /*#__PURE__*/function () {
4641
- var _ref109 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee59(_ref108) {
4642
- var libraryId, objectId, partHash, _ref108$format, format, path;
4643
- return _regeneratorRuntime.wrap(function _callee59$(_context59) {
4644
- while (1) switch (_context59.prev = _context59.next) {
4810
+ var _ref111 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee60(_ref110) {
4811
+ var libraryId, objectId, partHash, _ref110$format, format, path;
4812
+ return _regeneratorRuntime.wrap(function _callee60$(_context60) {
4813
+ while (1) switch (_context60.prev = _context60.next) {
4645
4814
  case 0:
4646
- libraryId = _ref108.libraryId, objectId = _ref108.objectId, partHash = _ref108.partHash, _ref108$format = _ref108.format, format = _ref108$format === void 0 ? "blob" : _ref108$format;
4815
+ libraryId = _ref110.libraryId, objectId = _ref110.objectId, partHash = _ref110.partHash, _ref110$format = _ref110.format, format = _ref110$format === void 0 ? "blob" : _ref110$format;
4647
4816
  ValidateParameters({
4648
4817
  libraryId: libraryId,
4649
4818
  objectId: objectId,
@@ -4651,32 +4820,32 @@ exports.QParts = /*#__PURE__*/function () {
4651
4820
  });
4652
4821
  ValidatePartHash(partHash);
4653
4822
  path = UrlJoin("qparts", partHash);
4654
- _context59.t0 = this.utils;
4655
- _context59.t1 = format;
4656
- _context59.t2 = this.HttpClient;
4657
- _context59.next = 9;
4823
+ _context60.t0 = this.utils;
4824
+ _context60.t1 = format;
4825
+ _context60.t2 = this.HttpClient;
4826
+ _context60.next = 9;
4658
4827
  return this.authClient.AuthorizationHeader({
4659
4828
  libraryId: libraryId,
4660
4829
  objectId: objectId,
4661
4830
  partHash: partHash
4662
4831
  });
4663
4832
  case 9:
4664
- _context59.t3 = _context59.sent;
4665
- _context59.t4 = path;
4666
- _context59.t5 = {
4667
- headers: _context59.t3,
4833
+ _context60.t3 = _context60.sent;
4834
+ _context60.t4 = path;
4835
+ _context60.t5 = {
4836
+ headers: _context60.t3,
4668
4837
  method: "GET",
4669
- path: _context59.t4
4838
+ path: _context60.t4
4670
4839
  };
4671
- _context59.t6 = _context59.t2.Request.call(_context59.t2, _context59.t5);
4672
- return _context59.abrupt("return", _context59.t0.ResponseToFormat.call(_context59.t0, _context59.t1, _context59.t6));
4840
+ _context60.t6 = _context60.t2.Request.call(_context60.t2, _context60.t5);
4841
+ return _context60.abrupt("return", _context60.t0.ResponseToFormat.call(_context60.t0, _context60.t1, _context60.t6));
4673
4842
  case 14:
4674
4843
  case "end":
4675
- return _context59.stop();
4844
+ return _context60.stop();
4676
4845
  }
4677
- }, _callee59, this);
4846
+ }, _callee60, this);
4678
4847
  }));
4679
- return function (_x58) {
4680
- return _ref109.apply(this, arguments);
4848
+ return function (_x59) {
4849
+ return _ref111.apply(this, arguments);
4681
4850
  };
4682
4851
  }();