@algolia/client-query-suggestions 5.52.1 → 5.54.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/browser.d.ts +16 -1
- package/dist/builds/browser.js +14 -38
- package/dist/builds/browser.js.map +1 -1
- package/dist/builds/browser.min.js +5 -1
- package/dist/builds/browser.min.js.map +1 -1
- package/dist/builds/browser.umd.js +7 -3
- package/dist/builds/fetch.js +14 -38
- package/dist/builds/fetch.js.map +1 -1
- package/dist/builds/node.cjs +13 -37
- package/dist/builds/node.cjs.map +1 -1
- package/dist/builds/node.js +14 -38
- package/dist/builds/node.js.map +1 -1
- package/dist/builds/worker.js +14 -38
- package/dist/builds/worker.js.map +1 -1
- package/dist/fetch.d.ts +16 -1
- package/dist/node.d.cts +16 -1
- package/dist/node.d.ts +16 -1
- package/dist/src/querySuggestionsClient.cjs +13 -37
- package/dist/src/querySuggestionsClient.cjs.map +1 -1
- package/dist/src/querySuggestionsClient.js +14 -38
- package/dist/src/querySuggestionsClient.js.map +1 -1
- package/dist/worker.d.ts +16 -1
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -40,11 +40,11 @@ All of our clients comes with type definition, and are available for both browse
|
|
|
40
40
|
### With a package manager
|
|
41
41
|
|
|
42
42
|
```bash
|
|
43
|
-
yarn add @algolia/client-query-suggestions@5.
|
|
43
|
+
yarn add @algolia/client-query-suggestions@5.54.0
|
|
44
44
|
# or
|
|
45
|
-
npm install @algolia/client-query-suggestions@5.
|
|
45
|
+
npm install @algolia/client-query-suggestions@5.54.0
|
|
46
46
|
# or
|
|
47
|
-
pnpm add @algolia/client-query-suggestions@5.
|
|
47
|
+
pnpm add @algolia/client-query-suggestions@5.54.0
|
|
48
48
|
```
|
|
49
49
|
|
|
50
50
|
### Without a package manager
|
|
@@ -52,7 +52,7 @@ pnpm add @algolia/client-query-suggestions@5.52.1
|
|
|
52
52
|
Add the following JavaScript snippet to the <head> of your website:
|
|
53
53
|
|
|
54
54
|
```html
|
|
55
|
-
<script src="https://cdn.jsdelivr.net/npm/@algolia/client-query-suggestions@5.
|
|
55
|
+
<script src="https://cdn.jsdelivr.net/npm/@algolia/client-query-suggestions@5.54.0/dist/builds/browser.umd.js"></script>
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
### Usage
|
package/dist/browser.d.ts
CHANGED
|
@@ -73,7 +73,13 @@ type SourceIndex = {
|
|
|
73
73
|
* If true, Query Suggestions uses all replica indices to find popular searches. If false, only the primary index is used.
|
|
74
74
|
*/
|
|
75
75
|
replicas?: boolean | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* Analytics tags for filtering the popular searches. For more information, see [Segment your analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments).
|
|
78
|
+
*/
|
|
76
79
|
analyticsTags?: Array<string> | null | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* Facets to use as top categories with your suggestions. If provided, Query Suggestions adds the top facet values to each suggestion.
|
|
82
|
+
*/
|
|
77
83
|
facets?: Array<Facet> | null | undefined;
|
|
78
84
|
/**
|
|
79
85
|
* Minimum number of hits required to be included as a suggestion. A search query must at least generate `minHits` search results to be included in the Query Suggestions index.
|
|
@@ -83,7 +89,13 @@ type SourceIndex = {
|
|
|
83
89
|
* Minimum letters required to be included as a suggestion. A search query must be at least `minLetters` long to be included in the Query Suggestions index.
|
|
84
90
|
*/
|
|
85
91
|
minLetters?: number | undefined;
|
|
92
|
+
/**
|
|
93
|
+
* Facets used for generating query suggestions from facet values. For example, if you set `generate: [\"color\", \"brand\"]`, combinations from the facet values are added as query suggestions, such as \"blue adidas\", \"red adidas\", \"blue nike\", \"red nike\", etc. You can include nested lists.
|
|
94
|
+
*/
|
|
86
95
|
generate?: Array<Array<string>> | null | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* Algolia indices with popular searches to use as query suggestions. Records of these indices must have these attributes: - `query`: search query which will be added as a suggestion - `count`: measure of popularity of that search query For example, you can export popular searches from an external analytics provider, such as Google Analytics or Adobe Analytics, and feed this data into an Algolia index. You can use this index to generate query suggestions until your Algolia Analytics has collected enough data.
|
|
98
|
+
*/
|
|
87
99
|
external?: Array<string> | null | undefined;
|
|
88
100
|
};
|
|
89
101
|
|
|
@@ -96,6 +108,9 @@ type Configuration = {
|
|
|
96
108
|
*/
|
|
97
109
|
sourceIndices: Array<SourceIndex>;
|
|
98
110
|
languages?: Languages | undefined;
|
|
111
|
+
/**
|
|
112
|
+
* Words or regular expressions to exclude from the suggestions.
|
|
113
|
+
*/
|
|
99
114
|
exclude?: Array<string> | null | undefined;
|
|
100
115
|
/**
|
|
101
116
|
* Whether to turn on personalized query suggestions.
|
|
@@ -253,7 +268,7 @@ type UpdateConfigProps = {
|
|
|
253
268
|
configuration: Configuration;
|
|
254
269
|
};
|
|
255
270
|
|
|
256
|
-
declare const apiClientVersion = "5.
|
|
271
|
+
declare const apiClientVersion = "5.54.0";
|
|
257
272
|
declare const REGIONS: readonly ["eu", "us"];
|
|
258
273
|
type Region = (typeof REGIONS)[number];
|
|
259
274
|
type RegionOptions = {
|
package/dist/builds/browser.js
CHANGED
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
import { createXhrRequester } from "@algolia/requester-browser-xhr";
|
|
9
9
|
|
|
10
10
|
// src/querySuggestionsClient.ts
|
|
11
|
-
import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
|
|
12
|
-
var apiClientVersion = "5.
|
|
11
|
+
import { createAuth, createTransporter, getAlgoliaAgent, validateRequired } from "@algolia/client-common";
|
|
12
|
+
var apiClientVersion = "5.54.0";
|
|
13
13
|
var REGIONS = ["eu", "us"];
|
|
14
14
|
function getDefaultHosts(region) {
|
|
15
15
|
const url = "query-suggestions.{region}.algolia.com".replace("{region}", region);
|
|
@@ -95,9 +95,7 @@ function createQuerySuggestionsClient({
|
|
|
95
95
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
96
96
|
*/
|
|
97
97
|
createConfig(configurationWithIndex, requestOptions) {
|
|
98
|
-
|
|
99
|
-
throw new Error("Parameter `configurationWithIndex` is required when calling `createConfig`.");
|
|
100
|
-
}
|
|
98
|
+
validateRequired("configurationWithIndex", "createConfig", configurationWithIndex);
|
|
101
99
|
const requestPath = "/1/configs";
|
|
102
100
|
const headers = {};
|
|
103
101
|
const queryParameters = {};
|
|
@@ -118,9 +116,7 @@ function createQuerySuggestionsClient({
|
|
|
118
116
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
119
117
|
*/
|
|
120
118
|
customDelete({ path, parameters }, requestOptions) {
|
|
121
|
-
|
|
122
|
-
throw new Error("Parameter `path` is required when calling `customDelete`.");
|
|
123
|
-
}
|
|
119
|
+
validateRequired("path", "customDelete", path);
|
|
124
120
|
const requestPath = "/{path}".replace("{path}", path);
|
|
125
121
|
const headers = {};
|
|
126
122
|
const queryParameters = parameters ? parameters : {};
|
|
@@ -140,9 +136,7 @@ function createQuerySuggestionsClient({
|
|
|
140
136
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
141
137
|
*/
|
|
142
138
|
customGet({ path, parameters }, requestOptions) {
|
|
143
|
-
|
|
144
|
-
throw new Error("Parameter `path` is required when calling `customGet`.");
|
|
145
|
-
}
|
|
139
|
+
validateRequired("path", "customGet", path);
|
|
146
140
|
const requestPath = "/{path}".replace("{path}", path);
|
|
147
141
|
const headers = {};
|
|
148
142
|
const queryParameters = parameters ? parameters : {};
|
|
@@ -163,9 +157,7 @@ function createQuerySuggestionsClient({
|
|
|
163
157
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
164
158
|
*/
|
|
165
159
|
customPost({ path, parameters, body }, requestOptions) {
|
|
166
|
-
|
|
167
|
-
throw new Error("Parameter `path` is required when calling `customPost`.");
|
|
168
|
-
}
|
|
160
|
+
validateRequired("path", "customPost", path);
|
|
169
161
|
const requestPath = "/{path}".replace("{path}", path);
|
|
170
162
|
const headers = {};
|
|
171
163
|
const queryParameters = parameters ? parameters : {};
|
|
@@ -187,9 +179,7 @@ function createQuerySuggestionsClient({
|
|
|
187
179
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
188
180
|
*/
|
|
189
181
|
customPut({ path, parameters, body }, requestOptions) {
|
|
190
|
-
|
|
191
|
-
throw new Error("Parameter `path` is required when calling `customPut`.");
|
|
192
|
-
}
|
|
182
|
+
validateRequired("path", "customPut", path);
|
|
193
183
|
const requestPath = "/{path}".replace("{path}", path);
|
|
194
184
|
const headers = {};
|
|
195
185
|
const queryParameters = parameters ? parameters : {};
|
|
@@ -212,9 +202,7 @@ function createQuerySuggestionsClient({
|
|
|
212
202
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
213
203
|
*/
|
|
214
204
|
deleteConfig({ indexName }, requestOptions) {
|
|
215
|
-
|
|
216
|
-
throw new Error("Parameter `indexName` is required when calling `deleteConfig`.");
|
|
217
|
-
}
|
|
205
|
+
validateRequired("indexName", "deleteConfig", indexName);
|
|
218
206
|
const requestPath = "/1/configs/{indexName}".replace("{indexName}", encodeURIComponent(indexName));
|
|
219
207
|
const headers = {};
|
|
220
208
|
const queryParameters = {};
|
|
@@ -255,9 +243,7 @@ function createQuerySuggestionsClient({
|
|
|
255
243
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
256
244
|
*/
|
|
257
245
|
getConfig({ indexName }, requestOptions) {
|
|
258
|
-
|
|
259
|
-
throw new Error("Parameter `indexName` is required when calling `getConfig`.");
|
|
260
|
-
}
|
|
246
|
+
validateRequired("indexName", "getConfig", indexName);
|
|
261
247
|
const requestPath = "/1/configs/{indexName}".replace("{indexName}", encodeURIComponent(indexName));
|
|
262
248
|
const headers = {};
|
|
263
249
|
const queryParameters = {};
|
|
@@ -279,9 +265,7 @@ function createQuerySuggestionsClient({
|
|
|
279
265
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
280
266
|
*/
|
|
281
267
|
getConfigStatus({ indexName }, requestOptions) {
|
|
282
|
-
|
|
283
|
-
throw new Error("Parameter `indexName` is required when calling `getConfigStatus`.");
|
|
284
|
-
}
|
|
268
|
+
validateRequired("indexName", "getConfigStatus", indexName);
|
|
285
269
|
const requestPath = "/1/configs/{indexName}/status".replace("{indexName}", encodeURIComponent(indexName));
|
|
286
270
|
const headers = {};
|
|
287
271
|
const queryParameters = {};
|
|
@@ -303,9 +287,7 @@ function createQuerySuggestionsClient({
|
|
|
303
287
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
304
288
|
*/
|
|
305
289
|
getLogFile({ indexName }, requestOptions) {
|
|
306
|
-
|
|
307
|
-
throw new Error("Parameter `indexName` is required when calling `getLogFile`.");
|
|
308
|
-
}
|
|
290
|
+
validateRequired("indexName", "getLogFile", indexName);
|
|
309
291
|
const requestPath = "/1/logs/{indexName}".replace("{indexName}", encodeURIComponent(indexName));
|
|
310
292
|
const headers = {};
|
|
311
293
|
const queryParameters = {};
|
|
@@ -328,15 +310,9 @@ function createQuerySuggestionsClient({
|
|
|
328
310
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
329
311
|
*/
|
|
330
312
|
updateConfig({ indexName, configuration }, requestOptions) {
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
if (!configuration) {
|
|
335
|
-
throw new Error("Parameter `configuration` is required when calling `updateConfig`.");
|
|
336
|
-
}
|
|
337
|
-
if (!configuration.sourceIndices) {
|
|
338
|
-
throw new Error("Parameter `configuration.sourceIndices` is required when calling `updateConfig`.");
|
|
339
|
-
}
|
|
313
|
+
validateRequired("indexName", "updateConfig", indexName);
|
|
314
|
+
validateRequired("configuration", "updateConfig", configuration);
|
|
315
|
+
validateRequired("configuration.sourceIndices", "updateConfig", configuration.sourceIndices);
|
|
340
316
|
const requestPath = "/1/configs/{indexName}".replace("{indexName}", encodeURIComponent(indexName));
|
|
341
317
|
const headers = {};
|
|
342
318
|
const queryParameters = {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../builds/browser.ts","../../src/querySuggestionsClient.ts"],"sourcesContent":["// 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.\n\nimport {\n createBrowserLocalStorageCache,\n createFallbackableCache,\n createMemoryCache,\n createNullLogger,\n} from '@algolia/client-common';\nimport { createXhrRequester } from '@algolia/requester-browser-xhr';\n\nimport type { ClientOptions } from '@algolia/client-common';\n\nimport { apiClientVersion, createQuerySuggestionsClient } from '../src/querySuggestionsClient';\n\nimport type { Region } from '../src/querySuggestionsClient';\nimport { REGIONS } from '../src/querySuggestionsClient';\n\nexport type { Region, RegionOptions } from '../src/querySuggestionsClient';\n\nexport { apiClientVersion } from '../src/querySuggestionsClient';\n\nexport * from '../model';\n\nexport function querySuggestionsClient(\n appId: string,\n apiKey: string,\n region: Region,\n options?: ClientOptions | undefined,\n): QuerySuggestionsClient {\n if (!appId || typeof appId !== 'string') {\n throw new Error('`appId` is missing.');\n }\n\n if (!apiKey || typeof apiKey !== 'string') {\n throw new Error('`apiKey` is missing.');\n }\n\n if (!region || (region && (typeof region !== 'string' || !REGIONS.includes(region)))) {\n throw new Error(`\\`region\\` is required and must be one of the following: ${REGIONS.join(', ')}`);\n }\n\n const { compression: _compression, ...browserOptions } = options || {};\n\n return createQuerySuggestionsClient({\n appId,\n apiKey,\n region,\n timeouts: {\n connect: 1000,\n read: 2000,\n write: 30000,\n },\n logger: createNullLogger(),\n requester: createXhrRequester(),\n algoliaAgents: [{ segment: 'Browser' }],\n authMode: 'WithinQueryParameters',\n responsesCache: createMemoryCache(),\n requestsCache: createMemoryCache({ serializable: false }),\n hostsCache: createFallbackableCache({\n caches: [createBrowserLocalStorageCache({ key: `${apiClientVersion}-${appId}` }), createMemoryCache()],\n }),\n ...browserOptions,\n });\n}\n\nexport type QuerySuggestionsClient = ReturnType<typeof createQuerySuggestionsClient>;\n","// 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.\n\nimport type {\n CreateClientOptions,\n Headers,\n Host,\n QueryParameters,\n Request,\n RequestOptions,\n} from '@algolia/client-common';\nimport { createAuth, createTransporter, getAlgoliaAgent } from '@algolia/client-common';\n\nimport type { BaseResponse } from '../model/baseResponse';\nimport type { ConfigStatus } from '../model/configStatus';\nimport type { ConfigurationResponse } from '../model/configurationResponse';\nimport type { ConfigurationWithIndex } from '../model/configurationWithIndex';\nimport type { LogFile } from '../model/logFile';\n\nimport type {\n CustomDeleteProps,\n CustomGetProps,\n CustomPostProps,\n CustomPutProps,\n DeleteConfigProps,\n GetConfigProps,\n GetConfigStatusProps,\n GetLogFileProps,\n UpdateConfigProps,\n} from '../model/clientMethodProps';\n\nexport const apiClientVersion = '5.52.1';\n\nexport const REGIONS = ['eu', 'us'] as const;\nexport type Region = (typeof REGIONS)[number];\nexport type RegionOptions = { region: Region };\n\nfunction getDefaultHosts(region: Region): Host[] {\n const url = 'query-suggestions.{region}.algolia.com'.replace('{region}', region);\n\n return [{ url, accept: 'readWrite', protocol: 'https' }];\n}\n\nexport function createQuerySuggestionsClient({\n appId: appIdOption,\n apiKey: apiKeyOption,\n authMode,\n algoliaAgents,\n region: regionOption,\n ...options\n}: CreateClientOptions & RegionOptions) {\n const auth = createAuth(appIdOption, apiKeyOption, authMode);\n const transporter = createTransporter({\n hosts: getDefaultHosts(regionOption),\n ...options,\n algoliaAgent: getAlgoliaAgent({\n algoliaAgents,\n client: 'QuerySuggestions',\n version: apiClientVersion,\n }),\n baseHeaders: {\n 'content-type': 'text/plain',\n ...auth.headers(),\n ...options.baseHeaders,\n },\n baseQueryParameters: {\n ...auth.queryParameters(),\n ...options.baseQueryParameters,\n },\n });\n\n return {\n transporter,\n\n /**\n * The `appId` currently in use.\n */\n appId: appIdOption,\n\n /**\n * The `apiKey` currently in use.\n */\n apiKey: apiKeyOption,\n\n /**\n * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.\n */\n clearCache(): Promise<void> {\n return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => undefined);\n },\n\n /**\n * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.\n */\n get _ua(): string {\n return transporter.algoliaAgent.value;\n },\n\n /**\n * Adds a `segment` to the `x-algolia-agent` sent with every requests.\n *\n * @param segment - The algolia agent (user-agent) segment to add.\n * @param version - The version of the agent.\n */\n addAlgoliaAgent(segment: string, version?: string | undefined): void {\n transporter.algoliaAgent.add({ segment, version });\n },\n\n /**\n * Helper method to switch the API key used to authenticate the requests.\n *\n * @param params - Method params.\n * @param params.apiKey - The new API Key to use.\n */\n setClientApiKey({ apiKey }: { apiKey: string }): void {\n if (!authMode || authMode === 'WithinHeaders') {\n transporter.baseHeaders['x-algolia-api-key'] = apiKey;\n } else {\n transporter.baseQueryParameters['x-algolia-api-key'] = apiKey;\n }\n },\n\n /**\n * Creates a new Query Suggestions configuration. You can have up to 100 configurations per Algolia application.\n *\n * Required API Key ACLs:\n * - editSettings\n * @param configurationWithIndex - The configurationWithIndex object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n createConfig(\n configurationWithIndex: ConfigurationWithIndex,\n requestOptions?: RequestOptions,\n ): Promise<BaseResponse> {\n if (!configurationWithIndex) {\n throw new Error('Parameter `configurationWithIndex` is required when calling `createConfig`.');\n }\n\n const requestPath = '/1/configs';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: configurationWithIndex,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customDelete - The customDelete object.\n * @param customDelete.path - Path of the endpoint, for example `1/newFeature`.\n * @param customDelete.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customDelete(\n { path, parameters }: CustomDeleteProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customDelete`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customGet - The customGet object.\n * @param customGet.path - Path of the endpoint, for example `1/newFeature`.\n * @param customGet.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customGet`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customPost - The customPost object.\n * @param customPost.path - Path of the endpoint, for example `1/newFeature`.\n * @param customPost.parameters - Query parameters to apply to the current query.\n * @param customPost.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPost(\n { path, parameters, body }: CustomPostProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customPost`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customPut - The customPut object.\n * @param customPut.path - Path of the endpoint, for example `1/newFeature`.\n * @param customPut.parameters - Query parameters to apply to the current query.\n * @param customPut.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPut(\n { path, parameters, body }: CustomPutProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customPut`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'PUT',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Deletes a Query Suggestions configuration. Deleting only removes the configuration and stops updates to the Query Suggestions index. To delete the Query Suggestions index itself, use the Search API and the `Delete an index` operation.\n *\n * Required API Key ACLs:\n * - editSettings\n * @param deleteConfig - The deleteConfig object.\n * @param deleteConfig.indexName - Query Suggestions index name.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n deleteConfig({ indexName }: DeleteConfigProps, requestOptions?: RequestOptions): Promise<BaseResponse> {\n if (!indexName) {\n throw new Error('Parameter `indexName` is required when calling `deleteConfig`.');\n }\n\n const requestPath = '/1/configs/{indexName}'.replace('{indexName}', encodeURIComponent(indexName));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves all Query Suggestions configurations of your Algolia application.\n *\n * Required API Key ACLs:\n * - settings\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getAllConfigs(requestOptions?: RequestOptions | undefined): Promise<Array<ConfigurationResponse>> {\n const requestPath = '/1/configs';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves a single Query Suggestions configuration by its index name.\n *\n * Required API Key ACLs:\n * - settings\n * @param getConfig - The getConfig object.\n * @param getConfig.indexName - Query Suggestions index name.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getConfig({ indexName }: GetConfigProps, requestOptions?: RequestOptions): Promise<ConfigurationResponse> {\n if (!indexName) {\n throw new Error('Parameter `indexName` is required when calling `getConfig`.');\n }\n\n const requestPath = '/1/configs/{indexName}'.replace('{indexName}', encodeURIComponent(indexName));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Reports the status of a Query Suggestions index.\n *\n * Required API Key ACLs:\n * - settings\n * @param getConfigStatus - The getConfigStatus object.\n * @param getConfigStatus.indexName - Query Suggestions index name.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getConfigStatus({ indexName }: GetConfigStatusProps, requestOptions?: RequestOptions): Promise<ConfigStatus> {\n if (!indexName) {\n throw new Error('Parameter `indexName` is required when calling `getConfigStatus`.');\n }\n\n const requestPath = '/1/configs/{indexName}/status'.replace('{indexName}', encodeURIComponent(indexName));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves the logs for a single Query Suggestions index.\n *\n * Required API Key ACLs:\n * - settings\n * @param getLogFile - The getLogFile object.\n * @param getLogFile.indexName - Query Suggestions index name.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getLogFile({ indexName }: GetLogFileProps, requestOptions?: RequestOptions): Promise<LogFile> {\n if (!indexName) {\n throw new Error('Parameter `indexName` is required when calling `getLogFile`.');\n }\n\n const requestPath = '/1/logs/{indexName}'.replace('{indexName}', encodeURIComponent(indexName));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Updates a QuerySuggestions configuration.\n *\n * Required API Key ACLs:\n * - editSettings\n * @param updateConfig - The updateConfig object.\n * @param updateConfig.indexName - Query Suggestions index name.\n * @param updateConfig.configuration - The configuration object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n updateConfig(\n { indexName, configuration }: UpdateConfigProps,\n requestOptions?: RequestOptions,\n ): Promise<BaseResponse> {\n if (!indexName) {\n throw new Error('Parameter `indexName` is required when calling `updateConfig`.');\n }\n\n if (!configuration) {\n throw new Error('Parameter `configuration` is required when calling `updateConfig`.');\n }\n\n if (!configuration.sourceIndices) {\n throw new Error('Parameter `configuration.sourceIndices` is required when calling `updateConfig`.');\n }\n\n const requestPath = '/1/configs/{indexName}'.replace('{indexName}', encodeURIComponent(indexName));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'PUT',\n path: requestPath,\n queryParameters,\n headers,\n data: configuration,\n };\n\n return transporter.request(request, requestOptions);\n },\n };\n}\n"],"mappings":";AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,0BAA0B;;;ACEnC,SAAS,YAAY,mBAAmB,uBAAuB;AAoBxD,IAAM,mBAAmB;AAEzB,IAAM,UAAU,CAAC,MAAM,IAAI;AAIlC,SAAS,gBAAgB,QAAwB;AAC/C,QAAM,MAAM,yCAAyC,QAAQ,YAAY,MAAM;AAE/E,SAAO,CAAC,EAAE,KAAK,QAAQ,aAAa,UAAU,QAAQ,CA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AW,YAAY,CAAC,QAAQ,SAAS,MAAM,IAAK;AACpF,UAAM,IAAI,MAAM,4DAA4D,QAAQ,KAAK,IAAI,CAAC,EAAE;AAAA,EAClG;AAEA,QAAM,EAAE,aAAa,cAAc,GAAG,eAAe,IAAI,WAAW,CAAC;AAErE,SAAO,6BAA6B;AAAA,IAClC;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU;AAAA,MACR,SAAS;AAAA,MACT,MAAM;AAAA,MACN,OAAO;AAAA,IACT;AAAA,IACA,QAAQ,iBAAiB;AAAA,IACzB,WAAW,mBAAmB;AAAA,IAC9B,eAAe,CAAC,EAAE,SAAS,UAAU,CAAC;AAAA,IACtC,UAAU;AAAA,IACV,gBAAgB,kBAAkB;AAAA,IAClC,eAAe,kBAAkB,EAAE,cAAc,MAAM,CAAC;AAAA,IACxD,YAAY,wBAAwB;AAAA,MAClC,QAAQ,CAAC,+BAA+B,EAAE,KAAK,GAAG,gBAAgB,IAAI,KAAK,GAAG,CAAC,GAAG,kBAAkB,CAAC;AAAA,IACvG,CAAC;AAAA,IACD,GAAG;AAAA,EACL,CAAC;AACH;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../builds/browser.ts","../../src/querySuggestionsClient.ts"],"sourcesContent":["// 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.\n\nimport {\n createBrowserLocalStorageCache,\n createFallbackableCache,\n createMemoryCache,\n createNullLogger,\n} from '@algolia/client-common';\nimport { createXhrRequester } from '@algolia/requester-browser-xhr';\n\nimport type { ClientOptions } from '@algolia/client-common';\n\nimport { apiClientVersion, createQuerySuggestionsClient } from '../src/querySuggestionsClient';\n\nimport type { Region } from '../src/querySuggestionsClient';\nimport { REGIONS } from '../src/querySuggestionsClient';\n\nexport type { Region, RegionOptions } from '../src/querySuggestionsClient';\n\nexport { apiClientVersion } from '../src/querySuggestionsClient';\n\nexport * from '../model';\n\nexport function querySuggestionsClient(\n appId: string,\n apiKey: string,\n region: Region,\n options?: ClientOptions | undefined,\n): QuerySuggestionsClient {\n if (!appId || typeof appId !== 'string') {\n throw new Error('`appId` is missing.');\n }\n\n if (!apiKey || typeof apiKey !== 'string') {\n throw new Error('`apiKey` is missing.');\n }\n\n if (!region || (region && (typeof region !== 'string' || !REGIONS.includes(region)))) {\n throw new Error(`\\`region\\` is required and must be one of the following: ${REGIONS.join(', ')}`);\n }\n\n const { compression: _compression, ...browserOptions } = options || {};\n\n return createQuerySuggestionsClient({\n appId,\n apiKey,\n region,\n timeouts: {\n connect: 1000,\n read: 2000,\n write: 30000,\n },\n logger: createNullLogger(),\n requester: createXhrRequester(),\n algoliaAgents: [{ segment: 'Browser' }],\n authMode: 'WithinQueryParameters',\n responsesCache: createMemoryCache(),\n requestsCache: createMemoryCache({ serializable: false }),\n hostsCache: createFallbackableCache({\n caches: [createBrowserLocalStorageCache({ key: `${apiClientVersion}-${appId}` }), createMemoryCache()],\n }),\n ...browserOptions,\n });\n}\n\nexport type QuerySuggestionsClient = ReturnType<typeof createQuerySuggestionsClient>;\n","// 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.\n\nimport type {\n CreateClientOptions,\n Headers,\n Host,\n QueryParameters,\n Request,\n RequestOptions,\n} from '@algolia/client-common';\nimport { createAuth, createTransporter, getAlgoliaAgent, validateRequired } from '@algolia/client-common';\n\nimport type { BaseResponse } from '../model/baseResponse';\nimport type { ConfigStatus } from '../model/configStatus';\nimport type { ConfigurationResponse } from '../model/configurationResponse';\nimport type { ConfigurationWithIndex } from '../model/configurationWithIndex';\nimport type { LogFile } from '../model/logFile';\n\nimport type {\n CustomDeleteProps,\n CustomGetProps,\n CustomPostProps,\n CustomPutProps,\n DeleteConfigProps,\n GetConfigProps,\n GetConfigStatusProps,\n GetLogFileProps,\n UpdateConfigProps,\n} from '../model/clientMethodProps';\n\nexport const apiClientVersion = '5.54.0';\n\nexport const REGIONS = ['eu', 'us'] as const;\nexport type Region = (typeof REGIONS)[number];\nexport type RegionOptions = { region: Region };\n\nfunction getDefaultHosts(region: Region): Host[] {\n const url = 'query-suggestions.{region}.algolia.com'.replace('{region}', region);\n\n return [{ url, accept: 'readWrite', protocol: 'https' }];\n}\n\nexport function createQuerySuggestionsClient({\n appId: appIdOption,\n apiKey: apiKeyOption,\n authMode,\n algoliaAgents,\n region: regionOption,\n ...options\n}: CreateClientOptions & RegionOptions) {\n const auth = createAuth(appIdOption, apiKeyOption, authMode);\n const transporter = createTransporter({\n hosts: getDefaultHosts(regionOption),\n ...options,\n algoliaAgent: getAlgoliaAgent({\n algoliaAgents,\n client: 'QuerySuggestions',\n version: apiClientVersion,\n }),\n baseHeaders: {\n 'content-type': 'text/plain',\n ...auth.headers(),\n ...options.baseHeaders,\n },\n baseQueryParameters: {\n ...auth.queryParameters(),\n ...options.baseQueryParameters,\n },\n });\n\n return {\n transporter,\n\n /**\n * The `appId` currently in use.\n */\n appId: appIdOption,\n\n /**\n * The `apiKey` currently in use.\n */\n apiKey: apiKeyOption,\n\n /**\n * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.\n */\n clearCache(): Promise<void> {\n return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => undefined);\n },\n\n /**\n * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.\n */\n get _ua(): string {\n return transporter.algoliaAgent.value;\n },\n\n /**\n * Adds a `segment` to the `x-algolia-agent` sent with every requests.\n *\n * @param segment - The algolia agent (user-agent) segment to add.\n * @param version - The version of the agent.\n */\n addAlgoliaAgent(segment: string, version?: string | undefined): void {\n transporter.algoliaAgent.add({ segment, version });\n },\n\n /**\n * Helper method to switch the API key used to authenticate the requests.\n *\n * @param params - Method params.\n * @param params.apiKey - The new API Key to use.\n */\n setClientApiKey({ apiKey }: { apiKey: string }): void {\n if (!authMode || authMode === 'WithinHeaders') {\n transporter.baseHeaders['x-algolia-api-key'] = apiKey;\n } else {\n transporter.baseQueryParameters['x-algolia-api-key'] = apiKey;\n }\n },\n\n /**\n * Creates a new Query Suggestions configuration. You can have up to 100 configurations per Algolia application.\n *\n * Required API Key ACLs:\n * - editSettings\n * @param configurationWithIndex - The configurationWithIndex object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n createConfig(\n configurationWithIndex: ConfigurationWithIndex,\n requestOptions?: RequestOptions,\n ): Promise<BaseResponse> {\n validateRequired('configurationWithIndex', 'createConfig', configurationWithIndex);\n\n const requestPath = '/1/configs';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: configurationWithIndex,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customDelete - The customDelete object.\n * @param customDelete.path - Path of the endpoint, for example `1/newFeature`.\n * @param customDelete.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customDelete(\n { path, parameters }: CustomDeleteProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n validateRequired('path', 'customDelete', path);\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customGet - The customGet object.\n * @param customGet.path - Path of the endpoint, for example `1/newFeature`.\n * @param customGet.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>> {\n validateRequired('path', 'customGet', path);\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customPost - The customPost object.\n * @param customPost.path - Path of the endpoint, for example `1/newFeature`.\n * @param customPost.parameters - Query parameters to apply to the current query.\n * @param customPost.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPost(\n { path, parameters, body }: CustomPostProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n validateRequired('path', 'customPost', path);\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customPut - The customPut object.\n * @param customPut.path - Path of the endpoint, for example `1/newFeature`.\n * @param customPut.parameters - Query parameters to apply to the current query.\n * @param customPut.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPut(\n { path, parameters, body }: CustomPutProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n validateRequired('path', 'customPut', path);\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'PUT',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Deletes a Query Suggestions configuration. Deleting only removes the configuration and stops updates to the Query Suggestions index. To delete the Query Suggestions index itself, use the Search API and the `Delete an index` operation.\n *\n * Required API Key ACLs:\n * - editSettings\n * @param deleteConfig - The deleteConfig object.\n * @param deleteConfig.indexName - Query Suggestions index name.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n deleteConfig({ indexName }: DeleteConfigProps, requestOptions?: RequestOptions): Promise<BaseResponse> {\n validateRequired('indexName', 'deleteConfig', indexName);\n\n const requestPath = '/1/configs/{indexName}'.replace('{indexName}', encodeURIComponent(indexName));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves all Query Suggestions configurations of your Algolia application.\n *\n * Required API Key ACLs:\n * - settings\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getAllConfigs(requestOptions?: RequestOptions | undefined): Promise<Array<ConfigurationResponse>> {\n const requestPath = '/1/configs';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves a single Query Suggestions configuration by its index name.\n *\n * Required API Key ACLs:\n * - settings\n * @param getConfig - The getConfig object.\n * @param getConfig.indexName - Query Suggestions index name.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getConfig({ indexName }: GetConfigProps, requestOptions?: RequestOptions): Promise<ConfigurationResponse> {\n validateRequired('indexName', 'getConfig', indexName);\n\n const requestPath = '/1/configs/{indexName}'.replace('{indexName}', encodeURIComponent(indexName));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Reports the status of a Query Suggestions index.\n *\n * Required API Key ACLs:\n * - settings\n * @param getConfigStatus - The getConfigStatus object.\n * @param getConfigStatus.indexName - Query Suggestions index name.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getConfigStatus({ indexName }: GetConfigStatusProps, requestOptions?: RequestOptions): Promise<ConfigStatus> {\n validateRequired('indexName', 'getConfigStatus', indexName);\n\n const requestPath = '/1/configs/{indexName}/status'.replace('{indexName}', encodeURIComponent(indexName));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves the logs for a single Query Suggestions index.\n *\n * Required API Key ACLs:\n * - settings\n * @param getLogFile - The getLogFile object.\n * @param getLogFile.indexName - Query Suggestions index name.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getLogFile({ indexName }: GetLogFileProps, requestOptions?: RequestOptions): Promise<LogFile> {\n validateRequired('indexName', 'getLogFile', indexName);\n\n const requestPath = '/1/logs/{indexName}'.replace('{indexName}', encodeURIComponent(indexName));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Updates a QuerySuggestions configuration.\n *\n * Required API Key ACLs:\n * - editSettings\n * @param updateConfig - The updateConfig object.\n * @param updateConfig.indexName - Query Suggestions index name.\n * @param updateConfig.configuration - The configuration object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n updateConfig(\n { indexName, configuration }: UpdateConfigProps,\n requestOptions?: RequestOptions,\n ): Promise<BaseResponse> {\n validateRequired('indexName', 'updateConfig', indexName);\n\n validateRequired('configuration', 'updateConfig', configuration);\n\n validateRequired('configuration.sourceIndices', 'updateConfig', configuration.sourceIndices);\n\n const requestPath = '/1/configs/{indexName}'.replace('{indexName}', encodeURIComponent(indexName));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'PUT',\n path: requestPath,\n queryParameters,\n headers,\n data: configuration,\n };\n\n return transporter.request(request, requestOptions);\n },\n };\n}\n"],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,MAAM,4DAA4D,QAAQ,KAAK,IAAI,CAAC,EAAE;AAAA,EAClG;AAEA,QAAM,EAAE,aAAa,cAAc,GAAG,eAAe,IAAI,WAAW,CAAC;AAErE,SAAO,6BAA6B;AAAA,IAClC;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU;AAAA,MACR,SAAS;AAAA,MACT,MAAM;AAAA,MACN,OAAO;AAAA,IACT;AAAA,IACA,QAAQ,iBAAiB;AAAA,IACzB,WAAW,mBAAmB;AAAA,IAC9B,eAAe,CAAC,EAAE,SAAS,UAAU,CAAC;AAAA,IACtC,UAAU;AAAA,IACV,gBAAgB,kBAAkB;AAAA,IAClC,eAAe,kBAAkB,EAAE,cAAc,MAAM,CAAC;AAAA,IACxD,YAAY,wBAAwB;AAAA,MAClC,QAAQ,CAAC,+BAA+B,EAAE,KAAK,GAAG,gBAAgB,IAAI,KAAK,GAAG,CAAC,GAAG,kBAAkB,CAAC;AAAA,IACvG,CAAC;AAAA,IACD,GAAG;AAAA,EACL,CAAC;AACH;","names":[]}
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
function F(r){let e,s=`algolia-client-js-${r.key}`;function t(){return e===void 0&&(e=r.localStorage||window.localStorage),e}function i(){return JSON.parse(t().getItem(s)||"{}")}function c(a){t().setItem(s,JSON.stringify(a))}function h(){let a=r.timeToLive?r.timeToLive*1e3:null,o=i(),n=Object.fromEntries(Object.entries(o).filter(([,m])=>m.timestamp!==void 0));if(c(n),!a)return;let u=Object.fromEntries(Object.entries(n).filter(([,m])=>{let f=new Date().getTime();return!(m.timestamp+a<f)}));c(u)}return{get(a,o,n={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(h(),i()[JSON.stringify(a)])).then(u=>Promise.all([u?u.value:o(),u!==void 0])).then(([u,m])=>Promise.all([u,m||n.miss(u)])).then(([u])=>u)},set(a,o){return Promise.resolve().then(()=>{let n=i();return n[JSON.stringify(a)]={timestamp:new Date().getTime(),value:o},t().setItem(s,JSON.stringify(n)),o})},delete(a){return Promise.resolve().then(()=>{let o=i();delete o[JSON.stringify(a)],t().setItem(s,JSON.stringify(o))})},clear(){return Promise.resolve().then(()=>{t().removeItem(s)})}}}function te(){return{get(r,e,s={miss:()=>Promise.resolve()}){return e().then(i=>Promise.all([i,s.miss(i)])).then(([i])=>i)},set(r,e){return Promise.resolve(e)},delete(r){return Promise.resolve()},clear(){return Promise.resolve()}}}function v(r){let e=[...r.caches],s=e.shift();return s===void 0?te():{get(t,i,c={miss:()=>Promise.resolve()}){return s.get(t,i,c).catch(()=>v({caches:e}).get(t,i,c))},set(t,i){return s.set(t,i).catch(()=>v({caches:e}).set(t,i))},delete(t){return s.delete(t).catch(()=>v({caches:e}).delete(t))},clear(){return s.clear().catch(()=>v({caches:e}).clear())}}}function S(r={serializable:!0}){let e={};return{get(s,t,i={miss:()=>Promise.resolve()}){let c=JSON.stringify(s);if(c in e)return Promise.resolve(r.serializable?JSON.parse(e[c]):e[c]);let h=t();return h.then(a=>i.miss(a)).then(()=>h)},set(s,t){return e[JSON.stringify(s)]=r.serializable?JSON.stringify(t):t,Promise.resolve(t)},delete(s){return delete e[JSON.stringify(s)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}function se(r){let e={value:`Algolia for JavaScript (${r})`,add(s){let t=`; ${s.segment}${s.version!==void 0?` (${s.version})`:""}`;return e.value.indexOf(t)===-1&&(e.value=`${e.value}${t}`),e}};return e}function z(r,e,s="WithinHeaders"){let t={"x-algolia-api-key":e,"x-algolia-application-id":r};return{headers(){return s==="WithinHeaders"?t:{}},queryParameters(){return s==="WithinQueryParameters"?t:{}}}}function J({algoliaAgents:r,client:e,version:s}){let t=se(s).add({segment:e,version:s});return r.forEach(i=>t.add(i)),t}function M(){return{debug(r,e){return Promise.resolve()},info(r,e){return Promise.resolve()},error(r,e){return Promise.resolve()}}}var oe=750,$=120*1e3;function j(r,e="up"){let s=Date.now();function t(){return e==="up"||Date.now()-s>$}function i(){return e==="timed out"&&Date.now()-s<=$}return{...r,status:e,lastUpdate:s,isUp:t,isTimedOut:i}}var B=class extends Error{name="AlgoliaError";constructor(r,e){super(r),e&&(this.name=e)}};var X=class extends B{stackTrace;constructor(r,e,s){super(r,s),this.stackTrace=e}},ne=class extends X{constructor(r){super("Unreachable hosts - your application id may be incorrect. If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support",r,"RetryError")}},_=class extends X{status;constructor(r,e,s,t="ApiError"){super(r,s,t),this.status=e}},ae=class extends B{response;constructor(r,e){super(r,"DeserializationError"),this.response=e}},ie=class extends _{error;constructor(r,e,s,t){super(r,e,t,"DetailedApiError"),this.error=s}};function ue(r,e,s){let t=ce(s),i=`${r.protocol}://${r.url}${r.port?`:${r.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return t.length&&(i+=`?${t}`),i}function ce(r){return Object.keys(r).filter(e=>r[e]!==void 0).sort().map(e=>`${e}=${encodeURIComponent(Object.prototype.toString.call(r[e])==="[object Array]"?r[e].join(","):r[e]).replace(/\+/g,"%20")}`).join("&")}function le(r,e){if(r.method==="GET"||r.data===void 0&&e.data===void 0)return;let s=Array.isArray(r.data)?r.data:{...r.data,...e.data};return JSON.stringify(s)}function me(r,e,s){let t={Accept:"application/json",...r,...e,...s},i={};return Object.keys(t).forEach(c=>{let h=t[c];i[c.toLowerCase()]=h}),i}function de(r){try{return JSON.parse(r.content)}catch(e){throw new ae(e.message,r)}}function pe({content:r,status:e},s){try{let t=JSON.parse(r);return"error"in t?new ie(t.message,e,t.error,s):new _(t.message,e,s)}catch{}return new _(r,e,s)}function he({isTimedOut:r,status:e}){return!r&&~~e===0}function ge({isTimedOut:r,status:e}){return r||he({isTimedOut:r,status:e})||~~(e/100)!==2&&~~(e/100)!==4}function fe({status:r}){return~~(r/100)===2}function Pe(r){return r.map(e=>K(e))}function K(r){let e=r.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...r,request:{...r.request,headers:{...r.request.headers,...e}}}}function V({hosts:r,hostsCache:e,baseHeaders:s,logger:t,baseQueryParameters:i,algoliaAgent:c,timeouts:h,requester:a,requestsCache:o,responsesCache:n,compress:u,compression:m}){async function f(l){let p=await Promise.all(l.map(d=>e.get(d,()=>Promise.resolve(j(d))))),C=p.filter(d=>d.isUp()),E=p.filter(d=>d.isTimedOut()),w=[...C,...E];return{hosts:w.length>0?w:l,getTimeout(d,T){return(E.length===0&&d===0?1:E.length+3+d)*T}}}async function g(l,p,C){let E=[],w=le(l,p),y=me(s,l.headers,p.headers),d=m==="gzip"&&w!==void 0&&w.length>oe&&(l.method==="POST"||l.method==="PUT");d&&u===void 0&&t.info("Compression is disabled because no compress method is available.");let T=d&&u!==void 0,L=T?await u(w):w;T&&(y["content-encoding"]="gzip");let ee=l.method==="GET"?{...l.data,...p.data}:{},O={...i,...l.queryParameters,...ee};if(c.value&&(O["x-algolia-agent"]=c.value),p&&p.queryParameters)for(let P of Object.keys(p.queryParameters))!p.queryParameters[P]||Object.prototype.toString.call(p.queryParameters[P])==="[object Object]"?O[P]=p.queryParameters[P]:O[P]=p.queryParameters[P].toString();let N=0,H=async(P,b)=>{let x=P.pop();if(x===void 0)throw new ne(Pe(E));let I={...h,...p.timeouts},Q={data:L,headers:y,method:l.method,url:ue(x,l.path,O),connectTimeout:b(N,I.connect),responseTimeout:b(N,C?I.read:I.write)},G=D=>{let W={request:Q,response:D,host:x,triesLeft:P.length};return E.push(W),W},R=await a.send(Q);if(ge(R)){let D=G(R);return R.isTimedOut&&N++,t.info("Retryable failure",K(D)),await e.set(x,j(x,R.isTimedOut?"timed out":"down")),H(P,b)}if(fe(R))return de(R);throw G(R),pe(R,E)},re=r.filter(P=>P.accept==="readWrite"||(C?P.accept==="read":P.accept==="write")),k=await f(re);return H([...k.hosts].reverse(),k.getTimeout)}function q(l,p={}){let C=()=>g(l,p,E),E=l.useReadTransporter||l.method==="GET";if((p.cacheable||l.cacheable)!==!0)return C();let y={request:l,requestOptions:p,transporter:{queryParameters:i,headers:s}};return n.get(y,()=>o.get(y,()=>o.set(y,C()).then(d=>Promise.all([o.delete(y),d]),d=>Promise.all([o.delete(y),Promise.reject(d)])).then(([d,T])=>T)),{miss:d=>n.set(y,d)})}return{hostsCache:e,requester:a,timeouts:h,logger:t,algoliaAgent:c,baseHeaders:s,baseQueryParameters:i,hosts:r,request:q,requestsCache:o,responsesCache:n}}function Y(){function r(e){return new Promise(s=>{let t=new XMLHttpRequest;t.open(e.method,e.url,!0),Object.keys(e.headers).forEach(a=>t.setRequestHeader(a,e.headers[a]));let i=(a,o)=>setTimeout(()=>{t.abort(),s({status:0,content:o,isTimedOut:!0})},a),c=i(e.connectTimeout,"Connection timeout"),h;t.onreadystatechange=()=>{t.readyState>t.OPENED&&h===void 0&&(clearTimeout(c),h=i(e.responseTimeout,"Socket timeout"))},t.onerror=()=>{t.status===0&&(clearTimeout(c),clearTimeout(h),s({content:t.responseText||"Network request failed",status:t.status,isTimedOut:!1}))},t.onload=()=>{clearTimeout(c),clearTimeout(h),s({content:t.responseText,status:t.status,isTimedOut:!1})},t.send(e.data)})}return{send:r}}var A="5.52.1",U=["eu","us"];function ye(r){return[{url:"query-suggestions.{region}.algolia.com".replace("{region}",r),accept:"readWrite",protocol:"https"}]}function Z({appId:r,apiKey:e,authMode:s,algoliaAgents:t,region:i,...c}){let h=z(r,e,s),a=V({hosts:ye(i),...c,algoliaAgent:J({algoliaAgents:t,client:"QuerySuggestions",version:A}),baseHeaders:{"content-type":"text/plain",...h.headers(),...c.baseHeaders},baseQueryParameters:{...h.queryParameters(),...c.baseQueryParameters}});return{transporter:a,appId:r,apiKey:e,clearCache(){return Promise.all([a.requestsCache.clear(),a.responsesCache.clear()]).then(()=>{})},get _ua(){return a.algoliaAgent.value},addAlgoliaAgent(o,n){a.algoliaAgent.add({segment:o,version:n})},setClientApiKey({apiKey:o}){!s||s==="WithinHeaders"?a.baseHeaders["x-algolia-api-key"]=o:a.baseQueryParameters["x-algolia-api-key"]=o},createConfig(o,n){if(!o)throw new Error("Parameter `configurationWithIndex` is required when calling `createConfig`.");let g={method:"POST",path:"/1/configs",queryParameters:{},headers:{},data:o};return a.request(g,n)},customDelete({path:o,parameters:n},u){if(!o)throw new Error("Parameter `path` is required when calling `customDelete`.");let q={method:"DELETE",path:"/{path}".replace("{path}",o),queryParameters:n||{},headers:{}};return a.request(q,u)},customGet({path:o,parameters:n},u){if(!o)throw new Error("Parameter `path` is required when calling `customGet`.");let q={method:"GET",path:"/{path}".replace("{path}",o),queryParameters:n||{},headers:{}};return a.request(q,u)},customPost({path:o,parameters:n,body:u},m){if(!o)throw new Error("Parameter `path` is required when calling `customPost`.");let l={method:"POST",path:"/{path}".replace("{path}",o),queryParameters:n||{},headers:{},data:u||{}};return a.request(l,m)},customPut({path:o,parameters:n,body:u},m){if(!o)throw new Error("Parameter `path` is required when calling `customPut`.");let l={method:"PUT",path:"/{path}".replace("{path}",o),queryParameters:n||{},headers:{},data:u||{}};return a.request(l,m)},deleteConfig({indexName:o},n){if(!o)throw new Error("Parameter `indexName` is required when calling `deleteConfig`.");let g={method:"DELETE",path:"/1/configs/{indexName}".replace("{indexName}",encodeURIComponent(o)),queryParameters:{},headers:{}};return a.request(g,n)},getAllConfigs(o){let f={method:"GET",path:"/1/configs",queryParameters:{},headers:{}};return a.request(f,o)},getConfig({indexName:o},n){if(!o)throw new Error("Parameter `indexName` is required when calling `getConfig`.");let g={method:"GET",path:"/1/configs/{indexName}".replace("{indexName}",encodeURIComponent(o)),queryParameters:{},headers:{}};return a.request(g,n)},getConfigStatus({indexName:o},n){if(!o)throw new Error("Parameter `indexName` is required when calling `getConfigStatus`.");let g={method:"GET",path:"/1/configs/{indexName}/status".replace("{indexName}",encodeURIComponent(o)),queryParameters:{},headers:{}};return a.request(g,n)},getLogFile({indexName:o},n){if(!o)throw new Error("Parameter `indexName` is required when calling `getLogFile`.");let g={method:"GET",path:"/1/logs/{indexName}".replace("{indexName}",encodeURIComponent(o)),queryParameters:{},headers:{}};return a.request(g,n)},updateConfig({indexName:o,configuration:n},u){if(!o)throw new Error("Parameter `indexName` is required when calling `updateConfig`.");if(!n)throw new Error("Parameter `configuration` is required when calling `updateConfig`.");if(!n.sourceIndices)throw new Error("Parameter `configuration.sourceIndices` is required when calling `updateConfig`.");let q={method:"PUT",path:"/1/configs/{indexName}".replace("{indexName}",encodeURIComponent(o)),queryParameters:{},headers:{},data:n};return a.request(q,u)}}}function Je(r,e,s,t){if(!r||typeof r!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");if(!s||s&&(typeof s!="string"||!U.includes(s)))throw new Error(`\`region\` is required and must be one of the following: ${U.join(", ")}`);let{compression:i,...c}=t||{};return Z({appId:r,apiKey:e,region:s,timeouts:{connect:1e3,read:2e3,write:3e4},logger:M(),requester:Y(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:S(),requestsCache:S({serializable:!1}),hostsCache:v({caches:[F({key:`${A}-${r}`}),S()]}),...c})}export{A as apiClientVersion,Je as querySuggestionsClient};
|
|
1
|
+
function Y(t){let e,r=`algolia-client-js-${t.key}`;function s(){return e===void 0&&(e=t.localStorage||window.localStorage),e}function a(){return JSON.parse(s().getItem(r)||"{}")}function u(o){s().setItem(r,JSON.stringify(o))}function p(){return new Promise(o=>setTimeout(o,0))}function i(){let o=t.timeToLive?t.timeToLive*1e3:null,n=a(),c=new Date().getTime(),f=!1;return{namespace:Object.fromEntries(Object.entries(n).filter(([,m])=>!m||m.timestamp===void 0||o&&m.timestamp+o<c?(f=!0,!1):!0)),changed:f}}return{get(o,n,c={miss:()=>Promise.resolve()}){return p().then(()=>{let{namespace:f,changed:h}=i(),m=f[JSON.stringify(o)];return h&&u(f),m?m.value:n().then(P=>c.miss(P).then(()=>P))})},set(o,n){return p().then(()=>{let c=a();return c[JSON.stringify(o)]={timestamp:new Date().getTime(),value:n},s().setItem(r,JSON.stringify(c)),n})},delete(o){return p().then(()=>{let n=a();delete n[JSON.stringify(o)],s().setItem(r,JSON.stringify(n))})},clear(){return Promise.resolve().then(()=>{s().removeItem(r)})}}}function ce(){return{get(t,e,r={miss:()=>Promise.resolve()}){return e().then(a=>Promise.all([a,r.miss(a)])).then(([a])=>a)},set(t,e){return Promise.resolve(e)},delete(t){return Promise.resolve()},clear(){return Promise.resolve()}}}function O(t){let e=[...t.caches],r=e.shift();return r===void 0?ce():{get(s,a,u={miss:()=>Promise.resolve()}){return r.get(s,a,u).catch(()=>O({caches:e}).get(s,a,u))},set(s,a){return r.set(s,a).catch(()=>O({caches:e}).set(s,a))},delete(s){return r.delete(s).catch(()=>O({caches:e}).delete(s))},clear(){return r.clear().catch(()=>O({caches:e}).clear())}}}function _(t={serializable:!0}){let e={};return{get(r,s,a={miss:()=>Promise.resolve()}){let u=JSON.stringify(r);if(u in e)return Promise.resolve(t.serializable?JSON.parse(e[u]):e[u]);let p=s();return p.then(i=>a.miss(i)).then(()=>p)},set(r,s){return e[JSON.stringify(r)]=t.serializable?JSON.stringify(s):s,Promise.resolve(s)},delete(r){return delete e[JSON.stringify(r)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}function ue(t){let e={value:`Algolia for JavaScript (${t})`,add(r){let s=`; ${r.segment}${r.version!==void 0?` (${r.version})`:""}`;return e.value.indexOf(s)===-1&&(e.value=`${e.value}${s}`),e}};return e}function Z(t,e,r="WithinHeaders"){let s={"x-algolia-api-key":e,"x-algolia-application-id":t};return{headers(){return r==="WithinHeaders"?s:{}},queryParameters(){return r==="WithinQueryParameters"?s:{}}}}function ee({algoliaAgents:t,client:e,version:r}){let s=ue(r).add({segment:e,version:r});return t.forEach(a=>s.add(a)),s}function te(){return{debug(t,e){return Promise.resolve()},info(t,e){return Promise.resolve()},error(t,e){return Promise.resolve()}}}var le=10*1024*1024;async function*de(t){let e=t.getReader();try{for(;;){let{done:r,value:s}=await e.read();if(r)return;yield s}}finally{e.releaseLock()}}function me(t){return Symbol.asyncIterator in t?t:de(t)}async function*fe(t){let e=new TextDecoder("utf-8"),r=[],s=0,a=!1,u=!0;for await(let i of me(t)){let o=e.decode(i,{stream:!0}),n=0;for(a&&(a=!1,o.length>0&&o[0]===`
|
|
2
|
+
`&&(n=1));n<o.length;){let c=o.indexOf("\r",n),f=o.indexOf(`
|
|
3
|
+
`,n);if(c===-1&&f===-1){let l=o.slice(n);if(r.push(l),s+=l.length,s>le)throw new Error("SSE line buffer exceeded 10MB");break}let h,m;c!==-1&&(f===-1||c<f)?(h=c,c+1<o.length?m=o[c+1]===`
|
|
4
|
+
`?2:1:(a=!0,m=1)):(h=f,m=1);let P=o.slice(n,h);r.push(P);let q=r.length===1?r[0]:r.join("");r.length=0,s=0,u&&(q.startsWith("\uFEFF")&&(q=q.slice(1)),u=!1),yield q,n=h+m}}let p=e.decode();if(p&&r.push(p),r.length>0){let i=r.join("");u&&i.startsWith("\uFEFF")&&(i=i.slice(1)),yield i}}var pe=class{data=[];eventType="";lastEventId=null;retry=null;decode(t){if(t==="")return this.dispatch();if(t[0]===":")return null;let e=t.indexOf(":"),r,s;switch(e===-1?(r=t,s=""):(r=t.slice(0,e),s=t.slice(e+1),s[0]===" "&&(s=s.slice(1))),r){case"data":this.data.push(s);break;case"event":this.eventType=s;break;case"id":s.includes("\0")||(this.lastEventId=s);break;case"retry":/^[0-9]+$/.test(s)&&(this.retry=parseInt(s,10));break}return null}dispatch(){let t=this.eventType;if(this.eventType="",this.data.length===0)return null;let e={data:this.data.join(`
|
|
5
|
+
`),event:t,id:this.lastEventId,retry:this.retry};return this.data=[],e}};async function*he(t){let e=new pe;for await(let r of fe(t)){let s=e.decode(r);s!==null&&(yield s)}}var ge=750,J=120*1e3;function M(t,e="up"){let r=Date.now();function s(){return e==="up"||Date.now()-r>J}function a(){return e==="timed out"&&Date.now()-r<=J}return{...t,status:e,lastUpdate:r,isUp:s,isTimedOut:a}}var re=class extends Error{name="AlgoliaError";constructor(t,e){super(t),e&&(this.name=e)}};var se=class extends re{stackTrace;constructor(t,e,r){super(t,r),this.stackTrace=e}},B=class extends se{constructor(t){super("Unreachable hosts - your application id may be incorrect. If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support",t,"RetryError")}},G=class extends se{status;constructor(t,e,r,s="ApiError"){super(t,r,s),this.status=e}},ye=class extends re{response;constructor(t,e){super(t,"DeserializationError"),this.response=e}},Pe=class extends G{error;constructor(t,e,r,s){super(t,e,s,"DetailedApiError"),this.error=r}};function X(t,e,r){let s=Ee(r),a=`${t.protocol}://${t.url}${t.port?`:${t.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return s.length&&(a+=`?${s}`),a}function Ee(t){return Object.keys(t).filter(e=>t[e]!==void 0).sort().map(e=>`${e}=${encodeURIComponent(Object.prototype.toString.call(t[e])==="[object Array]"?t[e].join(","):t[e]).replace(/\+/g,"%20")}`).join("&")}function K(t,e){if(t.method==="GET"||t.data===void 0&&e.data===void 0)return;let r=Array.isArray(t.data)?t.data:{...t.data,...e.data};return JSON.stringify(r)}function V(t,e,r){let s={Accept:"application/json",...t,...e,...r},a={};return Object.keys(s).forEach(u=>{let p=s[u];a[u.toLowerCase()]=p}),a}function Te(t){if(!(t.status===204||t.content.length===0))try{return JSON.parse(t.content)}catch(e){throw new ye(e.message,t)}}function ve({content:t,status:e},r){try{let s=JSON.parse(t);return"error"in s?new Pe(s.message,e,s.error,r):new G(s.message,e,r)}catch{}return new G(t,e,r)}function Re({isTimedOut:t,status:e}){return!t&&~~e===0}function qe({isTimedOut:t,status:e}){return t||Re({isTimedOut:t,status:e})||~~(e/100)!==2&&~~(e/100)!==4}function xe({status:t}){return~~(t/100)===2}function Se(t){return t.map(e=>oe(e))}function oe(t){let e=t.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...t,request:{...t.request,headers:{...t.request.headers,...e}}}}function ne({hosts:t,hostsCache:e,baseHeaders:r,logger:s,baseQueryParameters:a,algoliaAgent:u,timeouts:p,requester:i,requestsCache:o,responsesCache:n,compress:c,compression:f}){async function h(l){let d=await Promise.all(l.map(g=>e.get(g,()=>Promise.resolve(M(g))))),S=d.filter(g=>g.isUp()),v=d.filter(g=>g.isTimedOut()),x=[...S,...v];return{hosts:x.length>0?x:l,getTimeout(g,C){return(v.length===0&&g===0?1:v.length+3+g)*C}}}async function m(l,d,S){let v=[],x=K(l,d),y=V(r,l.headers,d.headers),g=f==="gzip"&&x!==void 0&&x.length>ge&&(l.method==="POST"||l.method==="PUT");g&&c===void 0&&s.info("Compression is disabled because no compress method is available.");let C=g&&c!==void 0,L=C?await c(x):x;C&&(y["content-encoding"]="gzip");let N=l.method==="GET"?{...l.data,...d.data}:{},w={...a,...l.queryParameters,...N};if(u.value&&(w["x-algolia-agent"]=u.value),d&&d.queryParameters)for(let E of Object.keys(d.queryParameters))!d.queryParameters[E]||Object.prototype.toString.call(d.queryParameters[E])==="[object Object]"?w[E]=d.queryParameters[E]:w[E]=d.queryParameters[E].toString();let A=0,D=async(E,U)=>{let I=E.pop();if(I===void 0)throw new B(Se(v));let H={...p,...d.timeouts},j={data:L,headers:y,method:l.method,url:X(I,l.path,w),connectTimeout:U(A,H.connect),responseTimeout:U(A,S?H.read:H.write)},W=F=>{let z={request:j,response:F,host:I,triesLeft:E.length};return v.push(z),z},b=await i.send(j);if(qe(b)){let F=W(b);return b.isTimedOut&&A++,s.info("Retryable failure",oe(F)),await e.set(I,M(I,b.isTimedOut?"timed out":"down")),D(E,U)}if(xe(b))return Te(b);throw W(b),ve(b,v)},R=t.filter(E=>E.accept==="readWrite"||(S?E.accept==="read":E.accept==="write")),$=await h(R);return D([...$.hosts].reverse(),$.getTimeout)}function P(l,d={}){let S=()=>m(l,d,v),v=l.useReadTransporter||l.method==="GET";if((d.cacheable||l.cacheable)!==!0)return S();let y={request:l,requestOptions:d,transporter:{queryParameters:a,headers:r}};return n.get(y,()=>o.get(y,()=>o.set(y,S()).then(g=>Promise.all([o.delete(y),g]),g=>Promise.all([o.delete(y),Promise.reject(g)])).then(([g,C])=>C)),{miss:g=>n.set(y,g)})}async function*q(l,d={}){if(!i.sendStream)throw new Error("This requester does not support streaming");let S=K(l,d),v=V(r,l.headers,d.headers);v.accept="text/event-stream";let x=l.method==="GET"?{...l.data,...d.data}:{},y={...a,...l.queryParameters,...x};if(u.value&&(y["x-algolia-agent"]=u.value),d&&d.queryParameters)for(let R of Object.keys(d.queryParameters))!d.queryParameters[R]||Object.prototype.toString.call(d.queryParameters[R])==="[object Object]"?y[R]=d.queryParameters[R]:y[R]=d.queryParameters[R].toString();let g=l.useReadTransporter||l.method==="GET",C=t.filter(R=>R.accept==="readWrite"||(g?R.accept==="read":R.accept==="write")),N=(await h(C)).hosts[0];if(!N)throw new B([]);let w={...p,...d.timeouts},A={data:S,headers:v,method:l.method,url:X(N,l.path,y),connectTimeout:w.connect,responseTimeout:g?w.read:w.write},D=await i.sendStream(A);yield*he(D)}return{hostsCache:e,requester:i,timeouts:p,logger:s,algoliaAgent:u,baseHeaders:r,baseQueryParameters:a,hosts:t,request:P,requestStream:q,requestsCache:o,responsesCache:n}}function T(t,e,r){if(r==null||typeof r=="string"&&r.length===0)throw new Error(`Parameter \`${t}\` is required when calling \`${e}\`.`)}function ae(){function t(e){return new Promise(r=>{let s=new XMLHttpRequest;s.open(e.method,e.url,!0),Object.keys(e.headers).forEach(i=>s.setRequestHeader(i,e.headers[i]));let a=(i,o)=>setTimeout(()=>{s.abort(),r({status:0,content:o,isTimedOut:!0})},i),u=a(e.connectTimeout,"Connection timeout"),p;s.onreadystatechange=()=>{s.readyState>s.OPENED&&p===void 0&&(clearTimeout(u),p=a(e.responseTimeout,"Socket timeout"))},s.onerror=()=>{s.status===0&&(clearTimeout(u),clearTimeout(p),r({content:s.responseText||"Network request failed",status:s.status,isTimedOut:!1}))},s.onload=()=>{clearTimeout(u),clearTimeout(p),r({content:s.responseText,status:s.status,isTimedOut:!1})},s.send(e.data)})}return{send:t}}var k="5.54.0",Q=["eu","us"];function Ce(t){return[{url:"query-suggestions.{region}.algolia.com".replace("{region}",t),accept:"readWrite",protocol:"https"}]}function ie({appId:t,apiKey:e,authMode:r,algoliaAgents:s,region:a,...u}){let p=Z(t,e,r),i=ne({hosts:Ce(a),...u,algoliaAgent:ee({algoliaAgents:s,client:"QuerySuggestions",version:k}),baseHeaders:{"content-type":"text/plain",...p.headers(),...u.baseHeaders},baseQueryParameters:{...p.queryParameters(),...u.baseQueryParameters}});return{transporter:i,appId:t,apiKey:e,clearCache(){return Promise.all([i.requestsCache.clear(),i.responsesCache.clear()]).then(()=>{})},get _ua(){return i.algoliaAgent.value},addAlgoliaAgent(o,n){i.algoliaAgent.add({segment:o,version:n})},setClientApiKey({apiKey:o}){!r||r==="WithinHeaders"?i.baseHeaders["x-algolia-api-key"]=o:i.baseQueryParameters["x-algolia-api-key"]=o},createConfig(o,n){T("configurationWithIndex","createConfig",o);let m={method:"POST",path:"/1/configs",queryParameters:{},headers:{},data:o};return i.request(m,n)},customDelete({path:o,parameters:n},c){T("path","customDelete",o);let P={method:"DELETE",path:"/{path}".replace("{path}",o),queryParameters:n||{},headers:{}};return i.request(P,c)},customGet({path:o,parameters:n},c){T("path","customGet",o);let P={method:"GET",path:"/{path}".replace("{path}",o),queryParameters:n||{},headers:{}};return i.request(P,c)},customPost({path:o,parameters:n,body:c},f){T("path","customPost",o);let q={method:"POST",path:"/{path}".replace("{path}",o),queryParameters:n||{},headers:{},data:c||{}};return i.request(q,f)},customPut({path:o,parameters:n,body:c},f){T("path","customPut",o);let q={method:"PUT",path:"/{path}".replace("{path}",o),queryParameters:n||{},headers:{},data:c||{}};return i.request(q,f)},deleteConfig({indexName:o},n){T("indexName","deleteConfig",o);let m={method:"DELETE",path:"/1/configs/{indexName}".replace("{indexName}",encodeURIComponent(o)),queryParameters:{},headers:{}};return i.request(m,n)},getAllConfigs(o){let h={method:"GET",path:"/1/configs",queryParameters:{},headers:{}};return i.request(h,o)},getConfig({indexName:o},n){T("indexName","getConfig",o);let m={method:"GET",path:"/1/configs/{indexName}".replace("{indexName}",encodeURIComponent(o)),queryParameters:{},headers:{}};return i.request(m,n)},getConfigStatus({indexName:o},n){T("indexName","getConfigStatus",o);let m={method:"GET",path:"/1/configs/{indexName}/status".replace("{indexName}",encodeURIComponent(o)),queryParameters:{},headers:{}};return i.request(m,n)},getLogFile({indexName:o},n){T("indexName","getLogFile",o);let m={method:"GET",path:"/1/logs/{indexName}".replace("{indexName}",encodeURIComponent(o)),queryParameters:{},headers:{}};return i.request(m,n)},updateConfig({indexName:o,configuration:n},c){T("indexName","updateConfig",o),T("configuration","updateConfig",n),T("configuration.sourceIndices","updateConfig",n.sourceIndices);let P={method:"PUT",path:"/1/configs/{indexName}".replace("{indexName}",encodeURIComponent(o)),queryParameters:{},headers:{},data:n};return i.request(P,c)}}}function tt(t,e,r,s){if(!t||typeof t!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");if(!r||r&&(typeof r!="string"||!Q.includes(r)))throw new Error(`\`region\` is required and must be one of the following: ${Q.join(", ")}`);let{compression:a,...u}=s||{};return ie({appId:t,apiKey:e,region:r,timeouts:{connect:1e3,read:2e3,write:3e4},logger:te(),requester:ae(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:_(),requestsCache:_({serializable:!1}),hostsCache:O({caches:[Y({key:`${k}-${t}`}),_()]}),...u})}export{k as apiClientVersion,tt as querySuggestionsClient};
|
|
2
6
|
//# sourceMappingURL=browser.min.js.map
|