@algolia/client-personalization 5.0.0-alpha.4 → 5.0.0-alpha.41
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 +4 -6
- package/dist/client-personalization.esm.browser.js +63 -113
- package/dist/client-personalization.esm.node.js +4 -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 +1 -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.41';
|
|
10
10
|
const REGIONS = ['eu', 'us'];
|
|
11
11
|
function getDefaultHosts(region) {
|
|
12
12
|
const url = 'personalization.{region}.algolia.com'.replace('{region}', region);
|
|
@@ -270,11 +270,9 @@ function personalizationClient(appId, apiKey, region, options) {
|
|
|
270
270
|
if (!apiKey || typeof apiKey !== 'string') {
|
|
271
271
|
throw new Error('`apiKey` is missing.');
|
|
272
272
|
}
|
|
273
|
-
if (!region
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
if (region && (typeof region !== 'string' || !REGIONS.includes(region))) {
|
|
277
|
-
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(', ')}`);
|
|
278
276
|
}
|
|
279
277
|
return createPersonalizationClient({
|
|
280
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,
|
|
@@ -200,6 +172,7 @@ function createStatefulHost(host, status = 'up') {
|
|
|
200
172
|
}
|
|
201
173
|
|
|
202
174
|
function _defineProperty(obj, key, value) {
|
|
175
|
+
key = _toPropertyKey(key);
|
|
203
176
|
if (key in obj) {
|
|
204
177
|
Object.defineProperty(obj, key, {
|
|
205
178
|
value: value,
|
|
@@ -210,79 +183,85 @@ function _defineProperty(obj, key, value) {
|
|
|
210
183
|
} else {
|
|
211
184
|
obj[key] = value;
|
|
212
185
|
}
|
|
213
|
-
|
|
214
186
|
return obj;
|
|
215
187
|
}
|
|
188
|
+
function _toPrimitive(input, hint) {
|
|
189
|
+
if (typeof input !== "object" || input === null) return input;
|
|
190
|
+
var prim = input[Symbol.toPrimitive];
|
|
191
|
+
if (prim !== undefined) {
|
|
192
|
+
var res = prim.call(input, hint || "default");
|
|
193
|
+
if (typeof res !== "object") return res;
|
|
194
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
195
|
+
}
|
|
196
|
+
return (hint === "string" ? String : Number)(input);
|
|
197
|
+
}
|
|
198
|
+
function _toPropertyKey(arg) {
|
|
199
|
+
var key = _toPrimitive(arg, "string");
|
|
200
|
+
return typeof key === "symbol" ? key : String(key);
|
|
201
|
+
}
|
|
216
202
|
|
|
217
203
|
class AlgoliaError extends Error {
|
|
218
204
|
constructor(message, name) {
|
|
219
205
|
super(message);
|
|
220
|
-
|
|
221
206
|
_defineProperty(this, "name", 'AlgoliaError');
|
|
222
|
-
|
|
223
207
|
if (name) {
|
|
224
208
|
this.name = name;
|
|
225
209
|
}
|
|
226
210
|
}
|
|
227
|
-
|
|
228
211
|
}
|
|
229
212
|
class ErrorWithStackTrace extends AlgoliaError {
|
|
230
213
|
constructor(message, stackTrace, name) {
|
|
231
|
-
super(message, name);
|
|
232
|
-
|
|
214
|
+
super(message, name);
|
|
215
|
+
// the array and object should be frozen to reflect the stackTrace at the time of the error
|
|
233
216
|
_defineProperty(this, "stackTrace", void 0);
|
|
234
|
-
|
|
235
217
|
this.stackTrace = stackTrace;
|
|
236
218
|
}
|
|
237
|
-
|
|
238
219
|
}
|
|
239
220
|
class RetryError extends ErrorWithStackTrace {
|
|
240
221
|
constructor(stackTrace) {
|
|
241
222
|
super('Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.', stackTrace, 'RetryError');
|
|
242
223
|
}
|
|
243
|
-
|
|
244
224
|
}
|
|
245
225
|
class ApiError extends ErrorWithStackTrace {
|
|
246
|
-
constructor(message, status, stackTrace) {
|
|
247
|
-
super(message, stackTrace,
|
|
248
|
-
|
|
226
|
+
constructor(message, status, stackTrace, name = 'ApiError') {
|
|
227
|
+
super(message, stackTrace, name);
|
|
249
228
|
_defineProperty(this, "status", void 0);
|
|
250
|
-
|
|
251
229
|
this.status = status;
|
|
252
230
|
}
|
|
253
|
-
|
|
254
231
|
}
|
|
255
232
|
class DeserializationError extends AlgoliaError {
|
|
256
233
|
constructor(message, response) {
|
|
257
234
|
super(message, 'DeserializationError');
|
|
258
|
-
|
|
259
235
|
_defineProperty(this, "response", void 0);
|
|
260
|
-
|
|
261
236
|
this.response = response;
|
|
262
237
|
}
|
|
263
|
-
|
|
238
|
+
}
|
|
239
|
+
// DetailedApiError is only used by the ingestion client to return more informative error, other clients will use ApiClient.
|
|
240
|
+
class DetailedApiError extends ApiError {
|
|
241
|
+
constructor(message, status, error, stackTrace) {
|
|
242
|
+
super(message, status, stackTrace, 'DetailedApiError');
|
|
243
|
+
_defineProperty(this, "error", void 0);
|
|
244
|
+
this.error = error;
|
|
245
|
+
}
|
|
264
246
|
}
|
|
265
247
|
function serializeUrl(host, path, queryParameters) {
|
|
266
248
|
const queryParametersAsString = serializeQueryParameters(queryParameters);
|
|
267
249
|
let url = `${host.protocol}://${host.url}/${path.charAt(0) === '/' ? path.substr(1) : path}`;
|
|
268
|
-
|
|
269
250
|
if (queryParametersAsString.length) {
|
|
270
251
|
url += `?${queryParametersAsString}`;
|
|
271
252
|
}
|
|
272
|
-
|
|
273
253
|
return url;
|
|
274
254
|
}
|
|
275
255
|
function serializeQueryParameters(parameters) {
|
|
276
256
|
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('&');
|
|
257
|
+
return Object.keys(parameters).map(key => `${key}=${encodeURIComponent(isObjectOrArray(parameters[key]) ? JSON.stringify(parameters[key]) : parameters[key])}`).join('&');
|
|
279
258
|
}
|
|
280
259
|
function serializeData(request, requestOptions) {
|
|
281
260
|
if (request.method === 'GET' || request.data === undefined && requestOptions.data === undefined) {
|
|
282
261
|
return undefined;
|
|
283
262
|
}
|
|
284
|
-
|
|
285
|
-
|
|
263
|
+
const data = Array.isArray(request.data) ? request.data : {
|
|
264
|
+
...request.data,
|
|
286
265
|
...requestOptions.data
|
|
287
266
|
};
|
|
288
267
|
return JSON.stringify(data);
|
|
@@ -312,14 +291,16 @@ function deserializeFailure({
|
|
|
312
291
|
content,
|
|
313
292
|
status
|
|
314
293
|
}, stackFrame) {
|
|
315
|
-
let message = content;
|
|
316
|
-
|
|
317
294
|
try {
|
|
318
|
-
|
|
319
|
-
|
|
295
|
+
const parsed = JSON.parse(content);
|
|
296
|
+
if ('error' in parsed) {
|
|
297
|
+
return new DetailedApiError(parsed.message, status, parsed.error, stackFrame);
|
|
298
|
+
}
|
|
299
|
+
return new ApiError(parsed.message, status, stackFrame);
|
|
300
|
+
} catch (e) {
|
|
301
|
+
// ..
|
|
320
302
|
}
|
|
321
|
-
|
|
322
|
-
return new ApiError(message, status, stackFrame);
|
|
303
|
+
return new ApiError(content, status, stackFrame);
|
|
323
304
|
}
|
|
324
305
|
|
|
325
306
|
function isNetworkError({
|
|
@@ -350,9 +331,12 @@ function stackFrameWithoutCredentials(stackFrame) {
|
|
|
350
331
|
const modifiedHeaders = stackFrame.request.headers['x-algolia-api-key'] ? {
|
|
351
332
|
'x-algolia-api-key': '*****'
|
|
352
333
|
} : {};
|
|
353
|
-
return {
|
|
354
|
-
|
|
355
|
-
|
|
334
|
+
return {
|
|
335
|
+
...stackFrame,
|
|
336
|
+
request: {
|
|
337
|
+
...stackFrame.request,
|
|
338
|
+
headers: {
|
|
339
|
+
...stackFrame.request.headers,
|
|
356
340
|
...modifiedHeaders
|
|
357
341
|
}
|
|
358
342
|
}
|
|
@@ -377,13 +361,12 @@ function createTransporter({
|
|
|
377
361
|
});
|
|
378
362
|
}));
|
|
379
363
|
const hostsUp = statefulHosts.filter(host => host.isUp());
|
|
380
|
-
const hostsTimedOut = statefulHosts.filter(host => host.isTimedOut());
|
|
381
|
-
|
|
364
|
+
const hostsTimedOut = statefulHosts.filter(host => host.isTimedOut());
|
|
365
|
+
// Note, we put the hosts that previously timed out on the end of the list.
|
|
382
366
|
const hostsAvailable = [...hostsUp, ...hostsTimedOut];
|
|
383
367
|
const compatibleHostsAvailable = hostsAvailable.length > 0 ? hostsAvailable : compatibleHosts;
|
|
384
368
|
return {
|
|
385
369
|
hosts: compatibleHostsAvailable,
|
|
386
|
-
|
|
387
370
|
getTimeout(timeoutsCount, baseTimeout) {
|
|
388
371
|
/**
|
|
389
372
|
* Imagine that you have 4 hosts, if timeouts will increase
|
|
@@ -399,29 +382,28 @@ function createTransporter({
|
|
|
399
382
|
const timeoutMultiplier = hostsTimedOut.length === 0 && timeoutsCount === 0 ? 1 : hostsTimedOut.length + 3 + timeoutsCount;
|
|
400
383
|
return timeoutMultiplier * baseTimeout;
|
|
401
384
|
}
|
|
402
|
-
|
|
403
385
|
};
|
|
404
386
|
}
|
|
405
|
-
|
|
406
387
|
async function retryableRequest(request, requestOptions, isRead = true) {
|
|
407
388
|
const stackTrace = [];
|
|
408
389
|
/**
|
|
409
390
|
* First we prepare the payload that do not depend from hosts.
|
|
410
391
|
*/
|
|
411
|
-
|
|
412
392
|
const data = serializeData(request, requestOptions);
|
|
413
|
-
const headers = serializeHeaders(baseHeaders, request.headers, requestOptions.headers);
|
|
414
|
-
|
|
415
|
-
const dataQueryParameters = request.method === 'GET' ? {
|
|
393
|
+
const headers = serializeHeaders(baseHeaders, request.headers, requestOptions.headers);
|
|
394
|
+
// On `GET`, the data is proxied to query parameters.
|
|
395
|
+
const dataQueryParameters = request.method === 'GET' ? {
|
|
396
|
+
...request.data,
|
|
416
397
|
...requestOptions.data
|
|
417
398
|
} : {};
|
|
418
399
|
const queryParameters = {
|
|
419
|
-
'x-algolia-agent': algoliaAgent.value,
|
|
420
400
|
...baseQueryParameters,
|
|
421
401
|
...request.queryParameters,
|
|
422
402
|
...dataQueryParameters
|
|
423
403
|
};
|
|
424
|
-
|
|
404
|
+
if (algoliaAgent.value) {
|
|
405
|
+
queryParameters['x-algolia-agent'] = algoliaAgent.value;
|
|
406
|
+
}
|
|
425
407
|
if (requestOptions && requestOptions.queryParameters) {
|
|
426
408
|
for (const key of Object.keys(requestOptions.queryParameters)) {
|
|
427
409
|
// We want to keep `undefined` and `null` values,
|
|
@@ -434,25 +416,19 @@ function createTransporter({
|
|
|
434
416
|
}
|
|
435
417
|
}
|
|
436
418
|
}
|
|
437
|
-
|
|
438
419
|
let timeoutsCount = 0;
|
|
439
|
-
|
|
440
420
|
const retry = async (retryableHosts, getTimeout) => {
|
|
441
421
|
/**
|
|
442
422
|
* We iterate on each host, until there is no host left.
|
|
443
423
|
*/
|
|
444
424
|
const host = retryableHosts.pop();
|
|
445
|
-
|
|
446
425
|
if (host === undefined) {
|
|
447
426
|
throw new RetryError(stackTraceWithoutCredentials(stackTrace));
|
|
448
427
|
}
|
|
449
|
-
|
|
450
428
|
let responseTimeout = requestOptions.timeout;
|
|
451
|
-
|
|
452
429
|
if (responseTimeout === undefined) {
|
|
453
430
|
responseTimeout = isRead ? timeouts.read : timeouts.write;
|
|
454
431
|
}
|
|
455
|
-
|
|
456
432
|
const payload = {
|
|
457
433
|
data,
|
|
458
434
|
headers,
|
|
@@ -466,7 +442,6 @@ function createTransporter({
|
|
|
466
442
|
* can have information about onRetry and onFailure
|
|
467
443
|
* decisions.
|
|
468
444
|
*/
|
|
469
|
-
|
|
470
445
|
const pushToStackTrace = response => {
|
|
471
446
|
const stackFrame = {
|
|
472
447
|
request: payload,
|
|
@@ -477,12 +452,10 @@ function createTransporter({
|
|
|
477
452
|
stackTrace.push(stackFrame);
|
|
478
453
|
return stackFrame;
|
|
479
454
|
};
|
|
480
|
-
|
|
481
455
|
const response = await requester.send(payload);
|
|
482
|
-
|
|
483
456
|
if (isRetryable(response)) {
|
|
484
|
-
const stackFrame = pushToStackTrace(response);
|
|
485
|
-
|
|
457
|
+
const stackFrame = pushToStackTrace(response);
|
|
458
|
+
// If response is a timeout, we increase the number of timeouts so we can increase the timeout later.
|
|
486
459
|
if (response.isTimedOut) {
|
|
487
460
|
timeoutsCount++;
|
|
488
461
|
}
|
|
@@ -492,23 +465,18 @@ function createTransporter({
|
|
|
492
465
|
* when a retry error does not happen.
|
|
493
466
|
*/
|
|
494
467
|
// eslint-disable-next-line no-console -- this will be fixed by exposing a `logger` to the transporter
|
|
495
|
-
|
|
496
|
-
|
|
497
468
|
console.log('Retryable failure', stackFrameWithoutCredentials(stackFrame));
|
|
498
469
|
/**
|
|
499
470
|
* We also store the state of the host in failure cases. If the host, is
|
|
500
471
|
* down it will remain down for the next 2 minutes. In a timeout situation,
|
|
501
472
|
* this host will be added end of the list of hosts on the next request.
|
|
502
473
|
*/
|
|
503
|
-
|
|
504
474
|
await hostsCache.set(host, createStatefulHost(host, response.isTimedOut ? 'timed out' : 'down'));
|
|
505
475
|
return retry(retryableHosts, getTimeout);
|
|
506
476
|
}
|
|
507
|
-
|
|
508
477
|
if (isSuccess(response)) {
|
|
509
478
|
return deserializeSuccess(response);
|
|
510
479
|
}
|
|
511
|
-
|
|
512
480
|
pushToStackTrace(response);
|
|
513
481
|
throw deserializeFailure(response, stackTrace);
|
|
514
482
|
};
|
|
@@ -520,20 +488,16 @@ function createTransporter({
|
|
|
520
488
|
* 2. We also get from the retryable options a timeout multiplier that is tailored
|
|
521
489
|
* for the current context.
|
|
522
490
|
*/
|
|
523
|
-
|
|
524
|
-
|
|
525
491
|
const compatibleHosts = hosts.filter(host => host.accept === 'readWrite' || (isRead ? host.accept === 'read' : host.accept === 'write'));
|
|
526
492
|
const options = await createRetryableOptions(compatibleHosts);
|
|
527
493
|
return retry([...options.hosts].reverse(), options.getTimeout);
|
|
528
494
|
}
|
|
529
|
-
|
|
530
495
|
function createRequest(request, requestOptions = {}) {
|
|
531
496
|
/**
|
|
532
497
|
* A read request is either a `GET` request, or a request that we make
|
|
533
498
|
* via the `read` transporter (e.g. `search`).
|
|
534
499
|
*/
|
|
535
500
|
const isRead = request.useReadTransporter || request.method === 'GET';
|
|
536
|
-
|
|
537
501
|
if (!isRead) {
|
|
538
502
|
/**
|
|
539
503
|
* On write requests, no cache mechanisms are applied, and we
|
|
@@ -541,7 +505,6 @@ function createTransporter({
|
|
|
541
505
|
*/
|
|
542
506
|
return retryableRequest(request, requestOptions, isRead);
|
|
543
507
|
}
|
|
544
|
-
|
|
545
508
|
const createRetryableRequest = () => {
|
|
546
509
|
/**
|
|
547
510
|
* Then, we prepare a function factory that contains the construction of
|
|
@@ -555,14 +518,11 @@ function createTransporter({
|
|
|
555
518
|
* request is "cacheable" - should be cached. Note that, once again,
|
|
556
519
|
* the user can force this option.
|
|
557
520
|
*/
|
|
558
|
-
|
|
559
|
-
|
|
560
521
|
const cacheable = requestOptions.cacheable || request.cacheable;
|
|
561
522
|
/**
|
|
562
523
|
* If is not "cacheable", we immediately trigger the retryable request, no
|
|
563
524
|
* need to check cache implementations.
|
|
564
525
|
*/
|
|
565
|
-
|
|
566
526
|
if (cacheable !== true) {
|
|
567
527
|
return createRetryableRequest();
|
|
568
528
|
}
|
|
@@ -571,8 +531,6 @@ function createTransporter({
|
|
|
571
531
|
* the cache implementations if this request is on progress or if the
|
|
572
532
|
* response already exists on the cache.
|
|
573
533
|
*/
|
|
574
|
-
|
|
575
|
-
|
|
576
534
|
const key = {
|
|
577
535
|
request,
|
|
578
536
|
requestOptions,
|
|
@@ -585,7 +543,6 @@ function createTransporter({
|
|
|
585
543
|
* With the computed key, we first ask the responses cache
|
|
586
544
|
* implementation if this request was been resolved before.
|
|
587
545
|
*/
|
|
588
|
-
|
|
589
546
|
return responsesCache.get(key, () => {
|
|
590
547
|
/**
|
|
591
548
|
* If the request has never resolved before, we actually ask if there
|
|
@@ -607,7 +564,6 @@ function createTransporter({
|
|
|
607
564
|
miss: response => responsesCache.set(key, response)
|
|
608
565
|
});
|
|
609
566
|
}
|
|
610
|
-
|
|
611
567
|
return {
|
|
612
568
|
hostsCache,
|
|
613
569
|
requester,
|
|
@@ -625,17 +581,13 @@ function createTransporter({
|
|
|
625
581
|
function createAlgoliaAgent(version) {
|
|
626
582
|
const algoliaAgent = {
|
|
627
583
|
value: `Algolia for JavaScript (${version})`,
|
|
628
|
-
|
|
629
584
|
add(options) {
|
|
630
585
|
const addedAlgoliaAgent = `; ${options.segment}${options.version !== undefined ? ` (${options.version})` : ''}`;
|
|
631
|
-
|
|
632
586
|
if (algoliaAgent.value.indexOf(addedAlgoliaAgent) === -1) {
|
|
633
587
|
algoliaAgent.value = `${algoliaAgent.value}${addedAlgoliaAgent}`;
|
|
634
588
|
}
|
|
635
|
-
|
|
636
589
|
return algoliaAgent;
|
|
637
590
|
}
|
|
638
|
-
|
|
639
591
|
};
|
|
640
592
|
return algoliaAgent;
|
|
641
593
|
}
|
|
@@ -710,7 +662,7 @@ function createXhrRequester() {
|
|
|
710
662
|
}
|
|
711
663
|
|
|
712
664
|
// 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.
|
|
665
|
+
const apiClientVersion = '5.0.0-alpha.41';
|
|
714
666
|
const REGIONS = ['eu', 'us'];
|
|
715
667
|
function getDefaultHosts(region) {
|
|
716
668
|
const url = 'personalization.{region}.algolia.com'.replace('{region}', region);
|
|
@@ -974,11 +926,9 @@ function personalizationClient(appId, apiKey, region, options) {
|
|
|
974
926
|
if (!apiKey || typeof apiKey !== 'string') {
|
|
975
927
|
throw new Error('`apiKey` is missing.');
|
|
976
928
|
}
|
|
977
|
-
if (!region
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
if (region && (typeof region !== 'string' || !REGIONS.includes(region))) {
|
|
981
|
-
throw new Error(`\`region\` must be one of the following: ${REGIONS.join(', ')}`);
|
|
929
|
+
if (!region ||
|
|
930
|
+
(region && (typeof region !== 'string' || !REGIONS.includes(region)))) {
|
|
931
|
+
throw new Error(`\`region\` is required and must be one of the following: ${REGIONS.join(', ')}`);
|
|
982
932
|
}
|
|
983
933
|
return createPersonalizationClient({
|
|
984
934
|
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.41';
|
|
6
6
|
const REGIONS = ['eu', 'us'];
|
|
7
7
|
function getDefaultHosts(region) {
|
|
8
8
|
const url = 'personalization.{region}.algolia.com'.replace('{region}', region);
|
|
@@ -266,11 +266,9 @@ function personalizationClient(appId, apiKey, region, options) {
|
|
|
266
266
|
if (!apiKey || typeof apiKey !== 'string') {
|
|
267
267
|
throw new Error('`apiKey` is missing.');
|
|
268
268
|
}
|
|
269
|
-
if (!region
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
if (region && (typeof region !== 'string' || !REGIONS.includes(region))) {
|
|
273
|
-
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(', ')}`);
|
|
274
272
|
}
|
|
275
273
|
return createPersonalizationClient({
|
|
276
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.4",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,appId:r,clearCache:function(){return Promise.all([u.requestsCache.clear(),u.responsesCache.clear()]).then((function(){}))},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.41 | © 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=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var s=r.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class i extends Error{constructor(e,t){super(e),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,s="ApiError"){super(e,r,s),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}}class d extends l{constructor(e,t,r,s){super(e,t,s,"DetailedApiError"),n(this,"error",void 0),this.error=r}}function p(e,t,r){const s=function(e){const t=e=>"[object Object]"===Object.prototype.toString.call(e)||"[object Array]"===Object.prototype.toString.call(e);return Object.keys(e).map((r=>`${r}=${encodeURIComponent(t(e[r])?JSON.stringify(e[r]):e[r])}`)).join("&")}(r);let a=`${e.protocol}://${e.url}/${"/"===t.charAt(0)?t.substr(1):t}`;return s.length&&(a+=`?${s}`),a}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 g({hosts:e,hostsCache:t,baseHeaders:r,baseQueryParameters:s,algoliaAgent:a,timeouts:n,requester:i,requestsCache:c,responsesCache:g}){async function f(c,g,f=!0){const y=[],P=function(e,t){if("GET"===e.method||void 0===e.data&&void 0===t.data)return;const r=Array.isArray(e.data)?e.data:{...e.data,...t.data};return JSON.stringify(r)}(c,g),w=function(e,t,r){const s={Accept:"application/json",...e,...t,...r},a={};return Object.keys(s).forEach((e=>{const t=s[e];a[e.toLowerCase()]=t})),a}(r,c.headers,g.headers),v="GET"===c.method?{...c.data,...g.data}:{},q={...s,...c.queryParameters,...v};if(a.value&&(q["x-algolia-agent"]=a.value),g&&g.queryParameters)for(const e of Object.keys(g.queryParameters))g.queryParameters[e]&&"[object Object]"!==Object.prototype.toString.call(g.queryParameters[e])?q[e]=g.queryParameters[e].toString():q[e]=g.queryParameters[e];let T=0;const b=async(e,r)=>{const s=e.pop();if(void 0===s)throw new u(function(e){return e.map((e=>m(e)))}(y));let a=g.timeout;void 0===a&&(a=f?n.read:n.write);const v={data:P,headers:w,method:c.method,url:p(s,c.path,q),connectTimeout:r(T,n.connect),responseTimeout:r(T,a)},S=t=>{const r={request:v,response:t,host:s,triesLeft:e.length};return y.push(r),r},O=await i.send(v);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=S(O);return O.isTimedOut&&T++,console.log("Retryable failure",m(a)),await t.set(s,o(s,O.isTimedOut?"timed out":"down")),b(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 S(O),function({content:e,status:t},r){try{const s=JSON.parse(e);return"error"in s?new d(s.message,t,s.error,r):new l(s.message,t,r)}catch(e){}return new l(e,t,r)}(O,y)},S=e.filter((e=>"readWrite"===e.accept||(f?"read"===e.accept:"write"===e.accept))),O=await async function(e){const r=await Promise.all(e.map((e=>t.get(e,(()=>Promise.resolve(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}}(S);return b([...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 f(e,t,a);const o=()=>f(e,t);if(!0!==(t.cacheable||e.cacheable))return o();const n={request:e,requestOptions:t,transporter:{queryParameters:s,headers:r}};return g.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=>g.set(n,e)})},requestsCache:c,responsesCache:g}}function f({algoliaAgents:e,client:t,version:r}){const s=function(e){const t={value:`Algolia for JavaScript (${e})`,add(e){const r=`; ${e.segment}${void 0!==e.version?` (${e.version})`:""}`;return-1===t.value.indexOf(r)&&(t.value=`${t.value}${r}`),t}};return t}(r).add({segment:t,version:r});return e.forEach((e=>s.add(e))),s}const y="5.0.0-alpha.41",P=["eu","us"];e.apiClientVersion=y,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||!P.includes(o)))throw new Error(`\`region\` is required and must be one of the following: ${P.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=g({hosts:(c=a,[{url:"personalization.{region}.algolia.com".replace("{region}",c),accept:"readWrite",protocol:"https"}]),...o,algoliaAgent:f({algoliaAgents:s,client:"Personalization",version:y}),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.41-${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,7 +4,7 @@ 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.41";
|
|
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 & {
|
|
@@ -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.41",
|
|
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.41",
|
|
42
|
+
"@algolia/requester-browser-xhr": "5.0.0-alpha.41",
|
|
43
|
+
"@algolia/requester-node-http": "5.0.0-alpha.41"
|
|
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"
|