@constructor-io/constructorio-node 4.17.0 → 4.17.1

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.17.0",
3
+ "version": "4.17.1",
4
4
  "description": "Constructor.io Node.js client",
5
5
  "main": "src/constructorio.js",
6
6
  "types": "src/types/constructorio.d.ts",
@@ -38,7 +38,16 @@ function createRecommendationsUrl(podId, parameters, userParameters, options) {
38
38
  }
39
39
 
40
40
  if (parameters) {
41
- const { numResults, itemIds, section, term, filters, variationsMap, hiddenFields } = parameters;
41
+ const {
42
+ numResults,
43
+ itemIds,
44
+ section,
45
+ term,
46
+ filters,
47
+ variationsMap,
48
+ hiddenFields,
49
+ preFilterExpression,
50
+ } = parameters;
42
51
 
43
52
  // Pull num results number from parameters
44
53
  if (!helpers.isNil(numResults)) {
@@ -78,6 +87,11 @@ function createRecommendationsUrl(podId, parameters, userParameters, options) {
78
87
  if (variationsMap) {
79
88
  queryParams.variations_map = JSON.stringify(variationsMap);
80
89
  }
90
+
91
+ // Pull pre_filter_expression from parameters
92
+ if (preFilterExpression) {
93
+ queryParams.pre_filter_expression = JSON.stringify(preFilterExpression);
94
+ }
81
95
  }
82
96
 
83
97
  queryParams = helpers.cleanParams(queryParams);
@@ -111,6 +125,7 @@ class Recommendations {
111
125
  * @param {string} [parameters.term] - The term to use to refine results (strategy specific)
112
126
  * @param {object} [parameters.filters] - Key / value mapping of filters used to refine results
113
127
  * @param {object} [parameters.variationsMap] - The variations map object to aggregate variations. Please refer to https://docs.constructor.com/reference/shared-variations-mapping for details
128
+ * @param {object} [parameters.preFilterExpression] - Faceting expression to scope search results. Please refer to https://docs.constructor.com/reference/configuration-collections
114
129
  * @param {string[]} [parameters.hiddenFields] - Hidden metadata fields to return
115
130
  * @param {object} [userParameters] - Parameters relevant to the user request
116
131
  * @param {number} [userParameters.sessionId] - Session ID, utilized to personalize results
@@ -8,6 +8,7 @@ export interface RecommendationsParameters {
8
8
  section?: string;
9
9
  term?: string;
10
10
  filters?: Record<string, any>;
11
+ preFilterExpression?: FilterExpression;
11
12
  variationsMap?: VariationsMap;
12
13
  hiddenFields?: string[];
13
14
  }