Socket
Socket
Sign inDemoInstall

@algolia/client-query-suggestions

Package Overview
Dependencies
Maintainers
0
Versions
153
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@algolia/client-query-suggestions - npm Package Compare versions

Comparing version 5.2.5 to 5.3.0

299

dist/browser.d.ts
import * as _algolia_client_common from '@algolia/client-common';
import { ClientOptions } from '@algolia/client-common';
import { CreateClientOptions, RequestOptions, ClientOptions } from '@algolia/client-common';
type AppID = {
/**
* Algolia application ID to which this Query Suggestions configuration belongs.
*/
appID?: string;
};
type BaseResponse = {

@@ -22,25 +15,2 @@ /**

type ConfigStatus = {
/**
* Name of the Query Suggestions index (case-sensitive).
*/
indexName?: string;
/**
* Whether the creation or update of the Query Suggestions index is in progress.
*/
isRunning?: boolean;
/**
* Date and time when the Query Suggestions index was last built, in RFC 3339 format.
*/
lastBuiltAt?: string;
/**
* Date and time when the Query Suggestions index was last updated successfully.
*/
lastSuccessfulBuiltAt?: string;
/**
* Duration of the last successful build in seconds.
*/
lastSuccessfulBuildDuration?: string;
};
/**

@@ -112,40 +82,2 @@ * Languages for deduplicating singular and plural suggestions. If specified, only the more popular form is included.

/**
* Query Suggestions configuration.
*/
type ConfigurationWithIndex = Configuration & Record<string, unknown>;
/**
* API response for retrieving Query Suggestions configurations.
*/
type ConfigurationResponse = AppID & ConfigurationWithIndex;
/**
* Error.
*/
type ErrorBase = Record<string, any> & {
message?: string;
};
/**
* Type of log entry. - `SKIP`. A query is skipped because it doesn\'t match the conditions for successful inclusion. For example, when a query doesn\'t generate enough search results. - `INFO`. An informative log entry. - `ERROR`. The Query Suggestions process encountered an error.
*/
type LogLevel = 'ERROR' | 'INFO' | 'SKIP';
type LogFile = {
/**
* Date and time of the log entry, in RFC 3339 format.
*/
timestamp?: string;
level?: LogLevel;
/**
* Details about this log entry.
*/
message?: string;
/**
* Level indicating the position of a suggestion in a hierarchy of records. For example, a `contextLevel` of 1 indicates that this suggestion belongs to a previous suggestion with `contextLevel` 0.
*/
contextLevel?: number;
};
/**
* Properties for the `customDelete` method.

@@ -257,29 +189,224 @@ */

declare const apiClientVersion = "5.2.5";
declare const REGIONS: readonly ["eu", "us"];
type Region = (typeof REGIONS)[number];
type ConfigStatus = {
/**
* Name of the Query Suggestions index (case-sensitive).
*/
indexName?: string;
/**
* Whether the creation or update of the Query Suggestions index is in progress.
*/
isRunning?: boolean;
/**
* Date and time when the Query Suggestions index was last built, in RFC 3339 format.
*/
lastBuiltAt?: string;
/**
* Date and time when the Query Suggestions index was last updated successfully.
*/
lastSuccessfulBuiltAt?: string;
/**
* Duration of the last successful build in seconds.
*/
lastSuccessfulBuildDuration?: string;
};
type AppID = {
/**
* Algolia application ID to which this Query Suggestions configuration belongs.
*/
appID?: string;
};
/**
* The client type.
* Query Suggestions configuration.
*/
type QuerySuggestionsClient = ReturnType<typeof querySuggestionsClient>;
declare function querySuggestionsClient(appId: string, apiKey: string, region: Region, options?: ClientOptions): {
type ConfigurationWithIndex = Configuration & Record<string, unknown>;
/**
* API response for retrieving Query Suggestions configurations.
*/
type ConfigurationResponse = AppID & ConfigurationWithIndex;
/**
* Type of log entry. - `SKIP`. A query is skipped because it doesn\'t match the conditions for successful inclusion. For example, when a query doesn\'t generate enough search results. - `INFO`. An informative log entry. - `ERROR`. The Query Suggestions process encountered an error.
*/
type LogLevel = 'ERROR' | 'INFO' | 'SKIP';
type LogFile = {
/**
* Date and time of the log entry, in RFC 3339 format.
*/
timestamp?: string;
level?: LogLevel;
/**
* Details about this log entry.
*/
message?: string;
/**
* Level indicating the position of a suggestion in a hierarchy of records. For example, a `contextLevel` of 1 indicates that this suggestion belongs to a previous suggestion with `contextLevel` 0.
*/
contextLevel?: number;
};
declare const apiClientVersion = "5.3.0";
declare const REGIONS: readonly ["eu", "us"];
type Region = (typeof REGIONS)[number];
declare function createQuerySuggestionsClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, region: regionOption, ...options }: CreateClientOptions & {
region: Region;
}): {
transporter: _algolia_client_common.Transporter;
/**
* The `appId` currently in use.
*/
appId: string;
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache(): Promise<void>;
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
readonly _ua: string;
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment: string, version?: string): void;
createConfig(configurationWithIndex: ConfigurationWithIndex, requestOptions?: _algolia_client_common.RequestOptions): Promise<BaseResponse>;
customDelete({ path, parameters }: CustomDeleteProps, requestOptions?: _algolia_client_common.RequestOptions): Promise<Record<string, unknown>>;
customGet({ path, parameters }: CustomGetProps, requestOptions?: _algolia_client_common.RequestOptions): Promise<Record<string, unknown>>;
customPost({ path, parameters, body }: CustomPostProps, requestOptions?: _algolia_client_common.RequestOptions): Promise<Record<string, unknown>>;
customPut({ path, parameters, body }: CustomPutProps, requestOptions?: _algolia_client_common.RequestOptions): Promise<Record<string, unknown>>;
deleteConfig({ indexName }: DeleteConfigProps, requestOptions?: _algolia_client_common.RequestOptions): Promise<BaseResponse>;
getAllConfigs(requestOptions?: _algolia_client_common.RequestOptions): Promise<ConfigurationResponse[]>;
getConfig({ indexName }: GetConfigProps, requestOptions?: _algolia_client_common.RequestOptions): Promise<ConfigurationResponse>;
getConfigStatus({ indexName }: GetConfigStatusProps, requestOptions?: _algolia_client_common.RequestOptions): Promise<ConfigStatus>;
getLogFile({ indexName }: GetLogFileProps, requestOptions?: _algolia_client_common.RequestOptions): Promise<LogFile>;
updateConfig({ indexName, configuration }: UpdateConfigProps, requestOptions?: _algolia_client_common.RequestOptions): Promise<BaseResponse>;
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }: {
apiKey: string;
}): void;
/**
* Creates a new Query Suggestions configuration. You can have up to 100 configurations per Algolia application.
*
* Required API Key ACLs:
* - editSettings.
*
* @param configurationWithIndex - The configurationWithIndex object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
createConfig(configurationWithIndex: ConfigurationWithIndex, requestOptions?: RequestOptions): Promise<BaseResponse>;
/**
* This method allow you to send requests to the Algolia REST API.
*
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, anything after \"/1\" must be specified.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }: CustomDeleteProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method allow you to send requests to the Algolia REST API.
*
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, anything after \"/1\" must be specified.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method allow you to send requests to the Algolia REST API.
*
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, anything after \"/1\" must be specified.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }: CustomPostProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method allow you to send requests to the Algolia REST API.
*
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, anything after \"/1\" must be specified.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }: CustomPutProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* 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.
*
* Required API Key ACLs:
* - editSettings.
*
* @param deleteConfig - The deleteConfig object.
* @param deleteConfig.indexName - Query Suggestions index name.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteConfig({ indexName }: DeleteConfigProps, requestOptions?: RequestOptions): Promise<BaseResponse>;
/**
* Retrieves all Query Suggestions configurations of your Algolia application.
*
* Required API Key ACLs:
* - settings.
*
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getAllConfigs(requestOptions?: RequestOptions): Promise<ConfigurationResponse[]>;
/**
* Retrieves a single Query Suggestions configuration by its index name.
*
* Required API Key ACLs:
* - settings.
*
* @param getConfig - The getConfig object.
* @param getConfig.indexName - Query Suggestions index name.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getConfig({ indexName }: GetConfigProps, requestOptions?: RequestOptions): Promise<ConfigurationResponse>;
/**
* Reports the status of a Query Suggestions index.
*
* Required API Key ACLs:
* - settings.
*
* @param getConfigStatus - The getConfigStatus object.
* @param getConfigStatus.indexName - Query Suggestions index name.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getConfigStatus({ indexName }: GetConfigStatusProps, requestOptions?: RequestOptions): Promise<ConfigStatus>;
/**
* Retrieves the logs for a single Query Suggestions index.
*
* Required API Key ACLs:
* - settings.
*
* @param getLogFile - The getLogFile object.
* @param getLogFile.indexName - Query Suggestions index name.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getLogFile({ indexName }: GetLogFileProps, requestOptions?: RequestOptions): Promise<LogFile>;
/**
* Updates a QuerySuggestions configuration.
*
* Required API Key ACLs:
* - editSettings.
*
* @param updateConfig - The updateConfig object.
* @param updateConfig.indexName - Query Suggestions index name.
* @param updateConfig.configuration - The configuration object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
updateConfig({ indexName, configuration }: UpdateConfigProps, requestOptions?: RequestOptions): Promise<BaseResponse>;
};
/**
* Error.
*/
type ErrorBase = Record<string, any> & {
message?: string;
};
type QuerySuggestionsClient = ReturnType<typeof createQuerySuggestionsClient>;
declare function querySuggestionsClient(appId: string, apiKey: string, region: Region, options?: ClientOptions): QuerySuggestionsClient;
export { type AppID, type BaseResponse, type ConfigStatus, type Configuration, type ConfigurationResponse, type ConfigurationWithIndex, type CustomDeleteProps, type CustomGetProps, type CustomPostProps, type CustomPutProps, type DeleteConfigProps, type ErrorBase, type Facet, type GetConfigProps, type GetConfigStatusProps, type GetLogFileProps, type Languages, type LogFile, type LogLevel, type QuerySuggestionsClient, type Region, type SourceIndex, type UpdateConfigProps, apiClientVersion, querySuggestionsClient };

@@ -14,3 +14,3 @@ // builds/browser.ts

import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
var apiClientVersion = "5.2.5";
var apiClientVersion = "5.3.0";
var REGIONS = ["eu", "us"];

@@ -30,22 +30,21 @@ function getDefaultHosts(region) {

const auth = createAuth(appIdOption, apiKeyOption, authMode);
const transporter = createTransporter({
hosts: getDefaultHosts(regionOption),
...options,
algoliaAgent: getAlgoliaAgent({
algoliaAgents,
client: "QuerySuggestions",
version: apiClientVersion
return {
transporter: createTransporter({
hosts: getDefaultHosts(regionOption),
...options,
algoliaAgent: getAlgoliaAgent({
algoliaAgents,
client: "QuerySuggestions",
version: apiClientVersion
}),
baseHeaders: {
"content-type": "text/plain",
...auth.headers(),
...options.baseHeaders
},
baseQueryParameters: {
...auth.queryParameters(),
...options.baseQueryParameters
}
}),
baseHeaders: {
"content-type": "text/plain",
...auth.headers(),
...options.baseHeaders
},
baseQueryParameters: {
...auth.queryParameters(),
...options.baseQueryParameters
}
});
return {
transporter,
/**

@@ -59,3 +58,5 @@ * The `appId` currently in use.

clearCache() {
return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
return Promise.all([this.transporter.requestsCache.clear(), this.transporter.responsesCache.clear()]).then(
() => void 0
);
},

@@ -66,3 +67,3 @@ /**

get _ua() {
return transporter.algoliaAgent.value;
return this.transporter.algoliaAgent.value;
},

@@ -76,5 +77,14 @@ /**

addAlgoliaAgent(segment, version) {
transporter.algoliaAgent.add({ segment, version });
this.transporter.algoliaAgent.add({ segment, version });
},
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }) {
this.transporter.baseHeaders["x-algolia-api-key"] = apiKey;
},
/**
* Creates a new Query Suggestions configuration. You can have up to 100 configurations per Algolia application.

@@ -102,3 +112,3 @@ *

};
return transporter.request(request, requestOptions);
return this.transporter.request(request, requestOptions);
},

@@ -126,3 +136,3 @@ /**

};
return transporter.request(request, requestOptions);
return this.transporter.request(request, requestOptions);
},

@@ -150,3 +160,3 @@ /**

};
return transporter.request(request, requestOptions);
return this.transporter.request(request, requestOptions);
},

@@ -176,3 +186,3 @@ /**

};
return transporter.request(request, requestOptions);
return this.transporter.request(request, requestOptions);
},

@@ -202,3 +212,3 @@ /**

};
return transporter.request(request, requestOptions);
return this.transporter.request(request, requestOptions);
},

@@ -228,3 +238,3 @@ /**

};
return transporter.request(request, requestOptions);
return this.transporter.request(request, requestOptions);
},

@@ -249,3 +259,3 @@ /**

};
return transporter.request(request, requestOptions);
return this.transporter.request(request, requestOptions);
},

@@ -275,3 +285,3 @@ /**

};
return transporter.request(request, requestOptions);
return this.transporter.request(request, requestOptions);
},

@@ -301,3 +311,3 @@ /**

};
return transporter.request(request, requestOptions);
return this.transporter.request(request, requestOptions);
},

@@ -327,3 +337,3 @@ /**

};
return transporter.request(request, requestOptions);
return this.transporter.request(request, requestOptions);
},

@@ -361,3 +371,3 @@ /**

};
return transporter.request(request, requestOptions);
return this.transporter.request(request, requestOptions);
}

@@ -364,0 +374,0 @@ };

@@ -1,2 +0,2 @@

function W(t,e,o="WithinHeaders"){let r={"x-algolia-api-key":e,"x-algolia-application-id":t};return{headers(){return o==="WithinHeaders"?r:{}},queryParameters(){return o==="WithinQueryParameters"?r:{}}}}function G(t){let e,o=`algolia-client-js-${t.key}`;function r(){return e===void 0&&(e=t.localStorage||window.localStorage),e}function i(){return JSON.parse(r().getItem(o)||"{}")}function m(a){r().setItem(o,JSON.stringify(a))}function p(){let a=t.timeToLive?t.timeToLive*1e3:null,s=i(),n=Object.fromEntries(Object.entries(s).filter(([,d])=>d.timestamp!==void 0));if(m(n),!a)return;let u=Object.fromEntries(Object.entries(n).filter(([,d])=>{let l=new Date().getTime();return!(d.timestamp+a<l)}));m(u)}return{get(a,s,n={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(p(),i()[JSON.stringify(a)])).then(u=>Promise.all([u?u.value:s(),u!==void 0])).then(([u,d])=>Promise.all([u,d||n.miss(u)])).then(([u])=>u)},set(a,s){return Promise.resolve().then(()=>{let n=i();return n[JSON.stringify(a)]={timestamp:new Date().getTime(),value:s},r().setItem(o,JSON.stringify(n)),s})},delete(a){return Promise.resolve().then(()=>{let s=i();delete s[JSON.stringify(a)],r().setItem(o,JSON.stringify(s))})},clear(){return Promise.resolve().then(()=>{r().removeItem(o)})}}}function Y(){return{get(t,e,o={miss:()=>Promise.resolve()}){return e().then(i=>Promise.all([i,o.miss(i)])).then(([i])=>i)},set(t,e){return Promise.resolve(e)},delete(t){return Promise.resolve()},clear(){return Promise.resolve()}}}function R(t){let e=[...t.caches],o=e.shift();return o===void 0?Y():{get(r,i,m={miss:()=>Promise.resolve()}){return o.get(r,i,m).catch(()=>R({caches:e}).get(r,i,m))},set(r,i){return o.set(r,i).catch(()=>R({caches:e}).set(r,i))},delete(r){return o.delete(r).catch(()=>R({caches:e}).delete(r))},clear(){return o.clear().catch(()=>R({caches:e}).clear())}}}function O(t={serializable:!0}){let e={};return{get(o,r,i={miss:()=>Promise.resolve()}){let m=JSON.stringify(o);if(m in e)return Promise.resolve(t.serializable?JSON.parse(e[m]):e[m]);let p=r();return p.then(a=>i.miss(a)).then(()=>p)},set(o,r){return e[JSON.stringify(o)]=t.serializable?JSON.stringify(r):r,Promise.resolve(r)},delete(o){return delete e[JSON.stringify(o)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}var k=2*60*1e3;function H(t,e="up"){let o=Date.now();function r(){return e==="up"||Date.now()-o>k}function i(){return e==="timed out"&&Date.now()-o<=k}return{...t,status:e,lastUpdate:o,isUp:r,isTimedOut:i}}var Q=class extends Error{name="AlgoliaError";constructor(t,e){super(t),e&&(this.name=e)}},j=class extends Q{stackTrace;constructor(t,e,o){super(t,o),this.stackTrace=e}},Z=class extends j{constructor(t){super("Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support.",t,"RetryError")}},N=class extends j{status;constructor(t,e,o,r="ApiError"){super(t,o,r),this.status=e}},ee=class extends Q{response;constructor(t,e){super(t,"DeserializationError"),this.response=e}},te=class extends N{error;constructor(t,e,o,r){super(t,e,r,"DetailedApiError"),this.error=o}};function re(t,e,o){let r=oe(o),i=`${t.protocol}://${t.url}${t.port?`:${t.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return r.length&&(i+=`?${r}`),i}function oe(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]).replaceAll("+","%20")}`).join("&")}function se(t,e){if(t.method==="GET"||t.data===void 0&&e.data===void 0)return;let o=Array.isArray(t.data)?t.data:{...t.data,...e.data};return JSON.stringify(o)}function ae(t,e,o){let r={Accept:"application/json",...t,...e,...o},i={};return Object.keys(r).forEach(m=>{let p=r[m];i[m.toLowerCase()]=p}),i}function ne(t){try{return JSON.parse(t.content)}catch(e){throw new ee(e.message,t)}}function ie({content:t,status:e},o){try{let r=JSON.parse(t);return"error"in r?new te(r.message,e,r.error,o):new N(r.message,e,o)}catch{}return new N(t,e,o)}function ce({isTimedOut:t,status:e}){return!t&&~~e===0}function ue({isTimedOut:t,status:e}){return t||ce({isTimedOut:t,status:e})||~~(e/100)!==2&&~~(e/100)!==4}function le({status:t}){return~~(t/100)===2}function me(t){return t.map(e=>F(e))}function F(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 J({hosts:t,hostsCache:e,baseHeaders:o,baseQueryParameters:r,algoliaAgent:i,timeouts:m,requester:p,requestsCache:a,responsesCache:s}){async function n(l){let c=await Promise.all(l.map(h=>e.get(h,()=>Promise.resolve(H(h))))),g=c.filter(h=>h.isUp()),f=c.filter(h=>h.isTimedOut()),T=[...g,...f];return{hosts:T.length>0?T:l,getTimeout(h,q){return(f.length===0&&h===0?1:f.length+3+h)*q}}}async function u(l,c,g=!0){let f=[],T=se(l,c),y=ae(o,l.headers,c.headers),h=l.method==="GET"?{...l.data,...c.data}:{},q={...r,...l.queryParameters,...h};if(i.value&&(q["x-algolia-agent"]=i.value),c&&c.queryParameters)for(let P of Object.keys(c.queryParameters))!c.queryParameters[P]||Object.prototype.toString.call(c.queryParameters[P])==="[object Object]"?q[P]=c.queryParameters[P]:q[P]=c.queryParameters[P].toString();let C=0,I=async(P,v)=>{let w=P.pop();if(w===void 0)throw new Z(me(f));let x={...m,...c.timeouts},D={data:T,headers:y,method:l.method,url:re(w,l.path,q),connectTimeout:v(C,x.connect),responseTimeout:v(C,g?x.read:x.write)},_=A=>{let L={request:D,response:A,host:w,triesLeft:P.length};return f.push(L),L},E=await p.send(D);if(ue(E)){let A=_(E);return E.isTimedOut&&C++,console.log("Retryable failure",F(A)),await e.set(w,H(w,E.isTimedOut?"timed out":"down")),I(P,v)}if(le(E))return ne(E);throw _(E),ie(E,f)},K=t.filter(P=>P.accept==="readWrite"||(g?P.accept==="read":P.accept==="write")),U=await n(K);return I([...U.hosts].reverse(),U.getTimeout)}function d(l,c={}){let g=l.useReadTransporter||l.method==="GET";if(!g)return u(l,c,g);let f=()=>u(l,c);if((c.cacheable||l.cacheable)!==!0)return f();let y={request:l,requestOptions:c,transporter:{queryParameters:r,headers:o}};return s.get(y,()=>a.get(y,()=>a.set(y,f()).then(h=>Promise.all([a.delete(y),h]),h=>Promise.all([a.delete(y),Promise.reject(h)])).then(([h,q])=>q)),{miss:h=>s.set(y,h)})}return{hostsCache:e,requester:p,timeouts:m,algoliaAgent:i,baseHeaders:o,baseQueryParameters:r,hosts:t,request:d,requestsCache:a,responsesCache:s}}function de(t){let e={value:`Algolia for JavaScript (${t})`,add(o){let r=`; ${o.segment}${o.version!==void 0?` (${o.version})`:""}`;return e.value.indexOf(r)===-1&&(e.value=`${e.value}${r}`),e}};return e}function $({algoliaAgents:t,client:e,version:o}){let r=de(o).add({segment:e,version:o});return t.forEach(i=>r.add(i)),r}var M=1e3,z=2e3,B=3e4;function X(){function t(e){return new Promise(o=>{let r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach(a=>r.setRequestHeader(a,e.headers[a]));let i=(a,s)=>setTimeout(()=>{r.abort(),o({status:0,content:s,isTimedOut:!0})},a),m=i(e.connectTimeout,"Connection timeout"),p;r.onreadystatechange=()=>{r.readyState>r.OPENED&&p===void 0&&(clearTimeout(m),p=i(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{r.status===0&&(clearTimeout(m),clearTimeout(p),o({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(m),clearTimeout(p),o({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)})}return{send:t}}var S="5.2.5",b=["eu","us"];function he(t){return[{url:"query-suggestions.{region}.algolia.com".replace("{region}",t),accept:"readWrite",protocol:"https"}]}function V({appId:t,apiKey:e,authMode:o,algoliaAgents:r,region:i,...m}){let p=W(t,e,o),a=J({hosts:he(i),...m,algoliaAgent:$({algoliaAgents:r,client:"QuerySuggestions",version:S}),baseHeaders:{"content-type":"text/plain",...p.headers(),...m.baseHeaders},baseQueryParameters:{...p.queryParameters(),...m.baseQueryParameters}});return{transporter:a,appId:t,clearCache(){return Promise.all([a.requestsCache.clear(),a.responsesCache.clear()]).then(()=>{})},get _ua(){return a.algoliaAgent.value},addAlgoliaAgent(s,n){a.algoliaAgent.add({segment:s,version:n})},createConfig(s,n){if(!s)throw new Error("Parameter `configurationWithIndex` is required when calling `createConfig`.");let c={method:"POST",path:"/1/configs",queryParameters:{},headers:{},data:s};return a.request(c,n)},customDelete({path:s,parameters:n},u){if(!s)throw new Error("Parameter `path` is required when calling `customDelete`.");let g={method:"DELETE",path:"/{path}".replace("{path}",s),queryParameters:n||{},headers:{}};return a.request(g,u)},customGet({path:s,parameters:n},u){if(!s)throw new Error("Parameter `path` is required when calling `customGet`.");let g={method:"GET",path:"/{path}".replace("{path}",s),queryParameters:n||{},headers:{}};return a.request(g,u)},customPost({path:s,parameters:n,body:u},d){if(!s)throw new Error("Parameter `path` is required when calling `customPost`.");let f={method:"POST",path:"/{path}".replace("{path}",s),queryParameters:n||{},headers:{},data:u||{}};return a.request(f,d)},customPut({path:s,parameters:n,body:u},d){if(!s)throw new Error("Parameter `path` is required when calling `customPut`.");let f={method:"PUT",path:"/{path}".replace("{path}",s),queryParameters:n||{},headers:{},data:u||{}};return a.request(f,d)},deleteConfig({indexName:s},n){if(!s)throw new Error("Parameter `indexName` is required when calling `deleteConfig`.");let c={method:"DELETE",path:"/1/configs/{indexName}".replace("{indexName}",encodeURIComponent(s)),queryParameters:{},headers:{}};return a.request(c,n)},getAllConfigs(s){let l={method:"GET",path:"/1/configs",queryParameters:{},headers:{}};return a.request(l,s)},getConfig({indexName:s},n){if(!s)throw new Error("Parameter `indexName` is required when calling `getConfig`.");let c={method:"GET",path:"/1/configs/{indexName}".replace("{indexName}",encodeURIComponent(s)),queryParameters:{},headers:{}};return a.request(c,n)},getConfigStatus({indexName:s},n){if(!s)throw new Error("Parameter `indexName` is required when calling `getConfigStatus`.");let c={method:"GET",path:"/1/configs/{indexName}/status".replace("{indexName}",encodeURIComponent(s)),queryParameters:{},headers:{}};return a.request(c,n)},getLogFile({indexName:s},n){if(!s)throw new Error("Parameter `indexName` is required when calling `getLogFile`.");let c={method:"GET",path:"/1/logs/{indexName}".replace("{indexName}",encodeURIComponent(s)),queryParameters:{},headers:{}};return a.request(c,n)},updateConfig({indexName:s,configuration:n},u){if(!s)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 g={method:"PUT",path:"/1/configs/{indexName}".replace("{indexName}",encodeURIComponent(s)),queryParameters:{},headers:{},data:n};return a.request(g,u)}}}function je(t,e,o,r){if(!t||typeof t!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");if(!o||o&&(typeof o!="string"||!b.includes(o)))throw new Error(`\`region\` is required and must be one of the following: ${b.join(", ")}`);return V({appId:t,apiKey:e,region:o,timeouts:{connect:M,read:z,write:B},requester:X(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:O(),requestsCache:O({serializable:!1}),hostsCache:R({caches:[G({key:`${S}-${t}`}),O()]}),...r})}export{S as apiClientVersion,je as querySuggestionsClient};
function W(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 Q(t){let e,s=`algolia-client-js-${t.key}`;function r(){return e===void 0&&(e=t.localStorage||window.localStorage),e}function n(){return JSON.parse(r().getItem(s)||"{}")}function m(o){r().setItem(s,JSON.stringify(o))}function p(){let o=t.timeToLive?t.timeToLive*1e3:null,a=n(),c=Object.fromEntries(Object.entries(a).filter(([,d])=>d.timestamp!==void 0));if(m(c),!o)return;let l=Object.fromEntries(Object.entries(c).filter(([,d])=>{let i=new Date().getTime();return!(d.timestamp+o<i)}));m(l)}return{get(o,a,c={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(p(),n()[JSON.stringify(o)])).then(l=>Promise.all([l?l.value:a(),l!==void 0])).then(([l,d])=>Promise.all([l,d||c.miss(l)])).then(([l])=>l)},set(o,a){return Promise.resolve().then(()=>{let c=n();return c[JSON.stringify(o)]={timestamp:new Date().getTime(),value:a},r().setItem(s,JSON.stringify(c)),a})},delete(o){return Promise.resolve().then(()=>{let a=n();delete a[JSON.stringify(o)],r().setItem(s,JSON.stringify(a))})},clear(){return Promise.resolve().then(()=>{r().removeItem(s)})}}}function Y(){return{get(t,e,s={miss:()=>Promise.resolve()}){return e().then(n=>Promise.all([n,s.miss(n)])).then(([n])=>n)},set(t,e){return Promise.resolve(e)},delete(t){return Promise.resolve()},clear(){return Promise.resolve()}}}function R(t){let e=[...t.caches],s=e.shift();return s===void 0?Y():{get(r,n,m={miss:()=>Promise.resolve()}){return s.get(r,n,m).catch(()=>R({caches:e}).get(r,n,m))},set(r,n){return s.set(r,n).catch(()=>R({caches:e}).set(r,n))},delete(r){return s.delete(r).catch(()=>R({caches:e}).delete(r))},clear(){return s.clear().catch(()=>R({caches:e}).clear())}}}function O(t={serializable:!0}){let e={};return{get(s,r,n={miss:()=>Promise.resolve()}){let m=JSON.stringify(s);if(m in e)return Promise.resolve(t.serializable?JSON.parse(e[m]):e[m]);let p=r();return p.then(o=>n.miss(o)).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()}}}var k=2*60*1e3;function H(t,e="up"){let s=Date.now();function r(){return e==="up"||Date.now()-s>k}function n(){return e==="timed out"&&Date.now()-s<=k}return{...t,status:e,lastUpdate:s,isUp:r,isTimedOut:n}}var G=class extends Error{name="AlgoliaError";constructor(t,e){super(t),e&&(this.name=e)}},j=class extends G{stackTrace;constructor(t,e,s){super(t,s),this.stackTrace=e}},Z=class extends j{constructor(t){super("Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support.",t,"RetryError")}},N=class extends j{status;constructor(t,e,s,r="ApiError"){super(t,s,r),this.status=e}},ee=class extends G{response;constructor(t,e){super(t,"DeserializationError"),this.response=e}},te=class extends N{error;constructor(t,e,s,r){super(t,e,r,"DetailedApiError"),this.error=s}};function re(t,e,s){let r=se(s),n=`${t.protocol}://${t.url}${t.port?`:${t.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return r.length&&(n+=`?${r}`),n}function se(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]).replaceAll("+","%20")}`).join("&")}function oe(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 ae(t,e,s){let r={Accept:"application/json",...t,...e,...s},n={};return Object.keys(r).forEach(m=>{let p=r[m];n[m.toLowerCase()]=p}),n}function ne(t){try{return JSON.parse(t.content)}catch(e){throw new ee(e.message,t)}}function ie({content:t,status:e},s){try{let r=JSON.parse(t);return"error"in r?new te(r.message,e,r.error,s):new N(r.message,e,s)}catch{}return new N(t,e,s)}function ue({isTimedOut:t,status:e}){return!t&&~~e===0}function ce({isTimedOut:t,status:e}){return t||ue({isTimedOut:t,status:e})||~~(e/100)!==2&&~~(e/100)!==4}function le({status:t}){return~~(t/100)===2}function me(t){return t.map(e=>F(e))}function F(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 J({hosts:t,hostsCache:e,baseHeaders:s,baseQueryParameters:r,algoliaAgent:n,timeouts:m,requester:p,requestsCache:o,responsesCache:a}){async function c(i){let u=await Promise.all(i.map(h=>e.get(h,()=>Promise.resolve(H(h))))),f=u.filter(h=>h.isUp()),P=u.filter(h=>h.isTimedOut()),T=[...f,...P];return{hosts:T.length>0?T:i,getTimeout(h,q){return(P.length===0&&h===0?1:P.length+3+h)*q}}}async function l(i,u,f=!0){let P=[],T=oe(i,u),y=ae(s,i.headers,u.headers),h=i.method==="GET"?{...i.data,...u.data}:{},q={...r,...i.queryParameters,...h};if(n.value&&(q["x-algolia-agent"]=n.value),u&&u.queryParameters)for(let g of Object.keys(u.queryParameters))!u.queryParameters[g]||Object.prototype.toString.call(u.queryParameters[g])==="[object Object]"?q[g]=u.queryParameters[g]:q[g]=u.queryParameters[g].toString();let C=0,I=async(g,v)=>{let w=g.pop();if(w===void 0)throw new Z(me(P));let x={...m,...u.timeouts},D={data:T,headers:y,method:i.method,url:re(w,i.path,q),connectTimeout:v(C,x.connect),responseTimeout:v(C,f?x.read:x.write)},_=A=>{let L={request:D,response:A,host:w,triesLeft:g.length};return P.push(L),L},E=await p.send(D);if(ce(E)){let A=_(E);return E.isTimedOut&&C++,console.log("Retryable failure",F(A)),await e.set(w,H(w,E.isTimedOut?"timed out":"down")),I(g,v)}if(le(E))return ne(E);throw _(E),ie(E,P)},V=t.filter(g=>g.accept==="readWrite"||(f?g.accept==="read":g.accept==="write")),U=await c(V);return I([...U.hosts].reverse(),U.getTimeout)}function d(i,u={}){let f=i.useReadTransporter||i.method==="GET";if(!f)return l(i,u,f);let P=()=>l(i,u);if((u.cacheable||i.cacheable)!==!0)return P();let y={request:i,requestOptions:u,transporter:{queryParameters:r,headers:s}};return a.get(y,()=>o.get(y,()=>o.set(y,P()).then(h=>Promise.all([o.delete(y),h]),h=>Promise.all([o.delete(y),Promise.reject(h)])).then(([h,q])=>q)),{miss:h=>a.set(y,h)})}return{hostsCache:e,requester:p,timeouts:m,algoliaAgent:n,baseHeaders:s,baseQueryParameters:r,hosts:t,request:d,requestsCache:o,responsesCache:a}}function de(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 $({algoliaAgents:t,client:e,version:s}){let r=de(s).add({segment:e,version:s});return t.forEach(n=>r.add(n)),r}var M=1e3,z=2e3,B=3e4;function X(){function t(e){return new Promise(s=>{let r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach(o=>r.setRequestHeader(o,e.headers[o]));let n=(o,a)=>setTimeout(()=>{r.abort(),s({status:0,content:a,isTimedOut:!0})},o),m=n(e.connectTimeout,"Connection timeout"),p;r.onreadystatechange=()=>{r.readyState>r.OPENED&&p===void 0&&(clearTimeout(m),p=n(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{r.status===0&&(clearTimeout(m),clearTimeout(p),s({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(m),clearTimeout(p),s({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)})}return{send:t}}var S="5.3.0",b=["eu","us"];function he(t){return[{url:"query-suggestions.{region}.algolia.com".replace("{region}",t),accept:"readWrite",protocol:"https"}]}function K({appId:t,apiKey:e,authMode:s,algoliaAgents:r,region:n,...m}){let p=W(t,e,s);return{transporter:J({hosts:he(n),...m,algoliaAgent:$({algoliaAgents:r,client:"QuerySuggestions",version:S}),baseHeaders:{"content-type":"text/plain",...p.headers(),...m.baseHeaders},baseQueryParameters:{...p.queryParameters(),...m.baseQueryParameters}}),appId:t,clearCache(){return Promise.all([this.transporter.requestsCache.clear(),this.transporter.responsesCache.clear()]).then(()=>{})},get _ua(){return this.transporter.algoliaAgent.value},addAlgoliaAgent(o,a){this.transporter.algoliaAgent.add({segment:o,version:a})},setClientApiKey({apiKey:o}){this.transporter.baseHeaders["x-algolia-api-key"]=o},createConfig(o,a){if(!o)throw new Error("Parameter `configurationWithIndex` is required when calling `createConfig`.");let i={method:"POST",path:"/1/configs",queryParameters:{},headers:{},data:o};return this.transporter.request(i,a)},customDelete({path:o,parameters:a},c){if(!o)throw new Error("Parameter `path` is required when calling `customDelete`.");let u={method:"DELETE",path:"/{path}".replace("{path}",o),queryParameters:a||{},headers:{}};return this.transporter.request(u,c)},customGet({path:o,parameters:a},c){if(!o)throw new Error("Parameter `path` is required when calling `customGet`.");let u={method:"GET",path:"/{path}".replace("{path}",o),queryParameters:a||{},headers:{}};return this.transporter.request(u,c)},customPost({path:o,parameters:a,body:c},l){if(!o)throw new Error("Parameter `path` is required when calling `customPost`.");let f={method:"POST",path:"/{path}".replace("{path}",o),queryParameters:a||{},headers:{},data:c||{}};return this.transporter.request(f,l)},customPut({path:o,parameters:a,body:c},l){if(!o)throw new Error("Parameter `path` is required when calling `customPut`.");let f={method:"PUT",path:"/{path}".replace("{path}",o),queryParameters:a||{},headers:{},data:c||{}};return this.transporter.request(f,l)},deleteConfig({indexName:o},a){if(!o)throw new Error("Parameter `indexName` is required when calling `deleteConfig`.");let i={method:"DELETE",path:"/1/configs/{indexName}".replace("{indexName}",encodeURIComponent(o)),queryParameters:{},headers:{}};return this.transporter.request(i,a)},getAllConfigs(o){let d={method:"GET",path:"/1/configs",queryParameters:{},headers:{}};return this.transporter.request(d,o)},getConfig({indexName:o},a){if(!o)throw new Error("Parameter `indexName` is required when calling `getConfig`.");let i={method:"GET",path:"/1/configs/{indexName}".replace("{indexName}",encodeURIComponent(o)),queryParameters:{},headers:{}};return this.transporter.request(i,a)},getConfigStatus({indexName:o},a){if(!o)throw new Error("Parameter `indexName` is required when calling `getConfigStatus`.");let i={method:"GET",path:"/1/configs/{indexName}/status".replace("{indexName}",encodeURIComponent(o)),queryParameters:{},headers:{}};return this.transporter.request(i,a)},getLogFile({indexName:o},a){if(!o)throw new Error("Parameter `indexName` is required when calling `getLogFile`.");let i={method:"GET",path:"/1/logs/{indexName}".replace("{indexName}",encodeURIComponent(o)),queryParameters:{},headers:{}};return this.transporter.request(i,a)},updateConfig({indexName:o,configuration:a},c){if(!o)throw new Error("Parameter `indexName` is required when calling `updateConfig`.");if(!a)throw new Error("Parameter `configuration` is required when calling `updateConfig`.");if(!a.sourceIndices)throw new Error("Parameter `configuration.sourceIndices` is required when calling `updateConfig`.");let u={method:"PUT",path:"/1/configs/{indexName}".replace("{indexName}",encodeURIComponent(o)),queryParameters:{},headers:{},data:a};return this.transporter.request(u,c)}}}function je(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"||!b.includes(s)))throw new Error(`\`region\` is required and must be one of the following: ${b.join(", ")}`);return K({appId:t,apiKey:e,region:s,timeouts:{connect:M,read:z,write:B},requester:X(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:O(),requestsCache:O({serializable:!1}),hostsCache:R({caches:[Q({key:`${S}-${t}`}),O()]}),...r})}export{S as apiClientVersion,je as querySuggestionsClient};
//# sourceMappingURL=browser.min.js.map

@@ -7,3 +7,3 @@ (function (global, factory) {

function W(t,e,o="WithinHeaders"){let r={"x-algolia-api-key":e,"x-algolia-application-id":t};return {headers(){return o==="WithinHeaders"?r:{}},queryParameters(){return o==="WithinQueryParameters"?r:{}}}}function G(t){let e,o=`algolia-client-js-${t.key}`;function r(){return e===void 0&&(e=t.localStorage||window.localStorage),e}function i(){return JSON.parse(r().getItem(o)||"{}")}function m(a){r().setItem(o,JSON.stringify(a));}function p(){let a=t.timeToLive?t.timeToLive*1e3:null,s=i(),n=Object.fromEntries(Object.entries(s).filter(([,d])=>d.timestamp!==void 0));if(m(n),!a)return;let u=Object.fromEntries(Object.entries(n).filter(([,d])=>{let l=new Date().getTime();return !(d.timestamp+a<l)}));m(u);}return {get(a,s,n={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(p(),i()[JSON.stringify(a)])).then(u=>Promise.all([u?u.value:s(),u!==void 0])).then(([u,d])=>Promise.all([u,d||n.miss(u)])).then(([u])=>u)},set(a,s){return Promise.resolve().then(()=>{let n=i();return n[JSON.stringify(a)]={timestamp:new Date().getTime(),value:s},r().setItem(o,JSON.stringify(n)),s})},delete(a){return Promise.resolve().then(()=>{let s=i();delete s[JSON.stringify(a)],r().setItem(o,JSON.stringify(s));})},clear(){return Promise.resolve().then(()=>{r().removeItem(o);})}}}function Y(){return {get(t,e,o={miss:()=>Promise.resolve()}){return e().then(i=>Promise.all([i,o.miss(i)])).then(([i])=>i)},set(t,e){return Promise.resolve(e)},delete(t){return Promise.resolve()},clear(){return Promise.resolve()}}}function R(t){let e=[...t.caches],o=e.shift();return o===void 0?Y():{get(r,i,m={miss:()=>Promise.resolve()}){return o.get(r,i,m).catch(()=>R({caches:e}).get(r,i,m))},set(r,i){return o.set(r,i).catch(()=>R({caches:e}).set(r,i))},delete(r){return o.delete(r).catch(()=>R({caches:e}).delete(r))},clear(){return o.clear().catch(()=>R({caches:e}).clear())}}}function O(t={serializable:!0}){let e={};return {get(o,r,i={miss:()=>Promise.resolve()}){let m=JSON.stringify(o);if(m in e)return Promise.resolve(t.serializable?JSON.parse(e[m]):e[m]);let p=r();return p.then(a=>i.miss(a)).then(()=>p)},set(o,r){return e[JSON.stringify(o)]=t.serializable?JSON.stringify(r):r,Promise.resolve(r)},delete(o){return delete e[JSON.stringify(o)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}var k=2*60*1e3;function H(t,e="up"){let o=Date.now();function r(){return e==="up"||Date.now()-o>k}function i(){return e==="timed out"&&Date.now()-o<=k}return {...t,status:e,lastUpdate:o,isUp:r,isTimedOut:i}}var Q=class extends Error{name="AlgoliaError";constructor(t,e){super(t),e&&(this.name=e);}},j=class extends Q{stackTrace;constructor(t,e,o){super(t,o),this.stackTrace=e;}},Z=class extends j{constructor(t){super("Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support.",t,"RetryError");}},N=class extends j{status;constructor(t,e,o,r="ApiError"){super(t,o,r),this.status=e;}},ee=class extends Q{response;constructor(t,e){super(t,"DeserializationError"),this.response=e;}},te=class extends N{error;constructor(t,e,o,r){super(t,e,r,"DetailedApiError"),this.error=o;}};function re(t,e,o){let r=oe(o),i=`${t.protocol}://${t.url}${t.port?`:${t.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return r.length&&(i+=`?${r}`),i}function oe(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]).replaceAll("+","%20")}`).join("&")}function se(t,e){if(t.method==="GET"||t.data===void 0&&e.data===void 0)return;let o=Array.isArray(t.data)?t.data:{...t.data,...e.data};return JSON.stringify(o)}function ae(t,e,o){let r={Accept:"application/json",...t,...e,...o},i={};return Object.keys(r).forEach(m=>{let p=r[m];i[m.toLowerCase()]=p;}),i}function ne(t){try{return JSON.parse(t.content)}catch(e){throw new ee(e.message,t)}}function ie({content:t,status:e},o){try{let r=JSON.parse(t);return "error"in r?new te(r.message,e,r.error,o):new N(r.message,e,o)}catch{}return new N(t,e,o)}function ce({isTimedOut:t,status:e}){return !t&&~~e===0}function ue({isTimedOut:t,status:e}){return t||ce({isTimedOut:t,status:e})||~~(e/100)!==2&&~~(e/100)!==4}function le({status:t}){return ~~(t/100)===2}function me(t){return t.map(e=>F(e))}function F(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 J({hosts:t,hostsCache:e,baseHeaders:o,baseQueryParameters:r,algoliaAgent:i,timeouts:m,requester:p,requestsCache:a,responsesCache:s}){async function n(l){let c=await Promise.all(l.map(h=>e.get(h,()=>Promise.resolve(H(h))))),g=c.filter(h=>h.isUp()),f=c.filter(h=>h.isTimedOut()),T=[...g,...f];return {hosts:T.length>0?T:l,getTimeout(h,q){return (f.length===0&&h===0?1:f.length+3+h)*q}}}async function u(l,c,g=!0){let f=[],T=se(l,c),y=ae(o,l.headers,c.headers),h=l.method==="GET"?{...l.data,...c.data}:{},q={...r,...l.queryParameters,...h};if(i.value&&(q["x-algolia-agent"]=i.value),c&&c.queryParameters)for(let P of Object.keys(c.queryParameters))!c.queryParameters[P]||Object.prototype.toString.call(c.queryParameters[P])==="[object Object]"?q[P]=c.queryParameters[P]:q[P]=c.queryParameters[P].toString();let C=0,I=async(P,v)=>{let w=P.pop();if(w===void 0)throw new Z(me(f));let x={...m,...c.timeouts},D={data:T,headers:y,method:l.method,url:re(w,l.path,q),connectTimeout:v(C,x.connect),responseTimeout:v(C,g?x.read:x.write)},_=A=>{let L={request:D,response:A,host:w,triesLeft:P.length};return f.push(L),L},E=await p.send(D);if(ue(E)){let A=_(E);return E.isTimedOut&&C++,console.log("Retryable failure",F(A)),await e.set(w,H(w,E.isTimedOut?"timed out":"down")),I(P,v)}if(le(E))return ne(E);throw _(E),ie(E,f)},K=t.filter(P=>P.accept==="readWrite"||(g?P.accept==="read":P.accept==="write")),U=await n(K);return I([...U.hosts].reverse(),U.getTimeout)}function d(l,c={}){let g=l.useReadTransporter||l.method==="GET";if(!g)return u(l,c,g);let f=()=>u(l,c);if((c.cacheable||l.cacheable)!==!0)return f();let y={request:l,requestOptions:c,transporter:{queryParameters:r,headers:o}};return s.get(y,()=>a.get(y,()=>a.set(y,f()).then(h=>Promise.all([a.delete(y),h]),h=>Promise.all([a.delete(y),Promise.reject(h)])).then(([h,q])=>q)),{miss:h=>s.set(y,h)})}return {hostsCache:e,requester:p,timeouts:m,algoliaAgent:i,baseHeaders:o,baseQueryParameters:r,hosts:t,request:d,requestsCache:a,responsesCache:s}}function de(t){let e={value:`Algolia for JavaScript (${t})`,add(o){let r=`; ${o.segment}${o.version!==void 0?` (${o.version})`:""}`;return e.value.indexOf(r)===-1&&(e.value=`${e.value}${r}`),e}};return e}function $({algoliaAgents:t,client:e,version:o}){let r=de(o).add({segment:e,version:o});return t.forEach(i=>r.add(i)),r}var M=1e3,z=2e3,B=3e4;function X(){function t(e){return new Promise(o=>{let r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach(a=>r.setRequestHeader(a,e.headers[a]));let i=(a,s)=>setTimeout(()=>{r.abort(),o({status:0,content:s,isTimedOut:!0});},a),m=i(e.connectTimeout,"Connection timeout"),p;r.onreadystatechange=()=>{r.readyState>r.OPENED&&p===void 0&&(clearTimeout(m),p=i(e.responseTimeout,"Socket timeout"));},r.onerror=()=>{r.status===0&&(clearTimeout(m),clearTimeout(p),o({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}));},r.onload=()=>{clearTimeout(m),clearTimeout(p),o({content:r.responseText,status:r.status,isTimedOut:!1});},r.send(e.data);})}return {send:t}}var S="5.2.5",b=["eu","us"];function he(t){return [{url:"query-suggestions.{region}.algolia.com".replace("{region}",t),accept:"readWrite",protocol:"https"}]}function V({appId:t,apiKey:e,authMode:o,algoliaAgents:r,region:i,...m}){let p=W(t,e,o),a=J({hosts:he(i),...m,algoliaAgent:$({algoliaAgents:r,client:"QuerySuggestions",version:S}),baseHeaders:{"content-type":"text/plain",...p.headers(),...m.baseHeaders},baseQueryParameters:{...p.queryParameters(),...m.baseQueryParameters}});return {transporter:a,appId:t,clearCache(){return Promise.all([a.requestsCache.clear(),a.responsesCache.clear()]).then(()=>{})},get _ua(){return a.algoliaAgent.value},addAlgoliaAgent(s,n){a.algoliaAgent.add({segment:s,version:n});},createConfig(s,n){if(!s)throw new Error("Parameter `configurationWithIndex` is required when calling `createConfig`.");let c={method:"POST",path:"/1/configs",queryParameters:{},headers:{},data:s};return a.request(c,n)},customDelete({path:s,parameters:n},u){if(!s)throw new Error("Parameter `path` is required when calling `customDelete`.");let g={method:"DELETE",path:"/{path}".replace("{path}",s),queryParameters:n||{},headers:{}};return a.request(g,u)},customGet({path:s,parameters:n},u){if(!s)throw new Error("Parameter `path` is required when calling `customGet`.");let g={method:"GET",path:"/{path}".replace("{path}",s),queryParameters:n||{},headers:{}};return a.request(g,u)},customPost({path:s,parameters:n,body:u},d){if(!s)throw new Error("Parameter `path` is required when calling `customPost`.");let f={method:"POST",path:"/{path}".replace("{path}",s),queryParameters:n||{},headers:{},data:u||{}};return a.request(f,d)},customPut({path:s,parameters:n,body:u},d){if(!s)throw new Error("Parameter `path` is required when calling `customPut`.");let f={method:"PUT",path:"/{path}".replace("{path}",s),queryParameters:n||{},headers:{},data:u||{}};return a.request(f,d)},deleteConfig({indexName:s},n){if(!s)throw new Error("Parameter `indexName` is required when calling `deleteConfig`.");let c={method:"DELETE",path:"/1/configs/{indexName}".replace("{indexName}",encodeURIComponent(s)),queryParameters:{},headers:{}};return a.request(c,n)},getAllConfigs(s){let l={method:"GET",path:"/1/configs",queryParameters:{},headers:{}};return a.request(l,s)},getConfig({indexName:s},n){if(!s)throw new Error("Parameter `indexName` is required when calling `getConfig`.");let c={method:"GET",path:"/1/configs/{indexName}".replace("{indexName}",encodeURIComponent(s)),queryParameters:{},headers:{}};return a.request(c,n)},getConfigStatus({indexName:s},n){if(!s)throw new Error("Parameter `indexName` is required when calling `getConfigStatus`.");let c={method:"GET",path:"/1/configs/{indexName}/status".replace("{indexName}",encodeURIComponent(s)),queryParameters:{},headers:{}};return a.request(c,n)},getLogFile({indexName:s},n){if(!s)throw new Error("Parameter `indexName` is required when calling `getLogFile`.");let c={method:"GET",path:"/1/logs/{indexName}".replace("{indexName}",encodeURIComponent(s)),queryParameters:{},headers:{}};return a.request(c,n)},updateConfig({indexName:s,configuration:n},u){if(!s)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 g={method:"PUT",path:"/1/configs/{indexName}".replace("{indexName}",encodeURIComponent(s)),queryParameters:{},headers:{},data:n};return a.request(g,u)}}}function je(t,e,o,r){if(!t||typeof t!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");if(!o||o&&(typeof o!="string"||!b.includes(o)))throw new Error(`\`region\` is required and must be one of the following: ${b.join(", ")}`);return V({appId:t,apiKey:e,region:o,timeouts:{connect:M,read:z,write:B},requester:X(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:O(),requestsCache:O({serializable:!1}),hostsCache:R({caches:[G({key:`${S}-${t}`}),O()]}),...r})}
function W(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 Q(t){let e,s=`algolia-client-js-${t.key}`;function r(){return e===void 0&&(e=t.localStorage||window.localStorage),e}function n(){return JSON.parse(r().getItem(s)||"{}")}function m(o){r().setItem(s,JSON.stringify(o));}function p(){let o=t.timeToLive?t.timeToLive*1e3:null,a=n(),c=Object.fromEntries(Object.entries(a).filter(([,d])=>d.timestamp!==void 0));if(m(c),!o)return;let l=Object.fromEntries(Object.entries(c).filter(([,d])=>{let i=new Date().getTime();return !(d.timestamp+o<i)}));m(l);}return {get(o,a,c={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(p(),n()[JSON.stringify(o)])).then(l=>Promise.all([l?l.value:a(),l!==void 0])).then(([l,d])=>Promise.all([l,d||c.miss(l)])).then(([l])=>l)},set(o,a){return Promise.resolve().then(()=>{let c=n();return c[JSON.stringify(o)]={timestamp:new Date().getTime(),value:a},r().setItem(s,JSON.stringify(c)),a})},delete(o){return Promise.resolve().then(()=>{let a=n();delete a[JSON.stringify(o)],r().setItem(s,JSON.stringify(a));})},clear(){return Promise.resolve().then(()=>{r().removeItem(s);})}}}function Y(){return {get(t,e,s={miss:()=>Promise.resolve()}){return e().then(n=>Promise.all([n,s.miss(n)])).then(([n])=>n)},set(t,e){return Promise.resolve(e)},delete(t){return Promise.resolve()},clear(){return Promise.resolve()}}}function R(t){let e=[...t.caches],s=e.shift();return s===void 0?Y():{get(r,n,m={miss:()=>Promise.resolve()}){return s.get(r,n,m).catch(()=>R({caches:e}).get(r,n,m))},set(r,n){return s.set(r,n).catch(()=>R({caches:e}).set(r,n))},delete(r){return s.delete(r).catch(()=>R({caches:e}).delete(r))},clear(){return s.clear().catch(()=>R({caches:e}).clear())}}}function O(t={serializable:!0}){let e={};return {get(s,r,n={miss:()=>Promise.resolve()}){let m=JSON.stringify(s);if(m in e)return Promise.resolve(t.serializable?JSON.parse(e[m]):e[m]);let p=r();return p.then(o=>n.miss(o)).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()}}}var k=2*60*1e3;function H(t,e="up"){let s=Date.now();function r(){return e==="up"||Date.now()-s>k}function n(){return e==="timed out"&&Date.now()-s<=k}return {...t,status:e,lastUpdate:s,isUp:r,isTimedOut:n}}var G=class extends Error{name="AlgoliaError";constructor(t,e){super(t),e&&(this.name=e);}},j=class extends G{stackTrace;constructor(t,e,s){super(t,s),this.stackTrace=e;}},Z=class extends j{constructor(t){super("Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support.",t,"RetryError");}},N=class extends j{status;constructor(t,e,s,r="ApiError"){super(t,s,r),this.status=e;}},ee=class extends G{response;constructor(t,e){super(t,"DeserializationError"),this.response=e;}},te=class extends N{error;constructor(t,e,s,r){super(t,e,r,"DetailedApiError"),this.error=s;}};function re(t,e,s){let r=se(s),n=`${t.protocol}://${t.url}${t.port?`:${t.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return r.length&&(n+=`?${r}`),n}function se(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]).replaceAll("+","%20")}`).join("&")}function oe(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 ae(t,e,s){let r={Accept:"application/json",...t,...e,...s},n={};return Object.keys(r).forEach(m=>{let p=r[m];n[m.toLowerCase()]=p;}),n}function ne(t){try{return JSON.parse(t.content)}catch(e){throw new ee(e.message,t)}}function ie({content:t,status:e},s){try{let r=JSON.parse(t);return "error"in r?new te(r.message,e,r.error,s):new N(r.message,e,s)}catch{}return new N(t,e,s)}function ue({isTimedOut:t,status:e}){return !t&&~~e===0}function ce({isTimedOut:t,status:e}){return t||ue({isTimedOut:t,status:e})||~~(e/100)!==2&&~~(e/100)!==4}function le({status:t}){return ~~(t/100)===2}function me(t){return t.map(e=>F(e))}function F(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 J({hosts:t,hostsCache:e,baseHeaders:s,baseQueryParameters:r,algoliaAgent:n,timeouts:m,requester:p,requestsCache:o,responsesCache:a}){async function c(i){let u=await Promise.all(i.map(h=>e.get(h,()=>Promise.resolve(H(h))))),f=u.filter(h=>h.isUp()),P=u.filter(h=>h.isTimedOut()),T=[...f,...P];return {hosts:T.length>0?T:i,getTimeout(h,q){return (P.length===0&&h===0?1:P.length+3+h)*q}}}async function l(i,u,f=!0){let P=[],T=oe(i,u),y=ae(s,i.headers,u.headers),h=i.method==="GET"?{...i.data,...u.data}:{},q={...r,...i.queryParameters,...h};if(n.value&&(q["x-algolia-agent"]=n.value),u&&u.queryParameters)for(let g of Object.keys(u.queryParameters))!u.queryParameters[g]||Object.prototype.toString.call(u.queryParameters[g])==="[object Object]"?q[g]=u.queryParameters[g]:q[g]=u.queryParameters[g].toString();let C=0,I=async(g,v)=>{let w=g.pop();if(w===void 0)throw new Z(me(P));let x={...m,...u.timeouts},D={data:T,headers:y,method:i.method,url:re(w,i.path,q),connectTimeout:v(C,x.connect),responseTimeout:v(C,f?x.read:x.write)},_=A=>{let L={request:D,response:A,host:w,triesLeft:g.length};return P.push(L),L},E=await p.send(D);if(ce(E)){let A=_(E);return E.isTimedOut&&C++,console.log("Retryable failure",F(A)),await e.set(w,H(w,E.isTimedOut?"timed out":"down")),I(g,v)}if(le(E))return ne(E);throw _(E),ie(E,P)},V=t.filter(g=>g.accept==="readWrite"||(f?g.accept==="read":g.accept==="write")),U=await c(V);return I([...U.hosts].reverse(),U.getTimeout)}function d(i,u={}){let f=i.useReadTransporter||i.method==="GET";if(!f)return l(i,u,f);let P=()=>l(i,u);if((u.cacheable||i.cacheable)!==!0)return P();let y={request:i,requestOptions:u,transporter:{queryParameters:r,headers:s}};return a.get(y,()=>o.get(y,()=>o.set(y,P()).then(h=>Promise.all([o.delete(y),h]),h=>Promise.all([o.delete(y),Promise.reject(h)])).then(([h,q])=>q)),{miss:h=>a.set(y,h)})}return {hostsCache:e,requester:p,timeouts:m,algoliaAgent:n,baseHeaders:s,baseQueryParameters:r,hosts:t,request:d,requestsCache:o,responsesCache:a}}function de(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 $({algoliaAgents:t,client:e,version:s}){let r=de(s).add({segment:e,version:s});return t.forEach(n=>r.add(n)),r}var M=1e3,z=2e3,B=3e4;function X(){function t(e){return new Promise(s=>{let r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach(o=>r.setRequestHeader(o,e.headers[o]));let n=(o,a)=>setTimeout(()=>{r.abort(),s({status:0,content:a,isTimedOut:!0});},o),m=n(e.connectTimeout,"Connection timeout"),p;r.onreadystatechange=()=>{r.readyState>r.OPENED&&p===void 0&&(clearTimeout(m),p=n(e.responseTimeout,"Socket timeout"));},r.onerror=()=>{r.status===0&&(clearTimeout(m),clearTimeout(p),s({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}));},r.onload=()=>{clearTimeout(m),clearTimeout(p),s({content:r.responseText,status:r.status,isTimedOut:!1});},r.send(e.data);})}return {send:t}}var S="5.3.0",b=["eu","us"];function he(t){return [{url:"query-suggestions.{region}.algolia.com".replace("{region}",t),accept:"readWrite",protocol:"https"}]}function K({appId:t,apiKey:e,authMode:s,algoliaAgents:r,region:n,...m}){let p=W(t,e,s);return {transporter:J({hosts:he(n),...m,algoliaAgent:$({algoliaAgents:r,client:"QuerySuggestions",version:S}),baseHeaders:{"content-type":"text/plain",...p.headers(),...m.baseHeaders},baseQueryParameters:{...p.queryParameters(),...m.baseQueryParameters}}),appId:t,clearCache(){return Promise.all([this.transporter.requestsCache.clear(),this.transporter.responsesCache.clear()]).then(()=>{})},get _ua(){return this.transporter.algoliaAgent.value},addAlgoliaAgent(o,a){this.transporter.algoliaAgent.add({segment:o,version:a});},setClientApiKey({apiKey:o}){this.transporter.baseHeaders["x-algolia-api-key"]=o;},createConfig(o,a){if(!o)throw new Error("Parameter `configurationWithIndex` is required when calling `createConfig`.");let i={method:"POST",path:"/1/configs",queryParameters:{},headers:{},data:o};return this.transporter.request(i,a)},customDelete({path:o,parameters:a},c){if(!o)throw new Error("Parameter `path` is required when calling `customDelete`.");let u={method:"DELETE",path:"/{path}".replace("{path}",o),queryParameters:a||{},headers:{}};return this.transporter.request(u,c)},customGet({path:o,parameters:a},c){if(!o)throw new Error("Parameter `path` is required when calling `customGet`.");let u={method:"GET",path:"/{path}".replace("{path}",o),queryParameters:a||{},headers:{}};return this.transporter.request(u,c)},customPost({path:o,parameters:a,body:c},l){if(!o)throw new Error("Parameter `path` is required when calling `customPost`.");let f={method:"POST",path:"/{path}".replace("{path}",o),queryParameters:a||{},headers:{},data:c||{}};return this.transporter.request(f,l)},customPut({path:o,parameters:a,body:c},l){if(!o)throw new Error("Parameter `path` is required when calling `customPut`.");let f={method:"PUT",path:"/{path}".replace("{path}",o),queryParameters:a||{},headers:{},data:c||{}};return this.transporter.request(f,l)},deleteConfig({indexName:o},a){if(!o)throw new Error("Parameter `indexName` is required when calling `deleteConfig`.");let i={method:"DELETE",path:"/1/configs/{indexName}".replace("{indexName}",encodeURIComponent(o)),queryParameters:{},headers:{}};return this.transporter.request(i,a)},getAllConfigs(o){let d={method:"GET",path:"/1/configs",queryParameters:{},headers:{}};return this.transporter.request(d,o)},getConfig({indexName:o},a){if(!o)throw new Error("Parameter `indexName` is required when calling `getConfig`.");let i={method:"GET",path:"/1/configs/{indexName}".replace("{indexName}",encodeURIComponent(o)),queryParameters:{},headers:{}};return this.transporter.request(i,a)},getConfigStatus({indexName:o},a){if(!o)throw new Error("Parameter `indexName` is required when calling `getConfigStatus`.");let i={method:"GET",path:"/1/configs/{indexName}/status".replace("{indexName}",encodeURIComponent(o)),queryParameters:{},headers:{}};return this.transporter.request(i,a)},getLogFile({indexName:o},a){if(!o)throw new Error("Parameter `indexName` is required when calling `getLogFile`.");let i={method:"GET",path:"/1/logs/{indexName}".replace("{indexName}",encodeURIComponent(o)),queryParameters:{},headers:{}};return this.transporter.request(i,a)},updateConfig({indexName:o,configuration:a},c){if(!o)throw new Error("Parameter `indexName` is required when calling `updateConfig`.");if(!a)throw new Error("Parameter `configuration` is required when calling `updateConfig`.");if(!a.sourceIndices)throw new Error("Parameter `configuration.sourceIndices` is required when calling `updateConfig`.");let u={method:"PUT",path:"/1/configs/{indexName}".replace("{indexName}",encodeURIComponent(o)),queryParameters:{},headers:{},data:a};return this.transporter.request(u,c)}}}function je(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"||!b.includes(s)))throw new Error(`\`region\` is required and must be one of the following: ${b.join(", ")}`);return K({appId:t,apiKey:e,region:s,timeouts:{connect:M,read:z,write:B},requester:X(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:O(),requestsCache:O({serializable:!1}),hostsCache:R({caches:[Q({key:`${S}-${t}`}),O()]}),...r})}

@@ -10,0 +10,0 @@ exports.apiClientVersion = S;

@@ -13,3 +13,3 @@ // builds/node.ts

import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
var apiClientVersion = "5.2.5";
var apiClientVersion = "5.3.0";
var REGIONS = ["eu", "us"];

@@ -29,22 +29,21 @@ function getDefaultHosts(region) {

const auth = createAuth(appIdOption, apiKeyOption, authMode);
const transporter = createTransporter({
hosts: getDefaultHosts(regionOption),
...options,
algoliaAgent: getAlgoliaAgent({
algoliaAgents,
client: "QuerySuggestions",
version: apiClientVersion
return {
transporter: createTransporter({
hosts: getDefaultHosts(regionOption),
...options,
algoliaAgent: getAlgoliaAgent({
algoliaAgents,
client: "QuerySuggestions",
version: apiClientVersion
}),
baseHeaders: {
"content-type": "text/plain",
...auth.headers(),
...options.baseHeaders
},
baseQueryParameters: {
...auth.queryParameters(),
...options.baseQueryParameters
}
}),
baseHeaders: {
"content-type": "text/plain",
...auth.headers(),
...options.baseHeaders
},
baseQueryParameters: {
...auth.queryParameters(),
...options.baseQueryParameters
}
});
return {
transporter,
/**

@@ -58,3 +57,5 @@ * The `appId` currently in use.

clearCache() {
return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
return Promise.all([this.transporter.requestsCache.clear(), this.transporter.responsesCache.clear()]).then(
() => void 0
);
},

@@ -65,3 +66,3 @@ /**

get _ua() {
return transporter.algoliaAgent.value;
return this.transporter.algoliaAgent.value;
},

@@ -75,5 +76,14 @@ /**

addAlgoliaAgent(segment, version) {
transporter.algoliaAgent.add({ segment, version });
this.transporter.algoliaAgent.add({ segment, version });
},
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }) {
this.transporter.baseHeaders["x-algolia-api-key"] = apiKey;
},
/**
* Creates a new Query Suggestions configuration. You can have up to 100 configurations per Algolia application.

@@ -101,3 +111,3 @@ *

};
return transporter.request(request, requestOptions);
return this.transporter.request(request, requestOptions);
},

@@ -125,3 +135,3 @@ /**

};
return transporter.request(request, requestOptions);
return this.transporter.request(request, requestOptions);
},

@@ -149,3 +159,3 @@ /**

};
return transporter.request(request, requestOptions);
return this.transporter.request(request, requestOptions);
},

@@ -175,3 +185,3 @@ /**

};
return transporter.request(request, requestOptions);
return this.transporter.request(request, requestOptions);
},

@@ -201,3 +211,3 @@ /**

};
return transporter.request(request, requestOptions);
return this.transporter.request(request, requestOptions);
},

@@ -227,3 +237,3 @@ /**

};
return transporter.request(request, requestOptions);
return this.transporter.request(request, requestOptions);
},

@@ -248,3 +258,3 @@ /**

};
return transporter.request(request, requestOptions);
return this.transporter.request(request, requestOptions);
},

@@ -274,3 +284,3 @@ /**

};
return transporter.request(request, requestOptions);
return this.transporter.request(request, requestOptions);
},

@@ -300,3 +310,3 @@ /**

};
return transporter.request(request, requestOptions);
return this.transporter.request(request, requestOptions);
},

@@ -326,3 +336,3 @@ /**

};
return transporter.request(request, requestOptions);
return this.transporter.request(request, requestOptions);
},

@@ -360,3 +370,3 @@ /**

};
return transporter.request(request, requestOptions);
return this.transporter.request(request, requestOptions);
}

@@ -363,0 +373,0 @@ };

import * as _algolia_client_common from '@algolia/client-common';
import { ClientOptions } from '@algolia/client-common';
import { CreateClientOptions, RequestOptions, ClientOptions } from '@algolia/client-common';
type AppID = {
/**
* Algolia application ID to which this Query Suggestions configuration belongs.
*/
appID?: string;
};
type BaseResponse = {

@@ -22,25 +15,2 @@ /**

type ConfigStatus = {
/**
* Name of the Query Suggestions index (case-sensitive).
*/
indexName?: string;
/**
* Whether the creation or update of the Query Suggestions index is in progress.
*/
isRunning?: boolean;
/**
* Date and time when the Query Suggestions index was last built, in RFC 3339 format.
*/
lastBuiltAt?: string;
/**
* Date and time when the Query Suggestions index was last updated successfully.
*/
lastSuccessfulBuiltAt?: string;
/**
* Duration of the last successful build in seconds.
*/
lastSuccessfulBuildDuration?: string;
};
/**

@@ -112,40 +82,2 @@ * Languages for deduplicating singular and plural suggestions. If specified, only the more popular form is included.

/**
* Query Suggestions configuration.
*/
type ConfigurationWithIndex = Configuration & Record<string, unknown>;
/**
* API response for retrieving Query Suggestions configurations.
*/
type ConfigurationResponse = AppID & ConfigurationWithIndex;
/**
* Error.
*/
type ErrorBase = Record<string, any> & {
message?: string;
};
/**
* Type of log entry. - `SKIP`. A query is skipped because it doesn\'t match the conditions for successful inclusion. For example, when a query doesn\'t generate enough search results. - `INFO`. An informative log entry. - `ERROR`. The Query Suggestions process encountered an error.
*/
type LogLevel = 'ERROR' | 'INFO' | 'SKIP';
type LogFile = {
/**
* Date and time of the log entry, in RFC 3339 format.
*/
timestamp?: string;
level?: LogLevel;
/**
* Details about this log entry.
*/
message?: string;
/**
* Level indicating the position of a suggestion in a hierarchy of records. For example, a `contextLevel` of 1 indicates that this suggestion belongs to a previous suggestion with `contextLevel` 0.
*/
contextLevel?: number;
};
/**
* Properties for the `customDelete` method.

@@ -257,29 +189,224 @@ */

declare const apiClientVersion = "5.2.5";
declare const REGIONS: readonly ["eu", "us"];
type Region = (typeof REGIONS)[number];
type ConfigStatus = {
/**
* Name of the Query Suggestions index (case-sensitive).
*/
indexName?: string;
/**
* Whether the creation or update of the Query Suggestions index is in progress.
*/
isRunning?: boolean;
/**
* Date and time when the Query Suggestions index was last built, in RFC 3339 format.
*/
lastBuiltAt?: string;
/**
* Date and time when the Query Suggestions index was last updated successfully.
*/
lastSuccessfulBuiltAt?: string;
/**
* Duration of the last successful build in seconds.
*/
lastSuccessfulBuildDuration?: string;
};
type AppID = {
/**
* Algolia application ID to which this Query Suggestions configuration belongs.
*/
appID?: string;
};
/**
* The client type.
* Query Suggestions configuration.
*/
type QuerySuggestionsClient = ReturnType<typeof querySuggestionsClient>;
declare function querySuggestionsClient(appId: string, apiKey: string, region: Region, options?: ClientOptions): {
type ConfigurationWithIndex = Configuration & Record<string, unknown>;
/**
* API response for retrieving Query Suggestions configurations.
*/
type ConfigurationResponse = AppID & ConfigurationWithIndex;
/**
* Type of log entry. - `SKIP`. A query is skipped because it doesn\'t match the conditions for successful inclusion. For example, when a query doesn\'t generate enough search results. - `INFO`. An informative log entry. - `ERROR`. The Query Suggestions process encountered an error.
*/
type LogLevel = 'ERROR' | 'INFO' | 'SKIP';
type LogFile = {
/**
* Date and time of the log entry, in RFC 3339 format.
*/
timestamp?: string;
level?: LogLevel;
/**
* Details about this log entry.
*/
message?: string;
/**
* Level indicating the position of a suggestion in a hierarchy of records. For example, a `contextLevel` of 1 indicates that this suggestion belongs to a previous suggestion with `contextLevel` 0.
*/
contextLevel?: number;
};
declare const apiClientVersion = "5.3.0";
declare const REGIONS: readonly ["eu", "us"];
type Region = (typeof REGIONS)[number];
declare function createQuerySuggestionsClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, region: regionOption, ...options }: CreateClientOptions & {
region: Region;
}): {
transporter: _algolia_client_common.Transporter;
/**
* The `appId` currently in use.
*/
appId: string;
/**
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
*/
clearCache(): Promise<void>;
_ua: string;
/**
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
*/
readonly _ua: string;
/**
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
*
* @param segment - The algolia agent (user-agent) segment to add.
* @param version - The version of the agent.
*/
addAlgoliaAgent(segment: string, version?: string): void;
createConfig(configurationWithIndex: ConfigurationWithIndex, requestOptions?: _algolia_client_common.RequestOptions): Promise<BaseResponse>;
customDelete({ path, parameters }: CustomDeleteProps, requestOptions?: _algolia_client_common.RequestOptions): Promise<Record<string, unknown>>;
customGet({ path, parameters }: CustomGetProps, requestOptions?: _algolia_client_common.RequestOptions): Promise<Record<string, unknown>>;
customPost({ path, parameters, body }: CustomPostProps, requestOptions?: _algolia_client_common.RequestOptions): Promise<Record<string, unknown>>;
customPut({ path, parameters, body }: CustomPutProps, requestOptions?: _algolia_client_common.RequestOptions): Promise<Record<string, unknown>>;
deleteConfig({ indexName }: DeleteConfigProps, requestOptions?: _algolia_client_common.RequestOptions): Promise<BaseResponse>;
getAllConfigs(requestOptions?: _algolia_client_common.RequestOptions): Promise<ConfigurationResponse[]>;
getConfig({ indexName }: GetConfigProps, requestOptions?: _algolia_client_common.RequestOptions): Promise<ConfigurationResponse>;
getConfigStatus({ indexName }: GetConfigStatusProps, requestOptions?: _algolia_client_common.RequestOptions): Promise<ConfigStatus>;
getLogFile({ indexName }: GetLogFileProps, requestOptions?: _algolia_client_common.RequestOptions): Promise<LogFile>;
updateConfig({ indexName, configuration }: UpdateConfigProps, requestOptions?: _algolia_client_common.RequestOptions): Promise<BaseResponse>;
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }: {
apiKey: string;
}): void;
/**
* Creates a new Query Suggestions configuration. You can have up to 100 configurations per Algolia application.
*
* Required API Key ACLs:
* - editSettings.
*
* @param configurationWithIndex - The configurationWithIndex object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
createConfig(configurationWithIndex: ConfigurationWithIndex, requestOptions?: RequestOptions): Promise<BaseResponse>;
/**
* This method allow you to send requests to the Algolia REST API.
*
* @param customDelete - The customDelete object.
* @param customDelete.path - Path of the endpoint, anything after \"/1\" must be specified.
* @param customDelete.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customDelete({ path, parameters }: CustomDeleteProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method allow you to send requests to the Algolia REST API.
*
* @param customGet - The customGet object.
* @param customGet.path - Path of the endpoint, anything after \"/1\" must be specified.
* @param customGet.parameters - Query parameters to apply to the current query.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method allow you to send requests to the Algolia REST API.
*
* @param customPost - The customPost object.
* @param customPost.path - Path of the endpoint, anything after \"/1\" must be specified.
* @param customPost.parameters - Query parameters to apply to the current query.
* @param customPost.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPost({ path, parameters, body }: CustomPostProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* This method allow you to send requests to the Algolia REST API.
*
* @param customPut - The customPut object.
* @param customPut.path - Path of the endpoint, anything after \"/1\" must be specified.
* @param customPut.parameters - Query parameters to apply to the current query.
* @param customPut.body - Parameters to send with the custom request.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
customPut({ path, parameters, body }: CustomPutProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
/**
* 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.
*
* Required API Key ACLs:
* - editSettings.
*
* @param deleteConfig - The deleteConfig object.
* @param deleteConfig.indexName - Query Suggestions index name.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
deleteConfig({ indexName }: DeleteConfigProps, requestOptions?: RequestOptions): Promise<BaseResponse>;
/**
* Retrieves all Query Suggestions configurations of your Algolia application.
*
* Required API Key ACLs:
* - settings.
*
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getAllConfigs(requestOptions?: RequestOptions): Promise<ConfigurationResponse[]>;
/**
* Retrieves a single Query Suggestions configuration by its index name.
*
* Required API Key ACLs:
* - settings.
*
* @param getConfig - The getConfig object.
* @param getConfig.indexName - Query Suggestions index name.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getConfig({ indexName }: GetConfigProps, requestOptions?: RequestOptions): Promise<ConfigurationResponse>;
/**
* Reports the status of a Query Suggestions index.
*
* Required API Key ACLs:
* - settings.
*
* @param getConfigStatus - The getConfigStatus object.
* @param getConfigStatus.indexName - Query Suggestions index name.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getConfigStatus({ indexName }: GetConfigStatusProps, requestOptions?: RequestOptions): Promise<ConfigStatus>;
/**
* Retrieves the logs for a single Query Suggestions index.
*
* Required API Key ACLs:
* - settings.
*
* @param getLogFile - The getLogFile object.
* @param getLogFile.indexName - Query Suggestions index name.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
getLogFile({ indexName }: GetLogFileProps, requestOptions?: RequestOptions): Promise<LogFile>;
/**
* Updates a QuerySuggestions configuration.
*
* Required API Key ACLs:
* - editSettings.
*
* @param updateConfig - The updateConfig object.
* @param updateConfig.indexName - Query Suggestions index name.
* @param updateConfig.configuration - The configuration object.
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
*/
updateConfig({ indexName, configuration }: UpdateConfigProps, requestOptions?: RequestOptions): Promise<BaseResponse>;
};
/**
* Error.
*/
type ErrorBase = Record<string, any> & {
message?: string;
};
type QuerySuggestionsClient = ReturnType<typeof createQuerySuggestionsClient>;
declare function querySuggestionsClient(appId: string, apiKey: string, region: Region, options?: ClientOptions): QuerySuggestionsClient;
export { type AppID, type BaseResponse, type ConfigStatus, type Configuration, type ConfigurationResponse, type ConfigurationWithIndex, type CustomDeleteProps, type CustomGetProps, type CustomPostProps, type CustomPutProps, type DeleteConfigProps, type ErrorBase, type Facet, type GetConfigProps, type GetConfigStatusProps, type GetLogFileProps, type Languages, type LogFile, type LogLevel, type QuerySuggestionsClient, type Region, type SourceIndex, type UpdateConfigProps, apiClientVersion, querySuggestionsClient };
// src/querySuggestionsClient.ts
import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
var apiClientVersion = "5.2.5";
var apiClientVersion = "5.3.0";
var REGIONS = ["eu", "us"];

@@ -18,22 +18,21 @@ function getDefaultHosts(region) {

const auth = createAuth(appIdOption, apiKeyOption, authMode);
const transporter = createTransporter({
hosts: getDefaultHosts(regionOption),
...options,
algoliaAgent: getAlgoliaAgent({
algoliaAgents,
client: "QuerySuggestions",
version: apiClientVersion
return {
transporter: createTransporter({
hosts: getDefaultHosts(regionOption),
...options,
algoliaAgent: getAlgoliaAgent({
algoliaAgents,
client: "QuerySuggestions",
version: apiClientVersion
}),
baseHeaders: {
"content-type": "text/plain",
...auth.headers(),
...options.baseHeaders
},
baseQueryParameters: {
...auth.queryParameters(),
...options.baseQueryParameters
}
}),
baseHeaders: {
"content-type": "text/plain",
...auth.headers(),
...options.baseHeaders
},
baseQueryParameters: {
...auth.queryParameters(),
...options.baseQueryParameters
}
});
return {
transporter,
/**

@@ -47,3 +46,5 @@ * The `appId` currently in use.

clearCache() {
return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
return Promise.all([this.transporter.requestsCache.clear(), this.transporter.responsesCache.clear()]).then(
() => void 0
);
},

@@ -54,3 +55,3 @@ /**

get _ua() {
return transporter.algoliaAgent.value;
return this.transporter.algoliaAgent.value;
},

@@ -64,5 +65,14 @@ /**

addAlgoliaAgent(segment, version) {
transporter.algoliaAgent.add({ segment, version });
this.transporter.algoliaAgent.add({ segment, version });
},
/**
* Helper method to switch the API key used to authenticate the requests.
*
* @param params - Method params.
* @param params.apiKey - The new API Key to use.
*/
setClientApiKey({ apiKey }) {
this.transporter.baseHeaders["x-algolia-api-key"] = apiKey;
},
/**
* Creates a new Query Suggestions configuration. You can have up to 100 configurations per Algolia application.

@@ -90,3 +100,3 @@ *

};
return transporter.request(request, requestOptions);
return this.transporter.request(request, requestOptions);
},

@@ -114,3 +124,3 @@ /**

};
return transporter.request(request, requestOptions);
return this.transporter.request(request, requestOptions);
},

@@ -138,3 +148,3 @@ /**

};
return transporter.request(request, requestOptions);
return this.transporter.request(request, requestOptions);
},

@@ -164,3 +174,3 @@ /**

};
return transporter.request(request, requestOptions);
return this.transporter.request(request, requestOptions);
},

@@ -190,3 +200,3 @@ /**

};
return transporter.request(request, requestOptions);
return this.transporter.request(request, requestOptions);
},

@@ -216,3 +226,3 @@ /**

};
return transporter.request(request, requestOptions);
return this.transporter.request(request, requestOptions);
},

@@ -237,3 +247,3 @@ /**

};
return transporter.request(request, requestOptions);
return this.transporter.request(request, requestOptions);
},

@@ -263,3 +273,3 @@ /**

};
return transporter.request(request, requestOptions);
return this.transporter.request(request, requestOptions);
},

@@ -289,3 +299,3 @@ /**

};
return transporter.request(request, requestOptions);
return this.transporter.request(request, requestOptions);
},

@@ -315,3 +325,3 @@ /**

};
return transporter.request(request, requestOptions);
return this.transporter.request(request, requestOptions);
},

@@ -349,3 +359,3 @@ /**

};
return transporter.request(request, requestOptions);
return this.transporter.request(request, requestOptions);
}

@@ -352,0 +362,0 @@ };

{
"version": "5.2.5",
"version": "5.3.0",
"repository": {

@@ -47,5 +47,5 @@ "type": "git",

"dependencies": {
"@algolia/client-common": "5.2.5",
"@algolia/requester-browser-xhr": "5.2.5",
"@algolia/requester-node-http": "5.2.5"
"@algolia/client-common": "5.3.0",
"@algolia/requester-browser-xhr": "5.3.0",
"@algolia/requester-node-http": "5.3.0"
},

@@ -52,0 +52,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc