Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
): SearchClient {
const logger = createConsoleLogger(options.logLevel || LogLevelEnum.Error);
const clientOptions = {
appId,
apiKey,
timeouts: {
connect: 1,
read: 2,
write: 30,
},
requester: createBrowserXhrRequester(),
logger,
responsesCache: createInMemoryCache(),
requestsCache: createInMemoryCache({ serializable: false }),
hostsCache: createFallbackableCache({
caches: [createBrowserLocalStorageCache({ version }), createInMemoryCache()],
}),
userAgent: createUserAgent(version).add({ segment: 'Browser' }),
};
return createSearchClient({
...clientOptions,
methods: {
search: multipleQueries,
searchForFacetValues: multipleSearchForFacetValues,
multipleBatch,
multipleGetObjects,
multipleQueries,
copyIndex,
copySettings,
copySynonyms,
): SearchClient {
const logger = createConsoleLogger(options.logLevel || LogLevelEnum.Error);
return createSearchClient({
appId,
apiKey,
timeouts: {
connect: 1,
read: 2,
write: 30,
},
requester: createBrowserXhrRequester(),
logger,
responsesCache: createInMemoryCache(),
requestsCache: createInMemoryCache({ serializable: false }),
hostsCache: createFallbackableCache({
caches: [
createBrowserLocalStorageCache({ key: `${version}-${appId}` }),
createInMemoryCache(),
],
}),
userAgent: createUserAgent(version).add({
segment: 'Browser',
version: 'lite',
}),
authMode: AuthMode.WithinQueryParameters,
methods: {
search: multipleQueries,
searchForFacetValues: multipleSearchForFacetValues,
multipleQueries,
multipleSearchForFacetValues,
initIndex: base => (indexName: string): SearchIndex => {