algoliasearch 5.2.5 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/builds/browser.ts +43 -68
- package/builds/models.ts +3 -3
- package/builds/node.ts +39 -122
- package/dist/algoliasearch.umd.js +8 -8
- package/dist/browser.d.ts +10 -100
- package/dist/browser.js +28 -56
- package/dist/browser.js.map +1 -1
- package/dist/browser.min.js +1 -1
- package/dist/browser.min.js.map +1 -1
- package/dist/lite/browser.d.ts +611 -545
- package/dist/lite/builds/browser.js +36 -26
- package/dist/lite/builds/browser.js.map +1 -1
- package/dist/lite/builds/browser.min.js +1 -1
- package/dist/lite/builds/browser.min.js.map +1 -1
- package/dist/lite/builds/browser.umd.js +2 -2
- package/dist/lite/builds/node.cjs +36 -26
- package/dist/lite/builds/node.cjs.map +1 -1
- package/dist/lite/builds/node.js +36 -26
- package/dist/lite/builds/node.js.map +1 -1
- package/dist/lite/node.d.cts +611 -545
- package/dist/lite/node.d.ts +611 -545
- package/dist/lite/src/liteClient.cjs +36 -26
- package/dist/lite/src/liteClient.cjs.map +1 -1
- package/dist/lite/src/liteClient.js +36 -26
- package/dist/lite/src/liteClient.js.map +1 -1
- package/dist/node.cjs +25 -89
- package/dist/node.cjs.map +1 -1
- package/dist/node.d.cts +10 -116
- package/dist/node.d.ts +10 -116
- package/dist/node.js +25 -96
- package/dist/node.js.map +1 -1
- package/lite/builds/browser.ts +3 -7
- package/lite/builds/node.ts +3 -7
- package/lite/src/liteClient.ts +37 -26
- package/package.json +9 -9
package/lite/src/liteClient.ts
CHANGED
|
@@ -22,7 +22,7 @@ import type { SearchMethodParams } from '../model/searchMethodParams';
|
|
|
22
22
|
import type { SearchResponse } from '../model/searchResponse';
|
|
23
23
|
import type { SearchResponses } from '../model/searchResponses';
|
|
24
24
|
|
|
25
|
-
export const apiClientVersion = '5.
|
|
25
|
+
export const apiClientVersion = '5.3.0';
|
|
26
26
|
|
|
27
27
|
function getDefaultHosts(appId: string): Host[] {
|
|
28
28
|
return (
|
|
@@ -68,27 +68,26 @@ export function createLiteClient({
|
|
|
68
68
|
...options
|
|
69
69
|
}: CreateClientOptions) {
|
|
70
70
|
const auth = createAuth(appIdOption, apiKeyOption, authMode);
|
|
71
|
-
const transporter = createTransporter({
|
|
72
|
-
hosts: getDefaultHosts(appIdOption),
|
|
73
|
-
...options,
|
|
74
|
-
algoliaAgent: getAlgoliaAgent({
|
|
75
|
-
algoliaAgents,
|
|
76
|
-
client: 'Lite',
|
|
77
|
-
version: apiClientVersion,
|
|
78
|
-
}),
|
|
79
|
-
baseHeaders: {
|
|
80
|
-
'content-type': 'text/plain',
|
|
81
|
-
...auth.headers(),
|
|
82
|
-
...options.baseHeaders,
|
|
83
|
-
},
|
|
84
|
-
baseQueryParameters: {
|
|
85
|
-
...auth.queryParameters(),
|
|
86
|
-
...options.baseQueryParameters,
|
|
87
|
-
},
|
|
88
|
-
});
|
|
89
71
|
|
|
90
72
|
return {
|
|
91
|
-
transporter
|
|
73
|
+
transporter: createTransporter({
|
|
74
|
+
hosts: getDefaultHosts(appIdOption),
|
|
75
|
+
...options,
|
|
76
|
+
algoliaAgent: getAlgoliaAgent({
|
|
77
|
+
algoliaAgents,
|
|
78
|
+
client: 'Lite',
|
|
79
|
+
version: apiClientVersion,
|
|
80
|
+
}),
|
|
81
|
+
baseHeaders: {
|
|
82
|
+
'content-type': 'text/plain',
|
|
83
|
+
...auth.headers(),
|
|
84
|
+
...options.baseHeaders,
|
|
85
|
+
},
|
|
86
|
+
baseQueryParameters: {
|
|
87
|
+
...auth.queryParameters(),
|
|
88
|
+
...options.baseQueryParameters,
|
|
89
|
+
},
|
|
90
|
+
}),
|
|
92
91
|
|
|
93
92
|
/**
|
|
94
93
|
* The `appId` currently in use.
|
|
@@ -99,14 +98,16 @@ export function createLiteClient({
|
|
|
99
98
|
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
|
|
100
99
|
*/
|
|
101
100
|
clearCache(): Promise<void> {
|
|
102
|
-
return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(
|
|
101
|
+
return Promise.all([this.transporter.requestsCache.clear(), this.transporter.responsesCache.clear()]).then(
|
|
102
|
+
() => undefined,
|
|
103
|
+
);
|
|
103
104
|
},
|
|
104
105
|
|
|
105
106
|
/**
|
|
106
107
|
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
|
|
107
108
|
*/
|
|
108
109
|
get _ua(): string {
|
|
109
|
-
return transporter.algoliaAgent.value;
|
|
110
|
+
return this.transporter.algoliaAgent.value;
|
|
110
111
|
},
|
|
111
112
|
|
|
112
113
|
/**
|
|
@@ -116,7 +117,17 @@ export function createLiteClient({
|
|
|
116
117
|
* @param version - The version of the agent.
|
|
117
118
|
*/
|
|
118
119
|
addAlgoliaAgent(segment: string, version?: string): void {
|
|
119
|
-
transporter.algoliaAgent.add({ segment, version });
|
|
120
|
+
this.transporter.algoliaAgent.add({ segment, version });
|
|
121
|
+
},
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Helper method to switch the API key used to authenticate the requests.
|
|
125
|
+
*
|
|
126
|
+
* @param params - Method params.
|
|
127
|
+
* @param params.apiKey - The new API Key to use.
|
|
128
|
+
*/
|
|
129
|
+
setClientApiKey({ apiKey }: { apiKey: string }): void {
|
|
130
|
+
this.transporter.baseHeaders['x-algolia-api-key'] = apiKey;
|
|
120
131
|
},
|
|
121
132
|
/**
|
|
122
133
|
* Helper: calls the `search` method but with certainty that we will only request Algolia records (hits) and not facets.
|
|
@@ -178,7 +189,7 @@ export function createLiteClient({
|
|
|
178
189
|
data: body ? body : {},
|
|
179
190
|
};
|
|
180
191
|
|
|
181
|
-
return transporter.request(request, requestOptions);
|
|
192
|
+
return this.transporter.request(request, requestOptions);
|
|
182
193
|
},
|
|
183
194
|
|
|
184
195
|
/**
|
|
@@ -225,7 +236,7 @@ export function createLiteClient({
|
|
|
225
236
|
cacheable: true,
|
|
226
237
|
};
|
|
227
238
|
|
|
228
|
-
return transporter.request(request, requestOptions);
|
|
239
|
+
return this.transporter.request(request, requestOptions);
|
|
229
240
|
},
|
|
230
241
|
|
|
231
242
|
/**
|
|
@@ -288,7 +299,7 @@ export function createLiteClient({
|
|
|
288
299
|
cacheable: true,
|
|
289
300
|
};
|
|
290
301
|
|
|
291
|
-
return transporter.request(request, requestOptions);
|
|
302
|
+
return this.transporter.request(request, requestOptions);
|
|
292
303
|
},
|
|
293
304
|
};
|
|
294
305
|
}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "5.
|
|
2
|
+
"version": "5.3.0",
|
|
3
3
|
"repository": {
|
|
4
4
|
"type": "git",
|
|
5
5
|
"url": "git+https://github.com/algolia/algoliasearch-client-javascript.git"
|
|
@@ -65,14 +65,14 @@
|
|
|
65
65
|
"lite.d.ts"
|
|
66
66
|
],
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@algolia/client-abtesting": "5.
|
|
69
|
-
"@algolia/client-analytics": "5.
|
|
70
|
-
"@algolia/client-common": "5.
|
|
71
|
-
"@algolia/client-personalization": "5.
|
|
72
|
-
"@algolia/client-search": "5.
|
|
73
|
-
"@algolia/recommend": "5.
|
|
74
|
-
"@algolia/requester-browser-xhr": "5.
|
|
75
|
-
"@algolia/requester-node-http": "5.
|
|
68
|
+
"@algolia/client-abtesting": "5.3.0",
|
|
69
|
+
"@algolia/client-analytics": "5.3.0",
|
|
70
|
+
"@algolia/client-common": "5.3.0",
|
|
71
|
+
"@algolia/client-personalization": "5.3.0",
|
|
72
|
+
"@algolia/client-search": "5.3.0",
|
|
73
|
+
"@algolia/recommend": "5.3.0",
|
|
74
|
+
"@algolia/requester-browser-xhr": "5.3.0",
|
|
75
|
+
"@algolia/requester-node-http": "5.3.0"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
78
|
"@arethetypeswrong/cli": "0.15.4",
|