@algolia/client-search 5.2.5 → 5.3.1
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 +118 -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 +112 -87
- package/dist/builds/node.cjs.map +1 -1
- package/dist/builds/node.js +120 -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 +110 -85
- package/dist/src/searchClient.cjs.map +1 -1
- package/dist/src/searchClient.js +118 -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.1";
|
|
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,20 @@ 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
|
+
if (!authMode || authMode === "WithinHeaders") {
|
|
128
|
+
this.transporter.baseHeaders["x-algolia-api-key"] = apiKey;
|
|
129
|
+
} else {
|
|
130
|
+
this.transporter.baseQueryParameters["x-algolia-api-key"] = apiKey;
|
|
131
|
+
}
|
|
118
132
|
},
|
|
119
133
|
/**
|
|
120
134
|
* Helper: Wait for a task to be published (completed) for a given `indexName` and `taskID`.
|
|
@@ -478,6 +492,17 @@ function createSearchClient({
|
|
|
478
492
|
});
|
|
479
493
|
return { copyOperationResponse, batchResponses, moveOperationResponse };
|
|
480
494
|
},
|
|
495
|
+
async indexExists({ indexName }) {
|
|
496
|
+
try {
|
|
497
|
+
await this.getSettings({ indexName });
|
|
498
|
+
} catch (error) {
|
|
499
|
+
if (error instanceof import_client_common.ApiError && error.status === 404) {
|
|
500
|
+
return false;
|
|
501
|
+
}
|
|
502
|
+
throw error;
|
|
503
|
+
}
|
|
504
|
+
return true;
|
|
505
|
+
},
|
|
481
506
|
/**
|
|
482
507
|
* Helper: calls the `search` method but with certainty that we will only request Algolia records (hits) and not facets.
|
|
483
508
|
* 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 +551,7 @@ function createSearchClient({
|
|
|
526
551
|
headers,
|
|
527
552
|
data: apiKey
|
|
528
553
|
};
|
|
529
|
-
return transporter.request(request, requestOptions);
|
|
554
|
+
return this.transporter.request(request, requestOptions);
|
|
530
555
|
},
|
|
531
556
|
/**
|
|
532
557
|
* 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 +585,7 @@ function createSearchClient({
|
|
|
560
585
|
headers,
|
|
561
586
|
data: body
|
|
562
587
|
};
|
|
563
|
-
return transporter.request(request, requestOptions);
|
|
588
|
+
return this.transporter.request(request, requestOptions);
|
|
564
589
|
},
|
|
565
590
|
/**
|
|
566
591
|
* Adds a source to the list of allowed sources.
|
|
@@ -588,7 +613,7 @@ function createSearchClient({
|
|
|
588
613
|
headers,
|
|
589
614
|
data: source
|
|
590
615
|
};
|
|
591
|
-
return transporter.request(request, requestOptions);
|
|
616
|
+
return this.transporter.request(request, requestOptions);
|
|
592
617
|
},
|
|
593
618
|
/**
|
|
594
619
|
* 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 +649,7 @@ function createSearchClient({
|
|
|
624
649
|
headers,
|
|
625
650
|
data: assignUserIdParams
|
|
626
651
|
};
|
|
627
|
-
return transporter.request(request, requestOptions);
|
|
652
|
+
return this.transporter.request(request, requestOptions);
|
|
628
653
|
},
|
|
629
654
|
/**
|
|
630
655
|
* 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 +679,7 @@ function createSearchClient({
|
|
|
654
679
|
headers,
|
|
655
680
|
data: batchWriteParams
|
|
656
681
|
};
|
|
657
|
-
return transporter.request(request, requestOptions);
|
|
682
|
+
return this.transporter.request(request, requestOptions);
|
|
658
683
|
},
|
|
659
684
|
/**
|
|
660
685
|
* Assigns multiple user IDs to a cluster. **You can\'t move users with this operation**.
|
|
@@ -693,7 +718,7 @@ function createSearchClient({
|
|
|
693
718
|
headers,
|
|
694
719
|
data: batchAssignUserIdsParams
|
|
695
720
|
};
|
|
696
|
-
return transporter.request(request, requestOptions);
|
|
721
|
+
return this.transporter.request(request, requestOptions);
|
|
697
722
|
},
|
|
698
723
|
/**
|
|
699
724
|
* Adds or deletes multiple entries from your plurals, segmentation, or stop word dictionaries.
|
|
@@ -731,7 +756,7 @@ function createSearchClient({
|
|
|
731
756
|
headers,
|
|
732
757
|
data: batchDictionaryEntriesParams
|
|
733
758
|
};
|
|
734
|
-
return transporter.request(request, requestOptions);
|
|
759
|
+
return this.transporter.request(request, requestOptions);
|
|
735
760
|
},
|
|
736
761
|
/**
|
|
737
762
|
* 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 +783,7 @@ function createSearchClient({
|
|
|
758
783
|
headers,
|
|
759
784
|
data: browseParams ? browseParams : {}
|
|
760
785
|
};
|
|
761
|
-
return transporter.request(request, requestOptions);
|
|
786
|
+
return this.transporter.request(request, requestOptions);
|
|
762
787
|
},
|
|
763
788
|
/**
|
|
764
789
|
* Deletes only the records from an index while keeping settings, synonyms, and rules.
|
|
@@ -783,7 +808,7 @@ function createSearchClient({
|
|
|
783
808
|
queryParameters,
|
|
784
809
|
headers
|
|
785
810
|
};
|
|
786
|
-
return transporter.request(request, requestOptions);
|
|
811
|
+
return this.transporter.request(request, requestOptions);
|
|
787
812
|
},
|
|
788
813
|
/**
|
|
789
814
|
* Deletes all rules from the index.
|
|
@@ -812,7 +837,7 @@ function createSearchClient({
|
|
|
812
837
|
queryParameters,
|
|
813
838
|
headers
|
|
814
839
|
};
|
|
815
|
-
return transporter.request(request, requestOptions);
|
|
840
|
+
return this.transporter.request(request, requestOptions);
|
|
816
841
|
},
|
|
817
842
|
/**
|
|
818
843
|
* Deletes all synonyms from the index.
|
|
@@ -841,7 +866,7 @@ function createSearchClient({
|
|
|
841
866
|
queryParameters,
|
|
842
867
|
headers
|
|
843
868
|
};
|
|
844
|
-
return transporter.request(request, requestOptions);
|
|
869
|
+
return this.transporter.request(request, requestOptions);
|
|
845
870
|
},
|
|
846
871
|
/**
|
|
847
872
|
* This method allow you to send requests to the Algolia REST API.
|
|
@@ -864,7 +889,7 @@ function createSearchClient({
|
|
|
864
889
|
queryParameters,
|
|
865
890
|
headers
|
|
866
891
|
};
|
|
867
|
-
return transporter.request(request, requestOptions);
|
|
892
|
+
return this.transporter.request(request, requestOptions);
|
|
868
893
|
},
|
|
869
894
|
/**
|
|
870
895
|
* This method allow you to send requests to the Algolia REST API.
|
|
@@ -887,7 +912,7 @@ function createSearchClient({
|
|
|
887
912
|
queryParameters,
|
|
888
913
|
headers
|
|
889
914
|
};
|
|
890
|
-
return transporter.request(request, requestOptions);
|
|
915
|
+
return this.transporter.request(request, requestOptions);
|
|
891
916
|
},
|
|
892
917
|
/**
|
|
893
918
|
* This method allow you to send requests to the Algolia REST API.
|
|
@@ -912,7 +937,7 @@ function createSearchClient({
|
|
|
912
937
|
headers,
|
|
913
938
|
data: body ? body : {}
|
|
914
939
|
};
|
|
915
|
-
return transporter.request(request, requestOptions);
|
|
940
|
+
return this.transporter.request(request, requestOptions);
|
|
916
941
|
},
|
|
917
942
|
/**
|
|
918
943
|
* This method allow you to send requests to the Algolia REST API.
|
|
@@ -937,7 +962,7 @@ function createSearchClient({
|
|
|
937
962
|
headers,
|
|
938
963
|
data: body ? body : {}
|
|
939
964
|
};
|
|
940
|
-
return transporter.request(request, requestOptions);
|
|
965
|
+
return this.transporter.request(request, requestOptions);
|
|
941
966
|
},
|
|
942
967
|
/**
|
|
943
968
|
* Deletes the API key.
|
|
@@ -962,7 +987,7 @@ function createSearchClient({
|
|
|
962
987
|
queryParameters,
|
|
963
988
|
headers
|
|
964
989
|
};
|
|
965
|
-
return transporter.request(request, requestOptions);
|
|
990
|
+
return this.transporter.request(request, requestOptions);
|
|
966
991
|
},
|
|
967
992
|
/**
|
|
968
993
|
* 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 +1017,7 @@ function createSearchClient({
|
|
|
992
1017
|
headers,
|
|
993
1018
|
data: deleteByParams
|
|
994
1019
|
};
|
|
995
|
-
return transporter.request(request, requestOptions);
|
|
1020
|
+
return this.transporter.request(request, requestOptions);
|
|
996
1021
|
},
|
|
997
1022
|
/**
|
|
998
1023
|
* 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 +1042,7 @@ function createSearchClient({
|
|
|
1017
1042
|
queryParameters,
|
|
1018
1043
|
headers
|
|
1019
1044
|
};
|
|
1020
|
-
return transporter.request(request, requestOptions);
|
|
1045
|
+
return this.transporter.request(request, requestOptions);
|
|
1021
1046
|
},
|
|
1022
1047
|
/**
|
|
1023
1048
|
* 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 +1071,7 @@ function createSearchClient({
|
|
|
1046
1071
|
queryParameters,
|
|
1047
1072
|
headers
|
|
1048
1073
|
};
|
|
1049
|
-
return transporter.request(request, requestOptions);
|
|
1074
|
+
return this.transporter.request(request, requestOptions);
|
|
1050
1075
|
},
|
|
1051
1076
|
/**
|
|
1052
1077
|
* Deletes a rule by its ID. To find the object ID for rules, use the [`search` operation](#tag/Rules/operation/searchRules).
|
|
@@ -1079,7 +1104,7 @@ function createSearchClient({
|
|
|
1079
1104
|
queryParameters,
|
|
1080
1105
|
headers
|
|
1081
1106
|
};
|
|
1082
|
-
return transporter.request(request, requestOptions);
|
|
1107
|
+
return this.transporter.request(request, requestOptions);
|
|
1083
1108
|
},
|
|
1084
1109
|
/**
|
|
1085
1110
|
* Deletes a source from the list of allowed sources.
|
|
@@ -1104,7 +1129,7 @@ function createSearchClient({
|
|
|
1104
1129
|
queryParameters,
|
|
1105
1130
|
headers
|
|
1106
1131
|
};
|
|
1107
|
-
return transporter.request(request, requestOptions);
|
|
1132
|
+
return this.transporter.request(request, requestOptions);
|
|
1108
1133
|
},
|
|
1109
1134
|
/**
|
|
1110
1135
|
* Deletes a synonym by its ID. To find the object IDs of your synonyms, use the [`search` operation](#tag/Synonyms/operation/searchSynonyms).
|
|
@@ -1137,7 +1162,7 @@ function createSearchClient({
|
|
|
1137
1162
|
queryParameters,
|
|
1138
1163
|
headers
|
|
1139
1164
|
};
|
|
1140
|
-
return transporter.request(request, requestOptions);
|
|
1165
|
+
return this.transporter.request(request, requestOptions);
|
|
1141
1166
|
},
|
|
1142
1167
|
/**
|
|
1143
1168
|
* 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 +1184,7 @@ function createSearchClient({
|
|
|
1159
1184
|
queryParameters,
|
|
1160
1185
|
headers
|
|
1161
1186
|
};
|
|
1162
|
-
return transporter.request(request, requestOptions);
|
|
1187
|
+
return this.transporter.request(request, requestOptions);
|
|
1163
1188
|
},
|
|
1164
1189
|
/**
|
|
1165
1190
|
* Checks the status of a given application task.
|
|
@@ -1184,7 +1209,7 @@ function createSearchClient({
|
|
|
1184
1209
|
queryParameters,
|
|
1185
1210
|
headers
|
|
1186
1211
|
};
|
|
1187
|
-
return transporter.request(request, requestOptions);
|
|
1212
|
+
return this.transporter.request(request, requestOptions);
|
|
1188
1213
|
},
|
|
1189
1214
|
/**
|
|
1190
1215
|
* Lists supported languages with their supported dictionary types and number of custom entries.
|
|
@@ -1204,7 +1229,7 @@ function createSearchClient({
|
|
|
1204
1229
|
queryParameters,
|
|
1205
1230
|
headers
|
|
1206
1231
|
};
|
|
1207
|
-
return transporter.request(request, requestOptions);
|
|
1232
|
+
return this.transporter.request(request, requestOptions);
|
|
1208
1233
|
},
|
|
1209
1234
|
/**
|
|
1210
1235
|
* Retrieves the languages for which standard dictionary entries are turned off.
|
|
@@ -1224,7 +1249,7 @@ function createSearchClient({
|
|
|
1224
1249
|
queryParameters,
|
|
1225
1250
|
headers
|
|
1226
1251
|
};
|
|
1227
|
-
return transporter.request(request, requestOptions);
|
|
1252
|
+
return this.transporter.request(request, requestOptions);
|
|
1228
1253
|
},
|
|
1229
1254
|
/**
|
|
1230
1255
|
* 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 +1286,7 @@ function createSearchClient({
|
|
|
1261
1286
|
queryParameters,
|
|
1262
1287
|
headers
|
|
1263
1288
|
};
|
|
1264
|
-
return transporter.request(request, requestOptions);
|
|
1289
|
+
return this.transporter.request(request, requestOptions);
|
|
1265
1290
|
},
|
|
1266
1291
|
/**
|
|
1267
1292
|
* Retrieves one record by its object ID. To retrieve more than one record, use the [`objects` operation](#tag/Records/operation/getObjects).
|
|
@@ -1294,7 +1319,7 @@ function createSearchClient({
|
|
|
1294
1319
|
queryParameters,
|
|
1295
1320
|
headers
|
|
1296
1321
|
};
|
|
1297
|
-
return transporter.request(request, requestOptions);
|
|
1322
|
+
return this.transporter.request(request, requestOptions);
|
|
1298
1323
|
},
|
|
1299
1324
|
/**
|
|
1300
1325
|
* Retrieves one or more records, potentially from different indices. Records are returned in the same order as the requests.
|
|
@@ -1324,7 +1349,7 @@ function createSearchClient({
|
|
|
1324
1349
|
useReadTransporter: true,
|
|
1325
1350
|
cacheable: true
|
|
1326
1351
|
};
|
|
1327
|
-
return transporter.request(request, requestOptions);
|
|
1352
|
+
return this.transporter.request(request, requestOptions);
|
|
1328
1353
|
},
|
|
1329
1354
|
/**
|
|
1330
1355
|
* Retrieves a rule by its ID. To find the object ID of rules, use the [`search` operation](#tag/Rules/operation/searchRules).
|
|
@@ -1353,7 +1378,7 @@ function createSearchClient({
|
|
|
1353
1378
|
queryParameters,
|
|
1354
1379
|
headers
|
|
1355
1380
|
};
|
|
1356
|
-
return transporter.request(request, requestOptions);
|
|
1381
|
+
return this.transporter.request(request, requestOptions);
|
|
1357
1382
|
},
|
|
1358
1383
|
/**
|
|
1359
1384
|
* Retrieves an object with non-null index settings.
|
|
@@ -1378,7 +1403,7 @@ function createSearchClient({
|
|
|
1378
1403
|
queryParameters,
|
|
1379
1404
|
headers
|
|
1380
1405
|
};
|
|
1381
|
-
return transporter.request(request, requestOptions);
|
|
1406
|
+
return this.transporter.request(request, requestOptions);
|
|
1382
1407
|
},
|
|
1383
1408
|
/**
|
|
1384
1409
|
* Retrieves all allowed IP addresses with access to your application.
|
|
@@ -1398,7 +1423,7 @@ function createSearchClient({
|
|
|
1398
1423
|
queryParameters,
|
|
1399
1424
|
headers
|
|
1400
1425
|
};
|
|
1401
|
-
return transporter.request(request, requestOptions);
|
|
1426
|
+
return this.transporter.request(request, requestOptions);
|
|
1402
1427
|
},
|
|
1403
1428
|
/**
|
|
1404
1429
|
* Retrieves a syonym by its ID. To find the object IDs for your synonyms, use the [`search` operation](#tag/Synonyms/operation/searchSynonyms).
|
|
@@ -1427,7 +1452,7 @@ function createSearchClient({
|
|
|
1427
1452
|
queryParameters,
|
|
1428
1453
|
headers
|
|
1429
1454
|
};
|
|
1430
|
-
return transporter.request(request, requestOptions);
|
|
1455
|
+
return this.transporter.request(request, requestOptions);
|
|
1431
1456
|
},
|
|
1432
1457
|
/**
|
|
1433
1458
|
* 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 +1481,7 @@ function createSearchClient({
|
|
|
1456
1481
|
queryParameters,
|
|
1457
1482
|
headers
|
|
1458
1483
|
};
|
|
1459
|
-
return transporter.request(request, requestOptions);
|
|
1484
|
+
return this.transporter.request(request, requestOptions);
|
|
1460
1485
|
},
|
|
1461
1486
|
/**
|
|
1462
1487
|
* 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 +1501,7 @@ function createSearchClient({
|
|
|
1476
1501
|
queryParameters,
|
|
1477
1502
|
headers
|
|
1478
1503
|
};
|
|
1479
|
-
return transporter.request(request, requestOptions);
|
|
1504
|
+
return this.transporter.request(request, requestOptions);
|
|
1480
1505
|
},
|
|
1481
1506
|
/**
|
|
1482
1507
|
* 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 +1526,7 @@ function createSearchClient({
|
|
|
1501
1526
|
queryParameters,
|
|
1502
1527
|
headers
|
|
1503
1528
|
};
|
|
1504
|
-
return transporter.request(request, requestOptions);
|
|
1529
|
+
return this.transporter.request(request, requestOptions);
|
|
1505
1530
|
},
|
|
1506
1531
|
/**
|
|
1507
1532
|
* 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 +1551,7 @@ function createSearchClient({
|
|
|
1526
1551
|
queryParameters,
|
|
1527
1552
|
headers
|
|
1528
1553
|
};
|
|
1529
|
-
return transporter.request(request, requestOptions);
|
|
1554
|
+
return this.transporter.request(request, requestOptions);
|
|
1530
1555
|
},
|
|
1531
1556
|
/**
|
|
1532
1557
|
* Lists all API keys associated with your Algolia application, including their permissions and restrictions.
|
|
@@ -1546,7 +1571,7 @@ function createSearchClient({
|
|
|
1546
1571
|
queryParameters,
|
|
1547
1572
|
headers
|
|
1548
1573
|
};
|
|
1549
|
-
return transporter.request(request, requestOptions);
|
|
1574
|
+
return this.transporter.request(request, requestOptions);
|
|
1550
1575
|
},
|
|
1551
1576
|
/**
|
|
1552
1577
|
* Lists the available clusters in a multi-cluster setup.
|
|
@@ -1566,7 +1591,7 @@ function createSearchClient({
|
|
|
1566
1591
|
queryParameters,
|
|
1567
1592
|
headers
|
|
1568
1593
|
};
|
|
1569
|
-
return transporter.request(request, requestOptions);
|
|
1594
|
+
return this.transporter.request(request, requestOptions);
|
|
1570
1595
|
},
|
|
1571
1596
|
/**
|
|
1572
1597
|
* 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 +1620,7 @@ function createSearchClient({
|
|
|
1595
1620
|
queryParameters,
|
|
1596
1621
|
headers
|
|
1597
1622
|
};
|
|
1598
|
-
return transporter.request(request, requestOptions);
|
|
1623
|
+
return this.transporter.request(request, requestOptions);
|
|
1599
1624
|
},
|
|
1600
1625
|
/**
|
|
1601
1626
|
* 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 +1649,7 @@ function createSearchClient({
|
|
|
1624
1649
|
queryParameters,
|
|
1625
1650
|
headers
|
|
1626
1651
|
};
|
|
1627
|
-
return transporter.request(request, requestOptions);
|
|
1652
|
+
return this.transporter.request(request, requestOptions);
|
|
1628
1653
|
},
|
|
1629
1654
|
/**
|
|
1630
1655
|
* 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 +1674,7 @@ function createSearchClient({
|
|
|
1649
1674
|
headers,
|
|
1650
1675
|
data: batchParams
|
|
1651
1676
|
};
|
|
1652
|
-
return transporter.request(request, requestOptions);
|
|
1677
|
+
return this.transporter.request(request, requestOptions);
|
|
1653
1678
|
},
|
|
1654
1679
|
/**
|
|
1655
1680
|
* 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 +1710,7 @@ function createSearchClient({
|
|
|
1685
1710
|
headers,
|
|
1686
1711
|
data: operationIndexParams
|
|
1687
1712
|
};
|
|
1688
|
-
return transporter.request(request, requestOptions);
|
|
1713
|
+
return this.transporter.request(request, requestOptions);
|
|
1689
1714
|
},
|
|
1690
1715
|
/**
|
|
1691
1716
|
* 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 +1748,7 @@ function createSearchClient({
|
|
|
1723
1748
|
headers,
|
|
1724
1749
|
data: attributesToUpdate
|
|
1725
1750
|
};
|
|
1726
|
-
return transporter.request(request, requestOptions);
|
|
1751
|
+
return this.transporter.request(request, requestOptions);
|
|
1727
1752
|
},
|
|
1728
1753
|
/**
|
|
1729
1754
|
* Deletes a user ID and its associated data from the clusters.
|
|
@@ -1748,7 +1773,7 @@ function createSearchClient({
|
|
|
1748
1773
|
queryParameters,
|
|
1749
1774
|
headers
|
|
1750
1775
|
};
|
|
1751
|
-
return transporter.request(request, requestOptions);
|
|
1776
|
+
return this.transporter.request(request, requestOptions);
|
|
1752
1777
|
},
|
|
1753
1778
|
/**
|
|
1754
1779
|
* Replaces the list of allowed sources.
|
|
@@ -1774,7 +1799,7 @@ function createSearchClient({
|
|
|
1774
1799
|
headers,
|
|
1775
1800
|
data: source
|
|
1776
1801
|
};
|
|
1777
|
-
return transporter.request(request, requestOptions);
|
|
1802
|
+
return this.transporter.request(request, requestOptions);
|
|
1778
1803
|
},
|
|
1779
1804
|
/**
|
|
1780
1805
|
* 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 +1824,7 @@ function createSearchClient({
|
|
|
1799
1824
|
queryParameters,
|
|
1800
1825
|
headers
|
|
1801
1826
|
};
|
|
1802
|
-
return transporter.request(request, requestOptions);
|
|
1827
|
+
return this.transporter.request(request, requestOptions);
|
|
1803
1828
|
},
|
|
1804
1829
|
/**
|
|
1805
1830
|
* 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 +1854,7 @@ function createSearchClient({
|
|
|
1829
1854
|
headers,
|
|
1830
1855
|
data: body
|
|
1831
1856
|
};
|
|
1832
|
-
return transporter.request(request, requestOptions);
|
|
1857
|
+
return this.transporter.request(request, requestOptions);
|
|
1833
1858
|
},
|
|
1834
1859
|
/**
|
|
1835
1860
|
* 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 +1895,7 @@ function createSearchClient({
|
|
|
1870
1895
|
headers,
|
|
1871
1896
|
data: rule
|
|
1872
1897
|
};
|
|
1873
|
-
return transporter.request(request, requestOptions);
|
|
1898
|
+
return this.transporter.request(request, requestOptions);
|
|
1874
1899
|
},
|
|
1875
1900
|
/**
|
|
1876
1901
|
* 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 +1933,7 @@ function createSearchClient({
|
|
|
1908
1933
|
headers,
|
|
1909
1934
|
data: rules
|
|
1910
1935
|
};
|
|
1911
|
-
return transporter.request(request, requestOptions);
|
|
1936
|
+
return this.transporter.request(request, requestOptions);
|
|
1912
1937
|
},
|
|
1913
1938
|
/**
|
|
1914
1939
|
* 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 +1977,7 @@ function createSearchClient({
|
|
|
1952
1977
|
headers,
|
|
1953
1978
|
data: synonymHit
|
|
1954
1979
|
};
|
|
1955
|
-
return transporter.request(request, requestOptions);
|
|
1980
|
+
return this.transporter.request(request, requestOptions);
|
|
1956
1981
|
},
|
|
1957
1982
|
/**
|
|
1958
1983
|
* If a synonym with the `objectID` doesn\'t exist, Algolia adds a new one. Otherwise, existing synonyms are replaced.
|
|
@@ -1990,7 +2015,7 @@ function createSearchClient({
|
|
|
1990
2015
|
headers,
|
|
1991
2016
|
data: synonymHit
|
|
1992
2017
|
};
|
|
1993
|
-
return transporter.request(request, requestOptions);
|
|
2018
|
+
return this.transporter.request(request, requestOptions);
|
|
1994
2019
|
},
|
|
1995
2020
|
/**
|
|
1996
2021
|
* 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 +2066,7 @@ function createSearchClient({
|
|
|
2041
2066
|
useReadTransporter: true,
|
|
2042
2067
|
cacheable: true
|
|
2043
2068
|
};
|
|
2044
|
-
return transporter.request(request, requestOptions);
|
|
2069
|
+
return this.transporter.request(request, requestOptions);
|
|
2045
2070
|
},
|
|
2046
2071
|
/**
|
|
2047
2072
|
* Searches for standard and custom dictionary entries.
|
|
@@ -2083,7 +2108,7 @@ function createSearchClient({
|
|
|
2083
2108
|
useReadTransporter: true,
|
|
2084
2109
|
cacheable: true
|
|
2085
2110
|
};
|
|
2086
|
-
return transporter.request(request, requestOptions);
|
|
2111
|
+
return this.transporter.request(request, requestOptions);
|
|
2087
2112
|
},
|
|
2088
2113
|
/**
|
|
2089
2114
|
* 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 +2141,7 @@ function createSearchClient({
|
|
|
2116
2141
|
useReadTransporter: true,
|
|
2117
2142
|
cacheable: true
|
|
2118
2143
|
};
|
|
2119
|
-
return transporter.request(request, requestOptions);
|
|
2144
|
+
return this.transporter.request(request, requestOptions);
|
|
2120
2145
|
},
|
|
2121
2146
|
/**
|
|
2122
2147
|
* Searches for rules in your index.
|
|
@@ -2145,7 +2170,7 @@ function createSearchClient({
|
|
|
2145
2170
|
useReadTransporter: true,
|
|
2146
2171
|
cacheable: true
|
|
2147
2172
|
};
|
|
2148
|
-
return transporter.request(request, requestOptions);
|
|
2173
|
+
return this.transporter.request(request, requestOptions);
|
|
2149
2174
|
},
|
|
2150
2175
|
/**
|
|
2151
2176
|
* 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 +2199,7 @@ function createSearchClient({
|
|
|
2174
2199
|
useReadTransporter: true,
|
|
2175
2200
|
cacheable: true
|
|
2176
2201
|
};
|
|
2177
|
-
return transporter.request(request, requestOptions);
|
|
2202
|
+
return this.transporter.request(request, requestOptions);
|
|
2178
2203
|
},
|
|
2179
2204
|
/**
|
|
2180
2205
|
* Searches for synonyms in your index.
|
|
@@ -2206,7 +2231,7 @@ function createSearchClient({
|
|
|
2206
2231
|
useReadTransporter: true,
|
|
2207
2232
|
cacheable: true
|
|
2208
2233
|
};
|
|
2209
|
-
return transporter.request(request, requestOptions);
|
|
2234
|
+
return this.transporter.request(request, requestOptions);
|
|
2210
2235
|
},
|
|
2211
2236
|
/**
|
|
2212
2237
|
* 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 +2261,7 @@ function createSearchClient({
|
|
|
2236
2261
|
useReadTransporter: true,
|
|
2237
2262
|
cacheable: true
|
|
2238
2263
|
};
|
|
2239
|
-
return transporter.request(request, requestOptions);
|
|
2264
|
+
return this.transporter.request(request, requestOptions);
|
|
2240
2265
|
},
|
|
2241
2266
|
/**
|
|
2242
2267
|
* Turns standard stop word dictionary entries on or off for a given language.
|
|
@@ -2266,7 +2291,7 @@ function createSearchClient({
|
|
|
2266
2291
|
headers,
|
|
2267
2292
|
data: dictionarySettingsParams
|
|
2268
2293
|
};
|
|
2269
|
-
return transporter.request(request, requestOptions);
|
|
2294
|
+
return this.transporter.request(request, requestOptions);
|
|
2270
2295
|
},
|
|
2271
2296
|
/**
|
|
2272
2297
|
* 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 +2325,7 @@ function createSearchClient({
|
|
|
2300
2325
|
headers,
|
|
2301
2326
|
data: indexSettings
|
|
2302
2327
|
};
|
|
2303
|
-
return transporter.request(request, requestOptions);
|
|
2328
|
+
return this.transporter.request(request, requestOptions);
|
|
2304
2329
|
},
|
|
2305
2330
|
/**
|
|
2306
2331
|
* Replaces the permissions of an existing API key. Any unspecified attribute resets that attribute to its default value.
|
|
@@ -2333,7 +2358,7 @@ function createSearchClient({
|
|
|
2333
2358
|
headers,
|
|
2334
2359
|
data: apiKey
|
|
2335
2360
|
};
|
|
2336
|
-
return transporter.request(request, requestOptions);
|
|
2361
|
+
return this.transporter.request(request, requestOptions);
|
|
2337
2362
|
}
|
|
2338
2363
|
};
|
|
2339
2364
|
}
|
|
@@ -2370,7 +2395,7 @@ function searchClient(appId, apiKey, options) {
|
|
|
2370
2395
|
* @param generateSecuredApiKey.parentApiKey - The base API key from which to generate the new secured one.
|
|
2371
2396
|
* @param generateSecuredApiKey.restrictions - A set of properties defining the restrictions of the secured API key.
|
|
2372
2397
|
*/
|
|
2373
|
-
generateSecuredApiKey({ parentApiKey, restrictions = {} }) {
|
|
2398
|
+
generateSecuredApiKey: ({ parentApiKey, restrictions = {} }) => {
|
|
2374
2399
|
let mergedRestrictions = restrictions;
|
|
2375
2400
|
if (restrictions.searchParams) {
|
|
2376
2401
|
mergedRestrictions = {
|
|
@@ -2398,7 +2423,7 @@ function searchClient(appId, apiKey, options) {
|
|
|
2398
2423
|
* @param getSecuredApiKeyRemainingValidity - The `getSecuredApiKeyRemainingValidity` object.
|
|
2399
2424
|
* @param getSecuredApiKeyRemainingValidity.securedApiKey - The secured API key generated with the `generateSecuredApiKey` method.
|
|
2400
2425
|
*/
|
|
2401
|
-
getSecuredApiKeyRemainingValidity({ securedApiKey }) {
|
|
2426
|
+
getSecuredApiKeyRemainingValidity: ({ securedApiKey }) => {
|
|
2402
2427
|
const decodedString = Buffer.from(securedApiKey, "base64").toString("ascii");
|
|
2403
2428
|
const regex = /validUntil=(\d+)/;
|
|
2404
2429
|
const match = decodedString.match(regex);
|