@algolia/client-search 5.34.0 → 5.35.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.
@@ -20,7 +20,7 @@ import {
20
20
  getAlgoliaAgent,
21
21
  shuffle
22
22
  } from "@algolia/client-common";
23
- var apiClientVersion = "5.34.0";
23
+ var apiClientVersion = "5.35.0";
24
24
  function getDefaultHosts(appId) {
25
25
  return [
26
26
  {
@@ -2403,9 +2403,16 @@ function searchClient(appId, apiKey, options) {
2403
2403
  * @param accountCopyIndex.destinationAppID - The application ID to write the index to.
2404
2404
  * @param accountCopyIndex.destinationApiKey - The API Key of the `destinationAppID` to write the index to, must have write ACLs.
2405
2405
  * @param accountCopyIndex.destinationIndexName - The name of the index to write the copied index to.
2406
+ * @param accountCopyIndex.batchSize - The size of the chunk of `objects`. Defaults to 1000.
2406
2407
  * @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `setSettings`, `saveRules`, `saveSynonyms` and `saveObjects` method and merged with the transporter requestOptions.
2407
2408
  */
2408
- async accountCopyIndex({ sourceIndexName, destinationAppID, destinationApiKey, destinationIndexName }, requestOptions) {
2409
+ async accountCopyIndex({
2410
+ sourceIndexName,
2411
+ destinationAppID,
2412
+ destinationApiKey,
2413
+ destinationIndexName,
2414
+ batchSize
2415
+ }, requestOptions) {
2409
2416
  const responses = [];
2410
2417
  if (this.appId === destinationAppID) {
2411
2418
  throw new IndicesInSameAppError();
@@ -2465,10 +2472,11 @@ function searchClient(appId, apiKey, options) {
2465
2472
  });
2466
2473
  await this.browseObjects({
2467
2474
  indexName: sourceIndexName,
2475
+ browseParams: batchSize ? { hitsPerPage: batchSize } : void 0,
2468
2476
  async aggregator(response) {
2469
2477
  responses.push(
2470
2478
  ...await destinationClient.saveObjects(
2471
- { indexName: destinationIndexName, objects: response.hits },
2479
+ { indexName: destinationIndexName, objects: response.hits, batchSize },
2472
2480
  requestOptions
2473
2481
  )
2474
2482
  );