From 928529df72775b0b2d054731eb5ff1d5c84c6d2e Mon Sep 17 00:00:00 2001 From: Yannick Chiron Date: Wed, 31 Aug 2022 20:08:12 +0200 Subject: [PATCH] chore: Add JDoc type declaration for client.getStackClient() --- packages/cozy-client/src/CozyClient.js | 5 +++++ packages/cozy-client/types/CozyClient.d.ts | 12 +++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/packages/cozy-client/src/CozyClient.js b/packages/cozy-client/src/CozyClient.js index 957e02cf0c..b6e65d1740 100644 --- a/packages/cozy-client/src/CozyClient.js +++ b/packages/cozy-client/src/CozyClient.js @@ -1632,6 +1632,11 @@ instantiation of the client.` return this.getStackClient() } + /** + * Retrieve the CozyStackClient instance used by CozyClient + * + * @returns {CozyStackClient} - CozyStackClient instance + */ getStackClient() { if (!this.stackClient) { this.createClient() diff --git a/packages/cozy-client/types/CozyClient.d.ts b/packages/cozy-client/types/CozyClient.d.ts index c3996c915b..5fecd55541 100644 --- a/packages/cozy-client/types/CozyClient.d.ts +++ b/packages/cozy-client/types/CozyClient.d.ts @@ -297,7 +297,7 @@ declare class CozyClient { * @returns {DocumentCollection} Collection corresponding to the doctype */ collection(doctype: string): DocumentCollection; - fetch(method: any, path: any, body: any, options?: {}): any; + fetch(method: any, path: any, body: any, options?: {}): Promise; all(doctype: any): QueryDefinition; find(doctype: any, selector?: any): QueryDefinition; get(doctype: any, id: any): QueryDefinition; @@ -660,8 +660,13 @@ declare class CozyClient { createClient(): void; stackClient: any; client: any; - getClient(): any; - getStackClient(): any; + getClient(): CozyStackClient; + /** + * Retrieve the CozyStackClient instance used by CozyClient + * + * @returns {CozyStackClient} - CozyStackClient instance + */ + getStackClient(): CozyStackClient; reducer(): (state: { documents: {}; queries: {}; @@ -733,6 +738,7 @@ import { OpenURLCallback } from "./types"; import { SessionCode } from "./types"; import { PKCECodes } from "./types"; import { ReduxStore } from "./types"; +import CozyStackClient from "cozy-stack-client"; import { CozyClient as SnapshotClient } from "./testing/snapshots"; import { OldCozyClient } from "./types"; import { NodeEnvironment } from "./types";