cozy-client 38.0.1 → 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 +43 -45
- 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/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/dist/CozyClient.js
CHANGED
|
@@ -75,8 +75,6 @@ var _snapshots = require("./testing/snapshots");
|
|
|
75
75
|
|
|
76
76
|
var _logger = _interopRequireDefault(require("./logger"));
|
|
77
77
|
|
|
78
|
-
var _types = require("./types");
|
|
79
|
-
|
|
80
78
|
var _queries = require("./store/queries");
|
|
81
79
|
|
|
82
80
|
var _jsonStableStringify = _interopRequireDefault(require("json-stable-stringify"));
|
|
@@ -136,7 +134,7 @@ var DOC_UPDATE = 'update';
|
|
|
136
134
|
* @property {object} [client]
|
|
137
135
|
* @property {object} [link]
|
|
138
136
|
* @property {object} [links]
|
|
139
|
-
* @property {Token} [token]
|
|
137
|
+
* @property {import("./types").Token} [token]
|
|
140
138
|
* @property {string} [uri]
|
|
141
139
|
* @property {object} [stackClient]
|
|
142
140
|
* @property {boolean} [warningForCustomHandlers]
|
|
@@ -145,11 +143,11 @@ var DOC_UPDATE = 'update';
|
|
|
145
143
|
* @property {object} [oauth]
|
|
146
144
|
* @property {Function} [onTokenRefresh]
|
|
147
145
|
* @property {Function} [onError] - Default callback if a query is errored
|
|
148
|
-
* @property {Link} [link] - Backward compatibility
|
|
149
|
-
* @property {Array<Link>} [links] - List of links
|
|
146
|
+
* @property {import("./types").Link} [link] - Backward compatibility
|
|
147
|
+
* @property {Array<import("./types").Link>} [links] - List of links
|
|
150
148
|
* @property {object} [schema] - Schema description for each doctypes
|
|
151
|
-
* @property {AppMetadata} [appMetadata] - Metadata about the application that will be used in ensureCozyMetadata
|
|
152
|
-
* @property {ClientCapabilities} [capabilities] - Capabilities sent by the stack
|
|
149
|
+
* @property {import("./types").AppMetadata} [appMetadata] - Metadata about the application that will be used in ensureCozyMetadata
|
|
150
|
+
* @property {import("./types").ClientCapabilities} [capabilities] - Capabilities sent by the stack
|
|
153
151
|
* @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.
|
|
154
152
|
*/
|
|
155
153
|
|
|
@@ -260,7 +258,7 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
260
258
|
this.chain = (0, _CozyLink.chain)(this.links);
|
|
261
259
|
this.schema = new _Schema.default(schema, stackClient);
|
|
262
260
|
/**
|
|
263
|
-
* @type {ClientCapabilities}
|
|
261
|
+
* @type {import("./types").ClientCapabilities}
|
|
264
262
|
*/
|
|
265
263
|
|
|
266
264
|
this.capabilities = capabilities || null; // Instances of plugins registered with registerPlugin
|
|
@@ -382,7 +380,7 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
382
380
|
* To help with the transition from cozy-client-js to cozy-client, it is possible to instantiate
|
|
383
381
|
* a client with a cookie-based instance of cozy-client-js.
|
|
384
382
|
*
|
|
385
|
-
* @param {OldCozyClient} oldClient - An instance of the deprecated cozy-client
|
|
383
|
+
* @param {import("./types").OldCozyClient} oldClient - An instance of the deprecated cozy-client
|
|
386
384
|
* @param {object} options - CozyStackClient options
|
|
387
385
|
* @returns {CozyClient}
|
|
388
386
|
*/
|
|
@@ -701,7 +699,7 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
701
699
|
* a [DocumentCollection]{@link https://docs.cozy.io/en/cozy-client/api/cozy-stack-client/#DocumentCollection} instance.
|
|
702
700
|
*
|
|
703
701
|
* @param {string} doctype The collection doctype.
|
|
704
|
-
* @returns {DocumentCollection} Collection corresponding to the doctype
|
|
702
|
+
* @returns {import("./types").DocumentCollection} Collection corresponding to the doctype
|
|
705
703
|
*/
|
|
706
704
|
|
|
707
705
|
}, {
|
|
@@ -749,7 +747,7 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
749
747
|
*
|
|
750
748
|
* @param {string} type - Doctype of the document
|
|
751
749
|
* @param {object} doc - Document to save
|
|
752
|
-
* @param {ReferenceMap} [references] - References are a special kind of relationship
|
|
750
|
+
* @param {import("./types").ReferenceMap} [references] - References are a special kind of relationship
|
|
753
751
|
* that is not stored inside the referencer document, they are used for example between a photo
|
|
754
752
|
* and its album. You should not need to use it normally.
|
|
755
753
|
* @param {object} options - Mutation options
|
|
@@ -896,7 +894,7 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
896
894
|
* - Can only be called with documents from the same doctype
|
|
897
895
|
* - Does not support automatic creation of references
|
|
898
896
|
*
|
|
899
|
-
* @param {CozyClientDocument[]} docs - Documents from the same doctype
|
|
897
|
+
* @param {import("./types").CozyClientDocument[]} docs - Documents from the same doctype
|
|
900
898
|
* @param {Object} mutationOptions - Mutation Options
|
|
901
899
|
* @param {string} [mutationOptions.as] - Mutation id
|
|
902
900
|
* @param {Function} [mutationOptions.update] - Function to update the document
|
|
@@ -976,10 +974,10 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
976
974
|
return saveAll;
|
|
977
975
|
}()
|
|
978
976
|
/**
|
|
979
|
-
* @param {CozyClientDocument} document - Document that will be saved
|
|
977
|
+
* @param {import("./types").CozyClientDocument} document - Document that will be saved
|
|
980
978
|
* @param {object} [options={event: DOC_CREATION}] - Event
|
|
981
979
|
* @param {string} [options.event] - Mutation type
|
|
982
|
-
* @returns {CozyClientDocument}
|
|
980
|
+
* @returns {import("./types").CozyClientDocument}
|
|
983
981
|
*/
|
|
984
982
|
|
|
985
983
|
}, {
|
|
@@ -1039,8 +1037,8 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
1039
1037
|
/**
|
|
1040
1038
|
* Dehydrates and adds metadata before saving a document
|
|
1041
1039
|
*
|
|
1042
|
-
* @param {CozyClientDocument} doc - Document that will be saved
|
|
1043
|
-
* @returns {CozyClientDocument}
|
|
1040
|
+
* @param {import("./types").CozyClientDocument} doc - Document that will be saved
|
|
1041
|
+
* @returns {import("./types").CozyClientDocument}
|
|
1044
1042
|
*/
|
|
1045
1043
|
|
|
1046
1044
|
}, {
|
|
@@ -1066,12 +1064,12 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
1066
1064
|
* ```
|
|
1067
1065
|
*
|
|
1068
1066
|
*
|
|
1069
|
-
* @param {CozyClientDocument} document - Document to create
|
|
1070
|
-
* @param {ReferenceMap} [referencesByName] - References to the created document. The
|
|
1067
|
+
* @param {import("./types").CozyClientDocument} document - Document to create
|
|
1068
|
+
* @param {import("./types").ReferenceMap} [referencesByName] - References to the created document. The
|
|
1071
1069
|
* relationship class associated to each reference list should support references, otherwise this
|
|
1072
1070
|
* method will throw.
|
|
1073
1071
|
*
|
|
1074
|
-
* @returns {Mutation[]|Mutation} One or more mutation to execute
|
|
1072
|
+
* @returns {import("./types").Mutation[]|import("./types").Mutation} One or more mutation to execute
|
|
1075
1073
|
*/
|
|
1076
1074
|
|
|
1077
1075
|
}, {
|
|
@@ -1161,8 +1159,8 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
1161
1159
|
/**
|
|
1162
1160
|
* Destroys a document. {before,after}:destroy hooks will be fired.
|
|
1163
1161
|
*
|
|
1164
|
-
* @param {CozyClientDocument} document - Document to be deleted
|
|
1165
|
-
* @returns {Promise<CozyClientDocument>} The document that has been deleted
|
|
1162
|
+
* @param {import("./types").CozyClientDocument} document - Document to be deleted
|
|
1163
|
+
* @returns {Promise<import("./types").CozyClientDocument>} The document that has been deleted
|
|
1166
1164
|
*/
|
|
1167
1165
|
|
|
1168
1166
|
}, {
|
|
@@ -1217,7 +1215,7 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
1217
1215
|
*
|
|
1218
1216
|
* @param {string} queryId - Id of the query
|
|
1219
1217
|
* @param {QueryDefinition} queryDefinition - Definition of the query
|
|
1220
|
-
* @param {QueryOptions} [options] - Additional options
|
|
1218
|
+
* @param {import("./types").QueryOptions} [options] - Additional options
|
|
1221
1219
|
*/
|
|
1222
1220
|
|
|
1223
1221
|
}, {
|
|
@@ -1238,8 +1236,8 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
1238
1236
|
* executes its query when mounted if no fetch policy has been indicated.
|
|
1239
1237
|
*
|
|
1240
1238
|
* @param {QueryDefinition} queryDefinition - Definition that will be executed
|
|
1241
|
-
* @param {QueryOptions} [options] - Options
|
|
1242
|
-
* @returns {Promise<QueryResult>}
|
|
1239
|
+
* @param {import("./types").QueryOptions} [options] - Options
|
|
1240
|
+
* @returns {Promise<import("./types").QueryResult>}
|
|
1243
1241
|
*/
|
|
1244
1242
|
|
|
1245
1243
|
}, {
|
|
@@ -1388,8 +1386,8 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
1388
1386
|
* result in a lot of network requests.
|
|
1389
1387
|
*
|
|
1390
1388
|
* @param {QueryDefinition} queryDefinition - Definition to be executed
|
|
1391
|
-
* @param {QueryOptions} [options] - Options
|
|
1392
|
-
* @returns {Promise<QueryResult>} All documents matching the query
|
|
1389
|
+
* @param {import("./types").QueryOptions} [options] - Options
|
|
1390
|
+
* @returns {Promise<import("./types").QueryResult>} All documents matching the query
|
|
1393
1391
|
*/
|
|
1394
1392
|
|
|
1395
1393
|
}, {
|
|
@@ -1562,7 +1560,7 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
1562
1560
|
*
|
|
1563
1561
|
* @private
|
|
1564
1562
|
* @param {QueryDefinition} definition QueryDefinition to be executed
|
|
1565
|
-
* @returns {Promise<ClientResponse>}
|
|
1563
|
+
* @returns {Promise<import("./types").ClientResponse>}
|
|
1566
1564
|
*/
|
|
1567
1565
|
|
|
1568
1566
|
}, {
|
|
@@ -1792,8 +1790,8 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
1792
1790
|
* Instead, the relationships will have null documents.
|
|
1793
1791
|
*
|
|
1794
1792
|
* @param {string} doctype - Doctype of the documents being hydrated
|
|
1795
|
-
* @param {Array<CozyClientDocument>} documents - Documents to be hydrated
|
|
1796
|
-
* @returns {Array<HydratedDocument>}
|
|
1793
|
+
* @param {Array<import("./types").CozyClientDocument>} documents - Documents to be hydrated
|
|
1794
|
+
* @returns {Array<import("./types").HydratedDocument>}
|
|
1797
1795
|
*/
|
|
1798
1796
|
|
|
1799
1797
|
}, {
|
|
@@ -1822,9 +1820,9 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
1822
1820
|
* The original document is kept in the target attribute of
|
|
1823
1821
|
* the relationship
|
|
1824
1822
|
*
|
|
1825
|
-
* @param {CozyClientDocument} document - for which relationships must be resolved
|
|
1823
|
+
* @param {import("./types").CozyClientDocument} document - for which relationships must be resolved
|
|
1826
1824
|
* @param {Schema} [schemaArg] - Optional
|
|
1827
|
-
* @returns {HydratedDocument}
|
|
1825
|
+
* @returns {import("./types").HydratedDocument}
|
|
1828
1826
|
*/
|
|
1829
1827
|
|
|
1830
1828
|
}, {
|
|
@@ -1910,7 +1908,7 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
1910
1908
|
*
|
|
1911
1909
|
* @param {string} type - Doctype of the collection
|
|
1912
1910
|
*
|
|
1913
|
-
* @returns {CozyClientDocument[]} Array of documents or null if the collection does not exist.
|
|
1911
|
+
* @returns {import("./types").CozyClientDocument[]} Array of documents or null if the collection does not exist.
|
|
1914
1912
|
*/
|
|
1915
1913
|
|
|
1916
1914
|
}, {
|
|
@@ -1930,7 +1928,7 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
1930
1928
|
* @param {string} type - Doctype of the document
|
|
1931
1929
|
* @param {string} id - Id of the document
|
|
1932
1930
|
*
|
|
1933
|
-
* @returns {CozyClientDocument} Document or null if the object does not exist.
|
|
1931
|
+
* @returns {import("./types").CozyClientDocument} Document or null if the object does not exist.
|
|
1934
1932
|
*/
|
|
1935
1933
|
|
|
1936
1934
|
}, {
|
|
@@ -1954,7 +1952,7 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
1954
1952
|
* a single doc instead of an array for single doc queries. Defaults to false for backward
|
|
1955
1953
|
* compatibility but will be set to true in the future.
|
|
1956
1954
|
*
|
|
1957
|
-
* @returns {QueryState} - Query state or null if it does not exist.
|
|
1955
|
+
* @returns {import("./types").QueryState} - Query state or null if it does not exist.
|
|
1958
1956
|
*/
|
|
1959
1957
|
|
|
1960
1958
|
}, {
|
|
@@ -1992,8 +1990,8 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
1992
1990
|
*
|
|
1993
1991
|
* @param {object} query - Query with definition and options
|
|
1994
1992
|
* @param {QueryDefinition} query.definition - Query Definition
|
|
1995
|
-
* @param {QueryOptions} query.options - Query Options
|
|
1996
|
-
* @returns {Promise<QueryState>} Query state
|
|
1993
|
+
* @param {import("./types").QueryOptions} query.options - Query Options
|
|
1994
|
+
* @returns {Promise<import("./types").QueryState>} Query state
|
|
1997
1995
|
*/
|
|
1998
1996
|
|
|
1999
1997
|
}, {
|
|
@@ -2020,7 +2018,7 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
2020
2018
|
/**
|
|
2021
2019
|
* Performs a complete OAuth flow, including updating the internal token at the end.
|
|
2022
2020
|
*
|
|
2023
|
-
* @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.
|
|
2021
|
+
* @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.
|
|
2024
2022
|
* @returns {Promise<object>} Contains the fetched token and the client information. These should be stored and used to restore the client.
|
|
2025
2023
|
*/
|
|
2026
2024
|
|
|
@@ -2105,9 +2103,9 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
2105
2103
|
* 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)
|
|
2106
2104
|
*
|
|
2107
2105
|
* @param {object} [options] - Authorization options
|
|
2108
|
-
* @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.
|
|
2109
|
-
* @param {SessionCode} [options.sessionCode] - session code than can be added to the authorization URL to automatically create the session.
|
|
2110
|
-
* @param {PKCECodes} [options.pkceCodes] - code verifier and a code challenge that should be used in the PKCE verification process.
|
|
2106
|
+
* @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.
|
|
2107
|
+
* @param {import("./types").SessionCode} [options.sessionCode] - session code than can be added to the authorization URL to automatically create the session.
|
|
2108
|
+
* @param {import("./types").PKCECodes} [options.pkceCodes] - code verifier and a code challenge that should be used in the PKCE verification process.
|
|
2111
2109
|
* @returns {Promise<object>} Contains the fetched token and the client information. These should be stored and used to restore the client.
|
|
2112
2110
|
*/
|
|
2113
2111
|
|
|
@@ -2226,7 +2224,7 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
2226
2224
|
* client.setStore(store)
|
|
2227
2225
|
* ```
|
|
2228
2226
|
*
|
|
2229
|
-
* @param {ReduxStore} store - A redux store
|
|
2227
|
+
* @param {import("./types").ReduxStore} store - A redux store
|
|
2230
2228
|
* @param {object} [options] - Options
|
|
2231
2229
|
* @param {boolean} [options.force] - Will deactivate throwing when client's store already exists
|
|
2232
2230
|
*/
|
|
@@ -2509,7 +2507,7 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
2509
2507
|
}
|
|
2510
2508
|
/**
|
|
2511
2509
|
*
|
|
2512
|
-
* @param {AppMetadata} newAppMetadata AppMetadata to update
|
|
2510
|
+
* @param {import("./types").AppMetadata} newAppMetadata AppMetadata to update
|
|
2513
2511
|
*/
|
|
2514
2512
|
|
|
2515
2513
|
}, {
|
|
@@ -2531,7 +2529,7 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
2531
2529
|
*
|
|
2532
2530
|
* Warning: unlike other instantiators, this one needs to be awaited.
|
|
2533
2531
|
*
|
|
2534
|
-
* @param {OldCozyClient} oldClient - An OAuth instance of the deprecated cozy-client
|
|
2532
|
+
* @param {import("./types").OldCozyClient} oldClient - An OAuth instance of the deprecated cozy-client
|
|
2535
2533
|
* @param {object} options - CozyStackClient options
|
|
2536
2534
|
* @returns {Promise<CozyClient>} An instance of a client, configured from the old client
|
|
2537
2535
|
*/
|
|
@@ -2596,7 +2594,7 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
2596
2594
|
* In konnector/service context, CozyClient can be instantiated from
|
|
2597
2595
|
* environment variables
|
|
2598
2596
|
*
|
|
2599
|
-
* @param {NodeEnvironment} [envArg] - The environment
|
|
2597
|
+
* @param {import("./types").NodeEnvironment} [envArg] - The environment
|
|
2600
2598
|
* @param {object} options - Options
|
|
2601
2599
|
* @returns {CozyClient}
|
|
2602
2600
|
*/
|
|
@@ -2679,7 +2677,7 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
2679
2677
|
CozyClient.hooks = CozyClient.hooks || {};
|
|
2680
2678
|
CozyClient.fetchPolicies = _policies.default; //COZY_CLIENT_VERSION_PACKAGE in replaced by babel. See babel config
|
|
2681
2679
|
|
|
2682
|
-
CozyClient.version = "38.0.
|
|
2680
|
+
CozyClient.version = "38.0.2";
|
|
2683
2681
|
|
|
2684
2682
|
_microee.default.mixin(CozyClient);
|
|
2685
2683
|
|
package/dist/RealTimeQueries.js
CHANGED
|
@@ -23,8 +23,6 @@ var _store = require("./store");
|
|
|
23
23
|
|
|
24
24
|
var _CozyClient = _interopRequireDefault(require("./CozyClient"));
|
|
25
25
|
|
|
26
|
-
var _types = require("./types");
|
|
27
|
-
|
|
28
26
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
29
27
|
|
|
30
28
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
@@ -35,8 +33,8 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
35
33
|
* Ensures existence of `_type`
|
|
36
34
|
*
|
|
37
35
|
* @public
|
|
38
|
-
* @param {CouchDBDocument} couchDBDoc - object representing the document
|
|
39
|
-
* @returns {CozyClientDocument} full normalized document
|
|
36
|
+
* @param {import("./types").CouchDBDocument} couchDBDoc - object representing the document
|
|
37
|
+
* @returns {import("./types").CozyClientDocument} full normalized document
|
|
40
38
|
*/
|
|
41
39
|
var normalizeDoc = function normalizeDoc(couchDBDoc, doctype) {
|
|
42
40
|
return _objectSpread({
|
|
@@ -48,9 +46,9 @@ var normalizeDoc = function normalizeDoc(couchDBDoc, doctype) {
|
|
|
48
46
|
* DispatchChange
|
|
49
47
|
*
|
|
50
48
|
* @param {CozyClient} client CozyClient instane
|
|
51
|
-
* @param {Doctype} doctype Doctype of the document to update
|
|
52
|
-
* @param {CouchDBDocument} couchDBDoc Document to update
|
|
53
|
-
* @param {Mutation} mutationDefinitionCreator Mutation to apply
|
|
49
|
+
* @param {import("./types").Doctype} doctype Doctype of the document to update
|
|
50
|
+
* @param {import("./types").CouchDBDocument} couchDBDoc Document to update
|
|
51
|
+
* @param {import("./types").Mutation} mutationDefinitionCreator Mutation to apply
|
|
54
52
|
*/
|
|
55
53
|
|
|
56
54
|
|
|
@@ -67,7 +65,7 @@ var dispatchChange = function dispatchChange(client, doctype, couchDBDoc, mutati
|
|
|
67
65
|
* internal store updated.
|
|
68
66
|
*
|
|
69
67
|
* @param {object} options - Options
|
|
70
|
-
* @param {Doctype} options.doctype - The doctype to watch
|
|
68
|
+
* @param {import("./types").Doctype} options.doctype - The doctype to watch
|
|
71
69
|
* @returns {null} The component does not display anything.
|
|
72
70
|
*/
|
|
73
71
|
|
package/dist/StackLink.js
CHANGED
|
@@ -31,8 +31,6 @@ var _dsl = require("./queries/dsl");
|
|
|
31
31
|
|
|
32
32
|
var _CozyLink2 = _interopRequireDefault(require("./CozyLink"));
|
|
33
33
|
|
|
34
|
-
var _types = require("./types");
|
|
35
|
-
|
|
36
34
|
var _const = require("./const");
|
|
37
35
|
|
|
38
36
|
var _errors = require("./errors");
|
|
@@ -70,9 +68,9 @@ var hasFindOptions = function hasFindOptions(queryDefinition) {
|
|
|
70
68
|
*
|
|
71
69
|
* @private
|
|
72
70
|
*
|
|
73
|
-
* @param {CouchDBBulkResult[]} bulkResponse - Response from bulk docs
|
|
74
|
-
* @param {CozyClientDocument[]} originalDocuments - Documents that were updated
|
|
75
|
-
* @returns {{ data: CozyClientDocument[] }} - Full documents with updated _id and _rev
|
|
71
|
+
* @param {import("./types").CouchDBBulkResult[]} bulkResponse - Response from bulk docs
|
|
72
|
+
* @param {import("./types").CozyClientDocument[]} originalDocuments - Documents that were updated
|
|
73
|
+
* @returns {{ data: import("./types").CozyClientDocument[] }} - Full documents with updated _id and _rev
|
|
76
74
|
*/
|
|
77
75
|
|
|
78
76
|
|
|
@@ -151,7 +149,7 @@ var StackLink = /*#__PURE__*/function (_CozyLink) {
|
|
|
151
149
|
/**
|
|
152
150
|
*
|
|
153
151
|
* @param {QueryDefinition} query - Query to execute
|
|
154
|
-
* @returns {Promise<ClientResponse>}
|
|
152
|
+
* @returns {Promise<import("./types").ClientResponse>}
|
|
155
153
|
*/
|
|
156
154
|
|
|
157
155
|
}, {
|
|
@@ -11,8 +11,6 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
|
|
|
11
11
|
|
|
12
12
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
13
|
|
|
14
|
-
var _types = require("../types");
|
|
15
|
-
|
|
16
14
|
var _dsl = require("../queries/dsl");
|
|
17
15
|
|
|
18
16
|
/**
|
|
@@ -249,11 +247,11 @@ var Association = /*#__PURE__*/function () {
|
|
|
249
247
|
/**
|
|
250
248
|
* Derived `Association`s need to implement this method.
|
|
251
249
|
*
|
|
252
|
-
* @param {CozyClientDocument} document - Document to query
|
|
250
|
+
* @param {import("../types").CozyClientDocument} document - Document to query
|
|
253
251
|
* @param {object} client - The CozyClient instance
|
|
254
252
|
* @param {Association} assoc - Association containing info on how to build the query to fetch related documents
|
|
255
253
|
*
|
|
256
|
-
* @returns {CozyClientDocument | QueryDefinition }
|
|
254
|
+
* @returns {import("../types").CozyClientDocument | QueryDefinition }
|
|
257
255
|
*/
|
|
258
256
|
|
|
259
257
|
}], [{
|
|
@@ -31,8 +31,6 @@ var _dsl = require("../queries/dsl");
|
|
|
31
31
|
|
|
32
32
|
var _store = require("../store");
|
|
33
33
|
|
|
34
|
-
var _types = require("../types");
|
|
35
|
-
|
|
36
34
|
var _Association2 = _interopRequireDefault(require("./Association"));
|
|
37
35
|
|
|
38
36
|
var _logger = _interopRequireDefault(require("../logger"));
|
|
@@ -164,8 +162,8 @@ var HasMany = /*#__PURE__*/function (_Association) {
|
|
|
164
162
|
/**
|
|
165
163
|
* Add the relationships to the target document
|
|
166
164
|
*
|
|
167
|
-
* @param {CozyClientDocument[]} docsArg - Documents to add as relationships
|
|
168
|
-
* @returns {CozyClientDocument} The saved target document
|
|
165
|
+
* @param {import("../types").CozyClientDocument[]} docsArg - Documents to add as relationships
|
|
166
|
+
* @returns {import("../types").CozyClientDocument} The saved target document
|
|
169
167
|
*/
|
|
170
168
|
|
|
171
169
|
}, {
|
|
@@ -180,8 +178,8 @@ var HasMany = /*#__PURE__*/function (_Association) {
|
|
|
180
178
|
/**
|
|
181
179
|
* Remove the relationships from the target document
|
|
182
180
|
*
|
|
183
|
-
* @param {CozyClientDocument[]} docsArg - Documents to remove as relationships
|
|
184
|
-
* @returns {CozyClientDocument} The saved target document
|
|
181
|
+
* @param {import("../types").CozyClientDocument[]} docsArg - Documents to remove as relationships
|
|
182
|
+
* @returns {import("../types").CozyClientDocument} The saved target document
|
|
185
183
|
*/
|
|
186
184
|
|
|
187
185
|
}, {
|
|
@@ -313,11 +311,11 @@ var HasMany = /*#__PURE__*/function (_Association) {
|
|
|
313
311
|
});
|
|
314
312
|
}
|
|
315
313
|
/**
|
|
316
|
-
* @param {CozyClientDocument} document - Document to query
|
|
314
|
+
* @param {import("../types").CozyClientDocument} document - Document to query
|
|
317
315
|
* @param {object} client - The CozyClient instance
|
|
318
316
|
* @param {Association} assoc - The query params
|
|
319
317
|
*
|
|
320
|
-
* @returns {CozyClientDocument | QueryDefinition}
|
|
318
|
+
* @returns {import("../types").CozyClientDocument | QueryDefinition}
|
|
321
319
|
*/
|
|
322
320
|
|
|
323
321
|
}, {
|
|
@@ -39,8 +39,6 @@ var _dsl = require("../queries/dsl");
|
|
|
39
39
|
|
|
40
40
|
var _store = require("../store");
|
|
41
41
|
|
|
42
|
-
var _types = require("../types");
|
|
43
|
-
|
|
44
42
|
var _const = require("../const");
|
|
45
43
|
|
|
46
44
|
var _Association = _interopRequireDefault(require("./Association"));
|
|
@@ -58,10 +56,10 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
58
56
|
/**
|
|
59
57
|
* newCursor - Returns a CouchDB view Cursor for cursor-based pagination
|
|
60
58
|
*
|
|
61
|
-
* @param {ViewKey} key - The CouchDB key of the view which will be requested
|
|
62
|
-
* @param {DocId} startDocId - The first doc _id to return from the view
|
|
59
|
+
* @param {import("../types").ViewKey} key - The CouchDB key of the view which will be requested
|
|
60
|
+
* @param {import("../types").DocId} startDocId - The first doc _id to return from the view
|
|
63
61
|
*
|
|
64
|
-
* @returns {CouchDBViewCursor}
|
|
62
|
+
* @returns {import("../types").CouchDBViewCursor}
|
|
65
63
|
*/
|
|
66
64
|
var newCursor = function newCursor(_ref, startDocId) {
|
|
67
65
|
var _ref2 = (0, _slicedToArray2.default)(_ref, 3),
|
|
@@ -281,11 +279,11 @@ var HasManyFiles = /*#__PURE__*/function (_HasMany) {
|
|
|
281
279
|
return (0, _omit.default)(doc, [this.name, "relationships.".concat(this.name)]);
|
|
282
280
|
}
|
|
283
281
|
/**
|
|
284
|
-
* @param {CozyClientDocument} document - Document to query
|
|
282
|
+
* @param {import("../types").CozyClientDocument} document - Document to query
|
|
285
283
|
* @param {object} client - The CozyClient instance
|
|
286
284
|
* @param {Association} assoc - The query params
|
|
287
285
|
*
|
|
288
|
-
* @returns {CozyClientDocument | QueryDefinition}
|
|
286
|
+
* @returns {import("../types").CozyClientDocument | QueryDefinition}
|
|
289
287
|
*/
|
|
290
288
|
|
|
291
289
|
}, {
|
|
@@ -21,8 +21,6 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
21
21
|
|
|
22
22
|
var _dsl = require("../queries/dsl");
|
|
23
23
|
|
|
24
|
-
var _types = require("../types");
|
|
25
|
-
|
|
26
24
|
var _Association2 = _interopRequireDefault(require("./Association"));
|
|
27
25
|
|
|
28
26
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -141,11 +139,11 @@ var HasManyInPlace = /*#__PURE__*/function (_Association) {
|
|
|
141
139
|
});
|
|
142
140
|
}
|
|
143
141
|
/**
|
|
144
|
-
* @param {CozyClientDocument} document - Document to query
|
|
142
|
+
* @param {import("../types").CozyClientDocument} document - Document to query
|
|
145
143
|
* @param {object} client - The CozyClient instance
|
|
146
144
|
* @param {Association} assoc - The query params
|
|
147
145
|
*
|
|
148
|
-
* @returns {CozyClientDocument | QueryDefinition}
|
|
146
|
+
* @returns {import("../types").CozyClientDocument | QueryDefinition}
|
|
149
147
|
*/
|
|
150
148
|
|
|
151
149
|
}], [{
|
|
@@ -25,8 +25,6 @@ var _set = _interopRequireDefault(require("lodash/set"));
|
|
|
25
25
|
|
|
26
26
|
var _dsl = require("../queries/dsl");
|
|
27
27
|
|
|
28
|
-
var _types = require("../types");
|
|
29
|
-
|
|
30
28
|
var _Association2 = _interopRequireDefault(require("./Association"));
|
|
31
29
|
|
|
32
30
|
var _logger = _interopRequireDefault(require("../logger"));
|
|
@@ -55,8 +53,8 @@ var HasOne = /*#__PURE__*/function (_Association) {
|
|
|
55
53
|
/**
|
|
56
54
|
* Add the relationship to the target document
|
|
57
55
|
*
|
|
58
|
-
* @param {CozyClientDocument} doc - Document to add as a relationship
|
|
59
|
-
* @returns {CozyClientDocument} The saved target document
|
|
56
|
+
* @param {import("../types").CozyClientDocument} doc - Document to add as a relationship
|
|
57
|
+
* @returns {import("../types").CozyClientDocument} The saved target document
|
|
60
58
|
*/
|
|
61
59
|
value: function add(doc) {
|
|
62
60
|
this.setRelationship(doc);
|
|
@@ -65,7 +63,7 @@ var HasOne = /*#__PURE__*/function (_Association) {
|
|
|
65
63
|
/**
|
|
66
64
|
* Remove the relationship from the target document
|
|
67
65
|
*
|
|
68
|
-
* @returns {CozyClientDocument} The saved target document
|
|
66
|
+
* @returns {import("../types").CozyClientDocument} The saved target document
|
|
69
67
|
*/
|
|
70
68
|
|
|
71
69
|
}, {
|
|
@@ -134,11 +132,11 @@ var HasOne = /*#__PURE__*/function (_Association) {
|
|
|
134
132
|
return this.get(this.doctype, this.raw._id);
|
|
135
133
|
}
|
|
136
134
|
/**
|
|
137
|
-
* @param {CozyClientDocument} document - Document to query
|
|
135
|
+
* @param {import("../types").CozyClientDocument} document - Document to query
|
|
138
136
|
* @param {object} client - The CozyClient instance
|
|
139
137
|
* @param {Association} assoc - The query params
|
|
140
138
|
*
|
|
141
|
-
* @returns {CozyClientDocument | QueryDefinition}
|
|
139
|
+
* @returns {import("../types").CozyClientDocument | QueryDefinition}
|
|
142
140
|
*/
|
|
143
141
|
|
|
144
142
|
}], [{
|
|
@@ -23,8 +23,6 @@ var _Association2 = _interopRequireDefault(require("./Association"));
|
|
|
23
23
|
|
|
24
24
|
var _dsl = require("../queries/dsl");
|
|
25
25
|
|
|
26
|
-
var _types = require("../types");
|
|
27
|
-
|
|
28
26
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
29
27
|
|
|
30
28
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
@@ -63,11 +61,11 @@ var HasOneInPlace = /*#__PURE__*/function (_Association) {
|
|
|
63
61
|
return this.get(this.doctype, this.raw);
|
|
64
62
|
}
|
|
65
63
|
/**
|
|
66
|
-
* @param {CozyClientDocument} document - Document to query
|
|
64
|
+
* @param {import("../types").CozyClientDocument} document - Document to query
|
|
67
65
|
* @param {object} client - The CozyClient instance
|
|
68
66
|
* @param {Association} assoc - The query params
|
|
69
67
|
*
|
|
70
|
-
* @returns {CozyClientDocument | QueryDefinition}
|
|
68
|
+
* @returns {import("../types").CozyClientDocument | QueryDefinition}
|
|
71
69
|
*/
|
|
72
70
|
|
|
73
71
|
}], [{
|
|
@@ -25,8 +25,6 @@ var _HasManyInPlace = _interopRequireDefault(require("./HasManyInPlace"));
|
|
|
25
25
|
|
|
26
26
|
var _HasManyFiles = _interopRequireDefault(require("./HasManyFiles"));
|
|
27
27
|
|
|
28
|
-
var _types = require("../types");
|
|
29
|
-
|
|
30
28
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
31
29
|
|
|
32
30
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
@@ -129,8 +127,8 @@ var create = function create(target, _ref, accessors) {
|
|
|
129
127
|
/**
|
|
130
128
|
* Checks if the file is referenced by a specific doctype
|
|
131
129
|
*
|
|
132
|
-
* @param {IOCozyFile} file - io.cozy.files document
|
|
133
|
-
* @param {Doctype} referencedBy - Doctype where document is referenced
|
|
130
|
+
* @param {import("../types").IOCozyFile} file - io.cozy.files document
|
|
131
|
+
* @param {import("../types").Doctype} referencedBy - Doctype where document is referenced
|
|
134
132
|
* @returns {boolean} If a reference is found
|
|
135
133
|
*/
|
|
136
134
|
|
|
@@ -148,8 +146,8 @@ var isReferencedBy = function isReferencedBy(file, referencedBy) {
|
|
|
148
146
|
/**
|
|
149
147
|
* Checks if the file is referenced by a specific doctype and a specific Id of that reference
|
|
150
148
|
*
|
|
151
|
-
* @param {IOCozyFile} file - io.cozy.files document
|
|
152
|
-
* @param {Doctype} referencedBy - Doctype where document is referenced
|
|
149
|
+
* @param {import("../types").IOCozyFile} file - io.cozy.files document
|
|
150
|
+
* @param {import("../types").Doctype} referencedBy - Doctype where document is referenced
|
|
153
151
|
* @param {string} referencedId - Id of the referenced document
|
|
154
152
|
* @returns {boolean} If a reference is found
|
|
155
153
|
*/
|
|
@@ -168,9 +166,9 @@ var isReferencedById = function isReferencedById(file, referencedBy, referencedI
|
|
|
168
166
|
/**
|
|
169
167
|
* Get array of reference by an specific doctype
|
|
170
168
|
*
|
|
171
|
-
* @param {IOCozyFile} file - io.cozy.files document
|
|
172
|
-
* @param {Doctype} referencedBy - Doctype where document is referenced
|
|
173
|
-
* @returns {Reference[]} Array of references found
|
|
169
|
+
* @param {import("../types").IOCozyFile} file - io.cozy.files document
|
|
170
|
+
* @param {import("../types").Doctype} referencedBy - Doctype where document is referenced
|
|
171
|
+
* @returns {import("../types").Reference[]} Array of references found
|
|
174
172
|
*/
|
|
175
173
|
|
|
176
174
|
|
|
@@ -187,10 +185,10 @@ var getReferencedBy = function getReferencedBy(file, referencedBy) {
|
|
|
187
185
|
/**
|
|
188
186
|
* Get array of reference by an specific doctype and a specific Id of that reference
|
|
189
187
|
*
|
|
190
|
-
* @param {IOCozyFile} file - io.cozy.files document
|
|
191
|
-
* @param {Doctype} referencedBy - Doctype where document is referenced
|
|
188
|
+
* @param {import("../types").IOCozyFile} file - io.cozy.files document
|
|
189
|
+
* @param {import("../types").Doctype} referencedBy - Doctype where document is referenced
|
|
192
190
|
* @param {string} referencedId - Id of the referenced document
|
|
193
|
-
* @returns {Reference[]} Array of the reference found
|
|
191
|
+
* @returns {import("../types").Reference[]} Array of the reference found
|
|
194
192
|
*/
|
|
195
193
|
|
|
196
194
|
|
|
@@ -15,12 +15,10 @@ var _const = require("../const");
|
|
|
15
15
|
|
|
16
16
|
var _cozyDeviceHelper = require("cozy-device-helper");
|
|
17
17
|
|
|
18
|
-
var _types = require("../types");
|
|
19
|
-
|
|
20
18
|
/* global prompt */
|
|
21
19
|
|
|
22
20
|
/**
|
|
23
|
-
* @type {CordovaWindow}
|
|
21
|
+
* @type {import("../types").CordovaWindow}
|
|
24
22
|
*/
|
|
25
23
|
// @ts-ignore
|
|
26
24
|
var win = typeof window !== 'undefined' ? window : null;
|