@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
@@ -0,0 +1,240 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/insightsClient.ts
21
+ var insightsClient_exports = {};
22
+ __export(insightsClient_exports, {
23
+ REGIONS: () => REGIONS,
24
+ apiClientVersion: () => apiClientVersion,
25
+ createInsightsClient: () => createInsightsClient
26
+ });
27
+ module.exports = __toCommonJS(insightsClient_exports);
28
+ var import_client_common = require("@algolia/client-common");
29
+ var apiClientVersion = "5.2.5";
30
+ var REGIONS = ["de", "us"];
31
+ function getDefaultHosts(region) {
32
+ const url = !region ? "insights.algolia.io" : "insights.{region}.algolia.io".replace("{region}", region);
33
+ return [{ url, accept: "readWrite", protocol: "https" }];
34
+ }
35
+ function createInsightsClient({
36
+ appId: appIdOption,
37
+ apiKey: apiKeyOption,
38
+ authMode,
39
+ algoliaAgents,
40
+ region: regionOption,
41
+ ...options
42
+ }) {
43
+ const auth = (0, import_client_common.createAuth)(appIdOption, apiKeyOption, authMode);
44
+ const transporter = (0, import_client_common.createTransporter)({
45
+ hosts: getDefaultHosts(regionOption),
46
+ ...options,
47
+ algoliaAgent: (0, import_client_common.getAlgoliaAgent)({
48
+ algoliaAgents,
49
+ client: "Insights",
50
+ version: apiClientVersion
51
+ }),
52
+ baseHeaders: {
53
+ "content-type": "text/plain",
54
+ ...auth.headers(),
55
+ ...options.baseHeaders
56
+ },
57
+ baseQueryParameters: {
58
+ ...auth.queryParameters(),
59
+ ...options.baseQueryParameters
60
+ }
61
+ });
62
+ return {
63
+ transporter,
64
+ /**
65
+ * The `appId` currently in use.
66
+ */
67
+ appId: appIdOption,
68
+ /**
69
+ * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
70
+ */
71
+ clearCache() {
72
+ return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
73
+ },
74
+ /**
75
+ * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
76
+ */
77
+ get _ua() {
78
+ return transporter.algoliaAgent.value;
79
+ },
80
+ /**
81
+ * Adds a `segment` to the `x-algolia-agent` sent with every requests.
82
+ *
83
+ * @param segment - The algolia agent (user-agent) segment to add.
84
+ * @param version - The version of the agent.
85
+ */
86
+ addAlgoliaAgent(segment, version) {
87
+ transporter.algoliaAgent.add({ segment, version });
88
+ },
89
+ /**
90
+ * This method allow you to send requests to the Algolia REST API.
91
+ *
92
+ * @param customDelete - The customDelete object.
93
+ * @param customDelete.path - Path of the endpoint, anything after \"/1\" must be specified.
94
+ * @param customDelete.parameters - Query parameters to apply to the current query.
95
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
96
+ */
97
+ customDelete({ path, parameters }, requestOptions) {
98
+ if (!path) {
99
+ throw new Error("Parameter `path` is required when calling `customDelete`.");
100
+ }
101
+ const requestPath = "/{path}".replace("{path}", path);
102
+ const headers = {};
103
+ const queryParameters = parameters ? parameters : {};
104
+ const request = {
105
+ method: "DELETE",
106
+ path: requestPath,
107
+ queryParameters,
108
+ headers
109
+ };
110
+ return transporter.request(request, requestOptions);
111
+ },
112
+ /**
113
+ * This method allow you to send requests to the Algolia REST API.
114
+ *
115
+ * @param customGet - The customGet object.
116
+ * @param customGet.path - Path of the endpoint, anything after \"/1\" must be specified.
117
+ * @param customGet.parameters - Query parameters to apply to the current query.
118
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
119
+ */
120
+ customGet({ path, parameters }, requestOptions) {
121
+ if (!path) {
122
+ throw new Error("Parameter `path` is required when calling `customGet`.");
123
+ }
124
+ const requestPath = "/{path}".replace("{path}", path);
125
+ const headers = {};
126
+ const queryParameters = parameters ? parameters : {};
127
+ const request = {
128
+ method: "GET",
129
+ path: requestPath,
130
+ queryParameters,
131
+ headers
132
+ };
133
+ return transporter.request(request, requestOptions);
134
+ },
135
+ /**
136
+ * This method allow you to send requests to the Algolia REST API.
137
+ *
138
+ * @param customPost - The customPost object.
139
+ * @param customPost.path - Path of the endpoint, anything after \"/1\" must be specified.
140
+ * @param customPost.parameters - Query parameters to apply to the current query.
141
+ * @param customPost.body - Parameters to send with the custom request.
142
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
143
+ */
144
+ customPost({ path, parameters, body }, requestOptions) {
145
+ if (!path) {
146
+ throw new Error("Parameter `path` is required when calling `customPost`.");
147
+ }
148
+ const requestPath = "/{path}".replace("{path}", path);
149
+ const headers = {};
150
+ const queryParameters = parameters ? parameters : {};
151
+ const request = {
152
+ method: "POST",
153
+ path: requestPath,
154
+ queryParameters,
155
+ headers,
156
+ data: body ? body : {}
157
+ };
158
+ return transporter.request(request, requestOptions);
159
+ },
160
+ /**
161
+ * This method allow you to send requests to the Algolia REST API.
162
+ *
163
+ * @param customPut - The customPut object.
164
+ * @param customPut.path - Path of the endpoint, anything after \"/1\" must be specified.
165
+ * @param customPut.parameters - Query parameters to apply to the current query.
166
+ * @param customPut.body - Parameters to send with the custom request.
167
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
168
+ */
169
+ customPut({ path, parameters, body }, requestOptions) {
170
+ if (!path) {
171
+ throw new Error("Parameter `path` is required when calling `customPut`.");
172
+ }
173
+ const requestPath = "/{path}".replace("{path}", path);
174
+ const headers = {};
175
+ const queryParameters = parameters ? parameters : {};
176
+ const request = {
177
+ method: "PUT",
178
+ path: requestPath,
179
+ queryParameters,
180
+ headers,
181
+ data: body ? body : {}
182
+ };
183
+ return transporter.request(request, requestOptions);
184
+ },
185
+ /**
186
+ * 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.
187
+ *
188
+ * @param deleteUserToken - The deleteUserToken object.
189
+ * @param deleteUserToken.userToken - User token for which to delete all associated events.
190
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
191
+ */
192
+ deleteUserToken({ userToken }, requestOptions) {
193
+ if (!userToken) {
194
+ throw new Error("Parameter `userToken` is required when calling `deleteUserToken`.");
195
+ }
196
+ const requestPath = "/1/usertokens/{userToken}".replace("{userToken}", encodeURIComponent(userToken));
197
+ const headers = {};
198
+ const queryParameters = {};
199
+ const request = {
200
+ method: "DELETE",
201
+ path: requestPath,
202
+ queryParameters,
203
+ headers
204
+ };
205
+ return transporter.request(request, requestOptions);
206
+ },
207
+ /**
208
+ * 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.
209
+ *
210
+ * @param insightsEvents - The insightsEvents object.
211
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
212
+ */
213
+ pushEvents(insightsEvents, requestOptions) {
214
+ if (!insightsEvents) {
215
+ throw new Error("Parameter `insightsEvents` is required when calling `pushEvents`.");
216
+ }
217
+ if (!insightsEvents.events) {
218
+ throw new Error("Parameter `insightsEvents.events` is required when calling `pushEvents`.");
219
+ }
220
+ const requestPath = "/1/events";
221
+ const headers = {};
222
+ const queryParameters = {};
223
+ const request = {
224
+ method: "POST",
225
+ path: requestPath,
226
+ queryParameters,
227
+ headers,
228
+ data: insightsEvents
229
+ };
230
+ return transporter.request(request, requestOptions);
231
+ }
232
+ };
233
+ }
234
+ // Annotate the CommonJS export names for ESM import in node:
235
+ 0 && (module.exports = {
236
+ REGIONS,
237
+ apiClientVersion,
238
+ createInsightsClient
239
+ });
240
+ //# sourceMappingURL=insightsClient.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../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 { createAuth, createTransporter, getAlgoliaAgent } from '@algolia/client-common';\nimport type {\n CreateClientOptions,\n Headers,\n Host,\n QueryParameters,\n Request,\n RequestOptions,\n} from '@algolia/client-common';\n\nimport type {\n CustomDeleteProps,\n CustomGetProps,\n CustomPostProps,\n CustomPutProps,\n DeleteUserTokenProps,\n} from '../model/clientMethodProps';\nimport type { EventsResponse } from '../model/eventsResponse';\nimport type { InsightsEvents } from '../model/insightsEvents';\n\nexport const apiClientVersion = '5.2.5';\n\nexport const REGIONS = ['de', 'us'] as const;\nexport type Region = (typeof REGIONS)[number];\n\nfunction getDefaultHosts(region?: Region): 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\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport function createInsightsClient({\n appId: appIdOption,\n apiKey: apiKeyOption,\n authMode,\n algoliaAgents,\n region: regionOption,\n ...options\n}: CreateClientOptions & { region?: Region }) {\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 * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.\n */\n clearCache(): Promise<void> {\n return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => undefined);\n },\n\n /**\n * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.\n */\n get _ua(): string {\n return transporter.algoliaAgent.value;\n },\n\n /**\n * Adds a `segment` to the `x-algolia-agent` sent with every requests.\n *\n * @param segment - The algolia agent (user-agent) segment to add.\n * @param version - The version of the agent.\n */\n addAlgoliaAgent(segment: string, version?: string): void {\n transporter.algoliaAgent.add({ segment, version });\n },\n\n /**\n * This method allow you to send requests to the Algolia REST API.\n *\n * @param customDelete - The customDelete object.\n * @param customDelete.path - Path of the endpoint, anything after \\\"/1\\\" must be specified.\n * @param customDelete.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customDelete(\n { path, parameters }: CustomDeleteProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customDelete`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method allow you to send requests to the Algolia REST API.\n *\n * @param customGet - The customGet object.\n * @param customGet.path - Path of the endpoint, anything after \\\"/1\\\" must be specified.\n * @param customGet.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customGet`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method allow you to send requests to the Algolia REST API.\n *\n * @param customPost - The customPost object.\n * @param customPost.path - Path of the endpoint, anything after \\\"/1\\\" must be specified.\n * @param customPost.parameters - Query parameters to apply to the current query.\n * @param customPost.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPost(\n { path, parameters, body }: CustomPostProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customPost`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method allow you to send requests to the Algolia REST API.\n *\n * @param customPut - The customPut object.\n * @param customPut.path - Path of the endpoint, anything after \\\"/1\\\" must be specified.\n * @param customPut.parameters - Query parameters to apply to the current query.\n * @param customPut.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPut(\n { path, parameters, body }: CustomPutProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customPut`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'PUT',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * 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 * @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 if (!userToken) {\n throw new Error('Parameter `userToken` is required when calling `deleteUserToken`.');\n }\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&nbsp;MB.\n *\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 if (!insightsEvents) {\n throw new Error('Parameter `insightsEvents` is required when calling `pushEvents`.');\n }\n\n if (!insightsEvents.events) {\n throw new Error('Parameter `insightsEvents.events` is required when calling `pushEvents`.');\n }\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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AACpB,YAAM,UAAmB,CAAC;AAC1B,YAAM,kBAAmC,CAAC;AAE1C,YAAM,UAAmB;AAAA,QACvB,QAAQ;AAAA,QACR,MAAM;AAAA,QACN;AAAA,QACA;AAAA,QACA,MAAM;AAAA,MACR;AAEA,aAAO,YAAY,QAAQ,SAAS,cAAc;AAAA,IACpD;AAAA,EACF;AACF;","names":[]}
@@ -0,0 +1,213 @@
1
+ // src/insightsClient.ts
2
+ import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
3
+ var apiClientVersion = "5.2.5";
4
+ var REGIONS = ["de", "us"];
5
+ function getDefaultHosts(region) {
6
+ const url = !region ? "insights.algolia.io" : "insights.{region}.algolia.io".replace("{region}", region);
7
+ return [{ url, accept: "readWrite", protocol: "https" }];
8
+ }
9
+ function createInsightsClient({
10
+ appId: appIdOption,
11
+ apiKey: apiKeyOption,
12
+ authMode,
13
+ algoliaAgents,
14
+ region: regionOption,
15
+ ...options
16
+ }) {
17
+ const auth = createAuth(appIdOption, apiKeyOption, authMode);
18
+ const transporter = createTransporter({
19
+ hosts: getDefaultHosts(regionOption),
20
+ ...options,
21
+ algoliaAgent: getAlgoliaAgent({
22
+ algoliaAgents,
23
+ client: "Insights",
24
+ version: apiClientVersion
25
+ }),
26
+ baseHeaders: {
27
+ "content-type": "text/plain",
28
+ ...auth.headers(),
29
+ ...options.baseHeaders
30
+ },
31
+ baseQueryParameters: {
32
+ ...auth.queryParameters(),
33
+ ...options.baseQueryParameters
34
+ }
35
+ });
36
+ return {
37
+ transporter,
38
+ /**
39
+ * The `appId` currently in use.
40
+ */
41
+ appId: appIdOption,
42
+ /**
43
+ * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
44
+ */
45
+ clearCache() {
46
+ return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
47
+ },
48
+ /**
49
+ * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
50
+ */
51
+ get _ua() {
52
+ return transporter.algoliaAgent.value;
53
+ },
54
+ /**
55
+ * Adds a `segment` to the `x-algolia-agent` sent with every requests.
56
+ *
57
+ * @param segment - The algolia agent (user-agent) segment to add.
58
+ * @param version - The version of the agent.
59
+ */
60
+ addAlgoliaAgent(segment, version) {
61
+ transporter.algoliaAgent.add({ segment, version });
62
+ },
63
+ /**
64
+ * This method allow you to send requests to the Algolia REST API.
65
+ *
66
+ * @param customDelete - The customDelete object.
67
+ * @param customDelete.path - Path of the endpoint, anything after \"/1\" must be specified.
68
+ * @param customDelete.parameters - Query parameters to apply to the current query.
69
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
70
+ */
71
+ customDelete({ path, parameters }, requestOptions) {
72
+ if (!path) {
73
+ throw new Error("Parameter `path` is required when calling `customDelete`.");
74
+ }
75
+ const requestPath = "/{path}".replace("{path}", path);
76
+ const headers = {};
77
+ const queryParameters = parameters ? parameters : {};
78
+ const request = {
79
+ method: "DELETE",
80
+ path: requestPath,
81
+ queryParameters,
82
+ headers
83
+ };
84
+ return transporter.request(request, requestOptions);
85
+ },
86
+ /**
87
+ * This method allow you to send requests to the Algolia REST API.
88
+ *
89
+ * @param customGet - The customGet object.
90
+ * @param customGet.path - Path of the endpoint, anything after \"/1\" must be specified.
91
+ * @param customGet.parameters - Query parameters to apply to the current query.
92
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
93
+ */
94
+ customGet({ path, parameters }, requestOptions) {
95
+ if (!path) {
96
+ throw new Error("Parameter `path` is required when calling `customGet`.");
97
+ }
98
+ const requestPath = "/{path}".replace("{path}", path);
99
+ const headers = {};
100
+ const queryParameters = parameters ? parameters : {};
101
+ const request = {
102
+ method: "GET",
103
+ path: requestPath,
104
+ queryParameters,
105
+ headers
106
+ };
107
+ return transporter.request(request, requestOptions);
108
+ },
109
+ /**
110
+ * This method allow you to send requests to the Algolia REST API.
111
+ *
112
+ * @param customPost - The customPost object.
113
+ * @param customPost.path - Path of the endpoint, anything after \"/1\" must be specified.
114
+ * @param customPost.parameters - Query parameters to apply to the current query.
115
+ * @param customPost.body - Parameters to send with the custom request.
116
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
117
+ */
118
+ customPost({ path, parameters, body }, requestOptions) {
119
+ if (!path) {
120
+ throw new Error("Parameter `path` is required when calling `customPost`.");
121
+ }
122
+ const requestPath = "/{path}".replace("{path}", path);
123
+ const headers = {};
124
+ const queryParameters = parameters ? parameters : {};
125
+ const request = {
126
+ method: "POST",
127
+ path: requestPath,
128
+ queryParameters,
129
+ headers,
130
+ data: body ? body : {}
131
+ };
132
+ return transporter.request(request, requestOptions);
133
+ },
134
+ /**
135
+ * This method allow you to send requests to the Algolia REST API.
136
+ *
137
+ * @param customPut - The customPut object.
138
+ * @param customPut.path - Path of the endpoint, anything after \"/1\" must be specified.
139
+ * @param customPut.parameters - Query parameters to apply to the current query.
140
+ * @param customPut.body - Parameters to send with the custom request.
141
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
142
+ */
143
+ customPut({ path, parameters, body }, requestOptions) {
144
+ if (!path) {
145
+ throw new Error("Parameter `path` is required when calling `customPut`.");
146
+ }
147
+ const requestPath = "/{path}".replace("{path}", path);
148
+ const headers = {};
149
+ const queryParameters = parameters ? parameters : {};
150
+ const request = {
151
+ method: "PUT",
152
+ path: requestPath,
153
+ queryParameters,
154
+ headers,
155
+ data: body ? body : {}
156
+ };
157
+ return transporter.request(request, requestOptions);
158
+ },
159
+ /**
160
+ * 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.
161
+ *
162
+ * @param deleteUserToken - The deleteUserToken object.
163
+ * @param deleteUserToken.userToken - User token for which to delete all associated events.
164
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
165
+ */
166
+ deleteUserToken({ userToken }, requestOptions) {
167
+ if (!userToken) {
168
+ throw new Error("Parameter `userToken` is required when calling `deleteUserToken`.");
169
+ }
170
+ const requestPath = "/1/usertokens/{userToken}".replace("{userToken}", encodeURIComponent(userToken));
171
+ const headers = {};
172
+ const queryParameters = {};
173
+ const request = {
174
+ method: "DELETE",
175
+ path: requestPath,
176
+ queryParameters,
177
+ headers
178
+ };
179
+ return transporter.request(request, requestOptions);
180
+ },
181
+ /**
182
+ * 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.
183
+ *
184
+ * @param insightsEvents - The insightsEvents object.
185
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
186
+ */
187
+ pushEvents(insightsEvents, requestOptions) {
188
+ if (!insightsEvents) {
189
+ throw new Error("Parameter `insightsEvents` is required when calling `pushEvents`.");
190
+ }
191
+ if (!insightsEvents.events) {
192
+ throw new Error("Parameter `insightsEvents.events` is required when calling `pushEvents`.");
193
+ }
194
+ const requestPath = "/1/events";
195
+ const headers = {};
196
+ const queryParameters = {};
197
+ const request = {
198
+ method: "POST",
199
+ path: requestPath,
200
+ queryParameters,
201
+ headers,
202
+ data: insightsEvents
203
+ };
204
+ return transporter.request(request, requestOptions);
205
+ }
206
+ };
207
+ }
208
+ export {
209
+ REGIONS,
210
+ apiClientVersion,
211
+ createInsightsClient
212
+ };
213
+ //# sourceMappingURL=insightsClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../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 { createAuth, createTransporter, getAlgoliaAgent } from '@algolia/client-common';\nimport type {\n CreateClientOptions,\n Headers,\n Host,\n QueryParameters,\n Request,\n RequestOptions,\n} from '@algolia/client-common';\n\nimport type {\n CustomDeleteProps,\n CustomGetProps,\n CustomPostProps,\n CustomPutProps,\n DeleteUserTokenProps,\n} from '../model/clientMethodProps';\nimport type { EventsResponse } from '../model/eventsResponse';\nimport type { InsightsEvents } from '../model/insightsEvents';\n\nexport const apiClientVersion = '5.2.5';\n\nexport const REGIONS = ['de', 'us'] as const;\nexport type Region = (typeof REGIONS)[number];\n\nfunction getDefaultHosts(region?: Region): 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\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport function createInsightsClient({\n appId: appIdOption,\n apiKey: apiKeyOption,\n authMode,\n algoliaAgents,\n region: regionOption,\n ...options\n}: CreateClientOptions & { region?: Region }) {\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 * Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.\n */\n clearCache(): Promise<void> {\n return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => undefined);\n },\n\n /**\n * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.\n */\n get _ua(): string {\n return transporter.algoliaAgent.value;\n },\n\n /**\n * Adds a `segment` to the `x-algolia-agent` sent with every requests.\n *\n * @param segment - The algolia agent (user-agent) segment to add.\n * @param version - The version of the agent.\n */\n addAlgoliaAgent(segment: string, version?: string): void {\n transporter.algoliaAgent.add({ segment, version });\n },\n\n /**\n * This method allow you to send requests to the Algolia REST API.\n *\n * @param customDelete - The customDelete object.\n * @param customDelete.path - Path of the endpoint, anything after \\\"/1\\\" must be specified.\n * @param customDelete.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customDelete(\n { path, parameters }: CustomDeleteProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customDelete`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'DELETE',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method allow you to send requests to the Algolia REST API.\n *\n * @param customGet - The customGet object.\n * @param customGet.path - Path of the endpoint, anything after \\\"/1\\\" must be specified.\n * @param customGet.parameters - Query parameters to apply to the current query.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customGet({ path, parameters }: CustomGetProps, requestOptions?: RequestOptions): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customGet`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'GET',\n path: requestPath,\n queryParameters,\n headers,\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method allow you to send requests to the Algolia REST API.\n *\n * @param customPost - The customPost object.\n * @param customPost.path - Path of the endpoint, anything after \\\"/1\\\" must be specified.\n * @param customPost.parameters - Query parameters to apply to the current query.\n * @param customPost.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPost(\n { path, parameters, body }: CustomPostProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customPost`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'POST',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * This method allow you to send requests to the Algolia REST API.\n *\n * @param customPut - The customPut object.\n * @param customPut.path - Path of the endpoint, anything after \\\"/1\\\" must be specified.\n * @param customPut.parameters - Query parameters to apply to the current query.\n * @param customPut.body - Parameters to send with the custom request.\n * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.\n */\n customPut(\n { path, parameters, body }: CustomPutProps,\n requestOptions?: RequestOptions,\n ): Promise<Record<string, unknown>> {\n if (!path) {\n throw new Error('Parameter `path` is required when calling `customPut`.');\n }\n\n const requestPath = '/{path}'.replace('{path}', path);\n const headers: Headers = {};\n const queryParameters: QueryParameters = parameters ? parameters : {};\n\n const request: Request = {\n method: 'PUT',\n path: requestPath,\n queryParameters,\n headers,\n data: body ? body : {},\n };\n\n return transporter.request(request, requestOptions);\n },\n\n /**\n * 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 * @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 if (!userToken) {\n throw new Error('Parameter `userToken` is required when calling `deleteUserToken`.');\n }\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&nbsp;MB.\n *\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 if (!insightsEvents) {\n throw new Error('Parameter `insightsEvents` is required when calling `pushEvents`.');\n }\n\n if (!insightsEvents.events) {\n throw new Error('Parameter `insightsEvents.events` is required when calling `pushEvents`.');\n }\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,SAAS,YAAY,mBAAmB,uBAAuB;AAoBxD,IAAM,mBAAmB;AAEzB,IAAM,UAAU,CAAC,MAAM,IAAI;AAGlC,SAAS,gBAAgB,QAAyB;AAChD,QAAM,MAAM,CAAC,SAAS,wBAAwB,+BAA+B,QAAQ,YAAY,MAAM;AAEvG,SAAO,CAAC,EAAE,KAAK,QAAQ,aAAa,UAAU,QAAQ,CAAC;AACzD;AAGO,SAAS,qBAAqB;AAAA,EACnC,OAAO;AAAA,EACP,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR,GAAG;AACL,GAA8C;AAC5C,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,IACb;AAAA,EACF,CAAC;AAED,SAAO;AAAA,IACL;AAAA;AAAA;AAAA;AAAA,IAKA,OAAO;AAAA;AAAA;AAAA;AAAA,IAK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Y,QAAQ,SAAS,cAAc;AAAA,IACpD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQA,WAAW,gBAAgC,gBAA0D;AACnG,UAAI,CAAC,gBAAgB;AACnB,cAAM,IAAI,MAAM,mEAAmE;AAAA,MACrF;AAEA,UAAI,CAAC,eAAe,QAAQ;AAC1B,cAAM,IAAI,MAAM,0EAA0E;AAAA,MAC5F;AAEA,YAAM,cAAc;AACpB,YAAM,UAAmB,CAAC;AAC1B,YAAM,kBAAmC,CAAC;AAE1C,YAAM,UAAmB;AAAA,QACvB,QAAQ;AAAA,QACR,MAAM;AAAA,QACN;AAAA,QACA;AAAA,QACA,MAAM;AAAA,MACR;AAEA,aAAO,YAAY,QAAQ,SAAS,cAAc;AAAA,IACpD;AAAA,EACF;AACF;","names":[]}
package/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // eslint-disable-next-line import/no-unresolved
2
- export * from './dist/builds/node';
2
+ export * from './dist/node';
package/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // eslint-disable-next-line import/no-commonjs,import/extensions
2
- module.exports = require('./dist/client-insights.cjs');
2
+ module.exports = require('./dist/builds/node.cjs');
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.2.4",
2
+ "version": "5.2.5",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/algolia/algoliasearch-client-javascript.git"
@@ -7,50 +7,53 @@
7
7
  "type": "module",
8
8
  "license": "MIT",
9
9
  "author": "Algolia",
10
- "types": "./index.d.ts",
10
+ "scripts": {
11
+ "build": "yarn clean && yarn tsup && yarn rollup -c rollup.config.js",
12
+ "clean": "rm -rf ./dist || true",
13
+ "test:bundle": "publint . && attw --pack ."
14
+ },
11
15
  "name": "@algolia/client-insights",
12
16
  "description": "JavaScript client for client-insights",
13
- "jsdelivr": "./dist/client-insights.umd.js",
14
- "unpkg": "./dist/client-insights.umd.js",
15
- "browser": "./dist/client-insights.umd.js",
16
17
  "exports": {
17
18
  ".": {
18
19
  "node": {
19
- "import": "./dist/client-insights.esm.node.js",
20
- "module": "./dist/client-insights.esm.node.js",
21
- "require": "./dist/client-insights.cjs",
22
- "default": "./dist/client-insights.cjs",
23
- "types": "./dist/builds/node.d.ts"
20
+ "types": {
21
+ "import": "./dist/node.d.ts",
22
+ "module": "./dist/node.d.ts",
23
+ "require": "./dist/node.d.cts"
24
+ },
25
+ "import": "./dist/builds/node.js",
26
+ "module": "./dist/builds/node.js",
27
+ "require": "./dist/builds/node.cjs"
24
28
  },
25
- "browser": {
26
- "umd": "./dist/client-insights.umd.js",
27
- "module": "./dist/client-insights.esm.browser.js",
28
- "import": "./dist/client-insights.esm.browser.js",
29
- "default": "./dist/client-insights.umd.js",
30
- "types": "./dist/builds/browser.d.ts"
29
+ "default": {
30
+ "types": "./dist/browser.d.ts",
31
+ "module": "./dist/builds/browser.js",
32
+ "import": "./dist/builds/browser.js",
33
+ "default": "./dist/builds/browser.umd.js"
31
34
  }
32
35
  },
33
- "./src/*": "./src/*.ts",
34
- "./model": "./model/index.ts"
36
+ "./src/*": "./src/*.ts"
35
37
  },
38
+ "jsdelivr": "./dist/builds/browser.umd.js",
39
+ "unpkg": "./dist/builds/browser.umd.js",
36
40
  "files": [
37
41
  "dist",
38
42
  "model",
39
43
  "index.js",
40
44
  "index.d.ts"
41
45
  ],
42
- "scripts": {
43
- "build": "yarn clean && rollup --config",
44
- "clean": "rm -rf ./dist || true"
45
- },
46
46
  "dependencies": {
47
- "@algolia/client-common": "5.2.4",
48
- "@algolia/requester-browser-xhr": "5.2.4",
49
- "@algolia/requester-node-http": "5.2.4"
47
+ "@algolia/client-common": "5.2.5",
48
+ "@algolia/requester-browser-xhr": "5.2.5",
49
+ "@algolia/requester-node-http": "5.2.5"
50
50
  },
51
51
  "devDependencies": {
52
+ "@arethetypeswrong/cli": "0.15.4",
52
53
  "@types/node": "22.5.1",
54
+ "publint": "0.2.10",
53
55
  "rollup": "4.21.2",
56
+ "tsup": "8.2.4",
54
57
  "typescript": "5.5.4"
55
58
  },
56
59
  "engines": {
@@ -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
- readonly _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=browser.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../builds/browser.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAW5D,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;;;;;;;;;;;;EAgCrG"}