@qrvey/filters 0.2.0 → 0.2.2

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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # [@qrvey/filters](https://bitbucket.org/qrvey/qrvey_filters/wiki/Home) *0.2.0*
1
+ # [@qrvey/filters](https://bitbucket.org/qrvey/qrvey_filters/wiki/Home) *0.2.2*
2
2
 
3
3
  > Helpers and logic for Filtering Data in Qrvey app
4
4
 
@@ -90,6 +90,22 @@ class FilterResources {
90
90
  static getHierarchyScopes() {
91
91
  return filter_scopes_resources_1.FILTER_SCOPES;
92
92
  }
93
+ static getScopeIdentifiers(filters) {
94
+ if (!Array.isArray(filters) || (0, utils_1.isEmpty)(filters))
95
+ return [];
96
+ const seen = new Map();
97
+ for (const filter of filters) {
98
+ const key = `${filter.scope}|${filter.scopeId ?? ""}`;
99
+ if (!seen.has(key)) {
100
+ seen.set(key, {
101
+ datasetId: filter.datasetId,
102
+ scope: filter.scope,
103
+ scopeId: filter.scopeId,
104
+ });
105
+ }
106
+ }
107
+ return Array.from(seen.values());
108
+ }
93
109
  static getFiltersByTimezone(filters, timezone) {
94
110
  if ((0, utils_1.isEmpty)(filters) || !Array.isArray(filters))
95
111
  return [];
@@ -1,7 +1,7 @@
1
1
  import { IColumnVsFormulaType, IDTimezone } from "@qrvey/utils";
2
2
  import { IFilterGroupingInfoByColumnTypeSettings, IFilterGroupingInfoByFilterSettings, IFilterGroupingInfoListByColumnSettings } from "../resources/filter-functions.resources";
3
3
  import { IFilterGrouping, IFilterGroupingInfo } from "../resources/filter-grouping.resources";
4
- import { IFilterScope } from "../resources/filter-scopes.resources";
4
+ import { IFilterScope, IFilterScopeIdentifier } from "../resources/filter-scopes.resources";
5
5
  import { IFilterValidator, IFilterValidatorInfo } from "../resources/filter-validators.resources";
6
6
  import { IFilter } from "../resources/filters.resources";
7
7
  export declare class FilterResources {
@@ -16,6 +16,7 @@ export declare class FilterResources {
16
16
  static getGroupings(): IFilterGrouping[];
17
17
  static getGroupingsInfoList(): IFilterGroupingInfo[];
18
18
  static getHierarchyScopes(): IFilterScope[];
19
+ static getScopeIdentifiers(filters: IFilter[]): IFilterScopeIdentifier[];
19
20
  static getFiltersByTimezone(filters: IFilter[], timezone: IDTimezone): IFilter[];
20
21
  static getValidatorInfo(validator: IFilterValidator): IFilterValidatorInfo;
21
22
  static getValidatorInfoList(): IFilterValidatorInfo[];
@@ -87,6 +87,22 @@ export class FilterResources {
87
87
  static getHierarchyScopes() {
88
88
  return FILTER_SCOPES;
89
89
  }
90
+ static getScopeIdentifiers(filters) {
91
+ if (!Array.isArray(filters) || isEmpty(filters))
92
+ return [];
93
+ const seen = new Map();
94
+ for (const filter of filters) {
95
+ const key = `${filter.scope}|${filter.scopeId ?? ""}`;
96
+ if (!seen.has(key)) {
97
+ seen.set(key, {
98
+ datasetId: filter.datasetId,
99
+ scope: filter.scope,
100
+ scopeId: filter.scopeId,
101
+ });
102
+ }
103
+ }
104
+ return Array.from(seen.values());
105
+ }
90
106
  static getFiltersByTimezone(filters, timezone) {
91
107
  if (isEmpty(filters) || !Array.isArray(filters))
92
108
  return [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qrvey/filters",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Helpers and logic for Filtering Data in Qrvey app",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/index.js",
@@ -49,7 +49,7 @@
49
49
  "typescript": "6.0.2"
50
50
  },
51
51
  "dependencies": {
52
- "@qrvey/utils": "1.17.0-8",
52
+ "@qrvey/utils": "1.17.0",
53
53
  "dayjs": "1.11.20",
54
54
  "tslib": "2.8.1"
55
55
  },