Skip to content

Commit 14cd3e3

Browse files
algolia-botFluf22
andcommitted
fix(javascript): move gzip compression to node-only builds, remove fflate (generated)
algolia/api-clients-automation#6154 Co-authored-by: algolia-bot <accounts+algolia-api-client-bot@algolia.com> Co-authored-by: Thomas Raffray <Fluf22@users.noreply.github.com>
1 parent 492d96a commit 14cd3e3

File tree

58 files changed

+258
-97
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+258
-97
lines changed

package.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,55 +27,55 @@
2727
"files": [
2828
{
2929
"path": "packages/algoliasearch/dist/algoliasearch.umd.js",
30-
"maxSize": "14.60KB"
30+
"maxSize": "14.8KB"
3131
},
3232
{
3333
"path": "packages/algoliasearch/dist/lite/builds/browser.umd.js",
34-
"maxSize": "3.95KB"
34+
"maxSize": "4.2KB"
3535
},
3636
{
3737
"path": "packages/abtesting/dist/builds/browser.umd.js",
38-
"maxSize": "4.35KB"
38+
"maxSize": "4.5KB"
3939
},
4040
{
4141
"path": "packages/client-abtesting/dist/builds/browser.umd.js",
42-
"maxSize": "4.20KB"
42+
"maxSize": "4.4KB"
4343
},
4444
{
4545
"path": "packages/client-analytics/dist/builds/browser.umd.js",
46-
"maxSize": "4.85KB"
46+
"maxSize": "5.1KB"
4747
},
4848
{
4949
"path": "packages/composition/dist/builds/browser.umd.js",
50-
"maxSize": "4.75KB"
50+
"maxSize": "5.0KB"
5151
},
5252
{
5353
"path": "packages/client-insights/dist/builds/browser.umd.js",
54-
"maxSize": "3.90KB"
54+
"maxSize": "4.2KB"
5555
},
5656
{
5757
"path": "packages/client-personalization/dist/builds/browser.umd.js",
58-
"maxSize": "4.05KB"
58+
"maxSize": "4.3KB"
5959
},
6060
{
6161
"path": "packages/client-query-suggestions/dist/builds/browser.umd.js",
62-
"maxSize": "4.05KB"
62+
"maxSize": "4.3KB"
6363
},
6464
{
6565
"path": "packages/client-search/dist/builds/browser.umd.js",
66-
"maxSize": "7.35KB"
66+
"maxSize": "7.7KB"
6767
},
6868
{
6969
"path": "packages/ingestion/dist/builds/browser.umd.js",
70-
"maxSize": "6.75KB"
70+
"maxSize": "7.1KB"
7171
},
7272
{
7373
"path": "packages/monitoring/dist/builds/browser.umd.js",
74-
"maxSize": "4.00KB"
74+
"maxSize": "4.3KB"
7575
},
7676
{
7777
"path": "packages/recommend/dist/builds/browser.umd.js",
78-
"maxSize": "4.15KB"
78+
"maxSize": "4.5KB"
7979
}
8080
]
8181
},

packages/abtesting/builds/browser.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ export function abtestingV3Client(
3939
throw new Error(`\`region\` must be one of the following: ${REGIONS.join(', ')}`);
4040
}
4141

42+
const { compression: _compression, ...browserOptions } = options || {};
43+
4244
return createAbtestingV3Client({
4345
appId,
4446
apiKey,
@@ -57,7 +59,7 @@ export function abtestingV3Client(
5759
hostsCache: createFallbackableCache({
5860
caches: [createBrowserLocalStorageCache({ key: `${apiClientVersion}-${appId}` }), createMemoryCache()],
5961
}),
60-
...options,
62+
...browserOptions,
6163
});
6264
}
6365

packages/abtesting/builds/fetch.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
export type AbtestingV3Client = ReturnType<typeof createAbtestingV3Client>;
44

5+
import { gzipSync } from 'node:zlib';
6+
57
import { createMemoryCache, createNullCache, createNullLogger } from '@algolia/client-common';
68
import { createFetchRequester } from '@algolia/requester-fetch';
79

@@ -52,6 +54,7 @@ export function abtestingV3Client(
5254
responsesCache: createNullCache(),
5355
requestsCache: createNullCache(),
5456
hostsCache: createMemoryCache(),
57+
compress: async (data: string): Promise<Uint8Array> => gzipSync(Buffer.from(data)),
5558
...options,
5659
}),
5760
};

packages/abtesting/builds/node.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
export type AbtestingV3Client = ReturnType<typeof createAbtestingV3Client>;
44

5+
import { gzipSync } from 'node:zlib';
6+
57
import { createMemoryCache, createNullCache, createNullLogger } from '@algolia/client-common';
68
import { createHttpRequester } from '@algolia/requester-node-http';
79

@@ -52,6 +54,7 @@ export function abtestingV3Client(
5254
responsesCache: createNullCache(),
5355
requestsCache: createNullCache(),
5456
hostsCache: createMemoryCache(),
57+
compress: async (data: string): Promise<Uint8Array> => gzipSync(Buffer.from(data)),
5558
...options,
5659
}),
5760
};

packages/abtesting/builds/worker.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ export function abtestingV3Client(
3636
throw new Error(`\`region\` must be one of the following: ${REGIONS.join(', ')}`);
3737
}
3838

39+
const { compression: _compression, ...workerOptions } = options || {};
40+
3941
return {
4042
...createAbtestingV3Client({
4143
appId,
@@ -52,7 +54,7 @@ export function abtestingV3Client(
5254
responsesCache: createNullCache(),
5355
requestsCache: createNullCache(),
5456
hostsCache: createMemoryCache(),
55-
...options,
57+
...workerOptions,
5658
}),
5759
};
5860
}

packages/advanced-personalization/builds/browser.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ export function advancedPersonalizationClient(
3939
throw new Error(`\`region\` is required and must be one of the following: ${REGIONS.join(', ')}`);
4040
}
4141

42+
const { compression: _compression, ...browserOptions } = options || {};
43+
4244
return createAdvancedPersonalizationClient({
4345
appId,
4446
apiKey,
@@ -57,7 +59,7 @@ export function advancedPersonalizationClient(
5759
hostsCache: createFallbackableCache({
5860
caches: [createBrowserLocalStorageCache({ key: `${apiClientVersion}-${appId}` }), createMemoryCache()],
5961
}),
60-
...options,
62+
...browserOptions,
6163
});
6264
}
6365

packages/advanced-personalization/builds/fetch.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
export type AdvancedPersonalizationClient = ReturnType<typeof createAdvancedPersonalizationClient>;
44

5+
import { gzipSync } from 'node:zlib';
6+
57
import { createMemoryCache, createNullCache, createNullLogger } from '@algolia/client-common';
68
import { createFetchRequester } from '@algolia/requester-fetch';
79

@@ -52,6 +54,7 @@ export function advancedPersonalizationClient(
5254
responsesCache: createNullCache(),
5355
requestsCache: createNullCache(),
5456
hostsCache: createMemoryCache(),
57+
compress: async (data: string): Promise<Uint8Array> => gzipSync(Buffer.from(data)),
5558
...options,
5659
}),
5760
};

packages/advanced-personalization/builds/node.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
export type AdvancedPersonalizationClient = ReturnType<typeof createAdvancedPersonalizationClient>;
44

5+
import { gzipSync } from 'node:zlib';
6+
57
import { createMemoryCache, createNullCache, createNullLogger } from '@algolia/client-common';
68
import { createHttpRequester } from '@algolia/requester-node-http';
79

@@ -52,6 +54,7 @@ export function advancedPersonalizationClient(
5254
responsesCache: createNullCache(),
5355
requestsCache: createNullCache(),
5456
hostsCache: createMemoryCache(),
57+
compress: async (data: string): Promise<Uint8Array> => gzipSync(Buffer.from(data)),
5558
...options,
5659
}),
5760
};

packages/advanced-personalization/builds/worker.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ export function advancedPersonalizationClient(
3636
throw new Error(`\`region\` is required and must be one of the following: ${REGIONS.join(', ')}`);
3737
}
3838

39+
const { compression: _compression, ...workerOptions } = options || {};
40+
3941
return {
4042
...createAdvancedPersonalizationClient({
4143
appId,
@@ -52,7 +54,7 @@ export function advancedPersonalizationClient(
5254
responsesCache: createNullCache(),
5355
requestsCache: createNullCache(),
5456
hostsCache: createMemoryCache(),
55-
...options,
57+
...workerOptions,
5658
}),
5759
};
5860
}

packages/algoliasearch/lite/builds/browser.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ export function liteClient(appId: string, apiKey: string, options?: ClientOption
2525
throw new Error('`apiKey` is missing.');
2626
}
2727

28+
const { compression: _compression, ...browserOptions } = options || {};
29+
2830
return createLiteClient({
2931
appId,
3032
apiKey,
@@ -42,7 +44,7 @@ export function liteClient(appId: string, apiKey: string, options?: ClientOption
4244
hostsCache: createFallbackableCache({
4345
caches: [createBrowserLocalStorageCache({ key: `${apiClientVersion}-${appId}` }), createMemoryCache()],
4446
}),
45-
...options,
47+
...browserOptions,
4648
});
4749
}
4850

0 commit comments

Comments
 (0)