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.
Files changed (77) hide show
  1. package/_VERSION +1 -1
  2. package/docs/models/Bundle.md +9 -2
  3. package/docs/models/BundleNotification.md +35 -0
  4. package/docs/models/BundleRegistration.md +3 -1
  5. package/docs/models/InboxRegistration.md +3 -1
  6. package/docs/models/Site.md +2 -0
  7. package/lib/Api.js +153 -159
  8. package/lib/isomorphic/File.node.js +24 -28
  9. package/lib/models/ActionNotificationExport.js +97 -101
  10. package/lib/models/ActionNotificationExportResult.js +44 -46
  11. package/lib/models/ActionWebhookFailure.js +42 -44
  12. package/lib/models/ApiKey.js +271 -287
  13. package/lib/models/App.js +26 -28
  14. package/lib/models/As2IncomingMessage.js +32 -34
  15. package/lib/models/As2OutgoingMessage.js +32 -34
  16. package/lib/models/As2Partner.js +231 -241
  17. package/lib/models/As2Station.js +219 -229
  18. package/lib/models/Automation.js +333 -343
  19. package/lib/models/AutomationRun.js +75 -79
  20. package/lib/models/BandwidthSnapshot.js +26 -28
  21. package/lib/models/Behavior.js +323 -337
  22. package/lib/models/Bundle.js +381 -387
  23. package/lib/models/BundleDownload.js +38 -40
  24. package/lib/models/BundleNotification.js +223 -173
  25. package/lib/models/BundleRecipient.js +104 -108
  26. package/lib/models/BundleRegistration.js +41 -40
  27. package/lib/models/Clickwrap.js +213 -223
  28. package/lib/models/DnsRecord.js +26 -28
  29. package/lib/models/ExternalEvent.js +93 -99
  30. package/lib/models/File.js +726 -766
  31. package/lib/models/FileComment.js +180 -188
  32. package/lib/models/FileCommentReaction.js +84 -88
  33. package/lib/models/FileMigration.js +31 -33
  34. package/lib/models/Folder.js +94 -98
  35. package/lib/models/FormFieldSet.js +189 -199
  36. package/lib/models/Group.js +207 -217
  37. package/lib/models/GroupUser.js +230 -238
  38. package/lib/models/History.js +266 -276
  39. package/lib/models/HistoryExport.js +175 -179
  40. package/lib/models/HistoryExportResult.js +44 -46
  41. package/lib/models/InboxRecipient.js +104 -108
  42. package/lib/models/InboxRegistration.js +35 -34
  43. package/lib/models/InboxUpload.js +38 -40
  44. package/lib/models/Invoice.js +57 -61
  45. package/lib/models/IpAddress.js +78 -84
  46. package/lib/models/Lock.js +148 -154
  47. package/lib/models/Message.js +267 -277
  48. package/lib/models/MessageComment.js +207 -217
  49. package/lib/models/MessageCommentReaction.js +147 -155
  50. package/lib/models/MessageReaction.js +147 -155
  51. package/lib/models/Notification.js +255 -265
  52. package/lib/models/Payment.js +57 -61
  53. package/lib/models/Permission.js +128 -134
  54. package/lib/models/Priority.js +45 -47
  55. package/lib/models/Project.js +183 -193
  56. package/lib/models/PublicKey.js +207 -217
  57. package/lib/models/RemoteBandwidthSnapshot.js +26 -28
  58. package/lib/models/RemoteServer.js +805 -819
  59. package/lib/models/Request.js +166 -174
  60. package/lib/models/Session.js +47 -51
  61. package/lib/models/SettingsChange.js +26 -28
  62. package/lib/models/SftpHostKey.js +177 -187
  63. package/lib/models/Site.js +415 -418
  64. package/lib/models/SsoStrategy.js +99 -105
  65. package/lib/models/Style.js +127 -133
  66. package/lib/models/UsageDailySnapshot.js +26 -28
  67. package/lib/models/UsageSnapshot.js +26 -28
  68. package/lib/models/User.js +587 -603
  69. package/lib/models/UserCipherUse.js +32 -34
  70. package/lib/models/UserRequest.js +147 -155
  71. package/lib/models/WebhookTest.js +54 -56
  72. package/package.json +1 -1
  73. package/src/models/Bundle.js +10 -1
  74. package/src/models/BundleNotification.js +39 -1
  75. package/src/models/BundleRegistration.js +3 -0
  76. package/src/models/InboxRegistration.js +3 -0
  77. package/src/models/Site.js +3 -0
@@ -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
- switch (_context.prev = _context.next) {
44
- case 0:
45
- if (!(0, _utils.isBrowser)()) {
46
- _context.next = 2;
47
- break;
48
- }
49
- throw new errors.NotImplementedError('Stream downloads are only available in a NodeJS environment');
50
- case 2:
51
- downloadUri = _this.getDownloadUri();
52
- if (downloadUri) {
53
- _context.next = 5;
54
- break;
55
- }
56
- throw new errors.EmptyPropertyError('Current object has no download URI');
57
- case 5:
58
- _require = require('../isomorphic/File.node.js'), saveUrlToStream = _require.saveUrlToStream;
59
- return _context.abrupt("return", saveUrlToStream(downloadUri, writableStream));
60
- case 7:
61
- case "end":
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
- switch (_context2.prev = _context2.next) {
77
- case 0:
78
- if (!(0, _utils.isBrowser)()) {
79
- _context2.next = 2;
80
- break;
81
- }
82
- throw new errors.NotImplementedError('Disk file downloads are only available in a NodeJS environment');
83
- case 2:
84
- downloadUri = _this.getDownloadUri();
85
- if (downloadUri) {
86
- _context2.next = 5;
87
- break;
88
- }
89
- throw new errors.EmptyPropertyError('Current object has no download URI');
90
- case 5:
91
- _require2 = require('../isomorphic/File.node.js'), saveUrlToFile = _require2.saveUrlToFile;
92
- return _context2.abrupt("return", saveUrlToFile(downloadUri, destinationPath));
93
- case 7:
94
- case "end":
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
- switch (_context3.prev = _context3.next) {
110
- case 0:
111
- params = {
112
- destination: destinationFilePath
113
- };
114
- return _context3.abrupt("return", _Api.default.sendRequest("/file_actions/copy/".concat(encodeURIComponent(_this.path)), 'POST', params, options));
115
- case 2:
116
- case "end":
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
- switch (_context4.prev = _context4.next) {
132
- case 0:
133
- params = {
134
- destination: destinationFilePath
135
- };
136
- return _context4.abrupt("return", _Api.default.sendRequest("/file_actions/move/".concat(encodeURIComponent(_this.path)), 'POST', params, options));
137
- case 2:
138
- case "end":
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
- switch (_context5.prev = _context5.next) {
314
- case 0:
315
- params = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {};
316
- if (_this.attributes.path) {
317
- _context5.next = 3;
318
- break;
319
- }
320
- throw new errors.EmptyPropertyError('Current object has no path');
321
- case 3:
322
- if ((0, _utils.isObject)(params)) {
323
- _context5.next = 5;
324
- break;
325
- }
326
- throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
327
- case 5:
328
- params.path = _this.attributes.path;
329
- if (!(params['path'] && !(0, _utils.isString)(params['path']))) {
330
- _context5.next = 8;
331
- break;
332
- }
333
- throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(path)));
334
- case 8:
335
- if (!(params['action'] && !(0, _utils.isString)(params['action']))) {
336
- _context5.next = 10;
337
- break;
338
- }
339
- throw new errors.InvalidParameterError("Bad parameter: action must be of type String, received ".concat((0, _utils.getType)(action)));
340
- case 10:
341
- if (!(params['preview_size'] && !(0, _utils.isString)(params['preview_size']))) {
342
- _context5.next = 12;
343
- break;
344
- }
345
- throw new errors.InvalidParameterError("Bad parameter: preview_size must be of type String, received ".concat((0, _utils.getType)(preview_size)));
346
- case 12:
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
- case 17:
359
- throw new errors.MissingParameterError('Parameter missing: path');
360
- case 18:
361
- _context5.next = 20;
362
- return _Api.default.sendRequest("/files/".concat(encodeURIComponent(params['path'])), 'GET', params, _this.options);
363
- case 20:
364
- response = _context5.sent;
365
- return _context5.abrupt("return", new File(response === null || response === void 0 ? void 0 : response.data, _this.options));
366
- case 22:
367
- case "end":
368
- return _context5.stop();
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
- switch (_context6.prev = _context6.next) {
380
- case 0:
381
- params = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {};
382
- if (_this.attributes.path) {
383
- _context6.next = 3;
384
- break;
385
- }
386
- throw new errors.EmptyPropertyError('Current object has no path');
387
- case 3:
388
- if ((0, _utils.isObject)(params)) {
389
- _context6.next = 5;
390
- break;
391
- }
392
- throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
393
- case 5:
394
- params.path = _this.attributes.path;
395
- if (!(params['path'] && !(0, _utils.isString)(params['path']))) {
396
- _context6.next = 8;
397
- break;
398
- }
399
- throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(path)));
400
- case 8:
401
- if (!(params['provided_mtime'] && !(0, _utils.isString)(params['provided_mtime']))) {
402
- _context6.next = 10;
403
- break;
404
- }
405
- throw new errors.InvalidParameterError("Bad parameter: provided_mtime must be of type String, received ".concat((0, _utils.getType)(provided_mtime)));
406
- case 10:
407
- if (!(params['priority_color'] && !(0, _utils.isString)(params['priority_color']))) {
408
- _context6.next = 12;
409
- break;
410
- }
411
- throw new errors.InvalidParameterError("Bad parameter: priority_color must be of type String, received ".concat((0, _utils.getType)(priority_color)));
412
- case 12:
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
- case 17:
425
- throw new errors.MissingParameterError('Parameter missing: path');
426
- case 18:
427
- _context6.next = 20;
428
- return _Api.default.sendRequest("/files/".concat(encodeURIComponent(params['path'])), 'PATCH', params, _this.options);
429
- case 20:
430
- response = _context6.sent;
431
- return _context6.abrupt("return", new File(response === null || response === void 0 ? void 0 : response.data, _this.options));
432
- case 22:
433
- case "end":
434
- return _context6.stop();
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
- switch (_context7.prev = _context7.next) {
446
- case 0:
447
- params = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : {};
448
- if (_this.attributes.path) {
449
- _context7.next = 3;
450
- break;
451
- }
452
- throw new errors.EmptyPropertyError('Current object has no path');
453
- case 3:
454
- if ((0, _utils.isObject)(params)) {
455
- _context7.next = 5;
456
- break;
457
- }
458
- throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
459
- case 5:
460
- params.path = _this.attributes.path;
461
- if (!(params['path'] && !(0, _utils.isString)(params['path']))) {
462
- _context7.next = 8;
463
- break;
464
- }
465
- throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(path)));
466
- case 8:
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
- case 13:
479
- throw new errors.MissingParameterError('Parameter missing: path');
480
- case 14:
481
- _context7.next = 16;
482
- return _Api.default.sendRequest("/files/".concat(encodeURIComponent(params['path'])), 'DELETE', params, _this.options);
483
- case 16:
484
- response = _context7.sent;
485
- return _context7.abrupt("return", response === null || response === void 0 ? void 0 : response.data);
486
- case 18:
487
- case "end":
488
- return _context7.stop();
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
- switch (_context8.prev = _context8.next) {
504
- case 0:
505
- params = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {};
506
- if (_this.attributes.path) {
507
- _context8.next = 3;
508
- break;
509
- }
510
- throw new errors.EmptyPropertyError('Current object has no path');
511
- case 3:
512
- if ((0, _utils.isObject)(params)) {
513
- _context8.next = 5;
514
- break;
515
- }
516
- throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
517
- case 5:
518
- params.path = _this.attributes.path;
519
- if (!(params['path'] && !(0, _utils.isString)(params['path']))) {
520
- _context8.next = 8;
521
- break;
522
- }
523
- throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(path)));
524
- case 8:
525
- if (!(params['destination'] && !(0, _utils.isString)(params['destination']))) {
526
- _context8.next = 10;
527
- break;
528
- }
529
- throw new errors.InvalidParameterError("Bad parameter: destination must be of type String, received ".concat((0, _utils.getType)(destination)));
530
- case 10:
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
- case 15:
543
- throw new errors.MissingParameterError('Parameter missing: path');
544
- case 16:
545
- if (params['destination']) {
546
- _context8.next = 22;
547
- break;
548
- }
549
- if (!_this.attributes.destination) {
550
- _context8.next = 21;
551
- break;
552
- }
553
- params['destination'] = _this.destination;
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
- case 21:
557
- throw new errors.MissingParameterError('Parameter missing: destination');
558
- case 22:
559
- _context8.next = 24;
560
- return _Api.default.sendRequest("/file_actions/copy/".concat(encodeURIComponent(params['path'])), 'POST', params, _this.options);
561
- case 24:
562
- response = _context8.sent;
563
- return _context8.abrupt("return", new _FileAction.default(response === null || response === void 0 ? void 0 : response.data, _this.options));
564
- case 26:
565
- case "end":
566
- return _context8.stop();
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
- switch (_context9.prev = _context9.next) {
578
- case 0:
579
- params = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : {};
580
- if (_this.attributes.path) {
581
- _context9.next = 3;
582
- break;
583
- }
584
- throw new errors.EmptyPropertyError('Current object has no path');
585
- case 3:
586
- if ((0, _utils.isObject)(params)) {
587
- _context9.next = 5;
588
- break;
589
- }
590
- throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
591
- case 5:
592
- params.path = _this.attributes.path;
593
- if (!(params['path'] && !(0, _utils.isString)(params['path']))) {
594
- _context9.next = 8;
595
- break;
596
- }
597
- throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(path)));
598
- case 8:
599
- if (!(params['destination'] && !(0, _utils.isString)(params['destination']))) {
600
- _context9.next = 10;
601
- break;
602
- }
603
- throw new errors.InvalidParameterError("Bad parameter: destination must be of type String, received ".concat((0, _utils.getType)(destination)));
604
- case 10:
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
- case 15:
617
- throw new errors.MissingParameterError('Parameter missing: path');
618
- case 16:
619
- if (params['destination']) {
620
- _context9.next = 22;
621
- break;
622
- }
623
- if (!_this.attributes.destination) {
624
- _context9.next = 21;
625
- break;
626
- }
627
- params['destination'] = _this.destination;
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
- case 21:
631
- throw new errors.MissingParameterError('Parameter missing: destination');
632
- case 22:
633
- _context9.next = 24;
634
- return _Api.default.sendRequest("/file_actions/move/".concat(encodeURIComponent(params['path'])), 'POST', params, _this.options);
635
- case 24:
636
- response = _context9.sent;
637
- return _context9.abrupt("return", new _FileAction.default(response === null || response === void 0 ? void 0 : response.data, _this.options));
638
- case 26:
639
- case "end":
640
- return _context9.stop();
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
- switch (_context10.prev = _context10.next) {
653
- case 0:
654
- params = _args10.length > 0 && _args10[0] !== undefined ? _args10[0] : {};
655
- if (_this.attributes.path) {
656
- _context10.next = 3;
657
- break;
658
- }
659
- throw new errors.EmptyPropertyError('Current object has no path');
660
- case 3:
661
- if ((0, _utils.isObject)(params)) {
662
- _context10.next = 5;
663
- break;
664
- }
665
- throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
666
- case 5:
667
- params.path = _this.attributes.path;
668
- if (!(params['path'] && !(0, _utils.isString)(params['path']))) {
669
- _context10.next = 8;
670
- break;
671
- }
672
- throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(path)));
673
- case 8:
674
- if (!(params['part'] && !(0, _utils.isInt)(params['part']))) {
675
- _context10.next = 10;
676
- break;
677
- }
678
- throw new errors.InvalidParameterError("Bad parameter: part must be of type Int, received ".concat((0, _utils.getType)(part)));
679
- case 10:
680
- if (!(params['parts'] && !(0, _utils.isInt)(params['parts']))) {
681
- _context10.next = 12;
682
- break;
683
- }
684
- throw new errors.InvalidParameterError("Bad parameter: parts must be of type Int, received ".concat((0, _utils.getType)(parts)));
685
- case 12:
686
- if (!(params['ref'] && !(0, _utils.isString)(params['ref']))) {
687
- _context10.next = 14;
688
- break;
689
- }
690
- throw new errors.InvalidParameterError("Bad parameter: ref must be of type String, received ".concat((0, _utils.getType)(ref)));
691
- case 14:
692
- if (!(params['restart'] && !(0, _utils.isInt)(params['restart']))) {
693
- _context10.next = 16;
694
- break;
695
- }
696
- throw new errors.InvalidParameterError("Bad parameter: restart must be of type Int, received ".concat((0, _utils.getType)(restart)));
697
- case 16:
698
- if (!(params['size'] && !(0, _utils.isInt)(params['size']))) {
699
- _context10.next = 18;
700
- break;
701
- }
702
- throw new errors.InvalidParameterError("Bad parameter: size must be of type Int, received ".concat((0, _utils.getType)(size)));
703
- case 18:
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
- case 23:
716
- throw new errors.MissingParameterError('Parameter missing: path');
717
- case 24:
718
- _context10.next = 26;
719
- return _Api.default.sendRequest("/file_actions/begin_upload/".concat(encodeURIComponent(params['path'])), 'POST', params, _this.options);
720
- case 26:
721
- response = _context10.sent;
722
- 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) {
723
- return new _FileUploadPart.default(obj, _this.options);
724
- })) || []);
725
- case 28:
726
- case "end":
727
- return _context10.stop();
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
- switch (_context11.prev = _context11.next) {
756
- case 0:
757
- params = _objectSpread(_objectSpread({}, paramsRaw), {}, {
758
- action: 'put'
759
- });
760
- _context11.next = 3;
761
- return _Api.default.sendRequest("/files/".concat(encodeURIComponent(path)), 'POST', params, options);
762
- case 3:
763
- response = _context11.sent;
764
- if (response) {
765
- _context11.next = 6;
766
- break;
767
- }
768
- return _context11.abrupt("return", null);
769
- case 6:
770
- partData = _objectSpread(_objectSpread({}, response.data), {}, {
771
- headers: response.headers,
772
- parameters: params
773
- });
774
- return _context11.abrupt("return", new _FileUploadPart.default(partData));
775
- case 8:
776
- case "end":
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
- switch (_context12.prev = _context12.next) {
792
- case 0:
793
- params = {
794
- action: 'put',
795
- part: partNumber,
796
- ref: firstFileUploadPart.ref
797
- };
798
- _context12.next = 3;
799
- return _Api.default.sendRequest("/files/".concat(encodeURIComponent(path)), 'POST', params, options);
800
- case 3:
801
- response = _context12.sent;
802
- if (response) {
803
- _context12.next = 6;
804
- break;
805
- }
806
- return _context12.abrupt("return", null);
807
- case 6:
808
- partData = _objectSpread(_objectSpread({}, response.data), {}, {
809
- headers: response.headers,
810
- parameters: params
811
- });
812
- return _context12.abrupt("return", new _FileUploadPart.default(partData));
813
- case 8:
814
- case "end":
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
- switch (_context13.prev = _context13.next) {
830
- case 0:
831
- params = {
832
- action: 'end',
833
- ref: firstFileUploadPart.ref
834
- };
835
- return _context13.abrupt("return", _Api.default.sendRequest("/files/".concat(encodeURIComponent(firstFileUploadPart.path)), 'POST', params, options));
836
- case 2:
837
- case "end":
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
- switch (_context16.prev = _context16.next) {
853
- case 0:
854
- _context16.next = 2;
855
- return File._openUpload(destinationPath, params, options);
856
- case 2:
857
- firstFileUploadPart = _context16.sent;
858
- if (firstFileUploadPart) {
859
- _context16.next = 5;
860
- break;
861
- }
862
- return _context16.abrupt("return");
863
- case 5:
864
- _context16.prev = 5;
865
- _context16.next = 8;
866
- return new Promise(function (resolve, reject) {
867
- var part = 0;
868
- var chunks = [];
869
- var length = 0;
870
- var concurrentUploads = [];
871
- readableStream.on('error', function (error) {
872
- reject(error);
873
- });
874
- readableStream.on('data', /*#__PURE__*/function () {
875
- var _ref17 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(chunk) {
876
- var nextLength, excessLength, chunkBuffer, lastChunkForPart, firstChunkForNextPart, buffer, nextFileUploadPart;
877
- return _regenerator.default.wrap(function _callee14$(_context14) {
878
- while (1) {
879
- switch (_context14.prev = _context14.next) {
880
- case 0:
881
- _context14.prev = 0;
882
- nextLength = length + chunk.length;
883
- excessLength = nextLength - firstFileUploadPart.partsize;
884
- chunkBuffer = _safeBuffer.Buffer.from(chunk);
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
- case 16:
955
- _context15.prev = 16;
956
- _context15.t0 = _context15["catch"](0);
957
- reject(_context15.t0);
958
- case 19:
959
- case "end":
960
- return _context15.stop();
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
- }, _callee15, null, [[0, 16]]);
964
- })));
965
- });
966
- case 8:
967
- file = _context16.sent;
968
- return _context16.abrupt("return", file);
969
- case 12:
970
- _context16.prev = 12;
971
- _context16.t0 = _context16["catch"](5);
972
- errors.handleErrorResponse(_context16.t0);
973
- case 15:
974
- case "end":
975
- return _context16.stop();
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
- switch (_context17.prev = _context17.next) {
989
- case 0:
990
- if (data) {
991
- _context17.next = 2;
992
- break;
993
- }
994
- throw new errors.MissingParameterError('Upload data was not provided');
995
- case 2:
996
- return _context17.abrupt("return", File.uploadStream(destinationPath, _readableStream.default.from(data), params, options));
997
- case 3:
998
- case "end":
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
- switch (_context18.prev = _context18.next) {
1014
- case 0:
1015
- if (!(0, _utils.isBrowser)()) {
1016
- _context18.next = 2;
1017
- break;
1018
- }
1019
- throw new errors.NotImplementedError('Disk file uploads are only available in a NodeJS environment');
1020
- case 2:
1021
- _require3 = require('../isomorphic/File.node.js'), openDiskFileReadStream = _require3.openDiskFileReadStream;
1022
- stream = openDiskFileReadStream(sourceFilePath);
1023
- return _context18.abrupt("return", File.uploadStream(destinationPath, stream, params, options));
1024
- case 5:
1025
- case "end":
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
- switch (_context19.prev = _context19.next) {
1044
- case 0:
1045
- params = _args19.length > 1 && _args19[1] !== undefined ? _args19[1] : {};
1046
- options = _args19.length > 2 && _args19[2] !== undefined ? _args19[2] : {};
1047
- if ((0, _utils.isObject)(params)) {
1048
- _context19.next = 4;
1049
- break;
1050
- }
1051
- throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
1052
- case 4:
1053
- params['path'] = path;
1054
- if (params['path']) {
1055
- _context19.next = 7;
1056
- break;
1057
- }
1058
- throw new errors.MissingParameterError('Parameter missing: path');
1059
- case 7:
1060
- if (!(params['path'] && !(0, _utils.isString)(params['path']))) {
1061
- _context19.next = 9;
1062
- break;
1063
- }
1064
- throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(params['path'])));
1065
- case 9:
1066
- if (!(params['action'] && !(0, _utils.isString)(params['action']))) {
1067
- _context19.next = 11;
1068
- break;
1069
- }
1070
- throw new errors.InvalidParameterError("Bad parameter: action must be of type String, received ".concat((0, _utils.getType)(params['action'])));
1071
- case 11:
1072
- if (!(params['length'] && !(0, _utils.isInt)(params['length']))) {
1073
- _context19.next = 13;
1074
- break;
1075
- }
1076
- throw new errors.InvalidParameterError("Bad parameter: length must be of type Int, received ".concat((0, _utils.getType)(params['length'])));
1077
- case 13:
1078
- if (!(params['part'] && !(0, _utils.isInt)(params['part']))) {
1079
- _context19.next = 15;
1080
- break;
1081
- }
1082
- throw new errors.InvalidParameterError("Bad parameter: part must be of type Int, received ".concat((0, _utils.getType)(params['part'])));
1083
- case 15:
1084
- if (!(params['parts'] && !(0, _utils.isInt)(params['parts']))) {
1085
- _context19.next = 17;
1086
- break;
1087
- }
1088
- throw new errors.InvalidParameterError("Bad parameter: parts must be of type Int, received ".concat((0, _utils.getType)(params['parts'])));
1089
- case 17:
1090
- if (!(params['provided_mtime'] && !(0, _utils.isString)(params['provided_mtime']))) {
1091
- _context19.next = 19;
1092
- break;
1093
- }
1094
- throw new errors.InvalidParameterError("Bad parameter: provided_mtime must be of type String, received ".concat((0, _utils.getType)(params['provided_mtime'])));
1095
- case 19:
1096
- if (!(params['ref'] && !(0, _utils.isString)(params['ref']))) {
1097
- _context19.next = 21;
1098
- break;
1099
- }
1100
- throw new errors.InvalidParameterError("Bad parameter: ref must be of type String, received ".concat((0, _utils.getType)(params['ref'])));
1101
- case 21:
1102
- if (!(params['restart'] && !(0, _utils.isInt)(params['restart']))) {
1103
- _context19.next = 23;
1104
- break;
1105
- }
1106
- throw new errors.InvalidParameterError("Bad parameter: restart must be of type Int, received ".concat((0, _utils.getType)(params['restart'])));
1107
- case 23:
1108
- if (!(params['size'] && !(0, _utils.isInt)(params['size']))) {
1109
- _context19.next = 25;
1110
- break;
1111
- }
1112
- throw new errors.InvalidParameterError("Bad parameter: size must be of type Int, received ".concat((0, _utils.getType)(params['size'])));
1113
- case 25:
1114
- if (!(params['structure'] && !(0, _utils.isString)(params['structure']))) {
1115
- _context19.next = 27;
1116
- break;
1117
- }
1118
- throw new errors.InvalidParameterError("Bad parameter: structure must be of type String, received ".concat((0, _utils.getType)(params['structure'])));
1119
- case 27:
1120
- _context19.next = 29;
1121
- return _Api.default.sendRequest("/files/".concat(encodeURIComponent(params['path'])), 'POST', params, options);
1122
- case 29:
1123
- response = _context19.sent;
1124
- return _context19.abrupt("return", new File(response === null || response === void 0 ? void 0 : response.data, options));
1125
- case 31:
1126
- case "end":
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
- switch (_context20.prev = _context20.next) {
1145
- case 0:
1146
- params = _args20.length > 1 && _args20[1] !== undefined ? _args20[1] : {};
1147
- options = _args20.length > 2 && _args20[2] !== undefined ? _args20[2] : {};
1148
- if ((0, _utils.isObject)(params)) {
1149
- _context20.next = 4;
1150
- break;
1151
- }
1152
- throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
1153
- case 4:
1154
- params['path'] = path;
1155
- if (params['path']) {
1156
- _context20.next = 7;
1157
- break;
1158
- }
1159
- throw new errors.MissingParameterError('Parameter missing: path');
1160
- case 7:
1161
- if (!(params['path'] && !(0, _utils.isString)(params['path']))) {
1162
- _context20.next = 9;
1163
- break;
1164
- }
1165
- throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(params['path'])));
1166
- case 9:
1167
- if (!(params['preview_size'] && !(0, _utils.isString)(params['preview_size']))) {
1168
- _context20.next = 11;
1169
- break;
1170
- }
1171
- throw new errors.InvalidParameterError("Bad parameter: preview_size must be of type String, received ".concat((0, _utils.getType)(params['preview_size'])));
1172
- case 11:
1173
- _context20.next = 13;
1174
- return _Api.default.sendRequest("/file_actions/metadata/".concat(encodeURIComponent(params['path'])), 'GET', params, options);
1175
- case 13:
1176
- response = _context20.sent;
1177
- return _context20.abrupt("return", new File(response === null || response === void 0 ? void 0 : response.data, options));
1178
- case 15:
1179
- case "end":
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
  }));