@algolia/client-search 5.2.5 → 5.3.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/dist/browser.d.ts +2485 -1687
- package/dist/builds/browser.js +114 -86
- package/dist/builds/browser.js.map +1 -1
- package/dist/builds/browser.min.js +1 -1
- package/dist/builds/browser.min.js.map +1 -1
- package/dist/builds/browser.umd.js +2 -2
- package/dist/builds/node.cjs +108 -87
- package/dist/builds/node.cjs.map +1 -1
- package/dist/builds/node.js +116 -88
- package/dist/builds/node.js.map +1 -1
- package/dist/node.d.cts +883 -102
- package/dist/node.d.ts +883 -102
- package/dist/src/searchClient.cjs +106 -85
- package/dist/src/searchClient.cjs.map +1 -1
- package/dist/src/searchClient.js +114 -86
- package/dist/src/searchClient.js.map +1 -1
- package/model/clientMethodProps.ts +5 -0
- package/package.json +4 -4
package/dist/builds/node.cjs
CHANGED
|
@@ -30,7 +30,7 @@ var import_requester_node_http = require("@algolia/requester-node-http");
|
|
|
30
30
|
|
|
31
31
|
// src/searchClient.ts
|
|
32
32
|
var import_client_common = require("@algolia/client-common");
|
|
33
|
-
var apiClientVersion = "5.
|
|
33
|
+
var apiClientVersion = "5.3.0";
|
|
34
34
|
function getDefaultHosts(appId) {
|
|
35
35
|
return [
|
|
36
36
|
{
|
|
@@ -71,26 +71,25 @@ function createSearchClient({
|
|
|
71
71
|
...options
|
|
72
72
|
}) {
|
|
73
73
|
const auth = (0, import_client_common.createAuth)(appIdOption, apiKeyOption, authMode);
|
|
74
|
-
const transporter = (0, import_client_common.createTransporter)({
|
|
75
|
-
hosts: getDefaultHosts(appIdOption),
|
|
76
|
-
...options,
|
|
77
|
-
algoliaAgent: (0, import_client_common.getAlgoliaAgent)({
|
|
78
|
-
algoliaAgents,
|
|
79
|
-
client: "Search",
|
|
80
|
-
version: apiClientVersion
|
|
81
|
-
}),
|
|
82
|
-
baseHeaders: {
|
|
83
|
-
"content-type": "text/plain",
|
|
84
|
-
...auth.headers(),
|
|
85
|
-
...options.baseHeaders
|
|
86
|
-
},
|
|
87
|
-
baseQueryParameters: {
|
|
88
|
-
...auth.queryParameters(),
|
|
89
|
-
...options.baseQueryParameters
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
74
|
return {
|
|
93
|
-
transporter,
|
|
75
|
+
transporter: (0, import_client_common.createTransporter)({
|
|
76
|
+
hosts: getDefaultHosts(appIdOption),
|
|
77
|
+
...options,
|
|
78
|
+
algoliaAgent: (0, import_client_common.getAlgoliaAgent)({
|
|
79
|
+
algoliaAgents,
|
|
80
|
+
client: "Search",
|
|
81
|
+
version: apiClientVersion
|
|
82
|
+
}),
|
|
83
|
+
baseHeaders: {
|
|
84
|
+
"content-type": "text/plain",
|
|
85
|
+
...auth.headers(),
|
|
86
|
+
...options.baseHeaders
|
|
87
|
+
},
|
|
88
|
+
baseQueryParameters: {
|
|
89
|
+
...auth.queryParameters(),
|
|
90
|
+
...options.baseQueryParameters
|
|
91
|
+
}
|
|
92
|
+
}),
|
|
94
93
|
/**
|
|
95
94
|
* The `appId` currently in use.
|
|
96
95
|
*/
|
|
@@ -99,13 +98,15 @@ function createSearchClient({
|
|
|
99
98
|
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
|
|
100
99
|
*/
|
|
101
100
|
clearCache() {
|
|
102
|
-
return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(
|
|
101
|
+
return Promise.all([this.transporter.requestsCache.clear(), this.transporter.responsesCache.clear()]).then(
|
|
102
|
+
() => void 0
|
|
103
|
+
);
|
|
103
104
|
},
|
|
104
105
|
/**
|
|
105
106
|
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
|
|
106
107
|
*/
|
|
107
108
|
get _ua() {
|
|
108
|
-
return transporter.algoliaAgent.value;
|
|
109
|
+
return this.transporter.algoliaAgent.value;
|
|
109
110
|
},
|
|
110
111
|
/**
|
|
111
112
|
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
|
|
@@ -114,7 +115,16 @@ function createSearchClient({
|
|
|
114
115
|
* @param version - The version of the agent.
|
|
115
116
|
*/
|
|
116
117
|
addAlgoliaAgent(segment, version) {
|
|
117
|
-
transporter.algoliaAgent.add({ segment, version });
|
|
118
|
+
this.transporter.algoliaAgent.add({ segment, version });
|
|
119
|
+
},
|
|
120
|
+
/**
|
|
121
|
+
* Helper method to switch the API key used to authenticate the requests.
|
|
122
|
+
*
|
|
123
|
+
* @param params - Method params.
|
|
124
|
+
* @param params.apiKey - The new API Key to use.
|
|
125
|
+
*/
|
|
126
|
+
setClientApiKey({ apiKey }) {
|
|
127
|
+
this.transporter.baseHeaders["x-algolia-api-key"] = apiKey;
|
|
118
128
|
},
|
|
119
129
|
/**
|
|
120
130
|
* Helper: Wait for a task to be published (completed) for a given `indexName` and `taskID`.
|
|
@@ -478,6 +488,17 @@ function createSearchClient({
|
|
|
478
488
|
});
|
|
479
489
|
return { copyOperationResponse, batchResponses, moveOperationResponse };
|
|
480
490
|
},
|
|
491
|
+
async indexExists({ indexName }) {
|
|
492
|
+
try {
|
|
493
|
+
await this.getSettings({ indexName });
|
|
494
|
+
} catch (error) {
|
|
495
|
+
if (error instanceof import_client_common.ApiError && error.status === 404) {
|
|
496
|
+
return false;
|
|
497
|
+
}
|
|
498
|
+
throw error;
|
|
499
|
+
}
|
|
500
|
+
return true;
|
|
501
|
+
},
|
|
481
502
|
/**
|
|
482
503
|
* Helper: calls the `search` method but with certainty that we will only request Algolia records (hits) and not facets.
|
|
483
504
|
* Disclaimer: We don't assert that the parameters you pass to this method only contains `hits` requests to prevent impacting search performances, this helper is purely for typing purposes.
|
|
@@ -526,7 +547,7 @@ function createSearchClient({
|
|
|
526
547
|
headers,
|
|
527
548
|
data: apiKey
|
|
528
549
|
};
|
|
529
|
-
return transporter.request(request, requestOptions);
|
|
550
|
+
return this.transporter.request(request, requestOptions);
|
|
530
551
|
},
|
|
531
552
|
/**
|
|
532
553
|
* If a record with the specified object ID exists, the existing record is replaced. Otherwise, a new record is added to the index. To update _some_ attributes of an existing record, use the [`partial` operation](#tag/Records/operation/partialUpdateObject) instead. To add, update, or replace multiple records, use the [`batch` operation](#tag/Records/operation/batch).
|
|
@@ -560,7 +581,7 @@ function createSearchClient({
|
|
|
560
581
|
headers,
|
|
561
582
|
data: body
|
|
562
583
|
};
|
|
563
|
-
return transporter.request(request, requestOptions);
|
|
584
|
+
return this.transporter.request(request, requestOptions);
|
|
564
585
|
},
|
|
565
586
|
/**
|
|
566
587
|
* Adds a source to the list of allowed sources.
|
|
@@ -588,7 +609,7 @@ function createSearchClient({
|
|
|
588
609
|
headers,
|
|
589
610
|
data: source
|
|
590
611
|
};
|
|
591
|
-
return transporter.request(request, requestOptions);
|
|
612
|
+
return this.transporter.request(request, requestOptions);
|
|
592
613
|
},
|
|
593
614
|
/**
|
|
594
615
|
* Assigns or moves a user ID to a cluster. The time it takes to move a user is proportional to the amount of data linked to the user ID.
|
|
@@ -624,7 +645,7 @@ function createSearchClient({
|
|
|
624
645
|
headers,
|
|
625
646
|
data: assignUserIdParams
|
|
626
647
|
};
|
|
627
|
-
return transporter.request(request, requestOptions);
|
|
648
|
+
return this.transporter.request(request, requestOptions);
|
|
628
649
|
},
|
|
629
650
|
/**
|
|
630
651
|
* Adds, updates, or deletes records in one index with a single API request. Batching index updates reduces latency and increases data integrity. - Actions are applied in the order they\'re specified. - Actions are equivalent to the individual API requests of the same name.
|
|
@@ -654,7 +675,7 @@ function createSearchClient({
|
|
|
654
675
|
headers,
|
|
655
676
|
data: batchWriteParams
|
|
656
677
|
};
|
|
657
|
-
return transporter.request(request, requestOptions);
|
|
678
|
+
return this.transporter.request(request, requestOptions);
|
|
658
679
|
},
|
|
659
680
|
/**
|
|
660
681
|
* Assigns multiple user IDs to a cluster. **You can\'t move users with this operation**.
|
|
@@ -693,7 +714,7 @@ function createSearchClient({
|
|
|
693
714
|
headers,
|
|
694
715
|
data: batchAssignUserIdsParams
|
|
695
716
|
};
|
|
696
|
-
return transporter.request(request, requestOptions);
|
|
717
|
+
return this.transporter.request(request, requestOptions);
|
|
697
718
|
},
|
|
698
719
|
/**
|
|
699
720
|
* Adds or deletes multiple entries from your plurals, segmentation, or stop word dictionaries.
|
|
@@ -731,7 +752,7 @@ function createSearchClient({
|
|
|
731
752
|
headers,
|
|
732
753
|
data: batchDictionaryEntriesParams
|
|
733
754
|
};
|
|
734
|
-
return transporter.request(request, requestOptions);
|
|
755
|
+
return this.transporter.request(request, requestOptions);
|
|
735
756
|
},
|
|
736
757
|
/**
|
|
737
758
|
* Retrieves records from an index, up to 1,000 per request. While searching retrieves _hits_ (records augmented with attributes for highlighting and ranking details), browsing _just_ returns matching records. This can be useful if you want to export your indices. - The Analytics API doesn\'t collect data when using `browse`. - Records are ranked by attributes and custom ranking. - There\'s no ranking for: typo-tolerance, number of matched words, proximity, geo distance. Browse requests automatically apply these settings: - `advancedSyntax`: `false` - `attributesToHighlight`: `[]` - `attributesToSnippet`: `[]` - `distinct`: `false` - `enablePersonalization`: `false` - `enableRules`: `false` - `facets`: `[]` - `getRankingInfo`: `false` - `ignorePlurals`: `false` - `optionalFilters`: `[]` - `typoTolerance`: `true` or `false` (`min` and `strict` is evaluated to `true`) If you send these parameters with your browse requests, they\'ll be ignored.
|
|
@@ -758,7 +779,7 @@ function createSearchClient({
|
|
|
758
779
|
headers,
|
|
759
780
|
data: browseParams ? browseParams : {}
|
|
760
781
|
};
|
|
761
|
-
return transporter.request(request, requestOptions);
|
|
782
|
+
return this.transporter.request(request, requestOptions);
|
|
762
783
|
},
|
|
763
784
|
/**
|
|
764
785
|
* Deletes only the records from an index while keeping settings, synonyms, and rules.
|
|
@@ -783,7 +804,7 @@ function createSearchClient({
|
|
|
783
804
|
queryParameters,
|
|
784
805
|
headers
|
|
785
806
|
};
|
|
786
|
-
return transporter.request(request, requestOptions);
|
|
807
|
+
return this.transporter.request(request, requestOptions);
|
|
787
808
|
},
|
|
788
809
|
/**
|
|
789
810
|
* Deletes all rules from the index.
|
|
@@ -812,7 +833,7 @@ function createSearchClient({
|
|
|
812
833
|
queryParameters,
|
|
813
834
|
headers
|
|
814
835
|
};
|
|
815
|
-
return transporter.request(request, requestOptions);
|
|
836
|
+
return this.transporter.request(request, requestOptions);
|
|
816
837
|
},
|
|
817
838
|
/**
|
|
818
839
|
* Deletes all synonyms from the index.
|
|
@@ -841,7 +862,7 @@ function createSearchClient({
|
|
|
841
862
|
queryParameters,
|
|
842
863
|
headers
|
|
843
864
|
};
|
|
844
|
-
return transporter.request(request, requestOptions);
|
|
865
|
+
return this.transporter.request(request, requestOptions);
|
|
845
866
|
},
|
|
846
867
|
/**
|
|
847
868
|
* This method allow you to send requests to the Algolia REST API.
|
|
@@ -864,7 +885,7 @@ function createSearchClient({
|
|
|
864
885
|
queryParameters,
|
|
865
886
|
headers
|
|
866
887
|
};
|
|
867
|
-
return transporter.request(request, requestOptions);
|
|
888
|
+
return this.transporter.request(request, requestOptions);
|
|
868
889
|
},
|
|
869
890
|
/**
|
|
870
891
|
* This method allow you to send requests to the Algolia REST API.
|
|
@@ -887,7 +908,7 @@ function createSearchClient({
|
|
|
887
908
|
queryParameters,
|
|
888
909
|
headers
|
|
889
910
|
};
|
|
890
|
-
return transporter.request(request, requestOptions);
|
|
911
|
+
return this.transporter.request(request, requestOptions);
|
|
891
912
|
},
|
|
892
913
|
/**
|
|
893
914
|
* This method allow you to send requests to the Algolia REST API.
|
|
@@ -912,7 +933,7 @@ function createSearchClient({
|
|
|
912
933
|
headers,
|
|
913
934
|
data: body ? body : {}
|
|
914
935
|
};
|
|
915
|
-
return transporter.request(request, requestOptions);
|
|
936
|
+
return this.transporter.request(request, requestOptions);
|
|
916
937
|
},
|
|
917
938
|
/**
|
|
918
939
|
* This method allow you to send requests to the Algolia REST API.
|
|
@@ -937,7 +958,7 @@ function createSearchClient({
|
|
|
937
958
|
headers,
|
|
938
959
|
data: body ? body : {}
|
|
939
960
|
};
|
|
940
|
-
return transporter.request(request, requestOptions);
|
|
961
|
+
return this.transporter.request(request, requestOptions);
|
|
941
962
|
},
|
|
942
963
|
/**
|
|
943
964
|
* Deletes the API key.
|
|
@@ -962,7 +983,7 @@ function createSearchClient({
|
|
|
962
983
|
queryParameters,
|
|
963
984
|
headers
|
|
964
985
|
};
|
|
965
|
-
return transporter.request(request, requestOptions);
|
|
986
|
+
return this.transporter.request(request, requestOptions);
|
|
966
987
|
},
|
|
967
988
|
/**
|
|
968
989
|
* This operation doesn\'t accept empty queries or filters. It\'s more efficient to get a list of object IDs with the [`browse` operation](#tag/Search/operation/browse), and then delete the records using the [`batch` operation](#tag/Records/operation/batch).
|
|
@@ -992,7 +1013,7 @@ function createSearchClient({
|
|
|
992
1013
|
headers,
|
|
993
1014
|
data: deleteByParams
|
|
994
1015
|
};
|
|
995
|
-
return transporter.request(request, requestOptions);
|
|
1016
|
+
return this.transporter.request(request, requestOptions);
|
|
996
1017
|
},
|
|
997
1018
|
/**
|
|
998
1019
|
* Deletes an index and all its settings. - Deleting an index doesn\'t delete its analytics data. - If you try to delete a non-existing index, the operation is ignored without warning. - If the index you want to delete has replica indices, the replicas become independent indices. - If the index you want to delete is a replica index, you must first unlink it from its primary index before you can delete it. For more information, see [Delete replica indices](https://www.algolia.com/doc/guides/managing-results/refine-results/sorting/how-to/deleting-replicas/).
|
|
@@ -1017,7 +1038,7 @@ function createSearchClient({
|
|
|
1017
1038
|
queryParameters,
|
|
1018
1039
|
headers
|
|
1019
1040
|
};
|
|
1020
|
-
return transporter.request(request, requestOptions);
|
|
1041
|
+
return this.transporter.request(request, requestOptions);
|
|
1021
1042
|
},
|
|
1022
1043
|
/**
|
|
1023
1044
|
* Deletes a record by its object ID. To delete more than one record, use the [`batch` operation](#tag/Records/operation/batch). To delete records matching a query, use the [`deleteByQuery` operation](#tag/Records/operation/deleteBy).
|
|
@@ -1046,7 +1067,7 @@ function createSearchClient({
|
|
|
1046
1067
|
queryParameters,
|
|
1047
1068
|
headers
|
|
1048
1069
|
};
|
|
1049
|
-
return transporter.request(request, requestOptions);
|
|
1070
|
+
return this.transporter.request(request, requestOptions);
|
|
1050
1071
|
},
|
|
1051
1072
|
/**
|
|
1052
1073
|
* Deletes a rule by its ID. To find the object ID for rules, use the [`search` operation](#tag/Rules/operation/searchRules).
|
|
@@ -1079,7 +1100,7 @@ function createSearchClient({
|
|
|
1079
1100
|
queryParameters,
|
|
1080
1101
|
headers
|
|
1081
1102
|
};
|
|
1082
|
-
return transporter.request(request, requestOptions);
|
|
1103
|
+
return this.transporter.request(request, requestOptions);
|
|
1083
1104
|
},
|
|
1084
1105
|
/**
|
|
1085
1106
|
* Deletes a source from the list of allowed sources.
|
|
@@ -1104,7 +1125,7 @@ function createSearchClient({
|
|
|
1104
1125
|
queryParameters,
|
|
1105
1126
|
headers
|
|
1106
1127
|
};
|
|
1107
|
-
return transporter.request(request, requestOptions);
|
|
1128
|
+
return this.transporter.request(request, requestOptions);
|
|
1108
1129
|
},
|
|
1109
1130
|
/**
|
|
1110
1131
|
* Deletes a synonym by its ID. To find the object IDs of your synonyms, use the [`search` operation](#tag/Synonyms/operation/searchSynonyms).
|
|
@@ -1137,7 +1158,7 @@ function createSearchClient({
|
|
|
1137
1158
|
queryParameters,
|
|
1138
1159
|
headers
|
|
1139
1160
|
};
|
|
1140
|
-
return transporter.request(request, requestOptions);
|
|
1161
|
+
return this.transporter.request(request, requestOptions);
|
|
1141
1162
|
},
|
|
1142
1163
|
/**
|
|
1143
1164
|
* Gets the permissions and restrictions of an API key. When authenticating with the admin API key, you can request information for any of your application\'s keys. When authenticating with other API keys, you can only retrieve information for that key.
|
|
@@ -1159,7 +1180,7 @@ function createSearchClient({
|
|
|
1159
1180
|
queryParameters,
|
|
1160
1181
|
headers
|
|
1161
1182
|
};
|
|
1162
|
-
return transporter.request(request, requestOptions);
|
|
1183
|
+
return this.transporter.request(request, requestOptions);
|
|
1163
1184
|
},
|
|
1164
1185
|
/**
|
|
1165
1186
|
* Checks the status of a given application task.
|
|
@@ -1184,7 +1205,7 @@ function createSearchClient({
|
|
|
1184
1205
|
queryParameters,
|
|
1185
1206
|
headers
|
|
1186
1207
|
};
|
|
1187
|
-
return transporter.request(request, requestOptions);
|
|
1208
|
+
return this.transporter.request(request, requestOptions);
|
|
1188
1209
|
},
|
|
1189
1210
|
/**
|
|
1190
1211
|
* Lists supported languages with their supported dictionary types and number of custom entries.
|
|
@@ -1204,7 +1225,7 @@ function createSearchClient({
|
|
|
1204
1225
|
queryParameters,
|
|
1205
1226
|
headers
|
|
1206
1227
|
};
|
|
1207
|
-
return transporter.request(request, requestOptions);
|
|
1228
|
+
return this.transporter.request(request, requestOptions);
|
|
1208
1229
|
},
|
|
1209
1230
|
/**
|
|
1210
1231
|
* Retrieves the languages for which standard dictionary entries are turned off.
|
|
@@ -1224,7 +1245,7 @@ function createSearchClient({
|
|
|
1224
1245
|
queryParameters,
|
|
1225
1246
|
headers
|
|
1226
1247
|
};
|
|
1227
|
-
return transporter.request(request, requestOptions);
|
|
1248
|
+
return this.transporter.request(request, requestOptions);
|
|
1228
1249
|
},
|
|
1229
1250
|
/**
|
|
1230
1251
|
* The request must be authenticated by an API key with the [`logs` ACL](https://www.algolia.com/doc/guides/security/api-keys/#access-control-list-acl). - Logs are held for the last seven days. - Up to 1,000 API requests per server are logged. - This request counts towards your [operations quota](https://support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-) but doesn\'t appear in the logs itself.
|
|
@@ -1261,7 +1282,7 @@ function createSearchClient({
|
|
|
1261
1282
|
queryParameters,
|
|
1262
1283
|
headers
|
|
1263
1284
|
};
|
|
1264
|
-
return transporter.request(request, requestOptions);
|
|
1285
|
+
return this.transporter.request(request, requestOptions);
|
|
1265
1286
|
},
|
|
1266
1287
|
/**
|
|
1267
1288
|
* Retrieves one record by its object ID. To retrieve more than one record, use the [`objects` operation](#tag/Records/operation/getObjects).
|
|
@@ -1294,7 +1315,7 @@ function createSearchClient({
|
|
|
1294
1315
|
queryParameters,
|
|
1295
1316
|
headers
|
|
1296
1317
|
};
|
|
1297
|
-
return transporter.request(request, requestOptions);
|
|
1318
|
+
return this.transporter.request(request, requestOptions);
|
|
1298
1319
|
},
|
|
1299
1320
|
/**
|
|
1300
1321
|
* Retrieves one or more records, potentially from different indices. Records are returned in the same order as the requests.
|
|
@@ -1324,7 +1345,7 @@ function createSearchClient({
|
|
|
1324
1345
|
useReadTransporter: true,
|
|
1325
1346
|
cacheable: true
|
|
1326
1347
|
};
|
|
1327
|
-
return transporter.request(request, requestOptions);
|
|
1348
|
+
return this.transporter.request(request, requestOptions);
|
|
1328
1349
|
},
|
|
1329
1350
|
/**
|
|
1330
1351
|
* Retrieves a rule by its ID. To find the object ID of rules, use the [`search` operation](#tag/Rules/operation/searchRules).
|
|
@@ -1353,7 +1374,7 @@ function createSearchClient({
|
|
|
1353
1374
|
queryParameters,
|
|
1354
1375
|
headers
|
|
1355
1376
|
};
|
|
1356
|
-
return transporter.request(request, requestOptions);
|
|
1377
|
+
return this.transporter.request(request, requestOptions);
|
|
1357
1378
|
},
|
|
1358
1379
|
/**
|
|
1359
1380
|
* Retrieves an object with non-null index settings.
|
|
@@ -1378,7 +1399,7 @@ function createSearchClient({
|
|
|
1378
1399
|
queryParameters,
|
|
1379
1400
|
headers
|
|
1380
1401
|
};
|
|
1381
|
-
return transporter.request(request, requestOptions);
|
|
1402
|
+
return this.transporter.request(request, requestOptions);
|
|
1382
1403
|
},
|
|
1383
1404
|
/**
|
|
1384
1405
|
* Retrieves all allowed IP addresses with access to your application.
|
|
@@ -1398,7 +1419,7 @@ function createSearchClient({
|
|
|
1398
1419
|
queryParameters,
|
|
1399
1420
|
headers
|
|
1400
1421
|
};
|
|
1401
|
-
return transporter.request(request, requestOptions);
|
|
1422
|
+
return this.transporter.request(request, requestOptions);
|
|
1402
1423
|
},
|
|
1403
1424
|
/**
|
|
1404
1425
|
* Retrieves a syonym by its ID. To find the object IDs for your synonyms, use the [`search` operation](#tag/Synonyms/operation/searchSynonyms).
|
|
@@ -1427,7 +1448,7 @@ function createSearchClient({
|
|
|
1427
1448
|
queryParameters,
|
|
1428
1449
|
headers
|
|
1429
1450
|
};
|
|
1430
|
-
return transporter.request(request, requestOptions);
|
|
1451
|
+
return this.transporter.request(request, requestOptions);
|
|
1431
1452
|
},
|
|
1432
1453
|
/**
|
|
1433
1454
|
* Checks the status of a given task. Indexing tasks are asynchronous. When you add, update, or delete records or indices, a task is created on a queue and completed depending on the load on the server. The indexing tasks\' responses include a task ID that you can use to check the status.
|
|
@@ -1456,7 +1477,7 @@ function createSearchClient({
|
|
|
1456
1477
|
queryParameters,
|
|
1457
1478
|
headers
|
|
1458
1479
|
};
|
|
1459
|
-
return transporter.request(request, requestOptions);
|
|
1480
|
+
return this.transporter.request(request, requestOptions);
|
|
1460
1481
|
},
|
|
1461
1482
|
/**
|
|
1462
1483
|
* Get the IDs of the 10 users with the highest number of records per cluster. Since it can take a few seconds to get the data from the different clusters, the response isn\'t real-time.
|
|
@@ -1476,7 +1497,7 @@ function createSearchClient({
|
|
|
1476
1497
|
queryParameters,
|
|
1477
1498
|
headers
|
|
1478
1499
|
};
|
|
1479
|
-
return transporter.request(request, requestOptions);
|
|
1500
|
+
return this.transporter.request(request, requestOptions);
|
|
1480
1501
|
},
|
|
1481
1502
|
/**
|
|
1482
1503
|
* Returns the user ID data stored in the mapping. Since it can take a few seconds to get the data from the different clusters, the response isn\'t real-time.
|
|
@@ -1501,7 +1522,7 @@ function createSearchClient({
|
|
|
1501
1522
|
queryParameters,
|
|
1502
1523
|
headers
|
|
1503
1524
|
};
|
|
1504
|
-
return transporter.request(request, requestOptions);
|
|
1525
|
+
return this.transporter.request(request, requestOptions);
|
|
1505
1526
|
},
|
|
1506
1527
|
/**
|
|
1507
1528
|
* To determine when the time-consuming process of creating a large batch of users or migrating users from one cluster to another is complete, this operation retrieves the status of the process.
|
|
@@ -1526,7 +1547,7 @@ function createSearchClient({
|
|
|
1526
1547
|
queryParameters,
|
|
1527
1548
|
headers
|
|
1528
1549
|
};
|
|
1529
|
-
return transporter.request(request, requestOptions);
|
|
1550
|
+
return this.transporter.request(request, requestOptions);
|
|
1530
1551
|
},
|
|
1531
1552
|
/**
|
|
1532
1553
|
* Lists all API keys associated with your Algolia application, including their permissions and restrictions.
|
|
@@ -1546,7 +1567,7 @@ function createSearchClient({
|
|
|
1546
1567
|
queryParameters,
|
|
1547
1568
|
headers
|
|
1548
1569
|
};
|
|
1549
|
-
return transporter.request(request, requestOptions);
|
|
1570
|
+
return this.transporter.request(request, requestOptions);
|
|
1550
1571
|
},
|
|
1551
1572
|
/**
|
|
1552
1573
|
* Lists the available clusters in a multi-cluster setup.
|
|
@@ -1566,7 +1587,7 @@ function createSearchClient({
|
|
|
1566
1587
|
queryParameters,
|
|
1567
1588
|
headers
|
|
1568
1589
|
};
|
|
1569
|
-
return transporter.request(request, requestOptions);
|
|
1590
|
+
return this.transporter.request(request, requestOptions);
|
|
1570
1591
|
},
|
|
1571
1592
|
/**
|
|
1572
1593
|
* Lists all indices in the current Algolia application. The request follows any index restrictions of the API key you use to make the request.
|
|
@@ -1595,7 +1616,7 @@ function createSearchClient({
|
|
|
1595
1616
|
queryParameters,
|
|
1596
1617
|
headers
|
|
1597
1618
|
};
|
|
1598
|
-
return transporter.request(request, requestOptions);
|
|
1619
|
+
return this.transporter.request(request, requestOptions);
|
|
1599
1620
|
},
|
|
1600
1621
|
/**
|
|
1601
1622
|
* Lists the userIDs assigned to a multi-cluster application. Since it can take a few seconds to get the data from the different clusters, the response isn\'t real-time.
|
|
@@ -1624,7 +1645,7 @@ function createSearchClient({
|
|
|
1624
1645
|
queryParameters,
|
|
1625
1646
|
headers
|
|
1626
1647
|
};
|
|
1627
|
-
return transporter.request(request, requestOptions);
|
|
1648
|
+
return this.transporter.request(request, requestOptions);
|
|
1628
1649
|
},
|
|
1629
1650
|
/**
|
|
1630
1651
|
* Adds, updates, or deletes records in multiple indices with a single API request. - Actions are applied in the order they are specified. - Actions are equivalent to the individual API requests of the same name.
|
|
@@ -1649,7 +1670,7 @@ function createSearchClient({
|
|
|
1649
1670
|
headers,
|
|
1650
1671
|
data: batchParams
|
|
1651
1672
|
};
|
|
1652
|
-
return transporter.request(request, requestOptions);
|
|
1673
|
+
return this.transporter.request(request, requestOptions);
|
|
1653
1674
|
},
|
|
1654
1675
|
/**
|
|
1655
1676
|
* Copies or moves (renames) an index within the same Algolia application. - Existing destination indices are overwritten, except for their analytics data. - If the destination index doesn\'t exist yet, it\'ll be created. **Copy** - Copying a source index that doesn\'t exist creates a new index with 0 records and default settings. - The API keys of the source index are merged with the existing keys in the destination index. - You can\'t copy the `enableReRanking`, `mode`, and `replicas` settings. - You can\'t copy to a destination index that already has replicas. - Be aware of the [size limits](https://www.algolia.com/doc/guides/scaling/algolia-service-limits/#application-record-and-index-limits). - Related guide: [Copy indices](https://www.algolia.com/doc/guides/sending-and-managing-data/manage-indices-and-apps/manage-indices/how-to/copy-indices/) **Move** - Moving a source index that doesn\'t exist is ignored without returning an error. - When moving an index, the analytics data keep their original name and a new set of analytics data is started for the new name. To access the original analytics in the dashboard, create an index with the original name. - If the destination index has replicas, moving will overwrite the existing index and copy the data to the replica indices. - Related guide: [Move indices](https://www.algolia.com/doc/guides/sending-and-managing-data/manage-indices-and-apps/manage-indices/how-to/move-indices/).
|
|
@@ -1685,7 +1706,7 @@ function createSearchClient({
|
|
|
1685
1706
|
headers,
|
|
1686
1707
|
data: operationIndexParams
|
|
1687
1708
|
};
|
|
1688
|
-
return transporter.request(request, requestOptions);
|
|
1709
|
+
return this.transporter.request(request, requestOptions);
|
|
1689
1710
|
},
|
|
1690
1711
|
/**
|
|
1691
1712
|
* Adds new attributes to a record, or update existing ones. - If a record with the specified object ID doesn\'t exist, a new record is added to the index **if** `createIfNotExists` is true. - If the index doesn\'t exist yet, this method creates a new index. - You can use any first-level attribute but not nested attributes. If you specify a nested attribute, the engine treats it as a replacement for its first-level ancestor. To update an attribute without pushing the entire record, you can use these built-in operations. These operations can be helpful if you don\'t have access to your initial data. - Increment: increment a numeric attribute - Decrement: decrement a numeric attribute - Add: append a number or string element to an array attribute - Remove: remove all matching number or string elements from an array attribute made of numbers or strings - AddUnique: add a number or string element to an array attribute made of numbers or strings only if it\'s not already present - IncrementFrom: increment a numeric integer attribute only if the provided value matches the current value, and otherwise ignore the whole object update. For example, if you pass an IncrementFrom value of 2 for the version attribute, but the current value of the attribute is 1, the engine ignores the update. If the object doesn\'t exist, the engine only creates it if you pass an IncrementFrom value of 0. - IncrementSet: increment a numeric integer attribute only if the provided value is greater than the current value, and otherwise ignore the whole object update. For example, if you pass an IncrementSet value of 2 for the version attribute, and the current value of the attribute is 1, the engine updates the object. If the object doesn\'t exist yet, the engine only creates it if you pass an IncrementSet value that\'s greater than 0. You can specify an operation by providing an object with the attribute to update as the key and its value being an object with the following properties: - _operation: the operation to apply on the attribute - value: the right-hand side argument to the operation, for example, increment or decrement step, value to add or remove.
|
|
@@ -1723,7 +1744,7 @@ function createSearchClient({
|
|
|
1723
1744
|
headers,
|
|
1724
1745
|
data: attributesToUpdate
|
|
1725
1746
|
};
|
|
1726
|
-
return transporter.request(request, requestOptions);
|
|
1747
|
+
return this.transporter.request(request, requestOptions);
|
|
1727
1748
|
},
|
|
1728
1749
|
/**
|
|
1729
1750
|
* Deletes a user ID and its associated data from the clusters.
|
|
@@ -1748,7 +1769,7 @@ function createSearchClient({
|
|
|
1748
1769
|
queryParameters,
|
|
1749
1770
|
headers
|
|
1750
1771
|
};
|
|
1751
|
-
return transporter.request(request, requestOptions);
|
|
1772
|
+
return this.transporter.request(request, requestOptions);
|
|
1752
1773
|
},
|
|
1753
1774
|
/**
|
|
1754
1775
|
* Replaces the list of allowed sources.
|
|
@@ -1774,7 +1795,7 @@ function createSearchClient({
|
|
|
1774
1795
|
headers,
|
|
1775
1796
|
data: source
|
|
1776
1797
|
};
|
|
1777
|
-
return transporter.request(request, requestOptions);
|
|
1798
|
+
return this.transporter.request(request, requestOptions);
|
|
1778
1799
|
},
|
|
1779
1800
|
/**
|
|
1780
1801
|
* Restores a deleted API key. Restoring resets the `validity` attribute to `0`. Algolia stores up to 1,000 API keys per application. If you create more, the oldest API keys are deleted and can\'t be restored.
|
|
@@ -1799,7 +1820,7 @@ function createSearchClient({
|
|
|
1799
1820
|
queryParameters,
|
|
1800
1821
|
headers
|
|
1801
1822
|
};
|
|
1802
|
-
return transporter.request(request, requestOptions);
|
|
1823
|
+
return this.transporter.request(request, requestOptions);
|
|
1803
1824
|
},
|
|
1804
1825
|
/**
|
|
1805
1826
|
* Adds a record to an index or replace it. - If the record doesn\'t have an object ID, a new record with an auto-generated object ID is added to your index. - If a record with the specified object ID exists, the existing record is replaced. - If a record with the specified object ID doesn\'t exist, a new record is added to your index. - If you add a record to an index that doesn\'t exist yet, a new index is created. To update _some_ attributes of a record, use the [`partial` operation](#tag/Records/operation/partialUpdateObject). To add, update, or replace multiple records, use the [`batch` operation](#tag/Records/operation/batch).
|
|
@@ -1829,7 +1850,7 @@ function createSearchClient({
|
|
|
1829
1850
|
headers,
|
|
1830
1851
|
data: body
|
|
1831
1852
|
};
|
|
1832
|
-
return transporter.request(request, requestOptions);
|
|
1853
|
+
return this.transporter.request(request, requestOptions);
|
|
1833
1854
|
},
|
|
1834
1855
|
/**
|
|
1835
1856
|
* If a rule with the specified object ID doesn\'t exist, it\'s created. Otherwise, the existing rule is replaced. To create or update more than one rule, use the [`batch` operation](#tag/Rules/operation/saveRules).
|
|
@@ -1870,7 +1891,7 @@ function createSearchClient({
|
|
|
1870
1891
|
headers,
|
|
1871
1892
|
data: rule
|
|
1872
1893
|
};
|
|
1873
|
-
return transporter.request(request, requestOptions);
|
|
1894
|
+
return this.transporter.request(request, requestOptions);
|
|
1874
1895
|
},
|
|
1875
1896
|
/**
|
|
1876
1897
|
* Create or update multiple rules. If a rule with the specified object ID doesn\'t exist, Algolia creates a new one. Otherwise, existing rules are replaced.
|
|
@@ -1908,7 +1929,7 @@ function createSearchClient({
|
|
|
1908
1929
|
headers,
|
|
1909
1930
|
data: rules
|
|
1910
1931
|
};
|
|
1911
|
-
return transporter.request(request, requestOptions);
|
|
1932
|
+
return this.transporter.request(request, requestOptions);
|
|
1912
1933
|
},
|
|
1913
1934
|
/**
|
|
1914
1935
|
* If a synonym with the specified object ID doesn\'t exist, Algolia adds a new one. Otherwise, the existing synonym is replaced. To add multiple synonyms in a single API request, use the [`batch` operation](#tag/Synonyms/operation/saveSynonyms).
|
|
@@ -1952,7 +1973,7 @@ function createSearchClient({
|
|
|
1952
1973
|
headers,
|
|
1953
1974
|
data: synonymHit
|
|
1954
1975
|
};
|
|
1955
|
-
return transporter.request(request, requestOptions);
|
|
1976
|
+
return this.transporter.request(request, requestOptions);
|
|
1956
1977
|
},
|
|
1957
1978
|
/**
|
|
1958
1979
|
* If a synonym with the `objectID` doesn\'t exist, Algolia adds a new one. Otherwise, existing synonyms are replaced.
|
|
@@ -1990,7 +2011,7 @@ function createSearchClient({
|
|
|
1990
2011
|
headers,
|
|
1991
2012
|
data: synonymHit
|
|
1992
2013
|
};
|
|
1993
|
-
return transporter.request(request, requestOptions);
|
|
2014
|
+
return this.transporter.request(request, requestOptions);
|
|
1994
2015
|
},
|
|
1995
2016
|
/**
|
|
1996
2017
|
* Sends multiple search request to one or more indices. This can be useful in these cases: - Different indices for different purposes, such as, one index for products, another one for marketing content. - Multiple searches to the same index—for example, with different filters.
|
|
@@ -2041,7 +2062,7 @@ function createSearchClient({
|
|
|
2041
2062
|
useReadTransporter: true,
|
|
2042
2063
|
cacheable: true
|
|
2043
2064
|
};
|
|
2044
|
-
return transporter.request(request, requestOptions);
|
|
2065
|
+
return this.transporter.request(request, requestOptions);
|
|
2045
2066
|
},
|
|
2046
2067
|
/**
|
|
2047
2068
|
* Searches for standard and custom dictionary entries.
|
|
@@ -2083,7 +2104,7 @@ function createSearchClient({
|
|
|
2083
2104
|
useReadTransporter: true,
|
|
2084
2105
|
cacheable: true
|
|
2085
2106
|
};
|
|
2086
|
-
return transporter.request(request, requestOptions);
|
|
2107
|
+
return this.transporter.request(request, requestOptions);
|
|
2087
2108
|
},
|
|
2088
2109
|
/**
|
|
2089
2110
|
* Searches for values of a specified facet attribute. - By default, facet values are sorted by decreasing count. You can adjust this with the `sortFacetValueBy` parameter. - Searching for facet values doesn\'t work if you have **more than 65 searchable facets and searchable attributes combined**.
|
|
@@ -2116,7 +2137,7 @@ function createSearchClient({
|
|
|
2116
2137
|
useReadTransporter: true,
|
|
2117
2138
|
cacheable: true
|
|
2118
2139
|
};
|
|
2119
|
-
return transporter.request(request, requestOptions);
|
|
2140
|
+
return this.transporter.request(request, requestOptions);
|
|
2120
2141
|
},
|
|
2121
2142
|
/**
|
|
2122
2143
|
* Searches for rules in your index.
|
|
@@ -2145,7 +2166,7 @@ function createSearchClient({
|
|
|
2145
2166
|
useReadTransporter: true,
|
|
2146
2167
|
cacheable: true
|
|
2147
2168
|
};
|
|
2148
|
-
return transporter.request(request, requestOptions);
|
|
2169
|
+
return this.transporter.request(request, requestOptions);
|
|
2149
2170
|
},
|
|
2150
2171
|
/**
|
|
2151
2172
|
* Searches a single index and return matching search results (_hits_). This method lets you retrieve up to 1,000 hits. If you need more, use the [`browse` operation](#tag/Search/operation/browse) or increase the `paginatedLimitedTo` index setting.
|
|
@@ -2174,7 +2195,7 @@ function createSearchClient({
|
|
|
2174
2195
|
useReadTransporter: true,
|
|
2175
2196
|
cacheable: true
|
|
2176
2197
|
};
|
|
2177
|
-
return transporter.request(request, requestOptions);
|
|
2198
|
+
return this.transporter.request(request, requestOptions);
|
|
2178
2199
|
},
|
|
2179
2200
|
/**
|
|
2180
2201
|
* Searches for synonyms in your index.
|
|
@@ -2206,7 +2227,7 @@ function createSearchClient({
|
|
|
2206
2227
|
useReadTransporter: true,
|
|
2207
2228
|
cacheable: true
|
|
2208
2229
|
};
|
|
2209
|
-
return transporter.request(request, requestOptions);
|
|
2230
|
+
return this.transporter.request(request, requestOptions);
|
|
2210
2231
|
},
|
|
2211
2232
|
/**
|
|
2212
2233
|
* Since it can take a few seconds to get the data from the different clusters, the response isn\'t real-time. To ensure rapid updates, the user IDs index isn\'t built at the same time as the mapping. Instead, it\'s built every 12 hours, at the same time as the update of user ID usage. For example, if you add or move a user ID, the search will show an old value until the next time the mapping is rebuilt (every 12 hours).
|
|
@@ -2236,7 +2257,7 @@ function createSearchClient({
|
|
|
2236
2257
|
useReadTransporter: true,
|
|
2237
2258
|
cacheable: true
|
|
2238
2259
|
};
|
|
2239
|
-
return transporter.request(request, requestOptions);
|
|
2260
|
+
return this.transporter.request(request, requestOptions);
|
|
2240
2261
|
},
|
|
2241
2262
|
/**
|
|
2242
2263
|
* Turns standard stop word dictionary entries on or off for a given language.
|
|
@@ -2266,7 +2287,7 @@ function createSearchClient({
|
|
|
2266
2287
|
headers,
|
|
2267
2288
|
data: dictionarySettingsParams
|
|
2268
2289
|
};
|
|
2269
|
-
return transporter.request(request, requestOptions);
|
|
2290
|
+
return this.transporter.request(request, requestOptions);
|
|
2270
2291
|
},
|
|
2271
2292
|
/**
|
|
2272
2293
|
* Update the specified index settings. Index settings that you don\'t specify are left unchanged. Specify `null` to reset a setting to its default value. For best performance, update the index settings before you add new records to your index.
|
|
@@ -2300,7 +2321,7 @@ function createSearchClient({
|
|
|
2300
2321
|
headers,
|
|
2301
2322
|
data: indexSettings
|
|
2302
2323
|
};
|
|
2303
|
-
return transporter.request(request, requestOptions);
|
|
2324
|
+
return this.transporter.request(request, requestOptions);
|
|
2304
2325
|
},
|
|
2305
2326
|
/**
|
|
2306
2327
|
* Replaces the permissions of an existing API key. Any unspecified attribute resets that attribute to its default value.
|
|
@@ -2333,7 +2354,7 @@ function createSearchClient({
|
|
|
2333
2354
|
headers,
|
|
2334
2355
|
data: apiKey
|
|
2335
2356
|
};
|
|
2336
|
-
return transporter.request(request, requestOptions);
|
|
2357
|
+
return this.transporter.request(request, requestOptions);
|
|
2337
2358
|
}
|
|
2338
2359
|
};
|
|
2339
2360
|
}
|
|
@@ -2370,7 +2391,7 @@ function searchClient(appId, apiKey, options) {
|
|
|
2370
2391
|
* @param generateSecuredApiKey.parentApiKey - The base API key from which to generate the new secured one.
|
|
2371
2392
|
* @param generateSecuredApiKey.restrictions - A set of properties defining the restrictions of the secured API key.
|
|
2372
2393
|
*/
|
|
2373
|
-
generateSecuredApiKey({ parentApiKey, restrictions = {} }) {
|
|
2394
|
+
generateSecuredApiKey: ({ parentApiKey, restrictions = {} }) => {
|
|
2374
2395
|
let mergedRestrictions = restrictions;
|
|
2375
2396
|
if (restrictions.searchParams) {
|
|
2376
2397
|
mergedRestrictions = {
|
|
@@ -2398,7 +2419,7 @@ function searchClient(appId, apiKey, options) {
|
|
|
2398
2419
|
* @param getSecuredApiKeyRemainingValidity - The `getSecuredApiKeyRemainingValidity` object.
|
|
2399
2420
|
* @param getSecuredApiKeyRemainingValidity.securedApiKey - The secured API key generated with the `generateSecuredApiKey` method.
|
|
2400
2421
|
*/
|
|
2401
|
-
getSecuredApiKeyRemainingValidity({ securedApiKey }) {
|
|
2422
|
+
getSecuredApiKeyRemainingValidity: ({ securedApiKey }) => {
|
|
2402
2423
|
const decodedString = Buffer.from(securedApiKey, "base64").toString("ascii");
|
|
2403
2424
|
const regex = /validUntil=(\d+)/;
|
|
2404
2425
|
const match = decodedString.match(regex);
|