algoliasearch-helper 3.11.0 → 3.11.2
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/CHANGELOG +8 -0
- package/dist/algoliasearch.helper.js +35 -3
- package/dist/algoliasearch.helper.js.map +5 -5
- package/dist/algoliasearch.helper.min.js +1 -1
- package/dist/algoliasearch.helper.min.js.map +1 -1
- package/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/algoliasearch.helper.js +2 -0
- package/src/functions/merge.js +2 -1
- package/src/requestBuilder.js +30 -1
- package/src/version.js +1 -1
package/CHANGELOG
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
3.11.2 - 2023-01-09
|
|
2
|
+
* feat: update Algolia logo (#918) https://github.com/algolia/algoliasearch-helper-js/commit/58e0e588195dde8f411383ad248bd112a9c01eb5
|
|
3
|
+
* fix: prevent prototype pollution in rare error-cases (#923) https://github.com/algolia/algoliasearch-helper-js/commit/7ae16eaa3f5732b96f1fa40973778c5494e77b89, closes https://github.com/algolia/algoliasearch-helper-js/issues/922
|
|
4
|
+
* fix(answers): deprecate findAnswers (#919) https://github.com/algolia/algoliasearch-helper-js/commit/07118610d3da07d04390d7b79e857122e98a3db5
|
|
5
|
+
|
|
6
|
+
3.11.1 - 2022-09-12
|
|
7
|
+
* fix(facetValues): use existing facet filters in multi queries for hierarchical facet values (#915) https://github.com/algolia/algoliasearch-helper-js/commit/bae388c7143653e74628dbd3c72979a51be6ab7f
|
|
8
|
+
|
|
1
9
|
3.11.0 - 2022-08-03
|
|
2
10
|
* feat(typing): Update SearchResults hits, expose optional hit typings (#914) https://github.com/algolia/algoliasearch-helper-js/commit/bf4c4c6cdc84a5b9d8daff60d591a419df01beed
|
|
3
11
|
|
|
@@ -3577,8 +3577,10 @@ AlgoliaSearchHelper.prototype.searchOnce = function(options, cb) {
|
|
|
3577
3577
|
* @param {number} options.nbHits - Maximum number of answers to retrieve from the Answers Engine. Cannot be greater than 1000.
|
|
3578
3578
|
*
|
|
3579
3579
|
* @return {promise} the answer results
|
|
3580
|
+
* @deprecated answers is deprecated and will be replaced with new initiatives
|
|
3580
3581
|
*/
|
|
3581
3582
|
AlgoliaSearchHelper.prototype.findAnswers = function(options) {
|
|
3583
|
+
console.warn('[algoliasearch-helper] answers is no longer supported');
|
|
3582
3584
|
var state = this.state;
|
|
3583
3585
|
var derivedHelper = this.derivedHelpers[0];
|
|
3584
3586
|
if (!derivedHelper) {
|
|
@@ -5007,7 +5009,8 @@ function _merge(target, source) {
|
|
|
5007
5009
|
for (var key in source) {
|
|
5008
5010
|
if (
|
|
5009
5011
|
!Object.prototype.hasOwnProperty.call(source, key) ||
|
|
5010
|
-
key === '__proto__'
|
|
5012
|
+
key === '__proto__' ||
|
|
5013
|
+
key === 'constructor'
|
|
5011
5014
|
) {
|
|
5012
5015
|
continue;
|
|
5013
5016
|
}
|
|
@@ -5259,8 +5262,37 @@ var requestBuilder = {
|
|
|
5259
5262
|
level === 0
|
|
5260
5263
|
);
|
|
5261
5264
|
|
|
5265
|
+
// Keep facet filters unrelated to current hierarchical attributes
|
|
5266
|
+
function hasHierarchicalFacetFilter(value) {
|
|
5267
|
+
return hierarchicalFacet.attributes.some(function(attribute) {
|
|
5268
|
+
return attribute === value.split(':')[0];
|
|
5269
|
+
});
|
|
5270
|
+
}
|
|
5271
|
+
|
|
5272
|
+
var filteredFacetFilters = (params.facetFilters || []).reduce(function(acc, facetFilter) {
|
|
5273
|
+
if (Array.isArray(facetFilter)) {
|
|
5274
|
+
var filtered = facetFilter.filter(function(filterValue) {
|
|
5275
|
+
return !hasHierarchicalFacetFilter(filterValue);
|
|
5276
|
+
});
|
|
5277
|
+
|
|
5278
|
+
if (filtered.length > 0) {
|
|
5279
|
+
acc.push(filtered);
|
|
5280
|
+
}
|
|
5281
|
+
}
|
|
5282
|
+
|
|
5283
|
+
if (typeof facetFilter === 'string' && !hasHierarchicalFacetFilter(facetFilter)) {
|
|
5284
|
+
acc.push(facetFilter);
|
|
5285
|
+
}
|
|
5286
|
+
|
|
5287
|
+
return acc;
|
|
5288
|
+
}, []);
|
|
5289
|
+
|
|
5262
5290
|
var parent = filtersMap[level - 1];
|
|
5263
|
-
|
|
5291
|
+
if (level > 0) {
|
|
5292
|
+
params.facetFilters = filteredFacetFilters.concat(parent.attribute + ':' + parent.value);
|
|
5293
|
+
} else {
|
|
5294
|
+
params.facetFilters = filteredFacetFilters.length > 0 ? filteredFacetFilters : undefined;
|
|
5295
|
+
}
|
|
5264
5296
|
|
|
5265
5297
|
queries.push({indexName: index, params: params});
|
|
5266
5298
|
});
|
|
@@ -5558,7 +5590,7 @@ module.exports = function isValidUserToken(userToken) {
|
|
|
5558
5590
|
},{}],24:[function(require,module,exports){
|
|
5559
5591
|
'use strict';
|
|
5560
5592
|
|
|
5561
|
-
module.exports = '3.11.
|
|
5593
|
+
module.exports = '3.11.2';
|
|
5562
5594
|
|
|
5563
5595
|
},{}]},{},[1])(1)
|
|
5564
5596
|
});
|