@algolia/client-search 5.10.1 → 5.11.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.
@@ -7,7 +7,7 @@ import {
7
7
  getAlgoliaAgent,
8
8
  shuffle
9
9
  } from "@algolia/client-common";
10
- var apiClientVersion = "5.10.1";
10
+ var apiClientVersion = "5.11.0";
11
11
  function getDefaultHosts(appId) {
12
12
  return [
13
13
  {
@@ -363,10 +363,11 @@ function createSearchClient({
363
363
  * @param saveObjects - The `saveObjects` object.
364
364
  * @param saveObjects.indexName - The `indexName` to save `objects` in.
365
365
  * @param saveObjects.objects - The array of `objects` to store in the given Algolia `indexName`.
366
+ * @param saveObjects.waitForTasks - Whether or not we should wait until every `batch` tasks has been processed, this operation may slow the total execution time of this method but is more reliable.
366
367
  * @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `batch` method and merged with the transporter requestOptions.
367
368
  */
368
- async saveObjects({ indexName, objects }, requestOptions) {
369
- return await this.chunkedBatch({ indexName, objects, action: "addObject" }, requestOptions);
369
+ async saveObjects({ indexName, objects, waitForTasks }, requestOptions) {
370
+ return await this.chunkedBatch({ indexName, objects, action: "addObject", waitForTasks }, requestOptions);
370
371
  },
371
372
  /**
372
373
  * Helper: Deletes every records for the given objectIDs. The `chunkedBatch` helper is used under the hood, which creates a `batch` requests with at most 1000 objectIDs in it.
@@ -375,14 +376,16 @@ function createSearchClient({
375
376
  * @param deleteObjects - The `deleteObjects` object.
376
377
  * @param deleteObjects.indexName - The `indexName` to delete `objectIDs` from.
377
378
  * @param deleteObjects.objectIDs - The objectIDs to delete.
379
+ * @param deleteObjects.waitForTasks - Whether or not we should wait until every `batch` tasks has been processed, this operation may slow the total execution time of this method but is more reliable.
378
380
  * @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `batch` method and merged with the transporter requestOptions.
379
381
  */
380
- async deleteObjects({ indexName, objectIDs }, requestOptions) {
382
+ async deleteObjects({ indexName, objectIDs, waitForTasks }, requestOptions) {
381
383
  return await this.chunkedBatch(
382
384
  {
383
385
  indexName,
384
386
  objects: objectIDs.map((objectID) => ({ objectID })),
385
- action: "deleteObject"
387
+ action: "deleteObject",
388
+ waitForTasks
386
389
  },
387
390
  requestOptions
388
391
  );
@@ -395,14 +398,16 @@ function createSearchClient({
395
398
  * @param partialUpdateObjects.indexName - The `indexName` to update `objects` in.
396
399
  * @param partialUpdateObjects.objects - The array of `objects` to update in the given Algolia `indexName`.
397
400
  * @param partialUpdateObjects.createIfNotExists - To be provided if non-existing objects are passed, otherwise, the call will fail..
401
+ * @param partialUpdateObjects.waitForTasks - Whether or not we should wait until every `batch` tasks has been processed, this operation may slow the total execution time of this method but is more reliable.
398
402
  * @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `getTask` method and merged with the transporter requestOptions.
399
403
  */
400
- async partialUpdateObjects({ indexName, objects, createIfNotExists }, requestOptions) {
404
+ async partialUpdateObjects({ indexName, objects, createIfNotExists, waitForTasks }, requestOptions) {
401
405
  return await this.chunkedBatch(
402
406
  {
403
407
  indexName,
404
408
  objects,
405
- action: createIfNotExists ? "partialUpdateObject" : "partialUpdateObjectNoCreate"
409
+ action: createIfNotExists ? "partialUpdateObject" : "partialUpdateObjectNoCreate",
410
+ waitForTasks
406
411
  },
407
412
  requestOptions
408
413
  );