cozy-client 34.2.0 → 34.4.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.
- package/dist/CozyClient.js +1 -1
- package/dist/index.node.js +11 -2
- package/dist/models/index.js +5 -1
- package/dist/models/paper.js +229 -0
- package/dist/models/paper.spec.js +73 -0
- package/dist/types.js +10 -0
- package/package.json +3 -3
- package/types/index.node.d.ts +1 -0
- package/types/models/index.d.ts +2 -1
- package/types/models/paper.d.ts +7 -0
- package/types/types.d.ts +31 -6
package/dist/CozyClient.js
CHANGED
|
@@ -2644,7 +2644,7 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
2644
2644
|
CozyClient.hooks = CozyClient.hooks || {};
|
|
2645
2645
|
CozyClient.fetchPolicies = _policies.default; //COZY_CLIENT_VERSION_PACKAGE in replaced by babel. See babel config
|
|
2646
2646
|
|
|
2647
|
-
CozyClient.version = "34.
|
|
2647
|
+
CozyClient.version = "34.4.0";
|
|
2648
2648
|
|
|
2649
2649
|
_microee.default.mixin(CozyClient);
|
|
2650
2650
|
|
package/dist/index.node.js
CHANGED
|
@@ -33,7 +33,8 @@ var _exportNames = {
|
|
|
33
33
|
Registry: true,
|
|
34
34
|
manifest: true,
|
|
35
35
|
BulkEditError: true,
|
|
36
|
-
models: true
|
|
36
|
+
models: true,
|
|
37
|
+
fetchPolicies: true
|
|
37
38
|
};
|
|
38
39
|
Object.defineProperty(exports, "default", {
|
|
39
40
|
enumerable: true,
|
|
@@ -185,6 +186,12 @@ Object.defineProperty(exports, "BulkEditError", {
|
|
|
185
186
|
return _errors.BulkEditError;
|
|
186
187
|
}
|
|
187
188
|
});
|
|
189
|
+
Object.defineProperty(exports, "fetchPolicies", {
|
|
190
|
+
enumerable: true,
|
|
191
|
+
get: function get() {
|
|
192
|
+
return _policies.default;
|
|
193
|
+
}
|
|
194
|
+
});
|
|
188
195
|
exports.models = exports.manifest = void 0;
|
|
189
196
|
|
|
190
197
|
var _CozyClient = _interopRequireDefault(require("./CozyClient"));
|
|
@@ -243,4 +250,6 @@ Object.keys(_cli).forEach(function (key) {
|
|
|
243
250
|
|
|
244
251
|
var models = _interopRequireWildcard(require("./models"));
|
|
245
252
|
|
|
246
|
-
exports.models = models;
|
|
253
|
+
exports.models = models;
|
|
254
|
+
|
|
255
|
+
var _policies = _interopRequireDefault(require("./policies"));
|
package/dist/models/index.js
CHANGED
|
@@ -5,7 +5,7 @@ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWild
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.doctypes = exports.dacc = exports.sharing = exports.timeseries = exports.document = exports.contact = exports.utils = exports.permission = exports.note = exports.account = exports.folder = exports.file = exports.applications = exports.instance = exports.trigger = exports.accounts = exports.triggers = void 0;
|
|
8
|
+
exports.paper = exports.doctypes = exports.dacc = exports.sharing = exports.timeseries = exports.document = exports.contact = exports.utils = exports.permission = exports.note = exports.account = exports.folder = exports.file = exports.applications = exports.instance = exports.trigger = exports.accounts = exports.triggers = void 0;
|
|
9
9
|
|
|
10
10
|
var trigger = _interopRequireWildcard(require("./trigger"));
|
|
11
11
|
|
|
@@ -66,6 +66,10 @@ exports.dacc = dacc;
|
|
|
66
66
|
var doctypes = _interopRequireWildcard(require("./doctypes"));
|
|
67
67
|
|
|
68
68
|
exports.doctypes = doctypes;
|
|
69
|
+
|
|
70
|
+
var paper = _interopRequireWildcard(require("./paper"));
|
|
71
|
+
|
|
72
|
+
exports.paper = paper;
|
|
69
73
|
// For backward compatibility before 9.0.0
|
|
70
74
|
var triggers = trigger;
|
|
71
75
|
exports.triggers = triggers;
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.isExpiringSoon = exports.isExpired = exports.computeExpirationNoticeLink = exports.computeExpirationNoticeDate = exports.computeExpirationDate = exports.isExpiring = void 0;
|
|
9
|
+
|
|
10
|
+
var _add = _interopRequireDefault(require("date-fns/add"));
|
|
11
|
+
|
|
12
|
+
var _sub = _interopRequireDefault(require("date-fns/sub"));
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @typedef {import("../types").IOCozyFile} IOCozyFile
|
|
16
|
+
*/
|
|
17
|
+
var PERSONAL_SPORTING_LICENCE_PERIOD_DAYS = 365;
|
|
18
|
+
var PERSONAL_SPORTING_LICENCE_NOTICE_PERIOD_DAYS = 15;
|
|
19
|
+
/**
|
|
20
|
+
* @param {IOCozyFile} file - io.cozy.files document
|
|
21
|
+
* @returns {boolean}
|
|
22
|
+
* @description Tells if a given file is a national id card, is French, has an expiration date set and has a notice period set
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
var isExpiringFrenchNationalIdCard = function isExpiringFrenchNationalIdCard(file) {
|
|
26
|
+
var _file$metadata, _file$metadata$qualif, _file$metadata2, _file$metadata3, _file$metadata4;
|
|
27
|
+
|
|
28
|
+
var label = (_file$metadata = file.metadata) === null || _file$metadata === void 0 ? void 0 : (_file$metadata$qualif = _file$metadata.qualification) === null || _file$metadata$qualif === void 0 ? void 0 : _file$metadata$qualif.label;
|
|
29
|
+
var country = (_file$metadata2 = file.metadata) === null || _file$metadata2 === void 0 ? void 0 : _file$metadata2.country;
|
|
30
|
+
var expirationDate = (_file$metadata3 = file.metadata) === null || _file$metadata3 === void 0 ? void 0 : _file$metadata3.expirationDate;
|
|
31
|
+
var noticePeriod = (_file$metadata4 = file.metadata) === null || _file$metadata4 === void 0 ? void 0 : _file$metadata4.noticePeriod;
|
|
32
|
+
|
|
33
|
+
if (label === 'national_id_card' && (!country || country === 'fr') && expirationDate && noticePeriod) {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return false;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* @param {IOCozyFile} file - io.cozy.files document
|
|
41
|
+
* @returns {boolean}
|
|
42
|
+
* @description Tells if a given file is a residence permit, has an expiration date set and a notice period set
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
var isExpiringResidencePermit = function isExpiringResidencePermit(file) {
|
|
47
|
+
var _file$metadata5, _file$metadata5$quali, _file$metadata6, _file$metadata7;
|
|
48
|
+
|
|
49
|
+
var label = (_file$metadata5 = file.metadata) === null || _file$metadata5 === void 0 ? void 0 : (_file$metadata5$quali = _file$metadata5.qualification) === null || _file$metadata5$quali === void 0 ? void 0 : _file$metadata5$quali.label;
|
|
50
|
+
var expirationDate = (_file$metadata6 = file.metadata) === null || _file$metadata6 === void 0 ? void 0 : _file$metadata6.expirationDate;
|
|
51
|
+
var noticePeriod = (_file$metadata7 = file.metadata) === null || _file$metadata7 === void 0 ? void 0 : _file$metadata7.noticePeriod;
|
|
52
|
+
|
|
53
|
+
if (label === 'residence_permit' && expirationDate && noticePeriod) {
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return false;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* @param {IOCozyFile} file - io.cozy.files document
|
|
61
|
+
* @returns {boolean}
|
|
62
|
+
* @description Tells if a given file is a sporting license, has a reference date set or a creation date if not
|
|
63
|
+
*/
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
var isExpiringPersonalSportingLicense = function isExpiringPersonalSportingLicense(file) {
|
|
67
|
+
var _file$metadata8, _file$metadata8$quali, _file$metadata9;
|
|
68
|
+
|
|
69
|
+
var label = (_file$metadata8 = file.metadata) === null || _file$metadata8 === void 0 ? void 0 : (_file$metadata8$quali = _file$metadata8.qualification) === null || _file$metadata8$quali === void 0 ? void 0 : _file$metadata8$quali.label;
|
|
70
|
+
var referencedDate = (_file$metadata9 = file.metadata) === null || _file$metadata9 === void 0 ? void 0 : _file$metadata9.referencedDate;
|
|
71
|
+
var created_at = file.created_at;
|
|
72
|
+
|
|
73
|
+
if (label === 'personal_sporting_licence' && (referencedDate || created_at)) {
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return false;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* @param {IOCozyFile} file - io.cozy.files document
|
|
81
|
+
* @returns {boolean}
|
|
82
|
+
* @description Tells if a given file matches one of the known types of expiring papers
|
|
83
|
+
*/
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
var isExpiring = function isExpiring(file) {
|
|
87
|
+
if (isExpiringFrenchNationalIdCard(file)) {
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (isExpiringResidencePermit(file)) {
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (isExpiringPersonalSportingLicense(file)) {
|
|
96
|
+
return true;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return false;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* @param {IOCozyFile} file - io.cozy.files document
|
|
103
|
+
* @returns {Date | null} Expiration date
|
|
104
|
+
* @description Computes et returns the expiration date of the given file, or null if it is not expiring
|
|
105
|
+
*/
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
exports.isExpiring = isExpiring;
|
|
109
|
+
|
|
110
|
+
var computeExpirationDate = function computeExpirationDate(file) {
|
|
111
|
+
if (isExpiringFrenchNationalIdCard(file) || isExpiringResidencePermit(file)) {
|
|
112
|
+
var _file$metadata10;
|
|
113
|
+
|
|
114
|
+
var expirationDate = (_file$metadata10 = file.metadata) === null || _file$metadata10 === void 0 ? void 0 : _file$metadata10.expirationDate;
|
|
115
|
+
return new Date(expirationDate);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (isExpiringPersonalSportingLicense(file)) {
|
|
119
|
+
var _file$metadata11;
|
|
120
|
+
|
|
121
|
+
var referencedDate = (_file$metadata11 = file.metadata) === null || _file$metadata11 === void 0 ? void 0 : _file$metadata11.referencedDate;
|
|
122
|
+
var created_at = file.created_at;
|
|
123
|
+
return (0, _add.default)(new Date(referencedDate !== null && referencedDate !== void 0 ? referencedDate : created_at), {
|
|
124
|
+
days: PERSONAL_SPORTING_LICENCE_PERIOD_DAYS
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return null;
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* @param {IOCozyFile} file - io.cozy.files document
|
|
132
|
+
* @returns {number | null} Expiration notice period in days
|
|
133
|
+
* @description Computes et returns the expiration notice period of the given file, or null if it is not expiring
|
|
134
|
+
*/
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
exports.computeExpirationDate = computeExpirationDate;
|
|
138
|
+
|
|
139
|
+
var computeExpirationNoticePeriodInDays = function computeExpirationNoticePeriodInDays(file) {
|
|
140
|
+
if (isExpiringFrenchNationalIdCard(file) || isExpiringResidencePermit(file)) {
|
|
141
|
+
var _file$metadata12;
|
|
142
|
+
|
|
143
|
+
var noticePeriodInDays = (_file$metadata12 = file.metadata) === null || _file$metadata12 === void 0 ? void 0 : _file$metadata12.noticePeriod;
|
|
144
|
+
return parseInt(noticePeriodInDays, 10);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (isExpiringPersonalSportingLicense(file)) {
|
|
148
|
+
return PERSONAL_SPORTING_LICENCE_NOTICE_PERIOD_DAYS;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return null;
|
|
152
|
+
};
|
|
153
|
+
/**
|
|
154
|
+
* @param {IOCozyFile} file - io.cozy.files document
|
|
155
|
+
* @returns {Date | null} Expiration notice date
|
|
156
|
+
* @description Computes et returns the expiration notice date of the given file, or null if it is not expiring
|
|
157
|
+
*/
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
var computeExpirationNoticeDate = function computeExpirationNoticeDate(file) {
|
|
161
|
+
var expirationDate = computeExpirationDate(file);
|
|
162
|
+
|
|
163
|
+
if (expirationDate == null) {
|
|
164
|
+
return null;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
var noticePeriodInDays = computeExpirationNoticePeriodInDays(file);
|
|
168
|
+
|
|
169
|
+
if (noticePeriodInDays == null) {
|
|
170
|
+
return null;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return (0, _sub.default)(expirationDate, {
|
|
174
|
+
days: noticePeriodInDays
|
|
175
|
+
});
|
|
176
|
+
};
|
|
177
|
+
/**
|
|
178
|
+
* @param {IOCozyFile} file - io.cozy.files document
|
|
179
|
+
* @returns {string | null} Expiration notice link
|
|
180
|
+
* @description Computes et returns the expiration notice link of the given file, or null if it has none or it is not expiring
|
|
181
|
+
*/
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
exports.computeExpirationNoticeDate = computeExpirationNoticeDate;
|
|
185
|
+
|
|
186
|
+
var computeExpirationNoticeLink = function computeExpirationNoticeLink(file) {
|
|
187
|
+
if (isExpiringFrenchNationalIdCard(file)) {
|
|
188
|
+
return 'https://www.service-public.fr/particuliers/vosdroits/N358';
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
if (isExpiringResidencePermit(file)) {
|
|
192
|
+
return 'https://www.service-public.fr/particuliers/vosdroits/N110';
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return null;
|
|
196
|
+
};
|
|
197
|
+
/**
|
|
198
|
+
* @param {IOCozyFile} file - io.cozy.files document
|
|
199
|
+
* @returns {boolean}
|
|
200
|
+
* @description Tells if the given file is expiring and if today is after its expiration date
|
|
201
|
+
*/
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
exports.computeExpirationNoticeLink = computeExpirationNoticeLink;
|
|
205
|
+
|
|
206
|
+
var isExpired = function isExpired(file) {
|
|
207
|
+
var now = new Date();
|
|
208
|
+
var expirationDate = computeExpirationDate(file);
|
|
209
|
+
var isExpired = expirationDate != null && expirationDate <= now;
|
|
210
|
+
return isExpired;
|
|
211
|
+
};
|
|
212
|
+
/**
|
|
213
|
+
* @param {IOCozyFile} file - io.cozy.files document
|
|
214
|
+
* @returns {boolean}
|
|
215
|
+
* @description Tells if the given file is expiring and if today is between its expiration notice date and its expiration date
|
|
216
|
+
*/
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
exports.isExpired = isExpired;
|
|
220
|
+
|
|
221
|
+
var isExpiringSoon = function isExpiringSoon(file) {
|
|
222
|
+
var now = new Date();
|
|
223
|
+
var expirationDate = computeExpirationDate(file);
|
|
224
|
+
var expirationNoticeDate = computeExpirationNoticeDate(file);
|
|
225
|
+
var isExpiringSoon = expirationDate != null && expirationNoticeDate != null && expirationNoticeDate <= now && now < expirationDate;
|
|
226
|
+
return isExpiringSoon;
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
exports.isExpiringSoon = isExpiringSoon;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import MockDate from 'mockdate'
|
|
2
|
+
|
|
3
|
+
import * as paperModel from './paper'
|
|
4
|
+
|
|
5
|
+
describe('Expiration', () => {
|
|
6
|
+
beforeEach(() => {
|
|
7
|
+
MockDate.set('2022-11-01T11:35:58.118Z')
|
|
8
|
+
})
|
|
9
|
+
afterEach(() => {
|
|
10
|
+
MockDate.reset()
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
const fakeFile01 = {
|
|
14
|
+
_id: '01',
|
|
15
|
+
name: 'national id card',
|
|
16
|
+
created_at: '2022-09-01T00:00:00.000Z',
|
|
17
|
+
metadata: {
|
|
18
|
+
qualification: { label: 'national_id_card' },
|
|
19
|
+
expirationDate: '2022-09-23T11:35:58.118Z',
|
|
20
|
+
noticePeriod: '90'
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const fakeFile02 = {
|
|
24
|
+
_id: '02',
|
|
25
|
+
name: 'personal sporting licence',
|
|
26
|
+
created_at: '2022-09-01T00:00:00.000Z',
|
|
27
|
+
metadata: {
|
|
28
|
+
qualification: { label: 'personal_sporting_licence' },
|
|
29
|
+
referencedDate: '2022-09-23T11:35:58.118Z'
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const fakeFile03 = {
|
|
33
|
+
_id: '03',
|
|
34
|
+
name: 'unknown'
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
describe('computeExpirationDate', () => {
|
|
38
|
+
it('should return expirationDate', () => {
|
|
39
|
+
const res = paperModel.computeExpirationDate(fakeFile01)
|
|
40
|
+
|
|
41
|
+
expect(res.toISOString()).toBe('2022-09-23T11:35:58.118Z')
|
|
42
|
+
})
|
|
43
|
+
it('should return referencedDate plus 365 days', () => {
|
|
44
|
+
const res = paperModel.computeExpirationDate(fakeFile02)
|
|
45
|
+
|
|
46
|
+
expect(res.toISOString()).toBe('2023-09-23T11:35:58.118Z')
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
it('should return "null" if metadata is not found', () => {
|
|
50
|
+
const res = paperModel.computeExpirationDate(fakeFile03)
|
|
51
|
+
|
|
52
|
+
expect(res).toBeNull()
|
|
53
|
+
})
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
describe('computeExpirationNoticeDate', () => {
|
|
57
|
+
it('should return notice date for file with expirationDate metadata', () => {
|
|
58
|
+
const res = paperModel.computeExpirationNoticeDate(fakeFile01)
|
|
59
|
+
|
|
60
|
+
expect(res.toISOString()).toBe('2022-06-25T11:35:58.118Z')
|
|
61
|
+
})
|
|
62
|
+
it('should return notice date for file with referencedDate metadata', () => {
|
|
63
|
+
const res = paperModel.computeExpirationNoticeDate(fakeFile02)
|
|
64
|
+
|
|
65
|
+
expect(res.toISOString()).toBe('2023-09-08T11:35:58.118Z')
|
|
66
|
+
})
|
|
67
|
+
it('should return null for file without corresponding metadata', () => {
|
|
68
|
+
const res = paperModel.computeExpirationNoticeDate(fakeFile03)
|
|
69
|
+
|
|
70
|
+
expect(res).toBeNull()
|
|
71
|
+
})
|
|
72
|
+
})
|
|
73
|
+
})
|
package/dist/types.js
CHANGED
|
@@ -7,6 +7,10 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _dsl = require("./queries/dsl");
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* @typedef {import("./models/document/qualification").Qualification} Qualification
|
|
12
|
+
*/
|
|
13
|
+
|
|
10
14
|
/**
|
|
11
15
|
* @typedef {"io.cozy.accounts"} AccountsDoctype
|
|
12
16
|
* @typedef {"io.cozy.triggers"} TriggersDoctype
|
|
@@ -177,6 +181,11 @@ var _dsl = require("./queries/dsl");
|
|
|
177
181
|
* @property {object} [schema] - the schema used by prosemirror (with notes and marks serialized as arrays to preserve the order).
|
|
178
182
|
* @property {string} [title] - the initial title of the note (that will also be used for the file name)
|
|
179
183
|
* @property {number} [version] - Number of a note
|
|
184
|
+
* @property {Qualification} [qualification] - Qualification of the file
|
|
185
|
+
* @property {string} [country] - Country of the paper
|
|
186
|
+
* @property {string} [expirationDate] - Expiration date of the paper
|
|
187
|
+
* @property {string} [referencedDate] - Reference date of the paper
|
|
188
|
+
* @property {string} [noticePeriod] - Notice period of the paper, in days
|
|
180
189
|
*/
|
|
181
190
|
|
|
182
191
|
/**
|
|
@@ -190,6 +199,7 @@ var _dsl = require("./queries/dsl");
|
|
|
190
199
|
* @property {string} mime - Mime of the file
|
|
191
200
|
* @property {boolean} executable - Whether or not the file is executable
|
|
192
201
|
* @property {boolean} encrypted - Whether or not the file is client-side encrypted
|
|
202
|
+
* @property {string} created_at - Creation date of the file
|
|
193
203
|
* @typedef {CozyClientDocument & FileDocument} IOCozyFile - An io.cozy.files document
|
|
194
204
|
*/
|
|
195
205
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-client",
|
|
3
|
-
"version": "34.
|
|
3
|
+
"version": "34.4.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.node.js",
|
|
6
6
|
"browser": "dist/index.js",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"@types/lodash": "^4.14.170",
|
|
20
20
|
"btoa": "^1.2.1",
|
|
21
21
|
"cozy-stack-client": "^34.1.5",
|
|
22
|
+
"date-fns": "2.29.3",
|
|
22
23
|
"json-stable-stringify": "^1.0.1",
|
|
23
24
|
"lodash": "^4.17.13",
|
|
24
25
|
"microee": "^0.0.6",
|
|
@@ -51,7 +52,6 @@
|
|
|
51
52
|
"cozy-flags": "2.10.2",
|
|
52
53
|
"cozy-logger": "1.7.0",
|
|
53
54
|
"cozy-ui": "48.0.0",
|
|
54
|
-
"date-fns": "2.27.0",
|
|
55
55
|
"jsdoc-plugin-intersection": "1.0.4",
|
|
56
56
|
"mockdate": "2.0.5",
|
|
57
57
|
"react": "16.14.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": "2810ff3f07087a335e8576aebd88f48594821e62"
|
|
77
77
|
}
|
package/types/index.node.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export { default as Registry } from "./registry";
|
|
|
8
8
|
export * from "./mock";
|
|
9
9
|
export * from "./cli";
|
|
10
10
|
export { BulkEditError } from "./errors";
|
|
11
|
+
export { default as fetchPolicies } from "./policies";
|
|
11
12
|
import * as manifest from "./manifest";
|
|
12
13
|
import * as models from "./models";
|
|
13
14
|
export { manifest, models };
|
package/types/models/index.d.ts
CHANGED
|
@@ -15,4 +15,5 @@ import * as timeseries from "./timeseries";
|
|
|
15
15
|
import * as sharing from "./sharing";
|
|
16
16
|
import * as dacc from "./dacc";
|
|
17
17
|
import * as doctypes from "./doctypes";
|
|
18
|
-
|
|
18
|
+
import * as paper from "./paper";
|
|
19
|
+
export { trigger, instance, applications, file, folder, note, account, permission, utils, contact, document, timeseries, sharing, dacc, doctypes, paper };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export function isExpiring(file: IOCozyFile): boolean;
|
|
2
|
+
export function computeExpirationDate(file: IOCozyFile): Date | null;
|
|
3
|
+
export function computeExpirationNoticeDate(file: IOCozyFile): Date | null;
|
|
4
|
+
export function computeExpirationNoticeLink(file: IOCozyFile): string | null;
|
|
5
|
+
export function isExpired(file: IOCozyFile): boolean;
|
|
6
|
+
export function isExpiringSoon(file: IOCozyFile): boolean;
|
|
7
|
+
export type IOCozyFile = import("../types").CozyClientDocument & import("../types").FileDocument;
|
package/types/types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
declare var _default: {};
|
|
2
2
|
export default _default;
|
|
3
|
+
export type Qualification = import("./models/document/qualification").Qualification;
|
|
3
4
|
export type AccountsDoctype = "io.cozy.accounts";
|
|
4
5
|
export type TriggersDoctype = "io.cozy.triggers";
|
|
5
6
|
export type KonnectorsDoctype = "io.cozy.konnectors";
|
|
@@ -194,6 +195,26 @@ export type FileMetadata = {
|
|
|
194
195
|
* - Number of a note
|
|
195
196
|
*/
|
|
196
197
|
version?: number;
|
|
198
|
+
/**
|
|
199
|
+
* - Qualification of the file
|
|
200
|
+
*/
|
|
201
|
+
qualification?: Qualification;
|
|
202
|
+
/**
|
|
203
|
+
* - Country of the paper
|
|
204
|
+
*/
|
|
205
|
+
country?: string;
|
|
206
|
+
/**
|
|
207
|
+
* - Expiration date of the paper
|
|
208
|
+
*/
|
|
209
|
+
expirationDate?: string;
|
|
210
|
+
/**
|
|
211
|
+
* - Reference date of the paper
|
|
212
|
+
*/
|
|
213
|
+
referencedDate?: string;
|
|
214
|
+
/**
|
|
215
|
+
* - Notice period of the paper, in days
|
|
216
|
+
*/
|
|
217
|
+
noticePeriod?: string;
|
|
197
218
|
};
|
|
198
219
|
/**
|
|
199
220
|
* - An io.cozy.files document
|
|
@@ -235,6 +256,10 @@ export type FileDocument = {
|
|
|
235
256
|
* - Whether or not the file is client-side encrypted
|
|
236
257
|
*/
|
|
237
258
|
encrypted: boolean;
|
|
259
|
+
/**
|
|
260
|
+
* - Creation date of the file
|
|
261
|
+
*/
|
|
262
|
+
created_at: string;
|
|
238
263
|
};
|
|
239
264
|
/**
|
|
240
265
|
* - An io.cozy.files document
|
|
@@ -370,7 +395,7 @@ export type Theme = {
|
|
|
370
395
|
defaultItems?: Array<string>;
|
|
371
396
|
};
|
|
372
397
|
export type ThemesList = Theme[];
|
|
373
|
-
export type ThemesLabels = "transport" | "identity" | "family" | "
|
|
398
|
+
export type ThemesLabels = "transport" | "identity" | "family" | "health" | "invoice" | "work_study" | "home" | "finance";
|
|
374
399
|
export type QualificationAttributes = {
|
|
375
400
|
label: string;
|
|
376
401
|
purpose?: string;
|
|
@@ -381,13 +406,13 @@ export type QualificationAttributes = {
|
|
|
381
406
|
export type IdentityLabel = "identity_photo" | "national_id_card" | "passport" | "residence_permit" | "family_record_book" | "birth_certificate" | "driver_license" | "other_identity_document" | "citizen_registration_certificate" | "personal_sporting_licence";
|
|
382
407
|
export type FamilyLabel = "family_record_book" | "birth_certificate" | "wedding" | "pacs" | "divorce" | "large_family_card" | "caf" | "other_family_document" | "payment_proof_family_allowance";
|
|
383
408
|
export type WorkStudyLabels = "resume" | "diploma" | "work_contract" | "pay_sheet" | "unemployment_benefit" | "pension" | "gradebook" | "student_card" | "motivation_letter" | "other_work_document" | "work_disability_recognition" | "school_attendance_certificate";
|
|
384
|
-
export type HealthLabels = "
|
|
385
|
-
export type HomeLabels = "
|
|
409
|
+
export type HealthLabels = "health_book" | "health_certificate" | "pregnancy_medical_certificate" | "work_disability_recognition" | "national_health_insurance_card" | "national_health_insurance_right_certificate" | "health_insurance_card" | "prescription" | "health_invoice" | "other_health_document";
|
|
410
|
+
export type HomeLabels = "house_sale_agreeement" | "building_permit" | "technical_diagnostic_record" | "lease" | "rent_receipt" | "house_insurance" | "work_quote" | "work_invoice" | "other_house_document" | "phone_invoice" | "isp_invoice" | "telecom_invoice" | "energy_invoice" | "water_invoice" | "other_invoice" | "unfit_for_habitation_declaration" | "accommodation_proof";
|
|
386
411
|
export type TransportLabels = "driver_license" | "vehicle_registration" | "car_insurance" | "mechanic_invoice" | "transport_invoice" | "other_transport_document";
|
|
387
|
-
export type FinanceLabels = "
|
|
388
|
-
export type InvoiceLabels = "health_invoice" | "
|
|
412
|
+
export type FinanceLabels = "pay_sheet" | "other_revenue" | "tax_return" | "tax_notice" | "tax_timetable" | "other_tax_document" | "bank_details" | "bank_statement" | "loan_agreement" | "other_bank_document" | "receipt" | "payment_proof_family_allowance";
|
|
413
|
+
export type InvoiceLabels = "health_invoice" | "transport_invoice" | "work_invoice" | "phone_invoice" | "isp_invoice" | "telecom_invoice" | "energy_invoice" | "water_invoice" | "appliance_invoice" | "web_service_invoice" | "restaurant_invoice" | "other_invoice";
|
|
389
414
|
export type ActivityLabels = "personal_sporting_licence" | "other_activity_document";
|
|
390
|
-
export type ItemsLabels = "resume" | "identity_photo" | "national_id_card" | "passport" | "residence_permit" | "family_record_book" | "birth_certificate" | "driver_license" | "other_identity_document" | "
|
|
415
|
+
export type ItemsLabels = "resume" | "identity_photo" | "national_id_card" | "passport" | "residence_permit" | "family_record_book" | "birth_certificate" | "driver_license" | "other_identity_document" | "wedding" | "pacs" | "divorce" | "large_family_card" | "caf" | "other_family_document" | "diploma" | "work_contract" | "pay_sheet" | "unemployment_benefit" | "pension" | "other_revenue" | "gradebook" | "student_card" | "motivation_letter" | "other_work_document" | "health_book" | "health_certificate" | "pregnancy_medical_certificate" | "work_disability_recognition" | "national_health_insurance_card" | "national_health_insurance_right_certificate" | "health_insurance_card" | "prescription" | "health_invoice" | "other_health_document" | "vehicle_registration" | "car_insurance" | "mechanic_invoice" | "transport_invoice" | "other_transport_document" | "house_sale_agreeement" | "building_permit" | "technical_diagnostic_record" | "lease" | "rent_receipt" | "house_insurance" | "work_quote" | "work_invoice" | "other_house_document" | "phone_invoice" | "isp_invoice" | "telecom_invoice" | "energy_invoice" | "water_invoice" | "appliance_invoice" | "web_service_invoice" | "restaurant_invoice" | "other_invoice" | "tax_return" | "tax_notice" | "tax_timetable" | "other_tax_document" | "bank_details" | "bank_statement" | "loan_agreement" | "other_bank_document" | "receipt" | "payment_proof_family_allowance" | "school_attendance_certificate" | "unfit_for_habitation_declaration" | "accommodation_proof" | "citizen_registration_certificate" | "personal_sporting_licence" | "other_activity_document";
|
|
391
416
|
/**
|
|
392
417
|
* See https://github.com/cozy/DACC
|
|
393
418
|
*/
|