@algolia/client-insights 5.2.4 → 5.2.5

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.
Files changed (85) hide show
  1. package/dist/browser.d.ts +598 -0
  2. package/dist/builds/browser.js +255 -0
  3. package/dist/builds/browser.js.map +1 -0
  4. package/dist/builds/browser.min.js +2 -0
  5. package/dist/builds/browser.min.js.map +1 -0
  6. package/dist/builds/browser.umd.js +12 -0
  7. package/dist/builds/node.cjs +273 -0
  8. package/dist/builds/node.cjs.map +1 -0
  9. package/dist/builds/node.js +253 -0
  10. package/dist/builds/node.js.map +1 -0
  11. package/dist/node.d.cts +598 -0
  12. package/dist/node.d.ts +598 -0
  13. package/dist/src/insightsClient.cjs +240 -0
  14. package/dist/src/insightsClient.cjs.map +1 -0
  15. package/dist/src/insightsClient.js +213 -0
  16. package/dist/src/insightsClient.js.map +1 -0
  17. package/index.d.ts +1 -1
  18. package/index.js +1 -1
  19. package/package.json +28 -25
  20. package/dist/builds/browser.d.ts +0 -22
  21. package/dist/builds/browser.d.ts.map +0 -1
  22. package/dist/builds/node.d.ts +0 -22
  23. package/dist/builds/node.d.ts.map +0 -1
  24. package/dist/client-insights.cjs +0 -240
  25. package/dist/client-insights.esm.browser.js +0 -914
  26. package/dist/client-insights.esm.node.js +0 -237
  27. package/dist/client-insights.umd.js +0 -2
  28. package/dist/model/addToCartEvent.d.ts +0 -2
  29. package/dist/model/addToCartEvent.d.ts.map +0 -1
  30. package/dist/model/addedToCartObjectIDs.d.ts +0 -45
  31. package/dist/model/addedToCartObjectIDs.d.ts.map +0 -1
  32. package/dist/model/addedToCartObjectIDsAfterSearch.d.ts +0 -49
  33. package/dist/model/addedToCartObjectIDsAfterSearch.d.ts.map +0 -1
  34. package/dist/model/clickEvent.d.ts +0 -2
  35. package/dist/model/clickEvent.d.ts.map +0 -1
  36. package/dist/model/clickedFilters.d.ts +0 -32
  37. package/dist/model/clickedFilters.d.ts.map +0 -1
  38. package/dist/model/clickedObjectIDs.d.ts +0 -32
  39. package/dist/model/clickedObjectIDs.d.ts.map +0 -1
  40. package/dist/model/clickedObjectIDsAfterSearch.d.ts +0 -40
  41. package/dist/model/clickedObjectIDsAfterSearch.d.ts.map +0 -1
  42. package/dist/model/clientMethodProps.d.ts +0 -70
  43. package/dist/model/clientMethodProps.d.ts.map +0 -1
  44. package/dist/model/conversionEvent.d.ts +0 -2
  45. package/dist/model/conversionEvent.d.ts.map +0 -1
  46. package/dist/model/convertedFilters.d.ts +0 -29
  47. package/dist/model/convertedFilters.d.ts.map +0 -1
  48. package/dist/model/convertedObjectIDs.d.ts +0 -32
  49. package/dist/model/convertedObjectIDs.d.ts.map +0 -1
  50. package/dist/model/convertedObjectIDsAfterSearch.d.ts +0 -36
  51. package/dist/model/convertedObjectIDsAfterSearch.d.ts.map +0 -1
  52. package/dist/model/discount.d.ts +0 -5
  53. package/dist/model/discount.d.ts.map +0 -1
  54. package/dist/model/errorBase.d.ts +0 -7
  55. package/dist/model/errorBase.d.ts.map +0 -1
  56. package/dist/model/eventsItems.d.ts +0 -14
  57. package/dist/model/eventsItems.d.ts.map +0 -1
  58. package/dist/model/eventsResponse.d.ts +0 -14
  59. package/dist/model/eventsResponse.d.ts.map +0 -1
  60. package/dist/model/index.d.ts +0 -28
  61. package/dist/model/index.d.ts.map +0 -1
  62. package/dist/model/insightsEvents.d.ts +0 -8
  63. package/dist/model/insightsEvents.d.ts.map +0 -1
  64. package/dist/model/objectData.d.ts +0 -11
  65. package/dist/model/objectData.d.ts.map +0 -1
  66. package/dist/model/objectDataAfterSearch.d.ts +0 -15
  67. package/dist/model/objectDataAfterSearch.d.ts.map +0 -1
  68. package/dist/model/price.d.ts +0 -5
  69. package/dist/model/price.d.ts.map +0 -1
  70. package/dist/model/purchaseEvent.d.ts +0 -2
  71. package/dist/model/purchaseEvent.d.ts.map +0 -1
  72. package/dist/model/purchasedObjectIDs.d.ts +0 -45
  73. package/dist/model/purchasedObjectIDs.d.ts.map +0 -1
  74. package/dist/model/purchasedObjectIDsAfterSearch.d.ts +0 -45
  75. package/dist/model/purchasedObjectIDsAfterSearch.d.ts.map +0 -1
  76. package/dist/model/value.d.ts +0 -5
  77. package/dist/model/value.d.ts.map +0 -1
  78. package/dist/model/viewEvent.d.ts +0 -2
  79. package/dist/model/viewEvent.d.ts.map +0 -1
  80. package/dist/model/viewedFilters.d.ts +0 -32
  81. package/dist/model/viewedFilters.d.ts.map +0 -1
  82. package/dist/model/viewedObjectIDs.d.ts +0 -32
  83. package/dist/model/viewedObjectIDs.d.ts.map +0 -1
  84. package/dist/src/insightsClient.d.ts +0 -85
  85. package/dist/src/insightsClient.d.ts.map +0 -1
@@ -1,22 +0,0 @@
1
- import type { ClientOptions } from '@algolia/client-common';
2
- import type { Region } from '../src/insightsClient';
3
- export { apiClientVersion, Region } from '../src/insightsClient';
4
- export * from '../model';
5
- /**
6
- * The client type.
7
- */
8
- export type InsightsClient = ReturnType<typeof insightsClient>;
9
- export declare function insightsClient(appId: string, apiKey: string, region?: Region, options?: ClientOptions): {
10
- transporter: import("@algolia/client-common").Transporter;
11
- appId: string;
12
- clearCache(): Promise<void>;
13
- _ua: string;
14
- addAlgoliaAgent(segment: string, version?: string): void;
15
- customDelete({ path, parameters }: import("../model").CustomDeleteProps, requestOptions?: import("@algolia/client-common").RequestOptions): Promise<Record<string, unknown>>;
16
- customGet({ path, parameters }: import("../model").CustomGetProps, requestOptions?: import("@algolia/client-common").RequestOptions): Promise<Record<string, unknown>>;
17
- customPost({ path, parameters, body }: import("../model").CustomPostProps, requestOptions?: import("@algolia/client-common").RequestOptions): Promise<Record<string, unknown>>;
18
- customPut({ path, parameters, body }: import("../model").CustomPutProps, requestOptions?: import("@algolia/client-common").RequestOptions): Promise<Record<string, unknown>>;
19
- deleteUserToken({ userToken }: import("../model").DeleteUserTokenProps, requestOptions?: import("@algolia/client-common").RequestOptions): Promise<void>;
20
- pushEvents(insightsEvents: import("../model").InsightsEvents, requestOptions?: import("@algolia/client-common").RequestOptions): Promise<import("../model").EventsResponse>;
21
- };
22
- //# sourceMappingURL=node.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../builds/node.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAU5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAGpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACjE,cAAc,UAAU,CAAC;AAEzB;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAG/D,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa;;;;;;;;;;;;EA+BrG"}
@@ -1,240 +0,0 @@
1
- 'use strict';
2
-
3
- var clientCommon = require('@algolia/client-common');
4
- var requesterNodeHttp = require('@algolia/requester-node-http');
5
-
6
- // Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
7
- const apiClientVersion = '5.2.4';
8
- const REGIONS = ['de', 'us'];
9
- function getDefaultHosts(region) {
10
- const url = !region ? 'insights.algolia.io' : 'insights.{region}.algolia.io'.replace('{region}', region);
11
- return [{ url, accept: 'readWrite', protocol: 'https' }];
12
- }
13
- // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
14
- function createInsightsClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, region: regionOption, ...options }) {
15
- const auth = clientCommon.createAuth(appIdOption, apiKeyOption, authMode);
16
- const transporter = clientCommon.createTransporter({
17
- hosts: getDefaultHosts(regionOption),
18
- ...options,
19
- algoliaAgent: clientCommon.getAlgoliaAgent({
20
- algoliaAgents,
21
- client: 'Insights',
22
- version: apiClientVersion,
23
- }),
24
- baseHeaders: {
25
- 'content-type': 'text/plain',
26
- ...auth.headers(),
27
- ...options.baseHeaders,
28
- },
29
- baseQueryParameters: {
30
- ...auth.queryParameters(),
31
- ...options.baseQueryParameters,
32
- },
33
- });
34
- return {
35
- transporter,
36
- /**
37
- * The `appId` currently in use.
38
- */
39
- appId: appIdOption,
40
- /**
41
- * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
42
- */
43
- clearCache() {
44
- return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => undefined);
45
- },
46
- /**
47
- * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
48
- */
49
- get _ua() {
50
- return transporter.algoliaAgent.value;
51
- },
52
- /**
53
- * Adds a `segment` to the `x-algolia-agent` sent with every requests.
54
- *
55
- * @param segment - The algolia agent (user-agent) segment to add.
56
- * @param version - The version of the agent.
57
- */
58
- addAlgoliaAgent(segment, version) {
59
- transporter.algoliaAgent.add({ segment, version });
60
- },
61
- /**
62
- * This method allow you to send requests to the Algolia REST API.
63
- *
64
- * @param customDelete - The customDelete object.
65
- * @param customDelete.path - Path of the endpoint, anything after \"/1\" must be specified.
66
- * @param customDelete.parameters - Query parameters to apply to the current query.
67
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
68
- */
69
- customDelete({ path, parameters }, requestOptions) {
70
- if (!path) {
71
- throw new Error('Parameter `path` is required when calling `customDelete`.');
72
- }
73
- const requestPath = '/{path}'.replace('{path}', path);
74
- const headers = {};
75
- const queryParameters = parameters ? parameters : {};
76
- const request = {
77
- method: 'DELETE',
78
- path: requestPath,
79
- queryParameters,
80
- headers,
81
- };
82
- return transporter.request(request, requestOptions);
83
- },
84
- /**
85
- * This method allow you to send requests to the Algolia REST API.
86
- *
87
- * @param customGet - The customGet object.
88
- * @param customGet.path - Path of the endpoint, anything after \"/1\" must be specified.
89
- * @param customGet.parameters - Query parameters to apply to the current query.
90
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
91
- */
92
- customGet({ path, parameters }, requestOptions) {
93
- if (!path) {
94
- throw new Error('Parameter `path` is required when calling `customGet`.');
95
- }
96
- const requestPath = '/{path}'.replace('{path}', path);
97
- const headers = {};
98
- const queryParameters = parameters ? parameters : {};
99
- const request = {
100
- method: 'GET',
101
- path: requestPath,
102
- queryParameters,
103
- headers,
104
- };
105
- return transporter.request(request, requestOptions);
106
- },
107
- /**
108
- * This method allow you to send requests to the Algolia REST API.
109
- *
110
- * @param customPost - The customPost object.
111
- * @param customPost.path - Path of the endpoint, anything after \"/1\" must be specified.
112
- * @param customPost.parameters - Query parameters to apply to the current query.
113
- * @param customPost.body - Parameters to send with the custom request.
114
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
115
- */
116
- customPost({ path, parameters, body }, requestOptions) {
117
- if (!path) {
118
- throw new Error('Parameter `path` is required when calling `customPost`.');
119
- }
120
- const requestPath = '/{path}'.replace('{path}', path);
121
- const headers = {};
122
- const queryParameters = parameters ? parameters : {};
123
- const request = {
124
- method: 'POST',
125
- path: requestPath,
126
- queryParameters,
127
- headers,
128
- data: body ? body : {},
129
- };
130
- return transporter.request(request, requestOptions);
131
- },
132
- /**
133
- * This method allow you to send requests to the Algolia REST API.
134
- *
135
- * @param customPut - The customPut object.
136
- * @param customPut.path - Path of the endpoint, anything after \"/1\" must be specified.
137
- * @param customPut.parameters - Query parameters to apply to the current query.
138
- * @param customPut.body - Parameters to send with the custom request.
139
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
140
- */
141
- customPut({ path, parameters, body }, requestOptions) {
142
- if (!path) {
143
- throw new Error('Parameter `path` is required when calling `customPut`.');
144
- }
145
- const requestPath = '/{path}'.replace('{path}', path);
146
- const headers = {};
147
- const queryParameters = parameters ? parameters : {};
148
- const request = {
149
- method: 'PUT',
150
- path: requestPath,
151
- queryParameters,
152
- headers,
153
- data: body ? body : {},
154
- };
155
- return transporter.request(request, requestOptions);
156
- },
157
- /**
158
- * 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](/specs/personalization#tag/profiles/operation/deleteUserProfile).
159
- *
160
- * @param deleteUserToken - The deleteUserToken object.
161
- * @param deleteUserToken.userToken - User token for which to delete all associated events.
162
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
163
- */
164
- deleteUserToken({ userToken }, requestOptions) {
165
- if (!userToken) {
166
- throw new Error('Parameter `userToken` is required when calling `deleteUserToken`.');
167
- }
168
- const requestPath = '/1/usertokens/{userToken}'.replace('{userToken}', encodeURIComponent(userToken));
169
- const headers = {};
170
- const queryParameters = {};
171
- const request = {
172
- method: 'DELETE',
173
- path: requestPath,
174
- queryParameters,
175
- headers,
176
- };
177
- return transporter.request(request, requestOptions);
178
- },
179
- /**
180
- * 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&nbsp;MB.
181
- *
182
- * @param insightsEvents - The insightsEvents object.
183
- * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
184
- */
185
- pushEvents(insightsEvents, requestOptions) {
186
- if (!insightsEvents) {
187
- throw new Error('Parameter `insightsEvents` is required when calling `pushEvents`.');
188
- }
189
- if (!insightsEvents.events) {
190
- throw new Error('Parameter `insightsEvents.events` is required when calling `pushEvents`.');
191
- }
192
- const requestPath = '/1/events';
193
- const headers = {};
194
- const queryParameters = {};
195
- const request = {
196
- method: 'POST',
197
- path: requestPath,
198
- queryParameters,
199
- headers,
200
- data: insightsEvents,
201
- };
202
- return transporter.request(request, requestOptions);
203
- },
204
- };
205
- }
206
-
207
- // 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.
208
- // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
209
- function insightsClient(appId, apiKey, region, options) {
210
- if (!appId || typeof appId !== 'string') {
211
- throw new Error('`appId` is missing.');
212
- }
213
- if (!apiKey || typeof apiKey !== 'string') {
214
- throw new Error('`apiKey` is missing.');
215
- }
216
- if (region && (typeof region !== 'string' || !REGIONS.includes(region))) {
217
- throw new Error(`\`region\` must be one of the following: ${REGIONS.join(', ')}`);
218
- }
219
- return {
220
- ...createInsightsClient({
221
- appId,
222
- apiKey,
223
- region,
224
- timeouts: {
225
- connect: clientCommon.DEFAULT_CONNECT_TIMEOUT_NODE,
226
- read: clientCommon.DEFAULT_READ_TIMEOUT_NODE,
227
- write: clientCommon.DEFAULT_WRITE_TIMEOUT_NODE,
228
- },
229
- requester: requesterNodeHttp.createHttpRequester(),
230
- algoliaAgents: [{ segment: 'Node.js', version: process.versions.node }],
231
- responsesCache: clientCommon.createNullCache(),
232
- requestsCache: clientCommon.createNullCache(),
233
- hostsCache: clientCommon.createMemoryCache(),
234
- ...options,
235
- }),
236
- };
237
- }
238
-
239
- exports.apiClientVersion = apiClientVersion;
240
- exports.insightsClient = insightsClient;