algoliasearch-helper 3.6.2 → 3.7.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 CHANGED
@@ -1,3 +1,14 @@
1
+ 3.7.2 - 2022-03-18
2
+ * chore(docs): fix capitalization of Github and npm https://github.com/algolia/algoliasearch-helper-js/commit/5babbcad0b3d406a0b56f7a55682ff169e2b853f
3
+ * fix(results): implement search result options via an argument https://github.com/algolia/algoliasearch-helper-js/commit/4e6ac6926bd284c7eafe060480fc4258844d121a
4
+
5
+ 3.7.1 - 2022-03-17
6
+ * docs(readme): fixed angular.js example link (#885) https://github.com/algolia/algoliasearch-helper-js/commit/c16287e6685040a3786b8d0bac0922cdc583134e, closes https://github.com/algolia/algoliasearch-helper-js/issues/885
7
+ * fix(types): allow "__isArtificial" (#890) https://github.com/algolia/algoliasearch-helper-js/commit/1e2aef0fb8aa88c80b985ef009bff5a3dd71ca80
8
+
9
+ 3.7.0 - 2021-12-13
10
+ * feat(events): move to @algolia/events (#883) https://github.com/algolia/algoliasearch-helper-js/commit/0c33fdc0063d7486db71ba0c6952339dc8b93ae5
11
+
1
12
  3.6.2 - 2021-10-19
2
13
  * fix(SearchParameters): ignore invalid parameters (#880) https://github.com/algolia/algoliasearch-helper-js/commit/4ff542b70b92a6b81cce8b9255700b0bc0817edd
3
14
 
package/README.md CHANGED
@@ -36,7 +36,7 @@ track of the search parameters and provides a higher level API.
36
36
  - [Helper cheatsheet](#helper-cheatsheet)
37
37
  - [Add the helper in your project](#add-the-helper-in-your-project)
38
38
  - [Regular `<script>` tag](#regular-script-tag)
39
- - [With NPM](#with-npm)
39
+ - [With npm](#with-npm)
40
40
  - [Init the helper](#init-the-helper)
41
41
  - [Helper lifecycle](#helper-lifecycle)
42
42
  - [Objects](#objects)
@@ -124,7 +124,7 @@ angular.module('searchApp', ['ngSanitize', 'algoliasearch'])
124
124
  }]);
125
125
  </script>
126
126
  ```
127
- You can see the full [Angular example here](examples/instantsearch%2Bhelper%2Bangular.html)
127
+ You can see the full [Angular example here](https://codepen.io/Algolia/pen/PzZobK)
128
128
 
129
129
  ## Helper cheatsheet
130
130
 
@@ -138,7 +138,7 @@ Use our [jsDelivr](http://www.jsdelivr.com/) build:
138
138
 
139
139
  `<script src="https://cdn.jsdelivr.net/algoliasearch.helper/2/algoliasearch.helper.min.js"></script>`
140
140
 
141
- ### With NPM
141
+ ### With npm
142
142
 
143
143
  `npm install algoliasearch-helper`
144
144
 
@@ -100,7 +100,7 @@ function EventEmitter() {
100
100
  module.exports = EventEmitter;
101
101
 
102
102
  // Backwards-compat with node 0.10.x
103
- EventEmitter.EventEmitter = EventEmitter;
103
+ // EventEmitter.EventEmitter = EventEmitter;
104
104
 
105
105
  EventEmitter.prototype._events = undefined;
106
106
  EventEmitter.prototype._maxListeners = undefined;
@@ -378,7 +378,7 @@ function isUndefined(arg) {
378
378
  },{}],3:[function(require,module,exports){
379
379
  'use strict';
380
380
 
381
- var events = require('events');
381
+ var EventEmitter = require('@algolia/events');
382
382
  var inherits = require('../functions/inherits');
383
383
 
384
384
  /**
@@ -397,7 +397,7 @@ function DerivedHelper(mainHelper, fn) {
397
397
  this.lastResults = null;
398
398
  }
399
399
 
400
- inherits(DerivedHelper, events.EventEmitter);
400
+ inherits(DerivedHelper, EventEmitter);
401
401
 
402
402
  /**
403
403
  * Detach this helper from the main helper
@@ -415,7 +415,7 @@ DerivedHelper.prototype.getModifiedState = function(parameters) {
415
415
 
416
416
  module.exports = DerivedHelper;
417
417
 
418
- },{"../functions/inherits":14,"events":2}],4:[function(require,module,exports){
418
+ },{"../functions/inherits":14,"@algolia/events":2}],4:[function(require,module,exports){
419
419
  'use strict';
420
420
 
421
421
  /**
@@ -2504,7 +2504,7 @@ function findMatchingHierarchicalFacetFromAttributeName(
2504
2504
  }
2505
2505
  **/
2506
2506
  /*eslint-enable */
2507
- function SearchResults(state, results) {
2507
+ function SearchResults(state, results, options) {
2508
2508
  var mainSubResponse = results[0];
2509
2509
 
2510
2510
  this._rawResults = results;
@@ -2516,6 +2516,11 @@ function SearchResults(state, results) {
2516
2516
  self[key] = mainSubResponse[key];
2517
2517
  });
2518
2518
 
2519
+ // Make every key of the result options reachable from the instance
2520
+ Object.keys(options || {}).forEach(function(key) {
2521
+ self[key] = options[key];
2522
+ });
2523
+
2519
2524
  /**
2520
2525
  * query used to generate the results
2521
2526
  * @name query
@@ -3303,7 +3308,7 @@ var SearchResults = require('./SearchResults');
3303
3308
  var DerivedHelper = require('./DerivedHelper');
3304
3309
  var requestBuilder = require('./requestBuilder');
3305
3310
 
3306
- var events = require('events');
3311
+ var EventEmitter = require('@algolia/events');
3307
3312
  var inherits = require('./functions/inherits');
3308
3313
  var objectHasKeys = require('./functions/objectHasKeys');
3309
3314
  var omit = require('./functions/omit');
@@ -3430,7 +3435,7 @@ function AlgoliaSearchHelper(client, index, options) {
3430
3435
  this._currentNbQueries = 0;
3431
3436
  }
3432
3437
 
3433
- inherits(AlgoliaSearchHelper, events.EventEmitter);
3438
+ inherits(AlgoliaSearchHelper, EventEmitter);
3434
3439
 
3435
3440
  /**
3436
3441
  * Start the search with the parameters set in the state. When the
@@ -4764,7 +4769,7 @@ AlgoliaSearchHelper.prototype.hasPendingRequests = function() {
4764
4769
 
4765
4770
  module.exports = AlgoliaSearchHelper;
4766
4771
 
4767
- },{"./DerivedHelper":3,"./SearchParameters":5,"./SearchResults":7,"./functions/inherits":14,"./functions/merge":16,"./functions/objectHasKeys":17,"./functions/omit":18,"./requestBuilder":21,"./version":23,"events":2}],9:[function(require,module,exports){
4772
+ },{"./DerivedHelper":3,"./SearchParameters":5,"./SearchResults":7,"./functions/inherits":14,"./functions/merge":16,"./functions/objectHasKeys":17,"./functions/omit":18,"./requestBuilder":21,"./version":23,"@algolia/events":2}],9:[function(require,module,exports){
4768
4773
  'use strict';
4769
4774
 
4770
4775
  module.exports = function compact(array) {
@@ -5447,7 +5452,7 @@ module.exports = function isValidUserToken(userToken) {
5447
5452
  },{}],23:[function(require,module,exports){
5448
5453
  'use strict';
5449
5454
 
5450
- module.exports = '3.6.2';
5455
+ module.exports = '3.7.2';
5451
5456
 
5452
5457
  },{}]},{},[1])(1)
5453
5458
  });