cozy-client 33.1.2 → 33.2.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.
@@ -203,7 +203,7 @@ var CozyClient = /*#__PURE__*/function () {
203
203
  return _this.query(definition, options);
204
204
 
205
205
  case 4:
206
- return _context.abrupt("return", _this.getQueryFromState(options.as));
206
+ return _context.abrupt("return", _this.getQueryFromState(options.as, options));
207
207
 
208
208
  case 7:
209
209
  _context.prev = 7;
@@ -1265,7 +1265,7 @@ var CozyClient = /*#__PURE__*/function () {
1265
1265
  update = _ref5.update, options = (0, _objectWithoutProperties2.default)(_ref5, ["update"]);
1266
1266
  this.ensureStore();
1267
1267
  queryId = options.as || this.queryIdGenerator.generateId(queryDefinition);
1268
- existingQuery = this.getQueryFromState(queryId);
1268
+ existingQuery = this.getQueryFromState(queryId, options);
1269
1269
 
1270
1270
  if (!options.fetchPolicy) {
1271
1271
  _context8.next = 11;
@@ -2572,16 +2572,15 @@ var CozyClient = /*#__PURE__*/function () {
2572
2572
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2573
2573
  var env = envArg || (typeof process !== 'undefined' ? process.env : {});
2574
2574
  var COZY_URL = env.COZY_URL,
2575
- COZY_CREDENTIALS = env.COZY_CREDENTIALS,
2576
- NODE_ENV = env.NODE_ENV;
2575
+ COZY_CREDENTIALS = env.COZY_CREDENTIALS;
2577
2576
 
2578
2577
  if (!COZY_URL || !COZY_CREDENTIALS) {
2579
2578
  throw new Error('Env used to instantiate CozyClient must have COZY_URL and COZY_CREDENTIALS');
2580
2579
  }
2581
2580
 
2582
- if (NODE_ENV === 'development') {
2581
+ try {
2583
2582
  options.oauth = JSON.parse(COZY_CREDENTIALS);
2584
- } else {
2583
+ } catch (err) {
2585
2584
  options.token = COZY_CREDENTIALS.trim();
2586
2585
  }
2587
2586
 
@@ -2645,7 +2644,7 @@ var CozyClient = /*#__PURE__*/function () {
2645
2644
  CozyClient.hooks = CozyClient.hooks || {};
2646
2645
  CozyClient.fetchPolicies = _policies.default; //COZY_CLIENT_VERSION_PACKAGE in replaced by babel. See babel config
2647
2646
 
2648
- CozyClient.version = "33.1.2";
2647
+ CozyClient.version = "33.2.1";
2649
2648
 
2650
2649
  _microee.default.mixin(CozyClient);
2651
2650
 
@@ -121,8 +121,7 @@ describe('CozyClient initialization', () => {
121
121
  }
122
122
  client = CozyClient.fromEnv({
123
123
  COZY_URL: url,
124
- COZY_CREDENTIALS: JSON.stringify(creds),
125
- NODE_ENV: 'development'
124
+ COZY_CREDENTIALS: JSON.stringify(creds)
126
125
  })
127
126
  expect(client.stackClient.uri).toBe(url)
128
127
  expect(client.stackClient.token.accessToken).toBe(token)
package/dist/types.js CHANGED
@@ -91,8 +91,8 @@ var _dsl = require("./queries/dsl");
91
91
  * @property {Function} [onError] - Callback when the query is errored
92
92
  * @property {boolean} [enabled=true] - If set to false, the query won't be executed
93
93
  * @property {boolean} [backgroundFetching] - If set to true, when the fetchStatus has already been loaded, it won't be updated during future fetches. Instead, a `isFetching` attribute will be used to indicate when background fetching is started.
94
- * @property {object} [hydrated=true] - Whether documents should be returned already hydrated
95
- * @property {object} [singleDocData] - If true, the "data" returned will be
94
+ * @property {boolean} [hydrated=true] - Whether documents should be returned already hydrated
95
+ * @property {boolean} [singleDocData] - If true, the "data" returned will be
96
96
  * a single doc instead of an array for single doc queries. Defaults to false for backward
97
97
  * compatibility but will be set to true in the future.
98
98
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-client",
3
- "version": "33.1.2",
3
+ "version": "33.2.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": "^33.1.2",
21
+ "cozy-stack-client": "^33.2.0",
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": "f681dd45241daca68dcc6dca0160ce6db9360958"
76
+ "gitHead": "a857d1e2276338bab6f0c74f0ca82ded1265521e"
77
77
  }
package/types/types.d.ts CHANGED
@@ -81,13 +81,13 @@ export type QueryOptions = {
81
81
  /**
82
82
  * - Whether documents should be returned already hydrated
83
83
  */
84
- hydrated?: object;
84
+ hydrated?: boolean;
85
85
  /**
86
86
  * - If true, the "data" returned will be
87
87
  * a single doc instead of an array for single doc queries. Defaults to false for backward
88
88
  * compatibility but will be set to true in the future.
89
89
  */
90
- singleDocData?: object;
90
+ singleDocData?: boolean;
91
91
  };
92
92
  export type FetchMoreAble = {
93
93
  fetchMore: Function;