@eluvio/elv-client-js 4.0.56 → 4.0.58

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