@algolia/monitoring
Advanced tools
Comparing version 1.17.1 to 1.18.0
@@ -285,3 +285,3 @@ import * as _algolia_client_common from '@algolia/client-common'; | ||
declare const apiClientVersion = "1.17.1"; | ||
declare const apiClientVersion = "1.18.0"; | ||
declare function createMonitoringClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, ...options }: CreateClientOptions): { | ||
@@ -288,0 +288,0 @@ transporter: _algolia_client_common.Transporter; |
@@ -12,3 +12,3 @@ // builds/browser.ts | ||
import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common"; | ||
var apiClientVersion = "1.17.1"; | ||
var apiClientVersion = "1.18.0"; | ||
function getDefaultHosts() { | ||
@@ -15,0 +15,0 @@ return [{ url: "status.algolia.com", accept: "readWrite", protocol: "https" }]; |
@@ -1,2 +0,2 @@ | ||
function U(){function t(e){return new Promise(s=>{let r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach(o=>r.setRequestHeader(o,e.headers[o]));let n=(o,a)=>setTimeout(()=>{r.abort(),s({status:0,content:a,isTimedOut:!0})},o),d=n(e.connectTimeout,"Connection timeout"),i;r.onreadystatechange=()=>{r.readyState>r.OPENED&&i===void 0&&(clearTimeout(d),i=n(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{r.status===0&&(clearTimeout(d),clearTimeout(i),s({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(d),clearTimeout(i),s({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)})}return{send:t}}function M(t){let e,s=`algolia-client-js-${t.key}`;function r(){return e===void 0&&(e=t.localStorage||window.localStorage),e}function n(){return JSON.parse(r().getItem(s)||"{}")}function d(o){r().setItem(s,JSON.stringify(o))}function i(){let o=t.timeToLive?t.timeToLive*1e3:null,a=n(),c=Object.fromEntries(Object.entries(a).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,a,c={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(i(),n()[JSON.stringify(o)])).then(u=>Promise.all([u?u.value:a(),u!==void 0])).then(([u,m])=>Promise.all([u,m||c.miss(u)])).then(([u])=>u)},set(o,a){return Promise.resolve().then(()=>{let c=n();return c[JSON.stringify(o)]={timestamp:new Date().getTime(),value:a},r().setItem(s,JSON.stringify(c)),a})},delete(o){return Promise.resolve().then(()=>{let a=n();delete a[JSON.stringify(o)],r().setItem(s,JSON.stringify(a))})},clear(){return Promise.resolve().then(()=>{r().removeItem(s)})}}}function K(){return{get(t,e,s={miss:()=>Promise.resolve()}){return e().then(n=>Promise.all([n,s.miss(n)])).then(([n])=>n)},set(t,e){return Promise.resolve(e)},delete(t){return Promise.resolve()},clear(){return Promise.resolve()}}}function E(t){let e=[...t.caches],s=e.shift();return s===void 0?K():{get(r,n,d={miss:()=>Promise.resolve()}){return s.get(r,n,d).catch(()=>E({caches:e}).get(r,n,d))},set(r,n){return s.set(r,n).catch(()=>E({caches:e}).set(r,n))},delete(r){return s.delete(r).catch(()=>E({caches:e}).delete(r))},clear(){return s.clear().catch(()=>E({caches:e}).clear())}}}function O(t={serializable:!0}){let e={};return{get(s,r,n={miss:()=>Promise.resolve()}){let d=JSON.stringify(s);if(d in e)return Promise.resolve(t.serializable?JSON.parse(e[d]):e[d]);let i=r();return i.then(o=>n.miss(o)).then(()=>i)},set(s,r){return e[JSON.stringify(s)]=t.serializable?JSON.stringify(r):r,Promise.resolve(r)},delete(s){return delete e[JSON.stringify(s)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}function V(t){let e={value:`Algolia for JavaScript (${t})`,add(s){let r=`; ${s.segment}${s.version!==void 0?` (${s.version})`:""}`;return e.value.indexOf(r)===-1&&(e.value=`${e.value}${r}`),e}};return e}function Q(t,e,s="WithinHeaders"){let r={"x-algolia-api-key":e,"x-algolia-application-id":t};return{headers(){return s==="WithinHeaders"?r:{}},queryParameters(){return s==="WithinQueryParameters"?r:{}}}}function W({algoliaAgents:t,client:e,version:s}){let r=V(s).add({segment:e,version:s});return t.forEach(n=>r.add(n)),r}function $(){return{debug(t,e){return Promise.resolve()},info(t,e){return Promise.resolve()},error(t,e){return Promise.resolve()}}}var k=2*60*1e3;function L(t,e="up"){let s=Date.now();function r(){return e==="up"||Date.now()-s>k}function n(){return e==="timed out"&&Date.now()-s<=k}return{...t,status:e,lastUpdate:s,isUp:r,isTimedOut:n}}var j=class extends Error{name="AlgoliaError";constructor(t,e){super(t),e&&(this.name=e)}},J=class extends j{stackTrace;constructor(t,e,s){super(t,s),this.stackTrace=e}},Y=class extends J{constructor(t){super("Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support.",t,"RetryError")}},I=class extends J{status;constructor(t,e,s,r="ApiError"){super(t,s,r),this.status=e}},Z=class extends j{response;constructor(t,e){super(t,"DeserializationError"),this.response=e}},ee=class extends I{error;constructor(t,e,s,r){super(t,e,r,"DetailedApiError"),this.error=s}};function te(t,e,s){let r=re(s),n=`${t.protocol}://${t.url}${t.port?`:${t.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return r.length&&(n+=`?${r}`),n}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]).replace(/\+/g,"%20")}`).join("&")}function se(t,e){if(t.method==="GET"||t.data===void 0&&e.data===void 0)return;let s=Array.isArray(t.data)?t.data:{...t.data,...e.data};return JSON.stringify(s)}function oe(t,e,s){let r={Accept:"application/json",...t,...e,...s},n={};return Object.keys(r).forEach(d=>{let i=r[d];n[d.toLowerCase()]=i}),n}function ae(t){try{return JSON.parse(t.content)}catch(e){throw new Z(e.message,t)}}function ne({content:t,status:e},s){try{let r=JSON.parse(t);return"error"in r?new ee(r.message,e,r.error,s):new I(r.message,e,s)}catch{}return new I(t,e,s)}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=>z(e))}function z(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 F({hosts:t,hostsCache:e,baseHeaders:s,logger:r,baseQueryParameters:n,algoliaAgent:d,timeouts:i,requester:o,requestsCache:a,responsesCache:c}){async function u(l){let p=await Promise.all(l.map(P=>e.get(P,()=>Promise.resolve(L(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=se(l,p),y=oe(s,l.headers,p.headers),P=l.method==="GET"?{...l.data,...p.data}:{},q={...n,...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 x=0,N=async(f,b)=>{let v=f.pop();if(v===void 0)throw new Y(le(g));let A={...i,...p.timeouts},_={data:w,headers:y,method:l.method,url:te(v,l.path,q),connectTimeout:b(x,A.connect),responseTimeout:b(x,T?A.read:A.write)},G=S=>{let H={request:_,response:S,host:v,triesLeft:f.length};return g.push(H),H},R=await o.send(_);if(ce(R)){let S=G(R);return R.isTimedOut&&x++,r.info("Retryable failure",z(S)),await e.set(v,L(v,R.isTimedOut?"timed out":"down")),N(f,b)}if(ue(R))return ae(R);throw G(R),ne(R,g)},X=t.filter(f=>f.accept==="readWrite"||(T?f.accept==="read":f.accept==="write")),D=await u(X);return N([...D.hosts].reverse(),D.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:n,headers:s}};return c.get(y,()=>a.get(y,()=>a.set(y,g()).then(P=>Promise.all([a.delete(y),P]),P=>Promise.all([a.delete(y),Promise.reject(P)])).then(([P,q])=>q)),{miss:P=>c.set(y,P)})}return{hostsCache:e,requester:o,timeouts:i,logger:r,algoliaAgent:d,baseHeaders:s,baseQueryParameters:n,hosts:t,request:h,requestsCache:a,responsesCache:c}}var C="1.17.1";function me(){return[{url:"status.algolia.com",accept:"readWrite",protocol:"https"}]}function B({appId:t,apiKey:e,authMode:s,algoliaAgents:r,...n}){let d=Q(t,e,s),i=F({hosts:me(),...n,algoliaAgent:W({algoliaAgents:r,client:"Monitoring",version:C}),baseHeaders:{"content-type":"text/plain",...d.headers(),...n.baseHeaders},baseQueryParameters:{...d.queryParameters(),...n.baseQueryParameters}});return{transporter:i,appId:t,clearCache(){return Promise.all([i.requestsCache.clear(),i.responsesCache.clear()]).then(()=>{})},get _ua(){return i.algoliaAgent.value},addAlgoliaAgent(o,a){i.algoliaAgent.add({segment:o,version:a})},setClientApiKey({apiKey:o}){!s||s==="WithinHeaders"?i.baseHeaders["x-algolia-api-key"]=o:i.baseQueryParameters["x-algolia-api-key"]=o},customDelete({path:o,parameters:a},c){if(!o)throw new Error("Parameter `path` is required when calling `customDelete`.");let l={method:"DELETE",path:"/{path}".replace("{path}",o),queryParameters:a||{},headers:{}};return i.request(l,c)},customGet({path:o,parameters:a},c){if(!o)throw new Error("Parameter `path` is required when calling `customGet`.");let l={method:"GET",path:"/{path}".replace("{path}",o),queryParameters:a||{},headers:{}};return i.request(l,c)},customPost({path:o,parameters:a,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:a||{},headers:{},data:c||{}};return i.request(p,u)},customPut({path:o,parameters:a,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:a||{},headers:{},data:c||{}};return i.request(p,u)},getClusterIncidents({clusters:o},a){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,a)},getClusterStatus({clusters:o},a){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,a)},getIncidents(o){let m={method:"GET",path:"/1/incidents",queryParameters:{},headers:{}};return i.request(m,o)},getIndexingTime({clusters:o},a){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,a)},getLatency({clusters:o},a){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,a)},getMetrics({metric:o,period:a},c){if(!o)throw new Error("Parameter `metric` is required when calling `getMetrics`.");if(!a)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(a)),queryParameters:{},headers:{}};return i.request(l,c)},getReachability({clusters:o},a){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,a)},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 Ke(t,e,s){if(!t||typeof t!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");return B({appId:t,apiKey:e,timeouts:{connect:1e3,read:2e3,write:3e4},logger:$(),requester:U(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:O(),requestsCache:O({serializable:!1}),hostsCache:E({caches:[M({key:`${C}-${t}`}),O()]}),...s})}export{C as apiClientVersion,Ke as monitoringClient}; | ||
function U(){function t(e){return new Promise(s=>{let r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach(o=>r.setRequestHeader(o,e.headers[o]));let n=(o,a)=>setTimeout(()=>{r.abort(),s({status:0,content:a,isTimedOut:!0})},o),d=n(e.connectTimeout,"Connection timeout"),i;r.onreadystatechange=()=>{r.readyState>r.OPENED&&i===void 0&&(clearTimeout(d),i=n(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{r.status===0&&(clearTimeout(d),clearTimeout(i),s({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(d),clearTimeout(i),s({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)})}return{send:t}}function M(t){let e,s=`algolia-client-js-${t.key}`;function r(){return e===void 0&&(e=t.localStorage||window.localStorage),e}function n(){return JSON.parse(r().getItem(s)||"{}")}function d(o){r().setItem(s,JSON.stringify(o))}function i(){let o=t.timeToLive?t.timeToLive*1e3:null,a=n(),c=Object.fromEntries(Object.entries(a).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,a,c={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(i(),n()[JSON.stringify(o)])).then(u=>Promise.all([u?u.value:a(),u!==void 0])).then(([u,m])=>Promise.all([u,m||c.miss(u)])).then(([u])=>u)},set(o,a){return Promise.resolve().then(()=>{let c=n();return c[JSON.stringify(o)]={timestamp:new Date().getTime(),value:a},r().setItem(s,JSON.stringify(c)),a})},delete(o){return Promise.resolve().then(()=>{let a=n();delete a[JSON.stringify(o)],r().setItem(s,JSON.stringify(a))})},clear(){return Promise.resolve().then(()=>{r().removeItem(s)})}}}function K(){return{get(t,e,s={miss:()=>Promise.resolve()}){return e().then(n=>Promise.all([n,s.miss(n)])).then(([n])=>n)},set(t,e){return Promise.resolve(e)},delete(t){return Promise.resolve()},clear(){return Promise.resolve()}}}function E(t){let e=[...t.caches],s=e.shift();return s===void 0?K():{get(r,n,d={miss:()=>Promise.resolve()}){return s.get(r,n,d).catch(()=>E({caches:e}).get(r,n,d))},set(r,n){return s.set(r,n).catch(()=>E({caches:e}).set(r,n))},delete(r){return s.delete(r).catch(()=>E({caches:e}).delete(r))},clear(){return s.clear().catch(()=>E({caches:e}).clear())}}}function O(t={serializable:!0}){let e={};return{get(s,r,n={miss:()=>Promise.resolve()}){let d=JSON.stringify(s);if(d in e)return Promise.resolve(t.serializable?JSON.parse(e[d]):e[d]);let i=r();return i.then(o=>n.miss(o)).then(()=>i)},set(s,r){return e[JSON.stringify(s)]=t.serializable?JSON.stringify(r):r,Promise.resolve(r)},delete(s){return delete e[JSON.stringify(s)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}function V(t){let e={value:`Algolia for JavaScript (${t})`,add(s){let r=`; ${s.segment}${s.version!==void 0?` (${s.version})`:""}`;return e.value.indexOf(r)===-1&&(e.value=`${e.value}${r}`),e}};return e}function Q(t,e,s="WithinHeaders"){let r={"x-algolia-api-key":e,"x-algolia-application-id":t};return{headers(){return s==="WithinHeaders"?r:{}},queryParameters(){return s==="WithinQueryParameters"?r:{}}}}function W({algoliaAgents:t,client:e,version:s}){let r=V(s).add({segment:e,version:s});return t.forEach(n=>r.add(n)),r}function $(){return{debug(t,e){return Promise.resolve()},info(t,e){return Promise.resolve()},error(t,e){return Promise.resolve()}}}var k=2*60*1e3;function L(t,e="up"){let s=Date.now();function r(){return e==="up"||Date.now()-s>k}function n(){return e==="timed out"&&Date.now()-s<=k}return{...t,status:e,lastUpdate:s,isUp:r,isTimedOut:n}}var j=class extends Error{name="AlgoliaError";constructor(t,e){super(t),e&&(this.name=e)}},J=class extends j{stackTrace;constructor(t,e,s){super(t,s),this.stackTrace=e}},Y=class extends J{constructor(t){super("Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support.",t,"RetryError")}},I=class extends J{status;constructor(t,e,s,r="ApiError"){super(t,s,r),this.status=e}},Z=class extends j{response;constructor(t,e){super(t,"DeserializationError"),this.response=e}},ee=class extends I{error;constructor(t,e,s,r){super(t,e,r,"DetailedApiError"),this.error=s}};function te(t,e,s){let r=re(s),n=`${t.protocol}://${t.url}${t.port?`:${t.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return r.length&&(n+=`?${r}`),n}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]).replace(/\+/g,"%20")}`).join("&")}function se(t,e){if(t.method==="GET"||t.data===void 0&&e.data===void 0)return;let s=Array.isArray(t.data)?t.data:{...t.data,...e.data};return JSON.stringify(s)}function oe(t,e,s){let r={Accept:"application/json",...t,...e,...s},n={};return Object.keys(r).forEach(d=>{let i=r[d];n[d.toLowerCase()]=i}),n}function ae(t){try{return JSON.parse(t.content)}catch(e){throw new Z(e.message,t)}}function ne({content:t,status:e},s){try{let r=JSON.parse(t);return"error"in r?new ee(r.message,e,r.error,s):new I(r.message,e,s)}catch{}return new I(t,e,s)}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=>z(e))}function z(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 F({hosts:t,hostsCache:e,baseHeaders:s,logger:r,baseQueryParameters:n,algoliaAgent:d,timeouts:i,requester:o,requestsCache:a,responsesCache:c}){async function u(l){let p=await Promise.all(l.map(P=>e.get(P,()=>Promise.resolve(L(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=se(l,p),y=oe(s,l.headers,p.headers),P=l.method==="GET"?{...l.data,...p.data}:{},q={...n,...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 x=0,N=async(f,b)=>{let v=f.pop();if(v===void 0)throw new Y(le(g));let A={...i,...p.timeouts},_={data:w,headers:y,method:l.method,url:te(v,l.path,q),connectTimeout:b(x,A.connect),responseTimeout:b(x,T?A.read:A.write)},G=S=>{let H={request:_,response:S,host:v,triesLeft:f.length};return g.push(H),H},R=await o.send(_);if(ce(R)){let S=G(R);return R.isTimedOut&&x++,r.info("Retryable failure",z(S)),await e.set(v,L(v,R.isTimedOut?"timed out":"down")),N(f,b)}if(ue(R))return ae(R);throw G(R),ne(R,g)},X=t.filter(f=>f.accept==="readWrite"||(T?f.accept==="read":f.accept==="write")),D=await u(X);return N([...D.hosts].reverse(),D.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:n,headers:s}};return c.get(y,()=>a.get(y,()=>a.set(y,g()).then(P=>Promise.all([a.delete(y),P]),P=>Promise.all([a.delete(y),Promise.reject(P)])).then(([P,q])=>q)),{miss:P=>c.set(y,P)})}return{hostsCache:e,requester:o,timeouts:i,logger:r,algoliaAgent:d,baseHeaders:s,baseQueryParameters:n,hosts:t,request:h,requestsCache:a,responsesCache:c}}var C="1.18.0";function me(){return[{url:"status.algolia.com",accept:"readWrite",protocol:"https"}]}function B({appId:t,apiKey:e,authMode:s,algoliaAgents:r,...n}){let d=Q(t,e,s),i=F({hosts:me(),...n,algoliaAgent:W({algoliaAgents:r,client:"Monitoring",version:C}),baseHeaders:{"content-type":"text/plain",...d.headers(),...n.baseHeaders},baseQueryParameters:{...d.queryParameters(),...n.baseQueryParameters}});return{transporter:i,appId:t,clearCache(){return Promise.all([i.requestsCache.clear(),i.responsesCache.clear()]).then(()=>{})},get _ua(){return i.algoliaAgent.value},addAlgoliaAgent(o,a){i.algoliaAgent.add({segment:o,version:a})},setClientApiKey({apiKey:o}){!s||s==="WithinHeaders"?i.baseHeaders["x-algolia-api-key"]=o:i.baseQueryParameters["x-algolia-api-key"]=o},customDelete({path:o,parameters:a},c){if(!o)throw new Error("Parameter `path` is required when calling `customDelete`.");let l={method:"DELETE",path:"/{path}".replace("{path}",o),queryParameters:a||{},headers:{}};return i.request(l,c)},customGet({path:o,parameters:a},c){if(!o)throw new Error("Parameter `path` is required when calling `customGet`.");let l={method:"GET",path:"/{path}".replace("{path}",o),queryParameters:a||{},headers:{}};return i.request(l,c)},customPost({path:o,parameters:a,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:a||{},headers:{},data:c||{}};return i.request(p,u)},customPut({path:o,parameters:a,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:a||{},headers:{},data:c||{}};return i.request(p,u)},getClusterIncidents({clusters:o},a){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,a)},getClusterStatus({clusters:o},a){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,a)},getIncidents(o){let m={method:"GET",path:"/1/incidents",queryParameters:{},headers:{}};return i.request(m,o)},getIndexingTime({clusters:o},a){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,a)},getLatency({clusters:o},a){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,a)},getMetrics({metric:o,period:a},c){if(!o)throw new Error("Parameter `metric` is required when calling `getMetrics`.");if(!a)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(a)),queryParameters:{},headers:{}};return i.request(l,c)},getReachability({clusters:o},a){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,a)},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 Ke(t,e,s){if(!t||typeof t!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");return B({appId:t,apiKey:e,timeouts:{connect:1e3,read:2e3,write:3e4},logger:$(),requester:U(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:O(),requestsCache:O({serializable:!1}),hostsCache:E({caches:[M({key:`${C}-${t}`}),O()]}),...s})}export{C as apiClientVersion,Ke as monitoringClient}; | ||
//# sourceMappingURL=browser.min.js.map |
@@ -7,3 +7,3 @@ (function (global, factory) { | ||
function U(){function t(e){return new Promise(s=>{let r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach(o=>r.setRequestHeader(o,e.headers[o]));let n=(o,a)=>setTimeout(()=>{r.abort(),s({status:0,content:a,isTimedOut:!0});},o),d=n(e.connectTimeout,"Connection timeout"),i;r.onreadystatechange=()=>{r.readyState>r.OPENED&&i===void 0&&(clearTimeout(d),i=n(e.responseTimeout,"Socket timeout"));},r.onerror=()=>{r.status===0&&(clearTimeout(d),clearTimeout(i),s({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}));},r.onload=()=>{clearTimeout(d),clearTimeout(i),s({content:r.responseText,status:r.status,isTimedOut:!1});},r.send(e.data);})}return {send:t}}function M(t){let e,s=`algolia-client-js-${t.key}`;function r(){return e===void 0&&(e=t.localStorage||window.localStorage),e}function n(){return JSON.parse(r().getItem(s)||"{}")}function d(o){r().setItem(s,JSON.stringify(o));}function i(){let o=t.timeToLive?t.timeToLive*1e3:null,a=n(),c=Object.fromEntries(Object.entries(a).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,a,c={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(i(),n()[JSON.stringify(o)])).then(u=>Promise.all([u?u.value:a(),u!==void 0])).then(([u,m])=>Promise.all([u,m||c.miss(u)])).then(([u])=>u)},set(o,a){return Promise.resolve().then(()=>{let c=n();return c[JSON.stringify(o)]={timestamp:new Date().getTime(),value:a},r().setItem(s,JSON.stringify(c)),a})},delete(o){return Promise.resolve().then(()=>{let a=n();delete a[JSON.stringify(o)],r().setItem(s,JSON.stringify(a));})},clear(){return Promise.resolve().then(()=>{r().removeItem(s);})}}}function K(){return {get(t,e,s={miss:()=>Promise.resolve()}){return e().then(n=>Promise.all([n,s.miss(n)])).then(([n])=>n)},set(t,e){return Promise.resolve(e)},delete(t){return Promise.resolve()},clear(){return Promise.resolve()}}}function E(t){let e=[...t.caches],s=e.shift();return s===void 0?K():{get(r,n,d={miss:()=>Promise.resolve()}){return s.get(r,n,d).catch(()=>E({caches:e}).get(r,n,d))},set(r,n){return s.set(r,n).catch(()=>E({caches:e}).set(r,n))},delete(r){return s.delete(r).catch(()=>E({caches:e}).delete(r))},clear(){return s.clear().catch(()=>E({caches:e}).clear())}}}function O(t={serializable:!0}){let e={};return {get(s,r,n={miss:()=>Promise.resolve()}){let d=JSON.stringify(s);if(d in e)return Promise.resolve(t.serializable?JSON.parse(e[d]):e[d]);let i=r();return i.then(o=>n.miss(o)).then(()=>i)},set(s,r){return e[JSON.stringify(s)]=t.serializable?JSON.stringify(r):r,Promise.resolve(r)},delete(s){return delete e[JSON.stringify(s)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}function V(t){let e={value:`Algolia for JavaScript (${t})`,add(s){let r=`; ${s.segment}${s.version!==void 0?` (${s.version})`:""}`;return e.value.indexOf(r)===-1&&(e.value=`${e.value}${r}`),e}};return e}function Q(t,e,s="WithinHeaders"){let r={"x-algolia-api-key":e,"x-algolia-application-id":t};return {headers(){return s==="WithinHeaders"?r:{}},queryParameters(){return s==="WithinQueryParameters"?r:{}}}}function W({algoliaAgents:t,client:e,version:s}){let r=V(s).add({segment:e,version:s});return t.forEach(n=>r.add(n)),r}function $(){return {debug(t,e){return Promise.resolve()},info(t,e){return Promise.resolve()},error(t,e){return Promise.resolve()}}}var k=2*60*1e3;function L(t,e="up"){let s=Date.now();function r(){return e==="up"||Date.now()-s>k}function n(){return e==="timed out"&&Date.now()-s<=k}return {...t,status:e,lastUpdate:s,isUp:r,isTimedOut:n}}var j=class extends Error{name="AlgoliaError";constructor(t,e){super(t),e&&(this.name=e);}},J=class extends j{stackTrace;constructor(t,e,s){super(t,s),this.stackTrace=e;}},Y=class extends J{constructor(t){super("Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support.",t,"RetryError");}},I=class extends J{status;constructor(t,e,s,r="ApiError"){super(t,s,r),this.status=e;}},Z=class extends j{response;constructor(t,e){super(t,"DeserializationError"),this.response=e;}},ee=class extends I{error;constructor(t,e,s,r){super(t,e,r,"DetailedApiError"),this.error=s;}};function te(t,e,s){let r=re(s),n=`${t.protocol}://${t.url}${t.port?`:${t.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return r.length&&(n+=`?${r}`),n}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]).replace(/\+/g,"%20")}`).join("&")}function se(t,e){if(t.method==="GET"||t.data===void 0&&e.data===void 0)return;let s=Array.isArray(t.data)?t.data:{...t.data,...e.data};return JSON.stringify(s)}function oe(t,e,s){let r={Accept:"application/json",...t,...e,...s},n={};return Object.keys(r).forEach(d=>{let i=r[d];n[d.toLowerCase()]=i;}),n}function ae(t){try{return JSON.parse(t.content)}catch(e){throw new Z(e.message,t)}}function ne({content:t,status:e},s){try{let r=JSON.parse(t);return "error"in r?new ee(r.message,e,r.error,s):new I(r.message,e,s)}catch{}return new I(t,e,s)}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=>z(e))}function z(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 F({hosts:t,hostsCache:e,baseHeaders:s,logger:r,baseQueryParameters:n,algoliaAgent:d,timeouts:i,requester:o,requestsCache:a,responsesCache:c}){async function u(l){let p=await Promise.all(l.map(P=>e.get(P,()=>Promise.resolve(L(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=se(l,p),y=oe(s,l.headers,p.headers),P=l.method==="GET"?{...l.data,...p.data}:{},q={...n,...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 x=0,N=async(f,b)=>{let v=f.pop();if(v===void 0)throw new Y(le(g));let A={...i,...p.timeouts},_={data:w,headers:y,method:l.method,url:te(v,l.path,q),connectTimeout:b(x,A.connect),responseTimeout:b(x,T?A.read:A.write)},G=S=>{let H={request:_,response:S,host:v,triesLeft:f.length};return g.push(H),H},R=await o.send(_);if(ce(R)){let S=G(R);return R.isTimedOut&&x++,r.info("Retryable failure",z(S)),await e.set(v,L(v,R.isTimedOut?"timed out":"down")),N(f,b)}if(ue(R))return ae(R);throw G(R),ne(R,g)},X=t.filter(f=>f.accept==="readWrite"||(T?f.accept==="read":f.accept==="write")),D=await u(X);return N([...D.hosts].reverse(),D.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:n,headers:s}};return c.get(y,()=>a.get(y,()=>a.set(y,g()).then(P=>Promise.all([a.delete(y),P]),P=>Promise.all([a.delete(y),Promise.reject(P)])).then(([P,q])=>q)),{miss:P=>c.set(y,P)})}return {hostsCache:e,requester:o,timeouts:i,logger:r,algoliaAgent:d,baseHeaders:s,baseQueryParameters:n,hosts:t,request:h,requestsCache:a,responsesCache:c}}var C="1.17.1";function me(){return [{url:"status.algolia.com",accept:"readWrite",protocol:"https"}]}function B({appId:t,apiKey:e,authMode:s,algoliaAgents:r,...n}){let d=Q(t,e,s),i=F({hosts:me(),...n,algoliaAgent:W({algoliaAgents:r,client:"Monitoring",version:C}),baseHeaders:{"content-type":"text/plain",...d.headers(),...n.baseHeaders},baseQueryParameters:{...d.queryParameters(),...n.baseQueryParameters}});return {transporter:i,appId:t,clearCache(){return Promise.all([i.requestsCache.clear(),i.responsesCache.clear()]).then(()=>{})},get _ua(){return i.algoliaAgent.value},addAlgoliaAgent(o,a){i.algoliaAgent.add({segment:o,version:a});},setClientApiKey({apiKey:o}){!s||s==="WithinHeaders"?i.baseHeaders["x-algolia-api-key"]=o:i.baseQueryParameters["x-algolia-api-key"]=o;},customDelete({path:o,parameters:a},c){if(!o)throw new Error("Parameter `path` is required when calling `customDelete`.");let l={method:"DELETE",path:"/{path}".replace("{path}",o),queryParameters:a||{},headers:{}};return i.request(l,c)},customGet({path:o,parameters:a},c){if(!o)throw new Error("Parameter `path` is required when calling `customGet`.");let l={method:"GET",path:"/{path}".replace("{path}",o),queryParameters:a||{},headers:{}};return i.request(l,c)},customPost({path:o,parameters:a,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:a||{},headers:{},data:c||{}};return i.request(p,u)},customPut({path:o,parameters:a,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:a||{},headers:{},data:c||{}};return i.request(p,u)},getClusterIncidents({clusters:o},a){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,a)},getClusterStatus({clusters:o},a){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,a)},getIncidents(o){let m={method:"GET",path:"/1/incidents",queryParameters:{},headers:{}};return i.request(m,o)},getIndexingTime({clusters:o},a){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,a)},getLatency({clusters:o},a){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,a)},getMetrics({metric:o,period:a},c){if(!o)throw new Error("Parameter `metric` is required when calling `getMetrics`.");if(!a)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(a)),queryParameters:{},headers:{}};return i.request(l,c)},getReachability({clusters:o},a){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,a)},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 Ke(t,e,s){if(!t||typeof t!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");return B({appId:t,apiKey:e,timeouts:{connect:1e3,read:2e3,write:3e4},logger:$(),requester:U(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:O(),requestsCache:O({serializable:!1}),hostsCache:E({caches:[M({key:`${C}-${t}`}),O()]}),...s})} | ||
function U(){function t(e){return new Promise(s=>{let r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach(o=>r.setRequestHeader(o,e.headers[o]));let n=(o,a)=>setTimeout(()=>{r.abort(),s({status:0,content:a,isTimedOut:!0});},o),d=n(e.connectTimeout,"Connection timeout"),i;r.onreadystatechange=()=>{r.readyState>r.OPENED&&i===void 0&&(clearTimeout(d),i=n(e.responseTimeout,"Socket timeout"));},r.onerror=()=>{r.status===0&&(clearTimeout(d),clearTimeout(i),s({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}));},r.onload=()=>{clearTimeout(d),clearTimeout(i),s({content:r.responseText,status:r.status,isTimedOut:!1});},r.send(e.data);})}return {send:t}}function M(t){let e,s=`algolia-client-js-${t.key}`;function r(){return e===void 0&&(e=t.localStorage||window.localStorage),e}function n(){return JSON.parse(r().getItem(s)||"{}")}function d(o){r().setItem(s,JSON.stringify(o));}function i(){let o=t.timeToLive?t.timeToLive*1e3:null,a=n(),c=Object.fromEntries(Object.entries(a).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,a,c={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(i(),n()[JSON.stringify(o)])).then(u=>Promise.all([u?u.value:a(),u!==void 0])).then(([u,m])=>Promise.all([u,m||c.miss(u)])).then(([u])=>u)},set(o,a){return Promise.resolve().then(()=>{let c=n();return c[JSON.stringify(o)]={timestamp:new Date().getTime(),value:a},r().setItem(s,JSON.stringify(c)),a})},delete(o){return Promise.resolve().then(()=>{let a=n();delete a[JSON.stringify(o)],r().setItem(s,JSON.stringify(a));})},clear(){return Promise.resolve().then(()=>{r().removeItem(s);})}}}function K(){return {get(t,e,s={miss:()=>Promise.resolve()}){return e().then(n=>Promise.all([n,s.miss(n)])).then(([n])=>n)},set(t,e){return Promise.resolve(e)},delete(t){return Promise.resolve()},clear(){return Promise.resolve()}}}function E(t){let e=[...t.caches],s=e.shift();return s===void 0?K():{get(r,n,d={miss:()=>Promise.resolve()}){return s.get(r,n,d).catch(()=>E({caches:e}).get(r,n,d))},set(r,n){return s.set(r,n).catch(()=>E({caches:e}).set(r,n))},delete(r){return s.delete(r).catch(()=>E({caches:e}).delete(r))},clear(){return s.clear().catch(()=>E({caches:e}).clear())}}}function O(t={serializable:!0}){let e={};return {get(s,r,n={miss:()=>Promise.resolve()}){let d=JSON.stringify(s);if(d in e)return Promise.resolve(t.serializable?JSON.parse(e[d]):e[d]);let i=r();return i.then(o=>n.miss(o)).then(()=>i)},set(s,r){return e[JSON.stringify(s)]=t.serializable?JSON.stringify(r):r,Promise.resolve(r)},delete(s){return delete e[JSON.stringify(s)],Promise.resolve()},clear(){return e={},Promise.resolve()}}}function V(t){let e={value:`Algolia for JavaScript (${t})`,add(s){let r=`; ${s.segment}${s.version!==void 0?` (${s.version})`:""}`;return e.value.indexOf(r)===-1&&(e.value=`${e.value}${r}`),e}};return e}function Q(t,e,s="WithinHeaders"){let r={"x-algolia-api-key":e,"x-algolia-application-id":t};return {headers(){return s==="WithinHeaders"?r:{}},queryParameters(){return s==="WithinQueryParameters"?r:{}}}}function W({algoliaAgents:t,client:e,version:s}){let r=V(s).add({segment:e,version:s});return t.forEach(n=>r.add(n)),r}function $(){return {debug(t,e){return Promise.resolve()},info(t,e){return Promise.resolve()},error(t,e){return Promise.resolve()}}}var k=2*60*1e3;function L(t,e="up"){let s=Date.now();function r(){return e==="up"||Date.now()-s>k}function n(){return e==="timed out"&&Date.now()-s<=k}return {...t,status:e,lastUpdate:s,isUp:r,isTimedOut:n}}var j=class extends Error{name="AlgoliaError";constructor(t,e){super(t),e&&(this.name=e);}},J=class extends j{stackTrace;constructor(t,e,s){super(t,s),this.stackTrace=e;}},Y=class extends J{constructor(t){super("Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support.",t,"RetryError");}},I=class extends J{status;constructor(t,e,s,r="ApiError"){super(t,s,r),this.status=e;}},Z=class extends j{response;constructor(t,e){super(t,"DeserializationError"),this.response=e;}},ee=class extends I{error;constructor(t,e,s,r){super(t,e,r,"DetailedApiError"),this.error=s;}};function te(t,e,s){let r=re(s),n=`${t.protocol}://${t.url}${t.port?`:${t.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return r.length&&(n+=`?${r}`),n}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]).replace(/\+/g,"%20")}`).join("&")}function se(t,e){if(t.method==="GET"||t.data===void 0&&e.data===void 0)return;let s=Array.isArray(t.data)?t.data:{...t.data,...e.data};return JSON.stringify(s)}function oe(t,e,s){let r={Accept:"application/json",...t,...e,...s},n={};return Object.keys(r).forEach(d=>{let i=r[d];n[d.toLowerCase()]=i;}),n}function ae(t){try{return JSON.parse(t.content)}catch(e){throw new Z(e.message,t)}}function ne({content:t,status:e},s){try{let r=JSON.parse(t);return "error"in r?new ee(r.message,e,r.error,s):new I(r.message,e,s)}catch{}return new I(t,e,s)}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=>z(e))}function z(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 F({hosts:t,hostsCache:e,baseHeaders:s,logger:r,baseQueryParameters:n,algoliaAgent:d,timeouts:i,requester:o,requestsCache:a,responsesCache:c}){async function u(l){let p=await Promise.all(l.map(P=>e.get(P,()=>Promise.resolve(L(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=se(l,p),y=oe(s,l.headers,p.headers),P=l.method==="GET"?{...l.data,...p.data}:{},q={...n,...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 x=0,N=async(f,b)=>{let v=f.pop();if(v===void 0)throw new Y(le(g));let A={...i,...p.timeouts},_={data:w,headers:y,method:l.method,url:te(v,l.path,q),connectTimeout:b(x,A.connect),responseTimeout:b(x,T?A.read:A.write)},G=S=>{let H={request:_,response:S,host:v,triesLeft:f.length};return g.push(H),H},R=await o.send(_);if(ce(R)){let S=G(R);return R.isTimedOut&&x++,r.info("Retryable failure",z(S)),await e.set(v,L(v,R.isTimedOut?"timed out":"down")),N(f,b)}if(ue(R))return ae(R);throw G(R),ne(R,g)},X=t.filter(f=>f.accept==="readWrite"||(T?f.accept==="read":f.accept==="write")),D=await u(X);return N([...D.hosts].reverse(),D.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:n,headers:s}};return c.get(y,()=>a.get(y,()=>a.set(y,g()).then(P=>Promise.all([a.delete(y),P]),P=>Promise.all([a.delete(y),Promise.reject(P)])).then(([P,q])=>q)),{miss:P=>c.set(y,P)})}return {hostsCache:e,requester:o,timeouts:i,logger:r,algoliaAgent:d,baseHeaders:s,baseQueryParameters:n,hosts:t,request:h,requestsCache:a,responsesCache:c}}var C="1.18.0";function me(){return [{url:"status.algolia.com",accept:"readWrite",protocol:"https"}]}function B({appId:t,apiKey:e,authMode:s,algoliaAgents:r,...n}){let d=Q(t,e,s),i=F({hosts:me(),...n,algoliaAgent:W({algoliaAgents:r,client:"Monitoring",version:C}),baseHeaders:{"content-type":"text/plain",...d.headers(),...n.baseHeaders},baseQueryParameters:{...d.queryParameters(),...n.baseQueryParameters}});return {transporter:i,appId:t,clearCache(){return Promise.all([i.requestsCache.clear(),i.responsesCache.clear()]).then(()=>{})},get _ua(){return i.algoliaAgent.value},addAlgoliaAgent(o,a){i.algoliaAgent.add({segment:o,version:a});},setClientApiKey({apiKey:o}){!s||s==="WithinHeaders"?i.baseHeaders["x-algolia-api-key"]=o:i.baseQueryParameters["x-algolia-api-key"]=o;},customDelete({path:o,parameters:a},c){if(!o)throw new Error("Parameter `path` is required when calling `customDelete`.");let l={method:"DELETE",path:"/{path}".replace("{path}",o),queryParameters:a||{},headers:{}};return i.request(l,c)},customGet({path:o,parameters:a},c){if(!o)throw new Error("Parameter `path` is required when calling `customGet`.");let l={method:"GET",path:"/{path}".replace("{path}",o),queryParameters:a||{},headers:{}};return i.request(l,c)},customPost({path:o,parameters:a,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:a||{},headers:{},data:c||{}};return i.request(p,u)},customPut({path:o,parameters:a,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:a||{},headers:{},data:c||{}};return i.request(p,u)},getClusterIncidents({clusters:o},a){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,a)},getClusterStatus({clusters:o},a){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,a)},getIncidents(o){let m={method:"GET",path:"/1/incidents",queryParameters:{},headers:{}};return i.request(m,o)},getIndexingTime({clusters:o},a){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,a)},getLatency({clusters:o},a){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,a)},getMetrics({metric:o,period:a},c){if(!o)throw new Error("Parameter `metric` is required when calling `getMetrics`.");if(!a)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(a)),queryParameters:{},headers:{}};return i.request(l,c)},getReachability({clusters:o},a){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,a)},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 Ke(t,e,s){if(!t||typeof t!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");return B({appId:t,apiKey:e,timeouts:{connect:1e3,read:2e3,write:3e4},logger:$(),requester:U(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:O(),requestsCache:O({serializable:!1}),hostsCache:E({caches:[M({key:`${C}-${t}`}),O()]}),...s})} | ||
@@ -10,0 +10,0 @@ exports.apiClientVersion = C; |
@@ -7,3 +7,3 @@ // builds/fetch.ts | ||
import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common"; | ||
var apiClientVersion = "1.17.1"; | ||
var apiClientVersion = "1.18.0"; | ||
function getDefaultHosts() { | ||
@@ -369,4 +369,4 @@ return [{ url: "status.algolia.com", accept: "readWrite", protocol: "https" }]; | ||
logger: createNullLogger(), | ||
requester: createFetchRequester(), | ||
algoliaAgents: [{ segment: "Fetch" }], | ||
requester: createFetchRequester(), | ||
responsesCache: createNullCache(), | ||
@@ -373,0 +373,0 @@ requestsCache: createNullCache(), |
@@ -7,3 +7,3 @@ // builds/node.ts | ||
import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common"; | ||
var apiClientVersion = "1.17.1"; | ||
var apiClientVersion = "1.18.0"; | ||
function getDefaultHosts() { | ||
@@ -10,0 +10,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.17.1"; | ||
declare const apiClientVersion = "1.18.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.17.1"; | ||
declare const apiClientVersion = "1.18.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.17.1"; | ||
var apiClientVersion = "1.18.0"; | ||
function getDefaultHosts() { | ||
@@ -5,0 +5,0 @@ return [{ url: "status.algolia.com", accept: "readWrite", protocol: "https" }]; |
{ | ||
"version": "1.17.1", | ||
"version": "1.18.0", | ||
"repository": { | ||
@@ -31,4 +31,4 @@ "type": "git", | ||
"worker": { | ||
"types": "./dist/fetch.d.ts", | ||
"default": "./dist/builds/fetch.js" | ||
"types": "./dist/worker.d.ts", | ||
"default": "./dist/builds/worker.js" | ||
}, | ||
@@ -53,10 +53,10 @@ "default": { | ||
"dependencies": { | ||
"@algolia/client-common": "5.17.1", | ||
"@algolia/requester-browser-xhr": "5.17.1", | ||
"@algolia/requester-fetch": "5.17.1", | ||
"@algolia/requester-node-http": "5.17.1" | ||
"@algolia/client-common": "5.18.0", | ||
"@algolia/requester-browser-xhr": "5.18.0", | ||
"@algolia/requester-fetch": "5.18.0", | ||
"@algolia/requester-node-http": "5.18.0" | ||
}, | ||
"devDependencies": { | ||
"@arethetypeswrong/cli": "0.17.1", | ||
"@types/node": "22.10.1", | ||
"@types/node": "22.10.2", | ||
"publint": "0.2.12", | ||
@@ -63,0 +63,0 @@ "rollup": "4.28.1", |
@@ -44,7 +44,7 @@ <p align="center"> | ||
```bash | ||
yarn add @algolia/monitoring@1.17.1 | ||
yarn add @algolia/monitoring@1.18.0 | ||
# or | ||
npm install @algolia/monitoring@1.17.1 | ||
npm install @algolia/monitoring@1.18.0 | ||
# or | ||
pnpm add @algolia/monitoring@1.17.1 | ||
pnpm add @algolia/monitoring@1.18.0 | ||
``` | ||
@@ -57,3 +57,3 @@ | ||
```html | ||
<script src="https://cdn.jsdelivr.net/npm/@algolia/monitoring@1.17.1/dist/builds/browser.umd.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/@algolia/monitoring@1.18.0/dist/builds/browser.umd.js"></script> | ||
``` | ||
@@ -60,0 +60,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
459604
27
4421
9
+ Added@algolia/client-common@5.18.0(transitive)
+ Added@algolia/requester-browser-xhr@5.18.0(transitive)
+ Added@algolia/requester-fetch@5.18.0(transitive)
+ Added@algolia/requester-node-http@5.18.0(transitive)
- Removed@algolia/client-common@5.17.1(transitive)
- Removed@algolia/requester-browser-xhr@5.17.1(transitive)
- Removed@algolia/requester-fetch@5.17.1(transitive)
- Removed@algolia/requester-node-http@5.17.1(transitive)