cozy-client 40.2.1 → 40.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 +15 -5
- package/dist/CozyClient.spec.js +32 -12
- package/dist/models/paper.js +2 -1
- package/dist/models/paper.spec.js +6 -0
- package/package.json +2 -2
- package/types/CozyClient.d.ts +1 -1
package/dist/CozyClient.js
CHANGED
|
@@ -2426,7 +2426,7 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
2426
2426
|
/**
|
|
2427
2427
|
* loadInstanceOptionsFromStack - Loads the instance options from cozy-stack and exposes it through getInstanceOptions
|
|
2428
2428
|
*
|
|
2429
|
-
*
|
|
2429
|
+
* This method is not iso with loadInstanceOptionsFromDOM for now.
|
|
2430
2430
|
*
|
|
2431
2431
|
* @returns {Promise<void>}
|
|
2432
2432
|
*/
|
|
@@ -2435,7 +2435,9 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
2435
2435
|
key: "loadInstanceOptionsFromStack",
|
|
2436
2436
|
value: function () {
|
|
2437
2437
|
var _loadInstanceOptionsFromStack = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18() {
|
|
2438
|
-
var
|
|
2438
|
+
var _instanceData$attribu, _instanceData$attribu2;
|
|
2439
|
+
|
|
2440
|
+
var _yield$this$query, data, _yield$this$query2, instanceData;
|
|
2439
2441
|
|
|
2440
2442
|
return _regenerator.default.wrap(function _callee18$(_context18) {
|
|
2441
2443
|
while (1) {
|
|
@@ -2447,12 +2449,20 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
2447
2449
|
case 2:
|
|
2448
2450
|
_yield$this$query = _context18.sent;
|
|
2449
2451
|
data = _yield$this$query.data;
|
|
2452
|
+
_context18.next = 6;
|
|
2453
|
+
return this.query((0, _dsl.Q)('io.cozy.settings').getById('io.cozy.settings.instance'));
|
|
2454
|
+
|
|
2455
|
+
case 6:
|
|
2456
|
+
_yield$this$query2 = _context18.sent;
|
|
2457
|
+
instanceData = _yield$this$query2.data;
|
|
2450
2458
|
this.instanceOptions = {
|
|
2451
|
-
capabilities: data.attributes
|
|
2459
|
+
capabilities: data.attributes,
|
|
2460
|
+
locale: (_instanceData$attribu = instanceData.attributes) === null || _instanceData$attribu === void 0 ? void 0 : _instanceData$attribu.locale,
|
|
2461
|
+
tracking: (_instanceData$attribu2 = instanceData.attributes) === null || _instanceData$attribu2 === void 0 ? void 0 : _instanceData$attribu2.tracking
|
|
2452
2462
|
};
|
|
2453
2463
|
this.capabilities = this.instanceOptions.capabilities || null;
|
|
2454
2464
|
|
|
2455
|
-
case
|
|
2465
|
+
case 10:
|
|
2456
2466
|
case "end":
|
|
2457
2467
|
return _context18.stop();
|
|
2458
2468
|
}
|
|
@@ -2685,7 +2695,7 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
2685
2695
|
CozyClient.hooks = CozyClient.hooks || {};
|
|
2686
2696
|
CozyClient.fetchPolicies = _policies.default; //COZY_CLIENT_VERSION_PACKAGE in replaced by babel. See babel config
|
|
2687
2697
|
|
|
2688
|
-
CozyClient.version = "40.
|
|
2698
|
+
CozyClient.version = "40.4.0";
|
|
2689
2699
|
|
|
2690
2700
|
_microee.default.mixin(CozyClient);
|
|
2691
2701
|
|
package/dist/CozyClient.spec.js
CHANGED
|
@@ -492,9 +492,14 @@ describe('CozyClient logout', () => {
|
|
|
492
492
|
})
|
|
493
493
|
|
|
494
494
|
it('should call reset on each link that can be reset', async () => {
|
|
495
|
-
client.query = jest
|
|
496
|
-
|
|
497
|
-
|
|
495
|
+
client.query = jest
|
|
496
|
+
.fn()
|
|
497
|
+
.mockResolvedValueOnce({
|
|
498
|
+
data: { attributes: { file_versioning: true, flat_subdomains: true } }
|
|
499
|
+
})
|
|
500
|
+
.mockResolvedValueOnce({
|
|
501
|
+
data: { attributes: { locale: 'fr', tracking: true } }
|
|
502
|
+
})
|
|
498
503
|
links[0].reset = jest.fn()
|
|
499
504
|
links[2].reset = jest.fn()
|
|
500
505
|
await client.login()
|
|
@@ -512,9 +517,14 @@ describe('CozyClient logout', () => {
|
|
|
512
517
|
})
|
|
513
518
|
|
|
514
519
|
it('should call all reset even if a reset throws an error', async () => {
|
|
515
|
-
client.query = jest
|
|
516
|
-
|
|
517
|
-
|
|
520
|
+
client.query = jest
|
|
521
|
+
.fn()
|
|
522
|
+
.mockResolvedValueOnce({
|
|
523
|
+
data: { attributes: { file_versioning: true, flat_subdomains: true } }
|
|
524
|
+
})
|
|
525
|
+
.mockResolvedValueOnce({
|
|
526
|
+
data: { attributes: { locale: 'fr', tracking: true } }
|
|
527
|
+
})
|
|
518
528
|
links[0].reset = jest.fn().mockRejectedValue(new Error('Async error'))
|
|
519
529
|
links[2].reset = jest.fn()
|
|
520
530
|
await client.login()
|
|
@@ -524,9 +534,14 @@ describe('CozyClient logout', () => {
|
|
|
524
534
|
})
|
|
525
535
|
|
|
526
536
|
it('should emit events', async () => {
|
|
527
|
-
client.query = jest
|
|
528
|
-
|
|
529
|
-
|
|
537
|
+
client.query = jest
|
|
538
|
+
.fn()
|
|
539
|
+
.mockResolvedValueOnce({
|
|
540
|
+
data: { attributes: { file_versioning: true, flat_subdomains: true } }
|
|
541
|
+
})
|
|
542
|
+
.mockResolvedValueOnce({
|
|
543
|
+
data: { attributes: { locale: 'fr', tracking: true } }
|
|
544
|
+
})
|
|
530
545
|
const originalLogout = client.logout
|
|
531
546
|
links[0].reset = jest.fn()
|
|
532
547
|
links[2].reset = jest.fn()
|
|
@@ -545,9 +560,14 @@ describe('CozyClient logout', () => {
|
|
|
545
560
|
})
|
|
546
561
|
|
|
547
562
|
it('should unregister an oauth client', async () => {
|
|
548
|
-
client.query = jest
|
|
549
|
-
|
|
550
|
-
|
|
563
|
+
client.query = jest
|
|
564
|
+
.fn()
|
|
565
|
+
.mockResolvedValueOnce({
|
|
566
|
+
data: { attributes: { file_versioning: true, flat_subdomains: true } }
|
|
567
|
+
})
|
|
568
|
+
.mockResolvedValueOnce({
|
|
569
|
+
data: { attributes: { locale: 'fr', tracking: true } }
|
|
570
|
+
})
|
|
551
571
|
await client.login()
|
|
552
572
|
stackClient.isRegistered.mockReturnValue(true)
|
|
553
573
|
|
package/dist/models/paper.js
CHANGED
|
@@ -19,7 +19,8 @@ var PERSONAL_SPORTING_LICENCE_NOTICE_PERIOD_DAYS = 15;
|
|
|
19
19
|
var EXPIRATION_LINK_BY_LABEL = {
|
|
20
20
|
national_id_card: 'https://www.service-public.fr/particuliers/vosdroits/N358',
|
|
21
21
|
residence_permit: 'https://www.service-public.fr/particuliers/vosdroits/N110',
|
|
22
|
-
passport: 'https://www.service-public.fr/particuliers/vosdroits/N360'
|
|
22
|
+
passport: 'https://www.service-public.fr/particuliers/vosdroits/N360',
|
|
23
|
+
driver_license: 'https://permisdeconduire.ants.gouv.fr/demarches-en-ligne/perte-vol-deterioration-fin-de-validite-ou-changement-d-etat-civil'
|
|
23
24
|
};
|
|
24
25
|
/**
|
|
25
26
|
* @param {IOCozyFile} file - io.cozy.files document
|
|
@@ -59,6 +59,11 @@ describe('Expiration', () => {
|
|
|
59
59
|
expirationDate: '2022-09-23T11:35:58.118Z',
|
|
60
60
|
noticePeriod: '90'
|
|
61
61
|
})
|
|
62
|
+
const fakeDriverLicense = buildMockFile({
|
|
63
|
+
qualificationLabel: 'driver_license',
|
|
64
|
+
expirationDate: '2022-09-23T11:35:58.118Z',
|
|
65
|
+
noticePeriod: '90'
|
|
66
|
+
})
|
|
62
67
|
|
|
63
68
|
describe('computeExpirationDate', () => {
|
|
64
69
|
it('should return expirationDate', () => {
|
|
@@ -109,6 +114,7 @@ describe('Expiration', () => {
|
|
|
109
114
|
${fakeNationalIdCardFile} | ${'https://www.service-public.fr/particuliers/vosdroits/N358'}
|
|
110
115
|
${fakeResidencePermitFile} | ${'https://www.service-public.fr/particuliers/vosdroits/N110'}
|
|
111
116
|
${fakePassportFile} | ${'https://www.service-public.fr/particuliers/vosdroits/N360'}
|
|
117
|
+
${fakeDriverLicense} | ${'https://permisdeconduire.ants.gouv.fr/demarches-en-ligne/perte-vol-deterioration-fin-de-validite-ou-changement-d-etat-civil'}
|
|
112
118
|
`(
|
|
113
119
|
`should return "$link" link for an file with "$file.metadata.qualification.label" qualification label`,
|
|
114
120
|
({ file, link }) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-client",
|
|
3
|
-
"version": "40.
|
|
3
|
+
"version": "40.4.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.node.js",
|
|
6
6
|
"browser": "dist/index.js",
|
|
@@ -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": "959a3be0c79a3423720b8ddeb13c101bfd4a3ffc"
|
|
77
77
|
}
|
package/types/CozyClient.d.ts
CHANGED
|
@@ -687,7 +687,7 @@ declare class CozyClient {
|
|
|
687
687
|
/**
|
|
688
688
|
* loadInstanceOptionsFromStack - Loads the instance options from cozy-stack and exposes it through getInstanceOptions
|
|
689
689
|
*
|
|
690
|
-
*
|
|
690
|
+
* This method is not iso with loadInstanceOptionsFromDOM for now.
|
|
691
691
|
*
|
|
692
692
|
* @returns {Promise<void>}
|
|
693
693
|
*/
|