cozy-client 32.3.0 → 32.3.3

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.
@@ -189,35 +189,38 @@ var CozyClient = /*#__PURE__*/function () {
189
189
  var rawOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
190
190
  (0, _classCallCheck2.default)(this, CozyClient);
191
191
  (0, _defineProperty2.default)(this, "fetchQueryAndGetFromState", /*#__PURE__*/function () {
192
- var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(query) {
192
+ var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref) {
193
+ var definition, options;
193
194
  return _regenerator.default.wrap(function _callee$(_context) {
194
195
  while (1) {
195
196
  switch (_context.prev = _context.next) {
196
197
  case 0:
197
- _context.prev = 0;
198
- _context.next = 3;
199
- return _this.query(query.definition, query.options);
198
+ definition = _ref.definition, options = _ref.options;
199
+ _context.prev = 1;
200
+ _context.next = 4;
201
+ return _this.query(definition, options);
200
202
 
201
- case 3:
202
- return _context.abrupt("return", _this.getQueryFromState(query.options.as));
203
+ case 4:
204
+ return _context.abrupt("return", _this.getQueryFromState(options.as));
203
205
 
204
- case 6:
205
- _context.prev = 6;
206
- _context.t0 = _context["catch"](0);
206
+ case 7:
207
+ _context.prev = 7;
208
+ _context.t0 = _context["catch"](1);
207
209
  throw _context.t0;
208
210
 
209
- case 9:
211
+ case 10:
210
212
  case "end":
211
213
  return _context.stop();
212
214
  }
213
215
  }
214
- }, _callee, null, [[0, 6]]);
216
+ }, _callee, null, [[1, 7]]);
215
217
  }));
216
218
 
217
219
  return function (_x) {
218
- return _ref.apply(this, arguments);
220
+ return _ref2.apply(this, arguments);
219
221
  };
220
222
  }());
223
+
221
224
  var link = rawOptions.link,
222
225
  links = rawOptions.links,
223
226
  _rawOptions$schema = rawOptions.schema,
@@ -225,15 +228,15 @@ var CozyClient = /*#__PURE__*/function () {
225
228
  _rawOptions$appMetada = rawOptions.appMetadata,
226
229
  appMetadata = _rawOptions$appMetada === void 0 ? {} : _rawOptions$appMetada,
227
230
  capabilities = rawOptions.capabilities,
228
- options = (0, _objectWithoutProperties2.default)(rawOptions, ["link", "links", "schema", "appMetadata", "capabilities"]);
231
+ _options = (0, _objectWithoutProperties2.default)(rawOptions, ["link", "links", "schema", "appMetadata", "capabilities"]);
229
232
 
230
233
  if (link) {
231
234
  console.warn('`link` is deprecated, use `links`');
232
235
  }
233
236
 
234
237
  this.appMetadata = appMetadata;
235
- options.uri = securiseUri(options.uri);
236
- this.options = options;
238
+ _options.uri = securiseUri(_options.uri);
239
+ this.options = _options;
237
240
  this.queryIdGenerator = new _queries.QueryIDGenerator();
238
241
  this.isLogged = false;
239
242
  this.instanceOptions = {}; // Bind handlers
@@ -266,7 +269,7 @@ var CozyClient = /*#__PURE__*/function () {
266
269
  } catch (err) {// not a critical error, we may be in node or the instance options are not on the default HTML element
267
270
  }
268
271
 
269
- if (options.uri && options.token) {
272
+ if (_options.uri && _options.token) {
270
273
  this.login();
271
274
  }
272
275
  /**
@@ -276,7 +279,7 @@ var CozyClient = /*#__PURE__*/function () {
276
279
 
277
280
  this.storeAccesors = null;
278
281
 
279
- if (options.store !== false) {
282
+ if (_options.store !== false) {
280
283
  this.ensureStore();
281
284
  }
282
285
  /**
@@ -873,8 +876,11 @@ var CozyClient = /*#__PURE__*/function () {
873
876
  * - Can only be called with documents from the same doctype
874
877
  * - Does not support automatic creation of references
875
878
  *
876
- * @param {CozyClientDocument[]} docs
877
- * @param {Object} mutationOptions
879
+ * @param {CozyClientDocument[]} docs - Documents from the same doctype
880
+ * @param {Object} mutationOptions - Mutation Options
881
+ * @param {string} [mutationOptions.as] - Mutation id
882
+ * @param {Function} [mutationOptions.update] - Function to update the document
883
+ * @param {Function} [mutationOptions.updateQueries] - Function to update queries
878
884
  * @returns {Promise<void>}
879
885
  */
880
886
 
@@ -948,6 +954,13 @@ var CozyClient = /*#__PURE__*/function () {
948
954
 
949
955
  return saveAll;
950
956
  }()
957
+ /**
958
+ * @param {CozyClientDocument} document - Document that will be saved
959
+ * @param {object} [options={event: DOC_CREATION}] - Event
960
+ * @param {string} [options.event] - Mutation type
961
+ * @returns {CozyClientDocument}
962
+ */
963
+
951
964
  }, {
952
965
  key: "ensureCozyMetadata",
953
966
  value: function ensureCozyMetadata(document) {
@@ -1032,7 +1045,7 @@ var CozyClient = /*#__PURE__*/function () {
1032
1045
  * ```
1033
1046
  *
1034
1047
  *
1035
- * @param {object} document - Document to create
1048
+ * @param {CozyClientDocument} document - Document to create
1036
1049
  * @param {ReferenceMap} [referencesByName] - References to the created document. The
1037
1050
  * relationship class associated to each reference list should support references, otherwise this
1038
1051
  * method will throw.
@@ -1074,10 +1087,10 @@ var CozyClient = /*#__PURE__*/function () {
1074
1087
  return [saveMutation, function (response) {
1075
1088
  var doc = _this3.hydrateDocument(response.data);
1076
1089
 
1077
- return Object.entries(referencesByName).map(function (_ref2) {
1078
- var _ref3 = (0, _slicedToArray2.default)(_ref2, 2),
1079
- relName = _ref3[0],
1080
- references = _ref3[1];
1090
+ return Object.entries(referencesByName).map(function (_ref3) {
1091
+ var _ref4 = (0, _slicedToArray2.default)(_ref3, 2),
1092
+ relName = _ref4[0],
1093
+ references = _ref4[1];
1081
1094
 
1082
1095
  var relationship = doc[relName];
1083
1096
  return relationship.addReferences(references);
@@ -1214,7 +1227,7 @@ var CozyClient = /*#__PURE__*/function () {
1214
1227
  var _query = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(queryDefinition) {
1215
1228
  var _this4 = this;
1216
1229
 
1217
- var _ref4,
1230
+ var _ref5,
1218
1231
  update,
1219
1232
  options,
1220
1233
  queryId,
@@ -1227,8 +1240,8 @@ var CozyClient = /*#__PURE__*/function () {
1227
1240
  while (1) {
1228
1241
  switch (_context8.prev = _context8.next) {
1229
1242
  case 0:
1230
- _ref4 = _args8.length > 1 && _args8[1] !== undefined ? _args8[1] : {};
1231
- update = _ref4.update, options = (0, _objectWithoutProperties2.default)(_ref4, ["update"]);
1243
+ _ref5 = _args8.length > 1 && _args8[1] !== undefined ? _args8[1] : {};
1244
+ update = _ref5.update, options = (0, _objectWithoutProperties2.default)(_ref5, ["update"]);
1232
1245
  this.ensureStore();
1233
1246
  queryId = options.as || this.queryIdGenerator.generateId(queryDefinition);
1234
1247
  existingQuery = this.getQueryFromState(queryId);
@@ -1446,7 +1459,7 @@ var CozyClient = /*#__PURE__*/function () {
1446
1459
  key: "mutate",
1447
1460
  value: function () {
1448
1461
  var _mutate = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(mutationDefinition) {
1449
- var _ref5,
1462
+ var _ref6,
1450
1463
  update,
1451
1464
  updateQueries,
1452
1465
  options,
@@ -1458,8 +1471,8 @@ var CozyClient = /*#__PURE__*/function () {
1458
1471
  while (1) {
1459
1472
  switch (_context10.prev = _context10.next) {
1460
1473
  case 0:
1461
- _ref5 = _args10.length > 1 && _args10[1] !== undefined ? _args10[1] : {};
1462
- update = _ref5.update, updateQueries = _ref5.updateQueries, options = (0, _objectWithoutProperties2.default)(_ref5, ["update", "updateQueries"]);
1474
+ _ref6 = _args10.length > 1 && _args10[1] !== undefined ? _args10[1] : {};
1475
+ update = _ref6.update, updateQueries = _ref6.updateQueries, options = (0, _objectWithoutProperties2.default)(_ref6, ["update", "updateQueries"]);
1463
1476
  this.ensureStore();
1464
1477
  mutationId = options.as || this.queryIdGenerator.generateId(mutationDefinition);
1465
1478
  this.dispatch((0, _store.initMutation)(mutationId, mutationDefinition));
@@ -1928,6 +1941,8 @@ var CozyClient = /*#__PURE__*/function () {
1928
1941
  * Has a behavior close to <Query /> or useQuery
1929
1942
  *
1930
1943
  * @param {object} query - Query with definition and options
1944
+ * @param {QueryDefinition} query.definition - Query Definition
1945
+ * @param {QueryOptions} query.options - Query Options
1931
1946
  * @returns {Promise<QueryState>} Query state
1932
1947
  */
1933
1948
 
@@ -2050,12 +2065,12 @@ var CozyClient = /*#__PURE__*/function () {
2050
2065
  key: "authorize",
2051
2066
  value: function () {
2052
2067
  var _authorize = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
2053
- var _ref6,
2054
- _ref6$openURLCallback,
2068
+ var _ref7,
2069
+ _ref7$openURLCallback,
2055
2070
  openURLCallback,
2056
- _ref6$sessionCode,
2071
+ _ref7$sessionCode,
2057
2072
  sessionCode,
2058
- _ref6$pkceCodes,
2073
+ _ref7$pkceCodes,
2059
2074
  pkceCodes,
2060
2075
  codeVerifier,
2061
2076
  codeChallenge,
@@ -2072,7 +2087,7 @@ var CozyClient = /*#__PURE__*/function () {
2072
2087
  while (1) {
2073
2088
  switch (_context16.prev = _context16.next) {
2074
2089
  case 0:
2075
- _ref6 = _args16.length > 0 && _args16[0] !== undefined ? _args16[0] : {}, _ref6$openURLCallback = _ref6.openURLCallback, openURLCallback = _ref6$openURLCallback === void 0 ? _mobile.authFunction : _ref6$openURLCallback, _ref6$sessionCode = _ref6.sessionCode, sessionCode = _ref6$sessionCode === void 0 ? undefined : _ref6$sessionCode, _ref6$pkceCodes = _ref6.pkceCodes, pkceCodes = _ref6$pkceCodes === void 0 ? {} : _ref6$pkceCodes;
2090
+ _ref7 = _args16.length > 0 && _args16[0] !== undefined ? _args16[0] : {}, _ref7$openURLCallback = _ref7.openURLCallback, openURLCallback = _ref7$openURLCallback === void 0 ? _mobile.authFunction : _ref7$openURLCallback, _ref7$sessionCode = _ref7.sessionCode, sessionCode = _ref7$sessionCode === void 0 ? undefined : _ref7$sessionCode, _ref7$pkceCodes = _ref7.pkceCodes, pkceCodes = _ref7$pkceCodes === void 0 ? {} : _ref7$pkceCodes;
2076
2091
  _context16.prev = 1;
2077
2092
  codeVerifier = pkceCodes.codeVerifier, codeChallenge = pkceCodes.codeChallenge;
2078
2093
  stackClient = this.getStackClient();
@@ -2169,9 +2184,9 @@ var CozyClient = /*#__PURE__*/function () {
2169
2184
  }, {
2170
2185
  key: "setStore",
2171
2186
  value: function setStore(store) {
2172
- var _ref7 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
2173
- _ref7$force = _ref7.force,
2174
- force = _ref7$force === void 0 ? false : _ref7$force;
2187
+ var _ref8 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
2188
+ _ref8$force = _ref8.force,
2189
+ force = _ref8$force === void 0 ? false : _ref8$force;
2175
2190
 
2176
2191
  if (store === undefined) {
2177
2192
  throw new Error('Store is undefined');
@@ -2365,10 +2380,10 @@ var CozyClient = /*#__PURE__*/function () {
2365
2380
  var _this10 = this;
2366
2381
 
2367
2382
  this.ensureStore();
2368
- Object.entries(data).forEach(function (_ref8) {
2369
- var _ref9 = (0, _slicedToArray2.default)(_ref8, 2),
2370
- doctype = _ref9[0],
2371
- data = _ref9[1];
2383
+ Object.entries(data).forEach(function (_ref9) {
2384
+ var _ref10 = (0, _slicedToArray2.default)(_ref9, 2),
2385
+ doctype = _ref10[0],
2386
+ data = _ref10[1];
2372
2387
 
2373
2388
  _this10.dispatch((0, _store.receiveQueryResult)(null, {
2374
2389
  data: data
@@ -2550,7 +2565,7 @@ var CozyClient = /*#__PURE__*/function () {
2550
2565
  CozyClient.hooks = CozyClient.hooks || {};
2551
2566
  CozyClient.fetchPolicies = _policies.default; //COZY_CLIENT_VERSION_PACKAGE in replaced by babel. See babel config
2552
2567
 
2553
- CozyClient.version = "32.3.0";
2568
+ CozyClient.version = "32.3.3";
2554
2569
 
2555
2570
  _microee.default.mixin(CozyClient);
2556
2571
 
@@ -27,7 +27,7 @@ var win = typeof window !== 'undefined' ? window : null;
27
27
  /**
28
28
  * Open a SafariView Controller and resolve with the URL containing the token
29
29
  *
30
- * @param {string} url
30
+ * @param {string} url - Url containing access_code and state
31
31
  * @returns {Promise}
32
32
  */
33
33
 
@@ -65,7 +65,7 @@ var authenticateWithSafari = function authenticateWithSafari(url) {
65
65
  /**
66
66
  * Opens an InAppBrowser and resolves with the URL containing the token
67
67
  *
68
- * @param {string} url
68
+ * @param {string} url - Url containing access_code and state
69
69
  * @returns {Promise}
70
70
  */
71
71
 
@@ -93,7 +93,7 @@ var getClassNameForExecutedTimesQuery = function getClassNameForExecutedTimesQue
93
93
  }
94
94
  };
95
95
  /**
96
- * @param {{ queryState: QueryState }} props
96
+ * @param {{ queryState: QueryState }} props - Query state containing fetchStatus, lastError
97
97
  */
98
98
 
99
99
 
@@ -106,7 +106,7 @@ var FetchStatus = function FetchStatus(props) {
106
106
  }, fetchStatus, fetchStatus === 'failed' ? " - ".concat(lastError) : null);
107
107
  };
108
108
  /**
109
- * @param {{ queryState: QueryState }} props
109
+ * @param {{ queryState: QueryState }} props - Query state containing definition
110
110
  */
111
111
 
112
112
 
@@ -17,6 +17,8 @@ var _logger = _interopRequireDefault(require("../logger"));
17
17
 
18
18
  var _storeAttestation = require("./store-attestation");
19
19
 
20
+ var _typedefs = require("./typedefs");
21
+
20
22
  /**
21
23
  * Request a challenge from the Stack that can be used to request the app attestation from the app store
22
24
  *
@@ -13,7 +13,9 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
13
13
 
14
14
  var _reactNativeGoogleSafetynet = _interopRequireDefault(require("react-native-google-safetynet"));
15
15
 
16
- //@ts-ignore
16
+ var _typedefs = require("./typedefs");
17
+
18
+ //@ts-ignore next-line
17
19
 
18
20
  /**
19
21
  * Retrieve the app's attestation from the Google Play store
@@ -13,7 +13,9 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
13
13
 
14
14
  var _reactNativeIos11Devicecheck = _interopRequireDefault(require("react-native-ios11-devicecheck"));
15
15
 
16
- //@ts-ignore
16
+ var _typedefs = require("./typedefs");
17
+
18
+ //@ts-ignore next-line
17
19
 
18
20
  /**
19
21
  * Retrieve the app's attestation from the Apple AppStore
@@ -11,6 +11,8 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
11
11
 
12
12
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
13
 
14
+ var _typedefs = require("./typedefs");
15
+
14
16
  /**
15
17
  * Retrieve the app's attestation from the app's store
16
18
  * /!\ This is a mock implementation that should never be called
@@ -1,3 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
1
8
  /**
2
9
  * @typedef {string} jws - A JSON Web Signature
3
10
  */
@@ -17,4 +24,5 @@
17
24
  * @typedef {object} CertificationConfig - Configuration to access the stores certification API
18
25
  * @property {string} androidSafetyNetApiKey
19
26
  */
20
- "use strict";
27
+ var _default = {};
28
+ exports.default = _default;
package/dist/manifest.js CHANGED
@@ -38,9 +38,9 @@ function isPartnershipValid(partnership) {
38
38
  return Boolean(partnership && partnership.description);
39
39
  }
40
40
  /**
41
- * Normalize app manifest, retrocompatibility for old manifests
41
+ * Normalize app manifest, retro-compatibility for old manifests
42
42
  *
43
- * @param {Manifest} manifest
43
+ * @param {Manifest} manifest - app manifest to normalize
44
44
  * @returns {Manifest}
45
45
  */
46
46
 
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.locales = void 0;
9
+
10
+ var locales = _interopRequireWildcard(require("./locales"));
11
+
12
+ exports.locales = locales;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ Object.defineProperty(exports, "fr", {
9
+ enumerable: true,
10
+ get: function get() {
11
+ return _fr.default;
12
+ }
13
+ });
14
+ Object.defineProperty(exports, "en", {
15
+ enumerable: true,
16
+ get: function get() {
17
+ return _en.default;
18
+ }
19
+ });
20
+
21
+ var _fr = _interopRequireDefault(require("./fr.json"));
22
+
23
+ var _en = _interopRequireDefault(require("./en.json"));
@@ -5,7 +5,7 @@ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWild
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.dacc = exports.sharing = exports.timeseries = exports.document = exports.contact = exports.utils = exports.permission = exports.note = exports.account = exports.folder = exports.file = exports.applications = exports.instance = exports.trigger = exports.accounts = exports.triggers = void 0;
8
+ exports.doctypes = exports.dacc = exports.sharing = exports.timeseries = exports.document = exports.contact = exports.utils = exports.permission = exports.note = exports.account = exports.folder = exports.file = exports.applications = exports.instance = exports.trigger = exports.accounts = exports.triggers = void 0;
9
9
 
10
10
  var trigger = _interopRequireWildcard(require("./trigger"));
11
11
 
@@ -62,6 +62,10 @@ exports.sharing = sharing;
62
62
  var dacc = _interopRequireWildcard(require("./dacc"));
63
63
 
64
64
  exports.dacc = dacc;
65
+
66
+ var doctypes = _interopRequireWildcard(require("./doctypes"));
67
+
68
+ exports.doctypes = doctypes;
65
69
  // For backward compatibility before 9.0.0
66
70
  var triggers = trigger;
67
71
  exports.triggers = triggers;
package/dist/types.js CHANGED
@@ -158,6 +158,7 @@ var _dsl = require("./queries/dsl");
158
158
  * @property {boolean} [_deleted] - When the document has been deleted
159
159
  * @property {ReferencedByRelationship} [relationships] - Relationships of the document
160
160
  * @property {Reference[]} [referenced_by] - referenced by of another document
161
+ * @property {object} [cozyMetadata] - Cozy Metadata
161
162
  */
162
163
 
163
164
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-client",
3
- "version": "32.3.0",
3
+ "version": "32.3.3",
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": "^32.2.5",
21
+ "cozy-stack-client": "^32.3.3",
22
22
  "json-stable-stringify": "^1.0.1",
23
23
  "lodash": "^4.17.13",
24
24
  "microee": "^0.0.6",
@@ -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": "17febe46fab581b9bb87d8fb4fd28060447c8841"
76
+ "gitHead": "e8d0916a43759433221c24dc62c48ca1627b5f96"
77
77
  }
@@ -331,14 +331,27 @@ declare class CozyClient {
331
331
  * - Can only be called with documents from the same doctype
332
332
  * - Does not support automatic creation of references
333
333
  *
334
- * @param {CozyClientDocument[]} docs
335
- * @param {Object} mutationOptions
334
+ * @param {CozyClientDocument[]} docs - Documents from the same doctype
335
+ * @param {Object} mutationOptions - Mutation Options
336
+ * @param {string} [mutationOptions.as] - Mutation id
337
+ * @param {Function} [mutationOptions.update] - Function to update the document
338
+ * @param {Function} [mutationOptions.updateQueries] - Function to update queries
336
339
  * @returns {Promise<void>}
337
340
  */
338
- saveAll(docs: CozyClientDocument[], mutationOptions?: any): Promise<void>;
339
- ensureCozyMetadata(document: any, options?: {
340
- event: string;
341
- }): any;
341
+ saveAll(docs: CozyClientDocument[], mutationOptions?: {
342
+ as?: string;
343
+ update?: Function;
344
+ updateQueries?: Function;
345
+ }): Promise<void>;
346
+ /**
347
+ * @param {CozyClientDocument} document - Document that will be saved
348
+ * @param {object} [options={event: DOC_CREATION}] - Event
349
+ * @param {string} [options.event] - Mutation type
350
+ * @returns {CozyClientDocument}
351
+ */
352
+ ensureCozyMetadata(document: CozyClientDocument, options?: {
353
+ event?: string;
354
+ }): CozyClientDocument;
342
355
  /**
343
356
  * Dehydrates and adds metadata before saving a document
344
357
  *
@@ -360,14 +373,14 @@ declare class CozyClient {
360
373
  * ```
361
374
  *
362
375
  *
363
- * @param {object} document - Document to create
376
+ * @param {CozyClientDocument} document - Document to create
364
377
  * @param {ReferenceMap} [referencesByName] - References to the created document. The
365
378
  * relationship class associated to each reference list should support references, otherwise this
366
379
  * method will throw.
367
380
  *
368
381
  * @returns {Mutation[]|Mutation} One or more mutation to execute
369
382
  */
370
- getDocumentSavePlan(document: object, referencesByName?: ReferenceMap): Mutation[] | Mutation;
383
+ getDocumentSavePlan(document: CozyClientDocument, referencesByName?: ReferenceMap): Mutation[] | Mutation;
371
384
  triggerHook(name: any, document: any): void;
372
385
  /**
373
386
  * Destroys a document. {before,after}:destroy hooks will be fired.
@@ -542,9 +555,14 @@ declare class CozyClient {
542
555
  * Has a behavior close to <Query /> or useQuery
543
556
  *
544
557
  * @param {object} query - Query with definition and options
558
+ * @param {QueryDefinition} query.definition - Query Definition
559
+ * @param {QueryOptions} query.options - Query Options
545
560
  * @returns {Promise<QueryState>} Query state
546
561
  */
547
- fetchQueryAndGetFromState: (query: object) => Promise<QueryState>;
562
+ fetchQueryAndGetFromState: ({ definition, options }: {
563
+ definition: QueryDefinition;
564
+ options: QueryOptions;
565
+ }) => Promise<QueryState>;
548
566
  /**
549
567
  * Performs a complete OAuth flow using a Cordova webview
550
568
  * or React Native WebView for auth.
@@ -1,2 +1,3 @@
1
1
  export function certifyFlagship(certificationConfig: CertificationConfig, client: CozyClient): Promise<void>;
2
+ import { CertificationConfig } from "./typedefs";
2
3
  import CozyClient from "../CozyClient";
@@ -1 +1,3 @@
1
1
  export function getAppAttestationFromStore(nonce: string, certificationConfig: CertificationConfig): Promise<AttestationResult>;
2
+ import { CertificationConfig } from "./typedefs";
3
+ import { AttestationResult } from "./typedefs";
@@ -7,3 +7,5 @@
7
7
  * @returns {Promise<AttestationResult>} the app's attestation
8
8
  */
9
9
  export function getAppAttestationFromStore(nonce: string, certificationConfig: CertificationConfig): Promise<AttestationResult>;
10
+ import { CertificationConfig } from "./typedefs";
11
+ import { AttestationResult } from "./typedefs";
@@ -1 +1,3 @@
1
1
  export function getAppAttestationFromStore(nonce: string, certificationConfig: CertificationConfig): Promise<AttestationResult>;
2
+ import { CertificationConfig } from "./typedefs";
3
+ import { AttestationResult } from "./typedefs";
@@ -1,15 +1,17 @@
1
+ declare var _default: {};
2
+ export default _default;
1
3
  /**
2
4
  * - A JSON Web Signature
3
5
  */
4
- type jws = string;
6
+ export type jws = string;
5
7
  /**
6
8
  * - A JSON Web Signature
7
9
  */
8
- type base64string = string;
10
+ export type base64string = string;
9
11
  /**
10
12
  * - An app attestation from the app store
11
13
  */
12
- type AttestationResult = {
14
+ export type AttestationResult = {
13
15
  platform: string;
14
16
  attestation: jws | base64string;
15
17
  keyId?: string;
@@ -17,6 +19,6 @@ type AttestationResult = {
17
19
  /**
18
20
  * - Configuration to access the stores certification API
19
21
  */
20
- type CertificationConfig = {
22
+ export type CertificationConfig = {
21
23
  androidSafetyNetApiKey: string;
22
24
  };
@@ -3,9 +3,9 @@ export function sanitizeCategories(categories: any): any;
3
3
  export function areTermsValid(terms: any): boolean;
4
4
  export function isPartnershipValid(partnership: any): boolean;
5
5
  /**
6
- * Normalize app manifest, retrocompatibility for old manifests
6
+ * Normalize app manifest, retro-compatibility for old manifests
7
7
  *
8
- * @param {Manifest} manifest
8
+ * @param {Manifest} manifest - app manifest to normalize
9
9
  * @returns {Manifest}
10
10
  */
11
11
  export function sanitize(manifest: Manifest): Manifest;
@@ -0,0 +1,2 @@
1
+ export { locales };
2
+ import * as locales from "./locales";
@@ -0,0 +1,3 @@
1
+ import fr from "./fr.json";
2
+ import en from "./en.json";
3
+ export { fr, en };
@@ -14,4 +14,5 @@ import * as document from "./document";
14
14
  import * as timeseries from "./timeseries";
15
15
  import * as sharing from "./sharing";
16
16
  import * as dacc from "./dacc";
17
- export { trigger, instance, applications, file, folder, note, account, permission, utils, contact, document, timeseries, sharing, dacc };
17
+ import * as doctypes from "./doctypes";
18
+ export { trigger, instance, applications, file, folder, note, account, permission, utils, contact, document, timeseries, sharing, dacc, doctypes };
package/types/types.d.ts CHANGED
@@ -164,6 +164,10 @@ export type CozyClientDocument = {
164
164
  * - referenced by of another document
165
165
  */
166
166
  referenced_by?: Reference[];
167
+ /**
168
+ * - Cozy Metadata
169
+ */
170
+ cozyMetadata?: object;
167
171
  };
168
172
  /**
169
173
  * - An io.cozy.files document