diff --git a/docs/api/cozy-client/classes/CozyLink.md b/docs/api/cozy-client/classes/CozyLink.md index ad48952f95..1a4fa2f4a5 100644 --- a/docs/api/cozy-client/classes/CozyLink.md +++ b/docs/api/cozy-client/classes/CozyLink.md @@ -31,41 +31,61 @@ ### persistCozyData -▸ **persistCozyData**(`data`, `forward`): `void` +▸ **persistCozyData**(`data`, `forward`): `Promise`<`any`> + +Persist the given data into the links storage *Parameters* -| Name | Type | -| :------ | :------ | -| `data` | `any` | -| `forward` | `any` | +| Name | Type | Description | +| :------ | :------ | :------ | +| `data` | `any` | The document to persist | +| `forward` | `any` | The next persistCozyData of the chain | *Returns* -`void` +`Promise`<`any`> *Defined in* -[packages/cozy-client/src/CozyLink.js:16](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/CozyLink.js#L16) +[packages/cozy-client/src/CozyLink.js:31](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/CozyLink.js#L31) *** ### request -▸ **request**(`operation`, `result`, `forward`): `void` +▸ **request**(`operation`, `result`, `forward`): `Promise`<`any`> + +Request the given operation from the link *Parameters* -| Name | Type | -| :------ | :------ | -| `operation` | `any` | -| `result` | `any` | -| `forward` | `any` | +| Name | Type | Description | +| :------ | :------ | :------ | +| `operation` | `any` | The operation to request | +| `result` | `any` | The result from the previous request of the chain | +| `forward` | `any` | The next request of the chain | + +*Returns* + +`Promise`<`any`> + +*Defined in* + +[packages/cozy-client/src/CozyLink.js:20](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/CozyLink.js#L20) + +*** + +### reset + +▸ **reset**(): `Promise`<`any`> + +Reset the link data *Returns* -`void` +`Promise`<`any`> *Defined in* -[packages/cozy-client/src/CozyLink.js:12](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/CozyLink.js#L12) +[packages/cozy-client/src/CozyLink.js:40](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/CozyLink.js#L40) diff --git a/docs/api/cozy-client/classes/FlagshipLink.md b/docs/api/cozy-client/classes/FlagshipLink.md index e1147b5552..1ea0f0a621 100644 --- a/docs/api/cozy-client/classes/FlagshipLink.md +++ b/docs/api/cozy-client/classes/FlagshipLink.md @@ -45,6 +45,8 @@ ▸ **persistCozyData**(`data`, `forward`): `Promise`<`void`> +Persist the given data into the links storage + *Parameters* | Name | Type | @@ -90,6 +92,8 @@ ▸ **request**(`operation`, `result`, `forward`): `Promise`<`boolean`> +Request the given operation from the link + *Parameters* | Name | Type | @@ -114,11 +118,17 @@ ### reset -▸ **reset**(): `void` +▸ **reset**(): `Promise`<`void`> + +Reset the link data *Returns* -`void` +`Promise`<`void`> + +*Overrides* + +[CozyLink](CozyLink.md).[reset](CozyLink.md#reset) *Defined in* diff --git a/docs/api/cozy-client/classes/StackLink.md b/docs/api/cozy-client/classes/StackLink.md index 45f4530f4f..6e69ab319d 100644 --- a/docs/api/cozy-client/classes/StackLink.md +++ b/docs/api/cozy-client/classes/StackLink.md @@ -98,6 +98,8 @@ Transfers queries and mutations to a remote stack ▸ **persistCozyData**(`data`, `forward`): `Promise`<`any`> +Persist the given data into the links storage + *Parameters* | Name | Type | @@ -143,6 +145,8 @@ Transfers queries and mutations to a remote stack ▸ **request**(`operation`, `result`, `forward`): `Promise`<`any`> +Request the given operation from the link + *Parameters* | Name | Type | @@ -167,11 +171,17 @@ Transfers queries and mutations to a remote stack ### reset -▸ **reset**(): `void` +▸ **reset**(): `Promise`<`void`> + +Reset the link data *Returns* -`void` +`Promise`<`void`> + +*Overrides* + +[CozyLink](CozyLink.md).[reset](CozyLink.md#reset) *Defined in* diff --git a/docs/api/cozy-pouch-link/classes/PouchLink.md b/docs/api/cozy-pouch-link/classes/PouchLink.md index 75827771b3..6e74bf75c0 100644 --- a/docs/api/cozy-pouch-link/classes/PouchLink.md +++ b/docs/api/cozy-pouch-link/classes/PouchLink.md @@ -603,6 +603,10 @@ CozyLink.request `Promise`<`void`> +*Overrides* + +CozyLink.reset + *Defined in* [CozyPouchLink.js:229](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L229) diff --git a/packages/cozy-client/types/CozyLink.d.ts b/packages/cozy-client/types/CozyLink.d.ts index 5d229867d8..27dda27f57 100644 --- a/packages/cozy-client/types/CozyLink.d.ts +++ b/packages/cozy-client/types/CozyLink.d.ts @@ -1,6 +1,27 @@ export default class CozyLink { constructor(requestHandler: any, persistHandler: any); - request(operation: any, result: any, forward: any): void; - persistCozyData(data: any, forward: any): void; + /** + * Request the given operation from the link + * + * @param {any} operation - The operation to request + * @param {any} result - The result from the previous request of the chain + * @param {any} forward - The next request of the chain + * @returns {Promise} + */ + request(operation: any, result: any, forward: any): Promise; + /** + * Persist the given data into the links storage + * + * @param {any} data - The document to persist + * @param {any} forward - The next persistCozyData of the chain + * @returns {Promise} + */ + persistCozyData(data: any, forward: any): Promise; + /** + * Reset the link data + * + * @returns {Promise} + */ + reset(): Promise; } export function chain(links: any): any; diff --git a/packages/cozy-client/types/FlagshipLink.d.ts b/packages/cozy-client/types/FlagshipLink.d.ts index 3b3e389fa8..a54035c3bb 100644 --- a/packages/cozy-client/types/FlagshipLink.d.ts +++ b/packages/cozy-client/types/FlagshipLink.d.ts @@ -8,6 +8,5 @@ export default class FlagshipLink extends CozyLink { }); webviewIntent: import("cozy-intent").WebviewService; registerClient(client: any): void; - reset(): void; } import CozyLink from "./CozyLink"; diff --git a/packages/cozy-client/types/StackLink.d.ts b/packages/cozy-client/types/StackLink.d.ts index 918ef72ef8..2c353a3c65 100644 --- a/packages/cozy-client/types/StackLink.d.ts +++ b/packages/cozy-client/types/StackLink.d.ts @@ -18,7 +18,6 @@ export default class StackLink extends CozyLink { stackClient: any; isOnline: any; registerClient(client: any): void; - reset(): void; /** * * @param {QueryDefinition} query - Query to execute diff --git a/packages/cozy-pouch-link/types/CozyPouchLink.d.ts b/packages/cozy-pouch-link/types/CozyPouchLink.d.ts index a8b6a30bfd..49b9fce8f0 100644 --- a/packages/cozy-pouch-link/types/CozyPouchLink.d.ts +++ b/packages/cozy-pouch-link/types/CozyPouchLink.d.ts @@ -96,7 +96,6 @@ declare class PouchLink extends CozyLink { }): Promise; onLogin(): Promise; pouches: PouchManager; - reset(): Promise; /** * Receives PouchDB updates (documents grouped by doctype). * Normalizes the data (.id -> ._id, .rev -> _rev).