@constructor-io/constructorio-node 4.10.1 → 4.11.0

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructor-io/constructorio-node",
3
- "version": "4.10.1",
3
+ "version": "4.11.0",
4
4
  "description": "Constructor.io Node.js client",
5
5
  "main": "src/constructorio.js",
6
6
  "types": "src/types/constructorio.d.ts",
@@ -53,6 +53,7 @@ function createAutocompleteUrl(query, parameters, userParameters, options) {
53
53
  filtersPerSection,
54
54
  hiddenFields,
55
55
  variationsMap,
56
+ preFilterExpression,
56
57
  resultsPerPagePerSection,
57
58
  pagePerSection,
58
59
  } = parameters;
@@ -104,6 +105,11 @@ function createAutocompleteUrl(query, parameters, userParameters, options) {
104
105
  if (variationsMap) {
105
106
  queryParams.variations_map = JSON.stringify(variationsMap);
106
107
  }
108
+
109
+ // Pull filter expression from parameters
110
+ if (preFilterExpression) {
111
+ queryParams.pre_filter_expression = JSON.stringify(preFilterExpression);
112
+ }
107
113
  }
108
114
 
109
115
  queryParams._dt = Date.now();
@@ -142,6 +148,7 @@ class Autocomplete {
142
148
  * @param {object} [parameters.resultsPerSection] - Number of results to return (value) per section (key)
143
149
  * @param {string[]} [parameters.hiddenFields] - Hidden metadata fields to return
144
150
  * @param {object} [parameters.variationsMap] - The variations map object to aggregate variations. Please refer to https://docs.constructor.io/rest_api/variations_mapping for details
151
+ * @param {object} [parameters.preFilterExpression] - Faceting expression to scope autocomplete results. Please refer to https://docs.constructor.io/rest_api/collections/#add-items-dynamically for details
145
152
  * @param {object} [userParameters] - Parameters relevant to the user request
146
153
  * @param {number} [userParameters.sessionId] - Session ID, utilized to personalize results
147
154
  * @param {string} [userParameters.clientId] - Client ID, utilized to personalize results
@@ -18,6 +18,7 @@ export interface AutocompleteParameters {
18
18
  resultsPerPagePerSection?: Record<string, number>;
19
19
  hiddenFields?: string[];
20
20
  variationsMap?: VariationsMap;
21
+ preFilterExpression?: FilterExpression;
21
22
  }
22
23
 
23
24
  declare class Autocomplete {
@@ -47,6 +48,8 @@ export interface AutocompleteRequestType extends Record<string, any> {
47
48
  features: Partial<RequestFeature>;
48
49
  feature_variants: Partial<RequestFeatureVariant>;
49
50
  searchandized_items: Record<string, any>;
51
+ variations_map?: VariationsMap;
52
+ pre_filter_expression?: FilterExpression;
50
53
  }
51
54
 
52
55
  export type Section = Partial<SectionItem>[];
@@ -142,4 +142,6 @@ export interface BrowseRequestType extends Record<string, any> {
142
142
  features: Partial<RequestFeature>;
143
143
  feature_variants: Partial<RequestFeatureVariant>;
144
144
  searchandized_items: Record<string, any>;
145
+ variations_map?: VariationsMap;
146
+ pre_filter_expression?: FilterExpression;
145
147
  }
@@ -83,6 +83,8 @@ export interface SearchRequestType extends Record<string, any> {
83
83
  features: Partial<RequestFeature>;
84
84
  feature_variants: Partial<RequestFeatureVariant>;
85
85
  searchandized_items: Record<string, any>;
86
+ variations_map?: VariationsMap;
87
+ pre_filter_expression?: FilterExpression;
86
88
  }
87
89
 
88
90
  export interface SearchResultType extends Record<string, any> {