Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@algolia/client-query-suggestions

Package Overview
Dependencies
Maintainers
82
Versions
164
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.13.0 to 5.14.0

2

dist/browser.d.ts

@@ -256,3 +256,3 @@ import * as _algolia_client_common from '@algolia/client-common';

declare const apiClientVersion = "5.13.0";
declare const apiClientVersion = "5.14.0";
declare const REGIONS: readonly ["eu", "us"];

@@ -259,0 +259,0 @@ type Region = (typeof REGIONS)[number];

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

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

@@ -18,0 +18,0 @@ function getDefaultHosts(region) {

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

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

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

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

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

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

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

@@ -17,0 +17,0 @@ function getDefaultHosts(region) {

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

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

@@ -17,0 +17,0 @@ function getDefaultHosts(region) {

@@ -256,3 +256,3 @@ import * as _algolia_client_common from '@algolia/client-common';

declare const apiClientVersion = "5.13.0";
declare const apiClientVersion = "5.14.0";
declare const REGIONS: readonly ["eu", "us"];

@@ -259,0 +259,0 @@ type Region = (typeof REGIONS)[number];

@@ -256,3 +256,3 @@ import * as _algolia_client_common from '@algolia/client-common';

declare const apiClientVersion = "5.13.0";
declare const apiClientVersion = "5.14.0";
declare const REGIONS: readonly ["eu", "us"];

@@ -259,0 +259,0 @@ type Region = (typeof REGIONS)[number];

// src/querySuggestionsClient.ts
import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
var apiClientVersion = "5.13.0";
var apiClientVersion = "5.14.0";
var REGIONS = ["eu", "us"];

@@ -5,0 +5,0 @@ function getDefaultHosts(region) {

{
"version": "5.13.0",
"version": "5.14.0",
"repository": {

@@ -51,12 +51,12 @@ "type": "git",

"dependencies": {
"@algolia/client-common": "5.13.0",
"@algolia/requester-browser-xhr": "5.13.0",
"@algolia/requester-fetch": "5.13.0",
"@algolia/requester-node-http": "5.13.0"
"@algolia/client-common": "5.14.0",
"@algolia/requester-browser-xhr": "5.14.0",
"@algolia/requester-fetch": "5.14.0",
"@algolia/requester-node-http": "5.14.0"
},
"devDependencies": {
"@arethetypeswrong/cli": "0.16.4",
"@types/node": "22.8.7",
"@arethetypeswrong/cli": "0.17.0",
"@types/node": "22.9.0",
"publint": "0.2.12",
"rollup": "4.24.3",
"rollup": "4.25.0",
"tsup": "8.3.5",

@@ -63,0 +63,0 @@ "typescript": "5.6.3"

@@ -44,7 +44,7 @@ <p align="center">

```bash
yarn add @algolia/client-query-suggestions@5.13.0
yarn add @algolia/client-query-suggestions@5.14.0
# or
npm install @algolia/client-query-suggestions@5.13.0
npm install @algolia/client-query-suggestions@5.14.0
# or
pnpm add @algolia/client-query-suggestions@5.13.0
pnpm add @algolia/client-query-suggestions@5.14.0
```

@@ -57,3 +57,3 @@

```html
<script src="https://cdn.jsdelivr.net/npm/@algolia/client-query-suggestions@5.13.0/dist/builds/browser.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@algolia/client-query-suggestions@5.14.0/dist/builds/browser.umd.js"></script>
```

@@ -60,0 +60,0 @@

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

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