cozy-client 31.0.0 → 31.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.
@@ -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 = "31.0.0";
2553
+ CozyClient.version = "31.0.1";
2554
2554
 
2555
2555
  _microee.default.mixin(CozyClient);
2556
2556
 
@@ -167,6 +167,7 @@ var buildAggregateParams = function buildAggregateParams(params) {
167
167
  * @param {CozyClient} client - The CozyClient instance
168
168
  * @param {string} remoteDoctype - The remote doctype to use
169
169
  * @param {DACCAggregatesParams} params - The request params
170
+ * @returns { Promise<DACCAggregatesResponse> }
170
171
  */
171
172
 
172
173
 
@@ -188,21 +189,20 @@ var fetchAggregatesFromDACC = /*#__PURE__*/function () {
188
189
  });
189
190
 
190
191
  case 4:
191
- _context2.next = 10;
192
- break;
192
+ return _context2.abrupt("return", _context2.sent);
193
193
 
194
- case 6:
195
- _context2.prev = 6;
194
+ case 7:
195
+ _context2.prev = 7;
196
196
  _context2.t0 = _context2["catch"](0);
197
197
  (0, _cozyLogger.default)('error', "Error while fetching aggregates to remote doctype: ".concat(_context2.t0.message));
198
198
  throw _context2.t0;
199
199
 
200
- case 10:
200
+ case 11:
201
201
  case "end":
202
202
  return _context2.stop();
203
203
  }
204
204
  }
205
- }, _callee2, null, [[0, 6]]);
205
+ }, _callee2, null, [[0, 7]]);
206
206
  }));
207
207
 
208
208
  return function fetchAggregatesFromDACC(_x4, _x5, _x6) {
package/dist/types.js CHANGED
@@ -338,6 +338,27 @@ var _dsl = require("./queries/dsl");
338
338
  * @property {string} endDate - End of the aggregation period. Should be in YYYY-MM-DD format
339
339
  */
340
340
 
341
+ /**
342
+ * @typedef {Array<DACCAggregate>} DACCAggregatesResponse
343
+ * See https://github.com/cozy/DACC
344
+ */
345
+
346
+ /**
347
+ * @typedef {object} DACCAggregate
348
+ * See https://github.com/cozy/DACC
349
+ *
350
+ * @property {string} measureName - The name of the measures aggregate
351
+ * @property {string} startDate - The aggregation start date
352
+ * @property {number} sum - The aggregate sum
353
+ * @property {number} count - The aggregate count
354
+ * @property {number} countNotZero - The aggregate count of values different from zero
355
+ * @property {number} avg - The aggregate average
356
+ * @property {number} min - The aggregate min
357
+ * @property {number} max - The aggregate max
358
+ * @property {number} std - The aggregate standard deviation
359
+ *
360
+ */
361
+
341
362
  /**
342
363
  * Receives the URL to present to the user as a parameter, and should return a promise that resolves with the URL the user was redirected to after accepting the permissions.
343
364
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-client",
3
- "version": "31.0.0",
3
+ "version": "31.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": "3d72a338ddcd4cfbedc9203634dff5125c5e3fd1"
76
+ "gitHead": "e989cf8c1f026696b4bf0720f3161067f1166d8b"
77
77
  }
@@ -2,7 +2,7 @@ export function isCorrectDateFormat(date: string): boolean;
2
2
  export function checkMeasureParams(measure: DACCMeasure): void;
3
3
  export function sendMeasureToDACC(client: CozyClient, remoteDoctype: string, measure: DACCMeasure): Promise<void>;
4
4
  export function buildAggregateParams(params: Params): DACCAggregatesParams;
5
- export function fetchAggregatesFromDACC(client: CozyClient, remoteDoctype: string, params: DACCAggregatesParams): Promise<void>;
5
+ export function fetchAggregatesFromDACC(client: CozyClient, remoteDoctype: string, params: DACCAggregatesParams): Promise<DACCAggregatesResponse>;
6
6
  /**
7
7
  * - The unformatted DACC aggregate params
8
8
  */
@@ -23,3 +23,4 @@ export type Params = {
23
23
  import { DACCMeasure } from "../types";
24
24
  import CozyClient from "../CozyClient";
25
25
  import { DACCAggregatesParams } from "../types";
26
+ import { DACCAggregatesResponse } from "../types";
package/types/types.d.ts CHANGED
@@ -407,6 +407,51 @@ export type DACCAggregatesParams = {
407
407
  */
408
408
  endDate: string;
409
409
  };
410
+ /**
411
+ * See https://github.com/cozy/DACC
412
+ */
413
+ export type DACCAggregatesResponse = DACCAggregate[];
414
+ /**
415
+ * See https://github.com/cozy/DACC
416
+ */
417
+ export type DACCAggregate = {
418
+ /**
419
+ * - The name of the measures aggregate
420
+ */
421
+ measureName: string;
422
+ /**
423
+ * - The aggregation start date
424
+ */
425
+ startDate: string;
426
+ /**
427
+ * - The aggregate sum
428
+ */
429
+ sum: number;
430
+ /**
431
+ * - The aggregate count
432
+ */
433
+ count: number;
434
+ /**
435
+ * - The aggregate count of values different from zero
436
+ */
437
+ countNotZero: number;
438
+ /**
439
+ * - The aggregate average
440
+ */
441
+ avg: number;
442
+ /**
443
+ * - The aggregate min
444
+ */
445
+ min: number;
446
+ /**
447
+ * - The aggregate max
448
+ */
449
+ max: number;
450
+ /**
451
+ * - The aggregate standard deviation
452
+ */
453
+ std: number;
454
+ };
410
455
  /**
411
456
  * Receives the URL to present to the user as a parameter, and should return a promise that resolves with the URL the user was redirected to after accepting the permissions.
412
457
  */