algoliasearch 5.9.1 → 5.10.0-beta.1

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 (168) hide show
  1. package/README.md +5 -5
  2. package/dist/algoliasearch.umd.js +7 -7
  3. package/dist/browser.d.ts +5 -5
  4. package/dist/browser.js +3 -3
  5. package/dist/browser.js.map +1 -1
  6. package/dist/browser.min.js +1 -1
  7. package/dist/browser.min.js.map +1 -1
  8. package/dist/fetch.d.ts +5 -5
  9. package/dist/fetch.js +3 -3
  10. package/dist/fetch.js.map +1 -1
  11. package/dist/lite/browser.d.ts +7 -7
  12. package/dist/lite/builds/browser.js +1 -1
  13. package/dist/lite/builds/browser.js.map +1 -1
  14. package/dist/lite/builds/browser.min.js +1 -1
  15. package/dist/lite/builds/browser.min.js.map +1 -1
  16. package/dist/lite/builds/browser.umd.js +1 -1
  17. package/dist/lite/builds/node.cjs +1 -1
  18. package/dist/lite/builds/node.cjs.map +1 -1
  19. package/dist/lite/builds/node.js +1 -1
  20. package/dist/lite/builds/node.js.map +1 -1
  21. package/dist/lite/node.d.cts +7 -7
  22. package/dist/lite/node.d.ts +7 -7
  23. package/dist/lite/src/liteClient.cjs +1 -1
  24. package/dist/lite/src/liteClient.cjs.map +1 -1
  25. package/dist/lite/src/liteClient.js +1 -1
  26. package/dist/lite/src/liteClient.js.map +1 -1
  27. package/dist/node.cjs +3 -3
  28. package/dist/node.cjs.map +1 -1
  29. package/dist/node.d.cts +5 -5
  30. package/dist/node.d.ts +5 -5
  31. package/dist/node.js +3 -3
  32. package/dist/node.js.map +1 -1
  33. package/package.json +17 -19
  34. package/builds/browser.ts +0 -130
  35. package/builds/fetch.ts +0 -130
  36. package/builds/models.ts +0 -250
  37. package/builds/node.ts +0 -130
  38. package/lite/builds/browser.ts +0 -51
  39. package/lite/builds/node.ts +0 -47
  40. package/lite/model/acl.ts +0 -21
  41. package/lite/model/advancedSyntaxFeatures.ts +0 -3
  42. package/lite/model/alternativesAsExact.ts +0 -3
  43. package/lite/model/apiKey.ts +0 -48
  44. package/lite/model/aroundPrecision.ts +0 -8
  45. package/lite/model/aroundRadius.ts +0 -8
  46. package/lite/model/aroundRadiusAll.ts +0 -6
  47. package/lite/model/automaticFacetFilter.ts +0 -21
  48. package/lite/model/automaticFacetFilters.ts +0 -8
  49. package/lite/model/banner.ts +0 -13
  50. package/lite/model/bannerImage.ts +0 -12
  51. package/lite/model/bannerImageUrl.ts +0 -8
  52. package/lite/model/bannerLink.ts +0 -8
  53. package/lite/model/baseGetApiKeyResponse.ts +0 -13
  54. package/lite/model/baseIndexSettings.ts +0 -90
  55. package/lite/model/baseRecommendIndexSettings.ts +0 -184
  56. package/lite/model/baseRecommendRequest.ts +0 -22
  57. package/lite/model/baseRecommendSearchParams.ts +0 -133
  58. package/lite/model/baseSearchParams.ts +0 -6
  59. package/lite/model/baseSearchParamsWithoutQuery.ts +0 -148
  60. package/lite/model/baseSearchResponse.ts +0 -129
  61. package/lite/model/booleanString.ts +0 -3
  62. package/lite/model/boughtTogetherQuery.ts +0 -6
  63. package/lite/model/browsePagination.ts +0 -23
  64. package/lite/model/browseParamsObject.ts +0 -6
  65. package/lite/model/browseResponse.ts +0 -8
  66. package/lite/model/clientMethodProps.ts +0 -63
  67. package/lite/model/consequenceParams.ts +0 -7
  68. package/lite/model/consequenceQuery.ts +0 -8
  69. package/lite/model/consequenceQueryObject.ts +0 -15
  70. package/lite/model/cursor.ts +0 -8
  71. package/lite/model/distinct.ts +0 -6
  72. package/lite/model/edit.ts +0 -17
  73. package/lite/model/editType.ts +0 -6
  74. package/lite/model/errorBase.ts +0 -8
  75. package/lite/model/exactOnSingleWordQuery.ts +0 -6
  76. package/lite/model/exhaustive.ts +0 -31
  77. package/lite/model/facetFilters.ts +0 -6
  78. package/lite/model/facetHits.ts +0 -18
  79. package/lite/model/facetOrdering.ts +0 -16
  80. package/lite/model/facetStats.ts +0 -23
  81. package/lite/model/fallbackParams.ts +0 -5
  82. package/lite/model/fbtModel.ts +0 -6
  83. package/lite/model/frequentlyBoughtTogether.ts +0 -12
  84. package/lite/model/getApiKeyResponse.ts +0 -6
  85. package/lite/model/getRecommendationsParams.ts +0 -13
  86. package/lite/model/getRecommendationsResponse.ts +0 -7
  87. package/lite/model/highlightResult.ts +0 -5
  88. package/lite/model/highlightResultOption.ts +0 -25
  89. package/lite/model/hit.ts +0 -29
  90. package/lite/model/ignorePlurals.ts +0 -9
  91. package/lite/model/index.ts +0 -128
  92. package/lite/model/indexSettings.ts +0 -9
  93. package/lite/model/indexSettingsAsSearchParams.ts +0 -205
  94. package/lite/model/indexSettingsFacets.ts +0 -11
  95. package/lite/model/lookingSimilar.ts +0 -15
  96. package/lite/model/lookingSimilarModel.ts +0 -6
  97. package/lite/model/lookingSimilarQuery.ts +0 -6
  98. package/lite/model/matchLevel.ts +0 -6
  99. package/lite/model/matchedGeoLocation.ts +0 -18
  100. package/lite/model/mode.ts +0 -6
  101. package/lite/model/numericFilters.ts +0 -6
  102. package/lite/model/optionalFilters.ts +0 -6
  103. package/lite/model/params.ts +0 -18
  104. package/lite/model/personalization.ts +0 -18
  105. package/lite/model/queryType.ts +0 -6
  106. package/lite/model/range.ts +0 -16
  107. package/lite/model/rankingInfo.ts +0 -68
  108. package/lite/model/reRankingApplyFilter.ts +0 -6
  109. package/lite/model/recommendHit.ts +0 -34
  110. package/lite/model/recommendIndexSettings.ts +0 -9
  111. package/lite/model/recommendSearchParams.ts +0 -10
  112. package/lite/model/recommendationsHit.ts +0 -7
  113. package/lite/model/recommendationsHits.ts +0 -7
  114. package/lite/model/recommendationsRequest.ts +0 -18
  115. package/lite/model/recommendationsResults.ts +0 -7
  116. package/lite/model/recommendedForYou.ts +0 -10
  117. package/lite/model/recommendedForYouModel.ts +0 -6
  118. package/lite/model/recommendedForYouQuery.ts +0 -6
  119. package/lite/model/redirect.ts +0 -10
  120. package/lite/model/redirectRuleIndexData.ts +0 -8
  121. package/lite/model/redirectRuleIndexMetadata.ts +0 -27
  122. package/lite/model/redirectURL.ts +0 -8
  123. package/lite/model/relatedModel.ts +0 -6
  124. package/lite/model/relatedProducts.ts +0 -15
  125. package/lite/model/relatedQuery.ts +0 -6
  126. package/lite/model/removeStopWords.ts +0 -8
  127. package/lite/model/removeWordsIfNoResults.ts +0 -6
  128. package/lite/model/renderingContent.ts +0 -16
  129. package/lite/model/searchForFacetValuesResponse.ts +0 -20
  130. package/lite/model/searchForFacets.ts +0 -6
  131. package/lite/model/searchForFacetsOptions.ts +0 -27
  132. package/lite/model/searchForHits.ts +0 -6
  133. package/lite/model/searchForHitsOptions.ts +0 -12
  134. package/lite/model/searchHits.ts +0 -20
  135. package/lite/model/searchMethodParams.ts +0 -10
  136. package/lite/model/searchPagination.ts +0 -23
  137. package/lite/model/searchParams.ts +0 -6
  138. package/lite/model/searchParamsObject.ts +0 -9
  139. package/lite/model/searchParamsQuery.ts +0 -8
  140. package/lite/model/searchParamsString.ts +0 -11
  141. package/lite/model/searchQuery.ts +0 -6
  142. package/lite/model/searchResponse.ts +0 -7
  143. package/lite/model/searchResponses.ts +0 -7
  144. package/lite/model/searchResult.ts +0 -6
  145. package/lite/model/searchStrategy.ts +0 -6
  146. package/lite/model/searchTypeDefault.ts +0 -6
  147. package/lite/model/searchTypeFacet.ts +0 -6
  148. package/lite/model/semanticSearch.ts +0 -11
  149. package/lite/model/settingsResponse.ts +0 -6
  150. package/lite/model/snippetResult.ts +0 -5
  151. package/lite/model/snippetResultOption.ts +0 -15
  152. package/lite/model/sortRemainingBy.ts +0 -6
  153. package/lite/model/supportedLanguage.ts +0 -74
  154. package/lite/model/tagFilters.ts +0 -6
  155. package/lite/model/trendingFacetHit.ts +0 -21
  156. package/lite/model/trendingFacets.ts +0 -15
  157. package/lite/model/trendingFacetsModel.ts +0 -6
  158. package/lite/model/trendingFacetsQuery.ts +0 -6
  159. package/lite/model/trendingItems.ts +0 -20
  160. package/lite/model/trendingItemsModel.ts +0 -6
  161. package/lite/model/trendingItemsQuery.ts +0 -6
  162. package/lite/model/typoTolerance.ts +0 -8
  163. package/lite/model/typoToleranceEnum.ts +0 -6
  164. package/lite/model/value.ts +0 -17
  165. package/lite/model/widgets.ts +0 -13
  166. package/lite/model/withPrimary.ts +0 -8
  167. package/lite/src/liteClient.ts +0 -305
  168. package/lite/tsconfig.json +0 -9
@@ -1,7 +0,0 @@
1
- // 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.
2
-
3
- import type { SearchResult } from './searchResult';
4
-
5
- export type SearchResponses<T = Record<string, any>> = {
6
- results: SearchResult<T>[];
7
- };
@@ -1,6 +0,0 @@
1
- // 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.
2
-
3
- import type { SearchForFacetValuesResponse } from './searchForFacetValuesResponse';
4
- import type { SearchResponse } from './searchResponse';
5
-
6
- export type SearchResult<T = Record<string, any>> = SearchResponse<T> | SearchForFacetValuesResponse;
@@ -1,6 +0,0 @@
1
- // 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.
2
-
3
- /**
4
- * Strategy for multiple search queries: - `none`. Run all queries. - `stopIfEnoughMatches`. Run the queries one by one, stopping as soon as a query matches at least the `hitsPerPage` number of results.
5
- */
6
- export type SearchStrategy = 'none' | 'stopIfEnoughMatches';
@@ -1,6 +0,0 @@
1
- // 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.
2
-
3
- /**
4
- * - `default`: perform a search query - `facet` [searches for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values).
5
- */
6
- export type SearchTypeDefault = 'default';
@@ -1,6 +0,0 @@
1
- // 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.
2
-
3
- /**
4
- * - `default`: perform a search query - `facet` [searches for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values).
5
- */
6
- export type SearchTypeFacet = 'facet';
@@ -1,11 +0,0 @@
1
- // 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.
2
-
3
- /**
4
- * Settings for the semantic search part of NeuralSearch. Only used when `mode` is `neuralSearch`.
5
- */
6
- export type SemanticSearch = {
7
- /**
8
- * Indices from which to collect click and conversion events. If null, the current index and all its replicas are used.
9
- */
10
- eventSources?: Array<string> | null;
11
- };
@@ -1,6 +0,0 @@
1
- // 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.
2
-
3
- import type { IndexSettings } from './indexSettings';
4
- import type { WithPrimary } from './withPrimary';
5
-
6
- export type SettingsResponse = IndexSettings & WithPrimary;
@@ -1,5 +0,0 @@
1
- // 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.
2
-
3
- import type { SnippetResultOption } from './snippetResultOption';
4
-
5
- export type SnippetResult = SnippetResultOption | { [key: string]: SnippetResult } | Array<SnippetResult>;
@@ -1,15 +0,0 @@
1
- // 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.
2
-
3
- import type { MatchLevel } from './matchLevel';
4
-
5
- /**
6
- * Snippets that show the context around a matching search query.
7
- */
8
- export type SnippetResultOption = {
9
- /**
10
- * Highlighted attribute value, including HTML tags.
11
- */
12
- value: string;
13
-
14
- matchLevel: MatchLevel;
15
- };
@@ -1,6 +0,0 @@
1
- // 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.
2
-
3
- /**
4
- * Order of facet values that aren\'t explicitly positioned with the `order` setting. - `count`. Order remaining facet values by decreasing count. The count is the number of matching records containing this facet value. - `alpha`. Sort facet values alphabetically. - `hidden`. Don\'t show facet values that aren\'t explicitly positioned.
5
- */
6
- export type SortRemainingBy = 'count' | 'alpha' | 'hidden';
@@ -1,74 +0,0 @@
1
- // 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.
2
-
3
- /**
4
- * ISO code for a supported language.
5
- */
6
- export type SupportedLanguage =
7
- | 'af'
8
- | 'ar'
9
- | 'az'
10
- | 'bg'
11
- | 'bn'
12
- | 'ca'
13
- | 'cs'
14
- | 'cy'
15
- | 'da'
16
- | 'de'
17
- | 'el'
18
- | 'en'
19
- | 'eo'
20
- | 'es'
21
- | 'et'
22
- | 'eu'
23
- | 'fa'
24
- | 'fi'
25
- | 'fo'
26
- | 'fr'
27
- | 'ga'
28
- | 'gl'
29
- | 'he'
30
- | 'hi'
31
- | 'hu'
32
- | 'hy'
33
- | 'id'
34
- | 'is'
35
- | 'it'
36
- | 'ja'
37
- | 'ka'
38
- | 'kk'
39
- | 'ko'
40
- | 'ku'
41
- | 'ky'
42
- | 'lt'
43
- | 'lv'
44
- | 'mi'
45
- | 'mn'
46
- | 'mr'
47
- | 'ms'
48
- | 'mt'
49
- | 'nb'
50
- | 'nl'
51
- | 'no'
52
- | 'ns'
53
- | 'pl'
54
- | 'ps'
55
- | 'pt'
56
- | 'pt-br'
57
- | 'qu'
58
- | 'ro'
59
- | 'ru'
60
- | 'sk'
61
- | 'sq'
62
- | 'sv'
63
- | 'sw'
64
- | 'ta'
65
- | 'te'
66
- | 'th'
67
- | 'tl'
68
- | 'tn'
69
- | 'tr'
70
- | 'tt'
71
- | 'uk'
72
- | 'ur'
73
- | 'uz'
74
- | 'zh';
@@ -1,6 +0,0 @@
1
- // 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.
2
-
3
- /**
4
- * Filter the search by values of the special `_tags` attribute. **Prefer using the `filters` parameter, which supports all filter types and combinations with boolean operators.** Different from regular facets, `_tags` can only be used for filtering (including or excluding records). You won\'t get a facet count. The same combination and escaping rules apply as for `facetFilters`.
5
- */
6
- export type TagFilters = Array<TagFilters> | string;
@@ -1,21 +0,0 @@
1
- // 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.
2
-
3
- /**
4
- * Trending facet hit.
5
- */
6
- export type TrendingFacetHit = {
7
- /**
8
- * Recommendation score.
9
- */
10
- _score?: number;
11
-
12
- /**
13
- * Facet attribute. To be used in combination with `facetValue`. If specified, only recommendations matching the facet filter will be returned.
14
- */
15
- facetName: string;
16
-
17
- /**
18
- * Facet value. To be used in combination with `facetName`. If specified, only recommendations matching the facet filter will be returned.
19
- */
20
- facetValue: string;
21
- };
@@ -1,15 +0,0 @@
1
- // 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.
2
-
3
- import type { FallbackParams } from './fallbackParams';
4
- import type { TrendingFacetsModel } from './trendingFacetsModel';
5
-
6
- export type TrendingFacets = {
7
- /**
8
- * Facet attribute for which to retrieve trending facet values.
9
- */
10
- facetName: any | null;
11
-
12
- model: TrendingFacetsModel;
13
-
14
- fallbackParameters?: FallbackParams;
15
- };
@@ -1,6 +0,0 @@
1
- // 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.
2
-
3
- /**
4
- * Trending facet values model. This model recommends trending facet values for the specified facet attribute.
5
- */
6
- export type TrendingFacetsModel = 'trending-facets';
@@ -1,6 +0,0 @@
1
- // 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.
2
-
3
- import type { BaseRecommendRequest } from './baseRecommendRequest';
4
- import type { TrendingFacets } from './trendingFacets';
5
-
6
- export type TrendingFacetsQuery = BaseRecommendRequest & TrendingFacets;
@@ -1,20 +0,0 @@
1
- // 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.
2
-
3
- import type { FallbackParams } from './fallbackParams';
4
- import type { TrendingItemsModel } from './trendingItemsModel';
5
-
6
- export type TrendingItems = {
7
- /**
8
- * Facet attribute. To be used in combination with `facetValue`. If specified, only recommendations matching the facet filter will be returned.
9
- */
10
- facetName?: string;
11
-
12
- /**
13
- * Facet value. To be used in combination with `facetName`. If specified, only recommendations matching the facet filter will be returned.
14
- */
15
- facetValue?: string;
16
-
17
- model: TrendingItemsModel;
18
-
19
- fallbackParameters?: FallbackParams;
20
- };
@@ -1,6 +0,0 @@
1
- // 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.
2
-
3
- /**
4
- * Trending items model. Trending items are determined from the number of conversion events collected on them.
5
- */
6
- export type TrendingItemsModel = 'trending-items';
@@ -1,6 +0,0 @@
1
- // 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.
2
-
3
- import type { BaseRecommendRequest } from './baseRecommendRequest';
4
- import type { TrendingItems } from './trendingItems';
5
-
6
- export type TrendingItemsQuery = BaseRecommendRequest & TrendingItems;
@@ -1,8 +0,0 @@
1
- // 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.
2
-
3
- import type { TypoToleranceEnum } from './typoToleranceEnum';
4
-
5
- /**
6
- * Whether [typo tolerance](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/typo-tolerance/) is enabled and how it is applied. If typo tolerance is true, `min`, or `strict`, [word splitting and concatenation](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/splitting-and-concatenation/) are also active.
7
- */
8
- export type TypoTolerance = boolean | TypoToleranceEnum;
@@ -1,6 +0,0 @@
1
- // 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.
2
-
3
- /**
4
- * - `min`. Return matches with the lowest number of typos. For example, if you have matches without typos, only include those. But if there are no matches without typos (with 1 typo), include matches with 1 typo (2 typos). - `strict`. Return matches with the two lowest numbers of typos. With `strict`, the Typo ranking criterion is applied first in the `ranking` setting.
5
- */
6
- export type TypoToleranceEnum = 'min' | 'strict';
@@ -1,17 +0,0 @@
1
- // 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.
2
-
3
- import type { SortRemainingBy } from './sortRemainingBy';
4
-
5
- export type Value = {
6
- /**
7
- * Explicit order of facets or facet values. This setting lets you always show specific facets or facet values at the top of the list.
8
- */
9
- order?: Array<string>;
10
-
11
- sortRemainingBy?: SortRemainingBy;
12
-
13
- /**
14
- * Hide facet values.
15
- */
16
- hide?: Array<string>;
17
- };
@@ -1,13 +0,0 @@
1
- // 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.
2
-
3
- import type { Banner } from './banner';
4
-
5
- /**
6
- * widgets returned from any rules that are applied to the current search.
7
- */
8
- export type Widgets = {
9
- /**
10
- * banners defined in the merchandising studio for the given search.
11
- */
12
- banners?: Array<Banner>;
13
- };
@@ -1,8 +0,0 @@
1
- // 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.
2
-
3
- export type WithPrimary = {
4
- /**
5
- * Replica indices only: the name of the primary index for this replica.
6
- */
7
- primary?: string;
8
- };
@@ -1,305 +0,0 @@
1
- // 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.
2
-
3
- import type {
4
- CreateClientOptions,
5
- Headers,
6
- Host,
7
- QueryParameters,
8
- Request,
9
- RequestOptions,
10
- } from '@algolia/client-common';
11
- import { createAuth, createTransporter, getAlgoliaAgent, shuffle } from '@algolia/client-common';
12
-
13
- import type { GetRecommendationsParams } from '../model/getRecommendationsParams';
14
- import type { GetRecommendationsResponse } from '../model/getRecommendationsResponse';
15
- import type { SearchMethodParams } from '../model/searchMethodParams';
16
- import type { SearchResponses } from '../model/searchResponses';
17
-
18
- import type {
19
- CustomPostProps,
20
- LegacyGetRecommendationsParams,
21
- LegacySearchMethodProps,
22
- } from '../model/clientMethodProps';
23
-
24
- import type { SearchForFacetValuesResponse } from '../model/searchForFacetValuesResponse';
25
- import type { SearchResponse } from '../model/searchResponse';
26
-
27
- export const apiClientVersion = '5.9.1';
28
-
29
- function getDefaultHosts(appId: string): Host[] {
30
- return (
31
- [
32
- {
33
- url: `${appId}-dsn.algolia.net`,
34
- accept: 'read',
35
- protocol: 'https',
36
- },
37
- {
38
- url: `${appId}.algolia.net`,
39
- accept: 'write',
40
- protocol: 'https',
41
- },
42
- ] as Host[]
43
- ).concat(
44
- shuffle([
45
- {
46
- url: `${appId}-1.algolianet.com`,
47
- accept: 'readWrite',
48
- protocol: 'https',
49
- },
50
- {
51
- url: `${appId}-2.algolianet.com`,
52
- accept: 'readWrite',
53
- protocol: 'https',
54
- },
55
- {
56
- url: `${appId}-3.algolianet.com`,
57
- accept: 'readWrite',
58
- protocol: 'https',
59
- },
60
- ]),
61
- );
62
- }
63
-
64
- export function createLiteClient({
65
- appId: appIdOption,
66
- apiKey: apiKeyOption,
67
- authMode,
68
- algoliaAgents,
69
- ...options
70
- }: CreateClientOptions) {
71
- const auth = createAuth(appIdOption, apiKeyOption, authMode);
72
- const transporter = createTransporter({
73
- hosts: getDefaultHosts(appIdOption),
74
- ...options,
75
- algoliaAgent: getAlgoliaAgent({
76
- algoliaAgents,
77
- client: 'Lite',
78
- version: apiClientVersion,
79
- }),
80
- baseHeaders: {
81
- 'content-type': 'text/plain',
82
- ...auth.headers(),
83
- ...options.baseHeaders,
84
- },
85
- baseQueryParameters: {
86
- ...auth.queryParameters(),
87
- ...options.baseQueryParameters,
88
- },
89
- });
90
-
91
- return {
92
- transporter,
93
-
94
- /**
95
- * The `appId` currently in use.
96
- */
97
- appId: appIdOption,
98
-
99
- /**
100
- * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
101
- */
102
- clearCache(): Promise<void> {
103
- return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => undefined);
104
- },
105
-
106
- /**
107
- * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
108
- */
109
- get _ua(): string {
110
- return transporter.algoliaAgent.value;
111
- },
112
-
113
- /**
114
- * Adds a `segment` to the `x-algolia-agent` sent with every requests.
115
- *
116
- * @param segment - The algolia agent (user-agent) segment to add.
117
- * @param version - The version of the agent.
118
- */
119
- addAlgoliaAgent(segment: string, version?: string): void {
120
- transporter.algoliaAgent.add({ segment, version });
121
- },
122
-
123
- /**
124
- * Helper method to switch the API key used to authenticate the requests.
125
- *
126
- * @param params - Method params.
127
- * @param params.apiKey - The new API Key to use.
128
- */
129
- setClientApiKey({ apiKey }: { apiKey: string }): void {
130
- if (!authMode || authMode === 'WithinHeaders') {
131
- transporter.baseHeaders['x-algolia-api-key'] = apiKey;
132
- } else {
133
- transporter.baseQueryParameters['x-algolia-api-key'] = apiKey;
134
- }
135
- },
136
-
137
- /**
138
- * Helper: calls the `search` method but with certainty that we will only request Algolia records (hits) and not facets.
139
- * Disclaimer: We don't assert that the parameters you pass to this method only contains `hits` requests to prevent impacting search performances, this helper is purely for typing purposes.
140
- *
141
- * @summary Search multiple indices for `hits`.
142
- * @param searchMethodParams - Query requests and strategies. Results will be received in the same order as the queries.
143
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
144
- */
145
- searchForHits<T>(
146
- searchMethodParams: LegacySearchMethodProps | SearchMethodParams,
147
- requestOptions?: RequestOptions,
148
- ): Promise<{ results: Array<SearchResponse<T>> }> {
149
- return this.search(searchMethodParams, requestOptions) as Promise<{ results: Array<SearchResponse<T>> }>;
150
- },
151
-
152
- /**
153
- * Helper: calls the `search` method but with certainty that we will only request Algolia facets and not records (hits).
154
- * Disclaimer: We don't assert that the parameters you pass to this method only contains `facets` requests to prevent impacting search performances, this helper is purely for typing purposes.
155
- *
156
- * @summary Search multiple indices for `facets`.
157
- * @param searchMethodParams - Query requests and strategies. Results will be received in the same order as the queries.
158
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
159
- */
160
- searchForFacets(
161
- searchMethodParams: LegacySearchMethodProps | SearchMethodParams,
162
- requestOptions?: RequestOptions,
163
- ): Promise<{ results: Array<SearchForFacetValuesResponse> }> {
164
- return this.search(searchMethodParams, requestOptions) as Promise<{
165
- results: Array<SearchForFacetValuesResponse>;
166
- }>;
167
- },
168
- /**
169
- * This method allow you to send requests to the Algolia REST API.
170
- * @param customPost - The customPost object.
171
- * @param customPost.path - Path of the endpoint, anything after \"/1\" must be specified.
172
- * @param customPost.parameters - Query parameters to apply to the current query.
173
- * @param customPost.body - Parameters to send with the custom request.
174
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
175
- */
176
- customPost(
177
- { path, parameters, body }: CustomPostProps,
178
- requestOptions?: RequestOptions,
179
- ): Promise<Record<string, unknown>> {
180
- if (!path) {
181
- throw new Error('Parameter `path` is required when calling `customPost`.');
182
- }
183
-
184
- const requestPath = '/{path}'.replace('{path}', path);
185
- const headers: Headers = {};
186
- const queryParameters: QueryParameters = parameters ? parameters : {};
187
-
188
- const request: Request = {
189
- method: 'POST',
190
- path: requestPath,
191
- queryParameters,
192
- headers,
193
- data: body ? body : {},
194
- };
195
-
196
- return transporter.request(request, requestOptions);
197
- },
198
-
199
- /**
200
- * Retrieves recommendations from selected AI models.
201
- *
202
- * Required API Key ACLs:
203
- * - search
204
- * @param getRecommendationsParams - The getRecommendationsParams object.
205
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
206
- */
207
- getRecommendations(
208
- getRecommendationsParams: GetRecommendationsParams | LegacyGetRecommendationsParams,
209
- requestOptions?: RequestOptions,
210
- ): Promise<GetRecommendationsResponse> {
211
- if (getRecommendationsParams && Array.isArray(getRecommendationsParams)) {
212
- const newSignatureRequest: GetRecommendationsParams = {
213
- requests: getRecommendationsParams,
214
- };
215
-
216
- getRecommendationsParams = newSignatureRequest;
217
- }
218
-
219
- if (!getRecommendationsParams) {
220
- throw new Error('Parameter `getRecommendationsParams` is required when calling `getRecommendations`.');
221
- }
222
-
223
- if (!getRecommendationsParams.requests) {
224
- throw new Error('Parameter `getRecommendationsParams.requests` is required when calling `getRecommendations`.');
225
- }
226
-
227
- const requestPath = '/1/indexes/*/recommendations';
228
- const headers: Headers = {};
229
- const queryParameters: QueryParameters = {};
230
-
231
- const request: Request = {
232
- method: 'POST',
233
- path: requestPath,
234
- queryParameters,
235
- headers,
236
- data: getRecommendationsParams,
237
- useReadTransporter: true,
238
- cacheable: true,
239
- };
240
-
241
- return transporter.request(request, requestOptions);
242
- },
243
-
244
- /**
245
- * Sends multiple search requests to one or more indices. This can be useful in these cases: - Different indices for different purposes, such as, one index for products, another one for marketing content. - Multiple searches to the same index—for example, with different filters.
246
- *
247
- * Required API Key ACLs:
248
- * - search
249
- * @param searchMethodParams - Muli-search request body. Results are returned in the same order as the requests.
250
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
251
- */
252
- search<T>(
253
- searchMethodParams: SearchMethodParams | LegacySearchMethodProps,
254
- requestOptions?: RequestOptions,
255
- ): Promise<SearchResponses<T>> {
256
- if (searchMethodParams && Array.isArray(searchMethodParams)) {
257
- const newSignatureRequest: SearchMethodParams = {
258
- requests: searchMethodParams.map(({ params, ...legacyRequest }) => {
259
- if (legacyRequest.type === 'facet') {
260
- return {
261
- ...legacyRequest,
262
- ...params,
263
- type: 'facet',
264
- };
265
- }
266
-
267
- return {
268
- ...legacyRequest,
269
- ...params,
270
- facet: undefined,
271
- maxFacetHits: undefined,
272
- facetQuery: undefined,
273
- };
274
- }),
275
- };
276
-
277
- searchMethodParams = newSignatureRequest;
278
- }
279
-
280
- if (!searchMethodParams) {
281
- throw new Error('Parameter `searchMethodParams` is required when calling `search`.');
282
- }
283
-
284
- if (!searchMethodParams.requests) {
285
- throw new Error('Parameter `searchMethodParams.requests` is required when calling `search`.');
286
- }
287
-
288
- const requestPath = '/1/indexes/*/queries';
289
- const headers: Headers = {};
290
- const queryParameters: QueryParameters = {};
291
-
292
- const request: Request = {
293
- method: 'POST',
294
- path: requestPath,
295
- queryParameters,
296
- headers,
297
- data: searchMethodParams,
298
- useReadTransporter: true,
299
- cacheable: true,
300
- };
301
-
302
- return transporter.request(request, requestOptions);
303
- },
304
- };
305
- }
@@ -1,9 +0,0 @@
1
- {
2
- "extends": "../tsconfig.json",
3
- "compilerOptions": {
4
- "types": ["node"],
5
- "outDir": "dist/lite"
6
- },
7
- "include": ["builds", "model", "src"],
8
- "exclude": ["dist", "node_modules"]
9
- }