files.com 1.2.249 → 1.2.250
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/_VERSION +1 -1
- package/lib/Api.js +72 -71
- package/lib/Files.js +1 -1
- package/lib/isomorphic/File.node.js +5 -5
- package/lib/models/ActionNotificationExport.js +38 -38
- package/lib/models/ActionNotificationExportResult.js +14 -14
- package/lib/models/ApiKey.js +100 -100
- package/lib/models/ApiRequestLog.js +8 -8
- package/lib/models/App.js +8 -8
- package/lib/models/As2IncomingMessage.js +10 -10
- package/lib/models/As2OutgoingMessage.js +10 -10
- package/lib/models/As2Partner.js +101 -101
- package/lib/models/As2Station.js +81 -81
- package/lib/models/Automation.js +167 -167
- package/lib/models/AutomationLog.js +8 -8
- package/lib/models/AutomationRun.js +24 -24
- package/lib/models/BandwidthSnapshot.js +8 -8
- package/lib/models/Behavior.js +106 -106
- package/lib/models/Bundle.js +143 -143
- package/lib/models/BundleAction.js +10 -10
- package/lib/models/BundleDownload.js +12 -12
- package/lib/models/BundleNotification.js +69 -69
- package/lib/models/BundleRecipient.js +40 -40
- package/lib/models/BundleRegistration.js +12 -12
- package/lib/models/Clickwrap.js +79 -79
- package/lib/models/DnsRecord.js +8 -8
- package/lib/models/EmailIncomingMessage.js +8 -8
- package/lib/models/EmailLog.js +8 -8
- package/lib/models/ExavaultApiRequestLog.js +8 -8
- package/lib/models/ExternalEvent.js +36 -36
- package/lib/models/File.js +269 -269
- package/lib/models/FileComment.js +70 -70
- package/lib/models/FileCommentReaction.js +34 -34
- package/lib/models/FileMigration.js +10 -10
- package/lib/models/FileMigrationLog.js +8 -8
- package/lib/models/Folder.js +36 -36
- package/lib/models/FormFieldSet.js +71 -71
- package/lib/models/FtpActionLog.js +8 -8
- package/lib/models/GpgKey.js +81 -81
- package/lib/models/Group.js +83 -83
- package/lib/models/GroupUser.js +89 -89
- package/lib/models/History.js +88 -88
- package/lib/models/HistoryExport.js +64 -64
- package/lib/models/HistoryExportResult.js +14 -14
- package/lib/models/InboxRecipient.js +36 -36
- package/lib/models/InboxRegistration.js +10 -10
- package/lib/models/InboxUpload.js +8 -8
- package/lib/models/Invoice.js +18 -18
- package/lib/models/IpAddress.js +32 -32
- package/lib/models/Lock.js +51 -51
- package/lib/models/Message.js +100 -100
- package/lib/models/MessageComment.js +78 -78
- package/lib/models/MessageCommentReaction.js +54 -54
- package/lib/models/MessageReaction.js +54 -54
- package/lib/models/Notification.js +91 -91
- package/lib/models/OutboundConnectionLog.js +8 -8
- package/lib/models/Payment.js +18 -18
- package/lib/models/Permission.js +54 -54
- package/lib/models/Priority.js +14 -14
- package/lib/models/Project.js +70 -70
- package/lib/models/PublicHostingRequestLog.js +8 -8
- package/lib/models/PublicKey.js +78 -78
- package/lib/models/RemoteBandwidthSnapshot.js +8 -8
- package/lib/models/RemoteServer.js +362 -362
- package/lib/models/Request.js +60 -60
- package/lib/models/Restore.js +24 -24
- package/lib/models/Session.js +21 -21
- package/lib/models/SettingsChange.js +8 -8
- package/lib/models/SftpActionLog.js +8 -8
- package/lib/models/SftpHostKey.js +67 -67
- package/lib/models/ShareGroup.js +79 -79
- package/lib/models/SiemHttpDestination.js +158 -158
- package/lib/models/Site.js +150 -150
- package/lib/models/Snapshot.js +85 -85
- package/lib/models/SsoStrategy.js +32 -32
- package/lib/models/Style.js +48 -48
- package/lib/models/SyncLog.js +8 -8
- package/lib/models/UsageDailySnapshot.js +8 -8
- package/lib/models/UsageSnapshot.js +8 -8
- package/lib/models/User.js +215 -215
- package/lib/models/UserCipherUse.js +10 -10
- package/lib/models/UserLifecycleRule.js +92 -92
- package/lib/models/UserRequest.js +56 -56
- package/lib/models/UserSftpClientUse.js +10 -10
- package/lib/models/WebDavActionLog.js +8 -8
- package/lib/models/WebhookTest.js +24 -24
- package/package.json +1 -1
- package/src/Files.js +1 -1
package/lib/models/File.js
CHANGED
|
@@ -19,7 +19,7 @@ var _utils = require("../utils");
|
|
|
19
19
|
var _excluded = ["determinePartUploadUri"];
|
|
20
20
|
var _File;
|
|
21
21
|
/* eslint-disable no-unused-vars */
|
|
22
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var
|
|
22
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t4 in e) "default" !== _t4 && {}.hasOwnProperty.call(e, _t4) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t4)) && (i.get || i.set) ? o(f, _t4, i) : f[_t4] = e[_t4]); return f; })(e, t); }
|
|
23
23
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
24
24
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
25
25
|
/* eslint-enable no-unused-vars */
|
|
@@ -39,25 +39,25 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
|
|
|
39
39
|
(0, _defineProperty2.default)(this, "downloadToStream", /*#__PURE__*/function () {
|
|
40
40
|
var _ref = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(writableStream) {
|
|
41
41
|
var downloadUri, _require, saveUrlToStream;
|
|
42
|
-
return _regenerator.default.wrap(function
|
|
42
|
+
return _regenerator.default.wrap(function (_context) {
|
|
43
43
|
while (1) switch (_context.prev = _context.next) {
|
|
44
44
|
case 0:
|
|
45
45
|
if (!(0, _utils.isBrowser)()) {
|
|
46
|
-
_context.next =
|
|
46
|
+
_context.next = 1;
|
|
47
47
|
break;
|
|
48
48
|
}
|
|
49
49
|
throw new errors.NotImplementedError('Stream downloads are only available in a NodeJS environment');
|
|
50
|
-
case
|
|
50
|
+
case 1:
|
|
51
51
|
downloadUri = _this.getDownloadUri();
|
|
52
52
|
if (downloadUri) {
|
|
53
|
-
_context.next =
|
|
53
|
+
_context.next = 2;
|
|
54
54
|
break;
|
|
55
55
|
}
|
|
56
56
|
throw new errors.EmptyPropertyError('Current object has no download URI');
|
|
57
|
-
case
|
|
57
|
+
case 2:
|
|
58
58
|
_require = require('../isomorphic/File.node.js'), saveUrlToStream = _require.saveUrlToStream;
|
|
59
59
|
return _context.abrupt("return", saveUrlToStream(downloadUri, writableStream));
|
|
60
|
-
case
|
|
60
|
+
case 3:
|
|
61
61
|
case "end":
|
|
62
62
|
return _context.stop();
|
|
63
63
|
}
|
|
@@ -69,25 +69,25 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
|
|
|
69
69
|
}());
|
|
70
70
|
(0, _defineProperty2.default)(this, "downloadToString", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
71
71
|
var downloadUri, _require2, saveUrlToString;
|
|
72
|
-
return _regenerator.default.wrap(function
|
|
72
|
+
return _regenerator.default.wrap(function (_context2) {
|
|
73
73
|
while (1) switch (_context2.prev = _context2.next) {
|
|
74
74
|
case 0:
|
|
75
75
|
if (!(0, _utils.isBrowser)()) {
|
|
76
|
-
_context2.next =
|
|
76
|
+
_context2.next = 1;
|
|
77
77
|
break;
|
|
78
78
|
}
|
|
79
79
|
throw new errors.NotImplementedError('String downloads are only available in a NodeJS environment');
|
|
80
|
-
case
|
|
80
|
+
case 1:
|
|
81
81
|
downloadUri = _this.getDownloadUri();
|
|
82
82
|
if (downloadUri) {
|
|
83
|
-
_context2.next =
|
|
83
|
+
_context2.next = 2;
|
|
84
84
|
break;
|
|
85
85
|
}
|
|
86
86
|
throw new errors.EmptyPropertyError('Current object has no download URI');
|
|
87
|
-
case
|
|
87
|
+
case 2:
|
|
88
88
|
_require2 = require('../isomorphic/File.node.js'), saveUrlToString = _require2.saveUrlToString;
|
|
89
89
|
return _context2.abrupt("return", saveUrlToString(downloadUri));
|
|
90
|
-
case
|
|
90
|
+
case 3:
|
|
91
91
|
case "end":
|
|
92
92
|
return _context2.stop();
|
|
93
93
|
}
|
|
@@ -96,25 +96,25 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
|
|
|
96
96
|
(0, _defineProperty2.default)(this, "downloadToFile", /*#__PURE__*/function () {
|
|
97
97
|
var _ref3 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3(destinationPath) {
|
|
98
98
|
var downloadUri, _require3, saveUrlToFile;
|
|
99
|
-
return _regenerator.default.wrap(function
|
|
99
|
+
return _regenerator.default.wrap(function (_context3) {
|
|
100
100
|
while (1) switch (_context3.prev = _context3.next) {
|
|
101
101
|
case 0:
|
|
102
102
|
if (!(0, _utils.isBrowser)()) {
|
|
103
|
-
_context3.next =
|
|
103
|
+
_context3.next = 1;
|
|
104
104
|
break;
|
|
105
105
|
}
|
|
106
106
|
throw new errors.NotImplementedError('Disk file downloads are only available in a NodeJS environment');
|
|
107
|
-
case
|
|
107
|
+
case 1:
|
|
108
108
|
downloadUri = _this.getDownloadUri();
|
|
109
109
|
if (downloadUri) {
|
|
110
|
-
_context3.next =
|
|
110
|
+
_context3.next = 2;
|
|
111
111
|
break;
|
|
112
112
|
}
|
|
113
113
|
throw new errors.EmptyPropertyError('Current object has no download URI');
|
|
114
|
-
case
|
|
114
|
+
case 2:
|
|
115
115
|
_require3 = require('../isomorphic/File.node.js'), saveUrlToFile = _require3.saveUrlToFile;
|
|
116
116
|
return _context3.abrupt("return", saveUrlToFile(downloadUri, destinationPath));
|
|
117
|
-
case
|
|
117
|
+
case 3:
|
|
118
118
|
case "end":
|
|
119
119
|
return _context3.stop();
|
|
120
120
|
}
|
|
@@ -127,14 +127,14 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
|
|
|
127
127
|
(0, _defineProperty2.default)(this, "copyTo", /*#__PURE__*/function () {
|
|
128
128
|
var _ref4 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4(destinationFilePath, options) {
|
|
129
129
|
var params;
|
|
130
|
-
return _regenerator.default.wrap(function
|
|
130
|
+
return _regenerator.default.wrap(function (_context4) {
|
|
131
131
|
while (1) switch (_context4.prev = _context4.next) {
|
|
132
132
|
case 0:
|
|
133
133
|
params = {
|
|
134
134
|
destination: destinationFilePath
|
|
135
135
|
};
|
|
136
136
|
return _context4.abrupt("return", _Api.default.sendRequest("/file_actions/copy/".concat(encodeURIComponent(_this.path)), 'POST', params, options));
|
|
137
|
-
case
|
|
137
|
+
case 1:
|
|
138
138
|
case "end":
|
|
139
139
|
return _context4.stop();
|
|
140
140
|
}
|
|
@@ -147,14 +147,14 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
|
|
|
147
147
|
(0, _defineProperty2.default)(this, "moveTo", /*#__PURE__*/function () {
|
|
148
148
|
var _ref5 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5(destinationFilePath, options) {
|
|
149
149
|
var params;
|
|
150
|
-
return _regenerator.default.wrap(function
|
|
150
|
+
return _regenerator.default.wrap(function (_context5) {
|
|
151
151
|
while (1) switch (_context5.prev = _context5.next) {
|
|
152
152
|
case 0:
|
|
153
153
|
params = {
|
|
154
154
|
destination: destinationFilePath
|
|
155
155
|
};
|
|
156
156
|
return _context5.abrupt("return", _Api.default.sendRequest("/file_actions/move/".concat(encodeURIComponent(_this.path)), 'POST', params, options));
|
|
157
|
-
case
|
|
157
|
+
case 1:
|
|
158
158
|
case "end":
|
|
159
159
|
return _context5.stop();
|
|
160
160
|
}
|
|
@@ -480,61 +480,61 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
|
|
|
480
480
|
var params,
|
|
481
481
|
response,
|
|
482
482
|
_args6 = arguments;
|
|
483
|
-
return _regenerator.default.wrap(function
|
|
483
|
+
return _regenerator.default.wrap(function (_context6) {
|
|
484
484
|
while (1) switch (_context6.prev = _context6.next) {
|
|
485
485
|
case 0:
|
|
486
486
|
params = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {};
|
|
487
487
|
if (_this.attributes.path) {
|
|
488
|
-
_context6.next =
|
|
488
|
+
_context6.next = 1;
|
|
489
489
|
break;
|
|
490
490
|
}
|
|
491
491
|
throw new errors.EmptyPropertyError('Current object has no path');
|
|
492
|
-
case
|
|
492
|
+
case 1:
|
|
493
493
|
if ((0, _utils.isObject)(params)) {
|
|
494
|
-
_context6.next =
|
|
494
|
+
_context6.next = 2;
|
|
495
495
|
break;
|
|
496
496
|
}
|
|
497
497
|
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
|
498
|
-
case
|
|
498
|
+
case 2:
|
|
499
499
|
params.path = _this.attributes.path;
|
|
500
500
|
if (!(params.path && !(0, _utils.isString)(params.path))) {
|
|
501
|
-
_context6.next =
|
|
501
|
+
_context6.next = 3;
|
|
502
502
|
break;
|
|
503
503
|
}
|
|
504
504
|
throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(params.path)));
|
|
505
|
-
case
|
|
505
|
+
case 3:
|
|
506
506
|
if (!(params.action && !(0, _utils.isString)(params.action))) {
|
|
507
|
-
_context6.next =
|
|
507
|
+
_context6.next = 4;
|
|
508
508
|
break;
|
|
509
509
|
}
|
|
510
510
|
throw new errors.InvalidParameterError("Bad parameter: action must be of type String, received ".concat((0, _utils.getType)(params.action)));
|
|
511
|
-
case
|
|
511
|
+
case 4:
|
|
512
512
|
if (!(params.preview_size && !(0, _utils.isString)(params.preview_size))) {
|
|
513
|
-
_context6.next =
|
|
513
|
+
_context6.next = 5;
|
|
514
514
|
break;
|
|
515
515
|
}
|
|
516
516
|
throw new errors.InvalidParameterError("Bad parameter: preview_size must be of type String, received ".concat((0, _utils.getType)(params.preview_size)));
|
|
517
|
-
case
|
|
517
|
+
case 5:
|
|
518
518
|
if (params.path) {
|
|
519
|
-
_context6.next =
|
|
519
|
+
_context6.next = 7;
|
|
520
520
|
break;
|
|
521
521
|
}
|
|
522
522
|
if (!_this.attributes.path) {
|
|
523
|
-
_context6.next =
|
|
523
|
+
_context6.next = 6;
|
|
524
524
|
break;
|
|
525
525
|
}
|
|
526
526
|
params.path = _this.path;
|
|
527
|
-
_context6.next =
|
|
527
|
+
_context6.next = 7;
|
|
528
528
|
break;
|
|
529
|
-
case
|
|
529
|
+
case 6:
|
|
530
530
|
throw new errors.MissingParameterError('Parameter missing: path');
|
|
531
|
-
case
|
|
532
|
-
_context6.next =
|
|
531
|
+
case 7:
|
|
532
|
+
_context6.next = 8;
|
|
533
533
|
return _Api.default.sendRequest("/files/".concat(encodeURIComponent(params.path)), 'GET', params, _this.options);
|
|
534
|
-
case
|
|
534
|
+
case 8:
|
|
535
535
|
response = _context6.sent;
|
|
536
536
|
return _context6.abrupt("return", new File(response === null || response === void 0 ? void 0 : response.data, _this.options));
|
|
537
|
-
case
|
|
537
|
+
case 9:
|
|
538
538
|
case "end":
|
|
539
539
|
return _context6.stop();
|
|
540
540
|
}
|
|
@@ -548,61 +548,61 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
|
|
|
548
548
|
var params,
|
|
549
549
|
response,
|
|
550
550
|
_args7 = arguments;
|
|
551
|
-
return _regenerator.default.wrap(function
|
|
551
|
+
return _regenerator.default.wrap(function (_context7) {
|
|
552
552
|
while (1) switch (_context7.prev = _context7.next) {
|
|
553
553
|
case 0:
|
|
554
554
|
params = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : {};
|
|
555
555
|
if (_this.attributes.path) {
|
|
556
|
-
_context7.next =
|
|
556
|
+
_context7.next = 1;
|
|
557
557
|
break;
|
|
558
558
|
}
|
|
559
559
|
throw new errors.EmptyPropertyError('Current object has no path');
|
|
560
|
-
case
|
|
560
|
+
case 1:
|
|
561
561
|
if ((0, _utils.isObject)(params)) {
|
|
562
|
-
_context7.next =
|
|
562
|
+
_context7.next = 2;
|
|
563
563
|
break;
|
|
564
564
|
}
|
|
565
565
|
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
|
566
|
-
case
|
|
566
|
+
case 2:
|
|
567
567
|
params.path = _this.attributes.path;
|
|
568
568
|
if (!(params.path && !(0, _utils.isString)(params.path))) {
|
|
569
|
-
_context7.next =
|
|
569
|
+
_context7.next = 3;
|
|
570
570
|
break;
|
|
571
571
|
}
|
|
572
572
|
throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(params.path)));
|
|
573
|
-
case
|
|
573
|
+
case 3:
|
|
574
574
|
if (!(params.provided_mtime && !(0, _utils.isString)(params.provided_mtime))) {
|
|
575
|
-
_context7.next =
|
|
575
|
+
_context7.next = 4;
|
|
576
576
|
break;
|
|
577
577
|
}
|
|
578
578
|
throw new errors.InvalidParameterError("Bad parameter: provided_mtime must be of type String, received ".concat((0, _utils.getType)(params.provided_mtime)));
|
|
579
|
-
case
|
|
579
|
+
case 4:
|
|
580
580
|
if (!(params.priority_color && !(0, _utils.isString)(params.priority_color))) {
|
|
581
|
-
_context7.next =
|
|
581
|
+
_context7.next = 5;
|
|
582
582
|
break;
|
|
583
583
|
}
|
|
584
584
|
throw new errors.InvalidParameterError("Bad parameter: priority_color must be of type String, received ".concat((0, _utils.getType)(params.priority_color)));
|
|
585
|
-
case
|
|
585
|
+
case 5:
|
|
586
586
|
if (params.path) {
|
|
587
|
-
_context7.next =
|
|
587
|
+
_context7.next = 7;
|
|
588
588
|
break;
|
|
589
589
|
}
|
|
590
590
|
if (!_this.attributes.path) {
|
|
591
|
-
_context7.next =
|
|
591
|
+
_context7.next = 6;
|
|
592
592
|
break;
|
|
593
593
|
}
|
|
594
594
|
params.path = _this.path;
|
|
595
|
-
_context7.next =
|
|
595
|
+
_context7.next = 7;
|
|
596
596
|
break;
|
|
597
|
-
case
|
|
597
|
+
case 6:
|
|
598
598
|
throw new errors.MissingParameterError('Parameter missing: path');
|
|
599
|
-
case
|
|
600
|
-
_context7.next =
|
|
599
|
+
case 7:
|
|
600
|
+
_context7.next = 8;
|
|
601
601
|
return _Api.default.sendRequest("/files/".concat(encodeURIComponent(params.path)), 'PATCH', params, _this.options);
|
|
602
|
-
case
|
|
602
|
+
case 8:
|
|
603
603
|
response = _context7.sent;
|
|
604
604
|
return _context7.abrupt("return", new File(response === null || response === void 0 ? void 0 : response.data, _this.options));
|
|
605
|
-
case
|
|
605
|
+
case 9:
|
|
606
606
|
case "end":
|
|
607
607
|
return _context7.stop();
|
|
608
608
|
}
|
|
@@ -613,46 +613,46 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
|
|
|
613
613
|
(0, _defineProperty2.default)(this, "delete", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
614
614
|
var params,
|
|
615
615
|
_args8 = arguments;
|
|
616
|
-
return _regenerator.default.wrap(function
|
|
616
|
+
return _regenerator.default.wrap(function (_context8) {
|
|
617
617
|
while (1) switch (_context8.prev = _context8.next) {
|
|
618
618
|
case 0:
|
|
619
619
|
params = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {};
|
|
620
620
|
if (_this.attributes.path) {
|
|
621
|
-
_context8.next =
|
|
621
|
+
_context8.next = 1;
|
|
622
622
|
break;
|
|
623
623
|
}
|
|
624
624
|
throw new errors.EmptyPropertyError('Current object has no path');
|
|
625
|
-
case
|
|
625
|
+
case 1:
|
|
626
626
|
if ((0, _utils.isObject)(params)) {
|
|
627
|
-
_context8.next =
|
|
627
|
+
_context8.next = 2;
|
|
628
628
|
break;
|
|
629
629
|
}
|
|
630
630
|
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
|
631
|
-
case
|
|
631
|
+
case 2:
|
|
632
632
|
params.path = _this.attributes.path;
|
|
633
633
|
if (!(params.path && !(0, _utils.isString)(params.path))) {
|
|
634
|
-
_context8.next =
|
|
634
|
+
_context8.next = 3;
|
|
635
635
|
break;
|
|
636
636
|
}
|
|
637
637
|
throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(params.path)));
|
|
638
|
-
case
|
|
638
|
+
case 3:
|
|
639
639
|
if (params.path) {
|
|
640
|
-
_context8.next =
|
|
640
|
+
_context8.next = 5;
|
|
641
641
|
break;
|
|
642
642
|
}
|
|
643
643
|
if (!_this.attributes.path) {
|
|
644
|
-
_context8.next =
|
|
644
|
+
_context8.next = 4;
|
|
645
645
|
break;
|
|
646
646
|
}
|
|
647
647
|
params.path = _this.path;
|
|
648
|
-
_context8.next =
|
|
648
|
+
_context8.next = 5;
|
|
649
649
|
break;
|
|
650
|
-
case
|
|
650
|
+
case 4:
|
|
651
651
|
throw new errors.MissingParameterError('Parameter missing: path');
|
|
652
|
-
case
|
|
653
|
-
_context8.next =
|
|
652
|
+
case 5:
|
|
653
|
+
_context8.next = 6;
|
|
654
654
|
return _Api.default.sendRequest("/files/".concat(encodeURIComponent(params.path)), 'DELETE', params, _this.options);
|
|
655
|
-
case
|
|
655
|
+
case 6:
|
|
656
656
|
case "end":
|
|
657
657
|
return _context8.stop();
|
|
658
658
|
}
|
|
@@ -673,70 +673,70 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
|
|
|
673
673
|
response,
|
|
674
674
|
FileAction,
|
|
675
675
|
_args9 = arguments;
|
|
676
|
-
return _regenerator.default.wrap(function
|
|
676
|
+
return _regenerator.default.wrap(function (_context9) {
|
|
677
677
|
while (1) switch (_context9.prev = _context9.next) {
|
|
678
678
|
case 0:
|
|
679
679
|
params = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : {};
|
|
680
680
|
if (_this.attributes.path) {
|
|
681
|
-
_context9.next =
|
|
681
|
+
_context9.next = 1;
|
|
682
682
|
break;
|
|
683
683
|
}
|
|
684
684
|
throw new errors.EmptyPropertyError('Current object has no path');
|
|
685
|
-
case
|
|
685
|
+
case 1:
|
|
686
686
|
if ((0, _utils.isObject)(params)) {
|
|
687
|
-
_context9.next =
|
|
687
|
+
_context9.next = 2;
|
|
688
688
|
break;
|
|
689
689
|
}
|
|
690
690
|
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
|
691
|
-
case
|
|
691
|
+
case 2:
|
|
692
692
|
params.path = _this.attributes.path;
|
|
693
693
|
if (!(params.path && !(0, _utils.isString)(params.path))) {
|
|
694
|
-
_context9.next =
|
|
694
|
+
_context9.next = 3;
|
|
695
695
|
break;
|
|
696
696
|
}
|
|
697
697
|
throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(params.path)));
|
|
698
|
-
case
|
|
698
|
+
case 3:
|
|
699
699
|
if (!(params.destination && !(0, _utils.isString)(params.destination))) {
|
|
700
|
-
_context9.next =
|
|
700
|
+
_context9.next = 4;
|
|
701
701
|
break;
|
|
702
702
|
}
|
|
703
703
|
throw new errors.InvalidParameterError("Bad parameter: destination must be of type String, received ".concat((0, _utils.getType)(params.destination)));
|
|
704
|
-
case
|
|
704
|
+
case 4:
|
|
705
705
|
if (params.path) {
|
|
706
|
-
_context9.next =
|
|
706
|
+
_context9.next = 6;
|
|
707
707
|
break;
|
|
708
708
|
}
|
|
709
709
|
if (!_this.attributes.path) {
|
|
710
|
-
_context9.next =
|
|
710
|
+
_context9.next = 5;
|
|
711
711
|
break;
|
|
712
712
|
}
|
|
713
713
|
params.path = _this.path;
|
|
714
|
-
_context9.next =
|
|
714
|
+
_context9.next = 6;
|
|
715
715
|
break;
|
|
716
|
-
case
|
|
716
|
+
case 5:
|
|
717
717
|
throw new errors.MissingParameterError('Parameter missing: path');
|
|
718
|
-
case
|
|
718
|
+
case 6:
|
|
719
719
|
if (params.destination) {
|
|
720
|
-
_context9.next =
|
|
720
|
+
_context9.next = 8;
|
|
721
721
|
break;
|
|
722
722
|
}
|
|
723
723
|
if (!_this.attributes.destination) {
|
|
724
|
-
_context9.next =
|
|
724
|
+
_context9.next = 7;
|
|
725
725
|
break;
|
|
726
726
|
}
|
|
727
727
|
params.destination = _this.destination;
|
|
728
|
-
_context9.next =
|
|
728
|
+
_context9.next = 8;
|
|
729
729
|
break;
|
|
730
|
-
case
|
|
730
|
+
case 7:
|
|
731
731
|
throw new errors.MissingParameterError('Parameter missing: destination');
|
|
732
|
-
case
|
|
733
|
-
_context9.next =
|
|
732
|
+
case 8:
|
|
733
|
+
_context9.next = 9;
|
|
734
734
|
return _Api.default.sendRequest("/file_actions/copy/".concat(encodeURIComponent(params.path)), 'POST', params, _this.options);
|
|
735
|
-
case
|
|
735
|
+
case 9:
|
|
736
736
|
response = _context9.sent;
|
|
737
737
|
FileAction = require('./FileAction.js').default;
|
|
738
738
|
return _context9.abrupt("return", new FileAction(response === null || response === void 0 ? void 0 : response.data, _this.options));
|
|
739
|
-
case
|
|
739
|
+
case 10:
|
|
740
740
|
case "end":
|
|
741
741
|
return _context9.stop();
|
|
742
742
|
}
|
|
@@ -752,70 +752,70 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
|
|
|
752
752
|
response,
|
|
753
753
|
FileAction,
|
|
754
754
|
_args0 = arguments;
|
|
755
|
-
return _regenerator.default.wrap(function
|
|
755
|
+
return _regenerator.default.wrap(function (_context0) {
|
|
756
756
|
while (1) switch (_context0.prev = _context0.next) {
|
|
757
757
|
case 0:
|
|
758
758
|
params = _args0.length > 0 && _args0[0] !== undefined ? _args0[0] : {};
|
|
759
759
|
if (_this.attributes.path) {
|
|
760
|
-
_context0.next =
|
|
760
|
+
_context0.next = 1;
|
|
761
761
|
break;
|
|
762
762
|
}
|
|
763
763
|
throw new errors.EmptyPropertyError('Current object has no path');
|
|
764
|
-
case
|
|
764
|
+
case 1:
|
|
765
765
|
if ((0, _utils.isObject)(params)) {
|
|
766
|
-
_context0.next =
|
|
766
|
+
_context0.next = 2;
|
|
767
767
|
break;
|
|
768
768
|
}
|
|
769
769
|
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
|
770
|
-
case
|
|
770
|
+
case 2:
|
|
771
771
|
params.path = _this.attributes.path;
|
|
772
772
|
if (!(params.path && !(0, _utils.isString)(params.path))) {
|
|
773
|
-
_context0.next =
|
|
773
|
+
_context0.next = 3;
|
|
774
774
|
break;
|
|
775
775
|
}
|
|
776
776
|
throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(params.path)));
|
|
777
|
-
case
|
|
777
|
+
case 3:
|
|
778
778
|
if (!(params.destination && !(0, _utils.isString)(params.destination))) {
|
|
779
|
-
_context0.next =
|
|
779
|
+
_context0.next = 4;
|
|
780
780
|
break;
|
|
781
781
|
}
|
|
782
782
|
throw new errors.InvalidParameterError("Bad parameter: destination must be of type String, received ".concat((0, _utils.getType)(params.destination)));
|
|
783
|
-
case
|
|
783
|
+
case 4:
|
|
784
784
|
if (params.path) {
|
|
785
|
-
_context0.next =
|
|
785
|
+
_context0.next = 6;
|
|
786
786
|
break;
|
|
787
787
|
}
|
|
788
788
|
if (!_this.attributes.path) {
|
|
789
|
-
_context0.next =
|
|
789
|
+
_context0.next = 5;
|
|
790
790
|
break;
|
|
791
791
|
}
|
|
792
792
|
params.path = _this.path;
|
|
793
|
-
_context0.next =
|
|
793
|
+
_context0.next = 6;
|
|
794
794
|
break;
|
|
795
|
-
case
|
|
795
|
+
case 5:
|
|
796
796
|
throw new errors.MissingParameterError('Parameter missing: path');
|
|
797
|
-
case
|
|
797
|
+
case 6:
|
|
798
798
|
if (params.destination) {
|
|
799
|
-
_context0.next =
|
|
799
|
+
_context0.next = 8;
|
|
800
800
|
break;
|
|
801
801
|
}
|
|
802
802
|
if (!_this.attributes.destination) {
|
|
803
|
-
_context0.next =
|
|
803
|
+
_context0.next = 7;
|
|
804
804
|
break;
|
|
805
805
|
}
|
|
806
806
|
params.destination = _this.destination;
|
|
807
|
-
_context0.next =
|
|
807
|
+
_context0.next = 8;
|
|
808
808
|
break;
|
|
809
|
-
case
|
|
809
|
+
case 7:
|
|
810
810
|
throw new errors.MissingParameterError('Parameter missing: destination');
|
|
811
|
-
case
|
|
812
|
-
_context0.next =
|
|
811
|
+
case 8:
|
|
812
|
+
_context0.next = 9;
|
|
813
813
|
return _Api.default.sendRequest("/file_actions/move/".concat(encodeURIComponent(params.path)), 'POST', params, _this.options);
|
|
814
|
-
case
|
|
814
|
+
case 9:
|
|
815
815
|
response = _context0.sent;
|
|
816
816
|
FileAction = require('./FileAction.js').default;
|
|
817
817
|
return _context0.abrupt("return", new FileAction(response === null || response === void 0 ? void 0 : response.data, _this.options));
|
|
818
|
-
case
|
|
818
|
+
case 10:
|
|
819
819
|
case "end":
|
|
820
820
|
return _context0.stop();
|
|
821
821
|
}
|
|
@@ -837,82 +837,82 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
|
|
|
837
837
|
response,
|
|
838
838
|
FileUploadPart,
|
|
839
839
|
_args1 = arguments;
|
|
840
|
-
return _regenerator.default.wrap(function
|
|
840
|
+
return _regenerator.default.wrap(function (_context1) {
|
|
841
841
|
while (1) switch (_context1.prev = _context1.next) {
|
|
842
842
|
case 0:
|
|
843
843
|
params = _args1.length > 0 && _args1[0] !== undefined ? _args1[0] : {};
|
|
844
844
|
if (_this.attributes.path) {
|
|
845
|
-
_context1.next =
|
|
845
|
+
_context1.next = 1;
|
|
846
846
|
break;
|
|
847
847
|
}
|
|
848
848
|
throw new errors.EmptyPropertyError('Current object has no path');
|
|
849
|
-
case
|
|
849
|
+
case 1:
|
|
850
850
|
if ((0, _utils.isObject)(params)) {
|
|
851
|
-
_context1.next =
|
|
851
|
+
_context1.next = 2;
|
|
852
852
|
break;
|
|
853
853
|
}
|
|
854
854
|
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
|
855
|
-
case
|
|
855
|
+
case 2:
|
|
856
856
|
params.path = _this.attributes.path;
|
|
857
857
|
if (!(params.path && !(0, _utils.isString)(params.path))) {
|
|
858
|
-
_context1.next =
|
|
858
|
+
_context1.next = 3;
|
|
859
859
|
break;
|
|
860
860
|
}
|
|
861
861
|
throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(params.path)));
|
|
862
|
-
case
|
|
862
|
+
case 3:
|
|
863
863
|
if (!(params.part && !(0, _utils.isInt)(params.part))) {
|
|
864
|
-
_context1.next =
|
|
864
|
+
_context1.next = 4;
|
|
865
865
|
break;
|
|
866
866
|
}
|
|
867
867
|
throw new errors.InvalidParameterError("Bad parameter: part must be of type Int, received ".concat((0, _utils.getType)(params.part)));
|
|
868
|
-
case
|
|
868
|
+
case 4:
|
|
869
869
|
if (!(params.parts && !(0, _utils.isInt)(params.parts))) {
|
|
870
|
-
_context1.next =
|
|
870
|
+
_context1.next = 5;
|
|
871
871
|
break;
|
|
872
872
|
}
|
|
873
873
|
throw new errors.InvalidParameterError("Bad parameter: parts must be of type Int, received ".concat((0, _utils.getType)(params.parts)));
|
|
874
|
-
case
|
|
874
|
+
case 5:
|
|
875
875
|
if (!(params.ref && !(0, _utils.isString)(params.ref))) {
|
|
876
|
-
_context1.next =
|
|
876
|
+
_context1.next = 6;
|
|
877
877
|
break;
|
|
878
878
|
}
|
|
879
879
|
throw new errors.InvalidParameterError("Bad parameter: ref must be of type String, received ".concat((0, _utils.getType)(params.ref)));
|
|
880
|
-
case
|
|
880
|
+
case 6:
|
|
881
881
|
if (!(params.restart && !(0, _utils.isInt)(params.restart))) {
|
|
882
|
-
_context1.next =
|
|
882
|
+
_context1.next = 7;
|
|
883
883
|
break;
|
|
884
884
|
}
|
|
885
885
|
throw new errors.InvalidParameterError("Bad parameter: restart must be of type Int, received ".concat((0, _utils.getType)(params.restart)));
|
|
886
|
-
case
|
|
886
|
+
case 7:
|
|
887
887
|
if (!(params.size && !(0, _utils.isInt)(params.size))) {
|
|
888
|
-
_context1.next =
|
|
888
|
+
_context1.next = 8;
|
|
889
889
|
break;
|
|
890
890
|
}
|
|
891
891
|
throw new errors.InvalidParameterError("Bad parameter: size must be of type Int, received ".concat((0, _utils.getType)(params.size)));
|
|
892
|
-
case
|
|
892
|
+
case 8:
|
|
893
893
|
if (params.path) {
|
|
894
|
-
_context1.next =
|
|
894
|
+
_context1.next = 10;
|
|
895
895
|
break;
|
|
896
896
|
}
|
|
897
897
|
if (!_this.attributes.path) {
|
|
898
|
-
_context1.next =
|
|
898
|
+
_context1.next = 9;
|
|
899
899
|
break;
|
|
900
900
|
}
|
|
901
901
|
params.path = _this.path;
|
|
902
|
-
_context1.next =
|
|
902
|
+
_context1.next = 10;
|
|
903
903
|
break;
|
|
904
|
-
case
|
|
904
|
+
case 9:
|
|
905
905
|
throw new errors.MissingParameterError('Parameter missing: path');
|
|
906
|
-
case
|
|
907
|
-
_context1.next =
|
|
906
|
+
case 10:
|
|
907
|
+
_context1.next = 11;
|
|
908
908
|
return _Api.default.sendRequest("/file_actions/begin_upload/".concat(encodeURIComponent(params.path)), 'POST', params, _this.options);
|
|
909
|
-
case
|
|
909
|
+
case 11:
|
|
910
910
|
response = _context1.sent;
|
|
911
911
|
FileUploadPart = require('./FileUploadPart.js').default;
|
|
912
912
|
return _context1.abrupt("return", (response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.map(function (obj) {
|
|
913
913
|
return new FileUploadPart(obj, _this.options);
|
|
914
914
|
})) || []);
|
|
915
|
-
case
|
|
915
|
+
case 12:
|
|
916
916
|
case "end":
|
|
917
917
|
return _context1.stop();
|
|
918
918
|
}
|
|
@@ -920,16 +920,16 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
|
|
|
920
920
|
})));
|
|
921
921
|
(0, _defineProperty2.default)(this, "save", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10() {
|
|
922
922
|
var newObject;
|
|
923
|
-
return _regenerator.default.wrap(function
|
|
923
|
+
return _regenerator.default.wrap(function (_context10) {
|
|
924
924
|
while (1) switch (_context10.prev = _context10.next) {
|
|
925
925
|
case 0:
|
|
926
|
-
_context10.next =
|
|
926
|
+
_context10.next = 1;
|
|
927
927
|
return File.create(_this.attributes.path, _this.attributes, _this.options);
|
|
928
|
-
case
|
|
928
|
+
case 1:
|
|
929
929
|
newObject = _context10.sent;
|
|
930
930
|
_this.attributes = _objectSpread({}, newObject.attributes);
|
|
931
931
|
return _context10.abrupt("return", true);
|
|
932
|
-
case
|
|
932
|
+
case 2:
|
|
933
933
|
case "end":
|
|
934
934
|
return _context10.stop();
|
|
935
935
|
}
|
|
@@ -952,29 +952,29 @@ _File = File;
|
|
|
952
952
|
(0, _defineProperty2.default)(File, "_openUpload", /*#__PURE__*/function () {
|
|
953
953
|
var _ref13 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11(path, paramsRaw, options) {
|
|
954
954
|
var params, response, partData, FileUploadPart;
|
|
955
|
-
return _regenerator.default.wrap(function
|
|
955
|
+
return _regenerator.default.wrap(function (_context11) {
|
|
956
956
|
while (1) switch (_context11.prev = _context11.next) {
|
|
957
957
|
case 0:
|
|
958
958
|
params = _objectSpread(_objectSpread({}, paramsRaw), {}, {
|
|
959
959
|
action: 'put'
|
|
960
960
|
});
|
|
961
|
-
_context11.next =
|
|
961
|
+
_context11.next = 1;
|
|
962
962
|
return _Api.default.sendRequest("/files/".concat(encodeURIComponent(path)), 'POST', params, options);
|
|
963
|
-
case
|
|
963
|
+
case 1:
|
|
964
964
|
response = _context11.sent;
|
|
965
965
|
if (response) {
|
|
966
|
-
_context11.next =
|
|
966
|
+
_context11.next = 2;
|
|
967
967
|
break;
|
|
968
968
|
}
|
|
969
969
|
return _context11.abrupt("return", null);
|
|
970
|
-
case
|
|
970
|
+
case 2:
|
|
971
971
|
partData = _objectSpread(_objectSpread({}, response.data), {}, {
|
|
972
972
|
headers: response.headers,
|
|
973
973
|
parameters: params
|
|
974
974
|
});
|
|
975
975
|
FileUploadPart = require('./FileUploadPart.js').default;
|
|
976
976
|
return _context11.abrupt("return", new FileUploadPart(partData));
|
|
977
|
-
case
|
|
977
|
+
case 3:
|
|
978
978
|
case "end":
|
|
979
979
|
return _context11.stop();
|
|
980
980
|
}
|
|
@@ -987,7 +987,7 @@ _File = File;
|
|
|
987
987
|
(0, _defineProperty2.default)(File, "_continueUpload", /*#__PURE__*/function () {
|
|
988
988
|
var _ref14 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee12(path, partNumber, firstFileUploadPart, options) {
|
|
989
989
|
var params, response, partData, FileUploadPart;
|
|
990
|
-
return _regenerator.default.wrap(function
|
|
990
|
+
return _regenerator.default.wrap(function (_context12) {
|
|
991
991
|
while (1) switch (_context12.prev = _context12.next) {
|
|
992
992
|
case 0:
|
|
993
993
|
params = {
|
|
@@ -995,23 +995,23 @@ _File = File;
|
|
|
995
995
|
part: partNumber,
|
|
996
996
|
ref: firstFileUploadPart.ref
|
|
997
997
|
};
|
|
998
|
-
_context12.next =
|
|
998
|
+
_context12.next = 1;
|
|
999
999
|
return _Api.default.sendRequest("/files/".concat(encodeURIComponent(path)), 'POST', params, options);
|
|
1000
|
-
case
|
|
1000
|
+
case 1:
|
|
1001
1001
|
response = _context12.sent;
|
|
1002
1002
|
if (response) {
|
|
1003
|
-
_context12.next =
|
|
1003
|
+
_context12.next = 2;
|
|
1004
1004
|
break;
|
|
1005
1005
|
}
|
|
1006
1006
|
return _context12.abrupt("return", null);
|
|
1007
|
-
case
|
|
1007
|
+
case 2:
|
|
1008
1008
|
partData = _objectSpread(_objectSpread({}, response.data), {}, {
|
|
1009
1009
|
headers: response.headers,
|
|
1010
1010
|
parameters: params
|
|
1011
1011
|
});
|
|
1012
1012
|
FileUploadPart = require('./FileUploadPart.js').default;
|
|
1013
1013
|
return _context12.abrupt("return", new FileUploadPart(partData));
|
|
1014
|
-
case
|
|
1014
|
+
case 3:
|
|
1015
1015
|
case "end":
|
|
1016
1016
|
return _context12.stop();
|
|
1017
1017
|
}
|
|
@@ -1024,7 +1024,7 @@ _File = File;
|
|
|
1024
1024
|
(0, _defineProperty2.default)(File, "_completeUpload", /*#__PURE__*/function () {
|
|
1025
1025
|
var _ref15 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee13(firstFileUploadPart, options) {
|
|
1026
1026
|
var params;
|
|
1027
|
-
return _regenerator.default.wrap(function
|
|
1027
|
+
return _regenerator.default.wrap(function (_context13) {
|
|
1028
1028
|
while (1) switch (_context13.prev = _context13.next) {
|
|
1029
1029
|
case 0:
|
|
1030
1030
|
params = {
|
|
@@ -1032,7 +1032,7 @@ _File = File;
|
|
|
1032
1032
|
ref: firstFileUploadPart.ref
|
|
1033
1033
|
};
|
|
1034
1034
|
return _context13.abrupt("return", _Api.default.sendRequest("/files/".concat(encodeURIComponent(firstFileUploadPart.path)), 'POST', params, options));
|
|
1035
|
-
case
|
|
1035
|
+
case 1:
|
|
1036
1036
|
case "end":
|
|
1037
1037
|
return _context13.stop();
|
|
1038
1038
|
}
|
|
@@ -1047,26 +1047,26 @@ _File = File;
|
|
|
1047
1047
|
*/
|
|
1048
1048
|
(0, _defineProperty2.default)(File, "uploadStream", /*#__PURE__*/function () {
|
|
1049
1049
|
var _ref16 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee16(destinationPath, readableStream, params, optionsRaw) {
|
|
1050
|
-
var _ref17, determinePartUploadUriRaw, options, firstFileUploadPart, determinePartUploadUri, file;
|
|
1051
|
-
return _regenerator.default.wrap(function
|
|
1050
|
+
var _ref17, determinePartUploadUriRaw, options, firstFileUploadPart, determinePartUploadUri, file, _t3;
|
|
1051
|
+
return _regenerator.default.wrap(function (_context16) {
|
|
1052
1052
|
while (1) switch (_context16.prev = _context16.next) {
|
|
1053
1053
|
case 0:
|
|
1054
1054
|
_ref17 = optionsRaw || {}, determinePartUploadUriRaw = _ref17.determinePartUploadUri, options = (0, _objectWithoutProperties2.default)(_ref17, _excluded);
|
|
1055
|
-
_context16.next =
|
|
1055
|
+
_context16.next = 1;
|
|
1056
1056
|
return _File._openUpload(destinationPath, params, options);
|
|
1057
|
-
case
|
|
1057
|
+
case 1:
|
|
1058
1058
|
firstFileUploadPart = _context16.sent;
|
|
1059
1059
|
if (firstFileUploadPart) {
|
|
1060
|
-
_context16.next =
|
|
1060
|
+
_context16.next = 2;
|
|
1061
1061
|
break;
|
|
1062
1062
|
}
|
|
1063
1063
|
return _context16.abrupt("return", null);
|
|
1064
|
-
case
|
|
1064
|
+
case 2:
|
|
1065
1065
|
determinePartUploadUri = determinePartUploadUriRaw || function (fileUploadPart) {
|
|
1066
1066
|
return fileUploadPart.upload_uri;
|
|
1067
1067
|
};
|
|
1068
|
-
_context16.prev =
|
|
1069
|
-
_context16.next =
|
|
1068
|
+
_context16.prev = 3;
|
|
1069
|
+
_context16.next = 4;
|
|
1070
1070
|
return new Promise(function (resolve, reject) {
|
|
1071
1071
|
var part = 0;
|
|
1072
1072
|
var chunks = [];
|
|
@@ -1076,52 +1076,52 @@ _File = File;
|
|
|
1076
1076
|
var streamEnded = false;
|
|
1077
1077
|
var handleStreamEnd = /*#__PURE__*/function () {
|
|
1078
1078
|
var _ref18 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee14() {
|
|
1079
|
-
var _options$getAgentForU, buffer, nextFileUploadPart, uploadUri, agent, response, createdFile;
|
|
1080
|
-
return _regenerator.default.wrap(function
|
|
1079
|
+
var _options$getAgentForU, buffer, nextFileUploadPart, uploadUri, agent, response, createdFile, _t;
|
|
1080
|
+
return _regenerator.default.wrap(function (_context14) {
|
|
1081
1081
|
while (1) switch (_context14.prev = _context14.next) {
|
|
1082
1082
|
case 0:
|
|
1083
1083
|
if (!(chunkBuffer !== null || !streamEnded)) {
|
|
1084
|
-
_context14.next =
|
|
1084
|
+
_context14.next = 1;
|
|
1085
1085
|
break;
|
|
1086
1086
|
}
|
|
1087
1087
|
return _context14.abrupt("return");
|
|
1088
|
-
case
|
|
1089
|
-
_context14.prev =
|
|
1088
|
+
case 1:
|
|
1089
|
+
_context14.prev = 1;
|
|
1090
1090
|
if (!(chunks.length > 0)) {
|
|
1091
|
-
_context14.next =
|
|
1091
|
+
_context14.next = 3;
|
|
1092
1092
|
break;
|
|
1093
1093
|
}
|
|
1094
1094
|
buffer = _safeBuffer.Buffer.concat(chunks);
|
|
1095
|
-
_context14.next =
|
|
1095
|
+
_context14.next = 2;
|
|
1096
1096
|
return _File._continueUpload(destinationPath, ++part, firstFileUploadPart, options);
|
|
1097
|
-
case
|
|
1097
|
+
case 2:
|
|
1098
1098
|
nextFileUploadPart = _context14.sent;
|
|
1099
1099
|
uploadUri = determinePartUploadUri(nextFileUploadPart); // instantiate an httpsAgent dynamically if needed
|
|
1100
1100
|
agent = ((_options$getAgentForU = options.getAgentForUrl) === null || _options$getAgentForU === void 0 ? void 0 : _options$getAgentForU.call(options, uploadUri)) || (options === null || options === void 0 ? void 0 : options.agent);
|
|
1101
1101
|
concurrentUploads.push(_Api.default.sendFilePart(uploadUri, 'PUT', buffer, {
|
|
1102
1102
|
agent: agent
|
|
1103
1103
|
}));
|
|
1104
|
-
case
|
|
1105
|
-
_context14.next =
|
|
1104
|
+
case 3:
|
|
1105
|
+
_context14.next = 4;
|
|
1106
1106
|
return Promise.all(concurrentUploads);
|
|
1107
|
-
case
|
|
1108
|
-
_context14.next =
|
|
1107
|
+
case 4:
|
|
1108
|
+
_context14.next = 5;
|
|
1109
1109
|
return _File._completeUpload(firstFileUploadPart, options);
|
|
1110
|
-
case
|
|
1110
|
+
case 5:
|
|
1111
1111
|
response = _context14.sent;
|
|
1112
1112
|
createdFile = new _File(response.data, options);
|
|
1113
1113
|
resolve(createdFile);
|
|
1114
|
-
_context14.next =
|
|
1114
|
+
_context14.next = 7;
|
|
1115
1115
|
break;
|
|
1116
|
-
case
|
|
1117
|
-
_context14.prev =
|
|
1118
|
-
|
|
1119
|
-
reject(
|
|
1120
|
-
case
|
|
1116
|
+
case 6:
|
|
1117
|
+
_context14.prev = 6;
|
|
1118
|
+
_t = _context14["catch"](1);
|
|
1119
|
+
reject(_t);
|
|
1120
|
+
case 7:
|
|
1121
1121
|
case "end":
|
|
1122
1122
|
return _context14.stop();
|
|
1123
1123
|
}
|
|
1124
|
-
}, _callee14, null, [[
|
|
1124
|
+
}, _callee14, null, [[1, 6]]);
|
|
1125
1125
|
}));
|
|
1126
1126
|
return function handleStreamEnd() {
|
|
1127
1127
|
return _ref18.apply(this, arguments);
|
|
@@ -1136,21 +1136,21 @@ _File = File;
|
|
|
1136
1136
|
// contain the entire file and we could get a single chunk with length >= partsize * 3
|
|
1137
1137
|
readableStream.on('data', /*#__PURE__*/function () {
|
|
1138
1138
|
var _ref19 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15(chunk) {
|
|
1139
|
-
var excessLength, _options$getAgentForU2, lengthForEndOfCurrentPart, lastChunkForCurrentPart, chunkBufferAfterCurrentPart, buffer, nextFileUploadPart, uploadUri, agent, uploadPromise, isNextChunkAtLeastOnePart;
|
|
1140
|
-
return _regenerator.default.wrap(function
|
|
1139
|
+
var excessLength, _options$getAgentForU2, lengthForEndOfCurrentPart, lastChunkForCurrentPart, chunkBufferAfterCurrentPart, buffer, nextFileUploadPart, uploadUri, agent, uploadPromise, isNextChunkAtLeastOnePart, _t2;
|
|
1140
|
+
return _regenerator.default.wrap(function (_context15) {
|
|
1141
1141
|
while (1) switch (_context15.prev = _context15.next) {
|
|
1142
1142
|
case 0:
|
|
1143
1143
|
_context15.prev = 0;
|
|
1144
1144
|
excessLength = length + chunk.length - firstFileUploadPart.partsize;
|
|
1145
1145
|
chunkBuffer = _safeBuffer.Buffer.from(chunk);
|
|
1146
1146
|
if (!(excessLength > 0)) {
|
|
1147
|
-
_context15.next =
|
|
1147
|
+
_context15.next = 6;
|
|
1148
1148
|
break;
|
|
1149
1149
|
}
|
|
1150
1150
|
readableStream.pause();
|
|
1151
|
-
case
|
|
1151
|
+
case 1:
|
|
1152
1152
|
if (!chunkBuffer) {
|
|
1153
|
-
_context15.next =
|
|
1153
|
+
_context15.next = 5;
|
|
1154
1154
|
break;
|
|
1155
1155
|
}
|
|
1156
1156
|
// the amount to append this last part with to make it exactly the full partsize
|
|
@@ -1160,9 +1160,9 @@ _File = File;
|
|
|
1160
1160
|
chunks.push(lastChunkForCurrentPart);
|
|
1161
1161
|
buffer = _safeBuffer.Buffer.concat(chunks);
|
|
1162
1162
|
/* eslint-disable-next-line no-await-in-loop */
|
|
1163
|
-
_context15.next =
|
|
1163
|
+
_context15.next = 2;
|
|
1164
1164
|
return _File._continueUpload(destinationPath, ++part, firstFileUploadPart, options);
|
|
1165
|
-
case
|
|
1165
|
+
case 2:
|
|
1166
1166
|
nextFileUploadPart = _context15.sent;
|
|
1167
1167
|
uploadUri = determinePartUploadUri(nextFileUploadPart); // instantiate an httpsAgent dynamically if needed
|
|
1168
1168
|
agent = ((_options$getAgentForU2 = options.getAgentForUrl) === null || _options$getAgentForU2 === void 0 ? void 0 : _options$getAgentForU2.call(options, uploadUri)) || (options === null || options === void 0 ? void 0 : options.agent);
|
|
@@ -1170,16 +1170,16 @@ _File = File;
|
|
|
1170
1170
|
agent: agent
|
|
1171
1171
|
});
|
|
1172
1172
|
if (!firstFileUploadPart.parallel_parts) {
|
|
1173
|
-
_context15.next =
|
|
1173
|
+
_context15.next = 3;
|
|
1174
1174
|
break;
|
|
1175
1175
|
}
|
|
1176
1176
|
concurrentUploads.push(uploadPromise);
|
|
1177
|
-
_context15.next =
|
|
1177
|
+
_context15.next = 4;
|
|
1178
1178
|
break;
|
|
1179
|
-
case
|
|
1180
|
-
_context15.next =
|
|
1179
|
+
case 3:
|
|
1180
|
+
_context15.next = 4;
|
|
1181
1181
|
return uploadPromise;
|
|
1182
|
-
case
|
|
1182
|
+
case 4:
|
|
1183
1183
|
// determine if the remainder of the excess chunk data is too large to be a single part
|
|
1184
1184
|
isNextChunkAtLeastOnePart = chunkBufferAfterCurrentPart.length >= firstFileUploadPart.partsize; // the excess data contains >= 1 full part, so we'll loop again to enqueue
|
|
1185
1185
|
// the next part for upload and continue processing any excess beyond that
|
|
@@ -1196,31 +1196,31 @@ _File = File;
|
|
|
1196
1196
|
} else {
|
|
1197
1197
|
chunkBuffer = null;
|
|
1198
1198
|
}
|
|
1199
|
-
_context15.next =
|
|
1199
|
+
_context15.next = 1;
|
|
1200
1200
|
break;
|
|
1201
|
-
case
|
|
1201
|
+
case 5:
|
|
1202
1202
|
readableStream.resume();
|
|
1203
|
-
_context15.next =
|
|
1203
|
+
_context15.next = 7;
|
|
1204
1204
|
break;
|
|
1205
|
-
case
|
|
1205
|
+
case 6:
|
|
1206
1206
|
chunks.push(chunkBuffer);
|
|
1207
1207
|
length += chunk.length;
|
|
1208
1208
|
chunkBuffer = null;
|
|
1209
|
-
case
|
|
1209
|
+
case 7:
|
|
1210
1210
|
if (streamEnded) {
|
|
1211
1211
|
handleStreamEnd();
|
|
1212
1212
|
}
|
|
1213
|
-
_context15.next =
|
|
1213
|
+
_context15.next = 9;
|
|
1214
1214
|
break;
|
|
1215
|
-
case
|
|
1216
|
-
_context15.prev =
|
|
1217
|
-
|
|
1218
|
-
reject(
|
|
1219
|
-
case
|
|
1215
|
+
case 8:
|
|
1216
|
+
_context15.prev = 8;
|
|
1217
|
+
_t2 = _context15["catch"](0);
|
|
1218
|
+
reject(_t2);
|
|
1219
|
+
case 9:
|
|
1220
1220
|
case "end":
|
|
1221
1221
|
return _context15.stop();
|
|
1222
1222
|
}
|
|
1223
|
-
}, _callee15, null, [[0,
|
|
1223
|
+
}, _callee15, null, [[0, 8]]);
|
|
1224
1224
|
}));
|
|
1225
1225
|
return function (_x18) {
|
|
1226
1226
|
return _ref19.apply(this, arguments);
|
|
@@ -1233,19 +1233,19 @@ _File = File;
|
|
|
1233
1233
|
handleStreamEnd();
|
|
1234
1234
|
});
|
|
1235
1235
|
});
|
|
1236
|
-
case
|
|
1236
|
+
case 4:
|
|
1237
1237
|
file = _context16.sent;
|
|
1238
1238
|
return _context16.abrupt("return", file);
|
|
1239
|
-
case
|
|
1240
|
-
_context16.prev =
|
|
1241
|
-
|
|
1242
|
-
errors.handleErrorResponse(
|
|
1239
|
+
case 5:
|
|
1240
|
+
_context16.prev = 5;
|
|
1241
|
+
_t3 = _context16["catch"](3);
|
|
1242
|
+
errors.handleErrorResponse(_t3);
|
|
1243
1243
|
return _context16.abrupt("return", null);
|
|
1244
|
-
case
|
|
1244
|
+
case 6:
|
|
1245
1245
|
case "end":
|
|
1246
1246
|
return _context16.stop();
|
|
1247
1247
|
}
|
|
1248
|
-
}, _callee16, null, [[
|
|
1248
|
+
}, _callee16, null, [[3, 5]]);
|
|
1249
1249
|
}));
|
|
1250
1250
|
return function (_x14, _x15, _x16, _x17) {
|
|
1251
1251
|
return _ref16.apply(this, arguments);
|
|
@@ -1257,17 +1257,17 @@ _File = File;
|
|
|
1257
1257
|
*/
|
|
1258
1258
|
(0, _defineProperty2.default)(File, "uploadData", /*#__PURE__*/function () {
|
|
1259
1259
|
var _ref20 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee17(destinationPath, data, params, options) {
|
|
1260
|
-
return _regenerator.default.wrap(function
|
|
1260
|
+
return _regenerator.default.wrap(function (_context17) {
|
|
1261
1261
|
while (1) switch (_context17.prev = _context17.next) {
|
|
1262
1262
|
case 0:
|
|
1263
1263
|
if (data) {
|
|
1264
|
-
_context17.next =
|
|
1264
|
+
_context17.next = 1;
|
|
1265
1265
|
break;
|
|
1266
1266
|
}
|
|
1267
1267
|
throw new errors.MissingParameterError('Upload data was not provided');
|
|
1268
|
-
case
|
|
1268
|
+
case 1:
|
|
1269
1269
|
return _context17.abrupt("return", _File.uploadStream(destinationPath, _readableStream.default.from(data), params, options));
|
|
1270
|
-
case
|
|
1270
|
+
case 2:
|
|
1271
1271
|
case "end":
|
|
1272
1272
|
return _context17.stop();
|
|
1273
1273
|
}
|
|
@@ -1283,19 +1283,19 @@ _File = File;
|
|
|
1283
1283
|
(0, _defineProperty2.default)(File, "uploadFile", /*#__PURE__*/function () {
|
|
1284
1284
|
var _ref21 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee18(destinationPath, sourceFilePath, params, options) {
|
|
1285
1285
|
var _require4, openDiskFileReadStream, stream;
|
|
1286
|
-
return _regenerator.default.wrap(function
|
|
1286
|
+
return _regenerator.default.wrap(function (_context18) {
|
|
1287
1287
|
while (1) switch (_context18.prev = _context18.next) {
|
|
1288
1288
|
case 0:
|
|
1289
1289
|
if (!(0, _utils.isBrowser)()) {
|
|
1290
|
-
_context18.next =
|
|
1290
|
+
_context18.next = 1;
|
|
1291
1291
|
break;
|
|
1292
1292
|
}
|
|
1293
1293
|
throw new errors.NotImplementedError('Disk file uploads are only available in a NodeJS environment');
|
|
1294
|
-
case
|
|
1294
|
+
case 1:
|
|
1295
1295
|
_require4 = require('../isomorphic/File.node.js'), openDiskFileReadStream = _require4.openDiskFileReadStream;
|
|
1296
1296
|
stream = openDiskFileReadStream(sourceFilePath);
|
|
1297
1297
|
return _context18.abrupt("return", _File.uploadStream(destinationPath, stream, params, options));
|
|
1298
|
-
case
|
|
1298
|
+
case 2:
|
|
1299
1299
|
case "end":
|
|
1300
1300
|
return _context18.stop();
|
|
1301
1301
|
}
|
|
@@ -1326,90 +1326,90 @@ _File = File;
|
|
|
1326
1326
|
options,
|
|
1327
1327
|
response,
|
|
1328
1328
|
_args19 = arguments;
|
|
1329
|
-
return _regenerator.default.wrap(function
|
|
1329
|
+
return _regenerator.default.wrap(function (_context19) {
|
|
1330
1330
|
while (1) switch (_context19.prev = _context19.next) {
|
|
1331
1331
|
case 0:
|
|
1332
1332
|
params = _args19.length > 1 && _args19[1] !== undefined ? _args19[1] : {};
|
|
1333
1333
|
options = _args19.length > 2 && _args19[2] !== undefined ? _args19[2] : {};
|
|
1334
1334
|
if ((0, _utils.isObject)(params)) {
|
|
1335
|
-
_context19.next =
|
|
1335
|
+
_context19.next = 1;
|
|
1336
1336
|
break;
|
|
1337
1337
|
}
|
|
1338
1338
|
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
|
1339
|
-
case
|
|
1339
|
+
case 1:
|
|
1340
1340
|
params.path = path;
|
|
1341
1341
|
if (params.path) {
|
|
1342
|
-
_context19.next =
|
|
1342
|
+
_context19.next = 2;
|
|
1343
1343
|
break;
|
|
1344
1344
|
}
|
|
1345
1345
|
throw new errors.MissingParameterError('Parameter missing: path');
|
|
1346
|
-
case
|
|
1346
|
+
case 2:
|
|
1347
1347
|
if (!(params.path && !(0, _utils.isString)(params.path))) {
|
|
1348
|
-
_context19.next =
|
|
1348
|
+
_context19.next = 3;
|
|
1349
1349
|
break;
|
|
1350
1350
|
}
|
|
1351
1351
|
throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(params.path)));
|
|
1352
|
-
case
|
|
1352
|
+
case 3:
|
|
1353
1353
|
if (!(params.action && !(0, _utils.isString)(params.action))) {
|
|
1354
|
-
_context19.next =
|
|
1354
|
+
_context19.next = 4;
|
|
1355
1355
|
break;
|
|
1356
1356
|
}
|
|
1357
1357
|
throw new errors.InvalidParameterError("Bad parameter: action must be of type String, received ".concat((0, _utils.getType)(params.action)));
|
|
1358
|
-
case
|
|
1358
|
+
case 4:
|
|
1359
1359
|
if (!(params.length && !(0, _utils.isInt)(params.length))) {
|
|
1360
|
-
_context19.next =
|
|
1360
|
+
_context19.next = 5;
|
|
1361
1361
|
break;
|
|
1362
1362
|
}
|
|
1363
1363
|
throw new errors.InvalidParameterError("Bad parameter: length must be of type Int, received ".concat((0, _utils.getType)(params.length)));
|
|
1364
|
-
case
|
|
1364
|
+
case 5:
|
|
1365
1365
|
if (!(params.part && !(0, _utils.isInt)(params.part))) {
|
|
1366
|
-
_context19.next =
|
|
1366
|
+
_context19.next = 6;
|
|
1367
1367
|
break;
|
|
1368
1368
|
}
|
|
1369
1369
|
throw new errors.InvalidParameterError("Bad parameter: part must be of type Int, received ".concat((0, _utils.getType)(params.part)));
|
|
1370
|
-
case
|
|
1370
|
+
case 6:
|
|
1371
1371
|
if (!(params.parts && !(0, _utils.isInt)(params.parts))) {
|
|
1372
|
-
_context19.next =
|
|
1372
|
+
_context19.next = 7;
|
|
1373
1373
|
break;
|
|
1374
1374
|
}
|
|
1375
1375
|
throw new errors.InvalidParameterError("Bad parameter: parts must be of type Int, received ".concat((0, _utils.getType)(params.parts)));
|
|
1376
|
-
case
|
|
1376
|
+
case 7:
|
|
1377
1377
|
if (!(params.provided_mtime && !(0, _utils.isString)(params.provided_mtime))) {
|
|
1378
|
-
_context19.next =
|
|
1378
|
+
_context19.next = 8;
|
|
1379
1379
|
break;
|
|
1380
1380
|
}
|
|
1381
1381
|
throw new errors.InvalidParameterError("Bad parameter: provided_mtime must be of type String, received ".concat((0, _utils.getType)(params.provided_mtime)));
|
|
1382
|
-
case
|
|
1382
|
+
case 8:
|
|
1383
1383
|
if (!(params.ref && !(0, _utils.isString)(params.ref))) {
|
|
1384
|
-
_context19.next =
|
|
1384
|
+
_context19.next = 9;
|
|
1385
1385
|
break;
|
|
1386
1386
|
}
|
|
1387
1387
|
throw new errors.InvalidParameterError("Bad parameter: ref must be of type String, received ".concat((0, _utils.getType)(params.ref)));
|
|
1388
|
-
case
|
|
1388
|
+
case 9:
|
|
1389
1389
|
if (!(params.restart && !(0, _utils.isInt)(params.restart))) {
|
|
1390
|
-
_context19.next =
|
|
1390
|
+
_context19.next = 10;
|
|
1391
1391
|
break;
|
|
1392
1392
|
}
|
|
1393
1393
|
throw new errors.InvalidParameterError("Bad parameter: restart must be of type Int, received ".concat((0, _utils.getType)(params.restart)));
|
|
1394
|
-
case
|
|
1394
|
+
case 10:
|
|
1395
1395
|
if (!(params.size && !(0, _utils.isInt)(params.size))) {
|
|
1396
|
-
_context19.next =
|
|
1396
|
+
_context19.next = 11;
|
|
1397
1397
|
break;
|
|
1398
1398
|
}
|
|
1399
1399
|
throw new errors.InvalidParameterError("Bad parameter: size must be of type Int, received ".concat((0, _utils.getType)(params.size)));
|
|
1400
|
-
case
|
|
1400
|
+
case 11:
|
|
1401
1401
|
if (!(params.structure && !(0, _utils.isString)(params.structure))) {
|
|
1402
|
-
_context19.next =
|
|
1402
|
+
_context19.next = 12;
|
|
1403
1403
|
break;
|
|
1404
1404
|
}
|
|
1405
1405
|
throw new errors.InvalidParameterError("Bad parameter: structure must be of type String, received ".concat((0, _utils.getType)(params.structure)));
|
|
1406
|
-
case
|
|
1407
|
-
_context19.next =
|
|
1406
|
+
case 12:
|
|
1407
|
+
_context19.next = 13;
|
|
1408
1408
|
return _Api.default.sendRequest("/files/".concat(encodeURIComponent(params.path)), 'POST', params, options);
|
|
1409
|
-
case
|
|
1409
|
+
case 13:
|
|
1410
1410
|
response = _context19.sent;
|
|
1411
1411
|
return _context19.abrupt("return", new _File(response === null || response === void 0 ? void 0 : response.data, options));
|
|
1412
|
-
case
|
|
1412
|
+
case 14:
|
|
1413
1413
|
case "end":
|
|
1414
1414
|
return _context19.stop();
|
|
1415
1415
|
}
|
|
@@ -1430,42 +1430,42 @@ _File = File;
|
|
|
1430
1430
|
options,
|
|
1431
1431
|
response,
|
|
1432
1432
|
_args20 = arguments;
|
|
1433
|
-
return _regenerator.default.wrap(function
|
|
1433
|
+
return _regenerator.default.wrap(function (_context20) {
|
|
1434
1434
|
while (1) switch (_context20.prev = _context20.next) {
|
|
1435
1435
|
case 0:
|
|
1436
1436
|
params = _args20.length > 1 && _args20[1] !== undefined ? _args20[1] : {};
|
|
1437
1437
|
options = _args20.length > 2 && _args20[2] !== undefined ? _args20[2] : {};
|
|
1438
1438
|
if ((0, _utils.isObject)(params)) {
|
|
1439
|
-
_context20.next =
|
|
1439
|
+
_context20.next = 1;
|
|
1440
1440
|
break;
|
|
1441
1441
|
}
|
|
1442
1442
|
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
|
1443
|
-
case
|
|
1443
|
+
case 1:
|
|
1444
1444
|
params.path = path;
|
|
1445
1445
|
if (params.path) {
|
|
1446
|
-
_context20.next =
|
|
1446
|
+
_context20.next = 2;
|
|
1447
1447
|
break;
|
|
1448
1448
|
}
|
|
1449
1449
|
throw new errors.MissingParameterError('Parameter missing: path');
|
|
1450
|
-
case
|
|
1450
|
+
case 2:
|
|
1451
1451
|
if (!(params.path && !(0, _utils.isString)(params.path))) {
|
|
1452
|
-
_context20.next =
|
|
1452
|
+
_context20.next = 3;
|
|
1453
1453
|
break;
|
|
1454
1454
|
}
|
|
1455
1455
|
throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(params.path)));
|
|
1456
|
-
case
|
|
1456
|
+
case 3:
|
|
1457
1457
|
if (!(params.preview_size && !(0, _utils.isString)(params.preview_size))) {
|
|
1458
|
-
_context20.next =
|
|
1458
|
+
_context20.next = 4;
|
|
1459
1459
|
break;
|
|
1460
1460
|
}
|
|
1461
1461
|
throw new errors.InvalidParameterError("Bad parameter: preview_size must be of type String, received ".concat((0, _utils.getType)(params.preview_size)));
|
|
1462
|
-
case
|
|
1463
|
-
_context20.next =
|
|
1462
|
+
case 4:
|
|
1463
|
+
_context20.next = 5;
|
|
1464
1464
|
return _Api.default.sendRequest("/file_actions/metadata/".concat(encodeURIComponent(params.path)), 'GET', params, options);
|
|
1465
|
-
case
|
|
1465
|
+
case 5:
|
|
1466
1466
|
response = _context20.sent;
|
|
1467
1467
|
return _context20.abrupt("return", new _File(response === null || response === void 0 ? void 0 : response.data, options));
|
|
1468
|
-
case
|
|
1468
|
+
case 6:
|
|
1469
1469
|
case "end":
|
|
1470
1470
|
return _context20.stop();
|
|
1471
1471
|
}
|