@algolia/client-search 5.0.0-alpha.1 → 5.0.0-alpha.10

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 (296) hide show
  1. package/dist/builds/browser.d.ts +2 -2
  2. package/dist/builds/browser.d.ts.map +1 -1
  3. package/dist/builds/node.d.ts +2 -2
  4. package/dist/builds/node.d.ts.map +1 -1
  5. package/dist/client-search.cjs.js +159 -37
  6. package/dist/client-search.esm.browser.js +192 -68
  7. package/dist/client-search.esm.node.js +160 -38
  8. package/dist/client-search.umd.js +2 -2
  9. package/dist/model/acl.d.ts +3 -0
  10. package/dist/model/acl.d.ts.map +1 -1
  11. package/dist/model/action.d.ts.map +1 -1
  12. package/dist/model/addApiKeyResponse.d.ts +1 -1
  13. package/dist/model/addApiKeyResponse.d.ts.map +1 -1
  14. package/dist/model/advancedSyntaxFeatures.d.ts.map +1 -1
  15. package/dist/model/alternativesAsExact.d.ts.map +1 -1
  16. package/dist/model/anchoring.d.ts.map +1 -1
  17. package/dist/model/apiKey.d.ts.map +1 -1
  18. package/dist/model/aroundRadius.d.ts.map +1 -1
  19. package/dist/model/aroundRadiusAll.d.ts.map +1 -1
  20. package/dist/model/assignUserIdParams.d.ts.map +1 -1
  21. package/dist/model/attributeToUpdate.d.ts +3 -0
  22. package/dist/model/attributeToUpdate.d.ts.map +1 -0
  23. package/dist/model/automaticFacetFilter.d.ts.map +1 -1
  24. package/dist/model/automaticFacetFilters.d.ts.map +1 -1
  25. package/dist/model/baseGetApiKeyResponse.d.ts +11 -0
  26. package/dist/model/baseGetApiKeyResponse.d.ts.map +1 -0
  27. package/dist/model/baseIndexSettings.d.ts.map +1 -1
  28. package/dist/model/baseSearchParams.d.ts.map +1 -1
  29. package/dist/model/baseSearchParamsWithoutQuery.d.ts.map +1 -1
  30. package/dist/model/baseSearchResponse.d.ts +3 -3
  31. package/dist/model/baseSearchResponse.d.ts.map +1 -1
  32. package/dist/model/batchAssignUserIdsParams.d.ts.map +1 -1
  33. package/dist/model/batchDictionaryEntriesParams.d.ts.map +1 -1
  34. package/dist/model/batchDictionaryEntriesRequest.d.ts.map +1 -1
  35. package/dist/model/batchParams.d.ts +2 -2
  36. package/dist/model/batchParams.d.ts.map +1 -1
  37. package/dist/model/batchRequest.d.ts +9 -0
  38. package/dist/model/batchRequest.d.ts.map +1 -0
  39. package/dist/model/batchResponse.d.ts.map +1 -1
  40. package/dist/model/batchWriteParams.d.ts +2 -2
  41. package/dist/model/batchWriteParams.d.ts.map +1 -1
  42. package/dist/model/browseParams.d.ts +4 -0
  43. package/dist/model/browseParams.d.ts.map +1 -0
  44. package/dist/model/browseParamsObject.d.ts +4 -0
  45. package/dist/model/browseParamsObject.d.ts.map +1 -0
  46. package/dist/model/browseResponse.d.ts +2 -2
  47. package/dist/model/browseResponse.d.ts.map +1 -1
  48. package/dist/model/builtInOperation.d.ts.map +1 -1
  49. package/dist/model/builtInOperationType.d.ts.map +1 -1
  50. package/dist/model/clientMethodProps.d.ts +25 -14
  51. package/dist/model/clientMethodProps.d.ts.map +1 -1
  52. package/dist/model/condition.d.ts.map +1 -1
  53. package/dist/model/consequence.d.ts.map +1 -1
  54. package/dist/model/consequenceHide.d.ts.map +1 -1
  55. package/dist/model/consequenceParams.d.ts.map +1 -1
  56. package/dist/model/consequenceQuery.d.ts.map +1 -1
  57. package/dist/model/consequenceQueryObject.d.ts.map +1 -1
  58. package/dist/model/createdAtResponse.d.ts.map +1 -1
  59. package/dist/model/{baseBrowseResponse.d.ts → cursor.d.ts} +3 -3
  60. package/dist/model/cursor.d.ts.map +1 -0
  61. package/dist/model/deleteApiKeyResponse.d.ts.map +1 -1
  62. package/dist/model/deleteSourceResponse.d.ts.map +1 -1
  63. package/dist/model/deletedAtResponse.d.ts.map +1 -1
  64. package/dist/model/dictionaryAction.d.ts.map +1 -1
  65. package/dist/model/dictionaryEntry.d.ts.map +1 -1
  66. package/dist/model/dictionaryEntryState.d.ts.map +1 -1
  67. package/dist/model/dictionaryLanguage.d.ts.map +1 -1
  68. package/dist/model/dictionarySettingsParams.d.ts.map +1 -1
  69. package/dist/model/dictionaryType.d.ts.map +1 -1
  70. package/dist/model/distinct.d.ts +5 -0
  71. package/dist/model/distinct.d.ts.map +1 -0
  72. package/dist/model/edit.d.ts.map +1 -1
  73. package/dist/model/editType.d.ts.map +1 -1
  74. package/dist/model/errorBase.d.ts.map +1 -1
  75. package/dist/model/exactOnSingleWordQuery.d.ts.map +1 -1
  76. package/dist/model/facetFilters.d.ts.map +1 -1
  77. package/dist/model/facetHits.d.ts.map +1 -1
  78. package/dist/model/facetOrdering.d.ts.map +1 -1
  79. package/dist/model/facets.d.ts.map +1 -1
  80. package/dist/model/facetsStats.d.ts.map +1 -1
  81. package/dist/model/fetchedIndex.d.ts.map +1 -1
  82. package/dist/model/getApiKeyResponse.d.ts +4 -0
  83. package/dist/model/getApiKeyResponse.d.ts.map +1 -0
  84. package/dist/model/getDictionarySettingsResponse.d.ts.map +1 -1
  85. package/dist/model/getLogsResponse.d.ts.map +1 -1
  86. package/dist/model/getObjectsParams.d.ts +2 -2
  87. package/dist/model/getObjectsParams.d.ts.map +1 -1
  88. package/dist/model/{multipleGetObjectsParams.d.ts → getObjectsRequest.d.ts} +2 -2
  89. package/dist/model/getObjectsRequest.d.ts.map +1 -0
  90. package/dist/model/getObjectsResponse.d.ts +2 -2
  91. package/dist/model/getObjectsResponse.d.ts.map +1 -1
  92. package/dist/model/getTaskResponse.d.ts.map +1 -1
  93. package/dist/model/getTopUserIdsResponse.d.ts.map +1 -1
  94. package/dist/model/hasPendingMappingsResponse.d.ts.map +1 -1
  95. package/dist/model/highlightResult.d.ts.map +1 -1
  96. package/dist/model/highlightResultOption.d.ts.map +1 -1
  97. package/dist/model/hit.d.ts +1 -1
  98. package/dist/model/hit.d.ts.map +1 -1
  99. package/dist/model/ignorePlurals.d.ts.map +1 -1
  100. package/dist/model/index.d.ts +10 -8
  101. package/dist/model/index.d.ts.map +1 -1
  102. package/dist/model/indexSettings.d.ts.map +1 -1
  103. package/dist/model/indexSettingsAsSearchParams.d.ts +4 -2
  104. package/dist/model/indexSettingsAsSearchParams.d.ts.map +1 -1
  105. package/dist/model/languages.d.ts.map +1 -1
  106. package/dist/model/listApiKeysResponse.d.ts +2 -2
  107. package/dist/model/listApiKeysResponse.d.ts.map +1 -1
  108. package/dist/model/listClustersResponse.d.ts.map +1 -1
  109. package/dist/model/listIndicesResponse.d.ts +1 -1
  110. package/dist/model/listIndicesResponse.d.ts.map +1 -1
  111. package/dist/model/listUserIdsResponse.d.ts.map +1 -1
  112. package/dist/model/log.d.ts.map +1 -1
  113. package/dist/model/logQuery.d.ts.map +1 -1
  114. package/dist/model/logType.d.ts.map +1 -1
  115. package/dist/model/matchLevel.d.ts.map +1 -1
  116. package/dist/model/matchedGeoLocation.d.ts.map +1 -1
  117. package/dist/model/mixedSearchFilters.d.ts.map +1 -1
  118. package/dist/model/{multipleBatchOperation.d.ts → multipleBatchRequest.d.ts} +5 -5
  119. package/dist/model/multipleBatchRequest.d.ts.map +1 -0
  120. package/dist/model/multipleBatchResponse.d.ts +2 -2
  121. package/dist/model/multipleBatchResponse.d.ts.map +1 -1
  122. package/dist/model/numericFilters.d.ts.map +1 -1
  123. package/dist/model/operationIndexParams.d.ts.map +1 -1
  124. package/dist/model/operationType.d.ts.map +1 -1
  125. package/dist/model/optionalFilters.d.ts.map +1 -1
  126. package/dist/model/params.d.ts.map +1 -1
  127. package/dist/model/personalization.d.ts.map +1 -1
  128. package/dist/model/promote.d.ts.map +1 -1
  129. package/dist/model/promoteObjectID.d.ts.map +1 -1
  130. package/dist/model/promoteObjectIDs.d.ts.map +1 -1
  131. package/dist/model/queryType.d.ts.map +1 -1
  132. package/dist/model/rankingInfo.d.ts.map +1 -1
  133. package/dist/model/reRankingApplyFilter.d.ts.map +1 -1
  134. package/dist/model/removeStopWords.d.ts.map +1 -1
  135. package/dist/model/removeUserIdResponse.d.ts.map +1 -1
  136. package/dist/model/removeWordsIfNoResults.d.ts.map +1 -1
  137. package/dist/model/renderingContent.d.ts.map +1 -1
  138. package/dist/model/replaceSourceResponse.d.ts.map +1 -1
  139. package/dist/model/rule.d.ts.map +1 -1
  140. package/dist/model/saveObjectResponse.d.ts +2 -2
  141. package/dist/model/saveObjectResponse.d.ts.map +1 -1
  142. package/dist/model/saveSynonymResponse.d.ts.map +1 -1
  143. package/dist/model/scopeType.d.ts.map +1 -1
  144. package/dist/model/searchDictionaryEntriesParams.d.ts.map +1 -1
  145. package/dist/model/searchForFacetValuesRequest.d.ts.map +1 -1
  146. package/dist/model/searchForFacetValuesResponse.d.ts.map +1 -1
  147. package/dist/model/searchForFacets.d.ts.map +1 -1
  148. package/dist/model/searchForFacetsOptions.d.ts.map +1 -1
  149. package/dist/model/searchForHits.d.ts.map +1 -1
  150. package/dist/model/searchForHitsOptions.d.ts.map +1 -1
  151. package/dist/model/searchHits.d.ts +2 -2
  152. package/dist/model/searchHits.d.ts.map +1 -1
  153. package/dist/model/searchMethodParams.d.ts.map +1 -1
  154. package/dist/model/searchParams.d.ts.map +1 -1
  155. package/dist/model/searchParamsObject.d.ts.map +1 -1
  156. package/dist/model/searchParamsQuery.d.ts.map +1 -1
  157. package/dist/model/searchParamsString.d.ts.map +1 -1
  158. package/dist/model/searchQuery.d.ts.map +1 -1
  159. package/dist/model/searchResponse.d.ts +1 -1
  160. package/dist/model/searchResponse.d.ts.map +1 -1
  161. package/dist/model/searchResponses.d.ts +1 -1
  162. package/dist/model/searchResponses.d.ts.map +1 -1
  163. package/dist/model/searchRulesParams.d.ts.map +1 -1
  164. package/dist/model/searchRulesResponse.d.ts.map +1 -1
  165. package/dist/model/searchStrategy.d.ts.map +1 -1
  166. package/dist/model/searchSynonymsParams.d.ts.map +1 -1
  167. package/dist/model/searchSynonymsResponse.d.ts.map +1 -1
  168. package/dist/model/searchTypeDefault.d.ts.map +1 -1
  169. package/dist/model/searchTypeFacet.d.ts.map +1 -1
  170. package/dist/model/searchUserIdsParams.d.ts.map +1 -1
  171. package/dist/model/searchUserIdsResponse.d.ts.map +1 -1
  172. package/dist/model/snippetResult.d.ts.map +1 -1
  173. package/dist/model/snippetResultOption.d.ts.map +1 -1
  174. package/dist/model/sortRemainingBy.d.ts.map +1 -1
  175. package/dist/model/source.d.ts.map +1 -1
  176. package/dist/model/standardEntries.d.ts.map +1 -1
  177. package/dist/model/synonymHit.d.ts.map +1 -1
  178. package/dist/model/synonymHitHighlightResult.d.ts.map +1 -1
  179. package/dist/model/synonymType.d.ts.map +1 -1
  180. package/dist/model/tagFilters.d.ts.map +1 -1
  181. package/dist/model/taskStatus.d.ts.map +1 -1
  182. package/dist/model/timeRange.d.ts.map +1 -1
  183. package/dist/model/typoTolerance.d.ts.map +1 -1
  184. package/dist/model/typoToleranceEnum.d.ts.map +1 -1
  185. package/dist/model/updateApiKeyResponse.d.ts +1 -1
  186. package/dist/model/updateApiKeyResponse.d.ts.map +1 -1
  187. package/dist/model/updatedAtResponse.d.ts.map +1 -1
  188. package/dist/model/updatedAtWithObjectIdResponse.d.ts.map +1 -1
  189. package/dist/model/updatedRuleResponse.d.ts.map +1 -1
  190. package/dist/model/userHighlightResult.d.ts.map +1 -1
  191. package/dist/model/userHit.d.ts.map +1 -1
  192. package/dist/model/userId.d.ts.map +1 -1
  193. package/dist/model/value.d.ts.map +1 -1
  194. package/dist/src/searchClient.d.ts +72 -22
  195. package/dist/src/searchClient.d.ts.map +1 -1
  196. package/model/acl.ts +3 -0
  197. package/model/addApiKeyResponse.ts +2 -1
  198. package/model/apiKey.ts +7 -0
  199. package/model/{attributeOrBuiltInOperation.ts → attributeToUpdate.ts} +1 -1
  200. package/model/automaticFacetFilter.ts +2 -0
  201. package/model/baseGetApiKeyResponse.ts +13 -0
  202. package/model/baseIndexSettings.ts +13 -0
  203. package/model/baseSearchParamsWithoutQuery.ts +32 -0
  204. package/model/baseSearchResponse.ts +27 -3
  205. package/model/batchAssignUserIdsParams.ts +1 -0
  206. package/model/batchDictionaryEntriesParams.ts +1 -0
  207. package/model/batchDictionaryEntriesRequest.ts +1 -0
  208. package/model/batchParams.ts +2 -2
  209. package/model/{batchOperation.ts → batchRequest.ts} +4 -3
  210. package/model/batchResponse.ts +1 -0
  211. package/model/batchWriteParams.ts +2 -2
  212. package/model/browseParams.ts +6 -0
  213. package/model/browseParamsObject.ts +6 -0
  214. package/model/browseResponse.ts +3 -3
  215. package/model/builtInOperation.ts +1 -0
  216. package/model/clientMethodProps.ts +30 -19
  217. package/model/condition.ts +3 -0
  218. package/model/consequence.ts +4 -0
  219. package/model/consequenceQueryObject.ts +1 -0
  220. package/model/{baseBrowseResponse.ts → cursor.ts} +2 -2
  221. package/model/deletedAtResponse.ts +1 -0
  222. package/model/dictionaryEntry.ts +5 -0
  223. package/model/{createdAtObject.ts → distinct.ts} +4 -6
  224. package/model/edit.ts +2 -0
  225. package/model/facetHits.ts +2 -0
  226. package/model/facetOrdering.ts +1 -0
  227. package/model/facetsStats.ts +3 -0
  228. package/model/fetchedIndex.ts +10 -0
  229. package/model/{key.ts → getApiKeyResponse.ts} +2 -2
  230. package/model/getObjectsParams.ts +2 -2
  231. package/model/{multipleGetObjectsParams.ts → getObjectsRequest.ts} +3 -1
  232. package/model/getObjectsResponse.ts +2 -2
  233. package/model/hasPendingMappingsResponse.ts +1 -0
  234. package/model/highlightResultOption.ts +3 -0
  235. package/model/hit.ts +5 -1
  236. package/model/index.ts +10 -8
  237. package/model/indexSettingsAsSearchParams.ts +46 -2
  238. package/model/languages.ts +2 -0
  239. package/model/listApiKeysResponse.ts +2 -2
  240. package/model/listIndicesResponse.ts +2 -1
  241. package/model/log.ts +14 -0
  242. package/model/logQuery.ts +2 -0
  243. package/model/matchedGeoLocation.ts +2 -0
  244. package/model/{multipleBatchOperation.ts → multipleBatchRequest.ts} +6 -4
  245. package/model/multipleBatchResponse.ts +3 -2
  246. package/model/operationIndexParams.ts +2 -0
  247. package/model/params.ts +3 -0
  248. package/model/personalization.ts +2 -0
  249. package/model/promoteObjectID.ts +1 -0
  250. package/model/promoteObjectIDs.ts +1 -0
  251. package/model/rankingInfo.ts +12 -0
  252. package/model/rule.ts +5 -0
  253. package/model/saveObjectResponse.ts +4 -2
  254. package/model/saveSynonymResponse.ts +2 -0
  255. package/model/searchDictionaryEntriesParams.ts +3 -0
  256. package/model/searchForFacetValuesRequest.ts +2 -0
  257. package/model/searchForFacetsOptions.ts +4 -0
  258. package/model/searchForHitsOptions.ts +1 -0
  259. package/model/searchHits.ts +2 -2
  260. package/model/searchMethodParams.ts +1 -0
  261. package/model/searchResponse.ts +2 -1
  262. package/model/searchResponses.ts +1 -1
  263. package/model/searchRulesParams.ts +6 -0
  264. package/model/searchRulesResponse.ts +3 -0
  265. package/model/searchSynonymsResponse.ts +1 -0
  266. package/model/searchUserIdsParams.ts +3 -0
  267. package/model/searchUserIdsResponse.ts +4 -0
  268. package/model/snippetResultOption.ts +1 -0
  269. package/model/source.ts +1 -0
  270. package/model/standardEntries.ts +2 -0
  271. package/model/synonymHit.ts +8 -0
  272. package/model/synonymHitHighlightResult.ts +1 -0
  273. package/model/timeRange.ts +1 -0
  274. package/model/updateApiKeyResponse.ts +2 -1
  275. package/model/updatedAtResponse.ts +1 -0
  276. package/model/updatedAtWithObjectIdResponse.ts +2 -0
  277. package/model/updatedRuleResponse.ts +2 -0
  278. package/model/userHighlightResult.ts +1 -0
  279. package/model/userHit.ts +5 -0
  280. package/model/userId.ts +3 -0
  281. package/model/value.ts +1 -0
  282. package/package.json +8 -6
  283. package/dist/model/attributeOrBuiltInOperation.d.ts +0 -3
  284. package/dist/model/attributeOrBuiltInOperation.d.ts.map +0 -1
  285. package/dist/model/baseBrowseResponse.d.ts.map +0 -1
  286. package/dist/model/batchOperation.d.ts +0 -9
  287. package/dist/model/batchOperation.d.ts.map +0 -1
  288. package/dist/model/browseRequest.d.ts +0 -11
  289. package/dist/model/browseRequest.d.ts.map +0 -1
  290. package/dist/model/createdAtObject.d.ts +0 -7
  291. package/dist/model/createdAtObject.d.ts.map +0 -1
  292. package/dist/model/key.d.ts +0 -4
  293. package/dist/model/key.d.ts.map +0 -1
  294. package/dist/model/multipleBatchOperation.d.ts.map +0 -1
  295. package/dist/model/multipleGetObjectsParams.d.ts.map +0 -1
  296. package/model/browseRequest.ts +0 -12
@@ -1,6 +1,6 @@
1
- import type { InitClientOptions } from '@algolia/client-common';
1
+ import type { ClientOptions } from '@algolia/client-common';
2
2
  import type { SearchClient } from '../src/searchClient';
3
3
  export { apiClientVersion, SearchClient } from '../src/searchClient';
4
4
  export * from '../model';
5
- export declare function searchClient(appId: string, apiKey: string, options?: InitClientOptions): SearchClient;
5
+ export declare function searchClient(appId: string, apiKey: string, options?: ClientOptions): SearchClient;
6
6
  //# sourceMappingURL=browser.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../../../packages/client-search/builds/browser.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAYhE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACrE,cAAc,UAAU,CAAC;AAEzB,wBAAgB,YAAY,CAC1B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,iBAAiB,GAC1B,YAAY,CA8Bd"}
1
+ {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../builds/browser.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAY5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACrE,cAAc,UAAU,CAAC;AAEzB,wBAAgB,YAAY,CAC1B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,aAAa,GACtB,YAAY,CA8Bd"}
@@ -1,6 +1,6 @@
1
- import type { InitClientOptions } from '@algolia/client-common';
1
+ import type { ClientOptions } from '@algolia/client-common';
2
2
  import type { SearchClient } from '../src/searchClient';
3
3
  export { apiClientVersion, SearchClient } from '../src/searchClient';
4
4
  export * from '../model';
5
- export declare function searchClient(appId: string, apiKey: string, options?: InitClientOptions): SearchClient;
5
+ export declare function searchClient(appId: string, apiKey: string, options?: ClientOptions): SearchClient;
6
6
  //# sourceMappingURL=node.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../../packages/client-search/builds/node.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAWhE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACrE,cAAc,UAAU,CAAC;AAEzB,wBAAgB,YAAY,CAC1B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,iBAAiB,GAC1B,YAAY,CAwBd"}
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../builds/node.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAW5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACrE,cAAc,UAAU,CAAC;AAEzB,wBAAgB,YAAY,CAC1B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,aAAa,GACtB,YAAY,CAwBd"}
@@ -6,7 +6,7 @@ var clientCommon = require('@algolia/client-common');
6
6
  var requesterNodeHttp = require('@algolia/requester-node-http');
7
7
 
8
8
  // This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
9
- const apiClientVersion = '5.0.0-alpha.1';
9
+ const apiClientVersion = '5.0.0-alpha.10';
10
10
  function getDefaultHosts(appId) {
11
11
  return [
12
12
  {
@@ -60,6 +60,19 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
60
60
  });
61
61
  return {
62
62
  transporter,
63
+ /**
64
+ * The `appId` currently in use.
65
+ */
66
+ appId: appIdOption,
67
+ /**
68
+ * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
69
+ */
70
+ clearCache() {
71
+ return Promise.all([
72
+ transporter.requestsCache.clear(),
73
+ transporter.responsesCache.clear(),
74
+ ]).then(() => undefined);
75
+ },
63
76
  /**
64
77
  * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
65
78
  */
@@ -76,38 +89,57 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
76
89
  transporter.algoliaAgent.add({ segment, version });
77
90
  },
78
91
  /**
79
- * Helper: Wait for a task to complete with `indexName` and `taskID`.
92
+ * Helper: Wait for a task to be published (completed) for a given `indexName` and `taskID`.
80
93
  *
81
- * @summary Wait for a task to complete.
94
+ * @summary Helper method that waits for a task to be published (completed).
82
95
  * @param waitForTaskOptions - The waitForTaskOptions object.
83
96
  * @param waitForTaskOptions.indexName - The `indexName` where the operation was performed.
84
97
  * @param waitForTaskOptions.taskID - The `taskID` returned in the method response.
98
+ * @param waitForTaskOptions.maxRetries - The maximum number of retries. 50 by default.
99
+ * @param waitForTaskOptions.timeout - The function to decide how long to wait between retries.
85
100
  * @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `getTask` method and merged with the transporter requestOptions.
86
101
  */
87
- waitForTask({ indexName, taskID, ...createRetryablePromiseOptions }, requestOptions) {
88
- return clientCommon.createRetryablePromise({
89
- ...createRetryablePromiseOptions,
102
+ waitForTask({ indexName, taskID, maxRetries = 50, timeout = (retryCount) => Math.min(retryCount * 200, 5000), }, requestOptions) {
103
+ let retryCount = 0;
104
+ return clientCommon.createIterablePromise({
90
105
  func: () => this.getTask({ indexName, taskID }, requestOptions),
91
106
  validate: (response) => response.status === 'published',
107
+ aggregator: () => (retryCount += 1),
108
+ error: {
109
+ validate: () => retryCount >= maxRetries,
110
+ message: () => `The maximum number of retries exceeded. (${retryCount}/${maxRetries})`,
111
+ },
112
+ timeout: () => timeout(retryCount),
92
113
  });
93
114
  },
94
115
  /**
95
116
  * Helper: Wait for an API key to be added, updated or deleted based on a given `operation`.
96
117
  *
97
- * @summary Wait for an API key task to be processed.
118
+ * @summary Helper method that waits for an API key task to be processed.
98
119
  * @param waitForApiKeyOptions - The waitForApiKeyOptions object.
99
120
  * @param waitForApiKeyOptions.operation - The `operation` that was done on a `key`.
100
121
  * @param waitForApiKeyOptions.key - The `key` that has been added, deleted or updated.
101
122
  * @param waitForApiKeyOptions.apiKey - Necessary to know if an `update` operation has been processed, compare fields of the response with it.
123
+ * @param waitForApiKeyOptions.maxRetries - The maximum number of retries. 50 by default.
124
+ * @param waitForApiKeyOptions.timeout - The function to decide how long to wait between retries.
102
125
  * @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `getApikey` method and merged with the transporter requestOptions.
103
126
  */
104
- waitForApiKey({ operation, key, apiKey, ...createRetryablePromiseOptions }, requestOptions) {
127
+ waitForApiKey({ operation, key, apiKey, maxRetries = 50, timeout = (retryCount) => Math.min(retryCount * 200, 5000), }, requestOptions) {
128
+ let retryCount = 0;
129
+ const baseIteratorOptions = {
130
+ aggregator: () => (retryCount += 1),
131
+ error: {
132
+ validate: () => retryCount >= maxRetries,
133
+ message: () => `The maximum number of retries exceeded. (${retryCount}/${maxRetries})`,
134
+ },
135
+ timeout: () => timeout(retryCount),
136
+ };
105
137
  if (operation === 'update') {
106
138
  if (!apiKey) {
107
139
  throw new Error('`apiKey` is required when waiting for an `update` operation.');
108
140
  }
109
- return clientCommon.createRetryablePromise({
110
- ...createRetryablePromiseOptions,
141
+ return clientCommon.createIterablePromise({
142
+ ...baseIteratorOptions,
111
143
  func: () => this.getApiKey({ key }, requestOptions),
112
144
  validate: (response) => {
113
145
  for (const field of Object.keys(apiKey)) {
@@ -125,12 +157,99 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
125
157
  },
126
158
  });
127
159
  }
128
- return clientCommon.createRetryablePromise({
129
- ...createRetryablePromiseOptions,
160
+ return clientCommon.createIterablePromise({
161
+ ...baseIteratorOptions,
130
162
  func: () => this.getApiKey({ key }, requestOptions).catch((error) => error),
131
163
  validate: (error) => operation === 'add' ? error.status !== 404 : error.status === 404,
132
164
  });
133
165
  },
166
+ /**
167
+ * Helper: Iterate on the `browse` method of the client to allow aggregating objects of an index.
168
+ *
169
+ * @summary Helper method that iterates on the `browse` method.
170
+ * @param browseObjects - The browseObjects object.
171
+ * @param browseObjects.indexName - The index in which to perform the request.
172
+ * @param browseObjects.browseParams - The `browse` parameters.
173
+ * @param browseObjects.validate - The validator function. It receive the resolved return of the API call. By default, stops when there is no `cursor` in the response.
174
+ * @param browseObjects.aggregator - The function that runs right after the API call has been resolved, allows you to do anything with the response before `validate`.
175
+ * @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `browse` method and merged with the transporter requestOptions.
176
+ */
177
+ browseObjects({ indexName, browseParams, ...browseObjectsOptions }, requestOptions) {
178
+ return clientCommon.createIterablePromise({
179
+ func: (previousResponse) => {
180
+ return this.browse({
181
+ indexName,
182
+ browseParams: {
183
+ cursor: previousResponse ? previousResponse.cursor : undefined,
184
+ ...browseParams,
185
+ },
186
+ }, requestOptions);
187
+ },
188
+ validate: (response) => response.cursor === undefined,
189
+ ...browseObjectsOptions,
190
+ });
191
+ },
192
+ /**
193
+ * Helper: Iterate on the `searchRules` method of the client to allow aggregating rules of an index.
194
+ *
195
+ * @summary Helper method that iterates on the `searchRules` method.
196
+ * @param browseObjects - The browseObjects object.
197
+ * @param browseObjects.indexName - The index in which to perform the request.
198
+ * @param browseObjects.searchRulesParams - The `searchRules` method parameters.
199
+ * @param browseObjects.validate - The validator function. It receive the resolved return of the API call. By default, stops when there is less hits returned than the number of maximum hits (1000).
200
+ * @param browseObjects.aggregator - The function that runs right after the API call has been resolved, allows you to do anything with the response before `validate`.
201
+ * @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `searchRules` method and merged with the transporter requestOptions.
202
+ */
203
+ browseRules({ indexName, searchRulesParams, ...browseRulesOptions }, requestOptions) {
204
+ const params = {
205
+ hitsPerPage: 1000,
206
+ ...searchRulesParams,
207
+ };
208
+ return clientCommon.createIterablePromise({
209
+ func: (previousResponse) => {
210
+ return this.searchRules({
211
+ indexName,
212
+ searchRulesParams: {
213
+ ...params,
214
+ page: previousResponse
215
+ ? previousResponse.page + 1
216
+ : params.page || 0,
217
+ },
218
+ }, requestOptions);
219
+ },
220
+ validate: (response) => response.nbHits < params.hitsPerPage,
221
+ ...browseRulesOptions,
222
+ });
223
+ },
224
+ /**
225
+ * Helper: Iterate on the `searchSynonyms` method of the client to allow aggregating rules of an index.
226
+ *
227
+ * @summary Helper method that iterates on the `searchSynonyms` method.
228
+ * @param browseObjects - The browseObjects object.
229
+ * @param browseObjects.indexName - The index in which to perform the request.
230
+ * @param browseObjects.validate - The validator function. It receive the resolved return of the API call. By default, stops when there is less hits returned than the number of maximum hits (1000).
231
+ * @param browseObjects.aggregator - The function that runs right after the API call has been resolved, allows you to do anything with the response before `validate`.
232
+ * @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `searchSynonyms` method and merged with the transporter requestOptions.
233
+ */
234
+ browseSynonyms({ indexName, validate, aggregator, ...browseSynonymsOptions }, requestOptions) {
235
+ const params = {
236
+ hitsPerPage: 1000,
237
+ ...browseSynonymsOptions,
238
+ };
239
+ return clientCommon.createIterablePromise({
240
+ func: (previousResponse) => {
241
+ return this.searchSynonyms({
242
+ ...params,
243
+ indexName,
244
+ page: previousResponse
245
+ ? previousResponse.page + 1
246
+ : browseSynonymsOptions.page || 0,
247
+ }, requestOptions);
248
+ },
249
+ validate: (response) => response.nbHits < params.hitsPerPage,
250
+ ...browseSynonymsOptions,
251
+ });
252
+ },
134
253
  /**
135
254
  * Add a new API Key with specific permissions/restrictions.
136
255
  *
@@ -264,6 +383,9 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
264
383
  if (!batchWriteParams) {
265
384
  throw new Error('Parameter `batchWriteParams` is required when calling `batch`.');
266
385
  }
386
+ if (!batchWriteParams.requests) {
387
+ throw new Error('Parameter `batchWriteParams.requests` is required when calling `batch`.');
388
+ }
267
389
  const requestPath = '/1/indexes/{indexName}/batch'.replace('{indexName}', encodeURIComponent(indexName));
268
390
  const headers = {};
269
391
  const queryParameters = {};
@@ -350,10 +472,10 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
350
472
  * @summary Retrieve all index content.
351
473
  * @param browse - The browse object.
352
474
  * @param browse.indexName - The index in which to perform the request.
353
- * @param browse.browseRequest - The browseRequest object.
475
+ * @param browse.browseParams - The browseParams object.
354
476
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
355
477
  */
356
- browse({ indexName, browseRequest }, requestOptions) {
478
+ browse({ indexName, browseParams }, requestOptions) {
357
479
  if (!indexName) {
358
480
  throw new Error('Parameter `indexName` is required when calling `browse`.');
359
481
  }
@@ -365,7 +487,7 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
365
487
  path: requestPath,
366
488
  queryParameters,
367
489
  headers,
368
- data: browseRequest ? browseRequest : {},
490
+ data: browseParams ? browseParams : {},
369
491
  };
370
492
  return transporter.request(request, requestOptions);
371
493
  },
@@ -756,7 +878,7 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
756
878
  * @param getLogs.type - Type of log entries to retrieve. When omitted, all log entries are retrieved.
757
879
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
758
880
  */
759
- getLogs({ offset, length, indexName, type }, requestOptions) {
881
+ getLogs({ offset, length, indexName, type } = {}, requestOptions = undefined) {
760
882
  const requestPath = '/1/logs';
761
883
  const headers = {};
762
884
  const queryParameters = {};
@@ -824,6 +946,9 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
824
946
  if (!getObjectsParams) {
825
947
  throw new Error('Parameter `getObjectsParams` is required when calling `getObjects`.');
826
948
  }
949
+ if (!getObjectsParams.requests) {
950
+ throw new Error('Parameter `getObjectsParams.requests` is required when calling `getObjects`.');
951
+ }
827
952
  const requestPath = '/1/indexes/*/objects';
828
953
  const headers = {};
829
954
  const queryParameters = {};
@@ -1015,7 +1140,7 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
1015
1140
  * @param hasPendingMappings.getClusters - If the clusters pending mapping state should be on the response.
1016
1141
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1017
1142
  */
1018
- hasPendingMappings({ getClusters }, requestOptions) {
1143
+ hasPendingMappings({ getClusters } = {}, requestOptions = undefined) {
1019
1144
  const requestPath = '/1/clusters/mapping/pending';
1020
1145
  const headers = {};
1021
1146
  const queryParameters = {};
@@ -1074,7 +1199,7 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
1074
1199
  * @param listIndices.page - Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination).
1075
1200
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1076
1201
  */
1077
- listIndices({ page }, requestOptions) {
1202
+ listIndices({ page } = {}, requestOptions = undefined) {
1078
1203
  const requestPath = '/1/indexes';
1079
1204
  const headers = {};
1080
1205
  const queryParameters = {};
@@ -1098,7 +1223,7 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
1098
1223
  * @param listUserIds.hitsPerPage - Maximum number of objects to retrieve.
1099
1224
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1100
1225
  */
1101
- listUserIds({ page, hitsPerPage }, requestOptions) {
1226
+ listUserIds({ page, hitsPerPage } = {}, requestOptions = undefined) {
1102
1227
  const requestPath = '/1/clusters/mapping';
1103
1228
  const headers = {};
1104
1229
  const queryParameters = {};
@@ -1127,6 +1252,9 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
1127
1252
  if (!batchParams) {
1128
1253
  throw new Error('Parameter `batchParams` is required when calling `multipleBatch`.');
1129
1254
  }
1255
+ if (!batchParams.requests) {
1256
+ throw new Error('Parameter `batchParams.requests` is required when calling `multipleBatch`.');
1257
+ }
1130
1258
  const requestPath = '/1/indexes/*/batch';
1131
1259
  const headers = {};
1132
1260
  const queryParameters = {};
@@ -1180,19 +1308,19 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
1180
1308
  * @param partialUpdateObject - The partialUpdateObject object.
1181
1309
  * @param partialUpdateObject.indexName - The index in which to perform the request.
1182
1310
  * @param partialUpdateObject.objectID - Unique identifier of an object.
1183
- * @param partialUpdateObject.attributeOrBuiltInOperation - List of attributes to update.
1311
+ * @param partialUpdateObject.attributesToUpdate - Map of attribute(s) to update.
1184
1312
  * @param partialUpdateObject.createIfNotExists - Creates the record if it does not exist yet.
1185
1313
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1186
1314
  */
1187
- partialUpdateObject({ indexName, objectID, attributeOrBuiltInOperation, createIfNotExists, }, requestOptions) {
1315
+ partialUpdateObject({ indexName, objectID, attributesToUpdate, createIfNotExists, }, requestOptions) {
1188
1316
  if (!indexName) {
1189
1317
  throw new Error('Parameter `indexName` is required when calling `partialUpdateObject`.');
1190
1318
  }
1191
1319
  if (!objectID) {
1192
1320
  throw new Error('Parameter `objectID` is required when calling `partialUpdateObject`.');
1193
1321
  }
1194
- if (!attributeOrBuiltInOperation) {
1195
- throw new Error('Parameter `attributeOrBuiltInOperation` is required when calling `partialUpdateObject`.');
1322
+ if (!attributesToUpdate) {
1323
+ throw new Error('Parameter `attributesToUpdate` is required when calling `partialUpdateObject`.');
1196
1324
  }
1197
1325
  const requestPath = '/1/indexes/{indexName}/{objectID}/partial'
1198
1326
  .replace('{indexName}', encodeURIComponent(indexName))
@@ -1207,7 +1335,7 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
1207
1335
  path: requestPath,
1208
1336
  queryParameters,
1209
1337
  headers,
1210
- data: attributeOrBuiltInOperation,
1338
+ data: attributesToUpdate,
1211
1339
  };
1212
1340
  return transporter.request(request, requestOptions);
1213
1341
  },
@@ -1408,17 +1536,17 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
1408
1536
  * @summary Save a batch of rules.
1409
1537
  * @param saveRules - The saveRules object.
1410
1538
  * @param saveRules.indexName - The index in which to perform the request.
1411
- * @param saveRules.rule - The rule object.
1539
+ * @param saveRules.rules - The rules object.
1412
1540
  * @param saveRules.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName.
1413
1541
  * @param saveRules.clearExistingRules - When true, existing Rules are cleared before adding this batch. When false, existing Rules are kept.
1414
1542
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1415
1543
  */
1416
- saveRules({ indexName, rule, forwardToReplicas, clearExistingRules, }, requestOptions) {
1544
+ saveRules({ indexName, rules, forwardToReplicas, clearExistingRules, }, requestOptions) {
1417
1545
  if (!indexName) {
1418
1546
  throw new Error('Parameter `indexName` is required when calling `saveRules`.');
1419
1547
  }
1420
- if (!rule) {
1421
- throw new Error('Parameter `rule` is required when calling `saveRules`.');
1548
+ if (!rules) {
1549
+ throw new Error('Parameter `rules` is required when calling `saveRules`.');
1422
1550
  }
1423
1551
  const requestPath = '/1/indexes/{indexName}/rules/batch'.replace('{indexName}', encodeURIComponent(indexName));
1424
1552
  const headers = {};
@@ -1434,7 +1562,7 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
1434
1562
  path: requestPath,
1435
1563
  queryParameters,
1436
1564
  headers,
1437
- data: rule,
1565
+ data: rules,
1438
1566
  };
1439
1567
  return transporter.request(request, requestOptions);
1440
1568
  },
@@ -1645,9 +1773,6 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
1645
1773
  if (!indexName) {
1646
1774
  throw new Error('Parameter `indexName` is required when calling `searchRules`.');
1647
1775
  }
1648
- if (!searchRulesParams) {
1649
- throw new Error('Parameter `searchRulesParams` is required when calling `searchRules`.');
1650
- }
1651
1776
  const requestPath = '/1/indexes/{indexName}/rules/search'.replace('{indexName}', encodeURIComponent(indexName));
1652
1777
  const headers = {};
1653
1778
  const queryParameters = {};
@@ -1656,7 +1781,7 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
1656
1781
  path: requestPath,
1657
1782
  queryParameters,
1658
1783
  headers,
1659
- data: searchRulesParams,
1784
+ data: searchRulesParams ? searchRulesParams : {},
1660
1785
  useReadTransporter: true,
1661
1786
  cacheable: true,
1662
1787
  };
@@ -1675,9 +1800,6 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
1675
1800
  if (!indexName) {
1676
1801
  throw new Error('Parameter `indexName` is required when calling `searchSingleIndex`.');
1677
1802
  }
1678
- if (!searchParams) {
1679
- throw new Error('Parameter `searchParams` is required when calling `searchSingleIndex`.');
1680
- }
1681
1803
  const requestPath = '/1/indexes/{indexName}/query'.replace('{indexName}', encodeURIComponent(indexName));
1682
1804
  const headers = {};
1683
1805
  const queryParameters = {};
@@ -1686,7 +1808,7 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
1686
1808
  path: requestPath,
1687
1809
  queryParameters,
1688
1810
  headers,
1689
- data: searchParams,
1811
+ data: searchParams ? searchParams : {},
1690
1812
  useReadTransporter: true,
1691
1813
  cacheable: true,
1692
1814
  };