@algolia/client-insights
Advanced tools
Comparing version 5.5.1 to 5.5.2
@@ -569,3 +569,3 @@ import * as _algolia_client_common from '@algolia/client-common'; | ||
declare const apiClientVersion = "5.5.1"; | ||
declare const apiClientVersion = "5.5.2"; | ||
declare const REGIONS: readonly ["de", "us"]; | ||
@@ -572,0 +572,0 @@ type Region = (typeof REGIONS)[number]; |
@@ -14,3 +14,3 @@ // builds/browser.ts | ||
import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common"; | ||
var apiClientVersion = "5.5.1"; | ||
var apiClientVersion = "5.5.2"; | ||
var REGIONS = ["de", "us"]; | ||
@@ -17,0 +17,0 @@ function getDefaultHosts(region) { |
@@ -1,2 +0,2 @@ | ||
function L(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 $(t){let e,o=`algolia-client-js-${t.key}`;function r(){return e===void 0&&(e=t.localStorage||window.localStorage),e}function a(){return JSON.parse(r().getItem(o)||"{}")}function m(n){r().setItem(o,JSON.stringify(n))}function d(){let n=t.timeToLive?t.timeToLive*1e3:null,s=a(),c=Object.fromEntries(Object.entries(s).filter(([,p])=>p.timestamp!==void 0));if(m(c),!n)return;let u=Object.fromEntries(Object.entries(c).filter(([,p])=>{let l=new Date().getTime();return!(p.timestamp+n<l)}));m(u)}return{get(n,s,c={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(d(),a()[JSON.stringify(n)])).then(u=>Promise.all([u?u.value:s(),u!==void 0])).then(([u,p])=>Promise.all([u,p||c.miss(u)])).then(([u])=>u)},set(n,s){return Promise.resolve().then(()=>{let c=a();return c[JSON.stringify(n)]={timestamp:new Date().getTime(),value:s},r().setItem(o,JSON.stringify(c)),s})},delete(n){return Promise.resolve().then(()=>{let s=a();delete s[JSON.stringify(n)],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(a=>Promise.all([a,o.miss(a)])).then(([a])=>a)},set(t,e){return Promise.resolve(e)},delete(t){return Promise.resolve()},clear(){return Promise.resolve()}}}function v(t){let e=[...t.caches],o=e.shift();return o===void 0?Y():{get(r,a,m={miss:()=>Promise.resolve()}){return o.get(r,a,m).catch(()=>v({caches:e}).get(r,a,m))},set(r,a){return o.set(r,a).catch(()=>v({caches:e}).set(r,a))},delete(r){return o.delete(r).catch(()=>v({caches:e}).delete(r))},clear(){return o.clear().catch(()=>v({caches:e}).clear())}}}function x(t={serializable:!0}){let e={};return{get(o,r,a={miss:()=>Promise.resolve()}){let m=JSON.stringify(o);if(m in e)return Promise.resolve(t.serializable?JSON.parse(e[m]):e[m]);let d=r();return d.then(n=>a.miss(n)).then(()=>d)},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 W=2*60*1e3;function H(t,e="up"){let o=Date.now();function r(){return e==="up"||Date.now()-o>W}function a(){return e==="timed out"&&Date.now()-o<=W}return{...t,status:e,lastUpdate:o,isUp:r,isTimedOut:a}}var j=class extends Error{name="AlgoliaError";constructor(t,e){super(t),e&&(this.name=e)}},J=class extends j{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")}},b=class extends J{status;constructor(t,e,o,r="ApiError"){super(t,o,r),this.status=e}},ee=class extends j{response;constructor(t,e){super(t,"DeserializationError"),this.response=e}},te=class extends b{error;constructor(t,e,o,r){super(t,e,r,"DetailedApiError"),this.error=o}};function re(t,e,o){let r=oe(o),a=`${t.protocol}://${t.url}${t.port?`:${t.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return r.length&&(a+=`?${r}`),a}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 ne(t,e,o){let r={Accept:"application/json",...t,...e,...o},a={};return Object.keys(r).forEach(m=>{let d=r[m];a[m.toLowerCase()]=d}),a}function ae(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 b(r.message,e,o)}catch{}return new b(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=>M(e))}function M(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 z({hosts:t,hostsCache:e,baseHeaders:o,baseQueryParameters:r,algoliaAgent:a,timeouts:m,requester:d,requestsCache:n,responsesCache:s}){async function c(l){let i=await Promise.all(l.map(h=>e.get(h,()=>Promise.resolve(H(h))))),P=i.filter(h=>h.isUp()),f=i.filter(h=>h.isTimedOut()),R=[...P,...f];return{hosts:R.length>0?R:l,getTimeout(h,E){return(f.length===0&&h===0?1:f.length+3+h)*E}}}async function u(l,i,P=!0){let f=[],R=se(l,i),y=ne(o,l.headers,i.headers),h=l.method==="GET"?{...l.data,...i.data}:{},E={...r,...l.queryParameters,...h};if(a.value&&(E["x-algolia-agent"]=a.value),i&&i.queryParameters)for(let g of Object.keys(i.queryParameters))!i.queryParameters[g]||Object.prototype.toString.call(i.queryParameters[g])==="[object Object]"?E[g]=i.queryParameters[g]:E[g]=i.queryParameters[g].toString();let O=0,I=async(g,A)=>{let w=g.pop();if(w===void 0)throw new Z(me(f));let S={...m,...i.timeouts},_={data:R,headers:y,method:l.method,url:re(w,l.path,E),connectTimeout:A(O,S.connect),responseTimeout:A(O,P?S.read:S.write)},k=C=>{let U={request:_,response:C,host:w,triesLeft:g.length};return f.push(U),U},T=await d.send(_);if(ue(T)){let C=k(T);return T.isTimedOut&&O++,console.log("Retryable failure",M(C)),await e.set(w,H(w,T.isTimedOut?"timed out":"down")),I(g,A)}if(le(T))return ae(T);throw k(T),ie(T,f)},V=t.filter(g=>g.accept==="readWrite"||(P?g.accept==="read":g.accept==="write")),N=await c(V);return I([...N.hosts].reverse(),N.getTimeout)}function p(l,i={}){let P=l.useReadTransporter||l.method==="GET";if(!P)return u(l,i,P);let f=()=>u(l,i);if((i.cacheable||l.cacheable)!==!0)return f();let y={request:l,requestOptions:i,transporter:{queryParameters:r,headers:o}};return s.get(y,()=>n.get(y,()=>n.set(y,f()).then(h=>Promise.all([n.delete(y),h]),h=>Promise.all([n.delete(y),Promise.reject(h)])).then(([h,E])=>E)),{miss:h=>s.set(y,h)})}return{hostsCache:e,requester:d,timeouts:m,algoliaAgent:a,baseHeaders:o,baseQueryParameters:r,hosts:t,request:p,requestsCache:n,responsesCache:s}}function he(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 Q({algoliaAgents:t,client:e,version:o}){let r=he(o).add({segment:e,version:o});return t.forEach(a=>r.add(a)),r}var F=1e3,G=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(n=>r.setRequestHeader(n,e.headers[n]));let a=(n,s)=>setTimeout(()=>{r.abort(),o({status:0,content:s,isTimedOut:!0})},n),m=a(e.connectTimeout,"Connection timeout"),d;r.onreadystatechange=()=>{r.readyState>r.OPENED&&d===void 0&&(clearTimeout(m),d=a(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{r.status===0&&(clearTimeout(m),clearTimeout(d),o({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(m),clearTimeout(d),o({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)})}return{send:t}}var q="5.5.1",D=["de","us"];function de(t){return[{url:t?"insights.{region}.algolia.io".replace("{region}",t):"insights.algolia.io",accept:"readWrite",protocol:"https"}]}function K({appId:t,apiKey:e,authMode:o,algoliaAgents:r,region:a,...m}){let d=L(t,e,o),n=z({hosts:de(a),...m,algoliaAgent:Q({algoliaAgents:r,client:"Insights",version:q}),baseHeaders:{"content-type":"text/plain",...d.headers(),...m.baseHeaders},baseQueryParameters:{...d.queryParameters(),...m.baseQueryParameters}});return{transporter:n,appId:t,clearCache(){return Promise.all([n.requestsCache.clear(),n.responsesCache.clear()]).then(()=>{})},get _ua(){return n.algoliaAgent.value},addAlgoliaAgent(s,c){n.algoliaAgent.add({segment:s,version:c})},setClientApiKey({apiKey:s}){!o||o==="WithinHeaders"?n.baseHeaders["x-algolia-api-key"]=s:n.baseQueryParameters["x-algolia-api-key"]=s},customDelete({path:s,parameters:c},u){if(!s)throw new Error("Parameter `path` is required when calling `customDelete`.");let P={method:"DELETE",path:"/{path}".replace("{path}",s),queryParameters:c||{},headers:{}};return n.request(P,u)},customGet({path:s,parameters:c},u){if(!s)throw new Error("Parameter `path` is required when calling `customGet`.");let P={method:"GET",path:"/{path}".replace("{path}",s),queryParameters:c||{},headers:{}};return n.request(P,u)},customPost({path:s,parameters:c,body:u},p){if(!s)throw new Error("Parameter `path` is required when calling `customPost`.");let f={method:"POST",path:"/{path}".replace("{path}",s),queryParameters:c||{},headers:{},data:u||{}};return n.request(f,p)},customPut({path:s,parameters:c,body:u},p){if(!s)throw new Error("Parameter `path` is required when calling `customPut`.");let f={method:"PUT",path:"/{path}".replace("{path}",s),queryParameters:c||{},headers:{},data:u||{}};return n.request(f,p)},deleteUserToken({userToken:s},c){if(!s)throw new Error("Parameter `userToken` is required when calling `deleteUserToken`.");let i={method:"DELETE",path:"/1/usertokens/{userToken}".replace("{userToken}",encodeURIComponent(s)),queryParameters:{},headers:{}};return n.request(i,c)},pushEvents(s,c){if(!s)throw new Error("Parameter `insightsEvents` is required when calling `pushEvents`.");if(!s.events)throw new Error("Parameter `insightsEvents.events` is required when calling `pushEvents`.");let i={method:"POST",path:"/1/events",queryParameters:{},headers:{},data:s};return n.request(i,c)}}}function et(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&&(typeof o!="string"||!D.includes(o)))throw new Error(`\`region\` must be one of the following: ${D.join(", ")}`);return K({appId:t,apiKey:e,region:o,timeouts:{connect:F,read:G,write:B},requester:X(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:x(),requestsCache:x({serializable:!1}),hostsCache:v({caches:[$({key:`${q}-${t}`}),x()]}),...r})}export{q as apiClientVersion,et as insightsClient}; | ||
function L(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 $(t){let e,o=`algolia-client-js-${t.key}`;function r(){return e===void 0&&(e=t.localStorage||window.localStorage),e}function a(){return JSON.parse(r().getItem(o)||"{}")}function m(n){r().setItem(o,JSON.stringify(n))}function d(){let n=t.timeToLive?t.timeToLive*1e3:null,s=a(),c=Object.fromEntries(Object.entries(s).filter(([,p])=>p.timestamp!==void 0));if(m(c),!n)return;let u=Object.fromEntries(Object.entries(c).filter(([,p])=>{let l=new Date().getTime();return!(p.timestamp+n<l)}));m(u)}return{get(n,s,c={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(d(),a()[JSON.stringify(n)])).then(u=>Promise.all([u?u.value:s(),u!==void 0])).then(([u,p])=>Promise.all([u,p||c.miss(u)])).then(([u])=>u)},set(n,s){return Promise.resolve().then(()=>{let c=a();return c[JSON.stringify(n)]={timestamp:new Date().getTime(),value:s},r().setItem(o,JSON.stringify(c)),s})},delete(n){return Promise.resolve().then(()=>{let s=a();delete s[JSON.stringify(n)],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(a=>Promise.all([a,o.miss(a)])).then(([a])=>a)},set(t,e){return Promise.resolve(e)},delete(t){return Promise.resolve()},clear(){return Promise.resolve()}}}function v(t){let e=[...t.caches],o=e.shift();return o===void 0?Y():{get(r,a,m={miss:()=>Promise.resolve()}){return o.get(r,a,m).catch(()=>v({caches:e}).get(r,a,m))},set(r,a){return o.set(r,a).catch(()=>v({caches:e}).set(r,a))},delete(r){return o.delete(r).catch(()=>v({caches:e}).delete(r))},clear(){return o.clear().catch(()=>v({caches:e}).clear())}}}function x(t={serializable:!0}){let e={};return{get(o,r,a={miss:()=>Promise.resolve()}){let m=JSON.stringify(o);if(m in e)return Promise.resolve(t.serializable?JSON.parse(e[m]):e[m]);let d=r();return d.then(n=>a.miss(n)).then(()=>d)},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 W=2*60*1e3;function H(t,e="up"){let o=Date.now();function r(){return e==="up"||Date.now()-o>W}function a(){return e==="timed out"&&Date.now()-o<=W}return{...t,status:e,lastUpdate:o,isUp:r,isTimedOut:a}}var j=class extends Error{name="AlgoliaError";constructor(t,e){super(t),e&&(this.name=e)}},J=class extends j{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")}},b=class extends J{status;constructor(t,e,o,r="ApiError"){super(t,o,r),this.status=e}},ee=class extends j{response;constructor(t,e){super(t,"DeserializationError"),this.response=e}},te=class extends b{error;constructor(t,e,o,r){super(t,e,r,"DetailedApiError"),this.error=o}};function re(t,e,o){let r=oe(o),a=`${t.protocol}://${t.url}${t.port?`:${t.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return r.length&&(a+=`?${r}`),a}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 ne(t,e,o){let r={Accept:"application/json",...t,...e,...o},a={};return Object.keys(r).forEach(m=>{let d=r[m];a[m.toLowerCase()]=d}),a}function ae(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 b(r.message,e,o)}catch{}return new b(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=>M(e))}function M(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 z({hosts:t,hostsCache:e,baseHeaders:o,baseQueryParameters:r,algoliaAgent:a,timeouts:m,requester:d,requestsCache:n,responsesCache:s}){async function c(l){let i=await Promise.all(l.map(h=>e.get(h,()=>Promise.resolve(H(h))))),P=i.filter(h=>h.isUp()),f=i.filter(h=>h.isTimedOut()),R=[...P,...f];return{hosts:R.length>0?R:l,getTimeout(h,E){return(f.length===0&&h===0?1:f.length+3+h)*E}}}async function u(l,i,P=!0){let f=[],R=se(l,i),y=ne(o,l.headers,i.headers),h=l.method==="GET"?{...l.data,...i.data}:{},E={...r,...l.queryParameters,...h};if(a.value&&(E["x-algolia-agent"]=a.value),i&&i.queryParameters)for(let g of Object.keys(i.queryParameters))!i.queryParameters[g]||Object.prototype.toString.call(i.queryParameters[g])==="[object Object]"?E[g]=i.queryParameters[g]:E[g]=i.queryParameters[g].toString();let O=0,I=async(g,A)=>{let w=g.pop();if(w===void 0)throw new Z(me(f));let S={...m,...i.timeouts},_={data:R,headers:y,method:l.method,url:re(w,l.path,E),connectTimeout:A(O,S.connect),responseTimeout:A(O,P?S.read:S.write)},k=C=>{let U={request:_,response:C,host:w,triesLeft:g.length};return f.push(U),U},T=await d.send(_);if(ue(T)){let C=k(T);return T.isTimedOut&&O++,console.log("Retryable failure",M(C)),await e.set(w,H(w,T.isTimedOut?"timed out":"down")),I(g,A)}if(le(T))return ae(T);throw k(T),ie(T,f)},V=t.filter(g=>g.accept==="readWrite"||(P?g.accept==="read":g.accept==="write")),N=await c(V);return I([...N.hosts].reverse(),N.getTimeout)}function p(l,i={}){let P=l.useReadTransporter||l.method==="GET";if(!P)return u(l,i,P);let f=()=>u(l,i);if((i.cacheable||l.cacheable)!==!0)return f();let y={request:l,requestOptions:i,transporter:{queryParameters:r,headers:o}};return s.get(y,()=>n.get(y,()=>n.set(y,f()).then(h=>Promise.all([n.delete(y),h]),h=>Promise.all([n.delete(y),Promise.reject(h)])).then(([h,E])=>E)),{miss:h=>s.set(y,h)})}return{hostsCache:e,requester:d,timeouts:m,algoliaAgent:a,baseHeaders:o,baseQueryParameters:r,hosts:t,request:p,requestsCache:n,responsesCache:s}}function he(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 Q({algoliaAgents:t,client:e,version:o}){let r=he(o).add({segment:e,version:o});return t.forEach(a=>r.add(a)),r}var F=1e3,G=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(n=>r.setRequestHeader(n,e.headers[n]));let a=(n,s)=>setTimeout(()=>{r.abort(),o({status:0,content:s,isTimedOut:!0})},n),m=a(e.connectTimeout,"Connection timeout"),d;r.onreadystatechange=()=>{r.readyState>r.OPENED&&d===void 0&&(clearTimeout(m),d=a(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{r.status===0&&(clearTimeout(m),clearTimeout(d),o({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(m),clearTimeout(d),o({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)})}return{send:t}}var q="5.5.2",D=["de","us"];function de(t){return[{url:t?"insights.{region}.algolia.io".replace("{region}",t):"insights.algolia.io",accept:"readWrite",protocol:"https"}]}function K({appId:t,apiKey:e,authMode:o,algoliaAgents:r,region:a,...m}){let d=L(t,e,o),n=z({hosts:de(a),...m,algoliaAgent:Q({algoliaAgents:r,client:"Insights",version:q}),baseHeaders:{"content-type":"text/plain",...d.headers(),...m.baseHeaders},baseQueryParameters:{...d.queryParameters(),...m.baseQueryParameters}});return{transporter:n,appId:t,clearCache(){return Promise.all([n.requestsCache.clear(),n.responsesCache.clear()]).then(()=>{})},get _ua(){return n.algoliaAgent.value},addAlgoliaAgent(s,c){n.algoliaAgent.add({segment:s,version:c})},setClientApiKey({apiKey:s}){!o||o==="WithinHeaders"?n.baseHeaders["x-algolia-api-key"]=s:n.baseQueryParameters["x-algolia-api-key"]=s},customDelete({path:s,parameters:c},u){if(!s)throw new Error("Parameter `path` is required when calling `customDelete`.");let P={method:"DELETE",path:"/{path}".replace("{path}",s),queryParameters:c||{},headers:{}};return n.request(P,u)},customGet({path:s,parameters:c},u){if(!s)throw new Error("Parameter `path` is required when calling `customGet`.");let P={method:"GET",path:"/{path}".replace("{path}",s),queryParameters:c||{},headers:{}};return n.request(P,u)},customPost({path:s,parameters:c,body:u},p){if(!s)throw new Error("Parameter `path` is required when calling `customPost`.");let f={method:"POST",path:"/{path}".replace("{path}",s),queryParameters:c||{},headers:{},data:u||{}};return n.request(f,p)},customPut({path:s,parameters:c,body:u},p){if(!s)throw new Error("Parameter `path` is required when calling `customPut`.");let f={method:"PUT",path:"/{path}".replace("{path}",s),queryParameters:c||{},headers:{},data:u||{}};return n.request(f,p)},deleteUserToken({userToken:s},c){if(!s)throw new Error("Parameter `userToken` is required when calling `deleteUserToken`.");let i={method:"DELETE",path:"/1/usertokens/{userToken}".replace("{userToken}",encodeURIComponent(s)),queryParameters:{},headers:{}};return n.request(i,c)},pushEvents(s,c){if(!s)throw new Error("Parameter `insightsEvents` is required when calling `pushEvents`.");if(!s.events)throw new Error("Parameter `insightsEvents.events` is required when calling `pushEvents`.");let i={method:"POST",path:"/1/events",queryParameters:{},headers:{},data:s};return n.request(i,c)}}}function et(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&&(typeof o!="string"||!D.includes(o)))throw new Error(`\`region\` must be one of the following: ${D.join(", ")}`);return K({appId:t,apiKey:e,region:o,timeouts:{connect:F,read:G,write:B},requester:X(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:x(),requestsCache:x({serializable:!1}),hostsCache:v({caches:[$({key:`${q}-${t}`}),x()]}),...r})}export{q as apiClientVersion,et as insightsClient}; | ||
//# sourceMappingURL=browser.min.js.map |
@@ -7,3 +7,3 @@ (function (global, factory) { | ||
function L(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 $(t){let e,o=`algolia-client-js-${t.key}`;function r(){return e===void 0&&(e=t.localStorage||window.localStorage),e}function a(){return JSON.parse(r().getItem(o)||"{}")}function m(n){r().setItem(o,JSON.stringify(n));}function d(){let n=t.timeToLive?t.timeToLive*1e3:null,s=a(),c=Object.fromEntries(Object.entries(s).filter(([,p])=>p.timestamp!==void 0));if(m(c),!n)return;let u=Object.fromEntries(Object.entries(c).filter(([,p])=>{let l=new Date().getTime();return !(p.timestamp+n<l)}));m(u);}return {get(n,s,c={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(d(),a()[JSON.stringify(n)])).then(u=>Promise.all([u?u.value:s(),u!==void 0])).then(([u,p])=>Promise.all([u,p||c.miss(u)])).then(([u])=>u)},set(n,s){return Promise.resolve().then(()=>{let c=a();return c[JSON.stringify(n)]={timestamp:new Date().getTime(),value:s},r().setItem(o,JSON.stringify(c)),s})},delete(n){return Promise.resolve().then(()=>{let s=a();delete s[JSON.stringify(n)],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(a=>Promise.all([a,o.miss(a)])).then(([a])=>a)},set(t,e){return Promise.resolve(e)},delete(t){return Promise.resolve()},clear(){return Promise.resolve()}}}function v(t){let e=[...t.caches],o=e.shift();return o===void 0?Y():{get(r,a,m={miss:()=>Promise.resolve()}){return o.get(r,a,m).catch(()=>v({caches:e}).get(r,a,m))},set(r,a){return o.set(r,a).catch(()=>v({caches:e}).set(r,a))},delete(r){return o.delete(r).catch(()=>v({caches:e}).delete(r))},clear(){return o.clear().catch(()=>v({caches:e}).clear())}}}function x(t={serializable:!0}){let e={};return {get(o,r,a={miss:()=>Promise.resolve()}){let m=JSON.stringify(o);if(m in e)return Promise.resolve(t.serializable?JSON.parse(e[m]):e[m]);let d=r();return d.then(n=>a.miss(n)).then(()=>d)},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 W=2*60*1e3;function H(t,e="up"){let o=Date.now();function r(){return e==="up"||Date.now()-o>W}function a(){return e==="timed out"&&Date.now()-o<=W}return {...t,status:e,lastUpdate:o,isUp:r,isTimedOut:a}}var j=class extends Error{name="AlgoliaError";constructor(t,e){super(t),e&&(this.name=e);}},J=class extends j{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");}},b=class extends J{status;constructor(t,e,o,r="ApiError"){super(t,o,r),this.status=e;}},ee=class extends j{response;constructor(t,e){super(t,"DeserializationError"),this.response=e;}},te=class extends b{error;constructor(t,e,o,r){super(t,e,r,"DetailedApiError"),this.error=o;}};function re(t,e,o){let r=oe(o),a=`${t.protocol}://${t.url}${t.port?`:${t.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return r.length&&(a+=`?${r}`),a}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 ne(t,e,o){let r={Accept:"application/json",...t,...e,...o},a={};return Object.keys(r).forEach(m=>{let d=r[m];a[m.toLowerCase()]=d;}),a}function ae(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 b(r.message,e,o)}catch{}return new b(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=>M(e))}function M(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 z({hosts:t,hostsCache:e,baseHeaders:o,baseQueryParameters:r,algoliaAgent:a,timeouts:m,requester:d,requestsCache:n,responsesCache:s}){async function c(l){let i=await Promise.all(l.map(h=>e.get(h,()=>Promise.resolve(H(h))))),P=i.filter(h=>h.isUp()),f=i.filter(h=>h.isTimedOut()),R=[...P,...f];return {hosts:R.length>0?R:l,getTimeout(h,E){return (f.length===0&&h===0?1:f.length+3+h)*E}}}async function u(l,i,P=!0){let f=[],R=se(l,i),y=ne(o,l.headers,i.headers),h=l.method==="GET"?{...l.data,...i.data}:{},E={...r,...l.queryParameters,...h};if(a.value&&(E["x-algolia-agent"]=a.value),i&&i.queryParameters)for(let g of Object.keys(i.queryParameters))!i.queryParameters[g]||Object.prototype.toString.call(i.queryParameters[g])==="[object Object]"?E[g]=i.queryParameters[g]:E[g]=i.queryParameters[g].toString();let O=0,I=async(g,A)=>{let w=g.pop();if(w===void 0)throw new Z(me(f));let S={...m,...i.timeouts},_={data:R,headers:y,method:l.method,url:re(w,l.path,E),connectTimeout:A(O,S.connect),responseTimeout:A(O,P?S.read:S.write)},k=C=>{let U={request:_,response:C,host:w,triesLeft:g.length};return f.push(U),U},T=await d.send(_);if(ue(T)){let C=k(T);return T.isTimedOut&&O++,console.log("Retryable failure",M(C)),await e.set(w,H(w,T.isTimedOut?"timed out":"down")),I(g,A)}if(le(T))return ae(T);throw k(T),ie(T,f)},V=t.filter(g=>g.accept==="readWrite"||(P?g.accept==="read":g.accept==="write")),N=await c(V);return I([...N.hosts].reverse(),N.getTimeout)}function p(l,i={}){let P=l.useReadTransporter||l.method==="GET";if(!P)return u(l,i,P);let f=()=>u(l,i);if((i.cacheable||l.cacheable)!==!0)return f();let y={request:l,requestOptions:i,transporter:{queryParameters:r,headers:o}};return s.get(y,()=>n.get(y,()=>n.set(y,f()).then(h=>Promise.all([n.delete(y),h]),h=>Promise.all([n.delete(y),Promise.reject(h)])).then(([h,E])=>E)),{miss:h=>s.set(y,h)})}return {hostsCache:e,requester:d,timeouts:m,algoliaAgent:a,baseHeaders:o,baseQueryParameters:r,hosts:t,request:p,requestsCache:n,responsesCache:s}}function he(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 Q({algoliaAgents:t,client:e,version:o}){let r=he(o).add({segment:e,version:o});return t.forEach(a=>r.add(a)),r}var F=1e3,G=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(n=>r.setRequestHeader(n,e.headers[n]));let a=(n,s)=>setTimeout(()=>{r.abort(),o({status:0,content:s,isTimedOut:!0});},n),m=a(e.connectTimeout,"Connection timeout"),d;r.onreadystatechange=()=>{r.readyState>r.OPENED&&d===void 0&&(clearTimeout(m),d=a(e.responseTimeout,"Socket timeout"));},r.onerror=()=>{r.status===0&&(clearTimeout(m),clearTimeout(d),o({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}));},r.onload=()=>{clearTimeout(m),clearTimeout(d),o({content:r.responseText,status:r.status,isTimedOut:!1});},r.send(e.data);})}return {send:t}}var q="5.5.1",D=["de","us"];function de(t){return [{url:t?"insights.{region}.algolia.io".replace("{region}",t):"insights.algolia.io",accept:"readWrite",protocol:"https"}]}function K({appId:t,apiKey:e,authMode:o,algoliaAgents:r,region:a,...m}){let d=L(t,e,o),n=z({hosts:de(a),...m,algoliaAgent:Q({algoliaAgents:r,client:"Insights",version:q}),baseHeaders:{"content-type":"text/plain",...d.headers(),...m.baseHeaders},baseQueryParameters:{...d.queryParameters(),...m.baseQueryParameters}});return {transporter:n,appId:t,clearCache(){return Promise.all([n.requestsCache.clear(),n.responsesCache.clear()]).then(()=>{})},get _ua(){return n.algoliaAgent.value},addAlgoliaAgent(s,c){n.algoliaAgent.add({segment:s,version:c});},setClientApiKey({apiKey:s}){!o||o==="WithinHeaders"?n.baseHeaders["x-algolia-api-key"]=s:n.baseQueryParameters["x-algolia-api-key"]=s;},customDelete({path:s,parameters:c},u){if(!s)throw new Error("Parameter `path` is required when calling `customDelete`.");let P={method:"DELETE",path:"/{path}".replace("{path}",s),queryParameters:c||{},headers:{}};return n.request(P,u)},customGet({path:s,parameters:c},u){if(!s)throw new Error("Parameter `path` is required when calling `customGet`.");let P={method:"GET",path:"/{path}".replace("{path}",s),queryParameters:c||{},headers:{}};return n.request(P,u)},customPost({path:s,parameters:c,body:u},p){if(!s)throw new Error("Parameter `path` is required when calling `customPost`.");let f={method:"POST",path:"/{path}".replace("{path}",s),queryParameters:c||{},headers:{},data:u||{}};return n.request(f,p)},customPut({path:s,parameters:c,body:u},p){if(!s)throw new Error("Parameter `path` is required when calling `customPut`.");let f={method:"PUT",path:"/{path}".replace("{path}",s),queryParameters:c||{},headers:{},data:u||{}};return n.request(f,p)},deleteUserToken({userToken:s},c){if(!s)throw new Error("Parameter `userToken` is required when calling `deleteUserToken`.");let i={method:"DELETE",path:"/1/usertokens/{userToken}".replace("{userToken}",encodeURIComponent(s)),queryParameters:{},headers:{}};return n.request(i,c)},pushEvents(s,c){if(!s)throw new Error("Parameter `insightsEvents` is required when calling `pushEvents`.");if(!s.events)throw new Error("Parameter `insightsEvents.events` is required when calling `pushEvents`.");let i={method:"POST",path:"/1/events",queryParameters:{},headers:{},data:s};return n.request(i,c)}}}function et(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&&(typeof o!="string"||!D.includes(o)))throw new Error(`\`region\` must be one of the following: ${D.join(", ")}`);return K({appId:t,apiKey:e,region:o,timeouts:{connect:F,read:G,write:B},requester:X(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:x(),requestsCache:x({serializable:!1}),hostsCache:v({caches:[$({key:`${q}-${t}`}),x()]}),...r})} | ||
function L(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 $(t){let e,o=`algolia-client-js-${t.key}`;function r(){return e===void 0&&(e=t.localStorage||window.localStorage),e}function a(){return JSON.parse(r().getItem(o)||"{}")}function m(n){r().setItem(o,JSON.stringify(n));}function d(){let n=t.timeToLive?t.timeToLive*1e3:null,s=a(),c=Object.fromEntries(Object.entries(s).filter(([,p])=>p.timestamp!==void 0));if(m(c),!n)return;let u=Object.fromEntries(Object.entries(c).filter(([,p])=>{let l=new Date().getTime();return !(p.timestamp+n<l)}));m(u);}return {get(n,s,c={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(d(),a()[JSON.stringify(n)])).then(u=>Promise.all([u?u.value:s(),u!==void 0])).then(([u,p])=>Promise.all([u,p||c.miss(u)])).then(([u])=>u)},set(n,s){return Promise.resolve().then(()=>{let c=a();return c[JSON.stringify(n)]={timestamp:new Date().getTime(),value:s},r().setItem(o,JSON.stringify(c)),s})},delete(n){return Promise.resolve().then(()=>{let s=a();delete s[JSON.stringify(n)],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(a=>Promise.all([a,o.miss(a)])).then(([a])=>a)},set(t,e){return Promise.resolve(e)},delete(t){return Promise.resolve()},clear(){return Promise.resolve()}}}function v(t){let e=[...t.caches],o=e.shift();return o===void 0?Y():{get(r,a,m={miss:()=>Promise.resolve()}){return o.get(r,a,m).catch(()=>v({caches:e}).get(r,a,m))},set(r,a){return o.set(r,a).catch(()=>v({caches:e}).set(r,a))},delete(r){return o.delete(r).catch(()=>v({caches:e}).delete(r))},clear(){return o.clear().catch(()=>v({caches:e}).clear())}}}function x(t={serializable:!0}){let e={};return {get(o,r,a={miss:()=>Promise.resolve()}){let m=JSON.stringify(o);if(m in e)return Promise.resolve(t.serializable?JSON.parse(e[m]):e[m]);let d=r();return d.then(n=>a.miss(n)).then(()=>d)},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 W=2*60*1e3;function H(t,e="up"){let o=Date.now();function r(){return e==="up"||Date.now()-o>W}function a(){return e==="timed out"&&Date.now()-o<=W}return {...t,status:e,lastUpdate:o,isUp:r,isTimedOut:a}}var j=class extends Error{name="AlgoliaError";constructor(t,e){super(t),e&&(this.name=e);}},J=class extends j{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");}},b=class extends J{status;constructor(t,e,o,r="ApiError"){super(t,o,r),this.status=e;}},ee=class extends j{response;constructor(t,e){super(t,"DeserializationError"),this.response=e;}},te=class extends b{error;constructor(t,e,o,r){super(t,e,r,"DetailedApiError"),this.error=o;}};function re(t,e,o){let r=oe(o),a=`${t.protocol}://${t.url}${t.port?`:${t.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return r.length&&(a+=`?${r}`),a}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 ne(t,e,o){let r={Accept:"application/json",...t,...e,...o},a={};return Object.keys(r).forEach(m=>{let d=r[m];a[m.toLowerCase()]=d;}),a}function ae(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 b(r.message,e,o)}catch{}return new b(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=>M(e))}function M(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 z({hosts:t,hostsCache:e,baseHeaders:o,baseQueryParameters:r,algoliaAgent:a,timeouts:m,requester:d,requestsCache:n,responsesCache:s}){async function c(l){let i=await Promise.all(l.map(h=>e.get(h,()=>Promise.resolve(H(h))))),P=i.filter(h=>h.isUp()),f=i.filter(h=>h.isTimedOut()),R=[...P,...f];return {hosts:R.length>0?R:l,getTimeout(h,E){return (f.length===0&&h===0?1:f.length+3+h)*E}}}async function u(l,i,P=!0){let f=[],R=se(l,i),y=ne(o,l.headers,i.headers),h=l.method==="GET"?{...l.data,...i.data}:{},E={...r,...l.queryParameters,...h};if(a.value&&(E["x-algolia-agent"]=a.value),i&&i.queryParameters)for(let g of Object.keys(i.queryParameters))!i.queryParameters[g]||Object.prototype.toString.call(i.queryParameters[g])==="[object Object]"?E[g]=i.queryParameters[g]:E[g]=i.queryParameters[g].toString();let O=0,I=async(g,A)=>{let w=g.pop();if(w===void 0)throw new Z(me(f));let S={...m,...i.timeouts},_={data:R,headers:y,method:l.method,url:re(w,l.path,E),connectTimeout:A(O,S.connect),responseTimeout:A(O,P?S.read:S.write)},k=C=>{let U={request:_,response:C,host:w,triesLeft:g.length};return f.push(U),U},T=await d.send(_);if(ue(T)){let C=k(T);return T.isTimedOut&&O++,console.log("Retryable failure",M(C)),await e.set(w,H(w,T.isTimedOut?"timed out":"down")),I(g,A)}if(le(T))return ae(T);throw k(T),ie(T,f)},V=t.filter(g=>g.accept==="readWrite"||(P?g.accept==="read":g.accept==="write")),N=await c(V);return I([...N.hosts].reverse(),N.getTimeout)}function p(l,i={}){let P=l.useReadTransporter||l.method==="GET";if(!P)return u(l,i,P);let f=()=>u(l,i);if((i.cacheable||l.cacheable)!==!0)return f();let y={request:l,requestOptions:i,transporter:{queryParameters:r,headers:o}};return s.get(y,()=>n.get(y,()=>n.set(y,f()).then(h=>Promise.all([n.delete(y),h]),h=>Promise.all([n.delete(y),Promise.reject(h)])).then(([h,E])=>E)),{miss:h=>s.set(y,h)})}return {hostsCache:e,requester:d,timeouts:m,algoliaAgent:a,baseHeaders:o,baseQueryParameters:r,hosts:t,request:p,requestsCache:n,responsesCache:s}}function he(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 Q({algoliaAgents:t,client:e,version:o}){let r=he(o).add({segment:e,version:o});return t.forEach(a=>r.add(a)),r}var F=1e3,G=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(n=>r.setRequestHeader(n,e.headers[n]));let a=(n,s)=>setTimeout(()=>{r.abort(),o({status:0,content:s,isTimedOut:!0});},n),m=a(e.connectTimeout,"Connection timeout"),d;r.onreadystatechange=()=>{r.readyState>r.OPENED&&d===void 0&&(clearTimeout(m),d=a(e.responseTimeout,"Socket timeout"));},r.onerror=()=>{r.status===0&&(clearTimeout(m),clearTimeout(d),o({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}));},r.onload=()=>{clearTimeout(m),clearTimeout(d),o({content:r.responseText,status:r.status,isTimedOut:!1});},r.send(e.data);})}return {send:t}}var q="5.5.2",D=["de","us"];function de(t){return [{url:t?"insights.{region}.algolia.io".replace("{region}",t):"insights.algolia.io",accept:"readWrite",protocol:"https"}]}function K({appId:t,apiKey:e,authMode:o,algoliaAgents:r,region:a,...m}){let d=L(t,e,o),n=z({hosts:de(a),...m,algoliaAgent:Q({algoliaAgents:r,client:"Insights",version:q}),baseHeaders:{"content-type":"text/plain",...d.headers(),...m.baseHeaders},baseQueryParameters:{...d.queryParameters(),...m.baseQueryParameters}});return {transporter:n,appId:t,clearCache(){return Promise.all([n.requestsCache.clear(),n.responsesCache.clear()]).then(()=>{})},get _ua(){return n.algoliaAgent.value},addAlgoliaAgent(s,c){n.algoliaAgent.add({segment:s,version:c});},setClientApiKey({apiKey:s}){!o||o==="WithinHeaders"?n.baseHeaders["x-algolia-api-key"]=s:n.baseQueryParameters["x-algolia-api-key"]=s;},customDelete({path:s,parameters:c},u){if(!s)throw new Error("Parameter `path` is required when calling `customDelete`.");let P={method:"DELETE",path:"/{path}".replace("{path}",s),queryParameters:c||{},headers:{}};return n.request(P,u)},customGet({path:s,parameters:c},u){if(!s)throw new Error("Parameter `path` is required when calling `customGet`.");let P={method:"GET",path:"/{path}".replace("{path}",s),queryParameters:c||{},headers:{}};return n.request(P,u)},customPost({path:s,parameters:c,body:u},p){if(!s)throw new Error("Parameter `path` is required when calling `customPost`.");let f={method:"POST",path:"/{path}".replace("{path}",s),queryParameters:c||{},headers:{},data:u||{}};return n.request(f,p)},customPut({path:s,parameters:c,body:u},p){if(!s)throw new Error("Parameter `path` is required when calling `customPut`.");let f={method:"PUT",path:"/{path}".replace("{path}",s),queryParameters:c||{},headers:{},data:u||{}};return n.request(f,p)},deleteUserToken({userToken:s},c){if(!s)throw new Error("Parameter `userToken` is required when calling `deleteUserToken`.");let i={method:"DELETE",path:"/1/usertokens/{userToken}".replace("{userToken}",encodeURIComponent(s)),queryParameters:{},headers:{}};return n.request(i,c)},pushEvents(s,c){if(!s)throw new Error("Parameter `insightsEvents` is required when calling `pushEvents`.");if(!s.events)throw new Error("Parameter `insightsEvents.events` is required when calling `pushEvents`.");let i={method:"POST",path:"/1/events",queryParameters:{},headers:{},data:s};return n.request(i,c)}}}function et(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&&(typeof o!="string"||!D.includes(o)))throw new Error(`\`region\` must be one of the following: ${D.join(", ")}`);return K({appId:t,apiKey:e,region:o,timeouts:{connect:F,read:G,write:B},requester:X(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:x(),requestsCache:x({serializable:!1}),hostsCache:v({caches:[$({key:`${q}-${t}`}),x()]}),...r})} | ||
@@ -10,0 +10,0 @@ exports.apiClientVersion = q; |
@@ -13,3 +13,3 @@ // builds/fetch.ts | ||
import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common"; | ||
var apiClientVersion = "5.5.1"; | ||
var apiClientVersion = "5.5.2"; | ||
var REGIONS = ["de", "us"]; | ||
@@ -16,0 +16,0 @@ function getDefaultHosts(region) { |
@@ -13,3 +13,3 @@ // builds/node.ts | ||
import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common"; | ||
var apiClientVersion = "5.5.1"; | ||
var apiClientVersion = "5.5.2"; | ||
var REGIONS = ["de", "us"]; | ||
@@ -16,0 +16,0 @@ function getDefaultHosts(region) { |
@@ -569,3 +569,3 @@ import * as _algolia_client_common from '@algolia/client-common'; | ||
declare const apiClientVersion = "5.5.1"; | ||
declare const apiClientVersion = "5.5.2"; | ||
declare const REGIONS: readonly ["de", "us"]; | ||
@@ -572,0 +572,0 @@ type Region = (typeof REGIONS)[number]; |
@@ -569,3 +569,3 @@ import * as _algolia_client_common from '@algolia/client-common'; | ||
declare const apiClientVersion = "5.5.1"; | ||
declare const apiClientVersion = "5.5.2"; | ||
declare const REGIONS: readonly ["de", "us"]; | ||
@@ -572,0 +572,0 @@ type Region = (typeof REGIONS)[number]; |
// src/insightsClient.ts | ||
import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common"; | ||
var apiClientVersion = "5.5.1"; | ||
var apiClientVersion = "5.5.2"; | ||
var REGIONS = ["de", "us"]; | ||
@@ -5,0 +5,0 @@ function getDefaultHosts(region) { |
{ | ||
"version": "5.5.1", | ||
"version": "5.5.2", | ||
"repository": { | ||
@@ -52,6 +52,6 @@ "type": "git", | ||
"dependencies": { | ||
"@algolia/client-common": "5.5.1", | ||
"@algolia/requester-browser-xhr": "5.5.1", | ||
"@algolia/requester-fetch": "5.5.1", | ||
"@algolia/requester-node-http": "5.5.1" | ||
"@algolia/client-common": "5.5.2", | ||
"@algolia/requester-browser-xhr": "5.5.2", | ||
"@algolia/requester-fetch": "5.5.2", | ||
"@algolia/requester-node-http": "5.5.2" | ||
}, | ||
@@ -58,0 +58,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
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
+ Added@algolia/client-common@5.5.2(transitive)
+ Added@algolia/requester-browser-xhr@5.5.2(transitive)
+ Added@algolia/requester-fetch@5.5.2(transitive)
+ Added@algolia/requester-node-http@5.5.2(transitive)
- Removed@algolia/client-common@5.5.1(transitive)
- Removed@algolia/requester-browser-xhr@5.5.1(transitive)
- Removed@algolia/requester-fetch@5.5.1(transitive)
- Removed@algolia/requester-node-http@5.5.1(transitive)
Updated@algolia/client-common@5.5.2