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

@algolia/monitoring

Package Overview
Dependencies
Maintainers
85
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.8.1 to 1.9.0

2

dist/browser.d.ts

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

{
"version": "1.8.1",
"version": "1.9.0",
"repository": {

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

"dependencies": {
"@algolia/client-common": "5.8.1",
"@algolia/requester-browser-xhr": "5.8.1",
"@algolia/requester-fetch": "5.8.1",
"@algolia/requester-node-http": "5.8.1"
"@algolia/client-common": "5.9.0",
"@algolia/requester-browser-xhr": "5.9.0",
"@algolia/requester-fetch": "5.9.0",
"@algolia/requester-node-http": "5.9.0"
},
"devDependencies": {
"@arethetypeswrong/cli": "0.16.4",
"@types/node": "22.7.4",
"@types/node": "22.7.5",
"publint": "0.2.11",
"rollup": "4.24.0",
"tsup": "8.3.0",
"typescript": "5.6.2"
"typescript": "5.6.3"
},

@@ -66,0 +66,0 @@ "engines": {

@@ -35,2 +35,5 @@ <p align="center">

> [!TIP]
> This API client is already a dependency of [the algoliasearch client](https://www.npmjs.com/package/algoliasearch), you don't need to manually install `@algolia/monitoring` if you already have `algoliasearch` installed.
To get started, you first need to install @algolia/monitoring (or any other available API client package).

@@ -42,7 +45,7 @@ All of our clients comes with type definition, and are available for both browser and node environments.

```bash
yarn add @algolia/monitoring@1.8.1
yarn add @algolia/monitoring@1.9.0
# or
npm install @algolia/monitoring@1.8.1
npm install @algolia/monitoring@1.9.0
# or
pnpm add @algolia/monitoring@1.8.1
pnpm add @algolia/monitoring@1.9.0
```

@@ -55,3 +58,3 @@

```html
<script src="https://cdn.jsdelivr.net/npm/@algolia/monitoring@1.8.1/dist/builds/browser.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@algolia/monitoring@1.9.0/dist/builds/browser.umd.js"></script>
```

@@ -58,0 +61,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc