cozy-client 28.1.1 → 28.2.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.
- package/dist/CozyClient.js +1 -1
- package/dist/CozyClient.spec.js +1 -1
- package/dist/models/file.js +15 -2
- package/dist/models/file.spec.js +12 -0
- package/dist/types.js +5 -2
- package/package.json +4 -4
- package/types/models/file.d.ts +1 -0
- package/types/types.d.ts +14 -2
package/dist/CozyClient.js
CHANGED
|
@@ -2537,7 +2537,7 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
2537
2537
|
CozyClient.hooks = CozyClient.hooks || {};
|
|
2538
2538
|
CozyClient.fetchPolicies = _policies.default; //COZY_CLIENT_VERSION_PACKAGE in replaced by babel. See babel config
|
|
2539
2539
|
|
|
2540
|
-
CozyClient.version = "28.
|
|
2540
|
+
CozyClient.version = "28.2.2";
|
|
2541
2541
|
|
|
2542
2542
|
_microee.default.mixin(CozyClient);
|
|
2543
2543
|
|
package/dist/CozyClient.spec.js
CHANGED
|
@@ -1800,7 +1800,7 @@ describe('file creation', () => {
|
|
|
1800
1800
|
expect(doc._id).toEqual('1337')
|
|
1801
1801
|
expect(client.stackClient.fetchJSON).toHaveBeenCalledWith(
|
|
1802
1802
|
'POST',
|
|
1803
|
-
'/files/folder-id?Name=toto.pdf&Type=file&Executable=false&MetadataID=&Size=12',
|
|
1803
|
+
'/files/folder-id?Name=toto.pdf&Type=file&Executable=false&Encrypted=false&MetadataID=&Size=12',
|
|
1804
1804
|
'file-content',
|
|
1805
1805
|
{
|
|
1806
1806
|
headers: { 'Content-Type': 'text/plain', 'Content-Length': '12' },
|
package/dist/models/file.js
CHANGED
|
@@ -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.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.isReferencedByAlbum = 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.isNote = exports.isDirectory = exports.isFile = exports.splitFilename = exports.ALBUMS_DOCTYPE = void 0;
|
|
11
|
+
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.isReferencedByAlbum = 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;
|
|
12
12
|
|
|
13
13
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
14
14
|
|
|
@@ -109,6 +109,19 @@ var isNote = function isNote(file) {
|
|
|
109
109
|
if (file && file.name && file.name.endsWith('.cozy-note') && file.type === FILE_TYPE && file.metadata && file.metadata.content !== undefined && file.metadata.schema !== undefined && file.metadata.title !== undefined && file.metadata.version !== undefined) return true;
|
|
110
110
|
return false;
|
|
111
111
|
};
|
|
112
|
+
/**
|
|
113
|
+
* Whether the file is client-side encrypted
|
|
114
|
+
*
|
|
115
|
+
* @param {IOCozyFile} file - io.cozy.files document
|
|
116
|
+
* @returns {boolean}
|
|
117
|
+
*/
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
exports.isNote = isNote;
|
|
121
|
+
|
|
122
|
+
var isEncrypted = function isEncrypted(file) {
|
|
123
|
+
return !!file.encrypted;
|
|
124
|
+
};
|
|
112
125
|
/**
|
|
113
126
|
* Whether the file is supported by Only Office
|
|
114
127
|
*
|
|
@@ -117,7 +130,7 @@ var isNote = function isNote(file) {
|
|
|
117
130
|
*/
|
|
118
131
|
|
|
119
132
|
|
|
120
|
-
exports.
|
|
133
|
+
exports.isEncrypted = isEncrypted;
|
|
121
134
|
|
|
122
135
|
var isOnlyOfficeFile = function isOnlyOfficeFile(file) {
|
|
123
136
|
return isFile(file) && !isNote(file) && (file.class === 'text' || file.class === 'spreadsheet' || file.class === 'slide');
|
package/dist/models/file.spec.js
CHANGED
|
@@ -231,6 +231,18 @@ describe('File Model', () => {
|
|
|
231
231
|
})
|
|
232
232
|
})
|
|
233
233
|
|
|
234
|
+
describe('encryption', () => {
|
|
235
|
+
it('should return when a file is encrypted or not', () => {
|
|
236
|
+
const encryptedFile = {
|
|
237
|
+
name: 'encryptedfile.txt',
|
|
238
|
+
encrypted: true
|
|
239
|
+
}
|
|
240
|
+
const plaintextFile = { name: 'plaintext.txt', mime: 'text' }
|
|
241
|
+
expect(fileModel.isEncrypted(encryptedFile)).toBe(true)
|
|
242
|
+
expect(fileModel.isEncrypted(plaintextFile)).toBe(false)
|
|
243
|
+
})
|
|
244
|
+
})
|
|
245
|
+
|
|
234
246
|
describe('splitFilename', () => {
|
|
235
247
|
it.each`
|
|
236
248
|
opts | result
|
package/dist/types.js
CHANGED
|
@@ -165,8 +165,11 @@ var _dsl = require("./queries/dsl");
|
|
|
165
165
|
* @property {FilesDoctype} _type - Doctype of the file
|
|
166
166
|
* @property {string} name - Name of the file
|
|
167
167
|
* @property {object} metadata - Metadata of the file
|
|
168
|
-
* @property {
|
|
169
|
-
* @property {
|
|
168
|
+
* @property {string} type - Type of the file
|
|
169
|
+
* @property {string} class - Class of the file
|
|
170
|
+
* @property {string} mime - Mime of the file
|
|
171
|
+
* @property {boolean} executable - Whether or not the file is executable
|
|
172
|
+
* @property {boolean} encrypted - Whether or not the file is client-side encrypted
|
|
170
173
|
* @typedef {CozyClientDocument & FileDocument} IOCozyFile - An io.cozy.files document
|
|
171
174
|
*/
|
|
172
175
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-client",
|
|
3
|
-
"version": "28.
|
|
3
|
+
"version": "28.2.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.node.js",
|
|
6
6
|
"browser": "dist/index.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"@types/jest": "^26.0.20",
|
|
19
19
|
"@types/lodash": "^4.14.170",
|
|
20
20
|
"btoa": "^1.2.1",
|
|
21
|
-
"cozy-stack-client": "^28.
|
|
21
|
+
"cozy-stack-client": "^28.2.1",
|
|
22
22
|
"json-stable-stringify": "^1.0.1",
|
|
23
23
|
"lodash": "^4.17.13",
|
|
24
24
|
"microee": "^0.0.6",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@testing-library/react-hooks": "3.7.0",
|
|
48
48
|
"babel-plugin-search-and-replace": "1.1.0",
|
|
49
49
|
"btoa": "1.2.1",
|
|
50
|
-
"cozy-device-helper": "
|
|
50
|
+
"cozy-device-helper": "1.12.0",
|
|
51
51
|
"cozy-flags": "2.8.6",
|
|
52
52
|
"cozy-logger": "1.7.0",
|
|
53
53
|
"cozy-ui": "48.0.0",
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"react-native-ios11-devicecheck": "https://github.com/cozy/react-native-devicecheck#app-attest-v0.1"
|
|
74
74
|
},
|
|
75
75
|
"sideEffects": false,
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "a333422df52b6b76ee8a0c096ee35609466276a6"
|
|
77
77
|
}
|
package/types/models/file.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ export function splitFilename(file: IOCozyFile): object;
|
|
|
29
29
|
export function isFile(file: IOCozyFile): boolean;
|
|
30
30
|
export function isDirectory(file: IOCozyFile): boolean;
|
|
31
31
|
export function isNote(file: IOCozyFile): boolean;
|
|
32
|
+
export function isEncrypted(file: IOCozyFile): boolean;
|
|
32
33
|
export function isOnlyOfficeFile(file: IOCozyFile): boolean;
|
|
33
34
|
export function shouldBeOpenedByOnlyOffice(file: IOCozyFile): boolean;
|
|
34
35
|
export function isShortcut(file: IOCozyFile): boolean;
|
package/types/types.d.ts
CHANGED
|
@@ -187,11 +187,23 @@ export type FileDocument = {
|
|
|
187
187
|
/**
|
|
188
188
|
* - Type of the file
|
|
189
189
|
*/
|
|
190
|
-
type:
|
|
190
|
+
type: string;
|
|
191
191
|
/**
|
|
192
192
|
* - Class of the file
|
|
193
193
|
*/
|
|
194
|
-
class:
|
|
194
|
+
class: string;
|
|
195
|
+
/**
|
|
196
|
+
* - Mime of the file
|
|
197
|
+
*/
|
|
198
|
+
mime: string;
|
|
199
|
+
/**
|
|
200
|
+
* - Whether or not the file is executable
|
|
201
|
+
*/
|
|
202
|
+
executable: boolean;
|
|
203
|
+
/**
|
|
204
|
+
* - Whether or not the file is client-side encrypted
|
|
205
|
+
*/
|
|
206
|
+
encrypted: boolean;
|
|
195
207
|
};
|
|
196
208
|
/**
|
|
197
209
|
* - An io.cozy.files document
|