cozy-client 29.0.0 → 29.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.
@@ -119,7 +119,7 @@ var referencesUnsupportedError = function referencesUnsupportedError(relationshi
119
119
  var securiseUri = function securiseUri(uri) {
120
120
  var _window$cozy;
121
121
 
122
- if (uri && (_window$cozy = window['cozy']) !== null && _window$cozy !== void 0 && _window$cozy.isSecureProtocol) {
122
+ if (uri && window && (_window$cozy = window['cozy']) !== null && _window$cozy !== void 0 && _window$cozy.isSecureProtocol) {
123
123
  var secureUrl = new URL(uri);
124
124
  secureUrl.protocol = 'https:';
125
125
  return secureUrl.toString();
@@ -2550,7 +2550,7 @@ var CozyClient = /*#__PURE__*/function () {
2550
2550
  CozyClient.hooks = CozyClient.hooks || {};
2551
2551
  CozyClient.fetchPolicies = _policies.default; //COZY_CLIENT_VERSION_PACKAGE in replaced by babel. See babel config
2552
2552
 
2553
- CozyClient.version = "29.0.0";
2553
+ CozyClient.version = "29.0.1";
2554
2554
 
2555
2555
  _microee.default.mixin(CozyClient);
2556
2556
 
@@ -280,6 +280,19 @@ describe('CozyClient initialization', () => {
280
280
  expect(client.options.uri).toBe('http://cozy.tools')
281
281
  })
282
282
 
283
+ it('should not secure the URL if window is undefined (node env)', () => {
284
+ let windowSpy = jest.spyOn(window, 'window', 'get')
285
+ windowSpy.mockImplementation(() => undefined)
286
+ const client = new CozyClient({
287
+ uri: 'http://cozy.tools',
288
+ schema: '',
289
+ token: 'SOME_TOKEN'
290
+ })
291
+
292
+ expect(client.options.uri).toBe('http://cozy.tools')
293
+ windowSpy.mockRestore()
294
+ })
295
+
283
296
  describe('capabilities', () => {
284
297
  it('should instanciate Client with capabilities', () => {
285
298
  const options = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-client",
3
- "version": "29.0.0",
3
+ "version": "29.0.1",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.node.js",
6
6
  "browser": "dist/index.js",
@@ -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": "e06be593189751f337a648cca37241005df099af"
76
+ "gitHead": "2f377563187a5bf3b89d8c3044c72615452bfc01"
77
77
  }