cozy-client 38.0.0 → 38.0.2
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/dist/CozyClient.js +44 -46
- package/dist/RealTimeQueries.js +6 -8
- package/dist/StackLink.js +4 -6
- package/dist/associations/Association.js +2 -4
- package/dist/associations/HasMany.js +6 -8
- package/dist/associations/HasManyFiles.js +5 -7
- package/dist/associations/HasManyInPlace.js +2 -4
- package/dist/associations/HasOne.js +5 -7
- package/dist/associations/HasOneInPlace.js +2 -4
- package/dist/associations/helpers.js +10 -12
- package/dist/authentication/mobile.js +1 -3
- package/dist/devtools/Queries.js +4 -6
- package/dist/errors.js +4 -6
- package/dist/flagship-certification/flagship-certification.js +2 -4
- package/dist/flagship-certification/store-attestation.android.js +2 -4
- package/dist/flagship-certification/store-attestation.ios.js +2 -4
- package/dist/flagship-certification/store-attestation.js +2 -4
- package/dist/helpers/urlHelper.js +3 -5
- package/dist/hooks/useAppsInMaintenance.js +1 -3
- package/dist/hooks/useCapabilities.js +1 -1
- package/dist/hooks/useClientErrors.js +3 -5
- package/dist/hooks/useQuery.js +2 -4
- package/dist/hooks/useQueryAll.js +2 -4
- package/dist/models/dacc.js +5 -7
- package/dist/models/document/documentTypeData.js +12 -14
- package/dist/models/document/documentTypeDataHelpers.js +4 -6
- package/dist/models/file.js +23 -25
- package/dist/models/folder.js +5 -7
- package/dist/models/timeseries.js +1 -3
- package/dist/queries/dsl.js +6 -8
- package/dist/store/documents.js +1 -3
- package/dist/store/queries.js +28 -30
- package/package.json +3 -3
- package/types/CozyClient.d.ts +75 -92
- package/types/RealTimeQueries.d.ts +1 -2
- package/types/StackLink.d.ts +4 -7
- package/types/associations/Association.d.ts +3 -4
- package/types/associations/HasMany.d.ts +6 -7
- package/types/associations/HasOne.d.ts +5 -6
- package/types/associations/helpers.d.ts +4 -7
- package/types/errors.d.ts +9 -11
- package/types/flagship-certification/flagship-certification.d.ts +1 -2
- package/types/flagship-certification/store-attestation.android.d.ts +1 -3
- package/types/flagship-certification/store-attestation.d.ts +3 -5
- package/types/flagship-certification/store-attestation.ios.d.ts +1 -3
- package/types/helpers/urlHelper.d.ts +2 -5
- package/types/hooks/useAppsInMaintenance.d.ts +2 -3
- package/types/hooks/useQuery.d.ts +3 -5
- package/types/hooks/useQueryAll.d.ts +3 -5
- package/types/models/dacc.d.ts +4 -7
- package/types/models/document/documentTypeData.d.ts +2 -3
- package/types/models/document/documentTypeDataHelpers.d.ts +1 -3
- package/types/models/file.d.ts +22 -24
- package/types/models/folder.d.ts +3 -5
- package/types/queries/dsl.d.ts +13 -16
- package/types/store/documents.d.ts +1 -2
- package/types/store/queries.d.ts +11 -16
package/types/CozyClient.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export type ClientOptions = {
|
|
|
3
3
|
client?: object;
|
|
4
4
|
link?: object;
|
|
5
5
|
links?: object;
|
|
6
|
-
token?: Token;
|
|
6
|
+
token?: import("./types").Token;
|
|
7
7
|
uri?: string;
|
|
8
8
|
stackClient?: object;
|
|
9
9
|
warningForCustomHandlers?: boolean;
|
|
@@ -25,11 +25,11 @@ export type ClientOptions = {
|
|
|
25
25
|
/**
|
|
26
26
|
* - Metadata about the application that will be used in ensureCozyMetadata
|
|
27
27
|
*/
|
|
28
|
-
appMetadata?: AppMetadata;
|
|
28
|
+
appMetadata?: import("./types").AppMetadata;
|
|
29
29
|
/**
|
|
30
30
|
* - Capabilities sent by the stack
|
|
31
31
|
*/
|
|
32
|
-
capabilities?: ClientCapabilities;
|
|
32
|
+
capabilities?: import("./types").ClientCapabilities;
|
|
33
33
|
/**
|
|
34
34
|
* - 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.
|
|
35
35
|
*/
|
|
@@ -40,7 +40,7 @@ export type ClientOptions = {
|
|
|
40
40
|
* @property {object} [client]
|
|
41
41
|
* @property {object} [link]
|
|
42
42
|
* @property {object} [links]
|
|
43
|
-
* @property {Token} [token]
|
|
43
|
+
* @property {import("./types").Token} [token]
|
|
44
44
|
* @property {string} [uri]
|
|
45
45
|
* @property {object} [stackClient]
|
|
46
46
|
* @property {boolean} [warningForCustomHandlers]
|
|
@@ -49,11 +49,11 @@ export type ClientOptions = {
|
|
|
49
49
|
* @property {object} [oauth]
|
|
50
50
|
* @property {Function} [onTokenRefresh]
|
|
51
51
|
* @property {Function} [onError] - Default callback if a query is errored
|
|
52
|
-
* @property {Link} [link] - Backward compatibility
|
|
53
|
-
* @property {Array<Link>} [links] - List of links
|
|
52
|
+
* @property {import("./types").Link} [link] - Backward compatibility
|
|
53
|
+
* @property {Array<import("./types").Link>} [links] - List of links
|
|
54
54
|
* @property {object} [schema] - Schema description for each doctypes
|
|
55
|
-
* @property {AppMetadata} [appMetadata] - Metadata about the application that will be used in ensureCozyMetadata
|
|
56
|
-
* @property {ClientCapabilities} [capabilities] - Capabilities sent by the stack
|
|
55
|
+
* @property {import("./types").AppMetadata} [appMetadata] - Metadata about the application that will be used in ensureCozyMetadata
|
|
56
|
+
* @property {import("./types").ClientCapabilities} [capabilities] - Capabilities sent by the stack
|
|
57
57
|
* @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.
|
|
58
58
|
*/
|
|
59
59
|
/**
|
|
@@ -69,31 +69,31 @@ declare class CozyClient {
|
|
|
69
69
|
* To help with the transition from cozy-client-js to cozy-client, it is possible to instantiate
|
|
70
70
|
* a client with a cookie-based instance of cozy-client-js.
|
|
71
71
|
*
|
|
72
|
-
* @param {OldCozyClient} oldClient - An instance of the deprecated cozy-client
|
|
72
|
+
* @param {import("./types").OldCozyClient} oldClient - An instance of the deprecated cozy-client
|
|
73
73
|
* @param {object} options - CozyStackClient options
|
|
74
74
|
* @returns {CozyClient}
|
|
75
75
|
*/
|
|
76
|
-
static fromOldClient(oldClient: OldCozyClient, options: object): CozyClient;
|
|
76
|
+
static fromOldClient(oldClient: import("./types").OldCozyClient, options: object): CozyClient;
|
|
77
77
|
/**
|
|
78
78
|
* To help with the transition from cozy-client-js to cozy-client, it is possible to instantiate
|
|
79
79
|
* a client with an OAuth-based instance of cozy-client-js.
|
|
80
80
|
*
|
|
81
81
|
* Warning: unlike other instantiators, this one needs to be awaited.
|
|
82
82
|
*
|
|
83
|
-
* @param {OldCozyClient} oldClient - An OAuth instance of the deprecated cozy-client
|
|
83
|
+
* @param {import("./types").OldCozyClient} oldClient - An OAuth instance of the deprecated cozy-client
|
|
84
84
|
* @param {object} options - CozyStackClient options
|
|
85
85
|
* @returns {Promise<CozyClient>} An instance of a client, configured from the old client
|
|
86
86
|
*/
|
|
87
|
-
static fromOldOAuthClient(oldClient: OldCozyClient, options: object): Promise<CozyClient>;
|
|
87
|
+
static fromOldOAuthClient(oldClient: import("./types").OldCozyClient, options: object): Promise<CozyClient>;
|
|
88
88
|
/**
|
|
89
89
|
* In konnector/service context, CozyClient can be instantiated from
|
|
90
90
|
* environment variables
|
|
91
91
|
*
|
|
92
|
-
* @param {NodeEnvironment} [envArg] - The environment
|
|
92
|
+
* @param {import("./types").NodeEnvironment} [envArg] - The environment
|
|
93
93
|
* @param {object} options - Options
|
|
94
94
|
* @returns {CozyClient}
|
|
95
95
|
*/
|
|
96
|
-
static fromEnv(envArg?: NodeEnvironment, options?: object): CozyClient;
|
|
96
|
+
static fromEnv(envArg?: import("./types").NodeEnvironment, options?: object): CozyClient;
|
|
97
97
|
/**
|
|
98
98
|
* When used from an app, CozyClient can be instantiated from the data injected by the stack in
|
|
99
99
|
* the DOM.
|
|
@@ -149,7 +149,7 @@ declare class CozyClient {
|
|
|
149
149
|
loginPromise: Promise<void>;
|
|
150
150
|
options: {
|
|
151
151
|
client?: object;
|
|
152
|
-
token?: Token;
|
|
152
|
+
token?: import("./types").Token;
|
|
153
153
|
uri?: string;
|
|
154
154
|
stackClient?: object;
|
|
155
155
|
warningForCustomHandlers?: boolean;
|
|
@@ -180,9 +180,9 @@ declare class CozyClient {
|
|
|
180
180
|
chain: any;
|
|
181
181
|
schema: Schema;
|
|
182
182
|
/**
|
|
183
|
-
* @type {ClientCapabilities}
|
|
183
|
+
* @type {import("./types").ClientCapabilities}
|
|
184
184
|
*/
|
|
185
|
-
capabilities: ClientCapabilities;
|
|
185
|
+
capabilities: import("./types").ClientCapabilities;
|
|
186
186
|
plugins: {};
|
|
187
187
|
/**
|
|
188
188
|
* Holds in-flight promises for deduplication purpose
|
|
@@ -294,9 +294,9 @@ declare class CozyClient {
|
|
|
294
294
|
* a [DocumentCollection]{@link https://docs.cozy.io/en/cozy-client/api/cozy-stack-client/#DocumentCollection} instance.
|
|
295
295
|
*
|
|
296
296
|
* @param {string} doctype The collection doctype.
|
|
297
|
-
* @returns {DocumentCollection} Collection corresponding to the doctype
|
|
297
|
+
* @returns {import("./types").DocumentCollection} Collection corresponding to the doctype
|
|
298
298
|
*/
|
|
299
|
-
collection(doctype: string): DocumentCollection;
|
|
299
|
+
collection(doctype: string): import("./types").DocumentCollection;
|
|
300
300
|
fetch(method: any, path: any, body: any, options?: {}): any;
|
|
301
301
|
all(doctype: any): QueryDefinition;
|
|
302
302
|
find(doctype: any, selector?: any): QueryDefinition;
|
|
@@ -306,7 +306,7 @@ declare class CozyClient {
|
|
|
306
306
|
*
|
|
307
307
|
* @param {string} type - Doctype of the document
|
|
308
308
|
* @param {object} doc - Document to save
|
|
309
|
-
* @param {ReferenceMap} [references] - References are a special kind of relationship
|
|
309
|
+
* @param {import("./types").ReferenceMap} [references] - References are a special kind of relationship
|
|
310
310
|
* that is not stored inside the referencer document, they are used for example between a photo
|
|
311
311
|
* and its album. You should not need to use it normally.
|
|
312
312
|
* @param {object} options - Mutation options
|
|
@@ -325,7 +325,7 @@ declare class CozyClient {
|
|
|
325
325
|
*
|
|
326
326
|
* @returns {Promise}
|
|
327
327
|
*/
|
|
328
|
-
create(type: string, doc: object, references?: ReferenceMap, options?: object): Promise<any>;
|
|
328
|
+
create(type: string, doc: object, references?: import("./types").ReferenceMap, options?: object): Promise<any>;
|
|
329
329
|
validate(document: any): Promise<{}>;
|
|
330
330
|
/**
|
|
331
331
|
* Create or update a document on the server
|
|
@@ -340,34 +340,34 @@ declare class CozyClient {
|
|
|
340
340
|
* - Can only be called with documents from the same doctype
|
|
341
341
|
* - Does not support automatic creation of references
|
|
342
342
|
*
|
|
343
|
-
* @param {CozyClientDocument[]} docs - Documents from the same doctype
|
|
343
|
+
* @param {import("./types").CozyClientDocument[]} docs - Documents from the same doctype
|
|
344
344
|
* @param {Object} mutationOptions - Mutation Options
|
|
345
345
|
* @param {string} [mutationOptions.as] - Mutation id
|
|
346
346
|
* @param {Function} [mutationOptions.update] - Function to update the document
|
|
347
347
|
* @param {Function} [mutationOptions.updateQueries] - Function to update queries
|
|
348
348
|
* @returns {Promise<void>}
|
|
349
349
|
*/
|
|
350
|
-
saveAll(docs: CozyClientDocument[], mutationOptions?: {
|
|
350
|
+
saveAll(docs: import("./types").CozyClientDocument[], mutationOptions?: {
|
|
351
351
|
as?: string;
|
|
352
352
|
update?: Function;
|
|
353
353
|
updateQueries?: Function;
|
|
354
354
|
}): Promise<void>;
|
|
355
355
|
/**
|
|
356
|
-
* @param {CozyClientDocument} document - Document that will be saved
|
|
356
|
+
* @param {import("./types").CozyClientDocument} document - Document that will be saved
|
|
357
357
|
* @param {object} [options={event: DOC_CREATION}] - Event
|
|
358
358
|
* @param {string} [options.event] - Mutation type
|
|
359
|
-
* @returns {CozyClientDocument}
|
|
359
|
+
* @returns {import("./types").CozyClientDocument}
|
|
360
360
|
*/
|
|
361
|
-
ensureCozyMetadata(document: CozyClientDocument, options?: {
|
|
361
|
+
ensureCozyMetadata(document: import("./types").CozyClientDocument, options?: {
|
|
362
362
|
event?: string;
|
|
363
|
-
}): CozyClientDocument;
|
|
363
|
+
}): import("./types").CozyClientDocument;
|
|
364
364
|
/**
|
|
365
365
|
* Dehydrates and adds metadata before saving a document
|
|
366
366
|
*
|
|
367
|
-
* @param {CozyClientDocument} doc - Document that will be saved
|
|
368
|
-
* @returns {CozyClientDocument}
|
|
367
|
+
* @param {import("./types").CozyClientDocument} doc - Document that will be saved
|
|
368
|
+
* @returns {import("./types").CozyClientDocument}
|
|
369
369
|
*/
|
|
370
|
-
prepareDocumentForSave(doc: CozyClientDocument): CozyClientDocument;
|
|
370
|
+
prepareDocumentForSave(doc: import("./types").CozyClientDocument): import("./types").CozyClientDocument;
|
|
371
371
|
/**
|
|
372
372
|
* Creates a list of mutations to execute to create a document and its relationships.
|
|
373
373
|
*
|
|
@@ -382,31 +382,31 @@ declare class CozyClient {
|
|
|
382
382
|
* ```
|
|
383
383
|
*
|
|
384
384
|
*
|
|
385
|
-
* @param {CozyClientDocument} document - Document to create
|
|
386
|
-
* @param {ReferenceMap} [referencesByName] - References to the created document. The
|
|
385
|
+
* @param {import("./types").CozyClientDocument} document - Document to create
|
|
386
|
+
* @param {import("./types").ReferenceMap} [referencesByName] - References to the created document. The
|
|
387
387
|
* relationship class associated to each reference list should support references, otherwise this
|
|
388
388
|
* method will throw.
|
|
389
389
|
*
|
|
390
|
-
* @returns {Mutation[]|Mutation} One or more mutation to execute
|
|
390
|
+
* @returns {import("./types").Mutation[]|import("./types").Mutation} One or more mutation to execute
|
|
391
391
|
*/
|
|
392
|
-
getDocumentSavePlan(document: CozyClientDocument, referencesByName?: ReferenceMap): Mutation[] | Mutation;
|
|
392
|
+
getDocumentSavePlan(document: import("./types").CozyClientDocument, referencesByName?: import("./types").ReferenceMap): import("./types").Mutation[] | import("./types").Mutation;
|
|
393
393
|
triggerHook(name: any, document: any): void;
|
|
394
394
|
/**
|
|
395
395
|
* Destroys a document. {before,after}:destroy hooks will be fired.
|
|
396
396
|
*
|
|
397
|
-
* @param {CozyClientDocument} document - Document to be deleted
|
|
398
|
-
* @returns {Promise<CozyClientDocument>} The document that has been deleted
|
|
397
|
+
* @param {import("./types").CozyClientDocument} document - Document to be deleted
|
|
398
|
+
* @returns {Promise<import("./types").CozyClientDocument>} The document that has been deleted
|
|
399
399
|
*/
|
|
400
|
-
destroy(document: CozyClientDocument, mutationOptions?: {}): Promise<CozyClientDocument>;
|
|
400
|
+
destroy(document: import("./types").CozyClientDocument, mutationOptions?: {}): Promise<import("./types").CozyClientDocument>;
|
|
401
401
|
upload(file: any, dirPath: any, mutationOptions?: {}): Promise<any>;
|
|
402
402
|
/**
|
|
403
403
|
* Makes sure that the query exists in the store
|
|
404
404
|
*
|
|
405
405
|
* @param {string} queryId - Id of the query
|
|
406
406
|
* @param {QueryDefinition} queryDefinition - Definition of the query
|
|
407
|
-
* @param {QueryOptions} [options] - Additional options
|
|
407
|
+
* @param {import("./types").QueryOptions} [options] - Additional options
|
|
408
408
|
*/
|
|
409
|
-
ensureQueryExists(queryId: string, queryDefinition: QueryDefinition, options?: QueryOptions): void;
|
|
409
|
+
ensureQueryExists(queryId: string, queryDefinition: QueryDefinition, options?: import("./types").QueryOptions): void;
|
|
410
410
|
/**
|
|
411
411
|
* Executes a query and returns its results.
|
|
412
412
|
*
|
|
@@ -415,20 +415,20 @@ declare class CozyClient {
|
|
|
415
415
|
* executes its query when mounted if no fetch policy has been indicated.
|
|
416
416
|
*
|
|
417
417
|
* @param {QueryDefinition} queryDefinition - Definition that will be executed
|
|
418
|
-
* @param {QueryOptions} [options] - Options
|
|
419
|
-
* @returns {Promise<QueryResult>}
|
|
418
|
+
* @param {import("./types").QueryOptions} [options] - Options
|
|
419
|
+
* @returns {Promise<import("./types").QueryResult>}
|
|
420
420
|
*/
|
|
421
|
-
query(queryDefinition: QueryDefinition, { update, ...options }?: QueryOptions): Promise<QueryResult>;
|
|
421
|
+
query(queryDefinition: QueryDefinition, { update, ...options }?: import("./types").QueryOptions): Promise<import("./types").QueryResult>;
|
|
422
422
|
/**
|
|
423
423
|
* Will fetch all documents for a `queryDefinition`, automatically fetching more
|
|
424
424
|
* documents if the total of documents is superior to the pagination limit. Can
|
|
425
425
|
* result in a lot of network requests.
|
|
426
426
|
*
|
|
427
427
|
* @param {QueryDefinition} queryDefinition - Definition to be executed
|
|
428
|
-
* @param {QueryOptions} [options] - Options
|
|
429
|
-
* @returns {Promise<QueryResult>} All documents matching the query
|
|
428
|
+
* @param {import("./types").QueryOptions} [options] - Options
|
|
429
|
+
* @returns {Promise<import("./types").QueryResult>} All documents matching the query
|
|
430
430
|
*/
|
|
431
|
-
queryAll(queryDefinition: QueryDefinition, options?: QueryOptions): Promise<QueryResult>;
|
|
431
|
+
queryAll(queryDefinition: QueryDefinition, options?: import("./types").QueryOptions): Promise<import("./types").QueryResult>;
|
|
432
432
|
watchQuery(...args: any[]): ObservableQuery;
|
|
433
433
|
makeObservableQuery(queryDefinition: any, options?: {}): ObservableQuery;
|
|
434
434
|
/**
|
|
@@ -451,7 +451,7 @@ declare class CozyClient {
|
|
|
451
451
|
*
|
|
452
452
|
* @private
|
|
453
453
|
* @param {QueryDefinition} definition QueryDefinition to be executed
|
|
454
|
-
* @returns {Promise<ClientResponse>}
|
|
454
|
+
* @returns {Promise<import("./types").ClientResponse>}
|
|
455
455
|
*/
|
|
456
456
|
private requestQuery;
|
|
457
457
|
/**
|
|
@@ -473,21 +473,21 @@ declare class CozyClient {
|
|
|
473
473
|
* Instead, the relationships will have null documents.
|
|
474
474
|
*
|
|
475
475
|
* @param {string} doctype - Doctype of the documents being hydrated
|
|
476
|
-
* @param {Array<CozyClientDocument>} documents - Documents to be hydrated
|
|
477
|
-
* @returns {Array<HydratedDocument>}
|
|
476
|
+
* @param {Array<import("./types").CozyClientDocument>} documents - Documents to be hydrated
|
|
477
|
+
* @returns {Array<import("./types").HydratedDocument>}
|
|
478
478
|
*/
|
|
479
|
-
hydrateDocuments(doctype: string, documents: Array<CozyClientDocument>): Array<HydratedDocument>;
|
|
479
|
+
hydrateDocuments(doctype: string, documents: Array<import("./types").CozyClientDocument>): Array<import("./types").HydratedDocument>;
|
|
480
480
|
/**
|
|
481
481
|
* Resolves relationships on a document.
|
|
482
482
|
*
|
|
483
483
|
* The original document is kept in the target attribute of
|
|
484
484
|
* the relationship
|
|
485
485
|
*
|
|
486
|
-
* @param {CozyClientDocument} document - for which relationships must be resolved
|
|
486
|
+
* @param {import("./types").CozyClientDocument} document - for which relationships must be resolved
|
|
487
487
|
* @param {Schema} [schemaArg] - Optional
|
|
488
|
-
* @returns {HydratedDocument}
|
|
488
|
+
* @returns {import("./types").HydratedDocument}
|
|
489
489
|
*/
|
|
490
|
-
hydrateDocument(document: CozyClientDocument, schemaArg?: Schema): HydratedDocument;
|
|
490
|
+
hydrateDocument(document: import("./types").CozyClientDocument, schemaArg?: Schema): import("./types").HydratedDocument;
|
|
491
491
|
hydrateRelationships(document: any, schemaRelationships: any): {
|
|
492
492
|
[x: string]: any;
|
|
493
493
|
};
|
|
@@ -529,18 +529,18 @@ declare class CozyClient {
|
|
|
529
529
|
*
|
|
530
530
|
* @param {string} type - Doctype of the collection
|
|
531
531
|
*
|
|
532
|
-
* @returns {CozyClientDocument[]} Array of documents or null if the collection does not exist.
|
|
532
|
+
* @returns {import("./types").CozyClientDocument[]} Array of documents or null if the collection does not exist.
|
|
533
533
|
*/
|
|
534
|
-
getCollectionFromState(type: string): CozyClientDocument[];
|
|
534
|
+
getCollectionFromState(type: string): import("./types").CozyClientDocument[];
|
|
535
535
|
/**
|
|
536
536
|
* Get a document from the internal store.
|
|
537
537
|
*
|
|
538
538
|
* @param {string} type - Doctype of the document
|
|
539
539
|
* @param {string} id - Id of the document
|
|
540
540
|
*
|
|
541
|
-
* @returns {CozyClientDocument} Document or null if the object does not exist.
|
|
541
|
+
* @returns {import("./types").CozyClientDocument} Document or null if the object does not exist.
|
|
542
542
|
*/
|
|
543
|
-
getDocumentFromState(type: string, id: string): CozyClientDocument;
|
|
543
|
+
getDocumentFromState(type: string, id: string): import("./types").CozyClientDocument;
|
|
544
544
|
/**
|
|
545
545
|
* Get a query from the internal store.
|
|
546
546
|
*
|
|
@@ -551,12 +551,12 @@ declare class CozyClient {
|
|
|
551
551
|
* a single doc instead of an array for single doc queries. Defaults to false for backward
|
|
552
552
|
* compatibility but will be set to true in the future.
|
|
553
553
|
*
|
|
554
|
-
* @returns {QueryState} - Query state or null if it does not exist.
|
|
554
|
+
* @returns {import("./types").QueryState} - Query state or null if it does not exist.
|
|
555
555
|
*/
|
|
556
556
|
getQueryFromState(id: string, options?: {
|
|
557
557
|
hydrated?: boolean;
|
|
558
558
|
singleDocData?: object;
|
|
559
|
-
}): QueryState;
|
|
559
|
+
}): import("./types").QueryState;
|
|
560
560
|
/**
|
|
561
561
|
* Executes a query and returns the results from internal store.
|
|
562
562
|
*
|
|
@@ -565,13 +565,13 @@ declare class CozyClient {
|
|
|
565
565
|
*
|
|
566
566
|
* @param {object} query - Query with definition and options
|
|
567
567
|
* @param {QueryDefinition} query.definition - Query Definition
|
|
568
|
-
* @param {QueryOptions} query.options - Query Options
|
|
569
|
-
* @returns {Promise<QueryState>} Query state
|
|
568
|
+
* @param {import("./types").QueryOptions} query.options - Query Options
|
|
569
|
+
* @returns {Promise<import("./types").QueryState>} Query state
|
|
570
570
|
*/
|
|
571
571
|
fetchQueryAndGetFromState: ({ definition, options }: {
|
|
572
572
|
definition: QueryDefinition;
|
|
573
|
-
options: QueryOptions;
|
|
574
|
-
}) => Promise<QueryState>;
|
|
573
|
+
options: import("./types").QueryOptions;
|
|
574
|
+
}) => Promise<import("./types").QueryState>;
|
|
575
575
|
/**
|
|
576
576
|
* Performs a complete OAuth flow using a Cordova webview
|
|
577
577
|
* or React Native WebView for auth.
|
|
@@ -585,10 +585,10 @@ declare class CozyClient {
|
|
|
585
585
|
/**
|
|
586
586
|
* Performs a complete OAuth flow, including updating the internal token at the end.
|
|
587
587
|
*
|
|
588
|
-
* @param {OpenURLCallback} openURLCallback Receives the URL to present to the user as a parameter, and should return a promise that resolves with the URL the user was redirected to after accepting the permissions.
|
|
588
|
+
* @param {import("./types").OpenURLCallback} openURLCallback Receives the URL to present to the user as a parameter, and should return a promise that resolves with the URL the user was redirected to after accepting the permissions.
|
|
589
589
|
* @returns {Promise<object>} Contains the fetched token and the client information. These should be stored and used to restore the client.
|
|
590
590
|
*/
|
|
591
|
-
startOAuthFlow(openURLCallback: OpenURLCallback): Promise<object>;
|
|
591
|
+
startOAuthFlow(openURLCallback: import("./types").OpenURLCallback): Promise<object>;
|
|
592
592
|
/**
|
|
593
593
|
* Perform the Flagship certification process for verifying that the current running app is a genuine Cozy application
|
|
594
594
|
*
|
|
@@ -601,15 +601,15 @@ declare class CozyClient {
|
|
|
601
601
|
* It is possible to skip the session creation process (when using an in-app browser) by passing a sessionCode (see https://docs.cozy.io/en/cozy-stack/auth/#post-authsession_code)
|
|
602
602
|
*
|
|
603
603
|
* @param {object} [options] - Authorization options
|
|
604
|
-
* @param {OpenURLCallback} [options.openURLCallback] - Receives the URL to present to the user as a parameter, and should return a promise that resolves with the URL the user was redirected to after accepting the permissions.
|
|
605
|
-
* @param {SessionCode} [options.sessionCode] - session code than can be added to the authorization URL to automatically create the session.
|
|
606
|
-
* @param {PKCECodes} [options.pkceCodes] - code verifier and a code challenge that should be used in the PKCE verification process.
|
|
604
|
+
* @param {import("./types").OpenURLCallback} [options.openURLCallback] - Receives the URL to present to the user as a parameter, and should return a promise that resolves with the URL the user was redirected to after accepting the permissions.
|
|
605
|
+
* @param {import("./types").SessionCode} [options.sessionCode] - session code than can be added to the authorization URL to automatically create the session.
|
|
606
|
+
* @param {import("./types").PKCECodes} [options.pkceCodes] - code verifier and a code challenge that should be used in the PKCE verification process.
|
|
607
607
|
* @returns {Promise<object>} Contains the fetched token and the client information. These should be stored and used to restore the client.
|
|
608
608
|
*/
|
|
609
609
|
authorize({ openURLCallback, sessionCode, pkceCodes }?: {
|
|
610
|
-
openURLCallback?: OpenURLCallback;
|
|
611
|
-
sessionCode?: SessionCode;
|
|
612
|
-
pkceCodes?: PKCECodes;
|
|
610
|
+
openURLCallback?: import("./types").OpenURLCallback;
|
|
611
|
+
sessionCode?: import("./types").SessionCode;
|
|
612
|
+
pkceCodes?: import("./types").PKCECodes;
|
|
613
613
|
}): Promise<object>;
|
|
614
614
|
/**
|
|
615
615
|
* Renews the token if, for instance, new permissions are required or token
|
|
@@ -636,11 +636,11 @@ declare class CozyClient {
|
|
|
636
636
|
* client.setStore(store)
|
|
637
637
|
* ```
|
|
638
638
|
*
|
|
639
|
-
* @param {ReduxStore} store - A redux store
|
|
639
|
+
* @param {import("./types").ReduxStore} store - A redux store
|
|
640
640
|
* @param {object} [options] - Options
|
|
641
641
|
* @param {boolean} [options.force] - Will deactivate throwing when client's store already exists
|
|
642
642
|
*/
|
|
643
|
-
setStore(store: ReduxStore, { force }?: {
|
|
643
|
+
setStore(store: import("./types").ReduxStore, { force }?: {
|
|
644
644
|
force?: boolean;
|
|
645
645
|
}): void;
|
|
646
646
|
store: any;
|
|
@@ -667,7 +667,7 @@ declare class CozyClient {
|
|
|
667
667
|
queries: {};
|
|
668
668
|
}, action: any) => {
|
|
669
669
|
documents: any;
|
|
670
|
-
queries: Record<string, QueryState>;
|
|
670
|
+
queries: Record<string, import("./types").QueryState>;
|
|
671
671
|
};
|
|
672
672
|
dispatch(action: any): any;
|
|
673
673
|
/**
|
|
@@ -710,35 +710,18 @@ declare class CozyClient {
|
|
|
710
710
|
toJSON(): SnapshotClient;
|
|
711
711
|
/**
|
|
712
712
|
*
|
|
713
|
-
* @param {AppMetadata} newAppMetadata AppMetadata to update
|
|
713
|
+
* @param {import("./types").AppMetadata} newAppMetadata AppMetadata to update
|
|
714
714
|
*/
|
|
715
|
-
setAppMetadata(newAppMetadata: AppMetadata): void;
|
|
715
|
+
setAppMetadata(newAppMetadata: import("./types").AppMetadata): void;
|
|
716
716
|
}
|
|
717
717
|
declare namespace CozyClient {
|
|
718
718
|
export const hooks: {};
|
|
719
719
|
export { fetchPolicies };
|
|
720
720
|
export const version: string;
|
|
721
721
|
}
|
|
722
|
-
import { Token } from "./types";
|
|
723
|
-
import { AppMetadata } from "./types";
|
|
724
|
-
import { ClientCapabilities } from "./types";
|
|
725
722
|
import { QueryIDGenerator } from "./store/queries";
|
|
726
723
|
import Schema from "./Schema";
|
|
727
|
-
import { DocumentCollection } from "./types";
|
|
728
724
|
import { QueryDefinition } from "./queries/dsl";
|
|
729
|
-
import { ReferenceMap } from "./types";
|
|
730
|
-
import { CozyClientDocument } from "./types";
|
|
731
|
-
import { Mutation } from "./types";
|
|
732
|
-
import { QueryOptions } from "./types";
|
|
733
|
-
import { QueryResult } from "./types";
|
|
734
725
|
import ObservableQuery from "./ObservableQuery";
|
|
735
|
-
import { HydratedDocument } from "./types";
|
|
736
|
-
import { QueryState } from "./types";
|
|
737
|
-
import { OpenURLCallback } from "./types";
|
|
738
|
-
import { SessionCode } from "./types";
|
|
739
|
-
import { PKCECodes } from "./types";
|
|
740
|
-
import { ReduxStore } from "./types";
|
|
741
726
|
import { CozyClient as SnapshotClient } from "./testing/snapshots";
|
|
742
|
-
import { OldCozyClient } from "./types";
|
|
743
|
-
import { NodeEnvironment } from "./types";
|
|
744
727
|
import fetchPolicies from "./policies";
|
package/types/StackLink.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export function transformBulkDocsResponse(bulkResponse: CouchDBBulkResult[], originalDocuments: CozyClientDocument[]): {
|
|
2
|
-
data: CozyClientDocument[];
|
|
1
|
+
export function transformBulkDocsResponse(bulkResponse: import("./types").CouchDBBulkResult[], originalDocuments: import("./types").CozyClientDocument[]): {
|
|
2
|
+
data: import("./types").CozyClientDocument[];
|
|
3
3
|
};
|
|
4
4
|
/**
|
|
5
5
|
* Transfers queries and mutations to a remote stack
|
|
@@ -20,13 +20,10 @@ export default class StackLink extends CozyLink {
|
|
|
20
20
|
/**
|
|
21
21
|
*
|
|
22
22
|
* @param {QueryDefinition} query - Query to execute
|
|
23
|
-
* @returns {Promise<ClientResponse>}
|
|
23
|
+
* @returns {Promise<import("./types").ClientResponse>}
|
|
24
24
|
*/
|
|
25
|
-
executeQuery(query: QueryDefinition): Promise<ClientResponse>;
|
|
25
|
+
executeQuery(query: QueryDefinition): Promise<import("./types").ClientResponse>;
|
|
26
26
|
executeMutation(mutation: any, result: any, forward: any): Promise<any>;
|
|
27
27
|
}
|
|
28
|
-
import { CouchDBBulkResult } from "./types";
|
|
29
|
-
import { CozyClientDocument } from "./types";
|
|
30
28
|
import CozyLink from "./CozyLink";
|
|
31
29
|
import { QueryDefinition } from "./queries/dsl";
|
|
32
|
-
import { ClientResponse } from "./types";
|
|
@@ -75,13 +75,13 @@ declare class Association {
|
|
|
75
75
|
/**
|
|
76
76
|
* Derived `Association`s need to implement this method.
|
|
77
77
|
*
|
|
78
|
-
* @param {CozyClientDocument} document - Document to query
|
|
78
|
+
* @param {import("../types").CozyClientDocument} document - Document to query
|
|
79
79
|
* @param {object} client - The CozyClient instance
|
|
80
80
|
* @param {Association} assoc - Association containing info on how to build the query to fetch related documents
|
|
81
81
|
*
|
|
82
|
-
* @returns {CozyClientDocument | QueryDefinition }
|
|
82
|
+
* @returns {import("../types").CozyClientDocument | QueryDefinition }
|
|
83
83
|
*/
|
|
84
|
-
static query(document: CozyClientDocument, client: object, assoc: Association): CozyClientDocument | QueryDefinition;
|
|
84
|
+
static query(document: import("../types").CozyClientDocument, client: object, assoc: Association): import("../types").CozyClientDocument | QueryDefinition;
|
|
85
85
|
/**
|
|
86
86
|
* @param {object} target - Original object containing raw data
|
|
87
87
|
* @param {string} name - Attribute under which the association is stored
|
|
@@ -221,5 +221,4 @@ declare class Association {
|
|
|
221
221
|
*/
|
|
222
222
|
get data(): any;
|
|
223
223
|
}
|
|
224
|
-
import { CozyClientDocument } from "../types";
|
|
225
224
|
import { QueryDefinition } from "../queries/dsl";
|
|
@@ -90,17 +90,17 @@ declare class HasMany extends Association {
|
|
|
90
90
|
/**
|
|
91
91
|
* Add the relationships to the target document
|
|
92
92
|
*
|
|
93
|
-
* @param {CozyClientDocument[]} docsArg - Documents to add as relationships
|
|
94
|
-
* @returns {CozyClientDocument} The saved target document
|
|
93
|
+
* @param {import("../types").CozyClientDocument[]} docsArg - Documents to add as relationships
|
|
94
|
+
* @returns {import("../types").CozyClientDocument} The saved target document
|
|
95
95
|
*/
|
|
96
|
-
add(docsArg: CozyClientDocument[]): CozyClientDocument;
|
|
96
|
+
add(docsArg: import("../types").CozyClientDocument[]): import("../types").CozyClientDocument;
|
|
97
97
|
/**
|
|
98
98
|
* Remove the relationships from the target document
|
|
99
99
|
*
|
|
100
|
-
* @param {CozyClientDocument[]} docsArg - Documents to remove as relationships
|
|
101
|
-
* @returns {CozyClientDocument} The saved target document
|
|
100
|
+
* @param {import("../types").CozyClientDocument[]} docsArg - Documents to remove as relationships
|
|
101
|
+
* @returns {import("../types").CozyClientDocument} The saved target document
|
|
102
102
|
*/
|
|
103
|
-
remove(docsArg: CozyClientDocument[]): CozyClientDocument;
|
|
103
|
+
remove(docsArg: import("../types").CozyClientDocument[]): import("../types").CozyClientDocument;
|
|
104
104
|
/**
|
|
105
105
|
* Update target document with relationships
|
|
106
106
|
*
|
|
@@ -132,4 +132,3 @@ declare class HasMany extends Association {
|
|
|
132
132
|
dehydrate(doc: any): any;
|
|
133
133
|
}
|
|
134
134
|
import Association from "./Association";
|
|
135
|
-
import { CozyClientDocument } from "../types";
|
|
@@ -9,20 +9,19 @@ export default class HasOne extends Association {
|
|
|
9
9
|
/**
|
|
10
10
|
* Add the relationship to the target document
|
|
11
11
|
*
|
|
12
|
-
* @param {CozyClientDocument} doc - Document to add as a relationship
|
|
13
|
-
* @returns {CozyClientDocument} The saved target document
|
|
12
|
+
* @param {import("../types").CozyClientDocument} doc - Document to add as a relationship
|
|
13
|
+
* @returns {import("../types").CozyClientDocument} The saved target document
|
|
14
14
|
*/
|
|
15
|
-
add(doc: CozyClientDocument): CozyClientDocument;
|
|
15
|
+
add(doc: import("../types").CozyClientDocument): import("../types").CozyClientDocument;
|
|
16
16
|
/**
|
|
17
17
|
* Remove the relationship from the target document
|
|
18
18
|
*
|
|
19
|
-
* @returns {CozyClientDocument} The saved target document
|
|
19
|
+
* @returns {import("../types").CozyClientDocument} The saved target document
|
|
20
20
|
*/
|
|
21
|
-
remove(): CozyClientDocument;
|
|
21
|
+
remove(): import("../types").CozyClientDocument;
|
|
22
22
|
setRelationship(doc: any): void;
|
|
23
23
|
set(doc: any): void;
|
|
24
24
|
unset(): void;
|
|
25
25
|
dehydrate(doc: any): any;
|
|
26
26
|
}
|
|
27
27
|
import Association from "./Association";
|
|
28
|
-
import { CozyClientDocument } from "../types";
|
|
@@ -7,10 +7,7 @@ export function create(target: any, { name, type, doctype }: {
|
|
|
7
7
|
type: any;
|
|
8
8
|
doctype: any;
|
|
9
9
|
}, accessors: any): any;
|
|
10
|
-
export function isReferencedBy(file: IOCozyFile, referencedBy: Doctype): boolean;
|
|
11
|
-
export function isReferencedById(file: IOCozyFile, referencedBy: Doctype, referencedId: string): boolean;
|
|
12
|
-
export function getReferencedBy(file: IOCozyFile, referencedBy: Doctype): Reference[];
|
|
13
|
-
export function getReferencedById(file: IOCozyFile, referencedBy: Doctype, referencedId: string): Reference[];
|
|
14
|
-
import { IOCozyFile } from "../types";
|
|
15
|
-
import { Doctype } from "../types";
|
|
16
|
-
import { Reference } from "../types";
|
|
10
|
+
export function isReferencedBy(file: import("../types").IOCozyFile, referencedBy: import("../types").Doctype): boolean;
|
|
11
|
+
export function isReferencedById(file: import("../types").IOCozyFile, referencedBy: import("../types").Doctype, referencedId: string): boolean;
|
|
12
|
+
export function getReferencedBy(file: import("../types").IOCozyFile, referencedBy: import("../types").Doctype): import("../types").Reference[];
|
|
13
|
+
export function getReferencedById(file: import("../types").IOCozyFile, referencedBy: import("../types").Doctype, referencedId: string): import("../types").Reference[];
|
package/types/errors.d.ts
CHANGED
|
@@ -2,12 +2,12 @@ export class BulkEditError extends Error {
|
|
|
2
2
|
/**
|
|
3
3
|
* Indicates that a bulk edit has (potentially partially) failed
|
|
4
4
|
*
|
|
5
|
-
* @param {CouchDBBulkResult[]} bulkResponse - CouchDB Bulk response
|
|
6
|
-
* @param {CozyClientDocument[]} updatedDocs - Docs with updated _id and _rev
|
|
5
|
+
* @param {import("./types").CouchDBBulkResult[]} bulkResponse - CouchDB Bulk response
|
|
6
|
+
* @param {import("./types").CozyClientDocument[]} updatedDocs - Docs with updated _id and _rev
|
|
7
7
|
*/
|
|
8
|
-
constructor(bulkResponse: CouchDBBulkResult[], updatedDocs: CozyClientDocument[]);
|
|
8
|
+
constructor(bulkResponse: import("./types").CouchDBBulkResult[], updatedDocs: import("./types").CozyClientDocument[]);
|
|
9
9
|
results: {
|
|
10
|
-
doc: CozyClientDocument;
|
|
10
|
+
doc: import("./types").CozyClientDocument;
|
|
11
11
|
ok: boolean;
|
|
12
12
|
id: string;
|
|
13
13
|
rev: string;
|
|
@@ -23,17 +23,15 @@ export class BulkEditError extends Error {
|
|
|
23
23
|
/**
|
|
24
24
|
* Get documents that have been correctly updated
|
|
25
25
|
*
|
|
26
|
-
* @returns {CozyClientDocument[]}
|
|
26
|
+
* @returns {import("./types").CozyClientDocument[]}
|
|
27
27
|
*/
|
|
28
|
-
getUpdatedDocuments(): CozyClientDocument[];
|
|
28
|
+
getUpdatedDocuments(): import("./types").CozyClientDocument[];
|
|
29
29
|
/**
|
|
30
30
|
* Get bulk errors results
|
|
31
31
|
*
|
|
32
|
-
* @returns {Array<CouchDBBulkResult & { doc: CozyClientDocument }>}
|
|
32
|
+
* @returns {Array<import("./types").CouchDBBulkResult & { doc: import("./types").CozyClientDocument }>}
|
|
33
33
|
*/
|
|
34
|
-
getErrors(): Array<CouchDBBulkResult & {
|
|
35
|
-
doc: CozyClientDocument;
|
|
34
|
+
getErrors(): Array<import("./types").CouchDBBulkResult & {
|
|
35
|
+
doc: import("./types").CozyClientDocument;
|
|
36
36
|
}>;
|
|
37
37
|
}
|
|
38
|
-
import { CozyClientDocument } from "./types";
|
|
39
|
-
import { CouchDBBulkResult } from "./types";
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
export function certifyFlagship(certificationConfig: CertificationConfig, client: CozyClient): Promise<void>;
|
|
2
|
-
import { CertificationConfig } from "./typedefs";
|
|
1
|
+
export function certifyFlagship(certificationConfig: import("./typedefs").CertificationConfig, client: CozyClient): Promise<void>;
|
|
3
2
|
import CozyClient from "../CozyClient";
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
export function getAppAttestationFromStore(nonce: string, certificationConfig: CertificationConfig): Promise<AttestationResult>;
|
|
2
|
-
import { CertificationConfig } from "./typedefs";
|
|
3
|
-
import { AttestationResult } from "./typedefs";
|
|
1
|
+
export function getAppAttestationFromStore(nonce: string, certificationConfig: import("./typedefs").CertificationConfig): Promise<import("./typedefs").AttestationResult>;
|
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
* /!\ This is a mock implementation that should never be called
|
|
4
4
|
*
|
|
5
5
|
* @param {string} nonce - the Nonce string retrieved from the stack
|
|
6
|
-
* @param {CertificationConfig} certificationConfig - Configuration to access the stores certification API
|
|
7
|
-
* @returns {Promise<AttestationResult>} the app's attestation
|
|
6
|
+
* @param {import("./typedefs").CertificationConfig} certificationConfig - Configuration to access the stores certification API
|
|
7
|
+
* @returns {Promise<import("./typedefs").AttestationResult>} the app's attestation
|
|
8
8
|
*/
|
|
9
|
-
export function getAppAttestationFromStore(nonce: string, certificationConfig: CertificationConfig): Promise<AttestationResult>;
|
|
10
|
-
import { CertificationConfig } from "./typedefs";
|
|
11
|
-
import { AttestationResult } from "./typedefs";
|
|
9
|
+
export function getAppAttestationFromStore(nonce: string, certificationConfig: import("./typedefs").CertificationConfig): Promise<import("./typedefs").AttestationResult>;
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
export function getAppAttestationFromStore(nonce: string, certificationConfig: CertificationConfig): Promise<AttestationResult>;
|
|
2
|
-
import { CertificationConfig } from "./typedefs";
|
|
3
|
-
import { AttestationResult } from "./typedefs";
|
|
1
|
+
export function getAppAttestationFromStore(nonce: string, certificationConfig: import("./typedefs").CertificationConfig): Promise<import("./typedefs").AttestationResult>;
|