cozy-client 27.3.2 → 27.6.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/CHANGELOG.md +45 -0
- package/dist/CozyClient.js +41 -4
- package/dist/CozyClient.spec.js +48 -1
- package/dist/associations/helpers.js +82 -2
- package/dist/associations/helpers.spec.js +213 -99
- package/dist/associations/index.js +24 -0
- package/dist/hooks/useQuery.js +9 -6
- package/dist/hooks/useQuery.spec.jsx +33 -2
- package/dist/index.js +33 -3
- package/dist/models/file.js +49 -2
- package/dist/models/file.spec.js +107 -70
- package/dist/types.js +27 -5
- package/package.json +2 -2
- package/types/CozyClient.d.ts +15 -1
- package/types/associations/helpers.d.ts +7 -0
- package/types/associations/index.d.ts +1 -1
- package/types/hooks/useQuery.d.ts +36 -12
- package/types/index.d.ts +1 -0
- package/types/models/file.d.ts +4 -0
- package/types/queries/referencedBy.d.ts +7 -0
- package/types/types.d.ts +31 -4
package/types/types.d.ts
CHANGED
|
@@ -64,24 +64,47 @@ export type QueryOptions = {
|
|
|
64
64
|
* - Does not seem to be used
|
|
65
65
|
*/
|
|
66
66
|
update?: string;
|
|
67
|
+
/**
|
|
68
|
+
* - Callback when the query is errored
|
|
69
|
+
*/
|
|
70
|
+
onError?: Function;
|
|
67
71
|
};
|
|
68
72
|
export type FetchMoreAble = {
|
|
69
73
|
fetchMore: Function;
|
|
70
74
|
};
|
|
71
75
|
export type UseQueryReturnValue = QueryState & FetchMoreAble;
|
|
72
76
|
/**
|
|
73
|
-
* A reference to a document
|
|
77
|
+
* A reference to a document
|
|
78
|
+
*/
|
|
79
|
+
export type ReferencedByRelationship = {
|
|
80
|
+
parent?: RelationshipParent;
|
|
81
|
+
referenced_by?: ReferencedBy;
|
|
82
|
+
};
|
|
83
|
+
export type RelationshipParent = {
|
|
84
|
+
links: {
|
|
85
|
+
related: string;
|
|
86
|
+
};
|
|
87
|
+
data?: Reference;
|
|
88
|
+
};
|
|
89
|
+
export type ReferencedBy = {
|
|
90
|
+
links: {
|
|
91
|
+
self: string;
|
|
92
|
+
};
|
|
93
|
+
data: Reference[] | null;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* A reference to a document
|
|
74
97
|
* https://docs.cozy.io/en/cozy-doctypes/docs/io.cozy.files/#references
|
|
75
98
|
*/
|
|
76
99
|
export type Reference = {
|
|
77
100
|
/**
|
|
78
101
|
* - id of the document
|
|
79
102
|
*/
|
|
80
|
-
|
|
103
|
+
id: string;
|
|
81
104
|
/**
|
|
82
105
|
* - doctype of the document
|
|
83
106
|
*/
|
|
84
|
-
|
|
107
|
+
type: string;
|
|
85
108
|
};
|
|
86
109
|
export type ReferenceMap = {
|
|
87
110
|
[x: string]: Reference[];
|
|
@@ -118,7 +141,11 @@ export type CozyClientDocument = {
|
|
|
118
141
|
/**
|
|
119
142
|
* - Relationships of the document
|
|
120
143
|
*/
|
|
121
|
-
relationships?:
|
|
144
|
+
relationships?: ReferencedByRelationship;
|
|
145
|
+
/**
|
|
146
|
+
* - referenced by of another document
|
|
147
|
+
*/
|
|
148
|
+
referenced_by?: Reference[];
|
|
122
149
|
};
|
|
123
150
|
/**
|
|
124
151
|
* - An io.cozy.files document
|