files.com 1.0.166 → 1.0.169

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 (63) hide show
  1. package/README.md +9 -5
  2. package/_VERSION +1 -1
  3. package/lib/models/ActionWebhookFailure.js +8 -2
  4. package/lib/models/ApiKey.js +16 -4
  5. package/lib/models/As2Partner.js +48 -14
  6. package/lib/models/As2Station.js +52 -12
  7. package/lib/models/Automation.js +16 -4
  8. package/lib/models/Behavior.js +16 -4
  9. package/lib/models/Bundle.js +24 -6
  10. package/lib/models/Clickwrap.js +16 -4
  11. package/lib/models/File.js +309 -311
  12. package/lib/models/FileComment.js +16 -4
  13. package/lib/models/FileCommentReaction.js +8 -2
  14. package/lib/models/FormFieldSet.js +16 -4
  15. package/lib/models/Group.js +16 -4
  16. package/lib/models/GroupUser.js +16 -4
  17. package/lib/models/Lock.js +8 -2
  18. package/lib/models/Message.js +16 -4
  19. package/lib/models/MessageComment.js +16 -4
  20. package/lib/models/MessageCommentReaction.js +8 -2
  21. package/lib/models/MessageReaction.js +8 -2
  22. package/lib/models/Notification.js +16 -4
  23. package/lib/models/Permission.js +8 -2
  24. package/lib/models/Project.js +16 -4
  25. package/lib/models/PublicKey.js +16 -4
  26. package/lib/models/RemoteServer.js +16 -4
  27. package/lib/models/Request.js +8 -2
  28. package/lib/models/SsoStrategy.js +8 -2
  29. package/lib/models/Style.js +16 -4
  30. package/lib/models/User.js +40 -10
  31. package/lib/models/UserRequest.js +8 -2
  32. package/package.json +1 -1
  33. package/src/models/ActionWebhookFailure.js +3 -1
  34. package/src/models/ApiKey.js +6 -2
  35. package/src/models/As2OutgoingMessage.js +1 -1
  36. package/src/models/As2Partner.js +22 -2
  37. package/src/models/As2Station.js +29 -2
  38. package/src/models/Automation.js +6 -2
  39. package/src/models/Behavior.js +6 -2
  40. package/src/models/Bundle.js +9 -3
  41. package/src/models/Clickwrap.js +6 -2
  42. package/src/models/File.js +26 -19
  43. package/src/models/FileComment.js +6 -2
  44. package/src/models/FileCommentReaction.js +3 -1
  45. package/src/models/FormFieldSet.js +6 -2
  46. package/src/models/Group.js +6 -2
  47. package/src/models/GroupUser.js +6 -2
  48. package/src/models/Lock.js +3 -1
  49. package/src/models/Message.js +6 -2
  50. package/src/models/MessageComment.js +6 -2
  51. package/src/models/MessageCommentReaction.js +3 -1
  52. package/src/models/MessageReaction.js +3 -1
  53. package/src/models/Notification.js +6 -2
  54. package/src/models/Permission.js +3 -1
  55. package/src/models/Project.js +6 -2
  56. package/src/models/PublicKey.js +6 -2
  57. package/src/models/RemoteServer.js +6 -2
  58. package/src/models/Request.js +3 -1
  59. package/src/models/SsoStrategy.js +3 -1
  60. package/src/models/Style.js +6 -2
  61. package/src/models/User.js +15 -5
  62. package/src/models/UserRequest.js +3 -1
  63. package/test/src/index.js +7 -3
@@ -49,7 +49,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
49
49
  });
50
50
  (0, _defineProperty2.default)(this, "downloadToStream", /*#__PURE__*/function () {
51
51
  var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(writableStream) {
52
- var _require, saveUrlToStream;
52
+ var downloadUri, _require, saveUrlToStream;
53
53
 
54
54
  return _regenerator.default.wrap(function _callee$(_context) {
55
55
  while (1) {
@@ -63,18 +63,20 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
63
63
  throw new Error('Stream downloads are only available in a NodeJS environment');
64
64
 
65
65
  case 2:
66
- if (_this.download_uri) {
67
- _context.next = 4;
66
+ downloadUri = _this.getDownloadUri();
67
+
68
+ if (downloadUri) {
69
+ _context.next = 5;
68
70
  break;
69
71
  }
70
72
 
71
73
  throw new Error('Current object has no download URI');
72
74
 
73
- case 4:
75
+ case 5:
74
76
  _require = require('../isomorphic/File.node.js'), saveUrlToStream = _require.saveUrlToStream;
75
- return _context.abrupt("return", saveUrlToStream(_this.download_uri, writableStream));
77
+ return _context.abrupt("return", saveUrlToStream(downloadUri, writableStream));
76
78
 
77
- case 6:
79
+ case 7:
78
80
  case "end":
79
81
  return _context.stop();
80
82
  }
@@ -88,7 +90,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
88
90
  }());
89
91
  (0, _defineProperty2.default)(this, "downloadToFile", /*#__PURE__*/function () {
90
92
  var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(destinationPath) {
91
- var _require2, saveUrlToFile;
93
+ var downloadUri, _require2, saveUrlToFile;
92
94
 
93
95
  return _regenerator.default.wrap(function _callee2$(_context2) {
94
96
  while (1) {
@@ -102,18 +104,20 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
102
104
  throw new Error('Disk file downloads are only available in a NodeJS environment');
103
105
 
104
106
  case 2:
105
- if (_this.download_uri) {
106
- _context2.next = 4;
107
+ downloadUri = _this.getDownloadUri();
108
+
109
+ if (downloadUri) {
110
+ _context2.next = 5;
107
111
  break;
108
112
  }
109
113
 
110
114
  throw new Error('Current object has no download URI');
111
115
 
112
- case 4:
116
+ case 5:
113
117
  _require2 = require('../isomorphic/File.node.js'), saveUrlToFile = _require2.saveUrlToFile;
114
- return _context2.abrupt("return", saveUrlToFile(_this.download_uri, destinationPath));
118
+ return _context2.abrupt("return", saveUrlToFile(downloadUri, destinationPath));
115
119
 
116
- case 6:
120
+ case 7:
117
121
  case "end":
118
122
  return _context2.stop();
119
123
  }
@@ -125,15 +129,19 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
125
129
  return _ref2.apply(this, arguments);
126
130
  };
127
131
  }());
128
- (0, _defineProperty2.default)(this, "get", /*#__PURE__*/function () {
129
- var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(path) {
132
+ (0, _defineProperty2.default)(this, "copyTo", /*#__PURE__*/function () {
133
+ var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(destinationFilePath) {
134
+ var params;
130
135
  return _regenerator.default.wrap(function _callee3$(_context3) {
131
136
  while (1) {
132
137
  switch (_context3.prev = _context3.next) {
133
138
  case 0:
134
- return _context3.abrupt("return", File.find(path));
139
+ params = {
140
+ destination: destinationFilePath
141
+ };
142
+ return _context3.abrupt("return", _Api.default.sendRequest("/file_actions/copy/".concat(encodeURIComponent(_this.path)), 'POST', params));
135
143
 
136
- case 1:
144
+ case 2:
137
145
  case "end":
138
146
  return _context3.stop();
139
147
  }
@@ -145,7 +153,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
145
153
  return _ref3.apply(this, arguments);
146
154
  };
147
155
  }());
148
- (0, _defineProperty2.default)(this, "copyTo", /*#__PURE__*/function () {
156
+ (0, _defineProperty2.default)(this, "moveTo", /*#__PURE__*/function () {
149
157
  var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(destinationFilePath) {
150
158
  var params;
151
159
  return _regenerator.default.wrap(function _callee4$(_context4) {
@@ -155,7 +163,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
155
163
  params = {
156
164
  destination: destinationFilePath
157
165
  };
158
- return _context4.abrupt("return", _Api.default.sendRequest("/file_actions/copy/".concat(encodeURIComponent(_this.path)), 'POST', params));
166
+ return _context4.abrupt("return", _Api.default.sendRequest("/file_actions/move/".concat(encodeURIComponent(_this.path)), 'POST', params));
159
167
 
160
168
  case 2:
161
169
  case "end":
@@ -169,30 +177,6 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
169
177
  return _ref4.apply(this, arguments);
170
178
  };
171
179
  }());
172
- (0, _defineProperty2.default)(this, "moveTo", /*#__PURE__*/function () {
173
- var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(destinationFilePath) {
174
- var params;
175
- return _regenerator.default.wrap(function _callee5$(_context5) {
176
- while (1) {
177
- switch (_context5.prev = _context5.next) {
178
- case 0:
179
- params = {
180
- destination: destinationFilePath
181
- };
182
- return _context5.abrupt("return", _Api.default.sendRequest("/file_actions/move/".concat(encodeURIComponent(_this.path)), 'POST', params));
183
-
184
- case 2:
185
- case "end":
186
- return _context5.stop();
187
- }
188
- }
189
- }, _callee5);
190
- }));
191
-
192
- return function (_x5) {
193
- return _ref5.apply(this, arguments);
194
- };
195
- }());
196
180
  (0, _defineProperty2.default)(this, "getPath", function () {
197
181
  return _this.attributes.path;
198
182
  });
@@ -343,17 +327,18 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
343
327
  (0, _defineProperty2.default)(this, "setWithRename", function (value) {
344
328
  _this.attributes.with_rename = value;
345
329
  });
346
- (0, _defineProperty2.default)(this, "download", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
330
+ (0, _defineProperty2.default)(this, "download", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
347
331
  var params,
348
- _args6 = arguments;
349
- return _regenerator.default.wrap(function _callee6$(_context6) {
332
+ response,
333
+ _args5 = arguments;
334
+ return _regenerator.default.wrap(function _callee5$(_context5) {
350
335
  while (1) {
351
- switch (_context6.prev = _context6.next) {
336
+ switch (_context5.prev = _context5.next) {
352
337
  case 0:
353
- params = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {};
338
+ params = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {};
354
339
 
355
340
  if (_this.attributes.path) {
356
- _context6.next = 3;
341
+ _context5.next = 3;
357
342
  break;
358
343
  }
359
344
 
@@ -361,7 +346,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
361
346
 
362
347
  case 3:
363
348
  if ((0, _utils.isObject)(params)) {
364
- _context6.next = 5;
349
+ _context5.next = 5;
365
350
  break;
366
351
  }
367
352
 
@@ -371,7 +356,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
371
356
  params.path = _this.attributes.path;
372
357
 
373
358
  if (!(params['path'] && !(0, _utils.isString)(params['path']))) {
374
- _context6.next = 8;
359
+ _context5.next = 8;
375
360
  break;
376
361
  }
377
362
 
@@ -379,7 +364,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
379
364
 
380
365
  case 8:
381
366
  if (!(params['action'] && !(0, _utils.isString)(params['action']))) {
382
- _context6.next = 10;
367
+ _context5.next = 10;
383
368
  break;
384
369
  }
385
370
 
@@ -387,7 +372,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
387
372
 
388
373
  case 10:
389
374
  if (!(params['preview_size'] && !(0, _utils.isString)(params['preview_size']))) {
390
- _context6.next = 12;
375
+ _context5.next = 12;
391
376
  break;
392
377
  }
393
378
 
@@ -395,43 +380,49 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
395
380
 
396
381
  case 12:
397
382
  if (params['path']) {
398
- _context6.next = 18;
383
+ _context5.next = 18;
399
384
  break;
400
385
  }
401
386
 
402
387
  if (!_this.attributes.path) {
403
- _context6.next = 17;
388
+ _context5.next = 17;
404
389
  break;
405
390
  }
406
391
 
407
392
  params['path'] = _this.path;
408
- _context6.next = 18;
393
+ _context5.next = 18;
409
394
  break;
410
395
 
411
396
  case 17:
412
397
  throw new Error('Parameter missing: path');
413
398
 
414
399
  case 18:
415
- return _context6.abrupt("return", _Api.default.sendRequest("/files/".concat(params['path']), 'GET', params, _this.options));
400
+ _context5.next = 20;
401
+ return _Api.default.sendRequest("/files/".concat(params['path']), 'GET', params, _this.options);
416
402
 
417
- case 19:
403
+ case 20:
404
+ response = _context5.sent;
405
+ return _context5.abrupt("return", new File(response === null || response === void 0 ? void 0 : response.data, _this.options));
406
+
407
+ case 22:
418
408
  case "end":
419
- return _context6.stop();
409
+ return _context5.stop();
420
410
  }
421
411
  }
422
- }, _callee6);
412
+ }, _callee5);
423
413
  })));
424
- (0, _defineProperty2.default)(this, "update", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
414
+ (0, _defineProperty2.default)(this, "update", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
425
415
  var params,
426
- _args7 = arguments;
427
- return _regenerator.default.wrap(function _callee7$(_context7) {
416
+ response,
417
+ _args6 = arguments;
418
+ return _regenerator.default.wrap(function _callee6$(_context6) {
428
419
  while (1) {
429
- switch (_context7.prev = _context7.next) {
420
+ switch (_context6.prev = _context6.next) {
430
421
  case 0:
431
- params = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : {};
422
+ params = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {};
432
423
 
433
424
  if (_this.attributes.path) {
434
- _context7.next = 3;
425
+ _context6.next = 3;
435
426
  break;
436
427
  }
437
428
 
@@ -439,7 +430,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
439
430
 
440
431
  case 3:
441
432
  if ((0, _utils.isObject)(params)) {
442
- _context7.next = 5;
433
+ _context6.next = 5;
443
434
  break;
444
435
  }
445
436
 
@@ -449,7 +440,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
449
440
  params.path = _this.attributes.path;
450
441
 
451
442
  if (!(params['path'] && !(0, _utils.isString)(params['path']))) {
452
- _context7.next = 8;
443
+ _context6.next = 8;
453
444
  break;
454
445
  }
455
446
 
@@ -457,7 +448,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
457
448
 
458
449
  case 8:
459
450
  if (!(params['provided_mtime'] && !(0, _utils.isString)(params['provided_mtime']))) {
460
- _context7.next = 10;
451
+ _context6.next = 10;
461
452
  break;
462
453
  }
463
454
 
@@ -465,7 +456,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
465
456
 
466
457
  case 10:
467
458
  if (!(params['priority_color'] && !(0, _utils.isString)(params['priority_color']))) {
468
- _context7.next = 12;
459
+ _context6.next = 12;
469
460
  break;
470
461
  }
471
462
 
@@ -473,43 +464,49 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
473
464
 
474
465
  case 12:
475
466
  if (params['path']) {
476
- _context7.next = 18;
467
+ _context6.next = 18;
477
468
  break;
478
469
  }
479
470
 
480
471
  if (!_this.attributes.path) {
481
- _context7.next = 17;
472
+ _context6.next = 17;
482
473
  break;
483
474
  }
484
475
 
485
476
  params['path'] = _this.path;
486
- _context7.next = 18;
477
+ _context6.next = 18;
487
478
  break;
488
479
 
489
480
  case 17:
490
481
  throw new Error('Parameter missing: path');
491
482
 
492
483
  case 18:
493
- return _context7.abrupt("return", _Api.default.sendRequest("/files/".concat(params['path']), 'PATCH', params, _this.options));
484
+ _context6.next = 20;
485
+ return _Api.default.sendRequest("/files/".concat(params['path']), 'PATCH', params, _this.options);
494
486
 
495
- case 19:
487
+ case 20:
488
+ response = _context6.sent;
489
+ return _context6.abrupt("return", new File(response === null || response === void 0 ? void 0 : response.data, _this.options));
490
+
491
+ case 22:
496
492
  case "end":
497
- return _context7.stop();
493
+ return _context6.stop();
498
494
  }
499
495
  }
500
- }, _callee7);
496
+ }, _callee6);
501
497
  })));
502
- (0, _defineProperty2.default)(this, "delete", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
498
+ (0, _defineProperty2.default)(this, "delete", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
503
499
  var params,
504
- _args8 = arguments;
505
- return _regenerator.default.wrap(function _callee8$(_context8) {
500
+ response,
501
+ _args7 = arguments;
502
+ return _regenerator.default.wrap(function _callee7$(_context7) {
506
503
  while (1) {
507
- switch (_context8.prev = _context8.next) {
504
+ switch (_context7.prev = _context7.next) {
508
505
  case 0:
509
- params = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {};
506
+ params = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : {};
510
507
 
511
508
  if (_this.attributes.path) {
512
- _context8.next = 3;
509
+ _context7.next = 3;
513
510
  break;
514
511
  }
515
512
 
@@ -517,7 +514,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
517
514
 
518
515
  case 3:
519
516
  if ((0, _utils.isObject)(params)) {
520
- _context8.next = 5;
517
+ _context7.next = 5;
521
518
  break;
522
519
  }
523
520
 
@@ -527,7 +524,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
527
524
  params.path = _this.attributes.path;
528
525
 
529
526
  if (!(params['path'] && !(0, _utils.isString)(params['path']))) {
530
- _context8.next = 8;
527
+ _context7.next = 8;
531
528
  break;
532
529
  }
533
530
 
@@ -535,47 +532,53 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
535
532
 
536
533
  case 8:
537
534
  if (params['path']) {
538
- _context8.next = 14;
535
+ _context7.next = 14;
539
536
  break;
540
537
  }
541
538
 
542
539
  if (!_this.attributes.path) {
543
- _context8.next = 13;
540
+ _context7.next = 13;
544
541
  break;
545
542
  }
546
543
 
547
544
  params['path'] = _this.path;
548
- _context8.next = 14;
545
+ _context7.next = 14;
549
546
  break;
550
547
 
551
548
  case 13:
552
549
  throw new Error('Parameter missing: path');
553
550
 
554
551
  case 14:
555
- return _context8.abrupt("return", _Api.default.sendRequest("/files/".concat(params['path']), 'DELETE', params, _this.options));
552
+ _context7.next = 16;
553
+ return _Api.default.sendRequest("/files/".concat(params['path']), 'DELETE', params, _this.options);
556
554
 
557
- case 15:
555
+ case 16:
556
+ response = _context7.sent;
557
+ return _context7.abrupt("return", response === null || response === void 0 ? void 0 : response.data);
558
+
559
+ case 18:
558
560
  case "end":
559
- return _context8.stop();
561
+ return _context7.stop();
560
562
  }
561
563
  }
562
- }, _callee8);
564
+ }, _callee7);
563
565
  })));
564
566
  (0, _defineProperty2.default)(this, "destroy", function () {
565
567
  var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
566
568
  return _this.delete(params);
567
569
  });
568
- (0, _defineProperty2.default)(this, "copy", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
570
+ (0, _defineProperty2.default)(this, "copy", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
569
571
  var params,
570
- _args9 = arguments;
571
- return _regenerator.default.wrap(function _callee9$(_context9) {
572
+ response,
573
+ _args8 = arguments;
574
+ return _regenerator.default.wrap(function _callee8$(_context8) {
572
575
  while (1) {
573
- switch (_context9.prev = _context9.next) {
576
+ switch (_context8.prev = _context8.next) {
574
577
  case 0:
575
- params = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : {};
578
+ params = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {};
576
579
 
577
580
  if (_this.attributes.path) {
578
- _context9.next = 3;
581
+ _context8.next = 3;
579
582
  break;
580
583
  }
581
584
 
@@ -583,7 +586,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
583
586
 
584
587
  case 3:
585
588
  if ((0, _utils.isObject)(params)) {
586
- _context9.next = 5;
589
+ _context8.next = 5;
587
590
  break;
588
591
  }
589
592
 
@@ -593,7 +596,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
593
596
  params.path = _this.attributes.path;
594
597
 
595
598
  if (!(params['path'] && !(0, _utils.isString)(params['path']))) {
596
- _context9.next = 8;
599
+ _context8.next = 8;
597
600
  break;
598
601
  }
599
602
 
@@ -601,7 +604,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
601
604
 
602
605
  case 8:
603
606
  if (!(params['destination'] && !(0, _utils.isString)(params['destination']))) {
604
- _context9.next = 10;
607
+ _context8.next = 10;
605
608
  break;
606
609
  }
607
610
 
@@ -609,17 +612,17 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
609
612
 
610
613
  case 10:
611
614
  if (params['path']) {
612
- _context9.next = 16;
615
+ _context8.next = 16;
613
616
  break;
614
617
  }
615
618
 
616
619
  if (!_this.attributes.path) {
617
- _context9.next = 15;
620
+ _context8.next = 15;
618
621
  break;
619
622
  }
620
623
 
621
624
  params['path'] = _this.path;
622
- _context9.next = 16;
625
+ _context8.next = 16;
623
626
  break;
624
627
 
625
628
  case 15:
@@ -627,43 +630,49 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
627
630
 
628
631
  case 16:
629
632
  if (params['destination']) {
630
- _context9.next = 22;
633
+ _context8.next = 22;
631
634
  break;
632
635
  }
633
636
 
634
637
  if (!_this.attributes.destination) {
635
- _context9.next = 21;
638
+ _context8.next = 21;
636
639
  break;
637
640
  }
638
641
 
639
642
  params['destination'] = _this.destination;
640
- _context9.next = 22;
643
+ _context8.next = 22;
641
644
  break;
642
645
 
643
646
  case 21:
644
647
  throw new Error('Parameter missing: destination');
645
648
 
646
649
  case 22:
647
- return _context9.abrupt("return", _Api.default.sendRequest("/file_actions/copy/".concat(params['path']), 'POST', params, _this.options));
650
+ _context8.next = 24;
651
+ return _Api.default.sendRequest("/file_actions/copy/".concat(params['path']), 'POST', params, _this.options);
648
652
 
649
- case 23:
653
+ case 24:
654
+ response = _context8.sent;
655
+ return _context8.abrupt("return", new FileAction(response === null || response === void 0 ? void 0 : response.data, _this.options));
656
+
657
+ case 26:
650
658
  case "end":
651
- return _context9.stop();
659
+ return _context8.stop();
652
660
  }
653
661
  }
654
- }, _callee9);
662
+ }, _callee8);
655
663
  })));
656
- (0, _defineProperty2.default)(this, "move", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
664
+ (0, _defineProperty2.default)(this, "move", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
657
665
  var params,
658
- _args10 = arguments;
659
- return _regenerator.default.wrap(function _callee10$(_context10) {
666
+ response,
667
+ _args9 = arguments;
668
+ return _regenerator.default.wrap(function _callee9$(_context9) {
660
669
  while (1) {
661
- switch (_context10.prev = _context10.next) {
670
+ switch (_context9.prev = _context9.next) {
662
671
  case 0:
663
- params = _args10.length > 0 && _args10[0] !== undefined ? _args10[0] : {};
672
+ params = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : {};
664
673
 
665
674
  if (_this.attributes.path) {
666
- _context10.next = 3;
675
+ _context9.next = 3;
667
676
  break;
668
677
  }
669
678
 
@@ -671,7 +680,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
671
680
 
672
681
  case 3:
673
682
  if ((0, _utils.isObject)(params)) {
674
- _context10.next = 5;
683
+ _context9.next = 5;
675
684
  break;
676
685
  }
677
686
 
@@ -681,7 +690,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
681
690
  params.path = _this.attributes.path;
682
691
 
683
692
  if (!(params['path'] && !(0, _utils.isString)(params['path']))) {
684
- _context10.next = 8;
693
+ _context9.next = 8;
685
694
  break;
686
695
  }
687
696
 
@@ -689,7 +698,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
689
698
 
690
699
  case 8:
691
700
  if (!(params['destination'] && !(0, _utils.isString)(params['destination']))) {
692
- _context10.next = 10;
701
+ _context9.next = 10;
693
702
  break;
694
703
  }
695
704
 
@@ -697,17 +706,17 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
697
706
 
698
707
  case 10:
699
708
  if (params['path']) {
700
- _context10.next = 16;
709
+ _context9.next = 16;
701
710
  break;
702
711
  }
703
712
 
704
713
  if (!_this.attributes.path) {
705
- _context10.next = 15;
714
+ _context9.next = 15;
706
715
  break;
707
716
  }
708
717
 
709
718
  params['path'] = _this.path;
710
- _context10.next = 16;
719
+ _context9.next = 16;
711
720
  break;
712
721
 
713
722
  case 15:
@@ -715,43 +724,51 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
715
724
 
716
725
  case 16:
717
726
  if (params['destination']) {
718
- _context10.next = 22;
727
+ _context9.next = 22;
719
728
  break;
720
729
  }
721
730
 
722
731
  if (!_this.attributes.destination) {
723
- _context10.next = 21;
732
+ _context9.next = 21;
724
733
  break;
725
734
  }
726
735
 
727
736
  params['destination'] = _this.destination;
728
- _context10.next = 22;
737
+ _context9.next = 22;
729
738
  break;
730
739
 
731
740
  case 21:
732
741
  throw new Error('Parameter missing: destination');
733
742
 
734
743
  case 22:
735
- return _context10.abrupt("return", _Api.default.sendRequest("/file_actions/move/".concat(params['path']), 'POST', params, _this.options));
744
+ _context9.next = 24;
745
+ return _Api.default.sendRequest("/file_actions/move/".concat(params['path']), 'POST', params, _this.options);
736
746
 
737
- case 23:
747
+ case 24:
748
+ response = _context9.sent;
749
+ return _context9.abrupt("return", new FileAction(response === null || response === void 0 ? void 0 : response.data, _this.options));
750
+
751
+ case 26:
738
752
  case "end":
739
- return _context10.stop();
753
+ return _context9.stop();
740
754
  }
741
755
  }
742
- }, _callee10);
756
+ }, _callee9);
743
757
  })));
744
- (0, _defineProperty2.default)(this, "beginUpload", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
758
+ (0, _defineProperty2.default)(this, "beginUpload", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
759
+ var _response$data;
760
+
745
761
  var params,
746
- _args11 = arguments;
747
- return _regenerator.default.wrap(function _callee11$(_context11) {
762
+ response,
763
+ _args10 = arguments;
764
+ return _regenerator.default.wrap(function _callee10$(_context10) {
748
765
  while (1) {
749
- switch (_context11.prev = _context11.next) {
766
+ switch (_context10.prev = _context10.next) {
750
767
  case 0:
751
- params = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : {};
768
+ params = _args10.length > 0 && _args10[0] !== undefined ? _args10[0] : {};
752
769
 
753
770
  if (_this.attributes.path) {
754
- _context11.next = 3;
771
+ _context10.next = 3;
755
772
  break;
756
773
  }
757
774
 
@@ -759,7 +776,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
759
776
 
760
777
  case 3:
761
778
  if ((0, _utils.isObject)(params)) {
762
- _context11.next = 5;
779
+ _context10.next = 5;
763
780
  break;
764
781
  }
765
782
 
@@ -769,7 +786,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
769
786
  params.path = _this.attributes.path;
770
787
 
771
788
  if (!(params['path'] && !(0, _utils.isString)(params['path']))) {
772
- _context11.next = 8;
789
+ _context10.next = 8;
773
790
  break;
774
791
  }
775
792
 
@@ -777,7 +794,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
777
794
 
778
795
  case 8:
779
796
  if (!(params['part'] && !(0, _utils.isInt)(params['part']))) {
780
- _context11.next = 10;
797
+ _context10.next = 10;
781
798
  break;
782
799
  }
783
800
 
@@ -785,7 +802,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
785
802
 
786
803
  case 10:
787
804
  if (!(params['parts'] && !(0, _utils.isInt)(params['parts']))) {
788
- _context11.next = 12;
805
+ _context10.next = 12;
789
806
  break;
790
807
  }
791
808
 
@@ -793,7 +810,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
793
810
 
794
811
  case 12:
795
812
  if (!(params['ref'] && !(0, _utils.isString)(params['ref']))) {
796
- _context11.next = 14;
813
+ _context10.next = 14;
797
814
  break;
798
815
  }
799
816
 
@@ -801,7 +818,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
801
818
 
802
819
  case 14:
803
820
  if (!(params['restart'] && !(0, _utils.isInt)(params['restart']))) {
804
- _context11.next = 16;
821
+ _context10.next = 16;
805
822
  break;
806
823
  }
807
824
 
@@ -809,7 +826,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
809
826
 
810
827
  case 16:
811
828
  if (!(params['size'] && !(0, _utils.isInt)(params['size']))) {
812
- _context11.next = 18;
829
+ _context10.next = 18;
813
830
  break;
814
831
  }
815
832
 
@@ -817,41 +834,48 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
817
834
 
818
835
  case 18:
819
836
  if (params['path']) {
820
- _context11.next = 24;
837
+ _context10.next = 24;
821
838
  break;
822
839
  }
823
840
 
824
841
  if (!_this.attributes.path) {
825
- _context11.next = 23;
842
+ _context10.next = 23;
826
843
  break;
827
844
  }
828
845
 
829
846
  params['path'] = _this.path;
830
- _context11.next = 24;
847
+ _context10.next = 24;
831
848
  break;
832
849
 
833
850
  case 23:
834
851
  throw new Error('Parameter missing: path');
835
852
 
836
853
  case 24:
837
- return _context11.abrupt("return", _Api.default.sendRequest("/file_actions/begin_upload/".concat(params['path']), 'POST', params, _this.options));
854
+ _context10.next = 26;
855
+ return _Api.default.sendRequest("/file_actions/begin_upload/".concat(params['path']), 'POST', params, _this.options);
838
856
 
839
- case 25:
857
+ case 26:
858
+ response = _context10.sent;
859
+ 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) {
860
+ return new _FileUploadPart.default(obj, _this.options);
861
+ })) || []);
862
+
863
+ case 28:
840
864
  case "end":
841
- return _context11.stop();
865
+ return _context10.stop();
842
866
  }
843
867
  }
844
- }, _callee11);
868
+ }, _callee10);
845
869
  })));
846
870
  (0, _defineProperty2.default)(this, "save", function () {
847
871
  var newObject = File.create(_this.attributes.path, _this.attributes, _this.options);
848
872
  _this.attributes = _objectSpread({}, newObject.attributes);
849
873
  return true;
850
874
  });
851
- Object.entries(attributes).forEach(function (_ref12) {
852
- var _ref13 = (0, _slicedToArray2.default)(_ref12, 2),
853
- key = _ref13[0],
854
- value = _ref13[1];
875
+ Object.entries(attributes).forEach(function (_ref11) {
876
+ var _ref12 = (0, _slicedToArray2.default)(_ref11, 2),
877
+ key = _ref12[0],
878
+ value = _ref12[1];
855
879
 
856
880
  var normalizedKey = key.replace('?', '');
857
881
  _this.attributes[normalizedKey] = value;
@@ -863,139 +887,139 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
863
887
  this.options = _objectSpread({}, options);
864
888
  });
865
889
  (0, _defineProperty2.default)(File, "_openUpload", /*#__PURE__*/function () {
866
- var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(path) {
890
+ var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(path) {
867
891
  var params, response, partData;
868
- return _regenerator.default.wrap(function _callee12$(_context12) {
892
+ return _regenerator.default.wrap(function _callee11$(_context11) {
869
893
  while (1) {
870
- switch (_context12.prev = _context12.next) {
894
+ switch (_context11.prev = _context11.next) {
871
895
  case 0:
872
896
  params = {
873
897
  action: 'put'
874
898
  };
875
- _context12.next = 3;
899
+ _context11.next = 3;
876
900
  return _Api.default.sendRequest("/files/".concat(encodeURIComponent(path)), 'POST', params);
877
901
 
878
902
  case 3:
879
- response = _context12.sent;
903
+ response = _context11.sent;
880
904
 
881
905
  if (response) {
882
- _context12.next = 6;
906
+ _context11.next = 6;
883
907
  break;
884
908
  }
885
909
 
886
- return _context12.abrupt("return", null);
910
+ return _context11.abrupt("return", null);
887
911
 
888
912
  case 6:
889
913
  partData = _objectSpread(_objectSpread({}, response.data), {}, {
890
914
  headers: response.headers,
891
915
  parameters: params
892
916
  });
893
- return _context12.abrupt("return", new _FileUploadPart.default(partData));
917
+ return _context11.abrupt("return", new _FileUploadPart.default(partData));
894
918
 
895
919
  case 8:
896
920
  case "end":
897
- return _context12.stop();
921
+ return _context11.stop();
898
922
  }
899
923
  }
900
- }, _callee12);
924
+ }, _callee11);
901
925
  }));
902
926
 
903
- return function (_x6) {
904
- return _ref14.apply(this, arguments);
927
+ return function (_x5) {
928
+ return _ref13.apply(this, arguments);
905
929
  };
906
930
  }());
907
931
  (0, _defineProperty2.default)(File, "_continueUpload", /*#__PURE__*/function () {
908
- var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(path, partNumber, firstFileUploadPart) {
932
+ var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(path, partNumber, firstFileUploadPart) {
909
933
  var params, response, partData;
910
- return _regenerator.default.wrap(function _callee13$(_context13) {
934
+ return _regenerator.default.wrap(function _callee12$(_context12) {
911
935
  while (1) {
912
- switch (_context13.prev = _context13.next) {
936
+ switch (_context12.prev = _context12.next) {
913
937
  case 0:
914
938
  params = {
915
939
  action: 'put',
916
940
  part: partNumber,
917
941
  ref: firstFileUploadPart.ref
918
942
  };
919
- _context13.next = 3;
943
+ _context12.next = 3;
920
944
  return _Api.default.sendRequest("/files/".concat(encodeURIComponent(path)), 'POST', params);
921
945
 
922
946
  case 3:
923
- response = _context13.sent;
947
+ response = _context12.sent;
924
948
 
925
949
  if (response) {
926
- _context13.next = 6;
950
+ _context12.next = 6;
927
951
  break;
928
952
  }
929
953
 
930
- return _context13.abrupt("return", null);
954
+ return _context12.abrupt("return", null);
931
955
 
932
956
  case 6:
933
957
  partData = _objectSpread(_objectSpread({}, response.data), {}, {
934
958
  headers: response.headers,
935
959
  parameters: params
936
960
  });
937
- return _context13.abrupt("return", new _FileUploadPart.default(partData));
961
+ return _context12.abrupt("return", new _FileUploadPart.default(partData));
938
962
 
939
963
  case 8:
940
964
  case "end":
941
- return _context13.stop();
965
+ return _context12.stop();
942
966
  }
943
967
  }
944
- }, _callee13);
968
+ }, _callee12);
945
969
  }));
946
970
 
947
- return function (_x7, _x8, _x9) {
948
- return _ref15.apply(this, arguments);
971
+ return function (_x6, _x7, _x8) {
972
+ return _ref14.apply(this, arguments);
949
973
  };
950
974
  }());
951
975
  (0, _defineProperty2.default)(File, "_completeUpload", /*#__PURE__*/function () {
952
- var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(fileUploadPart) {
976
+ var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(fileUploadPart) {
953
977
  var params;
954
- return _regenerator.default.wrap(function _callee14$(_context14) {
978
+ return _regenerator.default.wrap(function _callee13$(_context13) {
955
979
  while (1) {
956
- switch (_context14.prev = _context14.next) {
980
+ switch (_context13.prev = _context13.next) {
957
981
  case 0:
958
982
  params = {
959
983
  action: 'end',
960
984
  ref: fileUploadPart.ref
961
985
  };
962
- return _context14.abrupt("return", _Api.default.sendRequest("/files/".concat(encodeURIComponent(fileUploadPart.path)), 'POST', params));
986
+ return _context13.abrupt("return", _Api.default.sendRequest("/files/".concat(encodeURIComponent(fileUploadPart.path)), 'POST', params));
963
987
 
964
988
  case 2:
965
989
  case "end":
966
- return _context14.stop();
990
+ return _context13.stop();
967
991
  }
968
992
  }
969
- }, _callee14);
993
+ }, _callee13);
970
994
  }));
971
995
 
972
- return function (_x10) {
973
- return _ref16.apply(this, arguments);
996
+ return function (_x9) {
997
+ return _ref15.apply(this, arguments);
974
998
  };
975
999
  }());
976
1000
  (0, _defineProperty2.default)(File, "uploadStream", /*#__PURE__*/function () {
977
- var _ref17 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(destinationPath, readableStream) {
1001
+ var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16(destinationPath, readableStream) {
978
1002
  var fileUploadPart, file;
979
- return _regenerator.default.wrap(function _callee17$(_context17) {
1003
+ return _regenerator.default.wrap(function _callee16$(_context16) {
980
1004
  while (1) {
981
- switch (_context17.prev = _context17.next) {
1005
+ switch (_context16.prev = _context16.next) {
982
1006
  case 0:
983
- _context17.next = 2;
1007
+ _context16.next = 2;
984
1008
  return File._openUpload(destinationPath);
985
1009
 
986
1010
  case 2:
987
- fileUploadPart = _context17.sent;
1011
+ fileUploadPart = _context16.sent;
988
1012
 
989
1013
  if (fileUploadPart) {
990
- _context17.next = 5;
1014
+ _context16.next = 5;
991
1015
  break;
992
1016
  }
993
1017
 
994
- return _context17.abrupt("return");
1018
+ return _context16.abrupt("return");
995
1019
 
996
1020
  case 5:
997
- _context17.prev = 5;
998
- _context17.next = 8;
1021
+ _context16.prev = 5;
1022
+ _context16.next = 8;
999
1023
  return new Promise(function (resolve, reject) {
1000
1024
  var part = 0;
1001
1025
  var chunks = [];
@@ -1004,27 +1028,27 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1004
1028
  reject(error);
1005
1029
  });
1006
1030
  readableStream.on('data', /*#__PURE__*/function () {
1007
- var _ref18 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(chunk) {
1031
+ var _ref17 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(chunk) {
1008
1032
  var buffer, nextFileUploadPart;
1009
- return _regenerator.default.wrap(function _callee15$(_context15) {
1033
+ return _regenerator.default.wrap(function _callee14$(_context14) {
1010
1034
  while (1) {
1011
- switch (_context15.prev = _context15.next) {
1035
+ switch (_context14.prev = _context14.next) {
1012
1036
  case 0:
1013
1037
  length += chunk.length;
1014
1038
 
1015
1039
  if (!(length > fileUploadPart.partsize)) {
1016
- _context15.next = 12;
1040
+ _context14.next = 12;
1017
1041
  break;
1018
1042
  }
1019
1043
 
1020
1044
  readableStream.pause();
1021
1045
  buffer = _safeBuffer.Buffer.concat(chunks);
1022
- _context15.next = 6;
1046
+ _context14.next = 6;
1023
1047
  return File._continueUpload(destinationPath, ++part, fileUploadPart);
1024
1048
 
1025
1049
  case 6:
1026
- nextFileUploadPart = _context15.sent;
1027
- _context15.next = 9;
1050
+ nextFileUploadPart = _context14.sent;
1051
+ _context14.next = 9;
1028
1052
  return _Api.default.sendFilePart(nextFileUploadPart.upload_uri, 'PUT', buffer);
1029
1053
 
1030
1054
  case 9:
@@ -1037,113 +1061,113 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1037
1061
 
1038
1062
  case 13:
1039
1063
  case "end":
1040
- return _context15.stop();
1064
+ return _context14.stop();
1041
1065
  }
1042
1066
  }
1043
- }, _callee15);
1067
+ }, _callee14);
1044
1068
  }));
1045
1069
 
1046
- return function (_x13) {
1047
- return _ref18.apply(this, arguments);
1070
+ return function (_x12) {
1071
+ return _ref17.apply(this, arguments);
1048
1072
  };
1049
1073
  }());
1050
- readableStream.on('end', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
1074
+ readableStream.on('end', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15() {
1051
1075
  var buffer, nextFileUploadPart, response, createdFile;
1052
- return _regenerator.default.wrap(function _callee16$(_context16) {
1076
+ return _regenerator.default.wrap(function _callee15$(_context15) {
1053
1077
  while (1) {
1054
- switch (_context16.prev = _context16.next) {
1078
+ switch (_context15.prev = _context15.next) {
1055
1079
  case 0:
1056
1080
  if (!(chunks.length > 0)) {
1057
- _context16.next = 7;
1081
+ _context15.next = 7;
1058
1082
  break;
1059
1083
  }
1060
1084
 
1061
1085
  buffer = _safeBuffer.Buffer.concat(chunks);
1062
- _context16.next = 4;
1086
+ _context15.next = 4;
1063
1087
  return File._continueUpload(destinationPath, ++part, fileUploadPart);
1064
1088
 
1065
1089
  case 4:
1066
- nextFileUploadPart = _context16.sent;
1067
- _context16.next = 7;
1090
+ nextFileUploadPart = _context15.sent;
1091
+ _context15.next = 7;
1068
1092
  return _Api.default.sendFilePart(nextFileUploadPart.upload_uri, 'PUT', buffer);
1069
1093
 
1070
1094
  case 7:
1071
- _context16.next = 9;
1095
+ _context15.next = 9;
1072
1096
  return File._completeUpload(fileUploadPart);
1073
1097
 
1074
1098
  case 9:
1075
- response = _context16.sent;
1099
+ response = _context15.sent;
1076
1100
  createdFile = new File(response.data);
1077
1101
  resolve(createdFile);
1078
1102
 
1079
1103
  case 12:
1080
1104
  case "end":
1081
- return _context16.stop();
1105
+ return _context15.stop();
1082
1106
  }
1083
1107
  }
1084
- }, _callee16);
1108
+ }, _callee15);
1085
1109
  })));
1086
1110
  });
1087
1111
 
1088
1112
  case 8:
1089
- file = _context17.sent;
1090
- return _context17.abrupt("return", file);
1113
+ file = _context16.sent;
1114
+ return _context16.abrupt("return", file);
1091
1115
 
1092
1116
  case 12:
1093
- _context17.prev = 12;
1094
- _context17.t0 = _context17["catch"](5);
1095
- throw _context17.t0;
1117
+ _context16.prev = 12;
1118
+ _context16.t0 = _context16["catch"](5);
1119
+ throw _context16.t0;
1096
1120
 
1097
1121
  case 15:
1098
1122
  case "end":
1099
- return _context17.stop();
1123
+ return _context16.stop();
1100
1124
  }
1101
1125
  }
1102
- }, _callee17, null, [[5, 12]]);
1126
+ }, _callee16, null, [[5, 12]]);
1103
1127
  }));
1104
1128
 
1105
- return function (_x11, _x12) {
1106
- return _ref17.apply(this, arguments);
1129
+ return function (_x10, _x11) {
1130
+ return _ref16.apply(this, arguments);
1107
1131
  };
1108
1132
  }());
1109
1133
  (0, _defineProperty2.default)(File, "uploadData", /*#__PURE__*/function () {
1110
- var _ref20 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(destinationPath, data) {
1111
- return _regenerator.default.wrap(function _callee18$(_context18) {
1134
+ var _ref19 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(destinationPath, data) {
1135
+ return _regenerator.default.wrap(function _callee17$(_context17) {
1112
1136
  while (1) {
1113
- switch (_context18.prev = _context18.next) {
1137
+ switch (_context17.prev = _context17.next) {
1114
1138
  case 0:
1115
1139
  if (data) {
1116
- _context18.next = 2;
1140
+ _context17.next = 2;
1117
1141
  break;
1118
1142
  }
1119
1143
 
1120
1144
  throw new Error('Upload data was not provided');
1121
1145
 
1122
1146
  case 2:
1123
- return _context18.abrupt("return", File.uploadStream(destinationPath, _readableStream.default.from(data)));
1147
+ return _context17.abrupt("return", File.uploadStream(destinationPath, _readableStream.default.from(data)));
1124
1148
 
1125
1149
  case 3:
1126
1150
  case "end":
1127
- return _context18.stop();
1151
+ return _context17.stop();
1128
1152
  }
1129
1153
  }
1130
- }, _callee18);
1154
+ }, _callee17);
1131
1155
  }));
1132
1156
 
1133
- return function (_x14, _x15) {
1134
- return _ref20.apply(this, arguments);
1157
+ return function (_x13, _x14) {
1158
+ return _ref19.apply(this, arguments);
1135
1159
  };
1136
1160
  }());
1137
1161
  (0, _defineProperty2.default)(File, "uploadFile", /*#__PURE__*/function () {
1138
- var _ref21 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19(destinationPath, sourceFilePath) {
1162
+ var _ref20 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(destinationPath, sourceFilePath) {
1139
1163
  var _require3, openDiskFileReadStream, stream;
1140
1164
 
1141
- return _regenerator.default.wrap(function _callee19$(_context19) {
1165
+ return _regenerator.default.wrap(function _callee18$(_context18) {
1142
1166
  while (1) {
1143
- switch (_context19.prev = _context19.next) {
1167
+ switch (_context18.prev = _context18.next) {
1144
1168
  case 0:
1145
1169
  if (!(0, _utils.isBrowser)()) {
1146
- _context19.next = 2;
1170
+ _context18.next = 2;
1147
1171
  break;
1148
1172
  }
1149
1173
 
@@ -1152,61 +1176,35 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1152
1176
  case 2:
1153
1177
  _require3 = require('../isomorphic/File.node.js'), openDiskFileReadStream = _require3.openDiskFileReadStream;
1154
1178
  stream = openDiskFileReadStream(sourceFilePath);
1155
- return _context19.abrupt("return", File.uploadStream(destinationPath, stream));
1179
+ return _context18.abrupt("return", File.uploadStream(destinationPath, stream));
1156
1180
 
1157
1181
  case 5:
1158
1182
  case "end":
1159
- return _context19.stop();
1160
- }
1161
- }
1162
- }, _callee19);
1163
- }));
1164
-
1165
- return function (_x16, _x17) {
1166
- return _ref21.apply(this, arguments);
1167
- };
1168
- }());
1169
- (0, _defineProperty2.default)(File, "findDownload", /*#__PURE__*/function () {
1170
- var _ref22 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20(path) {
1171
- var response;
1172
- return _regenerator.default.wrap(function _callee20$(_context20) {
1173
- while (1) {
1174
- switch (_context20.prev = _context20.next) {
1175
- case 0:
1176
- _context20.next = 2;
1177
- return _Api.default.sendRequest("/files/".concat(encodeURIComponent(path)), 'GET');
1178
-
1179
- case 2:
1180
- response = _context20.sent;
1181
- return _context20.abrupt("return", new File(response.data));
1182
-
1183
- case 4:
1184
- case "end":
1185
- return _context20.stop();
1183
+ return _context18.stop();
1186
1184
  }
1187
1185
  }
1188
- }, _callee20);
1186
+ }, _callee18);
1189
1187
  }));
1190
1188
 
1191
- return function (_x18) {
1192
- return _ref22.apply(this, arguments);
1189
+ return function (_x15, _x16) {
1190
+ return _ref20.apply(this, arguments);
1193
1191
  };
1194
1192
  }());
1195
1193
  (0, _defineProperty2.default)(File, "create", /*#__PURE__*/function () {
1196
- var _ref23 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21(path) {
1194
+ var _ref21 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19(path) {
1197
1195
  var params,
1198
1196
  options,
1199
1197
  response,
1200
- _args21 = arguments;
1201
- return _regenerator.default.wrap(function _callee21$(_context21) {
1198
+ _args19 = arguments;
1199
+ return _regenerator.default.wrap(function _callee19$(_context19) {
1202
1200
  while (1) {
1203
- switch (_context21.prev = _context21.next) {
1201
+ switch (_context19.prev = _context19.next) {
1204
1202
  case 0:
1205
- params = _args21.length > 1 && _args21[1] !== undefined ? _args21[1] : {};
1206
- options = _args21.length > 2 && _args21[2] !== undefined ? _args21[2] : {};
1203
+ params = _args19.length > 1 && _args19[1] !== undefined ? _args19[1] : {};
1204
+ options = _args19.length > 2 && _args19[2] !== undefined ? _args19[2] : {};
1207
1205
 
1208
1206
  if ((0, _utils.isObject)(params)) {
1209
- _context21.next = 4;
1207
+ _context19.next = 4;
1210
1208
  break;
1211
1209
  }
1212
1210
 
@@ -1216,7 +1214,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1216
1214
  params['path'] = path;
1217
1215
 
1218
1216
  if (params['path']) {
1219
- _context21.next = 7;
1217
+ _context19.next = 7;
1220
1218
  break;
1221
1219
  }
1222
1220
 
@@ -1224,7 +1222,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1224
1222
 
1225
1223
  case 7:
1226
1224
  if (!(params['path'] && !(0, _utils.isString)(params['path']))) {
1227
- _context21.next = 9;
1225
+ _context19.next = 9;
1228
1226
  break;
1229
1227
  }
1230
1228
 
@@ -1232,7 +1230,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1232
1230
 
1233
1231
  case 9:
1234
1232
  if (!(params['action'] && !(0, _utils.isString)(params['action']))) {
1235
- _context21.next = 11;
1233
+ _context19.next = 11;
1236
1234
  break;
1237
1235
  }
1238
1236
 
@@ -1240,7 +1238,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1240
1238
 
1241
1239
  case 11:
1242
1240
  if (!(params['length'] && !(0, _utils.isInt)(params['length']))) {
1243
- _context21.next = 13;
1241
+ _context19.next = 13;
1244
1242
  break;
1245
1243
  }
1246
1244
 
@@ -1248,7 +1246,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1248
1246
 
1249
1247
  case 13:
1250
1248
  if (!(params['part'] && !(0, _utils.isInt)(params['part']))) {
1251
- _context21.next = 15;
1249
+ _context19.next = 15;
1252
1250
  break;
1253
1251
  }
1254
1252
 
@@ -1256,7 +1254,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1256
1254
 
1257
1255
  case 15:
1258
1256
  if (!(params['parts'] && !(0, _utils.isInt)(params['parts']))) {
1259
- _context21.next = 17;
1257
+ _context19.next = 17;
1260
1258
  break;
1261
1259
  }
1262
1260
 
@@ -1264,7 +1262,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1264
1262
 
1265
1263
  case 17:
1266
1264
  if (!(params['provided_mtime'] && !(0, _utils.isString)(params['provided_mtime']))) {
1267
- _context21.next = 19;
1265
+ _context19.next = 19;
1268
1266
  break;
1269
1267
  }
1270
1268
 
@@ -1272,7 +1270,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1272
1270
 
1273
1271
  case 19:
1274
1272
  if (!(params['ref'] && !(0, _utils.isString)(params['ref']))) {
1275
- _context21.next = 21;
1273
+ _context19.next = 21;
1276
1274
  break;
1277
1275
  }
1278
1276
 
@@ -1280,7 +1278,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1280
1278
 
1281
1279
  case 21:
1282
1280
  if (!(params['restart'] && !(0, _utils.isInt)(params['restart']))) {
1283
- _context21.next = 23;
1281
+ _context19.next = 23;
1284
1282
  break;
1285
1283
  }
1286
1284
 
@@ -1288,7 +1286,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1288
1286
 
1289
1287
  case 23:
1290
1288
  if (!(params['size'] && !(0, _utils.isInt)(params['size']))) {
1291
- _context21.next = 25;
1289
+ _context19.next = 25;
1292
1290
  break;
1293
1291
  }
1294
1292
 
@@ -1296,47 +1294,47 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1296
1294
 
1297
1295
  case 25:
1298
1296
  if (!(params['structure'] && !(0, _utils.isString)(params['structure']))) {
1299
- _context21.next = 27;
1297
+ _context19.next = 27;
1300
1298
  break;
1301
1299
  }
1302
1300
 
1303
1301
  throw new Error("Bad parameter: structure must be of type String, received ".concat((0, _utils.getType)(structure)));
1304
1302
 
1305
1303
  case 27:
1306
- _context21.next = 29;
1304
+ _context19.next = 29;
1307
1305
  return _Api.default.sendRequest("/files/".concat(params['path']), 'POST', params, options);
1308
1306
 
1309
1307
  case 29:
1310
- response = _context21.sent;
1311
- return _context21.abrupt("return", new File(response === null || response === void 0 ? void 0 : response.data, options));
1308
+ response = _context19.sent;
1309
+ return _context19.abrupt("return", new File(response === null || response === void 0 ? void 0 : response.data, options));
1312
1310
 
1313
1311
  case 31:
1314
1312
  case "end":
1315
- return _context21.stop();
1313
+ return _context19.stop();
1316
1314
  }
1317
1315
  }
1318
- }, _callee21);
1316
+ }, _callee19);
1319
1317
  }));
1320
1318
 
1321
- return function (_x19) {
1322
- return _ref23.apply(this, arguments);
1319
+ return function (_x17) {
1320
+ return _ref21.apply(this, arguments);
1323
1321
  };
1324
1322
  }());
1325
1323
  (0, _defineProperty2.default)(File, "find", /*#__PURE__*/function () {
1326
- var _ref24 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee22(path) {
1324
+ var _ref22 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20(path) {
1327
1325
  var params,
1328
1326
  options,
1329
1327
  response,
1330
- _args22 = arguments;
1331
- return _regenerator.default.wrap(function _callee22$(_context22) {
1328
+ _args20 = arguments;
1329
+ return _regenerator.default.wrap(function _callee20$(_context20) {
1332
1330
  while (1) {
1333
- switch (_context22.prev = _context22.next) {
1331
+ switch (_context20.prev = _context20.next) {
1334
1332
  case 0:
1335
- params = _args22.length > 1 && _args22[1] !== undefined ? _args22[1] : {};
1336
- options = _args22.length > 2 && _args22[2] !== undefined ? _args22[2] : {};
1333
+ params = _args20.length > 1 && _args20[1] !== undefined ? _args20[1] : {};
1334
+ options = _args20.length > 2 && _args20[2] !== undefined ? _args20[2] : {};
1337
1335
 
1338
1336
  if ((0, _utils.isObject)(params)) {
1339
- _context22.next = 4;
1337
+ _context20.next = 4;
1340
1338
  break;
1341
1339
  }
1342
1340
 
@@ -1346,7 +1344,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1346
1344
  params['path'] = path;
1347
1345
 
1348
1346
  if (params['path']) {
1349
- _context22.next = 7;
1347
+ _context20.next = 7;
1350
1348
  break;
1351
1349
  }
1352
1350
 
@@ -1354,7 +1352,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1354
1352
 
1355
1353
  case 7:
1356
1354
  if (!(params['path'] && !(0, _utils.isString)(params['path']))) {
1357
- _context22.next = 9;
1355
+ _context20.next = 9;
1358
1356
  break;
1359
1357
  }
1360
1358
 
@@ -1362,30 +1360,30 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1362
1360
 
1363
1361
  case 9:
1364
1362
  if (!(params['preview_size'] && !(0, _utils.isString)(params['preview_size']))) {
1365
- _context22.next = 11;
1363
+ _context20.next = 11;
1366
1364
  break;
1367
1365
  }
1368
1366
 
1369
1367
  throw new Error("Bad parameter: preview_size must be of type String, received ".concat((0, _utils.getType)(preview_size)));
1370
1368
 
1371
1369
  case 11:
1372
- _context22.next = 13;
1370
+ _context20.next = 13;
1373
1371
  return _Api.default.sendRequest("/file_actions/metadata/".concat(params['path']), 'GET', params, options);
1374
1372
 
1375
1373
  case 13:
1376
- response = _context22.sent;
1377
- return _context22.abrupt("return", new File(response === null || response === void 0 ? void 0 : response.data, options));
1374
+ response = _context20.sent;
1375
+ return _context20.abrupt("return", new File(response === null || response === void 0 ? void 0 : response.data, options));
1378
1376
 
1379
1377
  case 15:
1380
1378
  case "end":
1381
- return _context22.stop();
1379
+ return _context20.stop();
1382
1380
  }
1383
1381
  }
1384
- }, _callee22);
1382
+ }, _callee20);
1385
1383
  }));
1386
1384
 
1387
- return function (_x20) {
1388
- return _ref24.apply(this, arguments);
1385
+ return function (_x18) {
1386
+ return _ref22.apply(this, arguments);
1389
1387
  };
1390
1388
  }());
1391
1389
  (0, _defineProperty2.default)(File, "get", function (path) {