@dhis2/analytics 25.2.2 → 25.2.3

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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [25.2.3](https://github.com/dhis2/analytics/compare/v25.2.2...v25.2.3) (2023-06-20)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * avoid DV plugin crash if no ou levels are returned ([#1442](https://github.com/dhis2/analytics/issues/1442)) ([5296bd7](https://github.com/dhis2/analytics/commit/5296bd79104dbd914daa8242deda69ce150b355e))
7
+
1
8
  ## [25.2.2](https://github.com/dhis2/analytics/compare/v25.2.1...v25.2.2) (2023-06-20)
2
9
 
3
10
 
@@ -18,15 +18,17 @@ var _predefinedDimensions = require("../predefinedDimensions.js");
18
18
  const isOuLevelIntId = id => _index.ouIdHelper.hasLevelPrefix(id) ? Number.isInteger(parseInt(_index.ouIdHelper.removePrefix(id), 10)) : false;
19
19
 
20
20
  const replaceNumericOuLevelWithUid = ouLevels => item => {
21
+ var _ouLevels$find;
22
+
21
23
  if (!isOuLevelIntId(item.id)) {
22
24
  return item;
23
25
  }
24
26
 
25
27
  const ouIntId = parseInt(_index.ouIdHelper.removePrefix(item.id), 10);
26
- const ouUid = ouLevels.find(l => parseInt(l.level, 10) === ouIntId).id;
27
- return Object.assign({}, item, {
28
+ const ouUid = (_ouLevels$find = ouLevels.find(l => parseInt(l.level, 10) === ouIntId)) === null || _ouLevels$find === void 0 ? void 0 : _ouLevels$find.id;
29
+ return ouUid ? Object.assign({}, item, {
28
30
  id: _index.ouIdHelper.addLevelPrefix(ouUid)
29
- });
31
+ }) : item;
30
32
  };
31
33
 
32
34
  const convertOuLevelsToUids = (ouLevels, layout) => {
@@ -7,15 +7,17 @@ import { DIMENSION_ID_ORGUNIT } from '../predefinedDimensions.js';
7
7
  const isOuLevelIntId = id => ouIdHelper.hasLevelPrefix(id) ? Number.isInteger(parseInt(ouIdHelper.removePrefix(id), 10)) : false;
8
8
 
9
9
  const replaceNumericOuLevelWithUid = ouLevels => item => {
10
+ var _ouLevels$find;
11
+
10
12
  if (!isOuLevelIntId(item.id)) {
11
13
  return item;
12
14
  }
13
15
 
14
16
  const ouIntId = parseInt(ouIdHelper.removePrefix(item.id), 10);
15
- const ouUid = ouLevels.find(l => parseInt(l.level, 10) === ouIntId).id;
16
- return Object.assign({}, item, {
17
+ const ouUid = (_ouLevels$find = ouLevels.find(l => parseInt(l.level, 10) === ouIntId)) === null || _ouLevels$find === void 0 ? void 0 : _ouLevels$find.id;
18
+ return ouUid ? Object.assign({}, item, {
17
19
  id: ouIdHelper.addLevelPrefix(ouUid)
18
- });
20
+ }) : item;
19
21
  };
20
22
 
21
23
  export const convertOuLevelsToUids = (ouLevels, layout) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhis2/analytics",
3
- "version": "25.2.2",
3
+ "version": "25.2.3",
4
4
  "main": "./build/cjs/index.js",
5
5
  "module": "./build/es/index.js",
6
6
  "exports": {