@algolia/client-search 5.10.2 → 5.12.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.
@@ -19,7 +19,7 @@ import {
19
19
  getAlgoliaAgent,
20
20
  shuffle
21
21
  } from "@algolia/client-common";
22
- var apiClientVersion = "5.10.2";
22
+ var apiClientVersion = "5.12.0";
23
23
  function getDefaultHosts(appId) {
24
24
  return [
25
25
  {
@@ -375,10 +375,11 @@ function createSearchClient({
375
375
  * @param saveObjects - The `saveObjects` object.
376
376
  * @param saveObjects.indexName - The `indexName` to save `objects` in.
377
377
  * @param saveObjects.objects - The array of `objects` to store in the given Algolia `indexName`.
378
+ * @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.
378
379
  * @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
380
  */
380
- async saveObjects({ indexName, objects }, requestOptions) {
381
- return await this.chunkedBatch({ indexName, objects, action: "addObject" }, requestOptions);
381
+ async saveObjects({ indexName, objects, waitForTasks }, requestOptions) {
382
+ return await this.chunkedBatch({ indexName, objects, action: "addObject", waitForTasks }, requestOptions);
382
383
  },
383
384
  /**
384
385
  * 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.
@@ -387,14 +388,16 @@ function createSearchClient({
387
388
  * @param deleteObjects - The `deleteObjects` object.
388
389
  * @param deleteObjects.indexName - The `indexName` to delete `objectIDs` from.
389
390
  * @param deleteObjects.objectIDs - The objectIDs to delete.
391
+ * @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.
390
392
  * @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `batch` method and merged with the transporter requestOptions.
391
393
  */
392
- async deleteObjects({ indexName, objectIDs }, requestOptions) {
394
+ async deleteObjects({ indexName, objectIDs, waitForTasks }, requestOptions) {
393
395
  return await this.chunkedBatch(
394
396
  {
395
397
  indexName,
396
398
  objects: objectIDs.map((objectID) => ({ objectID })),
397
- action: "deleteObject"
399
+ action: "deleteObject",
400
+ waitForTasks
398
401
  },
399
402
  requestOptions
400
403
  );
@@ -407,14 +410,16 @@ function createSearchClient({
407
410
  * @param partialUpdateObjects.indexName - The `indexName` to update `objects` in.
408
411
  * @param partialUpdateObjects.objects - The array of `objects` to update in the given Algolia `indexName`.
409
412
  * @param partialUpdateObjects.createIfNotExists - To be provided if non-existing objects are passed, otherwise, the call will fail..
413
+ * @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.
410
414
  * @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `getTask` method and merged with the transporter requestOptions.
411
415
  */
412
- async partialUpdateObjects({ indexName, objects, createIfNotExists }, requestOptions) {
416
+ async partialUpdateObjects({ indexName, objects, createIfNotExists, waitForTasks }, requestOptions) {
413
417
  return await this.chunkedBatch(
414
418
  {
415
419
  indexName,
416
420
  objects,
417
- action: createIfNotExists ? "partialUpdateObject" : "partialUpdateObjectNoCreate"
421
+ action: createIfNotExists ? "partialUpdateObject" : "partialUpdateObjectNoCreate",
422
+ waitForTasks
418
423
  },
419
424
  requestOptions
420
425
  );