Skip to content

Commit f93e2d1

Browse files
chore: generated code for commit 7bb3928. [skip ci]
Co-authored-by: Clément Vannicatte <[email protected]>
1 parent 7bb3928 commit f93e2d1

File tree

12 files changed

+194
-80
lines changed

12 files changed

+194
-80
lines changed

Diff for: clients/algoliasearch-client-javascript/packages/algoliasearch/builds/browser.ts

+17-15
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,15 @@ export function algoliasearch(
6363
throw new Error('`apiKey` is missing.');
6464
}
6565

66-
const commonOptions: Omit<CreateClientOptions, 'apiKey' | 'appId'> = {
66+
const commonOptions: CreateClientOptions = {
67+
apiKey,
68+
appId,
6769
timeouts: {
6870
connect: DEFAULT_CONNECT_TIMEOUT_BROWSER,
6971
read: DEFAULT_READ_TIMEOUT_BROWSER,
7072
write: DEFAULT_WRITE_TIMEOUT_BROWSER,
7173
},
72-
requester: options?.requester ?? createXhrRequester(),
74+
requester: createXhrRequester(),
7375
algoliaAgents: [{ segment: 'Browser' }],
7476
authMode: 'WithinQueryParameters',
7577
responsesCache: createMemoryCache(),
@@ -99,11 +101,9 @@ export function algoliasearch(
99101
}
100102

101103
return createAnalyticsClient({
102-
...initOptions.options,
103104
...commonOptions,
104-
appId: initOptions.appId ?? appId,
105-
apiKey: initOptions.apiKey ?? apiKey,
106-
region: initOptions.region,
105+
...initOptions.options,
106+
...initOptions,
107107
});
108108
}
109109

@@ -123,11 +123,9 @@ export function algoliasearch(
123123
}
124124

125125
return createAbtestingClient({
126-
...initOptions.options,
127126
...commonOptions,
128-
appId: initOptions.appId ?? appId,
129-
apiKey: initOptions.apiKey ?? apiKey,
130-
region: initOptions.region,
127+
...initOptions.options,
128+
...initOptions,
131129
});
132130
}
133131

@@ -151,16 +149,20 @@ export function algoliasearch(
151149
}
152150

153151
return createPersonalizationClient({
154-
...initOptions.options,
155152
...commonOptions,
156-
appId: initOptions.appId ?? appId,
157-
apiKey: initOptions.apiKey ?? apiKey,
158-
region: initOptions.region,
153+
...initOptions.options,
154+
...initOptions,
159155
});
160156
}
161157

162158
return {
163-
...createSearchClient({ appId, apiKey, ...commonOptions }),
159+
...createSearchClient(commonOptions),
160+
/**
161+
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
162+
*/
163+
get _ua(): string {
164+
return this.transporter.algoliaAgent.value;
165+
},
164166
initAnalytics,
165167
initPersonalization,
166168
initAbtesting,

Diff for: clients/algoliasearch-client-javascript/packages/algoliasearch/builds/node.ts

+17-15
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,15 @@ export function algoliasearch(
6262
throw new Error('`apiKey` is missing.');
6363
}
6464

65-
const commonOptions: Omit<CreateClientOptions, 'apiKey' | 'appId'> = {
65+
const commonOptions: CreateClientOptions = {
66+
apiKey,
67+
appId,
6668
timeouts: {
6769
connect: DEFAULT_CONNECT_TIMEOUT_NODE,
6870
read: DEFAULT_READ_TIMEOUT_NODE,
6971
write: DEFAULT_WRITE_TIMEOUT_NODE,
7072
},
71-
requester: options?.requester ?? createHttpRequester(),
73+
requester: createHttpRequester(),
7274
algoliaAgents: [{ segment: 'Node.js', version: process.versions.node }],
7375
responsesCache: createNullCache(),
7476
requestsCache: createNullCache(),
@@ -92,11 +94,9 @@ export function algoliasearch(
9294
}
9395

9496
return createAnalyticsClient({
95-
...initOptions.options,
9697
...commonOptions,
97-
appId: initOptions.appId ?? appId,
98-
apiKey: initOptions.apiKey ?? apiKey,
99-
region: initOptions.region,
98+
...initOptions.options,
99+
...initOptions,
100100
});
101101
}
102102

@@ -116,11 +116,9 @@ export function algoliasearch(
116116
}
117117

118118
return createAbtestingClient({
119-
...initOptions.options,
120119
...commonOptions,
121-
appId: initOptions.appId ?? appId,
122-
apiKey: initOptions.apiKey ?? apiKey,
123-
region: initOptions.region,
120+
...initOptions.options,
121+
...initOptions,
124122
});
125123
}
126124

@@ -144,16 +142,20 @@ export function algoliasearch(
144142
}
145143

146144
return createPersonalizationClient({
147-
...initOptions.options,
148145
...commonOptions,
149-
appId: initOptions.appId ?? appId,
150-
apiKey: initOptions.apiKey ?? apiKey,
151-
region: initOptions.region,
146+
...initOptions.options,
147+
...initOptions,
152148
});
153149
}
154150

155151
return {
156-
...createSearchClient({ appId, apiKey, ...commonOptions }),
152+
...createSearchClient(commonOptions),
153+
/**
154+
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
155+
*/
156+
get _ua(): string {
157+
return this.transporter.algoliaAgent.value;
158+
},
157159
initAnalytics,
158160
initPersonalization,
159161
initAbtesting,

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

+16-5
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,23 @@ export function createLiteClient({
8585
},
8686
});
8787

88-
function addAlgoliaAgent(segment: string, version?: string): void {
89-
transporter.algoliaAgent.add({ segment, version });
90-
}
91-
9288
return {
93-
addAlgoliaAgent,
89+
transporter,
90+
/**
91+
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
92+
*/
93+
get _ua(): string {
94+
return transporter.algoliaAgent.value;
95+
},
96+
/**
97+
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
98+
*
99+
* @param segment - The algolia agent (user-agent) segment to add.
100+
* @param version - The version of the agent.
101+
*/
102+
addAlgoliaAgent(segment: string, version?: string): void {
103+
transporter.algoliaAgent.add({ segment, version });
104+
},
94105
/**
95106
* This method allow you to send requests to the Algolia REST API.
96107
*

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

+16-5
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,23 @@ export function createAbtestingClient({
6969
},
7070
});
7171

72-
function addAlgoliaAgent(segment: string, version?: string): void {
73-
transporter.algoliaAgent.add({ segment, version });
74-
}
75-
7672
return {
77-
addAlgoliaAgent,
73+
transporter,
74+
/**
75+
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
76+
*/
77+
get _ua(): string {
78+
return transporter.algoliaAgent.value;
79+
},
80+
/**
81+
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
82+
*
83+
* @param segment - The algolia agent (user-agent) segment to add.
84+
* @param version - The version of the agent.
85+
*/
86+
addAlgoliaAgent(segment: string, version?: string): void {
87+
transporter.algoliaAgent.add({ segment, version });
88+
},
7889
/**
7990
* Creates a new A/B test with provided configuration. You can set an A/B test on two different indices with different settings, or on the same index with different search parameters by providing a customSearchParameters setting on one of the variants.
8091
*

Diff for: clients/algoliasearch-client-javascript/packages/client-analytics/src/analyticsClient.ts

+16-5
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,23 @@ export function createAnalyticsClient({
9595
},
9696
});
9797

98-
function addAlgoliaAgent(segment: string, version?: string): void {
99-
transporter.algoliaAgent.add({ segment, version });
100-
}
101-
10298
return {
103-
addAlgoliaAgent,
99+
transporter,
100+
/**
101+
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
102+
*/
103+
get _ua(): string {
104+
return transporter.algoliaAgent.value;
105+
},
106+
/**
107+
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
108+
*
109+
* @param segment - The algolia agent (user-agent) segment to add.
110+
* @param version - The version of the agent.
111+
*/
112+
addAlgoliaAgent(segment: string, version?: string): void {
113+
transporter.algoliaAgent.add({ segment, version });
114+
},
104115
/**
105116
* This method allow you to send requests to the Algolia REST API.
106117
*

Diff for: clients/algoliasearch-client-javascript/packages/client-insights/src/insightsClient.ts

+16-5
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,23 @@ export function createInsightsClient({
6363
},
6464
});
6565

66-
function addAlgoliaAgent(segment: string, version?: string): void {
67-
transporter.algoliaAgent.add({ segment, version });
68-
}
69-
7066
return {
71-
addAlgoliaAgent,
67+
transporter,
68+
/**
69+
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
70+
*/
71+
get _ua(): string {
72+
return transporter.algoliaAgent.value;
73+
},
74+
/**
75+
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
76+
*
77+
* @param segment - The algolia agent (user-agent) segment to add.
78+
* @param version - The version of the agent.
79+
*/
80+
addAlgoliaAgent(segment: string, version?: string): void {
81+
transporter.algoliaAgent.add({ segment, version });
82+
},
7283
/**
7384
* This method allow you to send requests to the Algolia REST API.
7485
*

Diff for: clients/algoliasearch-client-javascript/packages/client-personalization/src/personalizationClient.ts

+16-5
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,23 @@ export function createPersonalizationClient({
6868
},
6969
});
7070

71-
function addAlgoliaAgent(segment: string, version?: string): void {
72-
transporter.algoliaAgent.add({ segment, version });
73-
}
74-
7571
return {
76-
addAlgoliaAgent,
72+
transporter,
73+
/**
74+
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
75+
*/
76+
get _ua(): string {
77+
return transporter.algoliaAgent.value;
78+
},
79+
/**
80+
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
81+
*
82+
* @param segment - The algolia agent (user-agent) segment to add.
83+
* @param version - The version of the agent.
84+
*/
85+
addAlgoliaAgent(segment: string, version?: string): void {
86+
transporter.algoliaAgent.add({ segment, version });
87+
},
7788
/**
7889
* This method allow you to send requests to the Algolia REST API.
7990
*

Diff for: clients/algoliasearch-client-javascript/packages/client-query-suggestions/src/querySuggestionsClient.ts

+16-5
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,23 @@ export function createQuerySuggestionsClient({
7272
},
7373
});
7474

75-
function addAlgoliaAgent(segment: string, version?: string): void {
76-
transporter.algoliaAgent.add({ segment, version });
77-
}
78-
7975
return {
80-
addAlgoliaAgent,
76+
transporter,
77+
/**
78+
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
79+
*/
80+
get _ua(): string {
81+
return transporter.algoliaAgent.value;
82+
},
83+
/**
84+
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
85+
*
86+
* @param segment - The algolia agent (user-agent) segment to add.
87+
* @param version - The version of the agent.
88+
*/
89+
addAlgoliaAgent(segment: string, version?: string): void {
90+
transporter.algoliaAgent.add({ segment, version });
91+
},
8192
/**
8293
* Create a configuration of a Query Suggestions index. There\'s a limit of 100 configurations per application.
8394
*

Diff for: clients/algoliasearch-client-javascript/packages/client-search/src/searchClient.ts

+16-5
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,23 @@ export function createSearchClient({
179179
},
180180
});
181181

182-
function addAlgoliaAgent(segment: string, version?: string): void {
183-
transporter.algoliaAgent.add({ segment, version });
184-
}
185-
186182
return {
187-
addAlgoliaAgent,
183+
transporter,
184+
/**
185+
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
186+
*/
187+
get _ua(): string {
188+
return transporter.algoliaAgent.value;
189+
},
190+
/**
191+
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
192+
*
193+
* @param segment - The algolia agent (user-agent) segment to add.
194+
* @param version - The version of the agent.
195+
*/
196+
addAlgoliaAgent(segment: string, version?: string): void {
197+
transporter.algoliaAgent.add({ segment, version });
198+
},
188199
/**
189200
* Helper: Wait for a task to complete with `indexName` and `taskID`.
190201
*

Diff for: clients/algoliasearch-client-javascript/packages/client-sources/src/sourcesClient.ts

+16-5
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,23 @@ export function createSourcesClient({
6161
},
6262
});
6363

64-
function addAlgoliaAgent(segment: string, version?: string): void {
65-
transporter.algoliaAgent.add({ segment, version });
66-
}
67-
6864
return {
69-
addAlgoliaAgent,
65+
transporter,
66+
/**
67+
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
68+
*/
69+
get _ua(): string {
70+
return transporter.algoliaAgent.value;
71+
},
72+
/**
73+
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
74+
*
75+
* @param segment - The algolia agent (user-agent) segment to add.
76+
* @param version - The version of the agent.
77+
*/
78+
addAlgoliaAgent(segment: string, version?: string): void {
79+
transporter.algoliaAgent.add({ segment, version });
80+
},
7081
/**
7182
* This method allow you to send requests to the Algolia REST API.
7283
*

0 commit comments

Comments
 (0)