cozy-client 53.0.0 → 53.1.0

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.
@@ -3049,7 +3049,7 @@ var CozyClient = /*#__PURE__*/function () {
3049
3049
  CozyClient.hooks = CozyClient.hooks || {};
3050
3050
  CozyClient.fetchPolicies = _policies.default; //COZY_CLIENT_VERSION_PACKAGE in replaced by babel. See babel config
3051
3051
 
3052
- CozyClient.version = "53.0.0";
3052
+ CozyClient.version = "53.1.0";
3053
3053
 
3054
3054
  _microee.default.mixin(CozyClient);
3055
3055
 
package/dist/const.js CHANGED
@@ -3,10 +3,12 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.DOCTYPE_PERMISSIONS = exports.DOCTYPE_FILES = exports.REGISTRATION_ABORT = void 0;
6
+ exports.DOCTYPE_FILES_ENCRYPTION = exports.DOCTYPE_PERMISSIONS = exports.DOCTYPE_FILES = exports.REGISTRATION_ABORT = void 0;
7
7
  var REGISTRATION_ABORT = 'REGISTRATION_ABORT';
8
8
  exports.REGISTRATION_ABORT = REGISTRATION_ABORT;
9
9
  var DOCTYPE_FILES = 'io.cozy.files';
10
10
  exports.DOCTYPE_FILES = DOCTYPE_FILES;
11
11
  var DOCTYPE_PERMISSIONS = 'io.cozy.permissions';
12
- exports.DOCTYPE_PERMISSIONS = DOCTYPE_PERMISSIONS;
12
+ exports.DOCTYPE_PERMISSIONS = DOCTYPE_PERMISSIONS;
13
+ var DOCTYPE_FILES_ENCRYPTION = 'io.cozy.files.encryption';
14
+ exports.DOCTYPE_FILES_ENCRYPTION = DOCTYPE_FILES_ENCRYPTION;
@@ -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.doMobileUpload = exports.readMobileFile = 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.isShortcut = exports.shouldBeOpenedByOnlyOffice = exports.isOnlyOfficeFile = exports.isEncrypted = 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.doMobileUpload = exports.readMobileFile = 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.isShortcut = exports.shouldBeOpenedByOnlyOffice = exports.isOnlyOfficeFile = exports.isEncryptedFileOrFolder = exports.isEncryptedFolder = exports.getEncryptiondRef = exports.isEncrypted = 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
 
@@ -120,6 +120,48 @@ exports.isNote = isNote;
120
120
  var isEncrypted = function isEncrypted(file) {
121
121
  return !!file.encrypted;
122
122
  };
123
+ /**
124
+ * Returns folder encryption reference
125
+ *
126
+ * @param {import("../types").IOCozyFile} dir - io.cozy.files document
127
+ * @returns {boolean}
128
+ */
129
+
130
+
131
+ exports.isEncrypted = isEncrypted;
132
+
133
+ var getEncryptiondRef = function getEncryptiondRef(dir) {
134
+ var refs = (0, _get.default)(dir, 'referenced_by', []);
135
+ return refs.find(function (ref) {
136
+ return ref.type === _const.DOCTYPE_FILES_ENCRYPTION;
137
+ });
138
+ };
139
+ /**
140
+ * Whether the folder is client-side encrypted
141
+ *
142
+ * @param {import("../types").IOCozyFile} dir - io.cozy.files document
143
+ * @returns {boolean}
144
+ */
145
+
146
+
147
+ exports.getEncryptiondRef = getEncryptiondRef;
148
+
149
+ var isEncryptedFolder = function isEncryptedFolder(dir) {
150
+ return !!getEncryptiondRef(dir);
151
+ };
152
+ /**
153
+ * Whether the file or folder is client-side encrypted
154
+ *
155
+ * @param {import("../types").IOCozyFile} fileOrdir - io.cozy.files document
156
+ * @returns {boolean}
157
+ */
158
+
159
+
160
+ exports.isEncryptedFolder = isEncryptedFolder;
161
+
162
+ var isEncryptedFileOrFolder = function isEncryptedFileOrFolder(fileOrdir) {
163
+ return isEncryptedFolder(fileOrdir) || isEncrypted(fileOrdir);
164
+ };
123
165
  /**
124
166
  * Whether the file is supported by Only Office
125
167
  *
@@ -128,7 +170,7 @@ var isEncrypted = function isEncrypted(file) {
128
170
  */
129
171
 
130
172
 
131
- exports.isEncrypted = isEncrypted;
173
+ exports.isEncryptedFileOrFolder = isEncryptedFileOrFolder;
132
174
 
133
175
  var isOnlyOfficeFile = function isOnlyOfficeFile(file) {
134
176
  return isFile(file) && !isNote(file) && (file.class === 'text' || file.class === 'spreadsheet' || file.class === 'slide');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-client",
3
- "version": "53.0.0",
3
+ "version": "53.1.0",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.node.js",
6
6
  "browser": "dist/index.js",
@@ -72,5 +72,5 @@
72
72
  "react-native-ios11-devicecheck": "https://github.com/cozy/react-native-devicecheck#app-attest-v0.1"
73
73
  },
74
74
  "sideEffects": false,
75
- "gitHead": "ff361d04c014bbbe538d0515eb61f8ec65764f15"
75
+ "gitHead": "d265f54c73e6e14860b83cffc79aa9a612119ca0"
76
76
  }
package/types/const.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export const REGISTRATION_ABORT: "REGISTRATION_ABORT";
2
2
  export const DOCTYPE_FILES: "io.cozy.files";
3
3
  export const DOCTYPE_PERMISSIONS: "io.cozy.permissions";
4
+ export const DOCTYPE_FILES_ENCRYPTION: "io.cozy.files.encryption";
@@ -33,6 +33,9 @@ export function isFile(file: import("../types").IOCozyFile): boolean;
33
33
  export function isDirectory(file: import("../types").IOCozyFile): boolean;
34
34
  export function isNote(file: import("../types").IOCozyFile): boolean;
35
35
  export function isEncrypted(file: import("../types").IOCozyFile): boolean;
36
+ export function getEncryptiondRef(dir: import("../types").IOCozyFile): boolean;
37
+ export function isEncryptedFolder(dir: import("../types").IOCozyFile): boolean;
38
+ export function isEncryptedFileOrFolder(fileOrdir: import("../types").IOCozyFile): boolean;
36
39
  export function isOnlyOfficeFile(file: import("../types").IOCozyFile): boolean;
37
40
  export function shouldBeOpenedByOnlyOffice(file: import("../types").IOCozyFile): boolean;
38
41
  export function isShortcut(file: import("../types").IOCozyFile): boolean;