@eluvio/elv-client-js 4.0.21 → 4.0.23

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.
@@ -340,9 +340,9 @@ exports.UploadFilesFromS3 = /*#__PURE__*/function () {
340
340
  exports.UploadFiles = /*#__PURE__*/function () {
341
341
  var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref5) {
342
342
  var _this = this;
343
- var libraryId, objectId, writeToken, fileInfo, _ref5$encryption, encryption, callback, conk, progress, fileDataMap, i, entry, _yield$this$CreateFil2, id, jobs, bufferSize, jobSpecs, prepared, uploaded, PrepareJobs, UploadJob, rateTestJobs, rates, j, start, elapsed, size, averageRate, concurrentUploads;
344
- return _regeneratorRuntime.wrap(function _callee6$(_context6) {
345
- while (1) switch (_context6.prev = _context6.next) {
343
+ var libraryId, objectId, writeToken, fileInfo, _ref5$encryption, encryption, callback, conk, progress, fileDataMap, originalFileInfo, i, entry, _yield$this$CreateFil2, id, jobs, bufferSize, jobSpecs, prepared, uploaded, PrepareJobs, UploadJob, rateTestJobs, rates, j, start, elapsed, size, averageRate, concurrentUploads;
344
+ return _regeneratorRuntime.wrap(function _callee6$(_context7) {
345
+ while (1) switch (_context7.prev = _context7.next) {
346
346
  case 0:
347
347
  libraryId = _ref5.libraryId, objectId = _ref5.objectId, writeToken = _ref5.writeToken, fileInfo = _ref5.fileInfo, _ref5$encryption = _ref5.encryption, encryption = _ref5$encryption === void 0 ? "none" : _ref5$encryption, callback = _ref5.callback;
348
348
  ValidateParameters({
@@ -350,25 +350,28 @@ exports.UploadFiles = /*#__PURE__*/function () {
350
350
  objectId: objectId
351
351
  });
352
352
  ValidateWriteToken(writeToken);
353
+ ValidatePresence("fileInfo", fileInfo);
353
354
  this.Log("Uploading files: ".concat(libraryId, " ").concat(objectId, " ").concat(writeToken));
354
355
  if (!(encryption === "cgck")) {
355
- _context6.next = 8;
356
+ _context7.next = 9;
356
357
  break;
357
358
  }
358
- _context6.next = 7;
359
+ _context7.next = 8;
359
360
  return this.EncryptionConk({
360
361
  libraryId: libraryId,
361
362
  objectId: objectId,
362
363
  writeToken: writeToken
363
364
  });
364
- case 7:
365
- conk = _context6.sent;
366
365
  case 8:
366
+ conk = _context7.sent;
367
+ case 9:
367
368
  // Extract file data into easily accessible hash while removing the data from the fileinfo for upload job creation
368
369
  progress = {};
369
370
  fileDataMap = {};
370
- for (i = 0; i < fileInfo.length; i++) {
371
- entry = _objectSpread(_objectSpread({}, fileInfo[i]), {}, {
371
+ originalFileInfo = fileInfo;
372
+ fileInfo = [];
373
+ for (i = 0; i < originalFileInfo.length; i++) {
374
+ entry = _objectSpread(_objectSpread({}, originalFileInfo[i]), {}, {
372
375
  data: undefined
373
376
  });
374
377
  entry.path = entry.path.replace(/^\/+/, "");
@@ -377,20 +380,19 @@ exports.UploadFiles = /*#__PURE__*/function () {
377
380
  scheme: "cgck"
378
381
  };
379
382
  }
380
- fileDataMap[entry.path] = fileInfo[i].data;
381
- delete entry.data;
383
+ fileDataMap[entry.path] = originalFileInfo[i].data;
382
384
  entry.type = "file";
383
385
  progress[entry.path] = {
384
386
  uploaded: 0,
385
387
  total: entry.size
386
388
  };
387
- fileInfo[i] = entry;
389
+ fileInfo.push(entry);
388
390
  }
389
391
  this.Log(fileInfo);
390
392
  if (callback) {
391
393
  callback(progress);
392
394
  }
393
- _context6.next = 15;
395
+ _context7.next = 18;
394
396
  return this.CreateFileUploadJob({
395
397
  libraryId: libraryId,
396
398
  objectId: objectId,
@@ -398,15 +400,15 @@ exports.UploadFiles = /*#__PURE__*/function () {
398
400
  ops: fileInfo,
399
401
  encryption: encryption
400
402
  });
401
- case 15:
402
- _yield$this$CreateFil2 = _context6.sent;
403
+ case 18:
404
+ _yield$this$CreateFil2 = _context7.sent;
403
405
  id = _yield$this$CreateFil2.id;
404
406
  jobs = _yield$this$CreateFil2.jobs;
405
407
  this.Log("Upload ID: ".concat(id));
406
408
  this.Log(jobs);
407
409
 
408
410
  // How far encryption can get ahead of upload
409
- bufferSize = 100 * 1024 * 1024;
411
+ bufferSize = 500 * 1024 * 1024;
410
412
  jobSpecs = [];
411
413
  prepared = 0;
412
414
  uploaded = 0; // Insert the data to upload into the job spec, encrypting if necessary
@@ -502,58 +504,98 @@ exports.UploadFiles = /*#__PURE__*/function () {
502
504
  }();
503
505
  UploadJob = /*#__PURE__*/function () {
504
506
  var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(jobId, j) {
505
- var jobSpec, files, f, _fileInfo2;
506
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
507
- while (1) switch (_context4.prev = _context4.next) {
507
+ var jobSpec, files, _loop, f;
508
+ return _regeneratorRuntime.wrap(function _callee4$(_context5) {
509
+ while (1) switch (_context5.prev = _context5.next) {
508
510
  case 0:
509
511
  if (jobSpecs[j]) {
510
- _context4.next = 5;
512
+ _context5.next = 5;
511
513
  break;
512
514
  }
513
- _context4.next = 3;
515
+ _context5.next = 3;
514
516
  return new Promise(function (resolve) {
515
517
  return setTimeout(resolve, 500);
516
518
  });
517
519
  case 3:
518
- _context4.next = 0;
520
+ _context5.next = 0;
519
521
  break;
520
522
  case 5:
521
523
  jobSpec = jobSpecs[j];
522
524
  files = jobSpec.files; // Upload each item
525
+ _loop = /*#__PURE__*/_regeneratorRuntime.mark(function _loop() {
526
+ var fileInfo, retries, succeeded;
527
+ return _regeneratorRuntime.wrap(function _loop$(_context4) {
528
+ while (1) switch (_context4.prev = _context4.next) {
529
+ case 0:
530
+ fileInfo = files[f];
531
+ retries = 0;
532
+ succeeded = false;
533
+ case 3:
534
+ _context4.prev = 3;
535
+ _context4.next = 6;
536
+ return _this.UploadFileData({
537
+ libraryId: libraryId,
538
+ objectId: objectId,
539
+ writeToken: writeToken,
540
+ uploadId: id,
541
+ jobId: jobId,
542
+ filePath: fileInfo.path,
543
+ fileData: fileInfo.data,
544
+ encryption: encryption
545
+ });
546
+ case 6:
547
+ succeeded = true;
548
+ _context4.next = 17;
549
+ break;
550
+ case 9:
551
+ _context4.prev = 9;
552
+ _context4.t0 = _context4["catch"](3);
553
+ _this.Log(_context4.t0, true);
554
+ retries += 1;
555
+ if (!(retries >= 10)) {
556
+ _context4.next = 15;
557
+ break;
558
+ }
559
+ throw _context4.t0;
560
+ case 15:
561
+ _context4.next = 17;
562
+ return new Promise(function (resolve) {
563
+ return setTimeout(resolve, 10 * retries * 1000);
564
+ });
565
+ case 17:
566
+ if (!succeeded && retries < 10) {
567
+ _context4.next = 3;
568
+ break;
569
+ }
570
+ case 18:
571
+ delete jobSpecs[j].files[f].data;
572
+ uploaded += fileInfo.len;
573
+ if (callback) {
574
+ progress[fileInfo.path] = _objectSpread(_objectSpread({}, progress[fileInfo.path]), {}, {
575
+ uploaded: progress[fileInfo.path].uploaded + fileInfo.len
576
+ });
577
+ callback(progress);
578
+ }
579
+ case 21:
580
+ case "end":
581
+ return _context4.stop();
582
+ }
583
+ }, _loop, null, [[3, 9]]);
584
+ });
523
585
  f = 0;
524
- case 8:
586
+ case 9:
525
587
  if (!(f < files.length)) {
526
- _context4.next = 18;
588
+ _context5.next = 14;
527
589
  break;
528
590
  }
529
- _fileInfo2 = files[f];
530
- _context4.next = 12;
531
- return _this.UploadFileData({
532
- libraryId: libraryId,
533
- objectId: objectId,
534
- writeToken: writeToken,
535
- uploadId: id,
536
- jobId: jobId,
537
- filePath: _fileInfo2.path,
538
- fileData: _fileInfo2.data,
539
- encryption: encryption
540
- });
541
- case 12:
542
- delete jobSpecs[j].files[f].data;
543
- uploaded += _fileInfo2.len;
544
- if (callback) {
545
- progress[_fileInfo2.path] = _objectSpread(_objectSpread({}, progress[_fileInfo2.path]), {}, {
546
- uploaded: progress[_fileInfo2.path].uploaded + _fileInfo2.len
547
- });
548
- callback(progress);
549
- }
550
- case 15:
591
+ return _context5.delegateYield(_loop(), "t0", 11);
592
+ case 11:
551
593
  f++;
552
- _context4.next = 8;
594
+ _context5.next = 9;
553
595
  break;
554
- case 18:
596
+ case 14:
555
597
  case "end":
556
- return _context4.stop();
598
+ return _context5.stop();
557
599
  }
558
600
  }, _callee4);
559
601
  }));
@@ -569,15 +611,15 @@ exports.UploadFiles = /*#__PURE__*/function () {
569
611
  rateTestJobs = Math.min(3, jobs.length);
570
612
  rates = [];
571
613
  j = 0;
572
- case 30:
614
+ case 33:
573
615
  if (!(j < rateTestJobs)) {
574
- _context6.next = 40;
616
+ _context7.next = 43;
575
617
  break;
576
618
  }
577
619
  start = new Date().getTime();
578
- _context6.next = 34;
620
+ _context7.next = 37;
579
621
  return UploadJob(jobs[j], j);
580
- case 34:
622
+ case 37:
581
623
  elapsed = (new Date().getTime() - start) / 1000;
582
624
  size = jobSpecs[j].files.map(function (file) {
583
625
  return file.len;
@@ -585,32 +627,32 @@ exports.UploadFiles = /*#__PURE__*/function () {
585
627
  return length + total;
586
628
  }, 0);
587
629
  rates.push(size / elapsed / (1024 * 1024));
588
- case 37:
630
+ case 40:
589
631
  j++;
590
- _context6.next = 30;
632
+ _context7.next = 33;
591
633
  break;
592
- case 40:
634
+ case 43:
593
635
  averageRate = rates.reduce(function (mbps, total) {
594
636
  return mbps + total;
595
637
  }, 0) / rateTestJobs; // Upload remaining jobs in parallel
596
638
  concurrentUploads = Math.min(5, Math.ceil(averageRate / 2));
597
- _context6.next = 44;
639
+ _context7.next = 47;
598
640
  return this.utils.LimitedMap(concurrentUploads, jobs, /*#__PURE__*/function () {
599
641
  var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(jobId, j) {
600
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
601
- while (1) switch (_context5.prev = _context5.next) {
642
+ return _regeneratorRuntime.wrap(function _callee5$(_context6) {
643
+ while (1) switch (_context6.prev = _context6.next) {
602
644
  case 0:
603
645
  if (!(j < rateTestJobs)) {
604
- _context5.next = 2;
646
+ _context6.next = 2;
605
647
  break;
606
648
  }
607
- return _context5.abrupt("return");
649
+ return _context6.abrupt("return");
608
650
  case 2:
609
- _context5.next = 4;
651
+ _context6.next = 4;
610
652
  return UploadJob(jobId, j);
611
653
  case 4:
612
654
  case "end":
613
- return _context5.stop();
655
+ return _context6.stop();
614
656
  }
615
657
  }, _callee5);
616
658
  }));
@@ -618,9 +660,9 @@ exports.UploadFiles = /*#__PURE__*/function () {
618
660
  return _ref9.apply(this, arguments);
619
661
  };
620
662
  }());
621
- case 44:
663
+ case 47:
622
664
  case "end":
623
- return _context6.stop();
665
+ return _context7.stop();
624
666
  }
625
667
  }, _callee6, this);
626
668
  }));
@@ -631,8 +673,8 @@ exports.UploadFiles = /*#__PURE__*/function () {
631
673
  exports.CreateFileUploadJob = /*#__PURE__*/function () {
632
674
  var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref10) {
633
675
  var libraryId, objectId, writeToken, ops, _ref10$defaults, defaults, _ref10$encryption, encryption, body, path;
634
- return _regeneratorRuntime.wrap(function _callee7$(_context7) {
635
- while (1) switch (_context7.prev = _context7.next) {
676
+ return _regeneratorRuntime.wrap(function _callee7$(_context8) {
677
+ while (1) switch (_context8.prev = _context8.next) {
636
678
  case 0:
637
679
  libraryId = _ref10.libraryId, objectId = _ref10.objectId, writeToken = _ref10.writeToken, ops = _ref10.ops, _ref10$defaults = _ref10.defaults, defaults = _ref10$defaults === void 0 ? {} : _ref10$defaults, _ref10$encryption = _ref10.encryption, encryption = _ref10$encryption === void 0 ? "none" : _ref10$encryption;
638
680
  ValidateParameters({
@@ -654,9 +696,9 @@ exports.CreateFileUploadJob = /*#__PURE__*/function () {
654
696
  ops: ops
655
697
  };
656
698
  path = UrlJoin("q", writeToken, "file_jobs");
657
- _context7.t0 = this.utils;
658
- _context7.t1 = this.HttpClient;
659
- _context7.next = 12;
699
+ _context8.t0 = this.utils;
700
+ _context8.t1 = this.HttpClient;
701
+ _context8.next = 12;
660
702
  return this.authClient.AuthorizationHeader({
661
703
  libraryId: libraryId,
662
704
  objectId: objectId,
@@ -664,21 +706,21 @@ exports.CreateFileUploadJob = /*#__PURE__*/function () {
664
706
  encryption: encryption
665
707
  });
666
708
  case 12:
667
- _context7.t2 = _context7.sent;
668
- _context7.t3 = path;
669
- _context7.t4 = body;
670
- _context7.t5 = {
671
- headers: _context7.t2,
709
+ _context8.t2 = _context8.sent;
710
+ _context8.t3 = path;
711
+ _context8.t4 = body;
712
+ _context8.t5 = {
713
+ headers: _context8.t2,
672
714
  method: "POST",
673
- path: _context7.t3,
674
- body: _context7.t4,
675
- failover: false
715
+ path: _context8.t3,
716
+ body: _context8.t4,
717
+ allowFailover: false
676
718
  };
677
- _context7.t6 = _context7.t1.Request.call(_context7.t1, _context7.t5);
678
- return _context7.abrupt("return", _context7.t0.ResponseToJson.call(_context7.t0, _context7.t6));
719
+ _context8.t6 = _context8.t1.Request.call(_context8.t1, _context8.t5);
720
+ return _context8.abrupt("return", _context8.t0.ResponseToJson.call(_context8.t0, _context8.t6));
679
721
  case 18:
680
722
  case "end":
681
- return _context7.stop();
723
+ return _context8.stop();
682
724
  }
683
725
  }, _callee7, this);
684
726
  }));
@@ -689,8 +731,8 @@ exports.CreateFileUploadJob = /*#__PURE__*/function () {
689
731
  exports.UploadStatus = /*#__PURE__*/function () {
690
732
  var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref12) {
691
733
  var libraryId, objectId, writeToken, uploadId, path;
692
- return _regeneratorRuntime.wrap(function _callee8$(_context8) {
693
- while (1) switch (_context8.prev = _context8.next) {
734
+ return _regeneratorRuntime.wrap(function _callee8$(_context9) {
735
+ while (1) switch (_context9.prev = _context9.next) {
694
736
  case 0:
695
737
  libraryId = _ref12.libraryId, objectId = _ref12.objectId, writeToken = _ref12.writeToken, uploadId = _ref12.uploadId;
696
738
  ValidateParameters({
@@ -699,28 +741,28 @@ exports.UploadStatus = /*#__PURE__*/function () {
699
741
  });
700
742
  ValidateWriteToken(writeToken);
701
743
  path = UrlJoin("q", writeToken, "file_jobs", uploadId);
702
- _context8.t0 = this.utils;
703
- _context8.t1 = this.HttpClient;
704
- _context8.next = 8;
744
+ _context9.t0 = this.utils;
745
+ _context9.t1 = this.HttpClient;
746
+ _context9.next = 8;
705
747
  return this.authClient.AuthorizationHeader({
706
748
  libraryId: libraryId,
707
749
  objectId: objectId,
708
750
  update: true
709
751
  });
710
752
  case 8:
711
- _context8.t2 = _context8.sent;
712
- _context8.t3 = path;
713
- _context8.t4 = {
714
- headers: _context8.t2,
753
+ _context9.t2 = _context9.sent;
754
+ _context9.t3 = path;
755
+ _context9.t4 = {
756
+ headers: _context9.t2,
715
757
  method: "GET",
716
- path: _context8.t3,
717
- failover: false
758
+ path: _context9.t3,
759
+ allowFailover: false
718
760
  };
719
- _context8.t5 = _context8.t1.Request.call(_context8.t1, _context8.t4);
720
- return _context8.abrupt("return", _context8.t0.ResponseToJson.call(_context8.t0, _context8.t5));
761
+ _context9.t5 = _context9.t1.Request.call(_context9.t1, _context9.t4);
762
+ return _context9.abrupt("return", _context9.t0.ResponseToJson.call(_context9.t0, _context9.t5));
721
763
  case 13:
722
764
  case "end":
723
- return _context8.stop();
765
+ return _context9.stop();
724
766
  }
725
767
  }, _callee8, this);
726
768
  }));
@@ -730,9 +772,9 @@ exports.UploadStatus = /*#__PURE__*/function () {
730
772
  }();
731
773
  exports.UploadJobStatus = /*#__PURE__*/function () {
732
774
  var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(_ref14) {
733
- var libraryId, objectId, writeToken, uploadId, jobId, path, retries, jobStatus;
734
- return _regeneratorRuntime.wrap(function _callee9$(_context9) {
735
- while (1) switch (_context9.prev = _context9.next) {
775
+ var libraryId, objectId, writeToken, uploadId, jobId, path;
776
+ return _regeneratorRuntime.wrap(function _callee9$(_context10) {
777
+ while (1) switch (_context10.prev = _context10.next) {
736
778
  case 0:
737
779
  libraryId = _ref14.libraryId, objectId = _ref14.objectId, writeToken = _ref14.writeToken, uploadId = _ref14.uploadId, jobId = _ref14.jobId;
738
780
  ValidateParameters({
@@ -740,55 +782,34 @@ exports.UploadJobStatus = /*#__PURE__*/function () {
740
782
  objectId: objectId
741
783
  });
742
784
  ValidateWriteToken(writeToken);
743
- path = UrlJoin("q", writeToken, "file_jobs", uploadId, "uploads", jobId); // This request is sent during file data upload and might fail due to congestion
744
- retries = 0;
745
- case 5:
746
- _context9.prev = 5;
747
- _context9.t0 = this.utils;
748
- _context9.t1 = this.HttpClient;
749
- _context9.next = 10;
785
+ path = UrlJoin("q", writeToken, "file_jobs", uploadId, "uploads", jobId);
786
+ _context10.t0 = this.utils;
787
+ _context10.t1 = this.HttpClient;
788
+ _context10.next = 8;
750
789
  return this.authClient.AuthorizationHeader({
751
790
  libraryId: libraryId,
752
791
  objectId: objectId,
753
792
  update: true
754
793
  });
755
- case 10:
756
- _context9.t2 = _context9.sent;
757
- _context9.t3 = path;
758
- _context9.t4 = {
759
- headers: _context9.t2,
794
+ case 8:
795
+ _context10.t2 = _context10.sent;
796
+ _context10.t3 = path;
797
+ _context10.t4 = {
798
+ headers: _context10.t2,
760
799
  method: "GET",
761
- path: _context9.t3,
762
- failover: false
800
+ path: _context10.t3,
801
+ allowFailover: false
763
802
  };
764
- _context9.t5 = _context9.t1.Request.call(_context9.t1, _context9.t4);
765
- jobStatus = _context9.t0.ResponseToJson.call(_context9.t0, _context9.t5);
766
- return _context9.abrupt("return", jobStatus);
767
- case 18:
768
- _context9.prev = 18;
769
- _context9.t6 = _context9["catch"](5);
770
- this.Log(_context9.t6, true);
771
- retries += 1;
772
- if (!(retries >= 5)) {
773
- _context9.next = 24;
774
- break;
775
- }
776
- throw _context9.t6;
777
- case 24:
778
- _context9.next = 26;
779
- return new Promise(function (resolve) {
780
- return setTimeout(resolve, 10 * retries * 1000);
781
- });
782
- case 26:
783
- if (retries < 5) {
784
- _context9.next = 5;
785
- break;
786
- }
787
- case 27:
803
+ _context10.t5 = _context10.t1.Request.call(_context10.t1, _context10.t4);
804
+ _context10.next = 14;
805
+ return _context10.t0.ResponseToJson.call(_context10.t0, _context10.t5);
806
+ case 14:
807
+ return _context10.abrupt("return", _context10.sent);
808
+ case 15:
788
809
  case "end":
789
- return _context9.stop();
810
+ return _context10.stop();
790
811
  }
791
- }, _callee9, this, [[5, 18]]);
812
+ }, _callee9, this);
792
813
  }));
793
814
  return function (_x10) {
794
815
  return _ref15.apply(this, arguments);
@@ -796,9 +817,9 @@ exports.UploadJobStatus = /*#__PURE__*/function () {
796
817
  }();
797
818
  exports.UploadFileData = /*#__PURE__*/function () {
798
819
  var _ref17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(_ref16) {
799
- var libraryId, objectId, writeToken, encryption, uploadId, jobId, filePath, fileData, retries, jobStatus, fileStatus, path;
800
- return _regeneratorRuntime.wrap(function _callee10$(_context10) {
801
- while (1) switch (_context10.prev = _context10.next) {
820
+ var libraryId, objectId, writeToken, encryption, uploadId, jobId, filePath, fileData, jobStatus, fileStatus, path;
821
+ return _regeneratorRuntime.wrap(function _callee10$(_context11) {
822
+ while (1) switch (_context11.prev = _context11.next) {
802
823
  case 0:
803
824
  libraryId = _ref16.libraryId, objectId = _ref16.objectId, writeToken = _ref16.writeToken, encryption = _ref16.encryption, uploadId = _ref16.uploadId, jobId = _ref16.jobId, filePath = _ref16.filePath, fileData = _ref16.fileData;
804
825
  ValidateParameters({
@@ -806,10 +827,7 @@ exports.UploadFileData = /*#__PURE__*/function () {
806
827
  objectId: objectId
807
828
  });
808
829
  ValidateWriteToken(writeToken);
809
- retries = 0;
810
- case 4:
811
- _context10.prev = 4;
812
- _context10.next = 7;
830
+ _context11.next = 5;
813
831
  return this.UploadJobStatus({
814
832
  libraryId: libraryId,
815
833
  objectId: objectId,
@@ -817,8 +835,8 @@ exports.UploadFileData = /*#__PURE__*/function () {
817
835
  uploadId: uploadId,
818
836
  jobId: jobId
819
837
  });
820
- case 7:
821
- jobStatus = _context10.sent;
838
+ case 5:
839
+ jobStatus = _context11.sent;
822
840
  // Find the status of this file
823
841
  fileStatus = jobStatus.files.find(function (item) {
824
842
  return item.path == filePath;
@@ -827,71 +845,52 @@ exports.UploadFileData = /*#__PURE__*/function () {
827
845
  fileStatus = fileStatus.encrypted;
828
846
  }
829
847
  if (!(fileStatus.rem === 0)) {
830
- _context10.next = 14;
848
+ _context11.next = 12;
831
849
  break;
832
850
  }
833
- return _context10.abrupt("return");
834
- case 14:
851
+ return _context11.abrupt("return");
852
+ case 12:
835
853
  if (fileStatus.skip) {
836
854
  fileData = fileData.slice(fileStatus.skip);
837
855
  }
838
- case 15:
856
+ case 13:
839
857
  path = UrlJoin("q", writeToken, "file_jobs", uploadId, jobId);
840
- _context10.t0 = this.utils;
841
- _context10.t1 = this.HttpClient;
842
- _context10.t2 = path;
843
- _context10.t3 = fileData;
844
- _context10.t4 = _objectSpread;
845
- _context10.t5 = {
858
+ _context11.t0 = this.utils;
859
+ _context11.t1 = this.HttpClient;
860
+ _context11.t2 = path;
861
+ _context11.t3 = fileData;
862
+ _context11.t4 = _objectSpread;
863
+ _context11.t5 = {
846
864
  "Content-type": "application/octet-stream"
847
865
  };
848
- _context10.next = 24;
866
+ _context11.next = 22;
849
867
  return this.authClient.AuthorizationHeader({
850
868
  libraryId: libraryId,
851
869
  objectId: objectId,
852
870
  update: true
853
871
  });
854
- case 24:
855
- _context10.t6 = _context10.sent;
856
- _context10.t7 = (0, _context10.t4)(_context10.t5, _context10.t6);
857
- _context10.t8 = {
872
+ case 22:
873
+ _context11.t6 = _context11.sent;
874
+ _context11.t7 = (0, _context11.t4)(_context11.t5, _context11.t6);
875
+ _context11.t8 = {
858
876
  method: "POST",
859
- path: _context10.t2,
860
- body: _context10.t3,
877
+ path: _context11.t2,
878
+ body: _context11.t3,
861
879
  bodyType: "BINARY",
862
- headers: _context10.t7,
863
- failover: false
880
+ headers: _context11.t7,
881
+ allowFailover: false,
882
+ allowRetry: false
864
883
  };
865
- _context10.t9 = _context10.t1.Request.call(_context10.t1, _context10.t8);
866
- _context10.next = 30;
867
- return _context10.t0.ResponseToJson.call(_context10.t0, _context10.t9);
868
- case 30:
869
- return _context10.abrupt("return", _context10.sent);
870
- case 33:
871
- _context10.prev = 33;
872
- _context10.t10 = _context10["catch"](4);
873
- this.Log(_context10.t10, true);
874
- retries += 1;
875
- if (!(retries >= 5)) {
876
- _context10.next = 39;
877
- break;
878
- }
879
- throw _context10.t10;
880
- case 39:
881
- _context10.next = 41;
882
- return new Promise(function (resolve) {
883
- return setTimeout(resolve, 10 * retries * 1000);
884
- });
885
- case 41:
886
- if (retries < 5) {
887
- _context10.next = 4;
888
- break;
889
- }
890
- case 42:
884
+ _context11.t9 = _context11.t1.Request.call(_context11.t1, _context11.t8);
885
+ _context11.next = 28;
886
+ return _context11.t0.ResponseToJson.call(_context11.t0, _context11.t9);
887
+ case 28:
888
+ return _context11.abrupt("return", _context11.sent);
889
+ case 29:
891
890
  case "end":
892
- return _context10.stop();
891
+ return _context11.stop();
893
892
  }
894
- }, _callee10, this, [[4, 33]]);
893
+ }, _callee10, this);
895
894
  }));
896
895
  return function (_x11) {
897
896
  return _ref17.apply(this, arguments);
@@ -900,8 +899,8 @@ exports.UploadFileData = /*#__PURE__*/function () {
900
899
  exports.FinalizeUploadJob = /*#__PURE__*/function () {
901
900
  var _ref19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(_ref18) {
902
901
  var libraryId, objectId, writeToken, path;
903
- return _regeneratorRuntime.wrap(function _callee11$(_context11) {
904
- while (1) switch (_context11.prev = _context11.next) {
902
+ return _regeneratorRuntime.wrap(function _callee11$(_context12) {
903
+ while (1) switch (_context12.prev = _context12.next) {
905
904
  case 0:
906
905
  libraryId = _ref18.libraryId, objectId = _ref18.objectId, writeToken = _ref18.writeToken;
907
906
  ValidateParameters({
@@ -911,28 +910,28 @@ exports.FinalizeUploadJob = /*#__PURE__*/function () {
911
910
  ValidateWriteToken(writeToken);
912
911
  this.Log("Finalizing upload job: ".concat(libraryId, " ").concat(objectId, " ").concat(writeToken));
913
912
  path = UrlJoin("q", writeToken, "files");
914
- _context11.t0 = this.HttpClient;
915
- _context11.t1 = path;
916
- _context11.next = 9;
913
+ _context12.t0 = this.HttpClient;
914
+ _context12.t1 = path;
915
+ _context12.next = 9;
917
916
  return this.authClient.AuthorizationHeader({
918
917
  libraryId: libraryId,
919
918
  objectId: objectId,
920
919
  update: true
921
920
  });
922
921
  case 9:
923
- _context11.t2 = _context11.sent;
924
- _context11.t3 = {
922
+ _context12.t2 = _context12.sent;
923
+ _context12.t3 = {
925
924
  method: "POST",
926
- path: _context11.t1,
925
+ path: _context12.t1,
927
926
  bodyType: "BINARY",
928
- headers: _context11.t2,
929
- failover: false
927
+ headers: _context12.t2,
928
+ allowFailover: false
930
929
  };
931
- _context11.next = 13;
932
- return _context11.t0.Request.call(_context11.t0, _context11.t3);
930
+ _context12.next = 13;
931
+ return _context12.t0.Request.call(_context12.t0, _context12.t3);
933
932
  case 13:
934
933
  case "end":
935
- return _context11.stop();
934
+ return _context12.stop();
936
935
  }
937
936
  }, _callee11, this);
938
937
  }));
@@ -955,8 +954,8 @@ exports.FinalizeUploadJob = /*#__PURE__*/function () {
955
954
  exports.CreateFileDirectories = /*#__PURE__*/function () {
956
955
  var _ref21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(_ref20) {
957
956
  var libraryId, objectId, writeToken, filePaths, ops;
958
- return _regeneratorRuntime.wrap(function _callee12$(_context12) {
959
- while (1) switch (_context12.prev = _context12.next) {
957
+ return _regeneratorRuntime.wrap(function _callee12$(_context13) {
958
+ while (1) switch (_context13.prev = _context13.next) {
960
959
  case 0:
961
960
  libraryId = _ref20.libraryId, objectId = _ref20.objectId, writeToken = _ref20.writeToken, filePaths = _ref20.filePaths;
962
961
  ValidateParameters({
@@ -973,7 +972,7 @@ exports.CreateFileDirectories = /*#__PURE__*/function () {
973
972
  path: path
974
973
  };
975
974
  });
976
- _context12.next = 8;
975
+ _context13.next = 8;
977
976
  return this.CreateFileUploadJob({
978
977
  libraryId: libraryId,
979
978
  objectId: objectId,
@@ -982,7 +981,7 @@ exports.CreateFileDirectories = /*#__PURE__*/function () {
982
981
  });
983
982
  case 8:
984
983
  case "end":
985
- return _context12.stop();
984
+ return _context13.stop();
986
985
  }
987
986
  }, _callee12, this);
988
987
  }));
@@ -1005,8 +1004,8 @@ exports.CreateFileDirectories = /*#__PURE__*/function () {
1005
1004
  exports.DeleteFiles = /*#__PURE__*/function () {
1006
1005
  var _ref23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(_ref22) {
1007
1006
  var libraryId, objectId, writeToken, filePaths, ops;
1008
- return _regeneratorRuntime.wrap(function _callee13$(_context13) {
1009
- while (1) switch (_context13.prev = _context13.next) {
1007
+ return _regeneratorRuntime.wrap(function _callee13$(_context14) {
1008
+ while (1) switch (_context14.prev = _context14.next) {
1010
1009
  case 0:
1011
1010
  libraryId = _ref22.libraryId, objectId = _ref22.objectId, writeToken = _ref22.writeToken, filePaths = _ref22.filePaths;
1012
1011
  ValidateParameters({
@@ -1022,7 +1021,7 @@ exports.DeleteFiles = /*#__PURE__*/function () {
1022
1021
  path: path
1023
1022
  };
1024
1023
  });
1025
- _context13.next = 8;
1024
+ _context14.next = 8;
1026
1025
  return this.CreateFileUploadJob({
1027
1026
  libraryId: libraryId,
1028
1027
  objectId: objectId,
@@ -1031,7 +1030,7 @@ exports.DeleteFiles = /*#__PURE__*/function () {
1031
1030
  });
1032
1031
  case 8:
1033
1032
  case "end":
1034
- return _context13.stop();
1033
+ return _context14.stop();
1035
1034
  }
1036
1035
  }, _callee13, this);
1037
1036
  }));
@@ -1087,9 +1086,9 @@ exports.DownloadFile = /*#__PURE__*/function () {
1087
1086
  ownerCapKey,
1088
1087
  ownerCap,
1089
1088
  bytesTotal,
1090
- _args14 = arguments;
1091
- return _regeneratorRuntime.wrap(function _callee14$(_context14) {
1092
- while (1) switch (_context14.prev = _context14.next) {
1089
+ _args15 = arguments;
1090
+ return _regeneratorRuntime.wrap(function _callee14$(_context15) {
1091
+ while (1) switch (_context15.prev = _context15.next) {
1093
1092
  case 0:
1094
1093
  libraryId = _ref24.libraryId, objectId = _ref24.objectId, versionHash = _ref24.versionHash, writeToken = _ref24.writeToken, filePath = _ref24.filePath, _ref24$format = _ref24.format, format = _ref24$format === void 0 ? "arrayBuffer" : _ref24$format, _ref24$chunked = _ref24.chunked, chunked = _ref24$chunked === void 0 ? false : _ref24$chunked, chunkSize = _ref24.chunkSize, _ref24$clientSideDecr = _ref24.clientSideDecryption, clientSideDecryption = _ref24$clientSideDecr === void 0 ? false : _ref24$clientSideDecr, callback = _ref24.callback;
1095
1094
  ValidateParameters({
@@ -1101,7 +1100,7 @@ exports.DownloadFile = /*#__PURE__*/function () {
1101
1100
  if (versionHash) {
1102
1101
  objectId = this.utils.DecodeVersionHash(versionHash).objectId;
1103
1102
  }
1104
- _context14.next = 6;
1103
+ _context15.next = 6;
1105
1104
  return this.ContentObjectMetadata({
1106
1105
  libraryId: libraryId,
1107
1106
  objectId: objectId,
@@ -1110,24 +1109,25 @@ exports.DownloadFile = /*#__PURE__*/function () {
1110
1109
  metadataSubtree: UrlJoin("files", filePath)
1111
1110
  });
1112
1111
  case 6:
1113
- fileInfo = _context14.sent;
1112
+ fileInfo = _context15.sent;
1114
1113
  encrypted = fileInfo && fileInfo["."].encryption && fileInfo["."].encryption.scheme === "cgck";
1115
1114
  encryption = encrypted ? "cgck" : undefined;
1116
1115
  path = encrypted && !clientSideDecryption ? UrlJoin("q", writeToken || versionHash || objectId, "rep", "files_download", filePath) : UrlJoin("q", writeToken || versionHash || objectId, "files", filePath);
1117
- _context14.next = 12;
1116
+ _context15.next = 12;
1118
1117
  return this.authClient.AuthorizationHeader({
1119
1118
  libraryId: libraryId,
1120
1119
  objectId: objectId,
1121
1120
  versionHash: versionHash,
1122
- encryption: encryption
1121
+ encryption: encryption,
1122
+ makeAccessRequest: encryption === "cgck"
1123
1123
  });
1124
1124
  case 12:
1125
- headers = _context14.sent;
1125
+ headers = _context15.sent;
1126
1126
  headers.Accept = "*/*";
1127
1127
 
1128
1128
  // If not owner, indicate re-encryption
1129
1129
  ownerCapKey = "eluv.caps.iusr".concat(this.utils.AddressToHash(this.signer.address));
1130
- _context14.next = 17;
1130
+ _context15.next = 17;
1131
1131
  return this.ContentObjectMetadata({
1132
1132
  libraryId: libraryId,
1133
1133
  objectId: objectId,
@@ -1135,31 +1135,31 @@ exports.DownloadFile = /*#__PURE__*/function () {
1135
1135
  metadataSubtree: ownerCapKey
1136
1136
  });
1137
1137
  case 17:
1138
- ownerCap = _context14.sent;
1139
- _context14.t1 = encrypted;
1140
- if (!_context14.t1) {
1141
- _context14.next = 26;
1138
+ ownerCap = _context15.sent;
1139
+ _context15.t1 = encrypted;
1140
+ if (!_context15.t1) {
1141
+ _context15.next = 26;
1142
1142
  break;
1143
1143
  }
1144
- _context14.t2 = this.utils;
1145
- _context14.t3 = this.signer.address;
1146
- _context14.next = 24;
1144
+ _context15.t2 = this.utils;
1145
+ _context15.t3 = this.signer.address;
1146
+ _context15.next = 24;
1147
1147
  return this.ContentObjectOwner({
1148
1148
  objectId: objectId
1149
1149
  });
1150
1150
  case 24:
1151
- _context14.t4 = _context14.sent;
1152
- _context14.t1 = !_context14.t2.EqualAddress.call(_context14.t2, _context14.t3, _context14.t4);
1151
+ _context15.t4 = _context15.sent;
1152
+ _context15.t1 = !_context15.t2.EqualAddress.call(_context15.t2, _context15.t3, _context15.t4);
1153
1153
  case 26:
1154
- _context14.t0 = _context14.t1;
1155
- if (!_context14.t0) {
1156
- _context14.next = 29;
1154
+ _context15.t0 = _context15.t1;
1155
+ if (!_context15.t0) {
1156
+ _context15.next = 29;
1157
1157
  break;
1158
1158
  }
1159
- _context14.t0 = !ownerCap;
1159
+ _context15.t0 = !ownerCap;
1160
1160
  case 29:
1161
- if (!_context14.t0) {
1162
- _context14.next = 31;
1161
+ if (!_context15.t0) {
1162
+ _context15.next = 31;
1163
1163
  break;
1164
1164
  }
1165
1165
  headers["X-Content-Fabric-Decryption-Mode"] = "reencrypt";
@@ -1172,11 +1172,11 @@ exports.DownloadFile = /*#__PURE__*/function () {
1172
1172
  }
1173
1173
  bytesTotal = fileInfo["."].size;
1174
1174
  if (!(encrypted && clientSideDecryption)) {
1175
- _context14.next = 51;
1175
+ _context15.next = 51;
1176
1176
  break;
1177
1177
  }
1178
- _context14.t5 = this;
1179
- _context14.next = 37;
1178
+ _context15.t5 = this;
1179
+ _context15.next = 37;
1180
1180
  return this.EncryptionConk({
1181
1181
  libraryId: libraryId,
1182
1182
  objectId: objectId,
@@ -1184,34 +1184,34 @@ exports.DownloadFile = /*#__PURE__*/function () {
1184
1184
  download: true
1185
1185
  });
1186
1186
  case 37:
1187
- _context14.t6 = _context14.sent;
1188
- _context14.t7 = path;
1189
- _context14.t8 = bytesTotal;
1190
- _context14.t9 = headers;
1191
- _context14.t10 = callback;
1192
- _context14.t11 = format;
1193
- _context14.t12 = clientSideDecryption;
1194
- _context14.t13 = chunked;
1195
- _context14.t14 = {
1196
- conk: _context14.t6,
1197
- downloadPath: _context14.t7,
1198
- bytesTotal: _context14.t8,
1199
- headers: _context14.t9,
1200
- callback: _context14.t10,
1201
- format: _context14.t11,
1202
- clientSideDecryption: _context14.t12,
1203
- chunked: _context14.t13
1187
+ _context15.t6 = _context15.sent;
1188
+ _context15.t7 = path;
1189
+ _context15.t8 = bytesTotal;
1190
+ _context15.t9 = headers;
1191
+ _context15.t10 = callback;
1192
+ _context15.t11 = format;
1193
+ _context15.t12 = clientSideDecryption;
1194
+ _context15.t13 = chunked;
1195
+ _context15.t14 = {
1196
+ conk: _context15.t6,
1197
+ downloadPath: _context15.t7,
1198
+ bytesTotal: _context15.t8,
1199
+ headers: _context15.t9,
1200
+ callback: _context15.t10,
1201
+ format: _context15.t11,
1202
+ clientSideDecryption: _context15.t12,
1203
+ chunked: _context15.t13
1204
1204
  };
1205
- _context14.next = 48;
1206
- return _context14.t5.DownloadEncrypted.call(_context14.t5, _context14.t14);
1205
+ _context15.next = 48;
1206
+ return _context15.t5.DownloadEncrypted.call(_context15.t5, _context15.t14);
1207
1207
  case 48:
1208
- return _context14.abrupt("return", _context14.sent);
1208
+ return _context15.abrupt("return", _context15.sent);
1209
1209
  case 51:
1210
1210
  if (!chunkSize) {
1211
1211
  chunkSize = 10000000;
1212
1212
  }
1213
- _context14.prev = 52;
1214
- _context14.next = 55;
1213
+ _context15.prev = 52;
1214
+ _context15.next = 55;
1215
1215
  return this.Download({
1216
1216
  downloadPath: path,
1217
1217
  bytesTotal: bytesTotal,
@@ -1222,22 +1222,22 @@ exports.DownloadFile = /*#__PURE__*/function () {
1222
1222
  chunkSize: chunkSize
1223
1223
  });
1224
1224
  case 55:
1225
- return _context14.abrupt("return", _context14.sent);
1225
+ return _context15.abrupt("return", _context15.sent);
1226
1226
  case 58:
1227
- _context14.prev = 58;
1228
- _context14.t15 = _context14["catch"](52);
1227
+ _context15.prev = 58;
1228
+ _context15.t15 = _context15["catch"](52);
1229
1229
  if (!(encrypted && !clientSideDecryption)) {
1230
- _context14.next = 62;
1230
+ _context15.next = 62;
1231
1231
  break;
1232
1232
  }
1233
- return _context14.abrupt("return", this.DownloadFile(_objectSpread(_objectSpread({}, _args14[0]), {}, {
1233
+ return _context15.abrupt("return", this.DownloadFile(_objectSpread(_objectSpread({}, _args15[0]), {}, {
1234
1234
  clientSideDecryption: true
1235
1235
  })));
1236
1236
  case 62:
1237
- throw _context14.t15;
1237
+ throw _context15.t15;
1238
1238
  case 63:
1239
1239
  case "end":
1240
- return _context14.stop();
1240
+ return _context15.stop();
1241
1241
  }
1242
1242
  }, _callee14, this, [[52, 58]]);
1243
1243
  }));
@@ -1263,8 +1263,8 @@ exports.DownloadFile = /*#__PURE__*/function () {
1263
1263
  exports.ContentParts = /*#__PURE__*/function () {
1264
1264
  var _ref27 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(_ref26) {
1265
1265
  var libraryId, objectId, versionHash, path, response;
1266
- return _regeneratorRuntime.wrap(function _callee15$(_context15) {
1267
- while (1) switch (_context15.prev = _context15.next) {
1266
+ return _regeneratorRuntime.wrap(function _callee15$(_context16) {
1267
+ while (1) switch (_context16.prev = _context16.next) {
1268
1268
  case 0:
1269
1269
  libraryId = _ref26.libraryId, objectId = _ref26.objectId, versionHash = _ref26.versionHash;
1270
1270
  ValidateParameters({
@@ -1277,31 +1277,31 @@ exports.ContentParts = /*#__PURE__*/function () {
1277
1277
  objectId = this.utils.DecodeVersionHash(versionHash).objectId;
1278
1278
  }
1279
1279
  path = UrlJoin("q", versionHash || objectId, "parts");
1280
- _context15.t0 = this.utils;
1281
- _context15.t1 = this.HttpClient;
1282
- _context15.next = 9;
1280
+ _context16.t0 = this.utils;
1281
+ _context16.t1 = this.HttpClient;
1282
+ _context16.next = 9;
1283
1283
  return this.authClient.AuthorizationHeader({
1284
1284
  libraryId: libraryId,
1285
1285
  objectId: objectId,
1286
1286
  versionHash: versionHash
1287
1287
  });
1288
1288
  case 9:
1289
- _context15.t2 = _context15.sent;
1290
- _context15.t3 = path;
1291
- _context15.t4 = {
1292
- headers: _context15.t2,
1289
+ _context16.t2 = _context16.sent;
1290
+ _context16.t3 = path;
1291
+ _context16.t4 = {
1292
+ headers: _context16.t2,
1293
1293
  method: "GET",
1294
- path: _context15.t3
1294
+ path: _context16.t3
1295
1295
  };
1296
- _context15.t5 = _context15.t1.Request.call(_context15.t1, _context15.t4);
1297
- _context15.next = 15;
1298
- return _context15.t0.ResponseToJson.call(_context15.t0, _context15.t5);
1296
+ _context16.t5 = _context16.t1.Request.call(_context16.t1, _context16.t4);
1297
+ _context16.next = 15;
1298
+ return _context16.t0.ResponseToJson.call(_context16.t0, _context16.t5);
1299
1299
  case 15:
1300
- response = _context15.sent;
1301
- return _context15.abrupt("return", response.parts);
1300
+ response = _context16.sent;
1301
+ return _context16.abrupt("return", response.parts);
1302
1302
  case 17:
1303
1303
  case "end":
1304
- return _context15.stop();
1304
+ return _context16.stop();
1305
1305
  }
1306
1306
  }, _callee15, this);
1307
1307
  }));
@@ -1326,8 +1326,8 @@ exports.ContentParts = /*#__PURE__*/function () {
1326
1326
  exports.ContentPart = /*#__PURE__*/function () {
1327
1327
  var _ref29 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(_ref28) {
1328
1328
  var libraryId, objectId, versionHash, partHash, path;
1329
- return _regeneratorRuntime.wrap(function _callee16$(_context16) {
1330
- while (1) switch (_context16.prev = _context16.next) {
1329
+ return _regeneratorRuntime.wrap(function _callee16$(_context17) {
1330
+ while (1) switch (_context17.prev = _context17.next) {
1331
1331
  case 0:
1332
1332
  libraryId = _ref28.libraryId, objectId = _ref28.objectId, versionHash = _ref28.versionHash, partHash = _ref28.partHash;
1333
1333
  ValidateParameters({
@@ -1341,30 +1341,30 @@ exports.ContentPart = /*#__PURE__*/function () {
1341
1341
  objectId = this.utils.DecodeVersionHash(versionHash).objectId;
1342
1342
  }
1343
1343
  path = UrlJoin("q", versionHash || objectId, "parts", partHash);
1344
- _context16.t0 = this.utils;
1345
- _context16.t1 = this.HttpClient;
1346
- _context16.next = 10;
1344
+ _context17.t0 = this.utils;
1345
+ _context17.t1 = this.HttpClient;
1346
+ _context17.next = 10;
1347
1347
  return this.authClient.AuthorizationHeader({
1348
1348
  libraryId: libraryId,
1349
1349
  objectId: objectId,
1350
1350
  versionHash: versionHash
1351
1351
  });
1352
1352
  case 10:
1353
- _context16.t2 = _context16.sent;
1354
- _context16.t3 = path;
1355
- _context16.t4 = {
1356
- headers: _context16.t2,
1353
+ _context17.t2 = _context17.sent;
1354
+ _context17.t3 = path;
1355
+ _context17.t4 = {
1356
+ headers: _context17.t2,
1357
1357
  method: "GET",
1358
- path: _context16.t3
1358
+ path: _context17.t3
1359
1359
  };
1360
- _context16.t5 = _context16.t1.Request.call(_context16.t1, _context16.t4);
1361
- _context16.next = 16;
1362
- return _context16.t0.ResponseToJson.call(_context16.t0, _context16.t5);
1360
+ _context17.t5 = _context17.t1.Request.call(_context17.t1, _context17.t4);
1361
+ _context17.next = 16;
1362
+ return _context17.t0.ResponseToJson.call(_context17.t0, _context17.t5);
1363
1363
  case 16:
1364
- return _context16.abrupt("return", _context16.sent);
1364
+ return _context17.abrupt("return", _context17.sent);
1365
1365
  case 17:
1366
1366
  case "end":
1367
- return _context16.stop();
1367
+ return _context17.stop();
1368
1368
  }
1369
1369
  }, _callee16, this);
1370
1370
  }));
@@ -1400,8 +1400,8 @@ exports.ContentPart = /*#__PURE__*/function () {
1400
1400
  exports.DownloadPart = /*#__PURE__*/function () {
1401
1401
  var _ref31 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17(_ref30) {
1402
1402
  var libraryId, objectId, versionHash, writeToken, partHash, _ref30$format, format, _ref30$chunked, chunked, _ref30$chunkSize, chunkSize, callback, encrypted, encryption, path, headers, bytesTotal;
1403
- return _regeneratorRuntime.wrap(function _callee17$(_context17) {
1404
- while (1) switch (_context17.prev = _context17.next) {
1403
+ return _regeneratorRuntime.wrap(function _callee17$(_context18) {
1404
+ while (1) switch (_context18.prev = _context18.next) {
1405
1405
  case 0:
1406
1406
  libraryId = _ref30.libraryId, objectId = _ref30.objectId, versionHash = _ref30.versionHash, writeToken = _ref30.writeToken, partHash = _ref30.partHash, _ref30$format = _ref30.format, format = _ref30$format === void 0 ? "arrayBuffer" : _ref30$format, _ref30$chunked = _ref30.chunked, chunked = _ref30$chunked === void 0 ? false : _ref30$chunked, _ref30$chunkSize = _ref30.chunkSize, chunkSize = _ref30$chunkSize === void 0 ? 10000000 : _ref30$chunkSize, callback = _ref30.callback;
1407
1407
  ValidateParameters({
@@ -1416,7 +1416,7 @@ exports.DownloadPart = /*#__PURE__*/function () {
1416
1416
  encrypted = partHash.startsWith("hqpe");
1417
1417
  encryption = encrypted ? "cgck" : undefined;
1418
1418
  path = UrlJoin("q", writeToken || versionHash || objectId, "data", partHash);
1419
- _context17.next = 9;
1419
+ _context18.next = 9;
1420
1420
  return this.authClient.AuthorizationHeader({
1421
1421
  libraryId: libraryId,
1422
1422
  objectId: objectId,
@@ -1425,8 +1425,8 @@ exports.DownloadPart = /*#__PURE__*/function () {
1425
1425
  makeAccessRequest: true
1426
1426
  });
1427
1427
  case 9:
1428
- headers = _context17.sent;
1429
- _context17.next = 12;
1428
+ headers = _context18.sent;
1429
+ _context18.next = 12;
1430
1430
  return this.ContentPart({
1431
1431
  libraryId: libraryId,
1432
1432
  objectId: objectId,
@@ -1434,55 +1434,55 @@ exports.DownloadPart = /*#__PURE__*/function () {
1434
1434
  partHash: partHash
1435
1435
  });
1436
1436
  case 12:
1437
- bytesTotal = _context17.sent.part.size;
1437
+ bytesTotal = _context18.sent.part.size;
1438
1438
  if (!encrypted) {
1439
- _context17.next = 37;
1439
+ _context18.next = 37;
1440
1440
  break;
1441
1441
  }
1442
- _context17.t0 = this.utils;
1443
- _context17.t1 = this.signer.address;
1444
- _context17.next = 18;
1442
+ _context18.t0 = this.utils;
1443
+ _context18.t1 = this.signer.address;
1444
+ _context18.next = 18;
1445
1445
  return this.ContentObjectOwner({
1446
1446
  objectId: objectId
1447
1447
  });
1448
1448
  case 18:
1449
- _context17.t2 = _context17.sent;
1450
- if (_context17.t0.EqualAddress.call(_context17.t0, _context17.t1, _context17.t2)) {
1451
- _context17.next = 21;
1449
+ _context18.t2 = _context18.sent;
1450
+ if (_context18.t0.EqualAddress.call(_context18.t0, _context18.t1, _context18.t2)) {
1451
+ _context18.next = 21;
1452
1452
  break;
1453
1453
  }
1454
1454
  headers["X-Content-Fabric-Decryption-Mode"] = "reencrypt";
1455
1455
  case 21:
1456
- _context17.t3 = this;
1457
- _context17.next = 24;
1456
+ _context18.t3 = this;
1457
+ _context18.next = 24;
1458
1458
  return this.EncryptionConk({
1459
1459
  libraryId: libraryId,
1460
1460
  objectId: objectId,
1461
1461
  download: true
1462
1462
  });
1463
1463
  case 24:
1464
- _context17.t4 = _context17.sent;
1465
- _context17.t5 = path;
1466
- _context17.t6 = bytesTotal;
1467
- _context17.t7 = headers;
1468
- _context17.t8 = callback;
1469
- _context17.t9 = format;
1470
- _context17.t10 = chunked;
1471
- _context17.t11 = {
1472
- conk: _context17.t4,
1473
- downloadPath: _context17.t5,
1474
- bytesTotal: _context17.t6,
1475
- headers: _context17.t7,
1476
- callback: _context17.t8,
1477
- format: _context17.t9,
1478
- chunked: _context17.t10
1464
+ _context18.t4 = _context18.sent;
1465
+ _context18.t5 = path;
1466
+ _context18.t6 = bytesTotal;
1467
+ _context18.t7 = headers;
1468
+ _context18.t8 = callback;
1469
+ _context18.t9 = format;
1470
+ _context18.t10 = chunked;
1471
+ _context18.t11 = {
1472
+ conk: _context18.t4,
1473
+ downloadPath: _context18.t5,
1474
+ bytesTotal: _context18.t6,
1475
+ headers: _context18.t7,
1476
+ callback: _context18.t8,
1477
+ format: _context18.t9,
1478
+ chunked: _context18.t10
1479
1479
  };
1480
- _context17.next = 34;
1481
- return _context17.t3.DownloadEncrypted.call(_context17.t3, _context17.t11);
1480
+ _context18.next = 34;
1481
+ return _context18.t3.DownloadEncrypted.call(_context18.t3, _context18.t11);
1482
1482
  case 34:
1483
- return _context17.abrupt("return", _context17.sent);
1483
+ return _context18.abrupt("return", _context18.sent);
1484
1484
  case 37:
1485
- _context17.next = 39;
1485
+ _context18.next = 39;
1486
1486
  return this.Download({
1487
1487
  downloadPath: path,
1488
1488
  bytesTotal: bytesTotal,
@@ -1493,10 +1493,10 @@ exports.DownloadPart = /*#__PURE__*/function () {
1493
1493
  chunkSize: chunkSize
1494
1494
  });
1495
1495
  case 39:
1496
- return _context17.abrupt("return", _context17.sent);
1496
+ return _context18.abrupt("return", _context18.sent);
1497
1497
  case 40:
1498
1498
  case "end":
1499
- return _context17.stop();
1499
+ return _context18.stop();
1500
1500
  }
1501
1501
  }, _callee17, this);
1502
1502
  }));
@@ -1507,12 +1507,12 @@ exports.DownloadPart = /*#__PURE__*/function () {
1507
1507
  exports.Download = /*#__PURE__*/function () {
1508
1508
  var _ref33 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(_ref32) {
1509
1509
  var downloadPath, headers, bytesTotal, _ref32$chunked, chunked, _ref32$chunkSize, chunkSize, callback, _ref32$format, format, outputChunks, bytesFinished, totalChunks, i, response;
1510
- return _regeneratorRuntime.wrap(function _callee18$(_context18) {
1511
- while (1) switch (_context18.prev = _context18.next) {
1510
+ return _regeneratorRuntime.wrap(function _callee18$(_context19) {
1511
+ while (1) switch (_context19.prev = _context19.next) {
1512
1512
  case 0:
1513
1513
  downloadPath = _ref32.downloadPath, headers = _ref32.headers, bytesTotal = _ref32.bytesTotal, _ref32$chunked = _ref32.chunked, chunked = _ref32$chunked === void 0 ? false : _ref32$chunked, _ref32$chunkSize = _ref32.chunkSize, chunkSize = _ref32$chunkSize === void 0 ? 2000000 : _ref32$chunkSize, callback = _ref32.callback, _ref32$format = _ref32.format, format = _ref32$format === void 0 ? "arrayBuffer" : _ref32$format;
1514
1514
  if (!(chunked && !callback)) {
1515
- _context18.next = 3;
1515
+ _context19.next = 3;
1516
1516
  break;
1517
1517
  }
1518
1518
  throw Error("No callback specified for chunked download");
@@ -1527,47 +1527,47 @@ exports.Download = /*#__PURE__*/function () {
1527
1527
  i = 0;
1528
1528
  case 7:
1529
1529
  if (!(i < totalChunks)) {
1530
- _context18.next = 35;
1530
+ _context19.next = 35;
1531
1531
  break;
1532
1532
  }
1533
1533
  headers["Range"] = "bytes=".concat(bytesFinished, "-").concat(bytesFinished + chunkSize - 1);
1534
- _context18.next = 11;
1534
+ _context19.next = 11;
1535
1535
  return this.HttpClient.Request({
1536
1536
  path: downloadPath,
1537
1537
  headers: headers,
1538
1538
  method: "GET"
1539
1539
  });
1540
1540
  case 11:
1541
- response = _context18.sent;
1541
+ response = _context19.sent;
1542
1542
  bytesFinished = Math.min(bytesFinished + chunkSize, bytesTotal);
1543
1543
  if (!chunked) {
1544
- _context18.next = 24;
1544
+ _context19.next = 24;
1545
1545
  break;
1546
1546
  }
1547
- _context18.t0 = callback;
1548
- _context18.t1 = bytesFinished;
1549
- _context18.t2 = bytesTotal;
1550
- _context18.next = 19;
1547
+ _context19.t0 = callback;
1548
+ _context19.t1 = bytesFinished;
1549
+ _context19.t2 = bytesTotal;
1550
+ _context19.next = 19;
1551
1551
  return this.utils.ResponseToFormat(format, response);
1552
1552
  case 19:
1553
- _context18.t3 = _context18.sent;
1554
- _context18.t4 = {
1555
- bytesFinished: _context18.t1,
1556
- bytesTotal: _context18.t2,
1557
- chunk: _context18.t3
1553
+ _context19.t3 = _context19.sent;
1554
+ _context19.t4 = {
1555
+ bytesFinished: _context19.t1,
1556
+ bytesTotal: _context19.t2,
1557
+ chunk: _context19.t3
1558
1558
  };
1559
- (0, _context18.t0)(_context18.t4);
1560
- _context18.next = 32;
1559
+ (0, _context19.t0)(_context19.t4);
1560
+ _context19.next = 32;
1561
1561
  break;
1562
1562
  case 24:
1563
- _context18.t5 = outputChunks;
1564
- _context18.t6 = Buffer;
1565
- _context18.next = 28;
1563
+ _context19.t5 = outputChunks;
1564
+ _context19.t6 = Buffer;
1565
+ _context19.next = 28;
1566
1566
  return response.arrayBuffer();
1567
1567
  case 28:
1568
- _context18.t7 = _context18.sent;
1569
- _context18.t8 = _context18.t6.from.call(_context18.t6, _context18.t7);
1570
- _context18.t5.push.call(_context18.t5, _context18.t8);
1568
+ _context19.t7 = _context19.sent;
1569
+ _context19.t8 = _context19.t6.from.call(_context19.t6, _context19.t7);
1570
+ _context19.t5.push.call(_context19.t5, _context19.t8);
1571
1571
  if (callback) {
1572
1572
  callback({
1573
1573
  bytesFinished: bytesFinished,
@@ -1576,20 +1576,20 @@ exports.Download = /*#__PURE__*/function () {
1576
1576
  }
1577
1577
  case 32:
1578
1578
  i++;
1579
- _context18.next = 7;
1579
+ _context19.next = 7;
1580
1580
  break;
1581
1581
  case 35:
1582
1582
  if (chunked) {
1583
- _context18.next = 39;
1583
+ _context19.next = 39;
1584
1584
  break;
1585
1585
  }
1586
- _context18.next = 38;
1586
+ _context19.next = 38;
1587
1587
  return this.utils.ResponseToFormat(format, new Response(Buffer.concat(outputChunks)));
1588
1588
  case 38:
1589
- return _context18.abrupt("return", _context18.sent);
1589
+ return _context19.abrupt("return", _context19.sent);
1590
1590
  case 39:
1591
1591
  case "end":
1592
- return _context18.stop();
1592
+ return _context19.stop();
1593
1593
  }
1594
1594
  }, _callee18, this);
1595
1595
  }));
@@ -1601,12 +1601,12 @@ exports.DownloadEncrypted = /*#__PURE__*/function () {
1601
1601
  var _ref35 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20(_ref34) {
1602
1602
  var _this2 = this;
1603
1603
  var conk, downloadPath, bytesTotal, headers, callback, _ref34$format, format, _ref34$chunked, chunked, isReencryption, chunkSize, bytesFinished, outputChunks, stream, totalChunks, i, response;
1604
- return _regeneratorRuntime.wrap(function _callee20$(_context20) {
1605
- while (1) switch (_context20.prev = _context20.next) {
1604
+ return _regeneratorRuntime.wrap(function _callee20$(_context21) {
1605
+ while (1) switch (_context21.prev = _context21.next) {
1606
1606
  case 0:
1607
1607
  conk = _ref34.conk, downloadPath = _ref34.downloadPath, bytesTotal = _ref34.bytesTotal, headers = _ref34.headers, callback = _ref34.callback, _ref34$format = _ref34.format, format = _ref34$format === void 0 ? "arrayBuffer" : _ref34$format, _ref34$chunked = _ref34.chunked, chunked = _ref34$chunked === void 0 ? false : _ref34$chunked;
1608
1608
  if (!(chunked && !callback)) {
1609
- _context20.next = 3;
1609
+ _context21.next = 3;
1610
1610
  break;
1611
1611
  }
1612
1612
  throw Error("No callback specified for chunked download");
@@ -1617,44 +1617,44 @@ exports.DownloadEncrypted = /*#__PURE__*/function () {
1617
1617
  bytesFinished = 0;
1618
1618
  format = format.toLowerCase();
1619
1619
  outputChunks = []; // Set up decryption stream
1620
- _context20.next = 10;
1620
+ _context21.next = 10;
1621
1621
  return this.Crypto.OpenDecryptionStream(conk);
1622
1622
  case 10:
1623
- stream = _context20.sent;
1623
+ stream = _context21.sent;
1624
1624
  stream.on("data", /*#__PURE__*/function () {
1625
1625
  var _ref36 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19(chunk) {
1626
1626
  var arrayBuffer;
1627
- return _regeneratorRuntime.wrap(function _callee19$(_context19) {
1628
- while (1) switch (_context19.prev = _context19.next) {
1627
+ return _regeneratorRuntime.wrap(function _callee19$(_context20) {
1628
+ while (1) switch (_context20.prev = _context20.next) {
1629
1629
  case 0:
1630
1630
  if (!chunked) {
1631
- _context19.next = 13;
1631
+ _context20.next = 13;
1632
1632
  break;
1633
1633
  }
1634
1634
  if (!(format !== "buffer")) {
1635
- _context19.next = 10;
1635
+ _context20.next = 10;
1636
1636
  break;
1637
1637
  }
1638
1638
  arrayBuffer = chunk.buffer.slice(chunk.byteOffset, chunk.byteOffset + chunk.byteLength);
1639
1639
  if (!(format === "arraybuffer")) {
1640
- _context19.next = 7;
1640
+ _context20.next = 7;
1641
1641
  break;
1642
1642
  }
1643
1643
  chunk = arrayBuffer;
1644
- _context19.next = 10;
1644
+ _context20.next = 10;
1645
1645
  break;
1646
1646
  case 7:
1647
- _context19.next = 9;
1647
+ _context20.next = 9;
1648
1648
  return _this2.utils.ResponseToFormat(format, new Response(arrayBuffer));
1649
1649
  case 9:
1650
- chunk = _context19.sent;
1650
+ chunk = _context20.sent;
1651
1651
  case 10:
1652
1652
  callback({
1653
1653
  bytesFinished: bytesFinished,
1654
1654
  bytesTotal: bytesTotal,
1655
1655
  chunk: chunk
1656
1656
  });
1657
- _context19.next = 15;
1657
+ _context20.next = 15;
1658
1658
  break;
1659
1659
  case 13:
1660
1660
  if (callback) {
@@ -1666,7 +1666,7 @@ exports.DownloadEncrypted = /*#__PURE__*/function () {
1666
1666
  outputChunks.push(chunk);
1667
1667
  case 15:
1668
1668
  case "end":
1669
- return _context19.stop();
1669
+ return _context20.stop();
1670
1670
  }
1671
1671
  }, _callee19);
1672
1672
  }));
@@ -1678,35 +1678,35 @@ exports.DownloadEncrypted = /*#__PURE__*/function () {
1678
1678
  i = 0;
1679
1679
  case 14:
1680
1680
  if (!(i < totalChunks)) {
1681
- _context20.next = 30;
1681
+ _context21.next = 30;
1682
1682
  break;
1683
1683
  }
1684
1684
  headers["Range"] = "bytes=".concat(bytesFinished, "-").concat(bytesFinished + chunkSize - 1);
1685
- _context20.next = 18;
1685
+ _context21.next = 18;
1686
1686
  return this.HttpClient.Request({
1687
1687
  headers: headers,
1688
1688
  method: "GET",
1689
1689
  path: downloadPath
1690
1690
  });
1691
1691
  case 18:
1692
- response = _context20.sent;
1692
+ response = _context21.sent;
1693
1693
  bytesFinished = Math.min(bytesFinished + chunkSize, bytesTotal);
1694
- _context20.t0 = stream;
1695
- _context20.t1 = Uint8Array;
1696
- _context20.next = 24;
1694
+ _context21.t0 = stream;
1695
+ _context21.t1 = Uint8Array;
1696
+ _context21.next = 24;
1697
1697
  return response.arrayBuffer();
1698
1698
  case 24:
1699
- _context20.t2 = _context20.sent;
1700
- _context20.t3 = new _context20.t1(_context20.t2);
1701
- _context20.t0.write.call(_context20.t0, _context20.t3);
1699
+ _context21.t2 = _context21.sent;
1700
+ _context21.t3 = new _context21.t1(_context21.t2);
1701
+ _context21.t0.write.call(_context21.t0, _context21.t3);
1702
1702
  case 27:
1703
1703
  i++;
1704
- _context20.next = 14;
1704
+ _context21.next = 14;
1705
1705
  break;
1706
1706
  case 30:
1707
1707
  // Wait for decryption to complete
1708
1708
  stream.end();
1709
- _context20.next = 33;
1709
+ _context21.next = 33;
1710
1710
  return new Promise(function (resolve) {
1711
1711
  return stream.on("finish", function () {
1712
1712
  resolve();
@@ -1714,16 +1714,16 @@ exports.DownloadEncrypted = /*#__PURE__*/function () {
1714
1714
  });
1715
1715
  case 33:
1716
1716
  if (chunked) {
1717
- _context20.next = 37;
1717
+ _context21.next = 37;
1718
1718
  break;
1719
1719
  }
1720
- _context20.next = 36;
1720
+ _context21.next = 36;
1721
1721
  return this.utils.ResponseToFormat(format, new Response(Buffer.concat(outputChunks)));
1722
1722
  case 36:
1723
- return _context20.abrupt("return", _context20.sent);
1723
+ return _context21.abrupt("return", _context21.sent);
1724
1724
  case 37:
1725
1725
  case "end":
1726
- return _context20.stop();
1726
+ return _context21.stop();
1727
1727
  }
1728
1728
  }, _callee20, this);
1729
1729
  }));
@@ -1748,8 +1748,8 @@ exports.DownloadEncrypted = /*#__PURE__*/function () {
1748
1748
  exports.CreatePart = /*#__PURE__*/function () {
1749
1749
  var _ref38 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(_ref37) {
1750
1750
  var libraryId, objectId, writeToken, encryption, path, openResponse;
1751
- return _regeneratorRuntime.wrap(function _callee21$(_context21) {
1752
- while (1) switch (_context21.prev = _context21.next) {
1751
+ return _regeneratorRuntime.wrap(function _callee21$(_context22) {
1752
+ while (1) switch (_context22.prev = _context22.next) {
1753
1753
  case 0:
1754
1754
  libraryId = _ref37.libraryId, objectId = _ref37.objectId, writeToken = _ref37.writeToken, encryption = _ref37.encryption;
1755
1755
  ValidateParameters({
@@ -1758,9 +1758,9 @@ exports.CreatePart = /*#__PURE__*/function () {
1758
1758
  });
1759
1759
  ValidateWriteToken(writeToken);
1760
1760
  path = UrlJoin("q", writeToken, "parts");
1761
- _context21.t0 = this.utils;
1762
- _context21.t1 = this.HttpClient;
1763
- _context21.next = 8;
1761
+ _context22.t0 = this.utils;
1762
+ _context22.t1 = this.HttpClient;
1763
+ _context22.next = 8;
1764
1764
  return this.authClient.AuthorizationHeader({
1765
1765
  libraryId: libraryId,
1766
1766
  objectId: objectId,
@@ -1768,25 +1768,25 @@ exports.CreatePart = /*#__PURE__*/function () {
1768
1768
  encryption: encryption
1769
1769
  });
1770
1770
  case 8:
1771
- _context21.t2 = _context21.sent;
1772
- _context21.t3 = path;
1773
- _context21.t4 = {
1774
- headers: _context21.t2,
1771
+ _context22.t2 = _context22.sent;
1772
+ _context22.t3 = path;
1773
+ _context22.t4 = {
1774
+ headers: _context22.t2,
1775
1775
  method: "POST",
1776
- path: _context21.t3,
1776
+ path: _context22.t3,
1777
1777
  bodyType: "BINARY",
1778
1778
  body: "",
1779
- failover: false
1779
+ allowFailover: false
1780
1780
  };
1781
- _context21.t5 = _context21.t1.Request.call(_context21.t1, _context21.t4);
1782
- _context21.next = 14;
1783
- return _context21.t0.ResponseToJson.call(_context21.t0, _context21.t5);
1781
+ _context22.t5 = _context22.t1.Request.call(_context22.t1, _context22.t4);
1782
+ _context22.next = 14;
1783
+ return _context22.t0.ResponseToJson.call(_context22.t0, _context22.t5);
1784
1784
  case 14:
1785
- openResponse = _context21.sent;
1786
- return _context21.abrupt("return", openResponse.part.write_token);
1785
+ openResponse = _context22.sent;
1786
+ return _context22.abrupt("return", openResponse.part.write_token);
1787
1787
  case 16:
1788
1788
  case "end":
1789
- return _context21.stop();
1789
+ return _context22.stop();
1790
1790
  }
1791
1791
  }, _callee21, this);
1792
1792
  }));
@@ -1813,8 +1813,8 @@ exports.CreatePart = /*#__PURE__*/function () {
1813
1813
  exports.UploadPartChunk = /*#__PURE__*/function () {
1814
1814
  var _ref40 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee22(_ref39) {
1815
1815
  var libraryId, objectId, writeToken, partWriteToken, chunk, encryption, conk, path;
1816
- return _regeneratorRuntime.wrap(function _callee22$(_context22) {
1817
- while (1) switch (_context22.prev = _context22.next) {
1816
+ return _regeneratorRuntime.wrap(function _callee22$(_context23) {
1817
+ while (1) switch (_context23.prev = _context23.next) {
1818
1818
  case 0:
1819
1819
  libraryId = _ref39.libraryId, objectId = _ref39.objectId, writeToken = _ref39.writeToken, partWriteToken = _ref39.partWriteToken, chunk = _ref39.chunk, encryption = _ref39.encryption;
1820
1820
  ValidateParameters({
@@ -1823,26 +1823,26 @@ exports.UploadPartChunk = /*#__PURE__*/function () {
1823
1823
  });
1824
1824
  ValidateWriteToken(writeToken);
1825
1825
  if (!(encryption && encryption !== "none")) {
1826
- _context22.next = 10;
1826
+ _context23.next = 10;
1827
1827
  break;
1828
1828
  }
1829
- _context22.next = 6;
1829
+ _context23.next = 6;
1830
1830
  return this.EncryptionConk({
1831
1831
  libraryId: libraryId,
1832
1832
  objectId: objectId,
1833
1833
  writeToken: writeToken
1834
1834
  });
1835
1835
  case 6:
1836
- conk = _context22.sent;
1837
- _context22.next = 9;
1836
+ conk = _context23.sent;
1837
+ _context23.next = 9;
1838
1838
  return this.Crypto.Encrypt(conk, chunk);
1839
1839
  case 9:
1840
- chunk = _context22.sent;
1840
+ chunk = _context23.sent;
1841
1841
  case 10:
1842
1842
  path = UrlJoin("q", writeToken, "parts");
1843
- _context22.t0 = this.utils;
1844
- _context22.t1 = this.HttpClient;
1845
- _context22.next = 15;
1843
+ _context23.t0 = this.utils;
1844
+ _context23.t1 = this.HttpClient;
1845
+ _context23.next = 15;
1846
1846
  return this.authClient.AuthorizationHeader({
1847
1847
  libraryId: libraryId,
1848
1848
  objectId: objectId,
@@ -1850,23 +1850,23 @@ exports.UploadPartChunk = /*#__PURE__*/function () {
1850
1850
  encryption: encryption
1851
1851
  });
1852
1852
  case 15:
1853
- _context22.t2 = _context22.sent;
1854
- _context22.t3 = UrlJoin(path, partWriteToken);
1855
- _context22.t4 = chunk;
1856
- _context22.t5 = {
1857
- headers: _context22.t2,
1853
+ _context23.t2 = _context23.sent;
1854
+ _context23.t3 = UrlJoin(path, partWriteToken);
1855
+ _context23.t4 = chunk;
1856
+ _context23.t5 = {
1857
+ headers: _context23.t2,
1858
1858
  method: "POST",
1859
- path: _context22.t3,
1860
- body: _context22.t4,
1859
+ path: _context23.t3,
1860
+ body: _context23.t4,
1861
1861
  bodyType: "BINARY",
1862
- failover: false
1862
+ allowFailover: false
1863
1863
  };
1864
- _context22.t6 = _context22.t1.Request.call(_context22.t1, _context22.t5);
1865
- _context22.next = 22;
1866
- return _context22.t0.ResponseToJson.call(_context22.t0, _context22.t6);
1864
+ _context23.t6 = _context23.t1.Request.call(_context23.t1, _context23.t5);
1865
+ _context23.next = 22;
1866
+ return _context23.t0.ResponseToJson.call(_context23.t0, _context23.t6);
1867
1867
  case 22:
1868
1868
  case "end":
1869
- return _context22.stop();
1869
+ return _context23.stop();
1870
1870
  }
1871
1871
  }, _callee22, this);
1872
1872
  }));
@@ -1892,8 +1892,8 @@ exports.UploadPartChunk = /*#__PURE__*/function () {
1892
1892
  exports.FinalizePart = /*#__PURE__*/function () {
1893
1893
  var _ref42 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee23(_ref41) {
1894
1894
  var libraryId, objectId, writeToken, partWriteToken, encryption, path;
1895
- return _regeneratorRuntime.wrap(function _callee23$(_context23) {
1896
- while (1) switch (_context23.prev = _context23.next) {
1895
+ return _regeneratorRuntime.wrap(function _callee23$(_context24) {
1896
+ while (1) switch (_context24.prev = _context24.next) {
1897
1897
  case 0:
1898
1898
  libraryId = _ref41.libraryId, objectId = _ref41.objectId, writeToken = _ref41.writeToken, partWriteToken = _ref41.partWriteToken, encryption = _ref41.encryption;
1899
1899
  ValidateParameters({
@@ -1902,9 +1902,9 @@ exports.FinalizePart = /*#__PURE__*/function () {
1902
1902
  });
1903
1903
  ValidateWriteToken(writeToken);
1904
1904
  path = UrlJoin("q", writeToken, "parts");
1905
- _context23.t0 = this.utils;
1906
- _context23.t1 = this.HttpClient;
1907
- _context23.next = 8;
1905
+ _context24.t0 = this.utils;
1906
+ _context24.t1 = this.HttpClient;
1907
+ _context24.next = 8;
1908
1908
  return this.authClient.AuthorizationHeader({
1909
1909
  libraryId: libraryId,
1910
1910
  objectId: objectId,
@@ -1912,27 +1912,27 @@ exports.FinalizePart = /*#__PURE__*/function () {
1912
1912
  encryption: encryption
1913
1913
  });
1914
1914
  case 8:
1915
- _context23.t2 = _context23.sent;
1916
- _context23.t3 = UrlJoin(path, partWriteToken);
1917
- _context23.t4 = {
1918
- headers: _context23.t2,
1915
+ _context24.t2 = _context24.sent;
1916
+ _context24.t3 = UrlJoin(path, partWriteToken);
1917
+ _context24.t4 = {
1918
+ headers: _context24.t2,
1919
1919
  method: "POST",
1920
- path: _context23.t3,
1920
+ path: _context24.t3,
1921
1921
  bodyType: "BINARY",
1922
1922
  body: "",
1923
- failover: false
1923
+ allowFailover: false
1924
1924
  };
1925
- _context23.next = 13;
1926
- return _context23.t1.Request.call(_context23.t1, _context23.t4);
1925
+ _context24.next = 13;
1926
+ return _context24.t1.Request.call(_context24.t1, _context24.t4);
1927
1927
  case 13:
1928
- _context23.t5 = _context23.sent;
1929
- _context23.next = 16;
1930
- return _context23.t0.ResponseToJson.call(_context23.t0, _context23.t5);
1928
+ _context24.t5 = _context24.sent;
1929
+ _context24.next = 16;
1930
+ return _context24.t0.ResponseToJson.call(_context24.t0, _context24.t5);
1931
1931
  case 16:
1932
- return _context23.abrupt("return", _context23.sent);
1932
+ return _context24.abrupt("return", _context24.sent);
1933
1933
  case 17:
1934
1934
  case "end":
1935
- return _context23.stop();
1935
+ return _context24.stop();
1936
1936
  }
1937
1937
  }, _callee23, this);
1938
1938
  }));
@@ -1965,8 +1965,8 @@ exports.FinalizePart = /*#__PURE__*/function () {
1965
1965
  exports.UploadPart = /*#__PURE__*/function () {
1966
1966
  var _ref44 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24(_ref43) {
1967
1967
  var libraryId, objectId, writeToken, data, _ref43$encryption, encryption, _ref43$chunkSize, chunkSize, callback, partWriteToken, size, i, chunk;
1968
- return _regeneratorRuntime.wrap(function _callee24$(_context24) {
1969
- while (1) switch (_context24.prev = _context24.next) {
1968
+ return _regeneratorRuntime.wrap(function _callee24$(_context25) {
1969
+ while (1) switch (_context25.prev = _context25.next) {
1970
1970
  case 0:
1971
1971
  libraryId = _ref43.libraryId, objectId = _ref43.objectId, writeToken = _ref43.writeToken, data = _ref43.data, _ref43$encryption = _ref43.encryption, encryption = _ref43$encryption === void 0 ? "none" : _ref43$encryption, _ref43$chunkSize = _ref43.chunkSize, chunkSize = _ref43$chunkSize === void 0 ? 10000000 : _ref43$chunkSize, callback = _ref43.callback;
1972
1972
  ValidateParameters({
@@ -1974,7 +1974,7 @@ exports.UploadPart = /*#__PURE__*/function () {
1974
1974
  objectId: objectId
1975
1975
  });
1976
1976
  ValidateWriteToken(writeToken);
1977
- _context24.next = 5;
1977
+ _context25.next = 5;
1978
1978
  return this.CreatePart({
1979
1979
  libraryId: libraryId,
1980
1980
  objectId: objectId,
@@ -1982,7 +1982,7 @@ exports.UploadPart = /*#__PURE__*/function () {
1982
1982
  encryption: encryption
1983
1983
  });
1984
1984
  case 5:
1985
- partWriteToken = _context24.sent;
1985
+ partWriteToken = _context25.sent;
1986
1986
  size = data.length || data.byteLength || data.size;
1987
1987
  if (callback) {
1988
1988
  callback({
@@ -1993,11 +1993,11 @@ exports.UploadPart = /*#__PURE__*/function () {
1993
1993
  i = 0;
1994
1994
  case 9:
1995
1995
  if (!(i < size)) {
1996
- _context24.next = 17;
1996
+ _context25.next = 17;
1997
1997
  break;
1998
1998
  }
1999
1999
  chunk = data.slice(i, i + chunkSize);
2000
- _context24.next = 13;
2000
+ _context25.next = 13;
2001
2001
  return this.UploadPartChunk({
2002
2002
  libraryId: libraryId,
2003
2003
  objectId: objectId,
@@ -2015,10 +2015,10 @@ exports.UploadPart = /*#__PURE__*/function () {
2015
2015
  }
2016
2016
  case 14:
2017
2017
  i += chunkSize;
2018
- _context24.next = 9;
2018
+ _context25.next = 9;
2019
2019
  break;
2020
2020
  case 17:
2021
- _context24.next = 19;
2021
+ _context25.next = 19;
2022
2022
  return this.FinalizePart({
2023
2023
  libraryId: libraryId,
2024
2024
  objectId: objectId,
@@ -2027,10 +2027,10 @@ exports.UploadPart = /*#__PURE__*/function () {
2027
2027
  encryption: encryption
2028
2028
  });
2029
2029
  case 19:
2030
- return _context24.abrupt("return", _context24.sent);
2030
+ return _context25.abrupt("return", _context25.sent);
2031
2031
  case 20:
2032
2032
  case "end":
2033
- return _context24.stop();
2033
+ return _context25.stop();
2034
2034
  }
2035
2035
  }, _callee24, this);
2036
2036
  }));
@@ -2053,8 +2053,8 @@ exports.UploadPart = /*#__PURE__*/function () {
2053
2053
  exports.DeletePart = /*#__PURE__*/function () {
2054
2054
  var _ref46 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(_ref45) {
2055
2055
  var libraryId, objectId, writeToken, partHash, path;
2056
- return _regeneratorRuntime.wrap(function _callee25$(_context25) {
2057
- while (1) switch (_context25.prev = _context25.next) {
2056
+ return _regeneratorRuntime.wrap(function _callee25$(_context26) {
2057
+ while (1) switch (_context26.prev = _context26.next) {
2058
2058
  case 0:
2059
2059
  libraryId = _ref45.libraryId, objectId = _ref45.objectId, writeToken = _ref45.writeToken, partHash = _ref45.partHash;
2060
2060
  ValidateParameters({
@@ -2064,27 +2064,27 @@ exports.DeletePart = /*#__PURE__*/function () {
2064
2064
  ValidateWriteToken(writeToken);
2065
2065
  ValidatePartHash(partHash);
2066
2066
  path = UrlJoin("q", writeToken, "parts", partHash);
2067
- _context25.t0 = this.HttpClient;
2068
- _context25.next = 8;
2067
+ _context26.t0 = this.HttpClient;
2068
+ _context26.next = 8;
2069
2069
  return this.authClient.AuthorizationHeader({
2070
2070
  libraryId: libraryId,
2071
2071
  objectId: objectId,
2072
2072
  update: true
2073
2073
  });
2074
2074
  case 8:
2075
- _context25.t1 = _context25.sent;
2076
- _context25.t2 = path;
2077
- _context25.t3 = {
2078
- headers: _context25.t1,
2075
+ _context26.t1 = _context26.sent;
2076
+ _context26.t2 = path;
2077
+ _context26.t3 = {
2078
+ headers: _context26.t1,
2079
2079
  method: "DELETE",
2080
- path: _context25.t2,
2081
- failover: false
2080
+ path: _context26.t2,
2081
+ allowFailover: false
2082
2082
  };
2083
- _context25.next = 13;
2084
- return _context25.t0.Request.call(_context25.t0, _context25.t3);
2083
+ _context26.next = 13;
2084
+ return _context26.t0.Request.call(_context26.t0, _context26.t3);
2085
2085
  case 13:
2086
2086
  case "end":
2087
- return _context25.stop();
2087
+ return _context26.stop();
2088
2088
  }
2089
2089
  }, _callee25, this);
2090
2090
  }));