cozy-client 39.0.0 → 40.0.1
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 +10 -2
- package/dist/CozyClient.spec.js +31 -0
- package/package.json +3 -3
package/dist/CozyClient.js
CHANGED
|
@@ -2263,9 +2263,17 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
2263
2263
|
while (1) {
|
|
2264
2264
|
switch (_context17.prev = _context17.next) {
|
|
2265
2265
|
case 0:
|
|
2266
|
+
if (!(this.stackClient instanceof _cozyStackClient.OAuthClient)) {
|
|
2267
|
+
_context17.next = 4;
|
|
2268
|
+
break;
|
|
2269
|
+
}
|
|
2270
|
+
|
|
2266
2271
|
return _context17.abrupt("return", this.stackClient.checkForRevocation());
|
|
2267
2272
|
|
|
2268
|
-
case
|
|
2273
|
+
case 4:
|
|
2274
|
+
throw 'checkForRevocation is only implemented for OAutClient';
|
|
2275
|
+
|
|
2276
|
+
case 5:
|
|
2269
2277
|
case "end":
|
|
2270
2278
|
return _context17.stop();
|
|
2271
2279
|
}
|
|
@@ -2677,7 +2685,7 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
2677
2685
|
CozyClient.hooks = CozyClient.hooks || {};
|
|
2678
2686
|
CozyClient.fetchPolicies = _policies.default; //COZY_CLIENT_VERSION_PACKAGE in replaced by babel. See babel config
|
|
2679
2687
|
|
|
2680
|
-
CozyClient.version = "
|
|
2688
|
+
CozyClient.version = "40.0.1";
|
|
2681
2689
|
|
|
2682
2690
|
_microee.default.mixin(CozyClient);
|
|
2683
2691
|
|
package/dist/CozyClient.spec.js
CHANGED
|
@@ -2060,3 +2060,34 @@ describe('document creation', () => {
|
|
|
2060
2060
|
expect(updatedDoc.data.relationships.authors.data[0]._id).toBe(1)
|
|
2061
2061
|
})
|
|
2062
2062
|
})
|
|
2063
|
+
|
|
2064
|
+
describe('CozyClient revocation handling', () => {
|
|
2065
|
+
let client
|
|
2066
|
+
let mockCallback
|
|
2067
|
+
|
|
2068
|
+
beforeEach(() => {
|
|
2069
|
+
client = new CozyClient({})
|
|
2070
|
+
client.stackClient.refreshToken = jest.fn().mockImplementation(() => {
|
|
2071
|
+
client.stackClient.onRevocationChange(true)
|
|
2072
|
+
})
|
|
2073
|
+
|
|
2074
|
+
mockCallback = jest.fn()
|
|
2075
|
+
client.on('revoked', mockCallback)
|
|
2076
|
+
})
|
|
2077
|
+
|
|
2078
|
+
it('should call "revoked" event when token is expired', async () => {
|
|
2079
|
+
await client.stackClient.refreshToken()
|
|
2080
|
+
|
|
2081
|
+
expect(mockCallback).toHaveBeenCalledTimes(1)
|
|
2082
|
+
})
|
|
2083
|
+
|
|
2084
|
+
it('should not call "revoked" event when token is not expired', async () => {
|
|
2085
|
+
client.stackClient.refreshToken = jest.fn().mockImplementation(() => {
|
|
2086
|
+
client.stackClient.onRevocationChange(false)
|
|
2087
|
+
})
|
|
2088
|
+
|
|
2089
|
+
await client.stackClient.refreshToken()
|
|
2090
|
+
|
|
2091
|
+
expect(mockCallback).not.toHaveBeenCalled()
|
|
2092
|
+
})
|
|
2093
|
+
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-client",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "40.0.1",
|
|
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": "^
|
|
21
|
+
"cozy-stack-client": "^40.0.1",
|
|
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": "
|
|
76
|
+
"gitHead": "4947ce4ff99fd34d8cf19140e5e8e1199c64fd9f"
|
|
77
77
|
}
|