@qrvey/utils 1.11.3 → 1.11.4

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.
@@ -3,6 +3,7 @@ import { IFSScopeID } from "../../interfaces/common/IFSScopeID";
3
3
  import { IFUData } from "../../interfaces/ui/IFUData";
4
4
  /**
5
5
  * Gets filters from Filter Data by Scopes/Scope IDs.
6
+ * If some scope Id property is not recieved into the collection, the filter is skipped.
6
7
  * @param filterData The filter data
7
8
  * @param scopes The collection of Scopes/Scope IDs
8
9
  * @returns a new Filter Data
@@ -3,9 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getFiltersByScopesIds = void 0;
4
4
  const isEmpty_1 = require("../../../general/mix/isEmpty");
5
5
  const cloneDeep_1 = require("../../../general/object/cloneDeep");
6
- const FILTER_SCOPE_1 = require("../../constants/common/FILTER_SCOPE");
6
+ const hasProperty_1 = require("../../../general/object/hasProperty");
7
7
  /**
8
8
  * Gets filters from Filter Data by Scopes/Scope IDs.
9
+ * If some scope Id property is not recieved into the collection, the filter is skipped.
9
10
  * @param filterData The filter data
10
11
  * @param scopes The collection of Scopes/Scope IDs
11
12
  * @returns a new Filter Data
@@ -16,8 +17,7 @@ function getFiltersByScopesIds(filterData, scopes = []) {
16
17
  const _filterData = (0, cloneDeep_1.cloneDeep)(filterData);
17
18
  _filterData.scopes = scopes.reduce((newScopes, scope) => {
18
19
  const filteredScopes = _filterData.scopes.filter((fScope) => scope.label === fScope.scope &&
19
- (scope.id === fScope.scopeid ||
20
- (fScope.scope === FILTER_SCOPE_1.FILTER_SCOPE.GLOBAL && fScope.scopeid == null)) &&
20
+ (scope.id === fScope.scopeid || !(0, hasProperty_1._hasProperty)(scope, "id")) &&
21
21
  fScope.datasets.length > 0);
22
22
  return newScopes.concat(filteredScopes);
23
23
  }, []);
@@ -1,6 +1,6 @@
1
1
  import { IFSData } from "../../interfaces/common/IFSData";
2
- import { IFUData } from "../../interfaces/ui/IFUData";
3
2
  import { IFSScopeID } from "../../interfaces/common/IFSScopeID";
3
+ import { IFUData } from "../../interfaces/ui/IFUData";
4
4
  /**
5
5
  * Get a new Filter Data by filtering scopes/scope IDs and enabled flags
6
6
  * @param filterData a Filter Data or UI Filter Data
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getFiltersByVisibility = void 0;
4
- const getFiltersByScopesIds_1 = require("./getFiltersByScopesIds");
5
4
  const getFiltersByParams_1 = require("./getFiltersByParams");
5
+ const getFiltersByScopesIds_1 = require("./getFiltersByScopesIds");
6
6
  const isEmpty_1 = require("../../../general/mix/isEmpty");
7
7
  const cloneDeep_1 = require("../../../general/object/cloneDeep");
8
8
  /**
@@ -3,6 +3,7 @@ import { IFSScopeID } from "../../interfaces/common/IFSScopeID";
3
3
  import { IFUData } from "../../interfaces/ui/IFUData";
4
4
  /**
5
5
  * Gets filters from Filter Data by Scopes/Scope IDs.
6
+ * If some scope Id property is not recieved into the collection, the filter is skipped.
6
7
  * @param filterData The filter data
7
8
  * @param scopes The collection of Scopes/Scope IDs
8
9
  * @returns a new Filter Data
@@ -1,8 +1,9 @@
1
1
  import { isEmpty } from "../../../general/mix/isEmpty";
2
2
  import { cloneDeep } from "../../../general/object/cloneDeep";
3
- import { FILTER_SCOPE } from "../../constants/common/FILTER_SCOPE";
3
+ import { _hasProperty } from "../../../general/object/hasProperty";
4
4
  /**
5
5
  * Gets filters from Filter Data by Scopes/Scope IDs.
6
+ * If some scope Id property is not recieved into the collection, the filter is skipped.
6
7
  * @param filterData The filter data
7
8
  * @param scopes The collection of Scopes/Scope IDs
8
9
  * @returns a new Filter Data
@@ -13,8 +14,7 @@ export function getFiltersByScopesIds(filterData, scopes = []) {
13
14
  const _filterData = cloneDeep(filterData);
14
15
  _filterData.scopes = scopes.reduce((newScopes, scope) => {
15
16
  const filteredScopes = _filterData.scopes.filter((fScope) => scope.label === fScope.scope &&
16
- (scope.id === fScope.scopeid ||
17
- (fScope.scope === FILTER_SCOPE.GLOBAL && fScope.scopeid == null)) &&
17
+ (scope.id === fScope.scopeid || !_hasProperty(scope, "id")) &&
18
18
  fScope.datasets.length > 0);
19
19
  return newScopes.concat(filteredScopes);
20
20
  }, []);
@@ -1,6 +1,6 @@
1
1
  import { IFSData } from "../../interfaces/common/IFSData";
2
- import { IFUData } from "../../interfaces/ui/IFUData";
3
2
  import { IFSScopeID } from "../../interfaces/common/IFSScopeID";
3
+ import { IFUData } from "../../interfaces/ui/IFUData";
4
4
  /**
5
5
  * Get a new Filter Data by filtering scopes/scope IDs and enabled flags
6
6
  * @param filterData a Filter Data or UI Filter Data
@@ -1,5 +1,5 @@
1
- import { getFiltersByScopesIds } from "./getFiltersByScopesIds";
2
1
  import { getFiltersByParams } from "./getFiltersByParams";
2
+ import { getFiltersByScopesIds } from "./getFiltersByScopesIds";
3
3
  import { isEmpty } from "../../../general/mix/isEmpty";
4
4
  import { cloneDeep } from "../../../general/object/cloneDeep";
5
5
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qrvey/utils",
3
- "version": "1.11.3",
3
+ "version": "1.11.4",
4
4
  "description": "Helper, Utils for all Qrvey Projects",
5
5
  "homepage": "https://bitbucket.org/qrvey/qrvey_utils/wiki/Home",
6
6
  "main": "dist/index.js",