@algolia/client-search 5.52.1 → 5.54.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.
@@ -25,7 +25,7 @@ __export(searchClient_exports, {
25
25
  });
26
26
  module.exports = __toCommonJS(searchClient_exports);
27
27
  var import_client_common = require("@algolia/client-common");
28
- var apiClientVersion = "5.52.1";
28
+ var apiClientVersion = "5.54.0";
29
29
  function getDefaultHosts(appId) {
30
30
  return [
31
31
  {
@@ -359,9 +359,17 @@ function createSearchClient({
359
359
  * @param chunkedBatch.action - The `batch` `action` to perform on the given array of `objects`, defaults to `addObject`.
360
360
  * @param chunkedBatch.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.
361
361
  * @param chunkedBatch.batchSize - The size of the chunk of `objects`. The number of `batch` calls will be equal to `length(objects) / batchSize`. Defaults to 1000.
362
+ * @param chunkedBatch.maxRetries - The maximum number of retries when polling for task completion. 100 by default.
362
363
  * @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `getTask` method and merged with the transporter requestOptions.
363
364
  */
364
- async chunkedBatch({ indexName, objects, action = "addObject", waitForTasks, batchSize = 1e3 }, requestOptions) {
365
+ async chunkedBatch({
366
+ indexName,
367
+ objects,
368
+ action = "addObject",
369
+ waitForTasks,
370
+ batchSize = 1e3,
371
+ maxRetries = 100
372
+ }, requestOptions) {
365
373
  let requests = [];
366
374
  const responses = [];
367
375
  const objectEntries = objects.entries();
@@ -374,7 +382,7 @@ function createSearchClient({
374
382
  }
375
383
  if (waitForTasks) {
376
384
  for (const resp of responses) {
377
- await this.waitForTask({ indexName, taskID: resp.taskID });
385
+ await this.waitForTask({ indexName, taskID: resp.taskID, maxRetries });
378
386
  }
379
387
  }
380
388
  return responses;
@@ -388,11 +396,12 @@ function createSearchClient({
388
396
  * @param saveObjects.objects - The array of `objects` to store in the given Algolia `indexName`.
389
397
  * @param saveObjects.batchSize - The size of the chunk of `objects`. The number of `batch` calls will be equal to `length(objects) / batchSize`. Defaults to 1000.
390
398
  * @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.
399
+ * @param saveObjects.maxRetries - The maximum number of retries when polling for task completion. 100 by default.
391
400
  * @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `batch` method and merged with the transporter requestOptions.
392
401
  */
393
- async saveObjects({ indexName, objects, waitForTasks, batchSize }, requestOptions) {
402
+ async saveObjects({ indexName, objects, waitForTasks, batchSize, maxRetries }, requestOptions) {
394
403
  return await this.chunkedBatch(
395
- { indexName, objects, action: "addObject", waitForTasks, batchSize },
404
+ { indexName, objects, action: "addObject", waitForTasks, batchSize, maxRetries },
396
405
  requestOptions
397
406
  );
398
407
  },
@@ -405,16 +414,18 @@ function createSearchClient({
405
414
  * @param deleteObjects.objectIDs - The objectIDs to delete.
406
415
  * @param deleteObjects.batchSize - The size of the chunk of `objects`. The number of `batch` calls will be equal to `length(objects) / batchSize`. Defaults to 1000.
407
416
  * @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.
417
+ * @param deleteObjects.maxRetries - The maximum number of retries when polling for task completion. 100 by default.
408
418
  * @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `batch` method and merged with the transporter requestOptions.
409
419
  */
410
- async deleteObjects({ indexName, objectIDs, waitForTasks, batchSize }, requestOptions) {
420
+ async deleteObjects({ indexName, objectIDs, waitForTasks, batchSize, maxRetries }, requestOptions) {
411
421
  return await this.chunkedBatch(
412
422
  {
413
423
  indexName,
414
424
  objects: objectIDs.map((objectID) => ({ objectID })),
415
425
  action: "deleteObject",
416
426
  waitForTasks,
417
- batchSize
427
+ batchSize,
428
+ maxRetries
418
429
  },
419
430
  requestOptions
420
431
  );
@@ -429,16 +440,18 @@ function createSearchClient({
429
440
  * @param partialUpdateObjects.createIfNotExists - To be provided if non-existing objects are passed, otherwise, the call will fail.
430
441
  * @param partialUpdateObjects.batchSize - The size of the chunk of `objects`. The number of `batch` calls will be equal to `length(objects) / batchSize`. Defaults to 1000.
431
442
  * @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.
443
+ * @param partialUpdateObjects.maxRetries - The maximum number of retries when polling for task completion. 100 by default.
432
444
  * @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `getTask` method and merged with the transporter requestOptions.
433
445
  */
434
- async partialUpdateObjects({ indexName, objects, createIfNotExists, waitForTasks, batchSize }, requestOptions) {
446
+ async partialUpdateObjects({ indexName, objects, createIfNotExists, waitForTasks, batchSize, maxRetries }, requestOptions) {
435
447
  return await this.chunkedBatch(
436
448
  {
437
449
  indexName,
438
450
  objects,
439
451
  action: createIfNotExists ? "partialUpdateObject" : "partialUpdateObjectNoCreate",
440
452
  batchSize,
441
- waitForTasks
453
+ waitForTasks,
454
+ maxRetries
442
455
  },
443
456
  requestOptions
444
457
  );
@@ -453,9 +466,10 @@ function createSearchClient({
453
466
  * @param replaceAllObjects.objects - The array of `objects` to store in the given Algolia `indexName`.
454
467
  * @param replaceAllObjects.batchSize - The size of the chunk of `objects`. The number of `batch` calls will be equal to `objects.length / batchSize`. Defaults to 1000.
455
468
  * @param replaceAllObjects.scopes - The `scopes` to keep from the index. Defaults to ['settings', 'rules', 'synonyms'].
469
+ * @param replaceAllObjects.maxRetries - The maximum number of retries when polling for task completion. 100 by default.
456
470
  * @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `batch`, `operationIndex` and `getTask` method and merged with the transporter requestOptions.
457
471
  */
458
- async replaceAllObjects({ indexName, objects, batchSize, scopes }, requestOptions) {
472
+ async replaceAllObjects({ indexName, objects, batchSize, scopes, maxRetries = 100 }, requestOptions) {
459
473
  const randomSuffix = Math.floor(Math.random() * 1e6) + 1e5;
460
474
  const tmpIndexName = `${indexName}_tmp_${randomSuffix}`;
461
475
  if (scopes === void 0) {
@@ -474,12 +488,13 @@ function createSearchClient({
474
488
  requestOptions
475
489
  );
476
490
  const batchResponses = await this.chunkedBatch(
477
- { indexName: tmpIndexName, objects, waitForTasks: true, batchSize },
491
+ { indexName: tmpIndexName, objects, waitForTasks: true, batchSize, maxRetries },
478
492
  requestOptions
479
493
  );
480
494
  await this.waitForTask({
481
495
  indexName: tmpIndexName,
482
- taskID: copyOperationResponse.taskID
496
+ taskID: copyOperationResponse.taskID,
497
+ maxRetries
483
498
  });
484
499
  copyOperationResponse = await this.operationIndex(
485
500
  {
@@ -494,7 +509,8 @@ function createSearchClient({
494
509
  );
495
510
  await this.waitForTask({
496
511
  indexName: tmpIndexName,
497
- taskID: copyOperationResponse.taskID
512
+ taskID: copyOperationResponse.taskID,
513
+ maxRetries
498
514
  });
499
515
  const moveOperationResponse = await this.operationIndex(
500
516
  {
@@ -505,7 +521,8 @@ function createSearchClient({
505
521
  );
506
522
  await this.waitForTask({
507
523
  indexName: tmpIndexName,
508
- taskID: moveOperationResponse.taskID
524
+ taskID: moveOperationResponse.taskID,
525
+ maxRetries
509
526
  });
510
527
  return { copyOperationResponse, batchResponses, moveOperationResponse };
511
528
  } catch (error) {
@@ -555,12 +572,8 @@ function createSearchClient({
555
572
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
556
573
  */
557
574
  addApiKey(apiKey, requestOptions) {
558
- if (!apiKey) {
559
- throw new Error("Parameter `apiKey` is required when calling `addApiKey`.");
560
- }
561
- if (!apiKey.acl) {
562
- throw new Error("Parameter `apiKey.acl` is required when calling `addApiKey`.");
563
- }
575
+ (0, import_client_common.validateRequired)("apiKey", "addApiKey", apiKey);
576
+ (0, import_client_common.validateRequired)("apiKey.acl", "addApiKey", apiKey.acl);
564
577
  const requestPath = "/1/keys";
565
578
  const headers = {};
566
579
  const queryParameters = {};
@@ -585,15 +598,9 @@ function createSearchClient({
585
598
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
586
599
  */
587
600
  addOrUpdateObject({ indexName, objectID, body }, requestOptions) {
588
- if (!indexName) {
589
- throw new Error("Parameter `indexName` is required when calling `addOrUpdateObject`.");
590
- }
591
- if (!objectID) {
592
- throw new Error("Parameter `objectID` is required when calling `addOrUpdateObject`.");
593
- }
594
- if (!body) {
595
- throw new Error("Parameter `body` is required when calling `addOrUpdateObject`.");
596
- }
601
+ (0, import_client_common.validateRequired)("indexName", "addOrUpdateObject", indexName);
602
+ (0, import_client_common.validateRequired)("objectID", "addOrUpdateObject", objectID);
603
+ (0, import_client_common.validateRequired)("body", "addOrUpdateObject", body);
597
604
  const requestPath = "/1/indexes/{indexName}/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
598
605
  const headers = {};
599
606
  const queryParameters = {};
@@ -615,12 +622,8 @@ function createSearchClient({
615
622
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
616
623
  */
617
624
  appendSource(source, requestOptions) {
618
- if (!source) {
619
- throw new Error("Parameter `source` is required when calling `appendSource`.");
620
- }
621
- if (!source.source) {
622
- throw new Error("Parameter `source.source` is required when calling `appendSource`.");
623
- }
625
+ (0, import_client_common.validateRequired)("source", "appendSource", source);
626
+ (0, import_client_common.validateRequired)("source.source", "appendSource", source.source);
624
627
  const requestPath = "/1/security/sources/append";
625
628
  const headers = {};
626
629
  const queryParameters = {};
@@ -646,15 +649,9 @@ function createSearchClient({
646
649
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
647
650
  */
648
651
  assignUserId({ xAlgoliaUserID, assignUserIdParams }, requestOptions) {
649
- if (!xAlgoliaUserID) {
650
- throw new Error("Parameter `xAlgoliaUserID` is required when calling `assignUserId`.");
651
- }
652
- if (!assignUserIdParams) {
653
- throw new Error("Parameter `assignUserIdParams` is required when calling `assignUserId`.");
654
- }
655
- if (!assignUserIdParams.cluster) {
656
- throw new Error("Parameter `assignUserIdParams.cluster` is required when calling `assignUserId`.");
657
- }
652
+ (0, import_client_common.validateRequired)("xAlgoliaUserID", "assignUserId", xAlgoliaUserID);
653
+ (0, import_client_common.validateRequired)("assignUserIdParams", "assignUserId", assignUserIdParams);
654
+ (0, import_client_common.validateRequired)("assignUserIdParams.cluster", "assignUserId", assignUserIdParams.cluster);
658
655
  const requestPath = "/1/clusters/mapping";
659
656
  const headers = {};
660
657
  const queryParameters = {};
@@ -681,15 +678,9 @@ function createSearchClient({
681
678
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
682
679
  */
683
680
  batch({ indexName, batchWriteParams }, requestOptions) {
684
- if (!indexName) {
685
- throw new Error("Parameter `indexName` is required when calling `batch`.");
686
- }
687
- if (!batchWriteParams) {
688
- throw new Error("Parameter `batchWriteParams` is required when calling `batch`.");
689
- }
690
- if (!batchWriteParams.requests) {
691
- throw new Error("Parameter `batchWriteParams.requests` is required when calling `batch`.");
692
- }
681
+ (0, import_client_common.validateRequired)("indexName", "batch", indexName);
682
+ (0, import_client_common.validateRequired)("batchWriteParams", "batch", batchWriteParams);
683
+ (0, import_client_common.validateRequired)("batchWriteParams.requests", "batch", batchWriteParams.requests);
693
684
  const requestPath = "/1/indexes/{indexName}/batch".replace("{indexName}", encodeURIComponent(indexName));
694
685
  const headers = {};
695
686
  const queryParameters = {};
@@ -715,18 +706,10 @@ function createSearchClient({
715
706
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
716
707
  */
717
708
  batchAssignUserIds({ xAlgoliaUserID, batchAssignUserIdsParams }, requestOptions) {
718
- if (!xAlgoliaUserID) {
719
- throw new Error("Parameter `xAlgoliaUserID` is required when calling `batchAssignUserIds`.");
720
- }
721
- if (!batchAssignUserIdsParams) {
722
- throw new Error("Parameter `batchAssignUserIdsParams` is required when calling `batchAssignUserIds`.");
723
- }
724
- if (!batchAssignUserIdsParams.cluster) {
725
- throw new Error("Parameter `batchAssignUserIdsParams.cluster` is required when calling `batchAssignUserIds`.");
726
- }
727
- if (!batchAssignUserIdsParams.users) {
728
- throw new Error("Parameter `batchAssignUserIdsParams.users` is required when calling `batchAssignUserIds`.");
729
- }
709
+ (0, import_client_common.validateRequired)("xAlgoliaUserID", "batchAssignUserIds", xAlgoliaUserID);
710
+ (0, import_client_common.validateRequired)("batchAssignUserIdsParams", "batchAssignUserIds", batchAssignUserIdsParams);
711
+ (0, import_client_common.validateRequired)("batchAssignUserIdsParams.cluster", "batchAssignUserIds", batchAssignUserIdsParams.cluster);
712
+ (0, import_client_common.validateRequired)("batchAssignUserIdsParams.users", "batchAssignUserIds", batchAssignUserIdsParams.users);
730
713
  const requestPath = "/1/clusters/mapping/batch";
731
714
  const headers = {};
732
715
  const queryParameters = {};
@@ -753,17 +736,13 @@ function createSearchClient({
753
736
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
754
737
  */
755
738
  batchDictionaryEntries({ dictionaryName, batchDictionaryEntriesParams }, requestOptions) {
756
- if (!dictionaryName) {
757
- throw new Error("Parameter `dictionaryName` is required when calling `batchDictionaryEntries`.");
758
- }
759
- if (!batchDictionaryEntriesParams) {
760
- throw new Error("Parameter `batchDictionaryEntriesParams` is required when calling `batchDictionaryEntries`.");
761
- }
762
- if (!batchDictionaryEntriesParams.requests) {
763
- throw new Error(
764
- "Parameter `batchDictionaryEntriesParams.requests` is required when calling `batchDictionaryEntries`."
765
- );
766
- }
739
+ (0, import_client_common.validateRequired)("dictionaryName", "batchDictionaryEntries", dictionaryName);
740
+ (0, import_client_common.validateRequired)("batchDictionaryEntriesParams", "batchDictionaryEntries", batchDictionaryEntriesParams);
741
+ (0, import_client_common.validateRequired)(
742
+ "batchDictionaryEntriesParams.requests",
743
+ "batchDictionaryEntries",
744
+ batchDictionaryEntriesParams.requests
745
+ );
767
746
  const requestPath = "/1/dictionaries/{dictionaryName}/batch".replace(
768
747
  "{dictionaryName}",
769
748
  encodeURIComponent(dictionaryName)
@@ -790,9 +769,7 @@ function createSearchClient({
790
769
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
791
770
  */
792
771
  browse({ indexName, browseParams }, requestOptions) {
793
- if (!indexName) {
794
- throw new Error("Parameter `indexName` is required when calling `browse`.");
795
- }
772
+ (0, import_client_common.validateRequired)("indexName", "browse", indexName);
796
773
  const requestPath = "/1/indexes/{indexName}/browse".replace("{indexName}", encodeURIComponent(indexName));
797
774
  const headers = {};
798
775
  const queryParameters = {};
@@ -816,9 +793,7 @@ function createSearchClient({
816
793
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
817
794
  */
818
795
  clearObjects({ indexName }, requestOptions) {
819
- if (!indexName) {
820
- throw new Error("Parameter `indexName` is required when calling `clearObjects`.");
821
- }
796
+ (0, import_client_common.validateRequired)("indexName", "clearObjects", indexName);
822
797
  const requestPath = "/1/indexes/{indexName}/clear".replace("{indexName}", encodeURIComponent(indexName));
823
798
  const headers = {};
824
799
  const queryParameters = {};
@@ -841,9 +816,7 @@ function createSearchClient({
841
816
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
842
817
  */
843
818
  clearRules({ indexName, forwardToReplicas }, requestOptions) {
844
- if (!indexName) {
845
- throw new Error("Parameter `indexName` is required when calling `clearRules`.");
846
- }
819
+ (0, import_client_common.validateRequired)("indexName", "clearRules", indexName);
847
820
  const requestPath = "/1/indexes/{indexName}/rules/clear".replace("{indexName}", encodeURIComponent(indexName));
848
821
  const headers = {};
849
822
  const queryParameters = {};
@@ -869,9 +842,7 @@ function createSearchClient({
869
842
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
870
843
  */
871
844
  clearSynonyms({ indexName, forwardToReplicas }, requestOptions) {
872
- if (!indexName) {
873
- throw new Error("Parameter `indexName` is required when calling `clearSynonyms`.");
874
- }
845
+ (0, import_client_common.validateRequired)("indexName", "clearSynonyms", indexName);
875
846
  const requestPath = "/1/indexes/{indexName}/synonyms/clear".replace("{indexName}", encodeURIComponent(indexName));
876
847
  const headers = {};
877
848
  const queryParameters = {};
@@ -894,9 +865,7 @@ function createSearchClient({
894
865
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
895
866
  */
896
867
  customDelete({ path, parameters }, requestOptions) {
897
- if (!path) {
898
- throw new Error("Parameter `path` is required when calling `customDelete`.");
899
- }
868
+ (0, import_client_common.validateRequired)("path", "customDelete", path);
900
869
  const requestPath = "/{path}".replace("{path}", path);
901
870
  const headers = {};
902
871
  const queryParameters = parameters ? parameters : {};
@@ -916,9 +885,7 @@ function createSearchClient({
916
885
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
917
886
  */
918
887
  customGet({ path, parameters }, requestOptions) {
919
- if (!path) {
920
- throw new Error("Parameter `path` is required when calling `customGet`.");
921
- }
888
+ (0, import_client_common.validateRequired)("path", "customGet", path);
922
889
  const requestPath = "/{path}".replace("{path}", path);
923
890
  const headers = {};
924
891
  const queryParameters = parameters ? parameters : {};
@@ -939,9 +906,7 @@ function createSearchClient({
939
906
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
940
907
  */
941
908
  customPost({ path, parameters, body }, requestOptions) {
942
- if (!path) {
943
- throw new Error("Parameter `path` is required when calling `customPost`.");
944
- }
909
+ (0, import_client_common.validateRequired)("path", "customPost", path);
945
910
  const requestPath = "/{path}".replace("{path}", path);
946
911
  const headers = {};
947
912
  const queryParameters = parameters ? parameters : {};
@@ -963,9 +928,7 @@ function createSearchClient({
963
928
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
964
929
  */
965
930
  customPut({ path, parameters, body }, requestOptions) {
966
- if (!path) {
967
- throw new Error("Parameter `path` is required when calling `customPut`.");
968
- }
931
+ (0, import_client_common.validateRequired)("path", "customPut", path);
969
932
  const requestPath = "/{path}".replace("{path}", path);
970
933
  const headers = {};
971
934
  const queryParameters = parameters ? parameters : {};
@@ -988,9 +951,7 @@ function createSearchClient({
988
951
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
989
952
  */
990
953
  deleteApiKey({ key }, requestOptions) {
991
- if (!key) {
992
- throw new Error("Parameter `key` is required when calling `deleteApiKey`.");
993
- }
954
+ (0, import_client_common.validateRequired)("key", "deleteApiKey", key);
994
955
  const requestPath = "/1/keys/{key}".replace("{key}", encodeURIComponent(key));
995
956
  const headers = {};
996
957
  const queryParameters = {};
@@ -1013,12 +974,8 @@ function createSearchClient({
1013
974
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1014
975
  */
1015
976
  deleteBy({ indexName, deleteByParams }, requestOptions) {
1016
- if (!indexName) {
1017
- throw new Error("Parameter `indexName` is required when calling `deleteBy`.");
1018
- }
1019
- if (!deleteByParams) {
1020
- throw new Error("Parameter `deleteByParams` is required when calling `deleteBy`.");
1021
- }
977
+ (0, import_client_common.validateRequired)("indexName", "deleteBy", indexName);
978
+ (0, import_client_common.validateRequired)("deleteByParams", "deleteBy", deleteByParams);
1022
979
  const requestPath = "/1/indexes/{indexName}/deleteByQuery".replace("{indexName}", encodeURIComponent(indexName));
1023
980
  const headers = {};
1024
981
  const queryParameters = {};
@@ -1041,9 +998,7 @@ function createSearchClient({
1041
998
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1042
999
  */
1043
1000
  deleteIndex({ indexName }, requestOptions) {
1044
- if (!indexName) {
1045
- throw new Error("Parameter `indexName` is required when calling `deleteIndex`.");
1046
- }
1001
+ (0, import_client_common.validateRequired)("indexName", "deleteIndex", indexName);
1047
1002
  const requestPath = "/1/indexes/{indexName}".replace("{indexName}", encodeURIComponent(indexName));
1048
1003
  const headers = {};
1049
1004
  const queryParameters = {};
@@ -1066,12 +1021,8 @@ function createSearchClient({
1066
1021
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1067
1022
  */
1068
1023
  deleteObject({ indexName, objectID }, requestOptions) {
1069
- if (!indexName) {
1070
- throw new Error("Parameter `indexName` is required when calling `deleteObject`.");
1071
- }
1072
- if (!objectID) {
1073
- throw new Error("Parameter `objectID` is required when calling `deleteObject`.");
1074
- }
1024
+ (0, import_client_common.validateRequired)("indexName", "deleteObject", indexName);
1025
+ (0, import_client_common.validateRequired)("objectID", "deleteObject", objectID);
1075
1026
  const requestPath = "/1/indexes/{indexName}/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
1076
1027
  const headers = {};
1077
1028
  const queryParameters = {};
@@ -1095,12 +1046,8 @@ function createSearchClient({
1095
1046
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1096
1047
  */
1097
1048
  deleteRule({ indexName, objectID, forwardToReplicas }, requestOptions) {
1098
- if (!indexName) {
1099
- throw new Error("Parameter `indexName` is required when calling `deleteRule`.");
1100
- }
1101
- if (!objectID) {
1102
- throw new Error("Parameter `objectID` is required when calling `deleteRule`.");
1103
- }
1049
+ (0, import_client_common.validateRequired)("indexName", "deleteRule", indexName);
1050
+ (0, import_client_common.validateRequired)("objectID", "deleteRule", objectID);
1104
1051
  const requestPath = "/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
1105
1052
  const headers = {};
1106
1053
  const queryParameters = {};
@@ -1125,9 +1072,7 @@ function createSearchClient({
1125
1072
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1126
1073
  */
1127
1074
  deleteSource({ source }, requestOptions) {
1128
- if (!source) {
1129
- throw new Error("Parameter `source` is required when calling `deleteSource`.");
1130
- }
1075
+ (0, import_client_common.validateRequired)("source", "deleteSource", source);
1131
1076
  const requestPath = "/1/security/sources/{source}".replace("{source}", encodeURIComponent(source));
1132
1077
  const headers = {};
1133
1078
  const queryParameters = {};
@@ -1151,12 +1096,8 @@ function createSearchClient({
1151
1096
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1152
1097
  */
1153
1098
  deleteSynonym({ indexName, objectID, forwardToReplicas }, requestOptions) {
1154
- if (!indexName) {
1155
- throw new Error("Parameter `indexName` is required when calling `deleteSynonym`.");
1156
- }
1157
- if (!objectID) {
1158
- throw new Error("Parameter `objectID` is required when calling `deleteSynonym`.");
1159
- }
1099
+ (0, import_client_common.validateRequired)("indexName", "deleteSynonym", indexName);
1100
+ (0, import_client_common.validateRequired)("objectID", "deleteSynonym", objectID);
1160
1101
  const requestPath = "/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
1161
1102
  const headers = {};
1162
1103
  const queryParameters = {};
@@ -1181,9 +1122,7 @@ function createSearchClient({
1181
1122
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1182
1123
  */
1183
1124
  getApiKey({ key }, requestOptions) {
1184
- if (!key) {
1185
- throw new Error("Parameter `key` is required when calling `getApiKey`.");
1186
- }
1125
+ (0, import_client_common.validateRequired)("key", "getApiKey", key);
1187
1126
  const requestPath = "/1/keys/{key}".replace("{key}", encodeURIComponent(key));
1188
1127
  const headers = {};
1189
1128
  const queryParameters = {};
@@ -1205,9 +1144,7 @@ function createSearchClient({
1205
1144
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1206
1145
  */
1207
1146
  getAppTask({ taskID }, requestOptions) {
1208
- if (!taskID) {
1209
- throw new Error("Parameter `taskID` is required when calling `getAppTask`.");
1210
- }
1147
+ (0, import_client_common.validateRequired)("taskID", "getAppTask", taskID);
1211
1148
  const requestPath = "/1/task/{taskID}".replace("{taskID}", encodeURIComponent(taskID));
1212
1149
  const headers = {};
1213
1150
  const queryParameters = {};
@@ -1305,12 +1242,8 @@ function createSearchClient({
1305
1242
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1306
1243
  */
1307
1244
  getObject({ indexName, objectID, attributesToRetrieve }, requestOptions) {
1308
- if (!indexName) {
1309
- throw new Error("Parameter `indexName` is required when calling `getObject`.");
1310
- }
1311
- if (!objectID) {
1312
- throw new Error("Parameter `objectID` is required when calling `getObject`.");
1313
- }
1245
+ (0, import_client_common.validateRequired)("indexName", "getObject", indexName);
1246
+ (0, import_client_common.validateRequired)("objectID", "getObject", objectID);
1314
1247
  const requestPath = "/1/indexes/{indexName}/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
1315
1248
  const headers = {};
1316
1249
  const queryParameters = {};
@@ -1334,12 +1267,8 @@ function createSearchClient({
1334
1267
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1335
1268
  */
1336
1269
  getObjects(getObjectsParams, requestOptions) {
1337
- if (!getObjectsParams) {
1338
- throw new Error("Parameter `getObjectsParams` is required when calling `getObjects`.");
1339
- }
1340
- if (!getObjectsParams.requests) {
1341
- throw new Error("Parameter `getObjectsParams.requests` is required when calling `getObjects`.");
1342
- }
1270
+ (0, import_client_common.validateRequired)("getObjectsParams", "getObjects", getObjectsParams);
1271
+ (0, import_client_common.validateRequired)("getObjectsParams.requests", "getObjects", getObjectsParams.requests);
1343
1272
  const requestPath = "/1/indexes/*/objects";
1344
1273
  const headers = {};
1345
1274
  const queryParameters = {};
@@ -1365,12 +1294,8 @@ function createSearchClient({
1365
1294
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1366
1295
  */
1367
1296
  getRule({ indexName, objectID }, requestOptions) {
1368
- if (!indexName) {
1369
- throw new Error("Parameter `indexName` is required when calling `getRule`.");
1370
- }
1371
- if (!objectID) {
1372
- throw new Error("Parameter `objectID` is required when calling `getRule`.");
1373
- }
1297
+ (0, import_client_common.validateRequired)("indexName", "getRule", indexName);
1298
+ (0, import_client_common.validateRequired)("objectID", "getRule", objectID);
1374
1299
  const requestPath = "/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
1375
1300
  const headers = {};
1376
1301
  const queryParameters = {};
@@ -1393,9 +1318,7 @@ function createSearchClient({
1393
1318
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1394
1319
  */
1395
1320
  getSettings({ indexName, getVersion }, requestOptions) {
1396
- if (!indexName) {
1397
- throw new Error("Parameter `indexName` is required when calling `getSettings`.");
1398
- }
1321
+ (0, import_client_common.validateRequired)("indexName", "getSettings", indexName);
1399
1322
  const requestPath = "/1/indexes/{indexName}/settings".replace("{indexName}", encodeURIComponent(indexName));
1400
1323
  const headers = {};
1401
1324
  const queryParameters = {};
@@ -1440,12 +1363,8 @@ function createSearchClient({
1440
1363
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1441
1364
  */
1442
1365
  getSynonym({ indexName, objectID }, requestOptions) {
1443
- if (!indexName) {
1444
- throw new Error("Parameter `indexName` is required when calling `getSynonym`.");
1445
- }
1446
- if (!objectID) {
1447
- throw new Error("Parameter `objectID` is required when calling `getSynonym`.");
1448
- }
1366
+ (0, import_client_common.validateRequired)("indexName", "getSynonym", indexName);
1367
+ (0, import_client_common.validateRequired)("objectID", "getSynonym", objectID);
1449
1368
  const requestPath = "/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
1450
1369
  const headers = {};
1451
1370
  const queryParameters = {};
@@ -1468,12 +1387,8 @@ function createSearchClient({
1468
1387
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1469
1388
  */
1470
1389
  getTask({ indexName, taskID }, requestOptions) {
1471
- if (!indexName) {
1472
- throw new Error("Parameter `indexName` is required when calling `getTask`.");
1473
- }
1474
- if (!taskID) {
1475
- throw new Error("Parameter `taskID` is required when calling `getTask`.");
1476
- }
1390
+ (0, import_client_common.validateRequired)("indexName", "getTask", indexName);
1391
+ (0, import_client_common.validateRequired)("taskID", "getTask", taskID);
1477
1392
  const requestPath = "/1/indexes/{indexName}/task/{taskID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{taskID}", encodeURIComponent(taskID));
1478
1393
  const headers = {};
1479
1394
  const queryParameters = {};
@@ -1518,9 +1433,7 @@ function createSearchClient({
1518
1433
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1519
1434
  */
1520
1435
  getUserId({ userID }, requestOptions) {
1521
- if (!userID) {
1522
- throw new Error("Parameter `userID` is required when calling `getUserId`.");
1523
- }
1436
+ (0, import_client_common.validateRequired)("userID", "getUserId", userID);
1524
1437
  const requestPath = "/1/clusters/mapping/{userID}".replace("{userID}", encodeURIComponent(userID));
1525
1438
  const headers = {};
1526
1439
  const queryParameters = {};
@@ -1665,12 +1578,8 @@ function createSearchClient({
1665
1578
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1666
1579
  */
1667
1580
  multipleBatch(batchParams, requestOptions) {
1668
- if (!batchParams) {
1669
- throw new Error("Parameter `batchParams` is required when calling `multipleBatch`.");
1670
- }
1671
- if (!batchParams.requests) {
1672
- throw new Error("Parameter `batchParams.requests` is required when calling `multipleBatch`.");
1673
- }
1581
+ (0, import_client_common.validateRequired)("batchParams", "multipleBatch", batchParams);
1582
+ (0, import_client_common.validateRequired)("batchParams.requests", "multipleBatch", batchParams.requests);
1674
1583
  const requestPath = "/1/indexes/*/batch";
1675
1584
  const headers = {};
1676
1585
  const queryParameters = {};
@@ -1694,18 +1603,10 @@ function createSearchClient({
1694
1603
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1695
1604
  */
1696
1605
  operationIndex({ indexName, operationIndexParams }, requestOptions) {
1697
- if (!indexName) {
1698
- throw new Error("Parameter `indexName` is required when calling `operationIndex`.");
1699
- }
1700
- if (!operationIndexParams) {
1701
- throw new Error("Parameter `operationIndexParams` is required when calling `operationIndex`.");
1702
- }
1703
- if (!operationIndexParams.operation) {
1704
- throw new Error("Parameter `operationIndexParams.operation` is required when calling `operationIndex`.");
1705
- }
1706
- if (!operationIndexParams.destination) {
1707
- throw new Error("Parameter `operationIndexParams.destination` is required when calling `operationIndex`.");
1708
- }
1606
+ (0, import_client_common.validateRequired)("indexName", "operationIndex", indexName);
1607
+ (0, import_client_common.validateRequired)("operationIndexParams", "operationIndex", operationIndexParams);
1608
+ (0, import_client_common.validateRequired)("operationIndexParams.operation", "operationIndex", operationIndexParams.operation);
1609
+ (0, import_client_common.validateRequired)("operationIndexParams.destination", "operationIndex", operationIndexParams.destination);
1709
1610
  const requestPath = "/1/indexes/{indexName}/operation".replace("{indexName}", encodeURIComponent(indexName));
1710
1611
  const headers = {};
1711
1612
  const queryParameters = {};
@@ -1731,15 +1632,9 @@ function createSearchClient({
1731
1632
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1732
1633
  */
1733
1634
  partialUpdateObject({ indexName, objectID, attributesToUpdate, createIfNotExists }, requestOptions) {
1734
- if (!indexName) {
1735
- throw new Error("Parameter `indexName` is required when calling `partialUpdateObject`.");
1736
- }
1737
- if (!objectID) {
1738
- throw new Error("Parameter `objectID` is required when calling `partialUpdateObject`.");
1739
- }
1740
- if (!attributesToUpdate) {
1741
- throw new Error("Parameter `attributesToUpdate` is required when calling `partialUpdateObject`.");
1742
- }
1635
+ (0, import_client_common.validateRequired)("indexName", "partialUpdateObject", indexName);
1636
+ (0, import_client_common.validateRequired)("objectID", "partialUpdateObject", objectID);
1637
+ (0, import_client_common.validateRequired)("attributesToUpdate", "partialUpdateObject", attributesToUpdate);
1743
1638
  const requestPath = "/1/indexes/{indexName}/{objectID}/partial".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
1744
1639
  const headers = {};
1745
1640
  const queryParameters = {};
@@ -1767,9 +1662,7 @@ function createSearchClient({
1767
1662
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1768
1663
  */
1769
1664
  removeUserId({ userID }, requestOptions) {
1770
- if (!userID) {
1771
- throw new Error("Parameter `userID` is required when calling `removeUserId`.");
1772
- }
1665
+ (0, import_client_common.validateRequired)("userID", "removeUserId", userID);
1773
1666
  const requestPath = "/1/clusters/mapping/{userID}".replace("{userID}", encodeURIComponent(userID));
1774
1667
  const headers = {};
1775
1668
  const queryParameters = {};
@@ -1791,9 +1684,7 @@ function createSearchClient({
1791
1684
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1792
1685
  */
1793
1686
  replaceSources({ source }, requestOptions) {
1794
- if (!source) {
1795
- throw new Error("Parameter `source` is required when calling `replaceSources`.");
1796
- }
1687
+ (0, import_client_common.validateRequired)("source", "replaceSources", source);
1797
1688
  const requestPath = "/1/security/sources";
1798
1689
  const headers = {};
1799
1690
  const queryParameters = {};
@@ -1816,9 +1707,7 @@ function createSearchClient({
1816
1707
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1817
1708
  */
1818
1709
  restoreApiKey({ key }, requestOptions) {
1819
- if (!key) {
1820
- throw new Error("Parameter `key` is required when calling `restoreApiKey`.");
1821
- }
1710
+ (0, import_client_common.validateRequired)("key", "restoreApiKey", key);
1822
1711
  const requestPath = "/1/keys/{key}/restore".replace("{key}", encodeURIComponent(key));
1823
1712
  const headers = {};
1824
1713
  const queryParameters = {};
@@ -1841,12 +1730,8 @@ function createSearchClient({
1841
1730
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1842
1731
  */
1843
1732
  saveObject({ indexName, body }, requestOptions) {
1844
- if (!indexName) {
1845
- throw new Error("Parameter `indexName` is required when calling `saveObject`.");
1846
- }
1847
- if (!body) {
1848
- throw new Error("Parameter `body` is required when calling `saveObject`.");
1849
- }
1733
+ (0, import_client_common.validateRequired)("indexName", "saveObject", indexName);
1734
+ (0, import_client_common.validateRequired)("body", "saveObject", body);
1850
1735
  const requestPath = "/1/indexes/{indexName}".replace("{indexName}", encodeURIComponent(indexName));
1851
1736
  const headers = {};
1852
1737
  const queryParameters = {};
@@ -1872,21 +1757,11 @@ function createSearchClient({
1872
1757
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1873
1758
  */
1874
1759
  saveRule({ indexName, objectID, rule, forwardToReplicas }, requestOptions) {
1875
- if (!indexName) {
1876
- throw new Error("Parameter `indexName` is required when calling `saveRule`.");
1877
- }
1878
- if (!objectID) {
1879
- throw new Error("Parameter `objectID` is required when calling `saveRule`.");
1880
- }
1881
- if (!rule) {
1882
- throw new Error("Parameter `rule` is required when calling `saveRule`.");
1883
- }
1884
- if (!rule.objectID) {
1885
- throw new Error("Parameter `rule.objectID` is required when calling `saveRule`.");
1886
- }
1887
- if (!rule.consequence) {
1888
- throw new Error("Parameter `rule.consequence` is required when calling `saveRule`.");
1889
- }
1760
+ (0, import_client_common.validateRequired)("indexName", "saveRule", indexName);
1761
+ (0, import_client_common.validateRequired)("objectID", "saveRule", objectID);
1762
+ (0, import_client_common.validateRequired)("rule", "saveRule", rule);
1763
+ (0, import_client_common.validateRequired)("rule.objectID", "saveRule", rule.objectID);
1764
+ (0, import_client_common.validateRequired)("rule.consequence", "saveRule", rule.consequence);
1890
1765
  const requestPath = "/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
1891
1766
  const headers = {};
1892
1767
  const queryParameters = {};
@@ -1915,12 +1790,8 @@ function createSearchClient({
1915
1790
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1916
1791
  */
1917
1792
  saveRules({ indexName, rules, forwardToReplicas, clearExistingRules }, requestOptions) {
1918
- if (!indexName) {
1919
- throw new Error("Parameter `indexName` is required when calling `saveRules`.");
1920
- }
1921
- if (!rules) {
1922
- throw new Error("Parameter `rules` is required when calling `saveRules`.");
1923
- }
1793
+ (0, import_client_common.validateRequired)("indexName", "saveRules", indexName);
1794
+ (0, import_client_common.validateRequired)("rules", "saveRules", rules);
1924
1795
  const requestPath = "/1/indexes/{indexName}/rules/batch".replace("{indexName}", encodeURIComponent(indexName));
1925
1796
  const headers = {};
1926
1797
  const queryParameters = {};
@@ -1952,21 +1823,11 @@ function createSearchClient({
1952
1823
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1953
1824
  */
1954
1825
  saveSynonym({ indexName, objectID, synonymHit, forwardToReplicas }, requestOptions) {
1955
- if (!indexName) {
1956
- throw new Error("Parameter `indexName` is required when calling `saveSynonym`.");
1957
- }
1958
- if (!objectID) {
1959
- throw new Error("Parameter `objectID` is required when calling `saveSynonym`.");
1960
- }
1961
- if (!synonymHit) {
1962
- throw new Error("Parameter `synonymHit` is required when calling `saveSynonym`.");
1963
- }
1964
- if (!synonymHit.objectID) {
1965
- throw new Error("Parameter `synonymHit.objectID` is required when calling `saveSynonym`.");
1966
- }
1967
- if (!synonymHit.type) {
1968
- throw new Error("Parameter `synonymHit.type` is required when calling `saveSynonym`.");
1969
- }
1826
+ (0, import_client_common.validateRequired)("indexName", "saveSynonym", indexName);
1827
+ (0, import_client_common.validateRequired)("objectID", "saveSynonym", objectID);
1828
+ (0, import_client_common.validateRequired)("synonymHit", "saveSynonym", synonymHit);
1829
+ (0, import_client_common.validateRequired)("synonymHit.objectID", "saveSynonym", synonymHit.objectID);
1830
+ (0, import_client_common.validateRequired)("synonymHit.type", "saveSynonym", synonymHit.type);
1970
1831
  const requestPath = "/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
1971
1832
  const headers = {};
1972
1833
  const queryParameters = {};
@@ -1995,12 +1856,8 @@ function createSearchClient({
1995
1856
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1996
1857
  */
1997
1858
  saveSynonyms({ indexName, synonymHit, forwardToReplicas, replaceExistingSynonyms }, requestOptions) {
1998
- if (!indexName) {
1999
- throw new Error("Parameter `indexName` is required when calling `saveSynonyms`.");
2000
- }
2001
- if (!synonymHit) {
2002
- throw new Error("Parameter `synonymHit` is required when calling `saveSynonyms`.");
2003
- }
1859
+ (0, import_client_common.validateRequired)("indexName", "saveSynonyms", indexName);
1860
+ (0, import_client_common.validateRequired)("synonymHit", "saveSynonyms", synonymHit);
2004
1861
  const requestPath = "/1/indexes/{indexName}/synonyms/batch".replace("{indexName}", encodeURIComponent(indexName));
2005
1862
  const headers = {};
2006
1863
  const queryParameters = {};
@@ -2049,12 +1906,8 @@ function createSearchClient({
2049
1906
  };
2050
1907
  searchMethodParams = newSignatureRequest;
2051
1908
  }
2052
- if (!searchMethodParams) {
2053
- throw new Error("Parameter `searchMethodParams` is required when calling `search`.");
2054
- }
2055
- if (!searchMethodParams.requests) {
2056
- throw new Error("Parameter `searchMethodParams.requests` is required when calling `search`.");
2057
- }
1909
+ (0, import_client_common.validateRequired)("searchMethodParams", "search", searchMethodParams);
1910
+ (0, import_client_common.validateRequired)("searchMethodParams.requests", "search", searchMethodParams.requests);
2058
1911
  const requestPath = "/1/indexes/*/queries";
2059
1912
  const headers = {};
2060
1913
  const queryParameters = {};
@@ -2080,19 +1933,13 @@ function createSearchClient({
2080
1933
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2081
1934
  */
2082
1935
  searchDictionaryEntries({ dictionaryName, searchDictionaryEntriesParams }, requestOptions) {
2083
- if (!dictionaryName) {
2084
- throw new Error("Parameter `dictionaryName` is required when calling `searchDictionaryEntries`.");
2085
- }
2086
- if (!searchDictionaryEntriesParams) {
2087
- throw new Error(
2088
- "Parameter `searchDictionaryEntriesParams` is required when calling `searchDictionaryEntries`."
2089
- );
2090
- }
2091
- if (!searchDictionaryEntriesParams.query) {
2092
- throw new Error(
2093
- "Parameter `searchDictionaryEntriesParams.query` is required when calling `searchDictionaryEntries`."
2094
- );
2095
- }
1936
+ (0, import_client_common.validateRequired)("dictionaryName", "searchDictionaryEntries", dictionaryName);
1937
+ (0, import_client_common.validateRequired)("searchDictionaryEntriesParams", "searchDictionaryEntries", searchDictionaryEntriesParams);
1938
+ (0, import_client_common.validateRequired)(
1939
+ "searchDictionaryEntriesParams.query",
1940
+ "searchDictionaryEntries",
1941
+ searchDictionaryEntriesParams.query
1942
+ );
2096
1943
  const requestPath = "/1/dictionaries/{dictionaryName}/search".replace(
2097
1944
  "{dictionaryName}",
2098
1945
  encodeURIComponent(dictionaryName)
@@ -2122,12 +1969,8 @@ function createSearchClient({
2122
1969
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2123
1970
  */
2124
1971
  searchForFacetValues({ indexName, facetName, searchForFacetValuesRequest }, requestOptions) {
2125
- if (!indexName) {
2126
- throw new Error("Parameter `indexName` is required when calling `searchForFacetValues`.");
2127
- }
2128
- if (!facetName) {
2129
- throw new Error("Parameter `facetName` is required when calling `searchForFacetValues`.");
2130
- }
1972
+ (0, import_client_common.validateRequired)("indexName", "searchForFacetValues", indexName);
1973
+ (0, import_client_common.validateRequired)("facetName", "searchForFacetValues", facetName);
2131
1974
  const requestPath = "/1/indexes/{indexName}/facets/{facetName}/query".replace("{indexName}", encodeURIComponent(indexName)).replace("{facetName}", encodeURIComponent(facetName));
2132
1975
  const headers = {};
2133
1976
  const queryParameters = {};
@@ -2153,9 +1996,7 @@ function createSearchClient({
2153
1996
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2154
1997
  */
2155
1998
  searchRules({ indexName, searchRulesParams }, requestOptions) {
2156
- if (!indexName) {
2157
- throw new Error("Parameter `indexName` is required when calling `searchRules`.");
2158
- }
1999
+ (0, import_client_common.validateRequired)("indexName", "searchRules", indexName);
2159
2000
  const requestPath = "/1/indexes/{indexName}/rules/search".replace("{indexName}", encodeURIComponent(indexName));
2160
2001
  const headers = {};
2161
2002
  const queryParameters = {};
@@ -2181,9 +2022,7 @@ function createSearchClient({
2181
2022
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2182
2023
  */
2183
2024
  searchSingleIndex({ indexName, searchParams }, requestOptions) {
2184
- if (!indexName) {
2185
- throw new Error("Parameter `indexName` is required when calling `searchSingleIndex`.");
2186
- }
2025
+ (0, import_client_common.validateRequired)("indexName", "searchSingleIndex", indexName);
2187
2026
  const requestPath = "/1/indexes/{indexName}/query".replace("{indexName}", encodeURIComponent(indexName));
2188
2027
  const headers = {};
2189
2028
  const queryParameters = {};
@@ -2209,9 +2048,7 @@ function createSearchClient({
2209
2048
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2210
2049
  */
2211
2050
  searchSynonyms({ indexName, searchSynonymsParams }, requestOptions) {
2212
- if (!indexName) {
2213
- throw new Error("Parameter `indexName` is required when calling `searchSynonyms`.");
2214
- }
2051
+ (0, import_client_common.validateRequired)("indexName", "searchSynonyms", indexName);
2215
2052
  const requestPath = "/1/indexes/{indexName}/synonyms/search".replace(
2216
2053
  "{indexName}",
2217
2054
  encodeURIComponent(indexName)
@@ -2240,12 +2077,8 @@ function createSearchClient({
2240
2077
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2241
2078
  */
2242
2079
  searchUserIds(searchUserIdsParams, requestOptions) {
2243
- if (!searchUserIdsParams) {
2244
- throw new Error("Parameter `searchUserIdsParams` is required when calling `searchUserIds`.");
2245
- }
2246
- if (!searchUserIdsParams.query) {
2247
- throw new Error("Parameter `searchUserIdsParams.query` is required when calling `searchUserIds`.");
2248
- }
2080
+ (0, import_client_common.validateRequired)("searchUserIdsParams", "searchUserIds", searchUserIdsParams);
2081
+ (0, import_client_common.validateRequired)("searchUserIdsParams.query", "searchUserIds", searchUserIdsParams.query);
2249
2082
  const requestPath = "/1/clusters/mapping/search";
2250
2083
  const headers = {};
2251
2084
  const queryParameters = {};
@@ -2269,14 +2102,12 @@ function createSearchClient({
2269
2102
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2270
2103
  */
2271
2104
  setDictionarySettings(dictionarySettingsParams, requestOptions) {
2272
- if (!dictionarySettingsParams) {
2273
- throw new Error("Parameter `dictionarySettingsParams` is required when calling `setDictionarySettings`.");
2274
- }
2275
- if (!dictionarySettingsParams.disableStandardEntries) {
2276
- throw new Error(
2277
- "Parameter `dictionarySettingsParams.disableStandardEntries` is required when calling `setDictionarySettings`."
2278
- );
2279
- }
2105
+ (0, import_client_common.validateRequired)("dictionarySettingsParams", "setDictionarySettings", dictionarySettingsParams);
2106
+ (0, import_client_common.validateRequired)(
2107
+ "dictionarySettingsParams.disableStandardEntries",
2108
+ "setDictionarySettings",
2109
+ dictionarySettingsParams.disableStandardEntries
2110
+ );
2280
2111
  const requestPath = "/1/dictionaries/*/settings";
2281
2112
  const headers = {};
2282
2113
  const queryParameters = {};
@@ -2301,12 +2132,8 @@ function createSearchClient({
2301
2132
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2302
2133
  */
2303
2134
  setSettings({ indexName, indexSettings, forwardToReplicas }, requestOptions) {
2304
- if (!indexName) {
2305
- throw new Error("Parameter `indexName` is required when calling `setSettings`.");
2306
- }
2307
- if (!indexSettings) {
2308
- throw new Error("Parameter `indexSettings` is required when calling `setSettings`.");
2309
- }
2135
+ (0, import_client_common.validateRequired)("indexName", "setSettings", indexName);
2136
+ (0, import_client_common.validateRequired)("indexSettings", "setSettings", indexSettings);
2310
2137
  const requestPath = "/1/indexes/{indexName}/settings".replace("{indexName}", encodeURIComponent(indexName));
2311
2138
  const headers = {};
2312
2139
  const queryParameters = {};
@@ -2333,15 +2160,9 @@ function createSearchClient({
2333
2160
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2334
2161
  */
2335
2162
  updateApiKey({ key, apiKey }, requestOptions) {
2336
- if (!key) {
2337
- throw new Error("Parameter `key` is required when calling `updateApiKey`.");
2338
- }
2339
- if (!apiKey) {
2340
- throw new Error("Parameter `apiKey` is required when calling `updateApiKey`.");
2341
- }
2342
- if (!apiKey.acl) {
2343
- throw new Error("Parameter `apiKey.acl` is required when calling `updateApiKey`.");
2344
- }
2163
+ (0, import_client_common.validateRequired)("key", "updateApiKey", key);
2164
+ (0, import_client_common.validateRequired)("apiKey", "updateApiKey", apiKey);
2165
+ (0, import_client_common.validateRequired)("apiKey.acl", "updateApiKey", apiKey.acl);
2345
2166
  const requestPath = "/1/keys/{key}".replace("{key}", encodeURIComponent(key));
2346
2167
  const headers = {};
2347
2168
  const queryParameters = {};