@algolia/client-query-suggestions 5.54.0 → 5.55.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 +1 -1
- package/dist/builds/browser.js +1 -1
- package/dist/builds/browser.js.map +1 -1
- package/dist/builds/browser.min.js +4 -4
- package/dist/builds/browser.min.js.map +1 -1
- package/dist/builds/browser.umd.js +4 -4
- package/dist/builds/fetch.js +1 -1
- package/dist/builds/fetch.js.map +1 -1
- package/dist/builds/node.cjs +1 -1
- package/dist/builds/node.cjs.map +1 -1
- package/dist/builds/node.js +1 -1
- package/dist/builds/node.js.map +1 -1
- package/dist/builds/worker.js +1 -1
- package/dist/builds/worker.js.map +1 -1
- package/dist/fetch.d.ts +1 -1
- package/dist/node.d.cts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/src/querySuggestionsClient.cjs +1 -1
- package/dist/src/querySuggestionsClient.cjs.map +1 -1
- package/dist/src/querySuggestionsClient.js +1 -1
- package/dist/src/querySuggestionsClient.js.map +1 -1
- package/dist/worker.d.ts +1 -1
- package/package.json +6 -6
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.55.0
|
|
44
44
|
# or
|
|
45
|
-
npm install @algolia/client-query-suggestions@5.
|
|
45
|
+
npm install @algolia/client-query-suggestions@5.55.0
|
|
46
46
|
# or
|
|
47
|
-
pnpm add @algolia/client-query-suggestions@5.
|
|
47
|
+
pnpm add @algolia/client-query-suggestions@5.55.0
|
|
48
48
|
```
|
|
49
49
|
|
|
50
50
|
### Without a package manager
|
|
@@ -52,7 +52,7 @@ pnpm add @algolia/client-query-suggestions@5.54.0
|
|
|
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.55.0/dist/builds/browser.umd.js"></script>
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
### Usage
|
package/dist/browser.d.ts
CHANGED
|
@@ -268,7 +268,7 @@ type UpdateConfigProps = {
|
|
|
268
268
|
configuration: Configuration;
|
|
269
269
|
};
|
|
270
270
|
|
|
271
|
-
declare const apiClientVersion = "5.
|
|
271
|
+
declare const apiClientVersion = "5.55.0";
|
|
272
272
|
declare const REGIONS: readonly ["eu", "us"];
|
|
273
273
|
type Region = (typeof REGIONS)[number];
|
|
274
274
|
type RegionOptions = {
|
package/dist/builds/browser.js
CHANGED
|
@@ -9,7 +9,7 @@ import { createXhrRequester } from "@algolia/requester-browser-xhr";
|
|
|
9
9
|
|
|
10
10
|
// src/querySuggestionsClient.ts
|
|
11
11
|
import { createAuth, createTransporter, getAlgoliaAgent, validateRequired } from "@algolia/client-common";
|
|
12
|
-
var apiClientVersion = "5.
|
|
12
|
+
var apiClientVersion = "5.55.0";
|
|
13
13
|
var REGIONS = ["eu", "us"];
|
|
14
14
|
function getDefaultHosts(region) {
|
|
15
15
|
const url = "query-suggestions.{region}.algolia.com".replace("{region}", region);
|
|
@@ -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, 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"],"mappings":";AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,0BAA0B;;;ACEnC,SAAS,YAAY,mBAAmB,iBAAiB,wBAAwB;AAoB1E,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,CAAC;AACzD;AAEO,SAAS,6BAA6B;AAAA,EAC3C,OAAO;AAAA,EACP,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR,GAAG;AACL,GAAwC;AACtC,QAAM,OAAO,WAAW,aAAa,cAAc,QAAQ;AAC3D,QAAM,cAAc,kBAAkB;AAAA,IACpC,OAAO,gBAAgB,YAAY;AAAA,IACnC,GAAG;AAAA,IACH,cAAc,gBAAgB;AAAA,MAC5B;AAAA,MACA,QAAQ;AAAA,MACR,SAAS;AAAA,IACX,CAAC;AAAA,IACD,aAAa;AAAA,MACX,gBAAgB;AAAA,MAChB,GAAG,KAAK,QAAQ;AAAA,MAChB,GAAG,QAAQ;AAAA,IACb;AAAA,IACA,qBAAqB;AAAA,MACnB,GAAG,KAAK,gBAAgB;AAAA,MACxB,GAAG,QAAQ;AAAA,IACb;AAAA,EACF,CAAC;AAED,SAAO;AAAA,IACL;AAAA;AAAA;AAAA;AAAA,IAKA,OAAO;AAAA;AAAA;AAAA;AAAA,IAKP,QAAQ;AAAA;AAAA;AAAA;AAAA,IAKR,aAA4B;AAC1B,aAAO,QAAQ,IAAI,CAAC,YAAY,cAAc,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AAC,UAAU,OAAO,WAAW,UAAU;AACzC,UAAM,IAAI,MAAM,sBAAsB;AAAA,EACxC;AAEA,MAAI,CAAC,UAAW,WAAW,OAAO,WAAW,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.55.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"],"mappings":";AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,0BAA0B;;;ACEnC,SAAS,YAAY,mBAAmB,iBAAiB,wBAAwB;AAoB1E,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,CAAC;AACzD;AAEO,SAAS,6BAA6B;AAAA,EAC3C,OAAO;AAAA,EACP,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR,GAAG;AACL,GAAwC;AACtC,QAAM,OAAO,WAAW,aAAa,cAAc,QAAQ;AAC3D,QAAM,cAAc,kBAAkB;AAAA,IACpC,OAAO,gBAAgB,YAAY;AAAA,IACnC,GAAG;AAAA,IACH,cAAc,gBAAgB;AAAA,MAC5B;AAAA,MACA,QAAQ;AAAA,MACR,SAAS;AAAA,IACX,CAAC;AAAA,IACD,aAAa;AAAA,MACX,gBAAgB;AAAA,MAChB,GAAG,KAAK,QAAQ;AAAA,MAChB,GAAG,QAAQ;AAAA,IACb;AAAA,IACA,qBAAqB;AAAA,MACnB,GAAG,KAAK,gBAAgB;AAAA,MACxB,GAAG,QAAQ;AAAA,IACb;AAAA,EACF,CAAC;AAED,SAAO;AAAA,IACL;AAAA;AAAA;AAAA;AAAA,IAKA,OAAO;AAAA;AAAA;AAAA;AAAA,IAKP,QAAQ;AAAA;AAAA;AAAA;AAAA,IAKR,aAA4B;AAC1B,aAAO,QAAQ,IAAI,CAAC,YAAY,cAAc,MAAM,GAAG,YAAY,eAAe,MAAM,CAAC,CAAC,EAAE,KAAK,MAA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sB;AAAA,EACxC;AAEA,MAAI,CAAC,UAAW,WAAW,OAAO,WAAW,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,6 +1,6 @@
|
|
|
1
|
-
function Y(t){let e,
|
|
1
|
+
function Y(t){let e,s=`algolia-client-js-${t.key}`;function r(){return e===void 0&&(e=t.localStorage||window.localStorage),e}function a(){return JSON.parse(r().getItem(s)||"{}")}function u(o){r().setItem(s,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},r().setItem(s,JSON.stringify(c)),n})},delete(o){return p().then(()=>{let n=a();delete n[JSON.stringify(o)],r().setItem(s,JSON.stringify(n))})},clear(){return Promise.resolve().then(()=>{r().removeItem(s)})}}}function ce(){return{get(t,e,s={miss:()=>Promise.resolve()}){return e().then(a=>Promise.all([a,s.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],s=e.shift();return s===void 0?ce():{get(r,a,u={miss:()=>Promise.resolve()}){return s.get(r,a,u).catch(()=>O({caches:e}).get(r,a,u))},set(r,a){return s.set(r,a).catch(()=>O({caches:e}).set(r,a))},delete(r){return s.delete(r).catch(()=>O({caches:e}).delete(r))},clear(){return s.clear().catch(()=>O({caches:e}).clear())}}}function _(t={serializable:!0}){let e={};return{get(s,r,a={miss:()=>Promise.resolve()}){let u=JSON.stringify(s);if(u in e)return Promise.resolve(t.serializable?JSON.parse(e[u]):e[u]);let p=r();return p.then(i=>a.miss(i)).then(()=>p)},set(s,r){return e[JSON.stringify(s)]=t.serializable?JSON.stringify(r):r,Promise.resolve(r)},delete(s){return delete e[JSON.stringify(s)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}function ue(t){let e={value:`Algolia for JavaScript (${t})`,add(s){let r=`; ${s.segment}${s.version!==void 0?` (${s.version})`:""}`;return e.value.indexOf(r)===-1&&(e.value=`${e.value}${r}`),e}};return e}function Z(t,e,s="WithinHeaders"){let r={"x-algolia-api-key":e,"x-algolia-application-id":t};return{headers(){return s==="WithinHeaders"?r:{}},queryParameters(){return s==="WithinQueryParameters"?r:{}}}}function ee({algoliaAgents:t,client:e,version:s}){let r=ue(s).add({segment:e,version:s});return t.forEach(a=>r.add(a)),r}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:s,value:r}=await e.read();if(s)return;yield r}}finally{e.releaseLock()}}function me(t){return Symbol.asyncIterator in t?t:de(t)}async function*fe(t){let e=new TextDecoder("utf-8"),s=[],r=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
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(
|
|
4
|
-
`?2:1:(a=!0,m=1)):(h=f,m=1);let P=o.slice(n,h);
|
|
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};
|
|
3
|
+
`,n);if(c===-1&&f===-1){let l=o.slice(n);if(s.push(l),r+=l.length,r>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);s.push(P);let q=s.length===1?s[0]:s.join("");s.length=0,r=0,u&&(q.startsWith("\uFEFF")&&(q=q.slice(1)),u=!1),yield q,n=h+m}}let p=e.decode();if(p&&s.push(p),s.length>0){let i=s.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(":"),s,r;switch(e===-1?(s=t,r=""):(s=t.slice(0,e),r=t.slice(e+1),r[0]===" "&&(r=r.slice(1))),s){case"data":this.data.push(r);break;case"event":this.eventType=r;break;case"id":r.includes("\0")||(this.lastEventId=r);break;case"retry":/^[0-9]+$/.test(r)&&(this.retry=parseInt(r,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 s of fe(t)){let r=e.decode(s);r!==null&&(yield r)}}var ge=750,J=120*1e3;function M(t,e="up"){let s=Date.now();function r(){return e==="up"||Date.now()-s>J}function a(){return e==="timed out"&&Date.now()-s<=J}return{...t,status:e,lastUpdate:s,isUp:r,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,s){super(t,s),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,s,r="ApiError"){super(t,s,r),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,s,r){super(t,e,r,"DetailedApiError"),this.error=s}};function X(t,e,s){let r=Ee(s),a=`${t.protocol}://${t.url}${t.port?`:${t.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return r.length&&(a+=`?${r}`),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 s=Array.isArray(t.data)?t.data:{...t.data,...e.data};return JSON.stringify(s)}function V(t,e,s){let r={Accept:"application/json",...t,...e,...s},a={};return Object.keys(r).forEach(u=>{let p=r[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},s){try{let r=JSON.parse(t);return"error"in r?new Pe(r.message,e,r.error,s):new G(r.message,e,s)}catch{}return new G(t,e,s)}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:s,logger:r,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(s,l.headers,d.headers),g=f==="gzip"&&x!==void 0&&x.length>ge&&(l.method==="POST"||l.method==="PUT");g&&c===void 0&&r.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++,r.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:s}};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(s,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:r,algoliaAgent:u,baseHeaders:s,baseQueryParameters:a,hosts:t,request:P,requestStream:q,requestsCache:o,responsesCache:n}}function T(t,e,s){if(s==null||typeof s=="string"&&s.length===0)throw new Error(`Parameter \`${t}\` is required when calling \`${e}\`.`)}function ae(){function t(e){return new Promise(s=>{let r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach(i=>r.setRequestHeader(i,e.headers[i]));let a=(i,o)=>setTimeout(()=>{r.abort(),s({status:0,content:o,isTimedOut:!0})},i),u=a(e.connectTimeout,"Connection timeout"),p;r.onreadystatechange=()=>{r.readyState>r.OPENED&&p===void 0&&(clearTimeout(u),p=a(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{r.status===0&&(clearTimeout(u),clearTimeout(p),s({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(u),clearTimeout(p),s({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)})}return{send:t}}var k="5.55.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:s,algoliaAgents:r,region:a,...u}){let p=Z(t,e,s),i=ne({hosts:Ce(a),...u,algoliaAgent:ee({algoliaAgents:r,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}){!s||s==="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,s,r){if(!t||typeof t!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");if(!s||s&&(typeof s!="string"||!Q.includes(s)))throw new Error(`\`region\` is required and must be one of the following: ${Q.join(", ")}`);let{compression:a,...u}=r||{};return ie({appId:t,apiKey:e,region:s,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};
|
|
6
6
|
//# sourceMappingURL=browser.min.js.map
|