@constructor-io/constructorio-node 4.5.0 → 4.5.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 +1 -1
- package/src/modules/browse.js +7 -0
- package/src/modules/search.js +8 -0
- package/src/types/browse.d.ts +2 -1
- package/src/types/search.d.ts +1 -0
package/package.json
CHANGED
package/src/modules/browse.js
CHANGED
|
@@ -37,6 +37,7 @@ function createQueryParams(parameters, userParameters, options) {
|
|
|
37
37
|
hiddenFacets,
|
|
38
38
|
variationsMap,
|
|
39
39
|
preFilterExpression,
|
|
40
|
+
qsParam,
|
|
40
41
|
} = parameters;
|
|
41
42
|
|
|
42
43
|
// Pull page from parameters
|
|
@@ -105,6 +106,11 @@ function createQueryParams(parameters, userParameters, options) {
|
|
|
105
106
|
if (preFilterExpression) {
|
|
106
107
|
queryParams.pre_filter_expression = JSON.stringify(preFilterExpression);
|
|
107
108
|
}
|
|
109
|
+
|
|
110
|
+
// Pull qs param from parameters
|
|
111
|
+
if (qsParam) {
|
|
112
|
+
queryParams.qs = JSON.stringify(qsParam);
|
|
113
|
+
}
|
|
108
114
|
}
|
|
109
115
|
|
|
110
116
|
// Pull test cells from options
|
|
@@ -252,6 +258,7 @@ class Browse {
|
|
|
252
258
|
* @param {string[]} [parameters.hiddenFacets] - Hidden facet fields to return
|
|
253
259
|
* @param {object} [parameters.variationsMap] - The variations map object to aggregate variations. Please refer to https://docs.constructor.io/rest_api/variations_mapping for details
|
|
254
260
|
* @param {object} [parameters.preFilterExpression] - Faceting expression to scope search results. Please refer to https://docs.constructor.io/rest_api/collections/#add-items-dynamically for details
|
|
261
|
+
* @param {object} [parameters.qsParam] - Parameters listed above can be serialized into a JSON object and parsed through this parameter. Please refer to https://docs.constructor.io/rest_api/browse/queries for details
|
|
255
262
|
* @param {object} [userParameters] - Parameters relevant to the user request
|
|
256
263
|
* @param {number} [userParameters.sessionId] - Session ID, utilized to personalize results
|
|
257
264
|
* @param {number} [userParameters.clientId] - Client ID, utilized to personalize results
|
package/src/modules/search.js
CHANGED
|
@@ -61,6 +61,7 @@ function createSearchUrl(query, parameters, userParameters, options, isVoiceSear
|
|
|
61
61
|
hiddenFacets,
|
|
62
62
|
variationsMap,
|
|
63
63
|
preFilterExpression,
|
|
64
|
+
qsParam,
|
|
64
65
|
} = parameters;
|
|
65
66
|
|
|
66
67
|
// Pull page from parameters
|
|
@@ -130,6 +131,11 @@ function createSearchUrl(query, parameters, userParameters, options, isVoiceSear
|
|
|
130
131
|
if (preFilterExpression) {
|
|
131
132
|
queryParams.pre_filter_expression = JSON.stringify(preFilterExpression);
|
|
132
133
|
}
|
|
134
|
+
|
|
135
|
+
// Pull qs param from parameters
|
|
136
|
+
if (qsParam) {
|
|
137
|
+
queryParams.qs = JSON.stringify(qsParam);
|
|
138
|
+
}
|
|
133
139
|
}
|
|
134
140
|
|
|
135
141
|
queryParams._dt = Date.now();
|
|
@@ -172,6 +178,7 @@ class Search {
|
|
|
172
178
|
* @param {string[]} [parameters.hiddenFacets] - Hidden facet fields to return
|
|
173
179
|
* @param {object} [parameters.variationsMap] - The variations map object to aggregate variations. Please refer to https://docs.constructor.io/rest_api/variations_mapping for details
|
|
174
180
|
* @param {object} [parameters.preFilterExpression] - Faceting expression to scope search results. Please refer to https://docs.constructor.io/rest_api/collections/#add-items-dynamically for details
|
|
181
|
+
* @param {object} [parameters.qsParam] - Parameters listed above can be serialized into a JSON object and parsed through this parameter. Please refer to https://docs.constructor.io/rest_api/search/queries for details
|
|
175
182
|
* @param {object} [userParameters] - Parameters relevant to the user request
|
|
176
183
|
* @param {number} [userParameters.sessionId] - Session ID, utilized to personalize results
|
|
177
184
|
* @param {number} [userParameters.clientId] - Client ID, utilized to personalize results
|
|
@@ -273,6 +280,7 @@ class Search {
|
|
|
273
280
|
* @param {string[]} [parameters.hiddenFacets] - Hidden facet fields to return
|
|
274
281
|
* @param {object} [parameters.variationsMap] - The variations map object to aggregate variations. Please refer to https://docs.constructor.io/rest_api/variations_mapping for details
|
|
275
282
|
* @param {object} [parameters.preFilterExpression] - Faceting expression to scope search results. Please refer to https://docs.constructor.io/rest_api/collections/#add-items-dynamically for details
|
|
283
|
+
* @param {object} [parameters.qsParam] - Parameters listed above can be serialized into a JSON object and parsed through this parameter. Please refer to https://docs.constructor.io/rest_api/search/queries for details
|
|
276
284
|
* @param {object} [userParameters] - Parameters relevant to the user request
|
|
277
285
|
* @param {number} [userParameters.sessionId] - Session ID, utilized to personalize results
|
|
278
286
|
* @param {number} [userParameters.clientId] - Client ID, utilized to personalize results
|
package/src/types/browse.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ export interface BrowseParameters {
|
|
|
29
29
|
hiddenFields?: string[];
|
|
30
30
|
hiddenFacets?: string[];
|
|
31
31
|
variationsMap?: Record<string, any>;
|
|
32
|
+
qsParam?: Record<string, any>;
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
declare class Browse {
|
|
@@ -46,7 +47,7 @@ declare class Browse {
|
|
|
46
47
|
|
|
47
48
|
getBrowseResultsForItemIds(
|
|
48
49
|
itemIds: string[],
|
|
49
|
-
parameters?: BrowseParameters,
|
|
50
|
+
parameters?: Omit<BrowseParameters, 'preFilterExpression' | 'qsParam'>,
|
|
50
51
|
userParameters?: UserParameters,
|
|
51
52
|
networkParameters?: NetworkParameters
|
|
52
53
|
): Promise<GetBrowseResultsForItemIdsResponse>;
|