@algolia/recommend 4.14.2 → 5.0.0-alpha.3

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.
Files changed (177) hide show
  1. package/dist/builds/browser.d.ts +6 -0
  2. package/dist/builds/browser.d.ts.map +1 -0
  3. package/dist/builds/node.d.ts +6 -0
  4. package/dist/builds/node.d.ts.map +1 -0
  5. package/dist/model/advancedSyntaxFeatures.d.ts +2 -0
  6. package/dist/model/advancedSyntaxFeatures.d.ts.map +1 -0
  7. package/dist/model/alternativesAsExact.d.ts +2 -0
  8. package/dist/model/alternativesAsExact.d.ts.map +1 -0
  9. package/dist/model/aroundRadius.d.ts +6 -0
  10. package/dist/model/aroundRadius.d.ts.map +1 -0
  11. package/dist/model/aroundRadiusAll.d.ts +2 -0
  12. package/dist/model/aroundRadiusAll.d.ts.map +1 -0
  13. package/dist/model/baseRecommendRequest.d.ts +18 -0
  14. package/dist/model/baseRecommendRequest.d.ts.map +1 -0
  15. package/dist/model/baseRecommendationRequest.d.ts +9 -0
  16. package/dist/model/baseRecommendationRequest.d.ts.map +1 -0
  17. package/dist/model/baseSearchParams.d.ts +4 -0
  18. package/dist/model/baseSearchParams.d.ts.map +1 -0
  19. package/dist/model/baseSearchParamsWithoutQuery.d.ts +123 -0
  20. package/dist/model/baseSearchParamsWithoutQuery.d.ts.map +1 -0
  21. package/dist/model/baseSearchResponse.d.ts +102 -0
  22. package/dist/model/baseSearchResponse.d.ts.map +1 -0
  23. package/dist/model/baseTrendingRequest.d.ts +13 -0
  24. package/dist/model/baseTrendingRequest.d.ts.map +1 -0
  25. package/dist/model/clientMethodProps.d.ts +61 -0
  26. package/dist/model/clientMethodProps.d.ts.map +1 -0
  27. package/dist/model/distinct.d.ts +5 -0
  28. package/dist/model/distinct.d.ts.map +1 -0
  29. package/dist/model/errorBase.d.ts +7 -0
  30. package/dist/model/errorBase.d.ts.map +1 -0
  31. package/dist/model/exactOnSingleWordQuery.d.ts +5 -0
  32. package/dist/model/exactOnSingleWordQuery.d.ts.map +1 -0
  33. package/dist/model/facetFilters.d.ts +6 -0
  34. package/dist/model/facetFilters.d.ts.map +1 -0
  35. package/dist/model/facetOrdering.d.ts +13 -0
  36. package/dist/model/facetOrdering.d.ts.map +1 -0
  37. package/dist/model/facets.d.ts +10 -0
  38. package/dist/model/facets.d.ts.map +1 -0
  39. package/dist/model/facetsStats.d.ts +19 -0
  40. package/dist/model/facetsStats.d.ts.map +1 -0
  41. package/dist/model/getRecommendationsParams.d.ts +11 -0
  42. package/dist/model/getRecommendationsParams.d.ts.map +1 -0
  43. package/dist/model/getRecommendationsResponse.d.ts +5 -0
  44. package/dist/model/getRecommendationsResponse.d.ts.map +1 -0
  45. package/dist/model/highlightResult.d.ts +3 -0
  46. package/dist/model/highlightResult.d.ts.map +1 -0
  47. package/dist/model/highlightResultOption.d.ts +20 -0
  48. package/dist/model/highlightResultOption.d.ts.map +1 -0
  49. package/dist/model/ignorePlurals.d.ts +5 -0
  50. package/dist/model/ignorePlurals.d.ts.map +1 -0
  51. package/dist/model/index.d.ts +54 -0
  52. package/dist/model/index.d.ts.map +1 -0
  53. package/dist/model/indexSettingsAsSearchParams.d.ts +157 -0
  54. package/dist/model/indexSettingsAsSearchParams.d.ts.map +1 -0
  55. package/dist/model/matchLevel.d.ts +5 -0
  56. package/dist/model/matchLevel.d.ts.map +1 -0
  57. package/dist/model/matchedGeoLocation.d.ts +15 -0
  58. package/dist/model/matchedGeoLocation.d.ts.map +1 -0
  59. package/dist/model/mixedSearchFilters.d.ts +2 -0
  60. package/dist/model/mixedSearchFilters.d.ts.map +1 -0
  61. package/dist/model/numericFilters.d.ts +6 -0
  62. package/dist/model/numericFilters.d.ts.map +1 -0
  63. package/dist/model/optionalFilters.d.ts +6 -0
  64. package/dist/model/optionalFilters.d.ts.map +1 -0
  65. package/dist/model/personalization.d.ts +15 -0
  66. package/dist/model/personalization.d.ts.map +1 -0
  67. package/dist/model/queryType.d.ts +5 -0
  68. package/dist/model/queryType.d.ts.map +1 -0
  69. package/dist/model/rankingInfo.d.ts +51 -0
  70. package/dist/model/rankingInfo.d.ts.map +1 -0
  71. package/dist/model/reRankingApplyFilter.d.ts +6 -0
  72. package/dist/model/reRankingApplyFilter.d.ts.map +1 -0
  73. package/dist/model/recommendHit.d.ts +27 -0
  74. package/dist/model/recommendHit.d.ts.map +1 -0
  75. package/dist/model/recommendHits.d.ts +5 -0
  76. package/dist/model/recommendHits.d.ts.map +1 -0
  77. package/dist/model/recommendationModels.d.ts +5 -0
  78. package/dist/model/recommendationModels.d.ts.map +1 -0
  79. package/dist/model/recommendationRequest.d.ts +4 -0
  80. package/dist/model/recommendationRequest.d.ts.map +1 -0
  81. package/dist/model/recommendationsRequest.d.ts +4 -0
  82. package/dist/model/recommendationsRequest.d.ts.map +1 -0
  83. package/dist/model/recommendationsResponse.d.ts +4 -0
  84. package/dist/model/recommendationsResponse.d.ts.map +1 -0
  85. package/dist/model/removeStopWords.d.ts +5 -0
  86. package/dist/model/removeStopWords.d.ts.map +1 -0
  87. package/dist/model/removeWordsIfNoResults.d.ts +5 -0
  88. package/dist/model/removeWordsIfNoResults.d.ts.map +1 -0
  89. package/dist/model/renderingContent.d.ts +8 -0
  90. package/dist/model/renderingContent.d.ts.map +1 -0
  91. package/dist/model/searchParamsObject.d.ts +4 -0
  92. package/dist/model/searchParamsObject.d.ts.map +1 -0
  93. package/dist/model/searchParamsQuery.d.ts +7 -0
  94. package/dist/model/searchParamsQuery.d.ts.map +1 -0
  95. package/dist/model/snippetResult.d.ts +3 -0
  96. package/dist/model/snippetResult.d.ts.map +1 -0
  97. package/dist/model/snippetResultOption.d.ts +12 -0
  98. package/dist/model/snippetResultOption.d.ts.map +1 -0
  99. package/dist/model/sortRemainingBy.d.ts +5 -0
  100. package/dist/model/sortRemainingBy.d.ts.map +1 -0
  101. package/dist/model/tagFilters.d.ts +6 -0
  102. package/dist/model/tagFilters.d.ts.map +1 -0
  103. package/dist/model/trendingModels.d.ts +5 -0
  104. package/dist/model/trendingModels.d.ts.map +1 -0
  105. package/dist/model/trendingRequest.d.ts +4 -0
  106. package/dist/model/trendingRequest.d.ts.map +1 -0
  107. package/dist/model/typoTolerance.d.ts +6 -0
  108. package/dist/model/typoTolerance.d.ts.map +1 -0
  109. package/dist/model/typoToleranceEnum.d.ts +2 -0
  110. package/dist/model/typoToleranceEnum.d.ts.map +1 -0
  111. package/dist/model/value.d.ts +9 -0
  112. package/dist/model/value.d.ts.map +1 -0
  113. package/dist/recommend.cjs.js +212 -142
  114. package/dist/recommend.esm.browser.js +884 -824
  115. package/dist/recommend.esm.node.js +230 -0
  116. package/dist/recommend.umd.js +2 -2
  117. package/dist/src/recommendClient.d.ts +74 -0
  118. package/dist/src/recommendClient.d.ts.map +1 -0
  119. package/index.d.ts +2 -3
  120. package/index.js +2 -15
  121. package/model/advancedSyntaxFeatures.ts +3 -0
  122. package/model/alternativesAsExact.ts +6 -0
  123. package/model/aroundRadius.ts +8 -0
  124. package/model/aroundRadiusAll.ts +3 -0
  125. package/model/baseRecommendRequest.ts +24 -0
  126. package/model/baseRecommendationRequest.ts +12 -0
  127. package/model/baseSearchParams.ts +6 -0
  128. package/model/baseSearchParamsWithoutQuery.ts +157 -0
  129. package/model/baseSearchResponse.ts +128 -0
  130. package/model/baseTrendingRequest.ts +17 -0
  131. package/model/clientMethodProps.ts +65 -0
  132. package/model/distinct.ts +6 -0
  133. package/model/errorBase.ts +8 -0
  134. package/model/exactOnSingleWordQuery.ts +6 -0
  135. package/model/facetFilters.ts +8 -0
  136. package/model/facetOrdering.ts +16 -0
  137. package/model/facets.ts +11 -0
  138. package/model/facetsStats.ts +23 -0
  139. package/model/getRecommendationsParams.ts +13 -0
  140. package/model/getRecommendationsResponse.ts +7 -0
  141. package/model/highlightResult.ts +5 -0
  142. package/model/highlightResultOption.ts +25 -0
  143. package/model/ignorePlurals.ts +6 -0
  144. package/model/index.ts +55 -0
  145. package/model/indexSettingsAsSearchParams.ts +200 -0
  146. package/model/matchLevel.ts +6 -0
  147. package/model/matchedGeoLocation.ts +18 -0
  148. package/model/mixedSearchFilters.ts +3 -0
  149. package/model/numericFilters.ts +8 -0
  150. package/model/optionalFilters.ts +8 -0
  151. package/model/personalization.ts +18 -0
  152. package/model/queryType.ts +6 -0
  153. package/model/rankingInfo.ts +65 -0
  154. package/model/reRankingApplyFilter.ts +8 -0
  155. package/model/recommendHit.ts +34 -0
  156. package/model/recommendHits.ts +7 -0
  157. package/model/recommendationModels.ts +6 -0
  158. package/model/recommendationRequest.ts +7 -0
  159. package/model/recommendationsRequest.ts +6 -0
  160. package/model/recommendationsResponse.ts +6 -0
  161. package/model/removeStopWords.ts +6 -0
  162. package/model/removeWordsIfNoResults.ts +10 -0
  163. package/model/renderingContent.ts +10 -0
  164. package/model/searchParamsObject.ts +6 -0
  165. package/model/searchParamsQuery.ts +8 -0
  166. package/model/snippetResult.ts +5 -0
  167. package/model/snippetResultOption.ts +15 -0
  168. package/model/sortRemainingBy.ts +6 -0
  169. package/model/tagFilters.ts +8 -0
  170. package/model/trendingModels.ts +6 -0
  171. package/model/trendingRequest.ts +6 -0
  172. package/model/typoTolerance.ts +8 -0
  173. package/model/typoToleranceEnum.ts +3 -0
  174. package/model/value.ts +12 -0
  175. package/package.json +22 -24
  176. package/README.md +0 -76
  177. package/dist/recommend.d.ts +0 -162
@@ -0,0 +1,18 @@
1
+ // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
2
+
3
+ export type Personalization = {
4
+ /**
5
+ * The score of the filters.
6
+ */
7
+ filtersScore?: number;
8
+
9
+ /**
10
+ * The score of the ranking.
11
+ */
12
+ rankingScore?: number;
13
+
14
+ /**
15
+ * The score of the event.
16
+ */
17
+ score?: number;
18
+ };
@@ -0,0 +1,6 @@
1
+ // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
2
+
3
+ /**
4
+ * Controls if and how query words are interpreted as prefixes.
5
+ */
6
+ export type QueryType = 'prefixAll' | 'prefixLast' | 'prefixNone';
@@ -0,0 +1,65 @@
1
+ // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
2
+
3
+ import type { MatchedGeoLocation } from './matchedGeoLocation';
4
+ import type { Personalization } from './personalization';
5
+
6
+ export type RankingInfo = {
7
+ /**
8
+ * This field is reserved for advanced usage.
9
+ */
10
+ filters: number;
11
+
12
+ /**
13
+ * Position of the most important matched attribute in the attributes to index list.
14
+ */
15
+ firstMatchedWord: number;
16
+
17
+ /**
18
+ * Distance between the geo location in the search query and the best matching geo location in the record, divided by the geo precision (in meters).
19
+ */
20
+ geoDistance: number;
21
+
22
+ /**
23
+ * Precision used when computing the geo distance, in meters.
24
+ */
25
+ geoPrecision?: number;
26
+
27
+ matchedGeoLocation?: MatchedGeoLocation;
28
+
29
+ personalization?: Personalization;
30
+
31
+ /**
32
+ * Number of exactly matched words.
33
+ */
34
+ nbExactWords: number;
35
+
36
+ /**
37
+ * Number of typos encountered when matching the record.
38
+ */
39
+ nbTypos: number;
40
+
41
+ /**
42
+ * Present and set to true if a Rule promoted the hit.
43
+ */
44
+ promoted: boolean;
45
+
46
+ /**
47
+ * When the query contains more than one word, the sum of the distances between matched words (in meters).
48
+ */
49
+ proximityDistance?: number;
50
+
51
+ /**
52
+ * Custom ranking for the object, expressed as a single integer value.
53
+ */
54
+ userScore: number;
55
+
56
+ /**
57
+ * Number of matched words, including prefixes and typos.
58
+ */
59
+ words: number;
60
+
61
+ /**
62
+ * Wether the record are promoted by the re-ranking strategy.
63
+ */
64
+ promotedByReRanking?: boolean;
65
+ };
@@ -0,0 +1,8 @@
1
+ // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
2
+
3
+ import type { MixedSearchFilters } from './mixedSearchFilters';
4
+
5
+ /**
6
+ * When Dynamic Re-Ranking is enabled, only records that match these filters will be impacted by Dynamic Re-Ranking.
7
+ */
8
+ export type ReRankingApplyFilter = MixedSearchFilters[] | string;
@@ -0,0 +1,34 @@
1
+ // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
2
+
3
+ import type { HighlightResult } from './highlightResult';
4
+ import type { RankingInfo } from './rankingInfo';
5
+ import type { SnippetResult } from './snippetResult';
6
+
7
+ /**
8
+ * A Recommend hit.
9
+ */
10
+ export type RecommendHit = Record<string, any> & {
11
+ /**
12
+ * Unique identifier of the object.
13
+ */
14
+ objectID: string;
15
+
16
+ /**
17
+ * Show highlighted section and words matched on a query.
18
+ */
19
+ _highlightResult?: Record<string, HighlightResult>;
20
+
21
+ /**
22
+ * Snippeted attributes show parts of the matched attributes. Only returned when attributesToSnippet is non-empty.
23
+ */
24
+ _snippetResult?: Record<string, SnippetResult>;
25
+
26
+ _rankingInfo?: RankingInfo;
27
+
28
+ _distinctSeqID?: number;
29
+
30
+ /**
31
+ * The recommendation score.
32
+ */
33
+ _score: number;
34
+ };
@@ -0,0 +1,7 @@
1
+ // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
2
+
3
+ import type { RecommendHit } from './recommendHit';
4
+
5
+ export type RecommendHits = {
6
+ hits: RecommendHit[];
7
+ };
@@ -0,0 +1,6 @@
1
+ // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
2
+
3
+ /**
4
+ * The recommendation model to use.
5
+ */
6
+ export type RecommendationModels = 'bought-together' | 'related-products';
@@ -0,0 +1,7 @@
1
+ // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
2
+
3
+ import type { BaseRecommendRequest } from './baseRecommendRequest';
4
+ import type { BaseRecommendationRequest } from './baseRecommendationRequest';
5
+
6
+ export type RecommendationRequest = BaseRecommendationRequest &
7
+ BaseRecommendRequest;
@@ -0,0 +1,6 @@
1
+ // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
2
+
3
+ import type { RecommendationRequest } from './recommendationRequest';
4
+ import type { TrendingRequest } from './trendingRequest';
5
+
6
+ export type RecommendationsRequest = RecommendationRequest | TrendingRequest;
@@ -0,0 +1,6 @@
1
+ // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
2
+
3
+ import type { BaseSearchResponse } from './baseSearchResponse';
4
+ import type { RecommendHits } from './recommendHits';
5
+
6
+ export type RecommendationsResponse = BaseSearchResponse & RecommendHits;
@@ -0,0 +1,6 @@
1
+ // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
2
+
3
+ /**
4
+ * Removes stop (common) words from the query before executing it. RemoveStopWords is used in conjunction with the queryLanguages setting. List: language ISO codes for which ignoring plurals should be enabled. This list will override any values that you may have set in queryLanguages. True: enables the stop word functionality, ensuring that stop words are removed from consideration in a search. The languages supported here are either every language, or those set by queryLanguages. False: disables stop word functionality, allowing stop words to be taken into account in a search.
5
+ */
6
+ export type RemoveStopWords = string[] | boolean;
@@ -0,0 +1,10 @@
1
+ // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
2
+
3
+ /**
4
+ * Selects a strategy to remove words from the query when it doesn\'t match any hits.
5
+ */
6
+ export type RemoveWordsIfNoResults =
7
+ | 'allOptional'
8
+ | 'firstWords'
9
+ | 'lastWords'
10
+ | 'none';
@@ -0,0 +1,10 @@
1
+ // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
2
+
3
+ import type { FacetOrdering } from './facetOrdering';
4
+
5
+ /**
6
+ * Content defining how the search interface should be rendered. Can be set via the settings for a default value and can be overridden via rules.
7
+ */
8
+ export type RenderingContent = {
9
+ facetOrdering?: FacetOrdering;
10
+ };
@@ -0,0 +1,6 @@
1
+ // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
2
+
3
+ import type { BaseSearchParams } from './baseSearchParams';
4
+ import type { IndexSettingsAsSearchParams } from './indexSettingsAsSearchParams';
5
+
6
+ export type SearchParamsObject = BaseSearchParams & IndexSettingsAsSearchParams;
@@ -0,0 +1,8 @@
1
+ // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
2
+
3
+ export type SearchParamsQuery = {
4
+ /**
5
+ * The text to search in the index.
6
+ */
7
+ query?: string;
8
+ };
@@ -0,0 +1,5 @@
1
+ // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
2
+
3
+ import type { SnippetResultOption } from './snippetResultOption';
4
+
5
+ export type SnippetResult = SnippetResultOption | SnippetResultOption[];
@@ -0,0 +1,15 @@
1
+ // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
2
+
3
+ import type { MatchLevel } from './matchLevel';
4
+
5
+ /**
6
+ * Snippeted attributes show parts of the matched attributes. Only returned when attributesToSnippet is non-empty.
7
+ */
8
+ export type SnippetResultOption = {
9
+ /**
10
+ * Markup text with occurrences highlighted.
11
+ */
12
+ value: string;
13
+
14
+ matchLevel: MatchLevel;
15
+ };
@@ -0,0 +1,6 @@
1
+ // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
2
+
3
+ /**
4
+ * How to display the remaining items. - `count`: facet count (descending). - `alpha`: alphabetical (ascending). - `hidden`: show only pinned values.
5
+ */
6
+ export type SortRemainingBy = 'alpha' | 'count' | 'hidden';
@@ -0,0 +1,8 @@
1
+ // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
2
+
3
+ import type { MixedSearchFilters } from './mixedSearchFilters';
4
+
5
+ /**
6
+ * Filter hits by tags.
7
+ */
8
+ export type TagFilters = MixedSearchFilters[] | string;
@@ -0,0 +1,6 @@
1
+ // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
2
+
3
+ /**
4
+ * The trending model to use.
5
+ */
6
+ export type TrendingModels = 'trending-facets' | 'trending-items';
@@ -0,0 +1,6 @@
1
+ // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
2
+
3
+ import type { BaseRecommendRequest } from './baseRecommendRequest';
4
+ import type { BaseTrendingRequest } from './baseTrendingRequest';
5
+
6
+ export type TrendingRequest = BaseRecommendRequest & BaseTrendingRequest;
@@ -0,0 +1,8 @@
1
+ // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
2
+
3
+ import type { TypoToleranceEnum } from './typoToleranceEnum';
4
+
5
+ /**
6
+ * Controls whether typo tolerance is enabled and how it is applied.
7
+ */
8
+ export type TypoTolerance = TypoToleranceEnum | boolean;
@@ -0,0 +1,3 @@
1
+ // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
2
+
3
+ export type TypoToleranceEnum = 'min' | 'strict';
package/model/value.ts ADDED
@@ -0,0 +1,12 @@
1
+ // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
2
+
3
+ import type { SortRemainingBy } from './sortRemainingBy';
4
+
5
+ export type Value = {
6
+ /**
7
+ * Pinned order of facet lists.
8
+ */
9
+ order?: string[];
10
+
11
+ sortRemainingBy?: SortRemainingBy;
12
+ };
package/package.json CHANGED
@@ -1,37 +1,35 @@
1
1
  {
2
2
  "name": "@algolia/recommend",
3
- "version": "4.14.2",
4
- "private": false,
5
- "description": "The perfect starting point to integrate Algolia Recommend within your JavaScript project.",
6
- "repository": {
7
- "type": "git",
8
- "url": "git://github.com/algolia/algoliasearch-client-javascript.git"
9
- },
3
+ "version": "5.0.0-alpha.3",
4
+ "description": "JavaScript client for recommend",
5
+ "repository": "algolia/algoliasearch-client-javascript",
10
6
  "license": "MIT",
11
- "sideEffects": false,
7
+ "author": "Algolia",
12
8
  "main": "index.js",
13
- "jsdelivr": "./dist/recommend.umd.js",
14
- "unpkg": "./dist/recommend.umd.js",
15
- "browser": {
16
- "./index.js": "./dist/recommend.umd.js"
17
- },
9
+ "jsdelivr": "dist/recommend.umd.js",
10
+ "unpkg": "dist/recommend.umd.js",
11
+ "module": "dist/recommend.esm.node.js",
12
+ "browser": "dist/recommend.umd.js",
18
13
  "types": "index.d.ts",
19
14
  "files": [
20
15
  "dist",
16
+ "model",
21
17
  "index.js",
22
18
  "index.d.ts"
23
19
  ],
20
+ "scripts": {
21
+ "clean": "rm -rf ./dist"
22
+ },
24
23
  "dependencies": {
25
- "@algolia/cache-browser-local-storage": "4.14.2",
26
- "@algolia/cache-common": "4.14.2",
27
- "@algolia/cache-in-memory": "4.14.2",
28
- "@algolia/client-common": "4.14.2",
29
- "@algolia/client-search": "4.14.2",
30
- "@algolia/logger-common": "4.14.2",
31
- "@algolia/logger-console": "4.14.2",
32
- "@algolia/requester-browser-xhr": "4.14.2",
33
- "@algolia/requester-common": "4.14.2",
34
- "@algolia/requester-node-http": "4.14.2",
35
- "@algolia/transporter": "4.14.2"
24
+ "@algolia/client-common": "5.0.0-alpha.3",
25
+ "@algolia/requester-browser-xhr": "5.0.0-alpha.3",
26
+ "@algolia/requester-node-http": "5.0.0-alpha.3"
27
+ },
28
+ "devDependencies": {
29
+ "@types/node": "16.11.45",
30
+ "typescript": "4.7.4"
31
+ },
32
+ "engines": {
33
+ "node": ">= 14.0.0"
36
34
  }
37
35
  }
package/README.md DELETED
@@ -1,76 +0,0 @@
1
- <p align="center">
2
- <h1>Algolia Recommend</h1>
3
-
4
- <h4>The perfect starting point to integrate <a href="https://www.algolia.com/products/recommendations" target="_blank">Algolia Recommend</a> within your JavaScript project</h4>
5
-
6
- <p align="center">
7
- <a href="https://npmjs.org/package/@algolia/recommend"><img src="https://img.shields.io/npm/v/@algolia/recommend.svg?style=flat-square" alt="NPM version"></img></a>
8
- <a href="LICENSE.md"><img src="https://img.shields.io/badge/license-MIT-green.svg?style=flat-square" alt="License"></a>
9
- </p>
10
- </p>
11
-
12
- <p align="center">
13
- <a href="https://www.algolia.com/doc/api-client/methods/recommend/" target="_blank">Documentation</a> •
14
- <a href="https://www.algolia.com/doc/ui-libraries/recommend/introduction/what-is-recommend/" target="_blank">UI library</a> •
15
- <a href="https://discourse.algolia.com" target="_blank">Community Forum</a> •
16
- <a href="http://stackoverflow.com/questions/tagged/algolia" target="_blank">Stack Overflow</a> •
17
- <a href="https://github.com/algolia/algoliasearch-client-javascript/issues" target="_blank">Report a bug</a> •
18
- <a href="https://www.algolia.com/support" target="_blank">Support</a>
19
- </p>
20
-
21
- ## ✨ Features
22
-
23
- - Thin & **minimal low-level HTTP client** to interact with Algolia's Recommend API
24
- - Works both on the **browser** and **node.js**
25
- - **UMD compatible**, you can use it with any module loader
26
- - Built with TypeScript
27
-
28
- ## 💡 Getting Started
29
-
30
- First, install Algolia Recommend API Client via the [npm](https://www.npmjs.com/get-npm) package manager:
31
-
32
- ```bash
33
- npm install @algolia/recommend
34
- ```
35
-
36
- Then, let's retrieve recommendations:
37
-
38
- ```js
39
- const algoliarecommend = require('@algolia/recommend');
40
-
41
- const client = algoliarecommend('YourApplicationID', 'YourAdminAPIKey');
42
-
43
- client
44
- .getFrequentlyBoughtTogether([
45
- {
46
- indexName: 'your_index_name',
47
- objectID: 'your_object_id',
48
- },
49
- ])
50
- .then(({ results }) => {
51
- console.log(results);
52
- })
53
- .catch(err => {
54
- console.log(err);
55
- });
56
-
57
- client
58
- .getRelatedProducts([
59
- {
60
- indexName: 'your_index_name',
61
- objectID: 'your_object_id',
62
- },
63
- ])
64
- .then(({ results }) => {
65
- console.log(results);
66
- })
67
- .catch(err => {
68
- console.log(err);
69
- });
70
- ```
71
-
72
- For full documentation, visit the **[online documentation](https://www.algolia.com/doc/api-client/methods/recommend/)**.
73
-
74
- ## 📄 License
75
-
76
- Algolia Recommend API Client is an open-sourced software licensed under the [MIT license](LICENSE.md).
@@ -1,162 +0,0 @@
1
- import { AuthModeType } from '@algolia/client-common';
2
- import { ClientTransporterOptions } from '@algolia/client-common';
3
- import { Destroyable } from '@algolia/requester-common';
4
- import { MultipleQueriesResponse } from '@algolia/client-search';
5
- import { RequestOptions } from '@algolia/transporter';
6
- import { SearchOptions } from '@algolia/client-search';
7
- import { Transporter } from '@algolia/transporter';
8
-
9
- export declare type BaseRecommendClient = {
10
- /**
11
- * The application id.
12
- */
13
- readonly appId: string;
14
- /**
15
- * The underlying transporter.
16
- */
17
- readonly transporter: Transporter;
18
- /**
19
- * Mutates the transporter, adding the given user agent.
20
- */
21
- readonly addAlgoliaAgent: (segment: string, version?: string) => void;
22
- /**
23
- * Clears both requests and responses caches.
24
- */
25
- readonly clearCache: () => Readonly<Promise<void>>;
26
- };
27
-
28
- export declare type FrequentlyBoughtTogetherQuery = Omit<RecommendationsQuery, 'model' | 'fallbackParameters'>;
29
-
30
- declare function recommend(appId: string, apiKey: string, options?: RecommendOptions): RecommendClient;
31
-
32
- declare namespace recommend {
33
- var version: string;
34
- }
35
- export default recommend;
36
-
37
- export declare type RecommendationsQuery = {
38
- /**
39
- * The name of the target index.
40
- */
41
- readonly indexName: string;
42
- /**
43
- * The name of the Recommendation model to use.
44
- */
45
- readonly model: RecommendModel;
46
- /**
47
- * The `objectID` of the item to get recommendations for.
48
- */
49
- readonly objectID: string;
50
- /**
51
- * Threshold for the recommendations confidence score (between 0 and 100). Only recommendations with a greater score are returned.
52
- */
53
- readonly threshold?: number;
54
- /**
55
- * How many recommendations to retrieve.
56
- */
57
- readonly maxRecommendations?: number;
58
- /**
59
- * List of [search parameters](https://www.algolia.com/doc/api-reference/search-api-parameters/) to send.
60
- */
61
- readonly queryParameters?: RecommendSearchOptions;
62
- /**
63
- * List of [search parameters](https://www.algolia.com/doc/api-reference/search-api-parameters/) to send.
64
- *
65
- * Additional filters to use as fallback when there aren’t enough recommendations.
66
- */
67
- readonly fallbackParameters?: RecommendSearchOptions;
68
- };
69
-
70
- export declare type RecommendClient = WithRecommendMethods<BaseRecommendClient> & Destroyable;
71
-
72
- export declare type RecommendClientOptions = {
73
- /**
74
- * The application id.
75
- */
76
- readonly appId: string;
77
- /**
78
- * The api key.
79
- */
80
- readonly apiKey: string;
81
- /**
82
- * The auth mode type. In browser environments credentials may
83
- * be passed within the headers.
84
- */
85
- readonly authMode?: AuthModeType;
86
- };
87
-
88
- export declare type RecommendModel = 'related-products' | 'bought-together' | TrendingModel;
89
-
90
- export declare type RecommendOptions = Partial<ClientTransporterOptions>;
91
-
92
- export declare type RecommendSearchOptions = Omit<SearchOptions, 'page' | 'hitsPerPage' | 'offset' | 'length'>;
93
-
94
- export declare type RelatedProductsQuery = Omit<RecommendationsQuery, 'model'>;
95
-
96
- export declare type TrendingFacetsQuery = Omit<TrendingQuery, 'model' | 'facetValue'>;
97
-
98
- export declare type TrendingItemsQuery = Omit<TrendingQuery, 'model'>;
99
-
100
- export declare type TrendingModel = 'trending-items' | 'trending-facets';
101
-
102
- export declare type TrendingQuery = {
103
- /**
104
- * The name of the target index.
105
- */
106
- readonly indexName: string;
107
- /**
108
- * The name of the Recommendation model to use.
109
- */
110
- readonly model: TrendingModel;
111
- /**
112
- * Threshold for the recommendations confidence score (between 0 and 100). Only recommendations with a greater score are returned.
113
- */
114
- readonly threshold?: number;
115
- /**
116
- * How many recommendations to retrieve.
117
- */
118
- readonly maxRecommendations?: number;
119
- /**
120
- * List of [search parameters](https://www.algolia.com/doc/api-reference/search-api-parameters/) to send.
121
- */
122
- readonly queryParameters?: RecommendSearchOptions;
123
- /**
124
- * List of [search parameters](https://www.algolia.com/doc/api-reference/search-api-parameters/) to send.
125
- *
126
- * Additional filters to use as fallback when there aren’t enough recommendations.
127
- */
128
- readonly fallbackParameters?: RecommendSearchOptions;
129
- /**
130
- * Used for trending model
131
- */
132
- readonly facetName?: string;
133
- /**
134
- * Used for trending model
135
- */
136
- readonly facetValue?: string;
137
- };
138
-
139
- export declare type WithRecommendMethods<TType> = TType & {
140
- /**
141
- * Returns recommendations.
142
- */
143
- readonly getRecommendations: <TObject>(queries: readonly RecommendationsQuery[], requestOptions?: RequestOptions & SearchOptions) => Readonly<Promise<MultipleQueriesResponse<TObject>>>;
144
- /**
145
- * Returns [Related Products](https://algolia.com/doc/guides/algolia-ai/recommend/#related-products).
146
- */
147
- readonly getRelatedProducts: <TObject>(queries: readonly RelatedProductsQuery[], requestOptions?: RequestOptions & SearchOptions) => Readonly<Promise<MultipleQueriesResponse<TObject>>>;
148
- /**
149
- * Returns [Frequently Bought Together](https://algolia.com/doc/guides/algolia-ai/recommend/#frequently-bought-together) products.
150
- */
151
- readonly getFrequentlyBoughtTogether: <TObject>(queries: readonly FrequentlyBoughtTogetherQuery[], requestOptions?: RequestOptions & SearchOptions) => Readonly<Promise<MultipleQueriesResponse<TObject>>>;
152
- /**
153
- * Returns trending items
154
- */
155
- readonly getTrendingItems: <TObject>(queries: readonly TrendingItemsQuery[], requestOptions?: RequestOptions & SearchOptions) => Readonly<Promise<MultipleQueriesResponse<TObject>>>;
156
- /**
157
- * Returns trending items per facet
158
- */
159
- readonly getTrendingFacets: <TObject>(queries: readonly TrendingFacetsQuery[], requestOptions?: RequestOptions & SearchOptions) => Readonly<Promise<MultipleQueriesResponse<TObject>>>;
160
- };
161
-
162
- export { }