@eluvio/elv-client-js 4.0.20 → 4.0.22
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/AuthorizationClient.js +1 -0
- package/dist/src/HttpClient.js +37 -21
- package/dist/src/client/ContentAccess.js +2 -1
- package/dist/src/client/ContentManagement.js +4 -4
- package/dist/src/client/Files.js +480 -475
- package/package.json +1 -1
- package/src/AuthorizationClient.js +1 -1
- package/src/HttpClient.js +21 -6
- package/src/client/ContentAccess.js +2 -2
- package/src/client/ContentManagement.js +4 -4
- package/src/client/Files.js +81 -81
- 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,57 +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
|
-
});
|
|
540
|
-
case 12:
|
|
541
|
-
delete jobSpecs[j].files[f].data;
|
|
542
|
-
uploaded += _fileInfo2.len;
|
|
543
|
-
if (callback) {
|
|
544
|
-
progress[_fileInfo2.path] = _objectSpread(_objectSpread({}, progress[_fileInfo2.path]), {}, {
|
|
545
|
-
uploaded: progress[_fileInfo2.path].uploaded + _fileInfo2.len
|
|
546
|
-
});
|
|
547
|
-
callback(progress);
|
|
548
|
-
}
|
|
549
|
-
case 15:
|
|
591
|
+
return _context5.delegateYield(_loop(), "t0", 11);
|
|
592
|
+
case 11:
|
|
550
593
|
f++;
|
|
551
|
-
|
|
594
|
+
_context5.next = 9;
|
|
552
595
|
break;
|
|
553
|
-
case
|
|
596
|
+
case 14:
|
|
554
597
|
case "end":
|
|
555
|
-
return
|
|
598
|
+
return _context5.stop();
|
|
556
599
|
}
|
|
557
600
|
}, _callee4);
|
|
558
601
|
}));
|
|
@@ -568,15 +611,15 @@ exports.UploadFiles = /*#__PURE__*/function () {
|
|
|
568
611
|
rateTestJobs = Math.min(3, jobs.length);
|
|
569
612
|
rates = [];
|
|
570
613
|
j = 0;
|
|
571
|
-
case
|
|
614
|
+
case 33:
|
|
572
615
|
if (!(j < rateTestJobs)) {
|
|
573
|
-
|
|
616
|
+
_context7.next = 43;
|
|
574
617
|
break;
|
|
575
618
|
}
|
|
576
619
|
start = new Date().getTime();
|
|
577
|
-
|
|
620
|
+
_context7.next = 37;
|
|
578
621
|
return UploadJob(jobs[j], j);
|
|
579
|
-
case
|
|
622
|
+
case 37:
|
|
580
623
|
elapsed = (new Date().getTime() - start) / 1000;
|
|
581
624
|
size = jobSpecs[j].files.map(function (file) {
|
|
582
625
|
return file.len;
|
|
@@ -584,32 +627,32 @@ exports.UploadFiles = /*#__PURE__*/function () {
|
|
|
584
627
|
return length + total;
|
|
585
628
|
}, 0);
|
|
586
629
|
rates.push(size / elapsed / (1024 * 1024));
|
|
587
|
-
case
|
|
630
|
+
case 40:
|
|
588
631
|
j++;
|
|
589
|
-
|
|
632
|
+
_context7.next = 33;
|
|
590
633
|
break;
|
|
591
|
-
case
|
|
634
|
+
case 43:
|
|
592
635
|
averageRate = rates.reduce(function (mbps, total) {
|
|
593
636
|
return mbps + total;
|
|
594
637
|
}, 0) / rateTestJobs; // Upload remaining jobs in parallel
|
|
595
638
|
concurrentUploads = Math.min(5, Math.ceil(averageRate / 2));
|
|
596
|
-
|
|
639
|
+
_context7.next = 47;
|
|
597
640
|
return this.utils.LimitedMap(concurrentUploads, jobs, /*#__PURE__*/function () {
|
|
598
641
|
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(jobId, j) {
|
|
599
|
-
return _regeneratorRuntime.wrap(function _callee5$(
|
|
600
|
-
while (1) switch (
|
|
642
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context6) {
|
|
643
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
601
644
|
case 0:
|
|
602
645
|
if (!(j < rateTestJobs)) {
|
|
603
|
-
|
|
646
|
+
_context6.next = 2;
|
|
604
647
|
break;
|
|
605
648
|
}
|
|
606
|
-
return
|
|
649
|
+
return _context6.abrupt("return");
|
|
607
650
|
case 2:
|
|
608
|
-
|
|
651
|
+
_context6.next = 4;
|
|
609
652
|
return UploadJob(jobId, j);
|
|
610
653
|
case 4:
|
|
611
654
|
case "end":
|
|
612
|
-
return
|
|
655
|
+
return _context6.stop();
|
|
613
656
|
}
|
|
614
657
|
}, _callee5);
|
|
615
658
|
}));
|
|
@@ -617,9 +660,9 @@ exports.UploadFiles = /*#__PURE__*/function () {
|
|
|
617
660
|
return _ref9.apply(this, arguments);
|
|
618
661
|
};
|
|
619
662
|
}());
|
|
620
|
-
case
|
|
663
|
+
case 47:
|
|
621
664
|
case "end":
|
|
622
|
-
return
|
|
665
|
+
return _context7.stop();
|
|
623
666
|
}
|
|
624
667
|
}, _callee6, this);
|
|
625
668
|
}));
|
|
@@ -630,8 +673,8 @@ exports.UploadFiles = /*#__PURE__*/function () {
|
|
|
630
673
|
exports.CreateFileUploadJob = /*#__PURE__*/function () {
|
|
631
674
|
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref10) {
|
|
632
675
|
var libraryId, objectId, writeToken, ops, _ref10$defaults, defaults, _ref10$encryption, encryption, body, path;
|
|
633
|
-
return _regeneratorRuntime.wrap(function _callee7$(
|
|
634
|
-
while (1) switch (
|
|
676
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context8) {
|
|
677
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
635
678
|
case 0:
|
|
636
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;
|
|
637
680
|
ValidateParameters({
|
|
@@ -653,9 +696,9 @@ exports.CreateFileUploadJob = /*#__PURE__*/function () {
|
|
|
653
696
|
ops: ops
|
|
654
697
|
};
|
|
655
698
|
path = UrlJoin("q", writeToken, "file_jobs");
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
699
|
+
_context8.t0 = this.utils;
|
|
700
|
+
_context8.t1 = this.HttpClient;
|
|
701
|
+
_context8.next = 12;
|
|
659
702
|
return this.authClient.AuthorizationHeader({
|
|
660
703
|
libraryId: libraryId,
|
|
661
704
|
objectId: objectId,
|
|
@@ -663,21 +706,21 @@ exports.CreateFileUploadJob = /*#__PURE__*/function () {
|
|
|
663
706
|
encryption: encryption
|
|
664
707
|
});
|
|
665
708
|
case 12:
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
headers:
|
|
709
|
+
_context8.t2 = _context8.sent;
|
|
710
|
+
_context8.t3 = path;
|
|
711
|
+
_context8.t4 = body;
|
|
712
|
+
_context8.t5 = {
|
|
713
|
+
headers: _context8.t2,
|
|
671
714
|
method: "POST",
|
|
672
|
-
path:
|
|
673
|
-
body:
|
|
674
|
-
|
|
715
|
+
path: _context8.t3,
|
|
716
|
+
body: _context8.t4,
|
|
717
|
+
allowFailover: false
|
|
675
718
|
};
|
|
676
|
-
|
|
677
|
-
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));
|
|
678
721
|
case 18:
|
|
679
722
|
case "end":
|
|
680
|
-
return
|
|
723
|
+
return _context8.stop();
|
|
681
724
|
}
|
|
682
725
|
}, _callee7, this);
|
|
683
726
|
}));
|
|
@@ -688,8 +731,8 @@ exports.CreateFileUploadJob = /*#__PURE__*/function () {
|
|
|
688
731
|
exports.UploadStatus = /*#__PURE__*/function () {
|
|
689
732
|
var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref12) {
|
|
690
733
|
var libraryId, objectId, writeToken, uploadId, path;
|
|
691
|
-
return _regeneratorRuntime.wrap(function _callee8$(
|
|
692
|
-
while (1) switch (
|
|
734
|
+
return _regeneratorRuntime.wrap(function _callee8$(_context9) {
|
|
735
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
693
736
|
case 0:
|
|
694
737
|
libraryId = _ref12.libraryId, objectId = _ref12.objectId, writeToken = _ref12.writeToken, uploadId = _ref12.uploadId;
|
|
695
738
|
ValidateParameters({
|
|
@@ -698,28 +741,28 @@ exports.UploadStatus = /*#__PURE__*/function () {
|
|
|
698
741
|
});
|
|
699
742
|
ValidateWriteToken(writeToken);
|
|
700
743
|
path = UrlJoin("q", writeToken, "file_jobs", uploadId);
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
744
|
+
_context9.t0 = this.utils;
|
|
745
|
+
_context9.t1 = this.HttpClient;
|
|
746
|
+
_context9.next = 8;
|
|
704
747
|
return this.authClient.AuthorizationHeader({
|
|
705
748
|
libraryId: libraryId,
|
|
706
749
|
objectId: objectId,
|
|
707
750
|
update: true
|
|
708
751
|
});
|
|
709
752
|
case 8:
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
headers:
|
|
753
|
+
_context9.t2 = _context9.sent;
|
|
754
|
+
_context9.t3 = path;
|
|
755
|
+
_context9.t4 = {
|
|
756
|
+
headers: _context9.t2,
|
|
714
757
|
method: "GET",
|
|
715
|
-
path:
|
|
716
|
-
|
|
758
|
+
path: _context9.t3,
|
|
759
|
+
allowFailover: false
|
|
717
760
|
};
|
|
718
|
-
|
|
719
|
-
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));
|
|
720
763
|
case 13:
|
|
721
764
|
case "end":
|
|
722
|
-
return
|
|
765
|
+
return _context9.stop();
|
|
723
766
|
}
|
|
724
767
|
}, _callee8, this);
|
|
725
768
|
}));
|
|
@@ -729,9 +772,9 @@ exports.UploadStatus = /*#__PURE__*/function () {
|
|
|
729
772
|
}();
|
|
730
773
|
exports.UploadJobStatus = /*#__PURE__*/function () {
|
|
731
774
|
var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(_ref14) {
|
|
732
|
-
var libraryId, objectId, writeToken, uploadId, jobId, path
|
|
733
|
-
return _regeneratorRuntime.wrap(function _callee9$(
|
|
734
|
-
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) {
|
|
735
778
|
case 0:
|
|
736
779
|
libraryId = _ref14.libraryId, objectId = _ref14.objectId, writeToken = _ref14.writeToken, uploadId = _ref14.uploadId, jobId = _ref14.jobId;
|
|
737
780
|
ValidateParameters({
|
|
@@ -739,54 +782,34 @@ exports.UploadJobStatus = /*#__PURE__*/function () {
|
|
|
739
782
|
objectId: objectId
|
|
740
783
|
});
|
|
741
784
|
ValidateWriteToken(writeToken);
|
|
742
|
-
path = UrlJoin("q", writeToken, "file_jobs", uploadId, "uploads", jobId);
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
_context9.t1 = this.HttpClient;
|
|
747
|
-
_context9.next = 9;
|
|
785
|
+
path = UrlJoin("q", writeToken, "file_jobs", uploadId, "uploads", jobId);
|
|
786
|
+
_context10.t0 = this.utils;
|
|
787
|
+
_context10.t1 = this.HttpClient;
|
|
788
|
+
_context10.next = 8;
|
|
748
789
|
return this.authClient.AuthorizationHeader({
|
|
749
790
|
libraryId: libraryId,
|
|
750
791
|
objectId: objectId,
|
|
751
792
|
update: true
|
|
752
793
|
});
|
|
753
|
-
case
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
headers:
|
|
794
|
+
case 8:
|
|
795
|
+
_context10.t2 = _context10.sent;
|
|
796
|
+
_context10.t3 = path;
|
|
797
|
+
_context10.t4 = {
|
|
798
|
+
headers: _context10.t2,
|
|
758
799
|
method: "GET",
|
|
759
|
-
path:
|
|
760
|
-
|
|
800
|
+
path: _context10.t3,
|
|
801
|
+
allowFailover: false
|
|
761
802
|
};
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
return
|
|
765
|
-
case
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
this.Log(_context9.t6, true);
|
|
769
|
-
retries += 1;
|
|
770
|
-
if (!(retries >= 5)) {
|
|
771
|
-
_context9.next = 23;
|
|
772
|
-
break;
|
|
773
|
-
}
|
|
774
|
-
throw _context9.t6;
|
|
775
|
-
case 23:
|
|
776
|
-
_context9.next = 25;
|
|
777
|
-
return new Promise(function (resolve) {
|
|
778
|
-
return setTimeout(resolve, 10 * retries * 1000);
|
|
779
|
-
});
|
|
780
|
-
case 25:
|
|
781
|
-
if (retries < 5) {
|
|
782
|
-
_context9.next = 4;
|
|
783
|
-
break;
|
|
784
|
-
}
|
|
785
|
-
case 26:
|
|
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:
|
|
786
809
|
case "end":
|
|
787
|
-
return
|
|
810
|
+
return _context10.stop();
|
|
788
811
|
}
|
|
789
|
-
}, _callee9, this
|
|
812
|
+
}, _callee9, this);
|
|
790
813
|
}));
|
|
791
814
|
return function (_x10) {
|
|
792
815
|
return _ref15.apply(this, arguments);
|
|
@@ -794,20 +817,17 @@ exports.UploadJobStatus = /*#__PURE__*/function () {
|
|
|
794
817
|
}();
|
|
795
818
|
exports.UploadFileData = /*#__PURE__*/function () {
|
|
796
819
|
var _ref17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(_ref16) {
|
|
797
|
-
var libraryId, objectId, writeToken, uploadId, jobId, filePath, fileData,
|
|
798
|
-
return _regeneratorRuntime.wrap(function _callee10$(
|
|
799
|
-
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) {
|
|
800
823
|
case 0:
|
|
801
|
-
libraryId = _ref16.libraryId, objectId = _ref16.objectId, writeToken = _ref16.writeToken, uploadId = _ref16.uploadId, jobId = _ref16.jobId, filePath = _ref16.filePath, fileData = _ref16.fileData;
|
|
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;
|
|
802
825
|
ValidateParameters({
|
|
803
826
|
libraryId: libraryId,
|
|
804
827
|
objectId: objectId
|
|
805
828
|
});
|
|
806
829
|
ValidateWriteToken(writeToken);
|
|
807
|
-
|
|
808
|
-
case 4:
|
|
809
|
-
_context10.prev = 4;
|
|
810
|
-
_context10.next = 7;
|
|
830
|
+
_context11.next = 5;
|
|
811
831
|
return this.UploadJobStatus({
|
|
812
832
|
libraryId: libraryId,
|
|
813
833
|
objectId: objectId,
|
|
@@ -815,78 +835,62 @@ exports.UploadFileData = /*#__PURE__*/function () {
|
|
|
815
835
|
uploadId: uploadId,
|
|
816
836
|
jobId: jobId
|
|
817
837
|
});
|
|
818
|
-
case
|
|
819
|
-
jobStatus =
|
|
838
|
+
case 5:
|
|
839
|
+
jobStatus = _context11.sent;
|
|
820
840
|
// Find the status of this file
|
|
821
841
|
fileStatus = jobStatus.files.find(function (item) {
|
|
822
842
|
return item.path == filePath;
|
|
823
843
|
});
|
|
844
|
+
if (encryption && encryption !== "none") {
|
|
845
|
+
fileStatus = fileStatus.encrypted;
|
|
846
|
+
}
|
|
824
847
|
if (!(fileStatus.rem === 0)) {
|
|
825
|
-
|
|
848
|
+
_context11.next = 12;
|
|
826
849
|
break;
|
|
827
850
|
}
|
|
828
|
-
return
|
|
829
|
-
case
|
|
851
|
+
return _context11.abrupt("return");
|
|
852
|
+
case 12:
|
|
830
853
|
if (fileStatus.skip) {
|
|
831
854
|
fileData = fileData.slice(fileStatus.skip);
|
|
832
855
|
}
|
|
833
|
-
case
|
|
856
|
+
case 13:
|
|
834
857
|
path = UrlJoin("q", writeToken, "file_jobs", uploadId, jobId);
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
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 = {
|
|
841
864
|
"Content-type": "application/octet-stream"
|
|
842
865
|
};
|
|
843
|
-
|
|
866
|
+
_context11.next = 22;
|
|
844
867
|
return this.authClient.AuthorizationHeader({
|
|
845
868
|
libraryId: libraryId,
|
|
846
869
|
objectId: objectId,
|
|
847
870
|
update: true
|
|
848
871
|
});
|
|
849
|
-
case
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
872
|
+
case 22:
|
|
873
|
+
_context11.t6 = _context11.sent;
|
|
874
|
+
_context11.t7 = (0, _context11.t4)(_context11.t5, _context11.t6);
|
|
875
|
+
_context11.t8 = {
|
|
853
876
|
method: "POST",
|
|
854
|
-
path:
|
|
855
|
-
body:
|
|
877
|
+
path: _context11.t2,
|
|
878
|
+
body: _context11.t3,
|
|
856
879
|
bodyType: "BINARY",
|
|
857
|
-
headers:
|
|
858
|
-
|
|
880
|
+
headers: _context11.t7,
|
|
881
|
+
allowFailover: false,
|
|
882
|
+
allowRetry: false
|
|
859
883
|
};
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
return
|
|
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);
|
|
863
889
|
case 29:
|
|
864
|
-
return _context10.abrupt("return", _context10.sent);
|
|
865
|
-
case 32:
|
|
866
|
-
_context10.prev = 32;
|
|
867
|
-
_context10.t10 = _context10["catch"](4);
|
|
868
|
-
this.Log(_context10.t10, true);
|
|
869
|
-
retries += 1;
|
|
870
|
-
if (!(retries >= 5)) {
|
|
871
|
-
_context10.next = 38;
|
|
872
|
-
break;
|
|
873
|
-
}
|
|
874
|
-
throw _context10.t10;
|
|
875
|
-
case 38:
|
|
876
|
-
_context10.next = 40;
|
|
877
|
-
return new Promise(function (resolve) {
|
|
878
|
-
return setTimeout(resolve, 10 * retries * 1000);
|
|
879
|
-
});
|
|
880
|
-
case 40:
|
|
881
|
-
if (retries < 5) {
|
|
882
|
-
_context10.next = 4;
|
|
883
|
-
break;
|
|
884
|
-
}
|
|
885
|
-
case 41:
|
|
886
890
|
case "end":
|
|
887
|
-
return
|
|
891
|
+
return _context11.stop();
|
|
888
892
|
}
|
|
889
|
-
}, _callee10, this
|
|
893
|
+
}, _callee10, this);
|
|
890
894
|
}));
|
|
891
895
|
return function (_x11) {
|
|
892
896
|
return _ref17.apply(this, arguments);
|
|
@@ -895,8 +899,8 @@ exports.UploadFileData = /*#__PURE__*/function () {
|
|
|
895
899
|
exports.FinalizeUploadJob = /*#__PURE__*/function () {
|
|
896
900
|
var _ref19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(_ref18) {
|
|
897
901
|
var libraryId, objectId, writeToken, path;
|
|
898
|
-
return _regeneratorRuntime.wrap(function _callee11$(
|
|
899
|
-
while (1) switch (
|
|
902
|
+
return _regeneratorRuntime.wrap(function _callee11$(_context12) {
|
|
903
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
900
904
|
case 0:
|
|
901
905
|
libraryId = _ref18.libraryId, objectId = _ref18.objectId, writeToken = _ref18.writeToken;
|
|
902
906
|
ValidateParameters({
|
|
@@ -906,28 +910,28 @@ exports.FinalizeUploadJob = /*#__PURE__*/function () {
|
|
|
906
910
|
ValidateWriteToken(writeToken);
|
|
907
911
|
this.Log("Finalizing upload job: ".concat(libraryId, " ").concat(objectId, " ").concat(writeToken));
|
|
908
912
|
path = UrlJoin("q", writeToken, "files");
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
913
|
+
_context12.t0 = this.HttpClient;
|
|
914
|
+
_context12.t1 = path;
|
|
915
|
+
_context12.next = 9;
|
|
912
916
|
return this.authClient.AuthorizationHeader({
|
|
913
917
|
libraryId: libraryId,
|
|
914
918
|
objectId: objectId,
|
|
915
919
|
update: true
|
|
916
920
|
});
|
|
917
921
|
case 9:
|
|
918
|
-
|
|
919
|
-
|
|
922
|
+
_context12.t2 = _context12.sent;
|
|
923
|
+
_context12.t3 = {
|
|
920
924
|
method: "POST",
|
|
921
|
-
path:
|
|
925
|
+
path: _context12.t1,
|
|
922
926
|
bodyType: "BINARY",
|
|
923
|
-
headers:
|
|
924
|
-
|
|
927
|
+
headers: _context12.t2,
|
|
928
|
+
allowFailover: false
|
|
925
929
|
};
|
|
926
|
-
|
|
927
|
-
return
|
|
930
|
+
_context12.next = 13;
|
|
931
|
+
return _context12.t0.Request.call(_context12.t0, _context12.t3);
|
|
928
932
|
case 13:
|
|
929
933
|
case "end":
|
|
930
|
-
return
|
|
934
|
+
return _context12.stop();
|
|
931
935
|
}
|
|
932
936
|
}, _callee11, this);
|
|
933
937
|
}));
|
|
@@ -950,8 +954,8 @@ exports.FinalizeUploadJob = /*#__PURE__*/function () {
|
|
|
950
954
|
exports.CreateFileDirectories = /*#__PURE__*/function () {
|
|
951
955
|
var _ref21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(_ref20) {
|
|
952
956
|
var libraryId, objectId, writeToken, filePaths, ops;
|
|
953
|
-
return _regeneratorRuntime.wrap(function _callee12$(
|
|
954
|
-
while (1) switch (
|
|
957
|
+
return _regeneratorRuntime.wrap(function _callee12$(_context13) {
|
|
958
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
955
959
|
case 0:
|
|
956
960
|
libraryId = _ref20.libraryId, objectId = _ref20.objectId, writeToken = _ref20.writeToken, filePaths = _ref20.filePaths;
|
|
957
961
|
ValidateParameters({
|
|
@@ -968,7 +972,7 @@ exports.CreateFileDirectories = /*#__PURE__*/function () {
|
|
|
968
972
|
path: path
|
|
969
973
|
};
|
|
970
974
|
});
|
|
971
|
-
|
|
975
|
+
_context13.next = 8;
|
|
972
976
|
return this.CreateFileUploadJob({
|
|
973
977
|
libraryId: libraryId,
|
|
974
978
|
objectId: objectId,
|
|
@@ -977,7 +981,7 @@ exports.CreateFileDirectories = /*#__PURE__*/function () {
|
|
|
977
981
|
});
|
|
978
982
|
case 8:
|
|
979
983
|
case "end":
|
|
980
|
-
return
|
|
984
|
+
return _context13.stop();
|
|
981
985
|
}
|
|
982
986
|
}, _callee12, this);
|
|
983
987
|
}));
|
|
@@ -1000,8 +1004,8 @@ exports.CreateFileDirectories = /*#__PURE__*/function () {
|
|
|
1000
1004
|
exports.DeleteFiles = /*#__PURE__*/function () {
|
|
1001
1005
|
var _ref23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(_ref22) {
|
|
1002
1006
|
var libraryId, objectId, writeToken, filePaths, ops;
|
|
1003
|
-
return _regeneratorRuntime.wrap(function _callee13$(
|
|
1004
|
-
while (1) switch (
|
|
1007
|
+
return _regeneratorRuntime.wrap(function _callee13$(_context14) {
|
|
1008
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
1005
1009
|
case 0:
|
|
1006
1010
|
libraryId = _ref22.libraryId, objectId = _ref22.objectId, writeToken = _ref22.writeToken, filePaths = _ref22.filePaths;
|
|
1007
1011
|
ValidateParameters({
|
|
@@ -1017,7 +1021,7 @@ exports.DeleteFiles = /*#__PURE__*/function () {
|
|
|
1017
1021
|
path: path
|
|
1018
1022
|
};
|
|
1019
1023
|
});
|
|
1020
|
-
|
|
1024
|
+
_context14.next = 8;
|
|
1021
1025
|
return this.CreateFileUploadJob({
|
|
1022
1026
|
libraryId: libraryId,
|
|
1023
1027
|
objectId: objectId,
|
|
@@ -1026,7 +1030,7 @@ exports.DeleteFiles = /*#__PURE__*/function () {
|
|
|
1026
1030
|
});
|
|
1027
1031
|
case 8:
|
|
1028
1032
|
case "end":
|
|
1029
|
-
return
|
|
1033
|
+
return _context14.stop();
|
|
1030
1034
|
}
|
|
1031
1035
|
}, _callee13, this);
|
|
1032
1036
|
}));
|
|
@@ -1046,7 +1050,7 @@ exports.DeleteFiles = /*#__PURE__*/function () {
|
|
|
1046
1050
|
* @param {string=} versionHash - Hash of the object version - if not specified, latest version will be used
|
|
1047
1051
|
* @param {string=} writeToken - Write token for the draft from which to download the file
|
|
1048
1052
|
* @param {string} filePath - Path to the file to download
|
|
1049
|
-
* @param {string=} format="
|
|
1053
|
+
* @param {string=} format="arrayBuffer" - Format in which to return the data ("blob" | "arraybuffer" | "buffer")
|
|
1050
1054
|
* @param {boolean=} chunked=false - If specified, file will be downloaded and decrypted in chunks. The
|
|
1051
1055
|
* specified callback will be invoked on completion of each chunk. This is recommended for large files.
|
|
1052
1056
|
* @param {number=} chunkSize=1000000 - Size of file chunks to request for download
|
|
@@ -1082,9 +1086,9 @@ exports.DownloadFile = /*#__PURE__*/function () {
|
|
|
1082
1086
|
ownerCapKey,
|
|
1083
1087
|
ownerCap,
|
|
1084
1088
|
bytesTotal,
|
|
1085
|
-
|
|
1086
|
-
return _regeneratorRuntime.wrap(function _callee14$(
|
|
1087
|
-
while (1) switch (
|
|
1089
|
+
_args15 = arguments;
|
|
1090
|
+
return _regeneratorRuntime.wrap(function _callee14$(_context15) {
|
|
1091
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1088
1092
|
case 0:
|
|
1089
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;
|
|
1090
1094
|
ValidateParameters({
|
|
@@ -1096,7 +1100,7 @@ exports.DownloadFile = /*#__PURE__*/function () {
|
|
|
1096
1100
|
if (versionHash) {
|
|
1097
1101
|
objectId = this.utils.DecodeVersionHash(versionHash).objectId;
|
|
1098
1102
|
}
|
|
1099
|
-
|
|
1103
|
+
_context15.next = 6;
|
|
1100
1104
|
return this.ContentObjectMetadata({
|
|
1101
1105
|
libraryId: libraryId,
|
|
1102
1106
|
objectId: objectId,
|
|
@@ -1105,11 +1109,11 @@ exports.DownloadFile = /*#__PURE__*/function () {
|
|
|
1105
1109
|
metadataSubtree: UrlJoin("files", filePath)
|
|
1106
1110
|
});
|
|
1107
1111
|
case 6:
|
|
1108
|
-
fileInfo =
|
|
1112
|
+
fileInfo = _context15.sent;
|
|
1109
1113
|
encrypted = fileInfo && fileInfo["."].encryption && fileInfo["."].encryption.scheme === "cgck";
|
|
1110
1114
|
encryption = encrypted ? "cgck" : undefined;
|
|
1111
1115
|
path = encrypted && !clientSideDecryption ? UrlJoin("q", writeToken || versionHash || objectId, "rep", "files_download", filePath) : UrlJoin("q", writeToken || versionHash || objectId, "files", filePath);
|
|
1112
|
-
|
|
1116
|
+
_context15.next = 12;
|
|
1113
1117
|
return this.authClient.AuthorizationHeader({
|
|
1114
1118
|
libraryId: libraryId,
|
|
1115
1119
|
objectId: objectId,
|
|
@@ -1117,43 +1121,44 @@ exports.DownloadFile = /*#__PURE__*/function () {
|
|
|
1117
1121
|
encryption: encryption
|
|
1118
1122
|
});
|
|
1119
1123
|
case 12:
|
|
1120
|
-
headers =
|
|
1124
|
+
headers = _context15.sent;
|
|
1121
1125
|
headers.Accept = "*/*";
|
|
1122
1126
|
|
|
1123
1127
|
// If not owner, indicate re-encryption
|
|
1124
1128
|
ownerCapKey = "eluv.caps.iusr".concat(this.utils.AddressToHash(this.signer.address));
|
|
1125
|
-
|
|
1129
|
+
_context15.next = 17;
|
|
1126
1130
|
return this.ContentObjectMetadata({
|
|
1127
1131
|
libraryId: libraryId,
|
|
1128
1132
|
objectId: objectId,
|
|
1133
|
+
versionHash: versionHash,
|
|
1129
1134
|
metadataSubtree: ownerCapKey
|
|
1130
1135
|
});
|
|
1131
1136
|
case 17:
|
|
1132
|
-
ownerCap =
|
|
1133
|
-
|
|
1134
|
-
if (!
|
|
1135
|
-
|
|
1137
|
+
ownerCap = _context15.sent;
|
|
1138
|
+
_context15.t1 = encrypted;
|
|
1139
|
+
if (!_context15.t1) {
|
|
1140
|
+
_context15.next = 26;
|
|
1136
1141
|
break;
|
|
1137
1142
|
}
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1143
|
+
_context15.t2 = this.utils;
|
|
1144
|
+
_context15.t3 = this.signer.address;
|
|
1145
|
+
_context15.next = 24;
|
|
1141
1146
|
return this.ContentObjectOwner({
|
|
1142
1147
|
objectId: objectId
|
|
1143
1148
|
});
|
|
1144
1149
|
case 24:
|
|
1145
|
-
|
|
1146
|
-
|
|
1150
|
+
_context15.t4 = _context15.sent;
|
|
1151
|
+
_context15.t1 = !_context15.t2.EqualAddress.call(_context15.t2, _context15.t3, _context15.t4);
|
|
1147
1152
|
case 26:
|
|
1148
|
-
|
|
1149
|
-
if (!
|
|
1150
|
-
|
|
1153
|
+
_context15.t0 = _context15.t1;
|
|
1154
|
+
if (!_context15.t0) {
|
|
1155
|
+
_context15.next = 29;
|
|
1151
1156
|
break;
|
|
1152
1157
|
}
|
|
1153
|
-
|
|
1158
|
+
_context15.t0 = !ownerCap;
|
|
1154
1159
|
case 29:
|
|
1155
|
-
if (!
|
|
1156
|
-
|
|
1160
|
+
if (!_context15.t0) {
|
|
1161
|
+
_context15.next = 31;
|
|
1157
1162
|
break;
|
|
1158
1163
|
}
|
|
1159
1164
|
headers["X-Content-Fabric-Decryption-Mode"] = "reencrypt";
|
|
@@ -1166,11 +1171,11 @@ exports.DownloadFile = /*#__PURE__*/function () {
|
|
|
1166
1171
|
}
|
|
1167
1172
|
bytesTotal = fileInfo["."].size;
|
|
1168
1173
|
if (!(encrypted && clientSideDecryption)) {
|
|
1169
|
-
|
|
1174
|
+
_context15.next = 51;
|
|
1170
1175
|
break;
|
|
1171
1176
|
}
|
|
1172
|
-
|
|
1173
|
-
|
|
1177
|
+
_context15.t5 = this;
|
|
1178
|
+
_context15.next = 37;
|
|
1174
1179
|
return this.EncryptionConk({
|
|
1175
1180
|
libraryId: libraryId,
|
|
1176
1181
|
objectId: objectId,
|
|
@@ -1178,34 +1183,34 @@ exports.DownloadFile = /*#__PURE__*/function () {
|
|
|
1178
1183
|
download: true
|
|
1179
1184
|
});
|
|
1180
1185
|
case 37:
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
conk:
|
|
1191
|
-
downloadPath:
|
|
1192
|
-
bytesTotal:
|
|
1193
|
-
headers:
|
|
1194
|
-
callback:
|
|
1195
|
-
format:
|
|
1196
|
-
clientSideDecryption:
|
|
1197
|
-
chunked:
|
|
1186
|
+
_context15.t6 = _context15.sent;
|
|
1187
|
+
_context15.t7 = path;
|
|
1188
|
+
_context15.t8 = bytesTotal;
|
|
1189
|
+
_context15.t9 = headers;
|
|
1190
|
+
_context15.t10 = callback;
|
|
1191
|
+
_context15.t11 = format;
|
|
1192
|
+
_context15.t12 = clientSideDecryption;
|
|
1193
|
+
_context15.t13 = chunked;
|
|
1194
|
+
_context15.t14 = {
|
|
1195
|
+
conk: _context15.t6,
|
|
1196
|
+
downloadPath: _context15.t7,
|
|
1197
|
+
bytesTotal: _context15.t8,
|
|
1198
|
+
headers: _context15.t9,
|
|
1199
|
+
callback: _context15.t10,
|
|
1200
|
+
format: _context15.t11,
|
|
1201
|
+
clientSideDecryption: _context15.t12,
|
|
1202
|
+
chunked: _context15.t13
|
|
1198
1203
|
};
|
|
1199
|
-
|
|
1200
|
-
return
|
|
1204
|
+
_context15.next = 48;
|
|
1205
|
+
return _context15.t5.DownloadEncrypted.call(_context15.t5, _context15.t14);
|
|
1201
1206
|
case 48:
|
|
1202
|
-
return
|
|
1207
|
+
return _context15.abrupt("return", _context15.sent);
|
|
1203
1208
|
case 51:
|
|
1204
1209
|
if (!chunkSize) {
|
|
1205
1210
|
chunkSize = 10000000;
|
|
1206
1211
|
}
|
|
1207
|
-
|
|
1208
|
-
|
|
1212
|
+
_context15.prev = 52;
|
|
1213
|
+
_context15.next = 55;
|
|
1209
1214
|
return this.Download({
|
|
1210
1215
|
downloadPath: path,
|
|
1211
1216
|
bytesTotal: bytesTotal,
|
|
@@ -1216,22 +1221,22 @@ exports.DownloadFile = /*#__PURE__*/function () {
|
|
|
1216
1221
|
chunkSize: chunkSize
|
|
1217
1222
|
});
|
|
1218
1223
|
case 55:
|
|
1219
|
-
return
|
|
1224
|
+
return _context15.abrupt("return", _context15.sent);
|
|
1220
1225
|
case 58:
|
|
1221
|
-
|
|
1222
|
-
|
|
1226
|
+
_context15.prev = 58;
|
|
1227
|
+
_context15.t15 = _context15["catch"](52);
|
|
1223
1228
|
if (!(encrypted && !clientSideDecryption)) {
|
|
1224
|
-
|
|
1229
|
+
_context15.next = 62;
|
|
1225
1230
|
break;
|
|
1226
1231
|
}
|
|
1227
|
-
return
|
|
1232
|
+
return _context15.abrupt("return", this.DownloadFile(_objectSpread(_objectSpread({}, _args15[0]), {}, {
|
|
1228
1233
|
clientSideDecryption: true
|
|
1229
1234
|
})));
|
|
1230
1235
|
case 62:
|
|
1231
|
-
throw
|
|
1236
|
+
throw _context15.t15;
|
|
1232
1237
|
case 63:
|
|
1233
1238
|
case "end":
|
|
1234
|
-
return
|
|
1239
|
+
return _context15.stop();
|
|
1235
1240
|
}
|
|
1236
1241
|
}, _callee14, this, [[52, 58]]);
|
|
1237
1242
|
}));
|
|
@@ -1257,8 +1262,8 @@ exports.DownloadFile = /*#__PURE__*/function () {
|
|
|
1257
1262
|
exports.ContentParts = /*#__PURE__*/function () {
|
|
1258
1263
|
var _ref27 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(_ref26) {
|
|
1259
1264
|
var libraryId, objectId, versionHash, path, response;
|
|
1260
|
-
return _regeneratorRuntime.wrap(function _callee15$(
|
|
1261
|
-
while (1) switch (
|
|
1265
|
+
return _regeneratorRuntime.wrap(function _callee15$(_context16) {
|
|
1266
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1262
1267
|
case 0:
|
|
1263
1268
|
libraryId = _ref26.libraryId, objectId = _ref26.objectId, versionHash = _ref26.versionHash;
|
|
1264
1269
|
ValidateParameters({
|
|
@@ -1271,31 +1276,31 @@ exports.ContentParts = /*#__PURE__*/function () {
|
|
|
1271
1276
|
objectId = this.utils.DecodeVersionHash(versionHash).objectId;
|
|
1272
1277
|
}
|
|
1273
1278
|
path = UrlJoin("q", versionHash || objectId, "parts");
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1279
|
+
_context16.t0 = this.utils;
|
|
1280
|
+
_context16.t1 = this.HttpClient;
|
|
1281
|
+
_context16.next = 9;
|
|
1277
1282
|
return this.authClient.AuthorizationHeader({
|
|
1278
1283
|
libraryId: libraryId,
|
|
1279
1284
|
objectId: objectId,
|
|
1280
1285
|
versionHash: versionHash
|
|
1281
1286
|
});
|
|
1282
1287
|
case 9:
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
headers:
|
|
1288
|
+
_context16.t2 = _context16.sent;
|
|
1289
|
+
_context16.t3 = path;
|
|
1290
|
+
_context16.t4 = {
|
|
1291
|
+
headers: _context16.t2,
|
|
1287
1292
|
method: "GET",
|
|
1288
|
-
path:
|
|
1293
|
+
path: _context16.t3
|
|
1289
1294
|
};
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
return
|
|
1295
|
+
_context16.t5 = _context16.t1.Request.call(_context16.t1, _context16.t4);
|
|
1296
|
+
_context16.next = 15;
|
|
1297
|
+
return _context16.t0.ResponseToJson.call(_context16.t0, _context16.t5);
|
|
1293
1298
|
case 15:
|
|
1294
|
-
response =
|
|
1295
|
-
return
|
|
1299
|
+
response = _context16.sent;
|
|
1300
|
+
return _context16.abrupt("return", response.parts);
|
|
1296
1301
|
case 17:
|
|
1297
1302
|
case "end":
|
|
1298
|
-
return
|
|
1303
|
+
return _context16.stop();
|
|
1299
1304
|
}
|
|
1300
1305
|
}, _callee15, this);
|
|
1301
1306
|
}));
|
|
@@ -1320,8 +1325,8 @@ exports.ContentParts = /*#__PURE__*/function () {
|
|
|
1320
1325
|
exports.ContentPart = /*#__PURE__*/function () {
|
|
1321
1326
|
var _ref29 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(_ref28) {
|
|
1322
1327
|
var libraryId, objectId, versionHash, partHash, path;
|
|
1323
|
-
return _regeneratorRuntime.wrap(function _callee16$(
|
|
1324
|
-
while (1) switch (
|
|
1328
|
+
return _regeneratorRuntime.wrap(function _callee16$(_context17) {
|
|
1329
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1325
1330
|
case 0:
|
|
1326
1331
|
libraryId = _ref28.libraryId, objectId = _ref28.objectId, versionHash = _ref28.versionHash, partHash = _ref28.partHash;
|
|
1327
1332
|
ValidateParameters({
|
|
@@ -1335,30 +1340,30 @@ exports.ContentPart = /*#__PURE__*/function () {
|
|
|
1335
1340
|
objectId = this.utils.DecodeVersionHash(versionHash).objectId;
|
|
1336
1341
|
}
|
|
1337
1342
|
path = UrlJoin("q", versionHash || objectId, "parts", partHash);
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1343
|
+
_context17.t0 = this.utils;
|
|
1344
|
+
_context17.t1 = this.HttpClient;
|
|
1345
|
+
_context17.next = 10;
|
|
1341
1346
|
return this.authClient.AuthorizationHeader({
|
|
1342
1347
|
libraryId: libraryId,
|
|
1343
1348
|
objectId: objectId,
|
|
1344
1349
|
versionHash: versionHash
|
|
1345
1350
|
});
|
|
1346
1351
|
case 10:
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
headers:
|
|
1352
|
+
_context17.t2 = _context17.sent;
|
|
1353
|
+
_context17.t3 = path;
|
|
1354
|
+
_context17.t4 = {
|
|
1355
|
+
headers: _context17.t2,
|
|
1351
1356
|
method: "GET",
|
|
1352
|
-
path:
|
|
1357
|
+
path: _context17.t3
|
|
1353
1358
|
};
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
return
|
|
1359
|
+
_context17.t5 = _context17.t1.Request.call(_context17.t1, _context17.t4);
|
|
1360
|
+
_context17.next = 16;
|
|
1361
|
+
return _context17.t0.ResponseToJson.call(_context17.t0, _context17.t5);
|
|
1357
1362
|
case 16:
|
|
1358
|
-
return
|
|
1363
|
+
return _context17.abrupt("return", _context17.sent);
|
|
1359
1364
|
case 17:
|
|
1360
1365
|
case "end":
|
|
1361
|
-
return
|
|
1366
|
+
return _context17.stop();
|
|
1362
1367
|
}
|
|
1363
1368
|
}, _callee16, this);
|
|
1364
1369
|
}));
|
|
@@ -1394,8 +1399,8 @@ exports.ContentPart = /*#__PURE__*/function () {
|
|
|
1394
1399
|
exports.DownloadPart = /*#__PURE__*/function () {
|
|
1395
1400
|
var _ref31 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17(_ref30) {
|
|
1396
1401
|
var libraryId, objectId, versionHash, writeToken, partHash, _ref30$format, format, _ref30$chunked, chunked, _ref30$chunkSize, chunkSize, callback, encrypted, encryption, path, headers, bytesTotal;
|
|
1397
|
-
return _regeneratorRuntime.wrap(function _callee17$(
|
|
1398
|
-
while (1) switch (
|
|
1402
|
+
return _regeneratorRuntime.wrap(function _callee17$(_context18) {
|
|
1403
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1399
1404
|
case 0:
|
|
1400
1405
|
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;
|
|
1401
1406
|
ValidateParameters({
|
|
@@ -1410,7 +1415,7 @@ exports.DownloadPart = /*#__PURE__*/function () {
|
|
|
1410
1415
|
encrypted = partHash.startsWith("hqpe");
|
|
1411
1416
|
encryption = encrypted ? "cgck" : undefined;
|
|
1412
1417
|
path = UrlJoin("q", writeToken || versionHash || objectId, "data", partHash);
|
|
1413
|
-
|
|
1418
|
+
_context18.next = 9;
|
|
1414
1419
|
return this.authClient.AuthorizationHeader({
|
|
1415
1420
|
libraryId: libraryId,
|
|
1416
1421
|
objectId: objectId,
|
|
@@ -1419,8 +1424,8 @@ exports.DownloadPart = /*#__PURE__*/function () {
|
|
|
1419
1424
|
makeAccessRequest: true
|
|
1420
1425
|
});
|
|
1421
1426
|
case 9:
|
|
1422
|
-
headers =
|
|
1423
|
-
|
|
1427
|
+
headers = _context18.sent;
|
|
1428
|
+
_context18.next = 12;
|
|
1424
1429
|
return this.ContentPart({
|
|
1425
1430
|
libraryId: libraryId,
|
|
1426
1431
|
objectId: objectId,
|
|
@@ -1428,55 +1433,55 @@ exports.DownloadPart = /*#__PURE__*/function () {
|
|
|
1428
1433
|
partHash: partHash
|
|
1429
1434
|
});
|
|
1430
1435
|
case 12:
|
|
1431
|
-
bytesTotal =
|
|
1436
|
+
bytesTotal = _context18.sent.part.size;
|
|
1432
1437
|
if (!encrypted) {
|
|
1433
|
-
|
|
1438
|
+
_context18.next = 37;
|
|
1434
1439
|
break;
|
|
1435
1440
|
}
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1441
|
+
_context18.t0 = this.utils;
|
|
1442
|
+
_context18.t1 = this.signer.address;
|
|
1443
|
+
_context18.next = 18;
|
|
1439
1444
|
return this.ContentObjectOwner({
|
|
1440
1445
|
objectId: objectId
|
|
1441
1446
|
});
|
|
1442
1447
|
case 18:
|
|
1443
|
-
|
|
1444
|
-
if (
|
|
1445
|
-
|
|
1448
|
+
_context18.t2 = _context18.sent;
|
|
1449
|
+
if (_context18.t0.EqualAddress.call(_context18.t0, _context18.t1, _context18.t2)) {
|
|
1450
|
+
_context18.next = 21;
|
|
1446
1451
|
break;
|
|
1447
1452
|
}
|
|
1448
1453
|
headers["X-Content-Fabric-Decryption-Mode"] = "reencrypt";
|
|
1449
1454
|
case 21:
|
|
1450
|
-
|
|
1451
|
-
|
|
1455
|
+
_context18.t3 = this;
|
|
1456
|
+
_context18.next = 24;
|
|
1452
1457
|
return this.EncryptionConk({
|
|
1453
1458
|
libraryId: libraryId,
|
|
1454
1459
|
objectId: objectId,
|
|
1455
1460
|
download: true
|
|
1456
1461
|
});
|
|
1457
1462
|
case 24:
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
conk:
|
|
1467
|
-
downloadPath:
|
|
1468
|
-
bytesTotal:
|
|
1469
|
-
headers:
|
|
1470
|
-
callback:
|
|
1471
|
-
format:
|
|
1472
|
-
chunked:
|
|
1463
|
+
_context18.t4 = _context18.sent;
|
|
1464
|
+
_context18.t5 = path;
|
|
1465
|
+
_context18.t6 = bytesTotal;
|
|
1466
|
+
_context18.t7 = headers;
|
|
1467
|
+
_context18.t8 = callback;
|
|
1468
|
+
_context18.t9 = format;
|
|
1469
|
+
_context18.t10 = chunked;
|
|
1470
|
+
_context18.t11 = {
|
|
1471
|
+
conk: _context18.t4,
|
|
1472
|
+
downloadPath: _context18.t5,
|
|
1473
|
+
bytesTotal: _context18.t6,
|
|
1474
|
+
headers: _context18.t7,
|
|
1475
|
+
callback: _context18.t8,
|
|
1476
|
+
format: _context18.t9,
|
|
1477
|
+
chunked: _context18.t10
|
|
1473
1478
|
};
|
|
1474
|
-
|
|
1475
|
-
return
|
|
1479
|
+
_context18.next = 34;
|
|
1480
|
+
return _context18.t3.DownloadEncrypted.call(_context18.t3, _context18.t11);
|
|
1476
1481
|
case 34:
|
|
1477
|
-
return
|
|
1482
|
+
return _context18.abrupt("return", _context18.sent);
|
|
1478
1483
|
case 37:
|
|
1479
|
-
|
|
1484
|
+
_context18.next = 39;
|
|
1480
1485
|
return this.Download({
|
|
1481
1486
|
downloadPath: path,
|
|
1482
1487
|
bytesTotal: bytesTotal,
|
|
@@ -1487,10 +1492,10 @@ exports.DownloadPart = /*#__PURE__*/function () {
|
|
|
1487
1492
|
chunkSize: chunkSize
|
|
1488
1493
|
});
|
|
1489
1494
|
case 39:
|
|
1490
|
-
return
|
|
1495
|
+
return _context18.abrupt("return", _context18.sent);
|
|
1491
1496
|
case 40:
|
|
1492
1497
|
case "end":
|
|
1493
|
-
return
|
|
1498
|
+
return _context18.stop();
|
|
1494
1499
|
}
|
|
1495
1500
|
}, _callee17, this);
|
|
1496
1501
|
}));
|
|
@@ -1501,12 +1506,12 @@ exports.DownloadPart = /*#__PURE__*/function () {
|
|
|
1501
1506
|
exports.Download = /*#__PURE__*/function () {
|
|
1502
1507
|
var _ref33 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(_ref32) {
|
|
1503
1508
|
var downloadPath, headers, bytesTotal, _ref32$chunked, chunked, _ref32$chunkSize, chunkSize, callback, _ref32$format, format, outputChunks, bytesFinished, totalChunks, i, response;
|
|
1504
|
-
return _regeneratorRuntime.wrap(function _callee18$(
|
|
1505
|
-
while (1) switch (
|
|
1509
|
+
return _regeneratorRuntime.wrap(function _callee18$(_context19) {
|
|
1510
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1506
1511
|
case 0:
|
|
1507
1512
|
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;
|
|
1508
1513
|
if (!(chunked && !callback)) {
|
|
1509
|
-
|
|
1514
|
+
_context19.next = 3;
|
|
1510
1515
|
break;
|
|
1511
1516
|
}
|
|
1512
1517
|
throw Error("No callback specified for chunked download");
|
|
@@ -1521,47 +1526,47 @@ exports.Download = /*#__PURE__*/function () {
|
|
|
1521
1526
|
i = 0;
|
|
1522
1527
|
case 7:
|
|
1523
1528
|
if (!(i < totalChunks)) {
|
|
1524
|
-
|
|
1529
|
+
_context19.next = 35;
|
|
1525
1530
|
break;
|
|
1526
1531
|
}
|
|
1527
1532
|
headers["Range"] = "bytes=".concat(bytesFinished, "-").concat(bytesFinished + chunkSize - 1);
|
|
1528
|
-
|
|
1533
|
+
_context19.next = 11;
|
|
1529
1534
|
return this.HttpClient.Request({
|
|
1530
1535
|
path: downloadPath,
|
|
1531
1536
|
headers: headers,
|
|
1532
1537
|
method: "GET"
|
|
1533
1538
|
});
|
|
1534
1539
|
case 11:
|
|
1535
|
-
response =
|
|
1540
|
+
response = _context19.sent;
|
|
1536
1541
|
bytesFinished = Math.min(bytesFinished + chunkSize, bytesTotal);
|
|
1537
1542
|
if (!chunked) {
|
|
1538
|
-
|
|
1543
|
+
_context19.next = 24;
|
|
1539
1544
|
break;
|
|
1540
1545
|
}
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1546
|
+
_context19.t0 = callback;
|
|
1547
|
+
_context19.t1 = bytesFinished;
|
|
1548
|
+
_context19.t2 = bytesTotal;
|
|
1549
|
+
_context19.next = 19;
|
|
1545
1550
|
return this.utils.ResponseToFormat(format, response);
|
|
1546
1551
|
case 19:
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
bytesFinished:
|
|
1550
|
-
bytesTotal:
|
|
1551
|
-
chunk:
|
|
1552
|
+
_context19.t3 = _context19.sent;
|
|
1553
|
+
_context19.t4 = {
|
|
1554
|
+
bytesFinished: _context19.t1,
|
|
1555
|
+
bytesTotal: _context19.t2,
|
|
1556
|
+
chunk: _context19.t3
|
|
1552
1557
|
};
|
|
1553
|
-
(0,
|
|
1554
|
-
|
|
1558
|
+
(0, _context19.t0)(_context19.t4);
|
|
1559
|
+
_context19.next = 32;
|
|
1555
1560
|
break;
|
|
1556
1561
|
case 24:
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1562
|
+
_context19.t5 = outputChunks;
|
|
1563
|
+
_context19.t6 = Buffer;
|
|
1564
|
+
_context19.next = 28;
|
|
1560
1565
|
return response.arrayBuffer();
|
|
1561
1566
|
case 28:
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1567
|
+
_context19.t7 = _context19.sent;
|
|
1568
|
+
_context19.t8 = _context19.t6.from.call(_context19.t6, _context19.t7);
|
|
1569
|
+
_context19.t5.push.call(_context19.t5, _context19.t8);
|
|
1565
1570
|
if (callback) {
|
|
1566
1571
|
callback({
|
|
1567
1572
|
bytesFinished: bytesFinished,
|
|
@@ -1570,20 +1575,20 @@ exports.Download = /*#__PURE__*/function () {
|
|
|
1570
1575
|
}
|
|
1571
1576
|
case 32:
|
|
1572
1577
|
i++;
|
|
1573
|
-
|
|
1578
|
+
_context19.next = 7;
|
|
1574
1579
|
break;
|
|
1575
1580
|
case 35:
|
|
1576
1581
|
if (chunked) {
|
|
1577
|
-
|
|
1582
|
+
_context19.next = 39;
|
|
1578
1583
|
break;
|
|
1579
1584
|
}
|
|
1580
|
-
|
|
1585
|
+
_context19.next = 38;
|
|
1581
1586
|
return this.utils.ResponseToFormat(format, new Response(Buffer.concat(outputChunks)));
|
|
1582
1587
|
case 38:
|
|
1583
|
-
return
|
|
1588
|
+
return _context19.abrupt("return", _context19.sent);
|
|
1584
1589
|
case 39:
|
|
1585
1590
|
case "end":
|
|
1586
|
-
return
|
|
1591
|
+
return _context19.stop();
|
|
1587
1592
|
}
|
|
1588
1593
|
}, _callee18, this);
|
|
1589
1594
|
}));
|
|
@@ -1595,12 +1600,12 @@ exports.DownloadEncrypted = /*#__PURE__*/function () {
|
|
|
1595
1600
|
var _ref35 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20(_ref34) {
|
|
1596
1601
|
var _this2 = this;
|
|
1597
1602
|
var conk, downloadPath, bytesTotal, headers, callback, _ref34$format, format, _ref34$chunked, chunked, isReencryption, chunkSize, bytesFinished, outputChunks, stream, totalChunks, i, response;
|
|
1598
|
-
return _regeneratorRuntime.wrap(function _callee20$(
|
|
1599
|
-
while (1) switch (
|
|
1603
|
+
return _regeneratorRuntime.wrap(function _callee20$(_context21) {
|
|
1604
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1600
1605
|
case 0:
|
|
1601
1606
|
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;
|
|
1602
1607
|
if (!(chunked && !callback)) {
|
|
1603
|
-
|
|
1608
|
+
_context21.next = 3;
|
|
1604
1609
|
break;
|
|
1605
1610
|
}
|
|
1606
1611
|
throw Error("No callback specified for chunked download");
|
|
@@ -1611,44 +1616,44 @@ exports.DownloadEncrypted = /*#__PURE__*/function () {
|
|
|
1611
1616
|
bytesFinished = 0;
|
|
1612
1617
|
format = format.toLowerCase();
|
|
1613
1618
|
outputChunks = []; // Set up decryption stream
|
|
1614
|
-
|
|
1619
|
+
_context21.next = 10;
|
|
1615
1620
|
return this.Crypto.OpenDecryptionStream(conk);
|
|
1616
1621
|
case 10:
|
|
1617
|
-
stream =
|
|
1622
|
+
stream = _context21.sent;
|
|
1618
1623
|
stream.on("data", /*#__PURE__*/function () {
|
|
1619
1624
|
var _ref36 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19(chunk) {
|
|
1620
1625
|
var arrayBuffer;
|
|
1621
|
-
return _regeneratorRuntime.wrap(function _callee19$(
|
|
1622
|
-
while (1) switch (
|
|
1626
|
+
return _regeneratorRuntime.wrap(function _callee19$(_context20) {
|
|
1627
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1623
1628
|
case 0:
|
|
1624
1629
|
if (!chunked) {
|
|
1625
|
-
|
|
1630
|
+
_context20.next = 13;
|
|
1626
1631
|
break;
|
|
1627
1632
|
}
|
|
1628
1633
|
if (!(format !== "buffer")) {
|
|
1629
|
-
|
|
1634
|
+
_context20.next = 10;
|
|
1630
1635
|
break;
|
|
1631
1636
|
}
|
|
1632
1637
|
arrayBuffer = chunk.buffer.slice(chunk.byteOffset, chunk.byteOffset + chunk.byteLength);
|
|
1633
1638
|
if (!(format === "arraybuffer")) {
|
|
1634
|
-
|
|
1639
|
+
_context20.next = 7;
|
|
1635
1640
|
break;
|
|
1636
1641
|
}
|
|
1637
1642
|
chunk = arrayBuffer;
|
|
1638
|
-
|
|
1643
|
+
_context20.next = 10;
|
|
1639
1644
|
break;
|
|
1640
1645
|
case 7:
|
|
1641
|
-
|
|
1646
|
+
_context20.next = 9;
|
|
1642
1647
|
return _this2.utils.ResponseToFormat(format, new Response(arrayBuffer));
|
|
1643
1648
|
case 9:
|
|
1644
|
-
chunk =
|
|
1649
|
+
chunk = _context20.sent;
|
|
1645
1650
|
case 10:
|
|
1646
1651
|
callback({
|
|
1647
1652
|
bytesFinished: bytesFinished,
|
|
1648
1653
|
bytesTotal: bytesTotal,
|
|
1649
1654
|
chunk: chunk
|
|
1650
1655
|
});
|
|
1651
|
-
|
|
1656
|
+
_context20.next = 15;
|
|
1652
1657
|
break;
|
|
1653
1658
|
case 13:
|
|
1654
1659
|
if (callback) {
|
|
@@ -1660,7 +1665,7 @@ exports.DownloadEncrypted = /*#__PURE__*/function () {
|
|
|
1660
1665
|
outputChunks.push(chunk);
|
|
1661
1666
|
case 15:
|
|
1662
1667
|
case "end":
|
|
1663
|
-
return
|
|
1668
|
+
return _context20.stop();
|
|
1664
1669
|
}
|
|
1665
1670
|
}, _callee19);
|
|
1666
1671
|
}));
|
|
@@ -1672,35 +1677,35 @@ exports.DownloadEncrypted = /*#__PURE__*/function () {
|
|
|
1672
1677
|
i = 0;
|
|
1673
1678
|
case 14:
|
|
1674
1679
|
if (!(i < totalChunks)) {
|
|
1675
|
-
|
|
1680
|
+
_context21.next = 30;
|
|
1676
1681
|
break;
|
|
1677
1682
|
}
|
|
1678
1683
|
headers["Range"] = "bytes=".concat(bytesFinished, "-").concat(bytesFinished + chunkSize - 1);
|
|
1679
|
-
|
|
1684
|
+
_context21.next = 18;
|
|
1680
1685
|
return this.HttpClient.Request({
|
|
1681
1686
|
headers: headers,
|
|
1682
1687
|
method: "GET",
|
|
1683
1688
|
path: downloadPath
|
|
1684
1689
|
});
|
|
1685
1690
|
case 18:
|
|
1686
|
-
response =
|
|
1691
|
+
response = _context21.sent;
|
|
1687
1692
|
bytesFinished = Math.min(bytesFinished + chunkSize, bytesTotal);
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1693
|
+
_context21.t0 = stream;
|
|
1694
|
+
_context21.t1 = Uint8Array;
|
|
1695
|
+
_context21.next = 24;
|
|
1691
1696
|
return response.arrayBuffer();
|
|
1692
1697
|
case 24:
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1698
|
+
_context21.t2 = _context21.sent;
|
|
1699
|
+
_context21.t3 = new _context21.t1(_context21.t2);
|
|
1700
|
+
_context21.t0.write.call(_context21.t0, _context21.t3);
|
|
1696
1701
|
case 27:
|
|
1697
1702
|
i++;
|
|
1698
|
-
|
|
1703
|
+
_context21.next = 14;
|
|
1699
1704
|
break;
|
|
1700
1705
|
case 30:
|
|
1701
1706
|
// Wait for decryption to complete
|
|
1702
1707
|
stream.end();
|
|
1703
|
-
|
|
1708
|
+
_context21.next = 33;
|
|
1704
1709
|
return new Promise(function (resolve) {
|
|
1705
1710
|
return stream.on("finish", function () {
|
|
1706
1711
|
resolve();
|
|
@@ -1708,16 +1713,16 @@ exports.DownloadEncrypted = /*#__PURE__*/function () {
|
|
|
1708
1713
|
});
|
|
1709
1714
|
case 33:
|
|
1710
1715
|
if (chunked) {
|
|
1711
|
-
|
|
1716
|
+
_context21.next = 37;
|
|
1712
1717
|
break;
|
|
1713
1718
|
}
|
|
1714
|
-
|
|
1719
|
+
_context21.next = 36;
|
|
1715
1720
|
return this.utils.ResponseToFormat(format, new Response(Buffer.concat(outputChunks)));
|
|
1716
1721
|
case 36:
|
|
1717
|
-
return
|
|
1722
|
+
return _context21.abrupt("return", _context21.sent);
|
|
1718
1723
|
case 37:
|
|
1719
1724
|
case "end":
|
|
1720
|
-
return
|
|
1725
|
+
return _context21.stop();
|
|
1721
1726
|
}
|
|
1722
1727
|
}, _callee20, this);
|
|
1723
1728
|
}));
|
|
@@ -1742,8 +1747,8 @@ exports.DownloadEncrypted = /*#__PURE__*/function () {
|
|
|
1742
1747
|
exports.CreatePart = /*#__PURE__*/function () {
|
|
1743
1748
|
var _ref38 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(_ref37) {
|
|
1744
1749
|
var libraryId, objectId, writeToken, encryption, path, openResponse;
|
|
1745
|
-
return _regeneratorRuntime.wrap(function _callee21$(
|
|
1746
|
-
while (1) switch (
|
|
1750
|
+
return _regeneratorRuntime.wrap(function _callee21$(_context22) {
|
|
1751
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1747
1752
|
case 0:
|
|
1748
1753
|
libraryId = _ref37.libraryId, objectId = _ref37.objectId, writeToken = _ref37.writeToken, encryption = _ref37.encryption;
|
|
1749
1754
|
ValidateParameters({
|
|
@@ -1752,9 +1757,9 @@ exports.CreatePart = /*#__PURE__*/function () {
|
|
|
1752
1757
|
});
|
|
1753
1758
|
ValidateWriteToken(writeToken);
|
|
1754
1759
|
path = UrlJoin("q", writeToken, "parts");
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1760
|
+
_context22.t0 = this.utils;
|
|
1761
|
+
_context22.t1 = this.HttpClient;
|
|
1762
|
+
_context22.next = 8;
|
|
1758
1763
|
return this.authClient.AuthorizationHeader({
|
|
1759
1764
|
libraryId: libraryId,
|
|
1760
1765
|
objectId: objectId,
|
|
@@ -1762,25 +1767,25 @@ exports.CreatePart = /*#__PURE__*/function () {
|
|
|
1762
1767
|
encryption: encryption
|
|
1763
1768
|
});
|
|
1764
1769
|
case 8:
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
headers:
|
|
1770
|
+
_context22.t2 = _context22.sent;
|
|
1771
|
+
_context22.t3 = path;
|
|
1772
|
+
_context22.t4 = {
|
|
1773
|
+
headers: _context22.t2,
|
|
1769
1774
|
method: "POST",
|
|
1770
|
-
path:
|
|
1775
|
+
path: _context22.t3,
|
|
1771
1776
|
bodyType: "BINARY",
|
|
1772
1777
|
body: "",
|
|
1773
|
-
|
|
1778
|
+
allowFailover: false
|
|
1774
1779
|
};
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
return
|
|
1780
|
+
_context22.t5 = _context22.t1.Request.call(_context22.t1, _context22.t4);
|
|
1781
|
+
_context22.next = 14;
|
|
1782
|
+
return _context22.t0.ResponseToJson.call(_context22.t0, _context22.t5);
|
|
1778
1783
|
case 14:
|
|
1779
|
-
openResponse =
|
|
1780
|
-
return
|
|
1784
|
+
openResponse = _context22.sent;
|
|
1785
|
+
return _context22.abrupt("return", openResponse.part.write_token);
|
|
1781
1786
|
case 16:
|
|
1782
1787
|
case "end":
|
|
1783
|
-
return
|
|
1788
|
+
return _context22.stop();
|
|
1784
1789
|
}
|
|
1785
1790
|
}, _callee21, this);
|
|
1786
1791
|
}));
|
|
@@ -1807,8 +1812,8 @@ exports.CreatePart = /*#__PURE__*/function () {
|
|
|
1807
1812
|
exports.UploadPartChunk = /*#__PURE__*/function () {
|
|
1808
1813
|
var _ref40 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee22(_ref39) {
|
|
1809
1814
|
var libraryId, objectId, writeToken, partWriteToken, chunk, encryption, conk, path;
|
|
1810
|
-
return _regeneratorRuntime.wrap(function _callee22$(
|
|
1811
|
-
while (1) switch (
|
|
1815
|
+
return _regeneratorRuntime.wrap(function _callee22$(_context23) {
|
|
1816
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1812
1817
|
case 0:
|
|
1813
1818
|
libraryId = _ref39.libraryId, objectId = _ref39.objectId, writeToken = _ref39.writeToken, partWriteToken = _ref39.partWriteToken, chunk = _ref39.chunk, encryption = _ref39.encryption;
|
|
1814
1819
|
ValidateParameters({
|
|
@@ -1817,26 +1822,26 @@ exports.UploadPartChunk = /*#__PURE__*/function () {
|
|
|
1817
1822
|
});
|
|
1818
1823
|
ValidateWriteToken(writeToken);
|
|
1819
1824
|
if (!(encryption && encryption !== "none")) {
|
|
1820
|
-
|
|
1825
|
+
_context23.next = 10;
|
|
1821
1826
|
break;
|
|
1822
1827
|
}
|
|
1823
|
-
|
|
1828
|
+
_context23.next = 6;
|
|
1824
1829
|
return this.EncryptionConk({
|
|
1825
1830
|
libraryId: libraryId,
|
|
1826
1831
|
objectId: objectId,
|
|
1827
1832
|
writeToken: writeToken
|
|
1828
1833
|
});
|
|
1829
1834
|
case 6:
|
|
1830
|
-
conk =
|
|
1831
|
-
|
|
1835
|
+
conk = _context23.sent;
|
|
1836
|
+
_context23.next = 9;
|
|
1832
1837
|
return this.Crypto.Encrypt(conk, chunk);
|
|
1833
1838
|
case 9:
|
|
1834
|
-
chunk =
|
|
1839
|
+
chunk = _context23.sent;
|
|
1835
1840
|
case 10:
|
|
1836
1841
|
path = UrlJoin("q", writeToken, "parts");
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1842
|
+
_context23.t0 = this.utils;
|
|
1843
|
+
_context23.t1 = this.HttpClient;
|
|
1844
|
+
_context23.next = 15;
|
|
1840
1845
|
return this.authClient.AuthorizationHeader({
|
|
1841
1846
|
libraryId: libraryId,
|
|
1842
1847
|
objectId: objectId,
|
|
@@ -1844,23 +1849,23 @@ exports.UploadPartChunk = /*#__PURE__*/function () {
|
|
|
1844
1849
|
encryption: encryption
|
|
1845
1850
|
});
|
|
1846
1851
|
case 15:
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
headers:
|
|
1852
|
+
_context23.t2 = _context23.sent;
|
|
1853
|
+
_context23.t3 = UrlJoin(path, partWriteToken);
|
|
1854
|
+
_context23.t4 = chunk;
|
|
1855
|
+
_context23.t5 = {
|
|
1856
|
+
headers: _context23.t2,
|
|
1852
1857
|
method: "POST",
|
|
1853
|
-
path:
|
|
1854
|
-
body:
|
|
1858
|
+
path: _context23.t3,
|
|
1859
|
+
body: _context23.t4,
|
|
1855
1860
|
bodyType: "BINARY",
|
|
1856
|
-
|
|
1861
|
+
allowFailover: false
|
|
1857
1862
|
};
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
return
|
|
1863
|
+
_context23.t6 = _context23.t1.Request.call(_context23.t1, _context23.t5);
|
|
1864
|
+
_context23.next = 22;
|
|
1865
|
+
return _context23.t0.ResponseToJson.call(_context23.t0, _context23.t6);
|
|
1861
1866
|
case 22:
|
|
1862
1867
|
case "end":
|
|
1863
|
-
return
|
|
1868
|
+
return _context23.stop();
|
|
1864
1869
|
}
|
|
1865
1870
|
}, _callee22, this);
|
|
1866
1871
|
}));
|
|
@@ -1886,8 +1891,8 @@ exports.UploadPartChunk = /*#__PURE__*/function () {
|
|
|
1886
1891
|
exports.FinalizePart = /*#__PURE__*/function () {
|
|
1887
1892
|
var _ref42 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee23(_ref41) {
|
|
1888
1893
|
var libraryId, objectId, writeToken, partWriteToken, encryption, path;
|
|
1889
|
-
return _regeneratorRuntime.wrap(function _callee23$(
|
|
1890
|
-
while (1) switch (
|
|
1894
|
+
return _regeneratorRuntime.wrap(function _callee23$(_context24) {
|
|
1895
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
1891
1896
|
case 0:
|
|
1892
1897
|
libraryId = _ref41.libraryId, objectId = _ref41.objectId, writeToken = _ref41.writeToken, partWriteToken = _ref41.partWriteToken, encryption = _ref41.encryption;
|
|
1893
1898
|
ValidateParameters({
|
|
@@ -1896,9 +1901,9 @@ exports.FinalizePart = /*#__PURE__*/function () {
|
|
|
1896
1901
|
});
|
|
1897
1902
|
ValidateWriteToken(writeToken);
|
|
1898
1903
|
path = UrlJoin("q", writeToken, "parts");
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1904
|
+
_context24.t0 = this.utils;
|
|
1905
|
+
_context24.t1 = this.HttpClient;
|
|
1906
|
+
_context24.next = 8;
|
|
1902
1907
|
return this.authClient.AuthorizationHeader({
|
|
1903
1908
|
libraryId: libraryId,
|
|
1904
1909
|
objectId: objectId,
|
|
@@ -1906,27 +1911,27 @@ exports.FinalizePart = /*#__PURE__*/function () {
|
|
|
1906
1911
|
encryption: encryption
|
|
1907
1912
|
});
|
|
1908
1913
|
case 8:
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
headers:
|
|
1914
|
+
_context24.t2 = _context24.sent;
|
|
1915
|
+
_context24.t3 = UrlJoin(path, partWriteToken);
|
|
1916
|
+
_context24.t4 = {
|
|
1917
|
+
headers: _context24.t2,
|
|
1913
1918
|
method: "POST",
|
|
1914
|
-
path:
|
|
1919
|
+
path: _context24.t3,
|
|
1915
1920
|
bodyType: "BINARY",
|
|
1916
1921
|
body: "",
|
|
1917
|
-
|
|
1922
|
+
allowFailover: false
|
|
1918
1923
|
};
|
|
1919
|
-
|
|
1920
|
-
return
|
|
1924
|
+
_context24.next = 13;
|
|
1925
|
+
return _context24.t1.Request.call(_context24.t1, _context24.t4);
|
|
1921
1926
|
case 13:
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
return
|
|
1927
|
+
_context24.t5 = _context24.sent;
|
|
1928
|
+
_context24.next = 16;
|
|
1929
|
+
return _context24.t0.ResponseToJson.call(_context24.t0, _context24.t5);
|
|
1925
1930
|
case 16:
|
|
1926
|
-
return
|
|
1931
|
+
return _context24.abrupt("return", _context24.sent);
|
|
1927
1932
|
case 17:
|
|
1928
1933
|
case "end":
|
|
1929
|
-
return
|
|
1934
|
+
return _context24.stop();
|
|
1930
1935
|
}
|
|
1931
1936
|
}, _callee23, this);
|
|
1932
1937
|
}));
|
|
@@ -1959,8 +1964,8 @@ exports.FinalizePart = /*#__PURE__*/function () {
|
|
|
1959
1964
|
exports.UploadPart = /*#__PURE__*/function () {
|
|
1960
1965
|
var _ref44 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24(_ref43) {
|
|
1961
1966
|
var libraryId, objectId, writeToken, data, _ref43$encryption, encryption, _ref43$chunkSize, chunkSize, callback, partWriteToken, size, i, chunk;
|
|
1962
|
-
return _regeneratorRuntime.wrap(function _callee24$(
|
|
1963
|
-
while (1) switch (
|
|
1967
|
+
return _regeneratorRuntime.wrap(function _callee24$(_context25) {
|
|
1968
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
1964
1969
|
case 0:
|
|
1965
1970
|
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;
|
|
1966
1971
|
ValidateParameters({
|
|
@@ -1968,7 +1973,7 @@ exports.UploadPart = /*#__PURE__*/function () {
|
|
|
1968
1973
|
objectId: objectId
|
|
1969
1974
|
});
|
|
1970
1975
|
ValidateWriteToken(writeToken);
|
|
1971
|
-
|
|
1976
|
+
_context25.next = 5;
|
|
1972
1977
|
return this.CreatePart({
|
|
1973
1978
|
libraryId: libraryId,
|
|
1974
1979
|
objectId: objectId,
|
|
@@ -1976,7 +1981,7 @@ exports.UploadPart = /*#__PURE__*/function () {
|
|
|
1976
1981
|
encryption: encryption
|
|
1977
1982
|
});
|
|
1978
1983
|
case 5:
|
|
1979
|
-
partWriteToken =
|
|
1984
|
+
partWriteToken = _context25.sent;
|
|
1980
1985
|
size = data.length || data.byteLength || data.size;
|
|
1981
1986
|
if (callback) {
|
|
1982
1987
|
callback({
|
|
@@ -1987,11 +1992,11 @@ exports.UploadPart = /*#__PURE__*/function () {
|
|
|
1987
1992
|
i = 0;
|
|
1988
1993
|
case 9:
|
|
1989
1994
|
if (!(i < size)) {
|
|
1990
|
-
|
|
1995
|
+
_context25.next = 17;
|
|
1991
1996
|
break;
|
|
1992
1997
|
}
|
|
1993
1998
|
chunk = data.slice(i, i + chunkSize);
|
|
1994
|
-
|
|
1999
|
+
_context25.next = 13;
|
|
1995
2000
|
return this.UploadPartChunk({
|
|
1996
2001
|
libraryId: libraryId,
|
|
1997
2002
|
objectId: objectId,
|
|
@@ -2009,10 +2014,10 @@ exports.UploadPart = /*#__PURE__*/function () {
|
|
|
2009
2014
|
}
|
|
2010
2015
|
case 14:
|
|
2011
2016
|
i += chunkSize;
|
|
2012
|
-
|
|
2017
|
+
_context25.next = 9;
|
|
2013
2018
|
break;
|
|
2014
2019
|
case 17:
|
|
2015
|
-
|
|
2020
|
+
_context25.next = 19;
|
|
2016
2021
|
return this.FinalizePart({
|
|
2017
2022
|
libraryId: libraryId,
|
|
2018
2023
|
objectId: objectId,
|
|
@@ -2021,10 +2026,10 @@ exports.UploadPart = /*#__PURE__*/function () {
|
|
|
2021
2026
|
encryption: encryption
|
|
2022
2027
|
});
|
|
2023
2028
|
case 19:
|
|
2024
|
-
return
|
|
2029
|
+
return _context25.abrupt("return", _context25.sent);
|
|
2025
2030
|
case 20:
|
|
2026
2031
|
case "end":
|
|
2027
|
-
return
|
|
2032
|
+
return _context25.stop();
|
|
2028
2033
|
}
|
|
2029
2034
|
}, _callee24, this);
|
|
2030
2035
|
}));
|
|
@@ -2047,8 +2052,8 @@ exports.UploadPart = /*#__PURE__*/function () {
|
|
|
2047
2052
|
exports.DeletePart = /*#__PURE__*/function () {
|
|
2048
2053
|
var _ref46 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(_ref45) {
|
|
2049
2054
|
var libraryId, objectId, writeToken, partHash, path;
|
|
2050
|
-
return _regeneratorRuntime.wrap(function _callee25$(
|
|
2051
|
-
while (1) switch (
|
|
2055
|
+
return _regeneratorRuntime.wrap(function _callee25$(_context26) {
|
|
2056
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
2052
2057
|
case 0:
|
|
2053
2058
|
libraryId = _ref45.libraryId, objectId = _ref45.objectId, writeToken = _ref45.writeToken, partHash = _ref45.partHash;
|
|
2054
2059
|
ValidateParameters({
|
|
@@ -2058,27 +2063,27 @@ exports.DeletePart = /*#__PURE__*/function () {
|
|
|
2058
2063
|
ValidateWriteToken(writeToken);
|
|
2059
2064
|
ValidatePartHash(partHash);
|
|
2060
2065
|
path = UrlJoin("q", writeToken, "parts", partHash);
|
|
2061
|
-
|
|
2062
|
-
|
|
2066
|
+
_context26.t0 = this.HttpClient;
|
|
2067
|
+
_context26.next = 8;
|
|
2063
2068
|
return this.authClient.AuthorizationHeader({
|
|
2064
2069
|
libraryId: libraryId,
|
|
2065
2070
|
objectId: objectId,
|
|
2066
2071
|
update: true
|
|
2067
2072
|
});
|
|
2068
2073
|
case 8:
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
headers:
|
|
2074
|
+
_context26.t1 = _context26.sent;
|
|
2075
|
+
_context26.t2 = path;
|
|
2076
|
+
_context26.t3 = {
|
|
2077
|
+
headers: _context26.t1,
|
|
2073
2078
|
method: "DELETE",
|
|
2074
|
-
path:
|
|
2075
|
-
|
|
2079
|
+
path: _context26.t2,
|
|
2080
|
+
allowFailover: false
|
|
2076
2081
|
};
|
|
2077
|
-
|
|
2078
|
-
return
|
|
2082
|
+
_context26.next = 13;
|
|
2083
|
+
return _context26.t0.Request.call(_context26.t0, _context26.t3);
|
|
2079
2084
|
case 13:
|
|
2080
2085
|
case "end":
|
|
2081
|
-
return
|
|
2086
|
+
return _context26.stop();
|
|
2082
2087
|
}
|
|
2083
2088
|
}, _callee25, this);
|
|
2084
2089
|
}));
|