@algolia/monitoring 1.1.1 → 1.2.2

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.
package/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
  <a href="https://npmjs.org/package/@algolia/monitoring"><img src="https://img.shields.io/npm/v/@algolia/monitoring.svg?style=flat-square" alt="NPM version"></img></a>
10
10
  <a href="http://npm-stat.com/charts.html?package=@algolia/monitoring"><img src="https://img.shields.io/npm/dm/@algolia/monitoring.svg?style=flat-square" alt="NPM downloads"></a>
11
11
  <a href="https://www.jsdelivr.com/package/npm/@algolia/monitoring"><img src="https://data.jsdelivr.com/v1/package/npm/@algolia/monitoring/badge" alt="jsDelivr Downloads"></img></a>
12
- <a href="LICENSE.md"><img src="https://img.shields.io/badge/license-MIT-green.svg?style=flat-square" alt="License"></a>
12
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green.svg?style=flat-square" alt="License"></a>
13
13
  </p>
14
14
  </p>
15
15
 
@@ -11,10 +11,10 @@ export declare function monitoringClient(appId: string, apiKey: string, options?
11
11
  clearCache(): Promise<void>;
12
12
  readonly _ua: string;
13
13
  addAlgoliaAgent(segment: string, version?: string): void;
14
- customDelete({ path, parameters }: import("../model").CustomDeleteProps, requestOptions?: import("@algolia/client-common").RequestOptions): Promise<Record<string, any>>;
15
- customGet({ path, parameters }: import("../model").CustomGetProps, requestOptions?: import("@algolia/client-common").RequestOptions): Promise<Record<string, any>>;
16
- customPost({ path, parameters, body }: import("../model").CustomPostProps, requestOptions?: import("@algolia/client-common").RequestOptions): Promise<Record<string, any>>;
17
- customPut({ path, parameters, body }: import("../model").CustomPutProps, requestOptions?: import("@algolia/client-common").RequestOptions): Promise<Record<string, any>>;
14
+ customDelete({ path, parameters }: import("../model").CustomDeleteProps, requestOptions?: import("@algolia/client-common").RequestOptions): Promise<Record<string, unknown>>;
15
+ customGet({ path, parameters }: import("../model").CustomGetProps, requestOptions?: import("@algolia/client-common").RequestOptions): Promise<Record<string, unknown>>;
16
+ customPost({ path, parameters, body }: import("../model").CustomPostProps, requestOptions?: import("@algolia/client-common").RequestOptions): Promise<Record<string, unknown>>;
17
+ customPut({ path, parameters, body }: import("../model").CustomPutProps, requestOptions?: import("@algolia/client-common").RequestOptions): Promise<Record<string, unknown>>;
18
18
  getClusterIncidents({ clusters }: import("../model").GetClusterIncidentsProps, requestOptions?: import("@algolia/client-common").RequestOptions): Promise<import("../model").IncidentsResponse>;
19
19
  getClusterStatus({ clusters }: import("../model").GetClusterStatusProps, requestOptions?: import("@algolia/client-common").RequestOptions): Promise<import("../model").StatusResponse>;
20
20
  getIncidents(requestOptions?: import("@algolia/client-common").RequestOptions): Promise<import("../model").IncidentsResponse>;
@@ -1 +1 @@
1
- {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../builds/browser.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAgB5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,cAAc,UAAU,CAAC;AAEzB;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAGnE,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,aAAa;;;;;;;;;;;;;;;;;;;EA+BxB"}
1
+ {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../builds/browser.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAa5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,cAAc,UAAU,CAAC;AAEzB;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAGnE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa;;;;;;;;;;;;;;;;;;;EA2BtF"}
@@ -11,10 +11,10 @@ export declare function monitoringClient(appId: string, apiKey: string, options?
11
11
  clearCache(): Promise<void>;
12
12
  _ua: string;
13
13
  addAlgoliaAgent(segment: string, version?: string): void;
14
- customDelete({ path, parameters }: import("../model").CustomDeleteProps, requestOptions?: import("@algolia/client-common").RequestOptions): Promise<Record<string, any>>;
15
- customGet({ path, parameters }: import("../model").CustomGetProps, requestOptions?: import("@algolia/client-common").RequestOptions): Promise<Record<string, any>>;
16
- customPost({ path, parameters, body }: import("../model").CustomPostProps, requestOptions?: import("@algolia/client-common").RequestOptions): Promise<Record<string, any>>;
17
- customPut({ path, parameters, body }: import("../model").CustomPutProps, requestOptions?: import("@algolia/client-common").RequestOptions): Promise<Record<string, any>>;
14
+ customDelete({ path, parameters }: import("../model").CustomDeleteProps, requestOptions?: import("@algolia/client-common").RequestOptions): Promise<Record<string, unknown>>;
15
+ customGet({ path, parameters }: import("../model").CustomGetProps, requestOptions?: import("@algolia/client-common").RequestOptions): Promise<Record<string, unknown>>;
16
+ customPost({ path, parameters, body }: import("../model").CustomPostProps, requestOptions?: import("@algolia/client-common").RequestOptions): Promise<Record<string, unknown>>;
17
+ customPut({ path, parameters, body }: import("../model").CustomPutProps, requestOptions?: import("@algolia/client-common").RequestOptions): Promise<Record<string, unknown>>;
18
18
  getClusterIncidents({ clusters }: import("../model").GetClusterIncidentsProps, requestOptions?: import("@algolia/client-common").RequestOptions): Promise<import("../model").IncidentsResponse>;
19
19
  getClusterStatus({ clusters }: import("../model").GetClusterStatusProps, requestOptions?: import("@algolia/client-common").RequestOptions): Promise<import("../model").StatusResponse>;
20
20
  getIncidents(requestOptions?: import("@algolia/client-common").RequestOptions): Promise<import("../model").IncidentsResponse>;
@@ -1 +1 @@
1
- {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../builds/node.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAY5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,cAAc,UAAU,CAAC;AAEzB;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAGnE,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,aAAa;;;;;;;;;;;;;;;;;;;EA2BxB"}
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../builds/node.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAY5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,cAAc,UAAU,CAAC;AAEzB;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAGnE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa;;;;;;;;;;;;;;;;;;;EA0BtF"}
@@ -41,7 +41,7 @@ export type CustomPostProps = {
41
41
  /**
42
42
  * Parameters to send with the custom request.
43
43
  */
44
- body?: Record<string, any>;
44
+ body?: Record<string, unknown>;
45
45
  };
46
46
  /**
47
47
  * Properties for the `customPut` method.
@@ -58,7 +58,7 @@ export type CustomPutProps = {
58
58
  /**
59
59
  * Parameters to send with the custom request.
60
60
  */
61
- body?: Record<string, any>;
61
+ body?: Record<string, unknown>;
62
62
  };
63
63
  /**
64
64
  * Properties for the `getClusterIncidents` method.
@@ -1 +1 @@
1
- {"version":3,"file":"clientMethodProps.d.ts","sourceRoot":"","sources":["../../model/clientMethodProps.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,U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U,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACjC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"metric.d.ts","sourceRoot":"","sources":["../../model/metric.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,MAAM,GACd,GAAG,GACH,gBAAgB,GAChB,WAAW,GACX,oBAAoB,GACpB,kBAAkB,GAClB,WAAW,CAAC"}
1
+ {"version":3,"file":"metric.d.ts","sourceRoot":"","sources":["../../model/metric.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,MAAM,GAAG,GAAG,GAAG,gBAAgB,GAAG,WAAW,GAAG,oBAAoB,GAAG,kBAAkB,GAAG,WAAW,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../model/status.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,MAAM,MAAM,GACd,sBAAsB,GACtB,cAAc,GACd,aAAa,GACb,gBAAgB,CAAC"}
1
+ {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../model/status.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG,sBAAsB,GAAG,cAAc,GAAG,aAAa,GAAG,gBAAgB,CAAC"}
@@ -4,11 +4,9 @@ var clientCommon = require('@algolia/client-common');
4
4
  var requesterNodeHttp = require('@algolia/requester-node-http');
5
5
 
6
6
  // 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.
7
- const apiClientVersion = '1.1.1';
7
+ const apiClientVersion = '1.2.2';
8
8
  function getDefaultHosts() {
9
- return [
10
- { url: 'status.algolia.com', accept: 'readWrite', protocol: 'https' },
11
- ];
9
+ return [{ url: 'status.algolia.com', accept: 'readWrite', protocol: 'https' }];
12
10
  }
13
11
  // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
14
12
  function createMonitoringClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, ...options }) {
@@ -41,10 +39,7 @@ function createMonitoringClient({ appId: appIdOption, apiKey: apiKeyOption, auth
41
39
  * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
42
40
  */
43
41
  clearCache() {
44
- return Promise.all([
45
- transporter.requestsCache.clear(),
46
- transporter.responsesCache.clear(),
47
- ]).then(() => undefined);
42
+ return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => undefined);
48
43
  },
49
44
  /**
50
45
  * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
@@ -314,7 +314,7 @@ function deserializeFailure({
314
314
  return new DetailedApiError(parsed.message, status, parsed.error, stackFrame);
315
315
  }
316
316
  return new ApiError(parsed.message, status, stackFrame);
317
- } catch (e) {
317
+ } catch {
318
318
  // ..
319
319
  }
320
320
  return new ApiError(content, status, stackFrame);
@@ -442,14 +442,17 @@ function createTransporter({
442
442
  if (host === undefined) {
443
443
  throw new RetryError(stackTraceWithoutCredentials(stackTrace));
444
444
  }
445
- let responseTimeout = isRead ? requestOptions.timeouts?.read || timeouts.read : requestOptions.timeouts?.write || timeouts.write;
445
+ const timeout = {
446
+ ...timeouts,
447
+ ...requestOptions.timeouts
448
+ };
446
449
  const payload = {
447
450
  data,
448
451
  headers,
449
452
  method: request.method,
450
453
  url: serializeUrl(host, request.path, queryParameters),
451
- connectTimeout: getTimeout(timeoutsCount, requestOptions.timeouts?.connect || timeouts.connect),
452
- responseTimeout: getTimeout(timeoutsCount, responseTimeout)
454
+ connectTimeout: getTimeout(timeoutsCount, timeout.connect),
455
+ responseTimeout: getTimeout(timeoutsCount, isRead ? timeout.read : timeout.write)
453
456
  };
454
457
  /**
455
458
  * The stackFrame is pushed to the stackTrace so we
@@ -642,8 +645,7 @@ function createXhrRequester() {
642
645
  const connectTimeout = createTimeout(request.connectTimeout, 'Connection timeout');
643
646
  let responseTimeout;
644
647
  baseRequester.onreadystatechange = () => {
645
- if (baseRequester.readyState > baseRequester.OPENED &&
646
- responseTimeout === undefined) {
648
+ if (baseRequester.readyState > baseRequester.OPENED && responseTimeout === undefined) {
647
649
  clearTimeout(connectTimeout);
648
650
  responseTimeout = createTimeout(request.responseTimeout, 'Socket timeout');
649
651
  }
@@ -676,11 +678,9 @@ function createXhrRequester() {
676
678
  }
677
679
 
678
680
  // 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.
679
- const apiClientVersion = '1.1.1';
681
+ const apiClientVersion = '1.2.2';
680
682
  function getDefaultHosts() {
681
- return [
682
- { url: 'status.algolia.com', accept: 'readWrite', protocol: 'https' },
683
- ];
683
+ return [{ url: 'status.algolia.com', accept: 'readWrite', protocol: 'https' }];
684
684
  }
685
685
  // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
686
686
  function createMonitoringClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, ...options }) {
@@ -713,10 +713,7 @@ function createMonitoringClient({ appId: appIdOption, apiKey: apiKeyOption, auth
713
713
  * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
714
714
  */
715
715
  clearCache() {
716
- return Promise.all([
717
- transporter.requestsCache.clear(),
718
- transporter.responsesCache.clear(),
719
- ]).then(() => undefined);
716
+ return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => undefined);
720
717
  },
721
718
  /**
722
719
  * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
@@ -1044,10 +1041,7 @@ function monitoringClient(appId, apiKey, options) {
1044
1041
  responsesCache: createMemoryCache(),
1045
1042
  requestsCache: createMemoryCache({ serializable: false }),
1046
1043
  hostsCache: createFallbackableCache({
1047
- caches: [
1048
- createBrowserLocalStorageCache({ key: `${apiClientVersion}-${appId}` }),
1049
- createMemoryCache(),
1050
- ],
1044
+ caches: [createBrowserLocalStorageCache({ key: `${apiClientVersion}-${appId}` }), createMemoryCache()],
1051
1045
  }),
1052
1046
  ...options,
1053
1047
  });
@@ -2,11 +2,9 @@ import { createAuth, createTransporter, getAlgoliaAgent, DEFAULT_CONNECT_TIMEOUT
2
2
  import { createHttpRequester } from '@algolia/requester-node-http';
3
3
 
4
4
  // 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.
5
- const apiClientVersion = '1.1.1';
5
+ const apiClientVersion = '1.2.2';
6
6
  function getDefaultHosts() {
7
- return [
8
- { url: 'status.algolia.com', accept: 'readWrite', protocol: 'https' },
9
- ];
7
+ return [{ url: 'status.algolia.com', accept: 'readWrite', protocol: 'https' }];
10
8
  }
11
9
  // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
12
10
  function createMonitoringClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, ...options }) {
@@ -39,10 +37,7 @@ function createMonitoringClient({ appId: appIdOption, apiKey: apiKeyOption, auth
39
37
  * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
40
38
  */
41
39
  clearCache() {
42
- return Promise.all([
43
- transporter.requestsCache.clear(),
44
- transporter.responsesCache.clear(),
45
- ]).then(() => undefined);
40
+ return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => undefined);
46
41
  },
47
42
  /**
48
43
  * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
@@ -1,2 +1,2 @@
1
- /*! monitoring.umd.js | 1.1.1 | © Algolia, inc. | https://github.com/algolia/algoliasearch-client-javascript */
2
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@algolia/monitoring"]={})}(this,(function(e){"use strict";function t(e){let t;const r=`algolia-client-js-${e.key}`;function s(){return void 0===t&&(t=e.localStorage||window.localStorage),t}function a(){return JSON.parse(s().getItem(r)||"{}")}function n(e){s().setItem(r,JSON.stringify(e))}return{get:(t,r,s={miss:()=>Promise.resolve()})=>Promise.resolve().then((()=>(function(){const t=e.timeToLive?1e3*e.timeToLive:null,r=a(),s=Object.fromEntries(Object.entries(r).filter((([,e])=>void 0!==e.timestamp)));if(n(s),!t)return;n(Object.fromEntries(Object.entries(s).filter((([,e])=>{const r=(new Date).getTime();return!(e.timestamp+t<r)}))))}(),a()[JSON.stringify(t)]))).then((e=>Promise.all([e?e.value:r(),void 0!==e]))).then((([e,t])=>Promise.all([e,t||s.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve().then((()=>{const n=a();return n[JSON.stringify(e)]={timestamp:(new Date).getTime(),value:t},s().setItem(r,JSON.stringify(n)),t})),delete:e=>Promise.resolve().then((()=>{const t=a();delete t[JSON.stringify(e)],s().setItem(r,JSON.stringify(t))})),clear:()=>Promise.resolve().then((()=>{s().removeItem(r)}))}}function r(e){const t=[...e.caches],s=t.shift();return void 0===s?{get:(e,t,r={miss:()=>Promise.resolve()})=>t().then((e=>Promise.all([e,r.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve(t),delete:e=>Promise.resolve(),clear:()=>Promise.resolve()}:{get:(e,a,n={miss:()=>Promise.resolve()})=>s.get(e,a,n).catch((()=>r({caches:t}).get(e,a,n))),set:(e,a)=>s.set(e,a).catch((()=>r({caches:t}).set(e,a))),delete:e=>s.delete(e).catch((()=>r({caches:t}).delete(e))),clear:()=>s.clear().catch((()=>r({caches:t}).clear()))}}function s(e={serializable:!0}){let t={};return{get(r,s,a={miss:()=>Promise.resolve()}){const n=JSON.stringify(r);if(n in t)return Promise.resolve(e.serializable?JSON.parse(t[n]):t[n]);const o=s();return o.then((e=>a.miss(e))).then((()=>o))},set:(r,s)=>(t[JSON.stringify(r)]=e.serializable?JSON.stringify(s):s,Promise.resolve(s)),delete:e=>(delete t[JSON.stringify(e)],Promise.resolve()),clear:()=>(t={},Promise.resolve())}}const a=12e4;function n(e,t="up"){const r=Date.now();return{...e,status:t,lastUpdate:r,isUp:function(){return"up"===t||Date.now()-r>a},isTimedOut:function(){return"timed out"===t&&Date.now()-r<=a}}}function o(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var s=r.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class i extends Error{constructor(e,t){super(e),o(this,"name","AlgoliaError"),t&&(this.name=t)}}class c extends i{constructor(e,t,r){super(e,r),o(this,"stackTrace",void 0),this.stackTrace=t}}class u extends c{constructor(e){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.",e,"RetryError")}}class l extends c{constructor(e,t,r,s="ApiError"){super(e,r,s),o(this,"status",void 0),this.status=t}}class m extends i{constructor(e,t){super(e,"DeserializationError"),o(this,"response",void 0),this.response=t}}class h extends l{constructor(e,t,r,s){super(e,t,s,"DetailedApiError"),o(this,"error",void 0),this.error=r}}function d(e,t,r){const s=(a=r,Object.keys(a).filter((e=>void 0!==a[e])).sort().map((e=>`${e}=${encodeURIComponent("[object Array]"===Object.prototype.toString.call(a[e])?a[e].join(","):a[e]).replaceAll("+","%20")}`)).join("&"));var a;let n=`${e.protocol}://${e.url}${e.port?`:${e.port}`:""}/${"/"===t.charAt(0)?t.substring(1):t}`;return s.length&&(n+=`?${s}`),n}function p(e){const t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...e,request:{...e.request,headers:{...e.request.headers,...t}}}}function g({hosts:e,hostsCache:t,baseHeaders:r,baseQueryParameters:s,algoliaAgent:a,timeouts:o,requester:i,requestsCache:c,responsesCache:g}){async function f(c,g,f=!0){const y=[],P=function(e,t){if("GET"===e.method||void 0===e.data&&void 0===t.data)return;const r=Array.isArray(e.data)?e.data:{...e.data,...t.data};return JSON.stringify(r)}(c,g),w=function(e,t,r){const s={Accept:"application/json",...e,...t,...r},a={};return Object.keys(s).forEach((e=>{const t=s[e];a[e.toLowerCase()]=t})),a}(r,c.headers,g.headers),q="GET"===c.method?{...c.data,...g.data}:{},v={...s,...c.queryParameters,...q};if(a.value&&(v["x-algolia-agent"]=a.value),g&&g.queryParameters)for(const e of Object.keys(g.queryParameters))g.queryParameters[e]&&"[object Object]"!==Object.prototype.toString.call(g.queryParameters[e])?v[e]=g.queryParameters[e].toString():v[e]=g.queryParameters[e];let T=0;const b=async(e,r)=>{const s=e.pop();if(void 0===s)throw new u(function(e){return e.map((e=>p(e)))}(y));let a=f?g.timeouts?.read||o.read:g.timeouts?.write||o.write;const q={data:P,headers:w,method:c.method,url:d(s,c.path,v),connectTimeout:r(T,g.timeouts?.connect||o.connect),responseTimeout:r(T,a)},E=t=>{const r={request:q,response:t,host:s,triesLeft:e.length};return y.push(r),r},O=await i.send(q);if(function({isTimedOut:e,status:t}){return e||function({isTimedOut:e,status:t}){return!e&&!~~t}({isTimedOut:e,status:t})||2!=~~(t/100)&&4!=~~(t/100)}(O)){const a=E(O);return O.isTimedOut&&T++,console.log("Retryable failure",p(a)),await t.set(s,n(s,O.isTimedOut?"timed out":"down")),b(e,r)}if(function({status:e}){return 2==~~(e/100)}(O))return function(e){try{return JSON.parse(e.content)}catch(t){throw new m(t.message,e)}}(O);throw E(O),function({content:e,status:t},r){try{const s=JSON.parse(e);return"error"in s?new h(s.message,t,s.error,r):new l(s.message,t,r)}catch(e){}return new l(e,t,r)}(O,y)},E=e.filter((e=>"readWrite"===e.accept||(f?"read"===e.accept:"write"===e.accept))),O=await async function(e){const r=await Promise.all(e.map((e=>t.get(e,(()=>Promise.resolve(n(e))))))),s=r.filter((e=>e.isUp())),a=r.filter((e=>e.isTimedOut())),o=[...s,...a];return{hosts:o.length>0?o:e,getTimeout:(e,t)=>(0===a.length&&0===e?1:a.length+3+e)*t}}(E);return b([...O.hosts].reverse(),O.getTimeout)}return{hostsCache:t,requester:i,timeouts:o,algoliaAgent:a,baseHeaders:r,baseQueryParameters:s,hosts:e,request:function(e,t={}){const a=e.useReadTransporter||"GET"===e.method;if(!a)return f(e,t,a);const n=()=>f(e,t);if(!0!==(t.cacheable||e.cacheable))return n();const o={request:e,requestOptions:t,transporter:{queryParameters:s,headers:r}};return g.get(o,(()=>c.get(o,(()=>c.set(o,n()).then((e=>Promise.all([c.delete(o),e])),(e=>Promise.all([c.delete(o),Promise.reject(e)]))).then((([e,t])=>t))))),{miss:e=>g.set(o,e)})},requestsCache:c,responsesCache:g}}function f({algoliaAgents:e,client:t,version:r}){const s=function(e){const t={value:`Algolia for JavaScript (${e})`,add(e){const r=`; ${e.segment}${void 0!==e.version?` (${e.version})`:""}`;return-1===t.value.indexOf(r)&&(t.value=`${t.value}${r}`),t}};return t}(r).add({segment:t,version:r});return e.forEach((e=>s.add(e))),s}const y="1.1.1";e.apiClientVersion=y,e.monitoringClient=function(e,a,n){if(!e||"string"!=typeof e)throw new Error("`appId` is missing.");if(!a||"string"!=typeof a)throw new Error("`apiKey` is missing.");return function({appId:e,apiKey:t,authMode:r,algoliaAgents:s,...a}){const n=function(e,t,r="WithinHeaders"){const s={"x-algolia-api-key":t,"x-algolia-application-id":e};return{headers:()=>"WithinHeaders"===r?s:{},queryParameters:()=>"WithinQueryParameters"===r?s:{}}}(e,t,r),o=g({hosts:[{url:"status.algolia.com",accept:"readWrite",protocol:"https"}],...a,algoliaAgent:f({algoliaAgents:s,client:"Monitoring",version:y}),baseHeaders:{"content-type":"text/plain",...n.headers(),...a.baseHeaders},baseQueryParameters:{...n.queryParameters(),...a.baseQueryParameters}});return{transporter:o,appId:e,clearCache:()=>Promise.all([o.requestsCache.clear(),o.responsesCache.clear()]).then((()=>{})),get _ua(){return o.algoliaAgent.value},addAlgoliaAgent(e,t){o.algoliaAgent.add({segment:e,version:t})},customDelete({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");const s={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return o.request(s,r)},customGet({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");const s={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return o.request(s,r)},customPost({path:e,parameters:t,body:r},s){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");const a={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return o.request(a,s)},customPut({path:e,parameters:t,body:r},s){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");const a={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return o.request(a,s)},getClusterIncidents({clusters:e},t){if(!e)throw new Error("Parameter `clusters` is required when calling `getClusterIncidents`.");const r={method:"GET",path:"/1/incidents/{clusters}".replace("{clusters}",encodeURIComponent(e)),queryParameters:{},headers:{}};return o.request(r,t)},getClusterStatus({clusters:e},t){if(!e)throw new Error("Parameter `clusters` is required when calling `getClusterStatus`.");const r={method:"GET",path:"/1/status/{clusters}".replace("{clusters}",encodeURIComponent(e)),queryParameters:{},headers:{}};return o.request(r,t)},getIncidents(e){const t={method:"GET",path:"/1/incidents",queryParameters:{},headers:{}};return o.request(t,e)},getIndexingTime({clusters:e},t){if(!e)throw new Error("Parameter `clusters` is required when calling `getIndexingTime`.");const r={method:"GET",path:"/1/indexing/{clusters}".replace("{clusters}",encodeURIComponent(e)),queryParameters:{},headers:{}};return o.request(r,t)},getLatency({clusters:e},t){if(!e)throw new Error("Parameter `clusters` is required when calling `getLatency`.");const r={method:"GET",path:"/1/latency/{clusters}".replace("{clusters}",encodeURIComponent(e)),queryParameters:{},headers:{}};return o.request(r,t)},getMetrics({metric:e,period:t},r){if(!e)throw new Error("Parameter `metric` is required when calling `getMetrics`.");if(!t)throw new Error("Parameter `period` is required when calling `getMetrics`.");const s={method:"GET",path:"/1/infrastructure/{metric}/period/{period}".replace("{metric}",encodeURIComponent(e)).replace("{period}",encodeURIComponent(t)),queryParameters:{},headers:{}};return o.request(s,r)},getReachability({clusters:e},t){if(!e)throw new Error("Parameter `clusters` is required when calling `getReachability`.");const r={method:"GET",path:"/1/reachability/{clusters}/probes".replace("{clusters}",encodeURIComponent(e)),queryParameters:{},headers:{}};return o.request(r,t)},getServers(e){const t={method:"GET",path:"/1/inventory/servers",queryParameters:{},headers:{}};return o.request(t,e)},getStatus(e){const t={method:"GET",path:"/1/status",queryParameters:{},headers:{}};return o.request(t,e)}}}({appId:e,apiKey:a,timeouts:{connect:1e3,read:2e3,write:3e4},requester:{send:function(e){return new Promise((t=>{const r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach((t=>r.setRequestHeader(t,e.headers[t])));const s=(e,s)=>setTimeout((()=>{r.abort(),t({status:0,content:s,isTimedOut:!0})}),e),a=s(e.connectTimeout,"Connection timeout");let n;r.onreadystatechange=()=>{r.readyState>r.OPENED&&void 0===n&&(clearTimeout(a),n=s(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{0===r.status&&(clearTimeout(a),clearTimeout(n),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(a),clearTimeout(n),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))}},algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:s(),requestsCache:s({serializable:!1}),hostsCache:r({caches:[t({key:`${y}-${e}`}),s()]}),...n})}}));
1
+ /*! monitoring.umd.js | 1.2.2 | © Algolia, inc. | https://github.com/algolia/algoliasearch-client-javascript */
2
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@algolia/monitoring"]={})}(this,(function(e){"use strict";function t(e){let t;const r=`algolia-client-js-${e.key}`;function s(){return void 0===t&&(t=e.localStorage||window.localStorage),t}function a(){return JSON.parse(s().getItem(r)||"{}")}function n(e){s().setItem(r,JSON.stringify(e))}return{get:(t,r,s={miss:()=>Promise.resolve()})=>Promise.resolve().then((()=>(function(){const t=e.timeToLive?1e3*e.timeToLive:null,r=a(),s=Object.fromEntries(Object.entries(r).filter((([,e])=>void 0!==e.timestamp)));if(n(s),!t)return;n(Object.fromEntries(Object.entries(s).filter((([,e])=>{const r=(new Date).getTime();return!(e.timestamp+t<r)}))))}(),a()[JSON.stringify(t)]))).then((e=>Promise.all([e?e.value:r(),void 0!==e]))).then((([e,t])=>Promise.all([e,t||s.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve().then((()=>{const n=a();return n[JSON.stringify(e)]={timestamp:(new Date).getTime(),value:t},s().setItem(r,JSON.stringify(n)),t})),delete:e=>Promise.resolve().then((()=>{const t=a();delete t[JSON.stringify(e)],s().setItem(r,JSON.stringify(t))})),clear:()=>Promise.resolve().then((()=>{s().removeItem(r)}))}}function r(e){const t=[...e.caches],s=t.shift();return void 0===s?{get:(e,t,r={miss:()=>Promise.resolve()})=>t().then((e=>Promise.all([e,r.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve(t),delete:e=>Promise.resolve(),clear:()=>Promise.resolve()}:{get:(e,a,n={miss:()=>Promise.resolve()})=>s.get(e,a,n).catch((()=>r({caches:t}).get(e,a,n))),set:(e,a)=>s.set(e,a).catch((()=>r({caches:t}).set(e,a))),delete:e=>s.delete(e).catch((()=>r({caches:t}).delete(e))),clear:()=>s.clear().catch((()=>r({caches:t}).clear()))}}function s(e={serializable:!0}){let t={};return{get(r,s,a={miss:()=>Promise.resolve()}){const n=JSON.stringify(r);if(n in t)return Promise.resolve(e.serializable?JSON.parse(t[n]):t[n]);const o=s();return o.then((e=>a.miss(e))).then((()=>o))},set:(r,s)=>(t[JSON.stringify(r)]=e.serializable?JSON.stringify(s):s,Promise.resolve(s)),delete:e=>(delete t[JSON.stringify(e)],Promise.resolve()),clear:()=>(t={},Promise.resolve())}}const a=12e4;function n(e,t="up"){const r=Date.now();return{...e,status:t,lastUpdate:r,isUp:function(){return"up"===t||Date.now()-r>a},isTimedOut:function(){return"timed out"===t&&Date.now()-r<=a}}}function o(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var s=r.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class i extends Error{constructor(e,t){super(e),o(this,"name","AlgoliaError"),t&&(this.name=t)}}class c extends i{constructor(e,t,r){super(e,r),o(this,"stackTrace",void 0),this.stackTrace=t}}class u extends c{constructor(e){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.",e,"RetryError")}}class l extends c{constructor(e,t,r,s="ApiError"){super(e,r,s),o(this,"status",void 0),this.status=t}}class m extends i{constructor(e,t){super(e,"DeserializationError"),o(this,"response",void 0),this.response=t}}class h extends l{constructor(e,t,r,s){super(e,t,s,"DetailedApiError"),o(this,"error",void 0),this.error=r}}function d(e,t,r){const s=(a=r,Object.keys(a).filter((e=>void 0!==a[e])).sort().map((e=>`${e}=${encodeURIComponent("[object Array]"===Object.prototype.toString.call(a[e])?a[e].join(","):a[e]).replaceAll("+","%20")}`)).join("&"));var a;let n=`${e.protocol}://${e.url}${e.port?`:${e.port}`:""}/${"/"===t.charAt(0)?t.substring(1):t}`;return s.length&&(n+=`?${s}`),n}function p(e){const t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...e,request:{...e.request,headers:{...e.request.headers,...t}}}}function g({hosts:e,hostsCache:t,baseHeaders:r,baseQueryParameters:s,algoliaAgent:a,timeouts:o,requester:i,requestsCache:c,responsesCache:g}){async function f(c,g,f=!0){const y=[],P=function(e,t){if("GET"===e.method||void 0===e.data&&void 0===t.data)return;const r=Array.isArray(e.data)?e.data:{...e.data,...t.data};return JSON.stringify(r)}(c,g),w=function(e,t,r){const s={Accept:"application/json",...e,...t,...r},a={};return Object.keys(s).forEach((e=>{const t=s[e];a[e.toLowerCase()]=t})),a}(r,c.headers,g.headers),q="GET"===c.method?{...c.data,...g.data}:{},v={...s,...c.queryParameters,...q};if(a.value&&(v["x-algolia-agent"]=a.value),g&&g.queryParameters)for(const e of Object.keys(g.queryParameters))g.queryParameters[e]&&"[object Object]"!==Object.prototype.toString.call(g.queryParameters[e])?v[e]=g.queryParameters[e].toString():v[e]=g.queryParameters[e];let T=0;const b=async(e,r)=>{const s=e.pop();if(void 0===s)throw new u(function(e){return e.map((e=>p(e)))}(y));const a={...o,...g.timeouts},q={data:P,headers:w,method:c.method,url:d(s,c.path,v),connectTimeout:r(T,a.connect),responseTimeout:r(T,f?a.read:a.write)},E=t=>{const r={request:q,response:t,host:s,triesLeft:e.length};return y.push(r),r},O=await i.send(q);if(function({isTimedOut:e,status:t}){return e||function({isTimedOut:e,status:t}){return!e&&!~~t}({isTimedOut:e,status:t})||2!=~~(t/100)&&4!=~~(t/100)}(O)){const a=E(O);return O.isTimedOut&&T++,console.log("Retryable failure",p(a)),await t.set(s,n(s,O.isTimedOut?"timed out":"down")),b(e,r)}if(function({status:e}){return 2==~~(e/100)}(O))return function(e){try{return JSON.parse(e.content)}catch(t){throw new m(t.message,e)}}(O);throw E(O),function({content:e,status:t},r){try{const s=JSON.parse(e);return"error"in s?new h(s.message,t,s.error,r):new l(s.message,t,r)}catch{}return new l(e,t,r)}(O,y)},E=e.filter((e=>"readWrite"===e.accept||(f?"read"===e.accept:"write"===e.accept))),O=await async function(e){const r=await Promise.all(e.map((e=>t.get(e,(()=>Promise.resolve(n(e))))))),s=r.filter((e=>e.isUp())),a=r.filter((e=>e.isTimedOut())),o=[...s,...a];return{hosts:o.length>0?o:e,getTimeout:(e,t)=>(0===a.length&&0===e?1:a.length+3+e)*t}}(E);return b([...O.hosts].reverse(),O.getTimeout)}return{hostsCache:t,requester:i,timeouts:o,algoliaAgent:a,baseHeaders:r,baseQueryParameters:s,hosts:e,request:function(e,t={}){const a=e.useReadTransporter||"GET"===e.method;if(!a)return f(e,t,a);const n=()=>f(e,t);if(!0!==(t.cacheable||e.cacheable))return n();const o={request:e,requestOptions:t,transporter:{queryParameters:s,headers:r}};return g.get(o,(()=>c.get(o,(()=>c.set(o,n()).then((e=>Promise.all([c.delete(o),e])),(e=>Promise.all([c.delete(o),Promise.reject(e)]))).then((([e,t])=>t))))),{miss:e=>g.set(o,e)})},requestsCache:c,responsesCache:g}}function f({algoliaAgents:e,client:t,version:r}){const s=function(e){const t={value:`Algolia for JavaScript (${e})`,add(e){const r=`; ${e.segment}${void 0!==e.version?` (${e.version})`:""}`;return-1===t.value.indexOf(r)&&(t.value=`${t.value}${r}`),t}};return t}(r).add({segment:t,version:r});return e.forEach((e=>s.add(e))),s}const y="1.2.2";e.apiClientVersion=y,e.monitoringClient=function(e,a,n){if(!e||"string"!=typeof e)throw new Error("`appId` is missing.");if(!a||"string"!=typeof a)throw new Error("`apiKey` is missing.");return function({appId:e,apiKey:t,authMode:r,algoliaAgents:s,...a}){const n=function(e,t,r="WithinHeaders"){const s={"x-algolia-api-key":t,"x-algolia-application-id":e};return{headers:()=>"WithinHeaders"===r?s:{},queryParameters:()=>"WithinQueryParameters"===r?s:{}}}(e,t,r),o=g({hosts:[{url:"status.algolia.com",accept:"readWrite",protocol:"https"}],...a,algoliaAgent:f({algoliaAgents:s,client:"Monitoring",version:y}),baseHeaders:{"content-type":"text/plain",...n.headers(),...a.baseHeaders},baseQueryParameters:{...n.queryParameters(),...a.baseQueryParameters}});return{transporter:o,appId:e,clearCache:()=>Promise.all([o.requestsCache.clear(),o.responsesCache.clear()]).then((()=>{})),get _ua(){return o.algoliaAgent.value},addAlgoliaAgent(e,t){o.algoliaAgent.add({segment:e,version:t})},customDelete({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `customDelete`.");const s={method:"DELETE",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return o.request(s,r)},customGet({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `customGet`.");const s={method:"GET",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return o.request(s,r)},customPost({path:e,parameters:t,body:r},s){if(!e)throw new Error("Parameter `path` is required when calling `customPost`.");const a={method:"POST",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return o.request(a,s)},customPut({path:e,parameters:t,body:r},s){if(!e)throw new Error("Parameter `path` is required when calling `customPut`.");const a={method:"PUT",path:"/{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return o.request(a,s)},getClusterIncidents({clusters:e},t){if(!e)throw new Error("Parameter `clusters` is required when calling `getClusterIncidents`.");const r={method:"GET",path:"/1/incidents/{clusters}".replace("{clusters}",encodeURIComponent(e)),queryParameters:{},headers:{}};return o.request(r,t)},getClusterStatus({clusters:e},t){if(!e)throw new Error("Parameter `clusters` is required when calling `getClusterStatus`.");const r={method:"GET",path:"/1/status/{clusters}".replace("{clusters}",encodeURIComponent(e)),queryParameters:{},headers:{}};return o.request(r,t)},getIncidents(e){const t={method:"GET",path:"/1/incidents",queryParameters:{},headers:{}};return o.request(t,e)},getIndexingTime({clusters:e},t){if(!e)throw new Error("Parameter `clusters` is required when calling `getIndexingTime`.");const r={method:"GET",path:"/1/indexing/{clusters}".replace("{clusters}",encodeURIComponent(e)),queryParameters:{},headers:{}};return o.request(r,t)},getLatency({clusters:e},t){if(!e)throw new Error("Parameter `clusters` is required when calling `getLatency`.");const r={method:"GET",path:"/1/latency/{clusters}".replace("{clusters}",encodeURIComponent(e)),queryParameters:{},headers:{}};return o.request(r,t)},getMetrics({metric:e,period:t},r){if(!e)throw new Error("Parameter `metric` is required when calling `getMetrics`.");if(!t)throw new Error("Parameter `period` is required when calling `getMetrics`.");const s={method:"GET",path:"/1/infrastructure/{metric}/period/{period}".replace("{metric}",encodeURIComponent(e)).replace("{period}",encodeURIComponent(t)),queryParameters:{},headers:{}};return o.request(s,r)},getReachability({clusters:e},t){if(!e)throw new Error("Parameter `clusters` is required when calling `getReachability`.");const r={method:"GET",path:"/1/reachability/{clusters}/probes".replace("{clusters}",encodeURIComponent(e)),queryParameters:{},headers:{}};return o.request(r,t)},getServers(e){const t={method:"GET",path:"/1/inventory/servers",queryParameters:{},headers:{}};return o.request(t,e)},getStatus(e){const t={method:"GET",path:"/1/status",queryParameters:{},headers:{}};return o.request(t,e)}}}({appId:e,apiKey:a,timeouts:{connect:1e3,read:2e3,write:3e4},requester:{send:function(e){return new Promise((t=>{const r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach((t=>r.setRequestHeader(t,e.headers[t])));const s=(e,s)=>setTimeout((()=>{r.abort(),t({status:0,content:s,isTimedOut:!0})}),e),a=s(e.connectTimeout,"Connection timeout");let n;r.onreadystatechange=()=>{r.readyState>r.OPENED&&void 0===n&&(clearTimeout(a),n=s(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{0===r.status&&(clearTimeout(a),clearTimeout(n),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(a),clearTimeout(n),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))}},algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:s(),requestsCache:s({serializable:!1}),hostsCache:r({caches:[t({key:`${y}-${e}`}),s()]}),...n})}}));
@@ -6,7 +6,7 @@ import type { InfrastructureResponse } from '../model/infrastructureResponse';
6
6
  import type { InventoryResponse } from '../model/inventoryResponse';
7
7
  import type { LatencyResponse } from '../model/latencyResponse';
8
8
  import type { StatusResponse } from '../model/statusResponse';
9
- export declare const apiClientVersion = "1.1.1";
9
+ export declare const apiClientVersion = "1.2.2";
10
10
  export declare function createMonitoringClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, ...options }: CreateClientOptions): {
11
11
  transporter: import("@algolia/client-common").Transporter;
12
12
  /**
@@ -36,7 +36,7 @@ export declare function createMonitoringClient({ appId: appIdOption, apiKey: api
36
36
  * @param customDelete.parameters - Query parameters to apply to the current query.
37
37
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
38
38
  */
39
- customDelete({ path, parameters }: CustomDeleteProps, requestOptions?: RequestOptions): Promise<Record<string, any>>;
39
+ customDelete({ path, parameters }: CustomDeleteProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
40
40
  /**
41
41
  * This method allow you to send requests to the Algolia REST API.
42
42
  *
@@ -45,7 +45,7 @@ export declare function createMonitoringClient({ appId: appIdOption, apiKey: api
45
45
  * @param customGet.parameters - Query parameters to apply to the current query.
46
46
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
47
47
  */
48
- customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, any>>;
48
+ customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
49
49
  /**
50
50
  * This method allow you to send requests to the Algolia REST API.
51
51
  *
@@ -55,7 +55,7 @@ export declare function createMonitoringClient({ appId: appIdOption, apiKey: api
55
55
  * @param customPost.body - Parameters to send with the custom request.
56
56
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
57
57
  */
58
- customPost({ path, parameters, body }: CustomPostProps, requestOptions?: RequestOptions): Promise<Record<string, any>>;
58
+ customPost({ path, parameters, body }: CustomPostProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
59
59
  /**
60
60
  * This method allow you to send requests to the Algolia REST API.
61
61
  *
@@ -65,7 +65,7 @@ export declare function createMonitoringClient({ appId: appIdOption, apiKey: api
65
65
  * @param customPut.body - Parameters to send with the custom request.
66
66
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
67
67
  */
68
- customPut({ path, parameters, body }: CustomPutProps, requestOptions?: RequestOptions): Promise<Record<string, any>>;
68
+ customPut({ path, parameters, body }: CustomPutProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
69
69
  /**
70
70
  * Retrieves known incidents for the selected clusters.
71
71
  *
@@ -1 +1 @@
1
- {"version":3,"file":"monitoringClient.d.ts","sourceRoot":"","sources":["../../src/monitoringClient.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,mBAAmB,EAKnB,cAAc,EACf,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EACV,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,cAAc,EACd,wBAAwB,EACxB,qBAAqB,EACrB,oBAAoB,EACpB,eAAe,EACf,eAAe,EACf,oBAAoB,EACrB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,KAA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AEa,oBAAoB,mBACjB,cAAc,GAC9B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAmBnD;;;;OAIG;gCACyB,cAAc,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAevE;;;;OAIG;+BACwB,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;EAetE"}
@@ -46,7 +46,7 @@ export type CustomPostProps = {
46
46
  /**
47
47
  * Parameters to send with the custom request.
48
48
  */
49
- body?: Record<string, any>;
49
+ body?: Record<string, unknown>;
50
50
  };
51
51
 
52
52
  /**
@@ -64,7 +64,7 @@ export type CustomPutProps = {
64
64
  /**
65
65
  * Parameters to send with the custom request.
66
66
  */
67
- body?: Record<string, any>;
67
+ body?: Record<string, unknown>;
68
68
  };
69
69
 
70
70
  /**
package/model/metric.ts CHANGED
@@ -1,9 +1,3 @@
1
1
  // 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.
2
2
 
3
- export type Metric =
4
- | '*'
5
- | 'avg_build_time'
6
- | 'cpu_usage'
7
- | 'ram_indexing_usage'
8
- | 'ram_search_usage'
9
- | 'ssd_usage';
3
+ export type Metric = '*' | 'avg_build_time' | 'cpu_usage' | 'ram_indexing_usage' | 'ram_search_usage' | 'ssd_usage';
package/model/status.ts CHANGED
@@ -3,8 +3,4 @@
3
3
  /**
4
4
  * Status of the cluster.
5
5
  */
6
- export type Status =
7
- | 'degraded_performance'
8
- | 'major_outage'
9
- | 'operational'
10
- | 'partial_outage';
6
+ export type Status = 'degraded_performance' | 'major_outage' | 'operational' | 'partial_outage';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@algolia/monitoring",
3
- "version": "1.1.1",
3
+ "version": "1.2.2",
4
4
  "description": "JavaScript client for monitoring",
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,7 +18,7 @@
18
18
  "default": "./dist/monitoring.cjs",
19
19
  "types": "./dist/builds/node.d.ts"
20
20
  },
21
- "default": {
21
+ "browser": {
22
22
  "umd": "./dist/monitoring.umd.js",
23
23
  "module": "./dist/monitoring.esm.browser.js",
24
24
  "import": "./dist/monitoring.esm.browser.js",
@@ -44,13 +44,13 @@
44
44
  "clean": "rm -rf ./dist || true"
45
45
  },
46
46
  "dependencies": {
47
- "@algolia/client-common": "5.1.1",
48
- "@algolia/requester-browser-xhr": "5.1.1",
49
- "@algolia/requester-node-http": "5.1.1"
47
+ "@algolia/client-common": "5.2.2",
48
+ "@algolia/requester-browser-xhr": "5.2.2",
49
+ "@algolia/requester-node-http": "5.2.2"
50
50
  },
51
51
  "devDependencies": {
52
- "@types/node": "22.2.0",
53
- "rollup": "4.20.0",
52
+ "@types/node": "22.5.0",
53
+ "rollup": "4.21.0",
54
54
  "typescript": "5.5.4"
55
55
  },
56
56
  "engines": {