Skip to content

Commit e4257b3

Browse files
fix: algoliasearch builds (generated)
Co-authored-by: shortcuts <[email protected]>
1 parent b55026c commit e4257b3

File tree

13 files changed

+513
-520
lines changed

13 files changed

+513
-520
lines changed

clients/algoliasearch-client-javascript/packages/algoliasearch/builds/browser.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,15 @@ export function algoliasearch(appId: string, apiKey: string, options?: ClientOpt
3434
throw new Error('`apiKey` is missing.');
3535
}
3636

37+
const client = searchClient(appId, apiKey, options);
38+
3739
return {
38-
...searchClient(appId, apiKey, options),
40+
...client,
3941
/**
4042
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
4143
*/
4244
get _ua(): string {
43-
return this.transporter.algoliaAgent.value;
45+
return client.transporter.algoliaAgent.value;
4446
},
4547
initRecommend: (initOptions: InitClientOptions = {}): RecommendClient => {
4648
return recommendClient(initOptions.appId || appId, initOptions.apiKey || apiKey, initOptions.options);

clients/algoliasearch-client-javascript/packages/algoliasearch/builds/node.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,15 @@ export function algoliasearch(appId: string, apiKey: string, options?: ClientOpt
3434
throw new Error('`apiKey` is missing.');
3535
}
3636

37+
const client = searchClient(appId, apiKey, options);
38+
3739
return {
38-
...searchClient(appId, apiKey, options),
40+
...client,
3941
/**
4042
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
4143
*/
4244
get _ua(): string {
43-
return this.transporter.algoliaAgent.value;
45+
return client.transporter.algoliaAgent.value;
4446
},
4547
initRecommend: (initOptions: InitClientOptions = {}): RecommendClient => {
4648
return recommendClient(initOptions.appId || appId, initOptions.apiKey || apiKey, initOptions.options);

clients/algoliasearch-client-javascript/packages/algoliasearch/lite/src/liteClient.ts

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -68,26 +68,27 @@ export function createLiteClient({
6868
...options
6969
}: CreateClientOptions) {
7070
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+
});
7189

7290
return {
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-
}),
91+
transporter,
9192

9293
/**
9394
* The `appId` currently in use.
@@ -98,16 +99,14 @@ export function createLiteClient({
9899
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
99100
*/
100101
clearCache(): Promise<void> {
101-
return Promise.all([this.transporter.requestsCache.clear(), this.transporter.responsesCache.clear()]).then(
102-
() => undefined,
103-
);
102+
return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => undefined);
104103
},
105104

106105
/**
107106
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
108107
*/
109108
get _ua(): string {
110-
return this.transporter.algoliaAgent.value;
109+
return transporter.algoliaAgent.value;
111110
},
112111

113112
/**
@@ -117,7 +116,7 @@ export function createLiteClient({
117116
* @param version - The version of the agent.
118117
*/
119118
addAlgoliaAgent(segment: string, version?: string): void {
120-
this.transporter.algoliaAgent.add({ segment, version });
119+
transporter.algoliaAgent.add({ segment, version });
121120
},
122121

123122
/**
@@ -128,9 +127,9 @@ export function createLiteClient({
128127
*/
129128
setClientApiKey({ apiKey }: { apiKey: string }): void {
130129
if (!authMode || authMode === 'WithinHeaders') {
131-
this.transporter.baseHeaders['x-algolia-api-key'] = apiKey;
130+
transporter.baseHeaders['x-algolia-api-key'] = apiKey;
132131
} else {
133-
this.transporter.baseQueryParameters['x-algolia-api-key'] = apiKey;
132+
transporter.baseQueryParameters['x-algolia-api-key'] = apiKey;
134133
}
135134
},
136135
/**
@@ -193,7 +192,7 @@ export function createLiteClient({
193192
data: body ? body : {},
194193
};
195194

196-
return this.transporter.request(request, requestOptions);
195+
return transporter.request(request, requestOptions);
197196
},
198197

199198
/**
@@ -240,7 +239,7 @@ export function createLiteClient({
240239
cacheable: true,
241240
};
242241

243-
return this.transporter.request(request, requestOptions);
242+
return transporter.request(request, requestOptions);
244243
},
245244

246245
/**
@@ -303,7 +302,7 @@ export function createLiteClient({
303302
cacheable: true,
304303
};
305304

306-
return this.transporter.request(request, requestOptions);
305+
return transporter.request(request, requestOptions);
307306
},
308307
};
309308
}

clients/algoliasearch-client-javascript/packages/client-abtesting/src/abtestingClient.ts

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -48,26 +48,27 @@ export function createAbtestingClient({
4848
...options
4949
}: CreateClientOptions & { region?: Region }) {
5050
const auth = createAuth(appIdOption, apiKeyOption, authMode);
51+
const transporter = createTransporter({
52+
hosts: getDefaultHosts(regionOption),
53+
...options,
54+
algoliaAgent: getAlgoliaAgent({
55+
algoliaAgents,
56+
client: 'Abtesting',
57+
version: apiClientVersion,
58+
}),
59+
baseHeaders: {
60+
'content-type': 'text/plain',
61+
...auth.headers(),
62+
...options.baseHeaders,
63+
},
64+
baseQueryParameters: {
65+
...auth.queryParameters(),
66+
...options.baseQueryParameters,
67+
},
68+
});
5169

5270
return {
53-
transporter: createTransporter({
54-
hosts: getDefaultHosts(regionOption),
55-
...options,
56-
algoliaAgent: getAlgoliaAgent({
57-
algoliaAgents,
58-
client: 'Abtesting',
59-
version: apiClientVersion,
60-
}),
61-
baseHeaders: {
62-
'content-type': 'text/plain',
63-
...auth.headers(),
64-
...options.baseHeaders,
65-
},
66-
baseQueryParameters: {
67-
...auth.queryParameters(),
68-
...options.baseQueryParameters,
69-
},
70-
}),
71+
transporter,
7172

7273
/**
7374
* The `appId` currently in use.
@@ -78,16 +79,14 @@ export function createAbtestingClient({
7879
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
7980
*/
8081
clearCache(): Promise<void> {
81-
return Promise.all([this.transporter.requestsCache.clear(), this.transporter.responsesCache.clear()]).then(
82-
() => undefined,
83-
);
82+
return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => undefined);
8483
},
8584

8685
/**
8786
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
8887
*/
8988
get _ua(): string {
90-
return this.transporter.algoliaAgent.value;
89+
return transporter.algoliaAgent.value;
9190
},
9291

9392
/**
@@ -97,7 +96,7 @@ export function createAbtestingClient({
9796
* @param version - The version of the agent.
9897
*/
9998
addAlgoliaAgent(segment: string, version?: string): void {
100-
this.transporter.algoliaAgent.add({ segment, version });
99+
transporter.algoliaAgent.add({ segment, version });
101100
},
102101

103102
/**
@@ -108,9 +107,9 @@ export function createAbtestingClient({
108107
*/
109108
setClientApiKey({ apiKey }: { apiKey: string }): void {
110109
if (!authMode || authMode === 'WithinHeaders') {
111-
this.transporter.baseHeaders['x-algolia-api-key'] = apiKey;
110+
transporter.baseHeaders['x-algolia-api-key'] = apiKey;
112111
} else {
113-
this.transporter.baseQueryParameters['x-algolia-api-key'] = apiKey;
112+
transporter.baseQueryParameters['x-algolia-api-key'] = apiKey;
114113
}
115114
},
116115

@@ -150,7 +149,7 @@ export function createAbtestingClient({
150149
data: addABTestsRequest,
151150
};
152151

153-
return this.transporter.request(request, requestOptions);
152+
return transporter.request(request, requestOptions);
154153
},
155154

156155
/**
@@ -180,7 +179,7 @@ export function createAbtestingClient({
180179
headers,
181180
};
182181

183-
return this.transporter.request(request, requestOptions);
182+
return transporter.request(request, requestOptions);
184183
},
185184

186185
/**
@@ -207,7 +206,7 @@ export function createAbtestingClient({
207206
headers,
208207
};
209208

210-
return this.transporter.request(request, requestOptions);
209+
return transporter.request(request, requestOptions);
211210
},
212211

213212
/**
@@ -239,7 +238,7 @@ export function createAbtestingClient({
239238
data: body ? body : {},
240239
};
241240

242-
return this.transporter.request(request, requestOptions);
241+
return transporter.request(request, requestOptions);
243242
},
244243

245244
/**
@@ -271,7 +270,7 @@ export function createAbtestingClient({
271270
data: body ? body : {},
272271
};
273272

274-
return this.transporter.request(request, requestOptions);
273+
return transporter.request(request, requestOptions);
275274
},
276275

277276
/**
@@ -300,7 +299,7 @@ export function createAbtestingClient({
300299
headers,
301300
};
302301

303-
return this.transporter.request(request, requestOptions);
302+
return transporter.request(request, requestOptions);
304303
},
305304

306305
/**
@@ -329,7 +328,7 @@ export function createAbtestingClient({
329328
headers,
330329
};
331330

332-
return this.transporter.request(request, requestOptions);
331+
return transporter.request(request, requestOptions);
333332
},
334333

335334
/**
@@ -352,13 +351,14 @@ export function createAbtestingClient({
352351
const requestPath = '/2/abtests';
353352
const headers: Headers = {};
354353
const queryParameters: QueryParameters = {};
354+
355355
if (offset !== undefined) {
356356
queryParameters.offset = offset.toString();
357357
}
358-
359358
if (limit !== undefined) {
360359
queryParameters.limit = limit.toString();
361360
}
361+
362362
if (indexPrefix !== undefined) {
363363
queryParameters.indexPrefix = indexPrefix.toString();
364364
}
@@ -373,7 +373,7 @@ export function createAbtestingClient({
373373
headers,
374374
};
375375

376-
return this.transporter.request(request, requestOptions);
376+
return transporter.request(request, requestOptions);
377377
},
378378

379379
/**
@@ -418,7 +418,7 @@ export function createAbtestingClient({
418418
data: scheduleABTestsRequest,
419419
};
420420

421-
return this.transporter.request(request, requestOptions);
421+
return transporter.request(request, requestOptions);
422422
},
423423

424424
/**
@@ -447,7 +447,7 @@ export function createAbtestingClient({
447447
headers,
448448
};
449449

450-
return this.transporter.request(request, requestOptions);
450+
return transporter.request(request, requestOptions);
451451
},
452452
};
453453
}

0 commit comments

Comments
 (0)