@algolia/client-personalization 5.0.0-alpha.3 → 5.0.0-alpha.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builds/browser.d.ts +1 -1
- package/dist/builds/browser.d.ts.map +1 -1
- package/dist/builds/node.d.ts +1 -1
- package/dist/builds/node.d.ts.map +1 -1
- package/dist/client-personalization.cjs.js +17 -6
- package/dist/client-personalization.esm.browser.js +45 -108
- package/dist/client-personalization.esm.node.js +17 -6
- package/dist/client-personalization.umd.js +2 -2
- package/dist/model/clientMethodProps.d.ts.map +1 -1
- package/dist/model/deleteUserProfileResponse.d.ts.map +1 -1
- package/dist/model/errorBase.d.ts.map +1 -1
- package/dist/model/eventScoring.d.ts.map +1 -1
- package/dist/model/facetScoring.d.ts.map +1 -1
- package/dist/model/getUserTokenResponse.d.ts.map +1 -1
- package/dist/model/index.d.ts.map +1 -1
- package/dist/model/personalizationStrategyParams.d.ts.map +1 -1
- package/dist/model/setPersonalizationStrategyResponse.d.ts.map +1 -1
- package/dist/src/personalizationClient.d.ts +9 -1
- package/dist/src/personalizationClient.d.ts.map +1 -1
- package/package.json +31 -13
package/dist/builds/browser.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ClientOptions } from '@algolia/client-common';
|
|
2
2
|
import type { PersonalizationClient, Region } from '../src/personalizationClient';
|
|
3
|
-
export { apiClientVersion, PersonalizationClient, } from '../src/personalizationClient';
|
|
3
|
+
export { apiClientVersion, PersonalizationClient, Region, } from '../src/personalizationClient';
|
|
4
4
|
export * from '../model';
|
|
5
5
|
export declare function personalizationClient(appId: string, apiKey: string, region: Region, options?: ClientOptions): PersonalizationClient;
|
|
6
6
|
//# sourceMappingURL=browser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["
|
|
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,EACV,qBAAqB,EACrB,MAAM,EACP,MAAM,8BAA8B,CAAC;AAOtC,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,MAAM,GACP,MAAM,8BAA8B,CAAC;AACtC,cAAc,UAAU,CAAC;AAEzB,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,aAAa,GACtB,qBAAqB,CA0CvB"}
|
package/dist/builds/node.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ClientOptions } from '@algolia/client-common';
|
|
2
2
|
import type { PersonalizationClient, Region } from '../src/personalizationClient';
|
|
3
|
-
export { apiClientVersion, PersonalizationClient, } from '../src/personalizationClient';
|
|
3
|
+
export { apiClientVersion, PersonalizationClient, Region, } from '../src/personalizationClient';
|
|
4
4
|
export * from '../model';
|
|
5
5
|
export declare function personalizationClient(appId: string, apiKey: string, region: Region, options?: ClientOptions): PersonalizationClient;
|
|
6
6
|
//# sourceMappingURL=node.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["
|
|
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,EACV,qBAAqB,EACrB,MAAM,EACP,MAAM,8BAA8B,CAAC;AAMtC,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,MAAM,GACP,MAAM,8BAA8B,CAAC;AACtC,cAAc,UAAU,CAAC;AAEzB,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,aAAa,GACtB,qBAAqB,CAoCvB"}
|
|
@@ -6,7 +6,7 @@ var clientCommon = require('@algolia/client-common');
|
|
|
6
6
|
var requesterNodeHttp = require('@algolia/requester-node-http');
|
|
7
7
|
|
|
8
8
|
// This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
|
|
9
|
-
const apiClientVersion = '5.0.0-alpha.
|
|
9
|
+
const apiClientVersion = '5.0.0-alpha.30';
|
|
10
10
|
const REGIONS = ['eu', 'us'];
|
|
11
11
|
function getDefaultHosts(region) {
|
|
12
12
|
const url = 'personalization.{region}.algolia.com'.replace('{region}', region);
|
|
@@ -35,6 +35,19 @@ function createPersonalizationClient({ appId: appIdOption, apiKey: apiKeyOption,
|
|
|
35
35
|
});
|
|
36
36
|
return {
|
|
37
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([
|
|
47
|
+
transporter.requestsCache.clear(),
|
|
48
|
+
transporter.responsesCache.clear(),
|
|
49
|
+
]).then(() => undefined);
|
|
50
|
+
},
|
|
38
51
|
/**
|
|
39
52
|
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
|
|
40
53
|
*/
|
|
@@ -257,11 +270,9 @@ function personalizationClient(appId, apiKey, region, options) {
|
|
|
257
270
|
if (!apiKey || typeof apiKey !== 'string') {
|
|
258
271
|
throw new Error('`apiKey` is missing.');
|
|
259
272
|
}
|
|
260
|
-
if (!region
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
if (region && (typeof region !== 'string' || !REGIONS.includes(region))) {
|
|
264
|
-
throw new Error(`\`region\` must be one of the following: ${REGIONS.join(', ')}`);
|
|
273
|
+
if (!region ||
|
|
274
|
+
(region && (typeof region !== 'string' || !REGIONS.includes(region)))) {
|
|
275
|
+
throw new Error(`\`region\` is required and must be one of the following: ${REGIONS.join(', ')}`);
|
|
265
276
|
}
|
|
266
277
|
return createPersonalizationClient({
|
|
267
278
|
appId,
|
|
@@ -7,31 +7,25 @@ function createAuth(appId, apiKey, authMode = 'WithinHeaders') {
|
|
|
7
7
|
headers() {
|
|
8
8
|
return authMode === 'WithinHeaders' ? credentials : {};
|
|
9
9
|
},
|
|
10
|
-
|
|
11
10
|
queryParameters() {
|
|
12
11
|
return authMode === 'WithinQueryParameters' ? credentials : {};
|
|
13
12
|
}
|
|
14
|
-
|
|
15
13
|
};
|
|
16
14
|
}
|
|
17
15
|
|
|
18
16
|
function createBrowserLocalStorageCache(options) {
|
|
19
|
-
let storage;
|
|
20
|
-
|
|
17
|
+
let storage;
|
|
18
|
+
// We've changed the namespace to avoid conflicts with v4, as this version is a huge breaking change
|
|
21
19
|
const namespaceKey = `algolia-client-js-${options.key}`;
|
|
22
|
-
|
|
23
20
|
function getStorage() {
|
|
24
21
|
if (storage === undefined) {
|
|
25
22
|
storage = options.localStorage || window.localStorage;
|
|
26
23
|
}
|
|
27
|
-
|
|
28
24
|
return storage;
|
|
29
25
|
}
|
|
30
|
-
|
|
31
26
|
function getNamespace() {
|
|
32
27
|
return JSON.parse(getStorage().getItem(namespaceKey) || '{}');
|
|
33
28
|
}
|
|
34
|
-
|
|
35
29
|
return {
|
|
36
30
|
get(key, defaultValue, events = {
|
|
37
31
|
miss: () => Promise.resolve()
|
|
@@ -44,7 +38,6 @@ function createBrowserLocalStorageCache(options) {
|
|
|
44
38
|
return Promise.all([value, exists || events.miss(value)]);
|
|
45
39
|
}).then(([value]) => value);
|
|
46
40
|
},
|
|
47
|
-
|
|
48
41
|
set(key, value) {
|
|
49
42
|
return Promise.resolve().then(() => {
|
|
50
43
|
const namespace = getNamespace();
|
|
@@ -53,7 +46,6 @@ function createBrowserLocalStorageCache(options) {
|
|
|
53
46
|
return value;
|
|
54
47
|
});
|
|
55
48
|
},
|
|
56
|
-
|
|
57
49
|
delete(key) {
|
|
58
50
|
return Promise.resolve().then(() => {
|
|
59
51
|
const namespace = getNamespace();
|
|
@@ -61,13 +53,11 @@ function createBrowserLocalStorageCache(options) {
|
|
|
61
53
|
getStorage().setItem(namespaceKey, JSON.stringify(namespace));
|
|
62
54
|
});
|
|
63
55
|
},
|
|
64
|
-
|
|
65
56
|
clear() {
|
|
66
57
|
return Promise.resolve().then(() => {
|
|
67
58
|
getStorage().removeItem(namespaceKey);
|
|
68
59
|
});
|
|
69
60
|
}
|
|
70
|
-
|
|
71
61
|
};
|
|
72
62
|
}
|
|
73
63
|
|
|
@@ -79,30 +69,24 @@ function createNullCache() {
|
|
|
79
69
|
const value = defaultValue();
|
|
80
70
|
return value.then(result => Promise.all([result, events.miss(result)])).then(([result]) => result);
|
|
81
71
|
},
|
|
82
|
-
|
|
83
72
|
set(_key, value) {
|
|
84
73
|
return Promise.resolve(value);
|
|
85
74
|
},
|
|
86
|
-
|
|
87
75
|
delete(_key) {
|
|
88
76
|
return Promise.resolve();
|
|
89
77
|
},
|
|
90
|
-
|
|
91
78
|
clear() {
|
|
92
79
|
return Promise.resolve();
|
|
93
80
|
}
|
|
94
|
-
|
|
95
81
|
};
|
|
96
82
|
}
|
|
97
83
|
|
|
98
84
|
function createFallbackableCache(options) {
|
|
99
85
|
const caches = [...options.caches];
|
|
100
86
|
const current = caches.shift();
|
|
101
|
-
|
|
102
87
|
if (current === undefined) {
|
|
103
88
|
return createNullCache();
|
|
104
89
|
}
|
|
105
|
-
|
|
106
90
|
return {
|
|
107
91
|
get(key, defaultValue, events = {
|
|
108
92
|
miss: () => Promise.resolve()
|
|
@@ -113,7 +97,6 @@ function createFallbackableCache(options) {
|
|
|
113
97
|
}).get(key, defaultValue, events);
|
|
114
98
|
});
|
|
115
99
|
},
|
|
116
|
-
|
|
117
100
|
set(key, value) {
|
|
118
101
|
return current.set(key, value).catch(() => {
|
|
119
102
|
return createFallbackableCache({
|
|
@@ -121,7 +104,6 @@ function createFallbackableCache(options) {
|
|
|
121
104
|
}).set(key, value);
|
|
122
105
|
});
|
|
123
106
|
},
|
|
124
|
-
|
|
125
107
|
delete(key) {
|
|
126
108
|
return current.delete(key).catch(() => {
|
|
127
109
|
return createFallbackableCache({
|
|
@@ -129,7 +111,6 @@ function createFallbackableCache(options) {
|
|
|
129
111
|
}).delete(key);
|
|
130
112
|
});
|
|
131
113
|
},
|
|
132
|
-
|
|
133
114
|
clear() {
|
|
134
115
|
return current.clear().catch(() => {
|
|
135
116
|
return createFallbackableCache({
|
|
@@ -137,7 +118,6 @@ function createFallbackableCache(options) {
|
|
|
137
118
|
}).clear();
|
|
138
119
|
});
|
|
139
120
|
}
|
|
140
|
-
|
|
141
121
|
};
|
|
142
122
|
}
|
|
143
123
|
|
|
@@ -150,30 +130,24 @@ function createMemoryCache(options = {
|
|
|
150
130
|
miss: () => Promise.resolve()
|
|
151
131
|
}) {
|
|
152
132
|
const keyAsString = JSON.stringify(key);
|
|
153
|
-
|
|
154
133
|
if (keyAsString in cache) {
|
|
155
134
|
return Promise.resolve(options.serializable ? JSON.parse(cache[keyAsString]) : cache[keyAsString]);
|
|
156
135
|
}
|
|
157
|
-
|
|
158
136
|
const promise = defaultValue();
|
|
159
137
|
return promise.then(value => events.miss(value)).then(() => promise);
|
|
160
138
|
},
|
|
161
|
-
|
|
162
139
|
set(key, value) {
|
|
163
140
|
cache[JSON.stringify(key)] = options.serializable ? JSON.stringify(value) : value;
|
|
164
141
|
return Promise.resolve(value);
|
|
165
142
|
},
|
|
166
|
-
|
|
167
143
|
delete(key) {
|
|
168
144
|
delete cache[JSON.stringify(key)];
|
|
169
145
|
return Promise.resolve();
|
|
170
146
|
},
|
|
171
|
-
|
|
172
147
|
clear() {
|
|
173
148
|
cache = {};
|
|
174
149
|
return Promise.resolve();
|
|
175
150
|
}
|
|
176
|
-
|
|
177
151
|
};
|
|
178
152
|
}
|
|
179
153
|
|
|
@@ -182,16 +156,14 @@ function createMemoryCache(options = {
|
|
|
182
156
|
const EXPIRATION_DELAY = 2 * 60 * 1000;
|
|
183
157
|
function createStatefulHost(host, status = 'up') {
|
|
184
158
|
const lastUpdate = Date.now();
|
|
185
|
-
|
|
186
159
|
function isUp() {
|
|
187
160
|
return status === 'up' || Date.now() - lastUpdate > EXPIRATION_DELAY;
|
|
188
161
|
}
|
|
189
|
-
|
|
190
162
|
function isTimedOut() {
|
|
191
163
|
return status === 'timed out' && Date.now() - lastUpdate <= EXPIRATION_DELAY;
|
|
192
164
|
}
|
|
193
|
-
|
|
194
|
-
|
|
165
|
+
return {
|
|
166
|
+
...host,
|
|
195
167
|
status,
|
|
196
168
|
lastUpdate,
|
|
197
169
|
isUp,
|
|
@@ -210,79 +182,63 @@ function _defineProperty(obj, key, value) {
|
|
|
210
182
|
} else {
|
|
211
183
|
obj[key] = value;
|
|
212
184
|
}
|
|
213
|
-
|
|
214
185
|
return obj;
|
|
215
186
|
}
|
|
216
187
|
|
|
217
188
|
class AlgoliaError extends Error {
|
|
218
189
|
constructor(message, name) {
|
|
219
190
|
super(message);
|
|
220
|
-
|
|
221
191
|
_defineProperty(this, "name", 'AlgoliaError');
|
|
222
|
-
|
|
223
192
|
if (name) {
|
|
224
193
|
this.name = name;
|
|
225
194
|
}
|
|
226
195
|
}
|
|
227
|
-
|
|
228
196
|
}
|
|
229
197
|
class ErrorWithStackTrace extends AlgoliaError {
|
|
230
198
|
constructor(message, stackTrace, name) {
|
|
231
|
-
super(message, name);
|
|
232
|
-
|
|
199
|
+
super(message, name);
|
|
200
|
+
// the array and object should be frozen to reflect the stackTrace at the time of the error
|
|
233
201
|
_defineProperty(this, "stackTrace", void 0);
|
|
234
|
-
|
|
235
202
|
this.stackTrace = stackTrace;
|
|
236
203
|
}
|
|
237
|
-
|
|
238
204
|
}
|
|
239
205
|
class RetryError extends ErrorWithStackTrace {
|
|
240
206
|
constructor(stackTrace) {
|
|
241
207
|
super('Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.', stackTrace, 'RetryError');
|
|
242
208
|
}
|
|
243
|
-
|
|
244
209
|
}
|
|
245
210
|
class ApiError extends ErrorWithStackTrace {
|
|
246
211
|
constructor(message, status, stackTrace) {
|
|
247
212
|
super(message, stackTrace, 'ApiError');
|
|
248
|
-
|
|
249
213
|
_defineProperty(this, "status", void 0);
|
|
250
|
-
|
|
251
214
|
this.status = status;
|
|
252
215
|
}
|
|
253
|
-
|
|
254
216
|
}
|
|
255
217
|
class DeserializationError extends AlgoliaError {
|
|
256
218
|
constructor(message, response) {
|
|
257
219
|
super(message, 'DeserializationError');
|
|
258
|
-
|
|
259
220
|
_defineProperty(this, "response", void 0);
|
|
260
|
-
|
|
261
221
|
this.response = response;
|
|
262
222
|
}
|
|
263
|
-
|
|
264
223
|
}
|
|
265
224
|
function serializeUrl(host, path, queryParameters) {
|
|
266
225
|
const queryParametersAsString = serializeQueryParameters(queryParameters);
|
|
267
226
|
let url = `${host.protocol}://${host.url}/${path.charAt(0) === '/' ? path.substr(1) : path}`;
|
|
268
|
-
|
|
269
227
|
if (queryParametersAsString.length) {
|
|
270
228
|
url += `?${queryParametersAsString}`;
|
|
271
229
|
}
|
|
272
|
-
|
|
273
230
|
return url;
|
|
274
231
|
}
|
|
275
232
|
function serializeQueryParameters(parameters) {
|
|
276
233
|
const isObjectOrArray = value => Object.prototype.toString.call(value) === '[object Object]' || Object.prototype.toString.call(value) === '[object Array]';
|
|
277
|
-
|
|
278
|
-
return Object.keys(parameters).map(key => `${key}=${isObjectOrArray(parameters[key]) ? JSON.stringify(parameters[key]) : parameters[key]}`).join('&');
|
|
234
|
+
return Object.keys(parameters).map(key => `${key}=${encodeURIComponent(isObjectOrArray(parameters[key]) ? JSON.stringify(parameters[key]) : parameters[key])}`).join('&');
|
|
279
235
|
}
|
|
280
236
|
function serializeData(request, requestOptions) {
|
|
281
237
|
if (request.method === 'GET' || request.data === undefined && requestOptions.data === undefined) {
|
|
282
238
|
return undefined;
|
|
283
239
|
}
|
|
284
|
-
|
|
285
|
-
|
|
240
|
+
const data = Array.isArray(request.data) ? request.data : {
|
|
241
|
+
...request.data,
|
|
286
242
|
...requestOptions.data
|
|
287
243
|
};
|
|
288
244
|
return JSON.stringify(data);
|
|
@@ -313,12 +269,11 @@ function deserializeFailure({
|
|
|
313
269
|
status
|
|
314
270
|
}, stackFrame) {
|
|
315
271
|
let message = content;
|
|
316
|
-
|
|
317
272
|
try {
|
|
318
273
|
message = JSON.parse(content).message;
|
|
319
|
-
} catch (e) {
|
|
274
|
+
} catch (e) {
|
|
275
|
+
// ..
|
|
320
276
|
}
|
|
321
|
-
|
|
322
277
|
return new ApiError(message, status, stackFrame);
|
|
323
278
|
}
|
|
324
279
|
|
|
@@ -350,9 +305,12 @@ function stackFrameWithoutCredentials(stackFrame) {
|
|
|
350
305
|
const modifiedHeaders = stackFrame.request.headers['x-algolia-api-key'] ? {
|
|
351
306
|
'x-algolia-api-key': '*****'
|
|
352
307
|
} : {};
|
|
353
|
-
return {
|
|
354
|
-
|
|
355
|
-
|
|
308
|
+
return {
|
|
309
|
+
...stackFrame,
|
|
310
|
+
request: {
|
|
311
|
+
...stackFrame.request,
|
|
312
|
+
headers: {
|
|
313
|
+
...stackFrame.request.headers,
|
|
356
314
|
...modifiedHeaders
|
|
357
315
|
}
|
|
358
316
|
}
|
|
@@ -377,13 +335,12 @@ function createTransporter({
|
|
|
377
335
|
});
|
|
378
336
|
}));
|
|
379
337
|
const hostsUp = statefulHosts.filter(host => host.isUp());
|
|
380
|
-
const hostsTimedOut = statefulHosts.filter(host => host.isTimedOut());
|
|
381
|
-
|
|
338
|
+
const hostsTimedOut = statefulHosts.filter(host => host.isTimedOut());
|
|
339
|
+
// Note, we put the hosts that previously timed out on the end of the list.
|
|
382
340
|
const hostsAvailable = [...hostsUp, ...hostsTimedOut];
|
|
383
341
|
const compatibleHostsAvailable = hostsAvailable.length > 0 ? hostsAvailable : compatibleHosts;
|
|
384
342
|
return {
|
|
385
343
|
hosts: compatibleHostsAvailable,
|
|
386
|
-
|
|
387
344
|
getTimeout(timeoutsCount, baseTimeout) {
|
|
388
345
|
/**
|
|
389
346
|
* Imagine that you have 4 hosts, if timeouts will increase
|
|
@@ -399,29 +356,28 @@ function createTransporter({
|
|
|
399
356
|
const timeoutMultiplier = hostsTimedOut.length === 0 && timeoutsCount === 0 ? 1 : hostsTimedOut.length + 3 + timeoutsCount;
|
|
400
357
|
return timeoutMultiplier * baseTimeout;
|
|
401
358
|
}
|
|
402
|
-
|
|
403
359
|
};
|
|
404
360
|
}
|
|
405
|
-
|
|
406
361
|
async function retryableRequest(request, requestOptions, isRead = true) {
|
|
407
362
|
const stackTrace = [];
|
|
408
363
|
/**
|
|
409
364
|
* First we prepare the payload that do not depend from hosts.
|
|
410
365
|
*/
|
|
411
|
-
|
|
412
366
|
const data = serializeData(request, requestOptions);
|
|
413
|
-
const headers = serializeHeaders(baseHeaders, request.headers, requestOptions.headers);
|
|
414
|
-
|
|
415
|
-
const dataQueryParameters = request.method === 'GET' ? {
|
|
367
|
+
const headers = serializeHeaders(baseHeaders, request.headers, requestOptions.headers);
|
|
368
|
+
// On `GET`, the data is proxied to query parameters.
|
|
369
|
+
const dataQueryParameters = request.method === 'GET' ? {
|
|
370
|
+
...request.data,
|
|
416
371
|
...requestOptions.data
|
|
417
372
|
} : {};
|
|
418
373
|
const queryParameters = {
|
|
419
|
-
'x-algolia-agent': algoliaAgent.value,
|
|
420
374
|
...baseQueryParameters,
|
|
421
375
|
...request.queryParameters,
|
|
422
376
|
...dataQueryParameters
|
|
423
377
|
};
|
|
424
|
-
|
|
378
|
+
if (algoliaAgent.value) {
|
|
379
|
+
queryParameters['x-algolia-agent'] = algoliaAgent.value;
|
|
380
|
+
}
|
|
425
381
|
if (requestOptions && requestOptions.queryParameters) {
|
|
426
382
|
for (const key of Object.keys(requestOptions.queryParameters)) {
|
|
427
383
|
// We want to keep `undefined` and `null` values,
|
|
@@ -434,25 +390,19 @@ function createTransporter({
|
|
|
434
390
|
}
|
|
435
391
|
}
|
|
436
392
|
}
|
|
437
|
-
|
|
438
393
|
let timeoutsCount = 0;
|
|
439
|
-
|
|
440
394
|
const retry = async (retryableHosts, getTimeout) => {
|
|
441
395
|
/**
|
|
442
396
|
* We iterate on each host, until there is no host left.
|
|
443
397
|
*/
|
|
444
398
|
const host = retryableHosts.pop();
|
|
445
|
-
|
|
446
399
|
if (host === undefined) {
|
|
447
400
|
throw new RetryError(stackTraceWithoutCredentials(stackTrace));
|
|
448
401
|
}
|
|
449
|
-
|
|
450
402
|
let responseTimeout = requestOptions.timeout;
|
|
451
|
-
|
|
452
403
|
if (responseTimeout === undefined) {
|
|
453
404
|
responseTimeout = isRead ? timeouts.read : timeouts.write;
|
|
454
405
|
}
|
|
455
|
-
|
|
456
406
|
const payload = {
|
|
457
407
|
data,
|
|
458
408
|
headers,
|
|
@@ -466,7 +416,6 @@ function createTransporter({
|
|
|
466
416
|
* can have information about onRetry and onFailure
|
|
467
417
|
* decisions.
|
|
468
418
|
*/
|
|
469
|
-
|
|
470
419
|
const pushToStackTrace = response => {
|
|
471
420
|
const stackFrame = {
|
|
472
421
|
request: payload,
|
|
@@ -477,12 +426,10 @@ function createTransporter({
|
|
|
477
426
|
stackTrace.push(stackFrame);
|
|
478
427
|
return stackFrame;
|
|
479
428
|
};
|
|
480
|
-
|
|
481
429
|
const response = await requester.send(payload);
|
|
482
|
-
|
|
483
430
|
if (isRetryable(response)) {
|
|
484
|
-
const stackFrame = pushToStackTrace(response);
|
|
485
|
-
|
|
431
|
+
const stackFrame = pushToStackTrace(response);
|
|
432
|
+
// If response is a timeout, we increase the number of timeouts so we can increase the timeout later.
|
|
486
433
|
if (response.isTimedOut) {
|
|
487
434
|
timeoutsCount++;
|
|
488
435
|
}
|
|
@@ -492,23 +439,18 @@ function createTransporter({
|
|
|
492
439
|
* when a retry error does not happen.
|
|
493
440
|
*/
|
|
494
441
|
// eslint-disable-next-line no-console -- this will be fixed by exposing a `logger` to the transporter
|
|
495
|
-
|
|
496
|
-
|
|
497
442
|
console.log('Retryable failure', stackFrameWithoutCredentials(stackFrame));
|
|
498
443
|
/**
|
|
499
444
|
* We also store the state of the host in failure cases. If the host, is
|
|
500
445
|
* down it will remain down for the next 2 minutes. In a timeout situation,
|
|
501
446
|
* this host will be added end of the list of hosts on the next request.
|
|
502
447
|
*/
|
|
503
|
-
|
|
504
448
|
await hostsCache.set(host, createStatefulHost(host, response.isTimedOut ? 'timed out' : 'down'));
|
|
505
449
|
return retry(retryableHosts, getTimeout);
|
|
506
450
|
}
|
|
507
|
-
|
|
508
451
|
if (isSuccess(response)) {
|
|
509
452
|
return deserializeSuccess(response);
|
|
510
453
|
}
|
|
511
|
-
|
|
512
454
|
pushToStackTrace(response);
|
|
513
455
|
throw deserializeFailure(response, stackTrace);
|
|
514
456
|
};
|
|
@@ -520,20 +462,16 @@ function createTransporter({
|
|
|
520
462
|
* 2. We also get from the retryable options a timeout multiplier that is tailored
|
|
521
463
|
* for the current context.
|
|
522
464
|
*/
|
|
523
|
-
|
|
524
|
-
|
|
525
465
|
const compatibleHosts = hosts.filter(host => host.accept === 'readWrite' || (isRead ? host.accept === 'read' : host.accept === 'write'));
|
|
526
466
|
const options = await createRetryableOptions(compatibleHosts);
|
|
527
467
|
return retry([...options.hosts].reverse(), options.getTimeout);
|
|
528
468
|
}
|
|
529
|
-
|
|
530
469
|
function createRequest(request, requestOptions = {}) {
|
|
531
470
|
/**
|
|
532
471
|
* A read request is either a `GET` request, or a request that we make
|
|
533
472
|
* via the `read` transporter (e.g. `search`).
|
|
534
473
|
*/
|
|
535
474
|
const isRead = request.useReadTransporter || request.method === 'GET';
|
|
536
|
-
|
|
537
475
|
if (!isRead) {
|
|
538
476
|
/**
|
|
539
477
|
* On write requests, no cache mechanisms are applied, and we
|
|
@@ -541,7 +479,6 @@ function createTransporter({
|
|
|
541
479
|
*/
|
|
542
480
|
return retryableRequest(request, requestOptions, isRead);
|
|
543
481
|
}
|
|
544
|
-
|
|
545
482
|
const createRetryableRequest = () => {
|
|
546
483
|
/**
|
|
547
484
|
* Then, we prepare a function factory that contains the construction of
|
|
@@ -555,14 +492,11 @@ function createTransporter({
|
|
|
555
492
|
* request is "cacheable" - should be cached. Note that, once again,
|
|
556
493
|
* the user can force this option.
|
|
557
494
|
*/
|
|
558
|
-
|
|
559
|
-
|
|
560
495
|
const cacheable = requestOptions.cacheable || request.cacheable;
|
|
561
496
|
/**
|
|
562
497
|
* If is not "cacheable", we immediately trigger the retryable request, no
|
|
563
498
|
* need to check cache implementations.
|
|
564
499
|
*/
|
|
565
|
-
|
|
566
500
|
if (cacheable !== true) {
|
|
567
501
|
return createRetryableRequest();
|
|
568
502
|
}
|
|
@@ -571,8 +505,6 @@ function createTransporter({
|
|
|
571
505
|
* the cache implementations if this request is on progress or if the
|
|
572
506
|
* response already exists on the cache.
|
|
573
507
|
*/
|
|
574
|
-
|
|
575
|
-
|
|
576
508
|
const key = {
|
|
577
509
|
request,
|
|
578
510
|
requestOptions,
|
|
@@ -585,7 +517,6 @@ function createTransporter({
|
|
|
585
517
|
* With the computed key, we first ask the responses cache
|
|
586
518
|
* implementation if this request was been resolved before.
|
|
587
519
|
*/
|
|
588
|
-
|
|
589
520
|
return responsesCache.get(key, () => {
|
|
590
521
|
/**
|
|
591
522
|
* If the request has never resolved before, we actually ask if there
|
|
@@ -607,7 +538,6 @@ function createTransporter({
|
|
|
607
538
|
miss: response => responsesCache.set(key, response)
|
|
608
539
|
});
|
|
609
540
|
}
|
|
610
|
-
|
|
611
541
|
return {
|
|
612
542
|
hostsCache,
|
|
613
543
|
requester,
|
|
@@ -625,17 +555,13 @@ function createTransporter({
|
|
|
625
555
|
function createAlgoliaAgent(version) {
|
|
626
556
|
const algoliaAgent = {
|
|
627
557
|
value: `Algolia for JavaScript (${version})`,
|
|
628
|
-
|
|
629
558
|
add(options) {
|
|
630
559
|
const addedAlgoliaAgent = `; ${options.segment}${options.version !== undefined ? ` (${options.version})` : ''}`;
|
|
631
|
-
|
|
632
560
|
if (algoliaAgent.value.indexOf(addedAlgoliaAgent) === -1) {
|
|
633
561
|
algoliaAgent.value = `${algoliaAgent.value}${addedAlgoliaAgent}`;
|
|
634
562
|
}
|
|
635
|
-
|
|
636
563
|
return algoliaAgent;
|
|
637
564
|
}
|
|
638
|
-
|
|
639
565
|
};
|
|
640
566
|
return algoliaAgent;
|
|
641
567
|
}
|
|
@@ -710,7 +636,7 @@ function createXhrRequester() {
|
|
|
710
636
|
}
|
|
711
637
|
|
|
712
638
|
// This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
|
|
713
|
-
const apiClientVersion = '5.0.0-alpha.
|
|
639
|
+
const apiClientVersion = '5.0.0-alpha.30';
|
|
714
640
|
const REGIONS = ['eu', 'us'];
|
|
715
641
|
function getDefaultHosts(region) {
|
|
716
642
|
const url = 'personalization.{region}.algolia.com'.replace('{region}', region);
|
|
@@ -739,6 +665,19 @@ function createPersonalizationClient({ appId: appIdOption, apiKey: apiKeyOption,
|
|
|
739
665
|
});
|
|
740
666
|
return {
|
|
741
667
|
transporter,
|
|
668
|
+
/**
|
|
669
|
+
* The `appId` currently in use.
|
|
670
|
+
*/
|
|
671
|
+
appId: appIdOption,
|
|
672
|
+
/**
|
|
673
|
+
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
|
|
674
|
+
*/
|
|
675
|
+
clearCache() {
|
|
676
|
+
return Promise.all([
|
|
677
|
+
transporter.requestsCache.clear(),
|
|
678
|
+
transporter.responsesCache.clear(),
|
|
679
|
+
]).then(() => undefined);
|
|
680
|
+
},
|
|
742
681
|
/**
|
|
743
682
|
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
|
|
744
683
|
*/
|
|
@@ -961,11 +900,9 @@ function personalizationClient(appId, apiKey, region, options) {
|
|
|
961
900
|
if (!apiKey || typeof apiKey !== 'string') {
|
|
962
901
|
throw new Error('`apiKey` is missing.');
|
|
963
902
|
}
|
|
964
|
-
if (!region
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
if (region && (typeof region !== 'string' || !REGIONS.includes(region))) {
|
|
968
|
-
throw new Error(`\`region\` must be one of the following: ${REGIONS.join(', ')}`);
|
|
903
|
+
if (!region ||
|
|
904
|
+
(region && (typeof region !== 'string' || !REGIONS.includes(region)))) {
|
|
905
|
+
throw new Error(`\`region\` is required and must be one of the following: ${REGIONS.join(', ')}`);
|
|
969
906
|
}
|
|
970
907
|
return createPersonalizationClient({
|
|
971
908
|
appId,
|
|
@@ -2,7 +2,7 @@ import { createAuth, createTransporter, getAlgoliaAgent, DEFAULT_CONNECT_TIMEOUT
|
|
|
2
2
|
import { createHttpRequester } from '@algolia/requester-node-http';
|
|
3
3
|
|
|
4
4
|
// This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
|
|
5
|
-
const apiClientVersion = '5.0.0-alpha.
|
|
5
|
+
const apiClientVersion = '5.0.0-alpha.30';
|
|
6
6
|
const REGIONS = ['eu', 'us'];
|
|
7
7
|
function getDefaultHosts(region) {
|
|
8
8
|
const url = 'personalization.{region}.algolia.com'.replace('{region}', region);
|
|
@@ -31,6 +31,19 @@ function createPersonalizationClient({ appId: appIdOption, apiKey: apiKeyOption,
|
|
|
31
31
|
});
|
|
32
32
|
return {
|
|
33
33
|
transporter,
|
|
34
|
+
/**
|
|
35
|
+
* The `appId` currently in use.
|
|
36
|
+
*/
|
|
37
|
+
appId: appIdOption,
|
|
38
|
+
/**
|
|
39
|
+
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
|
|
40
|
+
*/
|
|
41
|
+
clearCache() {
|
|
42
|
+
return Promise.all([
|
|
43
|
+
transporter.requestsCache.clear(),
|
|
44
|
+
transporter.responsesCache.clear(),
|
|
45
|
+
]).then(() => undefined);
|
|
46
|
+
},
|
|
34
47
|
/**
|
|
35
48
|
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
|
|
36
49
|
*/
|
|
@@ -253,11 +266,9 @@ function personalizationClient(appId, apiKey, region, options) {
|
|
|
253
266
|
if (!apiKey || typeof apiKey !== 'string') {
|
|
254
267
|
throw new Error('`apiKey` is missing.');
|
|
255
268
|
}
|
|
256
|
-
if (!region
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
if (region && (typeof region !== 'string' || !REGIONS.includes(region))) {
|
|
260
|
-
throw new Error(`\`region\` must be one of the following: ${REGIONS.join(', ')}`);
|
|
269
|
+
if (!region ||
|
|
270
|
+
(region && (typeof region !== 'string' || !REGIONS.includes(region)))) {
|
|
271
|
+
throw new Error(`\`region\` is required and must be one of the following: ${REGIONS.join(', ')}`);
|
|
261
272
|
}
|
|
262
273
|
return createPersonalizationClient({
|
|
263
274
|
appId,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! client-personalization.umd.js | 5.0.0-alpha.
|
|
2
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@algolia/client-personalization"]={})}(this,(function(e){"use strict";function t(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function r(e){let t;const r=`algolia-client-js-${e.key}`;function a(){return void 0===t&&(t=e.localStorage||window.localStorage),t}function n(){return JSON.parse(a().getItem(r)||"{}")}return{get:(e,t,r={miss:()=>Promise.resolve()})=>Promise.resolve().then((()=>{const r=JSON.stringify(e),a=n()[r];return Promise.all([a||t(),void 0!==a])})).then((([e,t])=>Promise.all([e,t||r.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve().then((()=>{const s=n();return s[JSON.stringify(e)]=t,a().setItem(r,JSON.stringify(s)),t})),delete:e=>Promise.resolve().then((()=>{const t=n();delete t[JSON.stringify(e)],a().setItem(r,JSON.stringify(t))})),clear:()=>Promise.resolve().then((()=>{a().removeItem(r)}))}}function a(e){const t=[...e.caches],r=t.shift();return void 0===r?{get:(e,t,r={miss:()=>Promise.resolve()})=>t().then((e=>Promise.all([e,r.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve(t),delete:e=>Promise.resolve(),clear:()=>Promise.resolve()}:{get:(e,n,s={miss:()=>Promise.resolve()})=>r.get(e,n,s).catch((()=>a({caches:t}).get(e,n,s))),set:(e,n)=>r.set(e,n).catch((()=>a({caches:t}).set(e,n))),delete:e=>r.delete(e).catch((()=>a({caches:t}).delete(e))),clear:()=>r.clear().catch((()=>a({caches:t}).clear()))}}function n(e={serializable:!0}){let t={};return{get(r,a,n={miss:()=>Promise.resolve()}){const s=JSON.stringify(r);if(s in t)return Promise.resolve(e.serializable?JSON.parse(t[s]):t[s]);const o=a();return o.then((e=>n.miss(e))).then((()=>o))},set:(r,a)=>(t[JSON.stringify(r)]=e.serializable?JSON.stringify(a):a,Promise.resolve(a)),delete:e=>(delete t[JSON.stringify(e)],Promise.resolve()),clear:()=>(t={},Promise.resolve())}}const s=12e4;function o(e,t="up"){const r=Date.now();return{...e,status:t,lastUpdate:r,isUp:function(){return"up"===t||Date.now()-r>s},isTimedOut:function(){return"timed out"===t&&Date.now()-r<=s}}}function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class c extends Error{constructor(e,t){super(e),i(this,"name","AlgoliaError"),t&&(this.name=t)}}class u extends c{constructor(e,t,r){super(e,r),i(this,"stackTrace",void 0),this.stackTrace=t}}class l extends u{constructor(e){super("Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.",e,"RetryError")}}class p extends u{constructor(e,t,r){super(e,r,"ApiError"),i(this,"status",void 0),this.status=t}}class h extends c{constructor(e,t){super(e,"DeserializationError"),i(this,"response",void 0),this.response=t}}function d(e,t,r){const a=function(e){const t=e=>"[object Object]"===Object.prototype.toString.call(e)||"[object Array]"===Object.prototype.toString.call(e);return Object.keys(e).map((r=>`${r}=${t(e[r])?JSON.stringify(e[r]):e[r]}`)).join("&")}(r);let n=`${e.protocol}://${e.url}/${"/"===t.charAt(0)?t.substr(1):t}`;return a.length&&(n+=`?${a}`),n}function m(e){const t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...e,request:{...e.request,headers:{...e.request.headers,...t}}}}function f({hosts:e,hostsCache:t,baseHeaders:r,baseQueryParameters:a,algoliaAgent:n,timeouts:s,requester:i,requestsCache:c,responsesCache:u}){async function f(c,u,f=!0){const g=[],y=function(e,t){if("GET"===e.method||void 0===e.data&&void 0===t.data)return;const r=Array.isArray(e.data)?e.data:{...e.data,...t.data};return JSON.stringify(r)}(c,u),P=function(e,t,r){const a={Accept:"application/json",...e,...t,...r},n={};return Object.keys(a).forEach((e=>{const t=a[e];n[e.toLowerCase()]=t})),n}(r,c.headers,u.headers),O="GET"===c.method?{...c.data,...u.data}:{},b={"x-algolia-agent":n.value,...a,...c.queryParameters,...O};if(u&&u.queryParameters)for(const e of Object.keys(u.queryParameters))u.queryParameters[e]&&"[object Object]"!==Object.prototype.toString.call(u.queryParameters[e])?b[e]=u.queryParameters[e].toString():b[e]=u.queryParameters[e];let w=0;const v=async(e,r)=>{const a=e.pop();if(void 0===a)throw new l(function(e){return e.map((e=>m(e)))}(g));let n=u.timeout;void 0===n&&(n=f?s.read:s.write);const O={data:y,headers:P,method:c.method,url:d(a,c.path,b),connectTimeout:r(w,s.connect),responseTimeout:r(w,n)},q=t=>{const r={request:O,response:t,host:a,triesLeft:e.length};return g.push(r),r},T=await i.send(O);if(function({isTimedOut:e,status:t}){return e||function({isTimedOut:e,status:t}){return!e&&0==~~t}({isTimedOut:e,status:t})||2!=~~(t/100)&&4!=~~(t/100)}(T)){const n=q(T);return T.isTimedOut&&w++,console.log("Retryable failure",m(n)),await t.set(a,o(a,T.isTimedOut?"timed out":"down")),v(e,r)}if(function({status:e}){return 2==~~(e/100)}(T))return function(e){try{return JSON.parse(e.content)}catch(t){throw new h(t.message,e)}}(T);throw q(T),function({content:e,status:t},r){let a=e;try{a=JSON.parse(e).message}catch(e){}return new p(a,t,r)}(T,g)},q=e.filter((e=>"readWrite"===e.accept||(f?"read"===e.accept:"write"===e.accept))),T=await async function(e){const r=await Promise.all(e.map((e=>t.get(e,(()=>Promise.resolve(o(e))))))),a=r.filter((e=>e.isUp())),n=r.filter((e=>e.isTimedOut())),s=[...a,...n];return{hosts:s.length>0?s:e,getTimeout:(e,t)=>(0===n.length&&0===e?1:n.length+3+e)*t}}(q);return v([...T.hosts].reverse(),T.getTimeout)}return{hostsCache:t,requester:i,timeouts:s,algoliaAgent:n,baseHeaders:r,baseQueryParameters:a,hosts:e,request:function(e,t={}){const n=e.useReadTransporter||"GET"===e.method;if(!n)return f(e,t,n);const s=()=>f(e,t);if(!0!==(t.cacheable||e.cacheable))return s();const o={request:e,requestOptions:t,transporter:{queryParameters:a,headers:r}};return u.get(o,(()=>c.get(o,(()=>c.set(o,s()).then((e=>Promise.all([c.delete(o),e])),(e=>Promise.all([c.delete(o),Promise.reject(e)]))).then((([e,t])=>t))))),{miss:e=>u.set(o,e)})},requestsCache:c,responsesCache:u}}function g({algoliaAgents:e,client:t,version:r}){const a=function(e){const t={value:`Algolia for JavaScript (${e})`,add(e){const r=`; ${e.segment}${void 0!==e.version?` (${e.version})`:""}`;return-1===t.value.indexOf(r)&&(t.value=`${t.value}${r}`),t}};return t}(r).add({segment:t,version:r});return e.forEach((e=>a.add(e))),a}function y(e,t){if(null==e)return{};var r,a,n=function(e,t){if(null==e)return{};var r,a,n={},s=Object.keys(e);for(a=0;a<s.length;a++)r=s[a],t.indexOf(r)>=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a<s.length;a++)r=s[a],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var P=["appId","apiKey","authMode","algoliaAgents","region"];function O(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function b(e){for(var r=1;r<arguments.length;r++){var a=null!=arguments[r]?arguments[r]:{};r%2?O(Object(a),!0).forEach((function(r){t(e,r,a[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):O(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}var w="5.0.0-alpha.3",v=["eu","us"];function q(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}e.apiClientVersion=w,e.personalizationClient=function(e,s,o,i){if(!e||"string"!=typeof e)throw new Error("`appId` is missing.");if(!s||"string"!=typeof s)throw new Error("`apiKey` is missing.");if(!o)throw new Error("`region` is missing.");if(o&&("string"!=typeof o||!v.includes(o)))throw new Error("`region` must be one of the following: ".concat(v.join(", ")));return function(e){var t,r=e.appId,a=e.apiKey,n=e.authMode,s=e.algoliaAgents,o=e.region,i=y(e,P),c=function(e,t,r="WithinHeaders"){const a={"x-algolia-api-key":t,"x-algolia-application-id":e};return{headers:()=>"WithinHeaders"===r?a:{},queryParameters:()=>"WithinQueryParameters"===r?a:{}}}(r,a,n),u=f(b(b({hosts:(t=o,[{url:"personalization.{region}.algolia.com".replace("{region}",t),accept:"readWrite",protocol:"https"}])},i),{},{algoliaAgent:g({algoliaAgents:s,client:"Personalization",version:w}),baseHeaders:b(b({"content-type":"text/plain"},c.headers()),i.baseHeaders),baseQueryParameters:b(b({},c.queryParameters()),i.baseQueryParameters)}));return{transporter:u,get _ua(){return u.algoliaAgent.value},addAlgoliaAgent:function(e,t){u.algoliaAgent.add({segment:e,version:t})},del:function(e,t){var r=e.path,a=e.parameters;if(!r)throw new Error("Parameter `path` is required when calling `del`.");var n={method:"DELETE",path:"/1{path}".replace("{path}",r),queryParameters:a||{},headers:{}};return u.request(n,t)},deleteUserProfile:function(e,t){var r=e.userToken;if(!r)throw new Error("Parameter `userToken` is required when calling `deleteUserProfile`.");var a={method:"DELETE",path:"/1/profiles/{userToken}".replace("{userToken}",encodeURIComponent(r)),queryParameters:{},headers:{}};return u.request(a,t)},get:function(e,t){var r=e.path,a=e.parameters;if(!r)throw new Error("Parameter `path` is required when calling `get`.");var n={method:"GET",path:"/1{path}".replace("{path}",r),queryParameters:a||{},headers:{}};return u.request(n,t)},getPersonalizationStrategy:function(e){var t={method:"GET",path:"/1/strategies/personalization",queryParameters:{},headers:{}};return u.request(t,e)},getUserTokenProfile:function(e,t){var r=e.userToken;if(!r)throw new Error("Parameter `userToken` is required when calling `getUserTokenProfile`.");var a={method:"GET",path:"/1/profiles/personalization/{userToken}".replace("{userToken}",encodeURIComponent(r)),queryParameters:{},headers:{}};return u.request(a,t)},post:function(e,t){var r=e.path,a=e.parameters,n=e.body;if(!r)throw new Error("Parameter `path` is required when calling `post`.");var s={method:"POST",path:"/1{path}".replace("{path}",r),queryParameters:a||{},headers:{},data:n||{}};return u.request(s,t)},put:function(e,t){var r=e.path,a=e.parameters,n=e.body;if(!r)throw new Error("Parameter `path` is required when calling `put`.");var s={method:"PUT",path:"/1{path}".replace("{path}",r),queryParameters:a||{},headers:{},data:n||{}};return u.request(s,t)},setPersonalizationStrategy:function(e,t){if(!e)throw new Error("Parameter `personalizationStrategyParams` is required when calling `setPersonalizationStrategy`.");if(!e.eventScoring)throw new Error("Parameter `personalizationStrategyParams.eventScoring` is required when calling `setPersonalizationStrategy`.");if(!e.facetScoring)throw new Error("Parameter `personalizationStrategyParams.facetScoring` is required when calling `setPersonalizationStrategy`.");if(!e.personalizationImpact)throw new Error("Parameter `personalizationStrategyParams.personalizationImpact` is required when calling `setPersonalizationStrategy`.");var r={method:"POST",path:"/1/strategies/personalization",queryParameters:{},headers:{},data:e};return u.request(r,t)}}}(function(e){for(var r=1;r<arguments.length;r++){var a=null!=arguments[r]?arguments[r]:{};r%2?q(Object(a),!0).forEach((function(r){t(e,r,a[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):q(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}({appId:e,apiKey:s,region:o,timeouts:{connect:1e3,read:2e3,write:3e4},requester:{send:function(e){return new Promise((t=>{const r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach((t=>r.setRequestHeader(t,e.headers[t])));const a=(e,a)=>setTimeout((()=>{r.abort(),t({status:0,content:a,isTimedOut:!0})}),e),n=a(e.connectTimeout,"Connection timeout");let s;r.onreadystatechange=()=>{r.readyState>r.OPENED&&void 0===s&&(clearTimeout(n),s=a(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{0===r.status&&(clearTimeout(n),clearTimeout(s),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(n),clearTimeout(s),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))}},algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:n(),requestsCache:n({serializable:!1}),hostsCache:a({caches:[r({key:"".concat(w,"-").concat(e)}),n()]})},i))}}));
|
|
1
|
+
/*! client-personalization.umd.js | 5.0.0-alpha.30 | © Algolia, inc. | https://github.com/algolia/algoliasearch-client-javascript */
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@algolia/client-personalization"]={})}(this,(function(e){"use strict";function t(e){let t;const r=`algolia-client-js-${e.key}`;function s(){return void 0===t&&(t=e.localStorage||window.localStorage),t}function a(){return JSON.parse(s().getItem(r)||"{}")}return{get:(e,t,r={miss:()=>Promise.resolve()})=>Promise.resolve().then((()=>{const r=JSON.stringify(e),s=a()[r];return Promise.all([s||t(),void 0!==s])})).then((([e,t])=>Promise.all([e,t||r.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve().then((()=>{const o=a();return o[JSON.stringify(e)]=t,s().setItem(r,JSON.stringify(o)),t})),delete:e=>Promise.resolve().then((()=>{const t=a();delete t[JSON.stringify(e)],s().setItem(r,JSON.stringify(t))})),clear:()=>Promise.resolve().then((()=>{s().removeItem(r)}))}}function r(e){const t=[...e.caches],s=t.shift();return void 0===s?{get:(e,t,r={miss:()=>Promise.resolve()})=>t().then((e=>Promise.all([e,r.miss(e)]))).then((([e])=>e)),set:(e,t)=>Promise.resolve(t),delete:e=>Promise.resolve(),clear:()=>Promise.resolve()}:{get:(e,a,o={miss:()=>Promise.resolve()})=>s.get(e,a,o).catch((()=>r({caches:t}).get(e,a,o))),set:(e,a)=>s.set(e,a).catch((()=>r({caches:t}).set(e,a))),delete:e=>s.delete(e).catch((()=>r({caches:t}).delete(e))),clear:()=>s.clear().catch((()=>r({caches:t}).clear()))}}function s(e={serializable:!0}){let t={};return{get(r,s,a={miss:()=>Promise.resolve()}){const o=JSON.stringify(r);if(o in t)return Promise.resolve(e.serializable?JSON.parse(t[o]):t[o]);const n=s();return n.then((e=>a.miss(e))).then((()=>n))},set:(r,s)=>(t[JSON.stringify(r)]=e.serializable?JSON.stringify(s):s,Promise.resolve(s)),delete:e=>(delete t[JSON.stringify(e)],Promise.resolve()),clear:()=>(t={},Promise.resolve())}}const a=12e4;function o(e,t="up"){const r=Date.now();return{...e,status:t,lastUpdate:r,isUp:function(){return"up"===t||Date.now()-r>a},isTimedOut:function(){return"timed out"===t&&Date.now()-r<=a}}}function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class i extends Error{constructor(e,t){super(e),n(this,"name","AlgoliaError"),t&&(this.name=t)}}class c extends i{constructor(e,t,r){super(e,r),n(this,"stackTrace",void 0),this.stackTrace=t}}class u extends c{constructor(e){super("Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.",e,"RetryError")}}class l extends c{constructor(e,t,r){super(e,r,"ApiError"),n(this,"status",void 0),this.status=t}}class h extends i{constructor(e,t){super(e,"DeserializationError"),n(this,"response",void 0),this.response=t}}function d(e,t,r){const s=function(e){const t=e=>"[object Object]"===Object.prototype.toString.call(e)||"[object Array]"===Object.prototype.toString.call(e);return Object.keys(e).map((r=>`${r}=${encodeURIComponent(t(e[r])?JSON.stringify(e[r]):e[r])}`)).join("&")}(r);let a=`${e.protocol}://${e.url}/${"/"===t.charAt(0)?t.substr(1):t}`;return s.length&&(a+=`?${s}`),a}function p(e){const t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...e,request:{...e.request,headers:{...e.request.headers,...t}}}}function m({hosts:e,hostsCache:t,baseHeaders:r,baseQueryParameters:s,algoliaAgent:a,timeouts:n,requester:i,requestsCache:c,responsesCache:m}){async function g(c,m,g=!0){const f=[],y=function(e,t){if("GET"===e.method||void 0===e.data&&void 0===t.data)return;const r=Array.isArray(e.data)?e.data:{...e.data,...t.data};return JSON.stringify(r)}(c,m),P=function(e,t,r){const s={Accept:"application/json",...e,...t,...r},a={};return Object.keys(s).forEach((e=>{const t=s[e];a[e.toLowerCase()]=t})),a}(r,c.headers,m.headers),w="GET"===c.method?{...c.data,...m.data}:{},q={...s,...c.queryParameters,...w};if(a.value&&(q["x-algolia-agent"]=a.value),m&&m.queryParameters)for(const e of Object.keys(m.queryParameters))m.queryParameters[e]&&"[object Object]"!==Object.prototype.toString.call(m.queryParameters[e])?q[e]=m.queryParameters[e].toString():q[e]=m.queryParameters[e];let T=0;const v=async(e,r)=>{const s=e.pop();if(void 0===s)throw new u(function(e){return e.map((e=>p(e)))}(f));let a=m.timeout;void 0===a&&(a=g?n.read:n.write);const w={data:y,headers:P,method:c.method,url:d(s,c.path,q),connectTimeout:r(T,n.connect),responseTimeout:r(T,a)},b=t=>{const r={request:w,response:t,host:s,triesLeft:e.length};return f.push(r),r},O=await i.send(w);if(function({isTimedOut:e,status:t}){return e||function({isTimedOut:e,status:t}){return!e&&0==~~t}({isTimedOut:e,status:t})||2!=~~(t/100)&&4!=~~(t/100)}(O)){const a=b(O);return O.isTimedOut&&T++,console.log("Retryable failure",p(a)),await t.set(s,o(s,O.isTimedOut?"timed out":"down")),v(e,r)}if(function({status:e}){return 2==~~(e/100)}(O))return function(e){try{return JSON.parse(e.content)}catch(t){throw new h(t.message,e)}}(O);throw b(O),function({content:e,status:t},r){let s=e;try{s=JSON.parse(e).message}catch(e){}return new l(s,t,r)}(O,f)},b=e.filter((e=>"readWrite"===e.accept||(g?"read"===e.accept:"write"===e.accept))),O=await async function(e){const r=await Promise.all(e.map((e=>t.get(e,(()=>Promise.resolve(o(e))))))),s=r.filter((e=>e.isUp())),a=r.filter((e=>e.isTimedOut())),n=[...s,...a];return{hosts:n.length>0?n:e,getTimeout:(e,t)=>(0===a.length&&0===e?1:a.length+3+e)*t}}(b);return v([...O.hosts].reverse(),O.getTimeout)}return{hostsCache:t,requester:i,timeouts:n,algoliaAgent:a,baseHeaders:r,baseQueryParameters:s,hosts:e,request:function(e,t={}){const a=e.useReadTransporter||"GET"===e.method;if(!a)return g(e,t,a);const o=()=>g(e,t);if(!0!==(t.cacheable||e.cacheable))return o();const n={request:e,requestOptions:t,transporter:{queryParameters:s,headers:r}};return m.get(n,(()=>c.get(n,(()=>c.set(n,o()).then((e=>Promise.all([c.delete(n),e])),(e=>Promise.all([c.delete(n),Promise.reject(e)]))).then((([e,t])=>t))))),{miss:e=>m.set(n,e)})},requestsCache:c,responsesCache:m}}function g({algoliaAgents:e,client:t,version:r}){const s=function(e){const t={value:`Algolia for JavaScript (${e})`,add(e){const r=`; ${e.segment}${void 0!==e.version?` (${e.version})`:""}`;return-1===t.value.indexOf(r)&&(t.value=`${t.value}${r}`),t}};return t}(r).add({segment:t,version:r});return e.forEach((e=>s.add(e))),s}const f="5.0.0-alpha.30",y=["eu","us"];e.apiClientVersion=f,e.personalizationClient=function(e,a,o,n){if(!e||"string"!=typeof e)throw new Error("`appId` is missing.");if(!a||"string"!=typeof a)throw new Error("`apiKey` is missing.");if(!o||o&&("string"!=typeof o||!y.includes(o)))throw new Error(`\`region\` is required and must be one of the following: ${y.join(", ")}`);return function({appId:e,apiKey:t,authMode:r,algoliaAgents:s,region:a,...o}){const n=function(e,t,r="WithinHeaders"){const s={"x-algolia-api-key":t,"x-algolia-application-id":e};return{headers:()=>"WithinHeaders"===r?s:{},queryParameters:()=>"WithinQueryParameters"===r?s:{}}}(e,t,r),i=m({hosts:(c=a,[{url:"personalization.{region}.algolia.com".replace("{region}",c),accept:"readWrite",protocol:"https"}]),...o,algoliaAgent:g({algoliaAgents:s,client:"Personalization",version:f}),baseHeaders:{"content-type":"text/plain",...n.headers(),...o.baseHeaders},baseQueryParameters:{...n.queryParameters(),...o.baseQueryParameters}});var c;return{transporter:i,appId:e,clearCache:()=>Promise.all([i.requestsCache.clear(),i.responsesCache.clear()]).then((()=>{})),get _ua(){return i.algoliaAgent.value},addAlgoliaAgent(e,t){i.algoliaAgent.add({segment:e,version:t})},del({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `del`.");const s={method:"DELETE",path:"/1{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return i.request(s,r)},deleteUserProfile({userToken:e},t){if(!e)throw new Error("Parameter `userToken` is required when calling `deleteUserProfile`.");const r={method:"DELETE",path:"/1/profiles/{userToken}".replace("{userToken}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(r,t)},get({path:e,parameters:t},r){if(!e)throw new Error("Parameter `path` is required when calling `get`.");const s={method:"GET",path:"/1{path}".replace("{path}",e),queryParameters:t||{},headers:{}};return i.request(s,r)},getPersonalizationStrategy(e){const t={method:"GET",path:"/1/strategies/personalization",queryParameters:{},headers:{}};return i.request(t,e)},getUserTokenProfile({userToken:e},t){if(!e)throw new Error("Parameter `userToken` is required when calling `getUserTokenProfile`.");const r={method:"GET",path:"/1/profiles/personalization/{userToken}".replace("{userToken}",encodeURIComponent(e)),queryParameters:{},headers:{}};return i.request(r,t)},post({path:e,parameters:t,body:r},s){if(!e)throw new Error("Parameter `path` is required when calling `post`.");const a={method:"POST",path:"/1{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return i.request(a,s)},put({path:e,parameters:t,body:r},s){if(!e)throw new Error("Parameter `path` is required when calling `put`.");const a={method:"PUT",path:"/1{path}".replace("{path}",e),queryParameters:t||{},headers:{},data:r||{}};return i.request(a,s)},setPersonalizationStrategy(e,t){if(!e)throw new Error("Parameter `personalizationStrategyParams` is required when calling `setPersonalizationStrategy`.");if(!e.eventScoring)throw new Error("Parameter `personalizationStrategyParams.eventScoring` is required when calling `setPersonalizationStrategy`.");if(!e.facetScoring)throw new Error("Parameter `personalizationStrategyParams.facetScoring` is required when calling `setPersonalizationStrategy`.");if(!e.personalizationImpact)throw new Error("Parameter `personalizationStrategyParams.personalizationImpact` is required when calling `setPersonalizationStrategy`.");const r={method:"POST",path:"/1/strategies/personalization",queryParameters:{},headers:{},data:e};return i.request(r,t)}}}({appId:e,apiKey:a,region:o,timeouts:{connect:1e3,read:2e3,write:3e4},requester:{send:function(e){return new Promise((t=>{const r=new XMLHttpRequest;r.open(e.method,e.url,!0),Object.keys(e.headers).forEach((t=>r.setRequestHeader(t,e.headers[t])));const s=(e,s)=>setTimeout((()=>{r.abort(),t({status:0,content:s,isTimedOut:!0})}),e),a=s(e.connectTimeout,"Connection timeout");let o;r.onreadystatechange=()=>{r.readyState>r.OPENED&&void 0===o&&(clearTimeout(a),o=s(e.responseTimeout,"Socket timeout"))},r.onerror=()=>{0===r.status&&(clearTimeout(a),clearTimeout(o),t({content:r.responseText||"Network request failed",status:r.status,isTimedOut:!1}))},r.onload=()=>{clearTimeout(a),clearTimeout(o),t({content:r.responseText,status:r.status,isTimedOut:!1})},r.send(e.data)}))}},algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:s(),requestsCache:s({serializable:!1}),hostsCache:r({caches:[t({key:`5.0.0-alpha.30-${e}`}),s()]}),...n})}}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clientMethodProps.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"clientMethodProps.d.ts","sourceRoot":"","sources":["../../model/clientMethodProps.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,oBAAY,QAAQ,GAAG;IACrB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAClC,CAAC;AAEF;;GAEG;AACH,oBAAY,sBAAsB,GAAG;IACnC;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;GAEG;AACH,oBAAY,QAAQ,GAAG;IACrB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAClC,CAAC;AAEF;;GAEG;AACH,oBAAY,wBAAwB,GAAG;IACrC;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;GAEG;AACH,oBAAY,SAAS,GAAG;IACtB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACjC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC5B,CAAC;AAEF;;GAEG;AACH,oBAAY,QAAQ,GAAG;IACrB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACjC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC5B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deleteUserProfileResponse.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"deleteUserProfileResponse.d.ts","sourceRoot":"","sources":["../../model/deleteUserProfileResponse.ts"],"names":[],"mappings":"AAEA,oBAAY,yBAAyB,GAAG;IACtC;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errorBase.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"errorBase.d.ts","sourceRoot":"","sources":["../../model/errorBase.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,oBAAY,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eventScoring.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"eventScoring.d.ts","sourceRoot":"","sources":["../../model/eventScoring.ts"],"names":[],"mappings":"AAEA,oBAAY,YAAY,GAAG;IACzB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"facetScoring.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"facetScoring.d.ts","sourceRoot":"","sources":["../../model/facetScoring.ts"],"names":[],"mappings":"AAEA,oBAAY,YAAY,GAAG;IACzB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getUserTokenResponse.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"getUserTokenResponse.d.ts","sourceRoot":"","sources":["../../model/getUserTokenResponse.ts"],"names":[],"mappings":"AAEA,oBAAY,oBAAoB,GAAG;IACjC;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC7B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../model/index.ts"],"names":[],"mappings":"AAEA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,iCAAiC,CAAC;AAChD,cAAc,sCAAsC,CAAC;AACrD,cAAc,qBAAqB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"personalizationStrategyParams.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"personalizationStrategyParams.d.ts","sourceRoot":"","sources":["../../model/personalizationStrategyParams.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,oBAAY,6BAA6B,GAAG;IAC1C;;OAEG;IACH,YAAY,EAAE,YAAY,EAAE,CAAC;IAE7B;;OAEG;IACH,YAAY,EAAE,YAAY,EAAE,CAAC;IAE7B;;OAEG;IACH,qBAAqB,EAAE,MAAM,CAAC;CAC/B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setPersonalizationStrategyResponse.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"setPersonalizationStrategyResponse.d.ts","sourceRoot":"","sources":["../../model/setPersonalizationStrategyResponse.ts"],"names":[],"mappings":"AAEA,oBAAY,kCAAkC,GAAG;IAC/C;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC"}
|
|
@@ -4,13 +4,21 @@ import type { DeleteUserProfileResponse } from '../model/deleteUserProfileRespon
|
|
|
4
4
|
import type { GetUserTokenResponse } from '../model/getUserTokenResponse';
|
|
5
5
|
import type { PersonalizationStrategyParams } from '../model/personalizationStrategyParams';
|
|
6
6
|
import type { SetPersonalizationStrategyResponse } from '../model/setPersonalizationStrategyResponse';
|
|
7
|
-
export declare const apiClientVersion = "5.0.0-alpha.
|
|
7
|
+
export declare const apiClientVersion = "5.0.0-alpha.30";
|
|
8
8
|
export declare const REGIONS: readonly ["eu", "us"];
|
|
9
9
|
export declare type Region = typeof REGIONS[number];
|
|
10
10
|
export declare function createPersonalizationClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, region: regionOption, ...options }: CreateClientOptions & {
|
|
11
11
|
region: Region;
|
|
12
12
|
}): {
|
|
13
13
|
transporter: import("@algolia/client-common").Transporter;
|
|
14
|
+
/**
|
|
15
|
+
* The `appId` currently in use.
|
|
16
|
+
*/
|
|
17
|
+
appId: string;
|
|
18
|
+
/**
|
|
19
|
+
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
|
|
20
|
+
*/
|
|
21
|
+
clearCache(): Promise<void>;
|
|
14
22
|
/**
|
|
15
23
|
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
|
|
16
24
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"personalizationClient.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"personalizationClient.d.ts","sourceRoot":"","sources":["../../src/personalizationClient.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,mBAAmB,EAInB,cAAc,EAEf,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EACV,QAAQ,EACR,sBAAsB,EACtB,QAAQ,EACR,wBAAwB,EACxB,SAAS,EACT,QAAQ,EACT,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AACpF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AAC5F,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,6CAA6C,CAAC;AAEtG,eAAO,MAAM,gBAAgB,mBAAmB,CAAC;AAEjD,eAAO,MAAM,OAAO,uBAAwB,CAAC;AAC7C,oBAAY,MAAM,GAAG,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC;AAY5C,wBAAgB,2BAA2B,CAAC,EAC1C,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,YAAY,EACpB,QAAQ,EACR,aAAa,EACb,MAAM,EAAE,YAAY,EACpB,GAAG,OAAO,EACX,EAAE,mBAAmB,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE;;IAwBvC;;OAEG;;IAGH;;OAEG;kBACW,QAAQ,IAAI,CAAC;IAO3B;;OAEG;;IAKH;;;;;OAKG;6BACsB,MAAM,YAAY,MAAM,GAAG,IAAI;IAIxD;;;;;;;;OAQG;8BAEqB,QAAQ,mBACb,cAAc,GAC9B,QAAQ,OAAO,MAAM,EAAE,GAAG,CAAC,CAAC;IAmB/B;;;;;;;OAOG;qCAEc,sBAAsB,mBACpB,cAAc,GAC9B,QAAQ,yBAAyB,CAAC;IAwBrC;;;;;;;;OAQG;8BAEqB,QAAQ,mBACb,cAAc,GAC9B,QAAQ,OAAO,MAAM,EAAE,GAAG,CAAC,CAAC;IAmB/B;;;;;OAKG;gDAEgB,cAAc,GAC9B,QAAQ,6BAA6B,CAAC;IAezC;;;;;;;OAOG;uCAEc,wBAAwB,mBACtB,cAAc,GAC9B,QAAQ,oBAAoB,CAAC;IAwBhC;;;;;;;;;OASG;qCAE2B,SAAS,mBACpB,cAAc,GAC9B,QAAQ,OAAO,MAAM,EAAE,GAAG,CAAC,CAAC;IAoB/B;;;;;;;;;OASG;oCAE2B,QAAQ,mBACnB,cAAc,GAC9B,QAAQ,OAAO,MAAM,EAAE,GAAG,CAAC,CAAC;IAoB/B;;;;;;OAMG;8DAE8B,6BAA6B,mBAC3C,cAAc,GAC9B,QAAQ,kCAAkC,CAAC;EAsCjD;AAED;;GAEG;AACH,oBAAY,qBAAqB,GAAG,UAAU,CAC5C,OAAO,2BAA2B,CACnC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,16 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@algolia/client-personalization",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.30",
|
|
4
4
|
"description": "JavaScript client for client-personalization",
|
|
5
5
|
"repository": "algolia/algoliasearch-client-javascript",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "Algolia",
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"node": {
|
|
11
|
+
"import": "./dist/client-personalization.esm.node.js",
|
|
12
|
+
"module": "./dist/client-personalization.esm.node.js",
|
|
13
|
+
"require": "./dist/client-personalization.cjs.js",
|
|
14
|
+
"default": "./dist/client-personalization.cjs.js"
|
|
15
|
+
},
|
|
16
|
+
"default": {
|
|
17
|
+
"umd": "./dist/client-personalization.umd.js",
|
|
18
|
+
"module": "./dist/client-personalization.esm.browser.js",
|
|
19
|
+
"import": "./dist/client-personalization.esm.browser.js",
|
|
20
|
+
"default": "./dist/client-personalization.umd.js"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"./src/*": "./src/*.ts",
|
|
24
|
+
"./model": "./model/index.ts"
|
|
25
|
+
},
|
|
26
|
+
"jsdelivr": "./dist/client-personalization.umd.js",
|
|
27
|
+
"unpkg": "./dist/client-personalization.umd.js",
|
|
28
|
+
"browser": "./dist/client-personalization.umd.js",
|
|
29
|
+
"types": "./index.d.ts",
|
|
14
30
|
"files": [
|
|
15
31
|
"dist",
|
|
16
32
|
"model",
|
|
@@ -18,16 +34,18 @@
|
|
|
18
34
|
"index.d.ts"
|
|
19
35
|
],
|
|
20
36
|
"scripts": {
|
|
21
|
-
"
|
|
37
|
+
"build": "yarn clean && rollup --config",
|
|
38
|
+
"clean": "rm -rf ./dist || true"
|
|
22
39
|
},
|
|
23
40
|
"dependencies": {
|
|
24
|
-
"@algolia/client-common": "5.0.0-alpha.
|
|
25
|
-
"@algolia/requester-browser-xhr": "5.0.0-alpha.
|
|
26
|
-
"@algolia/requester-node-http": "5.0.0-alpha.
|
|
41
|
+
"@algolia/client-common": "5.0.0-alpha.30",
|
|
42
|
+
"@algolia/requester-browser-xhr": "5.0.0-alpha.30",
|
|
43
|
+
"@algolia/requester-node-http": "5.0.0-alpha.30"
|
|
27
44
|
},
|
|
28
45
|
"devDependencies": {
|
|
29
|
-
"@types/node": "16.11.
|
|
30
|
-
"
|
|
46
|
+
"@types/node": "16.11.59",
|
|
47
|
+
"rollup": "2.79.1",
|
|
48
|
+
"typescript": "4.8.3"
|
|
31
49
|
},
|
|
32
50
|
"engines": {
|
|
33
51
|
"node": ">= 14.0.0"
|