@algolia/client-search 5.0.0-alpha.1 → 5.0.0-alpha.10
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/builds/browser.d.ts +2 -2
- package/dist/builds/browser.d.ts.map +1 -1
- package/dist/builds/node.d.ts +2 -2
- package/dist/builds/node.d.ts.map +1 -1
- package/dist/client-search.cjs.js +159 -37
- package/dist/client-search.esm.browser.js +192 -68
- package/dist/client-search.esm.node.js +160 -38
- package/dist/client-search.umd.js +2 -2
- package/dist/model/acl.d.ts +3 -0
- package/dist/model/acl.d.ts.map +1 -1
- package/dist/model/action.d.ts.map +1 -1
- package/dist/model/addApiKeyResponse.d.ts +1 -1
- package/dist/model/addApiKeyResponse.d.ts.map +1 -1
- package/dist/model/advancedSyntaxFeatures.d.ts.map +1 -1
- package/dist/model/alternativesAsExact.d.ts.map +1 -1
- package/dist/model/anchoring.d.ts.map +1 -1
- package/dist/model/apiKey.d.ts.map +1 -1
- package/dist/model/aroundRadius.d.ts.map +1 -1
- package/dist/model/aroundRadiusAll.d.ts.map +1 -1
- package/dist/model/assignUserIdParams.d.ts.map +1 -1
- package/dist/model/attributeToUpdate.d.ts +3 -0
- package/dist/model/attributeToUpdate.d.ts.map +1 -0
- package/dist/model/automaticFacetFilter.d.ts.map +1 -1
- package/dist/model/automaticFacetFilters.d.ts.map +1 -1
- package/dist/model/baseGetApiKeyResponse.d.ts +11 -0
- package/dist/model/baseGetApiKeyResponse.d.ts.map +1 -0
- package/dist/model/baseIndexSettings.d.ts.map +1 -1
- package/dist/model/baseSearchParams.d.ts.map +1 -1
- package/dist/model/baseSearchParamsWithoutQuery.d.ts.map +1 -1
- package/dist/model/baseSearchResponse.d.ts +3 -3
- package/dist/model/baseSearchResponse.d.ts.map +1 -1
- package/dist/model/batchAssignUserIdsParams.d.ts.map +1 -1
- package/dist/model/batchDictionaryEntriesParams.d.ts.map +1 -1
- package/dist/model/batchDictionaryEntriesRequest.d.ts.map +1 -1
- package/dist/model/batchParams.d.ts +2 -2
- package/dist/model/batchParams.d.ts.map +1 -1
- package/dist/model/batchRequest.d.ts +9 -0
- package/dist/model/batchRequest.d.ts.map +1 -0
- package/dist/model/batchResponse.d.ts.map +1 -1
- package/dist/model/batchWriteParams.d.ts +2 -2
- package/dist/model/batchWriteParams.d.ts.map +1 -1
- package/dist/model/browseParams.d.ts +4 -0
- package/dist/model/browseParams.d.ts.map +1 -0
- package/dist/model/browseParamsObject.d.ts +4 -0
- package/dist/model/browseParamsObject.d.ts.map +1 -0
- package/dist/model/browseResponse.d.ts +2 -2
- package/dist/model/browseResponse.d.ts.map +1 -1
- package/dist/model/builtInOperation.d.ts.map +1 -1
- package/dist/model/builtInOperationType.d.ts.map +1 -1
- package/dist/model/clientMethodProps.d.ts +25 -14
- package/dist/model/clientMethodProps.d.ts.map +1 -1
- package/dist/model/condition.d.ts.map +1 -1
- package/dist/model/consequence.d.ts.map +1 -1
- package/dist/model/consequenceHide.d.ts.map +1 -1
- package/dist/model/consequenceParams.d.ts.map +1 -1
- package/dist/model/consequenceQuery.d.ts.map +1 -1
- package/dist/model/consequenceQueryObject.d.ts.map +1 -1
- package/dist/model/createdAtResponse.d.ts.map +1 -1
- package/dist/model/{baseBrowseResponse.d.ts → cursor.d.ts} +3 -3
- package/dist/model/cursor.d.ts.map +1 -0
- package/dist/model/deleteApiKeyResponse.d.ts.map +1 -1
- package/dist/model/deleteSourceResponse.d.ts.map +1 -1
- package/dist/model/deletedAtResponse.d.ts.map +1 -1
- package/dist/model/dictionaryAction.d.ts.map +1 -1
- package/dist/model/dictionaryEntry.d.ts.map +1 -1
- package/dist/model/dictionaryEntryState.d.ts.map +1 -1
- package/dist/model/dictionaryLanguage.d.ts.map +1 -1
- package/dist/model/dictionarySettingsParams.d.ts.map +1 -1
- package/dist/model/dictionaryType.d.ts.map +1 -1
- package/dist/model/distinct.d.ts +5 -0
- package/dist/model/distinct.d.ts.map +1 -0
- package/dist/model/edit.d.ts.map +1 -1
- package/dist/model/editType.d.ts.map +1 -1
- package/dist/model/errorBase.d.ts.map +1 -1
- package/dist/model/exactOnSingleWordQuery.d.ts.map +1 -1
- package/dist/model/facetFilters.d.ts.map +1 -1
- package/dist/model/facetHits.d.ts.map +1 -1
- package/dist/model/facetOrdering.d.ts.map +1 -1
- package/dist/model/facets.d.ts.map +1 -1
- package/dist/model/facetsStats.d.ts.map +1 -1
- package/dist/model/fetchedIndex.d.ts.map +1 -1
- package/dist/model/getApiKeyResponse.d.ts +4 -0
- package/dist/model/getApiKeyResponse.d.ts.map +1 -0
- package/dist/model/getDictionarySettingsResponse.d.ts.map +1 -1
- package/dist/model/getLogsResponse.d.ts.map +1 -1
- package/dist/model/getObjectsParams.d.ts +2 -2
- package/dist/model/getObjectsParams.d.ts.map +1 -1
- package/dist/model/{multipleGetObjectsParams.d.ts → getObjectsRequest.d.ts} +2 -2
- package/dist/model/getObjectsRequest.d.ts.map +1 -0
- package/dist/model/getObjectsResponse.d.ts +2 -2
- package/dist/model/getObjectsResponse.d.ts.map +1 -1
- package/dist/model/getTaskResponse.d.ts.map +1 -1
- package/dist/model/getTopUserIdsResponse.d.ts.map +1 -1
- package/dist/model/hasPendingMappingsResponse.d.ts.map +1 -1
- package/dist/model/highlightResult.d.ts.map +1 -1
- package/dist/model/highlightResultOption.d.ts.map +1 -1
- package/dist/model/hit.d.ts +1 -1
- package/dist/model/hit.d.ts.map +1 -1
- package/dist/model/ignorePlurals.d.ts.map +1 -1
- package/dist/model/index.d.ts +10 -8
- package/dist/model/index.d.ts.map +1 -1
- package/dist/model/indexSettings.d.ts.map +1 -1
- package/dist/model/indexSettingsAsSearchParams.d.ts +4 -2
- package/dist/model/indexSettingsAsSearchParams.d.ts.map +1 -1
- package/dist/model/languages.d.ts.map +1 -1
- package/dist/model/listApiKeysResponse.d.ts +2 -2
- package/dist/model/listApiKeysResponse.d.ts.map +1 -1
- package/dist/model/listClustersResponse.d.ts.map +1 -1
- package/dist/model/listIndicesResponse.d.ts +1 -1
- package/dist/model/listIndicesResponse.d.ts.map +1 -1
- package/dist/model/listUserIdsResponse.d.ts.map +1 -1
- package/dist/model/log.d.ts.map +1 -1
- package/dist/model/logQuery.d.ts.map +1 -1
- package/dist/model/logType.d.ts.map +1 -1
- package/dist/model/matchLevel.d.ts.map +1 -1
- package/dist/model/matchedGeoLocation.d.ts.map +1 -1
- package/dist/model/mixedSearchFilters.d.ts.map +1 -1
- package/dist/model/{multipleBatchOperation.d.ts → multipleBatchRequest.d.ts} +5 -5
- package/dist/model/multipleBatchRequest.d.ts.map +1 -0
- package/dist/model/multipleBatchResponse.d.ts +2 -2
- package/dist/model/multipleBatchResponse.d.ts.map +1 -1
- package/dist/model/numericFilters.d.ts.map +1 -1
- package/dist/model/operationIndexParams.d.ts.map +1 -1
- package/dist/model/operationType.d.ts.map +1 -1
- package/dist/model/optionalFilters.d.ts.map +1 -1
- package/dist/model/params.d.ts.map +1 -1
- package/dist/model/personalization.d.ts.map +1 -1
- package/dist/model/promote.d.ts.map +1 -1
- package/dist/model/promoteObjectID.d.ts.map +1 -1
- package/dist/model/promoteObjectIDs.d.ts.map +1 -1
- package/dist/model/queryType.d.ts.map +1 -1
- package/dist/model/rankingInfo.d.ts.map +1 -1
- package/dist/model/reRankingApplyFilter.d.ts.map +1 -1
- package/dist/model/removeStopWords.d.ts.map +1 -1
- package/dist/model/removeUserIdResponse.d.ts.map +1 -1
- package/dist/model/removeWordsIfNoResults.d.ts.map +1 -1
- package/dist/model/renderingContent.d.ts.map +1 -1
- package/dist/model/replaceSourceResponse.d.ts.map +1 -1
- package/dist/model/rule.d.ts.map +1 -1
- package/dist/model/saveObjectResponse.d.ts +2 -2
- package/dist/model/saveObjectResponse.d.ts.map +1 -1
- package/dist/model/saveSynonymResponse.d.ts.map +1 -1
- package/dist/model/scopeType.d.ts.map +1 -1
- package/dist/model/searchDictionaryEntriesParams.d.ts.map +1 -1
- package/dist/model/searchForFacetValuesRequest.d.ts.map +1 -1
- package/dist/model/searchForFacetValuesResponse.d.ts.map +1 -1
- package/dist/model/searchForFacets.d.ts.map +1 -1
- package/dist/model/searchForFacetsOptions.d.ts.map +1 -1
- package/dist/model/searchForHits.d.ts.map +1 -1
- package/dist/model/searchForHitsOptions.d.ts.map +1 -1
- package/dist/model/searchHits.d.ts +2 -2
- package/dist/model/searchHits.d.ts.map +1 -1
- package/dist/model/searchMethodParams.d.ts.map +1 -1
- package/dist/model/searchParams.d.ts.map +1 -1
- package/dist/model/searchParamsObject.d.ts.map +1 -1
- package/dist/model/searchParamsQuery.d.ts.map +1 -1
- package/dist/model/searchParamsString.d.ts.map +1 -1
- package/dist/model/searchQuery.d.ts.map +1 -1
- package/dist/model/searchResponse.d.ts +1 -1
- package/dist/model/searchResponse.d.ts.map +1 -1
- package/dist/model/searchResponses.d.ts +1 -1
- package/dist/model/searchResponses.d.ts.map +1 -1
- package/dist/model/searchRulesParams.d.ts.map +1 -1
- package/dist/model/searchRulesResponse.d.ts.map +1 -1
- package/dist/model/searchStrategy.d.ts.map +1 -1
- package/dist/model/searchSynonymsParams.d.ts.map +1 -1
- package/dist/model/searchSynonymsResponse.d.ts.map +1 -1
- package/dist/model/searchTypeDefault.d.ts.map +1 -1
- package/dist/model/searchTypeFacet.d.ts.map +1 -1
- package/dist/model/searchUserIdsParams.d.ts.map +1 -1
- package/dist/model/searchUserIdsResponse.d.ts.map +1 -1
- package/dist/model/snippetResult.d.ts.map +1 -1
- package/dist/model/snippetResultOption.d.ts.map +1 -1
- package/dist/model/sortRemainingBy.d.ts.map +1 -1
- package/dist/model/source.d.ts.map +1 -1
- package/dist/model/standardEntries.d.ts.map +1 -1
- package/dist/model/synonymHit.d.ts.map +1 -1
- package/dist/model/synonymHitHighlightResult.d.ts.map +1 -1
- package/dist/model/synonymType.d.ts.map +1 -1
- package/dist/model/tagFilters.d.ts.map +1 -1
- package/dist/model/taskStatus.d.ts.map +1 -1
- package/dist/model/timeRange.d.ts.map +1 -1
- package/dist/model/typoTolerance.d.ts.map +1 -1
- package/dist/model/typoToleranceEnum.d.ts.map +1 -1
- package/dist/model/updateApiKeyResponse.d.ts +1 -1
- package/dist/model/updateApiKeyResponse.d.ts.map +1 -1
- package/dist/model/updatedAtResponse.d.ts.map +1 -1
- package/dist/model/updatedAtWithObjectIdResponse.d.ts.map +1 -1
- package/dist/model/updatedRuleResponse.d.ts.map +1 -1
- package/dist/model/userHighlightResult.d.ts.map +1 -1
- package/dist/model/userHit.d.ts.map +1 -1
- package/dist/model/userId.d.ts.map +1 -1
- package/dist/model/value.d.ts.map +1 -1
- package/dist/src/searchClient.d.ts +72 -22
- package/dist/src/searchClient.d.ts.map +1 -1
- package/model/acl.ts +3 -0
- package/model/addApiKeyResponse.ts +2 -1
- package/model/apiKey.ts +7 -0
- package/model/{attributeOrBuiltInOperation.ts → attributeToUpdate.ts} +1 -1
- package/model/automaticFacetFilter.ts +2 -0
- package/model/baseGetApiKeyResponse.ts +13 -0
- package/model/baseIndexSettings.ts +13 -0
- package/model/baseSearchParamsWithoutQuery.ts +32 -0
- package/model/baseSearchResponse.ts +27 -3
- package/model/batchAssignUserIdsParams.ts +1 -0
- package/model/batchDictionaryEntriesParams.ts +1 -0
- package/model/batchDictionaryEntriesRequest.ts +1 -0
- package/model/batchParams.ts +2 -2
- package/model/{batchOperation.ts → batchRequest.ts} +4 -3
- package/model/batchResponse.ts +1 -0
- package/model/batchWriteParams.ts +2 -2
- package/model/browseParams.ts +6 -0
- package/model/browseParamsObject.ts +6 -0
- package/model/browseResponse.ts +3 -3
- package/model/builtInOperation.ts +1 -0
- package/model/clientMethodProps.ts +30 -19
- package/model/condition.ts +3 -0
- package/model/consequence.ts +4 -0
- package/model/consequenceQueryObject.ts +1 -0
- package/model/{baseBrowseResponse.ts → cursor.ts} +2 -2
- package/model/deletedAtResponse.ts +1 -0
- package/model/dictionaryEntry.ts +5 -0
- package/model/{createdAtObject.ts → distinct.ts} +4 -6
- package/model/edit.ts +2 -0
- package/model/facetHits.ts +2 -0
- package/model/facetOrdering.ts +1 -0
- package/model/facetsStats.ts +3 -0
- package/model/fetchedIndex.ts +10 -0
- package/model/{key.ts → getApiKeyResponse.ts} +2 -2
- package/model/getObjectsParams.ts +2 -2
- package/model/{multipleGetObjectsParams.ts → getObjectsRequest.ts} +3 -1
- package/model/getObjectsResponse.ts +2 -2
- package/model/hasPendingMappingsResponse.ts +1 -0
- package/model/highlightResultOption.ts +3 -0
- package/model/hit.ts +5 -1
- package/model/index.ts +10 -8
- package/model/indexSettingsAsSearchParams.ts +46 -2
- package/model/languages.ts +2 -0
- package/model/listApiKeysResponse.ts +2 -2
- package/model/listIndicesResponse.ts +2 -1
- package/model/log.ts +14 -0
- package/model/logQuery.ts +2 -0
- package/model/matchedGeoLocation.ts +2 -0
- package/model/{multipleBatchOperation.ts → multipleBatchRequest.ts} +6 -4
- package/model/multipleBatchResponse.ts +3 -2
- package/model/operationIndexParams.ts +2 -0
- package/model/params.ts +3 -0
- package/model/personalization.ts +2 -0
- package/model/promoteObjectID.ts +1 -0
- package/model/promoteObjectIDs.ts +1 -0
- package/model/rankingInfo.ts +12 -0
- package/model/rule.ts +5 -0
- package/model/saveObjectResponse.ts +4 -2
- package/model/saveSynonymResponse.ts +2 -0
- package/model/searchDictionaryEntriesParams.ts +3 -0
- package/model/searchForFacetValuesRequest.ts +2 -0
- package/model/searchForFacetsOptions.ts +4 -0
- package/model/searchForHitsOptions.ts +1 -0
- package/model/searchHits.ts +2 -2
- package/model/searchMethodParams.ts +1 -0
- package/model/searchResponse.ts +2 -1
- package/model/searchResponses.ts +1 -1
- package/model/searchRulesParams.ts +6 -0
- package/model/searchRulesResponse.ts +3 -0
- package/model/searchSynonymsResponse.ts +1 -0
- package/model/searchUserIdsParams.ts +3 -0
- package/model/searchUserIdsResponse.ts +4 -0
- package/model/snippetResultOption.ts +1 -0
- package/model/source.ts +1 -0
- package/model/standardEntries.ts +2 -0
- package/model/synonymHit.ts +8 -0
- package/model/synonymHitHighlightResult.ts +1 -0
- package/model/timeRange.ts +1 -0
- package/model/updateApiKeyResponse.ts +2 -1
- package/model/updatedAtResponse.ts +1 -0
- package/model/updatedAtWithObjectIdResponse.ts +2 -0
- package/model/updatedRuleResponse.ts +2 -0
- package/model/userHighlightResult.ts +1 -0
- package/model/userHit.ts +5 -0
- package/model/userId.ts +3 -0
- package/model/value.ts +1 -0
- package/package.json +8 -6
- package/dist/model/attributeOrBuiltInOperation.d.ts +0 -3
- package/dist/model/attributeOrBuiltInOperation.d.ts.map +0 -1
- package/dist/model/baseBrowseResponse.d.ts.map +0 -1
- package/dist/model/batchOperation.d.ts +0 -9
- package/dist/model/batchOperation.d.ts.map +0 -1
- package/dist/model/browseRequest.d.ts +0 -11
- package/dist/model/browseRequest.d.ts.map +0 -1
- package/dist/model/createdAtObject.d.ts +0 -7
- package/dist/model/createdAtObject.d.ts.map +0 -1
- package/dist/model/key.d.ts +0 -4
- package/dist/model/key.d.ts.map +0 -1
- package/dist/model/multipleBatchOperation.d.ts.map +0 -1
- package/dist/model/multipleGetObjectsParams.d.ts.map +0 -1
- package/model/browseRequest.ts +0 -12
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { createAuth, createTransporter, getAlgoliaAgent,
|
|
1
|
+
import { createAuth, createTransporter, getAlgoliaAgent, createIterablePromise, shuffle, DEFAULT_CONNECT_TIMEOUT_NODE, DEFAULT_READ_TIMEOUT_NODE, DEFAULT_WRITE_TIMEOUT_NODE, createNullCache, createMemoryCache } from '@algolia/client-common';
|
|
2
2
|
import { createHttpRequester } from '@algolia/requester-node-http';
|
|
3
3
|
|
|
4
4
|
// This file is generated, manual changes will be lost - read more on https://github.com/algolia/api-clients-automation.
|
|
5
|
-
const apiClientVersion = '5.0.0-alpha.
|
|
5
|
+
const apiClientVersion = '5.0.0-alpha.10';
|
|
6
6
|
function getDefaultHosts(appId) {
|
|
7
7
|
return [
|
|
8
8
|
{
|
|
@@ -56,6 +56,19 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
|
|
|
56
56
|
});
|
|
57
57
|
return {
|
|
58
58
|
transporter,
|
|
59
|
+
/**
|
|
60
|
+
* The `appId` currently in use.
|
|
61
|
+
*/
|
|
62
|
+
appId: appIdOption,
|
|
63
|
+
/**
|
|
64
|
+
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
|
|
65
|
+
*/
|
|
66
|
+
clearCache() {
|
|
67
|
+
return Promise.all([
|
|
68
|
+
transporter.requestsCache.clear(),
|
|
69
|
+
transporter.responsesCache.clear(),
|
|
70
|
+
]).then(() => undefined);
|
|
71
|
+
},
|
|
59
72
|
/**
|
|
60
73
|
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
|
|
61
74
|
*/
|
|
@@ -72,38 +85,57 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
|
|
|
72
85
|
transporter.algoliaAgent.add({ segment, version });
|
|
73
86
|
},
|
|
74
87
|
/**
|
|
75
|
-
* Helper: Wait for a task to
|
|
88
|
+
* Helper: Wait for a task to be published (completed) for a given `indexName` and `taskID`.
|
|
76
89
|
*
|
|
77
|
-
* @summary
|
|
90
|
+
* @summary Helper method that waits for a task to be published (completed).
|
|
78
91
|
* @param waitForTaskOptions - The waitForTaskOptions object.
|
|
79
92
|
* @param waitForTaskOptions.indexName - The `indexName` where the operation was performed.
|
|
80
93
|
* @param waitForTaskOptions.taskID - The `taskID` returned in the method response.
|
|
94
|
+
* @param waitForTaskOptions.maxRetries - The maximum number of retries. 50 by default.
|
|
95
|
+
* @param waitForTaskOptions.timeout - The function to decide how long to wait between retries.
|
|
81
96
|
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `getTask` method and merged with the transporter requestOptions.
|
|
82
97
|
*/
|
|
83
|
-
waitForTask({ indexName, taskID,
|
|
84
|
-
|
|
85
|
-
|
|
98
|
+
waitForTask({ indexName, taskID, maxRetries = 50, timeout = (retryCount) => Math.min(retryCount * 200, 5000), }, requestOptions) {
|
|
99
|
+
let retryCount = 0;
|
|
100
|
+
return createIterablePromise({
|
|
86
101
|
func: () => this.getTask({ indexName, taskID }, requestOptions),
|
|
87
102
|
validate: (response) => response.status === 'published',
|
|
103
|
+
aggregator: () => (retryCount += 1),
|
|
104
|
+
error: {
|
|
105
|
+
validate: () => retryCount >= maxRetries,
|
|
106
|
+
message: () => `The maximum number of retries exceeded. (${retryCount}/${maxRetries})`,
|
|
107
|
+
},
|
|
108
|
+
timeout: () => timeout(retryCount),
|
|
88
109
|
});
|
|
89
110
|
},
|
|
90
111
|
/**
|
|
91
112
|
* Helper: Wait for an API key to be added, updated or deleted based on a given `operation`.
|
|
92
113
|
*
|
|
93
|
-
* @summary
|
|
114
|
+
* @summary Helper method that waits for an API key task to be processed.
|
|
94
115
|
* @param waitForApiKeyOptions - The waitForApiKeyOptions object.
|
|
95
116
|
* @param waitForApiKeyOptions.operation - The `operation` that was done on a `key`.
|
|
96
117
|
* @param waitForApiKeyOptions.key - The `key` that has been added, deleted or updated.
|
|
97
118
|
* @param waitForApiKeyOptions.apiKey - Necessary to know if an `update` operation has been processed, compare fields of the response with it.
|
|
119
|
+
* @param waitForApiKeyOptions.maxRetries - The maximum number of retries. 50 by default.
|
|
120
|
+
* @param waitForApiKeyOptions.timeout - The function to decide how long to wait between retries.
|
|
98
121
|
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `getApikey` method and merged with the transporter requestOptions.
|
|
99
122
|
*/
|
|
100
|
-
waitForApiKey({ operation, key, apiKey,
|
|
123
|
+
waitForApiKey({ operation, key, apiKey, maxRetries = 50, timeout = (retryCount) => Math.min(retryCount * 200, 5000), }, requestOptions) {
|
|
124
|
+
let retryCount = 0;
|
|
125
|
+
const baseIteratorOptions = {
|
|
126
|
+
aggregator: () => (retryCount += 1),
|
|
127
|
+
error: {
|
|
128
|
+
validate: () => retryCount >= maxRetries,
|
|
129
|
+
message: () => `The maximum number of retries exceeded. (${retryCount}/${maxRetries})`,
|
|
130
|
+
},
|
|
131
|
+
timeout: () => timeout(retryCount),
|
|
132
|
+
};
|
|
101
133
|
if (operation === 'update') {
|
|
102
134
|
if (!apiKey) {
|
|
103
135
|
throw new Error('`apiKey` is required when waiting for an `update` operation.');
|
|
104
136
|
}
|
|
105
|
-
return
|
|
106
|
-
...
|
|
137
|
+
return createIterablePromise({
|
|
138
|
+
...baseIteratorOptions,
|
|
107
139
|
func: () => this.getApiKey({ key }, requestOptions),
|
|
108
140
|
validate: (response) => {
|
|
109
141
|
for (const field of Object.keys(apiKey)) {
|
|
@@ -121,12 +153,99 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
|
|
|
121
153
|
},
|
|
122
154
|
});
|
|
123
155
|
}
|
|
124
|
-
return
|
|
125
|
-
...
|
|
156
|
+
return createIterablePromise({
|
|
157
|
+
...baseIteratorOptions,
|
|
126
158
|
func: () => this.getApiKey({ key }, requestOptions).catch((error) => error),
|
|
127
159
|
validate: (error) => operation === 'add' ? error.status !== 404 : error.status === 404,
|
|
128
160
|
});
|
|
129
161
|
},
|
|
162
|
+
/**
|
|
163
|
+
* Helper: Iterate on the `browse` method of the client to allow aggregating objects of an index.
|
|
164
|
+
*
|
|
165
|
+
* @summary Helper method that iterates on the `browse` method.
|
|
166
|
+
* @param browseObjects - The browseObjects object.
|
|
167
|
+
* @param browseObjects.indexName - The index in which to perform the request.
|
|
168
|
+
* @param browseObjects.browseParams - The `browse` parameters.
|
|
169
|
+
* @param browseObjects.validate - The validator function. It receive the resolved return of the API call. By default, stops when there is no `cursor` in the response.
|
|
170
|
+
* @param browseObjects.aggregator - The function that runs right after the API call has been resolved, allows you to do anything with the response before `validate`.
|
|
171
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `browse` method and merged with the transporter requestOptions.
|
|
172
|
+
*/
|
|
173
|
+
browseObjects({ indexName, browseParams, ...browseObjectsOptions }, requestOptions) {
|
|
174
|
+
return createIterablePromise({
|
|
175
|
+
func: (previousResponse) => {
|
|
176
|
+
return this.browse({
|
|
177
|
+
indexName,
|
|
178
|
+
browseParams: {
|
|
179
|
+
cursor: previousResponse ? previousResponse.cursor : undefined,
|
|
180
|
+
...browseParams,
|
|
181
|
+
},
|
|
182
|
+
}, requestOptions);
|
|
183
|
+
},
|
|
184
|
+
validate: (response) => response.cursor === undefined,
|
|
185
|
+
...browseObjectsOptions,
|
|
186
|
+
});
|
|
187
|
+
},
|
|
188
|
+
/**
|
|
189
|
+
* Helper: Iterate on the `searchRules` method of the client to allow aggregating rules of an index.
|
|
190
|
+
*
|
|
191
|
+
* @summary Helper method that iterates on the `searchRules` method.
|
|
192
|
+
* @param browseObjects - The browseObjects object.
|
|
193
|
+
* @param browseObjects.indexName - The index in which to perform the request.
|
|
194
|
+
* @param browseObjects.searchRulesParams - The `searchRules` method parameters.
|
|
195
|
+
* @param browseObjects.validate - The validator function. It receive the resolved return of the API call. By default, stops when there is less hits returned than the number of maximum hits (1000).
|
|
196
|
+
* @param browseObjects.aggregator - The function that runs right after the API call has been resolved, allows you to do anything with the response before `validate`.
|
|
197
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `searchRules` method and merged with the transporter requestOptions.
|
|
198
|
+
*/
|
|
199
|
+
browseRules({ indexName, searchRulesParams, ...browseRulesOptions }, requestOptions) {
|
|
200
|
+
const params = {
|
|
201
|
+
hitsPerPage: 1000,
|
|
202
|
+
...searchRulesParams,
|
|
203
|
+
};
|
|
204
|
+
return createIterablePromise({
|
|
205
|
+
func: (previousResponse) => {
|
|
206
|
+
return this.searchRules({
|
|
207
|
+
indexName,
|
|
208
|
+
searchRulesParams: {
|
|
209
|
+
...params,
|
|
210
|
+
page: previousResponse
|
|
211
|
+
? previousResponse.page + 1
|
|
212
|
+
: params.page || 0,
|
|
213
|
+
},
|
|
214
|
+
}, requestOptions);
|
|
215
|
+
},
|
|
216
|
+
validate: (response) => response.nbHits < params.hitsPerPage,
|
|
217
|
+
...browseRulesOptions,
|
|
218
|
+
});
|
|
219
|
+
},
|
|
220
|
+
/**
|
|
221
|
+
* Helper: Iterate on the `searchSynonyms` method of the client to allow aggregating rules of an index.
|
|
222
|
+
*
|
|
223
|
+
* @summary Helper method that iterates on the `searchSynonyms` method.
|
|
224
|
+
* @param browseObjects - The browseObjects object.
|
|
225
|
+
* @param browseObjects.indexName - The index in which to perform the request.
|
|
226
|
+
* @param browseObjects.validate - The validator function. It receive the resolved return of the API call. By default, stops when there is less hits returned than the number of maximum hits (1000).
|
|
227
|
+
* @param browseObjects.aggregator - The function that runs right after the API call has been resolved, allows you to do anything with the response before `validate`.
|
|
228
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `searchSynonyms` method and merged with the transporter requestOptions.
|
|
229
|
+
*/
|
|
230
|
+
browseSynonyms({ indexName, validate, aggregator, ...browseSynonymsOptions }, requestOptions) {
|
|
231
|
+
const params = {
|
|
232
|
+
hitsPerPage: 1000,
|
|
233
|
+
...browseSynonymsOptions,
|
|
234
|
+
};
|
|
235
|
+
return createIterablePromise({
|
|
236
|
+
func: (previousResponse) => {
|
|
237
|
+
return this.searchSynonyms({
|
|
238
|
+
...params,
|
|
239
|
+
indexName,
|
|
240
|
+
page: previousResponse
|
|
241
|
+
? previousResponse.page + 1
|
|
242
|
+
: browseSynonymsOptions.page || 0,
|
|
243
|
+
}, requestOptions);
|
|
244
|
+
},
|
|
245
|
+
validate: (response) => response.nbHits < params.hitsPerPage,
|
|
246
|
+
...browseSynonymsOptions,
|
|
247
|
+
});
|
|
248
|
+
},
|
|
130
249
|
/**
|
|
131
250
|
* Add a new API Key with specific permissions/restrictions.
|
|
132
251
|
*
|
|
@@ -260,6 +379,9 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
|
|
|
260
379
|
if (!batchWriteParams) {
|
|
261
380
|
throw new Error('Parameter `batchWriteParams` is required when calling `batch`.');
|
|
262
381
|
}
|
|
382
|
+
if (!batchWriteParams.requests) {
|
|
383
|
+
throw new Error('Parameter `batchWriteParams.requests` is required when calling `batch`.');
|
|
384
|
+
}
|
|
263
385
|
const requestPath = '/1/indexes/{indexName}/batch'.replace('{indexName}', encodeURIComponent(indexName));
|
|
264
386
|
const headers = {};
|
|
265
387
|
const queryParameters = {};
|
|
@@ -346,10 +468,10 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
|
|
|
346
468
|
* @summary Retrieve all index content.
|
|
347
469
|
* @param browse - The browse object.
|
|
348
470
|
* @param browse.indexName - The index in which to perform the request.
|
|
349
|
-
* @param browse.
|
|
471
|
+
* @param browse.browseParams - The browseParams object.
|
|
350
472
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
351
473
|
*/
|
|
352
|
-
browse({ indexName,
|
|
474
|
+
browse({ indexName, browseParams }, requestOptions) {
|
|
353
475
|
if (!indexName) {
|
|
354
476
|
throw new Error('Parameter `indexName` is required when calling `browse`.');
|
|
355
477
|
}
|
|
@@ -361,7 +483,7 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
|
|
|
361
483
|
path: requestPath,
|
|
362
484
|
queryParameters,
|
|
363
485
|
headers,
|
|
364
|
-
data:
|
|
486
|
+
data: browseParams ? browseParams : {},
|
|
365
487
|
};
|
|
366
488
|
return transporter.request(request, requestOptions);
|
|
367
489
|
},
|
|
@@ -752,7 +874,7 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
|
|
|
752
874
|
* @param getLogs.type - Type of log entries to retrieve. When omitted, all log entries are retrieved.
|
|
753
875
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
754
876
|
*/
|
|
755
|
-
getLogs({ offset, length, indexName, type }, requestOptions) {
|
|
877
|
+
getLogs({ offset, length, indexName, type } = {}, requestOptions = undefined) {
|
|
756
878
|
const requestPath = '/1/logs';
|
|
757
879
|
const headers = {};
|
|
758
880
|
const queryParameters = {};
|
|
@@ -820,6 +942,9 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
|
|
|
820
942
|
if (!getObjectsParams) {
|
|
821
943
|
throw new Error('Parameter `getObjectsParams` is required when calling `getObjects`.');
|
|
822
944
|
}
|
|
945
|
+
if (!getObjectsParams.requests) {
|
|
946
|
+
throw new Error('Parameter `getObjectsParams.requests` is required when calling `getObjects`.');
|
|
947
|
+
}
|
|
823
948
|
const requestPath = '/1/indexes/*/objects';
|
|
824
949
|
const headers = {};
|
|
825
950
|
const queryParameters = {};
|
|
@@ -1011,7 +1136,7 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
|
|
|
1011
1136
|
* @param hasPendingMappings.getClusters - If the clusters pending mapping state should be on the response.
|
|
1012
1137
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1013
1138
|
*/
|
|
1014
|
-
hasPendingMappings({ getClusters }, requestOptions) {
|
|
1139
|
+
hasPendingMappings({ getClusters } = {}, requestOptions = undefined) {
|
|
1015
1140
|
const requestPath = '/1/clusters/mapping/pending';
|
|
1016
1141
|
const headers = {};
|
|
1017
1142
|
const queryParameters = {};
|
|
@@ -1070,7 +1195,7 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
|
|
|
1070
1195
|
* @param listIndices.page - Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination).
|
|
1071
1196
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1072
1197
|
*/
|
|
1073
|
-
listIndices({ page }, requestOptions) {
|
|
1198
|
+
listIndices({ page } = {}, requestOptions = undefined) {
|
|
1074
1199
|
const requestPath = '/1/indexes';
|
|
1075
1200
|
const headers = {};
|
|
1076
1201
|
const queryParameters = {};
|
|
@@ -1094,7 +1219,7 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
|
|
|
1094
1219
|
* @param listUserIds.hitsPerPage - Maximum number of objects to retrieve.
|
|
1095
1220
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1096
1221
|
*/
|
|
1097
|
-
listUserIds({ page, hitsPerPage }, requestOptions) {
|
|
1222
|
+
listUserIds({ page, hitsPerPage } = {}, requestOptions = undefined) {
|
|
1098
1223
|
const requestPath = '/1/clusters/mapping';
|
|
1099
1224
|
const headers = {};
|
|
1100
1225
|
const queryParameters = {};
|
|
@@ -1123,6 +1248,9 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
|
|
|
1123
1248
|
if (!batchParams) {
|
|
1124
1249
|
throw new Error('Parameter `batchParams` is required when calling `multipleBatch`.');
|
|
1125
1250
|
}
|
|
1251
|
+
if (!batchParams.requests) {
|
|
1252
|
+
throw new Error('Parameter `batchParams.requests` is required when calling `multipleBatch`.');
|
|
1253
|
+
}
|
|
1126
1254
|
const requestPath = '/1/indexes/*/batch';
|
|
1127
1255
|
const headers = {};
|
|
1128
1256
|
const queryParameters = {};
|
|
@@ -1176,19 +1304,19 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
|
|
|
1176
1304
|
* @param partialUpdateObject - The partialUpdateObject object.
|
|
1177
1305
|
* @param partialUpdateObject.indexName - The index in which to perform the request.
|
|
1178
1306
|
* @param partialUpdateObject.objectID - Unique identifier of an object.
|
|
1179
|
-
* @param partialUpdateObject.
|
|
1307
|
+
* @param partialUpdateObject.attributesToUpdate - Map of attribute(s) to update.
|
|
1180
1308
|
* @param partialUpdateObject.createIfNotExists - Creates the record if it does not exist yet.
|
|
1181
1309
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1182
1310
|
*/
|
|
1183
|
-
partialUpdateObject({ indexName, objectID,
|
|
1311
|
+
partialUpdateObject({ indexName, objectID, attributesToUpdate, createIfNotExists, }, requestOptions) {
|
|
1184
1312
|
if (!indexName) {
|
|
1185
1313
|
throw new Error('Parameter `indexName` is required when calling `partialUpdateObject`.');
|
|
1186
1314
|
}
|
|
1187
1315
|
if (!objectID) {
|
|
1188
1316
|
throw new Error('Parameter `objectID` is required when calling `partialUpdateObject`.');
|
|
1189
1317
|
}
|
|
1190
|
-
if (!
|
|
1191
|
-
throw new Error('Parameter `
|
|
1318
|
+
if (!attributesToUpdate) {
|
|
1319
|
+
throw new Error('Parameter `attributesToUpdate` is required when calling `partialUpdateObject`.');
|
|
1192
1320
|
}
|
|
1193
1321
|
const requestPath = '/1/indexes/{indexName}/{objectID}/partial'
|
|
1194
1322
|
.replace('{indexName}', encodeURIComponent(indexName))
|
|
@@ -1203,7 +1331,7 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
|
|
|
1203
1331
|
path: requestPath,
|
|
1204
1332
|
queryParameters,
|
|
1205
1333
|
headers,
|
|
1206
|
-
data:
|
|
1334
|
+
data: attributesToUpdate,
|
|
1207
1335
|
};
|
|
1208
1336
|
return transporter.request(request, requestOptions);
|
|
1209
1337
|
},
|
|
@@ -1404,17 +1532,17 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
|
|
|
1404
1532
|
* @summary Save a batch of rules.
|
|
1405
1533
|
* @param saveRules - The saveRules object.
|
|
1406
1534
|
* @param saveRules.indexName - The index in which to perform the request.
|
|
1407
|
-
* @param saveRules.
|
|
1535
|
+
* @param saveRules.rules - The rules object.
|
|
1408
1536
|
* @param saveRules.forwardToReplicas - When true, changes are also propagated to replicas of the given indexName.
|
|
1409
1537
|
* @param saveRules.clearExistingRules - When true, existing Rules are cleared before adding this batch. When false, existing Rules are kept.
|
|
1410
1538
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1411
1539
|
*/
|
|
1412
|
-
saveRules({ indexName,
|
|
1540
|
+
saveRules({ indexName, rules, forwardToReplicas, clearExistingRules, }, requestOptions) {
|
|
1413
1541
|
if (!indexName) {
|
|
1414
1542
|
throw new Error('Parameter `indexName` is required when calling `saveRules`.');
|
|
1415
1543
|
}
|
|
1416
|
-
if (!
|
|
1417
|
-
throw new Error('Parameter `
|
|
1544
|
+
if (!rules) {
|
|
1545
|
+
throw new Error('Parameter `rules` is required when calling `saveRules`.');
|
|
1418
1546
|
}
|
|
1419
1547
|
const requestPath = '/1/indexes/{indexName}/rules/batch'.replace('{indexName}', encodeURIComponent(indexName));
|
|
1420
1548
|
const headers = {};
|
|
@@ -1430,7 +1558,7 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
|
|
|
1430
1558
|
path: requestPath,
|
|
1431
1559
|
queryParameters,
|
|
1432
1560
|
headers,
|
|
1433
|
-
data:
|
|
1561
|
+
data: rules,
|
|
1434
1562
|
};
|
|
1435
1563
|
return transporter.request(request, requestOptions);
|
|
1436
1564
|
},
|
|
@@ -1641,9 +1769,6 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
|
|
|
1641
1769
|
if (!indexName) {
|
|
1642
1770
|
throw new Error('Parameter `indexName` is required when calling `searchRules`.');
|
|
1643
1771
|
}
|
|
1644
|
-
if (!searchRulesParams) {
|
|
1645
|
-
throw new Error('Parameter `searchRulesParams` is required when calling `searchRules`.');
|
|
1646
|
-
}
|
|
1647
1772
|
const requestPath = '/1/indexes/{indexName}/rules/search'.replace('{indexName}', encodeURIComponent(indexName));
|
|
1648
1773
|
const headers = {};
|
|
1649
1774
|
const queryParameters = {};
|
|
@@ -1652,7 +1777,7 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
|
|
|
1652
1777
|
path: requestPath,
|
|
1653
1778
|
queryParameters,
|
|
1654
1779
|
headers,
|
|
1655
|
-
data: searchRulesParams,
|
|
1780
|
+
data: searchRulesParams ? searchRulesParams : {},
|
|
1656
1781
|
useReadTransporter: true,
|
|
1657
1782
|
cacheable: true,
|
|
1658
1783
|
};
|
|
@@ -1671,9 +1796,6 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
|
|
|
1671
1796
|
if (!indexName) {
|
|
1672
1797
|
throw new Error('Parameter `indexName` is required when calling `searchSingleIndex`.');
|
|
1673
1798
|
}
|
|
1674
|
-
if (!searchParams) {
|
|
1675
|
-
throw new Error('Parameter `searchParams` is required when calling `searchSingleIndex`.');
|
|
1676
|
-
}
|
|
1677
1799
|
const requestPath = '/1/indexes/{indexName}/query'.replace('{indexName}', encodeURIComponent(indexName));
|
|
1678
1800
|
const headers = {};
|
|
1679
1801
|
const queryParameters = {};
|
|
@@ -1682,7 +1804,7 @@ function createSearchClient({ appId: appIdOption, apiKey: apiKeyOption, authMode
|
|
|
1682
1804
|
path: requestPath,
|
|
1683
1805
|
queryParameters,
|
|
1684
1806
|
headers,
|
|
1685
|
-
data: searchParams,
|
|
1807
|
+
data: searchParams ? searchParams : {},
|
|
1686
1808
|
useReadTransporter: true,
|
|
1687
1809
|
cacheable: true,
|
|
1688
1810
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! client-search.umd.js | 5.0.0-alpha.
|
|
2
|
-
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((e="undefined"!=typeof globalThis?globalThis:e||self)["@algolia/client-search"]={})}(this,(function(e){"use strict";function r(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}const t=e=>Math.min(200*e,5e3);function a({func:e,validate:r,maxRetries:a=50,timeout:n=t}){let i=0;const o=()=>new Promise(((t,s)=>{e().then((e=>{r(e)?t(e):i+1>=a?s(new Error(`The maximum number of retries exceeded. (${i+1}/${a})`)):(i+=1,setTimeout((()=>{o().then(t).catch(s)}),n(i)))})).catch((e=>{s(e)}))}));return o()}function n(e){let r;const t=`algolia-client-js-${e.key}`;function a(){return void 0===r&&(r=e.localStorage||window.localStorage),r}function n(){return JSON.parse(a().getItem(t)||"{}")}return{get:(e,r,t={miss:()=>Promise.resolve()})=>Promise.resolve().then((()=>{const t=JSON.stringify(e),a=n()[t];return Promise.all([a||r(),void 0!==a])})).then((([e,r])=>Promise.all([e,r||t.miss(e)]))).then((([e])=>e)),set:(e,r)=>Promise.resolve().then((()=>{const i=n();return i[JSON.stringify(e)]=r,a().setItem(t,JSON.stringify(i)),r})),delete:e=>Promise.resolve().then((()=>{const r=n();delete r[JSON.stringify(e)],a().setItem(t,JSON.stringify(r))})),clear:()=>Promise.resolve().then((()=>{a().removeItem(t)}))}}function i(e){const r=[...e.caches],t=r.shift();return void 0===t?{get:(e,r,t={miss:()=>Promise.resolve()})=>r().then((e=>Promise.all([e,t.miss(e)]))).then((([e])=>e)),set:(e,r)=>Promise.resolve(r),delete:e=>Promise.resolve(),clear:()=>Promise.resolve()}:{get:(e,a,n={miss:()=>Promise.resolve()})=>t.get(e,a,n).catch((()=>i({caches:r}).get(e,a,n))),set:(e,a)=>t.set(e,a).catch((()=>i({caches:r}).set(e,a))),delete:e=>t.delete(e).catch((()=>i({caches:r}).delete(e))),clear:()=>t.clear().catch((()=>i({caches:r}).clear()))}}function o(e={serializable:!0}){let r={};return{get(t,a,n={miss:()=>Promise.resolve()}){const i=JSON.stringify(t);if(i in r)return Promise.resolve(e.serializable?JSON.parse(r[i]):r[i]);const o=a();return o.then((e=>n.miss(e))).then((()=>o))},set:(t,a)=>(r[JSON.stringify(t)]=e.serializable?JSON.stringify(a):a,Promise.resolve(a)),delete:e=>(delete r[JSON.stringify(e)],Promise.resolve()),clear:()=>(r={},Promise.resolve())}}const s=12e4;function c(e,r="up"){const t=Date.now();return{...e,status:r,lastUpdate:t,isUp:function(){return"up"===r||Date.now()-t>s},isTimedOut:function(){return"timed out"===r&&Date.now()-t<=s}}}function d(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}class u extends Error{constructor(e,r){super(e),d(this,"name","AlgoliaError"),r&&(this.name=r)}}class l extends u{constructor(e,r,t){super(e,t),d(this,"stackTrace",void 0),this.stackTrace=r}}class m extends l{constructor(e){super("Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.",e,"RetryError")}}class h extends l{constructor(e,r,t){super(e,t,"ApiError"),d(this,"status",void 0),this.status=r}}class p extends u{constructor(e,r){super(e,"DeserializationError"),d(this,"response",void 0),this.response=r}}function w(e,r,t){const a=function(e){const r=e=>"[object Object]"===Object.prototype.toString.call(e)||"[object Array]"===Object.prototype.toString.call(e);return Object.keys(e).map((t=>`${t}=${r(e[t])?JSON.stringify(e[t]):e[t]}`)).join("&")}(t);let n=`${e.protocol}://${e.url}/${"/"===r.charAt(0)?r.substr(1):r}`;return a.length&&(n+=`?${a}`),n}function f(e){const r=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...e,request:{...e.request,headers:{...e.request.headers,...r}}}}function y({hosts:e,hostsCache:r,baseHeaders:t,baseQueryParameters:a,algoliaAgent:n,timeouts:i,requester:o,requestsCache:s,responsesCache:d}){async function u(s,d,u=!0){const l=[],y=function(e,r){if("GET"===e.method||void 0===e.data&&void 0===r.data)return;const t=Array.isArray(e.data)?e.data:{...e.data,...r.data};return JSON.stringify(t)}(s,d),g=function(e,r,t){const a={Accept:"application/json",...e,...r,...t},n={};return Object.keys(a).forEach((e=>{const r=a[e];n[e.toLowerCase()]=r})),n}(t,s.headers,d.headers),P="GET"===s.method?{...s.data,...d.data}:{},q={"x-algolia-agent":n.value,...a,...s.queryParameters,...P};if(d&&d.queryParameters)for(const e of Object.keys(d.queryParameters))d.queryParameters[e]&&"[object Object]"!==Object.prototype.toString.call(d.queryParameters[e])?q[e]=d.queryParameters[e].toString():q[e]=d.queryParameters[e];let v=0;const b=async(e,t)=>{const a=e.pop();if(void 0===a)throw new m(function(e){return e.map((e=>f(e)))}(l));let n=d.timeout;void 0===n&&(n=u?i.read:i.write);const P={data:y,headers:g,method:s.method,url:w(a,s.path,q),connectTimeout:t(v,i.connect),responseTimeout:t(v,n)},x=r=>{const t={request:P,response:r,host:a,triesLeft:e.length};return l.push(t),t},E=await o.send(P);if(function({isTimedOut:e,status:r}){return e||function({isTimedOut:e,status:r}){return!e&&0==~~r}({isTimedOut:e,status:r})||2!=~~(r/100)&&4!=~~(r/100)}(E)){const n=x(E);return E.isTimedOut&&v++,console.log("Retryable failure",f(n)),await r.set(a,c(a,E.isTimedOut?"timed out":"down")),b(e,t)}if(function({status:e}){return 2==~~(e/100)}(E))return function(e){try{return JSON.parse(e.content)}catch(r){throw new p(r.message,e)}}(E);throw x(E),function({content:e,status:r},t){let a=e;try{a=JSON.parse(e).message}catch(e){}return new h(a,r,t)}(E,l)},x=e.filter((e=>"readWrite"===e.accept||(u?"read"===e.accept:"write"===e.accept))),E=await async function(e){const t=await Promise.all(e.map((e=>r.get(e,(()=>Promise.resolve(c(e))))))),a=t.filter((e=>e.isUp())),n=t.filter((e=>e.isTimedOut())),i=[...a,...n];return{hosts:i.length>0?i:e,getTimeout:(e,r)=>(0===n.length&&0===e?1:n.length+3+e)*r}}(x);return b([...E.hosts].reverse(),E.getTimeout)}return{hostsCache:r,requester:o,timeouts:i,algoliaAgent:n,baseHeaders:t,baseQueryParameters:a,hosts:e,request:function(e,r={}){const n=e.useReadTransporter||"GET"===e.method;if(!n)return u(e,r,n);const i=()=>u(e,r);if(!0!==(r.cacheable||e.cacheable))return i();const o={request:e,requestOptions:r,transporter:{queryParameters:a,headers:t}};return d.get(o,(()=>s.get(o,(()=>s.set(o,i()).then((e=>Promise.all([s.delete(o),e])),(e=>Promise.all([s.delete(o),Promise.reject(e)]))).then((([e,r])=>r))))),{miss:e=>d.set(o,e)})},requestsCache:s,responsesCache:d}}function g({algoliaAgents:e,client:r,version:t}){const a=function(e){const r={value:`Algolia for JavaScript (${e})`,add(e){const t=`; ${e.segment}${void 0!==e.version?` (${e.version})`:""}`;return-1===r.value.indexOf(t)&&(r.value=`${r.value}${t}`),r}};return r}(t).add({segment:r,version:t});return e.forEach((e=>a.add(e))),a}function P(e){return P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},P(e)}function q(e,r){if(null==e)return{};var t,a,n=function(e,r){if(null==e)return{};var t,a,n={},i=Object.keys(e);for(a=0;a<i.length;a++)t=i[a],r.indexOf(t)>=0||(n[t]=e[t]);return n}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)t=i[a],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(n[t]=e[t])}return n}var v=["appId","apiKey","authMode","algoliaAgents"],b=["indexName","taskID"],x=["operation","key","apiKey"],E=["params"];function I(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);r&&(a=a.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,a)}return t}function N(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?I(Object(a),!0).forEach((function(t){r(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):I(Object(a)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(a,r))}))}return e}var O="5.0.0-alpha.1";function S(e){return[{url:"".concat(e,"-dsn.algolia.net"),accept:"read",protocol:"https"},{url:"".concat(e,".algolia.net"),accept:"write",protocol:"https"}].concat(function(e){const r=e;for(let t=e.length-1;t>0;t--){const a=Math.floor(Math.random()*(t+1)),n=e[t];r[t]=e[a],r[a]=n}return r}([{url:"".concat(e,"-1.algolianet.com"),accept:"readWrite",protocol:"https"},{url:"".concat(e,"-2.algolianet.com"),accept:"readWrite",protocol:"https"},{url:"".concat(e,"-3.algolianet.com"),accept:"readWrite",protocol:"https"}]))}function T(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);r&&(a=a.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,a)}return t}e.apiClientVersion=O,e.searchClient=function(e,t,s){if(!e||"string"!=typeof e)throw new Error("`appId` is missing.");if(!t||"string"!=typeof t)throw new Error("`apiKey` is missing.");return function(e){var r=e.appId,t=e.apiKey,n=e.authMode,i=e.algoliaAgents,o=q(e,v),s=function(e,r,t="WithinHeaders"){const a={"x-algolia-api-key":r,"x-algolia-application-id":e};return{headers:()=>"WithinHeaders"===t?a:{},queryParameters:()=>"WithinQueryParameters"===t?a:{}}}(r,t,n),c=y(N(N({hosts:S(r)},o),{},{algoliaAgent:g({algoliaAgents:i,client:"Search",version:O}),baseHeaders:N(N({"content-type":"text/plain"},s.headers()),o.baseHeaders),baseQueryParameters:N(N({},s.queryParameters()),o.baseQueryParameters)}));return{transporter:c,get _ua(){return c.algoliaAgent.value},addAlgoliaAgent:function(e,r){c.algoliaAgent.add({segment:e,version:r})},waitForTask:function(e,r){var t=this,n=e.indexName,i=e.taskID;return a(N(N({},q(e,b)),{},{func:function(){return t.getTask({indexName:n,taskID:i},r)},validate:function(e){return"published"===e.status}}))},waitForApiKey:function(e,r){var t=this,n=e.operation,i=e.key,o=e.apiKey,s=q(e,x);if("update"===n){if(!o)throw new Error("`apiKey` is required when waiting for an `update` operation.");return a(N(N({},s),{},{func:function(){return t.getApiKey({key:i},r)},validate:function(e){for(var r=function(){var r=a[t];if(Array.isArray(o[r])){if(o[r].length!==e[r].length||o[r].some((function(t,a){return t!==e[r][a]})))return{v:!1}}else if(e[r]!==o[r])return{v:!1}},t=0,a=Object.keys(o);t<a.length;t++){var n=r();if("object"===P(n))return n.v}return!0}}))}return a(N(N({},s),{},{func:function(){return t.getApiKey({key:i},r).catch((function(e){return e}))},validate:function(e){return"add"===n?404!==e.status:404===e.status}}))},addApiKey:function(e,r){if(!e)throw new Error("Parameter `apiKey` is required when calling `addApiKey`.");if(!e.acl)throw new Error("Parameter `apiKey.acl` is required when calling `addApiKey`.");var t={method:"POST",path:"/1/keys",queryParameters:{},headers:{},data:e};return c.request(t,r)},addOrUpdateObject:function(e,r){var t=e.indexName,a=e.objectID,n=e.body;if(!t)throw new Error("Parameter `indexName` is required when calling `addOrUpdateObject`.");if(!a)throw new Error("Parameter `objectID` is required when calling `addOrUpdateObject`.");if(!n)throw new Error("Parameter `body` is required when calling `addOrUpdateObject`.");var i={method:"PUT",path:"/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(t)).replace("{objectID}",encodeURIComponent(a)),queryParameters:{},headers:{},data:n};return c.request(i,r)},appendSource:function(e,r){if(!e)throw new Error("Parameter `source` is required when calling `appendSource`.");var t={method:"POST",path:"/1/security/sources/append",queryParameters:{},headers:{},data:e};return c.request(t,r)},assignUserId:function(e,r){var t=e.xAlgoliaUserID,a=e.assignUserIdParams;if(!t)throw new Error("Parameter `xAlgoliaUserID` is required when calling `assignUserId`.");if(!a)throw new Error("Parameter `assignUserIdParams` is required when calling `assignUserId`.");if(!a.cluster)throw new Error("Parameter `assignUserIdParams.cluster` is required when calling `assignUserId`.");var n={};void 0!==t&&(n["X-Algolia-User-ID"]=t.toString());var i={method:"POST",path:"/1/clusters/mapping",queryParameters:{},headers:n,data:a};return c.request(i,r)},batch:function(e,r){var t=e.indexName,a=e.batchWriteParams;if(!t)throw new Error("Parameter `indexName` is required when calling `batch`.");if(!a)throw new Error("Parameter `batchWriteParams` is required when calling `batch`.");var n={method:"POST",path:"/1/indexes/{indexName}/batch".replace("{indexName}",encodeURIComponent(t)),queryParameters:{},headers:{},data:a};return c.request(n,r)},batchAssignUserIds:function(e,r){var t=e.xAlgoliaUserID,a=e.batchAssignUserIdsParams;if(!t)throw new Error("Parameter `xAlgoliaUserID` is required when calling `batchAssignUserIds`.");if(!a)throw new Error("Parameter `batchAssignUserIdsParams` is required when calling `batchAssignUserIds`.");if(!a.cluster)throw new Error("Parameter `batchAssignUserIdsParams.cluster` is required when calling `batchAssignUserIds`.");if(!a.users)throw new Error("Parameter `batchAssignUserIdsParams.users` is required when calling `batchAssignUserIds`.");var n={};void 0!==t&&(n["X-Algolia-User-ID"]=t.toString());var i={method:"POST",path:"/1/clusters/mapping/batch",queryParameters:{},headers:n,data:a};return c.request(i,r)},batchDictionaryEntries:function(e,r){var t=e.dictionaryName,a=e.batchDictionaryEntriesParams;if(!t)throw new Error("Parameter `dictionaryName` is required when calling `batchDictionaryEntries`.");if(!a)throw new Error("Parameter `batchDictionaryEntriesParams` is required when calling `batchDictionaryEntries`.");if(!a.requests)throw new Error("Parameter `batchDictionaryEntriesParams.requests` is required when calling `batchDictionaryEntries`.");var n={method:"POST",path:"/1/dictionaries/{dictionaryName}/batch".replace("{dictionaryName}",encodeURIComponent(t)),queryParameters:{},headers:{},data:a};return c.request(n,r)},browse:function(e,r){var t=e.indexName,a=e.browseRequest;if(!t)throw new Error("Parameter `indexName` is required when calling `browse`.");var n={method:"POST",path:"/1/indexes/{indexName}/browse".replace("{indexName}",encodeURIComponent(t)),queryParameters:{},headers:{},data:a||{}};return c.request(n,r)},clearAllSynonyms:function(e,r){var t=e.indexName,a=e.forwardToReplicas;if(!t)throw new Error("Parameter `indexName` is required when calling `clearAllSynonyms`.");var n="/1/indexes/{indexName}/synonyms/clear".replace("{indexName}",encodeURIComponent(t)),i={};void 0!==a&&(i.forwardToReplicas=a.toString());var o={method:"POST",path:n,queryParameters:i,headers:{}};return c.request(o,r)},clearObjects:function(e,r){var t=e.indexName;if(!t)throw new Error("Parameter `indexName` is required when calling `clearObjects`.");var a={method:"POST",path:"/1/indexes/{indexName}/clear".replace("{indexName}",encodeURIComponent(t)),queryParameters:{},headers:{}};return c.request(a,r)},clearRules:function(e,r){var t=e.indexName,a=e.forwardToReplicas;if(!t)throw new Error("Parameter `indexName` is required when calling `clearRules`.");var n="/1/indexes/{indexName}/rules/clear".replace("{indexName}",encodeURIComponent(t)),i={};void 0!==a&&(i.forwardToReplicas=a.toString());var o={method:"POST",path:n,queryParameters:i,headers:{}};return c.request(o,r)},del:function(e,r){var t=e.path,a=e.parameters;if(!t)throw new Error("Parameter `path` is required when calling `del`.");var n={method:"DELETE",path:"/1{path}".replace("{path}",t),queryParameters:a||{},headers:{}};return c.request(n,r)},deleteApiKey:function(e,r){var t=e.key;if(!t)throw new Error("Parameter `key` is required when calling `deleteApiKey`.");var a={method:"DELETE",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(t)),queryParameters:{},headers:{}};return c.request(a,r)},deleteBy:function(e,r){var t=e.indexName,a=e.searchParams;if(!t)throw new Error("Parameter `indexName` is required when calling `deleteBy`.");if(!a)throw new Error("Parameter `searchParams` is required when calling `deleteBy`.");var n={method:"POST",path:"/1/indexes/{indexName}/deleteByQuery".replace("{indexName}",encodeURIComponent(t)),queryParameters:{},headers:{},data:a};return c.request(n,r)},deleteIndex:function(e,r){var t=e.indexName;if(!t)throw new Error("Parameter `indexName` is required when calling `deleteIndex`.");var a={method:"DELETE",path:"/1/indexes/{indexName}".replace("{indexName}",encodeURIComponent(t)),queryParameters:{},headers:{}};return c.request(a,r)},deleteObject:function(e,r){var t=e.indexName,a=e.objectID;if(!t)throw new Error("Parameter `indexName` is required when calling `deleteObject`.");if(!a)throw new Error("Parameter `objectID` is required when calling `deleteObject`.");var n={method:"DELETE",path:"/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(t)).replace("{objectID}",encodeURIComponent(a)),queryParameters:{},headers:{}};return c.request(n,r)},deleteRule:function(e,r){var t=e.indexName,a=e.objectID,n=e.forwardToReplicas;if(!t)throw new Error("Parameter `indexName` is required when calling `deleteRule`.");if(!a)throw new Error("Parameter `objectID` is required when calling `deleteRule`.");var i="/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(t)).replace("{objectID}",encodeURIComponent(a)),o={};void 0!==n&&(o.forwardToReplicas=n.toString());var s={method:"DELETE",path:i,queryParameters:o,headers:{}};return c.request(s,r)},deleteSource:function(e,r){var t=e.source;if(!t)throw new Error("Parameter `source` is required when calling `deleteSource`.");var a={method:"DELETE",path:"/1/security/sources/{source}".replace("{source}",encodeURIComponent(t)),queryParameters:{},headers:{}};return c.request(a,r)},deleteSynonym:function(e,r){var t=e.indexName,a=e.objectID,n=e.forwardToReplicas;if(!t)throw new Error("Parameter `indexName` is required when calling `deleteSynonym`.");if(!a)throw new Error("Parameter `objectID` is required when calling `deleteSynonym`.");var i="/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(t)).replace("{objectID}",encodeURIComponent(a)),o={};void 0!==n&&(o.forwardToReplicas=n.toString());var s={method:"DELETE",path:i,queryParameters:o,headers:{}};return c.request(s,r)},get:function(e,r){var t=e.path,a=e.parameters;if(!t)throw new Error("Parameter `path` is required when calling `get`.");var n={method:"GET",path:"/1{path}".replace("{path}",t),queryParameters:a||{},headers:{}};return c.request(n,r)},getApiKey:function(e,r){var t=e.key;if(!t)throw new Error("Parameter `key` is required when calling `getApiKey`.");var a={method:"GET",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(t)),queryParameters:{},headers:{}};return c.request(a,r)},getDictionaryLanguages:function(e){var r={method:"GET",path:"/1/dictionaries/*/languages",queryParameters:{},headers:{}};return c.request(r,e)},getDictionarySettings:function(e){var r={method:"GET",path:"/1/dictionaries/*/settings",queryParameters:{},headers:{}};return c.request(r,e)},getLogs:function(e,r){var t=e.offset,a=e.length,n=e.indexName,i=e.type,o={};void 0!==t&&(o.offset=t.toString()),void 0!==a&&(o.length=a.toString()),void 0!==n&&(o.indexName=n.toString()),void 0!==i&&(o.type=i.toString());var s={method:"GET",path:"/1/logs",queryParameters:o,headers:{}};return c.request(s,r)},getObject:function(e,r){var t=e.indexName,a=e.objectID,n=e.attributesToRetrieve;if(!t)throw new Error("Parameter `indexName` is required when calling `getObject`.");if(!a)throw new Error("Parameter `objectID` is required when calling `getObject`.");var i="/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(t)).replace("{objectID}",encodeURIComponent(a)),o={};void 0!==n&&(o.attributesToRetrieve=n.toString());var s={method:"GET",path:i,queryParameters:o,headers:{}};return c.request(s,r)},getObjects:function(e,r){if(!e)throw new Error("Parameter `getObjectsParams` is required when calling `getObjects`.");var t={method:"POST",path:"/1/indexes/*/objects",queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return c.request(t,r)},getRule:function(e,r){var t=e.indexName,a=e.objectID;if(!t)throw new Error("Parameter `indexName` is required when calling `getRule`.");if(!a)throw new Error("Parameter `objectID` is required when calling `getRule`.");var n={method:"GET",path:"/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(t)).replace("{objectID}",encodeURIComponent(a)),queryParameters:{},headers:{}};return c.request(n,r)},getSettings:function(e,r){var t=e.indexName;if(!t)throw new Error("Parameter `indexName` is required when calling `getSettings`.");var a={method:"GET",path:"/1/indexes/{indexName}/settings".replace("{indexName}",encodeURIComponent(t)),queryParameters:{},headers:{}};return c.request(a,r)},getSources:function(e){var r={method:"GET",path:"/1/security/sources",queryParameters:{},headers:{}};return c.request(r,e)},getSynonym:function(e,r){var t=e.indexName,a=e.objectID;if(!t)throw new Error("Parameter `indexName` is required when calling `getSynonym`.");if(!a)throw new Error("Parameter `objectID` is required when calling `getSynonym`.");var n={method:"GET",path:"/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(t)).replace("{objectID}",encodeURIComponent(a)),queryParameters:{},headers:{}};return c.request(n,r)},getTask:function(e,r){var t=e.indexName,a=e.taskID;if(!t)throw new Error("Parameter `indexName` is required when calling `getTask`.");if(!a)throw new Error("Parameter `taskID` is required when calling `getTask`.");var n={method:"GET",path:"/1/indexes/{indexName}/task/{taskID}".replace("{indexName}",encodeURIComponent(t)).replace("{taskID}",encodeURIComponent(a)),queryParameters:{},headers:{}};return c.request(n,r)},getTopUserIds:function(e){var r={method:"GET",path:"/1/clusters/mapping/top",queryParameters:{},headers:{}};return c.request(r,e)},getUserId:function(e,r){var t=e.userID;if(!t)throw new Error("Parameter `userID` is required when calling `getUserId`.");var a={method:"GET",path:"/1/clusters/mapping/{userID}".replace("{userID}",encodeURIComponent(t)),queryParameters:{},headers:{}};return c.request(a,r)},hasPendingMappings:function(e,r){var t=e.getClusters,a={};void 0!==t&&(a.getClusters=t.toString());var n={method:"GET",path:"/1/clusters/mapping/pending",queryParameters:a,headers:{}};return c.request(n,r)},listApiKeys:function(e){var r={method:"GET",path:"/1/keys",queryParameters:{},headers:{}};return c.request(r,e)},listClusters:function(e){var r={method:"GET",path:"/1/clusters",queryParameters:{},headers:{}};return c.request(r,e)},listIndices:function(e,r){var t=e.page,a={};void 0!==t&&(a.page=t.toString());var n={method:"GET",path:"/1/indexes",queryParameters:a,headers:{}};return c.request(n,r)},listUserIds:function(e,r){var t=e.page,a=e.hitsPerPage,n={};void 0!==t&&(n.page=t.toString()),void 0!==a&&(n.hitsPerPage=a.toString());var i={method:"GET",path:"/1/clusters/mapping",queryParameters:n,headers:{}};return c.request(i,r)},multipleBatch:function(e,r){if(!e)throw new Error("Parameter `batchParams` is required when calling `multipleBatch`.");var t={method:"POST",path:"/1/indexes/*/batch",queryParameters:{},headers:{},data:e};return c.request(t,r)},operationIndex:function(e,r){var t=e.indexName,a=e.operationIndexParams;if(!t)throw new Error("Parameter `indexName` is required when calling `operationIndex`.");if(!a)throw new Error("Parameter `operationIndexParams` is required when calling `operationIndex`.");if(!a.operation)throw new Error("Parameter `operationIndexParams.operation` is required when calling `operationIndex`.");if(!a.destination)throw new Error("Parameter `operationIndexParams.destination` is required when calling `operationIndex`.");var n={method:"POST",path:"/1/indexes/{indexName}/operation".replace("{indexName}",encodeURIComponent(t)),queryParameters:{},headers:{},data:a};return c.request(n,r)},partialUpdateObject:function(e,r){var t=e.indexName,a=e.objectID,n=e.attributeOrBuiltInOperation,i=e.createIfNotExists;if(!t)throw new Error("Parameter `indexName` is required when calling `partialUpdateObject`.");if(!a)throw new Error("Parameter `objectID` is required when calling `partialUpdateObject`.");if(!n)throw new Error("Parameter `attributeOrBuiltInOperation` is required when calling `partialUpdateObject`.");var o="/1/indexes/{indexName}/{objectID}/partial".replace("{indexName}",encodeURIComponent(t)).replace("{objectID}",encodeURIComponent(a)),s={};void 0!==i&&(s.createIfNotExists=i.toString());var d={method:"POST",path:o,queryParameters:s,headers:{},data:n};return c.request(d,r)},post:function(e,r){var t=e.path,a=e.parameters,n=e.body;if(!t)throw new Error("Parameter `path` is required when calling `post`.");var i={method:"POST",path:"/1{path}".replace("{path}",t),queryParameters:a||{},headers:{},data:n||{}};return c.request(i,r)},put:function(e,r){var t=e.path,a=e.parameters,n=e.body;if(!t)throw new Error("Parameter `path` is required when calling `put`.");var i={method:"PUT",path:"/1{path}".replace("{path}",t),queryParameters:a||{},headers:{},data:n||{}};return c.request(i,r)},removeUserId:function(e,r){var t=e.userID;if(!t)throw new Error("Parameter `userID` is required when calling `removeUserId`.");var a={method:"DELETE",path:"/1/clusters/mapping/{userID}".replace("{userID}",encodeURIComponent(t)),queryParameters:{},headers:{}};return c.request(a,r)},replaceSources:function(e,r){var t=e.source;if(!t)throw new Error("Parameter `source` is required when calling `replaceSources`.");var a={method:"PUT",path:"/1/security/sources",queryParameters:{},headers:{},data:t};return c.request(a,r)},restoreApiKey:function(e,r){var t=e.key;if(!t)throw new Error("Parameter `key` is required when calling `restoreApiKey`.");var a={method:"POST",path:"/1/keys/{key}/restore".replace("{key}",encodeURIComponent(t)),queryParameters:{},headers:{}};return c.request(a,r)},saveObject:function(e,r){var t=e.indexName,a=e.body;if(!t)throw new Error("Parameter `indexName` is required when calling `saveObject`.");if(!a)throw new Error("Parameter `body` is required when calling `saveObject`.");var n={method:"POST",path:"/1/indexes/{indexName}".replace("{indexName}",encodeURIComponent(t)),queryParameters:{},headers:{},data:a};return c.request(n,r)},saveRule:function(e,r){var t=e.indexName,a=e.objectID,n=e.rule,i=e.forwardToReplicas;if(!t)throw new Error("Parameter `indexName` is required when calling `saveRule`.");if(!a)throw new Error("Parameter `objectID` is required when calling `saveRule`.");if(!n)throw new Error("Parameter `rule` is required when calling `saveRule`.");if(!n.objectID)throw new Error("Parameter `rule.objectID` is required when calling `saveRule`.");var o="/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(t)).replace("{objectID}",encodeURIComponent(a)),s={};void 0!==i&&(s.forwardToReplicas=i.toString());var d={method:"PUT",path:o,queryParameters:s,headers:{},data:n};return c.request(d,r)},saveRules:function(e,r){var t=e.indexName,a=e.rule,n=e.forwardToReplicas,i=e.clearExistingRules;if(!t)throw new Error("Parameter `indexName` is required when calling `saveRules`.");if(!a)throw new Error("Parameter `rule` is required when calling `saveRules`.");var o="/1/indexes/{indexName}/rules/batch".replace("{indexName}",encodeURIComponent(t)),s={};void 0!==n&&(s.forwardToReplicas=n.toString()),void 0!==i&&(s.clearExistingRules=i.toString());var d={method:"POST",path:o,queryParameters:s,headers:{},data:a};return c.request(d,r)},saveSynonym:function(e,r){var t=e.indexName,a=e.objectID,n=e.synonymHit,i=e.forwardToReplicas;if(!t)throw new Error("Parameter `indexName` is required when calling `saveSynonym`.");if(!a)throw new Error("Parameter `objectID` is required when calling `saveSynonym`.");if(!n)throw new Error("Parameter `synonymHit` is required when calling `saveSynonym`.");if(!n.objectID)throw new Error("Parameter `synonymHit.objectID` is required when calling `saveSynonym`.");var o="/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(t)).replace("{objectID}",encodeURIComponent(a)),s={};void 0!==i&&(s.forwardToReplicas=i.toString());var d={method:"PUT",path:o,queryParameters:s,headers:{},data:n};return c.request(d,r)},saveSynonyms:function(e,r){var t=e.indexName,a=e.synonymHit,n=e.forwardToReplicas,i=e.replaceExistingSynonyms;if(!t)throw new Error("Parameter `indexName` is required when calling `saveSynonyms`.");if(!a)throw new Error("Parameter `synonymHit` is required when calling `saveSynonyms`.");var o="/1/indexes/{indexName}/synonyms/batch".replace("{indexName}",encodeURIComponent(t)),s={};void 0!==n&&(s.forwardToReplicas=n.toString()),void 0!==i&&(s.replaceExistingSynonyms=i.toString());var d={method:"POST",path:o,queryParameters:s,headers:{},data:a};return c.request(d,r)},search:function(e,r){if(e&&Array.isArray(e)){var t={requests:e.map((function(e){var r=e.params,t=q(e,E);return"facet"===t.type?N(N(N({},t),r),{},{type:"facet"}):N(N(N({},t),r),{},{facet:void 0,maxFacetHits:void 0,facetQuery:void 0})}))};e=t}if(!e)throw new Error("Parameter `searchMethodParams` is required when calling `search`.");if(!e.requests)throw new Error("Parameter `searchMethodParams.requests` is required when calling `search`.");var a={method:"POST",path:"/1/indexes/*/queries",queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return c.request(a,r)},searchDictionaryEntries:function(e,r){var t=e.dictionaryName,a=e.searchDictionaryEntriesParams;if(!t)throw new Error("Parameter `dictionaryName` is required when calling `searchDictionaryEntries`.");if(!a)throw new Error("Parameter `searchDictionaryEntriesParams` is required when calling `searchDictionaryEntries`.");if(!a.query)throw new Error("Parameter `searchDictionaryEntriesParams.query` is required when calling `searchDictionaryEntries`.");var n={method:"POST",path:"/1/dictionaries/{dictionaryName}/search".replace("{dictionaryName}",encodeURIComponent(t)),queryParameters:{},headers:{},data:a,useReadTransporter:!0,cacheable:!0};return c.request(n,r)},searchForFacetValues:function(e,r){var t=e.indexName,a=e.facetName,n=e.searchForFacetValuesRequest;if(!t)throw new Error("Parameter `indexName` is required when calling `searchForFacetValues`.");if(!a)throw new Error("Parameter `facetName` is required when calling `searchForFacetValues`.");var i={method:"POST",path:"/1/indexes/{indexName}/facets/{facetName}/query".replace("{indexName}",encodeURIComponent(t)).replace("{facetName}",encodeURIComponent(a)),queryParameters:{},headers:{},data:n||{},useReadTransporter:!0,cacheable:!0};return c.request(i,r)},searchRules:function(e,r){var t=e.indexName,a=e.searchRulesParams;if(!t)throw new Error("Parameter `indexName` is required when calling `searchRules`.");if(!a)throw new Error("Parameter `searchRulesParams` is required when calling `searchRules`.");var n={method:"POST",path:"/1/indexes/{indexName}/rules/search".replace("{indexName}",encodeURIComponent(t)),queryParameters:{},headers:{},data:a,useReadTransporter:!0,cacheable:!0};return c.request(n,r)},searchSingleIndex:function(e,r){var t=e.indexName,a=e.searchParams;if(!t)throw new Error("Parameter `indexName` is required when calling `searchSingleIndex`.");if(!a)throw new Error("Parameter `searchParams` is required when calling `searchSingleIndex`.");var n={method:"POST",path:"/1/indexes/{indexName}/query".replace("{indexName}",encodeURIComponent(t)),queryParameters:{},headers:{},data:a,useReadTransporter:!0,cacheable:!0};return c.request(n,r)},searchSynonyms:function(e,r){var t=e.indexName,a=e.type,n=e.page,i=e.hitsPerPage,o=e.searchSynonymsParams;if(!t)throw new Error("Parameter `indexName` is required when calling `searchSynonyms`.");var s="/1/indexes/{indexName}/synonyms/search".replace("{indexName}",encodeURIComponent(t)),d={};void 0!==a&&(d.type=a.toString()),void 0!==n&&(d.page=n.toString()),void 0!==i&&(d.hitsPerPage=i.toString());var u={method:"POST",path:s,queryParameters:d,headers:{},data:o||{},useReadTransporter:!0,cacheable:!0};return c.request(u,r)},searchUserIds:function(e,r){if(!e)throw new Error("Parameter `searchUserIdsParams` is required when calling `searchUserIds`.");if(!e.query)throw new Error("Parameter `searchUserIdsParams.query` is required when calling `searchUserIds`.");var t={method:"POST",path:"/1/clusters/mapping/search",queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return c.request(t,r)},setDictionarySettings:function(e,r){if(!e)throw new Error("Parameter `dictionarySettingsParams` is required when calling `setDictionarySettings`.");if(!e.disableStandardEntries)throw new Error("Parameter `dictionarySettingsParams.disableStandardEntries` is required when calling `setDictionarySettings`.");var t={method:"PUT",path:"/1/dictionaries/*/settings",queryParameters:{},headers:{},data:e};return c.request(t,r)},setSettings:function(e,r){var t=e.indexName,a=e.indexSettings,n=e.forwardToReplicas;if(!t)throw new Error("Parameter `indexName` is required when calling `setSettings`.");if(!a)throw new Error("Parameter `indexSettings` is required when calling `setSettings`.");var i="/1/indexes/{indexName}/settings".replace("{indexName}",encodeURIComponent(t)),o={};void 0!==n&&(o.forwardToReplicas=n.toString());var s={method:"PUT",path:i,queryParameters:o,headers:{},data:a};return c.request(s,r)},updateApiKey:function(e,r){var t=e.key,a=e.apiKey;if(!t)throw new Error("Parameter `key` is required when calling `updateApiKey`.");if(!a)throw new Error("Parameter `apiKey` is required when calling `updateApiKey`.");if(!a.acl)throw new Error("Parameter `apiKey.acl` is required when calling `updateApiKey`.");var n={method:"PUT",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(t)),queryParameters:{},headers:{},data:a};return c.request(n,r)}}}(function(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?T(Object(a),!0).forEach((function(t){r(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):T(Object(a)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(a,r))}))}return e}({appId:e,apiKey:t,timeouts:{connect:1e3,read:2e3,write:3e4},requester:{send:function(e){return new Promise((r=>{const t=new XMLHttpRequest;t.open(e.method,e.url,!0),Object.keys(e.headers).forEach((r=>t.setRequestHeader(r,e.headers[r])));const a=(e,a)=>setTimeout((()=>{t.abort(),r({status:0,content:a,isTimedOut:!0})}),e),n=a(e.connectTimeout,"Connection timeout");let i;t.onreadystatechange=()=>{t.readyState>t.OPENED&&void 0===i&&(clearTimeout(n),i=a(e.responseTimeout,"Socket timeout"))},t.onerror=()=>{0===t.status&&(clearTimeout(n),clearTimeout(i),r({content:t.responseText||"Network request failed",status:t.status,isTimedOut:!1}))},t.onload=()=>{clearTimeout(n),clearTimeout(i),r({content:t.responseText,status:t.status,isTimedOut:!1})},t.send(e.data)}))}},algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:o(),requestsCache:o({serializable:!1}),hostsCache:i({caches:[n({key:"".concat(O,"-").concat(e)}),o()]})},s))}}));
|
|
1
|
+
/*! client-search.umd.js | 5.0.0-alpha.10 | © Algolia, inc. | https://github.com/algolia/algoliasearch-client-javascript */
|
|
2
|
+
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((e="undefined"!=typeof globalThis?globalThis:e||self)["@algolia/client-search"]={})}(this,(function(e){"use strict";function r({func:e,validate:r,aggregator:t,error:a,timeout:n=(()=>0)}){const s=i=>new Promise(((o,c)=>{e(i).then((e=>(t&&t(e),r(e)?o(e):a&&a.validate(e)?c(new Error(a.message(e))):setTimeout((()=>{s(e).then(o).catch(c)}),n())))).catch((e=>{c(e)}))}));return s()}function t(e){let r;const t=`algolia-client-js-${e.key}`;function a(){return void 0===r&&(r=e.localStorage||window.localStorage),r}function n(){return JSON.parse(a().getItem(t)||"{}")}return{get:(e,r,t={miss:()=>Promise.resolve()})=>Promise.resolve().then((()=>{const t=JSON.stringify(e),a=n()[t];return Promise.all([a||r(),void 0!==a])})).then((([e,r])=>Promise.all([e,r||t.miss(e)]))).then((([e])=>e)),set:(e,r)=>Promise.resolve().then((()=>{const s=n();return s[JSON.stringify(e)]=r,a().setItem(t,JSON.stringify(s)),r})),delete:e=>Promise.resolve().then((()=>{const r=n();delete r[JSON.stringify(e)],a().setItem(t,JSON.stringify(r))})),clear:()=>Promise.resolve().then((()=>{a().removeItem(t)}))}}function a(e){const r=[...e.caches],t=r.shift();return void 0===t?{get:(e,r,t={miss:()=>Promise.resolve()})=>r().then((e=>Promise.all([e,t.miss(e)]))).then((([e])=>e)),set:(e,r)=>Promise.resolve(r),delete:e=>Promise.resolve(),clear:()=>Promise.resolve()}:{get:(e,n,s={miss:()=>Promise.resolve()})=>t.get(e,n,s).catch((()=>a({caches:r}).get(e,n,s))),set:(e,n)=>t.set(e,n).catch((()=>a({caches:r}).set(e,n))),delete:e=>t.delete(e).catch((()=>a({caches:r}).delete(e))),clear:()=>t.clear().catch((()=>a({caches:r}).clear()))}}function n(e={serializable:!0}){let r={};return{get(t,a,n={miss:()=>Promise.resolve()}){const s=JSON.stringify(t);if(s in r)return Promise.resolve(e.serializable?JSON.parse(r[s]):r[s]);const i=a();return i.then((e=>n.miss(e))).then((()=>i))},set:(t,a)=>(r[JSON.stringify(t)]=e.serializable?JSON.stringify(a):a,Promise.resolve(a)),delete:e=>(delete r[JSON.stringify(e)],Promise.resolve()),clear:()=>(r={},Promise.resolve())}}const s=12e4;function i(e,r="up"){const t=Date.now();return{...e,status:r,lastUpdate:t,isUp:function(){return"up"===r||Date.now()-t>s},isTimedOut:function(){return"timed out"===r&&Date.now()-t<=s}}}function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}class c extends Error{constructor(e,r){super(e),o(this,"name","AlgoliaError"),r&&(this.name=r)}}class d extends c{constructor(e,r,t){super(e,t),o(this,"stackTrace",void 0),this.stackTrace=r}}class u extends d{constructor(e){super("Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.",e,"RetryError")}}class m extends d{constructor(e,r,t){super(e,t,"ApiError"),o(this,"status",void 0),this.status=r}}class h extends c{constructor(e,r){super(e,"DeserializationError"),o(this,"response",void 0),this.response=r}}function l(e,r,t){const a=function(e){const r=e=>"[object Object]"===Object.prototype.toString.call(e)||"[object Array]"===Object.prototype.toString.call(e);return Object.keys(e).map((t=>`${t}=${r(e[t])?JSON.stringify(e[t]):e[t]}`)).join("&")}(t);let n=`${e.protocol}://${e.url}/${"/"===r.charAt(0)?r.substr(1):r}`;return a.length&&(n+=`?${a}`),n}function p(e){const r=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return{...e,request:{...e.request,headers:{...e.request.headers,...r}}}}function w({hosts:e,hostsCache:r,baseHeaders:t,baseQueryParameters:a,algoliaAgent:n,timeouts:s,requester:o,requestsCache:c,responsesCache:d}){async function w(c,d,w=!0){const g=[],y=function(e,r){if("GET"===e.method||void 0===e.data&&void 0===r.data)return;const t=Array.isArray(e.data)?e.data:{...e.data,...r.data};return JSON.stringify(t)}(c,d),P=function(e,r,t){const a={Accept:"application/json",...e,...r,...t},n={};return Object.keys(a).forEach((e=>{const r=a[e];n[e.toLowerCase()]=r})),n}(t,c.headers,d.headers),q="GET"===c.method?{...c.data,...d.data}:{},f={...a,...c.queryParameters,...q};if(n.value&&(f["x-algolia-agent"]=n.value),d&&d.queryParameters)for(const e of Object.keys(d.queryParameters))d.queryParameters[e]&&"[object Object]"!==Object.prototype.toString.call(d.queryParameters[e])?f[e]=d.queryParameters[e].toString():f[e]=d.queryParameters[e];let x=0;const E=async(e,t)=>{const a=e.pop();if(void 0===a)throw new u(function(e){return e.map((e=>p(e)))}(g));let n=d.timeout;void 0===n&&(n=w?s.read:s.write);const q={data:y,headers:P,method:c.method,url:l(a,c.path,f),connectTimeout:t(x,s.connect),responseTimeout:t(x,n)},b=r=>{const t={request:q,response:r,host:a,triesLeft:e.length};return g.push(t),t},I=await o.send(q);if(function({isTimedOut:e,status:r}){return e||function({isTimedOut:e,status:r}){return!e&&0==~~r}({isTimedOut:e,status:r})||2!=~~(r/100)&&4!=~~(r/100)}(I)){const n=b(I);return I.isTimedOut&&x++,console.log("Retryable failure",p(n)),await r.set(a,i(a,I.isTimedOut?"timed out":"down")),E(e,t)}if(function({status:e}){return 2==~~(e/100)}(I))return function(e){try{return JSON.parse(e.content)}catch(r){throw new h(r.message,e)}}(I);throw b(I),function({content:e,status:r},t){let a=e;try{a=JSON.parse(e).message}catch(e){}return new m(a,r,t)}(I,g)},b=e.filter((e=>"readWrite"===e.accept||(w?"read"===e.accept:"write"===e.accept))),I=await async function(e){const t=await Promise.all(e.map((e=>r.get(e,(()=>Promise.resolve(i(e))))))),a=t.filter((e=>e.isUp())),n=t.filter((e=>e.isTimedOut())),s=[...a,...n];return{hosts:s.length>0?s:e,getTimeout:(e,r)=>(0===n.length&&0===e?1:n.length+3+e)*r}}(b);return E([...I.hosts].reverse(),I.getTimeout)}return{hostsCache:r,requester:o,timeouts:s,algoliaAgent:n,baseHeaders:t,baseQueryParameters:a,hosts:e,request:function(e,r={}){const n=e.useReadTransporter||"GET"===e.method;if(!n)return w(e,r,n);const s=()=>w(e,r);if(!0!==(r.cacheable||e.cacheable))return s();const i={request:e,requestOptions:r,transporter:{queryParameters:a,headers:t}};return d.get(i,(()=>c.get(i,(()=>c.set(i,s()).then((e=>Promise.all([c.delete(i),e])),(e=>Promise.all([c.delete(i),Promise.reject(e)]))).then((([e,r])=>r))))),{miss:e=>d.set(i,e)})},requestsCache:c,responsesCache:d}}function g({algoliaAgents:e,client:r,version:t}){const a=function(e){const r={value:`Algolia for JavaScript (${e})`,add(e){const t=`; ${e.segment}${void 0!==e.version?` (${e.version})`:""}`;return-1===r.value.indexOf(t)&&(r.value=`${r.value}${t}`),r}};return r}(t).add({segment:r,version:t});return e.forEach((e=>a.add(e))),a}const y="5.0.0-alpha.10";function P(e){return[{url:`${e}-dsn.algolia.net`,accept:"read",protocol:"https"},{url:`${e}.algolia.net`,accept:"write",protocol:"https"}].concat(function(e){const r=e;for(let t=e.length-1;t>0;t--){const a=Math.floor(Math.random()*(t+1)),n=e[t];r[t]=e[a],r[a]=n}return r}([{url:`${e}-1.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${e}-2.algolianet.com`,accept:"readWrite",protocol:"https"},{url:`${e}-3.algolianet.com`,accept:"readWrite",protocol:"https"}]))}e.apiClientVersion=y,e.searchClient=function(e,s,i){if(!e||"string"!=typeof e)throw new Error("`appId` is missing.");if(!s||"string"!=typeof s)throw new Error("`apiKey` is missing.");return function({appId:e,apiKey:t,authMode:a,algoliaAgents:n,...s}){const i=function(e,r,t="WithinHeaders"){const a={"x-algolia-api-key":r,"x-algolia-application-id":e};return{headers:()=>"WithinHeaders"===t?a:{},queryParameters:()=>"WithinQueryParameters"===t?a:{}}}(e,t,a),o=w({hosts:P(e),...s,algoliaAgent:g({algoliaAgents:n,client:"Search",version:y}),baseHeaders:{"content-type":"text/plain",...i.headers(),...s.baseHeaders},baseQueryParameters:{...i.queryParameters(),...s.baseQueryParameters}});return{transporter:o,appId:e,clearCache:()=>Promise.all([o.requestsCache.clear(),o.responsesCache.clear()]).then((()=>{})),get _ua(){return o.algoliaAgent.value},addAlgoliaAgent(e,r){o.algoliaAgent.add({segment:e,version:r})},waitForTask({indexName:e,taskID:t,maxRetries:a=50,timeout:n=(e=>Math.min(200*e,5e3))},s){let i=0;return r({func:()=>this.getTask({indexName:e,taskID:t},s),validate:e=>"published"===e.status,aggregator:()=>i+=1,error:{validate:()=>i>=a,message:()=>`The maximum number of retries exceeded. (${i}/${a})`},timeout:()=>n(i)})},waitForApiKey({operation:e,key:t,apiKey:a,maxRetries:n=50,timeout:s=(e=>Math.min(200*e,5e3))},i){let o=0;const c={aggregator:()=>o+=1,error:{validate:()=>o>=n,message:()=>`The maximum number of retries exceeded. (${o}/${n})`},timeout:()=>s(o)};if("update"===e){if(!a)throw new Error("`apiKey` is required when waiting for an `update` operation.");return r({...c,func:()=>this.getApiKey({key:t},i),validate:e=>{for(const r of Object.keys(a))if(Array.isArray(a[r])){if(a[r].length!==e[r].length||a[r].some(((t,a)=>t!==e[r][a])))return!1}else if(e[r]!==a[r])return!1;return!0}})}return r({...c,func:()=>this.getApiKey({key:t},i).catch((e=>e)),validate:r=>"add"===e?404!==r.status:404===r.status})},browseObjects({indexName:e,browseParams:t,...a},n){return r({func:r=>this.browse({indexName:e,browseParams:{cursor:r?r.cursor:void 0,...t}},n),validate:e=>void 0===e.cursor,...a})},browseRules({indexName:e,searchRulesParams:t,...a},n){const s={hitsPerPage:1e3,...t};return r({func:r=>this.searchRules({indexName:e,searchRulesParams:{...s,page:r?r.page+1:s.page||0}},n),validate:e=>e.nbHits<s.hitsPerPage,...a})},browseSynonyms({indexName:e,validate:t,aggregator:a,...n},s){const i={hitsPerPage:1e3,...n};return r({func:r=>this.searchSynonyms({...i,indexName:e,page:r?r.page+1:n.page||0},s),validate:e=>e.nbHits<i.hitsPerPage,...n})},addApiKey(e,r){if(!e)throw new Error("Parameter `apiKey` is required when calling `addApiKey`.");if(!e.acl)throw new Error("Parameter `apiKey.acl` is required when calling `addApiKey`.");const t={method:"POST",path:"/1/keys",queryParameters:{},headers:{},data:e};return o.request(t,r)},addOrUpdateObject({indexName:e,objectID:r,body:t},a){if(!e)throw new Error("Parameter `indexName` is required when calling `addOrUpdateObject`.");if(!r)throw new Error("Parameter `objectID` is required when calling `addOrUpdateObject`.");if(!t)throw new Error("Parameter `body` is required when calling `addOrUpdateObject`.");const n={method:"PUT",path:"/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),queryParameters:{},headers:{},data:t};return o.request(n,a)},appendSource(e,r){if(!e)throw new Error("Parameter `source` is required when calling `appendSource`.");const t={method:"POST",path:"/1/security/sources/append",queryParameters:{},headers:{},data:e};return o.request(t,r)},assignUserId({xAlgoliaUserID:e,assignUserIdParams:r},t){if(!e)throw new Error("Parameter `xAlgoliaUserID` is required when calling `assignUserId`.");if(!r)throw new Error("Parameter `assignUserIdParams` is required when calling `assignUserId`.");if(!r.cluster)throw new Error("Parameter `assignUserIdParams.cluster` is required when calling `assignUserId`.");const a={};void 0!==e&&(a["X-Algolia-User-ID"]=e.toString());const n={method:"POST",path:"/1/clusters/mapping",queryParameters:{},headers:a,data:r};return o.request(n,t)},batch({indexName:e,batchWriteParams:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `batch`.");if(!r)throw new Error("Parameter `batchWriteParams` is required when calling `batch`.");if(!r.requests)throw new Error("Parameter `batchWriteParams.requests` is required when calling `batch`.");const a={method:"POST",path:"/1/indexes/{indexName}/batch".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return o.request(a,t)},batchAssignUserIds({xAlgoliaUserID:e,batchAssignUserIdsParams:r},t){if(!e)throw new Error("Parameter `xAlgoliaUserID` is required when calling `batchAssignUserIds`.");if(!r)throw new Error("Parameter `batchAssignUserIdsParams` is required when calling `batchAssignUserIds`.");if(!r.cluster)throw new Error("Parameter `batchAssignUserIdsParams.cluster` is required when calling `batchAssignUserIds`.");if(!r.users)throw new Error("Parameter `batchAssignUserIdsParams.users` is required when calling `batchAssignUserIds`.");const a={};void 0!==e&&(a["X-Algolia-User-ID"]=e.toString());const n={method:"POST",path:"/1/clusters/mapping/batch",queryParameters:{},headers:a,data:r};return o.request(n,t)},batchDictionaryEntries({dictionaryName:e,batchDictionaryEntriesParams:r},t){if(!e)throw new Error("Parameter `dictionaryName` is required when calling `batchDictionaryEntries`.");if(!r)throw new Error("Parameter `batchDictionaryEntriesParams` is required when calling `batchDictionaryEntries`.");if(!r.requests)throw new Error("Parameter `batchDictionaryEntriesParams.requests` is required when calling `batchDictionaryEntries`.");const a={method:"POST",path:"/1/dictionaries/{dictionaryName}/batch".replace("{dictionaryName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return o.request(a,t)},browse({indexName:e,browseParams:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `browse`.");const a={method:"POST",path:"/1/indexes/{indexName}/browse".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{}};return o.request(a,t)},clearAllSynonyms({indexName:e,forwardToReplicas:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `clearAllSynonyms`.");const a="/1/indexes/{indexName}/synonyms/clear".replace("{indexName}",encodeURIComponent(e)),n={};void 0!==r&&(n.forwardToReplicas=r.toString());const s={method:"POST",path:a,queryParameters:n,headers:{}};return o.request(s,t)},clearObjects({indexName:e},r){if(!e)throw new Error("Parameter `indexName` is required when calling `clearObjects`.");const t={method:"POST",path:"/1/indexes/{indexName}/clear".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{}};return o.request(t,r)},clearRules({indexName:e,forwardToReplicas:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `clearRules`.");const a="/1/indexes/{indexName}/rules/clear".replace("{indexName}",encodeURIComponent(e)),n={};void 0!==r&&(n.forwardToReplicas=r.toString());const s={method:"POST",path:a,queryParameters:n,headers:{}};return o.request(s,t)},del({path:e,parameters:r},t){if(!e)throw new Error("Parameter `path` is required when calling `del`.");const a={method:"DELETE",path:"/1{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return o.request(a,t)},deleteApiKey({key:e},r){if(!e)throw new Error("Parameter `key` is required when calling `deleteApiKey`.");const t={method:"DELETE",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(e)),queryParameters:{},headers:{}};return o.request(t,r)},deleteBy({indexName:e,searchParams:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteBy`.");if(!r)throw new Error("Parameter `searchParams` is required when calling `deleteBy`.");const a={method:"POST",path:"/1/indexes/{indexName}/deleteByQuery".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return o.request(a,t)},deleteIndex({indexName:e},r){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteIndex`.");const t={method:"DELETE",path:"/1/indexes/{indexName}".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{}};return o.request(t,r)},deleteObject({indexName:e,objectID:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteObject`.");if(!r)throw new Error("Parameter `objectID` is required when calling `deleteObject`.");const a={method:"DELETE",path:"/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return o.request(a,t)},deleteRule({indexName:e,objectID:r,forwardToReplicas:t},a){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteRule`.");if(!r)throw new Error("Parameter `objectID` is required when calling `deleteRule`.");const n="/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),s={};void 0!==t&&(s.forwardToReplicas=t.toString());const i={method:"DELETE",path:n,queryParameters:s,headers:{}};return o.request(i,a)},deleteSource({source:e},r){if(!e)throw new Error("Parameter `source` is required when calling `deleteSource`.");const t={method:"DELETE",path:"/1/security/sources/{source}".replace("{source}",encodeURIComponent(e)),queryParameters:{},headers:{}};return o.request(t,r)},deleteSynonym({indexName:e,objectID:r,forwardToReplicas:t},a){if(!e)throw new Error("Parameter `indexName` is required when calling `deleteSynonym`.");if(!r)throw new Error("Parameter `objectID` is required when calling `deleteSynonym`.");const n="/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),s={};void 0!==t&&(s.forwardToReplicas=t.toString());const i={method:"DELETE",path:n,queryParameters:s,headers:{}};return o.request(i,a)},get({path:e,parameters:r},t){if(!e)throw new Error("Parameter `path` is required when calling `get`.");const a={method:"GET",path:"/1{path}".replace("{path}",e),queryParameters:r||{},headers:{}};return o.request(a,t)},getApiKey({key:e},r){if(!e)throw new Error("Parameter `key` is required when calling `getApiKey`.");const t={method:"GET",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(e)),queryParameters:{},headers:{}};return o.request(t,r)},getDictionaryLanguages(e){const r={method:"GET",path:"/1/dictionaries/*/languages",queryParameters:{},headers:{}};return o.request(r,e)},getDictionarySettings(e){const r={method:"GET",path:"/1/dictionaries/*/settings",queryParameters:{},headers:{}};return o.request(r,e)},getLogs({offset:e,length:r,indexName:t,type:a}={},n){const s={};void 0!==e&&(s.offset=e.toString()),void 0!==r&&(s.length=r.toString()),void 0!==t&&(s.indexName=t.toString()),void 0!==a&&(s.type=a.toString());const i={method:"GET",path:"/1/logs",queryParameters:s,headers:{}};return o.request(i,n)},getObject({indexName:e,objectID:r,attributesToRetrieve:t},a){if(!e)throw new Error("Parameter `indexName` is required when calling `getObject`.");if(!r)throw new Error("Parameter `objectID` is required when calling `getObject`.");const n="/1/indexes/{indexName}/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),s={};void 0!==t&&(s.attributesToRetrieve=t.toString());const i={method:"GET",path:n,queryParameters:s,headers:{}};return o.request(i,a)},getObjects(e,r){if(!e)throw new Error("Parameter `getObjectsParams` is required when calling `getObjects`.");if(!e.requests)throw new Error("Parameter `getObjectsParams.requests` is required when calling `getObjects`.");const t={method:"POST",path:"/1/indexes/*/objects",queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return o.request(t,r)},getRule({indexName:e,objectID:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `getRule`.");if(!r)throw new Error("Parameter `objectID` is required when calling `getRule`.");const a={method:"GET",path:"/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return o.request(a,t)},getSettings({indexName:e},r){if(!e)throw new Error("Parameter `indexName` is required when calling `getSettings`.");const t={method:"GET",path:"/1/indexes/{indexName}/settings".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{}};return o.request(t,r)},getSources(e){const r={method:"GET",path:"/1/security/sources",queryParameters:{},headers:{}};return o.request(r,e)},getSynonym({indexName:e,objectID:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `getSynonym`.");if(!r)throw new Error("Parameter `objectID` is required when calling `getSynonym`.");const a={method:"GET",path:"/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return o.request(a,t)},getTask({indexName:e,taskID:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `getTask`.");if(!r)throw new Error("Parameter `taskID` is required when calling `getTask`.");const a={method:"GET",path:"/1/indexes/{indexName}/task/{taskID}".replace("{indexName}",encodeURIComponent(e)).replace("{taskID}",encodeURIComponent(r)),queryParameters:{},headers:{}};return o.request(a,t)},getTopUserIds(e){const r={method:"GET",path:"/1/clusters/mapping/top",queryParameters:{},headers:{}};return o.request(r,e)},getUserId({userID:e},r){if(!e)throw new Error("Parameter `userID` is required when calling `getUserId`.");const t={method:"GET",path:"/1/clusters/mapping/{userID}".replace("{userID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return o.request(t,r)},hasPendingMappings({getClusters:e}={},r){const t={};void 0!==e&&(t.getClusters=e.toString());const a={method:"GET",path:"/1/clusters/mapping/pending",queryParameters:t,headers:{}};return o.request(a,r)},listApiKeys(e){const r={method:"GET",path:"/1/keys",queryParameters:{},headers:{}};return o.request(r,e)},listClusters(e){const r={method:"GET",path:"/1/clusters",queryParameters:{},headers:{}};return o.request(r,e)},listIndices({page:e}={},r){const t={};void 0!==e&&(t.page=e.toString());const a={method:"GET",path:"/1/indexes",queryParameters:t,headers:{}};return o.request(a,r)},listUserIds({page:e,hitsPerPage:r}={},t){const a={};void 0!==e&&(a.page=e.toString()),void 0!==r&&(a.hitsPerPage=r.toString());const n={method:"GET",path:"/1/clusters/mapping",queryParameters:a,headers:{}};return o.request(n,t)},multipleBatch(e,r){if(!e)throw new Error("Parameter `batchParams` is required when calling `multipleBatch`.");if(!e.requests)throw new Error("Parameter `batchParams.requests` is required when calling `multipleBatch`.");const t={method:"POST",path:"/1/indexes/*/batch",queryParameters:{},headers:{},data:e};return o.request(t,r)},operationIndex({indexName:e,operationIndexParams:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `operationIndex`.");if(!r)throw new Error("Parameter `operationIndexParams` is required when calling `operationIndex`.");if(!r.operation)throw new Error("Parameter `operationIndexParams.operation` is required when calling `operationIndex`.");if(!r.destination)throw new Error("Parameter `operationIndexParams.destination` is required when calling `operationIndex`.");const a={method:"POST",path:"/1/indexes/{indexName}/operation".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return o.request(a,t)},partialUpdateObject({indexName:e,objectID:r,attributesToUpdate:t,createIfNotExists:a},n){if(!e)throw new Error("Parameter `indexName` is required when calling `partialUpdateObject`.");if(!r)throw new Error("Parameter `objectID` is required when calling `partialUpdateObject`.");if(!t)throw new Error("Parameter `attributesToUpdate` is required when calling `partialUpdateObject`.");const s="/1/indexes/{indexName}/{objectID}/partial".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),i={};void 0!==a&&(i.createIfNotExists=a.toString());const c={method:"POST",path:s,queryParameters:i,headers:{},data:t};return o.request(c,n)},post({path:e,parameters:r,body:t},a){if(!e)throw new Error("Parameter `path` is required when calling `post`.");const n={method:"POST",path:"/1{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:t||{}};return o.request(n,a)},put({path:e,parameters:r,body:t},a){if(!e)throw new Error("Parameter `path` is required when calling `put`.");const n={method:"PUT",path:"/1{path}".replace("{path}",e),queryParameters:r||{},headers:{},data:t||{}};return o.request(n,a)},removeUserId({userID:e},r){if(!e)throw new Error("Parameter `userID` is required when calling `removeUserId`.");const t={method:"DELETE",path:"/1/clusters/mapping/{userID}".replace("{userID}",encodeURIComponent(e)),queryParameters:{},headers:{}};return o.request(t,r)},replaceSources({source:e},r){if(!e)throw new Error("Parameter `source` is required when calling `replaceSources`.");const t={method:"PUT",path:"/1/security/sources",queryParameters:{},headers:{},data:e};return o.request(t,r)},restoreApiKey({key:e},r){if(!e)throw new Error("Parameter `key` is required when calling `restoreApiKey`.");const t={method:"POST",path:"/1/keys/{key}/restore".replace("{key}",encodeURIComponent(e)),queryParameters:{},headers:{}};return o.request(t,r)},saveObject({indexName:e,body:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `saveObject`.");if(!r)throw new Error("Parameter `body` is required when calling `saveObject`.");const a={method:"POST",path:"/1/indexes/{indexName}".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return o.request(a,t)},saveRule({indexName:e,objectID:r,rule:t,forwardToReplicas:a},n){if(!e)throw new Error("Parameter `indexName` is required when calling `saveRule`.");if(!r)throw new Error("Parameter `objectID` is required when calling `saveRule`.");if(!t)throw new Error("Parameter `rule` is required when calling `saveRule`.");if(!t.objectID)throw new Error("Parameter `rule.objectID` is required when calling `saveRule`.");const s="/1/indexes/{indexName}/rules/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),i={};void 0!==a&&(i.forwardToReplicas=a.toString());const c={method:"PUT",path:s,queryParameters:i,headers:{},data:t};return o.request(c,n)},saveRules({indexName:e,rules:r,forwardToReplicas:t,clearExistingRules:a},n){if(!e)throw new Error("Parameter `indexName` is required when calling `saveRules`.");if(!r)throw new Error("Parameter `rules` is required when calling `saveRules`.");const s="/1/indexes/{indexName}/rules/batch".replace("{indexName}",encodeURIComponent(e)),i={};void 0!==t&&(i.forwardToReplicas=t.toString()),void 0!==a&&(i.clearExistingRules=a.toString());const c={method:"POST",path:s,queryParameters:i,headers:{},data:r};return o.request(c,n)},saveSynonym({indexName:e,objectID:r,synonymHit:t,forwardToReplicas:a},n){if(!e)throw new Error("Parameter `indexName` is required when calling `saveSynonym`.");if(!r)throw new Error("Parameter `objectID` is required when calling `saveSynonym`.");if(!t)throw new Error("Parameter `synonymHit` is required when calling `saveSynonym`.");if(!t.objectID)throw new Error("Parameter `synonymHit.objectID` is required when calling `saveSynonym`.");const s="/1/indexes/{indexName}/synonyms/{objectID}".replace("{indexName}",encodeURIComponent(e)).replace("{objectID}",encodeURIComponent(r)),i={};void 0!==a&&(i.forwardToReplicas=a.toString());const c={method:"PUT",path:s,queryParameters:i,headers:{},data:t};return o.request(c,n)},saveSynonyms({indexName:e,synonymHit:r,forwardToReplicas:t,replaceExistingSynonyms:a},n){if(!e)throw new Error("Parameter `indexName` is required when calling `saveSynonyms`.");if(!r)throw new Error("Parameter `synonymHit` is required when calling `saveSynonyms`.");const s="/1/indexes/{indexName}/synonyms/batch".replace("{indexName}",encodeURIComponent(e)),i={};void 0!==t&&(i.forwardToReplicas=t.toString()),void 0!==a&&(i.replaceExistingSynonyms=a.toString());const c={method:"POST",path:s,queryParameters:i,headers:{},data:r};return o.request(c,n)},search(e,r){if(e&&Array.isArray(e)){const r={requests:e.map((({params:e,...r})=>"facet"===r.type?{...r,...e,type:"facet"}:{...r,...e,facet:void 0,maxFacetHits:void 0,facetQuery:void 0}))};e=r}if(!e)throw new Error("Parameter `searchMethodParams` is required when calling `search`.");if(!e.requests)throw new Error("Parameter `searchMethodParams.requests` is required when calling `search`.");const t={method:"POST",path:"/1/indexes/*/queries",queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return o.request(t,r)},searchDictionaryEntries({dictionaryName:e,searchDictionaryEntriesParams:r},t){if(!e)throw new Error("Parameter `dictionaryName` is required when calling `searchDictionaryEntries`.");if(!r)throw new Error("Parameter `searchDictionaryEntriesParams` is required when calling `searchDictionaryEntries`.");if(!r.query)throw new Error("Parameter `searchDictionaryEntriesParams.query` is required when calling `searchDictionaryEntries`.");const a={method:"POST",path:"/1/dictionaries/{dictionaryName}/search".replace("{dictionaryName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r,useReadTransporter:!0,cacheable:!0};return o.request(a,t)},searchForFacetValues({indexName:e,facetName:r,searchForFacetValuesRequest:t},a){if(!e)throw new Error("Parameter `indexName` is required when calling `searchForFacetValues`.");if(!r)throw new Error("Parameter `facetName` is required when calling `searchForFacetValues`.");const n={method:"POST",path:"/1/indexes/{indexName}/facets/{facetName}/query".replace("{indexName}",encodeURIComponent(e)).replace("{facetName}",encodeURIComponent(r)),queryParameters:{},headers:{},data:t||{},useReadTransporter:!0,cacheable:!0};return o.request(n,a)},searchRules({indexName:e,searchRulesParams:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `searchRules`.");const a={method:"POST",path:"/1/indexes/{indexName}/rules/search".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{},useReadTransporter:!0,cacheable:!0};return o.request(a,t)},searchSingleIndex({indexName:e,searchParams:r},t){if(!e)throw new Error("Parameter `indexName` is required when calling `searchSingleIndex`.");const a={method:"POST",path:"/1/indexes/{indexName}/query".replace("{indexName}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r||{},useReadTransporter:!0,cacheable:!0};return o.request(a,t)},searchSynonyms({indexName:e,type:r,page:t,hitsPerPage:a,searchSynonymsParams:n},s){if(!e)throw new Error("Parameter `indexName` is required when calling `searchSynonyms`.");const i="/1/indexes/{indexName}/synonyms/search".replace("{indexName}",encodeURIComponent(e)),c={};void 0!==r&&(c.type=r.toString()),void 0!==t&&(c.page=t.toString()),void 0!==a&&(c.hitsPerPage=a.toString());const d={method:"POST",path:i,queryParameters:c,headers:{},data:n||{},useReadTransporter:!0,cacheable:!0};return o.request(d,s)},searchUserIds(e,r){if(!e)throw new Error("Parameter `searchUserIdsParams` is required when calling `searchUserIds`.");if(!e.query)throw new Error("Parameter `searchUserIdsParams.query` is required when calling `searchUserIds`.");const t={method:"POST",path:"/1/clusters/mapping/search",queryParameters:{},headers:{},data:e,useReadTransporter:!0,cacheable:!0};return o.request(t,r)},setDictionarySettings(e,r){if(!e)throw new Error("Parameter `dictionarySettingsParams` is required when calling `setDictionarySettings`.");if(!e.disableStandardEntries)throw new Error("Parameter `dictionarySettingsParams.disableStandardEntries` is required when calling `setDictionarySettings`.");const t={method:"PUT",path:"/1/dictionaries/*/settings",queryParameters:{},headers:{},data:e};return o.request(t,r)},setSettings({indexName:e,indexSettings:r,forwardToReplicas:t},a){if(!e)throw new Error("Parameter `indexName` is required when calling `setSettings`.");if(!r)throw new Error("Parameter `indexSettings` is required when calling `setSettings`.");const n="/1/indexes/{indexName}/settings".replace("{indexName}",encodeURIComponent(e)),s={};void 0!==t&&(s.forwardToReplicas=t.toString());const i={method:"PUT",path:n,queryParameters:s,headers:{},data:r};return o.request(i,a)},updateApiKey({key:e,apiKey:r},t){if(!e)throw new Error("Parameter `key` is required when calling `updateApiKey`.");if(!r)throw new Error("Parameter `apiKey` is required when calling `updateApiKey`.");if(!r.acl)throw new Error("Parameter `apiKey.acl` is required when calling `updateApiKey`.");const a={method:"PUT",path:"/1/keys/{key}".replace("{key}",encodeURIComponent(e)),queryParameters:{},headers:{},data:r};return o.request(a,t)}}}({appId:e,apiKey:s,timeouts:{connect:1e3,read:2e3,write:3e4},requester:{send:function(e){return new Promise((r=>{const t=new XMLHttpRequest;t.open(e.method,e.url,!0),Object.keys(e.headers).forEach((r=>t.setRequestHeader(r,e.headers[r])));const a=(e,a)=>setTimeout((()=>{t.abort(),r({status:0,content:a,isTimedOut:!0})}),e),n=a(e.connectTimeout,"Connection timeout");let s;t.onreadystatechange=()=>{t.readyState>t.OPENED&&void 0===s&&(clearTimeout(n),s=a(e.responseTimeout,"Socket timeout"))},t.onerror=()=>{0===t.status&&(clearTimeout(n),clearTimeout(s),r({content:t.responseText||"Network request failed",status:t.status,isTimedOut:!1}))},t.onload=()=>{clearTimeout(n),clearTimeout(s),r({content:t.responseText,status:t.status,isTimedOut:!1})},t.send(e.data)}))}},algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:n(),requestsCache:n({serializable:!1}),hostsCache:a({caches:[t({key:`5.0.0-alpha.10-${e}`}),n()]}),...i})}}));
|
package/dist/model/acl.d.ts
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* List of rights for the API key. The following rights can be used: addObject: allows to add/update an object in the index (copy/move index are also allowed with this right). Analytics: allows to retrieve the analytics through the Analytics API. Browse: allows to retrieve all index content via the browse API. DeleteIndex: allows to delete or clear index content. DeleteObject: allows to delete objects from the index. EditSettings: allows to change index settings. ListIndexes: allows to list all accessible indices. Logs: allows to get the logs. Recommendation: Allows usage of the Personalization dashboard and the Recommendation API. Search: allows to search the index. SeeUnretrievableAttributes: disable unretrievableAttributes feature for all operations returning records. Settings: allows to get index settings.
|
|
3
|
+
*/
|
|
1
4
|
export declare type Acl = 'addObject' | 'analytics' | 'browse' | 'deleteIndex' | 'deleteObject' | 'editSettings' | 'listIndexes' | 'logs' | 'personalization' | 'recommendation' | 'search' | 'seeUnretrievableAttributes' | 'settings' | 'usage';
|
|
2
5
|
//# sourceMappingURL=acl.d.ts.map
|
package/dist/model/acl.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acl.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"acl.d.ts","sourceRoot":"","sources":["../../model/acl.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,oBAAY,GAAG,GACX,WAAW,GACX,WAAW,GACX,QAAQ,GACR,aAAa,GACb,cAAc,GACd,cAAc,GACd,aAAa,GACb,MAAM,GACN,iBAAiB,GACjB,gBAAgB,GAChB,QAAQ,GACR,4BAA4B,GAC5B,UAAU,GACV,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../model/action.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,oBAAY,MAAM,GACd,WAAW,GACX,OAAO,GACP,QAAQ,GACR,cAAc,GACd,qBAAqB,GACrB,6BAA6B,GAC7B,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addApiKeyResponse.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"addApiKeyResponse.d.ts","sourceRoot":"","sources":["../../model/addApiKeyResponse.ts"],"names":[],"mappings":"AAEA,oBAAY,iBAAiB,GAAG;IAC9B;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"advancedSyntaxFeatures.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"advancedSyntaxFeatures.d.ts","sourceRoot":"","sources":["../../model/advancedSyntaxFeatures.ts"],"names":[],"mappings":"AAEA,oBAAY,sBAAsB,GAAG,aAAa,GAAG,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alternativesAsExact.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"alternativesAsExact.d.ts","sourceRoot":"","sources":["../../model/alternativesAsExact.ts"],"names":[],"mappings":"AAEA,oBAAY,mBAAmB,GAC3B,eAAe,GACf,mBAAmB,GACnB,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anchoring.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"anchoring.d.ts","sourceRoot":"","sources":["../../model/anchoring.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,oBAAY,SAAS,GAAG,UAAU,GAAG,UAAU,GAAG,IAAI,GAAG,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiKey.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"apiKey.d.ts","sourceRoot":"","sources":["../../model/apiKey.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEjC;;GAEG;AACH,oBAAY,MAAM,GAAG;IACnB;;OAEG;IACH,GAAG,EAAE,GAAG,EAAE,CAAC;IAEX;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAEnB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAEhC;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IAEpB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC"}
|