@eluvio/elv-client-js 4.0.21 → 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/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 +475 -476
- 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 +78 -89
- 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,11 +1109,11 @@ 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,
|
|
@@ -1122,12 +1121,12 @@ exports.DownloadFile = /*#__PURE__*/function () {
|
|
|
1122
1121
|
encryption: encryption
|
|
1123
1122
|
});
|
|
1124
1123
|
case 12:
|
|
1125
|
-
headers =
|
|
1124
|
+
headers = _context15.sent;
|
|
1126
1125
|
headers.Accept = "*/*";
|
|
1127
1126
|
|
|
1128
1127
|
// If not owner, indicate re-encryption
|
|
1129
1128
|
ownerCapKey = "eluv.caps.iusr".concat(this.utils.AddressToHash(this.signer.address));
|
|
1130
|
-
|
|
1129
|
+
_context15.next = 17;
|
|
1131
1130
|
return this.ContentObjectMetadata({
|
|
1132
1131
|
libraryId: libraryId,
|
|
1133
1132
|
objectId: objectId,
|
|
@@ -1135,31 +1134,31 @@ exports.DownloadFile = /*#__PURE__*/function () {
|
|
|
1135
1134
|
metadataSubtree: ownerCapKey
|
|
1136
1135
|
});
|
|
1137
1136
|
case 17:
|
|
1138
|
-
ownerCap =
|
|
1139
|
-
|
|
1140
|
-
if (!
|
|
1141
|
-
|
|
1137
|
+
ownerCap = _context15.sent;
|
|
1138
|
+
_context15.t1 = encrypted;
|
|
1139
|
+
if (!_context15.t1) {
|
|
1140
|
+
_context15.next = 26;
|
|
1142
1141
|
break;
|
|
1143
1142
|
}
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1143
|
+
_context15.t2 = this.utils;
|
|
1144
|
+
_context15.t3 = this.signer.address;
|
|
1145
|
+
_context15.next = 24;
|
|
1147
1146
|
return this.ContentObjectOwner({
|
|
1148
1147
|
objectId: objectId
|
|
1149
1148
|
});
|
|
1150
1149
|
case 24:
|
|
1151
|
-
|
|
1152
|
-
|
|
1150
|
+
_context15.t4 = _context15.sent;
|
|
1151
|
+
_context15.t1 = !_context15.t2.EqualAddress.call(_context15.t2, _context15.t3, _context15.t4);
|
|
1153
1152
|
case 26:
|
|
1154
|
-
|
|
1155
|
-
if (!
|
|
1156
|
-
|
|
1153
|
+
_context15.t0 = _context15.t1;
|
|
1154
|
+
if (!_context15.t0) {
|
|
1155
|
+
_context15.next = 29;
|
|
1157
1156
|
break;
|
|
1158
1157
|
}
|
|
1159
|
-
|
|
1158
|
+
_context15.t0 = !ownerCap;
|
|
1160
1159
|
case 29:
|
|
1161
|
-
if (!
|
|
1162
|
-
|
|
1160
|
+
if (!_context15.t0) {
|
|
1161
|
+
_context15.next = 31;
|
|
1163
1162
|
break;
|
|
1164
1163
|
}
|
|
1165
1164
|
headers["X-Content-Fabric-Decryption-Mode"] = "reencrypt";
|
|
@@ -1172,11 +1171,11 @@ exports.DownloadFile = /*#__PURE__*/function () {
|
|
|
1172
1171
|
}
|
|
1173
1172
|
bytesTotal = fileInfo["."].size;
|
|
1174
1173
|
if (!(encrypted && clientSideDecryption)) {
|
|
1175
|
-
|
|
1174
|
+
_context15.next = 51;
|
|
1176
1175
|
break;
|
|
1177
1176
|
}
|
|
1178
|
-
|
|
1179
|
-
|
|
1177
|
+
_context15.t5 = this;
|
|
1178
|
+
_context15.next = 37;
|
|
1180
1179
|
return this.EncryptionConk({
|
|
1181
1180
|
libraryId: libraryId,
|
|
1182
1181
|
objectId: objectId,
|
|
@@ -1184,34 +1183,34 @@ exports.DownloadFile = /*#__PURE__*/function () {
|
|
|
1184
1183
|
download: true
|
|
1185
1184
|
});
|
|
1186
1185
|
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:
|
|
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
|
|
1204
1203
|
};
|
|
1205
|
-
|
|
1206
|
-
return
|
|
1204
|
+
_context15.next = 48;
|
|
1205
|
+
return _context15.t5.DownloadEncrypted.call(_context15.t5, _context15.t14);
|
|
1207
1206
|
case 48:
|
|
1208
|
-
return
|
|
1207
|
+
return _context15.abrupt("return", _context15.sent);
|
|
1209
1208
|
case 51:
|
|
1210
1209
|
if (!chunkSize) {
|
|
1211
1210
|
chunkSize = 10000000;
|
|
1212
1211
|
}
|
|
1213
|
-
|
|
1214
|
-
|
|
1212
|
+
_context15.prev = 52;
|
|
1213
|
+
_context15.next = 55;
|
|
1215
1214
|
return this.Download({
|
|
1216
1215
|
downloadPath: path,
|
|
1217
1216
|
bytesTotal: bytesTotal,
|
|
@@ -1222,22 +1221,22 @@ exports.DownloadFile = /*#__PURE__*/function () {
|
|
|
1222
1221
|
chunkSize: chunkSize
|
|
1223
1222
|
});
|
|
1224
1223
|
case 55:
|
|
1225
|
-
return
|
|
1224
|
+
return _context15.abrupt("return", _context15.sent);
|
|
1226
1225
|
case 58:
|
|
1227
|
-
|
|
1228
|
-
|
|
1226
|
+
_context15.prev = 58;
|
|
1227
|
+
_context15.t15 = _context15["catch"](52);
|
|
1229
1228
|
if (!(encrypted && !clientSideDecryption)) {
|
|
1230
|
-
|
|
1229
|
+
_context15.next = 62;
|
|
1231
1230
|
break;
|
|
1232
1231
|
}
|
|
1233
|
-
return
|
|
1232
|
+
return _context15.abrupt("return", this.DownloadFile(_objectSpread(_objectSpread({}, _args15[0]), {}, {
|
|
1234
1233
|
clientSideDecryption: true
|
|
1235
1234
|
})));
|
|
1236
1235
|
case 62:
|
|
1237
|
-
throw
|
|
1236
|
+
throw _context15.t15;
|
|
1238
1237
|
case 63:
|
|
1239
1238
|
case "end":
|
|
1240
|
-
return
|
|
1239
|
+
return _context15.stop();
|
|
1241
1240
|
}
|
|
1242
1241
|
}, _callee14, this, [[52, 58]]);
|
|
1243
1242
|
}));
|
|
@@ -1263,8 +1262,8 @@ exports.DownloadFile = /*#__PURE__*/function () {
|
|
|
1263
1262
|
exports.ContentParts = /*#__PURE__*/function () {
|
|
1264
1263
|
var _ref27 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(_ref26) {
|
|
1265
1264
|
var libraryId, objectId, versionHash, path, response;
|
|
1266
|
-
return _regeneratorRuntime.wrap(function _callee15$(
|
|
1267
|
-
while (1) switch (
|
|
1265
|
+
return _regeneratorRuntime.wrap(function _callee15$(_context16) {
|
|
1266
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1268
1267
|
case 0:
|
|
1269
1268
|
libraryId = _ref26.libraryId, objectId = _ref26.objectId, versionHash = _ref26.versionHash;
|
|
1270
1269
|
ValidateParameters({
|
|
@@ -1277,31 +1276,31 @@ exports.ContentParts = /*#__PURE__*/function () {
|
|
|
1277
1276
|
objectId = this.utils.DecodeVersionHash(versionHash).objectId;
|
|
1278
1277
|
}
|
|
1279
1278
|
path = UrlJoin("q", versionHash || objectId, "parts");
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1279
|
+
_context16.t0 = this.utils;
|
|
1280
|
+
_context16.t1 = this.HttpClient;
|
|
1281
|
+
_context16.next = 9;
|
|
1283
1282
|
return this.authClient.AuthorizationHeader({
|
|
1284
1283
|
libraryId: libraryId,
|
|
1285
1284
|
objectId: objectId,
|
|
1286
1285
|
versionHash: versionHash
|
|
1287
1286
|
});
|
|
1288
1287
|
case 9:
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
headers:
|
|
1288
|
+
_context16.t2 = _context16.sent;
|
|
1289
|
+
_context16.t3 = path;
|
|
1290
|
+
_context16.t4 = {
|
|
1291
|
+
headers: _context16.t2,
|
|
1293
1292
|
method: "GET",
|
|
1294
|
-
path:
|
|
1293
|
+
path: _context16.t3
|
|
1295
1294
|
};
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
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);
|
|
1299
1298
|
case 15:
|
|
1300
|
-
response =
|
|
1301
|
-
return
|
|
1299
|
+
response = _context16.sent;
|
|
1300
|
+
return _context16.abrupt("return", response.parts);
|
|
1302
1301
|
case 17:
|
|
1303
1302
|
case "end":
|
|
1304
|
-
return
|
|
1303
|
+
return _context16.stop();
|
|
1305
1304
|
}
|
|
1306
1305
|
}, _callee15, this);
|
|
1307
1306
|
}));
|
|
@@ -1326,8 +1325,8 @@ exports.ContentParts = /*#__PURE__*/function () {
|
|
|
1326
1325
|
exports.ContentPart = /*#__PURE__*/function () {
|
|
1327
1326
|
var _ref29 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(_ref28) {
|
|
1328
1327
|
var libraryId, objectId, versionHash, partHash, path;
|
|
1329
|
-
return _regeneratorRuntime.wrap(function _callee16$(
|
|
1330
|
-
while (1) switch (
|
|
1328
|
+
return _regeneratorRuntime.wrap(function _callee16$(_context17) {
|
|
1329
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1331
1330
|
case 0:
|
|
1332
1331
|
libraryId = _ref28.libraryId, objectId = _ref28.objectId, versionHash = _ref28.versionHash, partHash = _ref28.partHash;
|
|
1333
1332
|
ValidateParameters({
|
|
@@ -1341,30 +1340,30 @@ exports.ContentPart = /*#__PURE__*/function () {
|
|
|
1341
1340
|
objectId = this.utils.DecodeVersionHash(versionHash).objectId;
|
|
1342
1341
|
}
|
|
1343
1342
|
path = UrlJoin("q", versionHash || objectId, "parts", partHash);
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1343
|
+
_context17.t0 = this.utils;
|
|
1344
|
+
_context17.t1 = this.HttpClient;
|
|
1345
|
+
_context17.next = 10;
|
|
1347
1346
|
return this.authClient.AuthorizationHeader({
|
|
1348
1347
|
libraryId: libraryId,
|
|
1349
1348
|
objectId: objectId,
|
|
1350
1349
|
versionHash: versionHash
|
|
1351
1350
|
});
|
|
1352
1351
|
case 10:
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
headers:
|
|
1352
|
+
_context17.t2 = _context17.sent;
|
|
1353
|
+
_context17.t3 = path;
|
|
1354
|
+
_context17.t4 = {
|
|
1355
|
+
headers: _context17.t2,
|
|
1357
1356
|
method: "GET",
|
|
1358
|
-
path:
|
|
1357
|
+
path: _context17.t3
|
|
1359
1358
|
};
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
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);
|
|
1363
1362
|
case 16:
|
|
1364
|
-
return
|
|
1363
|
+
return _context17.abrupt("return", _context17.sent);
|
|
1365
1364
|
case 17:
|
|
1366
1365
|
case "end":
|
|
1367
|
-
return
|
|
1366
|
+
return _context17.stop();
|
|
1368
1367
|
}
|
|
1369
1368
|
}, _callee16, this);
|
|
1370
1369
|
}));
|
|
@@ -1400,8 +1399,8 @@ exports.ContentPart = /*#__PURE__*/function () {
|
|
|
1400
1399
|
exports.DownloadPart = /*#__PURE__*/function () {
|
|
1401
1400
|
var _ref31 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17(_ref30) {
|
|
1402
1401
|
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 (
|
|
1402
|
+
return _regeneratorRuntime.wrap(function _callee17$(_context18) {
|
|
1403
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1405
1404
|
case 0:
|
|
1406
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;
|
|
1407
1406
|
ValidateParameters({
|
|
@@ -1416,7 +1415,7 @@ exports.DownloadPart = /*#__PURE__*/function () {
|
|
|
1416
1415
|
encrypted = partHash.startsWith("hqpe");
|
|
1417
1416
|
encryption = encrypted ? "cgck" : undefined;
|
|
1418
1417
|
path = UrlJoin("q", writeToken || versionHash || objectId, "data", partHash);
|
|
1419
|
-
|
|
1418
|
+
_context18.next = 9;
|
|
1420
1419
|
return this.authClient.AuthorizationHeader({
|
|
1421
1420
|
libraryId: libraryId,
|
|
1422
1421
|
objectId: objectId,
|
|
@@ -1425,8 +1424,8 @@ exports.DownloadPart = /*#__PURE__*/function () {
|
|
|
1425
1424
|
makeAccessRequest: true
|
|
1426
1425
|
});
|
|
1427
1426
|
case 9:
|
|
1428
|
-
headers =
|
|
1429
|
-
|
|
1427
|
+
headers = _context18.sent;
|
|
1428
|
+
_context18.next = 12;
|
|
1430
1429
|
return this.ContentPart({
|
|
1431
1430
|
libraryId: libraryId,
|
|
1432
1431
|
objectId: objectId,
|
|
@@ -1434,55 +1433,55 @@ exports.DownloadPart = /*#__PURE__*/function () {
|
|
|
1434
1433
|
partHash: partHash
|
|
1435
1434
|
});
|
|
1436
1435
|
case 12:
|
|
1437
|
-
bytesTotal =
|
|
1436
|
+
bytesTotal = _context18.sent.part.size;
|
|
1438
1437
|
if (!encrypted) {
|
|
1439
|
-
|
|
1438
|
+
_context18.next = 37;
|
|
1440
1439
|
break;
|
|
1441
1440
|
}
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1441
|
+
_context18.t0 = this.utils;
|
|
1442
|
+
_context18.t1 = this.signer.address;
|
|
1443
|
+
_context18.next = 18;
|
|
1445
1444
|
return this.ContentObjectOwner({
|
|
1446
1445
|
objectId: objectId
|
|
1447
1446
|
});
|
|
1448
1447
|
case 18:
|
|
1449
|
-
|
|
1450
|
-
if (
|
|
1451
|
-
|
|
1448
|
+
_context18.t2 = _context18.sent;
|
|
1449
|
+
if (_context18.t0.EqualAddress.call(_context18.t0, _context18.t1, _context18.t2)) {
|
|
1450
|
+
_context18.next = 21;
|
|
1452
1451
|
break;
|
|
1453
1452
|
}
|
|
1454
1453
|
headers["X-Content-Fabric-Decryption-Mode"] = "reencrypt";
|
|
1455
1454
|
case 21:
|
|
1456
|
-
|
|
1457
|
-
|
|
1455
|
+
_context18.t3 = this;
|
|
1456
|
+
_context18.next = 24;
|
|
1458
1457
|
return this.EncryptionConk({
|
|
1459
1458
|
libraryId: libraryId,
|
|
1460
1459
|
objectId: objectId,
|
|
1461
1460
|
download: true
|
|
1462
1461
|
});
|
|
1463
1462
|
case 24:
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
conk:
|
|
1473
|
-
downloadPath:
|
|
1474
|
-
bytesTotal:
|
|
1475
|
-
headers:
|
|
1476
|
-
callback:
|
|
1477
|
-
format:
|
|
1478
|
-
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
|
|
1479
1478
|
};
|
|
1480
|
-
|
|
1481
|
-
return
|
|
1479
|
+
_context18.next = 34;
|
|
1480
|
+
return _context18.t3.DownloadEncrypted.call(_context18.t3, _context18.t11);
|
|
1482
1481
|
case 34:
|
|
1483
|
-
return
|
|
1482
|
+
return _context18.abrupt("return", _context18.sent);
|
|
1484
1483
|
case 37:
|
|
1485
|
-
|
|
1484
|
+
_context18.next = 39;
|
|
1486
1485
|
return this.Download({
|
|
1487
1486
|
downloadPath: path,
|
|
1488
1487
|
bytesTotal: bytesTotal,
|
|
@@ -1493,10 +1492,10 @@ exports.DownloadPart = /*#__PURE__*/function () {
|
|
|
1493
1492
|
chunkSize: chunkSize
|
|
1494
1493
|
});
|
|
1495
1494
|
case 39:
|
|
1496
|
-
return
|
|
1495
|
+
return _context18.abrupt("return", _context18.sent);
|
|
1497
1496
|
case 40:
|
|
1498
1497
|
case "end":
|
|
1499
|
-
return
|
|
1498
|
+
return _context18.stop();
|
|
1500
1499
|
}
|
|
1501
1500
|
}, _callee17, this);
|
|
1502
1501
|
}));
|
|
@@ -1507,12 +1506,12 @@ exports.DownloadPart = /*#__PURE__*/function () {
|
|
|
1507
1506
|
exports.Download = /*#__PURE__*/function () {
|
|
1508
1507
|
var _ref33 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(_ref32) {
|
|
1509
1508
|
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 (
|
|
1509
|
+
return _regeneratorRuntime.wrap(function _callee18$(_context19) {
|
|
1510
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1512
1511
|
case 0:
|
|
1513
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;
|
|
1514
1513
|
if (!(chunked && !callback)) {
|
|
1515
|
-
|
|
1514
|
+
_context19.next = 3;
|
|
1516
1515
|
break;
|
|
1517
1516
|
}
|
|
1518
1517
|
throw Error("No callback specified for chunked download");
|
|
@@ -1527,47 +1526,47 @@ exports.Download = /*#__PURE__*/function () {
|
|
|
1527
1526
|
i = 0;
|
|
1528
1527
|
case 7:
|
|
1529
1528
|
if (!(i < totalChunks)) {
|
|
1530
|
-
|
|
1529
|
+
_context19.next = 35;
|
|
1531
1530
|
break;
|
|
1532
1531
|
}
|
|
1533
1532
|
headers["Range"] = "bytes=".concat(bytesFinished, "-").concat(bytesFinished + chunkSize - 1);
|
|
1534
|
-
|
|
1533
|
+
_context19.next = 11;
|
|
1535
1534
|
return this.HttpClient.Request({
|
|
1536
1535
|
path: downloadPath,
|
|
1537
1536
|
headers: headers,
|
|
1538
1537
|
method: "GET"
|
|
1539
1538
|
});
|
|
1540
1539
|
case 11:
|
|
1541
|
-
response =
|
|
1540
|
+
response = _context19.sent;
|
|
1542
1541
|
bytesFinished = Math.min(bytesFinished + chunkSize, bytesTotal);
|
|
1543
1542
|
if (!chunked) {
|
|
1544
|
-
|
|
1543
|
+
_context19.next = 24;
|
|
1545
1544
|
break;
|
|
1546
1545
|
}
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1546
|
+
_context19.t0 = callback;
|
|
1547
|
+
_context19.t1 = bytesFinished;
|
|
1548
|
+
_context19.t2 = bytesTotal;
|
|
1549
|
+
_context19.next = 19;
|
|
1551
1550
|
return this.utils.ResponseToFormat(format, response);
|
|
1552
1551
|
case 19:
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
bytesFinished:
|
|
1556
|
-
bytesTotal:
|
|
1557
|
-
chunk:
|
|
1552
|
+
_context19.t3 = _context19.sent;
|
|
1553
|
+
_context19.t4 = {
|
|
1554
|
+
bytesFinished: _context19.t1,
|
|
1555
|
+
bytesTotal: _context19.t2,
|
|
1556
|
+
chunk: _context19.t3
|
|
1558
1557
|
};
|
|
1559
|
-
(0,
|
|
1560
|
-
|
|
1558
|
+
(0, _context19.t0)(_context19.t4);
|
|
1559
|
+
_context19.next = 32;
|
|
1561
1560
|
break;
|
|
1562
1561
|
case 24:
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1562
|
+
_context19.t5 = outputChunks;
|
|
1563
|
+
_context19.t6 = Buffer;
|
|
1564
|
+
_context19.next = 28;
|
|
1566
1565
|
return response.arrayBuffer();
|
|
1567
1566
|
case 28:
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
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);
|
|
1571
1570
|
if (callback) {
|
|
1572
1571
|
callback({
|
|
1573
1572
|
bytesFinished: bytesFinished,
|
|
@@ -1576,20 +1575,20 @@ exports.Download = /*#__PURE__*/function () {
|
|
|
1576
1575
|
}
|
|
1577
1576
|
case 32:
|
|
1578
1577
|
i++;
|
|
1579
|
-
|
|
1578
|
+
_context19.next = 7;
|
|
1580
1579
|
break;
|
|
1581
1580
|
case 35:
|
|
1582
1581
|
if (chunked) {
|
|
1583
|
-
|
|
1582
|
+
_context19.next = 39;
|
|
1584
1583
|
break;
|
|
1585
1584
|
}
|
|
1586
|
-
|
|
1585
|
+
_context19.next = 38;
|
|
1587
1586
|
return this.utils.ResponseToFormat(format, new Response(Buffer.concat(outputChunks)));
|
|
1588
1587
|
case 38:
|
|
1589
|
-
return
|
|
1588
|
+
return _context19.abrupt("return", _context19.sent);
|
|
1590
1589
|
case 39:
|
|
1591
1590
|
case "end":
|
|
1592
|
-
return
|
|
1591
|
+
return _context19.stop();
|
|
1593
1592
|
}
|
|
1594
1593
|
}, _callee18, this);
|
|
1595
1594
|
}));
|
|
@@ -1601,12 +1600,12 @@ exports.DownloadEncrypted = /*#__PURE__*/function () {
|
|
|
1601
1600
|
var _ref35 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20(_ref34) {
|
|
1602
1601
|
var _this2 = this;
|
|
1603
1602
|
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 (
|
|
1603
|
+
return _regeneratorRuntime.wrap(function _callee20$(_context21) {
|
|
1604
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
1606
1605
|
case 0:
|
|
1607
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;
|
|
1608
1607
|
if (!(chunked && !callback)) {
|
|
1609
|
-
|
|
1608
|
+
_context21.next = 3;
|
|
1610
1609
|
break;
|
|
1611
1610
|
}
|
|
1612
1611
|
throw Error("No callback specified for chunked download");
|
|
@@ -1617,44 +1616,44 @@ exports.DownloadEncrypted = /*#__PURE__*/function () {
|
|
|
1617
1616
|
bytesFinished = 0;
|
|
1618
1617
|
format = format.toLowerCase();
|
|
1619
1618
|
outputChunks = []; // Set up decryption stream
|
|
1620
|
-
|
|
1619
|
+
_context21.next = 10;
|
|
1621
1620
|
return this.Crypto.OpenDecryptionStream(conk);
|
|
1622
1621
|
case 10:
|
|
1623
|
-
stream =
|
|
1622
|
+
stream = _context21.sent;
|
|
1624
1623
|
stream.on("data", /*#__PURE__*/function () {
|
|
1625
1624
|
var _ref36 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19(chunk) {
|
|
1626
1625
|
var arrayBuffer;
|
|
1627
|
-
return _regeneratorRuntime.wrap(function _callee19$(
|
|
1628
|
-
while (1) switch (
|
|
1626
|
+
return _regeneratorRuntime.wrap(function _callee19$(_context20) {
|
|
1627
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1629
1628
|
case 0:
|
|
1630
1629
|
if (!chunked) {
|
|
1631
|
-
|
|
1630
|
+
_context20.next = 13;
|
|
1632
1631
|
break;
|
|
1633
1632
|
}
|
|
1634
1633
|
if (!(format !== "buffer")) {
|
|
1635
|
-
|
|
1634
|
+
_context20.next = 10;
|
|
1636
1635
|
break;
|
|
1637
1636
|
}
|
|
1638
1637
|
arrayBuffer = chunk.buffer.slice(chunk.byteOffset, chunk.byteOffset + chunk.byteLength);
|
|
1639
1638
|
if (!(format === "arraybuffer")) {
|
|
1640
|
-
|
|
1639
|
+
_context20.next = 7;
|
|
1641
1640
|
break;
|
|
1642
1641
|
}
|
|
1643
1642
|
chunk = arrayBuffer;
|
|
1644
|
-
|
|
1643
|
+
_context20.next = 10;
|
|
1645
1644
|
break;
|
|
1646
1645
|
case 7:
|
|
1647
|
-
|
|
1646
|
+
_context20.next = 9;
|
|
1648
1647
|
return _this2.utils.ResponseToFormat(format, new Response(arrayBuffer));
|
|
1649
1648
|
case 9:
|
|
1650
|
-
chunk =
|
|
1649
|
+
chunk = _context20.sent;
|
|
1651
1650
|
case 10:
|
|
1652
1651
|
callback({
|
|
1653
1652
|
bytesFinished: bytesFinished,
|
|
1654
1653
|
bytesTotal: bytesTotal,
|
|
1655
1654
|
chunk: chunk
|
|
1656
1655
|
});
|
|
1657
|
-
|
|
1656
|
+
_context20.next = 15;
|
|
1658
1657
|
break;
|
|
1659
1658
|
case 13:
|
|
1660
1659
|
if (callback) {
|
|
@@ -1666,7 +1665,7 @@ exports.DownloadEncrypted = /*#__PURE__*/function () {
|
|
|
1666
1665
|
outputChunks.push(chunk);
|
|
1667
1666
|
case 15:
|
|
1668
1667
|
case "end":
|
|
1669
|
-
return
|
|
1668
|
+
return _context20.stop();
|
|
1670
1669
|
}
|
|
1671
1670
|
}, _callee19);
|
|
1672
1671
|
}));
|
|
@@ -1678,35 +1677,35 @@ exports.DownloadEncrypted = /*#__PURE__*/function () {
|
|
|
1678
1677
|
i = 0;
|
|
1679
1678
|
case 14:
|
|
1680
1679
|
if (!(i < totalChunks)) {
|
|
1681
|
-
|
|
1680
|
+
_context21.next = 30;
|
|
1682
1681
|
break;
|
|
1683
1682
|
}
|
|
1684
1683
|
headers["Range"] = "bytes=".concat(bytesFinished, "-").concat(bytesFinished + chunkSize - 1);
|
|
1685
|
-
|
|
1684
|
+
_context21.next = 18;
|
|
1686
1685
|
return this.HttpClient.Request({
|
|
1687
1686
|
headers: headers,
|
|
1688
1687
|
method: "GET",
|
|
1689
1688
|
path: downloadPath
|
|
1690
1689
|
});
|
|
1691
1690
|
case 18:
|
|
1692
|
-
response =
|
|
1691
|
+
response = _context21.sent;
|
|
1693
1692
|
bytesFinished = Math.min(bytesFinished + chunkSize, bytesTotal);
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1693
|
+
_context21.t0 = stream;
|
|
1694
|
+
_context21.t1 = Uint8Array;
|
|
1695
|
+
_context21.next = 24;
|
|
1697
1696
|
return response.arrayBuffer();
|
|
1698
1697
|
case 24:
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1698
|
+
_context21.t2 = _context21.sent;
|
|
1699
|
+
_context21.t3 = new _context21.t1(_context21.t2);
|
|
1700
|
+
_context21.t0.write.call(_context21.t0, _context21.t3);
|
|
1702
1701
|
case 27:
|
|
1703
1702
|
i++;
|
|
1704
|
-
|
|
1703
|
+
_context21.next = 14;
|
|
1705
1704
|
break;
|
|
1706
1705
|
case 30:
|
|
1707
1706
|
// Wait for decryption to complete
|
|
1708
1707
|
stream.end();
|
|
1709
|
-
|
|
1708
|
+
_context21.next = 33;
|
|
1710
1709
|
return new Promise(function (resolve) {
|
|
1711
1710
|
return stream.on("finish", function () {
|
|
1712
1711
|
resolve();
|
|
@@ -1714,16 +1713,16 @@ exports.DownloadEncrypted = /*#__PURE__*/function () {
|
|
|
1714
1713
|
});
|
|
1715
1714
|
case 33:
|
|
1716
1715
|
if (chunked) {
|
|
1717
|
-
|
|
1716
|
+
_context21.next = 37;
|
|
1718
1717
|
break;
|
|
1719
1718
|
}
|
|
1720
|
-
|
|
1719
|
+
_context21.next = 36;
|
|
1721
1720
|
return this.utils.ResponseToFormat(format, new Response(Buffer.concat(outputChunks)));
|
|
1722
1721
|
case 36:
|
|
1723
|
-
return
|
|
1722
|
+
return _context21.abrupt("return", _context21.sent);
|
|
1724
1723
|
case 37:
|
|
1725
1724
|
case "end":
|
|
1726
|
-
return
|
|
1725
|
+
return _context21.stop();
|
|
1727
1726
|
}
|
|
1728
1727
|
}, _callee20, this);
|
|
1729
1728
|
}));
|
|
@@ -1748,8 +1747,8 @@ exports.DownloadEncrypted = /*#__PURE__*/function () {
|
|
|
1748
1747
|
exports.CreatePart = /*#__PURE__*/function () {
|
|
1749
1748
|
var _ref38 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(_ref37) {
|
|
1750
1749
|
var libraryId, objectId, writeToken, encryption, path, openResponse;
|
|
1751
|
-
return _regeneratorRuntime.wrap(function _callee21$(
|
|
1752
|
-
while (1) switch (
|
|
1750
|
+
return _regeneratorRuntime.wrap(function _callee21$(_context22) {
|
|
1751
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
1753
1752
|
case 0:
|
|
1754
1753
|
libraryId = _ref37.libraryId, objectId = _ref37.objectId, writeToken = _ref37.writeToken, encryption = _ref37.encryption;
|
|
1755
1754
|
ValidateParameters({
|
|
@@ -1758,9 +1757,9 @@ exports.CreatePart = /*#__PURE__*/function () {
|
|
|
1758
1757
|
});
|
|
1759
1758
|
ValidateWriteToken(writeToken);
|
|
1760
1759
|
path = UrlJoin("q", writeToken, "parts");
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1760
|
+
_context22.t0 = this.utils;
|
|
1761
|
+
_context22.t1 = this.HttpClient;
|
|
1762
|
+
_context22.next = 8;
|
|
1764
1763
|
return this.authClient.AuthorizationHeader({
|
|
1765
1764
|
libraryId: libraryId,
|
|
1766
1765
|
objectId: objectId,
|
|
@@ -1768,25 +1767,25 @@ exports.CreatePart = /*#__PURE__*/function () {
|
|
|
1768
1767
|
encryption: encryption
|
|
1769
1768
|
});
|
|
1770
1769
|
case 8:
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
headers:
|
|
1770
|
+
_context22.t2 = _context22.sent;
|
|
1771
|
+
_context22.t3 = path;
|
|
1772
|
+
_context22.t4 = {
|
|
1773
|
+
headers: _context22.t2,
|
|
1775
1774
|
method: "POST",
|
|
1776
|
-
path:
|
|
1775
|
+
path: _context22.t3,
|
|
1777
1776
|
bodyType: "BINARY",
|
|
1778
1777
|
body: "",
|
|
1779
|
-
|
|
1778
|
+
allowFailover: false
|
|
1780
1779
|
};
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
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);
|
|
1784
1783
|
case 14:
|
|
1785
|
-
openResponse =
|
|
1786
|
-
return
|
|
1784
|
+
openResponse = _context22.sent;
|
|
1785
|
+
return _context22.abrupt("return", openResponse.part.write_token);
|
|
1787
1786
|
case 16:
|
|
1788
1787
|
case "end":
|
|
1789
|
-
return
|
|
1788
|
+
return _context22.stop();
|
|
1790
1789
|
}
|
|
1791
1790
|
}, _callee21, this);
|
|
1792
1791
|
}));
|
|
@@ -1813,8 +1812,8 @@ exports.CreatePart = /*#__PURE__*/function () {
|
|
|
1813
1812
|
exports.UploadPartChunk = /*#__PURE__*/function () {
|
|
1814
1813
|
var _ref40 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee22(_ref39) {
|
|
1815
1814
|
var libraryId, objectId, writeToken, partWriteToken, chunk, encryption, conk, path;
|
|
1816
|
-
return _regeneratorRuntime.wrap(function _callee22$(
|
|
1817
|
-
while (1) switch (
|
|
1815
|
+
return _regeneratorRuntime.wrap(function _callee22$(_context23) {
|
|
1816
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
1818
1817
|
case 0:
|
|
1819
1818
|
libraryId = _ref39.libraryId, objectId = _ref39.objectId, writeToken = _ref39.writeToken, partWriteToken = _ref39.partWriteToken, chunk = _ref39.chunk, encryption = _ref39.encryption;
|
|
1820
1819
|
ValidateParameters({
|
|
@@ -1823,26 +1822,26 @@ exports.UploadPartChunk = /*#__PURE__*/function () {
|
|
|
1823
1822
|
});
|
|
1824
1823
|
ValidateWriteToken(writeToken);
|
|
1825
1824
|
if (!(encryption && encryption !== "none")) {
|
|
1826
|
-
|
|
1825
|
+
_context23.next = 10;
|
|
1827
1826
|
break;
|
|
1828
1827
|
}
|
|
1829
|
-
|
|
1828
|
+
_context23.next = 6;
|
|
1830
1829
|
return this.EncryptionConk({
|
|
1831
1830
|
libraryId: libraryId,
|
|
1832
1831
|
objectId: objectId,
|
|
1833
1832
|
writeToken: writeToken
|
|
1834
1833
|
});
|
|
1835
1834
|
case 6:
|
|
1836
|
-
conk =
|
|
1837
|
-
|
|
1835
|
+
conk = _context23.sent;
|
|
1836
|
+
_context23.next = 9;
|
|
1838
1837
|
return this.Crypto.Encrypt(conk, chunk);
|
|
1839
1838
|
case 9:
|
|
1840
|
-
chunk =
|
|
1839
|
+
chunk = _context23.sent;
|
|
1841
1840
|
case 10:
|
|
1842
1841
|
path = UrlJoin("q", writeToken, "parts");
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1842
|
+
_context23.t0 = this.utils;
|
|
1843
|
+
_context23.t1 = this.HttpClient;
|
|
1844
|
+
_context23.next = 15;
|
|
1846
1845
|
return this.authClient.AuthorizationHeader({
|
|
1847
1846
|
libraryId: libraryId,
|
|
1848
1847
|
objectId: objectId,
|
|
@@ -1850,23 +1849,23 @@ exports.UploadPartChunk = /*#__PURE__*/function () {
|
|
|
1850
1849
|
encryption: encryption
|
|
1851
1850
|
});
|
|
1852
1851
|
case 15:
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
headers:
|
|
1852
|
+
_context23.t2 = _context23.sent;
|
|
1853
|
+
_context23.t3 = UrlJoin(path, partWriteToken);
|
|
1854
|
+
_context23.t4 = chunk;
|
|
1855
|
+
_context23.t5 = {
|
|
1856
|
+
headers: _context23.t2,
|
|
1858
1857
|
method: "POST",
|
|
1859
|
-
path:
|
|
1860
|
-
body:
|
|
1858
|
+
path: _context23.t3,
|
|
1859
|
+
body: _context23.t4,
|
|
1861
1860
|
bodyType: "BINARY",
|
|
1862
|
-
|
|
1861
|
+
allowFailover: false
|
|
1863
1862
|
};
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
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);
|
|
1867
1866
|
case 22:
|
|
1868
1867
|
case "end":
|
|
1869
|
-
return
|
|
1868
|
+
return _context23.stop();
|
|
1870
1869
|
}
|
|
1871
1870
|
}, _callee22, this);
|
|
1872
1871
|
}));
|
|
@@ -1892,8 +1891,8 @@ exports.UploadPartChunk = /*#__PURE__*/function () {
|
|
|
1892
1891
|
exports.FinalizePart = /*#__PURE__*/function () {
|
|
1893
1892
|
var _ref42 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee23(_ref41) {
|
|
1894
1893
|
var libraryId, objectId, writeToken, partWriteToken, encryption, path;
|
|
1895
|
-
return _regeneratorRuntime.wrap(function _callee23$(
|
|
1896
|
-
while (1) switch (
|
|
1894
|
+
return _regeneratorRuntime.wrap(function _callee23$(_context24) {
|
|
1895
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
1897
1896
|
case 0:
|
|
1898
1897
|
libraryId = _ref41.libraryId, objectId = _ref41.objectId, writeToken = _ref41.writeToken, partWriteToken = _ref41.partWriteToken, encryption = _ref41.encryption;
|
|
1899
1898
|
ValidateParameters({
|
|
@@ -1902,9 +1901,9 @@ exports.FinalizePart = /*#__PURE__*/function () {
|
|
|
1902
1901
|
});
|
|
1903
1902
|
ValidateWriteToken(writeToken);
|
|
1904
1903
|
path = UrlJoin("q", writeToken, "parts");
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1904
|
+
_context24.t0 = this.utils;
|
|
1905
|
+
_context24.t1 = this.HttpClient;
|
|
1906
|
+
_context24.next = 8;
|
|
1908
1907
|
return this.authClient.AuthorizationHeader({
|
|
1909
1908
|
libraryId: libraryId,
|
|
1910
1909
|
objectId: objectId,
|
|
@@ -1912,27 +1911,27 @@ exports.FinalizePart = /*#__PURE__*/function () {
|
|
|
1912
1911
|
encryption: encryption
|
|
1913
1912
|
});
|
|
1914
1913
|
case 8:
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
headers:
|
|
1914
|
+
_context24.t2 = _context24.sent;
|
|
1915
|
+
_context24.t3 = UrlJoin(path, partWriteToken);
|
|
1916
|
+
_context24.t4 = {
|
|
1917
|
+
headers: _context24.t2,
|
|
1919
1918
|
method: "POST",
|
|
1920
|
-
path:
|
|
1919
|
+
path: _context24.t3,
|
|
1921
1920
|
bodyType: "BINARY",
|
|
1922
1921
|
body: "",
|
|
1923
|
-
|
|
1922
|
+
allowFailover: false
|
|
1924
1923
|
};
|
|
1925
|
-
|
|
1926
|
-
return
|
|
1924
|
+
_context24.next = 13;
|
|
1925
|
+
return _context24.t1.Request.call(_context24.t1, _context24.t4);
|
|
1927
1926
|
case 13:
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
return
|
|
1927
|
+
_context24.t5 = _context24.sent;
|
|
1928
|
+
_context24.next = 16;
|
|
1929
|
+
return _context24.t0.ResponseToJson.call(_context24.t0, _context24.t5);
|
|
1931
1930
|
case 16:
|
|
1932
|
-
return
|
|
1931
|
+
return _context24.abrupt("return", _context24.sent);
|
|
1933
1932
|
case 17:
|
|
1934
1933
|
case "end":
|
|
1935
|
-
return
|
|
1934
|
+
return _context24.stop();
|
|
1936
1935
|
}
|
|
1937
1936
|
}, _callee23, this);
|
|
1938
1937
|
}));
|
|
@@ -1965,8 +1964,8 @@ exports.FinalizePart = /*#__PURE__*/function () {
|
|
|
1965
1964
|
exports.UploadPart = /*#__PURE__*/function () {
|
|
1966
1965
|
var _ref44 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24(_ref43) {
|
|
1967
1966
|
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 (
|
|
1967
|
+
return _regeneratorRuntime.wrap(function _callee24$(_context25) {
|
|
1968
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
1970
1969
|
case 0:
|
|
1971
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;
|
|
1972
1971
|
ValidateParameters({
|
|
@@ -1974,7 +1973,7 @@ exports.UploadPart = /*#__PURE__*/function () {
|
|
|
1974
1973
|
objectId: objectId
|
|
1975
1974
|
});
|
|
1976
1975
|
ValidateWriteToken(writeToken);
|
|
1977
|
-
|
|
1976
|
+
_context25.next = 5;
|
|
1978
1977
|
return this.CreatePart({
|
|
1979
1978
|
libraryId: libraryId,
|
|
1980
1979
|
objectId: objectId,
|
|
@@ -1982,7 +1981,7 @@ exports.UploadPart = /*#__PURE__*/function () {
|
|
|
1982
1981
|
encryption: encryption
|
|
1983
1982
|
});
|
|
1984
1983
|
case 5:
|
|
1985
|
-
partWriteToken =
|
|
1984
|
+
partWriteToken = _context25.sent;
|
|
1986
1985
|
size = data.length || data.byteLength || data.size;
|
|
1987
1986
|
if (callback) {
|
|
1988
1987
|
callback({
|
|
@@ -1993,11 +1992,11 @@ exports.UploadPart = /*#__PURE__*/function () {
|
|
|
1993
1992
|
i = 0;
|
|
1994
1993
|
case 9:
|
|
1995
1994
|
if (!(i < size)) {
|
|
1996
|
-
|
|
1995
|
+
_context25.next = 17;
|
|
1997
1996
|
break;
|
|
1998
1997
|
}
|
|
1999
1998
|
chunk = data.slice(i, i + chunkSize);
|
|
2000
|
-
|
|
1999
|
+
_context25.next = 13;
|
|
2001
2000
|
return this.UploadPartChunk({
|
|
2002
2001
|
libraryId: libraryId,
|
|
2003
2002
|
objectId: objectId,
|
|
@@ -2015,10 +2014,10 @@ exports.UploadPart = /*#__PURE__*/function () {
|
|
|
2015
2014
|
}
|
|
2016
2015
|
case 14:
|
|
2017
2016
|
i += chunkSize;
|
|
2018
|
-
|
|
2017
|
+
_context25.next = 9;
|
|
2019
2018
|
break;
|
|
2020
2019
|
case 17:
|
|
2021
|
-
|
|
2020
|
+
_context25.next = 19;
|
|
2022
2021
|
return this.FinalizePart({
|
|
2023
2022
|
libraryId: libraryId,
|
|
2024
2023
|
objectId: objectId,
|
|
@@ -2027,10 +2026,10 @@ exports.UploadPart = /*#__PURE__*/function () {
|
|
|
2027
2026
|
encryption: encryption
|
|
2028
2027
|
});
|
|
2029
2028
|
case 19:
|
|
2030
|
-
return
|
|
2029
|
+
return _context25.abrupt("return", _context25.sent);
|
|
2031
2030
|
case 20:
|
|
2032
2031
|
case "end":
|
|
2033
|
-
return
|
|
2032
|
+
return _context25.stop();
|
|
2034
2033
|
}
|
|
2035
2034
|
}, _callee24, this);
|
|
2036
2035
|
}));
|
|
@@ -2053,8 +2052,8 @@ exports.UploadPart = /*#__PURE__*/function () {
|
|
|
2053
2052
|
exports.DeletePart = /*#__PURE__*/function () {
|
|
2054
2053
|
var _ref46 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(_ref45) {
|
|
2055
2054
|
var libraryId, objectId, writeToken, partHash, path;
|
|
2056
|
-
return _regeneratorRuntime.wrap(function _callee25$(
|
|
2057
|
-
while (1) switch (
|
|
2055
|
+
return _regeneratorRuntime.wrap(function _callee25$(_context26) {
|
|
2056
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
2058
2057
|
case 0:
|
|
2059
2058
|
libraryId = _ref45.libraryId, objectId = _ref45.objectId, writeToken = _ref45.writeToken, partHash = _ref45.partHash;
|
|
2060
2059
|
ValidateParameters({
|
|
@@ -2064,27 +2063,27 @@ exports.DeletePart = /*#__PURE__*/function () {
|
|
|
2064
2063
|
ValidateWriteToken(writeToken);
|
|
2065
2064
|
ValidatePartHash(partHash);
|
|
2066
2065
|
path = UrlJoin("q", writeToken, "parts", partHash);
|
|
2067
|
-
|
|
2068
|
-
|
|
2066
|
+
_context26.t0 = this.HttpClient;
|
|
2067
|
+
_context26.next = 8;
|
|
2069
2068
|
return this.authClient.AuthorizationHeader({
|
|
2070
2069
|
libraryId: libraryId,
|
|
2071
2070
|
objectId: objectId,
|
|
2072
2071
|
update: true
|
|
2073
2072
|
});
|
|
2074
2073
|
case 8:
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
headers:
|
|
2074
|
+
_context26.t1 = _context26.sent;
|
|
2075
|
+
_context26.t2 = path;
|
|
2076
|
+
_context26.t3 = {
|
|
2077
|
+
headers: _context26.t1,
|
|
2079
2078
|
method: "DELETE",
|
|
2080
|
-
path:
|
|
2081
|
-
|
|
2079
|
+
path: _context26.t2,
|
|
2080
|
+
allowFailover: false
|
|
2082
2081
|
};
|
|
2083
|
-
|
|
2084
|
-
return
|
|
2082
|
+
_context26.next = 13;
|
|
2083
|
+
return _context26.t0.Request.call(_context26.t0, _context26.t3);
|
|
2085
2084
|
case 13:
|
|
2086
2085
|
case "end":
|
|
2087
|
-
return
|
|
2086
|
+
return _context26.stop();
|
|
2088
2087
|
}
|
|
2089
2088
|
}, _callee25, this);
|
|
2090
2089
|
}));
|