files.com 1.0.474 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- package/_VERSION +1 -1
- package/lib/Files.js +1 -1
- package/lib/models/ActionNotificationExport.js +63 -49
- package/lib/models/ActionWebhookFailure.js +1 -1
- package/lib/models/ApiKey.js +113 -94
- package/lib/models/As2Partner.js +81 -62
- package/lib/models/As2Station.js +79 -60
- package/lib/models/Automation.js +90 -71
- package/lib/models/Behavior.js +114 -95
- package/lib/models/Bundle.js +90 -71
- package/lib/models/BundleNotification.js +75 -56
- package/lib/models/BundleRecipient.js +61 -47
- package/lib/models/Clickwrap.js +77 -58
- package/lib/models/ExternalEvent.js +71 -57
- package/lib/models/File.js +166 -154
- package/lib/models/FileComment.js +65 -46
- package/lib/models/FileCommentReaction.js +44 -30
- package/lib/models/Folder.js +58 -46
- package/lib/models/FormFieldSet.js +76 -57
- package/lib/models/GpgKey.js +79 -60
- package/lib/models/Group.js +78 -59
- package/lib/models/GroupUser.js +63 -44
- package/lib/models/HistoryExport.js +76 -62
- package/lib/models/InboxRecipient.js +61 -47
- package/lib/models/Lock.js +56 -44
- package/lib/models/Message.js +82 -63
- package/lib/models/MessageComment.js +78 -59
- package/lib/models/MessageCommentReaction.js +73 -59
- package/lib/models/MessageReaction.js +73 -59
- package/lib/models/Notification.js +84 -65
- package/lib/models/Permission.js +60 -46
- package/lib/models/Project.js +74 -55
- package/lib/models/PublicKey.js +78 -59
- package/lib/models/RemoteServer.js +147 -128
- package/lib/models/Request.js +76 -62
- package/lib/models/Session.js +53 -39
- package/lib/models/SftpHostKey.js +74 -55
- package/lib/models/ShareGroup.js +79 -60
- package/lib/models/Snapshot.js +75 -56
- package/lib/models/SsoStrategy.js +1 -1
- package/lib/models/Style.js +37 -23
- package/lib/models/User.js +104 -85
- package/lib/models/UserRequest.js +73 -59
- package/lib/models/WebhookTest.js +46 -32
- package/package.json +1 -1
- package/src/Files.js +1 -1
- package/src/models/ActionNotificationExport.js +2 -2
- package/src/models/ActionWebhookFailure.js +1 -1
- package/src/models/ApiKey.js +7 -5
- package/src/models/As2Partner.js +6 -4
- package/src/models/As2Station.js +6 -4
- package/src/models/Automation.js +7 -5
- package/src/models/Behavior.js +7 -5
- package/src/models/Bundle.js +7 -5
- package/src/models/BundleNotification.js +6 -4
- package/src/models/BundleRecipient.js +2 -2
- package/src/models/Clickwrap.js +6 -4
- package/src/models/ExternalEvent.js +2 -2
- package/src/models/File.js +3 -3
- package/src/models/FileComment.js +6 -4
- package/src/models/FileCommentReaction.js +3 -3
- package/src/models/Folder.js +2 -2
- package/src/models/FormFieldSet.js +6 -4
- package/src/models/GpgKey.js +6 -4
- package/src/models/Group.js +6 -4
- package/src/models/GroupUser.js +6 -4
- package/src/models/HistoryExport.js +2 -2
- package/src/models/InboxRecipient.js +2 -2
- package/src/models/Lock.js +3 -3
- package/src/models/Message.js +6 -4
- package/src/models/MessageComment.js +6 -4
- package/src/models/MessageCommentReaction.js +3 -3
- package/src/models/MessageReaction.js +3 -3
- package/src/models/Notification.js +6 -4
- package/src/models/Permission.js +3 -3
- package/src/models/Project.js +6 -4
- package/src/models/PublicKey.js +6 -4
- package/src/models/RemoteServer.js +6 -4
- package/src/models/Request.js +3 -3
- package/src/models/Session.js +3 -3
- package/src/models/SftpHostKey.js +6 -4
- package/src/models/ShareGroup.js +6 -4
- package/src/models/Snapshot.js +6 -4
- package/src/models/SsoStrategy.js +1 -1
- package/src/models/Style.js +6 -3
- package/src/models/User.js +9 -7
- package/src/models/UserRequest.js +3 -3
- package/src/models/WebhookTest.js +2 -2
package/lib/models/File.js
CHANGED
@@ -536,7 +536,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
|
|
536
536
|
return _Api.default.sendRequest("/files/".concat(encodeURIComponent(params['path'])), 'DELETE', params, _this.options);
|
537
537
|
case 16:
|
538
538
|
response = _context8.sent;
|
539
|
-
return _context8.abrupt("return"
|
539
|
+
return _context8.abrupt("return");
|
540
540
|
case 18:
|
541
541
|
case "end":
|
542
542
|
return _context8.stop();
|
@@ -801,15 +801,27 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
|
|
801
801
|
}
|
802
802
|
}, _callee11);
|
803
803
|
})));
|
804
|
-
(0, _defineProperty2.default)(this, "save", function () {
|
805
|
-
var newObject
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
804
|
+
(0, _defineProperty2.default)(this, "save", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
|
805
|
+
var newObject;
|
806
|
+
return _regenerator.default.wrap(function _callee12$(_context12) {
|
807
|
+
while (1) switch (_context12.prev = _context12.next) {
|
808
|
+
case 0:
|
809
|
+
_context12.next = 2;
|
810
|
+
return File.create(_this.attributes.path, _this.attributes, _this.options);
|
811
|
+
case 2:
|
812
|
+
newObject = _context12.sent;
|
813
|
+
_this.attributes = _objectSpread({}, newObject.attributes);
|
814
|
+
return _context12.abrupt("return", true);
|
815
|
+
case 5:
|
816
|
+
case "end":
|
817
|
+
return _context12.stop();
|
818
|
+
}
|
819
|
+
}, _callee12);
|
820
|
+
})));
|
821
|
+
Object.entries(attributes).forEach(function (_ref13) {
|
822
|
+
var _ref14 = (0, _slicedToArray2.default)(_ref13, 2),
|
823
|
+
key = _ref14[0],
|
824
|
+
value = _ref14[1];
|
813
825
|
var normalizedKey = key.replace('?', '');
|
814
826
|
_this.attributes[normalizedKey] = value;
|
815
827
|
Object.defineProperty(_this, normalizedKey, {
|
@@ -821,123 +833,123 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
|
|
821
833
|
});
|
822
834
|
_class = File;
|
823
835
|
(0, _defineProperty2.default)(File, "_openUpload", /*#__PURE__*/function () {
|
824
|
-
var
|
836
|
+
var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(path, paramsRaw, options) {
|
825
837
|
var params, response, partData, FileUploadPart;
|
826
|
-
return _regenerator.default.wrap(function
|
827
|
-
while (1) switch (
|
838
|
+
return _regenerator.default.wrap(function _callee13$(_context13) {
|
839
|
+
while (1) switch (_context13.prev = _context13.next) {
|
828
840
|
case 0:
|
829
841
|
params = _objectSpread(_objectSpread({}, paramsRaw), {}, {
|
830
842
|
action: 'put'
|
831
843
|
});
|
832
|
-
|
844
|
+
_context13.next = 3;
|
833
845
|
return _Api.default.sendRequest("/files/".concat(encodeURIComponent(path)), 'POST', params, options);
|
834
846
|
case 3:
|
835
|
-
response =
|
847
|
+
response = _context13.sent;
|
836
848
|
if (response) {
|
837
|
-
|
849
|
+
_context13.next = 6;
|
838
850
|
break;
|
839
851
|
}
|
840
|
-
return
|
852
|
+
return _context13.abrupt("return", null);
|
841
853
|
case 6:
|
842
854
|
partData = _objectSpread(_objectSpread({}, response.data), {}, {
|
843
855
|
headers: response.headers,
|
844
856
|
parameters: params
|
845
857
|
});
|
846
858
|
FileUploadPart = require('./FileUploadPart.js').default;
|
847
|
-
return
|
859
|
+
return _context13.abrupt("return", new FileUploadPart(partData));
|
848
860
|
case 9:
|
849
861
|
case "end":
|
850
|
-
return
|
862
|
+
return _context13.stop();
|
851
863
|
}
|
852
|
-
},
|
864
|
+
}, _callee13);
|
853
865
|
}));
|
854
866
|
return function (_x7, _x8, _x9) {
|
855
|
-
return
|
867
|
+
return _ref15.apply(this, arguments);
|
856
868
|
};
|
857
869
|
}());
|
858
870
|
(0, _defineProperty2.default)(File, "_continueUpload", /*#__PURE__*/function () {
|
859
|
-
var
|
871
|
+
var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(path, partNumber, firstFileUploadPart, options) {
|
860
872
|
var params, response, partData, FileUploadPart;
|
861
|
-
return _regenerator.default.wrap(function
|
862
|
-
while (1) switch (
|
873
|
+
return _regenerator.default.wrap(function _callee14$(_context14) {
|
874
|
+
while (1) switch (_context14.prev = _context14.next) {
|
863
875
|
case 0:
|
864
876
|
params = {
|
865
877
|
action: 'put',
|
866
878
|
part: partNumber,
|
867
879
|
ref: firstFileUploadPart.ref
|
868
880
|
};
|
869
|
-
|
881
|
+
_context14.next = 3;
|
870
882
|
return _Api.default.sendRequest("/files/".concat(encodeURIComponent(path)), 'POST', params, options);
|
871
883
|
case 3:
|
872
|
-
response =
|
884
|
+
response = _context14.sent;
|
873
885
|
if (response) {
|
874
|
-
|
886
|
+
_context14.next = 6;
|
875
887
|
break;
|
876
888
|
}
|
877
|
-
return
|
889
|
+
return _context14.abrupt("return", null);
|
878
890
|
case 6:
|
879
891
|
partData = _objectSpread(_objectSpread({}, response.data), {}, {
|
880
892
|
headers: response.headers,
|
881
893
|
parameters: params
|
882
894
|
});
|
883
895
|
FileUploadPart = require('./FileUploadPart.js').default;
|
884
|
-
return
|
896
|
+
return _context14.abrupt("return", new FileUploadPart(partData));
|
885
897
|
case 9:
|
886
898
|
case "end":
|
887
|
-
return
|
899
|
+
return _context14.stop();
|
888
900
|
}
|
889
|
-
},
|
901
|
+
}, _callee14);
|
890
902
|
}));
|
891
903
|
return function (_x10, _x11, _x12, _x13) {
|
892
|
-
return
|
904
|
+
return _ref16.apply(this, arguments);
|
893
905
|
};
|
894
906
|
}());
|
895
907
|
(0, _defineProperty2.default)(File, "_completeUpload", /*#__PURE__*/function () {
|
896
|
-
var
|
908
|
+
var _ref17 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(firstFileUploadPart, options) {
|
897
909
|
var params;
|
898
|
-
return _regenerator.default.wrap(function
|
899
|
-
while (1) switch (
|
910
|
+
return _regenerator.default.wrap(function _callee15$(_context15) {
|
911
|
+
while (1) switch (_context15.prev = _context15.next) {
|
900
912
|
case 0:
|
901
913
|
params = {
|
902
914
|
action: 'end',
|
903
915
|
ref: firstFileUploadPart.ref
|
904
916
|
};
|
905
|
-
return
|
917
|
+
return _context15.abrupt("return", _Api.default.sendRequest("/files/".concat(encodeURIComponent(firstFileUploadPart.path)), 'POST', params, options));
|
906
918
|
case 2:
|
907
919
|
case "end":
|
908
|
-
return
|
920
|
+
return _context15.stop();
|
909
921
|
}
|
910
|
-
},
|
922
|
+
}, _callee15);
|
911
923
|
}));
|
912
924
|
return function (_x14, _x15) {
|
913
|
-
return
|
925
|
+
return _ref17.apply(this, arguments);
|
914
926
|
};
|
915
927
|
}());
|
916
928
|
/**
|
917
929
|
* @note see File.copy() for list of supported params
|
918
930
|
*/
|
919
931
|
(0, _defineProperty2.default)(File, "uploadStream", /*#__PURE__*/function () {
|
920
|
-
var
|
921
|
-
var
|
922
|
-
return _regenerator.default.wrap(function
|
923
|
-
while (1) switch (
|
932
|
+
var _ref18 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(destinationPath, readableStream, params, optionsRaw) {
|
933
|
+
var _ref19, determinePartUploadUriRaw, options, firstFileUploadPart, determinePartUploadUri, file;
|
934
|
+
return _regenerator.default.wrap(function _callee18$(_context18) {
|
935
|
+
while (1) switch (_context18.prev = _context18.next) {
|
924
936
|
case 0:
|
925
|
-
|
926
|
-
|
937
|
+
_ref19 = optionsRaw || {}, determinePartUploadUriRaw = _ref19.determinePartUploadUri, options = (0, _objectWithoutProperties2.default)(_ref19, _excluded);
|
938
|
+
_context18.next = 3;
|
927
939
|
return _class._openUpload(destinationPath, params, options);
|
928
940
|
case 3:
|
929
|
-
firstFileUploadPart =
|
941
|
+
firstFileUploadPart = _context18.sent;
|
930
942
|
if (firstFileUploadPart) {
|
931
|
-
|
943
|
+
_context18.next = 6;
|
932
944
|
break;
|
933
945
|
}
|
934
|
-
return
|
946
|
+
return _context18.abrupt("return", null);
|
935
947
|
case 6:
|
936
948
|
determinePartUploadUri = determinePartUploadUriRaw || function (fileUploadPart) {
|
937
949
|
return fileUploadPart.upload_uri;
|
938
950
|
};
|
939
|
-
|
940
|
-
|
951
|
+
_context18.prev = 7;
|
952
|
+
_context18.next = 10;
|
941
953
|
return new Promise(function (resolve, reject) {
|
942
954
|
var part = 0;
|
943
955
|
var chunks = [];
|
@@ -946,56 +958,56 @@ _class = File;
|
|
946
958
|
var chunkBuffer = null;
|
947
959
|
var streamEnded = false;
|
948
960
|
var handleStreamEnd = /*#__PURE__*/function () {
|
949
|
-
var
|
961
|
+
var _ref20 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
|
950
962
|
var _options$getAgentForU, buffer, nextFileUploadPart, uploadUri, agent, response, createdFile;
|
951
|
-
return _regenerator.default.wrap(function
|
952
|
-
while (1) switch (
|
963
|
+
return _regenerator.default.wrap(function _callee16$(_context16) {
|
964
|
+
while (1) switch (_context16.prev = _context16.next) {
|
953
965
|
case 0:
|
954
966
|
if (!(chunkBuffer !== null || !streamEnded)) {
|
955
|
-
|
967
|
+
_context16.next = 2;
|
956
968
|
break;
|
957
969
|
}
|
958
|
-
return
|
970
|
+
return _context16.abrupt("return");
|
959
971
|
case 2:
|
960
|
-
|
972
|
+
_context16.prev = 2;
|
961
973
|
if (!(chunks.length > 0)) {
|
962
|
-
|
974
|
+
_context16.next = 11;
|
963
975
|
break;
|
964
976
|
}
|
965
977
|
buffer = _safeBuffer.Buffer.concat(chunks);
|
966
|
-
|
978
|
+
_context16.next = 7;
|
967
979
|
return _class._continueUpload(destinationPath, ++part, firstFileUploadPart, options);
|
968
980
|
case 7:
|
969
|
-
nextFileUploadPart =
|
981
|
+
nextFileUploadPart = _context16.sent;
|
970
982
|
uploadUri = determinePartUploadUri(nextFileUploadPart); // instantiate an httpsAgent dynamically if needed
|
971
983
|
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);
|
972
984
|
concurrentUploads.push(_Api.default.sendFilePart(uploadUri, 'PUT', buffer, {
|
973
985
|
agent: agent
|
974
986
|
}));
|
975
987
|
case 11:
|
976
|
-
|
988
|
+
_context16.next = 13;
|
977
989
|
return Promise.all(concurrentUploads);
|
978
990
|
case 13:
|
979
|
-
|
991
|
+
_context16.next = 15;
|
980
992
|
return _class._completeUpload(firstFileUploadPart, options);
|
981
993
|
case 15:
|
982
|
-
response =
|
994
|
+
response = _context16.sent;
|
983
995
|
createdFile = new _class(response.data, options);
|
984
996
|
resolve(createdFile);
|
985
|
-
|
997
|
+
_context16.next = 23;
|
986
998
|
break;
|
987
999
|
case 20:
|
988
|
-
|
989
|
-
|
990
|
-
reject(
|
1000
|
+
_context16.prev = 20;
|
1001
|
+
_context16.t0 = _context16["catch"](2);
|
1002
|
+
reject(_context16.t0);
|
991
1003
|
case 23:
|
992
1004
|
case "end":
|
993
|
-
return
|
1005
|
+
return _context16.stop();
|
994
1006
|
}
|
995
|
-
},
|
1007
|
+
}, _callee16, null, [[2, 20]]);
|
996
1008
|
}));
|
997
1009
|
return function handleStreamEnd() {
|
998
|
-
return
|
1010
|
+
return _ref20.apply(this, arguments);
|
999
1011
|
};
|
1000
1012
|
}();
|
1001
1013
|
readableStream.on('error', function (error) {
|
@@ -1006,22 +1018,22 @@ _class = File;
|
|
1006
1018
|
// if a stream has been created based on very large data, it's possible for a chunk to
|
1007
1019
|
// contain the entire file and we could get a single chunk with length >= partsize * 3
|
1008
1020
|
readableStream.on('data', /*#__PURE__*/function () {
|
1009
|
-
var
|
1021
|
+
var _ref21 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(chunk) {
|
1010
1022
|
var excessLength, _options$getAgentForU2, lengthForEndOfCurrentPart, lastChunkForCurrentPart, chunkBufferAfterCurrentPart, buffer, nextFileUploadPart, uploadUri, agent, uploadPromise, isNextChunkAtLeastOnePart;
|
1011
|
-
return _regenerator.default.wrap(function
|
1012
|
-
while (1) switch (
|
1023
|
+
return _regenerator.default.wrap(function _callee17$(_context17) {
|
1024
|
+
while (1) switch (_context17.prev = _context17.next) {
|
1013
1025
|
case 0:
|
1014
|
-
|
1026
|
+
_context17.prev = 0;
|
1015
1027
|
excessLength = length + chunk.length - firstFileUploadPart.partsize;
|
1016
1028
|
chunkBuffer = _safeBuffer.Buffer.from(chunk);
|
1017
1029
|
if (!(excessLength > 0)) {
|
1018
|
-
|
1030
|
+
_context17.next = 30;
|
1019
1031
|
break;
|
1020
1032
|
}
|
1021
1033
|
readableStream.pause();
|
1022
1034
|
case 5:
|
1023
1035
|
if (!chunkBuffer) {
|
1024
|
-
|
1036
|
+
_context17.next = 27;
|
1025
1037
|
break;
|
1026
1038
|
}
|
1027
1039
|
// the amount to append this last part with to make it exactly the full partsize
|
@@ -1031,24 +1043,24 @@ _class = File;
|
|
1031
1043
|
chunks.push(lastChunkForCurrentPart);
|
1032
1044
|
buffer = _safeBuffer.Buffer.concat(chunks);
|
1033
1045
|
/* eslint-disable-next-line no-await-in-loop */
|
1034
|
-
|
1046
|
+
_context17.next = 13;
|
1035
1047
|
return _class._continueUpload(destinationPath, ++part, firstFileUploadPart, options);
|
1036
1048
|
case 13:
|
1037
|
-
nextFileUploadPart =
|
1049
|
+
nextFileUploadPart = _context17.sent;
|
1038
1050
|
uploadUri = determinePartUploadUri(nextFileUploadPart); // instantiate an httpsAgent dynamically if needed
|
1039
1051
|
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);
|
1040
1052
|
uploadPromise = _Api.default.sendFilePart(uploadUri, 'PUT', buffer, {
|
1041
1053
|
agent: agent
|
1042
1054
|
});
|
1043
1055
|
if (!firstFileUploadPart.parallel_parts) {
|
1044
|
-
|
1056
|
+
_context17.next = 21;
|
1045
1057
|
break;
|
1046
1058
|
}
|
1047
1059
|
concurrentUploads.push(uploadPromise);
|
1048
|
-
|
1060
|
+
_context17.next = 23;
|
1049
1061
|
break;
|
1050
1062
|
case 21:
|
1051
|
-
|
1063
|
+
_context17.next = 23;
|
1052
1064
|
return uploadPromise;
|
1053
1065
|
case 23:
|
1054
1066
|
// determine if the remainder of the excess chunk data is too large to be a single part
|
@@ -1067,11 +1079,11 @@ _class = File;
|
|
1067
1079
|
} else {
|
1068
1080
|
chunkBuffer = null;
|
1069
1081
|
}
|
1070
|
-
|
1082
|
+
_context17.next = 5;
|
1071
1083
|
break;
|
1072
1084
|
case 27:
|
1073
1085
|
readableStream.resume();
|
1074
|
-
|
1086
|
+
_context17.next = 33;
|
1075
1087
|
break;
|
1076
1088
|
case 30:
|
1077
1089
|
chunks.push(chunkBuffer);
|
@@ -1081,20 +1093,20 @@ _class = File;
|
|
1081
1093
|
if (streamEnded) {
|
1082
1094
|
handleStreamEnd();
|
1083
1095
|
}
|
1084
|
-
|
1096
|
+
_context17.next = 39;
|
1085
1097
|
break;
|
1086
1098
|
case 36:
|
1087
|
-
|
1088
|
-
|
1089
|
-
reject(
|
1099
|
+
_context17.prev = 36;
|
1100
|
+
_context17.t0 = _context17["catch"](0);
|
1101
|
+
reject(_context17.t0);
|
1090
1102
|
case 39:
|
1091
1103
|
case "end":
|
1092
|
-
return
|
1104
|
+
return _context17.stop();
|
1093
1105
|
}
|
1094
|
-
},
|
1106
|
+
}, _callee17, null, [[0, 36]]);
|
1095
1107
|
}));
|
1096
1108
|
return function (_x20) {
|
1097
|
-
return
|
1109
|
+
return _ref21.apply(this, arguments);
|
1098
1110
|
};
|
1099
1111
|
}());
|
1100
1112
|
|
@@ -1105,21 +1117,21 @@ _class = File;
|
|
1105
1117
|
});
|
1106
1118
|
});
|
1107
1119
|
case 10:
|
1108
|
-
file =
|
1109
|
-
return
|
1120
|
+
file = _context18.sent;
|
1121
|
+
return _context18.abrupt("return", file);
|
1110
1122
|
case 14:
|
1111
|
-
|
1112
|
-
|
1113
|
-
errors.handleErrorResponse(
|
1114
|
-
return
|
1123
|
+
_context18.prev = 14;
|
1124
|
+
_context18.t0 = _context18["catch"](7);
|
1125
|
+
errors.handleErrorResponse(_context18.t0);
|
1126
|
+
return _context18.abrupt("return", null);
|
1115
1127
|
case 18:
|
1116
1128
|
case "end":
|
1117
|
-
return
|
1129
|
+
return _context18.stop();
|
1118
1130
|
}
|
1119
|
-
},
|
1131
|
+
}, _callee18, null, [[7, 14]]);
|
1120
1132
|
}));
|
1121
1133
|
return function (_x16, _x17, _x18, _x19) {
|
1122
|
-
return
|
1134
|
+
return _ref18.apply(this, arguments);
|
1123
1135
|
};
|
1124
1136
|
}());
|
1125
1137
|
/**
|
@@ -1127,53 +1139,53 @@ _class = File;
|
|
1127
1139
|
* @note see File.copy() for list of supported params
|
1128
1140
|
*/
|
1129
1141
|
(0, _defineProperty2.default)(File, "uploadData", /*#__PURE__*/function () {
|
1130
|
-
var
|
1131
|
-
return _regenerator.default.wrap(function
|
1132
|
-
while (1) switch (
|
1142
|
+
var _ref22 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19(destinationPath, data, params, options) {
|
1143
|
+
return _regenerator.default.wrap(function _callee19$(_context19) {
|
1144
|
+
while (1) switch (_context19.prev = _context19.next) {
|
1133
1145
|
case 0:
|
1134
1146
|
if (data) {
|
1135
|
-
|
1147
|
+
_context19.next = 2;
|
1136
1148
|
break;
|
1137
1149
|
}
|
1138
1150
|
throw new errors.MissingParameterError('Upload data was not provided');
|
1139
1151
|
case 2:
|
1140
|
-
return
|
1152
|
+
return _context19.abrupt("return", _class.uploadStream(destinationPath, _readableStream.default.from(data), params, options));
|
1141
1153
|
case 3:
|
1142
1154
|
case "end":
|
1143
|
-
return
|
1155
|
+
return _context19.stop();
|
1144
1156
|
}
|
1145
|
-
},
|
1157
|
+
}, _callee19);
|
1146
1158
|
}));
|
1147
1159
|
return function (_x21, _x22, _x23, _x24) {
|
1148
|
-
return
|
1160
|
+
return _ref22.apply(this, arguments);
|
1149
1161
|
};
|
1150
1162
|
}());
|
1151
1163
|
/**
|
1152
1164
|
* @note see File.copy() for list of supported params
|
1153
1165
|
*/
|
1154
1166
|
(0, _defineProperty2.default)(File, "uploadFile", /*#__PURE__*/function () {
|
1155
|
-
var
|
1167
|
+
var _ref23 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20(destinationPath, sourceFilePath, params, options) {
|
1156
1168
|
var _require4, openDiskFileReadStream, stream;
|
1157
|
-
return _regenerator.default.wrap(function
|
1158
|
-
while (1) switch (
|
1169
|
+
return _regenerator.default.wrap(function _callee20$(_context20) {
|
1170
|
+
while (1) switch (_context20.prev = _context20.next) {
|
1159
1171
|
case 0:
|
1160
1172
|
if (!(0, _utils.isBrowser)()) {
|
1161
|
-
|
1173
|
+
_context20.next = 2;
|
1162
1174
|
break;
|
1163
1175
|
}
|
1164
1176
|
throw new errors.NotImplementedError('Disk file uploads are only available in a NodeJS environment');
|
1165
1177
|
case 2:
|
1166
1178
|
_require4 = require('../isomorphic/File.node.js'), openDiskFileReadStream = _require4.openDiskFileReadStream;
|
1167
1179
|
stream = openDiskFileReadStream(sourceFilePath);
|
1168
|
-
return
|
1180
|
+
return _context20.abrupt("return", _class.uploadStream(destinationPath, stream, params, options));
|
1169
1181
|
case 5:
|
1170
1182
|
case "end":
|
1171
|
-
return
|
1183
|
+
return _context20.stop();
|
1172
1184
|
}
|
1173
|
-
},
|
1185
|
+
}, _callee20);
|
1174
1186
|
}));
|
1175
1187
|
return function (_x25, _x26, _x27, _x28) {
|
1176
|
-
return
|
1188
|
+
return _ref23.apply(this, arguments);
|
1177
1189
|
};
|
1178
1190
|
}());
|
1179
1191
|
// Parameters:
|
@@ -1192,102 +1204,102 @@ _class = File;
|
|
1192
1204
|
// structure - string - If copying folder, copy just the structure?
|
1193
1205
|
// with_rename - boolean - Allow file rename instead of overwrite?
|
1194
1206
|
(0, _defineProperty2.default)(File, "create", /*#__PURE__*/function () {
|
1195
|
-
var
|
1207
|
+
var _ref24 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21(path) {
|
1196
1208
|
var params,
|
1197
1209
|
options,
|
1198
1210
|
response,
|
1199
|
-
|
1200
|
-
return _regenerator.default.wrap(function
|
1201
|
-
while (1) switch (
|
1211
|
+
_args21 = arguments;
|
1212
|
+
return _regenerator.default.wrap(function _callee21$(_context21) {
|
1213
|
+
while (1) switch (_context21.prev = _context21.next) {
|
1202
1214
|
case 0:
|
1203
|
-
params =
|
1204
|
-
options =
|
1215
|
+
params = _args21.length > 1 && _args21[1] !== undefined ? _args21[1] : {};
|
1216
|
+
options = _args21.length > 2 && _args21[2] !== undefined ? _args21[2] : {};
|
1205
1217
|
if ((0, _utils.isObject)(params)) {
|
1206
|
-
|
1218
|
+
_context21.next = 4;
|
1207
1219
|
break;
|
1208
1220
|
}
|
1209
1221
|
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
1210
1222
|
case 4:
|
1211
1223
|
params['path'] = path;
|
1212
1224
|
if (params['path']) {
|
1213
|
-
|
1225
|
+
_context21.next = 7;
|
1214
1226
|
break;
|
1215
1227
|
}
|
1216
1228
|
throw new errors.MissingParameterError('Parameter missing: path');
|
1217
1229
|
case 7:
|
1218
1230
|
if (!(params['path'] && !(0, _utils.isString)(params['path']))) {
|
1219
|
-
|
1231
|
+
_context21.next = 9;
|
1220
1232
|
break;
|
1221
1233
|
}
|
1222
1234
|
throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(params['path'])));
|
1223
1235
|
case 9:
|
1224
1236
|
if (!(params['action'] && !(0, _utils.isString)(params['action']))) {
|
1225
|
-
|
1237
|
+
_context21.next = 11;
|
1226
1238
|
break;
|
1227
1239
|
}
|
1228
1240
|
throw new errors.InvalidParameterError("Bad parameter: action must be of type String, received ".concat((0, _utils.getType)(params['action'])));
|
1229
1241
|
case 11:
|
1230
1242
|
if (!(params['length'] && !(0, _utils.isInt)(params['length']))) {
|
1231
|
-
|
1243
|
+
_context21.next = 13;
|
1232
1244
|
break;
|
1233
1245
|
}
|
1234
1246
|
throw new errors.InvalidParameterError("Bad parameter: length must be of type Int, received ".concat((0, _utils.getType)(params['length'])));
|
1235
1247
|
case 13:
|
1236
1248
|
if (!(params['part'] && !(0, _utils.isInt)(params['part']))) {
|
1237
|
-
|
1249
|
+
_context21.next = 15;
|
1238
1250
|
break;
|
1239
1251
|
}
|
1240
1252
|
throw new errors.InvalidParameterError("Bad parameter: part must be of type Int, received ".concat((0, _utils.getType)(params['part'])));
|
1241
1253
|
case 15:
|
1242
1254
|
if (!(params['parts'] && !(0, _utils.isInt)(params['parts']))) {
|
1243
|
-
|
1255
|
+
_context21.next = 17;
|
1244
1256
|
break;
|
1245
1257
|
}
|
1246
1258
|
throw new errors.InvalidParameterError("Bad parameter: parts must be of type Int, received ".concat((0, _utils.getType)(params['parts'])));
|
1247
1259
|
case 17:
|
1248
1260
|
if (!(params['provided_mtime'] && !(0, _utils.isString)(params['provided_mtime']))) {
|
1249
|
-
|
1261
|
+
_context21.next = 19;
|
1250
1262
|
break;
|
1251
1263
|
}
|
1252
1264
|
throw new errors.InvalidParameterError("Bad parameter: provided_mtime must be of type String, received ".concat((0, _utils.getType)(params['provided_mtime'])));
|
1253
1265
|
case 19:
|
1254
1266
|
if (!(params['ref'] && !(0, _utils.isString)(params['ref']))) {
|
1255
|
-
|
1267
|
+
_context21.next = 21;
|
1256
1268
|
break;
|
1257
1269
|
}
|
1258
1270
|
throw new errors.InvalidParameterError("Bad parameter: ref must be of type String, received ".concat((0, _utils.getType)(params['ref'])));
|
1259
1271
|
case 21:
|
1260
1272
|
if (!(params['restart'] && !(0, _utils.isInt)(params['restart']))) {
|
1261
|
-
|
1273
|
+
_context21.next = 23;
|
1262
1274
|
break;
|
1263
1275
|
}
|
1264
1276
|
throw new errors.InvalidParameterError("Bad parameter: restart must be of type Int, received ".concat((0, _utils.getType)(params['restart'])));
|
1265
1277
|
case 23:
|
1266
1278
|
if (!(params['size'] && !(0, _utils.isInt)(params['size']))) {
|
1267
|
-
|
1279
|
+
_context21.next = 25;
|
1268
1280
|
break;
|
1269
1281
|
}
|
1270
1282
|
throw new errors.InvalidParameterError("Bad parameter: size must be of type Int, received ".concat((0, _utils.getType)(params['size'])));
|
1271
1283
|
case 25:
|
1272
1284
|
if (!(params['structure'] && !(0, _utils.isString)(params['structure']))) {
|
1273
|
-
|
1285
|
+
_context21.next = 27;
|
1274
1286
|
break;
|
1275
1287
|
}
|
1276
1288
|
throw new errors.InvalidParameterError("Bad parameter: structure must be of type String, received ".concat((0, _utils.getType)(params['structure'])));
|
1277
1289
|
case 27:
|
1278
|
-
|
1290
|
+
_context21.next = 29;
|
1279
1291
|
return _Api.default.sendRequest("/files/".concat(encodeURIComponent(params['path'])), 'POST', params, options);
|
1280
1292
|
case 29:
|
1281
|
-
response =
|
1282
|
-
return
|
1293
|
+
response = _context21.sent;
|
1294
|
+
return _context21.abrupt("return", new _class(response === null || response === void 0 ? void 0 : response.data, options));
|
1283
1295
|
case 31:
|
1284
1296
|
case "end":
|
1285
|
-
return
|
1297
|
+
return _context21.stop();
|
1286
1298
|
}
|
1287
|
-
},
|
1299
|
+
}, _callee21);
|
1288
1300
|
}));
|
1289
1301
|
return function (_x29) {
|
1290
|
-
return
|
1302
|
+
return _ref24.apply(this, arguments);
|
1291
1303
|
};
|
1292
1304
|
}());
|
1293
1305
|
// Parameters:
|
@@ -1296,54 +1308,54 @@ _class = File;
|
|
1296
1308
|
// with_previews - boolean - Include file preview information?
|
1297
1309
|
// with_priority_color - boolean - Include file priority color information?
|
1298
1310
|
(0, _defineProperty2.default)(File, "find", /*#__PURE__*/function () {
|
1299
|
-
var
|
1311
|
+
var _ref25 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee22(path) {
|
1300
1312
|
var params,
|
1301
1313
|
options,
|
1302
1314
|
response,
|
1303
|
-
|
1304
|
-
return _regenerator.default.wrap(function
|
1305
|
-
while (1) switch (
|
1315
|
+
_args22 = arguments;
|
1316
|
+
return _regenerator.default.wrap(function _callee22$(_context22) {
|
1317
|
+
while (1) switch (_context22.prev = _context22.next) {
|
1306
1318
|
case 0:
|
1307
|
-
params =
|
1308
|
-
options =
|
1319
|
+
params = _args22.length > 1 && _args22[1] !== undefined ? _args22[1] : {};
|
1320
|
+
options = _args22.length > 2 && _args22[2] !== undefined ? _args22[2] : {};
|
1309
1321
|
if ((0, _utils.isObject)(params)) {
|
1310
|
-
|
1322
|
+
_context22.next = 4;
|
1311
1323
|
break;
|
1312
1324
|
}
|
1313
1325
|
throw new errors.InvalidParameterError("Bad parameter: params must be of type object, received ".concat((0, _utils.getType)(params)));
|
1314
1326
|
case 4:
|
1315
1327
|
params['path'] = path;
|
1316
1328
|
if (params['path']) {
|
1317
|
-
|
1329
|
+
_context22.next = 7;
|
1318
1330
|
break;
|
1319
1331
|
}
|
1320
1332
|
throw new errors.MissingParameterError('Parameter missing: path');
|
1321
1333
|
case 7:
|
1322
1334
|
if (!(params['path'] && !(0, _utils.isString)(params['path']))) {
|
1323
|
-
|
1335
|
+
_context22.next = 9;
|
1324
1336
|
break;
|
1325
1337
|
}
|
1326
1338
|
throw new errors.InvalidParameterError("Bad parameter: path must be of type String, received ".concat((0, _utils.getType)(params['path'])));
|
1327
1339
|
case 9:
|
1328
1340
|
if (!(params['preview_size'] && !(0, _utils.isString)(params['preview_size']))) {
|
1329
|
-
|
1341
|
+
_context22.next = 11;
|
1330
1342
|
break;
|
1331
1343
|
}
|
1332
1344
|
throw new errors.InvalidParameterError("Bad parameter: preview_size must be of type String, received ".concat((0, _utils.getType)(params['preview_size'])));
|
1333
1345
|
case 11:
|
1334
|
-
|
1346
|
+
_context22.next = 13;
|
1335
1347
|
return _Api.default.sendRequest("/file_actions/metadata/".concat(encodeURIComponent(params['path'])), 'GET', params, options);
|
1336
1348
|
case 13:
|
1337
|
-
response =
|
1338
|
-
return
|
1349
|
+
response = _context22.sent;
|
1350
|
+
return _context22.abrupt("return", new _class(response === null || response === void 0 ? void 0 : response.data, options));
|
1339
1351
|
case 15:
|
1340
1352
|
case "end":
|
1341
|
-
return
|
1353
|
+
return _context22.stop();
|
1342
1354
|
}
|
1343
|
-
},
|
1355
|
+
}, _callee22);
|
1344
1356
|
}));
|
1345
1357
|
return function (_x30) {
|
1346
|
-
return
|
1358
|
+
return _ref25.apply(this, arguments);
|
1347
1359
|
};
|
1348
1360
|
}());
|
1349
1361
|
(0, _defineProperty2.default)(File, "get", function (path) {
|