Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: Update types and documentation
Browse files Browse the repository at this point in the history
Ldoppea committed Dec 20, 2024
1 parent c2a6c0f commit 2d7973e
Showing 14 changed files with 256 additions and 151 deletions.
20 changes: 20 additions & 0 deletions docs/api/cozy-client/README.md
Original file line number Diff line number Diff line change
@@ -86,6 +86,16 @@ cozy-client

***

### defaultPerformanceApi

`Const` **defaultPerformanceApi**: `PerformanceAPI`

*Defined in*

[packages/cozy-client/src/performances/defaultPerformanceApi.js:2](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/performances/defaultPerformanceApi.js#L2)

***

### fetchPolicies

`Const` **fetchPolicies**: `Object`
@@ -145,6 +155,16 @@ This hook manages the state during the saving of a document

[packages/cozy-client/src/hooks/useMutation.jsx:11](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/hooks/useMutation.jsx#L11)

***

### webPerformanceApi

`Const` **webPerformanceApi**: `PerformanceAPI`

*Defined in*

[packages/cozy-client/src/performances/webPerformanceApi.js:42](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/performances/webPerformanceApi.js#L42)

## Functions

### Q
194 changes: 102 additions & 92 deletions docs/api/cozy-client/classes/CozyClient.md

Large diffs are not rendered by default.

28 changes: 19 additions & 9 deletions docs/api/cozy-client/classes/StackLink.md
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ Transfers queries and mutations to a remote stack

*Defined in*

[packages/cozy-client/src/StackLink.js:68](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/StackLink.js#L68)
[packages/cozy-client/src/StackLink.js:70](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/StackLink.js#L70)

## Properties

@@ -38,7 +38,17 @@ Transfers queries and mutations to a remote stack

*Defined in*

[packages/cozy-client/src/StackLink.js:76](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/StackLink.js#L76)
[packages/cozy-client/src/StackLink.js:78](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/StackLink.js#L78)

***

### performanceApi

**performanceApi**: `PerformanceAPI`

*Defined in*

[packages/cozy-client/src/StackLink.js:81](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/StackLink.js#L81)

***

@@ -48,7 +58,7 @@ Transfers queries and mutations to a remote stack

*Defined in*

[packages/cozy-client/src/StackLink.js:75](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/StackLink.js#L75)
[packages/cozy-client/src/StackLink.js:77](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/StackLink.js#L77)

## Methods

@@ -70,7 +80,7 @@ Transfers queries and mutations to a remote stack

*Defined in*

[packages/cozy-client/src/StackLink.js:136](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/StackLink.js#L136)
[packages/cozy-client/src/StackLink.js:141](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/StackLink.js#L141)

***

@@ -90,7 +100,7 @@ Transfers queries and mutations to a remote stack

*Defined in*

[packages/cozy-client/src/StackLink.js:113](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/StackLink.js#L113)
[packages/cozy-client/src/StackLink.js:118](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/StackLink.js#L118)

***

@@ -117,7 +127,7 @@ Persist the given data into the links storage

*Defined in*

[packages/cozy-client/src/StackLink.js:105](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/StackLink.js#L105)
[packages/cozy-client/src/StackLink.js:110](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/StackLink.js#L110)

***

@@ -137,7 +147,7 @@ Persist the given data into the links storage

*Defined in*

[packages/cozy-client/src/StackLink.js:79](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/StackLink.js#L79)
[packages/cozy-client/src/StackLink.js:84](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/StackLink.js#L84)

***

@@ -165,7 +175,7 @@ Request the given operation from the link

*Defined in*

[packages/cozy-client/src/StackLink.js:87](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/StackLink.js#L87)
[packages/cozy-client/src/StackLink.js:92](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/StackLink.js#L92)

***

@@ -185,4 +195,4 @@ Reset the link data

*Defined in*

[packages/cozy-client/src/StackLink.js:83](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/StackLink.js#L83)
[packages/cozy-client/src/StackLink.js:88](https://github.com/cozy/cozy-client/blob/master/packages/cozy-client/src/StackLink.js#L88)
100 changes: 55 additions & 45 deletions docs/api/cozy-pouch-link/classes/PouchLink.md

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions packages/cozy-client/types/CozyClient.d.ts
Original file line number Diff line number Diff line change
@@ -76,6 +76,10 @@ export type ClientOptions = {
* - If set to false, the client will not instantiate a Redux store automatically. Use this if you want to merge cozy-client's store with your own redux store. See [here](https://docs.cozy.io/en/cozy-client/react-integration/#1b-use-your-own-redux-store) for more information.
*/
store?: boolean;
/**
* - The performance API that can be used to measure performances
*/
performanceApi?: import('./performances/types').PerformanceAPI;
};
/**
* @typedef {import("./types").CozyClientDocument} CozyClientDocument
@@ -99,6 +103,7 @@ export type ClientOptions = {
* @property {import("./types").AppMetadata} [appMetadata] - Metadata about the application that will be used in ensureCozyMetadata
* @property {import("./types").ClientCapabilities} [capabilities] - Capabilities sent by the stack
* @property {boolean} [store] - If set to false, the client will not instantiate a Redux store automatically. Use this if you want to merge cozy-client's store with your own redux store. See [here](https://docs.cozy.io/en/cozy-client/react-integration/#1b-use-your-own-redux-store) for more information.
* @property {import('./performances/types').PerformanceAPI} [performanceApi] - The performance API that can be used to measure performances
*/
/**
* Responsible for
@@ -189,6 +194,8 @@ declare class CozyClient {
* Cozy-Client will automatically call `this.login()` if provided with a token and an uri
*/
constructor(rawOptions?: ClientOptions);
/** @type {import('./performances/types').PerformanceAPI} */
performanceApi: import('./performances/types').PerformanceAPI;
appMetadata: import("./types").AppMetadata;
loginPromise: Promise<void>;
options: {
9 changes: 8 additions & 1 deletion packages/cozy-client/types/StackLink.d.ts
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@ export function transformBulkDocsResponse(bulkResponse: import("./types").CouchD
* @property {object} [stackClient] - A StackClient
* @property {object} [client] - A StackClient (deprecated)
* @property {import('cozy-pouch-link/dist/types').LinkPlatform} [platform] - Platform specific adapters and methods
* @property {import('./performances/types').PerformanceAPI} [performanceApi] - The performance API that can be used to measure performances
*/
/**
* Transfers queries and mutations to a remote stack
@@ -14,9 +15,11 @@ export default class StackLink extends CozyLink {
/**
* @param {StackLinkOptions} [options] - Options
*/
constructor({ client, stackClient, platform }?: StackLinkOptions);
constructor({ client, stackClient, platform, performanceApi }?: StackLinkOptions);
stackClient: any;
isOnline: any;
/** @type {import('./performances/types').PerformanceAPI} */
performanceApi: import('./performances/types').PerformanceAPI;
registerClient(client: any): void;
/**
*
@@ -39,6 +42,10 @@ export type StackLinkOptions = {
* - Platform specific adapters and methods
*/
platform?: any;
/**
* - The performance API that can be used to measure performances
*/
performanceApi?: import('./performances/types').PerformanceAPI;
};
import CozyLink from "./CozyLink";
import { QueryDefinition } from "./queries/dsl";
2 changes: 2 additions & 0 deletions packages/cozy-client/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -13,6 +13,8 @@ export { default as fetchPolicies } from "./policies";
export * from "./mock";
export * from "./hooks";
export { BulkEditError } from "./errors";
export { webPerformanceApi } from "./performances/webPerformanceApi";
export { defaultPerformanceApi } from "./performances/defaultPerformanceApi";
import * as manifest from "./models/manifest";
import * as models from "./models";
export { manifest, models };
2 changes: 2 additions & 0 deletions packages/cozy-client/types/index.node.d.ts
Original file line number Diff line number Diff line change
@@ -10,6 +10,8 @@ export * from "./mock";
export * from "./cli";
export { BulkEditError } from "./errors";
export { default as fetchPolicies } from "./policies";
export { webPerformanceApi } from "./performances/webPerformanceApi";
export { defaultPerformanceApi } from "./performances/defaultPerformanceApi";
import * as manifest from "./models/manifest";
import * as models from "./models";
export { manifest, models };
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/** @type {import('./types').PerformanceAPI} */
export const defaultPerformanceApi: import('./types').PerformanceAPI;
25 changes: 25 additions & 0 deletions packages/cozy-client/types/performances/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
declare var _default: {};
export default _default;
export type MeasureColor = "error" | "primary" | "primary-light" | "primary-dark" | "secondary" | "secondary-light" | "secondary-dark" | "tertiary" | "tertiary-light" | "tertiary-dark";
export type MeasureOptions = {
/**
* - Mark name used as the start point for performance measurement
*/
markName: string;
/**
* - Measure name that will be displayed in the performance graph. If not provided, markName will be used by default
*/
measureName?: string;
/**
* - Category where the measure will be displayed int he performance graph
*/
category?: string;
/**
* - Category where the measure will be displayed int he performance graph
*/
color?: MeasureColor;
};
export type PerformanceAPI = {
measure: (arg0: MeasureOptions) => void;
mark: (arg0: string) => string;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/** @type {import('./types').PerformanceAPI} */
export const webPerformanceApi: import('./types').PerformanceAPI;
6 changes: 3 additions & 3 deletions packages/cozy-client/types/store/index.d.ts
Original file line number Diff line number Diff line change
@@ -7,11 +7,11 @@ export class StoreProxy {
getState(): any;
}
export default combinedReducer;
export function createStore(): any;
declare function combinedReducer(state: {
export function createStore(performanceApi: any): any;
declare function combinedReducer(performanceApi: any): (state: {
documents: {};
queries: {};
}, action: any): {
}, action: any) => {
documents: any;
queries: Record<string, import("../types").QueryState>;
};
3 changes: 2 additions & 1 deletion packages/cozy-client/types/store/queries.d.ts
Original file line number Diff line number Diff line change
@@ -39,10 +39,11 @@ export namespace QueryIDGenerator {
}
import { QueryDefinition } from "../queries/dsl";
/**
* @param {import('../performances/types').PerformanceAPI} performanceApi - The performance API that can be used to measure performances
* @param {import("../types").QueriesStateSlice} state - Redux slice containing all the query states indexed by name
* @param {object} action - Income redux action
* @param {import("../types").DocumentsStateSlice} documents - Reference to documents slice
* @param {boolean} haveDocumentsChanged - Has the document slice changed with current action
* @returns {import("../types").QueriesStateSlice}
*/
declare function queries(state: import("../types").QueriesStateSlice, action: object, documents?: import("../types").DocumentsStateSlice, haveDocumentsChanged?: boolean): import("../types").QueriesStateSlice;
declare function queries(performanceApi: import('../performances/types').PerformanceAPI, state: import("../types").QueriesStateSlice, action: object, documents?: import("../types").DocumentsStateSlice, haveDocumentsChanged?: boolean): import("../types").QueriesStateSlice;
7 changes: 7 additions & 0 deletions packages/cozy-pouch-link/types/CozyPouchLink.d.ts
Original file line number Diff line number Diff line change
@@ -36,6 +36,10 @@ export type PouchLinkOptions = {
* Platform specific adapters and methods
*/
platform: import('./types').LinkPlatform;
/**
* - The performance API that can be used to measure performances
*/
performanceApi?: any;
};
/**
* @typedef {import('cozy-client/src/types').CozyClientDocument} CozyClientDocument
@@ -52,6 +56,7 @@ export type PouchLinkOptions = {
* @property {string[]} doctypes Doctypes to replicate
* @property {Record<string, object>} doctypesReplicationOptions A mapping from doctypes to replication options. All pouch replication options can be used, as well as the "strategy" option that determines which way the replication is done (can be "sync", "fromRemote" or "toRemote")
* @property {import('./types').LinkPlatform} platform Platform specific adapters and methods
* @property {import('cozy-client/src/performances/types').PerformanceAPI} [performanceApi] - The performance API that can be used to measure performances
*/
/**
* Link to be passed to a `CozyClient` instance to support CouchDB. It instantiates
@@ -86,6 +91,8 @@ declare class PouchLink extends CozyLink {
replicationStatus: Record<string, ReplicationStatus>;
/** @private */
private startReplicationDebounced;
/** @type {import('cozy-client/src/performances/types').PerformanceAPI} */
performanceApi: any;
getReplicationURL(doctype: any): string;
registerClient(client: any): Promise<void>;
client: any;

0 comments on commit 2d7973e

Please sign in to comment.