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

@algolia/monitoring

Package Overview
Dependencies
Maintainers
0
Versions
92
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@algolia/monitoring - npm Package Compare versions

Comparing version 1.5.2 to 1.5.3

2

dist/browser.d.ts

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

declare const apiClientVersion = "1.5.2";
declare const apiClientVersion = "1.5.3";
declare function createMonitoringClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, ...options }: CreateClientOptions): {

@@ -262,0 +262,0 @@ transporter: _algolia_client_common.Transporter;

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

import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
var apiClientVersion = "1.5.2";
var apiClientVersion = "1.5.3";
function getDefaultHosts() {

@@ -17,0 +17,0 @@ return [{ url: "status.algolia.com", accept: "readWrite", protocol: "https" }];

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

function M(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 L(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 p(s){r().setItem(o,JSON.stringify(s))}function i(){let s=t.timeToLive?t.timeToLive*1e3:null,n=a(),u=Object.fromEntries(Object.entries(n).filter(([,d])=>d.timestamp!==void 0));if(p(u),!s)return;let l=Object.fromEntries(Object.entries(u).filter(([,d])=>{let c=new Date().getTime();return!(d.timestamp+s<c)}));p(l)}return{get(s,n,u={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(i(),a()[JSON.stringify(s)])).then(l=>Promise.all([l?l.value:n(),l!==void 0])).then(([l,d])=>Promise.all([l,d||u.miss(l)])).then(([l])=>l)},set(s,n){return Promise.resolve().then(()=>{let u=a();return u[JSON.stringify(s)]={timestamp:new Date().getTime(),value:n},r().setItem(o,JSON.stringify(u)),n})},delete(s){return Promise.resolve().then(()=>{let n=a();delete n[JSON.stringify(s)],r().setItem(o,JSON.stringify(n))})},clear(){return Promise.resolve().then(()=>{r().removeItem(o)})}}}function V(){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 T(t){let e=[...t.caches],o=e.shift();return o===void 0?V():{get(r,a,p={miss:()=>Promise.resolve()}){return o.get(r,a,p).catch(()=>T({caches:e}).get(r,a,p))},set(r,a){return o.set(r,a).catch(()=>T({caches:e}).set(r,a))},delete(r){return o.delete(r).catch(()=>T({caches:e}).delete(r))},clear(){return o.clear().catch(()=>T({caches:e}).clear())}}}function O(t={serializable:!0}){let e={};return{get(o,r,a={miss:()=>Promise.resolve()}){let p=JSON.stringify(o);if(p in e)return Promise.resolve(t.serializable?JSON.parse(e[p]):e[p]);let i=r();return i.then(s=>a.miss(s)).then(()=>i)},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 G=2*60*1e3;function H(t,e="up"){let o=Date.now();function r(){return e==="up"||Date.now()-o>G}function a(){return e==="timed out"&&Date.now()-o<=G}return{...t,status:e,lastUpdate:o,isUp:r,isTimedOut:a}}var k=class extends Error{name="AlgoliaError";constructor(t,e){super(t),e&&(this.name=e)}},W=class extends k{stackTrace;constructor(t,e,o){super(t,o),this.stackTrace=e}},Y=class extends W{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")}},I=class extends W{status;constructor(t,e,o,r="ApiError"){super(t,o,r),this.status=e}},Z=class extends k{response;constructor(t,e){super(t,"DeserializationError"),this.response=e}},ee=class extends I{error;constructor(t,e,o,r){super(t,e,r,"DetailedApiError"),this.error=o}};function te(t,e,o){let r=re(o),a=`${t.protocol}://${t.url}${t.port?`:${t.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return r.length&&(a+=`?${r}`),a}function re(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 oe(t,e,o){let r={Accept:"application/json",...t,...e,...o},a={};return Object.keys(r).forEach(p=>{let i=r[p];a[p.toLowerCase()]=i}),a}function ne(t){try{return JSON.parse(t.content)}catch(e){throw new Z(e.message,t)}}function ae({content:t,status:e},o){try{let r=JSON.parse(t);return"error"in r?new ee(r.message,e,r.error,o):new I(r.message,e,o)}catch{}return new I(t,e,o)}function ie({isTimedOut:t,status:e}){return!t&&~~e===0}function ce({isTimedOut:t,status:e}){return t||ie({isTimedOut:t,status:e})||~~(e/100)!==2&&~~(e/100)!==4}function ue({status:t}){return~~(t/100)===2}function le(t){return t.map(e=>Q(e))}function Q(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 $({hosts:t,hostsCache:e,baseHeaders:o,baseQueryParameters:r,algoliaAgent:a,timeouts:p,requester:i,requestsCache:s,responsesCache:n}){async function u(c){let m=await Promise.all(c.map(h=>e.get(h,()=>Promise.resolve(H(h))))),f=m.filter(h=>h.isUp()),g=m.filter(h=>h.isTimedOut()),E=[...f,...g];return{hosts:E.length>0?E:c,getTimeout(h,q){return(g.length===0&&h===0?1:g.length+3+h)*q}}}async function l(c,m,f=!0){let g=[],E=se(c,m),y=oe(o,c.headers,m.headers),h=c.method==="GET"?{...c.data,...m.data}:{},q={...r,...c.queryParameters,...h};if(a.value&&(q["x-algolia-agent"]=a.value),m&&m.queryParameters)for(let P of Object.keys(m.queryParameters))!m.queryParameters[P]||Object.prototype.toString.call(m.queryParameters[P])==="[object Object]"?q[P]=m.queryParameters[P]:q[P]=m.queryParameters[P].toString();let v=0,b=async(P,C)=>{let w=P.pop();if(w===void 0)throw new Y(le(g));let A={...p,...m.timeouts},N={data:E,headers:y,method:c.method,url:te(w,c.path,q),connectTimeout:C(v,A.connect),responseTimeout:C(v,f?A.read:A.write)},U=S=>{let _={request:N,response:S,host:w,triesLeft:P.length};return g.push(_),_},R=await i.send(N);if(ce(R)){let S=U(R);return R.isTimedOut&&v++,console.log("Retryable failure",Q(S)),await e.set(w,H(w,R.isTimedOut?"timed out":"down")),b(P,C)}if(ue(R))return ne(R);throw U(R),ae(R,g)},K=t.filter(P=>P.accept==="readWrite"||(f?P.accept==="read":P.accept==="write")),D=await u(K);return b([...D.hosts].reverse(),D.getTimeout)}function d(c,m={}){let f=c.useReadTransporter||c.method==="GET";if(!f)return l(c,m,f);let g=()=>l(c,m);if((m.cacheable||c.cacheable)!==!0)return g();let y={request:c,requestOptions:m,transporter:{queryParameters:r,headers:o}};return n.get(y,()=>s.get(y,()=>s.set(y,g()).then(h=>Promise.all([s.delete(y),h]),h=>Promise.all([s.delete(y),Promise.reject(h)])).then(([h,q])=>q)),{miss:h=>n.set(y,h)})}return{hostsCache:e,requester:i,timeouts:p,algoliaAgent:a,baseHeaders:o,baseQueryParameters:r,hosts:t,request:d,requestsCache:s,responsesCache:n}}function me(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 j({algoliaAgents:t,client:e,version:o}){let r=me(o).add({segment:e,version:o});return t.forEach(a=>r.add(a)),r}var J=1e3,z=2e3,F=3e4;function B(){function t(e){return new Promise(o=>{let r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach(s=>r.setRequestHeader(s,e.headers[s]));let a=(s,n)=>setTimeout(()=>{r.abort(),o({status:0,content:n,isTimedOut:!0})},s),p=a(e.connectTimeout,"Connection timeout"),i;r.onreadystatechange=()=>{r.readyState>r.OPENED&&i===void 0&&(clearTimeout(p),i=a(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{r.status===0&&(clearTimeout(p),clearTimeout(i),o({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(p),clearTimeout(i),o({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)})}return{send:t}}var x="1.5.2";function de(){return[{url:"status.algolia.com",accept:"readWrite",protocol:"https"}]}function X({appId:t,apiKey:e,authMode:o,algoliaAgents:r,...a}){let p=M(t,e,o),i=$({hosts:de(),...a,algoliaAgent:j({algoliaAgents:r,client:"Monitoring",version:x}),baseHeaders:{"content-type":"text/plain",...p.headers(),...a.baseHeaders},baseQueryParameters:{...p.queryParameters(),...a.baseQueryParameters}});return{transporter:i,appId:t,clearCache(){return Promise.all([i.requestsCache.clear(),i.responsesCache.clear()]).then(()=>{})},get _ua(){return i.algoliaAgent.value},addAlgoliaAgent(s,n){i.algoliaAgent.add({segment:s,version:n})},setClientApiKey({apiKey:s}){!o||o==="WithinHeaders"?i.baseHeaders["x-algolia-api-key"]=s:i.baseQueryParameters["x-algolia-api-key"]=s},customDelete({path:s,parameters:n},u){if(!s)throw new Error("Parameter `path` is required when calling `customDelete`.");let m={method:"DELETE",path:"/{path}".replace("{path}",s),queryParameters:n||{},headers:{}};return i.request(m,u)},customGet({path:s,parameters:n},u){if(!s)throw new Error("Parameter `path` is required when calling `customGet`.");let m={method:"GET",path:"/{path}".replace("{path}",s),queryParameters:n||{},headers:{}};return i.request(m,u)},customPost({path:s,parameters:n,body:u},l){if(!s)throw new Error("Parameter `path` is required when calling `customPost`.");let f={method:"POST",path:"/{path}".replace("{path}",s),queryParameters:n||{},headers:{},data:u||{}};return i.request(f,l)},customPut({path:s,parameters:n,body:u},l){if(!s)throw new Error("Parameter `path` is required when calling `customPut`.");let f={method:"PUT",path:"/{path}".replace("{path}",s),queryParameters:n||{},headers:{},data:u||{}};return i.request(f,l)},getClusterIncidents({clusters:s},n){if(!s)throw new Error("Parameter `clusters` is required when calling `getClusterIncidents`.");let c={method:"GET",path:"/1/incidents/{clusters}".replace("{clusters}",encodeURIComponent(s)),queryParameters:{},headers:{}};return i.request(c,n)},getClusterStatus({clusters:s},n){if(!s)throw new Error("Parameter `clusters` is required when calling `getClusterStatus`.");let c={method:"GET",path:"/1/status/{clusters}".replace("{clusters}",encodeURIComponent(s)),queryParameters:{},headers:{}};return i.request(c,n)},getIncidents(s){let d={method:"GET",path:"/1/incidents",queryParameters:{},headers:{}};return i.request(d,s)},getIndexingTime({clusters:s},n){if(!s)throw new Error("Parameter `clusters` is required when calling `getIndexingTime`.");let c={method:"GET",path:"/1/indexing/{clusters}".replace("{clusters}",encodeURIComponent(s)),queryParameters:{},headers:{}};return i.request(c,n)},getLatency({clusters:s},n){if(!s)throw new Error("Parameter `clusters` is required when calling `getLatency`.");let c={method:"GET",path:"/1/latency/{clusters}".replace("{clusters}",encodeURIComponent(s)),queryParameters:{},headers:{}};return i.request(c,n)},getMetrics({metric:s,period:n},u){if(!s)throw new Error("Parameter `metric` is required when calling `getMetrics`.");if(!n)throw new Error("Parameter `period` is required when calling `getMetrics`.");let m={method:"GET",path:"/1/infrastructure/{metric}/period/{period}".replace("{metric}",encodeURIComponent(s)).replace("{period}",encodeURIComponent(n)),queryParameters:{},headers:{}};return i.request(m,u)},getReachability({clusters:s},n){if(!s)throw new Error("Parameter `clusters` is required when calling `getReachability`.");let c={method:"GET",path:"/1/reachability/{clusters}/probes".replace("{clusters}",encodeURIComponent(s)),queryParameters:{},headers:{}};return i.request(c,n)},getServers(s){let d={method:"GET",path:"/1/inventory/servers",queryParameters:{},headers:{}};return i.request(d,s)},getStatus(s){let d={method:"GET",path:"/1/status",queryParameters:{},headers:{}};return i.request(d,s)}}}function Ve(t,e,o){if(!t||typeof t!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");return X({appId:t,apiKey:e,timeouts:{connect:J,read:z,write:F},requester:B(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:O(),requestsCache:O({serializable:!1}),hostsCache:T({caches:[L({key:`${x}-${t}`}),O()]}),...o})}export{x as apiClientVersion,Ve as monitoringClient};
function M(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 L(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 p(s){r().setItem(o,JSON.stringify(s))}function i(){let s=t.timeToLive?t.timeToLive*1e3:null,n=a(),u=Object.fromEntries(Object.entries(n).filter(([,d])=>d.timestamp!==void 0));if(p(u),!s)return;let l=Object.fromEntries(Object.entries(u).filter(([,d])=>{let c=new Date().getTime();return!(d.timestamp+s<c)}));p(l)}return{get(s,n,u={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(i(),a()[JSON.stringify(s)])).then(l=>Promise.all([l?l.value:n(),l!==void 0])).then(([l,d])=>Promise.all([l,d||u.miss(l)])).then(([l])=>l)},set(s,n){return Promise.resolve().then(()=>{let u=a();return u[JSON.stringify(s)]={timestamp:new Date().getTime(),value:n},r().setItem(o,JSON.stringify(u)),n})},delete(s){return Promise.resolve().then(()=>{let n=a();delete n[JSON.stringify(s)],r().setItem(o,JSON.stringify(n))})},clear(){return Promise.resolve().then(()=>{r().removeItem(o)})}}}function V(){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 T(t){let e=[...t.caches],o=e.shift();return o===void 0?V():{get(r,a,p={miss:()=>Promise.resolve()}){return o.get(r,a,p).catch(()=>T({caches:e}).get(r,a,p))},set(r,a){return o.set(r,a).catch(()=>T({caches:e}).set(r,a))},delete(r){return o.delete(r).catch(()=>T({caches:e}).delete(r))},clear(){return o.clear().catch(()=>T({caches:e}).clear())}}}function O(t={serializable:!0}){let e={};return{get(o,r,a={miss:()=>Promise.resolve()}){let p=JSON.stringify(o);if(p in e)return Promise.resolve(t.serializable?JSON.parse(e[p]):e[p]);let i=r();return i.then(s=>a.miss(s)).then(()=>i)},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 G=2*60*1e3;function H(t,e="up"){let o=Date.now();function r(){return e==="up"||Date.now()-o>G}function a(){return e==="timed out"&&Date.now()-o<=G}return{...t,status:e,lastUpdate:o,isUp:r,isTimedOut:a}}var k=class extends Error{name="AlgoliaError";constructor(t,e){super(t),e&&(this.name=e)}},W=class extends k{stackTrace;constructor(t,e,o){super(t,o),this.stackTrace=e}},Y=class extends W{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")}},I=class extends W{status;constructor(t,e,o,r="ApiError"){super(t,o,r),this.status=e}},Z=class extends k{response;constructor(t,e){super(t,"DeserializationError"),this.response=e}},ee=class extends I{error;constructor(t,e,o,r){super(t,e,r,"DetailedApiError"),this.error=o}};function te(t,e,o){let r=re(o),a=`${t.protocol}://${t.url}${t.port?`:${t.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return r.length&&(a+=`?${r}`),a}function re(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 oe(t,e,o){let r={Accept:"application/json",...t,...e,...o},a={};return Object.keys(r).forEach(p=>{let i=r[p];a[p.toLowerCase()]=i}),a}function ne(t){try{return JSON.parse(t.content)}catch(e){throw new Z(e.message,t)}}function ae({content:t,status:e},o){try{let r=JSON.parse(t);return"error"in r?new ee(r.message,e,r.error,o):new I(r.message,e,o)}catch{}return new I(t,e,o)}function ie({isTimedOut:t,status:e}){return!t&&~~e===0}function ce({isTimedOut:t,status:e}){return t||ie({isTimedOut:t,status:e})||~~(e/100)!==2&&~~(e/100)!==4}function ue({status:t}){return~~(t/100)===2}function le(t){return t.map(e=>Q(e))}function Q(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 $({hosts:t,hostsCache:e,baseHeaders:o,baseQueryParameters:r,algoliaAgent:a,timeouts:p,requester:i,requestsCache:s,responsesCache:n}){async function u(c){let m=await Promise.all(c.map(h=>e.get(h,()=>Promise.resolve(H(h))))),f=m.filter(h=>h.isUp()),g=m.filter(h=>h.isTimedOut()),E=[...f,...g];return{hosts:E.length>0?E:c,getTimeout(h,q){return(g.length===0&&h===0?1:g.length+3+h)*q}}}async function l(c,m,f=!0){let g=[],E=se(c,m),y=oe(o,c.headers,m.headers),h=c.method==="GET"?{...c.data,...m.data}:{},q={...r,...c.queryParameters,...h};if(a.value&&(q["x-algolia-agent"]=a.value),m&&m.queryParameters)for(let P of Object.keys(m.queryParameters))!m.queryParameters[P]||Object.prototype.toString.call(m.queryParameters[P])==="[object Object]"?q[P]=m.queryParameters[P]:q[P]=m.queryParameters[P].toString();let v=0,b=async(P,C)=>{let w=P.pop();if(w===void 0)throw new Y(le(g));let A={...p,...m.timeouts},N={data:E,headers:y,method:c.method,url:te(w,c.path,q),connectTimeout:C(v,A.connect),responseTimeout:C(v,f?A.read:A.write)},U=S=>{let _={request:N,response:S,host:w,triesLeft:P.length};return g.push(_),_},R=await i.send(N);if(ce(R)){let S=U(R);return R.isTimedOut&&v++,console.log("Retryable failure",Q(S)),await e.set(w,H(w,R.isTimedOut?"timed out":"down")),b(P,C)}if(ue(R))return ne(R);throw U(R),ae(R,g)},K=t.filter(P=>P.accept==="readWrite"||(f?P.accept==="read":P.accept==="write")),D=await u(K);return b([...D.hosts].reverse(),D.getTimeout)}function d(c,m={}){let f=c.useReadTransporter||c.method==="GET";if(!f)return l(c,m,f);let g=()=>l(c,m);if((m.cacheable||c.cacheable)!==!0)return g();let y={request:c,requestOptions:m,transporter:{queryParameters:r,headers:o}};return n.get(y,()=>s.get(y,()=>s.set(y,g()).then(h=>Promise.all([s.delete(y),h]),h=>Promise.all([s.delete(y),Promise.reject(h)])).then(([h,q])=>q)),{miss:h=>n.set(y,h)})}return{hostsCache:e,requester:i,timeouts:p,algoliaAgent:a,baseHeaders:o,baseQueryParameters:r,hosts:t,request:d,requestsCache:s,responsesCache:n}}function me(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 j({algoliaAgents:t,client:e,version:o}){let r=me(o).add({segment:e,version:o});return t.forEach(a=>r.add(a)),r}var J=1e3,z=2e3,F=3e4;function B(){function t(e){return new Promise(o=>{let r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach(s=>r.setRequestHeader(s,e.headers[s]));let a=(s,n)=>setTimeout(()=>{r.abort(),o({status:0,content:n,isTimedOut:!0})},s),p=a(e.connectTimeout,"Connection timeout"),i;r.onreadystatechange=()=>{r.readyState>r.OPENED&&i===void 0&&(clearTimeout(p),i=a(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{r.status===0&&(clearTimeout(p),clearTimeout(i),o({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(p),clearTimeout(i),o({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)})}return{send:t}}var x="1.5.3";function de(){return[{url:"status.algolia.com",accept:"readWrite",protocol:"https"}]}function X({appId:t,apiKey:e,authMode:o,algoliaAgents:r,...a}){let p=M(t,e,o),i=$({hosts:de(),...a,algoliaAgent:j({algoliaAgents:r,client:"Monitoring",version:x}),baseHeaders:{"content-type":"text/plain",...p.headers(),...a.baseHeaders},baseQueryParameters:{...p.queryParameters(),...a.baseQueryParameters}});return{transporter:i,appId:t,clearCache(){return Promise.all([i.requestsCache.clear(),i.responsesCache.clear()]).then(()=>{})},get _ua(){return i.algoliaAgent.value},addAlgoliaAgent(s,n){i.algoliaAgent.add({segment:s,version:n})},setClientApiKey({apiKey:s}){!o||o==="WithinHeaders"?i.baseHeaders["x-algolia-api-key"]=s:i.baseQueryParameters["x-algolia-api-key"]=s},customDelete({path:s,parameters:n},u){if(!s)throw new Error("Parameter `path` is required when calling `customDelete`.");let m={method:"DELETE",path:"/{path}".replace("{path}",s),queryParameters:n||{},headers:{}};return i.request(m,u)},customGet({path:s,parameters:n},u){if(!s)throw new Error("Parameter `path` is required when calling `customGet`.");let m={method:"GET",path:"/{path}".replace("{path}",s),queryParameters:n||{},headers:{}};return i.request(m,u)},customPost({path:s,parameters:n,body:u},l){if(!s)throw new Error("Parameter `path` is required when calling `customPost`.");let f={method:"POST",path:"/{path}".replace("{path}",s),queryParameters:n||{},headers:{},data:u||{}};return i.request(f,l)},customPut({path:s,parameters:n,body:u},l){if(!s)throw new Error("Parameter `path` is required when calling `customPut`.");let f={method:"PUT",path:"/{path}".replace("{path}",s),queryParameters:n||{},headers:{},data:u||{}};return i.request(f,l)},getClusterIncidents({clusters:s},n){if(!s)throw new Error("Parameter `clusters` is required when calling `getClusterIncidents`.");let c={method:"GET",path:"/1/incidents/{clusters}".replace("{clusters}",encodeURIComponent(s)),queryParameters:{},headers:{}};return i.request(c,n)},getClusterStatus({clusters:s},n){if(!s)throw new Error("Parameter `clusters` is required when calling `getClusterStatus`.");let c={method:"GET",path:"/1/status/{clusters}".replace("{clusters}",encodeURIComponent(s)),queryParameters:{},headers:{}};return i.request(c,n)},getIncidents(s){let d={method:"GET",path:"/1/incidents",queryParameters:{},headers:{}};return i.request(d,s)},getIndexingTime({clusters:s},n){if(!s)throw new Error("Parameter `clusters` is required when calling `getIndexingTime`.");let c={method:"GET",path:"/1/indexing/{clusters}".replace("{clusters}",encodeURIComponent(s)),queryParameters:{},headers:{}};return i.request(c,n)},getLatency({clusters:s},n){if(!s)throw new Error("Parameter `clusters` is required when calling `getLatency`.");let c={method:"GET",path:"/1/latency/{clusters}".replace("{clusters}",encodeURIComponent(s)),queryParameters:{},headers:{}};return i.request(c,n)},getMetrics({metric:s,period:n},u){if(!s)throw new Error("Parameter `metric` is required when calling `getMetrics`.");if(!n)throw new Error("Parameter `period` is required when calling `getMetrics`.");let m={method:"GET",path:"/1/infrastructure/{metric}/period/{period}".replace("{metric}",encodeURIComponent(s)).replace("{period}",encodeURIComponent(n)),queryParameters:{},headers:{}};return i.request(m,u)},getReachability({clusters:s},n){if(!s)throw new Error("Parameter `clusters` is required when calling `getReachability`.");let c={method:"GET",path:"/1/reachability/{clusters}/probes".replace("{clusters}",encodeURIComponent(s)),queryParameters:{},headers:{}};return i.request(c,n)},getServers(s){let d={method:"GET",path:"/1/inventory/servers",queryParameters:{},headers:{}};return i.request(d,s)},getStatus(s){let d={method:"GET",path:"/1/status",queryParameters:{},headers:{}};return i.request(d,s)}}}function Ve(t,e,o){if(!t||typeof t!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");return X({appId:t,apiKey:e,timeouts:{connect:J,read:z,write:F},requester:B(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:O(),requestsCache:O({serializable:!1}),hostsCache:T({caches:[L({key:`${x}-${t}`}),O()]}),...o})}export{x as apiClientVersion,Ve as monitoringClient};
//# sourceMappingURL=browser.min.js.map

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

function M(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 L(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 p(s){r().setItem(o,JSON.stringify(s));}function i(){let s=t.timeToLive?t.timeToLive*1e3:null,n=a(),u=Object.fromEntries(Object.entries(n).filter(([,d])=>d.timestamp!==void 0));if(p(u),!s)return;let l=Object.fromEntries(Object.entries(u).filter(([,d])=>{let c=new Date().getTime();return !(d.timestamp+s<c)}));p(l);}return {get(s,n,u={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(i(),a()[JSON.stringify(s)])).then(l=>Promise.all([l?l.value:n(),l!==void 0])).then(([l,d])=>Promise.all([l,d||u.miss(l)])).then(([l])=>l)},set(s,n){return Promise.resolve().then(()=>{let u=a();return u[JSON.stringify(s)]={timestamp:new Date().getTime(),value:n},r().setItem(o,JSON.stringify(u)),n})},delete(s){return Promise.resolve().then(()=>{let n=a();delete n[JSON.stringify(s)],r().setItem(o,JSON.stringify(n));})},clear(){return Promise.resolve().then(()=>{r().removeItem(o);})}}}function V(){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 T(t){let e=[...t.caches],o=e.shift();return o===void 0?V():{get(r,a,p={miss:()=>Promise.resolve()}){return o.get(r,a,p).catch(()=>T({caches:e}).get(r,a,p))},set(r,a){return o.set(r,a).catch(()=>T({caches:e}).set(r,a))},delete(r){return o.delete(r).catch(()=>T({caches:e}).delete(r))},clear(){return o.clear().catch(()=>T({caches:e}).clear())}}}function O(t={serializable:!0}){let e={};return {get(o,r,a={miss:()=>Promise.resolve()}){let p=JSON.stringify(o);if(p in e)return Promise.resolve(t.serializable?JSON.parse(e[p]):e[p]);let i=r();return i.then(s=>a.miss(s)).then(()=>i)},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 G=2*60*1e3;function H(t,e="up"){let o=Date.now();function r(){return e==="up"||Date.now()-o>G}function a(){return e==="timed out"&&Date.now()-o<=G}return {...t,status:e,lastUpdate:o,isUp:r,isTimedOut:a}}var k=class extends Error{name="AlgoliaError";constructor(t,e){super(t),e&&(this.name=e);}},W=class extends k{stackTrace;constructor(t,e,o){super(t,o),this.stackTrace=e;}},Y=class extends W{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");}},I=class extends W{status;constructor(t,e,o,r="ApiError"){super(t,o,r),this.status=e;}},Z=class extends k{response;constructor(t,e){super(t,"DeserializationError"),this.response=e;}},ee=class extends I{error;constructor(t,e,o,r){super(t,e,r,"DetailedApiError"),this.error=o;}};function te(t,e,o){let r=re(o),a=`${t.protocol}://${t.url}${t.port?`:${t.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return r.length&&(a+=`?${r}`),a}function re(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 oe(t,e,o){let r={Accept:"application/json",...t,...e,...o},a={};return Object.keys(r).forEach(p=>{let i=r[p];a[p.toLowerCase()]=i;}),a}function ne(t){try{return JSON.parse(t.content)}catch(e){throw new Z(e.message,t)}}function ae({content:t,status:e},o){try{let r=JSON.parse(t);return "error"in r?new ee(r.message,e,r.error,o):new I(r.message,e,o)}catch{}return new I(t,e,o)}function ie({isTimedOut:t,status:e}){return !t&&~~e===0}function ce({isTimedOut:t,status:e}){return t||ie({isTimedOut:t,status:e})||~~(e/100)!==2&&~~(e/100)!==4}function ue({status:t}){return ~~(t/100)===2}function le(t){return t.map(e=>Q(e))}function Q(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 $({hosts:t,hostsCache:e,baseHeaders:o,baseQueryParameters:r,algoliaAgent:a,timeouts:p,requester:i,requestsCache:s,responsesCache:n}){async function u(c){let m=await Promise.all(c.map(h=>e.get(h,()=>Promise.resolve(H(h))))),f=m.filter(h=>h.isUp()),g=m.filter(h=>h.isTimedOut()),E=[...f,...g];return {hosts:E.length>0?E:c,getTimeout(h,q){return (g.length===0&&h===0?1:g.length+3+h)*q}}}async function l(c,m,f=!0){let g=[],E=se(c,m),y=oe(o,c.headers,m.headers),h=c.method==="GET"?{...c.data,...m.data}:{},q={...r,...c.queryParameters,...h};if(a.value&&(q["x-algolia-agent"]=a.value),m&&m.queryParameters)for(let P of Object.keys(m.queryParameters))!m.queryParameters[P]||Object.prototype.toString.call(m.queryParameters[P])==="[object Object]"?q[P]=m.queryParameters[P]:q[P]=m.queryParameters[P].toString();let v=0,b=async(P,C)=>{let w=P.pop();if(w===void 0)throw new Y(le(g));let A={...p,...m.timeouts},N={data:E,headers:y,method:c.method,url:te(w,c.path,q),connectTimeout:C(v,A.connect),responseTimeout:C(v,f?A.read:A.write)},U=S=>{let _={request:N,response:S,host:w,triesLeft:P.length};return g.push(_),_},R=await i.send(N);if(ce(R)){let S=U(R);return R.isTimedOut&&v++,console.log("Retryable failure",Q(S)),await e.set(w,H(w,R.isTimedOut?"timed out":"down")),b(P,C)}if(ue(R))return ne(R);throw U(R),ae(R,g)},K=t.filter(P=>P.accept==="readWrite"||(f?P.accept==="read":P.accept==="write")),D=await u(K);return b([...D.hosts].reverse(),D.getTimeout)}function d(c,m={}){let f=c.useReadTransporter||c.method==="GET";if(!f)return l(c,m,f);let g=()=>l(c,m);if((m.cacheable||c.cacheable)!==!0)return g();let y={request:c,requestOptions:m,transporter:{queryParameters:r,headers:o}};return n.get(y,()=>s.get(y,()=>s.set(y,g()).then(h=>Promise.all([s.delete(y),h]),h=>Promise.all([s.delete(y),Promise.reject(h)])).then(([h,q])=>q)),{miss:h=>n.set(y,h)})}return {hostsCache:e,requester:i,timeouts:p,algoliaAgent:a,baseHeaders:o,baseQueryParameters:r,hosts:t,request:d,requestsCache:s,responsesCache:n}}function me(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 j({algoliaAgents:t,client:e,version:o}){let r=me(o).add({segment:e,version:o});return t.forEach(a=>r.add(a)),r}var J=1e3,z=2e3,F=3e4;function B(){function t(e){return new Promise(o=>{let r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach(s=>r.setRequestHeader(s,e.headers[s]));let a=(s,n)=>setTimeout(()=>{r.abort(),o({status:0,content:n,isTimedOut:!0});},s),p=a(e.connectTimeout,"Connection timeout"),i;r.onreadystatechange=()=>{r.readyState>r.OPENED&&i===void 0&&(clearTimeout(p),i=a(e.responseTimeout,"Socket timeout"));},r.onerror=()=>{r.status===0&&(clearTimeout(p),clearTimeout(i),o({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}));},r.onload=()=>{clearTimeout(p),clearTimeout(i),o({content:r.responseText,status:r.status,isTimedOut:!1});},r.send(e.data);})}return {send:t}}var x="1.5.2";function de(){return [{url:"status.algolia.com",accept:"readWrite",protocol:"https"}]}function X({appId:t,apiKey:e,authMode:o,algoliaAgents:r,...a}){let p=M(t,e,o),i=$({hosts:de(),...a,algoliaAgent:j({algoliaAgents:r,client:"Monitoring",version:x}),baseHeaders:{"content-type":"text/plain",...p.headers(),...a.baseHeaders},baseQueryParameters:{...p.queryParameters(),...a.baseQueryParameters}});return {transporter:i,appId:t,clearCache(){return Promise.all([i.requestsCache.clear(),i.responsesCache.clear()]).then(()=>{})},get _ua(){return i.algoliaAgent.value},addAlgoliaAgent(s,n){i.algoliaAgent.add({segment:s,version:n});},setClientApiKey({apiKey:s}){!o||o==="WithinHeaders"?i.baseHeaders["x-algolia-api-key"]=s:i.baseQueryParameters["x-algolia-api-key"]=s;},customDelete({path:s,parameters:n},u){if(!s)throw new Error("Parameter `path` is required when calling `customDelete`.");let m={method:"DELETE",path:"/{path}".replace("{path}",s),queryParameters:n||{},headers:{}};return i.request(m,u)},customGet({path:s,parameters:n},u){if(!s)throw new Error("Parameter `path` is required when calling `customGet`.");let m={method:"GET",path:"/{path}".replace("{path}",s),queryParameters:n||{},headers:{}};return i.request(m,u)},customPost({path:s,parameters:n,body:u},l){if(!s)throw new Error("Parameter `path` is required when calling `customPost`.");let f={method:"POST",path:"/{path}".replace("{path}",s),queryParameters:n||{},headers:{},data:u||{}};return i.request(f,l)},customPut({path:s,parameters:n,body:u},l){if(!s)throw new Error("Parameter `path` is required when calling `customPut`.");let f={method:"PUT",path:"/{path}".replace("{path}",s),queryParameters:n||{},headers:{},data:u||{}};return i.request(f,l)},getClusterIncidents({clusters:s},n){if(!s)throw new Error("Parameter `clusters` is required when calling `getClusterIncidents`.");let c={method:"GET",path:"/1/incidents/{clusters}".replace("{clusters}",encodeURIComponent(s)),queryParameters:{},headers:{}};return i.request(c,n)},getClusterStatus({clusters:s},n){if(!s)throw new Error("Parameter `clusters` is required when calling `getClusterStatus`.");let c={method:"GET",path:"/1/status/{clusters}".replace("{clusters}",encodeURIComponent(s)),queryParameters:{},headers:{}};return i.request(c,n)},getIncidents(s){let d={method:"GET",path:"/1/incidents",queryParameters:{},headers:{}};return i.request(d,s)},getIndexingTime({clusters:s},n){if(!s)throw new Error("Parameter `clusters` is required when calling `getIndexingTime`.");let c={method:"GET",path:"/1/indexing/{clusters}".replace("{clusters}",encodeURIComponent(s)),queryParameters:{},headers:{}};return i.request(c,n)},getLatency({clusters:s},n){if(!s)throw new Error("Parameter `clusters` is required when calling `getLatency`.");let c={method:"GET",path:"/1/latency/{clusters}".replace("{clusters}",encodeURIComponent(s)),queryParameters:{},headers:{}};return i.request(c,n)},getMetrics({metric:s,period:n},u){if(!s)throw new Error("Parameter `metric` is required when calling `getMetrics`.");if(!n)throw new Error("Parameter `period` is required when calling `getMetrics`.");let m={method:"GET",path:"/1/infrastructure/{metric}/period/{period}".replace("{metric}",encodeURIComponent(s)).replace("{period}",encodeURIComponent(n)),queryParameters:{},headers:{}};return i.request(m,u)},getReachability({clusters:s},n){if(!s)throw new Error("Parameter `clusters` is required when calling `getReachability`.");let c={method:"GET",path:"/1/reachability/{clusters}/probes".replace("{clusters}",encodeURIComponent(s)),queryParameters:{},headers:{}};return i.request(c,n)},getServers(s){let d={method:"GET",path:"/1/inventory/servers",queryParameters:{},headers:{}};return i.request(d,s)},getStatus(s){let d={method:"GET",path:"/1/status",queryParameters:{},headers:{}};return i.request(d,s)}}}function Ve(t,e,o){if(!t||typeof t!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");return X({appId:t,apiKey:e,timeouts:{connect:J,read:z,write:F},requester:B(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:O(),requestsCache:O({serializable:!1}),hostsCache:T({caches:[L({key:`${x}-${t}`}),O()]}),...o})}
function M(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 L(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 p(s){r().setItem(o,JSON.stringify(s));}function i(){let s=t.timeToLive?t.timeToLive*1e3:null,n=a(),u=Object.fromEntries(Object.entries(n).filter(([,d])=>d.timestamp!==void 0));if(p(u),!s)return;let l=Object.fromEntries(Object.entries(u).filter(([,d])=>{let c=new Date().getTime();return !(d.timestamp+s<c)}));p(l);}return {get(s,n,u={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(i(),a()[JSON.stringify(s)])).then(l=>Promise.all([l?l.value:n(),l!==void 0])).then(([l,d])=>Promise.all([l,d||u.miss(l)])).then(([l])=>l)},set(s,n){return Promise.resolve().then(()=>{let u=a();return u[JSON.stringify(s)]={timestamp:new Date().getTime(),value:n},r().setItem(o,JSON.stringify(u)),n})},delete(s){return Promise.resolve().then(()=>{let n=a();delete n[JSON.stringify(s)],r().setItem(o,JSON.stringify(n));})},clear(){return Promise.resolve().then(()=>{r().removeItem(o);})}}}function V(){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 T(t){let e=[...t.caches],o=e.shift();return o===void 0?V():{get(r,a,p={miss:()=>Promise.resolve()}){return o.get(r,a,p).catch(()=>T({caches:e}).get(r,a,p))},set(r,a){return o.set(r,a).catch(()=>T({caches:e}).set(r,a))},delete(r){return o.delete(r).catch(()=>T({caches:e}).delete(r))},clear(){return o.clear().catch(()=>T({caches:e}).clear())}}}function O(t={serializable:!0}){let e={};return {get(o,r,a={miss:()=>Promise.resolve()}){let p=JSON.stringify(o);if(p in e)return Promise.resolve(t.serializable?JSON.parse(e[p]):e[p]);let i=r();return i.then(s=>a.miss(s)).then(()=>i)},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 G=2*60*1e3;function H(t,e="up"){let o=Date.now();function r(){return e==="up"||Date.now()-o>G}function a(){return e==="timed out"&&Date.now()-o<=G}return {...t,status:e,lastUpdate:o,isUp:r,isTimedOut:a}}var k=class extends Error{name="AlgoliaError";constructor(t,e){super(t),e&&(this.name=e);}},W=class extends k{stackTrace;constructor(t,e,o){super(t,o),this.stackTrace=e;}},Y=class extends W{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");}},I=class extends W{status;constructor(t,e,o,r="ApiError"){super(t,o,r),this.status=e;}},Z=class extends k{response;constructor(t,e){super(t,"DeserializationError"),this.response=e;}},ee=class extends I{error;constructor(t,e,o,r){super(t,e,r,"DetailedApiError"),this.error=o;}};function te(t,e,o){let r=re(o),a=`${t.protocol}://${t.url}${t.port?`:${t.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return r.length&&(a+=`?${r}`),a}function re(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 oe(t,e,o){let r={Accept:"application/json",...t,...e,...o},a={};return Object.keys(r).forEach(p=>{let i=r[p];a[p.toLowerCase()]=i;}),a}function ne(t){try{return JSON.parse(t.content)}catch(e){throw new Z(e.message,t)}}function ae({content:t,status:e},o){try{let r=JSON.parse(t);return "error"in r?new ee(r.message,e,r.error,o):new I(r.message,e,o)}catch{}return new I(t,e,o)}function ie({isTimedOut:t,status:e}){return !t&&~~e===0}function ce({isTimedOut:t,status:e}){return t||ie({isTimedOut:t,status:e})||~~(e/100)!==2&&~~(e/100)!==4}function ue({status:t}){return ~~(t/100)===2}function le(t){return t.map(e=>Q(e))}function Q(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 $({hosts:t,hostsCache:e,baseHeaders:o,baseQueryParameters:r,algoliaAgent:a,timeouts:p,requester:i,requestsCache:s,responsesCache:n}){async function u(c){let m=await Promise.all(c.map(h=>e.get(h,()=>Promise.resolve(H(h))))),f=m.filter(h=>h.isUp()),g=m.filter(h=>h.isTimedOut()),E=[...f,...g];return {hosts:E.length>0?E:c,getTimeout(h,q){return (g.length===0&&h===0?1:g.length+3+h)*q}}}async function l(c,m,f=!0){let g=[],E=se(c,m),y=oe(o,c.headers,m.headers),h=c.method==="GET"?{...c.data,...m.data}:{},q={...r,...c.queryParameters,...h};if(a.value&&(q["x-algolia-agent"]=a.value),m&&m.queryParameters)for(let P of Object.keys(m.queryParameters))!m.queryParameters[P]||Object.prototype.toString.call(m.queryParameters[P])==="[object Object]"?q[P]=m.queryParameters[P]:q[P]=m.queryParameters[P].toString();let v=0,b=async(P,C)=>{let w=P.pop();if(w===void 0)throw new Y(le(g));let A={...p,...m.timeouts},N={data:E,headers:y,method:c.method,url:te(w,c.path,q),connectTimeout:C(v,A.connect),responseTimeout:C(v,f?A.read:A.write)},U=S=>{let _={request:N,response:S,host:w,triesLeft:P.length};return g.push(_),_},R=await i.send(N);if(ce(R)){let S=U(R);return R.isTimedOut&&v++,console.log("Retryable failure",Q(S)),await e.set(w,H(w,R.isTimedOut?"timed out":"down")),b(P,C)}if(ue(R))return ne(R);throw U(R),ae(R,g)},K=t.filter(P=>P.accept==="readWrite"||(f?P.accept==="read":P.accept==="write")),D=await u(K);return b([...D.hosts].reverse(),D.getTimeout)}function d(c,m={}){let f=c.useReadTransporter||c.method==="GET";if(!f)return l(c,m,f);let g=()=>l(c,m);if((m.cacheable||c.cacheable)!==!0)return g();let y={request:c,requestOptions:m,transporter:{queryParameters:r,headers:o}};return n.get(y,()=>s.get(y,()=>s.set(y,g()).then(h=>Promise.all([s.delete(y),h]),h=>Promise.all([s.delete(y),Promise.reject(h)])).then(([h,q])=>q)),{miss:h=>n.set(y,h)})}return {hostsCache:e,requester:i,timeouts:p,algoliaAgent:a,baseHeaders:o,baseQueryParameters:r,hosts:t,request:d,requestsCache:s,responsesCache:n}}function me(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 j({algoliaAgents:t,client:e,version:o}){let r=me(o).add({segment:e,version:o});return t.forEach(a=>r.add(a)),r}var J=1e3,z=2e3,F=3e4;function B(){function t(e){return new Promise(o=>{let r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach(s=>r.setRequestHeader(s,e.headers[s]));let a=(s,n)=>setTimeout(()=>{r.abort(),o({status:0,content:n,isTimedOut:!0});},s),p=a(e.connectTimeout,"Connection timeout"),i;r.onreadystatechange=()=>{r.readyState>r.OPENED&&i===void 0&&(clearTimeout(p),i=a(e.responseTimeout,"Socket timeout"));},r.onerror=()=>{r.status===0&&(clearTimeout(p),clearTimeout(i),o({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}));},r.onload=()=>{clearTimeout(p),clearTimeout(i),o({content:r.responseText,status:r.status,isTimedOut:!1});},r.send(e.data);})}return {send:t}}var x="1.5.3";function de(){return [{url:"status.algolia.com",accept:"readWrite",protocol:"https"}]}function X({appId:t,apiKey:e,authMode:o,algoliaAgents:r,...a}){let p=M(t,e,o),i=$({hosts:de(),...a,algoliaAgent:j({algoliaAgents:r,client:"Monitoring",version:x}),baseHeaders:{"content-type":"text/plain",...p.headers(),...a.baseHeaders},baseQueryParameters:{...p.queryParameters(),...a.baseQueryParameters}});return {transporter:i,appId:t,clearCache(){return Promise.all([i.requestsCache.clear(),i.responsesCache.clear()]).then(()=>{})},get _ua(){return i.algoliaAgent.value},addAlgoliaAgent(s,n){i.algoliaAgent.add({segment:s,version:n});},setClientApiKey({apiKey:s}){!o||o==="WithinHeaders"?i.baseHeaders["x-algolia-api-key"]=s:i.baseQueryParameters["x-algolia-api-key"]=s;},customDelete({path:s,parameters:n},u){if(!s)throw new Error("Parameter `path` is required when calling `customDelete`.");let m={method:"DELETE",path:"/{path}".replace("{path}",s),queryParameters:n||{},headers:{}};return i.request(m,u)},customGet({path:s,parameters:n},u){if(!s)throw new Error("Parameter `path` is required when calling `customGet`.");let m={method:"GET",path:"/{path}".replace("{path}",s),queryParameters:n||{},headers:{}};return i.request(m,u)},customPost({path:s,parameters:n,body:u},l){if(!s)throw new Error("Parameter `path` is required when calling `customPost`.");let f={method:"POST",path:"/{path}".replace("{path}",s),queryParameters:n||{},headers:{},data:u||{}};return i.request(f,l)},customPut({path:s,parameters:n,body:u},l){if(!s)throw new Error("Parameter `path` is required when calling `customPut`.");let f={method:"PUT",path:"/{path}".replace("{path}",s),queryParameters:n||{},headers:{},data:u||{}};return i.request(f,l)},getClusterIncidents({clusters:s},n){if(!s)throw new Error("Parameter `clusters` is required when calling `getClusterIncidents`.");let c={method:"GET",path:"/1/incidents/{clusters}".replace("{clusters}",encodeURIComponent(s)),queryParameters:{},headers:{}};return i.request(c,n)},getClusterStatus({clusters:s},n){if(!s)throw new Error("Parameter `clusters` is required when calling `getClusterStatus`.");let c={method:"GET",path:"/1/status/{clusters}".replace("{clusters}",encodeURIComponent(s)),queryParameters:{},headers:{}};return i.request(c,n)},getIncidents(s){let d={method:"GET",path:"/1/incidents",queryParameters:{},headers:{}};return i.request(d,s)},getIndexingTime({clusters:s},n){if(!s)throw new Error("Parameter `clusters` is required when calling `getIndexingTime`.");let c={method:"GET",path:"/1/indexing/{clusters}".replace("{clusters}",encodeURIComponent(s)),queryParameters:{},headers:{}};return i.request(c,n)},getLatency({clusters:s},n){if(!s)throw new Error("Parameter `clusters` is required when calling `getLatency`.");let c={method:"GET",path:"/1/latency/{clusters}".replace("{clusters}",encodeURIComponent(s)),queryParameters:{},headers:{}};return i.request(c,n)},getMetrics({metric:s,period:n},u){if(!s)throw new Error("Parameter `metric` is required when calling `getMetrics`.");if(!n)throw new Error("Parameter `period` is required when calling `getMetrics`.");let m={method:"GET",path:"/1/infrastructure/{metric}/period/{period}".replace("{metric}",encodeURIComponent(s)).replace("{period}",encodeURIComponent(n)),queryParameters:{},headers:{}};return i.request(m,u)},getReachability({clusters:s},n){if(!s)throw new Error("Parameter `clusters` is required when calling `getReachability`.");let c={method:"GET",path:"/1/reachability/{clusters}/probes".replace("{clusters}",encodeURIComponent(s)),queryParameters:{},headers:{}};return i.request(c,n)},getServers(s){let d={method:"GET",path:"/1/inventory/servers",queryParameters:{},headers:{}};return i.request(d,s)},getStatus(s){let d={method:"GET",path:"/1/status",queryParameters:{},headers:{}};return i.request(d,s)}}}function Ve(t,e,o){if(!t||typeof t!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");return X({appId:t,apiKey:e,timeouts:{connect:J,read:z,write:F},requester:B(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:O(),requestsCache:O({serializable:!1}),hostsCache:T({caches:[L({key:`${x}-${t}`}),O()]}),...o})}

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

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

import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
var apiClientVersion = "1.5.2";
var apiClientVersion = "1.5.3";
function getDefaultHosts() {

@@ -16,0 +16,0 @@ return [{ url: "status.algolia.com", accept: "readWrite", protocol: "https" }];

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

import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
var apiClientVersion = "1.5.2";
var apiClientVersion = "1.5.3";
function getDefaultHosts() {

@@ -16,0 +16,0 @@ return [{ url: "status.algolia.com", accept: "readWrite", protocol: "https" }];

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

declare const apiClientVersion = "1.5.2";
declare const apiClientVersion = "1.5.3";
declare function createMonitoringClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, ...options }: CreateClientOptions): {

@@ -262,0 +262,0 @@ transporter: _algolia_client_common.Transporter;

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

declare const apiClientVersion = "1.5.2";
declare const apiClientVersion = "1.5.3";
declare function createMonitoringClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, ...options }: CreateClientOptions): {

@@ -262,0 +262,0 @@ transporter: _algolia_client_common.Transporter;

// src/monitoringClient.ts
import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
var apiClientVersion = "1.5.2";
var apiClientVersion = "1.5.3";
function getDefaultHosts() {

@@ -5,0 +5,0 @@ return [{ url: "status.algolia.com", accept: "readWrite", protocol: "https" }];

{
"version": "1.5.2",
"version": "1.5.3",
"repository": {

@@ -52,6 +52,6 @@ "type": "git",

"dependencies": {
"@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"
"@algolia/client-common": "5.5.3",
"@algolia/requester-browser-xhr": "5.5.3",
"@algolia/requester-fetch": "5.5.3",
"@algolia/requester-node-http": "5.5.3"
},

@@ -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

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