@algolia/client-insights 5.55.1 → 5.56.0
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 +4 -4
- package/dist/browser.d.ts +74 -3
- package/dist/builds/browser.js +148 -1
- package/dist/builds/browser.js.map +1 -1
- package/dist/builds/browser.min.js +5 -5
- package/dist/builds/browser.min.js.map +1 -1
- package/dist/builds/browser.umd.js +7 -7
- package/dist/builds/fetch.js +148 -1
- package/dist/builds/fetch.js.map +1 -1
- package/dist/builds/node.cjs +148 -1
- package/dist/builds/node.cjs.map +1 -1
- package/dist/builds/node.js +148 -1
- package/dist/builds/node.js.map +1 -1
- package/dist/builds/worker.js +148 -1
- package/dist/builds/worker.js.map +1 -1
- package/dist/fetch.d.ts +74 -3
- package/dist/node.d.cts +74 -3
- package/dist/node.d.ts +74 -3
- package/dist/src/insightsClient.cjs +148 -1
- package/dist/src/insightsClient.cjs.map +1 -1
- package/dist/src/insightsClient.js +148 -1
- package/dist/src/insightsClient.js.map +1 -1
- package/dist/worker.d.ts +74 -3
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -40,11 +40,11 @@ All of our clients comes with type definition, and are available for both browse
|
|
|
40
40
|
### With a package manager
|
|
41
41
|
|
|
42
42
|
```bash
|
|
43
|
-
yarn add @algolia/client-insights@5.
|
|
43
|
+
yarn add @algolia/client-insights@5.56.0
|
|
44
44
|
# or
|
|
45
|
-
npm install @algolia/client-insights@5.
|
|
45
|
+
npm install @algolia/client-insights@5.56.0
|
|
46
46
|
# or
|
|
47
|
-
pnpm add @algolia/client-insights@5.
|
|
47
|
+
pnpm add @algolia/client-insights@5.56.0
|
|
48
48
|
```
|
|
49
49
|
|
|
50
50
|
### Without a package manager
|
|
@@ -52,7 +52,7 @@ pnpm add @algolia/client-insights@5.55.1
|
|
|
52
52
|
Add the following JavaScript snippet to the <head> of your website:
|
|
53
53
|
|
|
54
54
|
```html
|
|
55
|
-
<script src="https://cdn.jsdelivr.net/npm/@algolia/client-insights@5.
|
|
55
|
+
<script src="https://cdn.jsdelivr.net/npm/@algolia/client-insights@5.56.0/dist/builds/browser.umd.js"></script>
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
### Usage
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _algolia_client_common from '@algolia/client-common';
|
|
2
|
-
import { CreateClientOptions, RequestOptions, ClientOptions } from '@algolia/client-common';
|
|
2
|
+
import { CreateClientOptions, RequestOptions, AlgoliaHttpResponse, ClientOptions } from '@algolia/client-common';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The response of the Insights API.
|
|
@@ -574,14 +574,14 @@ type DeleteUserTokenProps = {
|
|
|
574
574
|
userToken: string;
|
|
575
575
|
};
|
|
576
576
|
|
|
577
|
-
declare const apiClientVersion = "5.
|
|
577
|
+
declare const apiClientVersion = "5.56.0";
|
|
578
578
|
declare const REGIONS: readonly ["de", "us"];
|
|
579
579
|
type Region = (typeof REGIONS)[number];
|
|
580
580
|
type RegionOptions = {
|
|
581
581
|
region?: Region | undefined;
|
|
582
582
|
};
|
|
583
583
|
declare function createInsightsClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, region: regionOption, ...options }: CreateClientOptions & RegionOptions): {
|
|
584
|
-
transporter: _algolia_client_common.
|
|
584
|
+
transporter: _algolia_client_common.TransporterWithHttpInfo;
|
|
585
585
|
/**
|
|
586
586
|
* The `appId` currently in use.
|
|
587
587
|
*/
|
|
@@ -622,6 +622,17 @@ declare function createInsightsClient({ appId: appIdOption, apiKey: apiKeyOption
|
|
|
622
622
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
623
623
|
*/
|
|
624
624
|
customDelete({ path, parameters }: CustomDeleteProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
|
|
625
|
+
/**
|
|
626
|
+
* This method lets you send requests to the Algolia REST API.
|
|
627
|
+
*
|
|
628
|
+
* Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.
|
|
629
|
+
* @param customDelete - The customDelete object.
|
|
630
|
+
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
|
|
631
|
+
* @param customDelete.parameters - Query parameters to apply to the current query.
|
|
632
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
633
|
+
* @see customDelete for the plain version.
|
|
634
|
+
*/
|
|
635
|
+
customDeleteWithHTTPInfo({ path, parameters }: CustomDeleteProps, requestOptions?: RequestOptions): Promise<AlgoliaHttpResponse<Record<string, unknown>>>;
|
|
625
636
|
/**
|
|
626
637
|
* This method lets you send requests to the Algolia REST API.
|
|
627
638
|
* @param customGet - The customGet object.
|
|
@@ -630,6 +641,17 @@ declare function createInsightsClient({ appId: appIdOption, apiKey: apiKeyOption
|
|
|
630
641
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
631
642
|
*/
|
|
632
643
|
customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
|
|
644
|
+
/**
|
|
645
|
+
* This method lets you send requests to the Algolia REST API.
|
|
646
|
+
*
|
|
647
|
+
* Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.
|
|
648
|
+
* @param customGet - The customGet object.
|
|
649
|
+
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
|
|
650
|
+
* @param customGet.parameters - Query parameters to apply to the current query.
|
|
651
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
652
|
+
* @see customGet for the plain version.
|
|
653
|
+
*/
|
|
654
|
+
customGetWithHTTPInfo({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<AlgoliaHttpResponse<Record<string, unknown>>>;
|
|
633
655
|
/**
|
|
634
656
|
* This method lets you send requests to the Algolia REST API.
|
|
635
657
|
* @param customPost - The customPost object.
|
|
@@ -639,6 +661,18 @@ declare function createInsightsClient({ appId: appIdOption, apiKey: apiKeyOption
|
|
|
639
661
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
640
662
|
*/
|
|
641
663
|
customPost({ path, parameters, body }: CustomPostProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
|
|
664
|
+
/**
|
|
665
|
+
* This method lets you send requests to the Algolia REST API.
|
|
666
|
+
*
|
|
667
|
+
* Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.
|
|
668
|
+
* @param customPost - The customPost object.
|
|
669
|
+
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
|
|
670
|
+
* @param customPost.parameters - Query parameters to apply to the current query.
|
|
671
|
+
* @param customPost.body - Parameters to send with the custom request.
|
|
672
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
673
|
+
* @see customPost for the plain version.
|
|
674
|
+
*/
|
|
675
|
+
customPostWithHTTPInfo({ path, parameters, body }: CustomPostProps, requestOptions?: RequestOptions): Promise<AlgoliaHttpResponse<Record<string, unknown>>>;
|
|
642
676
|
/**
|
|
643
677
|
* This method lets you send requests to the Algolia REST API.
|
|
644
678
|
* @param customPut - The customPut object.
|
|
@@ -648,6 +682,18 @@ declare function createInsightsClient({ appId: appIdOption, apiKey: apiKeyOption
|
|
|
648
682
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
649
683
|
*/
|
|
650
684
|
customPut({ path, parameters, body }: CustomPutProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>>;
|
|
685
|
+
/**
|
|
686
|
+
* This method lets you send requests to the Algolia REST API.
|
|
687
|
+
*
|
|
688
|
+
* Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.
|
|
689
|
+
* @param customPut - The customPut object.
|
|
690
|
+
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
|
|
691
|
+
* @param customPut.parameters - Query parameters to apply to the current query.
|
|
692
|
+
* @param customPut.body - Parameters to send with the custom request.
|
|
693
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
694
|
+
* @see customPut for the plain version.
|
|
695
|
+
*/
|
|
696
|
+
customPutWithHTTPInfo({ path, parameters, body }: CustomPutProps, requestOptions?: RequestOptions): Promise<AlgoliaHttpResponse<Record<string, unknown>>>;
|
|
651
697
|
/**
|
|
652
698
|
* Deletes all events related to the specified user token from events metrics and analytics. The deletion is asynchronous, and processed within 48 hours. To delete a personalization user profile, see `Delete a user profile` in the Personalization API.
|
|
653
699
|
*
|
|
@@ -658,6 +704,19 @@ declare function createInsightsClient({ appId: appIdOption, apiKey: apiKeyOption
|
|
|
658
704
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
659
705
|
*/
|
|
660
706
|
deleteUserToken({ userToken }: DeleteUserTokenProps, requestOptions?: RequestOptions): Promise<void>;
|
|
707
|
+
/**
|
|
708
|
+
* Deletes all events related to the specified user token from events metrics and analytics. The deletion is asynchronous, and processed within 48 hours. To delete a personalization user profile, see `Delete a user profile` in the Personalization API.
|
|
709
|
+
*
|
|
710
|
+
* Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.
|
|
711
|
+
*
|
|
712
|
+
* Required API Key ACLs:
|
|
713
|
+
* - deleteObject
|
|
714
|
+
* @param deleteUserToken - The deleteUserToken object.
|
|
715
|
+
* @param deleteUserToken.userToken - User token for which to delete all associated events.
|
|
716
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
717
|
+
* @see deleteUserToken for the plain version.
|
|
718
|
+
*/
|
|
719
|
+
deleteUserTokenWithHTTPInfo({ userToken }: DeleteUserTokenProps, requestOptions?: RequestOptions): Promise<AlgoliaHttpResponse<void>>;
|
|
661
720
|
/**
|
|
662
721
|
* Sends a list of events to the Insights API. You can include up to 1,000 events in a single request, but the request body must be smaller than 2 MB.
|
|
663
722
|
*
|
|
@@ -667,6 +726,18 @@ declare function createInsightsClient({ appId: appIdOption, apiKey: apiKeyOption
|
|
|
667
726
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
668
727
|
*/
|
|
669
728
|
pushEvents(insightsEvents: InsightsEvents, requestOptions?: RequestOptions): Promise<EventsResponse>;
|
|
729
|
+
/**
|
|
730
|
+
* Sends a list of events to the Insights API. You can include up to 1,000 events in a single request, but the request body must be smaller than 2 MB.
|
|
731
|
+
*
|
|
732
|
+
* Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.
|
|
733
|
+
*
|
|
734
|
+
* Required API Key ACLs:
|
|
735
|
+
* - search
|
|
736
|
+
* @param insightsEvents - The insightsEvents object.
|
|
737
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
738
|
+
* @see pushEvents for the plain version.
|
|
739
|
+
*/
|
|
740
|
+
pushEventsWithHTTPInfo(insightsEvents: InsightsEvents, requestOptions?: RequestOptions): Promise<AlgoliaHttpResponse<EventsResponse>>;
|
|
670
741
|
};
|
|
671
742
|
|
|
672
743
|
/**
|
package/dist/builds/browser.js
CHANGED
|
@@ -9,7 +9,7 @@ import { createXhrRequester } from "@algolia/requester-browser-xhr";
|
|
|
9
9
|
|
|
10
10
|
// src/insightsClient.ts
|
|
11
11
|
import { createAuth, createTransporter, getAlgoliaAgent, validateRequired } from "@algolia/client-common";
|
|
12
|
-
var apiClientVersion = "5.
|
|
12
|
+
var apiClientVersion = "5.56.0";
|
|
13
13
|
var REGIONS = ["de", "us"];
|
|
14
14
|
function getDefaultHosts(region) {
|
|
15
15
|
const url = !region ? "insights.algolia.io" : "insights.{region}.algolia.io".replace("{region}", region);
|
|
@@ -106,6 +106,29 @@ function createInsightsClient({
|
|
|
106
106
|
};
|
|
107
107
|
return transporter.request(request, requestOptions);
|
|
108
108
|
},
|
|
109
|
+
/**
|
|
110
|
+
* This method lets you send requests to the Algolia REST API.
|
|
111
|
+
*
|
|
112
|
+
* Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.
|
|
113
|
+
* @param customDelete - The customDelete object.
|
|
114
|
+
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
|
|
115
|
+
* @param customDelete.parameters - Query parameters to apply to the current query.
|
|
116
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
117
|
+
* @see customDelete for the plain version.
|
|
118
|
+
*/
|
|
119
|
+
customDeleteWithHTTPInfo({ path, parameters }, requestOptions) {
|
|
120
|
+
validateRequired("path", "customDeleteWithHTTPInfo", path);
|
|
121
|
+
const requestPath = "/{path}".replace("{path}", path);
|
|
122
|
+
const headers = {};
|
|
123
|
+
const queryParameters = parameters ? parameters : {};
|
|
124
|
+
const request = {
|
|
125
|
+
method: "DELETE",
|
|
126
|
+
path: requestPath,
|
|
127
|
+
queryParameters,
|
|
128
|
+
headers
|
|
129
|
+
};
|
|
130
|
+
return transporter.requestWithHttpInfo(request, requestOptions);
|
|
131
|
+
},
|
|
109
132
|
/**
|
|
110
133
|
* This method lets you send requests to the Algolia REST API.
|
|
111
134
|
* @param customGet - The customGet object.
|
|
@@ -126,6 +149,29 @@ function createInsightsClient({
|
|
|
126
149
|
};
|
|
127
150
|
return transporter.request(request, requestOptions);
|
|
128
151
|
},
|
|
152
|
+
/**
|
|
153
|
+
* This method lets you send requests to the Algolia REST API.
|
|
154
|
+
*
|
|
155
|
+
* Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.
|
|
156
|
+
* @param customGet - The customGet object.
|
|
157
|
+
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
|
|
158
|
+
* @param customGet.parameters - Query parameters to apply to the current query.
|
|
159
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
160
|
+
* @see customGet for the plain version.
|
|
161
|
+
*/
|
|
162
|
+
customGetWithHTTPInfo({ path, parameters }, requestOptions) {
|
|
163
|
+
validateRequired("path", "customGetWithHTTPInfo", path);
|
|
164
|
+
const requestPath = "/{path}".replace("{path}", path);
|
|
165
|
+
const headers = {};
|
|
166
|
+
const queryParameters = parameters ? parameters : {};
|
|
167
|
+
const request = {
|
|
168
|
+
method: "GET",
|
|
169
|
+
path: requestPath,
|
|
170
|
+
queryParameters,
|
|
171
|
+
headers
|
|
172
|
+
};
|
|
173
|
+
return transporter.requestWithHttpInfo(request, requestOptions);
|
|
174
|
+
},
|
|
129
175
|
/**
|
|
130
176
|
* This method lets you send requests to the Algolia REST API.
|
|
131
177
|
* @param customPost - The customPost object.
|
|
@@ -148,6 +194,31 @@ function createInsightsClient({
|
|
|
148
194
|
};
|
|
149
195
|
return transporter.request(request, requestOptions);
|
|
150
196
|
},
|
|
197
|
+
/**
|
|
198
|
+
* This method lets you send requests to the Algolia REST API.
|
|
199
|
+
*
|
|
200
|
+
* Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.
|
|
201
|
+
* @param customPost - The customPost object.
|
|
202
|
+
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
|
|
203
|
+
* @param customPost.parameters - Query parameters to apply to the current query.
|
|
204
|
+
* @param customPost.body - Parameters to send with the custom request.
|
|
205
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
206
|
+
* @see customPost for the plain version.
|
|
207
|
+
*/
|
|
208
|
+
customPostWithHTTPInfo({ path, parameters, body }, requestOptions) {
|
|
209
|
+
validateRequired("path", "customPostWithHTTPInfo", path);
|
|
210
|
+
const requestPath = "/{path}".replace("{path}", path);
|
|
211
|
+
const headers = {};
|
|
212
|
+
const queryParameters = parameters ? parameters : {};
|
|
213
|
+
const request = {
|
|
214
|
+
method: "POST",
|
|
215
|
+
path: requestPath,
|
|
216
|
+
queryParameters,
|
|
217
|
+
headers,
|
|
218
|
+
data: body ? body : {}
|
|
219
|
+
};
|
|
220
|
+
return transporter.requestWithHttpInfo(request, requestOptions);
|
|
221
|
+
},
|
|
151
222
|
/**
|
|
152
223
|
* This method lets you send requests to the Algolia REST API.
|
|
153
224
|
* @param customPut - The customPut object.
|
|
@@ -170,6 +241,31 @@ function createInsightsClient({
|
|
|
170
241
|
};
|
|
171
242
|
return transporter.request(request, requestOptions);
|
|
172
243
|
},
|
|
244
|
+
/**
|
|
245
|
+
* This method lets you send requests to the Algolia REST API.
|
|
246
|
+
*
|
|
247
|
+
* Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.
|
|
248
|
+
* @param customPut - The customPut object.
|
|
249
|
+
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
|
|
250
|
+
* @param customPut.parameters - Query parameters to apply to the current query.
|
|
251
|
+
* @param customPut.body - Parameters to send with the custom request.
|
|
252
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
253
|
+
* @see customPut for the plain version.
|
|
254
|
+
*/
|
|
255
|
+
customPutWithHTTPInfo({ path, parameters, body }, requestOptions) {
|
|
256
|
+
validateRequired("path", "customPutWithHTTPInfo", path);
|
|
257
|
+
const requestPath = "/{path}".replace("{path}", path);
|
|
258
|
+
const headers = {};
|
|
259
|
+
const queryParameters = parameters ? parameters : {};
|
|
260
|
+
const request = {
|
|
261
|
+
method: "PUT",
|
|
262
|
+
path: requestPath,
|
|
263
|
+
queryParameters,
|
|
264
|
+
headers,
|
|
265
|
+
data: body ? body : {}
|
|
266
|
+
};
|
|
267
|
+
return transporter.requestWithHttpInfo(request, requestOptions);
|
|
268
|
+
},
|
|
173
269
|
/**
|
|
174
270
|
* Deletes all events related to the specified user token from events metrics and analytics. The deletion is asynchronous, and processed within 48 hours. To delete a personalization user profile, see `Delete a user profile` in the Personalization API.
|
|
175
271
|
*
|
|
@@ -192,6 +288,31 @@ function createInsightsClient({
|
|
|
192
288
|
};
|
|
193
289
|
return transporter.request(request, requestOptions);
|
|
194
290
|
},
|
|
291
|
+
/**
|
|
292
|
+
* Deletes all events related to the specified user token from events metrics and analytics. The deletion is asynchronous, and processed within 48 hours. To delete a personalization user profile, see `Delete a user profile` in the Personalization API.
|
|
293
|
+
*
|
|
294
|
+
* Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.
|
|
295
|
+
*
|
|
296
|
+
* Required API Key ACLs:
|
|
297
|
+
* - deleteObject
|
|
298
|
+
* @param deleteUserToken - The deleteUserToken object.
|
|
299
|
+
* @param deleteUserToken.userToken - User token for which to delete all associated events.
|
|
300
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
301
|
+
* @see deleteUserToken for the plain version.
|
|
302
|
+
*/
|
|
303
|
+
deleteUserTokenWithHTTPInfo({ userToken }, requestOptions) {
|
|
304
|
+
validateRequired("userToken", "deleteUserTokenWithHTTPInfo", userToken);
|
|
305
|
+
const requestPath = "/1/usertokens/{userToken}".replace("{userToken}", encodeURIComponent(userToken));
|
|
306
|
+
const headers = {};
|
|
307
|
+
const queryParameters = {};
|
|
308
|
+
const request = {
|
|
309
|
+
method: "DELETE",
|
|
310
|
+
path: requestPath,
|
|
311
|
+
queryParameters,
|
|
312
|
+
headers
|
|
313
|
+
};
|
|
314
|
+
return transporter.requestWithHttpInfo(request, requestOptions);
|
|
315
|
+
},
|
|
195
316
|
/**
|
|
196
317
|
* Sends a list of events to the Insights API. You can include up to 1,000 events in a single request, but the request body must be smaller than 2 MB.
|
|
197
318
|
*
|
|
@@ -214,6 +335,32 @@ function createInsightsClient({
|
|
|
214
335
|
data: insightsEvents
|
|
215
336
|
};
|
|
216
337
|
return transporter.request(request, requestOptions);
|
|
338
|
+
},
|
|
339
|
+
/**
|
|
340
|
+
* Sends a list of events to the Insights API. You can include up to 1,000 events in a single request, but the request body must be smaller than 2 MB.
|
|
341
|
+
*
|
|
342
|
+
* Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.
|
|
343
|
+
*
|
|
344
|
+
* Required API Key ACLs:
|
|
345
|
+
* - search
|
|
346
|
+
* @param insightsEvents - The insightsEvents object.
|
|
347
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
348
|
+
* @see pushEvents for the plain version.
|
|
349
|
+
*/
|
|
350
|
+
pushEventsWithHTTPInfo(insightsEvents, requestOptions) {
|
|
351
|
+
validateRequired("insightsEvents", "pushEventsWithHTTPInfo", insightsEvents);
|
|
352
|
+
validateRequired("insightsEvents.events", "pushEventsWithHTTPInfo", insightsEvents.events);
|
|
353
|
+
const requestPath = "/1/events";
|
|
354
|
+
const headers = {};
|
|
355
|
+
const queryParameters = {};
|
|
356
|
+
const request = {
|
|
357
|
+
method: "POST",
|
|
358
|
+
path: requestPath,
|
|
359
|
+
queryParameters,
|
|
360
|
+
headers,
|
|
361
|
+
data: insightsEvents
|
|
362
|
+
};
|
|
363
|
+
return transporter.requestWithHttpInfo(request, requestOptions);
|
|
217
364
|
}
|
|
218
365
|
};
|
|
219
366
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../builds/browser.ts","../../src/insightsClient.ts"],"sourcesContent":["// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nimport {\n createBrowserLocalStorageCache,\n createFallbackableCache,\n createMemoryCache,\n createNullLogger,\n} from '@algolia/client-common';\nimport { createXhrRequester } from '@algolia/requester-browser-xhr';\n\nimport type { ClientOptions } from '@algolia/client-common';\n\nimport { apiClientVersion, createInsightsClient } from '../src/insightsClient';\n\nimport type { Region } from '../src/insightsClient';\nimport { REGIONS } from '../src/insightsClient';\n\nexport type { Region, RegionOptions } from '../src/insightsClient';\n\nexport { apiClientVersion } from '../src/insightsClient';\n\nexport * from '../model';\n\nexport function insightsClient(\n appId: string,\n apiKey: string,\n region?: Region | undefined,\n options?: ClientOptions | undefined,\n): InsightsClient {\n if (!appId || typeof appId !== 'string') {\n throw new Error('`appId` is missing.');\n }\n\n if (!apiKey || typeof apiKey !== 'string') {\n throw new Error('`apiKey` is missing.');\n }\n\n if (region && (typeof region !== 'string' || !REGIONS.includes(region))) {\n throw new Error(`\\`region\\` must be one of the following: ${REGIONS.join(', ')}`);\n }\n\n const { compression: _compression, ...browserOptions } = options || {};\n\n return createInsightsClient({\n appId,\n apiKey,\n region,\n timeouts: {\n connect: 1000,\n read: 2000,\n write: 30000,\n },\n logger: createNullLogger(),\n requester: createXhrRequester(),\n algoliaAgents: [{ segment: 'Browser' }],\n authMode: 'WithinQueryParameters',\n responsesCache: createMemoryCache(),\n requestsCache: createMemoryCache({ serializable: false }),\n hostsCache: createFallbackableCache({\n caches: [createBrowserLocalStorageCache({ key: `${apiClientVersion}-${appId}` }), createMemoryCache()],\n }),\n ...browserOptions,\n });\n}\n\nexport type InsightsClient = ReturnType<typeof createInsightsClient>;\n","// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nimport type {\n CreateClientOptions,\n Headers,\n Host,\n QueryParameters,\n Request,\n RequestOptions,\n} from '@algolia/client-common';\nimport { createAuth, createTransporter, getAlgoliaAgent, validateRequired } from '@algolia/client-common';\n\nimport type { EventsResponse } from '../model/eventsResponse';\nimport type { InsightsEvents } from '../model/insightsEvents';\n\nimport type {\n CustomDeleteProps,\n CustomGetProps,\n CustomPostProps,\n CustomPutProps,\n DeleteUserTokenProps,\n} from '../model/clientMethodProps';\n\nexport const apiClientVersion = '5.55.1';\n\nexport const REGIONS = ['de', 'us'] as const;\nexport type Region = (typeof REGIONS)[number];\nexport type RegionOptions = { region?: Region | undefined };\n\nfunction getDefaultHosts(region?: Region | undefined): Host[] {\n const url = !region ? 'insights.algolia.io' : 'insights.{region}.algolia.io'.replace('{region}', region);\n\n return [{ url, accept: 'readWrite', protocol: 'https' }];\n}\n\nexport function createInsightsClient({\n appId: appIdOption,\n apiKey: apiKeyOption,\n authMode,\n algoliaAgents,\n region: regionOption,\n ...options\n}: CreateClientOptions & RegionOptions) {\n const auth = createAuth(appIdOption, apiKeyOption, authMode);\n const transporter = createTransporter({\n hosts: getDefaultHosts(regionOption),\n ...options,\n algoliaAgent: getAlgoliaAgent({\n algoliaAgents,\n client: 'Insights',\n version: apiClientVersion,\n }),\n baseHeaders: {\n 'content-type': 'text/plain',\n ...auth.headers(),\n ...options.baseHeaders,\n },\n baseQueryParameters: {\n ...auth.queryParameters(),\n ...options.baseQueryParameters,\n },\n });\n\n return {\n transporter,\n\n /**\n * The `appId` currently in use.\n */\n appId: appIdOption,\n\n /**\n * The `apiKey` currently in use.\n */\n apiKey: apiKeyOption,\n\n /**\n * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.\n */\n clearCache(): Promise<void> {\n return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => undefined);\n },\n\n /**\n * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.\n */\n get _ua(): string {\n return transporter.algoliaAgent.value;\n },\n\n /**\n * Adds a `segment` to the `x-algolia-agent` sent with every requests.\n *\n * @param segment - The algolia agent (user-agent) segment to add.\n * @param version - The version of the agent.\n */\n addAlgoliaAgent(segment: string, version?: string | undefined): void {\n transporter.algoliaAgent.add({ segment, version });\n },\n\n /**\n * Helper method to switch the API key used to authenticate the requests.\n *\n * @param params - Method params.\n * @param params.apiKey - The new API Key to use.\n */\n setClientApiKey({ apiKey }: { apiKey: string }): void {\n if (!authMode || authMode === 'WithinHeaders') {\n transporter.baseHeaders['x-algolia-api-key'] = apiKey;\n } else {\n transporter.baseQueryParameters['x-algolia-api-key'] = apiKey;\n }\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customDelete - The customDelete object.\n * @param customDelete.path - Path of the endpoint, for example `1/newFeature`.\n * @param customDelete.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customDelete(\n { path, parameters }: CustomDeleteProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n validateRequired('path', 'customDelete', path);\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customGet - The customGet object.\n * @param customGet.path - Path of the endpoint, for example `1/newFeature`.\n * @param customGet.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>> {\n validateRequired('path', 'customGet', path);\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customPost - The customPost object.\n * @param customPost.path - Path of the endpoint, for example `1/newFeature`.\n * @param customPost.parameters - Query parameters to apply to the current query.\n * @param customPost.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPost(\n { path, parameters, body }: CustomPostProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n validateRequired('path', 'customPost', path);\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customPut - The customPut object.\n * @param customPut.path - Path of the endpoint, for example `1/newFeature`.\n * @param customPut.parameters - Query parameters to apply to the current query.\n * @param customPut.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPut(\n { path, parameters, body }: CustomPutProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n validateRequired('path', 'customPut', path);\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'PUT',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Deletes all events related to the specified user token from events metrics and analytics. The deletion is asynchronous, and processed within 48 hours. To delete a personalization user profile, see `Delete a user profile` in the Personalization API.\n *\n * Required API Key ACLs:\n * - deleteObject\n * @param deleteUserToken - The deleteUserToken object.\n * @param deleteUserToken.userToken - User token for which to delete all associated events.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n deleteUserToken({ userToken }: DeleteUserTokenProps, requestOptions?: RequestOptions): Promise<void> {\n validateRequired('userToken', 'deleteUserToken', userToken);\n\n const requestPath = '/1/usertokens/{userToken}'.replace('{userToken}', encodeURIComponent(userToken));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * Sends a list of events to the Insights API. You can include up to 1,000 events in a single request, but the request body must be smaller than 2 MB.\n *\n * Required API Key ACLs:\n * - search\n * @param insightsEvents - The insightsEvents object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n pushEvents(insightsEvents: InsightsEvents, requestOptions?: RequestOptions): Promise<EventsResponse> {\n validateRequired('insightsEvents', 'pushEvents', insightsEvents);\n\n validateRequired('insightsEvents.events', 'pushEvents', insightsEvents.events);\n\n const requestPath = '/1/events';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: insightsEvents,\n };\n\n return transporter.request(request, requestOptions);\n },\n };\n}\n"],"mappings":";AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,0BAA0B;;;ACEnC,SAAS,YAAY,mBAAmB,iBAAiB,wBAAwB;AAa1E,IAAM,mBAAmB;AAEzB,IAAM,UAAU,CAAC,MAAM,IAAI;AAIlC,SAAS,gBAAgB,QAAqC;AAC5D,QAAM,MAAM,CAAC,SAAS,wBAAwB,+BAA+B,QAAQ,YAAY,MAAM;AAEvG,SAAO,CAAC,EAAE,KAAK,QAAQ,aAAa,UAAU,QAAQ,CAAC;AACzD;AAEO,SAAS,qBAAqB;AAAA,EACnC,OAAO;AAAA,EACP,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR,GAAG;AACL,GAAwC;AACtC,QAAM,OAAO,WAAW,aAAa,cAAc,QAAQ;AAC3D,QAAM,cAAc,kBAAkB;AAAA,IACpC,OAAO,gBAAgB,YAAY;AAAA,IACnC,GAAG;AAAA,IACH,cAAc,gBAAgB;AAAA,MAC5B;AAAA,MACA,QAAQ;AAAA,MACR,SAAS;AAAA,IACX,CAAC;AAAA,IACD,aAAa;AAAA,MACX,gBAAgB;AAAA,MAChB,GAAG,KAAK,QAAQ;AAAA,MAChB,GAAG,QAAQ;AAAA,IACb;AAAA,IACA,qBAAqB;AAAA,MACnB,GAAG,KAAK,gBAAgB;AAAA,MACxB,GAAG,QAAQ;AAAA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B;AAAA,IAC9B,eAAe,CAAC,EAAE,SAAS,UAAU,CAAC;AAAA,IACtC,UAAU;AAAA,IACV,gBAAgB,kBAAkB;AAAA,IAClC,eAAe,kBAAkB,EAAE,cAAc,MAAM,CAAC;AAAA,IACxD,YAAY,wBAAwB;AAAA,MAClC,QAAQ,CAAC,+BAA+B,EAAE,KAAK,GAAG,gBAAgB,IAAI,KAAK,GAAG,CAAC,GAAG,kBAAkB,CAAC;AAAA,IACvG,CAAC;AAAA,IACD,GAAG;AAAA,EACL,CAAC;AACH;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../builds/browser.ts","../../src/insightsClient.ts"],"sourcesContent":["// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nimport {\n createBrowserLocalStorageCache,\n createFallbackableCache,\n createMemoryCache,\n createNullLogger,\n} from '@algolia/client-common';\nimport { createXhrRequester } from '@algolia/requester-browser-xhr';\n\nimport type { ClientOptions } from '@algolia/client-common';\n\nimport { apiClientVersion, createInsightsClient } from '../src/insightsClient';\n\nimport type { Region } from '../src/insightsClient';\nimport { REGIONS } from '../src/insightsClient';\n\nexport type { Region, RegionOptions } from '../src/insightsClient';\n\nexport { apiClientVersion } from '../src/insightsClient';\n\nexport * from '../model';\n\nexport function insightsClient(\n appId: string,\n apiKey: string,\n region?: Region | undefined,\n options?: ClientOptions | undefined,\n): InsightsClient {\n if (!appId || typeof appId !== 'string') {\n throw new Error('`appId` is missing.');\n }\n\n if (!apiKey || typeof apiKey !== 'string') {\n throw new Error('`apiKey` is missing.');\n }\n\n if (region && (typeof region !== 'string' || !REGIONS.includes(region))) {\n throw new Error(`\\`region\\` must be one of the following: ${REGIONS.join(', ')}`);\n }\n\n const { compression: _compression, ...browserOptions } = options || {};\n\n return createInsightsClient({\n appId,\n apiKey,\n region,\n timeouts: {\n connect: 1000,\n read: 2000,\n write: 30000,\n },\n logger: createNullLogger(),\n requester: createXhrRequester(),\n algoliaAgents: [{ segment: 'Browser' }],\n authMode: 'WithinQueryParameters',\n responsesCache: createMemoryCache(),\n requestsCache: createMemoryCache({ serializable: false }),\n hostsCache: createFallbackableCache({\n caches: [createBrowserLocalStorageCache({ key: `${apiClientVersion}-${appId}` }), createMemoryCache()],\n }),\n ...browserOptions,\n });\n}\n\nexport type InsightsClient = ReturnType<typeof createInsightsClient>;\n","// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.\n\nimport type {\n AlgoliaHttpResponse,\n CreateClientOptions,\n Headers,\n Host,\n QueryParameters,\n Request,\n RequestOptions,\n} from '@algolia/client-common';\nimport { createAuth, createTransporter, getAlgoliaAgent, validateRequired } from '@algolia/client-common';\n\nimport type { EventsResponse } from '../model/eventsResponse';\nimport type { InsightsEvents } from '../model/insightsEvents';\n\nimport type {\n CustomDeleteProps,\n CustomGetProps,\n CustomPostProps,\n CustomPutProps,\n DeleteUserTokenProps,\n} from '../model/clientMethodProps';\n\nexport const apiClientVersion = '5.56.0';\n\nexport const REGIONS = ['de', 'us'] as const;\nexport type Region = (typeof REGIONS)[number];\nexport type RegionOptions = { region?: Region | undefined };\n\nfunction getDefaultHosts(region?: Region | undefined): Host[] {\n const url = !region ? 'insights.algolia.io' : 'insights.{region}.algolia.io'.replace('{region}', region);\n\n return [{ url, accept: 'readWrite', protocol: 'https' }];\n}\n\nexport function createInsightsClient({\n appId: appIdOption,\n apiKey: apiKeyOption,\n authMode,\n algoliaAgents,\n region: regionOption,\n ...options\n}: CreateClientOptions & RegionOptions) {\n const auth = createAuth(appIdOption, apiKeyOption, authMode);\n const transporter = createTransporter({\n hosts: getDefaultHosts(regionOption),\n ...options,\n algoliaAgent: getAlgoliaAgent({\n algoliaAgents,\n client: 'Insights',\n version: apiClientVersion,\n }),\n baseHeaders: {\n 'content-type': 'text/plain',\n ...auth.headers(),\n ...options.baseHeaders,\n },\n baseQueryParameters: {\n ...auth.queryParameters(),\n ...options.baseQueryParameters,\n },\n });\n\n return {\n transporter,\n\n /**\n * The `appId` currently in use.\n */\n appId: appIdOption,\n\n /**\n * The `apiKey` currently in use.\n */\n apiKey: apiKeyOption,\n\n /**\n * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.\n */\n clearCache(): Promise<void> {\n return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => undefined);\n },\n\n /**\n * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.\n */\n get _ua(): string {\n return transporter.algoliaAgent.value;\n },\n\n /**\n * Adds a `segment` to the `x-algolia-agent` sent with every requests.\n *\n * @param segment - The algolia agent (user-agent) segment to add.\n * @param version - The version of the agent.\n */\n addAlgoliaAgent(segment: string, version?: string | undefined): void {\n transporter.algoliaAgent.add({ segment, version });\n },\n\n /**\n * Helper method to switch the API key used to authenticate the requests.\n *\n * @param params - Method params.\n * @param params.apiKey - The new API Key to use.\n */\n setClientApiKey({ apiKey }: { apiKey: string }): void {\n if (!authMode || authMode === 'WithinHeaders') {\n transporter.baseHeaders['x-algolia-api-key'] = apiKey;\n } else {\n transporter.baseQueryParameters['x-algolia-api-key'] = apiKey;\n }\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customDelete - The customDelete object.\n * @param customDelete.path - Path of the endpoint, for example `1/newFeature`.\n * @param customDelete.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customDelete(\n { path, parameters }: CustomDeleteProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n validateRequired('path', 'customDelete', path);\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n /**\n * This method lets you send requests to the Algolia REST API.\n *\n * Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.\n * @param customDelete - The customDelete object.\n * @param customDelete.path - Path of the endpoint, for example `1/newFeature`.\n * @param customDelete.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n * @see customDelete for the plain version.\n */\n customDeleteWithHTTPInfo(\n { path, parameters }: CustomDeleteProps,\n requestOptions?: RequestOptions,\n ): Promise<AlgoliaHttpResponse<Record<string, unknown>>> {\n validateRequired('path', 'customDeleteWithHTTPInfo', path);\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.requestWithHttpInfo(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customGet - The customGet object.\n * @param customGet.path - Path of the endpoint, for example `1/newFeature`.\n * @param customGet.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>> {\n validateRequired('path', 'customGet', path);\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n /**\n * This method lets you send requests to the Algolia REST API.\n *\n * Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.\n * @param customGet - The customGet object.\n * @param customGet.path - Path of the endpoint, for example `1/newFeature`.\n * @param customGet.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n * @see customGet for the plain version.\n */\n customGetWithHTTPInfo(\n { path, parameters }: CustomGetProps,\n requestOptions?: RequestOptions,\n ): Promise<AlgoliaHttpResponse<Record<string, unknown>>> {\n validateRequired('path', 'customGetWithHTTPInfo', path);\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.requestWithHttpInfo(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customPost - The customPost object.\n * @param customPost.path - Path of the endpoint, for example `1/newFeature`.\n * @param customPost.parameters - Query parameters to apply to the current query.\n * @param customPost.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPost(\n { path, parameters, body }: CustomPostProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n validateRequired('path', 'customPost', path);\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n /**\n * This method lets you send requests to the Algolia REST API.\n *\n * Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.\n * @param customPost - The customPost object.\n * @param customPost.path - Path of the endpoint, for example `1/newFeature`.\n * @param customPost.parameters - Query parameters to apply to the current query.\n * @param customPost.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n * @see customPost for the plain version.\n */\n customPostWithHTTPInfo(\n { path, parameters, body }: CustomPostProps,\n requestOptions?: RequestOptions,\n ): Promise<AlgoliaHttpResponse<Record<string, unknown>>> {\n validateRequired('path', 'customPostWithHTTPInfo', path);\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.requestWithHttpInfo(request, requestOptions);\n },\n\n /**\n * This method lets you send requests to the Algolia REST API.\n * @param customPut - The customPut object.\n * @param customPut.path - Path of the endpoint, for example `1/newFeature`.\n * @param customPut.parameters - Query parameters to apply to the current query.\n * @param customPut.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPut(\n { path, parameters, body }: CustomPutProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n validateRequired('path', 'customPut', path);\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'PUT',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n /**\n * This method lets you send requests to the Algolia REST API.\n *\n * Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.\n * @param customPut - The customPut object.\n * @param customPut.path - Path of the endpoint, for example `1/newFeature`.\n * @param customPut.parameters - Query parameters to apply to the current query.\n * @param customPut.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n * @see customPut for the plain version.\n */\n customPutWithHTTPInfo(\n { path, parameters, body }: CustomPutProps,\n requestOptions?: RequestOptions,\n ): Promise<AlgoliaHttpResponse<Record<string, unknown>>> {\n validateRequired('path', 'customPutWithHTTPInfo', path);\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'PUT',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.requestWithHttpInfo(request, requestOptions);\n },\n\n /**\n * Deletes all events related to the specified user token from events metrics and analytics. The deletion is asynchronous, and processed within 48 hours. To delete a personalization user profile, see `Delete a user profile` in the Personalization API.\n *\n * Required API Key ACLs:\n * - deleteObject\n * @param deleteUserToken - The deleteUserToken object.\n * @param deleteUserToken.userToken - User token for which to delete all associated events.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n deleteUserToken({ userToken }: DeleteUserTokenProps, requestOptions?: RequestOptions): Promise<void> {\n validateRequired('userToken', 'deleteUserToken', userToken);\n\n const requestPath = '/1/usertokens/{userToken}'.replace('{userToken}', encodeURIComponent(userToken));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n /**\n * Deletes all events related to the specified user token from events metrics and analytics. The deletion is asynchronous, and processed within 48 hours. To delete a personalization user profile, see `Delete a user profile` in the Personalization API.\n *\n * Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.\n *\n * Required API Key ACLs:\n * - deleteObject\n * @param deleteUserToken - The deleteUserToken object.\n * @param deleteUserToken.userToken - User token for which to delete all associated events.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n * @see deleteUserToken for the plain version.\n */\n deleteUserTokenWithHTTPInfo(\n { userToken }: DeleteUserTokenProps,\n requestOptions?: RequestOptions,\n ): Promise<AlgoliaHttpResponse<void>> {\n validateRequired('userToken', 'deleteUserTokenWithHTTPInfo', userToken);\n\n const requestPath = '/1/usertokens/{userToken}'.replace('{userToken}', encodeURIComponent(userToken));\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.requestWithHttpInfo(request, requestOptions);\n },\n\n /**\n * Sends a list of events to the Insights API. You can include up to 1,000 events in a single request, but the request body must be smaller than 2 MB.\n *\n * Required API Key ACLs:\n * - search\n * @param insightsEvents - The insightsEvents object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n pushEvents(insightsEvents: InsightsEvents, requestOptions?: RequestOptions): Promise<EventsResponse> {\n validateRequired('insightsEvents', 'pushEvents', insightsEvents);\n\n validateRequired('insightsEvents.events', 'pushEvents', insightsEvents.events);\n\n const requestPath = '/1/events';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: insightsEvents,\n };\n\n return transporter.request(request, requestOptions);\n },\n /**\n * Sends a list of events to the Insights API. You can include up to 1,000 events in a single request, but the request body must be smaller than 2 MB.\n *\n * Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.\n *\n * Required API Key ACLs:\n * - search\n * @param insightsEvents - The insightsEvents object.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n * @see pushEvents for the plain version.\n */\n pushEventsWithHTTPInfo(\n insightsEvents: InsightsEvents,\n requestOptions?: RequestOptions,\n ): Promise<AlgoliaHttpResponse<EventsResponse>> {\n validateRequired('insightsEvents', 'pushEventsWithHTTPInfo', insightsEvents);\n\n validateRequired('insightsEvents.events', 'pushEventsWithHTTPInfo', insightsEvents.events);\n\n const requestPath = '/1/events';\n const headers: Headers = {};\n const queryParameters: QueryParameters = {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: insightsEvents,\n };\n\n return transporter.requestWithHttpInfo(request, requestOptions);\n },\n };\n}\n"],"mappings":";AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,0BAA0B;;;ACGnC,SAAS,YAAY,mBAAmB,iBAAiB,wBAAwB;AAa1E,IAAM,mBAAmB;AAEzB,IAAM,UAAU,CAAC,MAAM,IAAI;AAIlC,SAAS,gBAAgB,QAAqC;AAC5D,QAAM,MAAM,C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A,aAAO,YAAY,oBAAoB,SAAS,cAAc;AAAA,IAChE;AAAA,EACF;AACF;;;ADvbO,SAAS,eACd,OACA,QACA,QACA,SACgB;AAChB,MAAI,CAAC,SAAS,OAAO,UAAU,UAAU;AACvC,UAAM,IAAI,MAAM,qBAAqB;AAAA,EACvC;AAEA,MAAI,CAAC,UAAU,OAAO,WAAW,UAAU;AACzC,UAAM,IAAI,MAAM,sBAAsB;AAAA,EACxC;AAEA,MAAI,WAAW,OAAO,WAAW,YAAY,CAAC,QAAQ,SAAS,MAAM,IAAI;AACvE,UAAM,IAAI,MAAM,4CAA4C,QAAQ,KAAK,IAAI,CAAC,EAAE;AAAA,EAClF;AAEA,QAAM,EAAE,aAAa,cAAc,GAAG,eAAe,IAAI,WAAW,CAAC;AAErE,SAAO,qBAAqB;AAAA,IAC1B;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU;AAAA,MACR,SAAS;AAAA,MACT,MAAM;AAAA,MACN,OAAO;AAAA,IACT;AAAA,IACA,QAAQ,iBAAiB;AAAA,IACzB,WAAW,mBAAmB;AAAA,IAC9B,eAAe,CAAC,EAAE,SAAS,UAAU,CAAC;AAAA,IACtC,UAAU;AAAA,IACV,gBAAgB,kBAAkB;AAAA,IAClC,eAAe,kBAAkB,EAAE,cAAc,MAAM,CAAC;AAAA,IACxD,YAAY,wBAAwB;AAAA,MAClC,QAAQ,CAAC,+BAA+B,EAAE,KAAK,GAAG,gBAAgB,IAAI,KAAK,GAAG,CAAC,GAAG,kBAAkB,CAAC;AAAA,IACvG,CAAC;AAAA,IACD,GAAG;AAAA,EACL,CAAC;AACH;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
function
|
|
2
|
-
`&&(
|
|
3
|
-
`,
|
|
4
|
-
`?2:1:(
|
|
5
|
-
`),event:t,id:this.lastEventId,retry:this.retry};return this.data=[],e}};async function*pe(t){let e=new he;for await(let n of fe(t)){let r=e.decode(n);r!==null&&(yield r)}}var ge=750,G=120*1e3;function Q(t,e="up"){let n=Date.now();function r(){return e==="up"||Date.now()-n>G}function o(){return e==="timed out"&&Date.now()-n<=G}return{...t,status:e,lastUpdate:n,isUp:r,isTimedOut:o}}var re=class extends Error{name="AlgoliaError";constructor(t,e){super(t),e&&(this.name=e)}};var ne=class extends re{stackTrace;constructor(t,e,n){super(t,n),this.stackTrace=e}},B=class extends ne{constructor(t){super("Unreachable hosts - your application id may be incorrect. If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support",t,"RetryError")}},H=class extends ne{status;constructor(t,e,n,r="ApiError"){super(t,n,r),this.status=e}},ye=class extends re{response;constructor(t,e){super(t,"DeserializationError"),this.response=e}},Pe=class extends H{error;constructor(t,e,n,r){super(t,e,r,"DetailedApiError"),this.error=n}};function X(t,e,n){let r=Ee(n),o=`${t.protocol}://${t.url}${t.port?`:${t.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return r.length&&(o+=`?${r}`),o}function Ee(t){return Object.keys(t).filter(e=>t[e]!==void 0).sort().map(e=>`${e}=${encodeURIComponent(Object.prototype.toString.call(t[e])==="[object Array]"?t[e].join(","):t[e]).replace(/\+/g,"%20")}`).join("&")}function K(t,e){if(t.method==="GET"||t.data===void 0&&e.data===void 0)return;let n=Array.isArray(t.data)?t.data:{...t.data,...e.data};return JSON.stringify(n)}function V(t,e,n){let r={Accept:"application/json",...t,...e,...n},o={};return Object.keys(r).forEach(c=>{let m=r[c];o[c.toLowerCase()]=m}),o}function ve(t){if(!(t.status===204||t.content.length===0))try{return JSON.parse(t.content)}catch(e){throw new ye(e.message,t)}}function Te({content:t,status:e},n){try{let r=JSON.parse(t);return"error"in r?new Pe(r.message,e,r.error,n):new H(r.message,e,n)}catch{}return new H(t,e,n)}function xe({isTimedOut:t,status:e}){return!t&&~~e===0}function we({isTimedOut:t,status:e}){return t||xe({isTimedOut:t,status:e})||~~(e/100)!==2&&~~(e/100)!==4}function Re({status:t}){return~~(t/100)===2}function Se(t){return t.map(e=>se(e))}function se(t){let e=t.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...t,request:{...t.request,headers:{...t.request.headers,...e}}}}function oe({hosts:t,hostsCache:e,baseHeaders:n,logger:r,baseQueryParameters:o,algoliaAgent:c,timeouts:m,requester:i,requestsCache:s,responsesCache:a,compress:d,compression:h}){async function g(u){let l=await Promise.all(u.map(f=>e.get(f,()=>Promise.resolve(Q(f))))),R=l.filter(f=>f.isUp()),v=l.filter(f=>f.isTimedOut()),w=[...R,...v];return{hosts:w.length>0?w:u,getTimeout(f,S){return(v.length===0&&f===0?1:v.length+3+f)*S}}}async function p(u,l,R){let v=[],w=K(u,l),y=V(n,u.headers,l.headers),f=h==="gzip"&&w!==void 0&&w.length>ge&&(u.method==="POST"||u.method==="PUT");f&&d===void 0&&r.info("Compression is disabled because no compress method is available.");let S=f&&d!==void 0,L=S?await d(w):w;S&&(y["content-encoding"]="gzip");let _=u.method==="GET"?{...u.data,...l.data}:{},b={...o,...u.queryParameters,..._};if(c.value&&(b["x-algolia-agent"]=c.value),l&&l.queryParameters)for(let P of Object.keys(l.queryParameters))!l.queryParameters[P]||Object.prototype.toString.call(l.queryParameters[P])==="[object Object]"?b[P]=l.queryParameters[P]:b[P]=l.queryParameters[P].toString();let C=0,N=async(P,U)=>{let k=P.pop();if(k===void 0)throw new B(Se(v));let $={...m,...l.timeouts},z={data:L,headers:y,method:u.method,url:X(k,u.path,b),connectTimeout:U(C,$.connect),responseTimeout:U(C,R?$.read:$.write)},J=j=>{let M={request:z,response:j,host:k,triesLeft:P.length};return v.push(M),M},A=await i.send(z);if(we(A)){let j=J(A);return A.isTimedOut&&C++,r.info("Retryable failure",se(j)),await e.set(k,Q(k,A.isTimedOut?"timed out":"down")),N(P,U)}if(Re(A))return ve(A);throw J(A),Te(A,v)},T=t.filter(P=>P.accept==="readWrite"||(R?P.accept==="read":P.accept==="write")),W=await g(T);return N([...W.hosts].reverse(),W.getTimeout)}function E(u,l={}){let R=()=>p(u,l,v),v=u.useReadTransporter||u.method==="GET";if((l.cacheable||u.cacheable)!==!0)return R();let y={request:u,requestOptions:l,transporter:{queryParameters:o,headers:n}};return a.get(y,()=>s.get(y,()=>s.set(y,R()).then(f=>Promise.all([s.delete(y),f]),f=>Promise.all([s.delete(y),Promise.reject(f)])).then(([f,S])=>S)),{miss:f=>a.set(y,f)})}async function*x(u,l={}){if(!i.sendStream)throw new Error("This requester does not support streaming");let R=K(u,l),v=V(n,u.headers,l.headers);v.accept="text/event-stream";let w=u.method==="GET"?{...u.data,...l.data}:{},y={...o,...u.queryParameters,...w};if(c.value&&(y["x-algolia-agent"]=c.value),l&&l.queryParameters)for(let T of Object.keys(l.queryParameters))!l.queryParameters[T]||Object.prototype.toString.call(l.queryParameters[T])==="[object Object]"?y[T]=l.queryParameters[T]:y[T]=l.queryParameters[T].toString();let f=u.useReadTransporter||u.method==="GET",S=t.filter(T=>T.accept==="readWrite"||(f?T.accept==="read":T.accept==="write")),_=(await g(S)).hosts[0];if(!_)throw new B([]);let b={...m,...l.timeouts},C={data:R,headers:v,method:u.method,url:X(_,u.path,y),connectTimeout:b.connect,responseTimeout:f?b.read:b.write},N=await i.sendStream(C);yield*pe(N)}return{hostsCache:e,requester:i,timeouts:m,logger:r,algoliaAgent:c,baseHeaders:n,baseQueryParameters:o,hosts:t,request:E,requestStream:x,requestsCache:s,responsesCache:a}}function O(t,e,n){if(n==null||typeof n=="string"&&n.length===0)throw new Error(`Parameter \`${t}\` is required when calling \`${e}\`.`)}function ae(){function t(e){return new Promise(n=>{let r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach(i=>r.setRequestHeader(i,e.headers[i]));let o=(i,s)=>setTimeout(()=>{r.abort(),n({status:0,content:s,isTimedOut:!0})},i),c=o(e.connectTimeout,"Connection timeout"),m;r.onreadystatechange=()=>{r.readyState>r.OPENED&&m===void 0&&(clearTimeout(c),m=o(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{r.status===0&&(clearTimeout(c),clearTimeout(m),n({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(c),clearTimeout(m),n({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)})}return{send:t}}var D="5.55.1",F=["de","us"];function be(t){return[{url:t?"insights.{region}.algolia.io".replace("{region}",t):"insights.algolia.io",accept:"readWrite",protocol:"https"}]}function ie({appId:t,apiKey:e,authMode:n,algoliaAgents:r,region:o,...c}){let m=Z(t,e,n),i=oe({hosts:be(o),...c,algoliaAgent:ee({algoliaAgents:r,client:"Insights",version:D}),baseHeaders:{"content-type":"text/plain",...m.headers(),...c.baseHeaders},baseQueryParameters:{...m.queryParameters(),...c.baseQueryParameters}});return{transporter:i,appId:t,apiKey:e,clearCache(){return Promise.all([i.requestsCache.clear(),i.responsesCache.clear()]).then(()=>{})},get _ua(){return i.algoliaAgent.value},addAlgoliaAgent(s,a){i.algoliaAgent.add({segment:s,version:a})},setClientApiKey({apiKey:s}){!n||n==="WithinHeaders"?i.baseHeaders["x-algolia-api-key"]=s:i.baseQueryParameters["x-algolia-api-key"]=s},customDelete({path:s,parameters:a},d){O("path","customDelete",s);let E={method:"DELETE",path:"/{path}".replace("{path}",s),queryParameters:a||{},headers:{}};return i.request(E,d)},customGet({path:s,parameters:a},d){O("path","customGet",s);let E={method:"GET",path:"/{path}".replace("{path}",s),queryParameters:a||{},headers:{}};return i.request(E,d)},customPost({path:s,parameters:a,body:d},h){O("path","customPost",s);let x={method:"POST",path:"/{path}".replace("{path}",s),queryParameters:a||{},headers:{},data:d||{}};return i.request(x,h)},customPut({path:s,parameters:a,body:d},h){O("path","customPut",s);let x={method:"PUT",path:"/{path}".replace("{path}",s),queryParameters:a||{},headers:{},data:d||{}};return i.request(x,h)},deleteUserToken({userToken:s},a){O("userToken","deleteUserToken",s);let p={method:"DELETE",path:"/1/usertokens/{userToken}".replace("{userToken}",encodeURIComponent(s)),queryParameters:{},headers:{}};return i.request(p,a)},pushEvents(s,a){O("insightsEvents","pushEvents",s),O("insightsEvents.events","pushEvents",s.events);let p={method:"POST",path:"/1/events",queryParameters:{},headers:{},data:s};return i.request(p,a)}}}function pt(t,e,n,r){if(!t||typeof t!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");if(n&&(typeof n!="string"||!F.includes(n)))throw new Error(`\`region\` must be one of the following: ${F.join(", ")}`);let{compression:o,...c}=r||{};return ie({appId:t,apiKey:e,region:n,timeouts:{connect:1e3,read:2e3,write:3e4},logger:te(),requester:ae(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:q(),requestsCache:q({serializable:!1}),hostsCache:I({caches:[Y({key:`${D}-${t}`}),q()]}),...c})}export{D as apiClientVersion,pt as insightsClient};
|
|
1
|
+
function Z(e){let t,s=`algolia-client-js-${e.key}`;function r(){return t===void 0&&(t=e.localStorage||window.localStorage),t}function a(){return JSON.parse(r().getItem(s)||"{}")}function d(n){r().setItem(s,JSON.stringify(n))}function f(){return new Promise(n=>setTimeout(n,0))}function c(){let n=e.timeToLive?e.timeToLive*1e3:null,o=a(),i=new Date().getTime(),h=!1;return{namespace:Object.fromEntries(Object.entries(o).filter(([,m])=>!m||m.timestamp===void 0||n&&m.timestamp+n<i?(h=!0,!1):!0)),changed:h}}return{get(n,o,i={miss:()=>Promise.resolve()}){return f().then(()=>{let{namespace:h,changed:P}=c(),m=h[JSON.stringify(n)];return P&&d(h),m?m.value:o().then(g=>i.miss(g).then(()=>g))})},set(n,o){return f().then(()=>{let i=a();return i[JSON.stringify(n)]={timestamp:new Date().getTime(),value:o},r().setItem(s,JSON.stringify(i)),o})},delete(n){return f().then(()=>{let o=a();delete o[JSON.stringify(n)],r().setItem(s,JSON.stringify(o))})},clear(){return Promise.resolve().then(()=>{r().removeItem(s)})}}}function le(){return{get(e,t,s={miss:()=>Promise.resolve()}){return t().then(a=>Promise.all([a,s.miss(a)])).then(([a])=>a)},set(e,t){return Promise.resolve(t)},delete(e){return Promise.resolve()},clear(){return Promise.resolve()}}}function O(e){let t=[...e.caches],s=t.shift();return s===void 0?le():{get(r,a,d={miss:()=>Promise.resolve()}){return s.get(r,a,d).catch(()=>O({caches:t}).get(r,a,d))},set(r,a){return s.set(r,a).catch(()=>O({caches:t}).set(r,a))},delete(r){return s.delete(r).catch(()=>O({caches:t}).delete(r))},clear(){return s.clear().catch(()=>O({caches:t}).clear())}}}function W(e={serializable:!0}){let t={};return{get(s,r,a={miss:()=>Promise.resolve()}){let d=JSON.stringify(s);if(d in t)return Promise.resolve(e.serializable?JSON.parse(t[d]):t[d]);let f=r();return f.then(c=>a.miss(c)).then(()=>f)},set(s,r){return t[JSON.stringify(s)]=e.serializable?JSON.stringify(r):r,Promise.resolve(r)},delete(s){return delete t[JSON.stringify(s)],Promise.resolve()},clear(){return t={},Promise.resolve()}}}function de(e){let t={value:`Algolia for JavaScript (${e})`,add(s){let r=`; ${s.segment}${s.version!==void 0?` (${s.version})`:""}`;return t.value.indexOf(r)===-1&&(t.value=`${t.value}${r}`),t}};return t}function ee(e,t,s="WithinHeaders"){let r={"x-algolia-api-key":t,"x-algolia-application-id":e};return{headers(){return s==="WithinHeaders"?r:{}},queryParameters(){return s==="WithinQueryParameters"?r:{}}}}function te({algoliaAgents:e,client:t,version:s}){let r=de(s).add({segment:t,version:s});return e.forEach(a=>r.add(a)),r}function re(){return{debug(e,t){return Promise.resolve()},info(e,t){return Promise.resolve()},error(e,t){return Promise.resolve()}}}var me=10*1024*1024;async function*he(e){let t=e.getReader();try{for(;;){let{done:s,value:r}=await t.read();if(s)return;yield r}}finally{t.releaseLock()}}function pe(e){return Symbol.asyncIterator in e?e:he(e)}async function*fe(e){let t=new TextDecoder("utf-8"),s=[],r=0,a=!1,d=!0;for await(let c of pe(e)){let n=t.decode(c,{stream:!0}),o=0;for(a&&(a=!1,n.length>0&&n[0]===`
|
|
2
|
+
`&&(o=1));o<n.length;){let i=n.indexOf("\r",o),h=n.indexOf(`
|
|
3
|
+
`,o);if(i===-1&&h===-1){let C=n.slice(o);if(s.push(C),r+=C.length,r>me)throw new Error("SSE line buffer exceeded 10MB");break}let P,m;i!==-1&&(h===-1||i<h)?(P=i,i+1<n.length?m=n[i+1]===`
|
|
4
|
+
`?2:1:(a=!0,m=1)):(P=h,m=1);let g=n.slice(o,P);s.push(g);let E=s.length===1?s[0]:s.join("");s.length=0,r=0,d&&(E.startsWith("\uFEFF")&&(E=E.slice(1)),d=!1),yield E,o=P+m}}let f=t.decode();if(f&&s.push(f),s.length>0){let c=s.join("");d&&c.startsWith("\uFEFF")&&(c=c.slice(1)),yield c}}var Pe=class{data=[];eventType="";lastEventId=null;retry=null;decode(e){if(e==="")return this.dispatch();if(e[0]===":")return null;let t=e.indexOf(":"),s,r;switch(t===-1?(s=e,r=""):(s=e.slice(0,t),r=e.slice(t+1),r[0]===" "&&(r=r.slice(1))),s){case"data":this.data.push(r);break;case"event":this.eventType=r;break;case"id":r.includes("\0")||(this.lastEventId=r);break;case"retry":/^[0-9]+$/.test(r)&&(this.retry=parseInt(r,10));break}return null}dispatch(){let e=this.eventType;if(this.eventType="",this.data.length===0)return null;let t={data:this.data.join(`
|
|
5
|
+
`),event:e,id:this.lastEventId,retry:this.retry};return this.data=[],t}};async function*ge(e){let t=new Pe;for await(let s of fe(e)){let r=t.decode(s);r!==null&&(yield r)}}var ye=750,M=120*1e3;function B(e,t="up"){let s=Date.now();function r(){return t==="up"||Date.now()-s>M}function a(){return t==="timed out"&&Date.now()-s<=M}return{...e,status:t,lastUpdate:s,isUp:r,isTimedOut:a}}var se=class extends Error{name="AlgoliaError";constructor(e,t){super(e),t&&(this.name=t)}};var ne=class extends se{stackTrace;constructor(e,t,s){super(e,s),this.stackTrace=t}},X=class extends ne{constructor(e){super("Unreachable hosts - your application id may be incorrect. If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support",e,"RetryError")}},j=class extends ne{status;constructor(e,t,s,r="ApiError"){super(e,s,r),this.status=t}},Te=class extends se{response;constructor(e,t){super(e,"DeserializationError"),this.response=t}},Ee=class extends j{error;constructor(e,t,s,r){super(e,t,r,"DetailedApiError"),this.error=s}};function K(e,t,s){let r=ve(s),a=`${e.protocol}://${e.url}${e.port?`:${e.port}`:""}/${t.charAt(0)==="/"?t.substring(1):t}`;return r.length&&(a+=`?${r}`),a}function ve(e){return Object.keys(e).filter(t=>e[t]!==void 0).sort().map(t=>`${t}=${encodeURIComponent(Object.prototype.toString.call(e[t])==="[object Array]"?e[t].join(","):e[t]).replace(/\+/g,"%20")}`).join("&")}function V(e,t){if(e.method==="GET"||e.data===void 0&&t.data===void 0)return;let s=Array.isArray(e.data)?e.data:{...e.data,...t.data};return JSON.stringify(s)}function Y(e,t,s){let r={Accept:"application/json",...e,...t,...s},a={};return Object.keys(r).forEach(d=>{let f=r[d];a[d.toLowerCase()]=f}),a}function oe(e){if(!(e.status===204||e.content.length===0))try{return JSON.parse(e.content)}catch(t){throw new Te(t.message,e)}}function Re(e){return{status:e.status,headers:e.headers,content:e.content,data:oe(e)}}function qe({content:e,status:t},s){try{let r=JSON.parse(e);return"error"in r?new Ee(r.message,t,r.error,s):new j(r.message,t,s)}catch{}return new j(e,t,s)}function xe({isTimedOut:e,status:t}){return!e&&~~t===0}function we({isTimedOut:e,status:t}){return e||xe({isTimedOut:e,status:t})||~~(t/100)!==2&&~~(t/100)!==4}function Ie({status:e}){return~~(e/100)===2}function Se(e){return e.map(t=>ae(t))}function ae(e){let t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...e,request:{...e.request,headers:{...e.request.headers,...t}}}}function ie({hosts:e,hostsCache:t,baseHeaders:s,logger:r,baseQueryParameters:a,algoliaAgent:d,timeouts:f,requester:c,requestsCache:n,responsesCache:o,compress:i,compression:h}){async function P(u){let l=await Promise.all(u.map(p=>t.get(p,()=>Promise.resolve(B(p))))),x=l.filter(p=>p.isUp()),v=l.filter(p=>p.isTimedOut()),w=[...x,...v];return{hosts:w.length>0?w:u,getTimeout(p,I){return(v.length===0&&p===0?1:v.length+3+p)*I}}}async function m(u,l,x){let v=[],w=V(u,l),y=Y(s,u.headers,l.headers),p=h==="gzip"&&w!==void 0&&w.length>ye&&(u.method==="POST"||u.method==="PUT");p&&i===void 0&&r.info("Compression is disabled because no compress method is available.");let I=p&&i!==void 0,N=I?await i(w):w;I&&(y["content-encoding"]="gzip");let k=u.method==="GET"?{...u.data,...l.data}:{},S={...a,...u.queryParameters,...k};if(d.value&&(S["x-algolia-agent"]=d.value),l&&l.queryParameters)for(let R of Object.keys(l.queryParameters))!l.queryParameters[R]||Object.prototype.toString.call(l.queryParameters[R])==="[object Object]"?S[R]=l.queryParameters[R]:S[R]=l.queryParameters[R].toString();let b=0,D=async(R,L)=>{let H=R.pop();if(H===void 0)throw new X(Se(v));let U={...f,...l.timeouts},G={data:N,headers:y,method:u.method,url:K(H,u.path,S),connectTimeout:L(b,U.connect),responseTimeout:L(b,x?U.read:U.write)},Q=$=>{let J={request:G,response:$,host:H,triesLeft:R.length};return v.push(J),J},A=await c.send(G);if(we(A)){let $=Q(A);return A.isTimedOut&&b++,r.info("Retryable failure",ae($)),await t.set(H,B(H,A.isTimedOut?"timed out":"down")),D(R,L)}if(Ie(A))return A;throw Q(A),qe(A,v)},q=e.filter(R=>R.accept==="readWrite"||(x?R.accept==="read":R.accept==="write")),z=await P(q);return D([...z.hosts].reverse(),z.getTimeout)}function g(u,l={}){let x=()=>m(u,l,v).then(p=>oe(p)),v=u.useReadTransporter||u.method==="GET";if((l.cacheable||u.cacheable)!==!0)return x();let y={request:u,requestOptions:l,transporter:{queryParameters:a,headers:s}};return o.get(y,()=>n.get(y,()=>n.set(y,x()).then(p=>Promise.all([n.delete(y),p]),p=>Promise.all([n.delete(y),Promise.reject(p)])).then(([p,I])=>I)),{miss:p=>o.set(y,p)})}function E(u,l={}){let x=u.useReadTransporter||u.method==="GET";return m(u,l,x).then(v=>Re(v))}async function*C(u,l={}){if(!c.sendStream)throw new Error("This requester does not support streaming");let x=V(u,l),v=Y(s,u.headers,l.headers);v.accept="text/event-stream";let w=u.method==="GET"?{...u.data,...l.data}:{},y={...a,...u.queryParameters,...w};if(d.value&&(y["x-algolia-agent"]=d.value),l&&l.queryParameters)for(let q of Object.keys(l.queryParameters))!l.queryParameters[q]||Object.prototype.toString.call(l.queryParameters[q])==="[object Object]"?y[q]=l.queryParameters[q]:y[q]=l.queryParameters[q].toString();let p=u.useReadTransporter||u.method==="GET",I=e.filter(q=>q.accept==="readWrite"||(p?q.accept==="read":q.accept==="write")),k=(await P(I)).hosts[0];if(!k)throw new X([]);let S={...f,...l.timeouts},b={data:x,headers:v,method:u.method,url:K(k,u.path,y),connectTimeout:S.connect,responseTimeout:p?S.read:S.write},D=await c.sendStream(b);yield*ge(D)}return{hostsCache:t,requester:c,timeouts:f,logger:r,algoliaAgent:d,baseHeaders:s,baseQueryParameters:a,hosts:e,request:g,requestWithHttpInfo:E,requestStream:C,requestsCache:n,responsesCache:o}}function T(e,t,s){if(s==null||typeof s=="string"&&s.length===0)throw new Error(`Parameter \`${e}\` is required when calling \`${t}\`.`)}function Ae(e){let t={};for(let s of e.trim().split(/[\r\n]+/)){let r=s.indexOf(": ");r>0&&(t[s.slice(0,r).toLowerCase()]=s.slice(r+2))}return t}function ce(){function e(t){return new Promise(s=>{let r=new XMLHttpRequest;r.open(t.method,t.url,!0),Object.keys(t.headers).forEach(c=>r.setRequestHeader(c,t.headers[c]));let a=(c,n)=>setTimeout(()=>{r.abort(),s({status:0,content:n,isTimedOut:!0})},c),d=a(t.connectTimeout,"Connection timeout"),f;r.onreadystatechange=()=>{r.readyState>r.OPENED&&f===void 0&&(clearTimeout(d),f=a(t.responseTimeout,"Socket timeout"))},r.onerror=()=>{r.status===0&&(clearTimeout(d),clearTimeout(f),s({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(d),clearTimeout(f),s({content:r.responseText,headers:Ae(r.getAllResponseHeaders()),status:r.status,isTimedOut:!1})},r.send(t.data)})}return{send:e}}var _="5.56.0",F=["de","us"];function Oe(e){return[{url:e?"insights.{region}.algolia.io".replace("{region}",e):"insights.algolia.io",accept:"readWrite",protocol:"https"}]}function ue({appId:e,apiKey:t,authMode:s,algoliaAgents:r,region:a,...d}){let f=ee(e,t,s),c=ie({hosts:Oe(a),...d,algoliaAgent:te({algoliaAgents:r,client:"Insights",version:_}),baseHeaders:{"content-type":"text/plain",...f.headers(),...d.baseHeaders},baseQueryParameters:{...f.queryParameters(),...d.baseQueryParameters}});return{transporter:c,appId:e,apiKey:t,clearCache(){return Promise.all([c.requestsCache.clear(),c.responsesCache.clear()]).then(()=>{})},get _ua(){return c.algoliaAgent.value},addAlgoliaAgent(n,o){c.algoliaAgent.add({segment:n,version:o})},setClientApiKey({apiKey:n}){!s||s==="WithinHeaders"?c.baseHeaders["x-algolia-api-key"]=n:c.baseQueryParameters["x-algolia-api-key"]=n},customDelete({path:n,parameters:o},i){T("path","customDelete",n);let g={method:"DELETE",path:"/{path}".replace("{path}",n),queryParameters:o||{},headers:{}};return c.request(g,i)},customDeleteWithHTTPInfo({path:n,parameters:o},i){T("path","customDeleteWithHTTPInfo",n);let g={method:"DELETE",path:"/{path}".replace("{path}",n),queryParameters:o||{},headers:{}};return c.requestWithHttpInfo(g,i)},customGet({path:n,parameters:o},i){T("path","customGet",n);let g={method:"GET",path:"/{path}".replace("{path}",n),queryParameters:o||{},headers:{}};return c.request(g,i)},customGetWithHTTPInfo({path:n,parameters:o},i){T("path","customGetWithHTTPInfo",n);let g={method:"GET",path:"/{path}".replace("{path}",n),queryParameters:o||{},headers:{}};return c.requestWithHttpInfo(g,i)},customPost({path:n,parameters:o,body:i},h){T("path","customPost",n);let E={method:"POST",path:"/{path}".replace("{path}",n),queryParameters:o||{},headers:{},data:i||{}};return c.request(E,h)},customPostWithHTTPInfo({path:n,parameters:o,body:i},h){T("path","customPostWithHTTPInfo",n);let E={method:"POST",path:"/{path}".replace("{path}",n),queryParameters:o||{},headers:{},data:i||{}};return c.requestWithHttpInfo(E,h)},customPut({path:n,parameters:o,body:i},h){T("path","customPut",n);let E={method:"PUT",path:"/{path}".replace("{path}",n),queryParameters:o||{},headers:{},data:i||{}};return c.request(E,h)},customPutWithHTTPInfo({path:n,parameters:o,body:i},h){T("path","customPutWithHTTPInfo",n);let E={method:"PUT",path:"/{path}".replace("{path}",n),queryParameters:o||{},headers:{},data:i||{}};return c.requestWithHttpInfo(E,h)},deleteUserToken({userToken:n},o){T("userToken","deleteUserToken",n);let m={method:"DELETE",path:"/1/usertokens/{userToken}".replace("{userToken}",encodeURIComponent(n)),queryParameters:{},headers:{}};return c.request(m,o)},deleteUserTokenWithHTTPInfo({userToken:n},o){T("userToken","deleteUserTokenWithHTTPInfo",n);let m={method:"DELETE",path:"/1/usertokens/{userToken}".replace("{userToken}",encodeURIComponent(n)),queryParameters:{},headers:{}};return c.requestWithHttpInfo(m,o)},pushEvents(n,o){T("insightsEvents","pushEvents",n),T("insightsEvents.events","pushEvents",n.events);let m={method:"POST",path:"/1/events",queryParameters:{},headers:{},data:n};return c.request(m,o)},pushEventsWithHTTPInfo(n,o){T("insightsEvents","pushEventsWithHTTPInfo",n),T("insightsEvents.events","pushEventsWithHTTPInfo",n.events);let m={method:"POST",path:"/1/events",queryParameters:{},headers:{},data:n};return c.requestWithHttpInfo(m,o)}}}function yt(e,t,s,r){if(!e||typeof e!="string")throw new Error("`appId` is missing.");if(!t||typeof t!="string")throw new Error("`apiKey` is missing.");if(s&&(typeof s!="string"||!F.includes(s)))throw new Error(`\`region\` must be one of the following: ${F.join(", ")}`);let{compression:a,...d}=r||{};return ue({appId:e,apiKey:t,region:s,timeouts:{connect:1e3,read:2e3,write:3e4},logger:re(),requester:ce(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:W(),requestsCache:W({serializable:!1}),hostsCache:O({caches:[Z({key:`${_}-${e}`}),W()]}),...d})}export{_ as apiClientVersion,yt as insightsClient};
|
|
6
6
|
//# sourceMappingURL=browser.min.js.map
|