cozy-client 60.16.1 → 60.17.2

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.
@@ -3126,7 +3126,7 @@ var CozyClient = /*#__PURE__*/function () {
3126
3126
  CozyClient.hooks = CozyClient.hooks || {};
3127
3127
  CozyClient.fetchPolicies = _policies.default; //COZY_CLIENT_VERSION_PACKAGE in replaced by babel. See babel config
3128
3128
 
3129
- CozyClient.version = "60.16.1";
3129
+ CozyClient.version = "60.17.2";
3130
3130
 
3131
3131
  _microee.default.mixin(CozyClient);
3132
3132
 
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "__esModule", {
8
8
  exports.normalize = normalize;
9
9
  exports.ensureFilePath = ensureFilePath;
10
10
  exports.getParentFolderId = getParentFolderId;
11
- exports.downloadFile = exports.copy = exports.fetchBlobFileById = exports.isFromKonnector = exports.hasCertifications = exports.hasQualifications = exports.isPlainText = exports.uploadFileWithConflictStrategy = exports.generateFileNameForRevision = exports.generateNewFileNameOnConflict = exports.overrideFileForPath = exports.move = exports.getFullpath = exports.hasMetadataAttribute = exports.fetchFilesByQualificationRules = exports.saveFileQualification = exports.isSharingShorcutNew = exports.isSharingShortcutNew = exports.isSharingShorcut = exports.isSharingShortcut = exports.getSharingShortcutTargetDoctype = exports.getSharingShortcutTargetMime = exports.getSharingShortcutStatus = exports.getShortcutImgSrc = exports.isShortcut = exports.shouldBeOpenedByOnlyOffice = exports.isOnlyOfficeFile = exports.isEncryptedFileOrFolder = exports.isEncryptedFolder = exports.getEncryptiondRef = exports.isEncrypted = exports.isDocs = exports.isNote = exports.isDirectory = exports.isFile = exports.splitFilename = exports.ALBUMS_DOCTYPE = void 0;
11
+ exports.downloadFile = exports.copy = exports.fetchBlobFileById = exports.isFromKonnector = exports.hasCertifications = exports.hasQualifications = exports.isPlainText = exports.uploadFileWithConflictStrategy = exports.generateFileNameForRevision = exports.generateNewFileNameOnConflict = exports.overrideFileForPath = exports.moveRelateToSharedDrive = exports.move = exports.getFullpath = exports.hasMetadataAttribute = exports.fetchFilesByQualificationRules = exports.saveFileQualification = exports.isSharingShorcutNew = exports.isSharingShortcutNew = exports.isSharingShorcut = exports.isSharingShortcut = exports.getSharingShortcutTargetDoctype = exports.getSharingShortcutTargetMime = exports.getSharingShortcutStatus = exports.getShortcutImgSrc = exports.isShortcut = exports.shouldBeOpenedByOnlyOffice = exports.isOnlyOfficeFile = exports.isEncryptedFileOrFolder = exports.isEncryptedFolder = exports.getEncryptiondRef = exports.isEncrypted = exports.isDocs = exports.isNote = exports.isDirectory = exports.isFile = exports.splitFilename = exports.ALBUMS_DOCTYPE = void 0;
12
12
 
13
13
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
14
14
 
@@ -724,6 +724,74 @@ var move = /*#__PURE__*/function () {
724
724
  return _ref6.apply(this, arguments);
725
725
  };
726
726
  }();
727
+ /**
728
+ * Move or copy a file or a directory between locations (personal drive and/or shared drives).
729
+ * Manage 3 cases :
730
+ * - From a shared drive to another shared drive (same stack or cross-stack)
731
+ * - From a shared drive to a personal drive
732
+ * - From a personal drive to a shared drive
733
+ *
734
+ * @param {CozyClient} client - The CozyClient instance.
735
+ * @param {object} source - The source file/folder to move/copy (required)
736
+ * At least one side (source or destination) must be a shared drive.
737
+ * @param {string} [source.instance] - omit for personal drive
738
+ * If `source.instance` is provided, `source.sharing_id` is required.
739
+ * @param {string} [source.sharing_id] - required when instance is set
740
+ * @param {string} [source.file_id] - file needs to move
741
+ * @param {string} [source.dir_id] - folder needs to move
742
+ * Exactly one of `source.file_id` or `source.dir_id` must be provided.
743
+ * @param {object} dest - The destination folder (required)
744
+ * @param {string} [dest.instance] - omit for personal drive
745
+ * If `dest.instance` is provided, `dest.sharing_id` is required.
746
+ * @param {string} [dest.sharing_id] - required when instance is set
747
+ * @param {string} dest.dir_id - destination directory id (required)
748
+ * @param {boolean} isCopy - controls whether the operation is a move (default) or copy.
749
+ * When `copy: false` (default): The source file/directory is moved to the destination and deleted from the source.
750
+ * When `copy: true`: The source file/directory is copied to the destination but remains in the source location.
751
+ * @returns {Promise<{moved: undefined|import('../types').IOCozyFile, deleted: null|string[] }>} - A promise that returns the move/copy action response (if any)
752
+ */
753
+
754
+
755
+ exports.move = move;
756
+
757
+ var moveRelateToSharedDrive = /*#__PURE__*/function () {
758
+ var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(client, source, dest, isCopy) {
759
+ var filesCollection, resp;
760
+ return _regenerator.default.wrap(function _callee5$(_context5) {
761
+ while (1) {
762
+ switch (_context5.prev = _context5.next) {
763
+ case 0:
764
+ filesCollection = client.collection(_const.DOCTYPE_FILES, {
765
+ driveId: 'move'
766
+ });
767
+ _context5.prev = 1;
768
+ _context5.next = 4;
769
+ return filesCollection.moveRelateToSharedDrive(source, dest, isCopy);
770
+
771
+ case 4:
772
+ resp = _context5.sent;
773
+ return _context5.abrupt("return", {
774
+ moved: resp.data,
775
+ deleted: null
776
+ });
777
+
778
+ case 8:
779
+ _context5.prev = 8;
780
+ _context5.t0 = _context5["catch"](1);
781
+ throw _context5.t0;
782
+
783
+ case 11:
784
+ case "end":
785
+ return _context5.stop();
786
+ }
787
+ }
788
+ }, _callee5, null, [[1, 8]]);
789
+ }));
790
+
791
+ return function moveRelateToSharedDrive(_x12, _x13, _x14, _x15) {
792
+ return _ref8.apply(this, arguments);
793
+ };
794
+ }();
727
795
  /**
728
796
  *
729
797
  * Method to upload a file even if a file with the same name already exists.
@@ -738,11 +806,11 @@ var move = /*#__PURE__*/function () {
738
806
  */
739
807
 
740
808
 
741
- exports.move = move;
809
+ exports.moveRelateToSharedDrive = moveRelateToSharedDrive;
742
810
 
743
811
  var overrideFileForPath = /*#__PURE__*/function () {
744
- var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(client, dirPath, file, metadata) {
745
- var _ref9,
812
+ var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(client, dirPath, file, metadata) {
813
+ var _ref10,
746
814
  driveId,
747
815
  path,
748
816
  filesCollection,
@@ -753,26 +821,26 @@ var overrideFileForPath = /*#__PURE__*/function () {
753
821
  resp,
754
822
  _dirId,
755
823
  createdFile,
756
- _args5 = arguments;
824
+ _args6 = arguments;
757
825
 
758
- return _regenerator.default.wrap(function _callee5$(_context5) {
826
+ return _regenerator.default.wrap(function _callee6$(_context6) {
759
827
  while (1) {
760
- switch (_context5.prev = _context5.next) {
828
+ switch (_context6.prev = _context6.next) {
761
829
  case 0:
762
- _ref9 = _args5.length > 4 && _args5[4] !== undefined ? _args5[4] : {}, driveId = _ref9.driveId;
830
+ _ref10 = _args6.length > 4 && _args6[4] !== undefined ? _args6[4] : {}, driveId = _ref10.driveId;
763
831
  path = dirPath;
764
832
  if (!path.endsWith('/')) path = path + '/';
765
833
  filesCollection = client.collection(_const.DOCTYPE_FILES, {
766
834
  driveId: driveId
767
835
  });
768
- _context5.prev = 4;
769
- _context5.next = 7;
836
+ _context6.prev = 4;
837
+ _context6.next = 7;
770
838
  return filesCollection.statByPath(path + file.name);
771
839
 
772
840
  case 7:
773
- existingFile = _context5.sent;
841
+ existingFile = _context6.sent;
774
842
  _existingFile$data = existingFile.data, fileId = _existingFile$data.id, dirId = _existingFile$data.dir_id;
775
- _context5.next = 11;
843
+ _context6.next = 11;
776
844
  return filesCollection.updateFile(file, {
777
845
  dirId: dirId,
778
846
  fileId: fileId,
@@ -780,46 +848,46 @@ var overrideFileForPath = /*#__PURE__*/function () {
780
848
  });
781
849
 
782
850
  case 11:
783
- resp = _context5.sent;
784
- return _context5.abrupt("return", resp);
851
+ resp = _context6.sent;
852
+ return _context6.abrupt("return", resp);
785
853
 
786
854
  case 15:
787
- _context5.prev = 15;
788
- _context5.t0 = _context5["catch"](4);
855
+ _context6.prev = 15;
856
+ _context6.t0 = _context6["catch"](4);
789
857
 
790
- if (!/Not Found/.test(_context5.t0)) {
791
- _context5.next = 25;
858
+ if (!/Not Found/.test(_context6.t0)) {
859
+ _context6.next = 25;
792
860
  break;
793
861
  }
794
862
 
795
- _context5.next = 20;
863
+ _context6.next = 20;
796
864
  return filesCollection.ensureDirectoryExists(path);
797
865
 
798
866
  case 20:
799
- _dirId = _context5.sent;
800
- _context5.next = 23;
867
+ _dirId = _context6.sent;
868
+ _context6.next = 23;
801
869
  return filesCollection.createFile(file, {
802
870
  dirId: _dirId,
803
871
  metadata: metadata
804
872
  });
805
873
 
806
874
  case 23:
807
- createdFile = _context5.sent;
808
- return _context5.abrupt("return", createdFile);
875
+ createdFile = _context6.sent;
876
+ return _context6.abrupt("return", createdFile);
809
877
 
810
878
  case 25:
811
- throw _context5.t0;
879
+ throw _context6.t0;
812
880
 
813
881
  case 26:
814
882
  case "end":
815
- return _context5.stop();
883
+ return _context6.stop();
816
884
  }
817
885
  }
818
- }, _callee5, null, [[4, 15]]);
886
+ }, _callee6, null, [[4, 15]]);
819
887
  }));
820
888
 
821
- return function overrideFileForPath(_x12, _x13, _x14, _x15) {
822
- return _ref8.apply(this, arguments);
889
+ return function overrideFileForPath(_x16, _x17, _x18, _x19) {
890
+ return _ref9.apply(this, arguments);
823
891
  };
824
892
  }();
825
893
  /**
@@ -898,43 +966,43 @@ var generateFileNameForRevision = function generateFileNameForRevision(file, rev
898
966
  exports.generateFileNameForRevision = generateFileNameForRevision;
899
967
 
900
968
  var uploadFileWithConflictStrategy = /*#__PURE__*/function () {
901
- var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(client, file, options) {
969
+ var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(client, file, options) {
902
970
  var name, dirId, conflictStrategy, conflictOptions, driveId, filesCollection, path, existingFile, fileId, resp, _splitFilename2, filename, extension, newFileName;
903
971
 
904
- return _regenerator.default.wrap(function _callee6$(_context6) {
972
+ return _regenerator.default.wrap(function _callee7$(_context7) {
905
973
  while (1) {
906
- switch (_context6.prev = _context6.next) {
974
+ switch (_context7.prev = _context7.next) {
907
975
  case 0:
908
976
  name = options.name, dirId = options.dirId, conflictStrategy = options.conflictStrategy, conflictOptions = options.conflictOptions, driveId = options.driveId;
909
977
  filesCollection = client.collection(_const.DOCTYPE_FILES, {
910
978
  driveId: driveId
911
979
  });
912
- _context6.prev = 2;
913
- _context6.next = 5;
980
+ _context7.prev = 2;
981
+ _context7.next = 5;
914
982
  return getFullpath(client, dirId, name, driveId);
915
983
 
916
984
  case 5:
917
- path = _context6.sent;
918
- _context6.next = 8;
985
+ path = _context7.sent;
986
+ _context7.next = 8;
919
987
  return filesCollection.statByPath(path);
920
988
 
921
989
  case 8:
922
- existingFile = _context6.sent;
990
+ existingFile = _context7.sent;
923
991
  fileId = existingFile.data.id;
924
992
 
925
993
  if (!(conflictStrategy === 'erase')) {
926
- _context6.next = 17;
994
+ _context7.next = 17;
927
995
  break;
928
996
  }
929
997
 
930
- _context6.next = 13;
998
+ _context7.next = 13;
931
999
  return filesCollection.updateFile(file, _objectSpread(_objectSpread({}, options), {}, {
932
1000
  fileId: fileId
933
1001
  }));
934
1002
 
935
1003
  case 13:
936
- resp = _context6.sent;
937
- return _context6.abrupt("return", resp);
1004
+ resp = _context7.sent;
1005
+ return _context7.abrupt("return", resp);
938
1006
 
939
1007
  case 17:
940
1008
  // @ts-ignore
@@ -944,38 +1012,38 @@ var uploadFileWithConflictStrategy = /*#__PURE__*/function () {
944
1012
  }), filename = _splitFilename2.filename, extension = _splitFilename2.extension;
945
1013
  newFileName = generateNewFileNameOnConflict(filename, conflictOptions) + extension; //recall itself with the newFilename.
946
1014
 
947
- return _context6.abrupt("return", uploadFileWithConflictStrategy(client, file, _objectSpread(_objectSpread({}, options), {}, {
1015
+ return _context7.abrupt("return", uploadFileWithConflictStrategy(client, file, _objectSpread(_objectSpread({}, options), {}, {
948
1016
  name: newFileName
949
1017
  })));
950
1018
 
951
1019
  case 20:
952
- _context6.next = 27;
1020
+ _context7.next = 27;
953
1021
  break;
954
1022
 
955
1023
  case 22:
956
- _context6.prev = 22;
957
- _context6.t0 = _context6["catch"](2);
1024
+ _context7.prev = 22;
1025
+ _context7.t0 = _context7["catch"](2);
958
1026
 
959
- if (!/Not Found/.test(_context6.t0.message)) {
960
- _context6.next = 26;
1027
+ if (!/Not Found/.test(_context7.t0.message)) {
1028
+ _context7.next = 26;
961
1029
  break;
962
1030
  }
963
1031
 
964
- return _context6.abrupt("return", filesCollection.createFile(file, options));
1032
+ return _context7.abrupt("return", filesCollection.createFile(file, options));
965
1033
 
966
1034
  case 26:
967
- throw _context6.t0;
1035
+ throw _context7.t0;
968
1036
 
969
1037
  case 27:
970
1038
  case "end":
971
- return _context6.stop();
1039
+ return _context7.stop();
972
1040
  }
973
1041
  }
974
- }, _callee6, null, [[2, 22]]);
1042
+ }, _callee7, null, [[2, 22]]);
975
1043
  }));
976
1044
 
977
- return function uploadFileWithConflictStrategy(_x16, _x17, _x18) {
978
- return _ref10.apply(this, arguments);
1045
+ return function uploadFileWithConflictStrategy(_x20, _x21, _x22) {
1046
+ return _ref11.apply(this, arguments);
979
1047
  };
980
1048
  }();
981
1049
  /**
@@ -1037,44 +1105,44 @@ var isFromKonnector = function isFromKonnector(file) {
1037
1105
  exports.isFromKonnector = isFromKonnector;
1038
1106
 
1039
1107
  var fetchBlobFileById = /*#__PURE__*/function () {
1040
- var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(client, fileId) {
1041
- var _ref12,
1108
+ var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(client, fileId) {
1109
+ var _ref13,
1042
1110
  driveId,
1043
1111
  fileColl,
1044
1112
  fileBin,
1045
1113
  fileBlob,
1046
- _args7 = arguments;
1114
+ _args8 = arguments;
1047
1115
 
1048
- return _regenerator.default.wrap(function _callee7$(_context7) {
1116
+ return _regenerator.default.wrap(function _callee8$(_context8) {
1049
1117
  while (1) {
1050
- switch (_context7.prev = _context7.next) {
1118
+ switch (_context8.prev = _context8.next) {
1051
1119
  case 0:
1052
- _ref12 = _args7.length > 2 && _args7[2] !== undefined ? _args7[2] : {}, driveId = _ref12.driveId;
1120
+ _ref13 = _args8.length > 2 && _args8[2] !== undefined ? _args8[2] : {}, driveId = _ref13.driveId;
1053
1121
  fileColl = client.collection(_const.DOCTYPE_FILES, {
1054
1122
  driveId: driveId
1055
1123
  });
1056
- _context7.next = 4;
1124
+ _context8.next = 4;
1057
1125
  return fileColl.fetchFileContentById(fileId);
1058
1126
 
1059
1127
  case 4:
1060
- fileBin = _context7.sent;
1061
- _context7.next = 7;
1128
+ fileBin = _context8.sent;
1129
+ _context8.next = 7;
1062
1130
  return fileBin.blob();
1063
1131
 
1064
1132
  case 7:
1065
- fileBlob = _context7.sent;
1066
- return _context7.abrupt("return", fileBlob);
1133
+ fileBlob = _context8.sent;
1134
+ return _context8.abrupt("return", fileBlob);
1067
1135
 
1068
1136
  case 9:
1069
1137
  case "end":
1070
- return _context7.stop();
1138
+ return _context8.stop();
1071
1139
  }
1072
1140
  }
1073
- }, _callee7);
1141
+ }, _callee8);
1074
1142
  }));
1075
1143
 
1076
- return function fetchBlobFileById(_x19, _x20) {
1077
- return _ref11.apply(this, arguments);
1144
+ return function fetchBlobFileById(_x23, _x24) {
1145
+ return _ref12.apply(this, arguments);
1078
1146
  };
1079
1147
  }();
1080
1148
  /**
@@ -1093,89 +1161,89 @@ var fetchBlobFileById = /*#__PURE__*/function () {
1093
1161
  exports.fetchBlobFileById = fetchBlobFileById;
1094
1162
 
1095
1163
  var copy = /*#__PURE__*/function () {
1096
- var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(client, file, destination) {
1097
- var _ref14,
1164
+ var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(client, file, destination) {
1165
+ var _ref15,
1098
1166
  driveId,
1099
1167
  _resp2,
1100
1168
  _resp3,
1101
1169
  _resp4,
1102
1170
  resp,
1103
- _args8 = arguments;
1171
+ _args9 = arguments;
1104
1172
 
1105
- return _regenerator.default.wrap(function _callee8$(_context8) {
1173
+ return _regenerator.default.wrap(function _callee9$(_context9) {
1106
1174
  while (1) {
1107
- switch (_context8.prev = _context8.next) {
1175
+ switch (_context9.prev = _context9.next) {
1108
1176
  case 0:
1109
- _ref14 = _args8.length > 3 && _args8[3] !== undefined ? _args8[3] : {}, driveId = _ref14.driveId;
1110
- _context8.prev = 1;
1177
+ _ref15 = _args9.length > 3 && _args9[3] !== undefined ? _args9[3] : {}, driveId = _ref15.driveId;
1178
+ _context9.prev = 1;
1111
1179
 
1112
1180
  if (!(file._type === 'io.cozy.remote.nextcloud.files' && destination._type === 'io.cozy.remote.nextcloud.files')) {
1113
- _context8.next = 7;
1181
+ _context9.next = 7;
1114
1182
  break;
1115
1183
  }
1116
1184
 
1117
- _context8.next = 5;
1185
+ _context9.next = 5;
1118
1186
  return client.collection('io.cozy.remote.nextcloud.files').copy(file, destination);
1119
1187
 
1120
1188
  case 5:
1121
- _resp2 = _context8.sent;
1122
- return _context8.abrupt("return", _resp2);
1189
+ _resp2 = _context9.sent;
1190
+ return _context9.abrupt("return", _resp2);
1123
1191
 
1124
1192
  case 7:
1125
1193
  if (!(file._type === 'io.cozy.remote.nextcloud.files' && destination._type === 'io.cozy.files')) {
1126
- _context8.next = 12;
1194
+ _context9.next = 12;
1127
1195
  break;
1128
1196
  }
1129
1197
 
1130
- _context8.next = 10;
1198
+ _context9.next = 10;
1131
1199
  return client.collection('io.cozy.remote.nextcloud.files').moveToCozy(file, destination, {
1132
1200
  copy: true
1133
1201
  });
1134
1202
 
1135
1203
  case 10:
1136
- _resp3 = _context8.sent;
1137
- return _context8.abrupt("return", _resp3);
1204
+ _resp3 = _context9.sent;
1205
+ return _context9.abrupt("return", _resp3);
1138
1206
 
1139
1207
  case 12:
1140
1208
  if (!(destination._type === 'io.cozy.remote.nextcloud.files')) {
1141
- _context8.next = 17;
1209
+ _context9.next = 17;
1142
1210
  break;
1143
1211
  }
1144
1212
 
1145
- _context8.next = 15;
1213
+ _context9.next = 15;
1146
1214
  return client.collection('io.cozy.remote.nextcloud.files').moveFromCozy(destination, file, {
1147
1215
  copy: true
1148
1216
  });
1149
1217
 
1150
1218
  case 15:
1151
- _resp4 = _context8.sent;
1152
- return _context8.abrupt("return", _resp4);
1219
+ _resp4 = _context9.sent;
1220
+ return _context9.abrupt("return", _resp4);
1153
1221
 
1154
1222
  case 17:
1155
- _context8.next = 19;
1223
+ _context9.next = 19;
1156
1224
  return client.collection(_const.DOCTYPE_FILES, {
1157
1225
  driveId: driveId
1158
1226
  }).copy(file._id, undefined, destination._id);
1159
1227
 
1160
1228
  case 19:
1161
- resp = _context8.sent;
1162
- return _context8.abrupt("return", resp);
1229
+ resp = _context9.sent;
1230
+ return _context9.abrupt("return", resp);
1163
1231
 
1164
1232
  case 23:
1165
- _context8.prev = 23;
1166
- _context8.t0 = _context8["catch"](1);
1167
- throw _context8.t0;
1233
+ _context9.prev = 23;
1234
+ _context9.t0 = _context9["catch"](1);
1235
+ throw _context9.t0;
1168
1236
 
1169
1237
  case 26:
1170
1238
  case "end":
1171
- return _context8.stop();
1239
+ return _context9.stop();
1172
1240
  }
1173
1241
  }
1174
- }, _callee8, null, [[1, 23]]);
1242
+ }, _callee9, null, [[1, 23]]);
1175
1243
  }));
1176
1244
 
1177
- return function copy(_x21, _x22, _x23) {
1178
- return _ref13.apply(this, arguments);
1245
+ return function copy(_x25, _x26, _x27) {
1246
+ return _ref14.apply(this, arguments);
1179
1247
  };
1180
1248
  }();
1181
1249
  /**
@@ -1200,85 +1268,85 @@ var copy = /*#__PURE__*/function () {
1200
1268
  exports.copy = copy;
1201
1269
 
1202
1270
  var downloadFile = /*#__PURE__*/function () {
1203
- var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(_ref15) {
1271
+ var _ref17 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(_ref16) {
1204
1272
  var client, file, url, webviewIntent, driveId, filesCollection, _yield$webviewIntent$, isFlagshipDownloadAvailable;
1205
1273
 
1206
- return _regenerator.default.wrap(function _callee9$(_context9) {
1274
+ return _regenerator.default.wrap(function _callee10$(_context10) {
1207
1275
  while (1) {
1208
- switch (_context9.prev = _context9.next) {
1276
+ switch (_context10.prev = _context10.next) {
1209
1277
  case 0:
1210
- client = _ref15.client, file = _ref15.file, url = _ref15.url, webviewIntent = _ref15.webviewIntent, driveId = _ref15.driveId;
1278
+ client = _ref16.client, file = _ref16.file, url = _ref16.url, webviewIntent = _ref16.webviewIntent, driveId = _ref16.driveId;
1211
1279
  filesCollection = client.collection(_const.DOCTYPE_FILES, {
1212
1280
  driveId: driveId
1213
1281
  });
1214
1282
 
1215
1283
  if (!((0, _cozyDeviceHelper.isFlagshipApp)() && webviewIntent && !isEncrypted(file))) {
1216
- _context9.next = 19;
1284
+ _context10.next = 19;
1217
1285
  break;
1218
1286
  }
1219
1287
 
1220
- _context9.next = 5;
1288
+ _context10.next = 5;
1221
1289
  return webviewIntent === null || webviewIntent === void 0 ? void 0 : webviewIntent.call('isAvailable', 'downloadFile');
1222
1290
 
1223
1291
  case 5:
1224
- _context9.t1 = _yield$webviewIntent$ = _context9.sent;
1225
- _context9.t0 = _context9.t1 !== null;
1292
+ _context10.t1 = _yield$webviewIntent$ = _context10.sent;
1293
+ _context10.t0 = _context10.t1 !== null;
1226
1294
 
1227
- if (!_context9.t0) {
1228
- _context9.next = 9;
1295
+ if (!_context10.t0) {
1296
+ _context10.next = 9;
1229
1297
  break;
1230
1298
  }
1231
1299
 
1232
- _context9.t0 = _yield$webviewIntent$ !== void 0;
1300
+ _context10.t0 = _yield$webviewIntent$ !== void 0;
1233
1301
 
1234
1302
  case 9:
1235
- if (!_context9.t0) {
1236
- _context9.next = 13;
1303
+ if (!_context10.t0) {
1304
+ _context10.next = 13;
1237
1305
  break;
1238
1306
  }
1239
1307
 
1240
- _context9.t2 = _yield$webviewIntent$;
1241
- _context9.next = 14;
1308
+ _context10.t2 = _yield$webviewIntent$;
1309
+ _context10.next = 14;
1242
1310
  break;
1243
1311
 
1244
1312
  case 13:
1245
- _context9.t2 = false;
1313
+ _context10.t2 = false;
1246
1314
 
1247
1315
  case 14:
1248
- isFlagshipDownloadAvailable = _context9.t2;
1316
+ isFlagshipDownloadAvailable = _context10.t2;
1249
1317
 
1250
1318
  if (!isFlagshipDownloadAvailable) {
1251
- _context9.next = 19;
1319
+ _context10.next = 19;
1252
1320
  break;
1253
1321
  }
1254
1322
 
1255
- _context9.next = 18;
1323
+ _context10.next = 18;
1256
1324
  return webviewIntent.call('downloadFile', file);
1257
1325
 
1258
1326
  case 18:
1259
- return _context9.abrupt("return", _context9.sent);
1327
+ return _context10.abrupt("return", _context10.sent);
1260
1328
 
1261
1329
  case 19:
1262
1330
  if (!isEncrypted(file)) {
1263
- _context9.next = 21;
1331
+ _context10.next = 21;
1264
1332
  break;
1265
1333
  }
1266
1334
 
1267
- return _context9.abrupt("return", filesCollection.forceFileDownload(url, file.name));
1335
+ return _context10.abrupt("return", filesCollection.forceFileDownload(url, file.name));
1268
1336
 
1269
1337
  case 21:
1270
- return _context9.abrupt("return", filesCollection.download(file));
1338
+ return _context10.abrupt("return", filesCollection.download(file));
1271
1339
 
1272
1340
  case 22:
1273
1341
  case "end":
1274
- return _context9.stop();
1342
+ return _context10.stop();
1275
1343
  }
1276
1344
  }
1277
- }, _callee9);
1345
+ }, _callee10);
1278
1346
  }));
1279
1347
 
1280
- return function downloadFile(_x24) {
1281
- return _ref16.apply(this, arguments);
1348
+ return function downloadFile(_x28) {
1349
+ return _ref17.apply(this, arguments);
1282
1350
  };
1283
1351
  }();
1284
1352
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-client",
3
- "version": "60.16.1",
3
+ "version": "60.17.2",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.node.js",
6
6
  "browser": "dist/index.js",
@@ -19,7 +19,7 @@
19
19
  "@types/jest": "^26.0.20",
20
20
  "@types/lodash": "^4.14.170",
21
21
  "btoa": "^1.2.1",
22
- "cozy-stack-client": "^60.16.1",
22
+ "cozy-stack-client": "^60.17.2",
23
23
  "date-fns": "^2.30.0",
24
24
  "fast-deep-equal": "^3.1.3",
25
25
  "json-stable-stringify": "^1.0.1",
@@ -74,5 +74,5 @@
74
74
  "react-native-ios11-devicecheck": "^0.0.3"
75
75
  },
76
76
  "sideEffects": false,
77
- "gitHead": "b92c3cdbd84d99e9289104918df55d9fd2fa0c14"
77
+ "gitHead": "63d19849194ca84aeda54c985f9068449b8ba954"
78
78
  }
@@ -64,6 +64,19 @@ export function move(client: CozyClient, file: import('../types').IOCozyFile | i
64
64
  moved: undefined | import('../types').IOCozyFile;
65
65
  deleted: null | string[];
66
66
  }>;
67
+ export function moveRelateToSharedDrive(client: CozyClient, source: {
68
+ instance: string;
69
+ sharing_id: string;
70
+ file_id: string;
71
+ dir_id: string;
72
+ }, dest: {
73
+ instance: string;
74
+ sharing_id: string;
75
+ dir_id: string;
76
+ }, isCopy: boolean): Promise<{
77
+ moved: undefined | import('../types').IOCozyFile;
78
+ deleted: null | string[];
79
+ }>;
67
80
  export function overrideFileForPath(client: CozyClient, dirPath: string, file: object, metadata: object, { driveId }?: {
68
81
  driveId: string;
69
82
  }): Promise<import("../types").IOCozyFile>;