cozy-pouch-link 51.6.1 → 51.7.0

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.
@@ -148,6 +148,7 @@ var normalizeAll = function normalizeAll(client) {
148
148
  * @property {string[]} doctypes Doctypes to replicate
149
149
  * @property {Record<string, object>} doctypesReplicationOptions A mapping from doctypes to replication options. All pouch replication options can be used, as well as the "strategy" option that determines which way the replication is done (can be "sync", "fromRemote" or "toRemote")
150
150
  * @property {import('./types').LinkPlatform} platform Platform specific adapters and methods
151
+ * @property {import('cozy-client/src/performances/types').PerformanceAPI} [performanceApi] - The performance API that can be used to measure performances
151
152
  */
152
153
 
153
154
  /**
@@ -180,7 +181,8 @@ var PouchLink = /*#__PURE__*/function (_CozyLink) {
180
181
  periodicSync = options.periodicSync,
181
182
  initialSync = options.initialSync,
182
183
  syncDebounceDelayInMs = options.syncDebounceDelayInMs,
183
- syncDebounceMaxDelayInMs = options.syncDebounceMaxDelayInMs;
184
+ syncDebounceMaxDelayInMs = options.syncDebounceMaxDelayInMs,
185
+ performanceApi = options.performanceApi;
184
186
  _this.options = options;
185
187
 
186
188
  if (!doctypes) {
@@ -201,6 +203,9 @@ var PouchLink = /*#__PURE__*/function (_CozyLink) {
201
203
  _this.startReplicationDebounced = (0, _debounce.default)(_this._startReplication, syncDebounceDelayInMs || DEFAULT_DEBOUNCE_DELAY, {
202
204
  maxWait: syncDebounceMaxDelayInMs || MAX_DEBOUNCE_DELAY
203
205
  });
206
+ /** @type {import('cozy-client/src/performances/types').PerformanceAPI} */
207
+
208
+ _this.performanceApi = performanceApi || _cozyClient.defaultPerformanceApi;
204
209
  return _this;
205
210
  }
206
211
  /**
@@ -355,7 +360,7 @@ var PouchLink = /*#__PURE__*/function (_CozyLink) {
355
360
  var _onLogin = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
356
361
  var _this2 = this;
357
362
 
358
- var prefix, shouldDestroyDatabases, adapter;
363
+ var markName, prefix, shouldDestroyDatabases, adapter;
359
364
  return _regenerator.default.wrap(function _callee3$(_context3) {
360
365
  while (1) {
361
366
  switch (_context3.prev = _context3.next) {
@@ -370,11 +375,12 @@ var PouchLink = /*#__PURE__*/function (_CozyLink) {
370
375
  return _context3.abrupt("return");
371
376
 
372
377
  case 3:
378
+ markName = this.performanceApi.mark('onLogin');
373
379
  prefix = (0, _utils.getPrefix)(this.client.stackClient.uri);
374
380
  shouldDestroyDatabases = this.pouches && this.pouches.options && this.pouches.options.prefix !== prefix;
375
381
 
376
382
  if (!shouldDestroyDatabases) {
377
- _context3.next = 15;
383
+ _context3.next = 16;
378
384
  break;
379
385
  }
380
386
 
@@ -382,47 +388,47 @@ var PouchLink = /*#__PURE__*/function (_CozyLink) {
382
388
  _logger.default.info('PouchLink: URI changed, destroy pouches');
383
389
  }
384
390
 
385
- _context3.prev = 7;
386
- _context3.next = 10;
391
+ _context3.prev = 8;
392
+ _context3.next = 11;
387
393
  return this.pouches.destroy();
388
394
 
389
- case 10:
390
- _context3.next = 15;
395
+ case 11:
396
+ _context3.next = 16;
391
397
  break;
392
398
 
393
- case 12:
394
- _context3.prev = 12;
395
- _context3.t0 = _context3["catch"](7);
399
+ case 13:
400
+ _context3.prev = 13;
401
+ _context3.t0 = _context3["catch"](8);
396
402
 
397
403
  _logger.default.warn('Error while destroying pouch DBs', _context3.t0);
398
404
 
399
- case 15:
405
+ case 16:
400
406
  if (prefix) {
401
- _context3.next = 17;
407
+ _context3.next = 18;
402
408
  break;
403
409
  }
404
410
 
405
411
  throw new Error('PouchLink: Prefix is required');
406
412
 
407
- case 17:
413
+ case 18:
408
414
  if (process.env.NODE_ENV !== 'production') {
409
415
  _logger.default.log('Create pouches with ' + prefix + ' prefix');
410
416
  }
411
417
 
412
- _context3.next = 20;
418
+ _context3.next = 21;
413
419
  return this.storage.getAdapterName();
414
420
 
415
- case 20:
421
+ case 21:
416
422
  if (_context3.sent) {
417
- _context3.next = 24;
423
+ _context3.next = 25;
418
424
  break;
419
425
  }
420
426
 
421
427
  adapter = (0, _get.default)(this.options, 'pouch.options.adapter');
422
- _context3.next = 24;
428
+ _context3.next = 25;
423
429
  return this.storage.persistAdapterName(adapter);
424
430
 
425
- case 24:
431
+ case 25:
426
432
  this.pouches = new _PouchManager.default(this.doctypes, {
427
433
  pouch: this.options.pouch,
428
434
  getReplicationURL: this.getReplicationURL.bind(this),
@@ -437,20 +443,25 @@ var PouchLink = /*#__PURE__*/function (_CozyLink) {
437
443
  executeQuery: this.executeQuery.bind(this),
438
444
  platform: this.options.platform
439
445
  });
440
- _context3.next = 27;
446
+ _context3.next = 28;
441
447
  return this.pouches.init();
442
448
 
443
- case 27:
449
+ case 28:
444
450
  if (this.client && this.initialSync) {
445
451
  this.startReplication();
446
452
  }
447
453
 
448
- case 28:
454
+ this.performanceApi.measure({
455
+ markName: markName,
456
+ category: 'CozyPouchLink'
457
+ });
458
+
459
+ case 30:
449
460
  case "end":
450
461
  return _context3.stop();
451
462
  }
452
463
  }
453
- }, _callee3, this, [[7, 12]]);
464
+ }, _callee3, this, [[8, 13]]);
454
465
  }));
455
466
 
456
467
  function onLogin() {
@@ -887,6 +898,7 @@ var PouchLink = /*#__PURE__*/function (_CozyLink) {
887
898
  value: function () {
888
899
  var _persistCozyData = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(data) {
889
900
  var forward,
901
+ markName,
890
902
  sanitizedDoc,
891
903
  oldDoc,
892
904
  db,
@@ -896,12 +908,13 @@ var PouchLink = /*#__PURE__*/function (_CozyLink) {
896
908
  switch (_context9.prev = _context9.next) {
897
909
  case 0:
898
910
  forward = _args9.length > 1 && _args9[1] !== undefined ? _args9[1] : doNothing;
911
+ markName = this.performanceApi.mark('persistCozyData');
899
912
  sanitizedDoc = this.sanitizeJsonApi(data);
900
913
  sanitizedDoc.cozyLocalOnly = true;
901
- _context9.next = 5;
914
+ _context9.next = 6;
902
915
  return this.getExistingDocument(data._id, data._type);
903
916
 
904
- case 5:
917
+ case 6:
905
918
  oldDoc = _context9.sent;
906
919
 
907
920
  if (oldDoc) {
@@ -909,10 +922,16 @@ var PouchLink = /*#__PURE__*/function (_CozyLink) {
909
922
  }
910
923
 
911
924
  db = this.pouches.getPouch(data._type);
912
- _context9.next = 10;
925
+ _context9.next = 11;
913
926
  return db.put(sanitizedDoc);
914
927
 
915
- case 10:
928
+ case 11:
929
+ this.performanceApi.measure({
930
+ markName: markName,
931
+ category: 'CozyPouchLink'
932
+ });
933
+
934
+ case 12:
916
935
  case "end":
917
936
  return _context9.stop();
918
937
  }
@@ -942,6 +961,7 @@ var PouchLink = /*#__PURE__*/function (_CozyLink) {
942
961
  var _getExistingDocument = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(id, type) {
943
962
  var throwIfNotFound,
944
963
  db,
964
+ markName,
945
965
  existingDoc,
946
966
  _args10 = arguments;
947
967
  return _regenerator.default.wrap(function _callee10$(_context10) {
@@ -951,33 +971,38 @@ var PouchLink = /*#__PURE__*/function (_CozyLink) {
951
971
  throwIfNotFound = _args10.length > 2 && _args10[2] !== undefined ? _args10[2] : false;
952
972
  _context10.prev = 1;
953
973
  db = this.pouches.getPouch(type);
954
- _context10.next = 5;
974
+ markName = this.performanceApi.mark('db.get from getExistingDocument');
975
+ _context10.next = 6;
955
976
  return db.get(id);
956
977
 
957
- case 5:
978
+ case 6:
958
979
  existingDoc = _context10.sent;
980
+ this.performanceApi.measure({
981
+ markName: markName,
982
+ category: 'PouchDB'
983
+ });
959
984
  return _context10.abrupt("return", existingDoc);
960
985
 
961
- case 9:
962
- _context10.prev = 9;
986
+ case 11:
987
+ _context10.prev = 11;
963
988
  _context10.t0 = _context10["catch"](1);
964
989
 
965
990
  if (!(_context10.t0.name === 'not_found' && !throwIfNotFound)) {
966
- _context10.next = 15;
991
+ _context10.next = 17;
967
992
  break;
968
993
  }
969
994
 
970
995
  return _context10.abrupt("return", null);
971
996
 
972
- case 15:
997
+ case 17:
973
998
  throw _context10.t0;
974
999
 
975
- case 16:
1000
+ case 18:
976
1001
  case "end":
977
1002
  return _context10.stop();
978
1003
  }
979
1004
  }
980
- }, _callee10, this, [[1, 9]]);
1005
+ }, _callee10, this, [[1, 11]]);
981
1006
  }));
982
1007
 
983
1008
  function getExistingDocument(_x9, _x10) {
@@ -1191,69 +1216,86 @@ var PouchLink = /*#__PURE__*/function (_CozyLink) {
1191
1216
  key: "executeQuery",
1192
1217
  value: function () {
1193
1218
  var _executeQuery = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(_ref3) {
1194
- var doctype, selector, sort, fields, limit, id, ids, skip, indexedFields, partialFilter, db, res, withRows, findSelector, findOpts, index;
1219
+ var doctype, selector, sort, fields, limit, id, ids, skip, indexedFields, partialFilter, markName, db, res, withRows, _markName, _markName2, _markName3, findSelector, findOpts, index, _markName4, jsonResult;
1220
+
1195
1221
  return _regenerator.default.wrap(function _callee14$(_context14) {
1196
1222
  while (1) {
1197
1223
  switch (_context14.prev = _context14.next) {
1198
1224
  case 0:
1199
1225
  doctype = _ref3.doctype, selector = _ref3.selector, sort = _ref3.sort, fields = _ref3.fields, limit = _ref3.limit, id = _ref3.id, ids = _ref3.ids, skip = _ref3.skip, indexedFields = _ref3.indexedFields, partialFilter = _ref3.partialFilter;
1226
+ markName = this.performanceApi.mark('executeQuery');
1200
1227
  db = this.getPouch(doctype);
1201
1228
 
1202
1229
  if (!id) {
1203
- _context14.next = 9;
1230
+ _context14.next = 12;
1204
1231
  break;
1205
1232
  }
1206
1233
 
1207
- _context14.next = 5;
1234
+ _markName = this.performanceApi.mark('db.get from executeQuery');
1235
+ _context14.next = 7;
1208
1236
  return db.get(id);
1209
1237
 
1210
- case 5:
1238
+ case 7:
1211
1239
  res = _context14.sent;
1240
+ this.performanceApi.measure({
1241
+ markName: _markName,
1242
+ category: 'PouchDB'
1243
+ });
1212
1244
  withRows = false;
1213
- _context14.next = 38;
1245
+ _context14.next = 47;
1214
1246
  break;
1215
1247
 
1216
- case 9:
1248
+ case 12:
1217
1249
  if (!ids) {
1218
- _context14.next = 18;
1250
+ _context14.next = 23;
1219
1251
  break;
1220
1252
  }
1221
1253
 
1222
- _context14.next = 12;
1254
+ _markName2 = this.performanceApi.mark('allDocs from executeQuery with ids');
1255
+ _context14.next = 16;
1223
1256
  return allDocs(db, {
1224
1257
  include_docs: true,
1225
1258
  keys: ids
1226
1259
  });
1227
1260
 
1228
- case 12:
1261
+ case 16:
1229
1262
  res = _context14.sent;
1263
+ this.performanceApi.measure({
1264
+ markName: _markName2,
1265
+ category: 'PouchDB'
1266
+ });
1230
1267
  res = withoutDesignDocuments(res);
1231
1268
  res.total_rows = null; // pouch indicates the total number of docs in res.total_rows, even though we use "keys". Setting it to null avoids cozy-client thinking there are more docs to fetch.
1232
1269
 
1233
1270
  withRows = true;
1234
- _context14.next = 38;
1271
+ _context14.next = 47;
1235
1272
  break;
1236
1273
 
1237
- case 18:
1274
+ case 23:
1238
1275
  if (!(!selector && !partialFilter && !fields && !sort)) {
1239
- _context14.next = 26;
1276
+ _context14.next = 33;
1240
1277
  break;
1241
1278
  }
1242
1279
 
1243
- _context14.next = 21;
1280
+ _markName3 = this.performanceApi.mark('allDocs from executeQuery');
1281
+ _context14.next = 27;
1244
1282
  return allDocs(db, {
1245
1283
  include_docs: true,
1246
1284
  limit: limit
1247
1285
  });
1248
1286
 
1249
- case 21:
1287
+ case 27:
1250
1288
  res = _context14.sent;
1289
+ this.performanceApi.measure({
1290
+ markName: _markName3,
1291
+ category: 'PouchDB'
1292
+ });
1251
1293
  res = withoutDesignDocuments(res);
1252
1294
  withRows = true;
1253
- _context14.next = 38;
1295
+ _context14.next = 47;
1254
1296
  break;
1255
1297
 
1256
- case 26:
1298
+ case 33:
1257
1299
  findSelector = _helpers.default.normalizeFindSelector({
1258
1300
  selector: selector,
1259
1301
  sort: sort,
@@ -1269,33 +1311,43 @@ var PouchLink = /*#__PURE__*/function (_CozyLink) {
1269
1311
  limit: limit,
1270
1312
  skip: skip
1271
1313
  };
1272
- _context14.next = 30;
1314
+ _context14.next = 37;
1273
1315
  return this.ensureIndex(doctype, _objectSpread(_objectSpread({}, findOpts), {}, {
1274
1316
  indexedFields: indexedFields,
1275
1317
  partialFilter: partialFilter
1276
1318
  }));
1277
1319
 
1278
- case 30:
1320
+ case 37:
1279
1321
  index = _context14.sent;
1280
1322
  findOpts.use_index = index.id;
1281
- _context14.next = 34;
1323
+ _markName4 = this.performanceApi.mark('find from executeQuery');
1324
+ _context14.next = 42;
1282
1325
  return find(db, findOpts);
1283
1326
 
1284
- case 34:
1327
+ case 42:
1285
1328
  res = _context14.sent;
1329
+ this.performanceApi.measure({
1330
+ markName: _markName4,
1331
+ category: 'PouchDB'
1332
+ });
1286
1333
  res.offset = skip;
1287
1334
  res.limit = limit;
1288
1335
  withRows = true;
1289
1336
 
1290
- case 38:
1291
- return _context14.abrupt("return", jsonapi.fromPouchResult({
1337
+ case 47:
1338
+ jsonResult = jsonapi.fromPouchResult({
1292
1339
  res: res,
1293
1340
  withRows: withRows,
1294
1341
  doctype: doctype,
1295
1342
  client: this.client
1296
- }));
1343
+ });
1344
+ this.performanceApi.measure({
1345
+ markName: markName,
1346
+ category: 'CozyPouchLink'
1347
+ });
1348
+ return _context14.abrupt("return", jsonResult);
1297
1349
 
1298
- case 39:
1350
+ case 50:
1299
1351
  case "end":
1300
1352
  return _context14.stop();
1301
1353
  }
@@ -1313,67 +1365,73 @@ var PouchLink = /*#__PURE__*/function (_CozyLink) {
1313
1365
  key: "executeMutation",
1314
1366
  value: function () {
1315
1367
  var _executeMutation = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(mutation, result, forward) {
1316
- var pouchRes;
1368
+ var markName, pouchRes, jsonResult;
1317
1369
  return _regenerator.default.wrap(function _callee15$(_context15) {
1318
1370
  while (1) {
1319
1371
  switch (_context15.prev = _context15.next) {
1320
1372
  case 0:
1373
+ markName = this.performanceApi.mark('executeMutation');
1321
1374
  _context15.t0 = mutation.mutationType;
1322
- _context15.next = _context15.t0 === _cozyClient.MutationTypes.CREATE_DOCUMENT ? 3 : _context15.t0 === _cozyClient.MutationTypes.UPDATE_DOCUMENT ? 7 : _context15.t0 === _cozyClient.MutationTypes.UPDATE_DOCUMENTS ? 11 : _context15.t0 === _cozyClient.MutationTypes.DELETE_DOCUMENT ? 15 : _context15.t0 === _cozyClient.MutationTypes.ADD_REFERENCES_TO ? 19 : 23;
1375
+ _context15.next = _context15.t0 === _cozyClient.MutationTypes.CREATE_DOCUMENT ? 4 : _context15.t0 === _cozyClient.MutationTypes.UPDATE_DOCUMENT ? 8 : _context15.t0 === _cozyClient.MutationTypes.UPDATE_DOCUMENTS ? 12 : _context15.t0 === _cozyClient.MutationTypes.DELETE_DOCUMENT ? 16 : _context15.t0 === _cozyClient.MutationTypes.ADD_REFERENCES_TO ? 20 : 24;
1323
1376
  break;
1324
1377
 
1325
- case 3:
1326
- _context15.next = 5;
1378
+ case 4:
1379
+ _context15.next = 6;
1327
1380
  return this.createDocument(mutation);
1328
1381
 
1329
- case 5:
1382
+ case 6:
1330
1383
  pouchRes = _context15.sent;
1331
- return _context15.abrupt("break", 24);
1384
+ return _context15.abrupt("break", 25);
1332
1385
 
1333
- case 7:
1334
- _context15.next = 9;
1386
+ case 8:
1387
+ _context15.next = 10;
1335
1388
  return this.updateDocument(mutation);
1336
1389
 
1337
- case 9:
1390
+ case 10:
1338
1391
  pouchRes = _context15.sent;
1339
- return _context15.abrupt("break", 24);
1392
+ return _context15.abrupt("break", 25);
1340
1393
 
1341
- case 11:
1342
- _context15.next = 13;
1394
+ case 12:
1395
+ _context15.next = 14;
1343
1396
  return this.updateDocuments(mutation);
1344
1397
 
1345
- case 13:
1398
+ case 14:
1346
1399
  pouchRes = _context15.sent;
1347
- return _context15.abrupt("break", 24);
1400
+ return _context15.abrupt("break", 25);
1348
1401
 
1349
- case 15:
1350
- _context15.next = 17;
1402
+ case 16:
1403
+ _context15.next = 18;
1351
1404
  return this.deleteDocument(mutation);
1352
1405
 
1353
- case 17:
1406
+ case 18:
1354
1407
  pouchRes = _context15.sent;
1355
- return _context15.abrupt("break", 24);
1408
+ return _context15.abrupt("break", 25);
1356
1409
 
1357
- case 19:
1358
- _context15.next = 21;
1410
+ case 20:
1411
+ _context15.next = 22;
1359
1412
  return this.addReferencesTo(mutation);
1360
1413
 
1361
- case 21:
1414
+ case 22:
1362
1415
  pouchRes = _context15.sent;
1363
- return _context15.abrupt("break", 24);
1416
+ return _context15.abrupt("break", 25);
1364
1417
 
1365
- case 23:
1418
+ case 24:
1366
1419
  return _context15.abrupt("return", forward(mutation, result));
1367
1420
 
1368
- case 24:
1369
- return _context15.abrupt("return", jsonapi.fromPouchResult({
1421
+ case 25:
1422
+ jsonResult = jsonapi.fromPouchResult({
1370
1423
  res: pouchRes,
1371
1424
  withRows: false,
1372
1425
  doctype: (0, _cozyClient.getDoctypeFromOperation)(mutation),
1373
1426
  client: this.client
1374
- }));
1427
+ });
1428
+ this.performanceApi.measure({
1429
+ markName: markName,
1430
+ category: 'CozyPouchLink'
1431
+ });
1432
+ return _context15.abrupt("return", jsonResult);
1375
1433
 
1376
- case 25:
1434
+ case 28:
1377
1435
  case "end":
1378
1436
  return _context15.stop();
1379
1437
  }
@@ -1558,62 +1616,73 @@ var PouchLink = /*#__PURE__*/function (_CozyLink) {
1558
1616
  key: "dbMethod",
1559
1617
  value: function () {
1560
1618
  var _dbMethod = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21(method, mutation) {
1561
- var doctype, doc, docs, db, res;
1619
+ var markName, doctype, doc, docs, db, res;
1562
1620
  return _regenerator.default.wrap(function _callee21$(_context21) {
1563
1621
  while (1) {
1564
1622
  switch (_context21.prev = _context21.next) {
1565
1623
  case 0:
1624
+ markName = this.performanceApi.mark("dbMethod ".concat(method));
1566
1625
  doctype = (0, _cozyClient.getDoctypeFromOperation)(mutation);
1567
1626
  doc = mutation.document, docs = mutation.documents;
1568
1627
  db = this.getPouch(doctype);
1569
- _context21.prev = 3;
1628
+ _context21.prev = 4;
1570
1629
 
1571
1630
  if (!docs) {
1572
- _context21.next = 10;
1631
+ _context21.next = 11;
1573
1632
  break;
1574
1633
  }
1575
1634
 
1576
- _context21.next = 7;
1635
+ _context21.next = 8;
1577
1636
  return db[method](docs.map(function (doc) {
1578
1637
  return sanitized(doc);
1579
1638
  }));
1580
1639
 
1581
- case 7:
1640
+ case 8:
1582
1641
  res = _context21.sent;
1583
- _context21.next = 17;
1642
+ _context21.next = 18;
1584
1643
  break;
1585
1644
 
1586
- case 10:
1645
+ case 11:
1587
1646
  if (!doc) {
1588
- _context21.next = 16;
1647
+ _context21.next = 17;
1589
1648
  break;
1590
1649
  }
1591
1650
 
1592
- _context21.next = 13;
1651
+ _context21.next = 14;
1593
1652
  return db[method](sanitized(doc));
1594
1653
 
1595
- case 13:
1654
+ case 14:
1596
1655
  res = _context21.sent;
1597
- _context21.next = 17;
1656
+ _context21.next = 18;
1598
1657
  break;
1599
1658
 
1600
- case 16:
1659
+ case 17:
1601
1660
  throw new Error('A mutation should either have document or documents member.');
1602
1661
 
1603
- case 17:
1662
+ case 18:
1663
+ this.performanceApi.measure({
1664
+ markName: markName,
1665
+ category: 'PouchDB'
1666
+ });
1604
1667
  return _context21.abrupt("return", res);
1605
1668
 
1606
- case 20:
1607
- _context21.prev = 20;
1608
- _context21.t0 = _context21["catch"](3);
1669
+ case 22:
1670
+ _context21.prev = 22;
1671
+ _context21.t0 = _context21["catch"](4);
1672
+ this.performanceApi.measure({
1673
+ markName: markName,
1674
+ measureName: "".concat(markName, " error"),
1675
+ category: 'PouchDB',
1676
+ color: 'error'
1677
+ });
1609
1678
  throw new Error("Coud not apply mutation: ".concat(_context21.t0.message));
1610
1679
 
1611
- case 23:
1680
+ case 26:
1612
1681
  case "end":
1613
1682
  return _context21.stop();
1614
1683
  }
1615
1684
  }
1616
- }, _callee21, this, [[3, 20]]);
1685
+ }, _callee21, this, [[4, 22]]);
1617
1686
  }));
1618
1687
 
1619
1688
  function dbMethod(_x24, _x25) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-pouch-link",
3
- "version": "51.6.1",
3
+ "version": "51.7.0",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "types/index.d.ts",
@@ -13,7 +13,7 @@
13
13
  "url": "git+https://github.com/cozy/cozy-client.git"
14
14
  },
15
15
  "dependencies": {
16
- "cozy-client": "^51.6.1",
16
+ "cozy-client": "^51.7.0",
17
17
  "pouchdb-browser": "^7.2.2",
18
18
  "pouchdb-find": "^7.2.2"
19
19
  },
@@ -39,5 +39,5 @@
39
39
  "typecheck": "tsc -p tsconfig.json"
40
40
  },
41
41
  "sideEffects": false,
42
- "gitHead": "b46c9c9248b140429972790624fa46b1b547226f"
42
+ "gitHead": "86418c696e22dcf873aa9d84ed195253ec058783"
43
43
  }
@@ -36,6 +36,10 @@ export type PouchLinkOptions = {
36
36
  * Platform specific adapters and methods
37
37
  */
38
38
  platform: import('./types').LinkPlatform;
39
+ /**
40
+ * - The performance API that can be used to measure performances
41
+ */
42
+ performanceApi?: any;
39
43
  };
40
44
  /**
41
45
  * @typedef {import('cozy-client/src/types').CozyClientDocument} CozyClientDocument
@@ -52,6 +56,7 @@ export type PouchLinkOptions = {
52
56
  * @property {string[]} doctypes Doctypes to replicate
53
57
  * @property {Record<string, object>} doctypesReplicationOptions A mapping from doctypes to replication options. All pouch replication options can be used, as well as the "strategy" option that determines which way the replication is done (can be "sync", "fromRemote" or "toRemote")
54
58
  * @property {import('./types').LinkPlatform} platform Platform specific adapters and methods
59
+ * @property {import('cozy-client/src/performances/types').PerformanceAPI} [performanceApi] - The performance API that can be used to measure performances
55
60
  */
56
61
  /**
57
62
  * Link to be passed to a `CozyClient` instance to support CouchDB. It instantiates
@@ -86,6 +91,8 @@ declare class PouchLink extends CozyLink {
86
91
  replicationStatus: Record<string, ReplicationStatus>;
87
92
  /** @private */
88
93
  private startReplicationDebounced;
94
+ /** @type {import('cozy-client/src/performances/types').PerformanceAPI} */
95
+ performanceApi: any;
89
96
  getReplicationURL(doctype: any): string;
90
97
  registerClient(client: any): Promise<void>;
91
98
  client: any;