@constructor-io/constructorio-node 4.4.3 → 4.4.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.
package/package.json
CHANGED
package/src/types/browse.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
ResultSources,
|
|
12
12
|
SortOption,
|
|
13
13
|
FmtOptions,
|
|
14
|
+
FilterExpression,
|
|
14
15
|
} from '.';
|
|
15
16
|
|
|
16
17
|
export default Browse;
|
|
@@ -24,6 +25,7 @@ export interface BrowseParameters {
|
|
|
24
25
|
sortOrder?: string;
|
|
25
26
|
section?: string;
|
|
26
27
|
fmtOptions?: FmtOptions;
|
|
28
|
+
preFilterExpression?: FilterExpression;
|
|
27
29
|
hiddenFields?: string[];
|
|
28
30
|
hiddenFacets?: string[];
|
|
29
31
|
variationsMap?: Record<string, any>;
|
package/src/types/index.d.ts
CHANGED
|
@@ -275,3 +275,31 @@ export interface SynonymGroup extends Record<string, any> {
|
|
|
275
275
|
synonym_group_id: number;
|
|
276
276
|
synonyms: string[];
|
|
277
277
|
}
|
|
278
|
+
|
|
279
|
+
export type FilterExpression =
|
|
280
|
+
| FilterExpressionGroup
|
|
281
|
+
| FilterExpressionNot
|
|
282
|
+
| FilterExpressionValue
|
|
283
|
+
| FilterExpressionRange;
|
|
284
|
+
|
|
285
|
+
export type FilterExpressionGroup =
|
|
286
|
+
| FilterExpressionGroupOr
|
|
287
|
+
| FilterExpressionGroupAnd;
|
|
288
|
+
|
|
289
|
+
export type FilterExpressionGroupOr = { or: FilterExpression[] };
|
|
290
|
+
export type FilterExpressionGroupAnd = { and: FilterExpression[] };
|
|
291
|
+
export type FilterExpressionCondition = 'or' | 'and';
|
|
292
|
+
|
|
293
|
+
export type FilterExpressionNot = { not: FilterExpression };
|
|
294
|
+
|
|
295
|
+
export type FilterExpressionValue = {
|
|
296
|
+
name: string;
|
|
297
|
+
value: string;
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
export type FilterExpressionRange = {
|
|
301
|
+
name: string;
|
|
302
|
+
range: FilterExpressionRangeValue;
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
export type FilterExpressionRangeValue = ['-inf' | number, 'inf' | number];
|
package/src/types/search.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
ConstructorClientOptions,
|
|
3
3
|
Facet,
|
|
4
4
|
Feature,
|
|
5
|
+
FilterExpression,
|
|
5
6
|
FmtOption,
|
|
6
7
|
Group,
|
|
7
8
|
NetworkParameters,
|
|
@@ -22,6 +23,7 @@ export interface SearchParameters {
|
|
|
22
23
|
sortOrder?: string;
|
|
23
24
|
section?: string;
|
|
24
25
|
fmtOptions?: Record<string, any>;
|
|
26
|
+
preFilterExpression?: FilterExpression;
|
|
25
27
|
hiddenFields?: string[];
|
|
26
28
|
hiddenFacets?: string[];
|
|
27
29
|
variationsMap?: Record<string, any>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { expectAssignable } from 'tsd';
|
|
2
|
+
import { FilterExpression } from '../index';
|
|
3
|
+
|
|
4
|
+
expectAssignable<FilterExpression>({
|
|
5
|
+
or: [
|
|
6
|
+
{
|
|
7
|
+
and: [
|
|
8
|
+
{
|
|
9
|
+
name: 'group_id',
|
|
10
|
+
value: 'electronics-group-id',
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
name: 'Price',
|
|
14
|
+
range: ['-inf', 200],
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
and: [
|
|
20
|
+
{
|
|
21
|
+
name: 'Type',
|
|
22
|
+
value: 'Laptop',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
not: {
|
|
26
|
+
name: 'Price',
|
|
27
|
+
range: [800, 'inf'],
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
});
|