File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,13 +9,37 @@ export default class CozyLink {
99 }
1010 }
1111
12- request ( operation , result , forward ) {
12+ /**
13+ * Request the given operation from the link
14+ *
15+ * @param {any } operation - The operation to request
16+ * @param {any } result - The result from the previous request of the chain
17+ * @param {any } forward - The next request of the chain
18+ * @returns {Promise<any> }
19+ */
20+ async request ( operation , result , forward ) {
1321 throw new Error ( 'request is not implemented' )
1422 }
1523
16- persistCozyData ( data , forward ) {
24+ /**
25+ * Persist the given data into the links storage
26+ *
27+ * @param {any } data - The document to persist
28+ * @param {any } forward - The next persistCozyData of the chain
29+ * @returns {Promise<any> }
30+ */
31+ async persistCozyData ( data , forward ) {
1732 throw new Error ( 'persistCozyData is not implemented' )
1833 }
34+
35+ /**
36+ * Reset the link data
37+ *
38+ * @returns {Promise<any> }
39+ */
40+ async reset ( ) {
41+ throw new Error ( 'reset is not implemented' )
42+ }
1943}
2044
2145const toLink = handler =>
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ export default class FlagshipLink extends CozyLink {
1414 // does nothing, we don't need any client for this kind of link
1515 }
1616
17- reset ( ) {
17+ async reset ( ) {
1818 // does nothing, we don't need any client for this kind of link
1919 }
2020
Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ export default class StackLink extends CozyLink {
8080 this . stackClient = client . stackClient || client . client
8181 }
8282
83- reset ( ) {
83+ async reset ( ) {
8484 this . stackClient = null
8585 }
8686
Original file line number Diff line number Diff line change 11export default class CozyLink {
22 constructor ( requestHandler : any , persistHandler : any ) ;
3- request ( operation : any , result : any , forward : any ) : void ;
4- persistCozyData ( data : any , forward : any ) : void ;
3+ /**
4+ * Request the given operation from the link
5+ *
6+ * @param {any } operation - The operation to request
7+ * @param {any } result - The result from the previous request of the chain
8+ * @param {any } forward - The next request of the chain
9+ * @returns {Promise<any> }
10+ */
11+ request ( operation : any , result : any , forward : any ) : Promise < any > ;
12+ /**
13+ * Persist the given data into the links storage
14+ *
15+ * @param {any } data - The document to persist
16+ * @param {any } forward - The next persistCozyData of the chain
17+ * @returns {Promise<any> }
18+ */
19+ persistCozyData ( data : any , forward : any ) : Promise < any > ;
20+ /**
21+ * Reset the link data
22+ *
23+ * @returns {Promise<any> }
24+ */
25+ reset ( ) : Promise < any > ;
526}
627export function chain ( links : any ) : any ;
Original file line number Diff line number Diff line change @@ -8,6 +8,5 @@ export default class FlagshipLink extends CozyLink {
88 } ) ;
99 webviewIntent : import ( "cozy-intent" ) . WebviewService ;
1010 registerClient ( client : any ) : void ;
11- reset ( ) : void ;
1211}
1312import CozyLink from "./CozyLink" ;
Original file line number Diff line number Diff line change @@ -18,7 +18,6 @@ export default class StackLink extends CozyLink {
1818 stackClient : any ;
1919 isOnline : any ;
2020 registerClient ( client : any ) : void ;
21- reset ( ) : void ;
2221 /**
2322 *
2423 * @param {QueryDefinition } query - Query to execute
Original file line number Diff line number Diff line change @@ -96,7 +96,6 @@ declare class PouchLink extends CozyLink {
9696 } ) : Promise < void > ;
9797 onLogin ( ) : Promise < void > ;
9898 pouches : PouchManager ;
99- reset ( ) : Promise < void > ;
10099 /**
101100 * Receives PouchDB updates (documents grouped by doctype).
102101 * Normalizes the data (.id -> ._id, .rev -> _rev).
You can’t perform that action at this time.
0 commit comments