File tree 5 files changed +30
-19
lines changed
clients/algoliasearch-client-javascript
packages/client-common/src
templates/javascript/clients/client/api
5 files changed +30
-19
lines changed Original file line number Diff line number Diff line change @@ -225,6 +225,10 @@ jobs:
225
225
if : ${{ steps.cache.outputs.cache-hit != 'true' && matrix.client.language != 'php' }}
226
226
run : yarn cli build clients ${{ matrix.client.language }} ${{ matrix.client.toBuild }}
227
227
228
+ - name : Test JavaScript bundle size
229
+ if : ${{ steps.cache.outputs.cache-hit != 'true' && matrix.client.language == 'javascript' }}
230
+ run : cd ${{ matrix.client.path }} && yarn test:size
231
+
228
232
- name : Run JavaScript 'algoliasearch' client tests
229
233
if : ${{ steps.cache.outputs.cache-hit != 'true' && matrix.client.language == 'javascript' }}
230
234
run : cd ${{ matrix.client.path }} && yarn workspace @experimental-api-clients-automation/algoliasearch test
Original file line number Diff line number Diff line change 2
2
"files" : [
3
3
{
4
4
"path" : " packages/algoliasearch/dist/algoliasearch.umd.js" ,
5
- "maxSize" : " 7.60KB "
5
+ "maxSize" : " 7.80KB "
6
6
},
7
7
{
8
8
"path" : " packages/algoliasearch/dist/lite/lite.umd.js" ,
18
18
},
19
19
{
20
20
"path" : " packages/client-insights/dist/client-insights.umd.js" ,
21
- "maxSize" : " 3.80KB "
21
+ "maxSize" : " 3.75KB "
22
22
},
23
23
{
24
24
"path" : " packages/client-personalization/dist/client-personalization.umd.js" ,
30
30
},
31
31
{
32
32
"path" : " packages/client-search/dist/client-search.umd.js" ,
33
- "maxSize" : " 6.30KB "
33
+ "maxSize" : " 6.55KB "
34
34
},
35
35
{
36
36
"path" : " packages/client-sources/dist/client-sources.umd.js" ,
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ function getUrlParams({
24
24
host,
25
25
algoliaAgent,
26
26
searchParams :
27
- Object . entries ( searchParams ) . length === 0 ? undefined : searchParams ,
27
+ Object . keys ( searchParams ) . length === 0 ? undefined : searchParams ,
28
28
} ;
29
29
}
30
30
@@ -39,7 +39,7 @@ export function createEchoRequester({
39
39
) : Promise < Response > {
40
40
const { host, searchParams, algoliaAgent } = getUrlParams ( getURL ( url ) ) ;
41
41
const originalData =
42
- data && Object . entries ( data ) . length > 0 ? data : undefined ;
42
+ data && Object . keys ( data ) . length > 0 ? data : undefined ;
43
43
44
44
return Promise . resolve ( {
45
45
content : JSON . stringify ( {
Original file line number Diff line number Diff line change @@ -113,19 +113,19 @@ export function createTransporter({
113
113
} ;
114
114
115
115
if ( requestOptions ?. queryParameters ) {
116
- for ( const [ key , value ] of Object . entries (
117
- requestOptions . queryParameters
118
- ) ) {
116
+ for ( const key of Object . keys ( requestOptions . queryParameters ) ) {
119
117
// We want to keep `undefined` and `null` values,
120
118
// but also avoid stringifying `object`s, as they are
121
119
// handled in the `serializeUrl` step right after.
122
120
if (
123
- ! value ||
124
- Object . prototype . toString . call ( value ) === '[object Object]'
121
+ ! requestOptions . queryParameters [ key ] ||
122
+ Object . prototype . toString . call (
123
+ requestOptions . queryParameters [ key ]
124
+ ) === '[object Object]'
125
125
) {
126
- queryParameters [ key ] = value ;
126
+ queryParameters [ key ] = requestOptions . queryParameters [ key ] ;
127
127
} else {
128
- queryParameters [ key ] = value . toString ( ) ;
128
+ queryParameters [ key ] = requestOptions . queryParameters [ key ] . toString ( ) ;
129
129
}
130
130
}
131
131
}
Original file line number Diff line number Diff line change @@ -34,23 +34,30 @@ waitForApiKey({
34
34
...createRetryablePromiseOptions
35
35
} : WaitForApiKeyOptions): Promise<ApiError | Key > {
36
36
if (operation === ' update' ) {
37
+ if (! apiKey) {
38
+ throw new Error(
39
+ ' `apiKey` is required when waiting for an `update` operation.'
40
+ );
41
+ }
42
+
37
43
return createRetryablePromise({
38
44
...createRetryablePromiseOptions,
39
45
func: () => this.getApiKey({ key } ),
40
- validate: (response) => {
41
- for (const [entry, values] of Object.entries (apiKey)) {
42
- if (Array.isArray(values )) {
46
+ validate: (response) => {
47
+ for (const field of Object.keys (apiKey)) {
48
+ if (Array.isArray(apiKey[field] )) {
43
49
if (
44
- values.length !== response[entry].length ||
45
- values.some((val, index) => val !== response[entry][index])
50
+ apiKey[field].length !== response[field].length ||
51
+ (apiKey[field] as string[]).some(
52
+ (value, index) => value !== response[field][index]
53
+ )
46
54
) {
47
55
return false ;
48
56
}
49
- } else if (values !== response[entry ]) {
57
+ } else if (response[field] !== apiKey[field ]) {
50
58
return false ;
51
59
}
52
60
}
53
-
54
61
return true;
55
62
},
56
63
});
You can’t perform that action at this time.
0 commit comments