cozy-pouch-link 51.7.0 → 52.0.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.
- package/dist/CozyPouchLink.js +48 -39
- package/dist/CozyPouchLink.spec.js +2 -2
- package/package.json +3 -3
- package/types/CozyPouchLink.d.ts +1 -1
package/dist/CozyPouchLink.js
CHANGED
|
@@ -696,7 +696,7 @@ var PouchLink = /*#__PURE__*/function (_CozyLink) {
|
|
|
696
696
|
}, {
|
|
697
697
|
key: "request",
|
|
698
698
|
value: function () {
|
|
699
|
-
var _request = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(operation) {
|
|
699
|
+
var _request = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(operation, options) {
|
|
700
700
|
var result,
|
|
701
701
|
forward,
|
|
702
702
|
doctype,
|
|
@@ -705,12 +705,21 @@ var PouchLink = /*#__PURE__*/function (_CozyLink) {
|
|
|
705
705
|
while (1) {
|
|
706
706
|
switch (_context6.prev = _context6.next) {
|
|
707
707
|
case 0:
|
|
708
|
-
result = _args6.length >
|
|
709
|
-
forward = _args6.length >
|
|
708
|
+
result = _args6.length > 2 && _args6[2] !== undefined ? _args6[2] : null;
|
|
709
|
+
forward = _args6.length > 3 && _args6[3] !== undefined ? _args6[3] : doNothing;
|
|
710
|
+
|
|
711
|
+
if (!(options !== null && options !== void 0 && options.forceStack)) {
|
|
712
|
+
_context6.next = 4;
|
|
713
|
+
break;
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
return _context6.abrupt("return", forward(operation, options));
|
|
717
|
+
|
|
718
|
+
case 4:
|
|
710
719
|
doctype = (0, _cozyClient.getDoctypeFromOperation)(operation);
|
|
711
720
|
|
|
712
721
|
if (this.pouches) {
|
|
713
|
-
_context6.next =
|
|
722
|
+
_context6.next = 8;
|
|
714
723
|
break;
|
|
715
724
|
}
|
|
716
725
|
|
|
@@ -718,11 +727,11 @@ var PouchLink = /*#__PURE__*/function (_CozyLink) {
|
|
|
718
727
|
_logger.default.info("Tried to access local ".concat(doctype, " but Cozy Pouch is not initialized yet. Forwarding the operation to next link"));
|
|
719
728
|
}
|
|
720
729
|
|
|
721
|
-
return _context6.abrupt("return", forward(operation));
|
|
730
|
+
return _context6.abrupt("return", forward(operation, options));
|
|
722
731
|
|
|
723
|
-
case
|
|
732
|
+
case 8:
|
|
724
733
|
if (!(this.pouches.getSyncStatus(doctype) === 'not_synced')) {
|
|
725
|
-
_context6.next =
|
|
734
|
+
_context6.next = 11;
|
|
726
735
|
break;
|
|
727
736
|
}
|
|
728
737
|
|
|
@@ -730,15 +739,15 @@ var PouchLink = /*#__PURE__*/function (_CozyLink) {
|
|
|
730
739
|
_logger.default.info("Tried to access local ".concat(doctype, " but Cozy Pouch is not synced yet. Forwarding the operation to next link"));
|
|
731
740
|
}
|
|
732
741
|
|
|
733
|
-
return _context6.abrupt("return", forward(operation));
|
|
742
|
+
return _context6.abrupt("return", forward(operation, options));
|
|
734
743
|
|
|
735
|
-
case
|
|
736
|
-
_context6.next =
|
|
744
|
+
case 11:
|
|
745
|
+
_context6.next = 13;
|
|
737
746
|
return this.needsToWaitWarmup(doctype);
|
|
738
747
|
|
|
739
|
-
case
|
|
748
|
+
case 13:
|
|
740
749
|
if (!_context6.sent) {
|
|
741
|
-
_context6.next =
|
|
750
|
+
_context6.next = 16;
|
|
742
751
|
break;
|
|
743
752
|
}
|
|
744
753
|
|
|
@@ -746,11 +755,11 @@ var PouchLink = /*#__PURE__*/function (_CozyLink) {
|
|
|
746
755
|
_logger.default.info("Tried to access local ".concat(doctype, " but not warmuped yet. Forwarding the operation to next link"));
|
|
747
756
|
}
|
|
748
757
|
|
|
749
|
-
return _context6.abrupt("return", forward(operation));
|
|
758
|
+
return _context6.abrupt("return", forward(operation, options));
|
|
750
759
|
|
|
751
|
-
case
|
|
760
|
+
case 16:
|
|
752
761
|
if (this.supportsOperation(operation)) {
|
|
753
|
-
_context6.next =
|
|
762
|
+
_context6.next = 19;
|
|
754
763
|
break;
|
|
755
764
|
}
|
|
756
765
|
|
|
@@ -758,20 +767,20 @@ var PouchLink = /*#__PURE__*/function (_CozyLink) {
|
|
|
758
767
|
_logger.default.info("The doctype '".concat(doctype, "' is not supported. Forwarding the operation to next link"));
|
|
759
768
|
}
|
|
760
769
|
|
|
761
|
-
return _context6.abrupt("return", forward(operation));
|
|
770
|
+
return _context6.abrupt("return", forward(operation, options));
|
|
762
771
|
|
|
763
|
-
case
|
|
772
|
+
case 19:
|
|
764
773
|
if (!operation.mutationType) {
|
|
765
|
-
_context6.next =
|
|
774
|
+
_context6.next = 23;
|
|
766
775
|
break;
|
|
767
776
|
}
|
|
768
777
|
|
|
769
|
-
return _context6.abrupt("return", this.executeMutation(operation, result, forward));
|
|
778
|
+
return _context6.abrupt("return", this.executeMutation(operation, options, result, forward));
|
|
770
779
|
|
|
771
|
-
case
|
|
780
|
+
case 23:
|
|
772
781
|
return _context6.abrupt("return", this.executeQuery(operation));
|
|
773
782
|
|
|
774
|
-
case
|
|
783
|
+
case 24:
|
|
775
784
|
case "end":
|
|
776
785
|
return _context6.stop();
|
|
777
786
|
}
|
|
@@ -779,7 +788,7 @@ var PouchLink = /*#__PURE__*/function (_CozyLink) {
|
|
|
779
788
|
}, _callee6, this);
|
|
780
789
|
}));
|
|
781
790
|
|
|
782
|
-
function request(_x4) {
|
|
791
|
+
function request(_x4, _x5) {
|
|
783
792
|
return _request.apply(this, arguments);
|
|
784
793
|
}
|
|
785
794
|
|
|
@@ -822,7 +831,7 @@ var PouchLink = /*#__PURE__*/function (_CozyLink) {
|
|
|
822
831
|
}, _callee7, this);
|
|
823
832
|
}));
|
|
824
833
|
|
|
825
|
-
function getChanges(
|
|
834
|
+
function getChanges(_x6, _x7) {
|
|
826
835
|
return _getChanges.apply(this, arguments);
|
|
827
836
|
}
|
|
828
837
|
|
|
@@ -864,7 +873,7 @@ var PouchLink = /*#__PURE__*/function (_CozyLink) {
|
|
|
864
873
|
}, _callee8, this);
|
|
865
874
|
}));
|
|
866
875
|
|
|
867
|
-
function getDbInfo(
|
|
876
|
+
function getDbInfo(_x8) {
|
|
868
877
|
return _getDbInfo.apply(this, arguments);
|
|
869
878
|
}
|
|
870
879
|
|
|
@@ -939,7 +948,7 @@ var PouchLink = /*#__PURE__*/function (_CozyLink) {
|
|
|
939
948
|
}, _callee9, this);
|
|
940
949
|
}));
|
|
941
950
|
|
|
942
|
-
function persistCozyData(
|
|
951
|
+
function persistCozyData(_x9) {
|
|
943
952
|
return _persistCozyData.apply(this, arguments);
|
|
944
953
|
}
|
|
945
954
|
|
|
@@ -1005,7 +1014,7 @@ var PouchLink = /*#__PURE__*/function (_CozyLink) {
|
|
|
1005
1014
|
}, _callee10, this, [[1, 11]]);
|
|
1006
1015
|
}));
|
|
1007
1016
|
|
|
1008
|
-
function getExistingDocument(
|
|
1017
|
+
function getExistingDocument(_x10, _x11) {
|
|
1009
1018
|
return _getExistingDocument.apply(this, arguments);
|
|
1010
1019
|
}
|
|
1011
1020
|
|
|
@@ -1050,7 +1059,7 @@ var PouchLink = /*#__PURE__*/function (_CozyLink) {
|
|
|
1050
1059
|
}, _callee11, this);
|
|
1051
1060
|
}));
|
|
1052
1061
|
|
|
1053
|
-
function needsToWaitWarmup(
|
|
1062
|
+
function needsToWaitWarmup(_x12) {
|
|
1054
1063
|
return _needsToWaitWarmup.apply(this, arguments);
|
|
1055
1064
|
}
|
|
1056
1065
|
|
|
@@ -1115,7 +1124,7 @@ var PouchLink = /*#__PURE__*/function (_CozyLink) {
|
|
|
1115
1124
|
}, _callee12, this);
|
|
1116
1125
|
}));
|
|
1117
1126
|
|
|
1118
|
-
function createIndex(
|
|
1127
|
+
function createIndex(_x13) {
|
|
1119
1128
|
return _createIndex.apply(this, arguments);
|
|
1120
1129
|
}
|
|
1121
1130
|
|
|
@@ -1206,7 +1215,7 @@ var PouchLink = /*#__PURE__*/function (_CozyLink) {
|
|
|
1206
1215
|
}, _callee13, this);
|
|
1207
1216
|
}));
|
|
1208
1217
|
|
|
1209
|
-
function ensureIndex(
|
|
1218
|
+
function ensureIndex(_x14, _x15) {
|
|
1210
1219
|
return _ensureIndex.apply(this, arguments);
|
|
1211
1220
|
}
|
|
1212
1221
|
|
|
@@ -1355,7 +1364,7 @@ var PouchLink = /*#__PURE__*/function (_CozyLink) {
|
|
|
1355
1364
|
}, _callee14, this);
|
|
1356
1365
|
}));
|
|
1357
1366
|
|
|
1358
|
-
function executeQuery(
|
|
1367
|
+
function executeQuery(_x16) {
|
|
1359
1368
|
return _executeQuery.apply(this, arguments);
|
|
1360
1369
|
}
|
|
1361
1370
|
|
|
@@ -1364,7 +1373,7 @@ var PouchLink = /*#__PURE__*/function (_CozyLink) {
|
|
|
1364
1373
|
}, {
|
|
1365
1374
|
key: "executeMutation",
|
|
1366
1375
|
value: function () {
|
|
1367
|
-
var _executeMutation = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(mutation, result, forward) {
|
|
1376
|
+
var _executeMutation = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(mutation, options, result, forward) {
|
|
1368
1377
|
var markName, pouchRes, jsonResult;
|
|
1369
1378
|
return _regenerator.default.wrap(function _callee15$(_context15) {
|
|
1370
1379
|
while (1) {
|
|
@@ -1416,7 +1425,7 @@ var PouchLink = /*#__PURE__*/function (_CozyLink) {
|
|
|
1416
1425
|
return _context15.abrupt("break", 25);
|
|
1417
1426
|
|
|
1418
1427
|
case 24:
|
|
1419
|
-
return _context15.abrupt("return", forward(mutation, result));
|
|
1428
|
+
return _context15.abrupt("return", forward(mutation, options, result));
|
|
1420
1429
|
|
|
1421
1430
|
case 25:
|
|
1422
1431
|
jsonResult = jsonapi.fromPouchResult({
|
|
@@ -1439,7 +1448,7 @@ var PouchLink = /*#__PURE__*/function (_CozyLink) {
|
|
|
1439
1448
|
}, _callee15, this);
|
|
1440
1449
|
}));
|
|
1441
1450
|
|
|
1442
|
-
function executeMutation(
|
|
1451
|
+
function executeMutation(_x17, _x18, _x19, _x20) {
|
|
1443
1452
|
return _executeMutation.apply(this, arguments);
|
|
1444
1453
|
}
|
|
1445
1454
|
|
|
@@ -1469,7 +1478,7 @@ var PouchLink = /*#__PURE__*/function (_CozyLink) {
|
|
|
1469
1478
|
}, _callee16, this);
|
|
1470
1479
|
}));
|
|
1471
1480
|
|
|
1472
|
-
function createDocument(
|
|
1481
|
+
function createDocument(_x21) {
|
|
1473
1482
|
return _createDocument.apply(this, arguments);
|
|
1474
1483
|
}
|
|
1475
1484
|
|
|
@@ -1499,7 +1508,7 @@ var PouchLink = /*#__PURE__*/function (_CozyLink) {
|
|
|
1499
1508
|
}, _callee17, this);
|
|
1500
1509
|
}));
|
|
1501
1510
|
|
|
1502
|
-
function updateDocument(
|
|
1511
|
+
function updateDocument(_x22) {
|
|
1503
1512
|
return _updateDocument.apply(this, arguments);
|
|
1504
1513
|
}
|
|
1505
1514
|
|
|
@@ -1547,7 +1556,7 @@ var PouchLink = /*#__PURE__*/function (_CozyLink) {
|
|
|
1547
1556
|
}, _callee18, this);
|
|
1548
1557
|
}));
|
|
1549
1558
|
|
|
1550
|
-
function updateDocuments(
|
|
1559
|
+
function updateDocuments(_x23) {
|
|
1551
1560
|
return _updateDocuments.apply(this, arguments);
|
|
1552
1561
|
}
|
|
1553
1562
|
|
|
@@ -1582,7 +1591,7 @@ var PouchLink = /*#__PURE__*/function (_CozyLink) {
|
|
|
1582
1591
|
}, _callee19, this);
|
|
1583
1592
|
}));
|
|
1584
1593
|
|
|
1585
|
-
function deleteDocument(
|
|
1594
|
+
function deleteDocument(_x24) {
|
|
1586
1595
|
return _deleteDocument.apply(this, arguments);
|
|
1587
1596
|
}
|
|
1588
1597
|
|
|
@@ -1606,7 +1615,7 @@ var PouchLink = /*#__PURE__*/function (_CozyLink) {
|
|
|
1606
1615
|
}, _callee20);
|
|
1607
1616
|
}));
|
|
1608
1617
|
|
|
1609
|
-
function addReferencesTo(
|
|
1618
|
+
function addReferencesTo(_x25) {
|
|
1610
1619
|
return _addReferencesTo.apply(this, arguments);
|
|
1611
1620
|
}
|
|
1612
1621
|
|
|
@@ -1685,7 +1694,7 @@ var PouchLink = /*#__PURE__*/function (_CozyLink) {
|
|
|
1685
1694
|
}, _callee21, this, [[4, 22]]);
|
|
1686
1695
|
}));
|
|
1687
1696
|
|
|
1688
|
-
function dbMethod(
|
|
1697
|
+
function dbMethod(_x26, _x27) {
|
|
1689
1698
|
return _dbMethod.apply(this, arguments);
|
|
1690
1699
|
}
|
|
1691
1700
|
|
|
@@ -98,7 +98,7 @@ describe('CozyPouchLink', () => {
|
|
|
98
98
|
await setup()
|
|
99
99
|
const query = Q(TODO_DOCTYPE)
|
|
100
100
|
expect.assertions(1)
|
|
101
|
-
await link.request(query, null, () => {
|
|
101
|
+
await link.request(query, null, null, () => {
|
|
102
102
|
expect(true).toBe(true)
|
|
103
103
|
})
|
|
104
104
|
})
|
|
@@ -111,7 +111,7 @@ describe('CozyPouchLink', () => {
|
|
|
111
111
|
})
|
|
112
112
|
const query = Q(TODO_DOCTYPE)
|
|
113
113
|
expect.assertions(1)
|
|
114
|
-
await link.request(query, null, () => {
|
|
114
|
+
await link.request(query, null, null, () => {
|
|
115
115
|
expect(true).toBe(true)
|
|
116
116
|
})
|
|
117
117
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-pouch-link",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "52.0.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": "^
|
|
16
|
+
"cozy-client": "^52.0.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": "
|
|
42
|
+
"gitHead": "5b59b97a76e9191e67f3c3ce885358f47df8a4e1"
|
|
43
43
|
}
|
package/types/CozyPouchLink.d.ts
CHANGED
|
@@ -275,7 +275,7 @@ declare class PouchLink extends CozyLink {
|
|
|
275
275
|
skip: any;
|
|
276
276
|
next: boolean;
|
|
277
277
|
}>;
|
|
278
|
-
executeMutation(mutation: any, result: any, forward: any): Promise<any>;
|
|
278
|
+
executeMutation(mutation: any, options: any, result: any, forward: any): Promise<any>;
|
|
279
279
|
createDocument(mutation: any): Promise<any>;
|
|
280
280
|
updateDocument(mutation: any): Promise<any>;
|
|
281
281
|
updateDocuments(mutation: any): Promise<any[]>;
|