@algolia/monitoring 1.2.5 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@
4
4
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.monitoringClient = {}));
5
5
  })(this, (function (exports) { 'use strict';
6
6
 
7
- function M(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 H(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 p(o){r().setItem(s,JSON.stringify(o));}function c(){let o=t.timeToLive?t.timeToLive*1e3:null,a=n(),u=Object.fromEntries(Object.entries(a).filter(([,d])=>d.timestamp!==void 0));if(p(u),!o)return;let l=Object.fromEntries(Object.entries(u).filter(([,d])=>{let i=new Date().getTime();return !(d.timestamp+o<i)}));p(l);}return {get(o,a,u={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(c(),n()[JSON.stringify(o)])).then(l=>Promise.all([l?l.value:a(),l!==void 0])).then(([l,d])=>Promise.all([l,d||u.miss(l)])).then(([l])=>l)},set(o,a){return Promise.resolve().then(()=>{let u=n();return u[JSON.stringify(o)]={timestamp:new Date().getTime(),value:a},r().setItem(s,JSON.stringify(u)),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 T(t){let e=[...t.caches],s=e.shift();return s===void 0?K():{get(r,n,p={miss:()=>Promise.resolve()}){return s.get(r,n,p).catch(()=>T({caches:e}).get(r,n,p))},set(r,n){return s.set(r,n).catch(()=>T({caches:e}).set(r,n))},delete(r){return s.delete(r).catch(()=>T({caches:e}).delete(r))},clear(){return s.clear().catch(()=>T({caches:e}).clear())}}}function O(t={serializable:!0}){let e={};return {get(s,r,n={miss:()=>Promise.resolve()}){let p=JSON.stringify(s);if(p in e)return Promise.resolve(t.serializable?JSON.parse(e[p]):e[p]);let c=r();return c.then(o=>n.miss(o)).then(()=>c)},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()}}}var G=2*60*1e3;function L(t,e="up"){let s=Date.now();function r(){return e==="up"||Date.now()-s>G}function n(){return e==="timed out"&&Date.now()-s<=G}return {...t,status:e,lastUpdate:s,isUp:r,isTimedOut:n}}var k=class extends Error{name="AlgoliaError";constructor(t,e){super(t),e&&(this.name=e);}},W=class extends k{stackTrace;constructor(t,e,s){super(t,s),this.stackTrace=e;}},Y=class extends W{constructor(t){super("Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support.",t,"RetryError");}},I=class extends W{status;constructor(t,e,s,r="ApiError"){super(t,s,r),this.status=e;}},Z=class extends k{response;constructor(t,e){super(t,"DeserializationError"),this.response=e;}},ee=class extends I{error;constructor(t,e,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]).replaceAll("+","%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(p=>{let c=r[p];n[p.toLowerCase()]=c;}),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=>J(e))}function J(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 Q({hosts:t,hostsCache:e,baseHeaders:s,baseQueryParameters:r,algoliaAgent:n,timeouts:p,requester:c,requestsCache:o,responsesCache:a}){async function u(i){let m=await Promise.all(i.map(h=>e.get(h,()=>Promise.resolve(L(h))))),f=m.filter(h=>h.isUp()),g=m.filter(h=>h.isTimedOut()),E=[...f,...g];return {hosts:E.length>0?E:i,getTimeout(h,q){return (g.length===0&&h===0?1:g.length+3+h)*q}}}async function l(i,m,f=!0){let g=[],E=se(i,m),y=oe(s,i.headers,m.headers),h=i.method==="GET"?{...i.data,...m.data}:{},q={...r,...i.queryParameters,...h};if(n.value&&(q["x-algolia-agent"]=n.value),m&&m.queryParameters)for(let P of Object.keys(m.queryParameters))!m.queryParameters[P]||Object.prototype.toString.call(m.queryParameters[P])==="[object Object]"?q[P]=m.queryParameters[P]:q[P]=m.queryParameters[P].toString();let v=0,b=async(P,C)=>{let w=P.pop();if(w===void 0)throw new Y(le(g));let A={...p,...m.timeouts},N={data:E,headers:y,method:i.method,url:te(w,i.path,q),connectTimeout:C(v,A.connect),responseTimeout:C(v,f?A.read:A.write)},D=S=>{let _={request:N,response:S,host:w,triesLeft:P.length};return g.push(_),_},R=await c.send(N);if(ce(R)){let S=D(R);return R.isTimedOut&&v++,console.log("Retryable failure",J(S)),await e.set(w,L(w,R.isTimedOut?"timed out":"down")),b(P,C)}if(ue(R))return ae(R);throw D(R),ne(R,g)},V=t.filter(P=>P.accept==="readWrite"||(f?P.accept==="read":P.accept==="write")),U=await u(V);return b([...U.hosts].reverse(),U.getTimeout)}function d(i,m={}){let f=i.useReadTransporter||i.method==="GET";if(!f)return l(i,m,f);let g=()=>l(i,m);if((m.cacheable||i.cacheable)!==!0)return g();let y={request:i,requestOptions:m,transporter:{queryParameters:r,headers:s}};return a.get(y,()=>o.get(y,()=>o.set(y,g()).then(h=>Promise.all([o.delete(y),h]),h=>Promise.all([o.delete(y),Promise.reject(h)])).then(([h,q])=>q)),{miss:h=>a.set(y,h)})}return {hostsCache:e,requester:c,timeouts:p,algoliaAgent:n,baseHeaders:s,baseQueryParameters:r,hosts:t,request:d,requestsCache:o,responsesCache:a}}function me(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 j({algoliaAgents:t,client:e,version:s}){let r=me(s).add({segment:e,version:s});return t.forEach(n=>r.add(n)),r}var $=1e3,z=2e3,F=3e4;function B(){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),p=n(e.connectTimeout,"Connection timeout"),c;r.onreadystatechange=()=>{r.readyState>r.OPENED&&c===void 0&&(clearTimeout(p),c=n(e.responseTimeout,"Socket timeout"));},r.onerror=()=>{r.status===0&&(clearTimeout(p),clearTimeout(c),s({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}));},r.onload=()=>{clearTimeout(p),clearTimeout(c),s({content:r.responseText,status:r.status,isTimedOut:!1});},r.send(e.data);})}return {send:t}}var x="1.2.5";function de(){return [{url:"status.algolia.com",accept:"readWrite",protocol:"https"}]}function X({appId:t,apiKey:e,authMode:s,algoliaAgents:r,...n}){let p=M(t,e,s),c=Q({hosts:de(),...n,algoliaAgent:j({algoliaAgents:r,client:"Monitoring",version:x}),baseHeaders:{"content-type":"text/plain",...p.headers(),...n.baseHeaders},baseQueryParameters:{...p.queryParameters(),...n.baseQueryParameters}});return {transporter:c,appId:t,clearCache(){return Promise.all([c.requestsCache.clear(),c.responsesCache.clear()]).then(()=>{})},get _ua(){return c.algoliaAgent.value},addAlgoliaAgent(o,a){c.algoliaAgent.add({segment:o,version:a});},customDelete({path:o,parameters:a},u){if(!o)throw new Error("Parameter `path` is required when calling `customDelete`.");let m={method:"DELETE",path:"/{path}".replace("{path}",o),queryParameters:a||{},headers:{}};return c.request(m,u)},customGet({path:o,parameters:a},u){if(!o)throw new Error("Parameter `path` is required when calling `customGet`.");let m={method:"GET",path:"/{path}".replace("{path}",o),queryParameters:a||{},headers:{}};return c.request(m,u)},customPost({path:o,parameters:a,body:u},l){if(!o)throw new Error("Parameter `path` is required when calling `customPost`.");let f={method:"POST",path:"/{path}".replace("{path}",o),queryParameters:a||{},headers:{},data:u||{}};return c.request(f,l)},customPut({path:o,parameters:a,body:u},l){if(!o)throw new Error("Parameter `path` is required when calling `customPut`.");let f={method:"PUT",path:"/{path}".replace("{path}",o),queryParameters:a||{},headers:{},data:u||{}};return c.request(f,l)},getClusterIncidents({clusters:o},a){if(!o)throw new Error("Parameter `clusters` is required when calling `getClusterIncidents`.");let i={method:"GET",path:"/1/incidents/{clusters}".replace("{clusters}",encodeURIComponent(o)),queryParameters:{},headers:{}};return c.request(i,a)},getClusterStatus({clusters:o},a){if(!o)throw new Error("Parameter `clusters` is required when calling `getClusterStatus`.");let i={method:"GET",path:"/1/status/{clusters}".replace("{clusters}",encodeURIComponent(o)),queryParameters:{},headers:{}};return c.request(i,a)},getIncidents(o){let d={method:"GET",path:"/1/incidents",queryParameters:{},headers:{}};return c.request(d,o)},getIndexingTime({clusters:o},a){if(!o)throw new Error("Parameter `clusters` is required when calling `getIndexingTime`.");let i={method:"GET",path:"/1/indexing/{clusters}".replace("{clusters}",encodeURIComponent(o)),queryParameters:{},headers:{}};return c.request(i,a)},getLatency({clusters:o},a){if(!o)throw new Error("Parameter `clusters` is required when calling `getLatency`.");let i={method:"GET",path:"/1/latency/{clusters}".replace("{clusters}",encodeURIComponent(o)),queryParameters:{},headers:{}};return c.request(i,a)},getMetrics({metric:o,period:a},u){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 m={method:"GET",path:"/1/infrastructure/{metric}/period/{period}".replace("{metric}",encodeURIComponent(o)).replace("{period}",encodeURIComponent(a)),queryParameters:{},headers:{}};return c.request(m,u)},getReachability({clusters:o},a){if(!o)throw new Error("Parameter `clusters` is required when calling `getReachability`.");let i={method:"GET",path:"/1/reachability/{clusters}/probes".replace("{clusters}",encodeURIComponent(o)),queryParameters:{},headers:{}};return c.request(i,a)},getServers(o){let d={method:"GET",path:"/1/inventory/servers",queryParameters:{},headers:{}};return c.request(d,o)},getStatus(o){let d={method:"GET",path:"/1/status",queryParameters:{},headers:{}};return c.request(d,o)}}}function Ze(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 X({appId:t,apiKey:e,timeouts:{connect:$,read:z,write:F},requester:B(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:O(),requestsCache:O({serializable:!1}),hostsCache:T({caches:[H({key:`${x}-${t}`}),O()]}),...s})}
7
+ function L(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 k(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 p(a){r().setItem(s,JSON.stringify(a));}function o(){let a=t.timeToLive?t.timeToLive*1e3:null,i=n(),l=Object.fromEntries(Object.entries(i).filter(([,h])=>h.timestamp!==void 0));if(p(l),!a)return;let c=Object.fromEntries(Object.entries(l).filter(([,h])=>{let u=new Date().getTime();return !(h.timestamp+a<u)}));p(c);}return {get(a,i,l={miss:()=>Promise.resolve()}){return Promise.resolve().then(()=>(o(),n()[JSON.stringify(a)])).then(c=>Promise.all([c?c.value:i(),c!==void 0])).then(([c,h])=>Promise.all([c,h||l.miss(c)])).then(([c])=>c)},set(a,i){return Promise.resolve().then(()=>{let l=n();return l[JSON.stringify(a)]={timestamp:new Date().getTime(),value:i},r().setItem(s,JSON.stringify(l)),i})},delete(a){return Promise.resolve().then(()=>{let i=n();delete i[JSON.stringify(a)],r().setItem(s,JSON.stringify(i));})},clear(){return Promise.resolve().then(()=>{r().removeItem(s);})}}}function V(){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 T(t){let e=[...t.caches],s=e.shift();return s===void 0?V():{get(r,n,p={miss:()=>Promise.resolve()}){return s.get(r,n,p).catch(()=>T({caches:e}).get(r,n,p))},set(r,n){return s.set(r,n).catch(()=>T({caches:e}).set(r,n))},delete(r){return s.delete(r).catch(()=>T({caches:e}).delete(r))},clear(){return s.clear().catch(()=>T({caches:e}).clear())}}}function O(t={serializable:!0}){let e={};return {get(s,r,n={miss:()=>Promise.resolve()}){let p=JSON.stringify(s);if(p in e)return Promise.resolve(t.serializable?JSON.parse(e[p]):e[p]);let o=r();return o.then(a=>n.miss(a)).then(()=>o)},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()}}}var G=2*60*1e3;function H(t,e="up"){let s=Date.now();function r(){return e==="up"||Date.now()-s>G}function n(){return e==="timed out"&&Date.now()-s<=G}return {...t,status:e,lastUpdate:s,isUp:r,isTimedOut:n}}var M=class extends Error{name="AlgoliaError";constructor(t,e){super(t),e&&(this.name=e);}},W=class extends M{stackTrace;constructor(t,e,s){super(t,s),this.stackTrace=e;}},Y=class extends W{constructor(t){super("Unreachable hosts - your application id may be incorrect. If the error persists, please reach out to the Algolia Support team: https://alg.li/support.",t,"RetryError");}},I=class extends W{status;constructor(t,e,s,r="ApiError"){super(t,s,r),this.status=e;}},Z=class extends M{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]).replaceAll("+","%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(p=>{let o=r[p];n[p.toLowerCase()]=o;}),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=>Q(e))}function Q(t){let e=t.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return {...t,request:{...t.request,headers:{...t.request.headers,...e}}}}function J({hosts:t,hostsCache:e,baseHeaders:s,baseQueryParameters:r,algoliaAgent:n,timeouts:p,requester:o,requestsCache:a,responsesCache:i}){async function l(u){let m=await Promise.all(u.map(d=>e.get(d,()=>Promise.resolve(H(d))))),R=m.filter(d=>d.isUp()),f=m.filter(d=>d.isTimedOut()),E=[...R,...f];return {hosts:E.length>0?E:u,getTimeout(d,y){return (f.length===0&&d===0?1:f.length+3+d)*y}}}async function c(u,m,R=!0){let f=[],E=se(u,m),g=oe(s,u.headers,m.headers),d=u.method==="GET"?{...u.data,...m.data}:{},y={...r,...u.queryParameters,...d};if(n.value&&(y["x-algolia-agent"]=n.value),m&&m.queryParameters)for(let P of Object.keys(m.queryParameters))!m.queryParameters[P]||Object.prototype.toString.call(m.queryParameters[P])==="[object Object]"?y[P]=m.queryParameters[P]:y[P]=m.queryParameters[P].toString();let v=0,b=async(P,C)=>{let w=P.pop();if(w===void 0)throw new Y(le(f));let A={...p,...m.timeouts},N={data:E,headers:g,method:u.method,url:te(w,u.path,y),connectTimeout:C(v,A.connect),responseTimeout:C(v,R?A.read:A.write)},D=S=>{let _={request:N,response:S,host:w,triesLeft:P.length};return f.push(_),_},q=await o.send(N);if(ce(q)){let S=D(q);return q.isTimedOut&&v++,console.log("Retryable failure",Q(S)),await e.set(w,H(w,q.isTimedOut?"timed out":"down")),b(P,C)}if(ue(q))return ae(q);throw D(q),ne(q,f)},K=t.filter(P=>P.accept==="readWrite"||(R?P.accept==="read":P.accept==="write")),U=await l(K);return b([...U.hosts].reverse(),U.getTimeout)}function h(u,m={}){let R=u.useReadTransporter||u.method==="GET";if(!R)return c(u,m,R);let f=()=>c(u,m);if((m.cacheable||u.cacheable)!==!0)return f();let g={request:u,requestOptions:m,transporter:{queryParameters:r,headers:s}};return i.get(g,()=>a.get(g,()=>a.set(g,f()).then(d=>Promise.all([a.delete(g),d]),d=>Promise.all([a.delete(g),Promise.reject(d)])).then(([d,y])=>y)),{miss:d=>i.set(g,d)})}return {hostsCache:e,requester:o,timeouts:p,algoliaAgent:n,baseHeaders:s,baseQueryParameters:r,hosts:t,request:h,requestsCache:a,responsesCache:i}}function me(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 j({algoliaAgents:t,client:e,version:s}){let r=me(s).add({segment:e,version:s});return t.forEach(n=>r.add(n)),r}var $=1e3,z=2e3,F=3e4;function B(){function t(e){return new Promise(s=>{let r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach(a=>r.setRequestHeader(a,e.headers[a]));let n=(a,i)=>setTimeout(()=>{r.abort(),s({status:0,content:i,isTimedOut:!0});},a),p=n(e.connectTimeout,"Connection timeout"),o;r.onreadystatechange=()=>{r.readyState>r.OPENED&&o===void 0&&(clearTimeout(p),o=n(e.responseTimeout,"Socket timeout"));},r.onerror=()=>{r.status===0&&(clearTimeout(p),clearTimeout(o),s({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}));},r.onload=()=>{clearTimeout(p),clearTimeout(o),s({content:r.responseText,status:r.status,isTimedOut:!1});},r.send(e.data);})}return {send:t}}var x="1.3.1";function pe(){return [{url:"status.algolia.com",accept:"readWrite",protocol:"https"}]}function X({appId:t,apiKey:e,authMode:s,algoliaAgents:r,...n}){let p=L(t,e,s);return {transporter:J({hosts:pe(),...n,algoliaAgent:j({algoliaAgents:r,client:"Monitoring",version:x}),baseHeaders:{"content-type":"text/plain",...p.headers(),...n.baseHeaders},baseQueryParameters:{...p.queryParameters(),...n.baseQueryParameters}}),appId:t,clearCache(){return Promise.all([this.transporter.requestsCache.clear(),this.transporter.responsesCache.clear()]).then(()=>{})},get _ua(){return this.transporter.algoliaAgent.value},addAlgoliaAgent(o,a){this.transporter.algoliaAgent.add({segment:o,version:a});},setClientApiKey({apiKey:o}){!s||s==="WithinHeaders"?this.transporter.baseHeaders["x-algolia-api-key"]=o:this.transporter.baseQueryParameters["x-algolia-api-key"]=o;},customDelete({path:o,parameters:a},i){if(!o)throw new Error("Parameter `path` is required when calling `customDelete`.");let u={method:"DELETE",path:"/{path}".replace("{path}",o),queryParameters:a||{},headers:{}};return this.transporter.request(u,i)},customGet({path:o,parameters:a},i){if(!o)throw new Error("Parameter `path` is required when calling `customGet`.");let u={method:"GET",path:"/{path}".replace("{path}",o),queryParameters:a||{},headers:{}};return this.transporter.request(u,i)},customPost({path:o,parameters:a,body:i},l){if(!o)throw new Error("Parameter `path` is required when calling `customPost`.");let m={method:"POST",path:"/{path}".replace("{path}",o),queryParameters:a||{},headers:{},data:i||{}};return this.transporter.request(m,l)},customPut({path:o,parameters:a,body:i},l){if(!o)throw new Error("Parameter `path` is required when calling `customPut`.");let m={method:"PUT",path:"/{path}".replace("{path}",o),queryParameters:a||{},headers:{},data:i||{}};return this.transporter.request(m,l)},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 this.transporter.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 this.transporter.request(h,a)},getIncidents(o){let c={method:"GET",path:"/1/incidents",queryParameters:{},headers:{}};return this.transporter.request(c,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 this.transporter.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 this.transporter.request(h,a)},getMetrics({metric:o,period:a},i){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 u={method:"GET",path:"/1/infrastructure/{metric}/period/{period}".replace("{metric}",encodeURIComponent(o)).replace("{period}",encodeURIComponent(a)),queryParameters:{},headers:{}};return this.transporter.request(u,i)},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 this.transporter.request(h,a)},getServers(o){let c={method:"GET",path:"/1/inventory/servers",queryParameters:{},headers:{}};return this.transporter.request(c,o)},getStatus(o){let c={method:"GET",path:"/1/status",queryParameters:{},headers:{}};return this.transporter.request(c,o)}}}function Ze(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 X({appId:t,apiKey:e,timeouts:{connect:$,read:z,write:F},requester:B(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:O(),requestsCache:O({serializable:!1}),hostsCache:T({caches:[k({key:`${x}-${t}`}),O()]}),...s})}
8
8
 
9
9
  exports.apiClientVersion = x;
10
10
  exports.monitoringClient = Ze;
@@ -29,7 +29,7 @@ var import_requester_node_http = require("@algolia/requester-node-http");
29
29
 
30
30
  // src/monitoringClient.ts
31
31
  var import_client_common = require("@algolia/client-common");
32
- var apiClientVersion = "1.2.5";
32
+ var apiClientVersion = "1.3.1";
33
33
  function getDefaultHosts() {
34
34
  return [{ url: "status.algolia.com", accept: "readWrite", protocol: "https" }];
35
35
  }
@@ -41,26 +41,25 @@ function createMonitoringClient({
41
41
  ...options
42
42
  }) {
43
43
  const auth = (0, import_client_common.createAuth)(appIdOption, apiKeyOption, authMode);
44
- const transporter = (0, import_client_common.createTransporter)({
45
- hosts: getDefaultHosts(),
46
- ...options,
47
- algoliaAgent: (0, import_client_common.getAlgoliaAgent)({
48
- algoliaAgents,
49
- client: "Monitoring",
50
- version: apiClientVersion
51
- }),
52
- baseHeaders: {
53
- "content-type": "text/plain",
54
- ...auth.headers(),
55
- ...options.baseHeaders
56
- },
57
- baseQueryParameters: {
58
- ...auth.queryParameters(),
59
- ...options.baseQueryParameters
60
- }
61
- });
62
44
  return {
63
- transporter,
45
+ transporter: (0, import_client_common.createTransporter)({
46
+ hosts: getDefaultHosts(),
47
+ ...options,
48
+ algoliaAgent: (0, import_client_common.getAlgoliaAgent)({
49
+ algoliaAgents,
50
+ client: "Monitoring",
51
+ version: apiClientVersion
52
+ }),
53
+ baseHeaders: {
54
+ "content-type": "text/plain",
55
+ ...auth.headers(),
56
+ ...options.baseHeaders
57
+ },
58
+ baseQueryParameters: {
59
+ ...auth.queryParameters(),
60
+ ...options.baseQueryParameters
61
+ }
62
+ }),
64
63
  /**
65
64
  * The `appId` currently in use.
66
65
  */
@@ -69,13 +68,15 @@ function createMonitoringClient({
69
68
  * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
70
69
  */
71
70
  clearCache() {
72
- return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
71
+ return Promise.all([this.transporter.requestsCache.clear(), this.transporter.responsesCache.clear()]).then(
72
+ () => void 0
73
+ );
73
74
  },
74
75
  /**
75
76
  * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
76
77
  */
77
78
  get _ua() {
78
- return transporter.algoliaAgent.value;
79
+ return this.transporter.algoliaAgent.value;
79
80
  },
80
81
  /**
81
82
  * Adds a `segment` to the `x-algolia-agent` sent with every requests.
@@ -84,7 +85,20 @@ function createMonitoringClient({
84
85
  * @param version - The version of the agent.
85
86
  */
86
87
  addAlgoliaAgent(segment, version) {
87
- transporter.algoliaAgent.add({ segment, version });
88
+ this.transporter.algoliaAgent.add({ segment, version });
89
+ },
90
+ /**
91
+ * Helper method to switch the API key used to authenticate the requests.
92
+ *
93
+ * @param params - Method params.
94
+ * @param params.apiKey - The new API Key to use.
95
+ */
96
+ setClientApiKey({ apiKey }) {
97
+ if (!authMode || authMode === "WithinHeaders") {
98
+ this.transporter.baseHeaders["x-algolia-api-key"] = apiKey;
99
+ } else {
100
+ this.transporter.baseQueryParameters["x-algolia-api-key"] = apiKey;
101
+ }
88
102
  },
89
103
  /**
90
104
  * This method allow you to send requests to the Algolia REST API.
@@ -107,7 +121,7 @@ function createMonitoringClient({
107
121
  queryParameters,
108
122
  headers
109
123
  };
110
- return transporter.request(request, requestOptions);
124
+ return this.transporter.request(request, requestOptions);
111
125
  },
112
126
  /**
113
127
  * This method allow you to send requests to the Algolia REST API.
@@ -130,7 +144,7 @@ function createMonitoringClient({
130
144
  queryParameters,
131
145
  headers
132
146
  };
133
- return transporter.request(request, requestOptions);
147
+ return this.transporter.request(request, requestOptions);
134
148
  },
135
149
  /**
136
150
  * This method allow you to send requests to the Algolia REST API.
@@ -155,7 +169,7 @@ function createMonitoringClient({
155
169
  headers,
156
170
  data: body ? body : {}
157
171
  };
158
- return transporter.request(request, requestOptions);
172
+ return this.transporter.request(request, requestOptions);
159
173
  },
160
174
  /**
161
175
  * This method allow you to send requests to the Algolia REST API.
@@ -180,7 +194,7 @@ function createMonitoringClient({
180
194
  headers,
181
195
  data: body ? body : {}
182
196
  };
183
- return transporter.request(request, requestOptions);
197
+ return this.transporter.request(request, requestOptions);
184
198
  },
185
199
  /**
186
200
  * Retrieves known incidents for the selected clusters.
@@ -202,7 +216,7 @@ function createMonitoringClient({
202
216
  queryParameters,
203
217
  headers
204
218
  };
205
- return transporter.request(request, requestOptions);
219
+ return this.transporter.request(request, requestOptions);
206
220
  },
207
221
  /**
208
222
  * Retrieves the status of selected clusters.
@@ -224,7 +238,7 @@ function createMonitoringClient({
224
238
  queryParameters,
225
239
  headers
226
240
  };
227
- return transporter.request(request, requestOptions);
241
+ return this.transporter.request(request, requestOptions);
228
242
  },
229
243
  /**
230
244
  * Retrieves known incidents for all clusters.
@@ -241,7 +255,7 @@ function createMonitoringClient({
241
255
  queryParameters,
242
256
  headers
243
257
  };
244
- return transporter.request(request, requestOptions);
258
+ return this.transporter.request(request, requestOptions);
245
259
  },
246
260
  /**
247
261
  * Retrieves average times for indexing operations for selected clusters.
@@ -263,7 +277,7 @@ function createMonitoringClient({
263
277
  queryParameters,
264
278
  headers
265
279
  };
266
- return transporter.request(request, requestOptions);
280
+ return this.transporter.request(request, requestOptions);
267
281
  },
268
282
  /**
269
283
  * Retrieves the average latency for search requests for selected clusters.
@@ -285,7 +299,7 @@ function createMonitoringClient({
285
299
  queryParameters,
286
300
  headers
287
301
  };
288
- return transporter.request(request, requestOptions);
302
+ return this.transporter.request(request, requestOptions);
289
303
  },
290
304
  /**
291
305
  * Retrieves metrics related to your Algolia infrastructure, aggregated over a selected time window. Access to this API is available as part of the [Premium or Elevate plans](https://www.algolia.com/pricing). You must authenticate requests with the `x-algolia-application-id` and `x-algolia-api-key` headers (using the Monitoring API key).
@@ -311,7 +325,7 @@ function createMonitoringClient({
311
325
  queryParameters,
312
326
  headers
313
327
  };
314
- return transporter.request(request, requestOptions);
328
+ return this.transporter.request(request, requestOptions);
315
329
  },
316
330
  /**
317
331
  * Test whether clusters are reachable or not.
@@ -333,7 +347,7 @@ function createMonitoringClient({
333
347
  queryParameters,
334
348
  headers
335
349
  };
336
- return transporter.request(request, requestOptions);
350
+ return this.transporter.request(request, requestOptions);
337
351
  },
338
352
  /**
339
353
  * Retrieves the servers that belong to clusters. The response depends on whether you authenticate your API request: - With authentication, the response lists the servers assigned to your Algolia application\'s cluster. - Without authentication, the response lists the servers for all Algolia clusters.
@@ -350,7 +364,7 @@ function createMonitoringClient({
350
364
  queryParameters,
351
365
  headers
352
366
  };
353
- return transporter.request(request, requestOptions);
367
+ return this.transporter.request(request, requestOptions);
354
368
  },
355
369
  /**
356
370
  * Retrieves the status of all Algolia clusters and instances.
@@ -367,7 +381,7 @@ function createMonitoringClient({
367
381
  queryParameters,
368
382
  headers
369
383
  };
370
- return transporter.request(request, requestOptions);
384
+ return this.transporter.request(request, requestOptions);
371
385
  }
372
386
  };
373
387
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../builds/node.ts","../../src/monitoringClient.ts"],"sourcesContent":["// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nimport type { ClientOptions } from '@algolia/client-common';\nimport {\n createMemoryCache,\n createNullCache,\n DEFAULT_CONNECT_TIMEOUT_NODE,\n DEFAULT_READ_TIMEOUT_NODE,\n DEFAULT_WRITE_TIMEOUT_NODE,\n} from '@algolia/client-common';\nimport { createHttpRequester } from '@algolia/requester-node-http';\n\nimport { createMonitoringClient } from '../src/monitoringClient';\n\nexport { apiClientVersion } from '../src/monitoringClient';\nexport * from '../model';\n\n/**\n * The client type.\n */\nexport type MonitoringClient = ReturnType<typeof monitoringClient>;\n\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport function monitoringClient(appId: string, apiKey: string, options?: ClientOptions) {\n if (!appId || typeof appId !== 'string') {\n throw new Error('`appId` is missing.');\n }\n\n if (!apiKey || typeof apiKey !== 'string') {\n throw new Error('`apiKey` is missing.');\n }\n\n return {\n ...createMonitoringClient({\n appId,\n apiKey,\n timeouts: {\n connect: DEFAULT_CONNECT_TIMEOUT_NODE,\n read: DEFAULT_READ_TIMEOUT_NODE,\n write: DEFAULT_WRITE_TIMEOUT_NODE,\n },\n requester: createHttpRequester(),\n algoliaAgents: [{ segment: 'Node.js', version: process.versions.node }],\n responsesCache: createNullCache(),\n requestsCache: createNullCache(),\n hostsCache: createMemoryCache(),\n ...options,\n }),\n };\n}\n","// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nimport { createAuth, createTransporter, getAlgoliaAgent } from '@algolia/client-common';\nimport type {\n CreateClientOptions,\n Headers,\n Host,\n QueryParameters,\n Request,\n RequestOptions,\n} from '@algolia/client-common';\n\nimport type {\n CustomDeleteProps,\n CustomGetProps,\n CustomPostProps,\n CustomPutProps,\n GetClusterIncidentsProps,\n GetClusterStatusProps,\n GetIndexingTimeProps,\n GetLatencyProps,\n GetMetricsProps,\n GetReachabilityProps,\n} from '../model/clientMethodProps';\nimport type { IncidentsResponse } from '../model/incidentsResponse';\nimport type { IndexingTimeResponse } from '../model/indexingTimeResponse';\nimport type { InfrastructureResponse } from '../model/infrastructureResponse';\nimport type { InventoryResponse } from '../model/inventoryResponse';\nimport type { LatencyResponse } from '../model/latencyResponse';\nimport type { StatusResponse } from '../model/statusResponse';\n\nexport const apiClientVersion = '1.2.5';\n\nfunction getDefaultHosts(): Host[] {\n return [{ url: 'status.algolia.com', accept: 'readWrite', protocol: 'https' }];\n}\n\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport function createMonitoringClient({\n appId: appIdOption,\n apiKey: apiKeyOption,\n authMode,\n algoliaAgents,\n ...options\n}: CreateClientOptions) {\n const auth = createAuth(appIdOption, apiKeyOption, authMode);\n const transporter = createTransporter({\n hosts: getDefaultHosts(),\n ...options,\n algoliaAgent: getAlgoliaAgent({\n algoliaAgents,\n client: 'Monitoring',\n version: apiClientVersion,\n }),\n baseHeaders: {\n 'content-type': 'text/plain',\n ...auth.headers(),\n ...options.baseHeaders,\n },\n baseQueryParameters: {\n ...auth.queryParameters(),\n ...options.baseQueryParameters,\n },\n });\n\n return {\n transporter,\n\n /**\n * The `appId` currently in use.\n */\n appId: appIdOption,\n\n /**\n * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.\n */\n clearCache(): Promise<void> {\n return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => undefined);\n },\n\n /**\n * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.\n */\n get _ua(): string {\n return transporter.algoliaAgent.value;\n },\n\n /**\n * Adds a `segment` to the `x-algolia-agent` sent with every requests.\n *\n * @param segment - The algolia agent (user-agent) segment to add.\n * @param version - The version of the agent.\n */\n addAlgoliaAgent(segment: string, version?: string): void {\n transporter.algoliaAgent.add({ segment, version });\n },\n\n /**\n * This method allow you to send requests to the Algolia REST API.\n *\n * @param customDelete - The customDelete object.\n * @param customDelete.path - Path of the endpoint, anything after \\\"/1\\\" must be specified.\n * @param customDelete.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customDelete(\n { path, parameters }: CustomDeleteProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customDelete`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method allow you to send requests to the Algolia REST API.\n *\n * @param customGet - The customGet object.\n * @param customGet.path - Path of the endpoint, anything after \\\"/1\\\" must be specified.\n * @param customGet.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customGet`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method allow you to send requests to the Algolia REST API.\n *\n * @param customPost - The customPost object.\n * @param customPost.path - Path of the endpoint, anything after \\\"/1\\\" must be specified.\n * @param customPost.parameters - Query parameters to apply to the current query.\n * @param customPost.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPost(\n { path, parameters, body }: CustomPostProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customPost`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method allow you to send requests to the Algolia REST API.\n *\n * @param customPut - The customPut object.\n * @param customPut.path - Path of the endpoint, anything after \\\"/1\\\" must be specified.\n * @param customPut.parameters - Query parameters to apply to the current query.\n * @param customPut.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPut(\n { path, parameters, body }: CustomPutProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customPut`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'PUT',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves known incidents for the selected clusters.\n *\n * @param getClusterIncidents - The getClusterIncidents object.\n * @param getClusterIncidents.clusters - Subset of clusters, separated by comma.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getClusterIncidents(\n { clusters }: GetClusterIncidentsProps,\n requestOptions?: RequestOptions,\n ): Promise<IncidentsResponse> {\n if (!clusters) {\n throw new Error('Parameter `clusters` is required when calling `getClusterIncidents`.');\n }\n\n const requestPath = '/1/incidents/{clusters}'.replace('{clusters}', encodeURIComponent(clusters));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves the status of selected clusters.\n *\n * @param getClusterStatus - The getClusterStatus object.\n * @param getClusterStatus.clusters - Subset of clusters, separated by comma.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getClusterStatus({ clusters }: GetClusterStatusProps, requestOptions?: RequestOptions): Promise<StatusResponse> {\n if (!clusters) {\n throw new Error('Parameter `clusters` is required when calling `getClusterStatus`.');\n }\n\n const requestPath = '/1/status/{clusters}'.replace('{clusters}', encodeURIComponent(clusters));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves known incidents for all clusters.\n *\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getIncidents(requestOptions?: RequestOptions): Promise<IncidentsResponse> {\n const requestPath = '/1/incidents';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves average times for indexing operations for selected clusters.\n *\n * @param getIndexingTime - The getIndexingTime object.\n * @param getIndexingTime.clusters - Subset of clusters, separated by comma.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getIndexingTime(\n { clusters }: GetIndexingTimeProps,\n requestOptions?: RequestOptions,\n ): Promise<IndexingTimeResponse> {\n if (!clusters) {\n throw new Error('Parameter `clusters` is required when calling `getIndexingTime`.');\n }\n\n const requestPath = '/1/indexing/{clusters}'.replace('{clusters}', encodeURIComponent(clusters));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves the average latency for search requests for selected clusters.\n *\n * @param getLatency - The getLatency object.\n * @param getLatency.clusters - Subset of clusters, separated by comma.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getLatency({ clusters }: GetLatencyProps, requestOptions?: RequestOptions): Promise<LatencyResponse> {\n if (!clusters) {\n throw new Error('Parameter `clusters` is required when calling `getLatency`.');\n }\n\n const requestPath = '/1/latency/{clusters}'.replace('{clusters}', encodeURIComponent(clusters));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves metrics related to your Algolia infrastructure, aggregated over a selected time window. Access to this API is available as part of the [Premium or Elevate plans](https://www.algolia.com/pricing). You must authenticate requests with the `x-algolia-application-id` and `x-algolia-api-key` headers (using the Monitoring API key).\n *\n * @param getMetrics - The getMetrics object.\n * @param getMetrics.metric - Metric to report. For more information about the individual metrics, see the description of the API response. To include all metrics, use `*`.\n * @param getMetrics.period - Period over which to aggregate the metrics: - `minute`. Aggregate the last minute. 1 data point per 10 seconds. - `hour`. Aggregate the last hour. 1 data point per minute. - `day`. Aggregate the last day. 1 data point per 10 minutes. - `week`. Aggregate the last week. 1 data point per hour. - `month`. Aggregate the last month. 1 data point per day.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getMetrics({ metric, period }: GetMetricsProps, requestOptions?: RequestOptions): Promise<InfrastructureResponse> {\n if (!metric) {\n throw new Error('Parameter `metric` is required when calling `getMetrics`.');\n }\n\n if (!period) {\n throw new Error('Parameter `period` is required when calling `getMetrics`.');\n }\n\n const requestPath = '/1/infrastructure/{metric}/period/{period}'\n .replace('{metric}', encodeURIComponent(metric))\n .replace('{period}', encodeURIComponent(period));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Test whether clusters are reachable or not.\n *\n * @param getReachability - The getReachability object.\n * @param getReachability.clusters - Subset of clusters, separated by comma.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getReachability(\n { clusters }: GetReachabilityProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, Record<string, boolean>>> {\n if (!clusters) {\n throw new Error('Parameter `clusters` is required when calling `getReachability`.');\n }\n\n const requestPath = '/1/reachability/{clusters}/probes'.replace('{clusters}', encodeURIComponent(clusters));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves the servers that belong to clusters. The response depends on whether you authenticate your API request: - With authentication, the response lists the servers assigned to your Algolia application\\'s cluster. - Without authentication, the response lists the servers for all Algolia clusters.\n *\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getServers(requestOptions?: RequestOptions): Promise<InventoryResponse> {\n const requestPath = '/1/inventory/servers';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves the status of all Algolia clusters and instances.\n *\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getStatus(requestOptions?: RequestOptions): Promise<StatusResponse> {\n const requestPath = '/1/status';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,IAAAA,wBAMO;AACP,iCAAoC;;;ACRpC,2BAA+D;AA6BxD,IAAM,mBAAmB;AAEhC,SAAS,kB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;AACF;;;AD3aO,SAAS,iBAAiB,OAAe,QAAgB,SAAyB;AACvF,MAAI,CAAC,SAAS,OAAO,UAAU,UAAU;AACvC,UAAM,IAAI,MAAM,qBAAqB;AAAA,EACvC;AAEA,MAAI,CAAC,UAAU,OAAO,WAAW,UAAU;AACzC,UAAM,IAAI,MAAM,sBAAsB;AAAA,EACxC;AAEA,SAAO;AAAA,IACL,GAAG,uBAAuB;AAAA,MACxB;AAAA,MACA;AAAA,MACA,UAAU;AAAA,QACR,SAAS;AAAA,QACT,MAAM;AAAA,QACN,OAAO;AAAA,MACT;AAAA,MACA,eAAW,gDAAoB;AAAA,MAC/B,eAAe,CAAC,EAAE,SAAS,WAAW,SAAS,QAAQ,SAAS,KAAK,CAAC;AAAA,MACtE,oBAAgB,uCAAgB;AAAA,MAChC,mBAAe,uCAAgB;AAAA,MAC/B,gBAAY,yCAAkB;AAAA,MAC9B,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;","names":["import_client_common"]}
1
+ {"version":3,"sources":["../../builds/node.ts","../../src/monitoringClient.ts"],"sourcesContent":["// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nimport type { ClientOptions } from '@algolia/client-common';\nimport {\n createMemoryCache,\n createNullCache,\n DEFAULT_CONNECT_TIMEOUT_NODE,\n DEFAULT_READ_TIMEOUT_NODE,\n DEFAULT_WRITE_TIMEOUT_NODE,\n} from '@algolia/client-common';\nimport { createHttpRequester } from '@algolia/requester-node-http';\n\nimport { createMonitoringClient } from '../src/monitoringClient';\n\nexport type MonitoringClient = ReturnType<typeof createMonitoringClient>;\n\nexport { apiClientVersion } from '../src/monitoringClient';\nexport * from '../model';\n\nexport function monitoringClient(appId: string, apiKey: string, options?: ClientOptions): MonitoringClient {\n if (!appId || typeof appId !== 'string') {\n throw new Error('`appId` is missing.');\n }\n\n if (!apiKey || typeof apiKey !== 'string') {\n throw new Error('`apiKey` is missing.');\n }\n\n return {\n ...createMonitoringClient({\n appId,\n apiKey,\n timeouts: {\n connect: DEFAULT_CONNECT_TIMEOUT_NODE,\n read: DEFAULT_READ_TIMEOUT_NODE,\n write: DEFAULT_WRITE_TIMEOUT_NODE,\n },\n requester: createHttpRequester(),\n algoliaAgents: [{ segment: 'Node.js', version: process.versions.node }],\n responsesCache: createNullCache(),\n requestsCache: createNullCache(),\n hostsCache: createMemoryCache(),\n ...options,\n }),\n };\n}\n","// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nimport { createAuth, createTransporter, getAlgoliaAgent } from '@algolia/client-common';\nimport type {\n CreateClientOptions,\n Headers,\n Host,\n QueryParameters,\n Request,\n RequestOptions,\n} from '@algolia/client-common';\n\nimport type {\n CustomDeleteProps,\n CustomGetProps,\n CustomPostProps,\n CustomPutProps,\n GetClusterIncidentsProps,\n GetClusterStatusProps,\n GetIndexingTimeProps,\n GetLatencyProps,\n GetMetricsProps,\n GetReachabilityProps,\n} from '../model/clientMethodProps';\nimport type { IncidentsResponse } from '../model/incidentsResponse';\nimport type { IndexingTimeResponse } from '../model/indexingTimeResponse';\nimport type { InfrastructureResponse } from '../model/infrastructureResponse';\nimport type { InventoryResponse } from '../model/inventoryResponse';\nimport type { LatencyResponse } from '../model/latencyResponse';\nimport type { StatusResponse } from '../model/statusResponse';\n\nexport const apiClientVersion = '1.3.1';\n\nfunction getDefaultHosts(): Host[] {\n return [{ url: 'status.algolia.com', accept: 'readWrite', protocol: 'https' }];\n}\n\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport function createMonitoringClient({\n appId: appIdOption,\n apiKey: apiKeyOption,\n authMode,\n algoliaAgents,\n ...options\n}: CreateClientOptions) {\n const auth = createAuth(appIdOption, apiKeyOption, authMode);\n\n return {\n transporter: createTransporter({\n hosts: getDefaultHosts(),\n ...options,\n algoliaAgent: getAlgoliaAgent({\n algoliaAgents,\n client: 'Monitoring',\n version: apiClientVersion,\n }),\n baseHeaders: {\n 'content-type': 'text/plain',\n ...auth.headers(),\n ...options.baseHeaders,\n },\n baseQueryParameters: {\n ...auth.queryParameters(),\n ...options.baseQueryParameters,\n },\n }),\n\n /**\n * The `appId` currently in use.\n */\n appId: appIdOption,\n\n /**\n * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.\n */\n clearCache(): Promise<void> {\n return Promise.all([this.transporter.requestsCache.clear(), this.transporter.responsesCache.clear()]).then(\n () => undefined,\n );\n },\n\n /**\n * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.\n */\n get _ua(): string {\n return this.transporter.algoliaAgent.value;\n },\n\n /**\n * Adds a `segment` to the `x-algolia-agent` sent with every requests.\n *\n * @param segment - The algolia agent (user-agent) segment to add.\n * @param version - The version of the agent.\n */\n addAlgoliaAgent(segment: string, version?: string): void {\n this.transporter.algoliaAgent.add({ segment, version });\n },\n\n /**\n * Helper method to switch the API key used to authenticate the requests.\n *\n * @param params - Method params.\n * @param params.apiKey - The new API Key to use.\n */\n setClientApiKey({ apiKey }: { apiKey: string }): void {\n if (!authMode || authMode === 'WithinHeaders') {\n this.transporter.baseHeaders['x-algolia-api-key'] = apiKey;\n } else {\n this.transporter.baseQueryParameters['x-algolia-api-key'] = apiKey;\n }\n },\n\n /**\n * This method allow you to send requests to the Algolia REST API.\n *\n * @param customDelete - The customDelete object.\n * @param customDelete.path - Path of the endpoint, anything after \\\"/1\\\" must be specified.\n * @param customDelete.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customDelete(\n { path, parameters }: CustomDeleteProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customDelete`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return this.transporter.request(request, requestOptions);\n },\n\n /**\n * This method allow you to send requests to the Algolia REST API.\n *\n * @param customGet - The customGet object.\n * @param customGet.path - Path of the endpoint, anything after \\\"/1\\\" must be specified.\n * @param customGet.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customGet`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return this.transporter.request(request, requestOptions);\n },\n\n /**\n * This method allow you to send requests to the Algolia REST API.\n *\n * @param customPost - The customPost object.\n * @param customPost.path - Path of the endpoint, anything after \\\"/1\\\" must be specified.\n * @param customPost.parameters - Query parameters to apply to the current query.\n * @param customPost.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPost(\n { path, parameters, body }: CustomPostProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customPost`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return this.transporter.request(request, requestOptions);\n },\n\n /**\n * This method allow you to send requests to the Algolia REST API.\n *\n * @param customPut - The customPut object.\n * @param customPut.path - Path of the endpoint, anything after \\\"/1\\\" must be specified.\n * @param customPut.parameters - Query parameters to apply to the current query.\n * @param customPut.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPut(\n { path, parameters, body }: CustomPutProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customPut`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'PUT',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return this.transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves known incidents for the selected clusters.\n *\n * @param getClusterIncidents - The getClusterIncidents object.\n * @param getClusterIncidents.clusters - Subset of clusters, separated by comma.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getClusterIncidents(\n { clusters }: GetClusterIncidentsProps,\n requestOptions?: RequestOptions,\n ): Promise<IncidentsResponse> {\n if (!clusters) {\n throw new Error('Parameter `clusters` is required when calling `getClusterIncidents`.');\n }\n\n const requestPath = '/1/incidents/{clusters}'.replace('{clusters}', encodeURIComponent(clusters));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return this.transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves the status of selected clusters.\n *\n * @param getClusterStatus - The getClusterStatus object.\n * @param getClusterStatus.clusters - Subset of clusters, separated by comma.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getClusterStatus({ clusters }: GetClusterStatusProps, requestOptions?: RequestOptions): Promise<StatusResponse> {\n if (!clusters) {\n throw new Error('Parameter `clusters` is required when calling `getClusterStatus`.');\n }\n\n const requestPath = '/1/status/{clusters}'.replace('{clusters}', encodeURIComponent(clusters));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return this.transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves known incidents for all clusters.\n *\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getIncidents(requestOptions?: RequestOptions): Promise<IncidentsResponse> {\n const requestPath = '/1/incidents';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return this.transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves average times for indexing operations for selected clusters.\n *\n * @param getIndexingTime - The getIndexingTime object.\n * @param getIndexingTime.clusters - Subset of clusters, separated by comma.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getIndexingTime(\n { clusters }: GetIndexingTimeProps,\n requestOptions?: RequestOptions,\n ): Promise<IndexingTimeResponse> {\n if (!clusters) {\n throw new Error('Parameter `clusters` is required when calling `getIndexingTime`.');\n }\n\n const requestPath = '/1/indexing/{clusters}'.replace('{clusters}', encodeURIComponent(clusters));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return this.transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves the average latency for search requests for selected clusters.\n *\n * @param getLatency - The getLatency object.\n * @param getLatency.clusters - Subset of clusters, separated by comma.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getLatency({ clusters }: GetLatencyProps, requestOptions?: RequestOptions): Promise<LatencyResponse> {\n if (!clusters) {\n throw new Error('Parameter `clusters` is required when calling `getLatency`.');\n }\n\n const requestPath = '/1/latency/{clusters}'.replace('{clusters}', encodeURIComponent(clusters));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return this.transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves metrics related to your Algolia infrastructure, aggregated over a selected time window. Access to this API is available as part of the [Premium or Elevate plans](https://www.algolia.com/pricing). You must authenticate requests with the `x-algolia-application-id` and `x-algolia-api-key` headers (using the Monitoring API key).\n *\n * @param getMetrics - The getMetrics object.\n * @param getMetrics.metric - Metric to report. For more information about the individual metrics, see the description of the API response. To include all metrics, use `*`.\n * @param getMetrics.period - Period over which to aggregate the metrics: - `minute`. Aggregate the last minute. 1 data point per 10 seconds. - `hour`. Aggregate the last hour. 1 data point per minute. - `day`. Aggregate the last day. 1 data point per 10 minutes. - `week`. Aggregate the last week. 1 data point per hour. - `month`. Aggregate the last month. 1 data point per day.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getMetrics({ metric, period }: GetMetricsProps, requestOptions?: RequestOptions): Promise<InfrastructureResponse> {\n if (!metric) {\n throw new Error('Parameter `metric` is required when calling `getMetrics`.');\n }\n\n if (!period) {\n throw new Error('Parameter `period` is required when calling `getMetrics`.');\n }\n\n const requestPath = '/1/infrastructure/{metric}/period/{period}'\n .replace('{metric}', encodeURIComponent(metric))\n .replace('{period}', encodeURIComponent(period));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return this.transporter.request(request, requestOptions);\n },\n\n /**\n * Test whether clusters are reachable or not.\n *\n * @param getReachability - The getReachability object.\n * @param getReachability.clusters - Subset of clusters, separated by comma.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getReachability(\n { clusters }: GetReachabilityProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, Record<string, boolean>>> {\n if (!clusters) {\n throw new Error('Parameter `clusters` is required when calling `getReachability`.');\n }\n\n const requestPath = '/1/reachability/{clusters}/probes'.replace('{clusters}', encodeURIComponent(clusters));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return this.transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves the servers that belong to clusters. The response depends on whether you authenticate your API request: - With authentication, the response lists the servers assigned to your Algolia application\\'s cluster. - Without authentication, the response lists the servers for all Algolia clusters.\n *\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getServers(requestOptions?: RequestOptions): Promise<InventoryResponse> {\n const requestPath = '/1/inventory/servers';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return this.transporter.request(request, requestOptions);\n },\n\n /**\n * Retrieves the status of all Algolia clusters and instances.\n *\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n getStatus(requestOptions?: RequestOptions): Promise<StatusResponse> {\n const requestPath = '/1/status';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return this.transporter.request(request, requestOptions);\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,IAAAA,wBAMO;AACP,iCAAoC;;;ACRpC,2BAA+D;AA6BxD,IAAM,mBAAmB;AAEhC,SAAS,kBAA0B;AACjC,SAAO,CAAC,EAAE,KAAK,sBAAsB,QAAQ,aAAa,UAAU,QAAQ,CAAC;AAC/E;AAGO,SAAS,uBAAuB;AAAA,EACrC,OAAO;AAAA,EACP,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAwB;AACtB,QAAM,WAAO,iCAAW,aAAa,cAAc,QAAQ;AAE3D,SAAO;AAAA,IACL,iBAAa,wCAAkB;AAAA,MAC7B,OAAO,gBAAgB;AAAA,MACvB,GAAG;AAAA,MACH,kBAAc,sCAAgB;AAAA,QAC5B;AAAA,QACA,QAAQ;AAAA,QACR,SAAS;AAAA,MACX,CAAC;AAAA,MACD,aAAa;AAAA,QACX,gBAAgB;AAAA,QAChB,GAAG,KAAK,QAAQ;AAAA,QAChB,GAA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U,OAAO,WAAW,UAAU;AACzC,UAAM,IAAI,MAAM,sBAAsB;AAAA,EACxC;AAEA,SAAO;AAAA,IACL,GAAG,uBAAuB;AAAA,MACxB;AAAA,MACA;AAAA,MACA,UAAU;AAAA,QACR,SAAS;AAAA,QACT,MAAM;AAAA,QACN,OAAO;AAAA,MACT;AAAA,MACA,eAAW,gDAAoB;AAAA,MAC/B,eAAe,CAAC,EAAE,SAAS,WAAW,SAAS,QAAQ,SAAS,KAAK,CAAC;AAAA,MACtE,oBAAgB,uCAAgB;AAAA,MAChC,mBAAe,uCAAgB;AAAA,MAC/B,gBAAY,yCAAkB;AAAA,MAC9B,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;","names":["import_client_common"]}
@@ -10,7 +10,7 @@ import { createHttpRequester } from "@algolia/requester-node-http";
10
10
 
11
11
  // src/monitoringClient.ts
12
12
  import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
13
- var apiClientVersion = "1.2.5";
13
+ var apiClientVersion = "1.3.1";
14
14
  function getDefaultHosts() {
15
15
  return [{ url: "status.algolia.com", accept: "readWrite", protocol: "https" }];
16
16
  }
@@ -22,26 +22,25 @@ function createMonitoringClient({
22
22
  ...options
23
23
  }) {
24
24
  const auth = createAuth(appIdOption, apiKeyOption, authMode);
25
- const transporter = createTransporter({
26
- hosts: getDefaultHosts(),
27
- ...options,
28
- algoliaAgent: getAlgoliaAgent({
29
- algoliaAgents,
30
- client: "Monitoring",
31
- version: apiClientVersion
32
- }),
33
- baseHeaders: {
34
- "content-type": "text/plain",
35
- ...auth.headers(),
36
- ...options.baseHeaders
37
- },
38
- baseQueryParameters: {
39
- ...auth.queryParameters(),
40
- ...options.baseQueryParameters
41
- }
42
- });
43
25
  return {
44
- transporter,
26
+ transporter: createTransporter({
27
+ hosts: getDefaultHosts(),
28
+ ...options,
29
+ algoliaAgent: getAlgoliaAgent({
30
+ algoliaAgents,
31
+ client: "Monitoring",
32
+ version: apiClientVersion
33
+ }),
34
+ baseHeaders: {
35
+ "content-type": "text/plain",
36
+ ...auth.headers(),
37
+ ...options.baseHeaders
38
+ },
39
+ baseQueryParameters: {
40
+ ...auth.queryParameters(),
41
+ ...options.baseQueryParameters
42
+ }
43
+ }),
45
44
  /**
46
45
  * The `appId` currently in use.
47
46
  */
@@ -50,13 +49,15 @@ function createMonitoringClient({
50
49
  * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
51
50
  */
52
51
  clearCache() {
53
- return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
52
+ return Promise.all([this.transporter.requestsCache.clear(), this.transporter.responsesCache.clear()]).then(
53
+ () => void 0
54
+ );
54
55
  },
55
56
  /**
56
57
  * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
57
58
  */
58
59
  get _ua() {
59
- return transporter.algoliaAgent.value;
60
+ return this.transporter.algoliaAgent.value;
60
61
  },
61
62
  /**
62
63
  * Adds a `segment` to the `x-algolia-agent` sent with every requests.
@@ -65,7 +66,20 @@ function createMonitoringClient({
65
66
  * @param version - The version of the agent.
66
67
  */
67
68
  addAlgoliaAgent(segment, version) {
68
- transporter.algoliaAgent.add({ segment, version });
69
+ this.transporter.algoliaAgent.add({ segment, version });
70
+ },
71
+ /**
72
+ * Helper method to switch the API key used to authenticate the requests.
73
+ *
74
+ * @param params - Method params.
75
+ * @param params.apiKey - The new API Key to use.
76
+ */
77
+ setClientApiKey({ apiKey }) {
78
+ if (!authMode || authMode === "WithinHeaders") {
79
+ this.transporter.baseHeaders["x-algolia-api-key"] = apiKey;
80
+ } else {
81
+ this.transporter.baseQueryParameters["x-algolia-api-key"] = apiKey;
82
+ }
69
83
  },
70
84
  /**
71
85
  * This method allow you to send requests to the Algolia REST API.
@@ -88,7 +102,7 @@ function createMonitoringClient({
88
102
  queryParameters,
89
103
  headers
90
104
  };
91
- return transporter.request(request, requestOptions);
105
+ return this.transporter.request(request, requestOptions);
92
106
  },
93
107
  /**
94
108
  * This method allow you to send requests to the Algolia REST API.
@@ -111,7 +125,7 @@ function createMonitoringClient({
111
125
  queryParameters,
112
126
  headers
113
127
  };
114
- return transporter.request(request, requestOptions);
128
+ return this.transporter.request(request, requestOptions);
115
129
  },
116
130
  /**
117
131
  * This method allow you to send requests to the Algolia REST API.
@@ -136,7 +150,7 @@ function createMonitoringClient({
136
150
  headers,
137
151
  data: body ? body : {}
138
152
  };
139
- return transporter.request(request, requestOptions);
153
+ return this.transporter.request(request, requestOptions);
140
154
  },
141
155
  /**
142
156
  * This method allow you to send requests to the Algolia REST API.
@@ -161,7 +175,7 @@ function createMonitoringClient({
161
175
  headers,
162
176
  data: body ? body : {}
163
177
  };
164
- return transporter.request(request, requestOptions);
178
+ return this.transporter.request(request, requestOptions);
165
179
  },
166
180
  /**
167
181
  * Retrieves known incidents for the selected clusters.
@@ -183,7 +197,7 @@ function createMonitoringClient({
183
197
  queryParameters,
184
198
  headers
185
199
  };
186
- return transporter.request(request, requestOptions);
200
+ return this.transporter.request(request, requestOptions);
187
201
  },
188
202
  /**
189
203
  * Retrieves the status of selected clusters.
@@ -205,7 +219,7 @@ function createMonitoringClient({
205
219
  queryParameters,
206
220
  headers
207
221
  };
208
- return transporter.request(request, requestOptions);
222
+ return this.transporter.request(request, requestOptions);
209
223
  },
210
224
  /**
211
225
  * Retrieves known incidents for all clusters.
@@ -222,7 +236,7 @@ function createMonitoringClient({
222
236
  queryParameters,
223
237
  headers
224
238
  };
225
- return transporter.request(request, requestOptions);
239
+ return this.transporter.request(request, requestOptions);
226
240
  },
227
241
  /**
228
242
  * Retrieves average times for indexing operations for selected clusters.
@@ -244,7 +258,7 @@ function createMonitoringClient({
244
258
  queryParameters,
245
259
  headers
246
260
  };
247
- return transporter.request(request, requestOptions);
261
+ return this.transporter.request(request, requestOptions);
248
262
  },
249
263
  /**
250
264
  * Retrieves the average latency for search requests for selected clusters.
@@ -266,7 +280,7 @@ function createMonitoringClient({
266
280
  queryParameters,
267
281
  headers
268
282
  };
269
- return transporter.request(request, requestOptions);
283
+ return this.transporter.request(request, requestOptions);
270
284
  },
271
285
  /**
272
286
  * Retrieves metrics related to your Algolia infrastructure, aggregated over a selected time window. Access to this API is available as part of the [Premium or Elevate plans](https://www.algolia.com/pricing). You must authenticate requests with the `x-algolia-application-id` and `x-algolia-api-key` headers (using the Monitoring API key).
@@ -292,7 +306,7 @@ function createMonitoringClient({
292
306
  queryParameters,
293
307
  headers
294
308
  };
295
- return transporter.request(request, requestOptions);
309
+ return this.transporter.request(request, requestOptions);
296
310
  },
297
311
  /**
298
312
  * Test whether clusters are reachable or not.
@@ -314,7 +328,7 @@ function createMonitoringClient({
314
328
  queryParameters,
315
329
  headers
316
330
  };
317
- return transporter.request(request, requestOptions);
331
+ return this.transporter.request(request, requestOptions);
318
332
  },
319
333
  /**
320
334
  * Retrieves the servers that belong to clusters. The response depends on whether you authenticate your API request: - With authentication, the response lists the servers assigned to your Algolia application\'s cluster. - Without authentication, the response lists the servers for all Algolia clusters.
@@ -331,7 +345,7 @@ function createMonitoringClient({
331
345
  queryParameters,
332
346
  headers
333
347
  };
334
- return transporter.request(request, requestOptions);
348
+ return this.transporter.request(request, requestOptions);
335
349
  },
336
350
  /**
337
351
  * Retrieves the status of all Algolia clusters and instances.
@@ -348,7 +362,7 @@ function createMonitoringClient({
348
362
  queryParameters,
349
363
  headers
350
364
  };
351
- return transporter.request(request, requestOptions);
365
+ return this.transporter.request(request, requestOptions);
352
366
  }
353
367
  };
354
368
  }