@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.
- package/dist/ElvClient-min.js +4 -4
- package/dist/ElvClient-node-min.js +4 -4
- package/dist/ElvFrameClient-min.js +1 -1
- package/dist/ElvWalletClient-min.js +4 -4
- package/dist/ElvWalletClient-node-min.js +8 -8
- package/dist/src/HttpClient.js +37 -21
- package/dist/src/client/ContentAccess.js +1 -1
- package/dist/src/client/ContentManagement.js +4 -4
- package/dist/src/client/Files.js +477 -477
- package/package.json +1 -1
- package/src/HttpClient.js +21 -6
- package/src/client/ContentAccess.js +1 -1
- package/src/client/ContentManagement.js +4 -4
- package/src/client/Files.js +79 -90
- package/testScripts/Test.js +1 -2
- package/testScripts/UploadFilesTest.js +84 -0
- package/testScripts/abr_profile_4k_both.json +0 -10
- package/testScripts/abr_profile_4k_drm_public_access.json +128 -0
- package/testScripts/abr_profile_both.json +0 -10
- package/testScripts/abr_profile_drm_public_access.json +1962 -0
- package/utilities/example_files/abr_profile_4k_both.json +0 -10
- package/utilities/example_files/abr_profile_4k_drm_public_access.json +128 -0
- package/utilities/example_files/abr_profile_both.json +0 -10
- package/utilities/example_files/abr_profile_drm_public_access.json +1916 -0
package/dist/src/client/Files.js
CHANGED
|
@@ -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$(
|
|
345
|
-
while (1) switch (
|
|
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
|
-
|
|
356
|
+
_context7.next = 9;
|
|
356
357
|
break;
|
|
357
358
|
}
|
|
358
|
-
|
|
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
|
-
|
|
371
|
-
|
|
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] =
|
|
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
|
|
389
|
+
fileInfo.push(entry);
|
|
388
390
|
}
|
|
389
391
|
this.Log(fileInfo);
|
|
390
392
|
if (callback) {
|
|
391
393
|
callback(progress);
|
|
392
394
|
}
|
|
393
|
-
|
|
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
|
|
402
|
-
_yield$this$CreateFil2 =
|
|
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 =
|
|
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,
|
|
506
|
-
return _regeneratorRuntime.wrap(function _callee4$(
|
|
507
|
-
while (1) switch (
|
|
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
|
-
|
|
512
|
+
_context5.next = 5;
|
|
511
513
|
break;
|
|
512
514
|
}
|
|
513
|
-
|
|
515
|
+
_context5.next = 3;
|
|
514
516
|
return new Promise(function (resolve) {
|
|
515
517
|
return setTimeout(resolve, 500);
|
|
516
518
|
});
|
|
517
519
|
case 3:
|
|
518
|
-
|
|
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
|
|
586
|
+
case 9:
|
|
525
587
|
if (!(f < files.length)) {
|
|
526
|
-
|
|
588
|
+
_context5.next = 14;
|
|
527
589
|
break;
|
|
528
590
|
}
|
|
529
|
-
|
|
530
|
-
|
|
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
|
-
|
|
594
|
+
_context5.next = 9;
|
|
553
595
|
break;
|
|
554
|
-
case
|
|
596
|
+
case 14:
|
|
555
597
|
case "end":
|
|
556
|
-
return
|
|
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
|
|
614
|
+
case 33:
|
|
573
615
|
if (!(j < rateTestJobs)) {
|
|
574
|
-
|
|
616
|
+
_context7.next = 43;
|
|
575
617
|
break;
|
|
576
618
|
}
|
|
577
619
|
start = new Date().getTime();
|
|
578
|
-
|
|
620
|
+
_context7.next = 37;
|
|
579
621
|
return UploadJob(jobs[j], j);
|
|
580
|
-
case
|
|
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
|
|
630
|
+
case 40:
|
|
589
631
|
j++;
|
|
590
|
-
|
|
632
|
+
_context7.next = 33;
|
|
591
633
|
break;
|
|
592
|
-
case
|
|
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
|
-
|
|
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$(
|
|
601
|
-
while (1) switch (
|
|
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
|
-
|
|
646
|
+
_context6.next = 2;
|
|
605
647
|
break;
|
|
606
648
|
}
|
|
607
|
-
return
|
|
649
|
+
return _context6.abrupt("return");
|
|
608
650
|
case 2:
|
|
609
|
-
|
|
651
|
+
_context6.next = 4;
|
|
610
652
|
return UploadJob(jobId, j);
|
|
611
653
|
case 4:
|
|
612
654
|
case "end":
|
|
613
|
-
return
|
|
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
|
|
663
|
+
case 47:
|
|
622
664
|
case "end":
|
|
623
|
-
return
|
|
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$(
|
|
635
|
-
while (1) switch (
|
|
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
|
-
|
|
658
|
-
|
|
659
|
-
|
|
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
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
headers:
|
|
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:
|
|
674
|
-
body:
|
|
675
|
-
|
|
715
|
+
path: _context8.t3,
|
|
716
|
+
body: _context8.t4,
|
|
717
|
+
allowFailover: false
|
|
676
718
|
};
|
|
677
|
-
|
|
678
|
-
return
|
|
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
|
|
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$(
|
|
693
|
-
while (1) switch (
|
|
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
|
-
|
|
703
|
-
|
|
704
|
-
|
|
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
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
headers:
|
|
753
|
+
_context9.t2 = _context9.sent;
|
|
754
|
+
_context9.t3 = path;
|
|
755
|
+
_context9.t4 = {
|
|
756
|
+
headers: _context9.t2,
|
|
715
757
|
method: "GET",
|
|
716
|
-
path:
|
|
717
|
-
|
|
758
|
+
path: _context9.t3,
|
|
759
|
+
allowFailover: false
|
|
718
760
|
};
|
|
719
|
-
|
|
720
|
-
return
|
|
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
|
|
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
|
|
734
|
-
return _regeneratorRuntime.wrap(function _callee9$(
|
|
735
|
-
while (1) switch (
|
|
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);
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
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
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
headers:
|
|
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:
|
|
762
|
-
|
|
800
|
+
path: _context10.t3,
|
|
801
|
+
allowFailover: false
|
|
763
802
|
};
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
return
|
|
767
|
-
case
|
|
768
|
-
|
|
769
|
-
|
|
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
|
|
810
|
+
return _context10.stop();
|
|
790
811
|
}
|
|
791
|
-
}, _callee9, this
|
|
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,
|
|
800
|
-
return _regeneratorRuntime.wrap(function _callee10$(
|
|
801
|
-
while (1) switch (
|
|
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
|
-
|
|
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
|
|
821
|
-
jobStatus =
|
|
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
|
-
|
|
848
|
+
_context11.next = 12;
|
|
831
849
|
break;
|
|
832
850
|
}
|
|
833
|
-
return
|
|
834
|
-
case
|
|
851
|
+
return _context11.abrupt("return");
|
|
852
|
+
case 12:
|
|
835
853
|
if (fileStatus.skip) {
|
|
836
854
|
fileData = fileData.slice(fileStatus.skip);
|
|
837
855
|
}
|
|
838
|
-
case
|
|
856
|
+
case 13:
|
|
839
857
|
path = UrlJoin("q", writeToken, "file_jobs", uploadId, jobId);
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
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
|
-
|
|
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
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
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:
|
|
860
|
-
body:
|
|
877
|
+
path: _context11.t2,
|
|
878
|
+
body: _context11.t3,
|
|
861
879
|
bodyType: "BINARY",
|
|
862
|
-
headers:
|
|
863
|
-
|
|
880
|
+
headers: _context11.t7,
|
|
881
|
+
allowFailover: false,
|
|
882
|
+
allowRetry: false
|
|
864
883
|
};
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
return
|
|
868
|
-
case
|
|
869
|
-
return
|
|
870
|
-
case
|
|
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
|
|
891
|
+
return _context11.stop();
|
|
893
892
|
}
|
|
894
|
-
}, _callee10, this
|
|
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$(
|
|
904
|
-
while (1) switch (
|
|
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
|
-
|
|
915
|
-
|
|
916
|
-
|
|
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
|
-
|
|
924
|
-
|
|
922
|
+
_context12.t2 = _context12.sent;
|
|
923
|
+
_context12.t3 = {
|
|
925
924
|
method: "POST",
|
|
926
|
-
path:
|
|
925
|
+
path: _context12.t1,
|
|
927
926
|
bodyType: "BINARY",
|
|
928
|
-
headers:
|
|
929
|
-
|
|
927
|
+
headers: _context12.t2,
|
|
928
|
+
allowFailover: false
|
|
930
929
|
};
|
|
931
|
-
|
|
932
|
-
return
|
|
930
|
+
_context12.next = 13;
|
|
931
|
+
return _context12.t0.Request.call(_context12.t0, _context12.t3);
|
|
933
932
|
case 13:
|
|
934
933
|
case "end":
|
|
935
|
-
return
|
|
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$(
|
|
959
|
-
while (1) switch (
|
|
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
|
-
|
|
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
|
|
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$(
|
|
1009
|
-
while (1) switch (
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
1091
|
-
return _regeneratorRuntime.wrap(function _callee14$(
|
|
1092
|
-
while (1) switch (
|
|
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
|
-
|
|
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 =
|
|
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
|
-
|
|
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 =
|
|
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
|
-
|
|
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 =
|
|
1139
|
-
|
|
1140
|
-
if (!
|
|
1141
|
-
|
|
1138
|
+
ownerCap = _context15.sent;
|
|
1139
|
+
_context15.t1 = encrypted;
|
|
1140
|
+
if (!_context15.t1) {
|
|
1141
|
+
_context15.next = 26;
|
|
1142
1142
|
break;
|
|
1143
1143
|
}
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
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
|
-
|
|
1152
|
-
|
|
1151
|
+
_context15.t4 = _context15.sent;
|
|
1152
|
+
_context15.t1 = !_context15.t2.EqualAddress.call(_context15.t2, _context15.t3, _context15.t4);
|
|
1153
1153
|
case 26:
|
|
1154
|
-
|
|
1155
|
-
if (!
|
|
1156
|
-
|
|
1154
|
+
_context15.t0 = _context15.t1;
|
|
1155
|
+
if (!_context15.t0) {
|
|
1156
|
+
_context15.next = 29;
|
|
1157
1157
|
break;
|
|
1158
1158
|
}
|
|
1159
|
-
|
|
1159
|
+
_context15.t0 = !ownerCap;
|
|
1160
1160
|
case 29:
|
|
1161
|
-
if (!
|
|
1162
|
-
|
|
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
|
-
|
|
1175
|
+
_context15.next = 51;
|
|
1176
1176
|
break;
|
|
1177
1177
|
}
|
|
1178
|
-
|
|
1179
|
-
|
|
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
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
conk:
|
|
1197
|
-
downloadPath:
|
|
1198
|
-
bytesTotal:
|
|
1199
|
-
headers:
|
|
1200
|
-
callback:
|
|
1201
|
-
format:
|
|
1202
|
-
clientSideDecryption:
|
|
1203
|
-
chunked:
|
|
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
|
-
|
|
1206
|
-
return
|
|
1205
|
+
_context15.next = 48;
|
|
1206
|
+
return _context15.t5.DownloadEncrypted.call(_context15.t5, _context15.t14);
|
|
1207
1207
|
case 48:
|
|
1208
|
-
return
|
|
1208
|
+
return _context15.abrupt("return", _context15.sent);
|
|
1209
1209
|
case 51:
|
|
1210
1210
|
if (!chunkSize) {
|
|
1211
1211
|
chunkSize = 10000000;
|
|
1212
1212
|
}
|
|
1213
|
-
|
|
1214
|
-
|
|
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
|
|
1225
|
+
return _context15.abrupt("return", _context15.sent);
|
|
1226
1226
|
case 58:
|
|
1227
|
-
|
|
1228
|
-
|
|
1227
|
+
_context15.prev = 58;
|
|
1228
|
+
_context15.t15 = _context15["catch"](52);
|
|
1229
1229
|
if (!(encrypted && !clientSideDecryption)) {
|
|
1230
|
-
|
|
1230
|
+
_context15.next = 62;
|
|
1231
1231
|
break;
|
|
1232
1232
|
}
|
|
1233
|
-
return
|
|
1233
|
+
return _context15.abrupt("return", this.DownloadFile(_objectSpread(_objectSpread({}, _args15[0]), {}, {
|
|
1234
1234
|
clientSideDecryption: true
|
|
1235
1235
|
})));
|
|
1236
1236
|
case 62:
|
|
1237
|
-
throw
|
|
1237
|
+
throw _context15.t15;
|
|
1238
1238
|
case 63:
|
|
1239
1239
|
case "end":
|
|
1240
|
-
return
|
|
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$(
|
|
1267
|
-
while (1) switch (
|
|
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
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
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
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
headers:
|
|
1289
|
+
_context16.t2 = _context16.sent;
|
|
1290
|
+
_context16.t3 = path;
|
|
1291
|
+
_context16.t4 = {
|
|
1292
|
+
headers: _context16.t2,
|
|
1293
1293
|
method: "GET",
|
|
1294
|
-
path:
|
|
1294
|
+
path: _context16.t3
|
|
1295
1295
|
};
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
return
|
|
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 =
|
|
1301
|
-
return
|
|
1300
|
+
response = _context16.sent;
|
|
1301
|
+
return _context16.abrupt("return", response.parts);
|
|
1302
1302
|
case 17:
|
|
1303
1303
|
case "end":
|
|
1304
|
-
return
|
|
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$(
|
|
1330
|
-
while (1) switch (
|
|
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
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
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
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
headers:
|
|
1353
|
+
_context17.t2 = _context17.sent;
|
|
1354
|
+
_context17.t3 = path;
|
|
1355
|
+
_context17.t4 = {
|
|
1356
|
+
headers: _context17.t2,
|
|
1357
1357
|
method: "GET",
|
|
1358
|
-
path:
|
|
1358
|
+
path: _context17.t3
|
|
1359
1359
|
};
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
return
|
|
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
|
|
1364
|
+
return _context17.abrupt("return", _context17.sent);
|
|
1365
1365
|
case 17:
|
|
1366
1366
|
case "end":
|
|
1367
|
-
return
|
|
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$(
|
|
1404
|
-
while (1) switch (
|
|
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
|
-
|
|
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 =
|
|
1429
|
-
|
|
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 =
|
|
1437
|
+
bytesTotal = _context18.sent.part.size;
|
|
1438
1438
|
if (!encrypted) {
|
|
1439
|
-
|
|
1439
|
+
_context18.next = 37;
|
|
1440
1440
|
break;
|
|
1441
1441
|
}
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
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
|
-
|
|
1450
|
-
if (
|
|
1451
|
-
|
|
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
|
-
|
|
1457
|
-
|
|
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
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
conk:
|
|
1473
|
-
downloadPath:
|
|
1474
|
-
bytesTotal:
|
|
1475
|
-
headers:
|
|
1476
|
-
callback:
|
|
1477
|
-
format:
|
|
1478
|
-
chunked:
|
|
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
|
-
|
|
1481
|
-
return
|
|
1480
|
+
_context18.next = 34;
|
|
1481
|
+
return _context18.t3.DownloadEncrypted.call(_context18.t3, _context18.t11);
|
|
1482
1482
|
case 34:
|
|
1483
|
-
return
|
|
1483
|
+
return _context18.abrupt("return", _context18.sent);
|
|
1484
1484
|
case 37:
|
|
1485
|
-
|
|
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
|
|
1496
|
+
return _context18.abrupt("return", _context18.sent);
|
|
1497
1497
|
case 40:
|
|
1498
1498
|
case "end":
|
|
1499
|
-
return
|
|
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$(
|
|
1511
|
-
while (1) switch (
|
|
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
|
-
|
|
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
|
-
|
|
1530
|
+
_context19.next = 35;
|
|
1531
1531
|
break;
|
|
1532
1532
|
}
|
|
1533
1533
|
headers["Range"] = "bytes=".concat(bytesFinished, "-").concat(bytesFinished + chunkSize - 1);
|
|
1534
|
-
|
|
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 =
|
|
1541
|
+
response = _context19.sent;
|
|
1542
1542
|
bytesFinished = Math.min(bytesFinished + chunkSize, bytesTotal);
|
|
1543
1543
|
if (!chunked) {
|
|
1544
|
-
|
|
1544
|
+
_context19.next = 24;
|
|
1545
1545
|
break;
|
|
1546
1546
|
}
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
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
|
-
|
|
1554
|
-
|
|
1555
|
-
bytesFinished:
|
|
1556
|
-
bytesTotal:
|
|
1557
|
-
chunk:
|
|
1553
|
+
_context19.t3 = _context19.sent;
|
|
1554
|
+
_context19.t4 = {
|
|
1555
|
+
bytesFinished: _context19.t1,
|
|
1556
|
+
bytesTotal: _context19.t2,
|
|
1557
|
+
chunk: _context19.t3
|
|
1558
1558
|
};
|
|
1559
|
-
(0,
|
|
1560
|
-
|
|
1559
|
+
(0, _context19.t0)(_context19.t4);
|
|
1560
|
+
_context19.next = 32;
|
|
1561
1561
|
break;
|
|
1562
1562
|
case 24:
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1563
|
+
_context19.t5 = outputChunks;
|
|
1564
|
+
_context19.t6 = Buffer;
|
|
1565
|
+
_context19.next = 28;
|
|
1566
1566
|
return response.arrayBuffer();
|
|
1567
1567
|
case 28:
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
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
|
-
|
|
1579
|
+
_context19.next = 7;
|
|
1580
1580
|
break;
|
|
1581
1581
|
case 35:
|
|
1582
1582
|
if (chunked) {
|
|
1583
|
-
|
|
1583
|
+
_context19.next = 39;
|
|
1584
1584
|
break;
|
|
1585
1585
|
}
|
|
1586
|
-
|
|
1586
|
+
_context19.next = 38;
|
|
1587
1587
|
return this.utils.ResponseToFormat(format, new Response(Buffer.concat(outputChunks)));
|
|
1588
1588
|
case 38:
|
|
1589
|
-
return
|
|
1589
|
+
return _context19.abrupt("return", _context19.sent);
|
|
1590
1590
|
case 39:
|
|
1591
1591
|
case "end":
|
|
1592
|
-
return
|
|
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$(
|
|
1605
|
-
while (1) switch (
|
|
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
|
-
|
|
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
|
-
|
|
1620
|
+
_context21.next = 10;
|
|
1621
1621
|
return this.Crypto.OpenDecryptionStream(conk);
|
|
1622
1622
|
case 10:
|
|
1623
|
-
stream =
|
|
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$(
|
|
1628
|
-
while (1) switch (
|
|
1627
|
+
return _regeneratorRuntime.wrap(function _callee19$(_context20) {
|
|
1628
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1629
1629
|
case 0:
|
|
1630
1630
|
if (!chunked) {
|
|
1631
|
-
|
|
1631
|
+
_context20.next = 13;
|
|
1632
1632
|
break;
|
|
1633
1633
|
}
|
|
1634
1634
|
if (!(format !== "buffer")) {
|
|
1635
|
-
|
|
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
|
-
|
|
1640
|
+
_context20.next = 7;
|
|
1641
1641
|
break;
|
|
1642
1642
|
}
|
|
1643
1643
|
chunk = arrayBuffer;
|
|
1644
|
-
|
|
1644
|
+
_context20.next = 10;
|
|
1645
1645
|
break;
|
|
1646
1646
|
case 7:
|
|
1647
|
-
|
|
1647
|
+
_context20.next = 9;
|
|
1648
1648
|
return _this2.utils.ResponseToFormat(format, new Response(arrayBuffer));
|
|
1649
1649
|
case 9:
|
|
1650
|
-
chunk =
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
1681
|
+
_context21.next = 30;
|
|
1682
1682
|
break;
|
|
1683
1683
|
}
|
|
1684
1684
|
headers["Range"] = "bytes=".concat(bytesFinished, "-").concat(bytesFinished + chunkSize - 1);
|
|
1685
|
-
|
|
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 =
|
|
1692
|
+
response = _context21.sent;
|
|
1693
1693
|
bytesFinished = Math.min(bytesFinished + chunkSize, bytesTotal);
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1694
|
+
_context21.t0 = stream;
|
|
1695
|
+
_context21.t1 = Uint8Array;
|
|
1696
|
+
_context21.next = 24;
|
|
1697
1697
|
return response.arrayBuffer();
|
|
1698
1698
|
case 24:
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
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
|
-
|
|
1704
|
+
_context21.next = 14;
|
|
1705
1705
|
break;
|
|
1706
1706
|
case 30:
|
|
1707
1707
|
// Wait for decryption to complete
|
|
1708
1708
|
stream.end();
|
|
1709
|
-
|
|
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
|
-
|
|
1717
|
+
_context21.next = 37;
|
|
1718
1718
|
break;
|
|
1719
1719
|
}
|
|
1720
|
-
|
|
1720
|
+
_context21.next = 36;
|
|
1721
1721
|
return this.utils.ResponseToFormat(format, new Response(Buffer.concat(outputChunks)));
|
|
1722
1722
|
case 36:
|
|
1723
|
-
return
|
|
1723
|
+
return _context21.abrupt("return", _context21.sent);
|
|
1724
1724
|
case 37:
|
|
1725
1725
|
case "end":
|
|
1726
|
-
return
|
|
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$(
|
|
1752
|
-
while (1) switch (
|
|
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
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
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
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
headers:
|
|
1771
|
+
_context22.t2 = _context22.sent;
|
|
1772
|
+
_context22.t3 = path;
|
|
1773
|
+
_context22.t4 = {
|
|
1774
|
+
headers: _context22.t2,
|
|
1775
1775
|
method: "POST",
|
|
1776
|
-
path:
|
|
1776
|
+
path: _context22.t3,
|
|
1777
1777
|
bodyType: "BINARY",
|
|
1778
1778
|
body: "",
|
|
1779
|
-
|
|
1779
|
+
allowFailover: false
|
|
1780
1780
|
};
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
return
|
|
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 =
|
|
1786
|
-
return
|
|
1785
|
+
openResponse = _context22.sent;
|
|
1786
|
+
return _context22.abrupt("return", openResponse.part.write_token);
|
|
1787
1787
|
case 16:
|
|
1788
1788
|
case "end":
|
|
1789
|
-
return
|
|
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$(
|
|
1817
|
-
while (1) switch (
|
|
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
|
-
|
|
1826
|
+
_context23.next = 10;
|
|
1827
1827
|
break;
|
|
1828
1828
|
}
|
|
1829
|
-
|
|
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 =
|
|
1837
|
-
|
|
1836
|
+
conk = _context23.sent;
|
|
1837
|
+
_context23.next = 9;
|
|
1838
1838
|
return this.Crypto.Encrypt(conk, chunk);
|
|
1839
1839
|
case 9:
|
|
1840
|
-
chunk =
|
|
1840
|
+
chunk = _context23.sent;
|
|
1841
1841
|
case 10:
|
|
1842
1842
|
path = UrlJoin("q", writeToken, "parts");
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
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
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
headers:
|
|
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:
|
|
1860
|
-
body:
|
|
1859
|
+
path: _context23.t3,
|
|
1860
|
+
body: _context23.t4,
|
|
1861
1861
|
bodyType: "BINARY",
|
|
1862
|
-
|
|
1862
|
+
allowFailover: false
|
|
1863
1863
|
};
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
return
|
|
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
|
|
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$(
|
|
1896
|
-
while (1) switch (
|
|
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
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
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
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
headers:
|
|
1915
|
+
_context24.t2 = _context24.sent;
|
|
1916
|
+
_context24.t3 = UrlJoin(path, partWriteToken);
|
|
1917
|
+
_context24.t4 = {
|
|
1918
|
+
headers: _context24.t2,
|
|
1919
1919
|
method: "POST",
|
|
1920
|
-
path:
|
|
1920
|
+
path: _context24.t3,
|
|
1921
1921
|
bodyType: "BINARY",
|
|
1922
1922
|
body: "",
|
|
1923
|
-
|
|
1923
|
+
allowFailover: false
|
|
1924
1924
|
};
|
|
1925
|
-
|
|
1926
|
-
return
|
|
1925
|
+
_context24.next = 13;
|
|
1926
|
+
return _context24.t1.Request.call(_context24.t1, _context24.t4);
|
|
1927
1927
|
case 13:
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
return
|
|
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
|
|
1932
|
+
return _context24.abrupt("return", _context24.sent);
|
|
1933
1933
|
case 17:
|
|
1934
1934
|
case "end":
|
|
1935
|
-
return
|
|
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$(
|
|
1969
|
-
while (1) switch (
|
|
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
|
-
|
|
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 =
|
|
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
|
-
|
|
1996
|
+
_context25.next = 17;
|
|
1997
1997
|
break;
|
|
1998
1998
|
}
|
|
1999
1999
|
chunk = data.slice(i, i + chunkSize);
|
|
2000
|
-
|
|
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
|
-
|
|
2018
|
+
_context25.next = 9;
|
|
2019
2019
|
break;
|
|
2020
2020
|
case 17:
|
|
2021
|
-
|
|
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
|
|
2030
|
+
return _context25.abrupt("return", _context25.sent);
|
|
2031
2031
|
case 20:
|
|
2032
2032
|
case "end":
|
|
2033
|
-
return
|
|
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$(
|
|
2057
|
-
while (1) switch (
|
|
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
|
-
|
|
2068
|
-
|
|
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
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
headers:
|
|
2075
|
+
_context26.t1 = _context26.sent;
|
|
2076
|
+
_context26.t2 = path;
|
|
2077
|
+
_context26.t3 = {
|
|
2078
|
+
headers: _context26.t1,
|
|
2079
2079
|
method: "DELETE",
|
|
2080
|
-
path:
|
|
2081
|
-
|
|
2080
|
+
path: _context26.t2,
|
|
2081
|
+
allowFailover: false
|
|
2082
2082
|
};
|
|
2083
|
-
|
|
2084
|
-
return
|
|
2083
|
+
_context26.next = 13;
|
|
2084
|
+
return _context26.t0.Request.call(_context26.t0, _context26.t3);
|
|
2085
2085
|
case 13:
|
|
2086
2086
|
case "end":
|
|
2087
|
-
return
|
|
2087
|
+
return _context26.stop();
|
|
2088
2088
|
}
|
|
2089
2089
|
}, _callee25, this);
|
|
2090
2090
|
}));
|