files.com 1.0.235 → 1.0.237
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/docs/models/Bundle.md +9 -2
- package/docs/models/BundleNotification.md +35 -0
- package/docs/models/BundleRegistration.md +3 -1
- package/docs/models/InboxRegistration.md +3 -1
- package/docs/models/Site.md +2 -0
- package/lib/Api.js +153 -159
- package/lib/isomorphic/File.node.js +24 -28
- package/lib/models/ActionNotificationExport.js +97 -101
- package/lib/models/ActionNotificationExportResult.js +44 -46
- package/lib/models/ActionWebhookFailure.js +42 -44
- package/lib/models/ApiKey.js +271 -287
- package/lib/models/App.js +26 -28
- package/lib/models/As2IncomingMessage.js +32 -34
- package/lib/models/As2OutgoingMessage.js +32 -34
- package/lib/models/As2Partner.js +231 -241
- package/lib/models/As2Station.js +219 -229
- package/lib/models/Automation.js +333 -343
- package/lib/models/AutomationRun.js +75 -79
- package/lib/models/BandwidthSnapshot.js +26 -28
- package/lib/models/Behavior.js +323 -337
- package/lib/models/Bundle.js +381 -387
- package/lib/models/BundleDownload.js +38 -40
- package/lib/models/BundleNotification.js +223 -173
- package/lib/models/BundleRecipient.js +104 -108
- package/lib/models/BundleRegistration.js +41 -40
- package/lib/models/Clickwrap.js +213 -223
- package/lib/models/DnsRecord.js +26 -28
- package/lib/models/ExternalEvent.js +93 -99
- package/lib/models/File.js +726 -766
- package/lib/models/FileComment.js +180 -188
- package/lib/models/FileCommentReaction.js +84 -88
- package/lib/models/FileMigration.js +31 -33
- package/lib/models/Folder.js +94 -98
- package/lib/models/FormFieldSet.js +189 -199
- package/lib/models/Group.js +207 -217
- package/lib/models/GroupUser.js +230 -238
- package/lib/models/History.js +266 -276
- package/lib/models/HistoryExport.js +175 -179
- package/lib/models/HistoryExportResult.js +44 -46
- package/lib/models/InboxRecipient.js +104 -108
- package/lib/models/InboxRegistration.js +35 -34
- package/lib/models/InboxUpload.js +38 -40
- package/lib/models/Invoice.js +57 -61
- package/lib/models/IpAddress.js +78 -84
- package/lib/models/Lock.js +148 -154
- package/lib/models/Message.js +267 -277
- package/lib/models/MessageComment.js +207 -217
- package/lib/models/MessageCommentReaction.js +147 -155
- package/lib/models/MessageReaction.js +147 -155
- package/lib/models/Notification.js +255 -265
- package/lib/models/Payment.js +57 -61
- package/lib/models/Permission.js +128 -134
- package/lib/models/Priority.js +45 -47
- package/lib/models/Project.js +183 -193
- package/lib/models/PublicKey.js +207 -217
- package/lib/models/RemoteBandwidthSnapshot.js +26 -28
- package/lib/models/RemoteServer.js +805 -819
- package/lib/models/Request.js +166 -174
- package/lib/models/Session.js +47 -51
- package/lib/models/SettingsChange.js +26 -28
- package/lib/models/SftpHostKey.js +177 -187
- package/lib/models/Site.js +415 -418
- package/lib/models/SsoStrategy.js +99 -105
- package/lib/models/Style.js +127 -133
- package/lib/models/UsageDailySnapshot.js +26 -28
- package/lib/models/UsageSnapshot.js +26 -28
- package/lib/models/User.js +587 -603
- package/lib/models/UserCipherUse.js +32 -34
- package/lib/models/UserRequest.js +147 -155
- package/lib/models/WebhookTest.js +54 -56
- package/package.json +1 -1
- package/src/models/Bundle.js +10 -1
- package/src/models/BundleNotification.js +39 -1
- package/src/models/BundleRegistration.js +3 -0
- package/src/models/InboxRegistration.js +3 -0
- package/src/models/Site.js +3 -0
package/lib/models/File.js
CHANGED
@@ -39,28 +39,26 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
|
|
39
39
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(writableStream) {
|
40
40
|
var downloadUri, _require, saveUrlToStream;
|
41
41
|
return _regenerator.default.wrap(function _callee$(_context) {
|
42
|
-
while (1) {
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
return _context.stop();
|
63
|
-
}
|
42
|
+
while (1) switch (_context.prev = _context.next) {
|
43
|
+
case 0:
|
44
|
+
if (!(0, _utils.isBrowser)()) {
|
45
|
+
_context.next = 2;
|
46
|
+
break;
|
47
|
+
}
|
48
|
+
throw new errors.NotImplementedError('Stream downloads are only available in a NodeJS environment');
|
49
|
+
case 2:
|
50
|
+
downloadUri = _this.getDownloadUri();
|
51
|
+
if (downloadUri) {
|
52
|
+
_context.next = 5;
|
53
|
+
break;
|
54
|
+
}
|
55
|
+
throw new errors.EmptyPropertyError('Current object has no download URI');
|
56
|
+
case 5:
|
57
|
+
_require = require('../isomorphic/File.node.js'), saveUrlToStream = _require.saveUrlToStream;
|
58
|
+
return _context.abrupt("return", saveUrlToStream(downloadUri, writableStream));
|
59
|
+
case 7:
|
60
|
+
case "end":
|
61
|
+
return _context.stop();
|
64
62
|
}
|
65
63
|
}, _callee);
|
66
64
|
}));
|
@@ -72,28 +70,26 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
|
|
72
70
|
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(destinationPath) {
|
73
71
|
var downloadUri, _require2, saveUrlToFile;
|
74
72
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
75
|
-
while (1) {
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
return _context2.stop();
|
96
|
-
}
|
73
|
+
while (1) switch (_context2.prev = _context2.next) {
|
74
|
+
case 0:
|
75
|
+
if (!(0, _utils.isBrowser)()) {
|
76
|
+
_context2.next = 2;
|
77
|
+
break;
|
78
|
+
}
|
79
|
+
throw new errors.NotImplementedError('Disk file downloads are only available in a NodeJS environment');
|
80
|
+
case 2:
|
81
|
+
downloadUri = _this.getDownloadUri();
|
82
|
+
if (downloadUri) {
|
83
|
+
_context2.next = 5;
|
84
|
+
break;
|
85
|
+
}
|
86
|
+
throw new errors.EmptyPropertyError('Current object has no download URI');
|
87
|
+
case 5:
|
88
|
+
_require2 = require('../isomorphic/File.node.js'), saveUrlToFile = _require2.saveUrlToFile;
|
89
|
+
return _context2.abrupt("return", saveUrlToFile(downloadUri, destinationPath));
|
90
|
+
case 7:
|
91
|
+
case "end":
|
92
|
+
return _context2.stop();
|
97
93
|
}
|
98
94
|
}, _callee2);
|
99
95
|
}));
|
@@ -105,17 +101,15 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
|
|
105
101
|
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(destinationFilePath, options) {
|
106
102
|
var params;
|
107
103
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
108
|
-
while (1) {
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
return _context3.stop();
|
118
|
-
}
|
104
|
+
while (1) switch (_context3.prev = _context3.next) {
|
105
|
+
case 0:
|
106
|
+
params = {
|
107
|
+
destination: destinationFilePath
|
108
|
+
};
|
109
|
+
return _context3.abrupt("return", _Api.default.sendRequest("/file_actions/copy/".concat(encodeURIComponent(_this.path)), 'POST', params, options));
|
110
|
+
case 2:
|
111
|
+
case "end":
|
112
|
+
return _context3.stop();
|
119
113
|
}
|
120
114
|
}, _callee3);
|
121
115
|
}));
|
@@ -127,17 +121,15 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
|
|
127
121
|
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(destinationFilePath, options) {
|
128
122
|
var params;
|
129
123
|
return _regenerator.default.wrap(function _callee4$(_context4) {
|
130
|
-
while (1) {
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
return _context4.stop();
|
140
|
-
}
|
124
|
+
while (1) switch (_context4.prev = _context4.next) {
|
125
|
+
case 0:
|
126
|
+
params = {
|
127
|
+
destination: destinationFilePath
|
128
|
+
};
|
129
|
+
return _context4.abrupt("return", _Api.default.sendRequest("/file_actions/move/".concat(encodeURIComponent(_this.path)), 'POST', params, options));
|
130
|
+
case 2:
|
131
|
+
case "end":
|
132
|
+
return _context4.stop();
|
141
133
|
}
|
142
134
|
}, _callee4);
|
143
135
|
}));
|
@@ -309,64 +301,62 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
|
|
309
301
|
response,
|
310
302
|
_args5 = arguments;
|
311
303
|
return _regenerator.default.wrap(function _callee5$(_context5) {
|
312
|
-
while (1) {
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
if (params['path']) {
|
348
|
-
_context5.next = 18;
|
349
|
-
break;
|
350
|
-
}
|
351
|
-
if (!_this.attributes.path) {
|
352
|
-
_context5.next = 17;
|
353
|
-
break;
|
354
|
-
}
|
355
|
-
params['path'] = _this.path;
|
304
|
+
while (1) switch (_context5.prev = _context5.next) {
|
305
|
+
case 0:
|
306
|
+
params = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {};
|
307
|
+
if (_this.attributes.path) {
|
308
|
+
_context5.next = 3;
|
309
|
+
break;
|
310
|
+
}
|
311
|
+
throw new errors.EmptyPropertyError('Current object has no path');
|
312
|
+
case 3:
|
313
|
+
if ((0, _utils.isObject)(params)) {
|
314
|
+
_context5.next = 5;
|
315
|
+
break;
|
316
|
+
}
|
317
|
+
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
318
|
+
case 5:
|
319
|
+
params.path = _this.attributes.path;
|
320
|
+
if (!(params['path'] && !(0, _utils.isString)(params['path']))) {
|
321
|
+
_context5.next = 8;
|
322
|
+
break;
|
323
|
+
}
|
324
|
+
throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(path)));
|
325
|
+
case 8:
|
326
|
+
if (!(params['action'] && !(0, _utils.isString)(params['action']))) {
|
327
|
+
_context5.next = 10;
|
328
|
+
break;
|
329
|
+
}
|
330
|
+
throw new errors.InvalidParameterError("Bad parameter: action must be of type String, received ".concat((0, _utils.getType)(action)));
|
331
|
+
case 10:
|
332
|
+
if (!(params['preview_size'] && !(0, _utils.isString)(params['preview_size']))) {
|
333
|
+
_context5.next = 12;
|
334
|
+
break;
|
335
|
+
}
|
336
|
+
throw new errors.InvalidParameterError("Bad parameter: preview_size must be of type String, received ".concat((0, _utils.getType)(preview_size)));
|
337
|
+
case 12:
|
338
|
+
if (params['path']) {
|
356
339
|
_context5.next = 18;
|
357
340
|
break;
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
341
|
+
}
|
342
|
+
if (!_this.attributes.path) {
|
343
|
+
_context5.next = 17;
|
344
|
+
break;
|
345
|
+
}
|
346
|
+
params['path'] = _this.path;
|
347
|
+
_context5.next = 18;
|
348
|
+
break;
|
349
|
+
case 17:
|
350
|
+
throw new errors.MissingParameterError('Parameter missing: path');
|
351
|
+
case 18:
|
352
|
+
_context5.next = 20;
|
353
|
+
return _Api.default.sendRequest("/files/".concat(encodeURIComponent(params['path'])), 'GET', params, _this.options);
|
354
|
+
case 20:
|
355
|
+
response = _context5.sent;
|
356
|
+
return _context5.abrupt("return", new File(response === null || response === void 0 ? void 0 : response.data, _this.options));
|
357
|
+
case 22:
|
358
|
+
case "end":
|
359
|
+
return _context5.stop();
|
370
360
|
}
|
371
361
|
}, _callee5);
|
372
362
|
})));
|
@@ -375,64 +365,62 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
|
|
375
365
|
response,
|
376
366
|
_args6 = arguments;
|
377
367
|
return _regenerator.default.wrap(function _callee6$(_context6) {
|
378
|
-
while (1) {
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
if (params['path']) {
|
414
|
-
_context6.next = 18;
|
415
|
-
break;
|
416
|
-
}
|
417
|
-
if (!_this.attributes.path) {
|
418
|
-
_context6.next = 17;
|
419
|
-
break;
|
420
|
-
}
|
421
|
-
params['path'] = _this.path;
|
368
|
+
while (1) switch (_context6.prev = _context6.next) {
|
369
|
+
case 0:
|
370
|
+
params = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {};
|
371
|
+
if (_this.attributes.path) {
|
372
|
+
_context6.next = 3;
|
373
|
+
break;
|
374
|
+
}
|
375
|
+
throw new errors.EmptyPropertyError('Current object has no path');
|
376
|
+
case 3:
|
377
|
+
if ((0, _utils.isObject)(params)) {
|
378
|
+
_context6.next = 5;
|
379
|
+
break;
|
380
|
+
}
|
381
|
+
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
382
|
+
case 5:
|
383
|
+
params.path = _this.attributes.path;
|
384
|
+
if (!(params['path'] && !(0, _utils.isString)(params['path']))) {
|
385
|
+
_context6.next = 8;
|
386
|
+
break;
|
387
|
+
}
|
388
|
+
throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(path)));
|
389
|
+
case 8:
|
390
|
+
if (!(params['provided_mtime'] && !(0, _utils.isString)(params['provided_mtime']))) {
|
391
|
+
_context6.next = 10;
|
392
|
+
break;
|
393
|
+
}
|
394
|
+
throw new errors.InvalidParameterError("Bad parameter: provided_mtime must be of type String, received ".concat((0, _utils.getType)(provided_mtime)));
|
395
|
+
case 10:
|
396
|
+
if (!(params['priority_color'] && !(0, _utils.isString)(params['priority_color']))) {
|
397
|
+
_context6.next = 12;
|
398
|
+
break;
|
399
|
+
}
|
400
|
+
throw new errors.InvalidParameterError("Bad parameter: priority_color must be of type String, received ".concat((0, _utils.getType)(priority_color)));
|
401
|
+
case 12:
|
402
|
+
if (params['path']) {
|
422
403
|
_context6.next = 18;
|
423
404
|
break;
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
405
|
+
}
|
406
|
+
if (!_this.attributes.path) {
|
407
|
+
_context6.next = 17;
|
408
|
+
break;
|
409
|
+
}
|
410
|
+
params['path'] = _this.path;
|
411
|
+
_context6.next = 18;
|
412
|
+
break;
|
413
|
+
case 17:
|
414
|
+
throw new errors.MissingParameterError('Parameter missing: path');
|
415
|
+
case 18:
|
416
|
+
_context6.next = 20;
|
417
|
+
return _Api.default.sendRequest("/files/".concat(encodeURIComponent(params['path'])), 'PATCH', params, _this.options);
|
418
|
+
case 20:
|
419
|
+
response = _context6.sent;
|
420
|
+
return _context6.abrupt("return", new File(response === null || response === void 0 ? void 0 : response.data, _this.options));
|
421
|
+
case 22:
|
422
|
+
case "end":
|
423
|
+
return _context6.stop();
|
436
424
|
}
|
437
425
|
}, _callee6);
|
438
426
|
})));
|
@@ -441,52 +429,50 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
|
|
441
429
|
response,
|
442
430
|
_args7 = arguments;
|
443
431
|
return _regenerator.default.wrap(function _callee7$(_context7) {
|
444
|
-
while (1) {
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
if (params['path']) {
|
468
|
-
_context7.next = 14;
|
469
|
-
break;
|
470
|
-
}
|
471
|
-
if (!_this.attributes.path) {
|
472
|
-
_context7.next = 13;
|
473
|
-
break;
|
474
|
-
}
|
475
|
-
params['path'] = _this.path;
|
432
|
+
while (1) switch (_context7.prev = _context7.next) {
|
433
|
+
case 0:
|
434
|
+
params = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : {};
|
435
|
+
if (_this.attributes.path) {
|
436
|
+
_context7.next = 3;
|
437
|
+
break;
|
438
|
+
}
|
439
|
+
throw new errors.EmptyPropertyError('Current object has no path');
|
440
|
+
case 3:
|
441
|
+
if ((0, _utils.isObject)(params)) {
|
442
|
+
_context7.next = 5;
|
443
|
+
break;
|
444
|
+
}
|
445
|
+
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
446
|
+
case 5:
|
447
|
+
params.path = _this.attributes.path;
|
448
|
+
if (!(params['path'] && !(0, _utils.isString)(params['path']))) {
|
449
|
+
_context7.next = 8;
|
450
|
+
break;
|
451
|
+
}
|
452
|
+
throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(path)));
|
453
|
+
case 8:
|
454
|
+
if (params['path']) {
|
476
455
|
_context7.next = 14;
|
477
456
|
break;
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
457
|
+
}
|
458
|
+
if (!_this.attributes.path) {
|
459
|
+
_context7.next = 13;
|
460
|
+
break;
|
461
|
+
}
|
462
|
+
params['path'] = _this.path;
|
463
|
+
_context7.next = 14;
|
464
|
+
break;
|
465
|
+
case 13:
|
466
|
+
throw new errors.MissingParameterError('Parameter missing: path');
|
467
|
+
case 14:
|
468
|
+
_context7.next = 16;
|
469
|
+
return _Api.default.sendRequest("/files/".concat(encodeURIComponent(params['path'])), 'DELETE', params, _this.options);
|
470
|
+
case 16:
|
471
|
+
response = _context7.sent;
|
472
|
+
return _context7.abrupt("return", response === null || response === void 0 ? void 0 : response.data);
|
473
|
+
case 18:
|
474
|
+
case "end":
|
475
|
+
return _context7.stop();
|
490
476
|
}
|
491
477
|
}, _callee7);
|
492
478
|
})));
|
@@ -499,72 +485,70 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
|
|
499
485
|
response,
|
500
486
|
_args8 = arguments;
|
501
487
|
return _regenerator.default.wrap(function _callee8$(_context8) {
|
502
|
-
while (1) {
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
if (params['path']) {
|
532
|
-
_context8.next = 16;
|
533
|
-
break;
|
534
|
-
}
|
535
|
-
if (!_this.attributes.path) {
|
536
|
-
_context8.next = 15;
|
537
|
-
break;
|
538
|
-
}
|
539
|
-
params['path'] = _this.path;
|
488
|
+
while (1) switch (_context8.prev = _context8.next) {
|
489
|
+
case 0:
|
490
|
+
params = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {};
|
491
|
+
if (_this.attributes.path) {
|
492
|
+
_context8.next = 3;
|
493
|
+
break;
|
494
|
+
}
|
495
|
+
throw new errors.EmptyPropertyError('Current object has no path');
|
496
|
+
case 3:
|
497
|
+
if ((0, _utils.isObject)(params)) {
|
498
|
+
_context8.next = 5;
|
499
|
+
break;
|
500
|
+
}
|
501
|
+
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
502
|
+
case 5:
|
503
|
+
params.path = _this.attributes.path;
|
504
|
+
if (!(params['path'] && !(0, _utils.isString)(params['path']))) {
|
505
|
+
_context8.next = 8;
|
506
|
+
break;
|
507
|
+
}
|
508
|
+
throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(path)));
|
509
|
+
case 8:
|
510
|
+
if (!(params['destination'] && !(0, _utils.isString)(params['destination']))) {
|
511
|
+
_context8.next = 10;
|
512
|
+
break;
|
513
|
+
}
|
514
|
+
throw new errors.InvalidParameterError("Bad parameter: destination must be of type String, received ".concat((0, _utils.getType)(destination)));
|
515
|
+
case 10:
|
516
|
+
if (params['path']) {
|
540
517
|
_context8.next = 16;
|
541
518
|
break;
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
519
|
+
}
|
520
|
+
if (!_this.attributes.path) {
|
521
|
+
_context8.next = 15;
|
522
|
+
break;
|
523
|
+
}
|
524
|
+
params['path'] = _this.path;
|
525
|
+
_context8.next = 16;
|
526
|
+
break;
|
527
|
+
case 15:
|
528
|
+
throw new errors.MissingParameterError('Parameter missing: path');
|
529
|
+
case 16:
|
530
|
+
if (params['destination']) {
|
554
531
|
_context8.next = 22;
|
555
532
|
break;
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
533
|
+
}
|
534
|
+
if (!_this.attributes.destination) {
|
535
|
+
_context8.next = 21;
|
536
|
+
break;
|
537
|
+
}
|
538
|
+
params['destination'] = _this.destination;
|
539
|
+
_context8.next = 22;
|
540
|
+
break;
|
541
|
+
case 21:
|
542
|
+
throw new errors.MissingParameterError('Parameter missing: destination');
|
543
|
+
case 22:
|
544
|
+
_context8.next = 24;
|
545
|
+
return _Api.default.sendRequest("/file_actions/copy/".concat(encodeURIComponent(params['path'])), 'POST', params, _this.options);
|
546
|
+
case 24:
|
547
|
+
response = _context8.sent;
|
548
|
+
return _context8.abrupt("return", new _FileAction.default(response === null || response === void 0 ? void 0 : response.data, _this.options));
|
549
|
+
case 26:
|
550
|
+
case "end":
|
551
|
+
return _context8.stop();
|
568
552
|
}
|
569
553
|
}, _callee8);
|
570
554
|
})));
|
@@ -573,72 +557,70 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
|
|
573
557
|
response,
|
574
558
|
_args9 = arguments;
|
575
559
|
return _regenerator.default.wrap(function _callee9$(_context9) {
|
576
|
-
while (1) {
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
if (params['path']) {
|
606
|
-
_context9.next = 16;
|
607
|
-
break;
|
608
|
-
}
|
609
|
-
if (!_this.attributes.path) {
|
610
|
-
_context9.next = 15;
|
611
|
-
break;
|
612
|
-
}
|
613
|
-
params['path'] = _this.path;
|
560
|
+
while (1) switch (_context9.prev = _context9.next) {
|
561
|
+
case 0:
|
562
|
+
params = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : {};
|
563
|
+
if (_this.attributes.path) {
|
564
|
+
_context9.next = 3;
|
565
|
+
break;
|
566
|
+
}
|
567
|
+
throw new errors.EmptyPropertyError('Current object has no path');
|
568
|
+
case 3:
|
569
|
+
if ((0, _utils.isObject)(params)) {
|
570
|
+
_context9.next = 5;
|
571
|
+
break;
|
572
|
+
}
|
573
|
+
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
574
|
+
case 5:
|
575
|
+
params.path = _this.attributes.path;
|
576
|
+
if (!(params['path'] && !(0, _utils.isString)(params['path']))) {
|
577
|
+
_context9.next = 8;
|
578
|
+
break;
|
579
|
+
}
|
580
|
+
throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(path)));
|
581
|
+
case 8:
|
582
|
+
if (!(params['destination'] && !(0, _utils.isString)(params['destination']))) {
|
583
|
+
_context9.next = 10;
|
584
|
+
break;
|
585
|
+
}
|
586
|
+
throw new errors.InvalidParameterError("Bad parameter: destination must be of type String, received ".concat((0, _utils.getType)(destination)));
|
587
|
+
case 10:
|
588
|
+
if (params['path']) {
|
614
589
|
_context9.next = 16;
|
615
590
|
break;
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
591
|
+
}
|
592
|
+
if (!_this.attributes.path) {
|
593
|
+
_context9.next = 15;
|
594
|
+
break;
|
595
|
+
}
|
596
|
+
params['path'] = _this.path;
|
597
|
+
_context9.next = 16;
|
598
|
+
break;
|
599
|
+
case 15:
|
600
|
+
throw new errors.MissingParameterError('Parameter missing: path');
|
601
|
+
case 16:
|
602
|
+
if (params['destination']) {
|
628
603
|
_context9.next = 22;
|
629
604
|
break;
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
605
|
+
}
|
606
|
+
if (!_this.attributes.destination) {
|
607
|
+
_context9.next = 21;
|
608
|
+
break;
|
609
|
+
}
|
610
|
+
params['destination'] = _this.destination;
|
611
|
+
_context9.next = 22;
|
612
|
+
break;
|
613
|
+
case 21:
|
614
|
+
throw new errors.MissingParameterError('Parameter missing: destination');
|
615
|
+
case 22:
|
616
|
+
_context9.next = 24;
|
617
|
+
return _Api.default.sendRequest("/file_actions/move/".concat(encodeURIComponent(params['path'])), 'POST', params, _this.options);
|
618
|
+
case 24:
|
619
|
+
response = _context9.sent;
|
620
|
+
return _context9.abrupt("return", new _FileAction.default(response === null || response === void 0 ? void 0 : response.data, _this.options));
|
621
|
+
case 26:
|
622
|
+
case "end":
|
623
|
+
return _context9.stop();
|
642
624
|
}
|
643
625
|
}, _callee9);
|
644
626
|
})));
|
@@ -648,84 +630,82 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
|
|
648
630
|
response,
|
649
631
|
_args10 = arguments;
|
650
632
|
return _regenerator.default.wrap(function _callee10$(_context10) {
|
651
|
-
while (1) {
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
if (params['path']) {
|
705
|
-
_context10.next = 24;
|
706
|
-
break;
|
707
|
-
}
|
708
|
-
if (!_this.attributes.path) {
|
709
|
-
_context10.next = 23;
|
710
|
-
break;
|
711
|
-
}
|
712
|
-
params['path'] = _this.path;
|
633
|
+
while (1) switch (_context10.prev = _context10.next) {
|
634
|
+
case 0:
|
635
|
+
params = _args10.length > 0 && _args10[0] !== undefined ? _args10[0] : {};
|
636
|
+
if (_this.attributes.path) {
|
637
|
+
_context10.next = 3;
|
638
|
+
break;
|
639
|
+
}
|
640
|
+
throw new errors.EmptyPropertyError('Current object has no path');
|
641
|
+
case 3:
|
642
|
+
if ((0, _utils.isObject)(params)) {
|
643
|
+
_context10.next = 5;
|
644
|
+
break;
|
645
|
+
}
|
646
|
+
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
647
|
+
case 5:
|
648
|
+
params.path = _this.attributes.path;
|
649
|
+
if (!(params['path'] && !(0, _utils.isString)(params['path']))) {
|
650
|
+
_context10.next = 8;
|
651
|
+
break;
|
652
|
+
}
|
653
|
+
throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(path)));
|
654
|
+
case 8:
|
655
|
+
if (!(params['part'] && !(0, _utils.isInt)(params['part']))) {
|
656
|
+
_context10.next = 10;
|
657
|
+
break;
|
658
|
+
}
|
659
|
+
throw new errors.InvalidParameterError("Bad parameter: part must be of type Int, received ".concat((0, _utils.getType)(part)));
|
660
|
+
case 10:
|
661
|
+
if (!(params['parts'] && !(0, _utils.isInt)(params['parts']))) {
|
662
|
+
_context10.next = 12;
|
663
|
+
break;
|
664
|
+
}
|
665
|
+
throw new errors.InvalidParameterError("Bad parameter: parts must be of type Int, received ".concat((0, _utils.getType)(parts)));
|
666
|
+
case 12:
|
667
|
+
if (!(params['ref'] && !(0, _utils.isString)(params['ref']))) {
|
668
|
+
_context10.next = 14;
|
669
|
+
break;
|
670
|
+
}
|
671
|
+
throw new errors.InvalidParameterError("Bad parameter: ref must be of type String, received ".concat((0, _utils.getType)(ref)));
|
672
|
+
case 14:
|
673
|
+
if (!(params['restart'] && !(0, _utils.isInt)(params['restart']))) {
|
674
|
+
_context10.next = 16;
|
675
|
+
break;
|
676
|
+
}
|
677
|
+
throw new errors.InvalidParameterError("Bad parameter: restart must be of type Int, received ".concat((0, _utils.getType)(restart)));
|
678
|
+
case 16:
|
679
|
+
if (!(params['size'] && !(0, _utils.isInt)(params['size']))) {
|
680
|
+
_context10.next = 18;
|
681
|
+
break;
|
682
|
+
}
|
683
|
+
throw new errors.InvalidParameterError("Bad parameter: size must be of type Int, received ".concat((0, _utils.getType)(size)));
|
684
|
+
case 18:
|
685
|
+
if (params['path']) {
|
713
686
|
_context10.next = 24;
|
714
687
|
break;
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
688
|
+
}
|
689
|
+
if (!_this.attributes.path) {
|
690
|
+
_context10.next = 23;
|
691
|
+
break;
|
692
|
+
}
|
693
|
+
params['path'] = _this.path;
|
694
|
+
_context10.next = 24;
|
695
|
+
break;
|
696
|
+
case 23:
|
697
|
+
throw new errors.MissingParameterError('Parameter missing: path');
|
698
|
+
case 24:
|
699
|
+
_context10.next = 26;
|
700
|
+
return _Api.default.sendRequest("/file_actions/begin_upload/".concat(encodeURIComponent(params['path'])), 'POST', params, _this.options);
|
701
|
+
case 26:
|
702
|
+
response = _context10.sent;
|
703
|
+
return _context10.abrupt("return", (response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.map(function (obj) {
|
704
|
+
return new _FileUploadPart.default(obj, _this.options);
|
705
|
+
})) || []);
|
706
|
+
case 28:
|
707
|
+
case "end":
|
708
|
+
return _context10.stop();
|
729
709
|
}
|
730
710
|
}, _callee10);
|
731
711
|
})));
|
@@ -751,31 +731,29 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
|
|
751
731
|
var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(path, paramsRaw, options) {
|
752
732
|
var params, response, partData;
|
753
733
|
return _regenerator.default.wrap(function _callee11$(_context11) {
|
754
|
-
while (1) {
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
return _context11.stop();
|
778
|
-
}
|
734
|
+
while (1) switch (_context11.prev = _context11.next) {
|
735
|
+
case 0:
|
736
|
+
params = _objectSpread(_objectSpread({}, paramsRaw), {}, {
|
737
|
+
action: 'put'
|
738
|
+
});
|
739
|
+
_context11.next = 3;
|
740
|
+
return _Api.default.sendRequest("/files/".concat(encodeURIComponent(path)), 'POST', params, options);
|
741
|
+
case 3:
|
742
|
+
response = _context11.sent;
|
743
|
+
if (response) {
|
744
|
+
_context11.next = 6;
|
745
|
+
break;
|
746
|
+
}
|
747
|
+
return _context11.abrupt("return", null);
|
748
|
+
case 6:
|
749
|
+
partData = _objectSpread(_objectSpread({}, response.data), {}, {
|
750
|
+
headers: response.headers,
|
751
|
+
parameters: params
|
752
|
+
});
|
753
|
+
return _context11.abrupt("return", new _FileUploadPart.default(partData));
|
754
|
+
case 8:
|
755
|
+
case "end":
|
756
|
+
return _context11.stop();
|
779
757
|
}
|
780
758
|
}, _callee11);
|
781
759
|
}));
|
@@ -787,33 +765,31 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
|
|
787
765
|
var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(path, partNumber, firstFileUploadPart, options) {
|
788
766
|
var params, response, partData;
|
789
767
|
return _regenerator.default.wrap(function _callee12$(_context12) {
|
790
|
-
while (1) {
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
return _context12.stop();
|
816
|
-
}
|
768
|
+
while (1) switch (_context12.prev = _context12.next) {
|
769
|
+
case 0:
|
770
|
+
params = {
|
771
|
+
action: 'put',
|
772
|
+
part: partNumber,
|
773
|
+
ref: firstFileUploadPart.ref
|
774
|
+
};
|
775
|
+
_context12.next = 3;
|
776
|
+
return _Api.default.sendRequest("/files/".concat(encodeURIComponent(path)), 'POST', params, options);
|
777
|
+
case 3:
|
778
|
+
response = _context12.sent;
|
779
|
+
if (response) {
|
780
|
+
_context12.next = 6;
|
781
|
+
break;
|
782
|
+
}
|
783
|
+
return _context12.abrupt("return", null);
|
784
|
+
case 6:
|
785
|
+
partData = _objectSpread(_objectSpread({}, response.data), {}, {
|
786
|
+
headers: response.headers,
|
787
|
+
parameters: params
|
788
|
+
});
|
789
|
+
return _context12.abrupt("return", new _FileUploadPart.default(partData));
|
790
|
+
case 8:
|
791
|
+
case "end":
|
792
|
+
return _context12.stop();
|
817
793
|
}
|
818
794
|
}, _callee12);
|
819
795
|
}));
|
@@ -825,18 +801,16 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
|
|
825
801
|
var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(firstFileUploadPart, options) {
|
826
802
|
var params;
|
827
803
|
return _regenerator.default.wrap(function _callee13$(_context13) {
|
828
|
-
while (1) {
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
return _context13.stop();
|
839
|
-
}
|
804
|
+
while (1) switch (_context13.prev = _context13.next) {
|
805
|
+
case 0:
|
806
|
+
params = {
|
807
|
+
action: 'end',
|
808
|
+
ref: firstFileUploadPart.ref
|
809
|
+
};
|
810
|
+
return _context13.abrupt("return", _Api.default.sendRequest("/files/".concat(encodeURIComponent(firstFileUploadPart.path)), 'POST', params, options));
|
811
|
+
case 2:
|
812
|
+
case "end":
|
813
|
+
return _context13.stop();
|
840
814
|
}
|
841
815
|
}, _callee13);
|
842
816
|
}));
|
@@ -848,132 +822,126 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
|
|
848
822
|
var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16(destinationPath, readableStream, params, options) {
|
849
823
|
var firstFileUploadPart, file;
|
850
824
|
return _regenerator.default.wrap(function _callee16$(_context16) {
|
851
|
-
while (1) {
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
var
|
876
|
-
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
if (!(excessLength > 0)) {
|
886
|
-
_context14.next = 19;
|
887
|
-
break;
|
888
|
-
}
|
889
|
-
readableStream.pause();
|
890
|
-
lastChunkForPart = chunkBuffer.subarray(0, excessLength);
|
891
|
-
firstChunkForNextPart = chunkBuffer.subarray(excessLength);
|
892
|
-
chunks.push(lastChunkForPart);
|
893
|
-
buffer = _safeBuffer.Buffer.concat(chunks);
|
894
|
-
_context14.next = 12;
|
895
|
-
return File._continueUpload(destinationPath, ++part, firstFileUploadPart, options);
|
896
|
-
case 12:
|
897
|
-
nextFileUploadPart = _context14.sent;
|
898
|
-
concurrentUploads.push(_Api.default.sendFilePart(nextFileUploadPart.upload_uri, 'PUT', buffer));
|
899
|
-
chunks = [firstChunkForNextPart];
|
900
|
-
length = 1;
|
901
|
-
readableStream.resume();
|
902
|
-
_context14.next = 21;
|
903
|
-
break;
|
904
|
-
case 19:
|
905
|
-
chunks.push(chunkBuffer);
|
906
|
-
length += chunk.length;
|
907
|
-
case 21:
|
908
|
-
_context14.next = 26;
|
909
|
-
break;
|
910
|
-
case 23:
|
911
|
-
_context14.prev = 23;
|
912
|
-
_context14.t0 = _context14["catch"](0);
|
913
|
-
reject(_context14.t0);
|
914
|
-
case 26:
|
915
|
-
case "end":
|
916
|
-
return _context14.stop();
|
917
|
-
}
|
918
|
-
}
|
919
|
-
}, _callee14, null, [[0, 23]]);
|
920
|
-
}));
|
921
|
-
return function (_x20) {
|
922
|
-
return _ref17.apply(this, arguments);
|
923
|
-
};
|
924
|
-
}());
|
925
|
-
readableStream.on('end', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15() {
|
926
|
-
var buffer, nextFileUploadPart, response, createdFile;
|
927
|
-
return _regenerator.default.wrap(function _callee15$(_context15) {
|
928
|
-
while (1) {
|
929
|
-
switch (_context15.prev = _context15.next) {
|
930
|
-
case 0:
|
931
|
-
_context15.prev = 0;
|
932
|
-
if (!(chunks.length > 0)) {
|
933
|
-
_context15.next = 7;
|
934
|
-
break;
|
935
|
-
}
|
936
|
-
buffer = _safeBuffer.Buffer.concat(chunks);
|
937
|
-
_context15.next = 5;
|
938
|
-
return File._continueUpload(destinationPath, ++part, firstFileUploadPart, options);
|
939
|
-
case 5:
|
940
|
-
nextFileUploadPart = _context15.sent;
|
941
|
-
concurrentUploads.push(_Api.default.sendFilePart(nextFileUploadPart.upload_uri, 'PUT', buffer));
|
942
|
-
case 7:
|
943
|
-
_context15.next = 9;
|
944
|
-
return Promise.all(concurrentUploads);
|
945
|
-
case 9:
|
946
|
-
_context15.next = 11;
|
947
|
-
return File._completeUpload(firstFileUploadPart, options);
|
948
|
-
case 11:
|
949
|
-
response = _context15.sent;
|
950
|
-
createdFile = new File(response.data, options);
|
951
|
-
resolve(createdFile);
|
952
|
-
_context15.next = 19;
|
825
|
+
while (1) switch (_context16.prev = _context16.next) {
|
826
|
+
case 0:
|
827
|
+
_context16.next = 2;
|
828
|
+
return File._openUpload(destinationPath, params, options);
|
829
|
+
case 2:
|
830
|
+
firstFileUploadPart = _context16.sent;
|
831
|
+
if (firstFileUploadPart) {
|
832
|
+
_context16.next = 5;
|
833
|
+
break;
|
834
|
+
}
|
835
|
+
return _context16.abrupt("return");
|
836
|
+
case 5:
|
837
|
+
_context16.prev = 5;
|
838
|
+
_context16.next = 8;
|
839
|
+
return new Promise(function (resolve, reject) {
|
840
|
+
var part = 0;
|
841
|
+
var chunks = [];
|
842
|
+
var length = 0;
|
843
|
+
var concurrentUploads = [];
|
844
|
+
readableStream.on('error', function (error) {
|
845
|
+
reject(error);
|
846
|
+
});
|
847
|
+
readableStream.on('data', /*#__PURE__*/function () {
|
848
|
+
var _ref17 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(chunk) {
|
849
|
+
var nextLength, excessLength, chunkBuffer, lastChunkForPart, firstChunkForNextPart, buffer, nextFileUploadPart;
|
850
|
+
return _regenerator.default.wrap(function _callee14$(_context14) {
|
851
|
+
while (1) switch (_context14.prev = _context14.next) {
|
852
|
+
case 0:
|
853
|
+
_context14.prev = 0;
|
854
|
+
nextLength = length + chunk.length;
|
855
|
+
excessLength = nextLength - firstFileUploadPart.partsize;
|
856
|
+
chunkBuffer = _safeBuffer.Buffer.from(chunk);
|
857
|
+
if (!(excessLength > 0)) {
|
858
|
+
_context14.next = 19;
|
953
859
|
break;
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
860
|
+
}
|
861
|
+
readableStream.pause();
|
862
|
+
lastChunkForPart = chunkBuffer.subarray(0, excessLength);
|
863
|
+
firstChunkForNextPart = chunkBuffer.subarray(excessLength);
|
864
|
+
chunks.push(lastChunkForPart);
|
865
|
+
buffer = _safeBuffer.Buffer.concat(chunks);
|
866
|
+
_context14.next = 12;
|
867
|
+
return File._continueUpload(destinationPath, ++part, firstFileUploadPart, options);
|
868
|
+
case 12:
|
869
|
+
nextFileUploadPart = _context14.sent;
|
870
|
+
concurrentUploads.push(_Api.default.sendFilePart(nextFileUploadPart.upload_uri, 'PUT', buffer));
|
871
|
+
chunks = [firstChunkForNextPart];
|
872
|
+
length = 1;
|
873
|
+
readableStream.resume();
|
874
|
+
_context14.next = 21;
|
875
|
+
break;
|
876
|
+
case 19:
|
877
|
+
chunks.push(chunkBuffer);
|
878
|
+
length += chunk.length;
|
879
|
+
case 21:
|
880
|
+
_context14.next = 26;
|
881
|
+
break;
|
882
|
+
case 23:
|
883
|
+
_context14.prev = 23;
|
884
|
+
_context14.t0 = _context14["catch"](0);
|
885
|
+
reject(_context14.t0);
|
886
|
+
case 26:
|
887
|
+
case "end":
|
888
|
+
return _context14.stop();
|
962
889
|
}
|
963
|
-
},
|
964
|
-
}))
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
|
976
|
-
|
890
|
+
}, _callee14, null, [[0, 23]]);
|
891
|
+
}));
|
892
|
+
return function (_x20) {
|
893
|
+
return _ref17.apply(this, arguments);
|
894
|
+
};
|
895
|
+
}());
|
896
|
+
readableStream.on('end', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15() {
|
897
|
+
var buffer, nextFileUploadPart, response, createdFile;
|
898
|
+
return _regenerator.default.wrap(function _callee15$(_context15) {
|
899
|
+
while (1) switch (_context15.prev = _context15.next) {
|
900
|
+
case 0:
|
901
|
+
_context15.prev = 0;
|
902
|
+
if (!(chunks.length > 0)) {
|
903
|
+
_context15.next = 7;
|
904
|
+
break;
|
905
|
+
}
|
906
|
+
buffer = _safeBuffer.Buffer.concat(chunks);
|
907
|
+
_context15.next = 5;
|
908
|
+
return File._continueUpload(destinationPath, ++part, firstFileUploadPart, options);
|
909
|
+
case 5:
|
910
|
+
nextFileUploadPart = _context15.sent;
|
911
|
+
concurrentUploads.push(_Api.default.sendFilePart(nextFileUploadPart.upload_uri, 'PUT', buffer));
|
912
|
+
case 7:
|
913
|
+
_context15.next = 9;
|
914
|
+
return Promise.all(concurrentUploads);
|
915
|
+
case 9:
|
916
|
+
_context15.next = 11;
|
917
|
+
return File._completeUpload(firstFileUploadPart, options);
|
918
|
+
case 11:
|
919
|
+
response = _context15.sent;
|
920
|
+
createdFile = new File(response.data, options);
|
921
|
+
resolve(createdFile);
|
922
|
+
_context15.next = 19;
|
923
|
+
break;
|
924
|
+
case 16:
|
925
|
+
_context15.prev = 16;
|
926
|
+
_context15.t0 = _context15["catch"](0);
|
927
|
+
reject(_context15.t0);
|
928
|
+
case 19:
|
929
|
+
case "end":
|
930
|
+
return _context15.stop();
|
931
|
+
}
|
932
|
+
}, _callee15, null, [[0, 16]]);
|
933
|
+
})));
|
934
|
+
});
|
935
|
+
case 8:
|
936
|
+
file = _context16.sent;
|
937
|
+
return _context16.abrupt("return", file);
|
938
|
+
case 12:
|
939
|
+
_context16.prev = 12;
|
940
|
+
_context16.t0 = _context16["catch"](5);
|
941
|
+
errors.handleErrorResponse(_context16.t0);
|
942
|
+
case 15:
|
943
|
+
case "end":
|
944
|
+
return _context16.stop();
|
977
945
|
}
|
978
946
|
}, _callee16, null, [[5, 12]]);
|
979
947
|
}));
|
@@ -984,20 +952,18 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
|
|
984
952
|
(0, _defineProperty2.default)(File, "uploadData", /*#__PURE__*/function () {
|
985
953
|
var _ref19 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(destinationPath, data, params, options) {
|
986
954
|
return _regenerator.default.wrap(function _callee17$(_context17) {
|
987
|
-
while (1) {
|
988
|
-
|
989
|
-
|
990
|
-
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
return _context17.stop();
|
1000
|
-
}
|
955
|
+
while (1) switch (_context17.prev = _context17.next) {
|
956
|
+
case 0:
|
957
|
+
if (data) {
|
958
|
+
_context17.next = 2;
|
959
|
+
break;
|
960
|
+
}
|
961
|
+
throw new errors.MissingParameterError('Upload data was not provided');
|
962
|
+
case 2:
|
963
|
+
return _context17.abrupt("return", File.uploadStream(destinationPath, _readableStream.default.from(data), params, options));
|
964
|
+
case 3:
|
965
|
+
case "end":
|
966
|
+
return _context17.stop();
|
1001
967
|
}
|
1002
968
|
}, _callee17);
|
1003
969
|
}));
|
@@ -1009,22 +975,20 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
|
|
1009
975
|
var _ref20 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(destinationPath, sourceFilePath, params, options) {
|
1010
976
|
var _require3, openDiskFileReadStream, stream;
|
1011
977
|
return _regenerator.default.wrap(function _callee18$(_context18) {
|
1012
|
-
while (1) {
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
1026
|
-
return _context18.stop();
|
1027
|
-
}
|
978
|
+
while (1) switch (_context18.prev = _context18.next) {
|
979
|
+
case 0:
|
980
|
+
if (!(0, _utils.isBrowser)()) {
|
981
|
+
_context18.next = 2;
|
982
|
+
break;
|
983
|
+
}
|
984
|
+
throw new errors.NotImplementedError('Disk file uploads are only available in a NodeJS environment');
|
985
|
+
case 2:
|
986
|
+
_require3 = require('../isomorphic/File.node.js'), openDiskFileReadStream = _require3.openDiskFileReadStream;
|
987
|
+
stream = openDiskFileReadStream(sourceFilePath);
|
988
|
+
return _context18.abrupt("return", File.uploadStream(destinationPath, stream, params, options));
|
989
|
+
case 5:
|
990
|
+
case "end":
|
991
|
+
return _context18.stop();
|
1028
992
|
}
|
1029
993
|
}, _callee18);
|
1030
994
|
}));
|
@@ -1039,93 +1003,91 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
|
|
1039
1003
|
response,
|
1040
1004
|
_args19 = arguments;
|
1041
1005
|
return _regenerator.default.wrap(function _callee19$(_context19) {
|
1042
|
-
while (1) {
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1063
|
-
|
1064
|
-
|
1065
|
-
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
return _context19.stop();
|
1128
|
-
}
|
1006
|
+
while (1) switch (_context19.prev = _context19.next) {
|
1007
|
+
case 0:
|
1008
|
+
params = _args19.length > 1 && _args19[1] !== undefined ? _args19[1] : {};
|
1009
|
+
options = _args19.length > 2 && _args19[2] !== undefined ? _args19[2] : {};
|
1010
|
+
if ((0, _utils.isObject)(params)) {
|
1011
|
+
_context19.next = 4;
|
1012
|
+
break;
|
1013
|
+
}
|
1014
|
+
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
1015
|
+
case 4:
|
1016
|
+
params['path'] = path;
|
1017
|
+
if (params['path']) {
|
1018
|
+
_context19.next = 7;
|
1019
|
+
break;
|
1020
|
+
}
|
1021
|
+
throw new errors.MissingParameterError('Parameter missing: path');
|
1022
|
+
case 7:
|
1023
|
+
if (!(params['path'] && !(0, _utils.isString)(params['path']))) {
|
1024
|
+
_context19.next = 9;
|
1025
|
+
break;
|
1026
|
+
}
|
1027
|
+
throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(params['path'])));
|
1028
|
+
case 9:
|
1029
|
+
if (!(params['action'] && !(0, _utils.isString)(params['action']))) {
|
1030
|
+
_context19.next = 11;
|
1031
|
+
break;
|
1032
|
+
}
|
1033
|
+
throw new errors.InvalidParameterError("Bad parameter: action must be of type String, received ".concat((0, _utils.getType)(params['action'])));
|
1034
|
+
case 11:
|
1035
|
+
if (!(params['length'] && !(0, _utils.isInt)(params['length']))) {
|
1036
|
+
_context19.next = 13;
|
1037
|
+
break;
|
1038
|
+
}
|
1039
|
+
throw new errors.InvalidParameterError("Bad parameter: length must be of type Int, received ".concat((0, _utils.getType)(params['length'])));
|
1040
|
+
case 13:
|
1041
|
+
if (!(params['part'] && !(0, _utils.isInt)(params['part']))) {
|
1042
|
+
_context19.next = 15;
|
1043
|
+
break;
|
1044
|
+
}
|
1045
|
+
throw new errors.InvalidParameterError("Bad parameter: part must be of type Int, received ".concat((0, _utils.getType)(params['part'])));
|
1046
|
+
case 15:
|
1047
|
+
if (!(params['parts'] && !(0, _utils.isInt)(params['parts']))) {
|
1048
|
+
_context19.next = 17;
|
1049
|
+
break;
|
1050
|
+
}
|
1051
|
+
throw new errors.InvalidParameterError("Bad parameter: parts must be of type Int, received ".concat((0, _utils.getType)(params['parts'])));
|
1052
|
+
case 17:
|
1053
|
+
if (!(params['provided_mtime'] && !(0, _utils.isString)(params['provided_mtime']))) {
|
1054
|
+
_context19.next = 19;
|
1055
|
+
break;
|
1056
|
+
}
|
1057
|
+
throw new errors.InvalidParameterError("Bad parameter: provided_mtime must be of type String, received ".concat((0, _utils.getType)(params['provided_mtime'])));
|
1058
|
+
case 19:
|
1059
|
+
if (!(params['ref'] && !(0, _utils.isString)(params['ref']))) {
|
1060
|
+
_context19.next = 21;
|
1061
|
+
break;
|
1062
|
+
}
|
1063
|
+
throw new errors.InvalidParameterError("Bad parameter: ref must be of type String, received ".concat((0, _utils.getType)(params['ref'])));
|
1064
|
+
case 21:
|
1065
|
+
if (!(params['restart'] && !(0, _utils.isInt)(params['restart']))) {
|
1066
|
+
_context19.next = 23;
|
1067
|
+
break;
|
1068
|
+
}
|
1069
|
+
throw new errors.InvalidParameterError("Bad parameter: restart must be of type Int, received ".concat((0, _utils.getType)(params['restart'])));
|
1070
|
+
case 23:
|
1071
|
+
if (!(params['size'] && !(0, _utils.isInt)(params['size']))) {
|
1072
|
+
_context19.next = 25;
|
1073
|
+
break;
|
1074
|
+
}
|
1075
|
+
throw new errors.InvalidParameterError("Bad parameter: size must be of type Int, received ".concat((0, _utils.getType)(params['size'])));
|
1076
|
+
case 25:
|
1077
|
+
if (!(params['structure'] && !(0, _utils.isString)(params['structure']))) {
|
1078
|
+
_context19.next = 27;
|
1079
|
+
break;
|
1080
|
+
}
|
1081
|
+
throw new errors.InvalidParameterError("Bad parameter: structure must be of type String, received ".concat((0, _utils.getType)(params['structure'])));
|
1082
|
+
case 27:
|
1083
|
+
_context19.next = 29;
|
1084
|
+
return _Api.default.sendRequest("/files/".concat(encodeURIComponent(params['path'])), 'POST', params, options);
|
1085
|
+
case 29:
|
1086
|
+
response = _context19.sent;
|
1087
|
+
return _context19.abrupt("return", new File(response === null || response === void 0 ? void 0 : response.data, options));
|
1088
|
+
case 31:
|
1089
|
+
case "end":
|
1090
|
+
return _context19.stop();
|
1129
1091
|
}
|
1130
1092
|
}, _callee19);
|
1131
1093
|
}));
|
@@ -1140,45 +1102,43 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
|
|
1140
1102
|
response,
|
1141
1103
|
_args20 = arguments;
|
1142
1104
|
return _regenerator.default.wrap(function _callee20$(_context20) {
|
1143
|
-
while (1) {
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
return _context20.stop();
|
1181
|
-
}
|
1105
|
+
while (1) switch (_context20.prev = _context20.next) {
|
1106
|
+
case 0:
|
1107
|
+
params = _args20.length > 1 && _args20[1] !== undefined ? _args20[1] : {};
|
1108
|
+
options = _args20.length > 2 && _args20[2] !== undefined ? _args20[2] : {};
|
1109
|
+
if ((0, _utils.isObject)(params)) {
|
1110
|
+
_context20.next = 4;
|
1111
|
+
break;
|
1112
|
+
}
|
1113
|
+
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
1114
|
+
case 4:
|
1115
|
+
params['path'] = path;
|
1116
|
+
if (params['path']) {
|
1117
|
+
_context20.next = 7;
|
1118
|
+
break;
|
1119
|
+
}
|
1120
|
+
throw new errors.MissingParameterError('Parameter missing: path');
|
1121
|
+
case 7:
|
1122
|
+
if (!(params['path'] && !(0, _utils.isString)(params['path']))) {
|
1123
|
+
_context20.next = 9;
|
1124
|
+
break;
|
1125
|
+
}
|
1126
|
+
throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(params['path'])));
|
1127
|
+
case 9:
|
1128
|
+
if (!(params['preview_size'] && !(0, _utils.isString)(params['preview_size']))) {
|
1129
|
+
_context20.next = 11;
|
1130
|
+
break;
|
1131
|
+
}
|
1132
|
+
throw new errors.InvalidParameterError("Bad parameter: preview_size must be of type String, received ".concat((0, _utils.getType)(params['preview_size'])));
|
1133
|
+
case 11:
|
1134
|
+
_context20.next = 13;
|
1135
|
+
return _Api.default.sendRequest("/file_actions/metadata/".concat(encodeURIComponent(params['path'])), 'GET', params, options);
|
1136
|
+
case 13:
|
1137
|
+
response = _context20.sent;
|
1138
|
+
return _context20.abrupt("return", new File(response === null || response === void 0 ? void 0 : response.data, options));
|
1139
|
+
case 15:
|
1140
|
+
case "end":
|
1141
|
+
return _context20.stop();
|
1182
1142
|
}
|
1183
1143
|
}, _callee20);
|
1184
1144
|
}));
|