@algolia/monitoring 1.0.0-alpha.4 → 1.0.0-alpha.40
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/dist/builds/browser.d.ts +25 -3
- package/dist/builds/browser.d.ts.map +1 -1
- package/dist/builds/node.d.ts +25 -3
- package/dist/builds/node.d.ts.map +1 -1
- package/dist/model/clientMethodProps.d.ts +39 -39
- package/dist/model/clientMethodProps.d.ts.map +1 -1
- package/dist/model/getServers403Response.d.ts +4 -0
- package/dist/model/getServers403Response.d.ts.map +1 -0
- package/dist/model/incidentsInner.d.ts +1 -1
- package/dist/model/index.d.ts +1 -1
- package/dist/model/index.d.ts.map +1 -1
- package/dist/model/probesMetric.d.ts +1 -1
- package/dist/model/region.d.ts +1 -1
- package/dist/model/server.d.ts +2 -2
- package/dist/model/timeInner.d.ts +1 -1
- package/dist/{monitoring.cjs.js → monitoring.cjs} +100 -135
- package/dist/monitoring.esm.browser.js +130 -157
- package/dist/monitoring.esm.node.js +101 -136
- package/dist/monitoring.umd.js +2 -2
- package/dist/src/monitoringClient.d.ts +41 -58
- package/dist/src/monitoringClient.d.ts.map +1 -1
- package/index.js +1 -1
- package/model/clientMethodProps.ts +41 -41
- package/model/{getInventory403Response.ts → getServers403Response.ts} +1 -1
- package/model/incidentsInner.ts +1 -1
- package/model/index.ts +1 -1
- package/model/probesMetric.ts +1 -1
- package/model/region.ts +1 -1
- package/model/server.ts +2 -2
- package/model/timeInner.ts +1 -1
- package/package.json +9 -9
- package/dist/model/getInventory403Response.d.ts +0 -4
- package/dist/model/getInventory403Response.d.ts.map +0 -1
|
@@ -1,43 +1,18 @@
|
|
|
1
|
-
import { createAuth, createTransporter, getAlgoliaAgent,
|
|
1
|
+
import { createAuth, createTransporter, getAlgoliaAgent, DEFAULT_CONNECT_TIMEOUT_NODE, DEFAULT_READ_TIMEOUT_NODE, DEFAULT_WRITE_TIMEOUT_NODE, createNullCache, createMemoryCache } from '@algolia/client-common';
|
|
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.0.0-alpha.
|
|
6
|
-
function getDefaultHosts(
|
|
5
|
+
const apiClientVersion = '1.0.0-alpha.40';
|
|
6
|
+
function getDefaultHosts() {
|
|
7
7
|
return [
|
|
8
|
-
{
|
|
9
|
-
|
|
10
|
-
accept: 'read',
|
|
11
|
-
protocol: 'https',
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
url: `${appId}.algolia.net`,
|
|
15
|
-
accept: 'write',
|
|
16
|
-
protocol: 'https',
|
|
17
|
-
},
|
|
18
|
-
].concat(shuffle([
|
|
19
|
-
{
|
|
20
|
-
url: `${appId}-1.algolianet.com`,
|
|
21
|
-
accept: 'readWrite',
|
|
22
|
-
protocol: 'https',
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
url: `${appId}-2.algolianet.com`,
|
|
26
|
-
accept: 'readWrite',
|
|
27
|
-
protocol: 'https',
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
url: `${appId}-3.algolianet.com`,
|
|
31
|
-
accept: 'readWrite',
|
|
32
|
-
protocol: 'https',
|
|
33
|
-
},
|
|
34
|
-
]));
|
|
8
|
+
{ url: 'status.algolia.com', accept: 'readWrite', protocol: 'https' },
|
|
9
|
+
];
|
|
35
10
|
}
|
|
36
11
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
37
12
|
function createMonitoringClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, ...options }) {
|
|
38
13
|
const auth = createAuth(appIdOption, apiKeyOption, authMode);
|
|
39
14
|
const transporter = createTransporter({
|
|
40
|
-
hosts: getDefaultHosts(
|
|
15
|
+
hosts: getDefaultHosts(),
|
|
41
16
|
...options,
|
|
42
17
|
algoliaAgent: getAlgoliaAgent({
|
|
43
18
|
algoliaAgents,
|
|
@@ -87,17 +62,16 @@ function createMonitoringClient({ appId: appIdOption, apiKey: apiKeyOption, auth
|
|
|
87
62
|
/**
|
|
88
63
|
* This method allow you to send requests to the Algolia REST API.
|
|
89
64
|
*
|
|
90
|
-
* @
|
|
91
|
-
* @param
|
|
92
|
-
* @param
|
|
93
|
-
* @param del.parameters - Query parameters to apply to the current query.
|
|
65
|
+
* @param customDelete - The customDelete object.
|
|
66
|
+
* @param customDelete.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
67
|
+
* @param customDelete.parameters - Query parameters to apply to the current query.
|
|
94
68
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
95
69
|
*/
|
|
96
|
-
|
|
70
|
+
customDelete({ path, parameters }, requestOptions) {
|
|
97
71
|
if (!path) {
|
|
98
|
-
throw new Error('Parameter `path` is required when calling `
|
|
72
|
+
throw new Error('Parameter `path` is required when calling `customDelete`.');
|
|
99
73
|
}
|
|
100
|
-
const requestPath = '/
|
|
74
|
+
const requestPath = '/{path}'.replace('{path}', path);
|
|
101
75
|
const headers = {};
|
|
102
76
|
const queryParameters = parameters ? parameters : {};
|
|
103
77
|
const request = {
|
|
@@ -111,17 +85,16 @@ function createMonitoringClient({ appId: appIdOption, apiKey: apiKeyOption, auth
|
|
|
111
85
|
/**
|
|
112
86
|
* This method allow you to send requests to the Algolia REST API.
|
|
113
87
|
*
|
|
114
|
-
* @
|
|
115
|
-
* @param
|
|
116
|
-
* @param
|
|
117
|
-
* @param get.parameters - Query parameters to apply to the current query.
|
|
88
|
+
* @param customGet - The customGet object.
|
|
89
|
+
* @param customGet.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
90
|
+
* @param customGet.parameters - Query parameters to apply to the current query.
|
|
118
91
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
119
92
|
*/
|
|
120
|
-
|
|
93
|
+
customGet({ path, parameters }, requestOptions) {
|
|
121
94
|
if (!path) {
|
|
122
|
-
throw new Error('Parameter `path` is required when calling `
|
|
95
|
+
throw new Error('Parameter `path` is required when calling `customGet`.');
|
|
123
96
|
}
|
|
124
|
-
const requestPath = '/
|
|
97
|
+
const requestPath = '/{path}'.replace('{path}', path);
|
|
125
98
|
const headers = {};
|
|
126
99
|
const queryParameters = parameters ? parameters : {};
|
|
127
100
|
const request = {
|
|
@@ -133,9 +106,58 @@ function createMonitoringClient({ appId: appIdOption, apiKey: apiKeyOption, auth
|
|
|
133
106
|
return transporter.request(request, requestOptions);
|
|
134
107
|
},
|
|
135
108
|
/**
|
|
136
|
-
*
|
|
109
|
+
* This method allow you to send requests to the Algolia REST API.
|
|
110
|
+
*
|
|
111
|
+
* @param customPost - The customPost object.
|
|
112
|
+
* @param customPost.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
113
|
+
* @param customPost.parameters - Query parameters to apply to the current query.
|
|
114
|
+
* @param customPost.body - Parameters to send with the custom request.
|
|
115
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
116
|
+
*/
|
|
117
|
+
customPost({ path, parameters, body }, requestOptions) {
|
|
118
|
+
if (!path) {
|
|
119
|
+
throw new Error('Parameter `path` is required when calling `customPost`.');
|
|
120
|
+
}
|
|
121
|
+
const requestPath = '/{path}'.replace('{path}', path);
|
|
122
|
+
const headers = {};
|
|
123
|
+
const queryParameters = parameters ? parameters : {};
|
|
124
|
+
const request = {
|
|
125
|
+
method: 'POST',
|
|
126
|
+
path: requestPath,
|
|
127
|
+
queryParameters,
|
|
128
|
+
headers,
|
|
129
|
+
data: body ? body : {},
|
|
130
|
+
};
|
|
131
|
+
return transporter.request(request, requestOptions);
|
|
132
|
+
},
|
|
133
|
+
/**
|
|
134
|
+
* This method allow you to send requests to the Algolia REST API.
|
|
135
|
+
*
|
|
136
|
+
* @param customPut - The customPut object.
|
|
137
|
+
* @param customPut.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
138
|
+
* @param customPut.parameters - Query parameters to apply to the current query.
|
|
139
|
+
* @param customPut.body - Parameters to send with the custom request.
|
|
140
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
141
|
+
*/
|
|
142
|
+
customPut({ path, parameters, body }, requestOptions) {
|
|
143
|
+
if (!path) {
|
|
144
|
+
throw new Error('Parameter `path` is required when calling `customPut`.');
|
|
145
|
+
}
|
|
146
|
+
const requestPath = '/{path}'.replace('{path}', path);
|
|
147
|
+
const headers = {};
|
|
148
|
+
const queryParameters = parameters ? parameters : {};
|
|
149
|
+
const request = {
|
|
150
|
+
method: 'PUT',
|
|
151
|
+
path: requestPath,
|
|
152
|
+
queryParameters,
|
|
153
|
+
headers,
|
|
154
|
+
data: body ? body : {},
|
|
155
|
+
};
|
|
156
|
+
return transporter.request(request, requestOptions);
|
|
157
|
+
},
|
|
158
|
+
/**
|
|
159
|
+
* Retrieves known incidents for the selected clusters.
|
|
137
160
|
*
|
|
138
|
-
* @summary List incidents for selected clusters.
|
|
139
161
|
* @param getClusterIncidents - The getClusterIncidents object.
|
|
140
162
|
* @param getClusterIncidents.clusters - Subset of clusters, separated by comma.
|
|
141
163
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
@@ -156,9 +178,8 @@ function createMonitoringClient({ appId: appIdOption, apiKey: apiKeyOption, auth
|
|
|
156
178
|
return transporter.request(request, requestOptions);
|
|
157
179
|
},
|
|
158
180
|
/**
|
|
159
|
-
*
|
|
181
|
+
* Retrieves the status of selected clusters.
|
|
160
182
|
*
|
|
161
|
-
* @summary List statuses of selected clusters.
|
|
162
183
|
* @param getClusterStatus - The getClusterStatus object.
|
|
163
184
|
* @param getClusterStatus.clusters - Subset of clusters, separated by comma.
|
|
164
185
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
@@ -179,9 +200,8 @@ function createMonitoringClient({ appId: appIdOption, apiKey: apiKeyOption, auth
|
|
|
179
200
|
return transporter.request(request, requestOptions);
|
|
180
201
|
},
|
|
181
202
|
/**
|
|
182
|
-
*
|
|
203
|
+
* Retrieves known incidents for all clusters.
|
|
183
204
|
*
|
|
184
|
-
* @summary List incidents.
|
|
185
205
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
186
206
|
*/
|
|
187
207
|
getIncidents(requestOptions) {
|
|
@@ -197,9 +217,8 @@ function createMonitoringClient({ appId: appIdOption, apiKey: apiKeyOption, auth
|
|
|
197
217
|
return transporter.request(request, requestOptions);
|
|
198
218
|
},
|
|
199
219
|
/**
|
|
200
|
-
*
|
|
220
|
+
* Retrieves average times for indexing operations for selected clusters.
|
|
201
221
|
*
|
|
202
|
-
* @summary Get indexing times.
|
|
203
222
|
* @param getIndexingTime - The getIndexingTime object.
|
|
204
223
|
* @param getIndexingTime.clusters - Subset of clusters, separated by comma.
|
|
205
224
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
@@ -220,27 +239,8 @@ function createMonitoringClient({ appId: appIdOption, apiKey: apiKeyOption, auth
|
|
|
220
239
|
return transporter.request(request, requestOptions);
|
|
221
240
|
},
|
|
222
241
|
/**
|
|
223
|
-
*
|
|
224
|
-
*
|
|
225
|
-
* @summary List servers.
|
|
226
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
227
|
-
*/
|
|
228
|
-
getInventory(requestOptions) {
|
|
229
|
-
const requestPath = '/1/inventory/servers';
|
|
230
|
-
const headers = {};
|
|
231
|
-
const queryParameters = {};
|
|
232
|
-
const request = {
|
|
233
|
-
method: 'GET',
|
|
234
|
-
path: requestPath,
|
|
235
|
-
queryParameters,
|
|
236
|
-
headers,
|
|
237
|
-
};
|
|
238
|
-
return transporter.request(request, requestOptions);
|
|
239
|
-
},
|
|
240
|
-
/**
|
|
241
|
-
* List the average latency for search requests for selected clusters.
|
|
242
|
+
* Retrieves the average latency for search requests for selected clusters.
|
|
242
243
|
*
|
|
243
|
-
* @summary Get search latency times.
|
|
244
244
|
* @param getLatency - The getLatency object.
|
|
245
245
|
* @param getLatency.clusters - Subset of clusters, separated by comma.
|
|
246
246
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
@@ -261,11 +261,10 @@ function createMonitoringClient({ appId: appIdOption, apiKey: apiKeyOption, auth
|
|
|
261
261
|
return transporter.request(request, requestOptions);
|
|
262
262
|
},
|
|
263
263
|
/**
|
|
264
|
-
*
|
|
264
|
+
* 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).
|
|
265
265
|
*
|
|
266
|
-
* @summary Get metrics for a given period.
|
|
267
266
|
* @param getMetrics - The getMetrics object.
|
|
268
|
-
* @param getMetrics.metric - Metric to report. For more information about the individual metrics, see the response. To include all metrics, use
|
|
267
|
+
* @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 `*`.
|
|
269
268
|
* @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.
|
|
270
269
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
271
270
|
*/
|
|
@@ -292,7 +291,6 @@ function createMonitoringClient({ appId: appIdOption, apiKey: apiKeyOption, auth
|
|
|
292
291
|
/**
|
|
293
292
|
* Test whether clusters are reachable or not.
|
|
294
293
|
*
|
|
295
|
-
* @summary Test the reachability of clusters.
|
|
296
294
|
* @param getReachability - The getReachability object.
|
|
297
295
|
* @param getReachability.clusters - Subset of clusters, separated by comma.
|
|
298
296
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
@@ -313,13 +311,12 @@ function createMonitoringClient({ appId: appIdOption, apiKey: apiKeyOption, auth
|
|
|
313
311
|
return transporter.request(request, requestOptions);
|
|
314
312
|
},
|
|
315
313
|
/**
|
|
316
|
-
*
|
|
314
|
+
* 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.
|
|
317
315
|
*
|
|
318
|
-
* @summary List cluster statuses.
|
|
319
316
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
320
317
|
*/
|
|
321
|
-
|
|
322
|
-
const requestPath = '/1/
|
|
318
|
+
getServers(requestOptions) {
|
|
319
|
+
const requestPath = '/1/inventory/servers';
|
|
323
320
|
const headers = {};
|
|
324
321
|
const queryParameters = {};
|
|
325
322
|
const request = {
|
|
@@ -331,54 +328,19 @@ function createMonitoringClient({ appId: appIdOption, apiKey: apiKeyOption, auth
|
|
|
331
328
|
return transporter.request(request, requestOptions);
|
|
332
329
|
},
|
|
333
330
|
/**
|
|
334
|
-
*
|
|
331
|
+
* Retrieves the status of all Algolia clusters and instances.
|
|
335
332
|
*
|
|
336
|
-
* @summary Send requests to the Algolia REST API.
|
|
337
|
-
* @param post - The post object.
|
|
338
|
-
* @param post.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
339
|
-
* @param post.parameters - Query parameters to apply to the current query.
|
|
340
|
-
* @param post.body - Parameters to send with the custom request.
|
|
341
333
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
342
334
|
*/
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
throw new Error('Parameter `path` is required when calling `post`.');
|
|
346
|
-
}
|
|
347
|
-
const requestPath = '/1{path}'.replace('{path}', path);
|
|
348
|
-
const headers = {};
|
|
349
|
-
const queryParameters = parameters ? parameters : {};
|
|
350
|
-
const request = {
|
|
351
|
-
method: 'POST',
|
|
352
|
-
path: requestPath,
|
|
353
|
-
queryParameters,
|
|
354
|
-
headers,
|
|
355
|
-
data: body ? body : {},
|
|
356
|
-
};
|
|
357
|
-
return transporter.request(request, requestOptions);
|
|
358
|
-
},
|
|
359
|
-
/**
|
|
360
|
-
* This method allow you to send requests to the Algolia REST API.
|
|
361
|
-
*
|
|
362
|
-
* @summary Send requests to the Algolia REST API.
|
|
363
|
-
* @param put - The put object.
|
|
364
|
-
* @param put.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
365
|
-
* @param put.parameters - Query parameters to apply to the current query.
|
|
366
|
-
* @param put.body - Parameters to send with the custom request.
|
|
367
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
368
|
-
*/
|
|
369
|
-
put({ path, parameters, body }, requestOptions) {
|
|
370
|
-
if (!path) {
|
|
371
|
-
throw new Error('Parameter `path` is required when calling `put`.');
|
|
372
|
-
}
|
|
373
|
-
const requestPath = '/1{path}'.replace('{path}', path);
|
|
335
|
+
getStatus(requestOptions) {
|
|
336
|
+
const requestPath = '/1/status';
|
|
374
337
|
const headers = {};
|
|
375
|
-
const queryParameters =
|
|
338
|
+
const queryParameters = {};
|
|
376
339
|
const request = {
|
|
377
|
-
method: '
|
|
340
|
+
method: 'GET',
|
|
378
341
|
path: requestPath,
|
|
379
342
|
queryParameters,
|
|
380
343
|
headers,
|
|
381
|
-
data: body ? body : {},
|
|
382
344
|
};
|
|
383
345
|
return transporter.request(request, requestOptions);
|
|
384
346
|
},
|
|
@@ -386,6 +348,7 @@ function createMonitoringClient({ appId: appIdOption, apiKey: apiKeyOption, auth
|
|
|
386
348
|
}
|
|
387
349
|
|
|
388
350
|
// 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.
|
|
351
|
+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
389
352
|
function monitoringClient(appId, apiKey, options) {
|
|
390
353
|
if (!appId || typeof appId !== 'string') {
|
|
391
354
|
throw new Error('`appId` is missing.');
|
|
@@ -393,21 +356,23 @@ function monitoringClient(appId, apiKey, options) {
|
|
|
393
356
|
if (!apiKey || typeof apiKey !== 'string') {
|
|
394
357
|
throw new Error('`apiKey` is missing.');
|
|
395
358
|
}
|
|
396
|
-
return
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
359
|
+
return {
|
|
360
|
+
...createMonitoringClient({
|
|
361
|
+
appId,
|
|
362
|
+
apiKey,
|
|
363
|
+
timeouts: {
|
|
364
|
+
connect: DEFAULT_CONNECT_TIMEOUT_NODE,
|
|
365
|
+
read: DEFAULT_READ_TIMEOUT_NODE,
|
|
366
|
+
write: DEFAULT_WRITE_TIMEOUT_NODE,
|
|
367
|
+
},
|
|
368
|
+
requester: createHttpRequester(),
|
|
369
|
+
algoliaAgents: [{ segment: 'Node.js', version: process.versions.node }],
|
|
370
|
+
responsesCache: createNullCache(),
|
|
371
|
+
requestsCache: createNullCache(),
|
|
372
|
+
hostsCache: createMemoryCache(),
|
|
373
|
+
...options,
|
|
374
|
+
}),
|
|
375
|
+
};
|
|
411
376
|
}
|
|
412
377
|
|
|
413
378
|
export { apiClientVersion, monitoringClient };
|
package/dist/monitoring.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! monitoring.umd.js | 1.0.0-alpha.
|
|
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)||"{}")}return{get:(e,t,r={miss:()=>Promise.resolve()})=>Promise.resolve().then((()=>{const r=JSON.stringify(e),s=a()[r];return Promise.all([s||t(),void 0!==s])})).then((([e,t])=>Promise.all([e,t||r.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve().then((()=>{const n=a();return n[JSON.stringify(e)]=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||null===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:String(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, contact support@algolia.com.",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 h extends i{constructor(e,t){super(e,"DeserializationError"),o(this,"response",void 0),this.response=t}}class d extends l{constructor(e,t,r,s){super(e,t,s,"DetailedApiError"),o(this,"error",void 0),this.error=r}}function m(e,t,r){const s=function(e){const t=e=>"[object Object]"===Object.prototype.toString.call(e)||"[object Array]"===Object.prototype.toString.call(e);return Object.keys(e).map((r=>`${r}=${encodeURIComponent(t(e[r])?JSON.stringify(e[r]):e[r])}`)).join("&")}(r);let a=`${e.protocol}://${e.url}/${"/"===t.charAt(0)?t.substr(1):t}`;return s.length&&(a+=`?${s}`),a}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 b=0;const T=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=g.timeout;void 0===a&&(a=f?o.read:o.write);const q={data:P,headers:w,method:c.method,url:m(s,c.path,v),connectTimeout:r(b,o.connect),responseTimeout:r(b,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&&0==~~t}({isTimedOut:e,status:t})||2!=~~(t/100)&&4!=~~(t/100)}(O)){const a=E(O);return O.isTimedOut&&b++,console.log("Retryable failure",p(a)),await t.set(s,n(s,O.isTimedOut?"timed out":"down")),T(e,r)}if(function({status:e}){return 2==~~(e/100)}(O))return function(e){try{return JSON.parse(e.content)}catch(t){throw new h(t.message,e)}}(O);throw E(O),function({content:e,status:t},r){try{const s=JSON.parse(e);return"error"in s?new d(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 T([...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.0.0-alpha.4";function P(e){return[{url:`${e}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${e}.algolia.net`,accept:"write",protocol:"https"}].concat(function(e){const t=e;for(let r=e.length-1;r>0;r--){const s=Math.floor(Math.random()*(r+1)),a=e[r];t[r]=e[s],t[s]=a}return t}([{url:`${e}-1.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${e}-2.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${e}-3.algolianet.com`,accept:"readWrite",protocol:"https"}]))}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:P(e),...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})},del({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `del`.");const s={method:"DELETE",path:"/1{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return o.request(s,r)},get({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `get`.");const s={method:"GET",path:"/1{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return o.request(s,r)},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)},getInventory(e){const t={method:"GET",path:"/1/inventory/servers",queryParameters:{},headers:{}};return o.request(t,e)},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)},getStatus(e){const t={method:"GET",path:"/1/status",queryParameters:{},headers:{}};return o.request(t,e)},post({path:e,parameters:t,body:r},s){if(!e)throw new Error("Parameter `path` is required when calling `post`.");const a={method:"POST",path:"/1{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return o.request(a,s)},put({path:e,parameters:t,body:r},s){if(!e)throw new Error("Parameter `path` is required when calling `put`.");const a={method:"PUT",path:"/1{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return o.request(a,s)}}}({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.0.0-alpha.40 | © 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){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+""}function i(e,t,r){return(t=o(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class c extends Error{constructor(e,t){super(e),i(this,"name","AlgoliaError"),t&&(this.name=t)}}class u extends c{constructor(e,t,r){super(e,r),i(this,"stackTrace",void 0),this.stackTrace=t}}class l extends u{constructor(e){super("Unreachable hosts - your application id may be incorrect. If the error persists, please create a ticket at https://support.algolia.com/ sharing steps we can use to reproduce the issue.",e,"RetryError")}}class m extends u{constructor(e,t,r,s="ApiError"){super(e,r,s),i(this,"status",void 0),this.status=t}}class h extends c{constructor(e,t){super(e,"DeserializationError"),i(this,"response",void 0),this.response=t}}class d extends m{constructor(e,t,r,s){super(e,t,s,"DetailedApiError"),i(this,"error",void 0),this.error=r}}function p(e,t,r){const s=function(e){const t=e=>"[object Object]"===Object.prototype.toString.call(e)||"[object Array]"===Object.prototype.toString.call(e);return Object.keys(e).map((r=>`${r}=${encodeURIComponent(t(e[r])?JSON.stringify(e[r]):e[r]).replaceAll("+","%20")}`)).join("&")}(r);let a=`${e.protocol}://${e.url}${e.port?`:${e.port}`:""}/${"/"===t.charAt(0)?t.substring(1):t}`;return s.length&&(a+=`?${s}`),a}function g(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 f({hosts:e,hostsCache:t,baseHeaders:r,baseQueryParameters:s,algoliaAgent:a,timeouts:o,requester:i,requestsCache:c,responsesCache:u}){async function f(c,u,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,u),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,u.headers),q="GET"===c.method?{...c.data,...u.data}:{},v={...s,...c.queryParameters,...q};if(a.value&&(v["x-algolia-agent"]=a.value),u&&u.queryParameters)for(const e of Object.keys(u.queryParameters))u.queryParameters[e]&&"[object Object]"!==Object.prototype.toString.call(u.queryParameters[e])?v[e]=u.queryParameters[e].toString():v[e]=u.queryParameters[e];let b=0;const T=async(e,r)=>{const s=e.pop();if(void 0===s)throw new l(function(e){return e.map((e=>g(e)))}(y));let a=f?u.timeouts?.read||o.read:u.timeouts?.write||o.write;const q={data:P,headers:w,method:c.method,url:p(s,c.path,v),connectTimeout:r(b,u.timeouts?.connect||o.connect),responseTimeout:r(b,a)},O=t=>{const r={request:q,response:t,host:s,triesLeft:e.length};return y.push(r),r},E=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)}(E)){const a=O(E);return E.isTimedOut&&b++,console.log("Retryable failure",g(a)),await t.set(s,n(s,E.isTimedOut?"timed out":"down")),T(e,r)}if(function({status:e}){return 2==~~(e/100)}(E))return function(e){try{return JSON.parse(e.content)}catch(t){throw new h(t.message,e)}}(E);throw O(E),function({content:e,status:t},r){try{const s=JSON.parse(e);return"error"in s?new d(s.message,t,s.error,r):new m(s.message,t,r)}catch(e){}return new m(e,t,r)}(E,y)},O=e.filter((e=>"readWrite"===e.accept||(f?"read"===e.accept:"write"===e.accept))),E=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}}(O);return T([...E.hosts].reverse(),E.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 u.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=>u.set(o,e)})},requestsCache:c,responsesCache:u}}function y({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 P="1.0.0-alpha.40";e.apiClientVersion=P,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=f({hosts:[{url:"status.algolia.com",accept:"readWrite",protocol:"https"}],...a,algoliaAgent:y({algoliaAgents:s,client:"Monitoring",version:P}),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:`${P}-${e}`}),s()]}),...n})}}));
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { CreateClientOptions, RequestOptions } from '@algolia/client-common';
|
|
2
|
-
import type {
|
|
2
|
+
import type { CustomDeleteProps, CustomGetProps, CustomPostProps, CustomPutProps, GetClusterIncidentsProps, GetClusterStatusProps, GetIndexingTimeProps, GetLatencyProps, GetMetricsProps, GetReachabilityProps } from '../model/clientMethodProps';
|
|
3
3
|
import type { IncidentsResponse } from '../model/incidentsResponse';
|
|
4
4
|
import type { IndexingTimeResponse } from '../model/indexingTimeResponse';
|
|
5
5
|
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.0.0-alpha.
|
|
9
|
+
export declare const apiClientVersion = "1.0.0-alpha.40";
|
|
10
10
|
export declare function createMonitoringClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, ...options }: CreateClientOptions): {
|
|
11
11
|
transporter: import("@algolia/client-common").Transporter;
|
|
12
12
|
/**
|
|
@@ -31,79 +31,84 @@ export declare function createMonitoringClient({ appId: appIdOption, apiKey: api
|
|
|
31
31
|
/**
|
|
32
32
|
* This method allow you to send requests to the Algolia REST API.
|
|
33
33
|
*
|
|
34
|
-
* @
|
|
35
|
-
* @param
|
|
36
|
-
* @param
|
|
37
|
-
* @param del.parameters - Query parameters to apply to the current query.
|
|
34
|
+
* @param customDelete - The customDelete object.
|
|
35
|
+
* @param customDelete.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
36
|
+
* @param customDelete.parameters - Query parameters to apply to the current query.
|
|
38
37
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
39
38
|
*/
|
|
40
|
-
|
|
39
|
+
customDelete({ path, parameters }: CustomDeleteProps, requestOptions?: RequestOptions): Promise<Record<string, any>>;
|
|
41
40
|
/**
|
|
42
41
|
* This method allow you to send requests to the Algolia REST API.
|
|
43
42
|
*
|
|
44
|
-
* @
|
|
45
|
-
* @param
|
|
46
|
-
* @param
|
|
47
|
-
* @param get.parameters - Query parameters to apply to the current query.
|
|
43
|
+
* @param customGet - The customGet object.
|
|
44
|
+
* @param customGet.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
45
|
+
* @param customGet.parameters - Query parameters to apply to the current query.
|
|
48
46
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
49
47
|
*/
|
|
50
|
-
|
|
48
|
+
customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, any>>;
|
|
51
49
|
/**
|
|
52
|
-
*
|
|
50
|
+
* This method allow you to send requests to the Algolia REST API.
|
|
51
|
+
*
|
|
52
|
+
* @param customPost - The customPost object.
|
|
53
|
+
* @param customPost.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
54
|
+
* @param customPost.parameters - Query parameters to apply to the current query.
|
|
55
|
+
* @param customPost.body - Parameters to send with the custom request.
|
|
56
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
57
|
+
*/
|
|
58
|
+
customPost({ path, parameters, body }: CustomPostProps, requestOptions?: RequestOptions): Promise<Record<string, any>>;
|
|
59
|
+
/**
|
|
60
|
+
* This method allow you to send requests to the Algolia REST API.
|
|
61
|
+
*
|
|
62
|
+
* @param customPut - The customPut object.
|
|
63
|
+
* @param customPut.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
64
|
+
* @param customPut.parameters - Query parameters to apply to the current query.
|
|
65
|
+
* @param customPut.body - Parameters to send with the custom request.
|
|
66
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
67
|
+
*/
|
|
68
|
+
customPut({ path, parameters, body }: CustomPutProps, requestOptions?: RequestOptions): Promise<Record<string, any>>;
|
|
69
|
+
/**
|
|
70
|
+
* Retrieves known incidents for the selected clusters.
|
|
53
71
|
*
|
|
54
|
-
* @summary List incidents for selected clusters.
|
|
55
72
|
* @param getClusterIncidents - The getClusterIncidents object.
|
|
56
73
|
* @param getClusterIncidents.clusters - Subset of clusters, separated by comma.
|
|
57
74
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
58
75
|
*/
|
|
59
76
|
getClusterIncidents({ clusters }: GetClusterIncidentsProps, requestOptions?: RequestOptions): Promise<IncidentsResponse>;
|
|
60
77
|
/**
|
|
61
|
-
*
|
|
78
|
+
* Retrieves the status of selected clusters.
|
|
62
79
|
*
|
|
63
|
-
* @summary List statuses of selected clusters.
|
|
64
80
|
* @param getClusterStatus - The getClusterStatus object.
|
|
65
81
|
* @param getClusterStatus.clusters - Subset of clusters, separated by comma.
|
|
66
82
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
67
83
|
*/
|
|
68
84
|
getClusterStatus({ clusters }: GetClusterStatusProps, requestOptions?: RequestOptions): Promise<StatusResponse>;
|
|
69
85
|
/**
|
|
70
|
-
*
|
|
86
|
+
* Retrieves known incidents for all clusters.
|
|
71
87
|
*
|
|
72
|
-
* @summary List incidents.
|
|
73
88
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
74
89
|
*/
|
|
75
90
|
getIncidents(requestOptions?: RequestOptions): Promise<IncidentsResponse>;
|
|
76
91
|
/**
|
|
77
|
-
*
|
|
92
|
+
* Retrieves average times for indexing operations for selected clusters.
|
|
78
93
|
*
|
|
79
|
-
* @summary Get indexing times.
|
|
80
94
|
* @param getIndexingTime - The getIndexingTime object.
|
|
81
95
|
* @param getIndexingTime.clusters - Subset of clusters, separated by comma.
|
|
82
96
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
83
97
|
*/
|
|
84
98
|
getIndexingTime({ clusters }: GetIndexingTimeProps, requestOptions?: RequestOptions): Promise<IndexingTimeResponse>;
|
|
85
99
|
/**
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
* @summary List servers.
|
|
89
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
90
|
-
*/
|
|
91
|
-
getInventory(requestOptions?: RequestOptions): Promise<InventoryResponse>;
|
|
92
|
-
/**
|
|
93
|
-
* List the average latency for search requests for selected clusters.
|
|
100
|
+
* Retrieves the average latency for search requests for selected clusters.
|
|
94
101
|
*
|
|
95
|
-
* @summary Get search latency times.
|
|
96
102
|
* @param getLatency - The getLatency object.
|
|
97
103
|
* @param getLatency.clusters - Subset of clusters, separated by comma.
|
|
98
104
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
99
105
|
*/
|
|
100
106
|
getLatency({ clusters }: GetLatencyProps, requestOptions?: RequestOptions): Promise<LatencyResponse>;
|
|
101
107
|
/**
|
|
102
|
-
*
|
|
108
|
+
* 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).
|
|
103
109
|
*
|
|
104
|
-
* @summary Get metrics for a given period.
|
|
105
110
|
* @param getMetrics - The getMetrics object.
|
|
106
|
-
* @param getMetrics.metric - Metric to report. For more information about the individual metrics, see the response. To include all metrics, use
|
|
111
|
+
* @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 `*`.
|
|
107
112
|
* @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.
|
|
108
113
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
109
114
|
*/
|
|
@@ -111,44 +116,22 @@ export declare function createMonitoringClient({ appId: appIdOption, apiKey: api
|
|
|
111
116
|
/**
|
|
112
117
|
* Test whether clusters are reachable or not.
|
|
113
118
|
*
|
|
114
|
-
* @summary Test the reachability of clusters.
|
|
115
119
|
* @param getReachability - The getReachability object.
|
|
116
120
|
* @param getReachability.clusters - Subset of clusters, separated by comma.
|
|
117
121
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
118
122
|
*/
|
|
119
123
|
getReachability({ clusters }: GetReachabilityProps, requestOptions?: RequestOptions): Promise<Record<string, Record<string, boolean>>>;
|
|
120
124
|
/**
|
|
121
|
-
*
|
|
125
|
+
* 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.
|
|
122
126
|
*
|
|
123
|
-
* @summary List cluster statuses.
|
|
124
127
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
125
128
|
*/
|
|
126
|
-
|
|
129
|
+
getServers(requestOptions?: RequestOptions): Promise<InventoryResponse>;
|
|
127
130
|
/**
|
|
128
|
-
*
|
|
131
|
+
* Retrieves the status of all Algolia clusters and instances.
|
|
129
132
|
*
|
|
130
|
-
* @summary Send requests to the Algolia REST API.
|
|
131
|
-
* @param post - The post object.
|
|
132
|
-
* @param post.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
133
|
-
* @param post.parameters - Query parameters to apply to the current query.
|
|
134
|
-
* @param post.body - Parameters to send with the custom request.
|
|
135
133
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
136
134
|
*/
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* This method allow you to send requests to the Algolia REST API.
|
|
140
|
-
*
|
|
141
|
-
* @summary Send requests to the Algolia REST API.
|
|
142
|
-
* @param put - The put object.
|
|
143
|
-
* @param put.path - Path of the endpoint, anything after \"/1\" must be specified.
|
|
144
|
-
* @param put.parameters - Query parameters to apply to the current query.
|
|
145
|
-
* @param put.body - Parameters to send with the custom request.
|
|
146
|
-
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
147
|
-
*/
|
|
148
|
-
put({ path, parameters, body }: PutProps, requestOptions?: RequestOptions): Promise<Record<string, any>>;
|
|
135
|
+
getStatus(requestOptions?: RequestOptions): Promise<StatusResponse>;
|
|
149
136
|
};
|
|
150
|
-
/**
|
|
151
|
-
* The client type.
|
|
152
|
-
*/
|
|
153
|
-
export type MonitoringClient = ReturnType<typeof createMonitoringClient>;
|
|
154
137
|
//# sourceMappingURL=monitoringClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"monitoringClient.d.ts","sourceRoot":"","sources":["../../src/monitoringClient.ts"],"names":[],"mappings":"
|
|
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,KAAK,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE9D,eAAO,MAAM,gBAAgB,mBAAmB,CAAC;AASjD,wBAAgB,sBAAsB,CAAC,EACrC,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,YAAY,EACpB,QAAQ,EACR,aAAa,EACb,GAAG,OAAO,EACX,EAAE,mBAAmB;;IAwBlB;;OAEG;;IAGH;;OAEG;kBACW,QAAQ,IAAI,CAAC;IAO3B;;OAEG;;IAKH;;;;;OAKG;6BACsB,MAAM,YAAY,MAAM,GAAG,IAAI;IAIxD;;;;;;;OAOG;uCAEqB,iBAAiB,mBACtB,cAAc,GAC9B,QAAQ,OAAO,MAAM,EAAE,GAAG,CAAC,CAAC;IAqB/B;;;;;;;OAOG;oCAEqB,cAAc,mBACnB,cAAc,GAC9B,QAAQ,OAAO,MAAM,EAAE,GAAG,CAAC,CAAC;IAqB/B;;;;;;;;OAQG;2CAE2B,eAAe,mBAC1B,cAAc,GAC9B,QAAQ,OAAO,MAAM,EAAE,GAAG,CAAC,CAAC;IAsB/B;;;;;;;;OAQG;0CAE2B,cAAc,mBACzB,cAAc,GAC9B,QAAQ,OAAO,MAAM,EAAE,GAAG,CAAC,CAAC;IAsB/B;;;;;;OAMG;sCAEa,wBAAwB,mBACrB,cAAc,GAC9B,QAAQ,iBAAiB,CAAC;IAwB7B;;;;;;OAMG;mCAEa,qBAAqB,mBAClB,cAAc,GAC9B,QAAQ,cAAc,CAAC;IAwB1B;;;;OAIG;kCAC2B,cAAc,GAAG,QAAQ,iBAAiB,CAAC;IAezE;;;;;;OAMG;kCAEa,oBAAoB,mBACjB,cAAc,GAC9B,QAAQ,oBAAoB,CAAC;IAwBhC;;;;;;OAMG;6BAEa,eAAe,mBACZ,cAAc,GAC9B,QAAQ,eAAe,CAAC;IAwB3B;;;;;;;OAOG;mCAEmB,eAAe,mBAClB,cAAc,GAC9B,QAAQ,sBAAsB,CAAC;IA6BlC;;;;;;OAMG;kCAEa,oBAAoB,mBACjB,cAAc,GAC9B,QAAQ,OAAO,MAAM,EAAE,OAAO,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAwBnD;;;;OAIG;gCACyB,cAAc,GAAG,QAAQ,iBAAiB,CAAC;IAevE;;;;OAIG;+BACwB,cAAc,GAAG,QAAQ,cAAc,CAAC;EAetE"}
|
package/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// eslint-disable-next-line import/no-commonjs,import/extensions
|
|
2
|
-
module.exports = require('./dist/monitoring.cjs
|
|
2
|
+
module.exports = require('./dist/monitoring.cjs');
|