@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.
- package/README.md +4 -4
- package/dist/browser.d.ts +88 -14
- package/dist/builds/browser.js +145 -323
- package/dist/builds/browser.js.map +1 -1
- package/dist/builds/browser.min.js +5 -1
- package/dist/builds/browser.min.js.map +1 -1
- package/dist/builds/browser.umd.js +7 -3
- package/dist/builds/fetch.js +149 -325
- package/dist/builds/fetch.js.map +1 -1
- package/dist/builds/node.cjs +147 -324
- package/dist/builds/node.cjs.map +1 -1
- package/dist/builds/node.js +149 -325
- package/dist/builds/node.js.map +1 -1
- package/dist/builds/worker.js +145 -323
- package/dist/builds/worker.js.map +1 -1
- package/dist/fetch.d.ts +88 -14
- package/dist/node.d.cts +88 -14
- package/dist/node.d.ts +88 -14
- package/dist/src/searchClient.cjs +143 -322
- package/dist/src/searchClient.cjs.map +1 -1
- package/dist/src/searchClient.js +147 -328
- package/dist/src/searchClient.js.map +1 -1
- package/dist/worker.d.ts +88 -14
- package/package.json +9 -9
package/dist/builds/fetch.js
CHANGED
|
@@ -20,9 +20,10 @@ import {
|
|
|
20
20
|
createIterablePromise,
|
|
21
21
|
createTransporter,
|
|
22
22
|
getAlgoliaAgent,
|
|
23
|
-
shuffle
|
|
23
|
+
shuffle,
|
|
24
|
+
validateRequired
|
|
24
25
|
} from "@algolia/client-common";
|
|
25
|
-
var apiClientVersion = "5.
|
|
26
|
+
var apiClientVersion = "5.54.0";
|
|
26
27
|
function getDefaultHosts(appId) {
|
|
27
28
|
return [
|
|
28
29
|
{
|
|
@@ -356,9 +357,17 @@ function createSearchClient({
|
|
|
356
357
|
* @param chunkedBatch.action - The `batch` `action` to perform on the given array of `objects`, defaults to `addObject`.
|
|
357
358
|
* @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.
|
|
358
359
|
* @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.
|
|
360
|
+
* @param chunkedBatch.maxRetries - The maximum number of retries when polling for task completion. 100 by default.
|
|
359
361
|
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `getTask` method and merged with the transporter requestOptions.
|
|
360
362
|
*/
|
|
361
|
-
async chunkedBatch({
|
|
363
|
+
async chunkedBatch({
|
|
364
|
+
indexName,
|
|
365
|
+
objects,
|
|
366
|
+
action = "addObject",
|
|
367
|
+
waitForTasks,
|
|
368
|
+
batchSize = 1e3,
|
|
369
|
+
maxRetries = 100
|
|
370
|
+
}, requestOptions) {
|
|
362
371
|
let requests = [];
|
|
363
372
|
const responses = [];
|
|
364
373
|
const objectEntries = objects.entries();
|
|
@@ -371,7 +380,7 @@ function createSearchClient({
|
|
|
371
380
|
}
|
|
372
381
|
if (waitForTasks) {
|
|
373
382
|
for (const resp of responses) {
|
|
374
|
-
await this.waitForTask({ indexName, taskID: resp.taskID });
|
|
383
|
+
await this.waitForTask({ indexName, taskID: resp.taskID, maxRetries });
|
|
375
384
|
}
|
|
376
385
|
}
|
|
377
386
|
return responses;
|
|
@@ -385,11 +394,12 @@ function createSearchClient({
|
|
|
385
394
|
* @param saveObjects.objects - The array of `objects` to store in the given Algolia `indexName`.
|
|
386
395
|
* @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.
|
|
387
396
|
* @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.
|
|
397
|
+
* @param saveObjects.maxRetries - The maximum number of retries when polling for task completion. 100 by default.
|
|
388
398
|
* @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
399
|
*/
|
|
390
|
-
async saveObjects({ indexName, objects, waitForTasks, batchSize }, requestOptions) {
|
|
400
|
+
async saveObjects({ indexName, objects, waitForTasks, batchSize, maxRetries }, requestOptions) {
|
|
391
401
|
return await this.chunkedBatch(
|
|
392
|
-
{ indexName, objects, action: "addObject", waitForTasks, batchSize },
|
|
402
|
+
{ indexName, objects, action: "addObject", waitForTasks, batchSize, maxRetries },
|
|
393
403
|
requestOptions
|
|
394
404
|
);
|
|
395
405
|
},
|
|
@@ -402,16 +412,18 @@ function createSearchClient({
|
|
|
402
412
|
* @param deleteObjects.objectIDs - The objectIDs to delete.
|
|
403
413
|
* @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.
|
|
404
414
|
* @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.
|
|
415
|
+
* @param deleteObjects.maxRetries - The maximum number of retries when polling for task completion. 100 by default.
|
|
405
416
|
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `batch` method and merged with the transporter requestOptions.
|
|
406
417
|
*/
|
|
407
|
-
async deleteObjects({ indexName, objectIDs, waitForTasks, batchSize }, requestOptions) {
|
|
418
|
+
async deleteObjects({ indexName, objectIDs, waitForTasks, batchSize, maxRetries }, requestOptions) {
|
|
408
419
|
return await this.chunkedBatch(
|
|
409
420
|
{
|
|
410
421
|
indexName,
|
|
411
422
|
objects: objectIDs.map((objectID) => ({ objectID })),
|
|
412
423
|
action: "deleteObject",
|
|
413
424
|
waitForTasks,
|
|
414
|
-
batchSize
|
|
425
|
+
batchSize,
|
|
426
|
+
maxRetries
|
|
415
427
|
},
|
|
416
428
|
requestOptions
|
|
417
429
|
);
|
|
@@ -426,16 +438,18 @@ function createSearchClient({
|
|
|
426
438
|
* @param partialUpdateObjects.createIfNotExists - To be provided if non-existing objects are passed, otherwise, the call will fail.
|
|
427
439
|
* @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.
|
|
428
440
|
* @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.
|
|
441
|
+
* @param partialUpdateObjects.maxRetries - The maximum number of retries when polling for task completion. 100 by default.
|
|
429
442
|
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `getTask` method and merged with the transporter requestOptions.
|
|
430
443
|
*/
|
|
431
|
-
async partialUpdateObjects({ indexName, objects, createIfNotExists, waitForTasks, batchSize }, requestOptions) {
|
|
444
|
+
async partialUpdateObjects({ indexName, objects, createIfNotExists, waitForTasks, batchSize, maxRetries }, requestOptions) {
|
|
432
445
|
return await this.chunkedBatch(
|
|
433
446
|
{
|
|
434
447
|
indexName,
|
|
435
448
|
objects,
|
|
436
449
|
action: createIfNotExists ? "partialUpdateObject" : "partialUpdateObjectNoCreate",
|
|
437
450
|
batchSize,
|
|
438
|
-
waitForTasks
|
|
451
|
+
waitForTasks,
|
|
452
|
+
maxRetries
|
|
439
453
|
},
|
|
440
454
|
requestOptions
|
|
441
455
|
);
|
|
@@ -450,9 +464,10 @@ function createSearchClient({
|
|
|
450
464
|
* @param replaceAllObjects.objects - The array of `objects` to store in the given Algolia `indexName`.
|
|
451
465
|
* @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.
|
|
452
466
|
* @param replaceAllObjects.scopes - The `scopes` to keep from the index. Defaults to ['settings', 'rules', 'synonyms'].
|
|
467
|
+
* @param replaceAllObjects.maxRetries - The maximum number of retries when polling for task completion. 100 by default.
|
|
453
468
|
* @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.
|
|
454
469
|
*/
|
|
455
|
-
async replaceAllObjects({ indexName, objects, batchSize, scopes }, requestOptions) {
|
|
470
|
+
async replaceAllObjects({ indexName, objects, batchSize, scopes, maxRetries = 100 }, requestOptions) {
|
|
456
471
|
const randomSuffix = Math.floor(Math.random() * 1e6) + 1e5;
|
|
457
472
|
const tmpIndexName = `${indexName}_tmp_${randomSuffix}`;
|
|
458
473
|
if (scopes === void 0) {
|
|
@@ -471,12 +486,13 @@ function createSearchClient({
|
|
|
471
486
|
requestOptions
|
|
472
487
|
);
|
|
473
488
|
const batchResponses = await this.chunkedBatch(
|
|
474
|
-
{ indexName: tmpIndexName, objects, waitForTasks: true, batchSize },
|
|
489
|
+
{ indexName: tmpIndexName, objects, waitForTasks: true, batchSize, maxRetries },
|
|
475
490
|
requestOptions
|
|
476
491
|
);
|
|
477
492
|
await this.waitForTask({
|
|
478
493
|
indexName: tmpIndexName,
|
|
479
|
-
taskID: copyOperationResponse.taskID
|
|
494
|
+
taskID: copyOperationResponse.taskID,
|
|
495
|
+
maxRetries
|
|
480
496
|
});
|
|
481
497
|
copyOperationResponse = await this.operationIndex(
|
|
482
498
|
{
|
|
@@ -491,7 +507,8 @@ function createSearchClient({
|
|
|
491
507
|
);
|
|
492
508
|
await this.waitForTask({
|
|
493
509
|
indexName: tmpIndexName,
|
|
494
|
-
taskID: copyOperationResponse.taskID
|
|
510
|
+
taskID: copyOperationResponse.taskID,
|
|
511
|
+
maxRetries
|
|
495
512
|
});
|
|
496
513
|
const moveOperationResponse = await this.operationIndex(
|
|
497
514
|
{
|
|
@@ -502,7 +519,8 @@ function createSearchClient({
|
|
|
502
519
|
);
|
|
503
520
|
await this.waitForTask({
|
|
504
521
|
indexName: tmpIndexName,
|
|
505
|
-
taskID: moveOperationResponse.taskID
|
|
522
|
+
taskID: moveOperationResponse.taskID,
|
|
523
|
+
maxRetries
|
|
506
524
|
});
|
|
507
525
|
return { copyOperationResponse, batchResponses, moveOperationResponse };
|
|
508
526
|
} catch (error) {
|
|
@@ -552,12 +570,8 @@ function createSearchClient({
|
|
|
552
570
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
553
571
|
*/
|
|
554
572
|
addApiKey(apiKey, requestOptions) {
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
}
|
|
558
|
-
if (!apiKey.acl) {
|
|
559
|
-
throw new Error("Parameter `apiKey.acl` is required when calling `addApiKey`.");
|
|
560
|
-
}
|
|
573
|
+
validateRequired("apiKey", "addApiKey", apiKey);
|
|
574
|
+
validateRequired("apiKey.acl", "addApiKey", apiKey.acl);
|
|
561
575
|
const requestPath = "/1/keys";
|
|
562
576
|
const headers = {};
|
|
563
577
|
const queryParameters = {};
|
|
@@ -582,15 +596,9 @@ function createSearchClient({
|
|
|
582
596
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
583
597
|
*/
|
|
584
598
|
addOrUpdateObject({ indexName, objectID, body }, requestOptions) {
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
if (!objectID) {
|
|
589
|
-
throw new Error("Parameter `objectID` is required when calling `addOrUpdateObject`.");
|
|
590
|
-
}
|
|
591
|
-
if (!body) {
|
|
592
|
-
throw new Error("Parameter `body` is required when calling `addOrUpdateObject`.");
|
|
593
|
-
}
|
|
599
|
+
validateRequired("indexName", "addOrUpdateObject", indexName);
|
|
600
|
+
validateRequired("objectID", "addOrUpdateObject", objectID);
|
|
601
|
+
validateRequired("body", "addOrUpdateObject", body);
|
|
594
602
|
const requestPath = "/1/indexes/{indexName}/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
|
|
595
603
|
const headers = {};
|
|
596
604
|
const queryParameters = {};
|
|
@@ -612,12 +620,8 @@ function createSearchClient({
|
|
|
612
620
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
613
621
|
*/
|
|
614
622
|
appendSource(source, requestOptions) {
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
}
|
|
618
|
-
if (!source.source) {
|
|
619
|
-
throw new Error("Parameter `source.source` is required when calling `appendSource`.");
|
|
620
|
-
}
|
|
623
|
+
validateRequired("source", "appendSource", source);
|
|
624
|
+
validateRequired("source.source", "appendSource", source.source);
|
|
621
625
|
const requestPath = "/1/security/sources/append";
|
|
622
626
|
const headers = {};
|
|
623
627
|
const queryParameters = {};
|
|
@@ -643,15 +647,9 @@ function createSearchClient({
|
|
|
643
647
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
644
648
|
*/
|
|
645
649
|
assignUserId({ xAlgoliaUserID, assignUserIdParams }, requestOptions) {
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
if (!assignUserIdParams) {
|
|
650
|
-
throw new Error("Parameter `assignUserIdParams` is required when calling `assignUserId`.");
|
|
651
|
-
}
|
|
652
|
-
if (!assignUserIdParams.cluster) {
|
|
653
|
-
throw new Error("Parameter `assignUserIdParams.cluster` is required when calling `assignUserId`.");
|
|
654
|
-
}
|
|
650
|
+
validateRequired("xAlgoliaUserID", "assignUserId", xAlgoliaUserID);
|
|
651
|
+
validateRequired("assignUserIdParams", "assignUserId", assignUserIdParams);
|
|
652
|
+
validateRequired("assignUserIdParams.cluster", "assignUserId", assignUserIdParams.cluster);
|
|
655
653
|
const requestPath = "/1/clusters/mapping";
|
|
656
654
|
const headers = {};
|
|
657
655
|
const queryParameters = {};
|
|
@@ -678,15 +676,9 @@ function createSearchClient({
|
|
|
678
676
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
679
677
|
*/
|
|
680
678
|
batch({ indexName, batchWriteParams }, requestOptions) {
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
if (!batchWriteParams) {
|
|
685
|
-
throw new Error("Parameter `batchWriteParams` is required when calling `batch`.");
|
|
686
|
-
}
|
|
687
|
-
if (!batchWriteParams.requests) {
|
|
688
|
-
throw new Error("Parameter `batchWriteParams.requests` is required when calling `batch`.");
|
|
689
|
-
}
|
|
679
|
+
validateRequired("indexName", "batch", indexName);
|
|
680
|
+
validateRequired("batchWriteParams", "batch", batchWriteParams);
|
|
681
|
+
validateRequired("batchWriteParams.requests", "batch", batchWriteParams.requests);
|
|
690
682
|
const requestPath = "/1/indexes/{indexName}/batch".replace("{indexName}", encodeURIComponent(indexName));
|
|
691
683
|
const headers = {};
|
|
692
684
|
const queryParameters = {};
|
|
@@ -712,18 +704,10 @@ function createSearchClient({
|
|
|
712
704
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
713
705
|
*/
|
|
714
706
|
batchAssignUserIds({ xAlgoliaUserID, batchAssignUserIdsParams }, requestOptions) {
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
throw new Error("Parameter `batchAssignUserIdsParams` is required when calling `batchAssignUserIds`.");
|
|
720
|
-
}
|
|
721
|
-
if (!batchAssignUserIdsParams.cluster) {
|
|
722
|
-
throw new Error("Parameter `batchAssignUserIdsParams.cluster` is required when calling `batchAssignUserIds`.");
|
|
723
|
-
}
|
|
724
|
-
if (!batchAssignUserIdsParams.users) {
|
|
725
|
-
throw new Error("Parameter `batchAssignUserIdsParams.users` is required when calling `batchAssignUserIds`.");
|
|
726
|
-
}
|
|
707
|
+
validateRequired("xAlgoliaUserID", "batchAssignUserIds", xAlgoliaUserID);
|
|
708
|
+
validateRequired("batchAssignUserIdsParams", "batchAssignUserIds", batchAssignUserIdsParams);
|
|
709
|
+
validateRequired("batchAssignUserIdsParams.cluster", "batchAssignUserIds", batchAssignUserIdsParams.cluster);
|
|
710
|
+
validateRequired("batchAssignUserIdsParams.users", "batchAssignUserIds", batchAssignUserIdsParams.users);
|
|
727
711
|
const requestPath = "/1/clusters/mapping/batch";
|
|
728
712
|
const headers = {};
|
|
729
713
|
const queryParameters = {};
|
|
@@ -750,17 +734,13 @@ function createSearchClient({
|
|
|
750
734
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
751
735
|
*/
|
|
752
736
|
batchDictionaryEntries({ dictionaryName, batchDictionaryEntriesParams }, requestOptions) {
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
throw new Error(
|
|
761
|
-
"Parameter `batchDictionaryEntriesParams.requests` is required when calling `batchDictionaryEntries`."
|
|
762
|
-
);
|
|
763
|
-
}
|
|
737
|
+
validateRequired("dictionaryName", "batchDictionaryEntries", dictionaryName);
|
|
738
|
+
validateRequired("batchDictionaryEntriesParams", "batchDictionaryEntries", batchDictionaryEntriesParams);
|
|
739
|
+
validateRequired(
|
|
740
|
+
"batchDictionaryEntriesParams.requests",
|
|
741
|
+
"batchDictionaryEntries",
|
|
742
|
+
batchDictionaryEntriesParams.requests
|
|
743
|
+
);
|
|
764
744
|
const requestPath = "/1/dictionaries/{dictionaryName}/batch".replace(
|
|
765
745
|
"{dictionaryName}",
|
|
766
746
|
encodeURIComponent(dictionaryName)
|
|
@@ -787,9 +767,7 @@ function createSearchClient({
|
|
|
787
767
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
788
768
|
*/
|
|
789
769
|
browse({ indexName, browseParams }, requestOptions) {
|
|
790
|
-
|
|
791
|
-
throw new Error("Parameter `indexName` is required when calling `browse`.");
|
|
792
|
-
}
|
|
770
|
+
validateRequired("indexName", "browse", indexName);
|
|
793
771
|
const requestPath = "/1/indexes/{indexName}/browse".replace("{indexName}", encodeURIComponent(indexName));
|
|
794
772
|
const headers = {};
|
|
795
773
|
const queryParameters = {};
|
|
@@ -813,9 +791,7 @@ function createSearchClient({
|
|
|
813
791
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
814
792
|
*/
|
|
815
793
|
clearObjects({ indexName }, requestOptions) {
|
|
816
|
-
|
|
817
|
-
throw new Error("Parameter `indexName` is required when calling `clearObjects`.");
|
|
818
|
-
}
|
|
794
|
+
validateRequired("indexName", "clearObjects", indexName);
|
|
819
795
|
const requestPath = "/1/indexes/{indexName}/clear".replace("{indexName}", encodeURIComponent(indexName));
|
|
820
796
|
const headers = {};
|
|
821
797
|
const queryParameters = {};
|
|
@@ -838,9 +814,7 @@ function createSearchClient({
|
|
|
838
814
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
839
815
|
*/
|
|
840
816
|
clearRules({ indexName, forwardToReplicas }, requestOptions) {
|
|
841
|
-
|
|
842
|
-
throw new Error("Parameter `indexName` is required when calling `clearRules`.");
|
|
843
|
-
}
|
|
817
|
+
validateRequired("indexName", "clearRules", indexName);
|
|
844
818
|
const requestPath = "/1/indexes/{indexName}/rules/clear".replace("{indexName}", encodeURIComponent(indexName));
|
|
845
819
|
const headers = {};
|
|
846
820
|
const queryParameters = {};
|
|
@@ -866,9 +840,7 @@ function createSearchClient({
|
|
|
866
840
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
867
841
|
*/
|
|
868
842
|
clearSynonyms({ indexName, forwardToReplicas }, requestOptions) {
|
|
869
|
-
|
|
870
|
-
throw new Error("Parameter `indexName` is required when calling `clearSynonyms`.");
|
|
871
|
-
}
|
|
843
|
+
validateRequired("indexName", "clearSynonyms", indexName);
|
|
872
844
|
const requestPath = "/1/indexes/{indexName}/synonyms/clear".replace("{indexName}", encodeURIComponent(indexName));
|
|
873
845
|
const headers = {};
|
|
874
846
|
const queryParameters = {};
|
|
@@ -891,9 +863,7 @@ function createSearchClient({
|
|
|
891
863
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
892
864
|
*/
|
|
893
865
|
customDelete({ path, parameters }, requestOptions) {
|
|
894
|
-
|
|
895
|
-
throw new Error("Parameter `path` is required when calling `customDelete`.");
|
|
896
|
-
}
|
|
866
|
+
validateRequired("path", "customDelete", path);
|
|
897
867
|
const requestPath = "/{path}".replace("{path}", path);
|
|
898
868
|
const headers = {};
|
|
899
869
|
const queryParameters = parameters ? parameters : {};
|
|
@@ -913,9 +883,7 @@ function createSearchClient({
|
|
|
913
883
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
914
884
|
*/
|
|
915
885
|
customGet({ path, parameters }, requestOptions) {
|
|
916
|
-
|
|
917
|
-
throw new Error("Parameter `path` is required when calling `customGet`.");
|
|
918
|
-
}
|
|
886
|
+
validateRequired("path", "customGet", path);
|
|
919
887
|
const requestPath = "/{path}".replace("{path}", path);
|
|
920
888
|
const headers = {};
|
|
921
889
|
const queryParameters = parameters ? parameters : {};
|
|
@@ -936,9 +904,7 @@ function createSearchClient({
|
|
|
936
904
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
937
905
|
*/
|
|
938
906
|
customPost({ path, parameters, body }, requestOptions) {
|
|
939
|
-
|
|
940
|
-
throw new Error("Parameter `path` is required when calling `customPost`.");
|
|
941
|
-
}
|
|
907
|
+
validateRequired("path", "customPost", path);
|
|
942
908
|
const requestPath = "/{path}".replace("{path}", path);
|
|
943
909
|
const headers = {};
|
|
944
910
|
const queryParameters = parameters ? parameters : {};
|
|
@@ -960,9 +926,7 @@ function createSearchClient({
|
|
|
960
926
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
961
927
|
*/
|
|
962
928
|
customPut({ path, parameters, body }, requestOptions) {
|
|
963
|
-
|
|
964
|
-
throw new Error("Parameter `path` is required when calling `customPut`.");
|
|
965
|
-
}
|
|
929
|
+
validateRequired("path", "customPut", path);
|
|
966
930
|
const requestPath = "/{path}".replace("{path}", path);
|
|
967
931
|
const headers = {};
|
|
968
932
|
const queryParameters = parameters ? parameters : {};
|
|
@@ -985,9 +949,7 @@ function createSearchClient({
|
|
|
985
949
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
986
950
|
*/
|
|
987
951
|
deleteApiKey({ key }, requestOptions) {
|
|
988
|
-
|
|
989
|
-
throw new Error("Parameter `key` is required when calling `deleteApiKey`.");
|
|
990
|
-
}
|
|
952
|
+
validateRequired("key", "deleteApiKey", key);
|
|
991
953
|
const requestPath = "/1/keys/{key}".replace("{key}", encodeURIComponent(key));
|
|
992
954
|
const headers = {};
|
|
993
955
|
const queryParameters = {};
|
|
@@ -1010,12 +972,8 @@ function createSearchClient({
|
|
|
1010
972
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1011
973
|
*/
|
|
1012
974
|
deleteBy({ indexName, deleteByParams }, requestOptions) {
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
}
|
|
1016
|
-
if (!deleteByParams) {
|
|
1017
|
-
throw new Error("Parameter `deleteByParams` is required when calling `deleteBy`.");
|
|
1018
|
-
}
|
|
975
|
+
validateRequired("indexName", "deleteBy", indexName);
|
|
976
|
+
validateRequired("deleteByParams", "deleteBy", deleteByParams);
|
|
1019
977
|
const requestPath = "/1/indexes/{indexName}/deleteByQuery".replace("{indexName}", encodeURIComponent(indexName));
|
|
1020
978
|
const headers = {};
|
|
1021
979
|
const queryParameters = {};
|
|
@@ -1038,9 +996,7 @@ function createSearchClient({
|
|
|
1038
996
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1039
997
|
*/
|
|
1040
998
|
deleteIndex({ indexName }, requestOptions) {
|
|
1041
|
-
|
|
1042
|
-
throw new Error("Parameter `indexName` is required when calling `deleteIndex`.");
|
|
1043
|
-
}
|
|
999
|
+
validateRequired("indexName", "deleteIndex", indexName);
|
|
1044
1000
|
const requestPath = "/1/indexes/{indexName}".replace("{indexName}", encodeURIComponent(indexName));
|
|
1045
1001
|
const headers = {};
|
|
1046
1002
|
const queryParameters = {};
|
|
@@ -1063,12 +1019,8 @@ function createSearchClient({
|
|
|
1063
1019
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1064
1020
|
*/
|
|
1065
1021
|
deleteObject({ indexName, objectID }, requestOptions) {
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
}
|
|
1069
|
-
if (!objectID) {
|
|
1070
|
-
throw new Error("Parameter `objectID` is required when calling `deleteObject`.");
|
|
1071
|
-
}
|
|
1022
|
+
validateRequired("indexName", "deleteObject", indexName);
|
|
1023
|
+
validateRequired("objectID", "deleteObject", objectID);
|
|
1072
1024
|
const requestPath = "/1/indexes/{indexName}/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
|
|
1073
1025
|
const headers = {};
|
|
1074
1026
|
const queryParameters = {};
|
|
@@ -1092,12 +1044,8 @@ function createSearchClient({
|
|
|
1092
1044
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1093
1045
|
*/
|
|
1094
1046
|
deleteRule({ indexName, objectID, forwardToReplicas }, requestOptions) {
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
}
|
|
1098
|
-
if (!objectID) {
|
|
1099
|
-
throw new Error("Parameter `objectID` is required when calling `deleteRule`.");
|
|
1100
|
-
}
|
|
1047
|
+
validateRequired("indexName", "deleteRule", indexName);
|
|
1048
|
+
validateRequired("objectID", "deleteRule", objectID);
|
|
1101
1049
|
const requestPath = "/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
|
|
1102
1050
|
const headers = {};
|
|
1103
1051
|
const queryParameters = {};
|
|
@@ -1122,9 +1070,7 @@ function createSearchClient({
|
|
|
1122
1070
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1123
1071
|
*/
|
|
1124
1072
|
deleteSource({ source }, requestOptions) {
|
|
1125
|
-
|
|
1126
|
-
throw new Error("Parameter `source` is required when calling `deleteSource`.");
|
|
1127
|
-
}
|
|
1073
|
+
validateRequired("source", "deleteSource", source);
|
|
1128
1074
|
const requestPath = "/1/security/sources/{source}".replace("{source}", encodeURIComponent(source));
|
|
1129
1075
|
const headers = {};
|
|
1130
1076
|
const queryParameters = {};
|
|
@@ -1148,12 +1094,8 @@ function createSearchClient({
|
|
|
1148
1094
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1149
1095
|
*/
|
|
1150
1096
|
deleteSynonym({ indexName, objectID, forwardToReplicas }, requestOptions) {
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
}
|
|
1154
|
-
if (!objectID) {
|
|
1155
|
-
throw new Error("Parameter `objectID` is required when calling `deleteSynonym`.");
|
|
1156
|
-
}
|
|
1097
|
+
validateRequired("indexName", "deleteSynonym", indexName);
|
|
1098
|
+
validateRequired("objectID", "deleteSynonym", objectID);
|
|
1157
1099
|
const requestPath = "/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
|
|
1158
1100
|
const headers = {};
|
|
1159
1101
|
const queryParameters = {};
|
|
@@ -1178,9 +1120,7 @@ function createSearchClient({
|
|
|
1178
1120
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1179
1121
|
*/
|
|
1180
1122
|
getApiKey({ key }, requestOptions) {
|
|
1181
|
-
|
|
1182
|
-
throw new Error("Parameter `key` is required when calling `getApiKey`.");
|
|
1183
|
-
}
|
|
1123
|
+
validateRequired("key", "getApiKey", key);
|
|
1184
1124
|
const requestPath = "/1/keys/{key}".replace("{key}", encodeURIComponent(key));
|
|
1185
1125
|
const headers = {};
|
|
1186
1126
|
const queryParameters = {};
|
|
@@ -1202,9 +1142,7 @@ function createSearchClient({
|
|
|
1202
1142
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1203
1143
|
*/
|
|
1204
1144
|
getAppTask({ taskID }, requestOptions) {
|
|
1205
|
-
|
|
1206
|
-
throw new Error("Parameter `taskID` is required when calling `getAppTask`.");
|
|
1207
|
-
}
|
|
1145
|
+
validateRequired("taskID", "getAppTask", taskID);
|
|
1208
1146
|
const requestPath = "/1/task/{taskID}".replace("{taskID}", encodeURIComponent(taskID));
|
|
1209
1147
|
const headers = {};
|
|
1210
1148
|
const queryParameters = {};
|
|
@@ -1302,12 +1240,8 @@ function createSearchClient({
|
|
|
1302
1240
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1303
1241
|
*/
|
|
1304
1242
|
getObject({ indexName, objectID, attributesToRetrieve }, requestOptions) {
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
}
|
|
1308
|
-
if (!objectID) {
|
|
1309
|
-
throw new Error("Parameter `objectID` is required when calling `getObject`.");
|
|
1310
|
-
}
|
|
1243
|
+
validateRequired("indexName", "getObject", indexName);
|
|
1244
|
+
validateRequired("objectID", "getObject", objectID);
|
|
1311
1245
|
const requestPath = "/1/indexes/{indexName}/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
|
|
1312
1246
|
const headers = {};
|
|
1313
1247
|
const queryParameters = {};
|
|
@@ -1331,12 +1265,8 @@ function createSearchClient({
|
|
|
1331
1265
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1332
1266
|
*/
|
|
1333
1267
|
getObjects(getObjectsParams, requestOptions) {
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
}
|
|
1337
|
-
if (!getObjectsParams.requests) {
|
|
1338
|
-
throw new Error("Parameter `getObjectsParams.requests` is required when calling `getObjects`.");
|
|
1339
|
-
}
|
|
1268
|
+
validateRequired("getObjectsParams", "getObjects", getObjectsParams);
|
|
1269
|
+
validateRequired("getObjectsParams.requests", "getObjects", getObjectsParams.requests);
|
|
1340
1270
|
const requestPath = "/1/indexes/*/objects";
|
|
1341
1271
|
const headers = {};
|
|
1342
1272
|
const queryParameters = {};
|
|
@@ -1362,12 +1292,8 @@ function createSearchClient({
|
|
|
1362
1292
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1363
1293
|
*/
|
|
1364
1294
|
getRule({ indexName, objectID }, requestOptions) {
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
}
|
|
1368
|
-
if (!objectID) {
|
|
1369
|
-
throw new Error("Parameter `objectID` is required when calling `getRule`.");
|
|
1370
|
-
}
|
|
1295
|
+
validateRequired("indexName", "getRule", indexName);
|
|
1296
|
+
validateRequired("objectID", "getRule", objectID);
|
|
1371
1297
|
const requestPath = "/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
|
|
1372
1298
|
const headers = {};
|
|
1373
1299
|
const queryParameters = {};
|
|
@@ -1390,9 +1316,7 @@ function createSearchClient({
|
|
|
1390
1316
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1391
1317
|
*/
|
|
1392
1318
|
getSettings({ indexName, getVersion }, requestOptions) {
|
|
1393
|
-
|
|
1394
|
-
throw new Error("Parameter `indexName` is required when calling `getSettings`.");
|
|
1395
|
-
}
|
|
1319
|
+
validateRequired("indexName", "getSettings", indexName);
|
|
1396
1320
|
const requestPath = "/1/indexes/{indexName}/settings".replace("{indexName}", encodeURIComponent(indexName));
|
|
1397
1321
|
const headers = {};
|
|
1398
1322
|
const queryParameters = {};
|
|
@@ -1437,12 +1361,8 @@ function createSearchClient({
|
|
|
1437
1361
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1438
1362
|
*/
|
|
1439
1363
|
getSynonym({ indexName, objectID }, requestOptions) {
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
}
|
|
1443
|
-
if (!objectID) {
|
|
1444
|
-
throw new Error("Parameter `objectID` is required when calling `getSynonym`.");
|
|
1445
|
-
}
|
|
1364
|
+
validateRequired("indexName", "getSynonym", indexName);
|
|
1365
|
+
validateRequired("objectID", "getSynonym", objectID);
|
|
1446
1366
|
const requestPath = "/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
|
|
1447
1367
|
const headers = {};
|
|
1448
1368
|
const queryParameters = {};
|
|
@@ -1465,12 +1385,8 @@ function createSearchClient({
|
|
|
1465
1385
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1466
1386
|
*/
|
|
1467
1387
|
getTask({ indexName, taskID }, requestOptions) {
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
}
|
|
1471
|
-
if (!taskID) {
|
|
1472
|
-
throw new Error("Parameter `taskID` is required when calling `getTask`.");
|
|
1473
|
-
}
|
|
1388
|
+
validateRequired("indexName", "getTask", indexName);
|
|
1389
|
+
validateRequired("taskID", "getTask", taskID);
|
|
1474
1390
|
const requestPath = "/1/indexes/{indexName}/task/{taskID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{taskID}", encodeURIComponent(taskID));
|
|
1475
1391
|
const headers = {};
|
|
1476
1392
|
const queryParameters = {};
|
|
@@ -1515,9 +1431,7 @@ function createSearchClient({
|
|
|
1515
1431
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1516
1432
|
*/
|
|
1517
1433
|
getUserId({ userID }, requestOptions) {
|
|
1518
|
-
|
|
1519
|
-
throw new Error("Parameter `userID` is required when calling `getUserId`.");
|
|
1520
|
-
}
|
|
1434
|
+
validateRequired("userID", "getUserId", userID);
|
|
1521
1435
|
const requestPath = "/1/clusters/mapping/{userID}".replace("{userID}", encodeURIComponent(userID));
|
|
1522
1436
|
const headers = {};
|
|
1523
1437
|
const queryParameters = {};
|
|
@@ -1662,12 +1576,8 @@ function createSearchClient({
|
|
|
1662
1576
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1663
1577
|
*/
|
|
1664
1578
|
multipleBatch(batchParams, requestOptions) {
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
}
|
|
1668
|
-
if (!batchParams.requests) {
|
|
1669
|
-
throw new Error("Parameter `batchParams.requests` is required when calling `multipleBatch`.");
|
|
1670
|
-
}
|
|
1579
|
+
validateRequired("batchParams", "multipleBatch", batchParams);
|
|
1580
|
+
validateRequired("batchParams.requests", "multipleBatch", batchParams.requests);
|
|
1671
1581
|
const requestPath = "/1/indexes/*/batch";
|
|
1672
1582
|
const headers = {};
|
|
1673
1583
|
const queryParameters = {};
|
|
@@ -1691,18 +1601,10 @@ function createSearchClient({
|
|
|
1691
1601
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1692
1602
|
*/
|
|
1693
1603
|
operationIndex({ indexName, operationIndexParams }, requestOptions) {
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
throw new Error("Parameter `operationIndexParams` is required when calling `operationIndex`.");
|
|
1699
|
-
}
|
|
1700
|
-
if (!operationIndexParams.operation) {
|
|
1701
|
-
throw new Error("Parameter `operationIndexParams.operation` is required when calling `operationIndex`.");
|
|
1702
|
-
}
|
|
1703
|
-
if (!operationIndexParams.destination) {
|
|
1704
|
-
throw new Error("Parameter `operationIndexParams.destination` is required when calling `operationIndex`.");
|
|
1705
|
-
}
|
|
1604
|
+
validateRequired("indexName", "operationIndex", indexName);
|
|
1605
|
+
validateRequired("operationIndexParams", "operationIndex", operationIndexParams);
|
|
1606
|
+
validateRequired("operationIndexParams.operation", "operationIndex", operationIndexParams.operation);
|
|
1607
|
+
validateRequired("operationIndexParams.destination", "operationIndex", operationIndexParams.destination);
|
|
1706
1608
|
const requestPath = "/1/indexes/{indexName}/operation".replace("{indexName}", encodeURIComponent(indexName));
|
|
1707
1609
|
const headers = {};
|
|
1708
1610
|
const queryParameters = {};
|
|
@@ -1728,15 +1630,9 @@ function createSearchClient({
|
|
|
1728
1630
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1729
1631
|
*/
|
|
1730
1632
|
partialUpdateObject({ indexName, objectID, attributesToUpdate, createIfNotExists }, requestOptions) {
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
if (!objectID) {
|
|
1735
|
-
throw new Error("Parameter `objectID` is required when calling `partialUpdateObject`.");
|
|
1736
|
-
}
|
|
1737
|
-
if (!attributesToUpdate) {
|
|
1738
|
-
throw new Error("Parameter `attributesToUpdate` is required when calling `partialUpdateObject`.");
|
|
1739
|
-
}
|
|
1633
|
+
validateRequired("indexName", "partialUpdateObject", indexName);
|
|
1634
|
+
validateRequired("objectID", "partialUpdateObject", objectID);
|
|
1635
|
+
validateRequired("attributesToUpdate", "partialUpdateObject", attributesToUpdate);
|
|
1740
1636
|
const requestPath = "/1/indexes/{indexName}/{objectID}/partial".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
|
|
1741
1637
|
const headers = {};
|
|
1742
1638
|
const queryParameters = {};
|
|
@@ -1764,9 +1660,7 @@ function createSearchClient({
|
|
|
1764
1660
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1765
1661
|
*/
|
|
1766
1662
|
removeUserId({ userID }, requestOptions) {
|
|
1767
|
-
|
|
1768
|
-
throw new Error("Parameter `userID` is required when calling `removeUserId`.");
|
|
1769
|
-
}
|
|
1663
|
+
validateRequired("userID", "removeUserId", userID);
|
|
1770
1664
|
const requestPath = "/1/clusters/mapping/{userID}".replace("{userID}", encodeURIComponent(userID));
|
|
1771
1665
|
const headers = {};
|
|
1772
1666
|
const queryParameters = {};
|
|
@@ -1788,9 +1682,7 @@ function createSearchClient({
|
|
|
1788
1682
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1789
1683
|
*/
|
|
1790
1684
|
replaceSources({ source }, requestOptions) {
|
|
1791
|
-
|
|
1792
|
-
throw new Error("Parameter `source` is required when calling `replaceSources`.");
|
|
1793
|
-
}
|
|
1685
|
+
validateRequired("source", "replaceSources", source);
|
|
1794
1686
|
const requestPath = "/1/security/sources";
|
|
1795
1687
|
const headers = {};
|
|
1796
1688
|
const queryParameters = {};
|
|
@@ -1813,9 +1705,7 @@ function createSearchClient({
|
|
|
1813
1705
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1814
1706
|
*/
|
|
1815
1707
|
restoreApiKey({ key }, requestOptions) {
|
|
1816
|
-
|
|
1817
|
-
throw new Error("Parameter `key` is required when calling `restoreApiKey`.");
|
|
1818
|
-
}
|
|
1708
|
+
validateRequired("key", "restoreApiKey", key);
|
|
1819
1709
|
const requestPath = "/1/keys/{key}/restore".replace("{key}", encodeURIComponent(key));
|
|
1820
1710
|
const headers = {};
|
|
1821
1711
|
const queryParameters = {};
|
|
@@ -1838,12 +1728,8 @@ function createSearchClient({
|
|
|
1838
1728
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1839
1729
|
*/
|
|
1840
1730
|
saveObject({ indexName, body }, requestOptions) {
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
}
|
|
1844
|
-
if (!body) {
|
|
1845
|
-
throw new Error("Parameter `body` is required when calling `saveObject`.");
|
|
1846
|
-
}
|
|
1731
|
+
validateRequired("indexName", "saveObject", indexName);
|
|
1732
|
+
validateRequired("body", "saveObject", body);
|
|
1847
1733
|
const requestPath = "/1/indexes/{indexName}".replace("{indexName}", encodeURIComponent(indexName));
|
|
1848
1734
|
const headers = {};
|
|
1849
1735
|
const queryParameters = {};
|
|
@@ -1869,21 +1755,11 @@ function createSearchClient({
|
|
|
1869
1755
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1870
1756
|
*/
|
|
1871
1757
|
saveRule({ indexName, objectID, rule, forwardToReplicas }, requestOptions) {
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
}
|
|
1878
|
-
if (!rule) {
|
|
1879
|
-
throw new Error("Parameter `rule` is required when calling `saveRule`.");
|
|
1880
|
-
}
|
|
1881
|
-
if (!rule.objectID) {
|
|
1882
|
-
throw new Error("Parameter `rule.objectID` is required when calling `saveRule`.");
|
|
1883
|
-
}
|
|
1884
|
-
if (!rule.consequence) {
|
|
1885
|
-
throw new Error("Parameter `rule.consequence` is required when calling `saveRule`.");
|
|
1886
|
-
}
|
|
1758
|
+
validateRequired("indexName", "saveRule", indexName);
|
|
1759
|
+
validateRequired("objectID", "saveRule", objectID);
|
|
1760
|
+
validateRequired("rule", "saveRule", rule);
|
|
1761
|
+
validateRequired("rule.objectID", "saveRule", rule.objectID);
|
|
1762
|
+
validateRequired("rule.consequence", "saveRule", rule.consequence);
|
|
1887
1763
|
const requestPath = "/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
|
|
1888
1764
|
const headers = {};
|
|
1889
1765
|
const queryParameters = {};
|
|
@@ -1912,12 +1788,8 @@ function createSearchClient({
|
|
|
1912
1788
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1913
1789
|
*/
|
|
1914
1790
|
saveRules({ indexName, rules, forwardToReplicas, clearExistingRules }, requestOptions) {
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
}
|
|
1918
|
-
if (!rules) {
|
|
1919
|
-
throw new Error("Parameter `rules` is required when calling `saveRules`.");
|
|
1920
|
-
}
|
|
1791
|
+
validateRequired("indexName", "saveRules", indexName);
|
|
1792
|
+
validateRequired("rules", "saveRules", rules);
|
|
1921
1793
|
const requestPath = "/1/indexes/{indexName}/rules/batch".replace("{indexName}", encodeURIComponent(indexName));
|
|
1922
1794
|
const headers = {};
|
|
1923
1795
|
const queryParameters = {};
|
|
@@ -1949,21 +1821,11 @@ function createSearchClient({
|
|
|
1949
1821
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1950
1822
|
*/
|
|
1951
1823
|
saveSynonym({ indexName, objectID, synonymHit, forwardToReplicas }, requestOptions) {
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
}
|
|
1958
|
-
if (!synonymHit) {
|
|
1959
|
-
throw new Error("Parameter `synonymHit` is required when calling `saveSynonym`.");
|
|
1960
|
-
}
|
|
1961
|
-
if (!synonymHit.objectID) {
|
|
1962
|
-
throw new Error("Parameter `synonymHit.objectID` is required when calling `saveSynonym`.");
|
|
1963
|
-
}
|
|
1964
|
-
if (!synonymHit.type) {
|
|
1965
|
-
throw new Error("Parameter `synonymHit.type` is required when calling `saveSynonym`.");
|
|
1966
|
-
}
|
|
1824
|
+
validateRequired("indexName", "saveSynonym", indexName);
|
|
1825
|
+
validateRequired("objectID", "saveSynonym", objectID);
|
|
1826
|
+
validateRequired("synonymHit", "saveSynonym", synonymHit);
|
|
1827
|
+
validateRequired("synonymHit.objectID", "saveSynonym", synonymHit.objectID);
|
|
1828
|
+
validateRequired("synonymHit.type", "saveSynonym", synonymHit.type);
|
|
1967
1829
|
const requestPath = "/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}", encodeURIComponent(indexName)).replace("{objectID}", encodeURIComponent(objectID));
|
|
1968
1830
|
const headers = {};
|
|
1969
1831
|
const queryParameters = {};
|
|
@@ -1992,12 +1854,8 @@ function createSearchClient({
|
|
|
1992
1854
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1993
1855
|
*/
|
|
1994
1856
|
saveSynonyms({ indexName, synonymHit, forwardToReplicas, replaceExistingSynonyms }, requestOptions) {
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
}
|
|
1998
|
-
if (!synonymHit) {
|
|
1999
|
-
throw new Error("Parameter `synonymHit` is required when calling `saveSynonyms`.");
|
|
2000
|
-
}
|
|
1857
|
+
validateRequired("indexName", "saveSynonyms", indexName);
|
|
1858
|
+
validateRequired("synonymHit", "saveSynonyms", synonymHit);
|
|
2001
1859
|
const requestPath = "/1/indexes/{indexName}/synonyms/batch".replace("{indexName}", encodeURIComponent(indexName));
|
|
2002
1860
|
const headers = {};
|
|
2003
1861
|
const queryParameters = {};
|
|
@@ -2046,12 +1904,8 @@ function createSearchClient({
|
|
|
2046
1904
|
};
|
|
2047
1905
|
searchMethodParams = newSignatureRequest;
|
|
2048
1906
|
}
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
}
|
|
2052
|
-
if (!searchMethodParams.requests) {
|
|
2053
|
-
throw new Error("Parameter `searchMethodParams.requests` is required when calling `search`.");
|
|
2054
|
-
}
|
|
1907
|
+
validateRequired("searchMethodParams", "search", searchMethodParams);
|
|
1908
|
+
validateRequired("searchMethodParams.requests", "search", searchMethodParams.requests);
|
|
2055
1909
|
const requestPath = "/1/indexes/*/queries";
|
|
2056
1910
|
const headers = {};
|
|
2057
1911
|
const queryParameters = {};
|
|
@@ -2077,19 +1931,13 @@ function createSearchClient({
|
|
|
2077
1931
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2078
1932
|
*/
|
|
2079
1933
|
searchDictionaryEntries({ dictionaryName, searchDictionaryEntriesParams }, requestOptions) {
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
}
|
|
2088
|
-
if (!searchDictionaryEntriesParams.query) {
|
|
2089
|
-
throw new Error(
|
|
2090
|
-
"Parameter `searchDictionaryEntriesParams.query` is required when calling `searchDictionaryEntries`."
|
|
2091
|
-
);
|
|
2092
|
-
}
|
|
1934
|
+
validateRequired("dictionaryName", "searchDictionaryEntries", dictionaryName);
|
|
1935
|
+
validateRequired("searchDictionaryEntriesParams", "searchDictionaryEntries", searchDictionaryEntriesParams);
|
|
1936
|
+
validateRequired(
|
|
1937
|
+
"searchDictionaryEntriesParams.query",
|
|
1938
|
+
"searchDictionaryEntries",
|
|
1939
|
+
searchDictionaryEntriesParams.query
|
|
1940
|
+
);
|
|
2093
1941
|
const requestPath = "/1/dictionaries/{dictionaryName}/search".replace(
|
|
2094
1942
|
"{dictionaryName}",
|
|
2095
1943
|
encodeURIComponent(dictionaryName)
|
|
@@ -2119,12 +1967,8 @@ function createSearchClient({
|
|
|
2119
1967
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2120
1968
|
*/
|
|
2121
1969
|
searchForFacetValues({ indexName, facetName, searchForFacetValuesRequest }, requestOptions) {
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
}
|
|
2125
|
-
if (!facetName) {
|
|
2126
|
-
throw new Error("Parameter `facetName` is required when calling `searchForFacetValues`.");
|
|
2127
|
-
}
|
|
1970
|
+
validateRequired("indexName", "searchForFacetValues", indexName);
|
|
1971
|
+
validateRequired("facetName", "searchForFacetValues", facetName);
|
|
2128
1972
|
const requestPath = "/1/indexes/{indexName}/facets/{facetName}/query".replace("{indexName}", encodeURIComponent(indexName)).replace("{facetName}", encodeURIComponent(facetName));
|
|
2129
1973
|
const headers = {};
|
|
2130
1974
|
const queryParameters = {};
|
|
@@ -2150,9 +1994,7 @@ function createSearchClient({
|
|
|
2150
1994
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2151
1995
|
*/
|
|
2152
1996
|
searchRules({ indexName, searchRulesParams }, requestOptions) {
|
|
2153
|
-
|
|
2154
|
-
throw new Error("Parameter `indexName` is required when calling `searchRules`.");
|
|
2155
|
-
}
|
|
1997
|
+
validateRequired("indexName", "searchRules", indexName);
|
|
2156
1998
|
const requestPath = "/1/indexes/{indexName}/rules/search".replace("{indexName}", encodeURIComponent(indexName));
|
|
2157
1999
|
const headers = {};
|
|
2158
2000
|
const queryParameters = {};
|
|
@@ -2178,9 +2020,7 @@ function createSearchClient({
|
|
|
2178
2020
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2179
2021
|
*/
|
|
2180
2022
|
searchSingleIndex({ indexName, searchParams }, requestOptions) {
|
|
2181
|
-
|
|
2182
|
-
throw new Error("Parameter `indexName` is required when calling `searchSingleIndex`.");
|
|
2183
|
-
}
|
|
2023
|
+
validateRequired("indexName", "searchSingleIndex", indexName);
|
|
2184
2024
|
const requestPath = "/1/indexes/{indexName}/query".replace("{indexName}", encodeURIComponent(indexName));
|
|
2185
2025
|
const headers = {};
|
|
2186
2026
|
const queryParameters = {};
|
|
@@ -2206,9 +2046,7 @@ function createSearchClient({
|
|
|
2206
2046
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2207
2047
|
*/
|
|
2208
2048
|
searchSynonyms({ indexName, searchSynonymsParams }, requestOptions) {
|
|
2209
|
-
|
|
2210
|
-
throw new Error("Parameter `indexName` is required when calling `searchSynonyms`.");
|
|
2211
|
-
}
|
|
2049
|
+
validateRequired("indexName", "searchSynonyms", indexName);
|
|
2212
2050
|
const requestPath = "/1/indexes/{indexName}/synonyms/search".replace(
|
|
2213
2051
|
"{indexName}",
|
|
2214
2052
|
encodeURIComponent(indexName)
|
|
@@ -2237,12 +2075,8 @@ function createSearchClient({
|
|
|
2237
2075
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2238
2076
|
*/
|
|
2239
2077
|
searchUserIds(searchUserIdsParams, requestOptions) {
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
}
|
|
2243
|
-
if (!searchUserIdsParams.query) {
|
|
2244
|
-
throw new Error("Parameter `searchUserIdsParams.query` is required when calling `searchUserIds`.");
|
|
2245
|
-
}
|
|
2078
|
+
validateRequired("searchUserIdsParams", "searchUserIds", searchUserIdsParams);
|
|
2079
|
+
validateRequired("searchUserIdsParams.query", "searchUserIds", searchUserIdsParams.query);
|
|
2246
2080
|
const requestPath = "/1/clusters/mapping/search";
|
|
2247
2081
|
const headers = {};
|
|
2248
2082
|
const queryParameters = {};
|
|
@@ -2266,14 +2100,12 @@ function createSearchClient({
|
|
|
2266
2100
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2267
2101
|
*/
|
|
2268
2102
|
setDictionarySettings(dictionarySettingsParams, requestOptions) {
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
);
|
|
2276
|
-
}
|
|
2103
|
+
validateRequired("dictionarySettingsParams", "setDictionarySettings", dictionarySettingsParams);
|
|
2104
|
+
validateRequired(
|
|
2105
|
+
"dictionarySettingsParams.disableStandardEntries",
|
|
2106
|
+
"setDictionarySettings",
|
|
2107
|
+
dictionarySettingsParams.disableStandardEntries
|
|
2108
|
+
);
|
|
2277
2109
|
const requestPath = "/1/dictionaries/*/settings";
|
|
2278
2110
|
const headers = {};
|
|
2279
2111
|
const queryParameters = {};
|
|
@@ -2298,12 +2130,8 @@ function createSearchClient({
|
|
|
2298
2130
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2299
2131
|
*/
|
|
2300
2132
|
setSettings({ indexName, indexSettings, forwardToReplicas }, requestOptions) {
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
}
|
|
2304
|
-
if (!indexSettings) {
|
|
2305
|
-
throw new Error("Parameter `indexSettings` is required when calling `setSettings`.");
|
|
2306
|
-
}
|
|
2133
|
+
validateRequired("indexName", "setSettings", indexName);
|
|
2134
|
+
validateRequired("indexSettings", "setSettings", indexSettings);
|
|
2307
2135
|
const requestPath = "/1/indexes/{indexName}/settings".replace("{indexName}", encodeURIComponent(indexName));
|
|
2308
2136
|
const headers = {};
|
|
2309
2137
|
const queryParameters = {};
|
|
@@ -2330,15 +2158,9 @@ function createSearchClient({
|
|
|
2330
2158
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
2331
2159
|
*/
|
|
2332
2160
|
updateApiKey({ key, apiKey }, requestOptions) {
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
if (!apiKey) {
|
|
2337
|
-
throw new Error("Parameter `apiKey` is required when calling `updateApiKey`.");
|
|
2338
|
-
}
|
|
2339
|
-
if (!apiKey.acl) {
|
|
2340
|
-
throw new Error("Parameter `apiKey.acl` is required when calling `updateApiKey`.");
|
|
2341
|
-
}
|
|
2161
|
+
validateRequired("key", "updateApiKey", key);
|
|
2162
|
+
validateRequired("apiKey", "updateApiKey", apiKey);
|
|
2163
|
+
validateRequired("apiKey.acl", "updateApiKey", apiKey.acl);
|
|
2342
2164
|
const requestPath = "/1/keys/{key}".replace("{key}", encodeURIComponent(key));
|
|
2343
2165
|
const headers = {};
|
|
2344
2166
|
const queryParameters = {};
|
|
@@ -2420,6 +2242,7 @@ function searchClient(appId, apiKey, options) {
|
|
|
2420
2242
|
* @param accountCopyIndex.destinationApiKey - The API Key of the `destinationAppID` to write the index to, must have write ACLs.
|
|
2421
2243
|
* @param accountCopyIndex.destinationIndexName - The name of the index to write the copied index to.
|
|
2422
2244
|
* @param accountCopyIndex.batchSize - The size of the chunk of `objects`. Defaults to 1000.
|
|
2245
|
+
* @param accountCopyIndex.maxRetries - The maximum number of retries when polling for task completion. 100 by default.
|
|
2423
2246
|
* @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.
|
|
2424
2247
|
*/
|
|
2425
2248
|
async accountCopyIndex({
|
|
@@ -2427,7 +2250,8 @@ function searchClient(appId, apiKey, options) {
|
|
|
2427
2250
|
destinationAppID,
|
|
2428
2251
|
destinationApiKey,
|
|
2429
2252
|
destinationIndexName,
|
|
2430
|
-
batchSize
|
|
2253
|
+
batchSize,
|
|
2254
|
+
maxRetries = 100
|
|
2431
2255
|
}, requestOptions) {
|
|
2432
2256
|
const responses = [];
|
|
2433
2257
|
if (this.appId === destinationAppID) {
|
|
@@ -2499,7 +2323,7 @@ function searchClient(appId, apiKey, options) {
|
|
|
2499
2323
|
}
|
|
2500
2324
|
});
|
|
2501
2325
|
for (const response of responses) {
|
|
2502
|
-
await destinationClient.waitForTask({ indexName: destinationIndexName, taskID: response.taskID });
|
|
2326
|
+
await destinationClient.waitForTask({ indexName: destinationIndexName, taskID: response.taskID, maxRetries });
|
|
2503
2327
|
}
|
|
2504
2328
|
},
|
|
2505
2329
|
/**
|