algoliasearch-helper 3.11.3 → 3.13.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/CHANGELOG CHANGED
@@ -1,3 +1,10 @@
1
+ 3.13.0 - 2023-05-03
2
+ * chore: delete renovate (#936) https://github.com/algolia/algoliasearch-helper-js/commit/0e3d8cff722d4a91a04251533636f0860ef3828c
3
+ * feat(DerivedHelper): skip request for empty index (#938) https://github.com/algolia/algoliasearch-helper-js/commit/79caa4b0ca2537c0f4431ee11556464031935436
4
+
5
+ 3.12.0 - 2023-03-03
6
+ * feat(types): add `queryAfterRemoval` to `SearchResults` (#934) https://github.com/algolia/algoliasearch-helper-js/commit/4fb5a0345f0cf438fb026d8010faf843bd3b0a01
7
+
1
8
  3.11.3 - 2023-01-23
2
9
  * chore(tests): remove remaining lodash usage (#927) https://github.com/algolia/algoliasearch-helper-js/commit/e234837aaa10e6458d06085ff9938c741ee74d4b
3
10
  * fix(getFacetValues): reflect the value of _state in hierarchicalFacetValues (#925) https://github.com/algolia/algoliasearch-helper-js/commit/4d093b464e62dc6963dc6676aee19ff78145f48a
@@ -4619,7 +4619,9 @@ AlgoliaSearchHelper.prototype._search = function(options) {
4619
4619
 
4620
4620
  var derivedQueries = this.derivedHelpers.map(function(derivedHelper) {
4621
4621
  var derivedState = derivedHelper.getModifiedState(state);
4622
- var derivedStateQueries = requestBuilder._getQueries(derivedState.index, derivedState);
4622
+ var derivedStateQueries = derivedState.index
4623
+ ? requestBuilder._getQueries(derivedState.index, derivedState)
4624
+ : [];
4623
4625
 
4624
4626
  states.push({
4625
4627
  state: derivedState,
@@ -4636,10 +4638,16 @@ AlgoliaSearchHelper.prototype._search = function(options) {
4636
4638
  });
4637
4639
 
4638
4640
  var queries = Array.prototype.concat.apply(mainQueries, derivedQueries);
4639
- var queryId = this._queryId++;
4640
4641
 
4642
+ var queryId = this._queryId++;
4641
4643
  this._currentNbQueries++;
4642
4644
 
4645
+ if (!queries.length) {
4646
+ return Promise.resolve({results: []}).then(
4647
+ this._dispatchAlgoliaResponse.bind(this, states, queryId)
4648
+ );
4649
+ }
4650
+
4643
4651
  try {
4644
4652
  this.client.search(queries)
4645
4653
  .then(this._dispatchAlgoliaResponse.bind(this, states, queryId))
@@ -4684,6 +4692,14 @@ AlgoliaSearchHelper.prototype._dispatchAlgoliaResponse = function(states, queryI
4684
4692
  var helper = s.helper;
4685
4693
  var specificResults = results.splice(0, queriesCount);
4686
4694
 
4695
+ if (!state.index) {
4696
+ helper.emit('result', {
4697
+ results: null,
4698
+ state: state
4699
+ });
4700
+ return;
4701
+ }
4702
+
4687
4703
  var formattedResponse = helper.lastResults = new SearchResults(state, specificResults);
4688
4704
 
4689
4705
  helper.emit('result', {
@@ -5616,7 +5632,7 @@ module.exports = function isValidUserToken(userToken) {
5616
5632
  },{}],24:[function(require,module,exports){
5617
5633
  'use strict';
5618
5634
 
5619
- module.exports = '3.11.3';
5635
+ module.exports = '3.13.0';
5620
5636
 
5621
5637
  },{}]},{},[1])(1)
5622
5638
  });