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.
Files changed (57) hide show
  1. package/dist/CozyClient.js +44 -46
  2. package/dist/RealTimeQueries.js +6 -8
  3. package/dist/StackLink.js +4 -6
  4. package/dist/associations/Association.js +2 -4
  5. package/dist/associations/HasMany.js +6 -8
  6. package/dist/associations/HasManyFiles.js +5 -7
  7. package/dist/associations/HasManyInPlace.js +2 -4
  8. package/dist/associations/HasOne.js +5 -7
  9. package/dist/associations/HasOneInPlace.js +2 -4
  10. package/dist/associations/helpers.js +10 -12
  11. package/dist/authentication/mobile.js +1 -3
  12. package/dist/devtools/Queries.js +4 -6
  13. package/dist/errors.js +4 -6
  14. package/dist/flagship-certification/flagship-certification.js +2 -4
  15. package/dist/flagship-certification/store-attestation.android.js +2 -4
  16. package/dist/flagship-certification/store-attestation.ios.js +2 -4
  17. package/dist/flagship-certification/store-attestation.js +2 -4
  18. package/dist/helpers/urlHelper.js +3 -5
  19. package/dist/hooks/useAppsInMaintenance.js +1 -3
  20. package/dist/hooks/useCapabilities.js +1 -1
  21. package/dist/hooks/useClientErrors.js +3 -5
  22. package/dist/hooks/useQuery.js +2 -4
  23. package/dist/hooks/useQueryAll.js +2 -4
  24. package/dist/models/dacc.js +5 -7
  25. package/dist/models/document/documentTypeData.js +12 -14
  26. package/dist/models/document/documentTypeDataHelpers.js +4 -6
  27. package/dist/models/file.js +23 -25
  28. package/dist/models/folder.js +5 -7
  29. package/dist/models/timeseries.js +1 -3
  30. package/dist/queries/dsl.js +6 -8
  31. package/dist/store/documents.js +1 -3
  32. package/dist/store/queries.js +28 -30
  33. package/package.json +3 -3
  34. package/types/CozyClient.d.ts +75 -92
  35. package/types/RealTimeQueries.d.ts +1 -2
  36. package/types/StackLink.d.ts +4 -7
  37. package/types/associations/Association.d.ts +3 -4
  38. package/types/associations/HasMany.d.ts +6 -7
  39. package/types/associations/HasOne.d.ts +5 -6
  40. package/types/associations/helpers.d.ts +4 -7
  41. package/types/errors.d.ts +9 -11
  42. package/types/flagship-certification/flagship-certification.d.ts +1 -2
  43. package/types/flagship-certification/store-attestation.android.d.ts +1 -3
  44. package/types/flagship-certification/store-attestation.d.ts +3 -5
  45. package/types/flagship-certification/store-attestation.ios.d.ts +1 -3
  46. package/types/helpers/urlHelper.d.ts +2 -5
  47. package/types/hooks/useAppsInMaintenance.d.ts +2 -3
  48. package/types/hooks/useQuery.d.ts +3 -5
  49. package/types/hooks/useQueryAll.d.ts +3 -5
  50. package/types/models/dacc.d.ts +4 -7
  51. package/types/models/document/documentTypeData.d.ts +2 -3
  52. package/types/models/document/documentTypeDataHelpers.d.ts +1 -3
  53. package/types/models/file.d.ts +22 -24
  54. package/types/models/folder.d.ts +3 -5
  55. package/types/queries/dsl.d.ts +13 -16
  56. package/types/store/documents.d.ts +1 -2
  57. package/types/store/queries.d.ts +11 -16
@@ -15,8 +15,6 @@ var _sortBy = _interopRequireDefault(require("lodash/sortBy"));
15
15
 
16
16
  var _CozyClient = _interopRequireDefault(require("../CozyClient"));
17
17
 
18
- var _types = require("../types");
19
-
20
18
  var _const = require("../const");
21
19
 
22
20
  var APP_DOCTYPE = 'io.cozy.apps';
@@ -39,7 +37,7 @@ var MAGIC_FOLDERS = {
39
37
  * @param {string} id Magic Folder id. `CozyFolder.magicFolders` contains the
40
38
  * ids of folders that can be magic folders.
41
39
  * @param {string} path Default path to use if magic folder does not exist
42
- * @returns {Promise<IOCozyFolder>} Folder document
40
+ * @returns {Promise<import("../types").IOCozyFolder>} Folder document
43
41
  */
44
42
 
45
43
  exports.MAGIC_FOLDERS = MAGIC_FOLDERS;
@@ -110,8 +108,8 @@ var ensureMagicFolder = /*#__PURE__*/function () {
110
108
  *
111
109
  * @param {CozyClient} client - cozy-client instance
112
110
  * @param {string} path - Folder path
113
- * @param {CozyClientDocument} document - Document to make reference to. Any doctype.
114
- * @returns {Promise<IOCozyFolder>} Folder document
111
+ * @param {import("../types").CozyClientDocument} document - Document to make reference to. Any doctype.
112
+ * @returns {Promise<import("../types").IOCozyFolder>} Folder document
115
113
  */
116
114
 
117
115
 
@@ -161,8 +159,8 @@ var createFolderWithReference = /*#__PURE__*/function () {
161
159
  * Returns the most recent folder referenced by the given document
162
160
  *
163
161
  * @param {CozyClient} client cozy-client instance
164
- * @param {CozyClientDocument} document Document to get references from
165
- * @returns {Promise<IOCozyFolder>} Folder referenced by the given document
162
+ * @param {import("../types").CozyClientDocument} document Document to get references from
163
+ * @returns {Promise<import("../types").IOCozyFolder>} Folder referenced by the given document
166
164
  */
167
165
 
168
166
 
@@ -13,8 +13,6 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
13
13
 
14
14
  var _dsl = require("../queries/dsl");
15
15
 
16
- var _types = require("../types");
17
-
18
16
  var validateTimeSeriesFormat = function validateTimeSeriesFormat(timeseries) {
19
17
  if (!timeseries.startDate || !timeseries.endDate) {
20
18
  throw new Error('You must specify a startDate and endDate for the time serie');
@@ -120,7 +118,7 @@ var fetchTimeSeriesByIntervalAndSource = /*#__PURE__*/function () {
120
118
  startDate = _ref2.startDate, endDate = _ref2.endDate, dataType = _ref2.dataType, source = _ref2.source, limit = _ref2.limit;
121
119
 
122
120
  /**
123
- * @type {Doctype}
121
+ * @type {import("../types").Doctype}
124
122
  */
125
123
  doctype = "io.cozy.timeseries.".concat(dataType);
126
124
  query = (0, _dsl.Q)(doctype).where({
@@ -17,8 +17,6 @@ var _isArray = _interopRequireDefault(require("lodash/isArray"));
17
17
 
18
18
  var _findKey = _interopRequireDefault(require("lodash/findKey"));
19
19
 
20
- var _types = require("../types");
21
-
22
20
  var _logger = _interopRequireDefault(require("../logger"));
23
21
 
24
22
  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; }
@@ -54,9 +52,9 @@ var QueryDefinition = /*#__PURE__*/function () {
54
52
  * @class
55
53
  *
56
54
  * @param {object} options Initial options for the query definition
57
- * @param {Doctype} [options.doctype] - The doctype of the doc.
58
- * @param {DocId|null} [options.id] - The id of the doc.
59
- * @param {Array<DocId>} [options.ids] - The ids of the docs.
55
+ * @param {import('../types').Doctype} [options.doctype] - The doctype of the doc.
56
+ * @param {import('../types').DocId|null} [options.id] - The id of the doc.
57
+ * @param {Array<import('../types').DocId>} [options.ids] - The ids of the docs.
60
58
  * @param {MangoSelector} [options.selector] - The selector to query the docs.
61
59
  * @param {Array<string>} [options.fields] - The fields to return.
62
60
  * @param {Array<string>} [options.indexedFields] - The fields to index.
@@ -66,7 +64,7 @@ var QueryDefinition = /*#__PURE__*/function () {
66
64
  * @param {string|null} [options.referenced] - The referenced document.
67
65
  * @param {number|null} [options.limit] - The document's limit to return.
68
66
  * @param {number|null} [options.skip] - The number of docs to skip.
69
- * @param {CouchDBViewCursor} [options.cursor] - The cursor to paginate views.
67
+ * @param {import('../types').CouchDBViewCursor} [options.cursor] - The cursor to paginate views.
70
68
  * @param {string} [options.bookmark] - The bookmark to paginate mango queries.
71
69
  */
72
70
  function QueryDefinition() {
@@ -393,7 +391,7 @@ var QueryDefinition = /*#__PURE__*/function () {
393
391
  * the starting document of the query, e.g. "file-id".
394
392
  * Use the last docid of each query as startkey_docid to paginate or leave blank for the first query.
395
393
  *
396
- * @param {CouchDBViewCursor} cursor The cursor for pagination.
394
+ * @param {import('../types').CouchDBViewCursor} cursor The cursor for pagination.
397
395
  * @returns {QueryDefinition} The QueryDefinition object.
398
396
  */
399
397
 
@@ -466,7 +464,7 @@ var QueryDefinition = /*#__PURE__*/function () {
466
464
  * Helper to create a QueryDefinition. Recommended way to create
467
465
  * query definitions.
468
466
  *
469
- * @param {Doctype} doctype - Doctype of the query definition
467
+ * @param {import('../types').Doctype} doctype - Doctype of the query definition
470
468
  *
471
469
  * @example
472
470
  * ```
@@ -27,8 +27,6 @@ var _dsl = require("../queries/dsl");
27
27
 
28
28
  var _mutations = require("./mutations");
29
29
 
30
- var _types = require("../types");
31
-
32
30
  var _helpers = require("./helpers");
33
31
 
34
32
  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; }
@@ -68,7 +66,7 @@ var mergeDocumentsWithRelationships = function mergeDocumentsWithRelationships()
68
66
  var nextDocument = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
69
67
 
70
68
  /**
71
- * @type {CozyClientDocument}
69
+ * @type {import("../types").CozyClientDocument}
72
70
  */
73
71
  var merged = _objectSpread(_objectSpread({}, prevDocument), nextDocument);
74
72
 
@@ -51,8 +51,6 @@ var _helpers = require("./helpers");
51
51
 
52
52
  var _dsl = require("../queries/dsl");
53
53
 
54
- var _types = require("../types");
55
-
56
54
  var _logger = _interopRequireDefault(require("../logger"));
57
55
 
58
56
  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; }
@@ -78,7 +76,7 @@ exports.isQueryAction = isQueryAction;
78
76
  var isReceivingData = function isReceivingData(action) {
79
77
  return action.type === RECEIVE_QUERY_RESULT;
80
78
  };
81
- /** @type {QueryState} */
79
+ /** @type {import("../types").QueryState} */
82
80
 
83
81
 
84
82
  exports.isReceivingData = isReceivingData;
@@ -100,8 +98,8 @@ var queryInitialState = {
100
98
  /**
101
99
  * Return the docs ids accordingly to the given sort and fetched docs
102
100
  *
103
- * @param {QueryState} queryState - Current state
104
- * @param {DocumentsStateSlice} documents - Reference to the documents slice
101
+ * @param {import("../types").QueryState} queryState - Current state
102
+ * @param {import("../types").DocumentsStateSlice} documents - Reference to the documents slice
105
103
  * @param {Array<string>} ids - The updated ids after query
106
104
  * @param {object} params - The additional params
107
105
  * @param {number} params.count - The count of retrieved docs
@@ -144,9 +142,9 @@ var sortAndLimitDocsIds = function sortAndLimitDocsIds(queryState, documents, id
144
142
  /**
145
143
  * Return the query docs ids, taken from the action response and the documents' slice
146
144
  *
147
- * @param {QueryState} queryState - Current state
145
+ * @param {import("../types").QueryState} queryState - Current state
148
146
  * @param {object} response - The action response
149
- * @param {DocumentsStateSlice} documents - Reference to the documents slice
147
+ * @param {import("../types").DocumentsStateSlice} documents - Reference to the documents slice
150
148
  * @param {object} params - The additional params
151
149
  * @param {number} params.count - The count of retrieved docs
152
150
  * @param {number} params.fetchedPagesCount - The number of pages already fetched
@@ -168,10 +166,10 @@ var updateQueryDataFromResponse = function updateQueryDataFromResponse(queryStat
168
166
  /**
169
167
  * Reducer for a query slice
170
168
  *
171
- * @param {QueryState} state - Current state
169
+ * @param {import("../types").QueryState} state - Current state
172
170
  * @param {any} action - Redux action
173
- * @param {DocumentsStateSlice} documents - Reference to the next documents slice
174
- * @returns {QueryState} - Next state
171
+ * @param {import("../types").DocumentsStateSlice} documents - Reference to the next documents slice
172
+ * @returns {import("../types").QueryState} - Next state
175
173
  */
176
174
 
177
175
 
@@ -223,7 +221,7 @@ var query = function query() {
223
221
  lastUpdate: Date.now()
224
222
  });
225
223
  }
226
- /** @type {Partial<QueryState>} */
224
+ /** @type {Partial<import("../types").QueryState>} */
227
225
 
228
226
 
229
227
  var common = _objectSpread({
@@ -308,7 +306,7 @@ var mergeSelectorAndPartialIndex = function mergeSelectorAndPartialIndex(queryDe
308
306
  };
309
307
  /**
310
308
  * @param {QueryDefinition} queryDefinition - A query definition
311
- * @returns {function(CozyClientDocument): boolean}
309
+ * @returns {function(import("../types").CozyClientDocument): boolean}
312
310
  */
313
311
 
314
312
 
@@ -348,8 +346,8 @@ var getSelectorFilterFn = function getSelectorFilterFn(queryDefinition) {
348
346
  * Returns a predicate function that checks if a document should be
349
347
  * included in the result of the query.
350
348
  *
351
- * @param {QueryState} query - Definition of the query
352
- * @returns {function(CozyClientDocument): boolean} Predicate function
349
+ * @param {import("../types").QueryState} query - Definition of the query
350
+ * @returns {function(import("../types").CozyClientDocument): boolean} Predicate function
353
351
  */
354
352
 
355
353
 
@@ -378,7 +376,7 @@ var makeCaseInsensitiveStringSorter = function makeCaseInsensitiveStringSorter(a
378
376
  * receiving updates.
379
377
  *
380
378
  * @param {QueryDefinition} definition - A query definition
381
- * @returns {function(Array<CozyClientDocument>): Array<CozyClientDocument>}
379
+ * @returns {function(Array<import("../types").CozyClientDocument>): Array<import("../types").CozyClientDocument>}
382
380
  *
383
381
  * @private
384
382
  */
@@ -415,10 +413,10 @@ var makeSorterFromDefinition = function makeSorterFromDefinition(definition) {
415
413
  /**
416
414
  * Updates query state when new data comes in
417
415
  *
418
- * @param {QueryState} query - Current query state
419
- * @param {Array<CozyClientDocument>} newData - New documents (in most case from the server)
420
- * @param {DocumentsStateSlice} documents - A reference to the documents slice
421
- * @returns {QueryState} - Updated query state
416
+ * @param {import("../types").QueryState} query - Current query state
417
+ * @param {Array<import("../types").CozyClientDocument>} newData - New documents (in most case from the server)
418
+ * @param {import("../types").DocumentsStateSlice} documents - A reference to the documents slice
419
+ * @returns {import("../types").QueryState} - Updated query state
422
420
  */
423
421
 
424
422
 
@@ -463,8 +461,8 @@ var updateData = function updateData(query, newData, documents) {
463
461
  * from an action
464
462
  *
465
463
  * @param {object} action - A redux action
466
- * @param {DocumentsStateSlice} documents - Reference to documents slice
467
- * @returns {function(QueryState): QueryState} - Updater query state
464
+ * @param {import("../types").DocumentsStateSlice} documents - Reference to documents slice
465
+ * @returns {function(import("../types").QueryState): import("../types").QueryState} - Updater query state
468
466
  */
469
467
 
470
468
 
@@ -495,8 +493,8 @@ var autoQueryUpdater = function autoQueryUpdater(action, documents) {
495
493
  * from an action
496
494
  *
497
495
  * @param {object} action - A redux action
498
- * @param {DocumentsStateSlice} documents - Reference to documents slice
499
- * @returns {function(QueryState): QueryState} - Updater query state
496
+ * @param {import("../types").DocumentsStateSlice} documents - Reference to documents slice
497
+ * @returns {function(import("../types").QueryState): import("../types").QueryState} - Updater query state
500
498
  */
501
499
 
502
500
 
@@ -523,11 +521,11 @@ var manualQueryUpdater = function manualQueryUpdater(action, documents) {
523
521
  };
524
522
  };
525
523
  /**
526
- * @param {QueriesStateSlice} state - Redux slice containing all the query states indexed by name
524
+ * @param {import("../types").QueriesStateSlice} state - Redux slice containing all the query states indexed by name
527
525
  * @param {object} action - Income redux action
528
- * @param {DocumentsStateSlice} documents - Reference to documents slice
526
+ * @param {import("../types").DocumentsStateSlice} documents - Reference to documents slice
529
527
  * @param {boolean} haveDocumentsChanged - Has the document slice changed with current action
530
- * @returns {QueriesStateSlice}
528
+ * @returns {import("../types").QueriesStateSlice}
531
529
  */
532
530
 
533
531
 
@@ -576,7 +574,7 @@ var _default = queries;
576
574
  *
577
575
  * @param {string} queryId Name/id of the query
578
576
  * @param {QueryDefinition} queryDefinition - Definition of the created query
579
- * @param {QueryOptions} [options] - Options for the created query
577
+ * @param {import("../types").QueryOptions} [options] - Options for the created query
580
578
  * @returns {object} Redux action to dispatch
581
579
  */
582
580
 
@@ -600,7 +598,7 @@ var initQuery = function initQuery(queryId, queryDefinition) {
600
598
  * Update the fetchStatus when the query is loading
601
599
  *
602
600
  * @param {string} queryId - id of the query
603
- * @param {QueryOptions} [options] - Options for the created query
601
+ * @param {import("../types").QueryOptions} [options] - Options for the created query
604
602
  * @returns {object} Redux action to dispatch
605
603
  */
606
604
 
@@ -618,7 +616,7 @@ var loadQuery = function loadQuery(queryId, options) {
618
616
  *
619
617
  * @param {string} queryId - id of the query
620
618
  * @param {object} response - The action response
621
- * @param {QueryOptions} [options] - Options for the created query
619
+ * @param {import("../types").QueryOptions} [options] - Options for the created query
622
620
  * @returns {object} Redux action to dispatch
623
621
  */
624
622
 
@@ -638,7 +636,7 @@ var receiveQueryResult = function receiveQueryResult(queryId, response) {
638
636
  *
639
637
  * @param {string} queryId - id of the query
640
638
  * @param {object} error - The action error
641
- * @param {QueryOptions} [options] - Options for the created query
639
+ * @param {import("../types").QueryOptions} [options] - Options for the created query
642
640
  * @returns {object} Redux action to dispatch
643
641
  */
644
642
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-client",
3
- "version": "38.0.0",
3
+ "version": "38.0.2",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.node.js",
6
6
  "browser": "dist/index.js",
@@ -18,7 +18,7 @@
18
18
  "@types/jest": "^26.0.20",
19
19
  "@types/lodash": "^4.14.170",
20
20
  "btoa": "^1.2.1",
21
- "cozy-stack-client": "^38.0.0",
21
+ "cozy-stack-client": "^38.0.2",
22
22
  "date-fns": "2.29.3",
23
23
  "json-stable-stringify": "^1.0.1",
24
24
  "lodash": "^4.17.13",
@@ -73,5 +73,5 @@
73
73
  "react-native-ios11-devicecheck": "https://github.com/cozy/react-native-devicecheck#app-attest-v0.1"
74
74
  },
75
75
  "sideEffects": false,
76
- "gitHead": "a54a8c8c30ace268890beaa88c7f569682e67d5e"
76
+ "gitHead": "00ea71a1a19cfdcc353044666c3498c2b56c1500"
77
77
  }