@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.
@@ -29,7 +29,7 @@ var import_client_common2 = require("@algolia/client-common");
29
29
 
30
30
  // src/searchClient.ts
31
31
  var import_client_common = require("@algolia/client-common");
32
- var apiClientVersion = "5.10.1";
32
+ var apiClientVersion = "5.11.0";
33
33
  function getDefaultHosts(appId) {
34
34
  return [
35
35
  {
@@ -385,10 +385,11 @@ function createSearchClient({
385
385
  * @param saveObjects - The `saveObjects` object.
386
386
  * @param saveObjects.indexName - The `indexName` to save `objects` in.
387
387
  * @param saveObjects.objects - The array of `objects` to store in the given Algolia `indexName`.
388
+ * @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.
388
389
  * @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `batch` method and merged with the transporter requestOptions.
389
390
  */
390
- async saveObjects({ indexName, objects }, requestOptions) {
391
- return await this.chunkedBatch({ indexName, objects, action: "addObject" }, requestOptions);
391
+ async saveObjects({ indexName, objects, waitForTasks }, requestOptions) {
392
+ return await this.chunkedBatch({ indexName, objects, action: "addObject", waitForTasks }, requestOptions);
392
393
  },
393
394
  /**
394
395
  * 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.
@@ -397,14 +398,16 @@ function createSearchClient({
397
398
  * @param deleteObjects - The `deleteObjects` object.
398
399
  * @param deleteObjects.indexName - The `indexName` to delete `objectIDs` from.
399
400
  * @param deleteObjects.objectIDs - The objectIDs to delete.
401
+ * @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.
400
402
  * @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `batch` method and merged with the transporter requestOptions.
401
403
  */
402
- async deleteObjects({ indexName, objectIDs }, requestOptions) {
404
+ async deleteObjects({ indexName, objectIDs, waitForTasks }, requestOptions) {
403
405
  return await this.chunkedBatch(
404
406
  {
405
407
  indexName,
406
408
  objects: objectIDs.map((objectID) => ({ objectID })),
407
- action: "deleteObject"
409
+ action: "deleteObject",
410
+ waitForTasks
408
411
  },
409
412
  requestOptions
410
413
  );
@@ -417,14 +420,16 @@ function createSearchClient({
417
420
  * @param partialUpdateObjects.indexName - The `indexName` to update `objects` in.
418
421
  * @param partialUpdateObjects.objects - The array of `objects` to update in the given Algolia `indexName`.
419
422
  * @param partialUpdateObjects.createIfNotExists - To be provided if non-existing objects are passed, otherwise, the call will fail..
423
+ * @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.
420
424
  * @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `getTask` method and merged with the transporter requestOptions.
421
425
  */
422
- async partialUpdateObjects({ indexName, objects, createIfNotExists }, requestOptions) {
426
+ async partialUpdateObjects({ indexName, objects, createIfNotExists, waitForTasks }, requestOptions) {
423
427
  return await this.chunkedBatch(
424
428
  {
425
429
  indexName,
426
430
  objects,
427
- action: createIfNotExists ? "partialUpdateObject" : "partialUpdateObjectNoCreate"
431
+ action: createIfNotExists ? "partialUpdateObject" : "partialUpdateObjectNoCreate",
432
+ waitForTasks
428
433
  },
429
434
  requestOptions
430
435
  );