initial vitepress site with basic nav
This commit is contained in:
parent
a7df2e049d
commit
2029f16583
1900 changed files with 1014692 additions and 0 deletions
82
node_modules/algoliasearch/README.md
generated
vendored
Normal file
82
node_modules/algoliasearch/README.md
generated
vendored
Normal file
|
@ -0,0 +1,82 @@
|
|||
<p align="center">
|
||||
<a href="https://www.algolia.com">
|
||||
<img alt="Algolia for JavaScript" src="https://raw.githubusercontent.com/algolia/algoliasearch-client-common/master/banners/javascript.png" >
|
||||
</a>
|
||||
|
||||
<h4 align="center">The perfect starting point to integrate <a href="https://algolia.com" target="_blank">Algolia</a> within your JavaScript project</h4>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://npmjs.org/package/algoliasearch"><img src="https://img.shields.io/npm/v/algoliasearch.svg?style=flat-square" alt="NPM version"></img></a>
|
||||
<a href="http://npm-stat.com/charts.html?package=algoliasearch"><img src="https://img.shields.io/npm/dm/algoliasearch.svg?style=flat-square" alt="NPM downloads"></a>
|
||||
<a href="https://www.jsdelivr.com/package/npm/algoliasearch"><img src="https://data.jsdelivr.com/v1/package/npm/algoliasearch/badge" alt="jsDelivr Downloads"></img></a>
|
||||
<a href="LICENSE.md"><img src="https://img.shields.io/badge/license-MIT-green.svg?style=flat-square" alt="License"></a>
|
||||
</p>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://www.algolia.com/doc/api-client/getting-started/install/javascript/" target="_blank">Documentation</a> •
|
||||
<a href="https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/js/" target="_blank">InstantSearch</a> •
|
||||
<a href="https://discourse.algolia.com" target="_blank">Community Forum</a> •
|
||||
<a href="http://stackoverflow.com/questions/tagged/algolia" target="_blank">Stack Overflow</a> •
|
||||
<a href="https://github.com/algolia/algoliasearch-client-javascript/issues" target="_blank">Report a bug</a> •
|
||||
<a href="https://www.algolia.com/support" target="_blank">Support</a>
|
||||
</p>
|
||||
|
||||
## ✨ Features
|
||||
|
||||
- Thin & **minimal low-level HTTP client** to interact with Algolia's API
|
||||
- Works both on the **browser** and **node.js**
|
||||
- **UMD compatible**, you can use it with any module loader
|
||||
- Built with TypeScript
|
||||
|
||||
## 💡 Getting Started
|
||||
|
||||
First, install Algolia JavaScript API Client via the [npm](https://www.npmjs.com/get-npm) package manager:
|
||||
|
||||
```bash
|
||||
npm install algoliasearch
|
||||
```
|
||||
|
||||
Then, create objects on your index:
|
||||
|
||||
```js
|
||||
const algoliasearch = require("algoliasearch");
|
||||
|
||||
const client = algoliasearch("YourApplicationID", "YourAdminAPIKey");
|
||||
const index = client.initIndex("your_index_name");
|
||||
|
||||
const objects = [
|
||||
{
|
||||
objectID: 1,
|
||||
name: "Foo"
|
||||
}
|
||||
];
|
||||
|
||||
index
|
||||
.saveObjects(objects)
|
||||
.then(({ objectIDs }) => {
|
||||
console.log(objectIDs);
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
});
|
||||
```
|
||||
|
||||
Finally, let's actually search using the `search` method:
|
||||
|
||||
```js
|
||||
index
|
||||
.search("Fo")
|
||||
.then(({ hits }) => {
|
||||
console.log(hits);
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
});
|
||||
```
|
||||
|
||||
For full documentation, visit the **[online documentation](https://www.algolia.com/doc/api-client/getting-started/install/javascript/)**.
|
||||
|
||||
## 📄 License
|
||||
|
||||
Algolia JavaScript API Client is an open-sourced software licensed under the [MIT license](LICENSE.md).
|
49
node_modules/algoliasearch/dist/algoliasearch-lite.d.ts
generated
vendored
Normal file
49
node_modules/algoliasearch/dist/algoliasearch-lite.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,49 @@
|
|||
import { ClientTransporterOptions } from '@algolia/client-common';
|
||||
import { FindAnswersOptions } from '@algolia/client-search';
|
||||
import { FindAnswersResponse } from '@algolia/client-search';
|
||||
import { MultipleQueriesOptions } from '@algolia/client-search';
|
||||
import { MultipleQueriesQuery } from '@algolia/client-search';
|
||||
import { MultipleQueriesResponse } from '@algolia/client-search';
|
||||
import { Request } from '@algolia/transporter';
|
||||
import { RequestOptions } from '@algolia/transporter';
|
||||
import { SearchClient as SearchClient_2 } from '@algolia/client-search';
|
||||
import { SearchClientOptions } from '@algolia/client-search';
|
||||
import { SearchForFacetValuesQueryParams } from '@algolia/client-search';
|
||||
import { SearchForFacetValuesResponse } from '@algolia/client-search';
|
||||
import { SearchIndex as SearchIndex_2 } from '@algolia/client-search';
|
||||
import { SearchOptions } from '@algolia/client-search';
|
||||
import { SearchResponse } from '@algolia/client-search';
|
||||
|
||||
declare function algoliasearch(appId: string, apiKey: string, options?: AlgoliaSearchOptions): SearchClient;
|
||||
|
||||
declare namespace algoliasearch {
|
||||
var version: string;
|
||||
}
|
||||
export default algoliasearch;
|
||||
|
||||
export declare type AlgoliaSearchOptions = Partial<ClientTransporterOptions> & WithoutCredentials<SearchClientOptions>;
|
||||
|
||||
declare type Credentials = {
|
||||
readonly appId: string;
|
||||
readonly apiKey: string;
|
||||
};
|
||||
|
||||
export declare type SearchClient = SearchClient_2 & {
|
||||
readonly initIndex: (indexName: string) => SearchIndex;
|
||||
readonly search: <TObject>(queries: readonly MultipleQueriesQuery[], requestOptions?: RequestOptions & MultipleQueriesOptions) => Readonly<Promise<MultipleQueriesResponse<TObject>>>;
|
||||
readonly searchForFacetValues: (queries: ReadonlyArray<{
|
||||
readonly indexName: string;
|
||||
readonly params: SearchForFacetValuesQueryParams & SearchOptions;
|
||||
}>, requestOptions?: RequestOptions) => Readonly<Promise<readonly SearchForFacetValuesResponse[]>>;
|
||||
readonly customRequest: <TResponse>(request: Request, requestOptions?: RequestOptions) => Readonly<Promise<TResponse>>;
|
||||
};
|
||||
|
||||
export declare type SearchIndex = SearchIndex_2 & {
|
||||
readonly search: <TObject>(query: string, requestOptions?: RequestOptions & SearchOptions) => Readonly<Promise<SearchResponse<TObject>>>;
|
||||
readonly searchForFacetValues: (facetName: string, facetQuery: string, requestOptions?: RequestOptions & SearchOptions) => Readonly<Promise<SearchForFacetValuesResponse>>;
|
||||
readonly findAnswers: <TObject>(query: string, queryLanguages: readonly string[], requestOptions?: RequestOptions & FindAnswersOptions) => Readonly<Promise<FindAnswersResponse<TObject>>>;
|
||||
};
|
||||
|
||||
export declare type WithoutCredentials<TClientOptions extends Credentials> = Omit<TClientOptions, keyof Credentials>;
|
||||
|
||||
export { }
|
915
node_modules/algoliasearch/dist/algoliasearch-lite.esm.browser.js
generated
vendored
Normal file
915
node_modules/algoliasearch/dist/algoliasearch-lite.esm.browser.js
generated
vendored
Normal file
|
@ -0,0 +1,915 @@
|
|||
function createBrowserLocalStorageCache(options) {
|
||||
const namespaceKey = `algoliasearch-client-js-${options.key}`;
|
||||
// eslint-disable-next-line functional/no-let
|
||||
let storage;
|
||||
const getStorage = () => {
|
||||
if (storage === undefined) {
|
||||
storage = options.localStorage || window.localStorage;
|
||||
}
|
||||
return storage;
|
||||
};
|
||||
const getNamespace = () => {
|
||||
return JSON.parse(getStorage().getItem(namespaceKey) || '{}');
|
||||
};
|
||||
return {
|
||||
get(key, defaultValue, events = {
|
||||
miss: () => Promise.resolve(),
|
||||
}) {
|
||||
return Promise.resolve()
|
||||
.then(() => {
|
||||
const keyAsString = JSON.stringify(key);
|
||||
const value = getNamespace()[keyAsString];
|
||||
return Promise.all([value || defaultValue(), value !== undefined]);
|
||||
})
|
||||
.then(([value, exists]) => {
|
||||
return Promise.all([value, exists || events.miss(value)]);
|
||||
})
|
||||
.then(([value]) => value);
|
||||
},
|
||||
set(key, value) {
|
||||
return Promise.resolve().then(() => {
|
||||
const namespace = getNamespace();
|
||||
// eslint-disable-next-line functional/immutable-data
|
||||
namespace[JSON.stringify(key)] = value;
|
||||
getStorage().setItem(namespaceKey, JSON.stringify(namespace));
|
||||
return value;
|
||||
});
|
||||
},
|
||||
delete(key) {
|
||||
return Promise.resolve().then(() => {
|
||||
const namespace = getNamespace();
|
||||
// eslint-disable-next-line functional/immutable-data
|
||||
delete namespace[JSON.stringify(key)];
|
||||
getStorage().setItem(namespaceKey, JSON.stringify(namespace));
|
||||
});
|
||||
},
|
||||
clear() {
|
||||
return Promise.resolve().then(() => {
|
||||
getStorage().removeItem(namespaceKey);
|
||||
});
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
// @todo Add logger on options to debug when caches go wrong.
|
||||
function createFallbackableCache(options) {
|
||||
const caches = [...options.caches];
|
||||
const current = caches.shift(); // eslint-disable-line functional/immutable-data
|
||||
if (current === undefined) {
|
||||
return createNullCache();
|
||||
}
|
||||
return {
|
||||
get(key, defaultValue, events = {
|
||||
miss: () => Promise.resolve(),
|
||||
}) {
|
||||
return current.get(key, defaultValue, events).catch(() => {
|
||||
return createFallbackableCache({ caches }).get(key, defaultValue, events);
|
||||
});
|
||||
},
|
||||
set(key, value) {
|
||||
return current.set(key, value).catch(() => {
|
||||
return createFallbackableCache({ caches }).set(key, value);
|
||||
});
|
||||
},
|
||||
delete(key) {
|
||||
return current.delete(key).catch(() => {
|
||||
return createFallbackableCache({ caches }).delete(key);
|
||||
});
|
||||
},
|
||||
clear() {
|
||||
return current.clear().catch(() => {
|
||||
return createFallbackableCache({ caches }).clear();
|
||||
});
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function createNullCache() {
|
||||
return {
|
||||
get(_key, defaultValue, events = {
|
||||
miss: () => Promise.resolve(),
|
||||
}) {
|
||||
const value = defaultValue();
|
||||
return value
|
||||
.then(result => Promise.all([result, events.miss(result)]))
|
||||
.then(([result]) => result);
|
||||
},
|
||||
set(_key, value) {
|
||||
return Promise.resolve(value);
|
||||
},
|
||||
delete(_key) {
|
||||
return Promise.resolve();
|
||||
},
|
||||
clear() {
|
||||
return Promise.resolve();
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function createInMemoryCache(options = { serializable: true }) {
|
||||
// eslint-disable-next-line functional/no-let
|
||||
let cache = {};
|
||||
return {
|
||||
get(key, defaultValue, events = {
|
||||
miss: () => Promise.resolve(),
|
||||
}) {
|
||||
const keyAsString = JSON.stringify(key);
|
||||
if (keyAsString in cache) {
|
||||
return Promise.resolve(options.serializable ? JSON.parse(cache[keyAsString]) : cache[keyAsString]);
|
||||
}
|
||||
const promise = defaultValue();
|
||||
const miss = (events && events.miss) || (() => Promise.resolve());
|
||||
return promise.then((value) => miss(value)).then(() => promise);
|
||||
},
|
||||
set(key, value) {
|
||||
// eslint-disable-next-line functional/immutable-data
|
||||
cache[JSON.stringify(key)] = options.serializable ? JSON.stringify(value) : value;
|
||||
return Promise.resolve(value);
|
||||
},
|
||||
delete(key) {
|
||||
// eslint-disable-next-line functional/immutable-data
|
||||
delete cache[JSON.stringify(key)];
|
||||
return Promise.resolve();
|
||||
},
|
||||
clear() {
|
||||
cache = {};
|
||||
return Promise.resolve();
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function createAuth(authMode, appId, apiKey) {
|
||||
const credentials = {
|
||||
'x-algolia-api-key': apiKey,
|
||||
'x-algolia-application-id': appId,
|
||||
};
|
||||
return {
|
||||
headers() {
|
||||
return authMode === AuthMode.WithinHeaders ? credentials : {};
|
||||
},
|
||||
queryParameters() {
|
||||
return authMode === AuthMode.WithinQueryParameters ? credentials : {};
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
// eslint-disable-next-line functional/prefer-readonly-type
|
||||
function shuffle(array) {
|
||||
let c = array.length - 1; // eslint-disable-line functional/no-let
|
||||
// eslint-disable-next-line functional/no-loop-statement
|
||||
for (c; c > 0; c--) {
|
||||
const b = Math.floor(Math.random() * (c + 1));
|
||||
const a = array[c];
|
||||
array[c] = array[b]; // eslint-disable-line functional/immutable-data, no-param-reassign
|
||||
array[b] = a; // eslint-disable-line functional/immutable-data, no-param-reassign
|
||||
}
|
||||
return array;
|
||||
}
|
||||
function addMethods(base, methods) {
|
||||
if (!methods) {
|
||||
return base;
|
||||
}
|
||||
Object.keys(methods).forEach(key => {
|
||||
// eslint-disable-next-line functional/immutable-data, no-param-reassign
|
||||
base[key] = methods[key](base);
|
||||
});
|
||||
return base;
|
||||
}
|
||||
function encode(format, ...args) {
|
||||
// eslint-disable-next-line functional/no-let
|
||||
let i = 0;
|
||||
return format.replace(/%s/g, () => encodeURIComponent(args[i++]));
|
||||
}
|
||||
|
||||
const version = '4.17.0';
|
||||
|
||||
const AuthMode = {
|
||||
/**
|
||||
* If auth credentials should be in query parameters.
|
||||
*/
|
||||
WithinQueryParameters: 0,
|
||||
/**
|
||||
* If auth credentials should be in headers.
|
||||
*/
|
||||
WithinHeaders: 1,
|
||||
};
|
||||
|
||||
function createMappedRequestOptions(requestOptions, timeout) {
|
||||
const options = requestOptions || {};
|
||||
const data = options.data || {};
|
||||
Object.keys(options).forEach(key => {
|
||||
if (['timeout', 'headers', 'queryParameters', 'data', 'cacheable'].indexOf(key) === -1) {
|
||||
data[key] = options[key]; // eslint-disable-line functional/immutable-data
|
||||
}
|
||||
});
|
||||
return {
|
||||
data: Object.entries(data).length > 0 ? data : undefined,
|
||||
timeout: options.timeout || timeout,
|
||||
headers: options.headers || {},
|
||||
queryParameters: options.queryParameters || {},
|
||||
cacheable: options.cacheable,
|
||||
};
|
||||
}
|
||||
|
||||
const CallEnum = {
|
||||
/**
|
||||
* If the host is read only.
|
||||
*/
|
||||
Read: 1,
|
||||
/**
|
||||
* If the host is write only.
|
||||
*/
|
||||
Write: 2,
|
||||
/**
|
||||
* If the host is both read and write.
|
||||
*/
|
||||
Any: 3,
|
||||
};
|
||||
|
||||
const HostStatusEnum = {
|
||||
Up: 1,
|
||||
Down: 2,
|
||||
Timeouted: 3,
|
||||
};
|
||||
|
||||
// By default, API Clients at Algolia have expiration delay
|
||||
// of 5 mins. In the JavaScript client, we have 2 mins.
|
||||
const EXPIRATION_DELAY = 2 * 60 * 1000;
|
||||
function createStatefulHost(host, status = HostStatusEnum.Up) {
|
||||
return {
|
||||
...host,
|
||||
status,
|
||||
lastUpdate: Date.now(),
|
||||
};
|
||||
}
|
||||
function isStatefulHostUp(host) {
|
||||
return host.status === HostStatusEnum.Up || Date.now() - host.lastUpdate > EXPIRATION_DELAY;
|
||||
}
|
||||
function isStatefulHostTimeouted(host) {
|
||||
return (host.status === HostStatusEnum.Timeouted && Date.now() - host.lastUpdate <= EXPIRATION_DELAY);
|
||||
}
|
||||
|
||||
function createStatelessHost(options) {
|
||||
if (typeof options === 'string') {
|
||||
return {
|
||||
protocol: 'https',
|
||||
url: options,
|
||||
accept: CallEnum.Any,
|
||||
};
|
||||
}
|
||||
return {
|
||||
protocol: options.protocol || 'https',
|
||||
url: options.url,
|
||||
accept: options.accept || CallEnum.Any,
|
||||
};
|
||||
}
|
||||
|
||||
const MethodEnum = {
|
||||
Delete: 'DELETE',
|
||||
Get: 'GET',
|
||||
Post: 'POST',
|
||||
Put: 'PUT',
|
||||
};
|
||||
|
||||
function createRetryableOptions(hostsCache, statelessHosts) {
|
||||
return Promise.all(statelessHosts.map(statelessHost => {
|
||||
return hostsCache.get(statelessHost, () => {
|
||||
return Promise.resolve(createStatefulHost(statelessHost));
|
||||
});
|
||||
})).then(statefulHosts => {
|
||||
const hostsUp = statefulHosts.filter(host => isStatefulHostUp(host));
|
||||
const hostsTimeouted = statefulHosts.filter(host => isStatefulHostTimeouted(host));
|
||||
/**
|
||||
* Note, we put the hosts that previously timeouted on the end of the list.
|
||||
*/
|
||||
const hostsAvailable = [...hostsUp, ...hostsTimeouted];
|
||||
const statelessHostsAvailable = hostsAvailable.length > 0
|
||||
? hostsAvailable.map(host => createStatelessHost(host))
|
||||
: statelessHosts;
|
||||
return {
|
||||
getTimeout(timeoutsCount, baseTimeout) {
|
||||
/**
|
||||
* Imagine that you have 4 hosts, if timeouts will increase
|
||||
* on the following way: 1 (timeouted) > 4 (timeouted) > 5 (200)
|
||||
*
|
||||
* Note that, the very next request, we start from the previous timeout
|
||||
*
|
||||
* 5 (timeouted) > 6 (timeouted) > 7 ...
|
||||
*
|
||||
* This strategy may need to be reviewed, but is the strategy on the our
|
||||
* current v3 version.
|
||||
*/
|
||||
const timeoutMultiplier = hostsTimeouted.length === 0 && timeoutsCount === 0
|
||||
? 1
|
||||
: hostsTimeouted.length + 3 + timeoutsCount;
|
||||
return timeoutMultiplier * baseTimeout;
|
||||
},
|
||||
statelessHosts: statelessHostsAvailable,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
const isNetworkError = ({ isTimedOut, status }) => {
|
||||
return !isTimedOut && ~~status === 0;
|
||||
};
|
||||
const isRetryable = (response) => {
|
||||
const status = response.status;
|
||||
const isTimedOut = response.isTimedOut;
|
||||
return (isTimedOut || isNetworkError(response) || (~~(status / 100) !== 2 && ~~(status / 100) !== 4));
|
||||
};
|
||||
const isSuccess = ({ status }) => {
|
||||
return ~~(status / 100) === 2;
|
||||
};
|
||||
const retryDecision = (response, outcomes) => {
|
||||
if (isRetryable(response)) {
|
||||
return outcomes.onRetry(response);
|
||||
}
|
||||
if (isSuccess(response)) {
|
||||
return outcomes.onSuccess(response);
|
||||
}
|
||||
return outcomes.onFail(response);
|
||||
};
|
||||
|
||||
function retryableRequest(transporter, statelessHosts, request, requestOptions) {
|
||||
const stackTrace = []; // eslint-disable-line functional/prefer-readonly-type
|
||||
/**
|
||||
* First we prepare the payload that do not depend from hosts.
|
||||
*/
|
||||
const data = serializeData(request, requestOptions);
|
||||
const headers = serializeHeaders(transporter, requestOptions);
|
||||
const method = request.method;
|
||||
// On `GET`, the data is proxied to query parameters.
|
||||
const dataQueryParameters = request.method !== MethodEnum.Get
|
||||
? {}
|
||||
: {
|
||||
...request.data,
|
||||
...requestOptions.data,
|
||||
};
|
||||
const queryParameters = {
|
||||
'x-algolia-agent': transporter.userAgent.value,
|
||||
...transporter.queryParameters,
|
||||
...dataQueryParameters,
|
||||
...requestOptions.queryParameters,
|
||||
};
|
||||
let timeoutsCount = 0; // eslint-disable-line functional/no-let
|
||||
const retry = (hosts, // eslint-disable-line functional/prefer-readonly-type
|
||||
getTimeout) => {
|
||||
/**
|
||||
* We iterate on each host, until there is no host left.
|
||||
*/
|
||||
const host = hosts.pop(); // eslint-disable-line functional/immutable-data
|
||||
if (host === undefined) {
|
||||
throw createRetryError(stackTraceWithoutCredentials(stackTrace));
|
||||
}
|
||||
const payload = {
|
||||
data,
|
||||
headers,
|
||||
method,
|
||||
url: serializeUrl(host, request.path, queryParameters),
|
||||
connectTimeout: getTimeout(timeoutsCount, transporter.timeouts.connect),
|
||||
responseTimeout: getTimeout(timeoutsCount, requestOptions.timeout),
|
||||
};
|
||||
/**
|
||||
* The stackFrame is pushed to the stackTrace so we
|
||||
* can have information about onRetry and onFailure
|
||||
* decisions.
|
||||
*/
|
||||
const pushToStackTrace = (response) => {
|
||||
const stackFrame = {
|
||||
request: payload,
|
||||
response,
|
||||
host,
|
||||
triesLeft: hosts.length,
|
||||
};
|
||||
// eslint-disable-next-line functional/immutable-data
|
||||
stackTrace.push(stackFrame);
|
||||
return stackFrame;
|
||||
};
|
||||
const decisions = {
|
||||
onSuccess: response => deserializeSuccess(response),
|
||||
onRetry(response) {
|
||||
const stackFrame = pushToStackTrace(response);
|
||||
/**
|
||||
* If response is a timeout, we increaset the number of
|
||||
* timeouts so we can increase the timeout later.
|
||||
*/
|
||||
if (response.isTimedOut) {
|
||||
timeoutsCount++;
|
||||
}
|
||||
return Promise.all([
|
||||
/**
|
||||
* Failures are individually send the logger, allowing
|
||||
* the end user to debug / store stack frames even
|
||||
* when a retry error does not happen.
|
||||
*/
|
||||
transporter.logger.info('Retryable failure', stackFrameWithoutCredentials(stackFrame)),
|
||||
/**
|
||||
* We also store the state of the host in failure cases. If the host, is
|
||||
* down it will remain down for the next 2 minutes. In a timeout situation,
|
||||
* this host will be added end of the list of hosts on the next request.
|
||||
*/
|
||||
transporter.hostsCache.set(host, createStatefulHost(host, response.isTimedOut ? HostStatusEnum.Timeouted : HostStatusEnum.Down)),
|
||||
]).then(() => retry(hosts, getTimeout));
|
||||
},
|
||||
onFail(response) {
|
||||
pushToStackTrace(response);
|
||||
throw deserializeFailure(response, stackTraceWithoutCredentials(stackTrace));
|
||||
},
|
||||
};
|
||||
return transporter.requester.send(payload).then(response => {
|
||||
return retryDecision(response, decisions);
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Finally, for each retryable host perform request until we got a non
|
||||
* retryable response. Some notes here:
|
||||
*
|
||||
* 1. The reverse here is applied so we can apply a `pop` later on => more performant.
|
||||
* 2. We also get from the retryable options a timeout multiplier that is tailored
|
||||
* for the current context.
|
||||
*/
|
||||
return createRetryableOptions(transporter.hostsCache, statelessHosts).then(options => {
|
||||
return retry([...options.statelessHosts].reverse(), options.getTimeout);
|
||||
});
|
||||
}
|
||||
|
||||
function createTransporter(options) {
|
||||
const { hostsCache, logger, requester, requestsCache, responsesCache, timeouts, userAgent, hosts, queryParameters, headers, } = options;
|
||||
const transporter = {
|
||||
hostsCache,
|
||||
logger,
|
||||
requester,
|
||||
requestsCache,
|
||||
responsesCache,
|
||||
timeouts,
|
||||
userAgent,
|
||||
headers,
|
||||
queryParameters,
|
||||
hosts: hosts.map(host => createStatelessHost(host)),
|
||||
read(request, requestOptions) {
|
||||
/**
|
||||
* First, we compute the user request options. Now, keep in mind,
|
||||
* that using request options the user is able to modified the intire
|
||||
* payload of the request. Such as headers, query parameters, and others.
|
||||
*/
|
||||
const mappedRequestOptions = createMappedRequestOptions(requestOptions, transporter.timeouts.read);
|
||||
const createRetryableRequest = () => {
|
||||
/**
|
||||
* Then, we prepare a function factory that contains the construction of
|
||||
* the retryable request. At this point, we may *not* perform the actual
|
||||
* request. But we want to have the function factory ready.
|
||||
*/
|
||||
return retryableRequest(transporter, transporter.hosts.filter(host => (host.accept & CallEnum.Read) !== 0), request, mappedRequestOptions);
|
||||
};
|
||||
/**
|
||||
* Once we have the function factory ready, we need to determine of the
|
||||
* request is "cacheable" - should be cached. Note that, once again,
|
||||
* the user can force this option.
|
||||
*/
|
||||
const cacheable = mappedRequestOptions.cacheable !== undefined
|
||||
? mappedRequestOptions.cacheable
|
||||
: request.cacheable;
|
||||
/**
|
||||
* If is not "cacheable", we immediatly trigger the retryable request, no
|
||||
* need to check cache implementations.
|
||||
*/
|
||||
if (cacheable !== true) {
|
||||
return createRetryableRequest();
|
||||
}
|
||||
/**
|
||||
* If the request is "cacheable", we need to first compute the key to ask
|
||||
* the cache implementations if this request is on progress or if the
|
||||
* response already exists on the cache.
|
||||
*/
|
||||
const key = {
|
||||
request,
|
||||
mappedRequestOptions,
|
||||
transporter: {
|
||||
queryParameters: transporter.queryParameters,
|
||||
headers: transporter.headers,
|
||||
},
|
||||
};
|
||||
/**
|
||||
* With the computed key, we first ask the responses cache
|
||||
* implemention if this request was been resolved before.
|
||||
*/
|
||||
return transporter.responsesCache.get(key, () => {
|
||||
/**
|
||||
* If the request has never resolved before, we actually ask if there
|
||||
* is a current request with the same key on progress.
|
||||
*/
|
||||
return transporter.requestsCache.get(key, () => {
|
||||
return (transporter.requestsCache
|
||||
/**
|
||||
* Finally, if there is no request in progress with the same key,
|
||||
* this `createRetryableRequest()` will actually trigger the
|
||||
* retryable request.
|
||||
*/
|
||||
.set(key, createRetryableRequest())
|
||||
.then(response => Promise.all([transporter.requestsCache.delete(key), response]), err => Promise.all([transporter.requestsCache.delete(key), Promise.reject(err)]))
|
||||
.then(([_, response]) => response));
|
||||
});
|
||||
}, {
|
||||
/**
|
||||
* Of course, once we get this response back from the server, we
|
||||
* tell response cache to actually store the received response
|
||||
* to be used later.
|
||||
*/
|
||||
miss: response => transporter.responsesCache.set(key, response),
|
||||
});
|
||||
},
|
||||
write(request, requestOptions) {
|
||||
/**
|
||||
* On write requests, no cache mechanisms are applied, and we
|
||||
* proxy the request immediately to the requester.
|
||||
*/
|
||||
return retryableRequest(transporter, transporter.hosts.filter(host => (host.accept & CallEnum.Write) !== 0), request, createMappedRequestOptions(requestOptions, transporter.timeouts.write));
|
||||
},
|
||||
};
|
||||
return transporter;
|
||||
}
|
||||
|
||||
function createUserAgent(version) {
|
||||
const userAgent = {
|
||||
value: `Algolia for JavaScript (${version})`,
|
||||
add(options) {
|
||||
const addedUserAgent = `; ${options.segment}${options.version !== undefined ? ` (${options.version})` : ''}`;
|
||||
if (userAgent.value.indexOf(addedUserAgent) === -1) {
|
||||
// eslint-disable-next-line functional/immutable-data
|
||||
userAgent.value = `${userAgent.value}${addedUserAgent}`;
|
||||
}
|
||||
return userAgent;
|
||||
},
|
||||
};
|
||||
return userAgent;
|
||||
}
|
||||
|
||||
function deserializeSuccess(response) {
|
||||
// eslint-disable-next-line functional/no-try-statement
|
||||
try {
|
||||
return JSON.parse(response.content);
|
||||
}
|
||||
catch (e) {
|
||||
throw createDeserializationError(e.message, response);
|
||||
}
|
||||
}
|
||||
function deserializeFailure({ content, status }, stackFrame) {
|
||||
// eslint-disable-next-line functional/no-let
|
||||
let message = content;
|
||||
// eslint-disable-next-line functional/no-try-statement
|
||||
try {
|
||||
message = JSON.parse(content).message;
|
||||
}
|
||||
catch (e) {
|
||||
// ..
|
||||
}
|
||||
return createApiError(message, status, stackFrame);
|
||||
}
|
||||
|
||||
function serializeUrl(host, path, queryParameters) {
|
||||
const queryParametersAsString = serializeQueryParameters(queryParameters);
|
||||
// eslint-disable-next-line functional/no-let
|
||||
let url = `${host.protocol}://${host.url}/${path.charAt(0) === '/' ? path.substr(1) : path}`;
|
||||
if (queryParametersAsString.length) {
|
||||
url += `?${queryParametersAsString}`;
|
||||
}
|
||||
return url;
|
||||
}
|
||||
function serializeQueryParameters(parameters) {
|
||||
const isObjectOrArray = (value) => Object.prototype.toString.call(value) === '[object Object]' ||
|
||||
Object.prototype.toString.call(value) === '[object Array]';
|
||||
return Object.keys(parameters)
|
||||
.map(key => encode('%s=%s', key, isObjectOrArray(parameters[key]) ? JSON.stringify(parameters[key]) : parameters[key]))
|
||||
.join('&');
|
||||
}
|
||||
function serializeData(request, requestOptions) {
|
||||
if (request.method === MethodEnum.Get ||
|
||||
(request.data === undefined && requestOptions.data === undefined)) {
|
||||
return undefined;
|
||||
}
|
||||
const data = Array.isArray(request.data)
|
||||
? request.data
|
||||
: { ...request.data, ...requestOptions.data };
|
||||
return JSON.stringify(data);
|
||||
}
|
||||
function serializeHeaders(transporter, requestOptions) {
|
||||
const headers = {
|
||||
...transporter.headers,
|
||||
...requestOptions.headers,
|
||||
};
|
||||
const serializedHeaders = {};
|
||||
Object.keys(headers).forEach(header => {
|
||||
const value = headers[header];
|
||||
// @ts-ignore
|
||||
// eslint-disable-next-line functional/immutable-data
|
||||
serializedHeaders[header.toLowerCase()] = value;
|
||||
});
|
||||
return serializedHeaders;
|
||||
}
|
||||
|
||||
function stackTraceWithoutCredentials(stackTrace) {
|
||||
return stackTrace.map(stackFrame => stackFrameWithoutCredentials(stackFrame));
|
||||
}
|
||||
function stackFrameWithoutCredentials(stackFrame) {
|
||||
const modifiedHeaders = stackFrame.request.headers['x-algolia-api-key']
|
||||
? { 'x-algolia-api-key': '*****' }
|
||||
: {};
|
||||
return {
|
||||
...stackFrame,
|
||||
request: {
|
||||
...stackFrame.request,
|
||||
headers: {
|
||||
...stackFrame.request.headers,
|
||||
...modifiedHeaders,
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function createApiError(message, status, transporterStackTrace) {
|
||||
return {
|
||||
name: 'ApiError',
|
||||
message,
|
||||
status,
|
||||
transporterStackTrace,
|
||||
};
|
||||
}
|
||||
|
||||
function createDeserializationError(message, response) {
|
||||
return {
|
||||
name: 'DeserializationError',
|
||||
message,
|
||||
response,
|
||||
};
|
||||
}
|
||||
|
||||
function createRetryError(transporterStackTrace) {
|
||||
return {
|
||||
name: 'RetryError',
|
||||
message: 'Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.',
|
||||
transporterStackTrace,
|
||||
};
|
||||
}
|
||||
|
||||
const createSearchClient = options => {
|
||||
const appId = options.appId;
|
||||
const auth = createAuth(options.authMode !== undefined ? options.authMode : AuthMode.WithinHeaders, appId, options.apiKey);
|
||||
const transporter = createTransporter({
|
||||
hosts: [
|
||||
{ url: `${appId}-dsn.algolia.net`, accept: CallEnum.Read },
|
||||
{ url: `${appId}.algolia.net`, accept: CallEnum.Write },
|
||||
].concat(shuffle([
|
||||
{ url: `${appId}-1.algolianet.com` },
|
||||
{ url: `${appId}-2.algolianet.com` },
|
||||
{ url: `${appId}-3.algolianet.com` },
|
||||
])),
|
||||
...options,
|
||||
headers: {
|
||||
...auth.headers(),
|
||||
...{ 'content-type': 'application/x-www-form-urlencoded' },
|
||||
...options.headers,
|
||||
},
|
||||
queryParameters: {
|
||||
...auth.queryParameters(),
|
||||
...options.queryParameters,
|
||||
},
|
||||
});
|
||||
const base = {
|
||||
transporter,
|
||||
appId,
|
||||
addAlgoliaAgent(segment, version) {
|
||||
transporter.userAgent.add({ segment, version });
|
||||
},
|
||||
clearCache() {
|
||||
return Promise.all([
|
||||
transporter.requestsCache.clear(),
|
||||
transporter.responsesCache.clear(),
|
||||
]).then(() => undefined);
|
||||
},
|
||||
};
|
||||
return addMethods(base, options.methods);
|
||||
};
|
||||
|
||||
const customRequest = (base) => {
|
||||
return (request, requestOptions) => {
|
||||
if (request.method === MethodEnum.Get) {
|
||||
return base.transporter.read(request, requestOptions);
|
||||
}
|
||||
return base.transporter.write(request, requestOptions);
|
||||
};
|
||||
};
|
||||
|
||||
const initIndex = (base) => {
|
||||
return (indexName, options = {}) => {
|
||||
const searchIndex = {
|
||||
transporter: base.transporter,
|
||||
appId: base.appId,
|
||||
indexName,
|
||||
};
|
||||
return addMethods(searchIndex, options.methods);
|
||||
};
|
||||
};
|
||||
|
||||
const multipleQueries = (base) => {
|
||||
return (queries, requestOptions) => {
|
||||
const requests = queries.map(query => {
|
||||
return {
|
||||
...query,
|
||||
params: serializeQueryParameters(query.params || {}),
|
||||
};
|
||||
});
|
||||
return base.transporter.read({
|
||||
method: MethodEnum.Post,
|
||||
path: '1/indexes/*/queries',
|
||||
data: {
|
||||
requests,
|
||||
},
|
||||
cacheable: true,
|
||||
}, requestOptions);
|
||||
};
|
||||
};
|
||||
|
||||
const multipleSearchForFacetValues = (base) => {
|
||||
return (queries, requestOptions) => {
|
||||
return Promise.all(queries.map(query => {
|
||||
const { facetName, facetQuery, ...params } = query.params;
|
||||
return initIndex(base)(query.indexName, {
|
||||
methods: { searchForFacetValues },
|
||||
}).searchForFacetValues(facetName, facetQuery, {
|
||||
...requestOptions,
|
||||
...params,
|
||||
});
|
||||
}));
|
||||
};
|
||||
};
|
||||
|
||||
const findAnswers = (base) => {
|
||||
return (query, queryLanguages, requestOptions) => {
|
||||
return base.transporter.read({
|
||||
method: MethodEnum.Post,
|
||||
path: encode('1/answers/%s/prediction', base.indexName),
|
||||
data: {
|
||||
query,
|
||||
queryLanguages,
|
||||
},
|
||||
cacheable: true,
|
||||
}, requestOptions);
|
||||
};
|
||||
};
|
||||
|
||||
const search = (base) => {
|
||||
return (query, requestOptions) => {
|
||||
return base.transporter.read({
|
||||
method: MethodEnum.Post,
|
||||
path: encode('1/indexes/%s/query', base.indexName),
|
||||
data: {
|
||||
query,
|
||||
},
|
||||
cacheable: true,
|
||||
}, requestOptions);
|
||||
};
|
||||
};
|
||||
|
||||
const searchForFacetValues = (base) => {
|
||||
return (facetName, facetQuery, requestOptions) => {
|
||||
return base.transporter.read({
|
||||
method: MethodEnum.Post,
|
||||
path: encode('1/indexes/%s/facets/%s/query', base.indexName, facetName),
|
||||
data: {
|
||||
facetQuery,
|
||||
},
|
||||
cacheable: true,
|
||||
}, requestOptions);
|
||||
};
|
||||
};
|
||||
|
||||
const LogLevelEnum = {
|
||||
Debug: 1,
|
||||
Info: 2,
|
||||
Error: 3,
|
||||
};
|
||||
|
||||
/* eslint no-console: 0 */
|
||||
function createConsoleLogger(logLevel) {
|
||||
return {
|
||||
debug(message, args) {
|
||||
if (LogLevelEnum.Debug >= logLevel) {
|
||||
console.debug(message, args);
|
||||
}
|
||||
return Promise.resolve();
|
||||
},
|
||||
info(message, args) {
|
||||
if (LogLevelEnum.Info >= logLevel) {
|
||||
console.info(message, args);
|
||||
}
|
||||
return Promise.resolve();
|
||||
},
|
||||
error(message, args) {
|
||||
console.error(message, args);
|
||||
return Promise.resolve();
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function createBrowserXhrRequester() {
|
||||
return {
|
||||
send(request) {
|
||||
return new Promise((resolve) => {
|
||||
const baseRequester = new XMLHttpRequest();
|
||||
baseRequester.open(request.method, request.url, true);
|
||||
Object.keys(request.headers).forEach(key => baseRequester.setRequestHeader(key, request.headers[key]));
|
||||
const createTimeout = (timeout, content) => {
|
||||
return setTimeout(() => {
|
||||
baseRequester.abort();
|
||||
resolve({
|
||||
status: 0,
|
||||
content,
|
||||
isTimedOut: true,
|
||||
});
|
||||
}, timeout * 1000);
|
||||
};
|
||||
const connectTimeout = createTimeout(request.connectTimeout, 'Connection timeout');
|
||||
// eslint-disable-next-line functional/no-let
|
||||
let responseTimeout;
|
||||
// eslint-disable-next-line functional/immutable-data
|
||||
baseRequester.onreadystatechange = () => {
|
||||
if (baseRequester.readyState > baseRequester.OPENED && responseTimeout === undefined) {
|
||||
clearTimeout(connectTimeout);
|
||||
responseTimeout = createTimeout(request.responseTimeout, 'Socket timeout');
|
||||
}
|
||||
};
|
||||
// eslint-disable-next-line functional/immutable-data
|
||||
baseRequester.onerror = () => {
|
||||
// istanbul ignore next
|
||||
if (baseRequester.status === 0) {
|
||||
clearTimeout(connectTimeout);
|
||||
clearTimeout(responseTimeout);
|
||||
resolve({
|
||||
content: baseRequester.responseText || 'Network request failed',
|
||||
status: baseRequester.status,
|
||||
isTimedOut: false,
|
||||
});
|
||||
}
|
||||
};
|
||||
// eslint-disable-next-line functional/immutable-data
|
||||
baseRequester.onload = () => {
|
||||
clearTimeout(connectTimeout);
|
||||
clearTimeout(responseTimeout);
|
||||
resolve({
|
||||
content: baseRequester.responseText,
|
||||
status: baseRequester.status,
|
||||
isTimedOut: false,
|
||||
});
|
||||
};
|
||||
baseRequester.send(request.data);
|
||||
});
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function algoliasearch(appId, apiKey, options) {
|
||||
const commonOptions = {
|
||||
appId,
|
||||
apiKey,
|
||||
timeouts: {
|
||||
connect: 1,
|
||||
read: 2,
|
||||
write: 30,
|
||||
},
|
||||
requester: createBrowserXhrRequester(),
|
||||
logger: createConsoleLogger(LogLevelEnum.Error),
|
||||
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,
|
||||
};
|
||||
return createSearchClient({
|
||||
...commonOptions,
|
||||
...options,
|
||||
methods: {
|
||||
search: multipleQueries,
|
||||
searchForFacetValues: multipleSearchForFacetValues,
|
||||
multipleQueries,
|
||||
multipleSearchForFacetValues,
|
||||
customRequest,
|
||||
initIndex: base => (indexName) => {
|
||||
return initIndex(base)(indexName, {
|
||||
methods: { search, searchForFacetValues, findAnswers },
|
||||
});
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
// eslint-disable-next-line functional/immutable-data
|
||||
algoliasearch.version = version;
|
||||
|
||||
export default algoliasearch;
|
2
node_modules/algoliasearch/dist/algoliasearch-lite.umd.js
generated
vendored
Normal file
2
node_modules/algoliasearch/dist/algoliasearch-lite.umd.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
156
node_modules/algoliasearch/dist/algoliasearch.cjs.js
generated
vendored
Normal file
156
node_modules/algoliasearch/dist/algoliasearch.cjs.js
generated
vendored
Normal file
|
@ -0,0 +1,156 @@
|
|||
'use strict';
|
||||
|
||||
var cacheCommon = require('@algolia/cache-common');
|
||||
var cacheInMemory = require('@algolia/cache-in-memory');
|
||||
var clientAnalytics = require('@algolia/client-analytics');
|
||||
var clientCommon = require('@algolia/client-common');
|
||||
var clientPersonalization = require('@algolia/client-personalization');
|
||||
var clientSearch = require('@algolia/client-search');
|
||||
var loggerCommon = require('@algolia/logger-common');
|
||||
var requesterNodeHttp = require('@algolia/requester-node-http');
|
||||
var transporter = require('@algolia/transporter');
|
||||
|
||||
function algoliasearch(appId, apiKey, options) {
|
||||
const commonOptions = {
|
||||
appId,
|
||||
apiKey,
|
||||
timeouts: {
|
||||
connect: 2,
|
||||
read: 5,
|
||||
write: 30,
|
||||
},
|
||||
requester: requesterNodeHttp.createNodeHttpRequester(),
|
||||
logger: loggerCommon.createNullLogger(),
|
||||
responsesCache: cacheCommon.createNullCache(),
|
||||
requestsCache: cacheCommon.createNullCache(),
|
||||
hostsCache: cacheInMemory.createInMemoryCache(),
|
||||
userAgent: transporter.createUserAgent(clientCommon.version).add({
|
||||
segment: 'Node.js',
|
||||
version: process.versions.node,
|
||||
}),
|
||||
};
|
||||
const searchClientOptions = { ...commonOptions, ...options };
|
||||
const initPersonalization = () => (clientOptions) => {
|
||||
return clientPersonalization.createPersonalizationClient({
|
||||
...commonOptions,
|
||||
...clientOptions,
|
||||
methods: {
|
||||
getPersonalizationStrategy: clientPersonalization.getPersonalizationStrategy,
|
||||
setPersonalizationStrategy: clientPersonalization.setPersonalizationStrategy,
|
||||
},
|
||||
});
|
||||
};
|
||||
return clientSearch.createSearchClient({
|
||||
...searchClientOptions,
|
||||
methods: {
|
||||
search: clientSearch.multipleQueries,
|
||||
searchForFacetValues: clientSearch.multipleSearchForFacetValues,
|
||||
multipleBatch: clientSearch.multipleBatch,
|
||||
multipleGetObjects: clientSearch.multipleGetObjects,
|
||||
multipleQueries: clientSearch.multipleQueries,
|
||||
copyIndex: clientSearch.copyIndex,
|
||||
copySettings: clientSearch.copySettings,
|
||||
copyRules: clientSearch.copyRules,
|
||||
copySynonyms: clientSearch.copySynonyms,
|
||||
moveIndex: clientSearch.moveIndex,
|
||||
listIndices: clientSearch.listIndices,
|
||||
getLogs: clientSearch.getLogs,
|
||||
listClusters: clientSearch.listClusters,
|
||||
multipleSearchForFacetValues: clientSearch.multipleSearchForFacetValues,
|
||||
getApiKey: clientSearch.getApiKey,
|
||||
addApiKey: clientSearch.addApiKey,
|
||||
listApiKeys: clientSearch.listApiKeys,
|
||||
updateApiKey: clientSearch.updateApiKey,
|
||||
deleteApiKey: clientSearch.deleteApiKey,
|
||||
restoreApiKey: clientSearch.restoreApiKey,
|
||||
assignUserID: clientSearch.assignUserID,
|
||||
assignUserIDs: clientSearch.assignUserIDs,
|
||||
getUserID: clientSearch.getUserID,
|
||||
searchUserIDs: clientSearch.searchUserIDs,
|
||||
listUserIDs: clientSearch.listUserIDs,
|
||||
getTopUserIDs: clientSearch.getTopUserIDs,
|
||||
removeUserID: clientSearch.removeUserID,
|
||||
hasPendingMappings: clientSearch.hasPendingMappings,
|
||||
generateSecuredApiKey: clientSearch.generateSecuredApiKey,
|
||||
getSecuredApiKeyRemainingValidity: clientSearch.getSecuredApiKeyRemainingValidity,
|
||||
destroy: clientCommon.destroy,
|
||||
clearDictionaryEntries: clientSearch.clearDictionaryEntries,
|
||||
deleteDictionaryEntries: clientSearch.deleteDictionaryEntries,
|
||||
getDictionarySettings: clientSearch.getDictionarySettings,
|
||||
getAppTask: clientSearch.getAppTask,
|
||||
replaceDictionaryEntries: clientSearch.replaceDictionaryEntries,
|
||||
saveDictionaryEntries: clientSearch.saveDictionaryEntries,
|
||||
searchDictionaryEntries: clientSearch.searchDictionaryEntries,
|
||||
setDictionarySettings: clientSearch.setDictionarySettings,
|
||||
waitAppTask: clientSearch.waitAppTask,
|
||||
customRequest: clientSearch.customRequest,
|
||||
initIndex: base => (indexName) => {
|
||||
return clientSearch.initIndex(base)(indexName, {
|
||||
methods: {
|
||||
batch: clientSearch.batch,
|
||||
delete: clientSearch.deleteIndex,
|
||||
findAnswers: clientSearch.findAnswers,
|
||||
getObject: clientSearch.getObject,
|
||||
getObjects: clientSearch.getObjects,
|
||||
saveObject: clientSearch.saveObject,
|
||||
saveObjects: clientSearch.saveObjects,
|
||||
search: clientSearch.search,
|
||||
searchForFacetValues: clientSearch.searchForFacetValues,
|
||||
waitTask: clientSearch.waitTask,
|
||||
setSettings: clientSearch.setSettings,
|
||||
getSettings: clientSearch.getSettings,
|
||||
partialUpdateObject: clientSearch.partialUpdateObject,
|
||||
partialUpdateObjects: clientSearch.partialUpdateObjects,
|
||||
deleteObject: clientSearch.deleteObject,
|
||||
deleteObjects: clientSearch.deleteObjects,
|
||||
deleteBy: clientSearch.deleteBy,
|
||||
clearObjects: clientSearch.clearObjects,
|
||||
browseObjects: clientSearch.browseObjects,
|
||||
getObjectPosition: clientSearch.getObjectPosition,
|
||||
findObject: clientSearch.findObject,
|
||||
exists: clientSearch.exists,
|
||||
saveSynonym: clientSearch.saveSynonym,
|
||||
saveSynonyms: clientSearch.saveSynonyms,
|
||||
getSynonym: clientSearch.getSynonym,
|
||||
searchSynonyms: clientSearch.searchSynonyms,
|
||||
browseSynonyms: clientSearch.browseSynonyms,
|
||||
deleteSynonym: clientSearch.deleteSynonym,
|
||||
clearSynonyms: clientSearch.clearSynonyms,
|
||||
replaceAllObjects: clientSearch.replaceAllObjects,
|
||||
replaceAllSynonyms: clientSearch.replaceAllSynonyms,
|
||||
searchRules: clientSearch.searchRules,
|
||||
getRule: clientSearch.getRule,
|
||||
deleteRule: clientSearch.deleteRule,
|
||||
saveRule: clientSearch.saveRule,
|
||||
saveRules: clientSearch.saveRules,
|
||||
replaceAllRules: clientSearch.replaceAllRules,
|
||||
browseRules: clientSearch.browseRules,
|
||||
clearRules: clientSearch.clearRules,
|
||||
},
|
||||
});
|
||||
},
|
||||
initAnalytics: () => (clientOptions) => {
|
||||
return clientAnalytics.createAnalyticsClient({
|
||||
...commonOptions,
|
||||
...clientOptions,
|
||||
methods: {
|
||||
addABTest: clientAnalytics.addABTest,
|
||||
getABTest: clientAnalytics.getABTest,
|
||||
getABTests: clientAnalytics.getABTests,
|
||||
stopABTest: clientAnalytics.stopABTest,
|
||||
deleteABTest: clientAnalytics.deleteABTest,
|
||||
},
|
||||
});
|
||||
},
|
||||
initPersonalization,
|
||||
initRecommendation: () => (clientOptions) => {
|
||||
searchClientOptions.logger.info('The `initRecommendation` method is deprecated. Use `initPersonalization` instead.');
|
||||
return initPersonalization()(clientOptions);
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
// eslint-disable-next-line functional/immutable-data
|
||||
algoliasearch.version = clientCommon.version;
|
||||
|
||||
module.exports = algoliasearch;
|
247
node_modules/algoliasearch/dist/algoliasearch.d.ts
generated
vendored
Normal file
247
node_modules/algoliasearch/dist/algoliasearch.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,247 @@
|
|||
import { ABTest } from '@algolia/client-analytics';
|
||||
import { AddABTestResponse } from '@algolia/client-analytics';
|
||||
import { AddApiKeyOptions } from '@algolia/client-search';
|
||||
import { AddApiKeyResponse } from '@algolia/client-search';
|
||||
import { AnalyticsClient as AnalyticsClient_2 } from '@algolia/client-analytics';
|
||||
import { AnalyticsClientOptions } from '@algolia/client-analytics';
|
||||
import { ApiKeyACLType } from '@algolia/client-search';
|
||||
import { AssignUserIDResponse } from '@algolia/client-search';
|
||||
import { AssignUserIDsResponse } from '@algolia/client-search';
|
||||
import { BatchRequest } from '@algolia/client-search';
|
||||
import { BatchResponse } from '@algolia/client-search';
|
||||
import { BrowseOptions } from '@algolia/client-search';
|
||||
import { ChunkedBatchResponse } from '@algolia/client-search';
|
||||
import { ChunkOptions } from '@algolia/client-search';
|
||||
import { ClearRulesOptions } from '@algolia/client-search';
|
||||
import { ClearSynonymsOptions } from '@algolia/client-search';
|
||||
import { ClientTransporterOptions } from '@algolia/client-common';
|
||||
import { CopyIndexOptions } from '@algolia/client-search';
|
||||
import { DeleteABTestResponse } from '@algolia/client-analytics';
|
||||
import { DeleteApiKeyResponse } from '@algolia/client-search';
|
||||
import { DeleteByFiltersOptions } from '@algolia/client-search';
|
||||
import { DeleteResponse } from '@algolia/client-search';
|
||||
import { DeleteSynonymOptions } from '@algolia/client-search';
|
||||
import { Destroyable } from '@algolia/requester-common';
|
||||
import { DictionaryEntriesOptions } from '@algolia/client-search';
|
||||
import { DictionaryEntriesResponse } from '@algolia/client-search';
|
||||
import { DictionaryEntry } from '@algolia/client-search';
|
||||
import { DictionaryName } from '@algolia/client-search';
|
||||
import { DictionarySettings } from '@algolia/client-search';
|
||||
import { FindAnswersOptions } from '@algolia/client-search';
|
||||
import { FindAnswersResponse } from '@algolia/client-search';
|
||||
import { FindObjectOptions } from '@algolia/client-search';
|
||||
import { FindObjectResponse } from '@algolia/client-search';
|
||||
import { GetABTestResponse } from '@algolia/client-analytics';
|
||||
import { GetABTestsOptions } from '@algolia/client-analytics';
|
||||
import { GetABTestsResponse } from '@algolia/client-analytics';
|
||||
import { GetApiKeyResponse } from '@algolia/client-search';
|
||||
import { GetDictionarySettingsResponse } from '@algolia/client-search';
|
||||
import { GetLogsResponse } from '@algolia/client-search';
|
||||
import { GetObjectOptions } from '@algolia/client-search';
|
||||
import { GetObjectsOptions } from '@algolia/client-search';
|
||||
import { GetObjectsResponse } from '@algolia/client-search';
|
||||
import { GetPersonalizationStrategyResponse } from '@algolia/client-personalization';
|
||||
import { GetTopUserIDsResponse } from '@algolia/client-search';
|
||||
import { HasPendingMappingsOptions } from '@algolia/client-search';
|
||||
import { HasPendingMappingsResponse } from '@algolia/client-search';
|
||||
import { IndexOperationResponse } from '@algolia/client-search';
|
||||
import { ListApiKeysResponse } from '@algolia/client-search';
|
||||
import { ListClustersResponse } from '@algolia/client-search';
|
||||
import { ListIndicesResponse } from '@algolia/client-search';
|
||||
import { ListUserIDsOptions } from '@algolia/client-search';
|
||||
import { ListUserIDsResponse } from '@algolia/client-search';
|
||||
import { MultipleBatchRequest } from '@algolia/client-search';
|
||||
import { MultipleBatchResponse } from '@algolia/client-search';
|
||||
import { MultipleGetObject } from '@algolia/client-search';
|
||||
import { MultipleGetObjectsResponse } from '@algolia/client-search';
|
||||
import { MultipleQueriesOptions } from '@algolia/client-search';
|
||||
import { MultipleQueriesQuery } from '@algolia/client-search';
|
||||
import { MultipleQueriesResponse } from '@algolia/client-search';
|
||||
import { ObjectWithObjectID } from '@algolia/client-search';
|
||||
import { PartialUpdateObjectResponse } from '@algolia/client-search';
|
||||
import { PartialUpdateObjectsOptions } from '@algolia/client-search';
|
||||
import { PersonalizationClient as PersonalizationClient_2 } from '@algolia/client-personalization';
|
||||
import { PersonalizationClientOptions } from '@algolia/client-personalization';
|
||||
import { PersonalizationStrategy } from '@algolia/client-personalization';
|
||||
import { RemoveUserIDResponse } from '@algolia/client-search';
|
||||
import { ReplaceAllObjectsOptions } from '@algolia/client-search';
|
||||
import { Request } from '@algolia/transporter';
|
||||
import { RequestOptions } from '@algolia/transporter';
|
||||
import { RestoreApiKeyResponse } from '@algolia/client-search';
|
||||
import { Rule } from '@algolia/client-search';
|
||||
import { SaveObjectResponse } from '@algolia/client-search';
|
||||
import { SaveObjectsOptions } from '@algolia/client-search';
|
||||
import { SaveRuleResponse } from '@algolia/client-search';
|
||||
import { SaveRulesOptions } from '@algolia/client-search';
|
||||
import { SaveRulesResponse } from '@algolia/client-search';
|
||||
import { SaveSynonymResponse } from '@algolia/client-search';
|
||||
import { SaveSynonymsOptions } from '@algolia/client-search';
|
||||
import { SaveSynonymsResponse } from '@algolia/client-search';
|
||||
import { SearchClient as SearchClient_2 } from '@algolia/client-search';
|
||||
import { SearchClientOptions } from '@algolia/client-search';
|
||||
import { SearchDictionaryEntriesResponse } from '@algolia/client-search';
|
||||
import { SearchForFacetValuesQueryParams } from '@algolia/client-search';
|
||||
import { SearchForFacetValuesResponse } from '@algolia/client-search';
|
||||
import { SearchIndex as SearchIndex_2 } from '@algolia/client-search';
|
||||
import { SearchOptions } from '@algolia/client-search';
|
||||
import { SearchResponse } from '@algolia/client-search';
|
||||
import { SearchRulesOptions } from '@algolia/client-search';
|
||||
import { SearchSynonymsOptions } from '@algolia/client-search';
|
||||
import { SearchSynonymsResponse } from '@algolia/client-search';
|
||||
import { SearchUserIDsOptions } from '@algolia/client-search';
|
||||
import { SearchUserIDsResponse } from '@algolia/client-search';
|
||||
import { SecuredApiKeyRestrictions } from '@algolia/client-search';
|
||||
import { SetPersonalizationStrategyResponse } from '@algolia/client-personalization';
|
||||
import { SetSettingsResponse } from '@algolia/client-search';
|
||||
import { Settings } from '@algolia/client-search';
|
||||
import { StopABTestResponse } from '@algolia/client-analytics';
|
||||
import { Synonym } from '@algolia/client-search';
|
||||
import { TaskStatusResponse } from '@algolia/client-search';
|
||||
import { UpdateApiKeyOptions } from '@algolia/client-search';
|
||||
import { UpdateApiKeyResponse } from '@algolia/client-search';
|
||||
import { UserIDResponse } from '@algolia/client-search';
|
||||
import { WaitablePromise } from '@algolia/client-common';
|
||||
|
||||
declare function algoliasearch(appId: string, apiKey: string, options?: AlgoliaSearchOptions): SearchClient;
|
||||
|
||||
declare namespace algoliasearch {
|
||||
var version: string;
|
||||
}
|
||||
export default algoliasearch;
|
||||
|
||||
export declare type AlgoliaSearchOptions = Partial<ClientTransporterOptions> & WithoutCredentials<SearchClientOptions>;
|
||||
|
||||
export declare type AnalyticsClient = AnalyticsClient_2 & {
|
||||
readonly addABTest: (abTest: ABTest, requestOptions?: RequestOptions) => Readonly<Promise<AddABTestResponse>>;
|
||||
readonly getABTest: (abTestID: number, requestOptions?: RequestOptions) => Readonly<Promise<GetABTestResponse>>;
|
||||
readonly getABTests: (requestOptions?: RequestOptions & GetABTestsOptions) => Readonly<Promise<GetABTestsResponse>>;
|
||||
readonly stopABTest: (abTestID: number, requestOptions?: RequestOptions) => Readonly<Promise<StopABTestResponse>>;
|
||||
readonly deleteABTest: (abTestID: number, requestOptions?: RequestOptions) => Readonly<Promise<DeleteABTestResponse>>;
|
||||
};
|
||||
|
||||
declare type Credentials = {
|
||||
readonly appId: string;
|
||||
readonly apiKey: string;
|
||||
};
|
||||
|
||||
export declare type InitAnalyticsOptions = Partial<ClientTransporterOptions> & OptionalCredentials<AnalyticsClientOptions>;
|
||||
|
||||
export declare type InitPersonalizationOptions = Partial<ClientTransporterOptions> & OptionalCredentials<PersonalizationClientOptions>;
|
||||
|
||||
/**
|
||||
* @deprecated Use `InitPersonalizationOptions` instead.
|
||||
*/
|
||||
export declare type InitRecommendationOptions = InitPersonalizationOptions;
|
||||
|
||||
export declare type OptionalCredentials<TClientOptions extends Credentials> = Omit<TClientOptions, keyof Credentials> & Pick<Partial<TClientOptions>, keyof Credentials>;
|
||||
|
||||
export declare type PersonalizationClient = PersonalizationClient_2 & {
|
||||
readonly getPersonalizationStrategy: (requestOptions?: RequestOptions) => Readonly<Promise<GetPersonalizationStrategyResponse>>;
|
||||
readonly setPersonalizationStrategy: (personalizationStrategy: PersonalizationStrategy, requestOptions?: RequestOptions) => Readonly<Promise<SetPersonalizationStrategyResponse>>;
|
||||
};
|
||||
|
||||
/**
|
||||
* @deprecated Use `PersonalizationClient` instead.
|
||||
*/
|
||||
export declare type RecommendationClient = PersonalizationClient;
|
||||
|
||||
export declare type SearchClient = SearchClient_2 & {
|
||||
readonly initIndex: (indexName: string) => SearchIndex;
|
||||
readonly search: <TObject>(queries: readonly MultipleQueriesQuery[], requestOptions?: RequestOptions & MultipleQueriesOptions) => Readonly<Promise<MultipleQueriesResponse<TObject>>>;
|
||||
readonly searchForFacetValues: (queries: ReadonlyArray<{
|
||||
readonly indexName: string;
|
||||
readonly params: SearchForFacetValuesQueryParams & SearchOptions;
|
||||
}>, requestOptions?: RequestOptions) => Readonly<Promise<readonly SearchForFacetValuesResponse[]>>;
|
||||
readonly multipleBatch: (requests: readonly MultipleBatchRequest[], requestOptions?: RequestOptions) => Readonly<WaitablePromise<MultipleBatchResponse>>;
|
||||
readonly multipleGetObjects: <TObject>(requests: readonly MultipleGetObject[], requestOptions?: RequestOptions) => Readonly<Promise<MultipleGetObjectsResponse<TObject>>>;
|
||||
readonly multipleQueries: <TObject>(queries: readonly MultipleQueriesQuery[], requestOptions?: RequestOptions & MultipleQueriesOptions) => Readonly<Promise<MultipleQueriesResponse<TObject>>>;
|
||||
readonly copyIndex: (from: string, to: string, requestOptions?: CopyIndexOptions & RequestOptions) => Readonly<WaitablePromise<IndexOperationResponse>>;
|
||||
readonly copySettings: (from: string, to: string, requestOptions?: RequestOptions) => Readonly<WaitablePromise<IndexOperationResponse>>;
|
||||
readonly copyRules: (from: string, to: string, requestOptions?: RequestOptions) => Readonly<WaitablePromise<IndexOperationResponse>>;
|
||||
readonly copySynonyms: (from: string, to: string, requestOptions?: RequestOptions) => Readonly<WaitablePromise<IndexOperationResponse>>;
|
||||
readonly moveIndex: (from: string, to: string, requestOptions?: RequestOptions) => Readonly<WaitablePromise<IndexOperationResponse>>;
|
||||
readonly listIndices: (requestOptions?: RequestOptions) => Readonly<Promise<ListIndicesResponse>>;
|
||||
readonly getLogs: (requestOptions?: RequestOptions) => Readonly<Promise<GetLogsResponse>>;
|
||||
readonly listClusters: (requestOptions?: RequestOptions) => Readonly<Promise<ListClustersResponse>>;
|
||||
readonly multipleSearchForFacetValues: (queries: ReadonlyArray<{
|
||||
readonly indexName: string;
|
||||
readonly params: SearchForFacetValuesQueryParams & SearchOptions;
|
||||
}>, requestOptions?: RequestOptions) => Readonly<Promise<readonly SearchForFacetValuesResponse[]>>;
|
||||
readonly getApiKey: (apiKey: string, requestOptions?: RequestOptions) => Readonly<Promise<GetApiKeyResponse>>;
|
||||
readonly addApiKey: (acl: readonly ApiKeyACLType[], requestOptions?: AddApiKeyOptions & Pick<RequestOptions, Exclude<keyof RequestOptions, 'queryParameters'>>) => Readonly<WaitablePromise<AddApiKeyResponse>>;
|
||||
readonly listApiKeys: (requestOptions?: RequestOptions) => Readonly<Promise<ListApiKeysResponse>>;
|
||||
readonly updateApiKey: (apiKey: string, requestOptions?: UpdateApiKeyOptions & Pick<RequestOptions, Exclude<keyof RequestOptions, 'queryParameters'>>) => Readonly<WaitablePromise<UpdateApiKeyResponse>>;
|
||||
readonly deleteApiKey: (apiKey: string, requestOptions?: RequestOptions) => Readonly<WaitablePromise<DeleteApiKeyResponse>>;
|
||||
readonly restoreApiKey: (apiKey: string, requestOptions?: RequestOptions) => Readonly<WaitablePromise<RestoreApiKeyResponse>>;
|
||||
readonly assignUserID: (userID: string, clusterName: string, requestOptions?: RequestOptions) => Readonly<Promise<AssignUserIDResponse>>;
|
||||
readonly assignUserIDs: (userIDs: readonly string[], clusterName: string, requestOptions?: RequestOptions) => Readonly<Promise<AssignUserIDsResponse>>;
|
||||
readonly getUserID: (userID: string, requestOptions?: RequestOptions) => Readonly<Promise<UserIDResponse>>;
|
||||
readonly searchUserIDs: (query: string, requestOptions?: SearchUserIDsOptions & RequestOptions) => Readonly<Promise<SearchUserIDsResponse>>;
|
||||
readonly listUserIDs: (requestOptions?: ListUserIDsOptions & RequestOptions) => Readonly<Promise<ListUserIDsResponse>>;
|
||||
readonly getTopUserIDs: (requestOptions?: RequestOptions) => Readonly<Promise<GetTopUserIDsResponse>>;
|
||||
readonly removeUserID: (userID: string, requestOptions?: RequestOptions) => Readonly<Promise<RemoveUserIDResponse>>;
|
||||
readonly hasPendingMappings: (requestOptions?: HasPendingMappingsOptions & RequestOptions) => Readonly<Promise<HasPendingMappingsResponse>>;
|
||||
readonly generateSecuredApiKey: (parentApiKey: string, restrictions: SecuredApiKeyRestrictions) => string;
|
||||
readonly getSecuredApiKeyRemainingValidity: (securedApiKey: string) => number;
|
||||
readonly clearDictionaryEntries: (dictionary: DictionaryName, requestOptions?: RequestOptions & DictionaryEntriesOptions) => Readonly<WaitablePromise<DictionaryEntriesResponse>>;
|
||||
readonly deleteDictionaryEntries: (dictionary: DictionaryName, objectIDs: readonly string[], requestOptions?: RequestOptions & DictionaryEntriesOptions) => Readonly<WaitablePromise<DictionaryEntriesResponse>>;
|
||||
readonly replaceDictionaryEntries: (dictionary: DictionaryName, entries: readonly DictionaryEntry[], requestOptions?: RequestOptions & DictionaryEntriesOptions) => Readonly<WaitablePromise<DictionaryEntriesResponse>>;
|
||||
readonly saveDictionaryEntries: (dictionary: DictionaryName, entries: readonly DictionaryEntry[], requestOptions?: RequestOptions & DictionaryEntriesOptions) => Readonly<WaitablePromise<DictionaryEntriesResponse>>;
|
||||
readonly searchDictionaryEntries: (dictionary: DictionaryName, query: string, requestOptions?: RequestOptions) => Readonly<Promise<SearchDictionaryEntriesResponse>>;
|
||||
readonly getDictionarySettings: (requestOptions?: RequestOptions) => Readonly<Promise<GetDictionarySettingsResponse>>;
|
||||
readonly setDictionarySettings: (settings: DictionarySettings, requestOptions?: RequestOptions) => Readonly<WaitablePromise<DictionaryEntriesResponse>>;
|
||||
readonly getAppTask: (taskID: number, requestOptions?: RequestOptions) => Readonly<Promise<TaskStatusResponse>>;
|
||||
readonly customRequest: <TResponse>(request: Request, requestOptions?: RequestOptions) => Readonly<Promise<TResponse>>;
|
||||
readonly initAnalytics: (options?: InitAnalyticsOptions) => AnalyticsClient;
|
||||
readonly initPersonalization: (options?: InitPersonalizationOptions) => PersonalizationClient;
|
||||
/**
|
||||
* @deprecated Use `initPersonalization` instead.
|
||||
*/
|
||||
readonly initRecommendation: (options?: InitPersonalizationOptions) => PersonalizationClient;
|
||||
} & Destroyable;
|
||||
|
||||
export declare type SearchIndex = SearchIndex_2 & {
|
||||
readonly search: <TObject>(query: string, requestOptions?: RequestOptions & SearchOptions) => Readonly<Promise<SearchResponse<TObject>>>;
|
||||
readonly searchForFacetValues: (facetName: string, facetQuery: string, requestOptions?: RequestOptions & SearchOptions) => Readonly<Promise<SearchForFacetValuesResponse>>;
|
||||
readonly findAnswers: <TObject>(query: string, queryLanguages: readonly string[], requestOptions?: RequestOptions & FindAnswersOptions) => Readonly<Promise<FindAnswersResponse<TObject>>>;
|
||||
readonly batch: (requests: readonly BatchRequest[], requestOptions?: RequestOptions) => Readonly<WaitablePromise<BatchResponse>>;
|
||||
readonly delete: (requestOptions?: RequestOptions) => Readonly<WaitablePromise<DeleteResponse>>;
|
||||
readonly getObject: <TObject>(objectID: string, requestOptions?: RequestOptions & GetObjectOptions) => Readonly<Promise<TObject & ObjectWithObjectID>>;
|
||||
readonly getObjects: <TObject>(objectIDs: readonly string[], requestOptions?: RequestOptions & GetObjectsOptions) => Readonly<Promise<GetObjectsResponse<TObject>>>;
|
||||
readonly saveObject: (object: Readonly<Record<string, any>>, requestOptions?: RequestOptions & ChunkOptions & SaveObjectsOptions) => Readonly<WaitablePromise<SaveObjectResponse>>;
|
||||
readonly saveObjects: (objects: ReadonlyArray<Readonly<Record<string, any>>>, requestOptions?: RequestOptions & ChunkOptions & SaveObjectsOptions) => Readonly<WaitablePromise<ChunkedBatchResponse>>;
|
||||
readonly waitTask: (taskID: number, requestOptions?: RequestOptions) => Readonly<Promise<void>>;
|
||||
readonly setSettings: (settings: Settings, requestOptions?: RequestOptions) => Readonly<WaitablePromise<SetSettingsResponse>>;
|
||||
readonly getSettings: (requestOptions?: RequestOptions) => Readonly<Promise<Settings>>;
|
||||
readonly partialUpdateObject: (object: Record<string, any>, requestOptions?: RequestOptions & ChunkOptions & PartialUpdateObjectsOptions) => Readonly<WaitablePromise<PartialUpdateObjectResponse>>;
|
||||
readonly partialUpdateObjects: (objects: ReadonlyArray<Record<string, any>>, requestOptions?: RequestOptions & ChunkOptions & PartialUpdateObjectsOptions) => Readonly<WaitablePromise<ChunkedBatchResponse>>;
|
||||
readonly deleteObject: (objectID: string, requestOptions?: RequestOptions) => Readonly<WaitablePromise<DeleteResponse>>;
|
||||
readonly deleteObjects: (objectIDs: readonly string[], requestOptions?: RequestOptions & ChunkOptions) => Readonly<WaitablePromise<ChunkedBatchResponse>>;
|
||||
readonly deleteBy: (filters: DeleteByFiltersOptions, requestOptions?: RequestOptions) => Readonly<WaitablePromise<DeleteResponse>>;
|
||||
readonly clearObjects: (requestOptions?: RequestOptions) => Readonly<WaitablePromise<DeleteResponse>>;
|
||||
readonly browseObjects: <TObject>(requestOptions?: SearchOptions & BrowseOptions<TObject> & RequestOptions) => Readonly<Promise<void>>;
|
||||
readonly getObjectPosition: (searchResponse: SearchResponse<{}>, objectID: string) => number;
|
||||
readonly findObject: <TObject>(callback: (object: TObject & ObjectWithObjectID) => boolean, requestOptions?: FindObjectOptions & RequestOptions) => Readonly<Promise<FindObjectResponse<TObject>>>;
|
||||
readonly exists: (requestOptions?: RequestOptions) => Readonly<Promise<boolean>>;
|
||||
readonly saveSynonym: (synonym: Synonym, requestOptions?: RequestOptions & SaveSynonymsOptions) => Readonly<WaitablePromise<SaveSynonymResponse>>;
|
||||
readonly saveSynonyms: (synonyms: readonly Synonym[], requestOptions?: SaveSynonymsOptions & RequestOptions) => Readonly<WaitablePromise<SaveSynonymsResponse>>;
|
||||
readonly getSynonym: (objectID: string, requestOptions?: RequestOptions) => Readonly<Promise<Synonym>>;
|
||||
readonly searchSynonyms: (query: string, requestOptions?: SearchSynonymsOptions & RequestOptions) => Readonly<Promise<SearchSynonymsResponse>>;
|
||||
readonly browseSynonyms: (requestOptions?: SearchSynonymsOptions & BrowseOptions<Synonym> & RequestOptions) => Readonly<Promise<void>>;
|
||||
readonly deleteSynonym: (objectID: string, requestOptions?: DeleteSynonymOptions & RequestOptions) => Readonly<WaitablePromise<DeleteResponse>>;
|
||||
readonly clearSynonyms: (requestOptions?: ClearSynonymsOptions & RequestOptions) => Readonly<WaitablePromise<DeleteResponse>>;
|
||||
readonly replaceAllObjects: (objects: ReadonlyArray<Readonly<Record<string, any>>>, requestOptions?: ReplaceAllObjectsOptions & ChunkOptions & SaveObjectsOptions & RequestOptions) => Readonly<WaitablePromise<ChunkedBatchResponse>>;
|
||||
readonly replaceAllSynonyms: (synonyms: readonly Synonym[], requestOptions?: RequestOptions & Pick<SaveSynonymsOptions, Exclude<keyof SaveSynonymsOptions, 'clearExistingSynonyms' | 'replaceExistingSynonyms'>>) => Readonly<WaitablePromise<SaveSynonymsResponse>>;
|
||||
readonly searchRules: (query: string, requestOptions?: RequestOptions & SearchRulesOptions) => Readonly<Promise<SearchResponse<Rule>>>;
|
||||
readonly getRule: (objectID: string, requestOptions?: RequestOptions) => Readonly<Promise<Rule>>;
|
||||
readonly deleteRule: (objectID: string, requestOptions?: RequestOptions) => Readonly<WaitablePromise<DeleteResponse>>;
|
||||
readonly saveRule: (rule: Rule, requestOptions?: RequestOptions & SaveRulesOptions) => Readonly<WaitablePromise<SaveRuleResponse>>;
|
||||
readonly saveRules: (rules: readonly Rule[], requestOptions?: RequestOptions & SaveRulesOptions) => Readonly<WaitablePromise<SaveRulesResponse>>;
|
||||
readonly replaceAllRules: (rules: readonly Rule[], requestOptions?: RequestOptions & SaveRulesOptions) => Readonly<WaitablePromise<SaveRulesResponse>>;
|
||||
readonly browseRules: (requestOptions?: SearchRulesOptions & BrowseOptions<Rule> & RequestOptions) => Readonly<Promise<void>>;
|
||||
readonly clearRules: (requestOptions?: RequestOptions & ClearRulesOptions) => Readonly<WaitablePromise<DeleteResponse>>;
|
||||
};
|
||||
|
||||
export declare type WithoutCredentials<TClientOptions extends Credentials> = Omit<TClientOptions, keyof Credentials>;
|
||||
|
||||
export { }
|
2221
node_modules/algoliasearch/dist/algoliasearch.esm.browser.js
generated
vendored
Normal file
2221
node_modules/algoliasearch/dist/algoliasearch.esm.browser.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
2
node_modules/algoliasearch/dist/algoliasearch.umd.js
generated
vendored
Normal file
2
node_modules/algoliasearch/dist/algoliasearch.umd.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3
node_modules/algoliasearch/index.d.ts
generated
vendored
Normal file
3
node_modules/algoliasearch/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
/* eslint-disable import/no-unresolved*/
|
||||
export * from './dist/algoliasearch';
|
||||
export { default } from './dist/algoliasearch';
|
15
node_modules/algoliasearch/index.js
generated
vendored
Normal file
15
node_modules/algoliasearch/index.js
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
/* eslint-disable functional/immutable-data, import/no-commonjs */
|
||||
const algoliasearch = require('./dist/algoliasearch.cjs.js');
|
||||
|
||||
/**
|
||||
* The Common JS build is the default entry point for the Node environment. Keep in
|
||||
* in mind, that for the browser environment, we hint the bundler to use the UMD
|
||||
* build instead as specified on the key `browser` of our `package.json` file.
|
||||
*/
|
||||
module.exports = algoliasearch;
|
||||
|
||||
/**
|
||||
* In addition, we also set explicitly the default export below making
|
||||
* this Common JS module in compliance with es6 modules specification.
|
||||
*/
|
||||
module.exports.default = algoliasearch;
|
3
node_modules/algoliasearch/lite.d.ts
generated
vendored
Normal file
3
node_modules/algoliasearch/lite.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
/* eslint-disable import/no-unresolved*/
|
||||
export * from './dist/algoliasearch-lite';
|
||||
export { default } from './dist/algoliasearch-lite';
|
2
node_modules/algoliasearch/lite.js
generated
vendored
Normal file
2
node_modules/algoliasearch/lite.js
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
// eslint-disable-next-line functional/immutable-data, import/no-commonjs
|
||||
module.exports = require('./index');
|
43
node_modules/algoliasearch/package.json
generated
vendored
Normal file
43
node_modules/algoliasearch/package.json
generated
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
"name": "algoliasearch",
|
||||
"version": "4.17.0",
|
||||
"private": false,
|
||||
"description": "A fully-featured and blazing-fast JavaScript API client to interact with Algolia API.",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/algolia/algoliasearch-client-javascript.git"
|
||||
},
|
||||
"license": "MIT",
|
||||
"sideEffects": false,
|
||||
"main": "index.js",
|
||||
"jsdelivr": "./dist/algoliasearch.umd.js",
|
||||
"unpkg": "./dist/algoliasearch.umd.js",
|
||||
"browser": {
|
||||
"./index.js": "./dist/algoliasearch.umd.js",
|
||||
"./lite.js": "./dist/algoliasearch-lite.umd.js"
|
||||
},
|
||||
"types": "index.d.ts",
|
||||
"files": [
|
||||
"dist",
|
||||
"index.js",
|
||||
"index.d.ts",
|
||||
"lite.js",
|
||||
"lite.d.ts"
|
||||
],
|
||||
"dependencies": {
|
||||
"@algolia/cache-browser-local-storage": "4.17.0",
|
||||
"@algolia/cache-common": "4.17.0",
|
||||
"@algolia/cache-in-memory": "4.17.0",
|
||||
"@algolia/client-account": "4.17.0",
|
||||
"@algolia/client-analytics": "4.17.0",
|
||||
"@algolia/client-common": "4.17.0",
|
||||
"@algolia/client-personalization": "4.17.0",
|
||||
"@algolia/client-search": "4.17.0",
|
||||
"@algolia/logger-common": "4.17.0",
|
||||
"@algolia/logger-console": "4.17.0",
|
||||
"@algolia/requester-browser-xhr": "4.17.0",
|
||||
"@algolia/requester-common": "4.17.0",
|
||||
"@algolia/requester-node-http": "4.17.0",
|
||||
"@algolia/transporter": "4.17.0"
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue