cozy-harvest-lib 22.5.4 → 22.5.6
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/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,28 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [22.5.6](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@22.5.5...cozy-harvest-lib@22.5.6) (2024-03-26)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* Use the right index ([74f6a26](https://github.com/cozy/cozy-libs/commit/74f6a2600a8684bc05af1710e26acbdc1554bd78))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [22.5.5](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@22.5.4...cozy-harvest-lib@22.5.5) (2024-03-26)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* We should request the files for the right slug and account ([5a1d5f6](https://github.com/cozy/cozy-libs/commit/5a1d5f619686fbcdd41d171e75ea215895fedda4))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
## [22.5.4](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@22.5.3...cozy-harvest-lib@22.5.4) (2024-03-25)
|
|
7
29
|
|
|
8
30
|
**Note:** Version bump only for package cozy-harvest-lib
|
|
@@ -157,7 +157,7 @@ var FileDataCard = function FileDataCard(_ref5) {
|
|
|
157
157
|
accountId = _ref5.accountId,
|
|
158
158
|
sourceAccountIdentifier = _ref5.sourceAccountIdentifier;
|
|
159
159
|
|
|
160
|
-
var _useDataCardFiles = useDataCardFiles(sourceAccountIdentifier, trigger.message.folder_to_save),
|
|
160
|
+
var _useDataCardFiles = useDataCardFiles(sourceAccountIdentifier, trigger.message.folder_to_save, konnector.slug),
|
|
161
161
|
data = _useDataCardFiles.data,
|
|
162
162
|
fetchStatus = _useDataCardFiles.fetchStatus;
|
|
163
163
|
|
|
@@ -19,16 +19,21 @@ var useFolderToSaveFiles = function useFolderToSaveFiles(folderToSaveId) {
|
|
|
19
19
|
});
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
var useSourceAccountIdentifierFiles = function useSourceAccountIdentifierFiles(sourceAccountIdentifier) {
|
|
22
|
+
var useSourceAccountIdentifierFiles = function useSourceAccountIdentifierFiles(sourceAccountIdentifier, slug) {
|
|
23
23
|
return useQuery(Q('io.cozy.files').where({
|
|
24
24
|
'cozyMetadata.sourceAccountIdentifier': sourceAccountIdentifier,
|
|
25
|
-
trashed: false
|
|
26
|
-
|
|
25
|
+
trashed: false,
|
|
26
|
+
'cozyMetadata.createdByApp': slug
|
|
27
|
+
}).indexFields(['cozyMetadata.sourceAccountIdentifier', 'cozyMetadata.createdByApp', 'cozyMetadata.createdAt', 'trashed']).sortBy([{
|
|
27
28
|
'cozyMetadata.sourceAccountIdentifier': 'desc'
|
|
28
29
|
}, {
|
|
29
30
|
'cozyMetadata.createdAt': 'desc'
|
|
31
|
+
}, {
|
|
32
|
+
'cozyMetadata.createdByApp': 'desc'
|
|
33
|
+
}, {
|
|
34
|
+
trashed: 'desc'
|
|
30
35
|
}]).limitBy(5), {
|
|
31
|
-
as: "fileDataCard_io.cozy.files/sourceAccountIdentifier/".concat(sourceAccountIdentifier),
|
|
36
|
+
as: "fileDataCard_io.cozy.files/sourceAccountIdentifier/".concat(sourceAccountIdentifier, "/").concat(slug),
|
|
32
37
|
fetchPolicy: CozyClient.fetchPolicies.olderThan(30 * 1000)
|
|
33
38
|
});
|
|
34
39
|
};
|
|
@@ -54,10 +59,10 @@ var getResponse = function getResponse(folderToSaveFiles, sourceAccountIdentifie
|
|
|
54
59
|
};
|
|
55
60
|
};
|
|
56
61
|
|
|
57
|
-
export var useDataCardFiles = function useDataCardFiles(sourceAccountIdentifier, folderToSaveId) {
|
|
62
|
+
export var useDataCardFiles = function useDataCardFiles(sourceAccountIdentifier, folderToSaveId, slug) {
|
|
58
63
|
if (!sourceAccountIdentifier || !folderToSaveId) throw new Error('Missing arguments in useDataCardFiles, cannot fetch files');
|
|
59
64
|
var folderToSaveFiles = useFolderToSaveFiles(folderToSaveId);
|
|
60
|
-
var sourceAccountIdentifierFiles = useSourceAccountIdentifierFiles(sourceAccountIdentifier);
|
|
65
|
+
var sourceAccountIdentifierFiles = useSourceAccountIdentifierFiles(sourceAccountIdentifier, slug);
|
|
61
66
|
return useMemo(function () {
|
|
62
67
|
return getResponse(folderToSaveFiles, sourceAccountIdentifierFiles);
|
|
63
68
|
}, [folderToSaveFiles, sourceAccountIdentifierFiles]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-harvest-lib",
|
|
3
|
-
"version": "22.5.
|
|
3
|
+
"version": "22.5.6",
|
|
4
4
|
"description": "Provides logic, modules and components for Cozy's harvest applications.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"author": "Cozy",
|
|
@@ -107,5 +107,5 @@
|
|
|
107
107
|
"react-router-dom": ">=4.3.1"
|
|
108
108
|
},
|
|
109
109
|
"sideEffects": false,
|
|
110
|
-
"gitHead": "
|
|
110
|
+
"gitHead": "b5c0c718917fdd4197ef3c5c37729091a423b28e"
|
|
111
111
|
}
|
|
@@ -156,7 +156,8 @@ const FileDataCard = ({
|
|
|
156
156
|
}) => {
|
|
157
157
|
const { data, fetchStatus } = useDataCardFiles(
|
|
158
158
|
sourceAccountIdentifier,
|
|
159
|
-
trigger.message.folder_to_save
|
|
159
|
+
trigger.message.folder_to_save,
|
|
160
|
+
konnector.slug
|
|
160
161
|
)
|
|
161
162
|
const isLoading = fetchStatus === 'loading'
|
|
162
163
|
const noFiles = fetchStatus === 'empty' || fetchStatus === 'failed'
|
|
@@ -21,24 +21,29 @@ const useFolderToSaveFiles = folderToSaveId =>
|
|
|
21
21
|
}
|
|
22
22
|
)
|
|
23
23
|
|
|
24
|
-
const useSourceAccountIdentifierFiles = sourceAccountIdentifier =>
|
|
24
|
+
const useSourceAccountIdentifierFiles = (sourceAccountIdentifier, slug) =>
|
|
25
25
|
useQuery(
|
|
26
26
|
Q('io.cozy.files')
|
|
27
27
|
.where({
|
|
28
28
|
'cozyMetadata.sourceAccountIdentifier': sourceAccountIdentifier,
|
|
29
|
-
trashed: false
|
|
29
|
+
trashed: false,
|
|
30
|
+
'cozyMetadata.createdByApp': slug
|
|
30
31
|
})
|
|
31
32
|
.indexFields([
|
|
32
33
|
'cozyMetadata.sourceAccountIdentifier',
|
|
33
|
-
'cozyMetadata.
|
|
34
|
+
'cozyMetadata.createdByApp',
|
|
35
|
+
'cozyMetadata.createdAt',
|
|
36
|
+
'trashed'
|
|
34
37
|
])
|
|
35
38
|
.sortBy([
|
|
36
39
|
{ 'cozyMetadata.sourceAccountIdentifier': 'desc' },
|
|
37
|
-
{ 'cozyMetadata.createdAt': 'desc' }
|
|
40
|
+
{ 'cozyMetadata.createdAt': 'desc' },
|
|
41
|
+
{ 'cozyMetadata.createdByApp': 'desc' },
|
|
42
|
+
{ trashed: 'desc' }
|
|
38
43
|
])
|
|
39
44
|
.limitBy(5),
|
|
40
45
|
{
|
|
41
|
-
as: `fileDataCard_io.cozy.files/sourceAccountIdentifier/${sourceAccountIdentifier}`,
|
|
46
|
+
as: `fileDataCard_io.cozy.files/sourceAccountIdentifier/${sourceAccountIdentifier}/${slug}`,
|
|
42
47
|
fetchPolicy: CozyClient.fetchPolicies.olderThan(30 * 1000)
|
|
43
48
|
}
|
|
44
49
|
)
|
|
@@ -79,13 +84,18 @@ const getResponse = (folderToSaveFiles, sourceAccountIdentifierFiles) => {
|
|
|
79
84
|
return { fetchStatus: 'loading' }
|
|
80
85
|
}
|
|
81
86
|
|
|
82
|
-
export const useDataCardFiles = (
|
|
87
|
+
export const useDataCardFiles = (
|
|
88
|
+
sourceAccountIdentifier,
|
|
89
|
+
folderToSaveId,
|
|
90
|
+
slug
|
|
91
|
+
) => {
|
|
83
92
|
if (!sourceAccountIdentifier || !folderToSaveId)
|
|
84
93
|
throw new Error('Missing arguments in useDataCardFiles, cannot fetch files')
|
|
85
94
|
|
|
86
95
|
const folderToSaveFiles = useFolderToSaveFiles(folderToSaveId)
|
|
87
96
|
const sourceAccountIdentifierFiles = useSourceAccountIdentifierFiles(
|
|
88
|
-
sourceAccountIdentifier
|
|
97
|
+
sourceAccountIdentifier,
|
|
98
|
+
slug
|
|
89
99
|
)
|
|
90
100
|
|
|
91
101
|
return useMemo(
|