files.com 1.2.236 → 1.2.238
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_VERSION +1 -1
- package/docs/models/Site.md +4 -0
- package/lib/Api.js +3 -4
- package/lib/Errors.js +964 -964
- package/lib/Files.js +1 -1
- package/lib/models/AccountLineItem.js +1 -2
- package/lib/models/Action.js +1 -2
- package/lib/models/ActionNotificationExport.js +1 -2
- package/lib/models/ActionNotificationExportResult.js +1 -2
- package/lib/models/ApiKey.js +1 -2
- package/lib/models/ApiRequestLog.js +1 -2
- package/lib/models/App.js +1 -2
- package/lib/models/As2IncomingMessage.js +1 -2
- package/lib/models/As2OutgoingMessage.js +1 -2
- package/lib/models/As2Partner.js +1 -2
- package/lib/models/As2Station.js +1 -2
- package/lib/models/Auto.js +1 -2
- package/lib/models/Automation.js +1 -2
- package/lib/models/AutomationLog.js +1 -2
- package/lib/models/AutomationRun.js +1 -2
- package/lib/models/BandwidthSnapshot.js +1 -2
- package/lib/models/Behavior.js +1 -2
- package/lib/models/Bundle.js +1 -2
- package/lib/models/BundleAction.js +1 -2
- package/lib/models/BundleDownload.js +1 -2
- package/lib/models/BundleNotification.js +1 -2
- package/lib/models/BundlePath.js +1 -2
- package/lib/models/BundleRecipient.js +1 -2
- package/lib/models/BundleRegistration.js +1 -2
- package/lib/models/Clickwrap.js +1 -2
- package/lib/models/DnsRecord.js +1 -2
- package/lib/models/EmailIncomingMessage.js +1 -2
- package/lib/models/EmailLog.js +1 -2
- package/lib/models/Errors.js +1 -2
- package/lib/models/ExavaultApiRequestLog.js +1 -2
- package/lib/models/ExternalEvent.js +1 -2
- package/lib/models/File.js +206 -207
- package/lib/models/FileAction.js +1 -2
- package/lib/models/FileComment.js +1 -2
- package/lib/models/FileCommentReaction.js +1 -2
- package/lib/models/FileMigration.js +1 -2
- package/lib/models/FileMigrationLog.js +1 -2
- package/lib/models/FileUploadPart.js +1 -2
- package/lib/models/Folder.js +1 -2
- package/lib/models/FormField.js +1 -2
- package/lib/models/FormFieldSet.js +1 -2
- package/lib/models/FtpActionLog.js +1 -2
- package/lib/models/GpgKey.js +1 -2
- package/lib/models/Group.js +1 -2
- package/lib/models/GroupUser.js +1 -2
- package/lib/models/History.js +1 -2
- package/lib/models/HistoryExport.js +1 -2
- package/lib/models/HistoryExportResult.js +1 -2
- package/lib/models/Image.js +1 -2
- package/lib/models/InboxRecipient.js +1 -2
- package/lib/models/InboxRegistration.js +1 -2
- package/lib/models/InboxUpload.js +1 -2
- package/lib/models/Invoice.js +1 -2
- package/lib/models/InvoiceLineItem.js +1 -2
- package/lib/models/IpAddress.js +1 -2
- package/lib/models/Lock.js +1 -2
- package/lib/models/Message.js +1 -2
- package/lib/models/MessageComment.js +1 -2
- package/lib/models/MessageCommentReaction.js +1 -2
- package/lib/models/MessageReaction.js +1 -2
- package/lib/models/Notification.js +1 -2
- package/lib/models/OutboundConnectionLog.js +1 -2
- package/lib/models/Payment.js +1 -2
- package/lib/models/PaymentLineItem.js +1 -2
- package/lib/models/Permission.js +1 -2
- package/lib/models/Preview.js +1 -2
- package/lib/models/Priority.js +1 -2
- package/lib/models/Project.js +1 -2
- package/lib/models/PublicHostingRequestLog.js +1 -2
- package/lib/models/PublicIpAddress.js +1 -2
- package/lib/models/PublicKey.js +1 -2
- package/lib/models/RemoteBandwidthSnapshot.js +1 -2
- package/lib/models/RemoteServer.js +1 -2
- package/lib/models/RemoteServerConfigurationFile.js +1 -2
- package/lib/models/Request.js +1 -2
- package/lib/models/Restore.js +1 -2
- package/lib/models/Session.js +1 -2
- package/lib/models/SettingsChange.js +1 -2
- package/lib/models/SftpActionLog.js +1 -2
- package/lib/models/SftpHostKey.js +1 -2
- package/lib/models/ShareGroup.js +1 -2
- package/lib/models/ShareGroupMember.js +1 -2
- package/lib/models/SiemHttpDestination.js +1 -2
- package/lib/models/Site.js +6 -2
- package/lib/models/Snapshot.js +1 -2
- package/lib/models/SsoStrategy.js +1 -2
- package/lib/models/Status.js +1 -2
- package/lib/models/Style.js +1 -2
- package/lib/models/SyncLog.js +1 -2
- package/lib/models/UsageByTopLevelDir.js +1 -2
- package/lib/models/UsageDailySnapshot.js +1 -2
- package/lib/models/UsageSnapshot.js +1 -2
- package/lib/models/User.js +3 -4
- package/lib/models/UserCipherUse.js +1 -2
- package/lib/models/UserRequest.js +1 -2
- package/lib/models/UserSftpClientUse.js +1 -2
- package/lib/models/WebDavActionLog.js +1 -2
- package/lib/models/WebhookTest.js +1 -2
- package/package.json +1 -1
- package/src/Files.js +1 -1
- package/src/models/Site.js +4 -0
package/lib/models/File.js
CHANGED
|
@@ -19,8 +19,7 @@ var _utils = require("../utils");
|
|
|
19
19
|
var _excluded = ["determinePartUploadUri"];
|
|
20
20
|
var _File;
|
|
21
21
|
/* eslint-disable no-unused-vars */
|
|
22
|
-
function
|
|
23
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
22
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
24
23
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
25
24
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
26
25
|
/* eslint-enable no-unused-vars */
|
|
@@ -748,79 +747,79 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
|
|
|
748
747
|
// Parameters:
|
|
749
748
|
// destination (required) - string - Move destination path.
|
|
750
749
|
// overwrite - boolean - Overwrite existing file(s) in the destination?
|
|
751
|
-
(0, _defineProperty2.default)(this, "move", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
750
|
+
(0, _defineProperty2.default)(this, "move", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee0() {
|
|
752
751
|
var params,
|
|
753
752
|
response,
|
|
754
753
|
FileAction,
|
|
755
|
-
|
|
756
|
-
return _regenerator.default.wrap(function
|
|
757
|
-
while (1) switch (
|
|
754
|
+
_args0 = arguments;
|
|
755
|
+
return _regenerator.default.wrap(function _callee0$(_context0) {
|
|
756
|
+
while (1) switch (_context0.prev = _context0.next) {
|
|
758
757
|
case 0:
|
|
759
|
-
params =
|
|
758
|
+
params = _args0.length > 0 && _args0[0] !== undefined ? _args0[0] : {};
|
|
760
759
|
if (_this.attributes.path) {
|
|
761
|
-
|
|
760
|
+
_context0.next = 3;
|
|
762
761
|
break;
|
|
763
762
|
}
|
|
764
763
|
throw new errors.EmptyPropertyError('Current object has no path');
|
|
765
764
|
case 3:
|
|
766
765
|
if ((0, _utils.isObject)(params)) {
|
|
767
|
-
|
|
766
|
+
_context0.next = 5;
|
|
768
767
|
break;
|
|
769
768
|
}
|
|
770
769
|
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
|
771
770
|
case 5:
|
|
772
771
|
params.path = _this.attributes.path;
|
|
773
772
|
if (!(params.path && !(0, _utils.isString)(params.path))) {
|
|
774
|
-
|
|
773
|
+
_context0.next = 8;
|
|
775
774
|
break;
|
|
776
775
|
}
|
|
777
776
|
throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(params.path)));
|
|
778
777
|
case 8:
|
|
779
778
|
if (!(params.destination && !(0, _utils.isString)(params.destination))) {
|
|
780
|
-
|
|
779
|
+
_context0.next = 10;
|
|
781
780
|
break;
|
|
782
781
|
}
|
|
783
782
|
throw new errors.InvalidParameterError("Bad parameter: destination must be of type String, received ".concat((0, _utils.getType)(params.destination)));
|
|
784
783
|
case 10:
|
|
785
784
|
if (params.path) {
|
|
786
|
-
|
|
785
|
+
_context0.next = 16;
|
|
787
786
|
break;
|
|
788
787
|
}
|
|
789
788
|
if (!_this.attributes.path) {
|
|
790
|
-
|
|
789
|
+
_context0.next = 15;
|
|
791
790
|
break;
|
|
792
791
|
}
|
|
793
792
|
params.path = _this.path;
|
|
794
|
-
|
|
793
|
+
_context0.next = 16;
|
|
795
794
|
break;
|
|
796
795
|
case 15:
|
|
797
796
|
throw new errors.MissingParameterError('Parameter missing: path');
|
|
798
797
|
case 16:
|
|
799
798
|
if (params.destination) {
|
|
800
|
-
|
|
799
|
+
_context0.next = 22;
|
|
801
800
|
break;
|
|
802
801
|
}
|
|
803
802
|
if (!_this.attributes.destination) {
|
|
804
|
-
|
|
803
|
+
_context0.next = 21;
|
|
805
804
|
break;
|
|
806
805
|
}
|
|
807
806
|
params.destination = _this.destination;
|
|
808
|
-
|
|
807
|
+
_context0.next = 22;
|
|
809
808
|
break;
|
|
810
809
|
case 21:
|
|
811
810
|
throw new errors.MissingParameterError('Parameter missing: destination');
|
|
812
811
|
case 22:
|
|
813
|
-
|
|
812
|
+
_context0.next = 24;
|
|
814
813
|
return _Api.default.sendRequest("/file_actions/move/".concat(encodeURIComponent(params.path)), 'POST', params, _this.options);
|
|
815
814
|
case 24:
|
|
816
|
-
response =
|
|
815
|
+
response = _context0.sent;
|
|
817
816
|
FileAction = require('./FileAction.js').default;
|
|
818
|
-
return
|
|
817
|
+
return _context0.abrupt("return", new FileAction(response === null || response === void 0 ? void 0 : response.data, _this.options));
|
|
819
818
|
case 27:
|
|
820
819
|
case "end":
|
|
821
|
-
return
|
|
820
|
+
return _context0.stop();
|
|
822
821
|
}
|
|
823
|
-
},
|
|
822
|
+
}, _callee0);
|
|
824
823
|
})));
|
|
825
824
|
// Begin File Upload
|
|
826
825
|
//
|
|
@@ -832,114 +831,114 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
|
|
|
832
831
|
// restart - int64 - File byte offset to restart from.
|
|
833
832
|
// size - int64 - Total bytes of file being uploaded (include bytes being retained if appending/restarting).
|
|
834
833
|
// with_rename - boolean - Allow file rename instead of overwrite?
|
|
835
|
-
(0, _defineProperty2.default)(this, "beginUpload", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
834
|
+
(0, _defineProperty2.default)(this, "beginUpload", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee1() {
|
|
836
835
|
var _response$data;
|
|
837
836
|
var params,
|
|
838
837
|
response,
|
|
839
838
|
FileUploadPart,
|
|
840
|
-
|
|
841
|
-
return _regenerator.default.wrap(function
|
|
842
|
-
while (1) switch (
|
|
839
|
+
_args1 = arguments;
|
|
840
|
+
return _regenerator.default.wrap(function _callee1$(_context1) {
|
|
841
|
+
while (1) switch (_context1.prev = _context1.next) {
|
|
843
842
|
case 0:
|
|
844
|
-
params =
|
|
843
|
+
params = _args1.length > 0 && _args1[0] !== undefined ? _args1[0] : {};
|
|
845
844
|
if (_this.attributes.path) {
|
|
846
|
-
|
|
845
|
+
_context1.next = 3;
|
|
847
846
|
break;
|
|
848
847
|
}
|
|
849
848
|
throw new errors.EmptyPropertyError('Current object has no path');
|
|
850
849
|
case 3:
|
|
851
850
|
if ((0, _utils.isObject)(params)) {
|
|
852
|
-
|
|
851
|
+
_context1.next = 5;
|
|
853
852
|
break;
|
|
854
853
|
}
|
|
855
854
|
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
|
856
855
|
case 5:
|
|
857
856
|
params.path = _this.attributes.path;
|
|
858
857
|
if (!(params.path && !(0, _utils.isString)(params.path))) {
|
|
859
|
-
|
|
858
|
+
_context1.next = 8;
|
|
860
859
|
break;
|
|
861
860
|
}
|
|
862
861
|
throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(params.path)));
|
|
863
862
|
case 8:
|
|
864
863
|
if (!(params.part && !(0, _utils.isInt)(params.part))) {
|
|
865
|
-
|
|
864
|
+
_context1.next = 10;
|
|
866
865
|
break;
|
|
867
866
|
}
|
|
868
867
|
throw new errors.InvalidParameterError("Bad parameter: part must be of type Int, received ".concat((0, _utils.getType)(params.part)));
|
|
869
868
|
case 10:
|
|
870
869
|
if (!(params.parts && !(0, _utils.isInt)(params.parts))) {
|
|
871
|
-
|
|
870
|
+
_context1.next = 12;
|
|
872
871
|
break;
|
|
873
872
|
}
|
|
874
873
|
throw new errors.InvalidParameterError("Bad parameter: parts must be of type Int, received ".concat((0, _utils.getType)(params.parts)));
|
|
875
874
|
case 12:
|
|
876
875
|
if (!(params.ref && !(0, _utils.isString)(params.ref))) {
|
|
877
|
-
|
|
876
|
+
_context1.next = 14;
|
|
878
877
|
break;
|
|
879
878
|
}
|
|
880
879
|
throw new errors.InvalidParameterError("Bad parameter: ref must be of type String, received ".concat((0, _utils.getType)(params.ref)));
|
|
881
880
|
case 14:
|
|
882
881
|
if (!(params.restart && !(0, _utils.isInt)(params.restart))) {
|
|
883
|
-
|
|
882
|
+
_context1.next = 16;
|
|
884
883
|
break;
|
|
885
884
|
}
|
|
886
885
|
throw new errors.InvalidParameterError("Bad parameter: restart must be of type Int, received ".concat((0, _utils.getType)(params.restart)));
|
|
887
886
|
case 16:
|
|
888
887
|
if (!(params.size && !(0, _utils.isInt)(params.size))) {
|
|
889
|
-
|
|
888
|
+
_context1.next = 18;
|
|
890
889
|
break;
|
|
891
890
|
}
|
|
892
891
|
throw new errors.InvalidParameterError("Bad parameter: size must be of type Int, received ".concat((0, _utils.getType)(params.size)));
|
|
893
892
|
case 18:
|
|
894
893
|
if (params.path) {
|
|
895
|
-
|
|
894
|
+
_context1.next = 24;
|
|
896
895
|
break;
|
|
897
896
|
}
|
|
898
897
|
if (!_this.attributes.path) {
|
|
899
|
-
|
|
898
|
+
_context1.next = 23;
|
|
900
899
|
break;
|
|
901
900
|
}
|
|
902
901
|
params.path = _this.path;
|
|
903
|
-
|
|
902
|
+
_context1.next = 24;
|
|
904
903
|
break;
|
|
905
904
|
case 23:
|
|
906
905
|
throw new errors.MissingParameterError('Parameter missing: path');
|
|
907
906
|
case 24:
|
|
908
|
-
|
|
907
|
+
_context1.next = 26;
|
|
909
908
|
return _Api.default.sendRequest("/file_actions/begin_upload/".concat(encodeURIComponent(params.path)), 'POST', params, _this.options);
|
|
910
909
|
case 26:
|
|
911
|
-
response =
|
|
910
|
+
response = _context1.sent;
|
|
912
911
|
FileUploadPart = require('./FileUploadPart.js').default;
|
|
913
|
-
return
|
|
912
|
+
return _context1.abrupt("return", (response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.map(function (obj) {
|
|
914
913
|
return new FileUploadPart(obj, _this.options);
|
|
915
914
|
})) || []);
|
|
916
915
|
case 29:
|
|
917
916
|
case "end":
|
|
918
|
-
return
|
|
917
|
+
return _context1.stop();
|
|
919
918
|
}
|
|
920
|
-
},
|
|
919
|
+
}, _callee1);
|
|
921
920
|
})));
|
|
922
|
-
(0, _defineProperty2.default)(this, "save", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function
|
|
921
|
+
(0, _defineProperty2.default)(this, "save", /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10() {
|
|
923
922
|
var newObject;
|
|
924
|
-
return _regenerator.default.wrap(function
|
|
925
|
-
while (1) switch (
|
|
923
|
+
return _regenerator.default.wrap(function _callee10$(_context10) {
|
|
924
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
926
925
|
case 0:
|
|
927
|
-
|
|
926
|
+
_context10.next = 2;
|
|
928
927
|
return File.create(_this.attributes.path, _this.attributes, _this.options);
|
|
929
928
|
case 2:
|
|
930
|
-
newObject =
|
|
929
|
+
newObject = _context10.sent;
|
|
931
930
|
_this.attributes = _objectSpread({}, newObject.attributes);
|
|
932
|
-
return
|
|
931
|
+
return _context10.abrupt("return", true);
|
|
933
932
|
case 5:
|
|
934
933
|
case "end":
|
|
935
|
-
return
|
|
934
|
+
return _context10.stop();
|
|
936
935
|
}
|
|
937
|
-
},
|
|
936
|
+
}, _callee10);
|
|
938
937
|
})));
|
|
939
|
-
Object.entries(attributes).forEach(function (
|
|
940
|
-
var
|
|
941
|
-
key =
|
|
942
|
-
value =
|
|
938
|
+
Object.entries(attributes).forEach(function (_ref11) {
|
|
939
|
+
var _ref12 = (0, _slicedToArray2.default)(_ref11, 2),
|
|
940
|
+
key = _ref12[0],
|
|
941
|
+
value = _ref12[1];
|
|
943
942
|
var normalizedKey = key.replace('?', '');
|
|
944
943
|
_this.attributes[normalizedKey] = value;
|
|
945
944
|
Object.defineProperty(_this, normalizedKey, {
|
|
@@ -951,123 +950,123 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
|
|
|
951
950
|
});
|
|
952
951
|
_File = File;
|
|
953
952
|
(0, _defineProperty2.default)(File, "_openUpload", /*#__PURE__*/function () {
|
|
954
|
-
var
|
|
953
|
+
var _ref13 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11(path, paramsRaw, options) {
|
|
955
954
|
var params, response, partData, FileUploadPart;
|
|
956
|
-
return _regenerator.default.wrap(function
|
|
957
|
-
while (1) switch (
|
|
955
|
+
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
956
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
958
957
|
case 0:
|
|
959
958
|
params = _objectSpread(_objectSpread({}, paramsRaw), {}, {
|
|
960
959
|
action: 'put'
|
|
961
960
|
});
|
|
962
|
-
|
|
961
|
+
_context11.next = 3;
|
|
963
962
|
return _Api.default.sendRequest("/files/".concat(encodeURIComponent(path)), 'POST', params, options);
|
|
964
963
|
case 3:
|
|
965
|
-
response =
|
|
964
|
+
response = _context11.sent;
|
|
966
965
|
if (response) {
|
|
967
|
-
|
|
966
|
+
_context11.next = 6;
|
|
968
967
|
break;
|
|
969
968
|
}
|
|
970
|
-
return
|
|
969
|
+
return _context11.abrupt("return", null);
|
|
971
970
|
case 6:
|
|
972
971
|
partData = _objectSpread(_objectSpread({}, response.data), {}, {
|
|
973
972
|
headers: response.headers,
|
|
974
973
|
parameters: params
|
|
975
974
|
});
|
|
976
975
|
FileUploadPart = require('./FileUploadPart.js').default;
|
|
977
|
-
return
|
|
976
|
+
return _context11.abrupt("return", new FileUploadPart(partData));
|
|
978
977
|
case 9:
|
|
979
978
|
case "end":
|
|
980
|
-
return
|
|
979
|
+
return _context11.stop();
|
|
981
980
|
}
|
|
982
|
-
},
|
|
981
|
+
}, _callee11);
|
|
983
982
|
}));
|
|
984
983
|
return function (_x7, _x8, _x9) {
|
|
985
|
-
return
|
|
984
|
+
return _ref13.apply(this, arguments);
|
|
986
985
|
};
|
|
987
986
|
}());
|
|
988
987
|
(0, _defineProperty2.default)(File, "_continueUpload", /*#__PURE__*/function () {
|
|
989
|
-
var
|
|
988
|
+
var _ref14 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee12(path, partNumber, firstFileUploadPart, options) {
|
|
990
989
|
var params, response, partData, FileUploadPart;
|
|
991
|
-
return _regenerator.default.wrap(function
|
|
992
|
-
while (1) switch (
|
|
990
|
+
return _regenerator.default.wrap(function _callee12$(_context12) {
|
|
991
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
993
992
|
case 0:
|
|
994
993
|
params = {
|
|
995
994
|
action: 'put',
|
|
996
995
|
part: partNumber,
|
|
997
996
|
ref: firstFileUploadPart.ref
|
|
998
997
|
};
|
|
999
|
-
|
|
998
|
+
_context12.next = 3;
|
|
1000
999
|
return _Api.default.sendRequest("/files/".concat(encodeURIComponent(path)), 'POST', params, options);
|
|
1001
1000
|
case 3:
|
|
1002
|
-
response =
|
|
1001
|
+
response = _context12.sent;
|
|
1003
1002
|
if (response) {
|
|
1004
|
-
|
|
1003
|
+
_context12.next = 6;
|
|
1005
1004
|
break;
|
|
1006
1005
|
}
|
|
1007
|
-
return
|
|
1006
|
+
return _context12.abrupt("return", null);
|
|
1008
1007
|
case 6:
|
|
1009
1008
|
partData = _objectSpread(_objectSpread({}, response.data), {}, {
|
|
1010
1009
|
headers: response.headers,
|
|
1011
1010
|
parameters: params
|
|
1012
1011
|
});
|
|
1013
1012
|
FileUploadPart = require('./FileUploadPart.js').default;
|
|
1014
|
-
return
|
|
1013
|
+
return _context12.abrupt("return", new FileUploadPart(partData));
|
|
1015
1014
|
case 9:
|
|
1016
1015
|
case "end":
|
|
1017
|
-
return
|
|
1016
|
+
return _context12.stop();
|
|
1018
1017
|
}
|
|
1019
|
-
},
|
|
1018
|
+
}, _callee12);
|
|
1020
1019
|
}));
|
|
1021
|
-
return function (
|
|
1022
|
-
return
|
|
1020
|
+
return function (_x0, _x1, _x10, _x11) {
|
|
1021
|
+
return _ref14.apply(this, arguments);
|
|
1023
1022
|
};
|
|
1024
1023
|
}());
|
|
1025
1024
|
(0, _defineProperty2.default)(File, "_completeUpload", /*#__PURE__*/function () {
|
|
1026
|
-
var
|
|
1025
|
+
var _ref15 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee13(firstFileUploadPart, options) {
|
|
1027
1026
|
var params;
|
|
1028
|
-
return _regenerator.default.wrap(function
|
|
1029
|
-
while (1) switch (
|
|
1027
|
+
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
1028
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
1030
1029
|
case 0:
|
|
1031
1030
|
params = {
|
|
1032
1031
|
action: 'end',
|
|
1033
1032
|
ref: firstFileUploadPart.ref
|
|
1034
1033
|
};
|
|
1035
|
-
return
|
|
1034
|
+
return _context13.abrupt("return", _Api.default.sendRequest("/files/".concat(encodeURIComponent(firstFileUploadPart.path)), 'POST', params, options));
|
|
1036
1035
|
case 2:
|
|
1037
1036
|
case "end":
|
|
1038
|
-
return
|
|
1037
|
+
return _context13.stop();
|
|
1039
1038
|
}
|
|
1040
|
-
},
|
|
1039
|
+
}, _callee13);
|
|
1041
1040
|
}));
|
|
1042
|
-
return function (
|
|
1043
|
-
return
|
|
1041
|
+
return function (_x12, _x13) {
|
|
1042
|
+
return _ref15.apply(this, arguments);
|
|
1044
1043
|
};
|
|
1045
1044
|
}());
|
|
1046
1045
|
/**
|
|
1047
1046
|
* @note see File.copy() for list of supported params
|
|
1048
1047
|
*/
|
|
1049
1048
|
(0, _defineProperty2.default)(File, "uploadStream", /*#__PURE__*/function () {
|
|
1050
|
-
var
|
|
1051
|
-
var
|
|
1052
|
-
return _regenerator.default.wrap(function
|
|
1053
|
-
while (1) switch (
|
|
1049
|
+
var _ref16 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee16(destinationPath, readableStream, params, optionsRaw) {
|
|
1050
|
+
var _ref17, determinePartUploadUriRaw, options, firstFileUploadPart, determinePartUploadUri, file;
|
|
1051
|
+
return _regenerator.default.wrap(function _callee16$(_context16) {
|
|
1052
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
1054
1053
|
case 0:
|
|
1055
|
-
|
|
1056
|
-
|
|
1054
|
+
_ref17 = optionsRaw || {}, determinePartUploadUriRaw = _ref17.determinePartUploadUri, options = (0, _objectWithoutProperties2.default)(_ref17, _excluded);
|
|
1055
|
+
_context16.next = 3;
|
|
1057
1056
|
return _File._openUpload(destinationPath, params, options);
|
|
1058
1057
|
case 3:
|
|
1059
|
-
firstFileUploadPart =
|
|
1058
|
+
firstFileUploadPart = _context16.sent;
|
|
1060
1059
|
if (firstFileUploadPart) {
|
|
1061
|
-
|
|
1060
|
+
_context16.next = 6;
|
|
1062
1061
|
break;
|
|
1063
1062
|
}
|
|
1064
|
-
return
|
|
1063
|
+
return _context16.abrupt("return", null);
|
|
1065
1064
|
case 6:
|
|
1066
1065
|
determinePartUploadUri = determinePartUploadUriRaw || function (fileUploadPart) {
|
|
1067
1066
|
return fileUploadPart.upload_uri;
|
|
1068
1067
|
};
|
|
1069
|
-
|
|
1070
|
-
|
|
1068
|
+
_context16.prev = 7;
|
|
1069
|
+
_context16.next = 10;
|
|
1071
1070
|
return new Promise(function (resolve, reject) {
|
|
1072
1071
|
var part = 0;
|
|
1073
1072
|
var chunks = [];
|
|
@@ -1076,56 +1075,56 @@ _File = File;
|
|
|
1076
1075
|
var chunkBuffer = null;
|
|
1077
1076
|
var streamEnded = false;
|
|
1078
1077
|
var handleStreamEnd = /*#__PURE__*/function () {
|
|
1079
|
-
var
|
|
1078
|
+
var _ref18 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee14() {
|
|
1080
1079
|
var _options$getAgentForU, buffer, nextFileUploadPart, uploadUri, agent, response, createdFile;
|
|
1081
|
-
return _regenerator.default.wrap(function
|
|
1082
|
-
while (1) switch (
|
|
1080
|
+
return _regenerator.default.wrap(function _callee14$(_context14) {
|
|
1081
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
1083
1082
|
case 0:
|
|
1084
1083
|
if (!(chunkBuffer !== null || !streamEnded)) {
|
|
1085
|
-
|
|
1084
|
+
_context14.next = 2;
|
|
1086
1085
|
break;
|
|
1087
1086
|
}
|
|
1088
|
-
return
|
|
1087
|
+
return _context14.abrupt("return");
|
|
1089
1088
|
case 2:
|
|
1090
|
-
|
|
1089
|
+
_context14.prev = 2;
|
|
1091
1090
|
if (!(chunks.length > 0)) {
|
|
1092
|
-
|
|
1091
|
+
_context14.next = 11;
|
|
1093
1092
|
break;
|
|
1094
1093
|
}
|
|
1095
1094
|
buffer = _safeBuffer.Buffer.concat(chunks);
|
|
1096
|
-
|
|
1095
|
+
_context14.next = 7;
|
|
1097
1096
|
return _File._continueUpload(destinationPath, ++part, firstFileUploadPart, options);
|
|
1098
1097
|
case 7:
|
|
1099
|
-
nextFileUploadPart =
|
|
1098
|
+
nextFileUploadPart = _context14.sent;
|
|
1100
1099
|
uploadUri = determinePartUploadUri(nextFileUploadPart); // instantiate an httpsAgent dynamically if needed
|
|
1101
1100
|
agent = ((_options$getAgentForU = options.getAgentForUrl) === null || _options$getAgentForU === void 0 ? void 0 : _options$getAgentForU.call(options, uploadUri)) || (options === null || options === void 0 ? void 0 : options.agent);
|
|
1102
1101
|
concurrentUploads.push(_Api.default.sendFilePart(uploadUri, 'PUT', buffer, {
|
|
1103
1102
|
agent: agent
|
|
1104
1103
|
}));
|
|
1105
1104
|
case 11:
|
|
1106
|
-
|
|
1105
|
+
_context14.next = 13;
|
|
1107
1106
|
return Promise.all(concurrentUploads);
|
|
1108
1107
|
case 13:
|
|
1109
|
-
|
|
1108
|
+
_context14.next = 15;
|
|
1110
1109
|
return _File._completeUpload(firstFileUploadPart, options);
|
|
1111
1110
|
case 15:
|
|
1112
|
-
response =
|
|
1111
|
+
response = _context14.sent;
|
|
1113
1112
|
createdFile = new _File(response.data, options);
|
|
1114
1113
|
resolve(createdFile);
|
|
1115
|
-
|
|
1114
|
+
_context14.next = 23;
|
|
1116
1115
|
break;
|
|
1117
1116
|
case 20:
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
reject(
|
|
1117
|
+
_context14.prev = 20;
|
|
1118
|
+
_context14.t0 = _context14["catch"](2);
|
|
1119
|
+
reject(_context14.t0);
|
|
1121
1120
|
case 23:
|
|
1122
1121
|
case "end":
|
|
1123
|
-
return
|
|
1122
|
+
return _context14.stop();
|
|
1124
1123
|
}
|
|
1125
|
-
},
|
|
1124
|
+
}, _callee14, null, [[2, 20]]);
|
|
1126
1125
|
}));
|
|
1127
1126
|
return function handleStreamEnd() {
|
|
1128
|
-
return
|
|
1127
|
+
return _ref18.apply(this, arguments);
|
|
1129
1128
|
};
|
|
1130
1129
|
}();
|
|
1131
1130
|
readableStream.on('error', function (error) {
|
|
@@ -1136,22 +1135,22 @@ _File = File;
|
|
|
1136
1135
|
// if a stream has been created based on very large data, it's possible for a chunk to
|
|
1137
1136
|
// contain the entire file and we could get a single chunk with length >= partsize * 3
|
|
1138
1137
|
readableStream.on('data', /*#__PURE__*/function () {
|
|
1139
|
-
var
|
|
1138
|
+
var _ref19 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15(chunk) {
|
|
1140
1139
|
var excessLength, _options$getAgentForU2, lengthForEndOfCurrentPart, lastChunkForCurrentPart, chunkBufferAfterCurrentPart, buffer, nextFileUploadPart, uploadUri, agent, uploadPromise, isNextChunkAtLeastOnePart;
|
|
1141
|
-
return _regenerator.default.wrap(function
|
|
1142
|
-
while (1) switch (
|
|
1140
|
+
return _regenerator.default.wrap(function _callee15$(_context15) {
|
|
1141
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1143
1142
|
case 0:
|
|
1144
|
-
|
|
1143
|
+
_context15.prev = 0;
|
|
1145
1144
|
excessLength = length + chunk.length - firstFileUploadPart.partsize;
|
|
1146
1145
|
chunkBuffer = _safeBuffer.Buffer.from(chunk);
|
|
1147
1146
|
if (!(excessLength > 0)) {
|
|
1148
|
-
|
|
1147
|
+
_context15.next = 30;
|
|
1149
1148
|
break;
|
|
1150
1149
|
}
|
|
1151
1150
|
readableStream.pause();
|
|
1152
1151
|
case 5:
|
|
1153
1152
|
if (!chunkBuffer) {
|
|
1154
|
-
|
|
1153
|
+
_context15.next = 27;
|
|
1155
1154
|
break;
|
|
1156
1155
|
}
|
|
1157
1156
|
// the amount to append this last part with to make it exactly the full partsize
|
|
@@ -1161,24 +1160,24 @@ _File = File;
|
|
|
1161
1160
|
chunks.push(lastChunkForCurrentPart);
|
|
1162
1161
|
buffer = _safeBuffer.Buffer.concat(chunks);
|
|
1163
1162
|
/* eslint-disable-next-line no-await-in-loop */
|
|
1164
|
-
|
|
1163
|
+
_context15.next = 13;
|
|
1165
1164
|
return _File._continueUpload(destinationPath, ++part, firstFileUploadPart, options);
|
|
1166
1165
|
case 13:
|
|
1167
|
-
nextFileUploadPart =
|
|
1166
|
+
nextFileUploadPart = _context15.sent;
|
|
1168
1167
|
uploadUri = determinePartUploadUri(nextFileUploadPart); // instantiate an httpsAgent dynamically if needed
|
|
1169
1168
|
agent = ((_options$getAgentForU2 = options.getAgentForUrl) === null || _options$getAgentForU2 === void 0 ? void 0 : _options$getAgentForU2.call(options, uploadUri)) || (options === null || options === void 0 ? void 0 : options.agent);
|
|
1170
1169
|
uploadPromise = _Api.default.sendFilePart(uploadUri, 'PUT', buffer, {
|
|
1171
1170
|
agent: agent
|
|
1172
1171
|
});
|
|
1173
1172
|
if (!firstFileUploadPart.parallel_parts) {
|
|
1174
|
-
|
|
1173
|
+
_context15.next = 21;
|
|
1175
1174
|
break;
|
|
1176
1175
|
}
|
|
1177
1176
|
concurrentUploads.push(uploadPromise);
|
|
1178
|
-
|
|
1177
|
+
_context15.next = 23;
|
|
1179
1178
|
break;
|
|
1180
1179
|
case 21:
|
|
1181
|
-
|
|
1180
|
+
_context15.next = 23;
|
|
1182
1181
|
return uploadPromise;
|
|
1183
1182
|
case 23:
|
|
1184
1183
|
// determine if the remainder of the excess chunk data is too large to be a single part
|
|
@@ -1197,11 +1196,11 @@ _File = File;
|
|
|
1197
1196
|
} else {
|
|
1198
1197
|
chunkBuffer = null;
|
|
1199
1198
|
}
|
|
1200
|
-
|
|
1199
|
+
_context15.next = 5;
|
|
1201
1200
|
break;
|
|
1202
1201
|
case 27:
|
|
1203
1202
|
readableStream.resume();
|
|
1204
|
-
|
|
1203
|
+
_context15.next = 33;
|
|
1205
1204
|
break;
|
|
1206
1205
|
case 30:
|
|
1207
1206
|
chunks.push(chunkBuffer);
|
|
@@ -1211,20 +1210,20 @@ _File = File;
|
|
|
1211
1210
|
if (streamEnded) {
|
|
1212
1211
|
handleStreamEnd();
|
|
1213
1212
|
}
|
|
1214
|
-
|
|
1213
|
+
_context15.next = 39;
|
|
1215
1214
|
break;
|
|
1216
1215
|
case 36:
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
reject(
|
|
1216
|
+
_context15.prev = 36;
|
|
1217
|
+
_context15.t0 = _context15["catch"](0);
|
|
1218
|
+
reject(_context15.t0);
|
|
1220
1219
|
case 39:
|
|
1221
1220
|
case "end":
|
|
1222
|
-
return
|
|
1221
|
+
return _context15.stop();
|
|
1223
1222
|
}
|
|
1224
|
-
},
|
|
1223
|
+
}, _callee15, null, [[0, 36]]);
|
|
1225
1224
|
}));
|
|
1226
|
-
return function (
|
|
1227
|
-
return
|
|
1225
|
+
return function (_x18) {
|
|
1226
|
+
return _ref19.apply(this, arguments);
|
|
1228
1227
|
};
|
|
1229
1228
|
}());
|
|
1230
1229
|
|
|
@@ -1235,21 +1234,21 @@ _File = File;
|
|
|
1235
1234
|
});
|
|
1236
1235
|
});
|
|
1237
1236
|
case 10:
|
|
1238
|
-
file =
|
|
1239
|
-
return
|
|
1237
|
+
file = _context16.sent;
|
|
1238
|
+
return _context16.abrupt("return", file);
|
|
1240
1239
|
case 14:
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
errors.handleErrorResponse(
|
|
1244
|
-
return
|
|
1240
|
+
_context16.prev = 14;
|
|
1241
|
+
_context16.t0 = _context16["catch"](7);
|
|
1242
|
+
errors.handleErrorResponse(_context16.t0);
|
|
1243
|
+
return _context16.abrupt("return", null);
|
|
1245
1244
|
case 18:
|
|
1246
1245
|
case "end":
|
|
1247
|
-
return
|
|
1246
|
+
return _context16.stop();
|
|
1248
1247
|
}
|
|
1249
|
-
},
|
|
1248
|
+
}, _callee16, null, [[7, 14]]);
|
|
1250
1249
|
}));
|
|
1251
|
-
return function (
|
|
1252
|
-
return
|
|
1250
|
+
return function (_x14, _x15, _x16, _x17) {
|
|
1251
|
+
return _ref16.apply(this, arguments);
|
|
1253
1252
|
};
|
|
1254
1253
|
}());
|
|
1255
1254
|
/**
|
|
@@ -1257,53 +1256,53 @@ _File = File;
|
|
|
1257
1256
|
* @note see File.copy() for list of supported params
|
|
1258
1257
|
*/
|
|
1259
1258
|
(0, _defineProperty2.default)(File, "uploadData", /*#__PURE__*/function () {
|
|
1260
|
-
var
|
|
1261
|
-
return _regenerator.default.wrap(function
|
|
1262
|
-
while (1) switch (
|
|
1259
|
+
var _ref20 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee17(destinationPath, data, params, options) {
|
|
1260
|
+
return _regenerator.default.wrap(function _callee17$(_context17) {
|
|
1261
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
1263
1262
|
case 0:
|
|
1264
1263
|
if (data) {
|
|
1265
|
-
|
|
1264
|
+
_context17.next = 2;
|
|
1266
1265
|
break;
|
|
1267
1266
|
}
|
|
1268
1267
|
throw new errors.MissingParameterError('Upload data was not provided');
|
|
1269
1268
|
case 2:
|
|
1270
|
-
return
|
|
1269
|
+
return _context17.abrupt("return", _File.uploadStream(destinationPath, _readableStream.default.from(data), params, options));
|
|
1271
1270
|
case 3:
|
|
1272
1271
|
case "end":
|
|
1273
|
-
return
|
|
1272
|
+
return _context17.stop();
|
|
1274
1273
|
}
|
|
1275
|
-
},
|
|
1274
|
+
}, _callee17);
|
|
1276
1275
|
}));
|
|
1277
|
-
return function (
|
|
1278
|
-
return
|
|
1276
|
+
return function (_x19, _x20, _x21, _x22) {
|
|
1277
|
+
return _ref20.apply(this, arguments);
|
|
1279
1278
|
};
|
|
1280
1279
|
}());
|
|
1281
1280
|
/**
|
|
1282
1281
|
* @note see File.copy() for list of supported params
|
|
1283
1282
|
*/
|
|
1284
1283
|
(0, _defineProperty2.default)(File, "uploadFile", /*#__PURE__*/function () {
|
|
1285
|
-
var
|
|
1284
|
+
var _ref21 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee18(destinationPath, sourceFilePath, params, options) {
|
|
1286
1285
|
var _require4, openDiskFileReadStream, stream;
|
|
1287
|
-
return _regenerator.default.wrap(function
|
|
1288
|
-
while (1) switch (
|
|
1286
|
+
return _regenerator.default.wrap(function _callee18$(_context18) {
|
|
1287
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
1289
1288
|
case 0:
|
|
1290
1289
|
if (!(0, _utils.isBrowser)()) {
|
|
1291
|
-
|
|
1290
|
+
_context18.next = 2;
|
|
1292
1291
|
break;
|
|
1293
1292
|
}
|
|
1294
1293
|
throw new errors.NotImplementedError('Disk file uploads are only available in a NodeJS environment');
|
|
1295
1294
|
case 2:
|
|
1296
1295
|
_require4 = require('../isomorphic/File.node.js'), openDiskFileReadStream = _require4.openDiskFileReadStream;
|
|
1297
1296
|
stream = openDiskFileReadStream(sourceFilePath);
|
|
1298
|
-
return
|
|
1297
|
+
return _context18.abrupt("return", _File.uploadStream(destinationPath, stream, params, options));
|
|
1299
1298
|
case 5:
|
|
1300
1299
|
case "end":
|
|
1301
|
-
return
|
|
1300
|
+
return _context18.stop();
|
|
1302
1301
|
}
|
|
1303
|
-
},
|
|
1302
|
+
}, _callee18);
|
|
1304
1303
|
}));
|
|
1305
|
-
return function (
|
|
1306
|
-
return
|
|
1304
|
+
return function (_x23, _x24, _x25, _x26) {
|
|
1305
|
+
return _ref21.apply(this, arguments);
|
|
1307
1306
|
};
|
|
1308
1307
|
}());
|
|
1309
1308
|
// Parameters:
|
|
@@ -1322,102 +1321,102 @@ _File = File;
|
|
|
1322
1321
|
// structure - string - If copying folder, copy just the structure?
|
|
1323
1322
|
// with_rename - boolean - Allow file rename instead of overwrite?
|
|
1324
1323
|
(0, _defineProperty2.default)(File, "create", /*#__PURE__*/function () {
|
|
1325
|
-
var
|
|
1324
|
+
var _ref22 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee19(path) {
|
|
1326
1325
|
var params,
|
|
1327
1326
|
options,
|
|
1328
1327
|
response,
|
|
1329
|
-
|
|
1330
|
-
return _regenerator.default.wrap(function
|
|
1331
|
-
while (1) switch (
|
|
1328
|
+
_args19 = arguments;
|
|
1329
|
+
return _regenerator.default.wrap(function _callee19$(_context19) {
|
|
1330
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
1332
1331
|
case 0:
|
|
1333
|
-
params =
|
|
1334
|
-
options =
|
|
1332
|
+
params = _args19.length > 1 && _args19[1] !== undefined ? _args19[1] : {};
|
|
1333
|
+
options = _args19.length > 2 && _args19[2] !== undefined ? _args19[2] : {};
|
|
1335
1334
|
if ((0, _utils.isObject)(params)) {
|
|
1336
|
-
|
|
1335
|
+
_context19.next = 4;
|
|
1337
1336
|
break;
|
|
1338
1337
|
}
|
|
1339
1338
|
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
|
1340
1339
|
case 4:
|
|
1341
1340
|
params.path = path;
|
|
1342
1341
|
if (params.path) {
|
|
1343
|
-
|
|
1342
|
+
_context19.next = 7;
|
|
1344
1343
|
break;
|
|
1345
1344
|
}
|
|
1346
1345
|
throw new errors.MissingParameterError('Parameter missing: path');
|
|
1347
1346
|
case 7:
|
|
1348
1347
|
if (!(params.path && !(0, _utils.isString)(params.path))) {
|
|
1349
|
-
|
|
1348
|
+
_context19.next = 9;
|
|
1350
1349
|
break;
|
|
1351
1350
|
}
|
|
1352
1351
|
throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(params.path)));
|
|
1353
1352
|
case 9:
|
|
1354
1353
|
if (!(params.action && !(0, _utils.isString)(params.action))) {
|
|
1355
|
-
|
|
1354
|
+
_context19.next = 11;
|
|
1356
1355
|
break;
|
|
1357
1356
|
}
|
|
1358
1357
|
throw new errors.InvalidParameterError("Bad parameter: action must be of type String, received ".concat((0, _utils.getType)(params.action)));
|
|
1359
1358
|
case 11:
|
|
1360
1359
|
if (!(params.length && !(0, _utils.isInt)(params.length))) {
|
|
1361
|
-
|
|
1360
|
+
_context19.next = 13;
|
|
1362
1361
|
break;
|
|
1363
1362
|
}
|
|
1364
1363
|
throw new errors.InvalidParameterError("Bad parameter: length must be of type Int, received ".concat((0, _utils.getType)(params.length)));
|
|
1365
1364
|
case 13:
|
|
1366
1365
|
if (!(params.part && !(0, _utils.isInt)(params.part))) {
|
|
1367
|
-
|
|
1366
|
+
_context19.next = 15;
|
|
1368
1367
|
break;
|
|
1369
1368
|
}
|
|
1370
1369
|
throw new errors.InvalidParameterError("Bad parameter: part must be of type Int, received ".concat((0, _utils.getType)(params.part)));
|
|
1371
1370
|
case 15:
|
|
1372
1371
|
if (!(params.parts && !(0, _utils.isInt)(params.parts))) {
|
|
1373
|
-
|
|
1372
|
+
_context19.next = 17;
|
|
1374
1373
|
break;
|
|
1375
1374
|
}
|
|
1376
1375
|
throw new errors.InvalidParameterError("Bad parameter: parts must be of type Int, received ".concat((0, _utils.getType)(params.parts)));
|
|
1377
1376
|
case 17:
|
|
1378
1377
|
if (!(params.provided_mtime && !(0, _utils.isString)(params.provided_mtime))) {
|
|
1379
|
-
|
|
1378
|
+
_context19.next = 19;
|
|
1380
1379
|
break;
|
|
1381
1380
|
}
|
|
1382
1381
|
throw new errors.InvalidParameterError("Bad parameter: provided_mtime must be of type String, received ".concat((0, _utils.getType)(params.provided_mtime)));
|
|
1383
1382
|
case 19:
|
|
1384
1383
|
if (!(params.ref && !(0, _utils.isString)(params.ref))) {
|
|
1385
|
-
|
|
1384
|
+
_context19.next = 21;
|
|
1386
1385
|
break;
|
|
1387
1386
|
}
|
|
1388
1387
|
throw new errors.InvalidParameterError("Bad parameter: ref must be of type String, received ".concat((0, _utils.getType)(params.ref)));
|
|
1389
1388
|
case 21:
|
|
1390
1389
|
if (!(params.restart && !(0, _utils.isInt)(params.restart))) {
|
|
1391
|
-
|
|
1390
|
+
_context19.next = 23;
|
|
1392
1391
|
break;
|
|
1393
1392
|
}
|
|
1394
1393
|
throw new errors.InvalidParameterError("Bad parameter: restart must be of type Int, received ".concat((0, _utils.getType)(params.restart)));
|
|
1395
1394
|
case 23:
|
|
1396
1395
|
if (!(params.size && !(0, _utils.isInt)(params.size))) {
|
|
1397
|
-
|
|
1396
|
+
_context19.next = 25;
|
|
1398
1397
|
break;
|
|
1399
1398
|
}
|
|
1400
1399
|
throw new errors.InvalidParameterError("Bad parameter: size must be of type Int, received ".concat((0, _utils.getType)(params.size)));
|
|
1401
1400
|
case 25:
|
|
1402
1401
|
if (!(params.structure && !(0, _utils.isString)(params.structure))) {
|
|
1403
|
-
|
|
1402
|
+
_context19.next = 27;
|
|
1404
1403
|
break;
|
|
1405
1404
|
}
|
|
1406
1405
|
throw new errors.InvalidParameterError("Bad parameter: structure must be of type String, received ".concat((0, _utils.getType)(params.structure)));
|
|
1407
1406
|
case 27:
|
|
1408
|
-
|
|
1407
|
+
_context19.next = 29;
|
|
1409
1408
|
return _Api.default.sendRequest("/files/".concat(encodeURIComponent(params.path)), 'POST', params, options);
|
|
1410
1409
|
case 29:
|
|
1411
|
-
response =
|
|
1412
|
-
return
|
|
1410
|
+
response = _context19.sent;
|
|
1411
|
+
return _context19.abrupt("return", new _File(response === null || response === void 0 ? void 0 : response.data, options));
|
|
1413
1412
|
case 31:
|
|
1414
1413
|
case "end":
|
|
1415
|
-
return
|
|
1414
|
+
return _context19.stop();
|
|
1416
1415
|
}
|
|
1417
|
-
},
|
|
1416
|
+
}, _callee19);
|
|
1418
1417
|
}));
|
|
1419
|
-
return function (
|
|
1420
|
-
return
|
|
1418
|
+
return function (_x27) {
|
|
1419
|
+
return _ref22.apply(this, arguments);
|
|
1421
1420
|
};
|
|
1422
1421
|
}());
|
|
1423
1422
|
// Parameters:
|
|
@@ -1426,54 +1425,54 @@ _File = File;
|
|
|
1426
1425
|
// with_previews - boolean - Include file preview information?
|
|
1427
1426
|
// with_priority_color - boolean - Include file priority color information?
|
|
1428
1427
|
(0, _defineProperty2.default)(File, "find", /*#__PURE__*/function () {
|
|
1429
|
-
var
|
|
1428
|
+
var _ref23 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee20(path) {
|
|
1430
1429
|
var params,
|
|
1431
1430
|
options,
|
|
1432
1431
|
response,
|
|
1433
|
-
|
|
1434
|
-
return _regenerator.default.wrap(function
|
|
1435
|
-
while (1) switch (
|
|
1432
|
+
_args20 = arguments;
|
|
1433
|
+
return _regenerator.default.wrap(function _callee20$(_context20) {
|
|
1434
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
1436
1435
|
case 0:
|
|
1437
|
-
params =
|
|
1438
|
-
options =
|
|
1436
|
+
params = _args20.length > 1 && _args20[1] !== undefined ? _args20[1] : {};
|
|
1437
|
+
options = _args20.length > 2 && _args20[2] !== undefined ? _args20[2] : {};
|
|
1439
1438
|
if ((0, _utils.isObject)(params)) {
|
|
1440
|
-
|
|
1439
|
+
_context20.next = 4;
|
|
1441
1440
|
break;
|
|
1442
1441
|
}
|
|
1443
1442
|
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
|
1444
1443
|
case 4:
|
|
1445
1444
|
params.path = path;
|
|
1446
1445
|
if (params.path) {
|
|
1447
|
-
|
|
1446
|
+
_context20.next = 7;
|
|
1448
1447
|
break;
|
|
1449
1448
|
}
|
|
1450
1449
|
throw new errors.MissingParameterError('Parameter missing: path');
|
|
1451
1450
|
case 7:
|
|
1452
1451
|
if (!(params.path && !(0, _utils.isString)(params.path))) {
|
|
1453
|
-
|
|
1452
|
+
_context20.next = 9;
|
|
1454
1453
|
break;
|
|
1455
1454
|
}
|
|
1456
1455
|
throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(params.path)));
|
|
1457
1456
|
case 9:
|
|
1458
1457
|
if (!(params.preview_size && !(0, _utils.isString)(params.preview_size))) {
|
|
1459
|
-
|
|
1458
|
+
_context20.next = 11;
|
|
1460
1459
|
break;
|
|
1461
1460
|
}
|
|
1462
1461
|
throw new errors.InvalidParameterError("Bad parameter: preview_size must be of type String, received ".concat((0, _utils.getType)(params.preview_size)));
|
|
1463
1462
|
case 11:
|
|
1464
|
-
|
|
1463
|
+
_context20.next = 13;
|
|
1465
1464
|
return _Api.default.sendRequest("/file_actions/metadata/".concat(encodeURIComponent(params.path)), 'GET', params, options);
|
|
1466
1465
|
case 13:
|
|
1467
|
-
response =
|
|
1468
|
-
return
|
|
1466
|
+
response = _context20.sent;
|
|
1467
|
+
return _context20.abrupt("return", new _File(response === null || response === void 0 ? void 0 : response.data, options));
|
|
1469
1468
|
case 15:
|
|
1470
1469
|
case "end":
|
|
1471
|
-
return
|
|
1470
|
+
return _context20.stop();
|
|
1472
1471
|
}
|
|
1473
|
-
},
|
|
1472
|
+
}, _callee20);
|
|
1474
1473
|
}));
|
|
1475
|
-
return function (
|
|
1476
|
-
return
|
|
1474
|
+
return function (_x28) {
|
|
1475
|
+
return _ref23.apply(this, arguments);
|
|
1477
1476
|
};
|
|
1478
1477
|
}());
|
|
1479
1478
|
(0, _defineProperty2.default)(File, "get", function (path) {
|