cozy-client 35.2.2 → 35.3.1
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
CHANGED
|
@@ -2669,7 +2669,7 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
2669
2669
|
CozyClient.hooks = CozyClient.hooks || {};
|
|
2670
2670
|
CozyClient.fetchPolicies = _policies.default; //COZY_CLIENT_VERSION_PACKAGE in replaced by babel. See babel config
|
|
2671
2671
|
|
|
2672
|
-
CozyClient.version = "35.
|
|
2672
|
+
CozyClient.version = "35.3.1";
|
|
2673
2673
|
|
|
2674
2674
|
_microee.default.mixin(CozyClient);
|
|
2675
2675
|
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.default = void 0;
|
|
8
|
+
exports.default = exports.getFileDatetime = void 0;
|
|
9
9
|
|
|
10
10
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
11
|
|
|
@@ -72,6 +72,20 @@ var newCursor = function newCursor(_ref, startDocId) {
|
|
|
72
72
|
var cursorKey = lastDatetime ? [doctype, id, lastDatetime] : [doctype, id];
|
|
73
73
|
return [cursorKey, startDocId];
|
|
74
74
|
};
|
|
75
|
+
/**
|
|
76
|
+
* Get the file datetime
|
|
77
|
+
*
|
|
78
|
+
* @param {import('../types').IOCozyFile} file - io.cozy.files document
|
|
79
|
+
* @returns {string} The file datetime
|
|
80
|
+
*/
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
var getFileDatetime = function getFileDatetime(file) {
|
|
84
|
+
var _file$metadata;
|
|
85
|
+
|
|
86
|
+
// Some files do not have any metadata, e.g. bitmap files.
|
|
87
|
+
return ((_file$metadata = file.metadata) === null || _file$metadata === void 0 ? void 0 : _file$metadata.datetime) || file.created_at;
|
|
88
|
+
};
|
|
75
89
|
/**
|
|
76
90
|
* This class is only used for photos albums relationships.
|
|
77
91
|
* Behind the hood, the queries uses a view returning the files sorted
|
|
@@ -79,6 +93,8 @@ var newCursor = function newCursor(_ref, startDocId) {
|
|
|
79
93
|
*/
|
|
80
94
|
|
|
81
95
|
|
|
96
|
+
exports.getFileDatetime = getFileDatetime;
|
|
97
|
+
|
|
82
98
|
var HasManyFiles = /*#__PURE__*/function (_HasMany) {
|
|
83
99
|
(0, _inherits2.default)(HasManyFiles, _HasMany);
|
|
84
100
|
|
|
@@ -114,9 +130,8 @@ var HasManyFiles = /*#__PURE__*/function (_HasMany) {
|
|
|
114
130
|
while (1) {
|
|
115
131
|
switch (_context.prev = _context.next) {
|
|
116
132
|
case 0:
|
|
117
|
-
lastRelDoc = (0, _store.getDocumentFromState)(getState(), lastRelationship._type, lastRelationship._id);
|
|
118
|
-
|
|
119
|
-
lastDatetime = lastRelDoc.attributes.metadata.datetime; // cursor-based pagination
|
|
133
|
+
lastRelDoc = (0, _store.getDocumentFromState)(getState(), lastRelationship._type, lastRelationship._id);
|
|
134
|
+
lastDatetime = getFileDatetime(lastRelDoc.attributes); // cursor-based pagination
|
|
120
135
|
|
|
121
136
|
cursor = newCursor([_this.target._type, _this.target._id, lastDatetime], relationships[relationships.length - 1]._id);
|
|
122
137
|
_context.next = 5;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DOCTYPE_FILES } from '../const'
|
|
2
|
-
import HasManyFiles from './HasManyFiles'
|
|
2
|
+
import HasManyFiles, { getFileDatetime } from './HasManyFiles'
|
|
3
3
|
|
|
4
4
|
describe('HasManyFiles', () => {
|
|
5
5
|
let originalFile, hydratedFile, originalTodo, hydratedTodo, save, mutate
|
|
@@ -155,3 +155,21 @@ describe('HasManyFiles', () => {
|
|
|
155
155
|
expect(queryDef.ids).toEqual(['1234'])
|
|
156
156
|
})
|
|
157
157
|
})
|
|
158
|
+
|
|
159
|
+
describe('getFileDatetime', () => {
|
|
160
|
+
it('should get the metadata datetime when it exists', () => {
|
|
161
|
+
const file = {
|
|
162
|
+
created_at: '2023-01-01',
|
|
163
|
+
metadata: {
|
|
164
|
+
datetime: '2023-02-01'
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
expect(getFileDatetime(file)).toEqual('2023-02-01')
|
|
168
|
+
})
|
|
169
|
+
it('should get the created_at when there is no datetime metadata', () => {
|
|
170
|
+
const file = {
|
|
171
|
+
created_at: '2023-01-01'
|
|
172
|
+
}
|
|
173
|
+
expect(getFileDatetime(file)).toEqual('2023-01-01')
|
|
174
|
+
})
|
|
175
|
+
})
|
package/dist/types.js
CHANGED
|
@@ -246,6 +246,7 @@ var _dsl = require("./queries/dsl");
|
|
|
246
246
|
* @property {string} [expirationDate] - Expiration date of the paper
|
|
247
247
|
* @property {string} [referencedDate] - Reference date of the paper
|
|
248
248
|
* @property {string} [noticePeriod] - Notice period of the paper, in days
|
|
249
|
+
* @property {string} [datetime] - Image EXIF date, if relevant
|
|
249
250
|
*/
|
|
250
251
|
|
|
251
252
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-client",
|
|
3
|
-
"version": "35.
|
|
3
|
+
"version": "35.3.1",
|
|
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": "^35.
|
|
21
|
+
"cozy-stack-client": "^35.3.1",
|
|
22
22
|
"date-fns": "2.29.3",
|
|
23
23
|
"json-stable-stringify": "^1.0.1",
|
|
24
24
|
"lodash": "^4.17.13",
|
|
@@ -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": "f012154d497d376422bf050b2d091e379befdd37"
|
|
77
77
|
}
|
package/types/types.d.ts
CHANGED