@dcupl/common 0.0.75 → 0.0.77

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.
Files changed (37) hide show
  1. package/dist/lib-cjs/computeSuggestions.js.map +1 -1
  2. package/dist/lib-cjs/getConstraints.d.ts +3 -2
  3. package/dist/lib-cjs/getConstraints.js +19 -3
  4. package/dist/lib-cjs/getConstraints.js.map +1 -1
  5. package/dist/lib-cjs/getFacetEntries.js +9 -3
  6. package/dist/lib-cjs/getFacetEntries.js.map +1 -1
  7. package/dist/lib-cjs/getFilteredData.d.ts +2 -1
  8. package/dist/lib-cjs/getFilteredData.js +129 -26
  9. package/dist/lib-cjs/getFilteredData.js.map +1 -1
  10. package/dist/lib-cjs/helper.js +2 -2
  11. package/dist/lib-cjs/helper.js.map +1 -1
  12. package/dist/lib-cjs/tsconfig-cjs.tsbuildinfo +1 -1
  13. package/dist/lib-cjs/types/filter.types.d.ts +30 -15
  14. package/dist/lib-cjs/types/filter.types.js +2 -0
  15. package/dist/lib-cjs/types/filter.types.js.map +1 -1
  16. package/dist/lib-cjs/types/list.types.d.ts +2 -0
  17. package/dist/lib-cjs/types/model.types.d.ts +15 -3
  18. package/dist/lib-cjs/types/model.types.js.map +1 -1
  19. package/dist/lib-esm/computeSuggestions.js.map +1 -1
  20. package/dist/lib-esm/getConstraints.d.ts +3 -2
  21. package/dist/lib-esm/getConstraints.js +17 -2
  22. package/dist/lib-esm/getConstraints.js.map +1 -1
  23. package/dist/lib-esm/getFacetEntries.js +9 -3
  24. package/dist/lib-esm/getFacetEntries.js.map +1 -1
  25. package/dist/lib-esm/getFilteredData.d.ts +2 -1
  26. package/dist/lib-esm/getFilteredData.js +127 -25
  27. package/dist/lib-esm/getFilteredData.js.map +1 -1
  28. package/dist/lib-esm/helper.js +2 -2
  29. package/dist/lib-esm/helper.js.map +1 -1
  30. package/dist/lib-esm/tsconfig.tsbuildinfo +1 -1
  31. package/dist/lib-esm/types/filter.types.d.ts +30 -15
  32. package/dist/lib-esm/types/filter.types.js +1 -1
  33. package/dist/lib-esm/types/filter.types.js.map +1 -1
  34. package/dist/lib-esm/types/list.types.d.ts +2 -0
  35. package/dist/lib-esm/types/model.types.d.ts +15 -3
  36. package/dist/lib-esm/types/model.types.js.map +1 -1
  37. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  import { ListItem } from '.';
2
2
  import { CatalogApiOptions } from './list.types';
3
3
  import { FilterComparisonType } from './model.types';
4
- export type ConstraintTypes = 'referenceConstraint' | 'textConstraint' | 'numberConstraint' | 'dateConstraint';
4
+ export type ConstraintTypes = 'referenceConstraint' | 'textConstraint' | 'numberConstraint' | 'dateConstraint' | 'booleanConstraint';
5
5
  export type ConstraintBase = {
6
6
  uid: string;
7
7
  filterKey: string;
@@ -10,13 +10,18 @@ export type ConstraintBase = {
10
10
  };
11
11
  export type ReferenceConstraint = ConstraintBase & {
12
12
  type: 'referenceConstraint';
13
- value: string;
13
+ value: string | undefined | null;
14
14
  calculateFacets: boolean;
15
15
  };
16
16
  export type TextConstraint = ConstraintBase & {
17
17
  type: 'textConstraint';
18
18
  comparisonType: FilterComparisonType;
19
- value: string;
19
+ value: string | undefined | null;
20
+ };
21
+ export type BooleanConstraint = ConstraintBase & {
22
+ type: 'booleanConstraint';
23
+ value: boolean | undefined | null;
24
+ calculateFacets: boolean;
20
25
  };
21
26
  export type NumberConstraint = ConstraintBase & NumberConstraintOperators & {
22
27
  type: 'numberConstraint';
@@ -24,13 +29,14 @@ export type NumberConstraint = ConstraintBase & NumberConstraintOperators & {
24
29
  export type DateConstraint = ConstraintBase & DateConstraintOperators & {
25
30
  type: 'dateConstraint';
26
31
  };
27
- export type FilterConstraint = ReferenceConstraint | TextConstraint | NumberConstraint | DateConstraint;
32
+ export type FilterConstraint = ReferenceConstraint | TextConstraint | NumberConstraint | DateConstraint | BooleanConstraint;
33
+ export declare const NumberOperators: string[];
28
34
  export type NumberConstraintOperators = {
29
35
  gt?: number;
30
36
  lt?: number;
31
37
  gte?: number;
32
38
  lte?: number;
33
- eq?: number | number[];
39
+ eq?: number | number[] | null;
34
40
  ne?: number | number[];
35
41
  };
36
42
  export type DateConstraintOperators = {
@@ -38,7 +44,7 @@ export type DateConstraintOperators = {
38
44
  lt?: Date;
39
45
  gte?: Date;
40
46
  lte?: Date;
41
- eq?: Date | Date[];
47
+ eq?: Date | Date[] | null;
42
48
  ne?: Date | Date[];
43
49
  };
44
50
  export type FilterEntryNumberRange = {
@@ -49,8 +55,8 @@ export type FilterEntryDateRange = {
49
55
  min: Date;
50
56
  max: Date;
51
57
  };
52
- export type FilterItemType = 'reference' | 'number' | 'text' | 'date';
53
- export type FilterItemPropertyType = 'number' | 'text' | 'date';
58
+ export type FilterItemType = 'reference' | 'number' | 'text' | 'date' | 'boolean';
59
+ export type FilterItemPropertyType = 'number' | 'text' | 'date' | 'boolean';
54
60
  export type FilterItemReferenceType = 'reference';
55
61
  export type FilterItemBase = {
56
62
  key: string;
@@ -65,7 +71,7 @@ export type FilterItemBase = {
65
71
  export type TextFilterItem = FilterItemBase & {
66
72
  type: 'text';
67
73
  comparisonType: FilterComparisonType;
68
- text: string;
74
+ text: string | undefined | null;
69
75
  };
70
76
  export type NumberFilterItem = FilterItemBase & {
71
77
  type: 'number';
@@ -75,6 +81,10 @@ export type DateFilterItem = FilterItemBase & {
75
81
  type: 'date';
76
82
  range: FilterItemDateRangeValue;
77
83
  };
84
+ export type BooleanFilterItem = FilterItemBase & {
85
+ type: 'boolean';
86
+ entries: Array<FilterItemEntry>;
87
+ };
78
88
  export type FilterItemNumberRangeValue = {
79
89
  available: FilterEntryNumberRange;
80
90
  initial: FilterEntryNumberRange;
@@ -89,14 +99,14 @@ export type ReferenceFilterItem = FilterItemBase & {
89
99
  type: 'reference';
90
100
  entries: Array<FilterItemEntry>;
91
101
  };
92
- export type PropertyFilterItem = TextFilterItem | NumberFilterItem | DateFilterItem;
102
+ export type PropertyFilterItem = TextFilterItem | NumberFilterItem | DateFilterItem | BooleanFilterItem;
93
103
  export type FilterItem = PropertyFilterItem | ReferenceFilterItem;
94
104
  export type FilterItemEntry = {
95
105
  key: string;
96
106
  enabled: boolean;
97
107
  selected: boolean;
98
108
  size: number;
99
- value: string;
109
+ value: boolean | string | null | undefined;
100
110
  entry: ListItem;
101
111
  resultKeys: string[];
102
112
  children?: Array<FilterItemEntry>;
@@ -111,10 +121,10 @@ export type BaseFilterOptions = {
111
121
  */
112
122
  mode?: FilterMode;
113
123
  } & CatalogApiOptions;
114
- export type FilterType = 'text' | 'number' | 'reference' | 'date';
124
+ export type FilterType = 'text' | 'number' | 'reference' | 'date' | 'boolean';
115
125
  type TextFilterOptionsFull = BaseFilterOptions & {
116
126
  type: 'text';
117
- text: string;
127
+ text: string | undefined | null;
118
128
  };
119
129
  type NumberFilterOptionsFull = BaseFilterOptions & NumberConstraintOperators & {
120
130
  type: 'number';
@@ -124,11 +134,16 @@ type DateFilterOptionsFull = BaseFilterOptions & DateConstraintOperators & {
124
134
  };
125
135
  type ReferenceFilterOptionsFull = BaseFilterOptions & {
126
136
  type: 'reference';
127
- itemKeys: string[];
137
+ itemKeys: Array<string | undefined | null>;
138
+ };
139
+ type BooleanFilterOptionsFull = BaseFilterOptions & {
140
+ type: 'boolean';
141
+ value: boolean | undefined | null;
128
142
  };
129
- export type FilterOptions = TextFilterOptionsFull | NumberFilterOptionsFull | DateFilterOptionsFull | ReferenceFilterOptionsFull;
143
+ export type FilterOptions = TextFilterOptionsFull | NumberFilterOptionsFull | DateFilterOptionsFull | ReferenceFilterOptionsFull | BooleanFilterOptionsFull;
130
144
  export type TextFilterOptions = Omit<TextFilterOptionsFull, 'type'>;
131
145
  export type NumberFilterOptions = Omit<NumberFilterOptionsFull, 'type'>;
132
146
  export type DateFilterOptions = Omit<DateFilterOptionsFull, 'type'>;
133
147
  export type ReferenceFilterOptions = Omit<ReferenceFilterOptionsFull, 'type'>;
148
+ export type BooleanFilterOptions = Omit<BooleanFilterOptionsFull, 'type'>;
134
149
  export {};
@@ -1,2 +1,2 @@
1
- export {};
1
+ export var NumberOperators = ['gt', 'lt', 'gte', 'lte', 'eq', 'ne'];
2
2
  //# sourceMappingURL=filter.types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"filter.types.js","sourceRoot":"","sources":["../../../src/types/filter.types.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"filter.types.js","sourceRoot":"","sources":["../../../src/types/filter.types.ts"],"names":[],"mappings":"AAoDA,MAAM,CAAC,IAAM,eAAe,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC"}
@@ -23,6 +23,7 @@ export type DcuplFilterOptions = CatalogApiOptions & {
23
23
  calculateFacets?: boolean;
24
24
  excludeZeros?: boolean;
25
25
  excludeUndefineds?: boolean;
26
+ excludeUnresolved?: boolean;
26
27
  count?: number;
27
28
  };
28
29
  export type DcuplFiltersOptions = DcuplFilterOptions & {
@@ -44,6 +45,7 @@ export type DcuplFacetOptions = {
44
45
  count?: number;
45
46
  excludeZeros?: boolean;
46
47
  excludeUndefineds?: boolean;
48
+ excludeUnresolved?: boolean;
47
49
  calculateFacets?: boolean;
48
50
  };
49
51
  export type ListMetadata = {
@@ -1,5 +1,5 @@
1
1
  import { RawItem } from '.';
2
- export type PropertyType = 'string' | 'int' | 'float' | 'json' | 'date' | 'any' | 'Array<string>' | 'Array<int>' | 'Array<float>' | 'Array<date>';
2
+ export type PropertyType = 'string' | 'int' | 'float' | 'json' | 'date' | 'boolean' | 'any' | 'Array<string>' | 'Array<int>' | 'Array<float>' | 'Array<date>';
3
3
  export declare const NumberPropertyTypes: PropertyType[];
4
4
  export declare const DatePropertyTypes: PropertyType[];
5
5
  /**
@@ -46,6 +46,11 @@ type PropertyBase = {
46
46
  meta?: ModelMetadata;
47
47
  index?: boolean;
48
48
  };
49
+ export type PropertyBoolean = PropertyBase & {
50
+ type: 'boolean';
51
+ aggregate?: boolean;
52
+ filter?: boolean;
53
+ };
49
54
  export type PropertyInt = PropertyBase & {
50
55
  type: 'int' | 'Array<int>';
51
56
  aggregate?: boolean;
@@ -67,7 +72,10 @@ export type PropertyJson = PropertyBase & {
67
72
  export type PropertyAny = PropertyBase & {
68
73
  type: 'any' | 'Array<any>';
69
74
  };
70
- export type PropertyDateInputFormat = 'date' | 'ts_seconds' | 'ts_milliseconds' | 'string';
75
+ /**
76
+ * Example: 'yyyy-MM-dd' | 'dd.MM.yyyy' | ...
77
+ */
78
+ export type PropertyDateInputFormat = 'date' | 'ts_seconds' | 'ts_milliseconds' | 'string' | string;
71
79
  export type PropertyDate = PropertyBase & {
72
80
  type: 'date' | 'Array<date>';
73
81
  inputFormat?: PropertyDateInputFormat;
@@ -83,7 +91,7 @@ export type PropertyExpression = PropertyBase & {
83
91
  filter?: boolean | FilterStringSingle | FilterStringArray[];
84
92
  };
85
93
  export type PropertyNumber = PropertyFloat | PropertyInt;
86
- export type Property = PropertyExpression | PropertyString | PropertyInt | PropertyFloat | PropertyDate | PropertyJson | PropertyAny;
94
+ export type Property = PropertyExpression | PropertyString | PropertyInt | PropertyFloat | PropertyDate | PropertyJson | PropertyBoolean | PropertyAny;
87
95
  export type PropertyDerived = Property & {
88
96
  derive: {
89
97
  localReference: string;
@@ -108,6 +116,10 @@ export type ReferenceFilterDefinition = {
108
116
  excludeZeros?: boolean;
109
117
  excludeUndefineds?: boolean;
110
118
  };
119
+ export type BooleanFilterDefinition = {
120
+ calculateFacets?: boolean;
121
+ excludeUndefineds?: boolean;
122
+ };
111
123
  export type ReferenceValidity = 'loose' | 'strict';
112
124
  /**
113
125
  * A Reference prepresent a list of elements along a explicite dimension.
@@ -1 +1 @@
1
- {"version":3,"file":"model.types.js","sourceRoot":"","sources":["../../../src/types/model.types.ts"],"names":[],"mappings":"AAcA,MAAM,CAAC,IAAM,mBAAmB,GAAmB,CAAC,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,cAAc,CAAC,CAAC;AAClG,MAAM,CAAC,IAAM,iBAAiB,GAAmB,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC"}
1
+ {"version":3,"file":"model.types.js","sourceRoot":"","sources":["../../../src/types/model.types.ts"],"names":[],"mappings":"AAeA,MAAM,CAAC,IAAM,mBAAmB,GAAmB,CAAC,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,cAAc,CAAC,CAAC;AAClG,MAAM,CAAC,IAAM,iBAAiB,GAAmB,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcupl/common",
3
- "version": "0.0.75",
3
+ "version": "0.0.77",
4
4
  "description": "Dcupl Common Code",
5
5
  "main": "dist/lib-cjs/index.js",
6
6
  "module": "dist/lib-esm/index.js",