cozy-client 48.6.0 → 48.8.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/models/paper.js +19 -2
- package/dist/models/paper.spec.js +30 -2
- package/dist/types.js +25 -1
- package/package.json +2 -2
- package/types/models/paper.d.ts +1 -0
- package/types/types.d.ts +69 -1
package/dist/CozyClient.js
CHANGED
|
@@ -2830,7 +2830,7 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
2830
2830
|
CozyClient.hooks = CozyClient.hooks || {};
|
|
2831
2831
|
CozyClient.fetchPolicies = _policies.default; //COZY_CLIENT_VERSION_PACKAGE in replaced by babel. See babel config
|
|
2832
2832
|
|
|
2833
|
-
CozyClient.version = "48.
|
|
2833
|
+
CozyClient.version = "48.8.0";
|
|
2834
2834
|
|
|
2835
2835
|
_microee.default.mixin(CozyClient);
|
|
2836
2836
|
|
package/dist/models/paper.js
CHANGED
|
@@ -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.makeExpirationDescription = exports.makeExpiresInMessage = exports.makeExpiredMessage = exports.formatContactValue = exports.getTranslatedNameForContact = exports.formatOtherMetadataValue = exports.getTranslatedNameForOtherMetadata = exports.formatInformationMetadataValue = exports.getTranslatedNameForInformationMetadata = exports.formatDateMetadataValue = exports.getTranslatedNameForDateMetadata = exports.getMetadataQualificationType = exports.formatMetadataQualification = exports.isExpiringSoon = exports.isExpired = exports.computeExpirationNoticeLink = exports.computeExpirationNoticeDate = exports.computeExpirationDate = exports.isExpiring = exports.KNOWN_BILLS_ATTRIBUTES_NAMES = exports.KNOWN_OTHER_METADATA_NAMES = exports.KNOWN_INFORMATION_METADATA_NAMES = exports.KNOWN_DATE_METADATA_NAMES = void 0;
|
|
8
|
+
exports.isForeignPaper = exports.makeExpirationDescription = exports.makeExpiresInMessage = exports.makeExpiredMessage = exports.formatContactValue = exports.getTranslatedNameForContact = exports.formatOtherMetadataValue = exports.getTranslatedNameForOtherMetadata = exports.formatInformationMetadataValue = exports.getTranslatedNameForInformationMetadata = exports.formatDateMetadataValue = exports.getTranslatedNameForDateMetadata = exports.getMetadataQualificationType = exports.formatMetadataQualification = exports.isExpiringSoon = exports.isExpired = exports.computeExpirationNoticeLink = exports.computeExpirationNoticeDate = exports.computeExpirationDate = exports.isExpiring = exports.KNOWN_BILLS_ATTRIBUTES_NAMES = exports.KNOWN_OTHER_METADATA_NAMES = exports.KNOWN_INFORMATION_METADATA_NAMES = exports.KNOWN_DATE_METADATA_NAMES = void 0;
|
|
9
9
|
|
|
10
10
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
11
|
|
|
@@ -585,5 +585,22 @@ var makeExpirationDescription = function makeExpirationDescription(expirationDat
|
|
|
585
585
|
duration: distance
|
|
586
586
|
});
|
|
587
587
|
};
|
|
588
|
+
/**
|
|
589
|
+
* @param {IOCozyFile} file - io.cozy.files document
|
|
590
|
+
* @returns {boolean}
|
|
591
|
+
*/
|
|
592
|
+
|
|
593
|
+
|
|
594
|
+
exports.makeExpirationDescription = makeExpirationDescription;
|
|
595
|
+
|
|
596
|
+
var isForeignPaper = function isForeignPaper(file) {
|
|
597
|
+
var _file$metadata13;
|
|
598
|
+
|
|
599
|
+
if ((_file$metadata13 = file.metadata) !== null && _file$metadata13 !== void 0 && _file$metadata13.country) {
|
|
600
|
+
return file.metadata.country.toLowerCase() !== 'fr';
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
return false;
|
|
604
|
+
};
|
|
588
605
|
|
|
589
|
-
exports.
|
|
606
|
+
exports.isForeignPaper = isForeignPaper;
|
|
@@ -9,17 +9,20 @@ import * as paperModel from './paper'
|
|
|
9
9
|
* @param {string} [param.expirationDate] - expiration date of file
|
|
10
10
|
* @param {string} [param.referencedDate] - reference date of file
|
|
11
11
|
* @param {string} [param.noticePeriod] - period before send notification
|
|
12
|
+
* @param {object} [param.metadata] - metadata of file
|
|
12
13
|
*/
|
|
13
14
|
const buildMockFile = ({
|
|
14
15
|
qualificationLabel,
|
|
15
16
|
expirationDate,
|
|
16
17
|
referencedDate,
|
|
17
|
-
noticePeriod
|
|
18
|
+
noticePeriod,
|
|
19
|
+
metadata = {}
|
|
18
20
|
}) => {
|
|
19
21
|
return /** @type {import('../types').IOCozyFile} */ ({
|
|
20
22
|
name: qualificationLabel,
|
|
21
23
|
created_at: '2022-09-01T00:00:00.000Z',
|
|
22
24
|
metadata: {
|
|
25
|
+
...metadata,
|
|
23
26
|
qualification: { label: qualificationLabel },
|
|
24
27
|
...(expirationDate && { expirationDate }),
|
|
25
28
|
...(referencedDate && { referencedDate }),
|
|
@@ -43,7 +46,18 @@ describe('Expiration', () => {
|
|
|
43
46
|
const fakeNationalIdCardFile = buildMockFile({
|
|
44
47
|
qualificationLabel: 'national_id_card',
|
|
45
48
|
expirationDate: '2022-09-23T11:35:58.118Z',
|
|
46
|
-
noticePeriod: '90'
|
|
49
|
+
noticePeriod: '90',
|
|
50
|
+
metadata: {
|
|
51
|
+
country: 'FR'
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
const fakeForeignNationalIdCardFile = buildMockFile({
|
|
55
|
+
qualificationLabel: 'national_id_card',
|
|
56
|
+
expirationDate: '2022-09-23T11:35:58.118Z',
|
|
57
|
+
noticePeriod: '90',
|
|
58
|
+
metadata: {
|
|
59
|
+
country: 'BE'
|
|
60
|
+
}
|
|
47
61
|
})
|
|
48
62
|
const fakePassportFile = buildMockFile({
|
|
49
63
|
qualificationLabel: 'passport',
|
|
@@ -263,4 +277,18 @@ describe('Expiration', () => {
|
|
|
263
277
|
expect(res).toEqual('France')
|
|
264
278
|
})
|
|
265
279
|
})
|
|
280
|
+
|
|
281
|
+
describe('isForeignPaper', () => {
|
|
282
|
+
it('should return true if the paper is a foreign paper', () => {
|
|
283
|
+
const res = paperModel.isForeignPaper(fakeForeignNationalIdCardFile)
|
|
284
|
+
|
|
285
|
+
expect(res).toBe(true)
|
|
286
|
+
})
|
|
287
|
+
|
|
288
|
+
it('should return false if the paper is not a foreign paper', () => {
|
|
289
|
+
const res = paperModel.isForeignPaper(fakeNationalIdCardFile)
|
|
290
|
+
|
|
291
|
+
expect(res).toBe(false)
|
|
292
|
+
})
|
|
293
|
+
})
|
|
266
294
|
})
|
package/dist/types.js
CHANGED
|
@@ -393,6 +393,27 @@ var _dsl = require("./queries/dsl");
|
|
|
393
393
|
* @property {Function} [updateQueries]
|
|
394
394
|
*/
|
|
395
395
|
|
|
396
|
+
/**
|
|
397
|
+
* @typedef {object} UpdatedByApp
|
|
398
|
+
* @property {string} slug - Slug of the app that updated the document
|
|
399
|
+
* @property {string} date - Date of the update
|
|
400
|
+
* @property {number} version - Version of the app that updated the document
|
|
401
|
+
*/
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* @typedef {object} CozyMetadata
|
|
405
|
+
* @property {number} [doctypeVersion] - Version of the doctype
|
|
406
|
+
* @property {number} [metadataVersion] - Version of the metadata
|
|
407
|
+
* @property {string} [createdAt] - Date of creation
|
|
408
|
+
* @property {string} [createdByApp] - Slug of the app that created the document
|
|
409
|
+
* @property {string} [createdByAppVersion] - Version of the app that created the document
|
|
410
|
+
* @property {string} [updatedAt] - Date of the last update
|
|
411
|
+
* @property {UpdatedByApp[]} [updatedByApps] - List of apps that updated the document
|
|
412
|
+
* @property {string} [sourceAccount] - Id of the account associated to the document
|
|
413
|
+
* @property {string} [sourceAccountIdentifier] - Identifier of the source account
|
|
414
|
+
* @property {boolean} [favorite] - Whether the document is marked as favorite
|
|
415
|
+
*/
|
|
416
|
+
|
|
396
417
|
/**
|
|
397
418
|
* @typedef {object} CozyClientDocument - A document
|
|
398
419
|
* @property {string} [_id] - Id of the document
|
|
@@ -402,7 +423,7 @@ var _dsl = require("./queries/dsl");
|
|
|
402
423
|
* @property {boolean} [_deleted] - When the document has been deleted
|
|
403
424
|
* @property {ReferencedByRelationship} [relationships] - Relationships of the document
|
|
404
425
|
* @property {Reference[]} [referenced_by] - referenced by of another document
|
|
405
|
-
* @property {
|
|
426
|
+
* @property {CozyMetadata} [cozyMetadata] - Cozy Metadata
|
|
406
427
|
*/
|
|
407
428
|
|
|
408
429
|
/**
|
|
@@ -425,12 +446,15 @@ var _dsl = require("./queries/dsl");
|
|
|
425
446
|
* @property {string} [referencedDate] - Reference date of the paper
|
|
426
447
|
* @property {string} [noticePeriod] - Notice period of the paper, in days
|
|
427
448
|
* @property {string} [datetime] - Image EXIF date, if relevant
|
|
449
|
+
* @property {string} [instanceName] - Name of the instance
|
|
428
450
|
*/
|
|
429
451
|
|
|
430
452
|
/**
|
|
431
453
|
* @typedef {object} FileDocument - An io.cozy.files document
|
|
432
454
|
* @property {string} _id - Id of the file
|
|
433
455
|
* @property {FilesDoctype} _type - Doctype of the file
|
|
456
|
+
* @property {string} dir_id - Id of the parent folder
|
|
457
|
+
* @property {string} [path] - Path of the file
|
|
434
458
|
* @property {string} name - Name of the file
|
|
435
459
|
* @property {FileMetadata} metadata - Metadata of the file
|
|
436
460
|
* @property {string} type - Type of the file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-client",
|
|
3
|
-
"version": "48.
|
|
3
|
+
"version": "48.8.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.node.js",
|
|
6
6
|
"browser": "dist/index.js",
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
"react-native-ios11-devicecheck": "https://github.com/cozy/react-native-devicecheck#app-attest-v0.1"
|
|
76
76
|
},
|
|
77
77
|
"sideEffects": false,
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "436e11e6ff7d688533c20a53c01fd546dc1a03ea"
|
|
79
79
|
}
|
package/types/models/paper.d.ts
CHANGED
|
@@ -49,5 +49,6 @@ export function makeExpiresInMessage(expirationDate: string, { lang }: {
|
|
|
49
49
|
export function makeExpirationDescription(expirationDate: string, { lang }: {
|
|
50
50
|
lang: string;
|
|
51
51
|
}): string;
|
|
52
|
+
export function isForeignPaper(file: IOCozyFile): boolean;
|
|
52
53
|
export type IOCozyFile = import("../types").CozyClientDocument & import("../types").FileDocument;
|
|
53
54
|
export type MetadataQualificationType = "other" | "date" | "contact" | "information" | "bills";
|
package/types/types.d.ts
CHANGED
|
@@ -638,6 +638,62 @@ export type MutationOptions = {
|
|
|
638
638
|
update?: Function;
|
|
639
639
|
updateQueries?: Function;
|
|
640
640
|
};
|
|
641
|
+
export type UpdatedByApp = {
|
|
642
|
+
/**
|
|
643
|
+
* - Slug of the app that updated the document
|
|
644
|
+
*/
|
|
645
|
+
slug: string;
|
|
646
|
+
/**
|
|
647
|
+
* - Date of the update
|
|
648
|
+
*/
|
|
649
|
+
date: string;
|
|
650
|
+
/**
|
|
651
|
+
* - Version of the app that updated the document
|
|
652
|
+
*/
|
|
653
|
+
version: number;
|
|
654
|
+
};
|
|
655
|
+
export type CozyMetadata = {
|
|
656
|
+
/**
|
|
657
|
+
* - Version of the doctype
|
|
658
|
+
*/
|
|
659
|
+
doctypeVersion?: number;
|
|
660
|
+
/**
|
|
661
|
+
* - Version of the metadata
|
|
662
|
+
*/
|
|
663
|
+
metadataVersion?: number;
|
|
664
|
+
/**
|
|
665
|
+
* - Date of creation
|
|
666
|
+
*/
|
|
667
|
+
createdAt?: string;
|
|
668
|
+
/**
|
|
669
|
+
* - Slug of the app that created the document
|
|
670
|
+
*/
|
|
671
|
+
createdByApp?: string;
|
|
672
|
+
/**
|
|
673
|
+
* - Version of the app that created the document
|
|
674
|
+
*/
|
|
675
|
+
createdByAppVersion?: string;
|
|
676
|
+
/**
|
|
677
|
+
* - Date of the last update
|
|
678
|
+
*/
|
|
679
|
+
updatedAt?: string;
|
|
680
|
+
/**
|
|
681
|
+
* - List of apps that updated the document
|
|
682
|
+
*/
|
|
683
|
+
updatedByApps?: UpdatedByApp[];
|
|
684
|
+
/**
|
|
685
|
+
* - Id of the account associated to the document
|
|
686
|
+
*/
|
|
687
|
+
sourceAccount?: string;
|
|
688
|
+
/**
|
|
689
|
+
* - Identifier of the source account
|
|
690
|
+
*/
|
|
691
|
+
sourceAccountIdentifier?: string;
|
|
692
|
+
/**
|
|
693
|
+
* - Whether the document is marked as favorite
|
|
694
|
+
*/
|
|
695
|
+
favorite?: boolean;
|
|
696
|
+
};
|
|
641
697
|
/**
|
|
642
698
|
* - A document
|
|
643
699
|
*/
|
|
@@ -673,7 +729,7 @@ export type CozyClientDocument = {
|
|
|
673
729
|
/**
|
|
674
730
|
* - Cozy Metadata
|
|
675
731
|
*/
|
|
676
|
-
cozyMetadata?:
|
|
732
|
+
cozyMetadata?: CozyMetadata;
|
|
677
733
|
};
|
|
678
734
|
/**
|
|
679
735
|
* - A io.cozy.files document's metadata
|
|
@@ -719,6 +775,10 @@ export type FileMetadata = {
|
|
|
719
775
|
* - Image EXIF date, if relevant
|
|
720
776
|
*/
|
|
721
777
|
datetime?: string;
|
|
778
|
+
/**
|
|
779
|
+
* - Name of the instance
|
|
780
|
+
*/
|
|
781
|
+
instanceName?: string;
|
|
722
782
|
};
|
|
723
783
|
/**
|
|
724
784
|
* - An io.cozy.files document
|
|
@@ -732,6 +792,14 @@ export type FileDocument = {
|
|
|
732
792
|
* - Doctype of the file
|
|
733
793
|
*/
|
|
734
794
|
_type: FilesDoctype;
|
|
795
|
+
/**
|
|
796
|
+
* - Id of the parent folder
|
|
797
|
+
*/
|
|
798
|
+
dir_id: string;
|
|
799
|
+
/**
|
|
800
|
+
* - Path of the file
|
|
801
|
+
*/
|
|
802
|
+
path?: string;
|
|
735
803
|
/**
|
|
736
804
|
* - Name of the file
|
|
737
805
|
*/
|