@algolia/recommend 5.0.0-alpha.9 → 5.0.0-alpha.91

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 (290) hide show
  1. package/dist/builds/browser.d.ts +5 -5
  2. package/dist/builds/node.d.ts +5 -5
  3. package/dist/model/advancedSyntaxFeatures.d.ts +1 -1
  4. package/dist/model/advancedSyntaxFeatures.d.ts.map +1 -1
  5. package/dist/model/alternativesAsExact.d.ts +1 -1
  6. package/dist/model/alternativesAsExact.d.ts.map +1 -1
  7. package/dist/model/anchoring.d.ts +5 -0
  8. package/dist/model/anchoring.d.ts.map +1 -0
  9. package/dist/model/aroundPrecision.d.ts +6 -0
  10. package/dist/model/aroundPrecision.d.ts.map +1 -0
  11. package/dist/model/aroundPrecisionFromValueInner.d.ts +5 -0
  12. package/dist/model/aroundPrecisionFromValueInner.d.ts.map +1 -0
  13. package/dist/model/aroundRadius.d.ts +5 -5
  14. package/dist/model/aroundRadius.d.ts.map +1 -1
  15. package/dist/model/aroundRadiusAll.d.ts +1 -1
  16. package/dist/model/aroundRadiusAll.d.ts.map +1 -1
  17. package/dist/model/automaticFacetFilter.d.ts +18 -0
  18. package/dist/model/automaticFacetFilter.d.ts.map +1 -0
  19. package/dist/model/automaticFacetFilters.d.ts +6 -0
  20. package/dist/model/automaticFacetFilters.d.ts.map +1 -0
  21. package/dist/model/baseRecommendRequest.d.ts +14 -17
  22. package/dist/model/baseRecommendRequest.d.ts.map +1 -1
  23. package/dist/model/baseRecommendationsQuery.d.ts +12 -0
  24. package/dist/model/baseRecommendationsQuery.d.ts.map +1 -0
  25. package/dist/model/baseSearchParams.d.ts +3 -3
  26. package/dist/model/baseSearchParams.d.ts.map +1 -1
  27. package/dist/model/baseSearchParamsWithoutQuery.d.ts +118 -122
  28. package/dist/model/baseSearchParamsWithoutQuery.d.ts.map +1 -1
  29. package/dist/model/baseSearchResponse.d.ts +105 -101
  30. package/dist/model/baseSearchResponse.d.ts.map +1 -1
  31. package/dist/model/baseTrendingFacetsQuery.d.ts +9 -0
  32. package/dist/model/baseTrendingFacetsQuery.d.ts.map +1 -0
  33. package/dist/model/baseTrendingItemsQuery.d.ts +16 -0
  34. package/dist/model/baseTrendingItemsQuery.d.ts.map +1 -0
  35. package/dist/model/clientMethodProps.d.ts +127 -60
  36. package/dist/model/clientMethodProps.d.ts.map +1 -1
  37. package/dist/model/condition.d.ts +17 -0
  38. package/dist/model/condition.d.ts.map +1 -0
  39. package/dist/model/consequence.d.ts +26 -0
  40. package/dist/model/consequence.d.ts.map +1 -0
  41. package/dist/model/consequenceHide.d.ts +10 -0
  42. package/dist/model/consequenceHide.d.ts.map +1 -0
  43. package/dist/model/consequenceParams.d.ts +5 -0
  44. package/dist/model/consequenceParams.d.ts.map +1 -0
  45. package/dist/model/consequenceQuery.d.ts +6 -0
  46. package/dist/model/consequenceQuery.d.ts.map +1 -0
  47. package/dist/model/consequenceQueryObject.d.ts +12 -0
  48. package/dist/model/consequenceQueryObject.d.ts.map +1 -0
  49. package/dist/model/deletedAtResponse.d.ts +14 -0
  50. package/dist/model/deletedAtResponse.d.ts.map +1 -0
  51. package/dist/model/distinct.d.ts +4 -4
  52. package/dist/model/distinct.d.ts.map +1 -1
  53. package/dist/model/edit.d.ts +13 -0
  54. package/dist/model/edit.d.ts.map +1 -0
  55. package/dist/model/editType.d.ts +5 -0
  56. package/dist/model/editType.d.ts.map +1 -0
  57. package/dist/model/errorBase.d.ts +6 -6
  58. package/dist/model/errorBase.d.ts.map +1 -1
  59. package/dist/model/exactOnSingleWordQuery.d.ts +4 -4
  60. package/dist/model/exactOnSingleWordQuery.d.ts.map +1 -1
  61. package/dist/model/exhaustive.d.ts +26 -0
  62. package/dist/model/exhaustive.d.ts.map +1 -0
  63. package/dist/model/facetFilters.d.ts +5 -5
  64. package/dist/model/facetFilters.d.ts.map +1 -1
  65. package/dist/model/facetOrdering.d.ts +12 -12
  66. package/dist/model/facetOrdering.d.ts.map +1 -1
  67. package/dist/model/facets.d.ts +9 -9
  68. package/dist/model/facets.d.ts.map +1 -1
  69. package/dist/model/facetsStats.d.ts +18 -18
  70. package/dist/model/facetsStats.d.ts.map +1 -1
  71. package/dist/model/getRecommendTaskResponse.d.ts +5 -0
  72. package/dist/model/getRecommendTaskResponse.d.ts.map +1 -0
  73. package/dist/model/getRecommendationsParams.d.ts +10 -10
  74. package/dist/model/getRecommendationsParams.d.ts.map +1 -1
  75. package/dist/model/getRecommendationsResponse.d.ts +4 -4
  76. package/dist/model/getRecommendationsResponse.d.ts.map +1 -1
  77. package/dist/model/highlightResult.d.ts +2 -2
  78. package/dist/model/highlightResult.d.ts.map +1 -1
  79. package/dist/model/highlightResultOption.d.ts +19 -19
  80. package/dist/model/highlightResultOption.d.ts.map +1 -1
  81. package/dist/model/ignorePlurals.d.ts +4 -4
  82. package/dist/model/ignorePlurals.d.ts.map +1 -1
  83. package/dist/model/index.d.ts +87 -53
  84. package/dist/model/index.d.ts.map +1 -1
  85. package/dist/model/indexSettingsAsSearchParams.d.ts +162 -160
  86. package/dist/model/indexSettingsAsSearchParams.d.ts.map +1 -1
  87. package/dist/model/matchLevel.d.ts +4 -4
  88. package/dist/model/matchLevel.d.ts.map +1 -1
  89. package/dist/model/matchedGeoLocation.d.ts +14 -14
  90. package/dist/model/matchedGeoLocation.d.ts.map +1 -1
  91. package/dist/model/mixedSearchFilters.d.ts +1 -1
  92. package/dist/model/mixedSearchFilters.d.ts.map +1 -1
  93. package/dist/model/mode.d.ts +5 -0
  94. package/dist/model/mode.d.ts.map +1 -0
  95. package/dist/model/numericFilters.d.ts +5 -5
  96. package/dist/model/numericFilters.d.ts.map +1 -1
  97. package/dist/model/optionalFilters.d.ts +5 -5
  98. package/dist/model/optionalFilters.d.ts.map +1 -1
  99. package/dist/model/params.d.ts +13 -0
  100. package/dist/model/params.d.ts.map +1 -0
  101. package/dist/model/personalization.d.ts +14 -14
  102. package/dist/model/personalization.d.ts.map +1 -1
  103. package/dist/model/promote.d.ts +4 -0
  104. package/dist/model/promote.d.ts.map +1 -0
  105. package/dist/model/promoteObjectID.d.ts +14 -0
  106. package/dist/model/promoteObjectID.d.ts.map +1 -0
  107. package/dist/model/promoteObjectIDs.d.ts +14 -0
  108. package/dist/model/promoteObjectIDs.d.ts.map +1 -0
  109. package/dist/model/queryType.d.ts +4 -4
  110. package/dist/model/queryType.d.ts.map +1 -1
  111. package/dist/model/rankingInfo.d.ts +50 -50
  112. package/dist/model/rankingInfo.d.ts.map +1 -1
  113. package/dist/model/reRankingApplyFilter.d.ts +5 -5
  114. package/dist/model/reRankingApplyFilter.d.ts.map +1 -1
  115. package/dist/model/recommendHit.d.ts +26 -26
  116. package/dist/model/recommendHit.d.ts.map +1 -1
  117. package/dist/model/recommendHits.d.ts +12 -4
  118. package/dist/model/recommendHits.d.ts.map +1 -1
  119. package/dist/model/recommendModels.d.ts +2 -0
  120. package/dist/model/recommendModels.d.ts.map +1 -0
  121. package/dist/model/recommendationModels.d.ts +4 -4
  122. package/dist/model/recommendationModels.d.ts.map +1 -1
  123. package/dist/model/recommendationsQuery.d.ts +4 -0
  124. package/dist/model/recommendationsQuery.d.ts.map +1 -0
  125. package/dist/model/recommendationsRequest.d.ts +4 -3
  126. package/dist/model/recommendationsRequest.d.ts.map +1 -1
  127. package/dist/model/recommendationsResponse.d.ts +3 -3
  128. package/dist/model/recommendationsResponse.d.ts.map +1 -1
  129. package/dist/model/redirect.d.ts +8 -0
  130. package/dist/model/redirect.d.ts.map +1 -0
  131. package/dist/model/redirectRuleIndexMetadata.d.ts +21 -0
  132. package/dist/model/redirectRuleIndexMetadata.d.ts.map +1 -0
  133. package/dist/model/redirectRuleIndexMetadataData.d.ts +7 -0
  134. package/dist/model/redirectRuleIndexMetadataData.d.ts.map +1 -0
  135. package/dist/model/removeStopWords.d.ts +4 -4
  136. package/dist/model/removeStopWords.d.ts.map +1 -1
  137. package/dist/model/removeWordsIfNoResults.d.ts +4 -4
  138. package/dist/model/removeWordsIfNoResults.d.ts.map +1 -1
  139. package/dist/model/renderingContent.d.ts +7 -7
  140. package/dist/model/renderingContent.d.ts.map +1 -1
  141. package/dist/model/ruleResponse.d.ts +27 -0
  142. package/dist/model/ruleResponse.d.ts.map +1 -0
  143. package/dist/model/ruleResponseMetadata.d.ts +7 -0
  144. package/dist/model/ruleResponseMetadata.d.ts.map +1 -0
  145. package/dist/model/searchParamsObject.d.ts +3 -3
  146. package/dist/model/searchParamsObject.d.ts.map +1 -1
  147. package/dist/model/searchParamsQuery.d.ts +6 -6
  148. package/dist/model/searchParamsQuery.d.ts.map +1 -1
  149. package/dist/model/searchRecommendRulesParams.d.ts +30 -0
  150. package/dist/model/searchRecommendRulesParams.d.ts.map +1 -0
  151. package/dist/model/searchRecommendRulesResponse.d.ts +20 -0
  152. package/dist/model/searchRecommendRulesResponse.d.ts.map +1 -0
  153. package/dist/model/semanticSearch.d.ts +10 -0
  154. package/dist/model/semanticSearch.d.ts.map +1 -0
  155. package/dist/model/snippetResult.d.ts +2 -2
  156. package/dist/model/snippetResult.d.ts.map +1 -1
  157. package/dist/model/snippetResultOption.d.ts +11 -11
  158. package/dist/model/snippetResultOption.d.ts.map +1 -1
  159. package/dist/model/sortRemainingBy.d.ts +4 -4
  160. package/dist/model/sortRemainingBy.d.ts.map +1 -1
  161. package/dist/model/tagFilters.d.ts +5 -5
  162. package/dist/model/tagFilters.d.ts.map +1 -1
  163. package/dist/model/taskStatus.d.ts +5 -0
  164. package/dist/model/taskStatus.d.ts.map +1 -0
  165. package/dist/model/trendingFacetsModel.d.ts +5 -0
  166. package/dist/model/trendingFacetsModel.d.ts.map +1 -0
  167. package/dist/model/trendingFacetsQuery.d.ts +4 -0
  168. package/dist/model/trendingFacetsQuery.d.ts.map +1 -0
  169. package/dist/model/trendingItemsModel.d.ts +5 -0
  170. package/dist/model/trendingItemsModel.d.ts.map +1 -0
  171. package/dist/model/trendingItemsQuery.d.ts +4 -0
  172. package/dist/model/trendingItemsQuery.d.ts.map +1 -0
  173. package/dist/model/typoTolerance.d.ts +5 -5
  174. package/dist/model/typoTolerance.d.ts.map +1 -1
  175. package/dist/model/typoToleranceEnum.d.ts +1 -1
  176. package/dist/model/typoToleranceEnum.d.ts.map +1 -1
  177. package/dist/model/value.d.ts +8 -8
  178. package/dist/model/value.d.ts.map +1 -1
  179. package/dist/recommend.cjs +381 -0
  180. package/dist/recommend.esm.browser.js +552 -469
  181. package/dist/recommend.esm.node.js +370 -235
  182. package/dist/recommend.umd.js +2 -2
  183. package/dist/src/recommendClient.d.ts +129 -81
  184. package/dist/src/recommendClient.d.ts.map +1 -1
  185. package/index.js +1 -1
  186. package/model/advancedSyntaxFeatures.ts +1 -1
  187. package/model/alternativesAsExact.ts +1 -1
  188. package/model/anchoring.ts +6 -0
  189. package/model/aroundPrecision.ts +8 -0
  190. package/model/aroundPrecisionFromValueInner.ts +7 -0
  191. package/model/aroundRadius.ts +2 -2
  192. package/model/aroundRadiusAll.ts +1 -1
  193. package/model/automaticFacetFilter.ts +21 -0
  194. package/model/automaticFacetFilters.ts +8 -0
  195. package/model/baseRecommendRequest.ts +5 -11
  196. package/model/baseRecommendationsQuery.ts +17 -0
  197. package/model/baseSearchParams.ts +1 -1
  198. package/model/baseSearchParamsWithoutQuery.ts +40 -45
  199. package/model/baseSearchResponse.ts +37 -31
  200. package/model/baseTrendingFacetsQuery.ts +12 -0
  201. package/model/baseTrendingItemsQuery.ts +22 -0
  202. package/model/clientMethodProps.ts +83 -11
  203. package/model/condition.ts +22 -0
  204. package/model/consequence.ts +32 -0
  205. package/model/consequenceHide.ts +11 -0
  206. package/model/consequenceParams.ts +9 -0
  207. package/model/consequenceQuery.ts +8 -0
  208. package/model/consequenceQueryObject.ts +15 -0
  209. package/model/deletedAtResponse.ts +16 -0
  210. package/model/distinct.ts +2 -2
  211. package/model/edit.ts +17 -0
  212. package/model/editType.ts +6 -0
  213. package/model/errorBase.ts +1 -1
  214. package/model/exactOnSingleWordQuery.ts +2 -2
  215. package/model/exhaustive.ts +31 -0
  216. package/model/facetFilters.ts +2 -2
  217. package/model/facetOrdering.ts +3 -3
  218. package/model/facets.ts +2 -2
  219. package/model/facetsStats.ts +5 -5
  220. package/model/getRecommendTaskResponse.ts +7 -0
  221. package/model/getRecommendationsParams.ts +3 -3
  222. package/model/getRecommendationsResponse.ts +1 -1
  223. package/model/highlightResult.ts +1 -1
  224. package/model/highlightResultOption.ts +2 -2
  225. package/model/ignorePlurals.ts +2 -2
  226. package/model/index.ts +40 -6
  227. package/model/indexSettingsAsSearchParams.ts +51 -47
  228. package/model/matchLevel.ts +1 -1
  229. package/model/matchedGeoLocation.ts +1 -1
  230. package/model/mixedSearchFilters.ts +1 -1
  231. package/model/mode.ts +6 -0
  232. package/model/numericFilters.ts +2 -2
  233. package/model/optionalFilters.ts +2 -2
  234. package/model/params.ts +18 -0
  235. package/model/personalization.ts +1 -1
  236. package/model/promote.ts +6 -0
  237. package/model/promoteObjectID.ts +16 -0
  238. package/model/promoteObjectIDs.ts +16 -0
  239. package/model/queryType.ts +2 -2
  240. package/model/rankingInfo.ts +1 -1
  241. package/model/reRankingApplyFilter.ts +2 -2
  242. package/model/recommendHit.ts +4 -4
  243. package/model/recommendHits.ts +11 -1
  244. package/model/recommendModels.ts +7 -0
  245. package/model/recommendationModels.ts +2 -2
  246. package/model/recommendationsQuery.ts +7 -0
  247. package/model/recommendationsRequest.ts +8 -4
  248. package/model/recommendationsResponse.ts +1 -1
  249. package/model/redirect.ts +10 -0
  250. package/model/redirectRuleIndexMetadata.ts +27 -0
  251. package/model/redirectRuleIndexMetadataData.ts +8 -0
  252. package/model/removeStopWords.ts +2 -2
  253. package/model/removeWordsIfNoResults.ts +2 -2
  254. package/model/renderingContent.ts +2 -2
  255. package/model/ruleResponse.ts +34 -0
  256. package/model/ruleResponseMetadata.ts +8 -0
  257. package/model/searchParamsObject.ts +1 -1
  258. package/model/searchParamsQuery.ts +2 -2
  259. package/model/searchRecommendRulesParams.ts +36 -0
  260. package/model/searchRecommendRulesResponse.ts +25 -0
  261. package/model/semanticSearch.ts +11 -0
  262. package/model/snippetResult.ts +1 -1
  263. package/model/snippetResultOption.ts +2 -2
  264. package/model/sortRemainingBy.ts +2 -2
  265. package/model/tagFilters.ts +2 -2
  266. package/model/taskStatus.ts +6 -0
  267. package/model/trendingFacetsModel.ts +6 -0
  268. package/model/trendingFacetsQuery.ts +7 -0
  269. package/model/trendingItemsModel.ts +6 -0
  270. package/model/trendingItemsQuery.ts +6 -0
  271. package/model/typoTolerance.ts +2 -2
  272. package/model/typoToleranceEnum.ts +1 -1
  273. package/model/value.ts +1 -1
  274. package/package.json +30 -13
  275. package/dist/model/baseRecommendationRequest.d.ts +0 -9
  276. package/dist/model/baseRecommendationRequest.d.ts.map +0 -1
  277. package/dist/model/baseTrendingRequest.d.ts +0 -13
  278. package/dist/model/baseTrendingRequest.d.ts.map +0 -1
  279. package/dist/model/recommendationRequest.d.ts +0 -4
  280. package/dist/model/recommendationRequest.d.ts.map +0 -1
  281. package/dist/model/trendingModels.d.ts +0 -5
  282. package/dist/model/trendingModels.d.ts.map +0 -1
  283. package/dist/model/trendingRequest.d.ts +0 -4
  284. package/dist/model/trendingRequest.d.ts.map +0 -1
  285. package/dist/recommend.cjs.js +0 -248
  286. package/model/baseRecommendationRequest.ts +0 -12
  287. package/model/baseTrendingRequest.ts +0 -17
  288. package/model/recommendationRequest.ts +0 -7
  289. package/model/trendingModels.ts +0 -6
  290. package/model/trendingRequest.ts +0 -6
@@ -7,31 +7,25 @@ function createAuth(appId, apiKey, authMode = 'WithinHeaders') {
7
7
  headers() {
8
8
  return authMode === 'WithinHeaders' ? credentials : {};
9
9
  },
10
-
11
10
  queryParameters() {
12
11
  return authMode === 'WithinQueryParameters' ? credentials : {};
13
12
  }
14
-
15
13
  };
16
14
  }
17
15
 
18
16
  function createBrowserLocalStorageCache(options) {
19
- let storage; // We've changed the namespace to avoid conflicts with v4, as this version is a huge breaking change
20
-
17
+ let storage;
18
+ // We've changed the namespace to avoid conflicts with v4, as this version is a huge breaking change
21
19
  const namespaceKey = `algolia-client-js-${options.key}`;
22
-
23
20
  function getStorage() {
24
21
  if (storage === undefined) {
25
22
  storage = options.localStorage || window.localStorage;
26
23
  }
27
-
28
24
  return storage;
29
25
  }
30
-
31
26
  function getNamespace() {
32
27
  return JSON.parse(getStorage().getItem(namespaceKey) || '{}');
33
28
  }
34
-
35
29
  return {
36
30
  get(key, defaultValue, events = {
37
31
  miss: () => Promise.resolve()
@@ -44,7 +38,6 @@ function createBrowserLocalStorageCache(options) {
44
38
  return Promise.all([value, exists || events.miss(value)]);
45
39
  }).then(([value]) => value);
46
40
  },
47
-
48
41
  set(key, value) {
49
42
  return Promise.resolve().then(() => {
50
43
  const namespace = getNamespace();
@@ -53,7 +46,6 @@ function createBrowserLocalStorageCache(options) {
53
46
  return value;
54
47
  });
55
48
  },
56
-
57
49
  delete(key) {
58
50
  return Promise.resolve().then(() => {
59
51
  const namespace = getNamespace();
@@ -61,13 +53,11 @@ function createBrowserLocalStorageCache(options) {
61
53
  getStorage().setItem(namespaceKey, JSON.stringify(namespace));
62
54
  });
63
55
  },
64
-
65
56
  clear() {
66
57
  return Promise.resolve().then(() => {
67
58
  getStorage().removeItem(namespaceKey);
68
59
  });
69
60
  }
70
-
71
61
  };
72
62
  }
73
63
 
@@ -79,30 +69,24 @@ function createNullCache() {
79
69
  const value = defaultValue();
80
70
  return value.then(result => Promise.all([result, events.miss(result)])).then(([result]) => result);
81
71
  },
82
-
83
72
  set(_key, value) {
84
73
  return Promise.resolve(value);
85
74
  },
86
-
87
75
  delete(_key) {
88
76
  return Promise.resolve();
89
77
  },
90
-
91
78
  clear() {
92
79
  return Promise.resolve();
93
80
  }
94
-
95
81
  };
96
82
  }
97
83
 
98
84
  function createFallbackableCache(options) {
99
85
  const caches = [...options.caches];
100
86
  const current = caches.shift();
101
-
102
87
  if (current === undefined) {
103
88
  return createNullCache();
104
89
  }
105
-
106
90
  return {
107
91
  get(key, defaultValue, events = {
108
92
  miss: () => Promise.resolve()
@@ -113,7 +97,6 @@ function createFallbackableCache(options) {
113
97
  }).get(key, defaultValue, events);
114
98
  });
115
99
  },
116
-
117
100
  set(key, value) {
118
101
  return current.set(key, value).catch(() => {
119
102
  return createFallbackableCache({
@@ -121,7 +104,6 @@ function createFallbackableCache(options) {
121
104
  }).set(key, value);
122
105
  });
123
106
  },
124
-
125
107
  delete(key) {
126
108
  return current.delete(key).catch(() => {
127
109
  return createFallbackableCache({
@@ -129,7 +111,6 @@ function createFallbackableCache(options) {
129
111
  }).delete(key);
130
112
  });
131
113
  },
132
-
133
114
  clear() {
134
115
  return current.clear().catch(() => {
135
116
  return createFallbackableCache({
@@ -137,7 +118,6 @@ function createFallbackableCache(options) {
137
118
  }).clear();
138
119
  });
139
120
  }
140
-
141
121
  };
142
122
  }
143
123
 
@@ -150,30 +130,24 @@ function createMemoryCache(options = {
150
130
  miss: () => Promise.resolve()
151
131
  }) {
152
132
  const keyAsString = JSON.stringify(key);
153
-
154
133
  if (keyAsString in cache) {
155
134
  return Promise.resolve(options.serializable ? JSON.parse(cache[keyAsString]) : cache[keyAsString]);
156
135
  }
157
-
158
136
  const promise = defaultValue();
159
137
  return promise.then(value => events.miss(value)).then(() => promise);
160
138
  },
161
-
162
139
  set(key, value) {
163
140
  cache[JSON.stringify(key)] = options.serializable ? JSON.stringify(value) : value;
164
141
  return Promise.resolve(value);
165
142
  },
166
-
167
143
  delete(key) {
168
144
  delete cache[JSON.stringify(key)];
169
145
  return Promise.resolve();
170
146
  },
171
-
172
147
  clear() {
173
148
  cache = {};
174
149
  return Promise.resolve();
175
150
  }
176
-
177
151
  };
178
152
  }
179
153
 
@@ -182,16 +156,14 @@ function createMemoryCache(options = {
182
156
  const EXPIRATION_DELAY = 2 * 60 * 1000;
183
157
  function createStatefulHost(host, status = 'up') {
184
158
  const lastUpdate = Date.now();
185
-
186
159
  function isUp() {
187
160
  return status === 'up' || Date.now() - lastUpdate > EXPIRATION_DELAY;
188
161
  }
189
-
190
162
  function isTimedOut() {
191
163
  return status === 'timed out' && Date.now() - lastUpdate <= EXPIRATION_DELAY;
192
164
  }
193
-
194
- return { ...host,
165
+ return {
166
+ ...host,
195
167
  status,
196
168
  lastUpdate,
197
169
  isUp,
@@ -200,6 +172,7 @@ function createStatefulHost(host, status = 'up') {
200
172
  }
201
173
 
202
174
  function _defineProperty(obj, key, value) {
175
+ key = _toPropertyKey(key);
203
176
  if (key in obj) {
204
177
  Object.defineProperty(obj, key, {
205
178
  value: value,
@@ -210,92 +183,96 @@ function _defineProperty(obj, key, value) {
210
183
  } else {
211
184
  obj[key] = value;
212
185
  }
213
-
214
186
  return obj;
215
187
  }
188
+ function _toPrimitive(input, hint) {
189
+ if (typeof input !== "object" || input === null) return input;
190
+ var prim = input[Symbol.toPrimitive];
191
+ if (prim !== undefined) {
192
+ var res = prim.call(input, hint || "default");
193
+ if (typeof res !== "object") return res;
194
+ throw new TypeError("@@toPrimitive must return a primitive value.");
195
+ }
196
+ return (hint === "string" ? String : Number)(input);
197
+ }
198
+ function _toPropertyKey(arg) {
199
+ var key = _toPrimitive(arg, "string");
200
+ return typeof key === "symbol" ? key : String(key);
201
+ }
216
202
 
217
203
  class AlgoliaError extends Error {
218
204
  constructor(message, name) {
219
205
  super(message);
220
-
221
206
  _defineProperty(this, "name", 'AlgoliaError');
222
-
223
207
  if (name) {
224
208
  this.name = name;
225
209
  }
226
210
  }
227
-
228
211
  }
229
212
  class ErrorWithStackTrace extends AlgoliaError {
230
213
  constructor(message, stackTrace, name) {
231
- super(message, name); // the array and object should be frozen to reflect the stackTrace at the time of the error
232
-
214
+ super(message, name);
215
+ // the array and object should be frozen to reflect the stackTrace at the time of the error
233
216
  _defineProperty(this, "stackTrace", void 0);
234
-
235
217
  this.stackTrace = stackTrace;
236
218
  }
237
-
238
219
  }
239
220
  class RetryError extends ErrorWithStackTrace {
240
221
  constructor(stackTrace) {
241
222
  super('Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.', stackTrace, 'RetryError');
242
223
  }
243
-
244
224
  }
245
225
  class ApiError extends ErrorWithStackTrace {
246
- constructor(message, status, stackTrace) {
247
- super(message, stackTrace, 'ApiError');
248
-
226
+ constructor(message, status, stackTrace, name = 'ApiError') {
227
+ super(message, stackTrace, name);
249
228
  _defineProperty(this, "status", void 0);
250
-
251
229
  this.status = status;
252
230
  }
253
-
254
231
  }
255
232
  class DeserializationError extends AlgoliaError {
256
233
  constructor(message, response) {
257
234
  super(message, 'DeserializationError');
258
-
259
235
  _defineProperty(this, "response", void 0);
260
-
261
236
  this.response = response;
262
237
  }
263
-
238
+ }
239
+ // DetailedApiError is only used by the ingestion client to return more informative error, other clients will use ApiClient.
240
+ class DetailedApiError extends ApiError {
241
+ constructor(message, status, error, stackTrace) {
242
+ super(message, status, stackTrace, 'DetailedApiError');
243
+ _defineProperty(this, "error", void 0);
244
+ this.error = error;
245
+ }
264
246
  }
265
247
 
266
248
  function shuffle(array) {
267
249
  const shuffledArray = array;
268
-
269
250
  for (let c = array.length - 1; c > 0; c--) {
270
251
  const b = Math.floor(Math.random() * (c + 1));
271
252
  const a = array[c];
272
253
  shuffledArray[c] = array[b];
273
254
  shuffledArray[b] = a;
274
255
  }
275
-
276
256
  return shuffledArray;
277
257
  }
278
258
  function serializeUrl(host, path, queryParameters) {
279
259
  const queryParametersAsString = serializeQueryParameters(queryParameters);
280
260
  let url = `${host.protocol}://${host.url}/${path.charAt(0) === '/' ? path.substr(1) : path}`;
281
-
282
261
  if (queryParametersAsString.length) {
283
262
  url += `?${queryParametersAsString}`;
284
263
  }
285
-
286
264
  return url;
287
265
  }
288
266
  function serializeQueryParameters(parameters) {
289
267
  const isObjectOrArray = value => Object.prototype.toString.call(value) === '[object Object]' || Object.prototype.toString.call(value) === '[object Array]';
290
-
291
- return Object.keys(parameters).map(key => `${key}=${isObjectOrArray(parameters[key]) ? JSON.stringify(parameters[key]) : parameters[key]}`).join('&');
268
+ return Object.keys(parameters).map(key => `${key}=${encodeURIComponent(isObjectOrArray(parameters[key]) ? JSON.stringify(parameters[key]) : parameters[key])}`).join('&');
292
269
  }
293
270
  function serializeData(request, requestOptions) {
294
271
  if (request.method === 'GET' || request.data === undefined && requestOptions.data === undefined) {
295
272
  return undefined;
296
273
  }
297
-
298
- const data = Array.isArray(request.data) ? request.data : { ...request.data,
274
+ const data = Array.isArray(request.data) ? request.data : {
275
+ ...request.data,
299
276
  ...requestOptions.data
300
277
  };
301
278
  return JSON.stringify(data);
@@ -325,14 +302,16 @@ function deserializeFailure({
325
302
  content,
326
303
  status
327
304
  }, stackFrame) {
328
- let message = content;
329
-
330
305
  try {
331
- message = JSON.parse(content).message;
332
- } catch (e) {// ..
306
+ const parsed = JSON.parse(content);
307
+ if ('error' in parsed) {
308
+ return new DetailedApiError(parsed.message, status, parsed.error, stackFrame);
309
+ }
310
+ return new ApiError(parsed.message, status, stackFrame);
311
+ } catch (e) {
312
+ // ..
333
313
  }
334
-
335
- return new ApiError(message, status, stackFrame);
314
+ return new ApiError(content, status, stackFrame);
336
315
  }
337
316
 
338
317
  function isNetworkError({
@@ -363,9 +342,12 @@ function stackFrameWithoutCredentials(stackFrame) {
363
342
  const modifiedHeaders = stackFrame.request.headers['x-algolia-api-key'] ? {
364
343
  'x-algolia-api-key': '*****'
365
344
  } : {};
366
- return { ...stackFrame,
367
- request: { ...stackFrame.request,
368
- headers: { ...stackFrame.request.headers,
345
+ return {
346
+ ...stackFrame,
347
+ request: {
348
+ ...stackFrame.request,
349
+ headers: {
350
+ ...stackFrame.request.headers,
369
351
  ...modifiedHeaders
370
352
  }
371
353
  }
@@ -390,53 +372,49 @@ function createTransporter({
390
372
  });
391
373
  }));
392
374
  const hostsUp = statefulHosts.filter(host => host.isUp());
393
- const hostsTimedOut = statefulHosts.filter(host => host.isTimedOut()); // Note, we put the hosts that previously timed out on the end of the list.
394
-
375
+ const hostsTimedOut = statefulHosts.filter(host => host.isTimedOut());
376
+ // Note, we put the hosts that previously timed out on the end of the list.
395
377
  const hostsAvailable = [...hostsUp, ...hostsTimedOut];
396
378
  const compatibleHostsAvailable = hostsAvailable.length > 0 ? hostsAvailable : compatibleHosts;
397
379
  return {
398
380
  hosts: compatibleHostsAvailable,
399
-
400
381
  getTimeout(timeoutsCount, baseTimeout) {
401
- /**
402
- * Imagine that you have 4 hosts, if timeouts will increase
403
- * on the following way: 1 (timed out) > 4 (timed out) > 5 (200).
404
- *
405
- * Note that, the very next request, we start from the previous timeout.
406
- *
407
- * 5 (timed out) > 6 (timed out) > 7 ...
408
- *
409
- * This strategy may need to be reviewed, but is the strategy on the our
410
- * current v3 version.
382
+ /**
383
+ * Imagine that you have 4 hosts, if timeouts will increase
384
+ * on the following way: 1 (timed out) > 4 (timed out) > 5 (200).
385
+ *
386
+ * Note that, the very next request, we start from the previous timeout.
387
+ *
388
+ * 5 (timed out) > 6 (timed out) > 7 ...
389
+ *
390
+ * This strategy may need to be reviewed, but is the strategy on the our
391
+ * current v3 version.
411
392
  */
412
393
  const timeoutMultiplier = hostsTimedOut.length === 0 && timeoutsCount === 0 ? 1 : hostsTimedOut.length + 3 + timeoutsCount;
413
394
  return timeoutMultiplier * baseTimeout;
414
395
  }
415
-
416
396
  };
417
397
  }
418
-
419
398
  async function retryableRequest(request, requestOptions, isRead = true) {
420
399
  const stackTrace = [];
421
- /**
422
- * First we prepare the payload that do not depend from hosts.
400
+ /**
401
+ * First we prepare the payload that do not depend from hosts.
423
402
  */
424
-
425
403
  const data = serializeData(request, requestOptions);
426
- const headers = serializeHeaders(baseHeaders, request.headers, requestOptions.headers); // On `GET`, the data is proxied to query parameters.
427
-
428
- const dataQueryParameters = request.method === 'GET' ? { ...request.data,
404
+ const headers = serializeHeaders(baseHeaders, request.headers, requestOptions.headers);
405
+ // On `GET`, the data is proxied to query parameters.
406
+ const dataQueryParameters = request.method === 'GET' ? {
407
+ ...request.data,
429
408
  ...requestOptions.data
430
409
  } : {};
431
- const queryParameters = { ...baseQueryParameters,
410
+ const queryParameters = {
411
+ ...baseQueryParameters,
432
412
  ...request.queryParameters,
433
413
  ...dataQueryParameters
434
414
  };
435
-
436
415
  if (algoliaAgent.value) {
437
416
  queryParameters['x-algolia-agent'] = algoliaAgent.value;
438
417
  }
439
-
440
418
  if (requestOptions && requestOptions.queryParameters) {
441
419
  for (const key of Object.keys(requestOptions.queryParameters)) {
442
420
  // We want to keep `undefined` and `null` values,
@@ -449,25 +427,19 @@ function createTransporter({
449
427
  }
450
428
  }
451
429
  }
452
-
453
430
  let timeoutsCount = 0;
454
-
455
431
  const retry = async (retryableHosts, getTimeout) => {
456
- /**
457
- * We iterate on each host, until there is no host left.
432
+ /**
433
+ * We iterate on each host, until there is no host left.
458
434
  */
459
435
  const host = retryableHosts.pop();
460
-
461
436
  if (host === undefined) {
462
437
  throw new RetryError(stackTraceWithoutCredentials(stackTrace));
463
438
  }
464
-
465
439
  let responseTimeout = requestOptions.timeout;
466
-
467
440
  if (responseTimeout === undefined) {
468
441
  responseTimeout = isRead ? timeouts.read : timeouts.write;
469
442
  }
470
-
471
443
  const payload = {
472
444
  data,
473
445
  headers,
@@ -476,12 +448,11 @@ function createTransporter({
476
448
  connectTimeout: getTimeout(timeoutsCount, timeouts.connect),
477
449
  responseTimeout: getTimeout(timeoutsCount, responseTimeout)
478
450
  };
479
- /**
480
- * The stackFrame is pushed to the stackTrace so we
481
- * can have information about onRetry and onFailure
482
- * decisions.
451
+ /**
452
+ * The stackFrame is pushed to the stackTrace so we
453
+ * can have information about onRetry and onFailure
454
+ * decisions.
483
455
  */
484
-
485
456
  const pushToStackTrace = response => {
486
457
  const stackFrame = {
487
458
  request: payload,
@@ -492,102 +463,85 @@ function createTransporter({
492
463
  stackTrace.push(stackFrame);
493
464
  return stackFrame;
494
465
  };
495
-
496
466
  const response = await requester.send(payload);
497
-
498
467
  if (isRetryable(response)) {
499
- const stackFrame = pushToStackTrace(response); // If response is a timeout, we increase the number of timeouts so we can increase the timeout later.
500
-
468
+ const stackFrame = pushToStackTrace(response);
469
+ // If response is a timeout, we increase the number of timeouts so we can increase the timeout later.
501
470
  if (response.isTimedOut) {
502
471
  timeoutsCount++;
503
472
  }
504
- /**
505
- * Failures are individually sent to the logger, allowing
506
- * the end user to debug / store stack frames even
507
- * when a retry error does not happen.
473
+ /**
474
+ * Failures are individually sent to the logger, allowing
475
+ * the end user to debug / store stack frames even
476
+ * when a retry error does not happen.
508
477
  */
509
478
  // eslint-disable-next-line no-console -- this will be fixed by exposing a `logger` to the transporter
510
-
511
-
512
479
  console.log('Retryable failure', stackFrameWithoutCredentials(stackFrame));
513
- /**
514
- * We also store the state of the host in failure cases. If the host, is
515
- * down it will remain down for the next 2 minutes. In a timeout situation,
516
- * this host will be added end of the list of hosts on the next request.
480
+ /**
481
+ * We also store the state of the host in failure cases. If the host, is
482
+ * down it will remain down for the next 2 minutes. In a timeout situation,
483
+ * this host will be added end of the list of hosts on the next request.
517
484
  */
518
-
519
485
  await hostsCache.set(host, createStatefulHost(host, response.isTimedOut ? 'timed out' : 'down'));
520
486
  return retry(retryableHosts, getTimeout);
521
487
  }
522
-
523
488
  if (isSuccess(response)) {
524
489
  return deserializeSuccess(response);
525
490
  }
526
-
527
491
  pushToStackTrace(response);
528
492
  throw deserializeFailure(response, stackTrace);
529
493
  };
530
- /**
531
- * Finally, for each retryable host perform request until we got a non
532
- * retryable response. Some notes here:
533
- *
534
- * 1. The reverse here is applied so we can apply a `pop` later on => more performant.
535
- * 2. We also get from the retryable options a timeout multiplier that is tailored
536
- * for the current context.
494
+ /**
495
+ * Finally, for each retryable host perform request until we got a non
496
+ * retryable response. Some notes here:
497
+ *
498
+ * 1. The reverse here is applied so we can apply a `pop` later on => more performant.
499
+ * 2. We also get from the retryable options a timeout multiplier that is tailored
500
+ * for the current context.
537
501
  */
538
-
539
-
540
502
  const compatibleHosts = hosts.filter(host => host.accept === 'readWrite' || (isRead ? host.accept === 'read' : host.accept === 'write'));
541
503
  const options = await createRetryableOptions(compatibleHosts);
542
504
  return retry([...options.hosts].reverse(), options.getTimeout);
543
505
  }
544
-
545
506
  function createRequest(request, requestOptions = {}) {
546
- /**
547
- * A read request is either a `GET` request, or a request that we make
548
- * via the `read` transporter (e.g. `search`).
507
+ /**
508
+ * A read request is either a `GET` request, or a request that we make
509
+ * via the `read` transporter (e.g. `search`).
549
510
  */
550
511
  const isRead = request.useReadTransporter || request.method === 'GET';
551
-
552
512
  if (!isRead) {
553
- /**
554
- * On write requests, no cache mechanisms are applied, and we
555
- * proxy the request immediately to the requester.
513
+ /**
514
+ * On write requests, no cache mechanisms are applied, and we
515
+ * proxy the request immediately to the requester.
556
516
  */
557
517
  return retryableRequest(request, requestOptions, isRead);
558
518
  }
559
-
560
519
  const createRetryableRequest = () => {
561
- /**
562
- * Then, we prepare a function factory that contains the construction of
563
- * the retryable request. At this point, we may *not* perform the actual
564
- * request. But we want to have the function factory ready.
520
+ /**
521
+ * Then, we prepare a function factory that contains the construction of
522
+ * the retryable request. At this point, we may *not* perform the actual
523
+ * request. But we want to have the function factory ready.
565
524
  */
566
525
  return retryableRequest(request, requestOptions);
567
526
  };
568
- /**
569
- * Once we have the function factory ready, we need to determine of the
570
- * request is "cacheable" - should be cached. Note that, once again,
571
- * the user can force this option.
527
+ /**
528
+ * Once we have the function factory ready, we need to determine of the
529
+ * request is "cacheable" - should be cached. Note that, once again,
530
+ * the user can force this option.
572
531
  */
573
-
574
-
575
532
  const cacheable = requestOptions.cacheable || request.cacheable;
576
- /**
577
- * If is not "cacheable", we immediately trigger the retryable request, no
578
- * need to check cache implementations.
533
+ /**
534
+ * If is not "cacheable", we immediately trigger the retryable request, no
535
+ * need to check cache implementations.
579
536
  */
580
-
581
537
  if (cacheable !== true) {
582
538
  return createRetryableRequest();
583
539
  }
584
- /**
585
- * If the request is "cacheable", we need to first compute the key to ask
586
- * the cache implementations if this request is on progress or if the
587
- * response already exists on the cache.
540
+ /**
541
+ * If the request is "cacheable", we need to first compute the key to ask
542
+ * the cache implementations if this request is on progress or if the
543
+ * response already exists on the cache.
588
544
  */
589
-
590
-
591
545
  const key = {
592
546
  request,
593
547
  requestOptions,
@@ -596,33 +550,31 @@ function createTransporter({
596
550
  headers: baseHeaders
597
551
  }
598
552
  };
599
- /**
600
- * With the computed key, we first ask the responses cache
601
- * implementation if this request was been resolved before.
553
+ /**
554
+ * With the computed key, we first ask the responses cache
555
+ * implementation if this request was been resolved before.
602
556
  */
603
-
604
557
  return responsesCache.get(key, () => {
605
- /**
606
- * If the request has never resolved before, we actually ask if there
607
- * is a current request with the same key on progress.
558
+ /**
559
+ * If the request has never resolved before, we actually ask if there
560
+ * is a current request with the same key on progress.
608
561
  */
609
562
  return requestsCache.get(key, () =>
610
- /**
611
- * Finally, if there is no request in progress with the same key,
612
- * this `createRetryableRequest()` will actually trigger the
613
- * retryable request.
563
+ /**
564
+ * Finally, if there is no request in progress with the same key,
565
+ * this `createRetryableRequest()` will actually trigger the
566
+ * retryable request.
614
567
  */
615
568
  requestsCache.set(key, createRetryableRequest()).then(response => Promise.all([requestsCache.delete(key), response]), err => Promise.all([requestsCache.delete(key), Promise.reject(err)])).then(([_, response]) => response));
616
569
  }, {
617
- /**
618
- * Of course, once we get this response back from the server, we
619
- * tell response cache to actually store the received response
620
- * to be used later.
570
+ /**
571
+ * Of course, once we get this response back from the server, we
572
+ * tell response cache to actually store the received response
573
+ * to be used later.
621
574
  */
622
575
  miss: response => responsesCache.set(key, response)
623
576
  });
624
577
  }
625
-
626
578
  return {
627
579
  hostsCache,
628
580
  requester,
@@ -640,17 +592,13 @@ function createTransporter({
640
592
  function createAlgoliaAgent(version) {
641
593
  const algoliaAgent = {
642
594
  value: `Algolia for JavaScript (${version})`,
643
-
644
595
  add(options) {
645
596
  const addedAlgoliaAgent = `; ${options.segment}${options.version !== undefined ? ` (${options.version})` : ''}`;
646
-
647
597
  if (algoliaAgent.value.indexOf(addedAlgoliaAgent) === -1) {
648
598
  algoliaAgent.value = `${algoliaAgent.value}${addedAlgoliaAgent}`;
649
599
  }
650
-
651
600
  return algoliaAgent;
652
601
  }
653
-
654
602
  };
655
603
  return algoliaAgent;
656
604
  }
@@ -672,301 +620,436 @@ const DEFAULT_CONNECT_TIMEOUT_BROWSER = 1000;
672
620
  const DEFAULT_READ_TIMEOUT_BROWSER = 2000;
673
621
  const DEFAULT_WRITE_TIMEOUT_BROWSER = 30000;
674
622
 
675
- function createXhrRequester() {
676
- function send(request) {
677
- return new Promise((resolve) => {
678
- const baseRequester = new XMLHttpRequest();
679
- baseRequester.open(request.method, request.url, true);
680
- Object.keys(request.headers).forEach((key) => baseRequester.setRequestHeader(key, request.headers[key]));
681
- const createTimeout = (timeout, content) => {
682
- return setTimeout(() => {
683
- baseRequester.abort();
684
- resolve({
685
- status: 0,
686
- content,
687
- isTimedOut: true,
688
- });
689
- }, timeout);
690
- };
691
- const connectTimeout = createTimeout(request.connectTimeout, 'Connection timeout');
692
- let responseTimeout;
693
- baseRequester.onreadystatechange = () => {
694
- if (baseRequester.readyState > baseRequester.OPENED &&
695
- responseTimeout === undefined) {
696
- clearTimeout(connectTimeout);
697
- responseTimeout = createTimeout(request.responseTimeout, 'Socket timeout');
698
- }
699
- };
700
- baseRequester.onerror = () => {
701
- // istanbul ignore next
702
- if (baseRequester.status === 0) {
703
- clearTimeout(connectTimeout);
704
- clearTimeout(responseTimeout);
705
- resolve({
706
- content: baseRequester.responseText || 'Network request failed',
707
- status: baseRequester.status,
708
- isTimedOut: false,
709
- });
710
- }
711
- };
712
- baseRequester.onload = () => {
713
- clearTimeout(connectTimeout);
714
- clearTimeout(responseTimeout);
715
- resolve({
716
- content: baseRequester.responseText,
717
- status: baseRequester.status,
718
- isTimedOut: false,
719
- });
720
- };
721
- baseRequester.send(request.data);
722
- });
723
- }
724
- return { send };
623
+ function createXhrRequester() {
624
+ function send(request) {
625
+ return new Promise((resolve) => {
626
+ const baseRequester = new XMLHttpRequest();
627
+ baseRequester.open(request.method, request.url, true);
628
+ Object.keys(request.headers).forEach((key) => baseRequester.setRequestHeader(key, request.headers[key]));
629
+ const createTimeout = (timeout, content) => {
630
+ return setTimeout(() => {
631
+ baseRequester.abort();
632
+ resolve({
633
+ status: 0,
634
+ content,
635
+ isTimedOut: true,
636
+ });
637
+ }, timeout);
638
+ };
639
+ const connectTimeout = createTimeout(request.connectTimeout, 'Connection timeout');
640
+ let responseTimeout;
641
+ baseRequester.onreadystatechange = () => {
642
+ if (baseRequester.readyState > baseRequester.OPENED &&
643
+ responseTimeout === undefined) {
644
+ clearTimeout(connectTimeout);
645
+ responseTimeout = createTimeout(request.responseTimeout, 'Socket timeout');
646
+ }
647
+ };
648
+ baseRequester.onerror = () => {
649
+ // istanbul ignore next
650
+ if (baseRequester.status === 0) {
651
+ clearTimeout(connectTimeout);
652
+ clearTimeout(responseTimeout);
653
+ resolve({
654
+ content: baseRequester.responseText || 'Network request failed',
655
+ status: baseRequester.status,
656
+ isTimedOut: false,
657
+ });
658
+ }
659
+ };
660
+ baseRequester.onload = () => {
661
+ clearTimeout(connectTimeout);
662
+ clearTimeout(responseTimeout);
663
+ resolve({
664
+ content: baseRequester.responseText,
665
+ status: baseRequester.status,
666
+ isTimedOut: false,
667
+ });
668
+ };
669
+ baseRequester.send(request.data);
670
+ });
671
+ }
672
+ return { send };
725
673
  }
726
674
 
727
- // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
728
- const apiClientVersion = '5.0.0-alpha.9';
729
- function getDefaultHosts(appId) {
730
- return [
731
- {
732
- url: `${appId}-dsn.algolia.net`,
733
- accept: 'read',
734
- protocol: 'https',
735
- },
736
- {
737
- url: `${appId}.algolia.net`,
738
- accept: 'write',
739
- protocol: 'https',
740
- },
741
- ].concat(shuffle([
742
- {
743
- url: `${appId}-1.algolianet.com`,
744
- accept: 'readWrite',
745
- protocol: 'https',
746
- },
747
- {
748
- url: `${appId}-2.algolianet.com`,
749
- accept: 'readWrite',
750
- protocol: 'https',
751
- },
752
- {
753
- url: `${appId}-3.algolianet.com`,
754
- accept: 'readWrite',
755
- protocol: 'https',
756
- },
757
- ]));
758
- }
759
- // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
760
- function createRecommendClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, ...options }) {
761
- const auth = createAuth(appIdOption, apiKeyOption, authMode);
762
- const transporter = createTransporter({
763
- hosts: getDefaultHosts(appIdOption),
764
- ...options,
765
- algoliaAgent: getAlgoliaAgent({
766
- algoliaAgents,
767
- client: 'Recommend',
768
- version: apiClientVersion,
769
- }),
770
- baseHeaders: {
771
- 'content-type': 'text/plain',
772
- ...auth.headers(),
773
- ...options.baseHeaders,
774
- },
775
- baseQueryParameters: {
776
- ...auth.queryParameters(),
777
- ...options.baseQueryParameters,
778
- },
779
- });
780
- return {
781
- transporter,
782
- /**
783
- * The `appId` currently in use.
784
- */
785
- appId: appIdOption,
786
- /**
787
- * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
788
- */
789
- clearCache() {
790
- return Promise.all([
791
- transporter.requestsCache.clear(),
792
- transporter.responsesCache.clear(),
793
- ]).then(() => undefined);
794
- },
795
- /**
796
- * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
797
- */
798
- get _ua() {
799
- return transporter.algoliaAgent.value;
800
- },
801
- /**
802
- * Adds a `segment` to the `x-algolia-agent` sent with every requests.
803
- *
804
- * @param segment - The algolia agent (user-agent) segment to add.
805
- * @param version - The version of the agent.
806
- */
807
- addAlgoliaAgent(segment, version) {
808
- transporter.algoliaAgent.add({ segment, version });
809
- },
810
- /**
811
- * This method allow you to send requests to the Algolia REST API.
812
- *
813
- * @summary Send requests to the Algolia REST API.
814
- * @param del - The del object.
815
- * @param del.path - The path of the API endpoint to target, anything after the /1 needs to be specified.
816
- * @param del.parameters - Query parameters to be applied to the current query.
817
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
818
- */
819
- del({ path, parameters }, requestOptions) {
820
- if (!path) {
821
- throw new Error('Parameter `path` is required when calling `del`.');
822
- }
823
- const requestPath = '/1{path}'.replace('{path}', path);
824
- const headers = {};
825
- const queryParameters = parameters ? parameters : {};
826
- const request = {
827
- method: 'DELETE',
828
- path: requestPath,
829
- queryParameters,
830
- headers,
831
- };
832
- return transporter.request(request, requestOptions);
833
- },
834
- /**
835
- * This method allow you to send requests to the Algolia REST API.
836
- *
837
- * @summary Send requests to the Algolia REST API.
838
- * @param get - The get object.
839
- * @param get.path - The path of the API endpoint to target, anything after the /1 needs to be specified.
840
- * @param get.parameters - Query parameters to be applied to the current query.
841
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
842
- */
843
- get({ path, parameters }, requestOptions) {
844
- if (!path) {
845
- throw new Error('Parameter `path` is required when calling `get`.');
846
- }
847
- const requestPath = '/1{path}'.replace('{path}', path);
848
- const headers = {};
849
- const queryParameters = parameters ? parameters : {};
850
- const request = {
851
- method: 'GET',
852
- path: requestPath,
853
- queryParameters,
854
- headers,
855
- };
856
- return transporter.request(request, requestOptions);
857
- },
858
- /**
859
- * Returns recommendations or trending results, for a specific model and `objectID`.
860
- *
861
- * @summary Get results.
862
- * @param getRecommendationsParams - The getRecommendationsParams object.
863
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
864
- */
865
- getRecommendations(getRecommendationsParams, requestOptions) {
866
- if (!getRecommendationsParams) {
867
- throw new Error('Parameter `getRecommendationsParams` is required when calling `getRecommendations`.');
868
- }
869
- if (!getRecommendationsParams.requests) {
870
- throw new Error('Parameter `getRecommendationsParams.requests` is required when calling `getRecommendations`.');
871
- }
872
- const requestPath = '/1/indexes/*/recommendations';
873
- const headers = {};
874
- const queryParameters = {};
875
- const request = {
876
- method: 'POST',
877
- path: requestPath,
878
- queryParameters,
879
- headers,
880
- data: getRecommendationsParams,
881
- useReadTransporter: true,
882
- cacheable: true,
883
- };
884
- return transporter.request(request, requestOptions);
885
- },
886
- /**
887
- * This method allow you to send requests to the Algolia REST API.
888
- *
889
- * @summary Send requests to the Algolia REST API.
890
- * @param post - The post object.
891
- * @param post.path - The path of the API endpoint to target, anything after the /1 needs to be specified.
892
- * @param post.parameters - Query parameters to be applied to the current query.
893
- * @param post.body - The parameters to send with the custom request.
894
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
895
- */
896
- post({ path, parameters, body }, requestOptions) {
897
- if (!path) {
898
- throw new Error('Parameter `path` is required when calling `post`.');
899
- }
900
- const requestPath = '/1{path}'.replace('{path}', path);
901
- const headers = {};
902
- const queryParameters = parameters ? parameters : {};
903
- const request = {
904
- method: 'POST',
905
- path: requestPath,
906
- queryParameters,
907
- headers,
908
- data: body ? body : {},
909
- };
910
- return transporter.request(request, requestOptions);
911
- },
912
- /**
913
- * This method allow you to send requests to the Algolia REST API.
914
- *
915
- * @summary Send requests to the Algolia REST API.
916
- * @param put - The put object.
917
- * @param put.path - The path of the API endpoint to target, anything after the /1 needs to be specified.
918
- * @param put.parameters - Query parameters to be applied to the current query.
919
- * @param put.body - The parameters to send with the custom request.
920
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
921
- */
922
- put({ path, parameters, body }, requestOptions) {
923
- if (!path) {
924
- throw new Error('Parameter `path` is required when calling `put`.');
925
- }
926
- const requestPath = '/1{path}'.replace('{path}', path);
927
- const headers = {};
928
- const queryParameters = parameters ? parameters : {};
929
- const request = {
930
- method: 'PUT',
931
- path: requestPath,
932
- queryParameters,
933
- headers,
934
- data: body ? body : {},
935
- };
936
- return transporter.request(request, requestOptions);
937
- },
938
- };
675
+ // Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
676
+ const apiClientVersion = '5.0.0-alpha.91';
677
+ function getDefaultHosts(appId) {
678
+ return [
679
+ {
680
+ url: `${appId}-dsn.algolia.net`,
681
+ accept: 'read',
682
+ protocol: 'https',
683
+ },
684
+ {
685
+ url: `${appId}.algolia.net`,
686
+ accept: 'write',
687
+ protocol: 'https',
688
+ },
689
+ ].concat(shuffle([
690
+ {
691
+ url: `${appId}-1.algolianet.com`,
692
+ accept: 'readWrite',
693
+ protocol: 'https',
694
+ },
695
+ {
696
+ url: `${appId}-2.algolianet.com`,
697
+ accept: 'readWrite',
698
+ protocol: 'https',
699
+ },
700
+ {
701
+ url: `${appId}-3.algolianet.com`,
702
+ accept: 'readWrite',
703
+ protocol: 'https',
704
+ },
705
+ ]));
706
+ }
707
+ // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
708
+ function createRecommendClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, ...options }) {
709
+ const auth = createAuth(appIdOption, apiKeyOption, authMode);
710
+ const transporter = createTransporter({
711
+ hosts: getDefaultHosts(appIdOption),
712
+ ...options,
713
+ algoliaAgent: getAlgoliaAgent({
714
+ algoliaAgents,
715
+ client: 'Recommend',
716
+ version: apiClientVersion,
717
+ }),
718
+ baseHeaders: {
719
+ 'content-type': 'text/plain',
720
+ ...auth.headers(),
721
+ ...options.baseHeaders,
722
+ },
723
+ baseQueryParameters: {
724
+ ...auth.queryParameters(),
725
+ ...options.baseQueryParameters,
726
+ },
727
+ });
728
+ return {
729
+ transporter,
730
+ /**
731
+ * The `appId` currently in use.
732
+ */
733
+ appId: appIdOption,
734
+ /**
735
+ * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
736
+ */
737
+ clearCache() {
738
+ return Promise.all([
739
+ transporter.requestsCache.clear(),
740
+ transporter.responsesCache.clear(),
741
+ ]).then(() => undefined);
742
+ },
743
+ /**
744
+ * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
745
+ */
746
+ get _ua() {
747
+ return transporter.algoliaAgent.value;
748
+ },
749
+ /**
750
+ * Adds a `segment` to the `x-algolia-agent` sent with every requests.
751
+ *
752
+ * @param segment - The algolia agent (user-agent) segment to add.
753
+ * @param version - The version of the agent.
754
+ */
755
+ addAlgoliaAgent(segment, version) {
756
+ transporter.algoliaAgent.add({ segment, version });
757
+ },
758
+ /**
759
+ * This method allow you to send requests to the Algolia REST API.
760
+ *
761
+ * @summary Send requests to the Algolia REST API.
762
+ * @param del - The del object.
763
+ * @param del.path - Path of the endpoint, anything after \"/1\" must be specified.
764
+ * @param del.parameters - Query parameters to apply to the current query.
765
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
766
+ */
767
+ del({ path, parameters }, requestOptions) {
768
+ if (!path) {
769
+ throw new Error('Parameter `path` is required when calling `del`.');
770
+ }
771
+ const requestPath = '/1{path}'.replace('{path}', path);
772
+ const headers = {};
773
+ const queryParameters = parameters ? parameters : {};
774
+ const request = {
775
+ method: 'DELETE',
776
+ path: requestPath,
777
+ queryParameters,
778
+ headers,
779
+ };
780
+ return transporter.request(request, requestOptions);
781
+ },
782
+ /**
783
+ * Delete a [Recommend rule](https://www.algolia.com/doc/guides/algolia-recommend/how-to/rules/).
784
+ *
785
+ * @summary Delete a Recommend rule.
786
+ * @param deleteRecommendRule - The deleteRecommendRule object.
787
+ * @param deleteRecommendRule.indexName - Index on which to perform the request.
788
+ * @param deleteRecommendRule.model - [Recommend models](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models).
789
+ * @param deleteRecommendRule.objectID - Unique record (object) identifier.
790
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
791
+ */
792
+ deleteRecommendRule({ indexName, model, objectID }, requestOptions) {
793
+ if (!indexName) {
794
+ throw new Error('Parameter `indexName` is required when calling `deleteRecommendRule`.');
795
+ }
796
+ if (!model) {
797
+ throw new Error('Parameter `model` is required when calling `deleteRecommendRule`.');
798
+ }
799
+ if (!objectID) {
800
+ throw new Error('Parameter `objectID` is required when calling `deleteRecommendRule`.');
801
+ }
802
+ const requestPath = '/1/indexes/{indexName}/{model}/recommend/rules/{objectID}'
803
+ .replace('{indexName}', encodeURIComponent(indexName))
804
+ .replace('{model}', encodeURIComponent(model))
805
+ .replace('{objectID}', encodeURIComponent(objectID));
806
+ const headers = {};
807
+ const queryParameters = {};
808
+ const request = {
809
+ method: 'DELETE',
810
+ path: requestPath,
811
+ queryParameters,
812
+ headers,
813
+ };
814
+ return transporter.request(request, requestOptions);
815
+ },
816
+ /**
817
+ * This method allow you to send requests to the Algolia REST API.
818
+ *
819
+ * @summary Send requests to the Algolia REST API.
820
+ * @param get - The get object.
821
+ * @param get.path - Path of the endpoint, anything after \"/1\" must be specified.
822
+ * @param get.parameters - Query parameters to apply to the current query.
823
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
824
+ */
825
+ get({ path, parameters }, requestOptions) {
826
+ if (!path) {
827
+ throw new Error('Parameter `path` is required when calling `get`.');
828
+ }
829
+ const requestPath = '/1{path}'.replace('{path}', path);
830
+ const headers = {};
831
+ const queryParameters = parameters ? parameters : {};
832
+ const request = {
833
+ method: 'GET',
834
+ path: requestPath,
835
+ queryParameters,
836
+ headers,
837
+ };
838
+ return transporter.request(request, requestOptions);
839
+ },
840
+ /**
841
+ * Return a [Recommend rule](https://www.algolia.com/doc/guides/algolia-recommend/how-to/rules/).
842
+ *
843
+ * @summary Get a Recommend rule.
844
+ * @param getRecommendRule - The getRecommendRule object.
845
+ * @param getRecommendRule.indexName - Index on which to perform the request.
846
+ * @param getRecommendRule.model - [Recommend models](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models).
847
+ * @param getRecommendRule.objectID - Unique record (object) identifier.
848
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
849
+ */
850
+ getRecommendRule({ indexName, model, objectID }, requestOptions) {
851
+ if (!indexName) {
852
+ throw new Error('Parameter `indexName` is required when calling `getRecommendRule`.');
853
+ }
854
+ if (!model) {
855
+ throw new Error('Parameter `model` is required when calling `getRecommendRule`.');
856
+ }
857
+ if (!objectID) {
858
+ throw new Error('Parameter `objectID` is required when calling `getRecommendRule`.');
859
+ }
860
+ const requestPath = '/1/indexes/{indexName}/{model}/recommend/rules/{objectID}'
861
+ .replace('{indexName}', encodeURIComponent(indexName))
862
+ .replace('{model}', encodeURIComponent(model))
863
+ .replace('{objectID}', encodeURIComponent(objectID));
864
+ const headers = {};
865
+ const queryParameters = {};
866
+ const request = {
867
+ method: 'GET',
868
+ path: requestPath,
869
+ queryParameters,
870
+ headers,
871
+ };
872
+ return transporter.request(request, requestOptions);
873
+ },
874
+ /**
875
+ * Some operations, such as deleting a Recommend rule, will respond with a `taskID` value. Use this value here to check the status of that task.
876
+ *
877
+ * @summary Get a Recommend task\'s status.
878
+ * @param getRecommendStatus - The getRecommendStatus object.
879
+ * @param getRecommendStatus.indexName - Index on which to perform the request.
880
+ * @param getRecommendStatus.model - [Recommend models](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models).
881
+ * @param getRecommendStatus.taskID - Unique identifier of a task. Numeric value (up to 64bits).
882
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
883
+ */
884
+ getRecommendStatus({ indexName, model, taskID }, requestOptions) {
885
+ if (!indexName) {
886
+ throw new Error('Parameter `indexName` is required when calling `getRecommendStatus`.');
887
+ }
888
+ if (!model) {
889
+ throw new Error('Parameter `model` is required when calling `getRecommendStatus`.');
890
+ }
891
+ if (!taskID) {
892
+ throw new Error('Parameter `taskID` is required when calling `getRecommendStatus`.');
893
+ }
894
+ const requestPath = '/1/indexes/{indexName}/{model}/task/{taskID}'
895
+ .replace('{indexName}', encodeURIComponent(indexName))
896
+ .replace('{model}', encodeURIComponent(model))
897
+ .replace('{taskID}', encodeURIComponent(taskID));
898
+ const headers = {};
899
+ const queryParameters = {};
900
+ const request = {
901
+ method: 'GET',
902
+ path: requestPath,
903
+ queryParameters,
904
+ headers,
905
+ };
906
+ return transporter.request(request, requestOptions);
907
+ },
908
+ /**
909
+ * Returns results from either recommendation or trending models: - **Recommendations** are provided by the [Related Products](https://www.algolia.com/doc/guides/algolia-recommend/overview/#related-products-and-related-content) and [Frequently Bought Together](https://www.algolia.com/doc/guides/algolia-recommend/overview/#frequently-bought-together) models - **Trending** models are [Trending Items and Trending Facet Values](https://www.algolia.com/doc/guides/algolia-recommend/overview/#trending-items-and-trending-facet-values).
910
+ *
911
+ * @summary Get recommendations and trending items.
912
+ * @param getRecommendationsParams - The getRecommendationsParams object.
913
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
914
+ */
915
+ getRecommendations(getRecommendationsParams, requestOptions) {
916
+ if (!getRecommendationsParams) {
917
+ throw new Error('Parameter `getRecommendationsParams` is required when calling `getRecommendations`.');
918
+ }
919
+ if (!getRecommendationsParams.requests) {
920
+ throw new Error('Parameter `getRecommendationsParams.requests` is required when calling `getRecommendations`.');
921
+ }
922
+ const requestPath = '/1/indexes/*/recommendations';
923
+ const headers = {};
924
+ const queryParameters = {};
925
+ const request = {
926
+ method: 'POST',
927
+ path: requestPath,
928
+ queryParameters,
929
+ headers,
930
+ data: getRecommendationsParams,
931
+ useReadTransporter: true,
932
+ cacheable: true,
933
+ };
934
+ return transporter.request(request, requestOptions);
935
+ },
936
+ /**
937
+ * This method allow you to send requests to the Algolia REST API.
938
+ *
939
+ * @summary Send requests to the Algolia REST API.
940
+ * @param post - The post object.
941
+ * @param post.path - Path of the endpoint, anything after \"/1\" must be specified.
942
+ * @param post.parameters - Query parameters to apply to the current query.
943
+ * @param post.body - Parameters to send with the custom request.
944
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
945
+ */
946
+ post({ path, parameters, body }, requestOptions) {
947
+ if (!path) {
948
+ throw new Error('Parameter `path` is required when calling `post`.');
949
+ }
950
+ const requestPath = '/1{path}'.replace('{path}', path);
951
+ const headers = {};
952
+ const queryParameters = parameters ? parameters : {};
953
+ const request = {
954
+ method: 'POST',
955
+ path: requestPath,
956
+ queryParameters,
957
+ headers,
958
+ data: body ? body : {},
959
+ };
960
+ return transporter.request(request, requestOptions);
961
+ },
962
+ /**
963
+ * This method allow you to send requests to the Algolia REST API.
964
+ *
965
+ * @summary Send requests to the Algolia REST API.
966
+ * @param put - The put object.
967
+ * @param put.path - Path of the endpoint, anything after \"/1\" must be specified.
968
+ * @param put.parameters - Query parameters to apply to the current query.
969
+ * @param put.body - Parameters to send with the custom request.
970
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
971
+ */
972
+ put({ path, parameters, body }, requestOptions) {
973
+ if (!path) {
974
+ throw new Error('Parameter `path` is required when calling `put`.');
975
+ }
976
+ const requestPath = '/1{path}'.replace('{path}', path);
977
+ const headers = {};
978
+ const queryParameters = parameters ? parameters : {};
979
+ const request = {
980
+ method: 'PUT',
981
+ path: requestPath,
982
+ queryParameters,
983
+ headers,
984
+ data: body ? body : {},
985
+ };
986
+ return transporter.request(request, requestOptions);
987
+ },
988
+ /**
989
+ * List [Recommend rules](https://www.algolia.com/doc/guides/algolia-recommend/how-to/rules/).
990
+ *
991
+ * @summary List Recommend rules.
992
+ * @param searchRecommendRules - The searchRecommendRules object.
993
+ * @param searchRecommendRules.indexName - Index on which to perform the request.
994
+ * @param searchRecommendRules.model - [Recommend models](https://www.algolia.com/doc/guides/algolia-recommend/overview/#recommend-models).
995
+ * @param searchRecommendRules.searchRecommendRulesParams - The searchRecommendRulesParams object.
996
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
997
+ */
998
+ searchRecommendRules({ indexName, model, searchRecommendRulesParams, }, requestOptions) {
999
+ if (!indexName) {
1000
+ throw new Error('Parameter `indexName` is required when calling `searchRecommendRules`.');
1001
+ }
1002
+ if (!model) {
1003
+ throw new Error('Parameter `model` is required when calling `searchRecommendRules`.');
1004
+ }
1005
+ const requestPath = '/1/indexes/{indexName}/{model}/recommend/rules/search'
1006
+ .replace('{indexName}', encodeURIComponent(indexName))
1007
+ .replace('{model}', encodeURIComponent(model));
1008
+ const headers = {};
1009
+ const queryParameters = {};
1010
+ const request = {
1011
+ method: 'POST',
1012
+ path: requestPath,
1013
+ queryParameters,
1014
+ headers,
1015
+ data: searchRecommendRulesParams ? searchRecommendRulesParams : {},
1016
+ useReadTransporter: true,
1017
+ cacheable: true,
1018
+ };
1019
+ return transporter.request(request, requestOptions);
1020
+ },
1021
+ };
939
1022
  }
940
1023
 
941
- // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
942
- function recommendClient(appId, apiKey, options) {
943
- if (!appId || typeof appId !== 'string') {
944
- throw new Error('`appId` is missing.');
945
- }
946
- if (!apiKey || typeof apiKey !== 'string') {
947
- throw new Error('`apiKey` is missing.');
948
- }
949
- return createRecommendClient({
950
- appId,
951
- apiKey,
952
- timeouts: {
953
- connect: DEFAULT_CONNECT_TIMEOUT_BROWSER,
954
- read: DEFAULT_READ_TIMEOUT_BROWSER,
955
- write: DEFAULT_WRITE_TIMEOUT_BROWSER,
956
- },
957
- requester: createXhrRequester(),
958
- algoliaAgents: [{ segment: 'Browser' }],
959
- authMode: 'WithinQueryParameters',
960
- responsesCache: createMemoryCache(),
961
- requestsCache: createMemoryCache({ serializable: false }),
962
- hostsCache: createFallbackableCache({
963
- caches: [
964
- createBrowserLocalStorageCache({ key: `${apiClientVersion}-${appId}` }),
965
- createMemoryCache(),
966
- ],
967
- }),
968
- ...options,
969
- });
1024
+ // Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
1025
+ function recommendClient(appId, apiKey, options) {
1026
+ if (!appId || typeof appId !== 'string') {
1027
+ throw new Error('`appId` is missing.');
1028
+ }
1029
+ if (!apiKey || typeof apiKey !== 'string') {
1030
+ throw new Error('`apiKey` is missing.');
1031
+ }
1032
+ return createRecommendClient({
1033
+ appId,
1034
+ apiKey,
1035
+ timeouts: {
1036
+ connect: DEFAULT_CONNECT_TIMEOUT_BROWSER,
1037
+ read: DEFAULT_READ_TIMEOUT_BROWSER,
1038
+ write: DEFAULT_WRITE_TIMEOUT_BROWSER,
1039
+ },
1040
+ requester: createXhrRequester(),
1041
+ algoliaAgents: [{ segment: 'Browser' }],
1042
+ authMode: 'WithinQueryParameters',
1043
+ responsesCache: createMemoryCache(),
1044
+ requestsCache: createMemoryCache({ serializable: false }),
1045
+ hostsCache: createFallbackableCache({
1046
+ caches: [
1047
+ createBrowserLocalStorageCache({ key: `${apiClientVersion}-${appId}` }),
1048
+ createMemoryCache(),
1049
+ ],
1050
+ }),
1051
+ ...options,
1052
+ });
970
1053
  }
971
1054
 
972
1055
  export { apiClientVersion, recommendClient };