@algolia/client-common
Advanced tools
Comparing version 4.0.0-beta.11 to 4.0.0-beta.12
@@ -21,4 +21,3 @@ 'use strict'; | ||
function createRetryablePromise(callback) { | ||
// eslint-disable-next-line functional/no-let | ||
let retriesCount = 0; | ||
let retriesCount = 0; // eslint-disable-line functional/no-let | ||
const retry = () => { | ||
@@ -75,6 +74,18 @@ retriesCount++; | ||
const version = '4.0.0-beta.11'; | ||
const version = '4.0.0-beta.12'; | ||
const destroy = (base) => { | ||
return () => { | ||
return base.transporter.requester.destroy(); | ||
}; | ||
}; | ||
const AuthMode = { | ||
/** | ||
* If auth credentials should be in query parameters. | ||
*/ | ||
WithinQueryParameters: 0, | ||
/** | ||
* If auth credentials should be in headers. | ||
*/ | ||
WithinHeaders: 1, | ||
@@ -88,4 +99,5 @@ }; | ||
exports.createWaitablePromise = createWaitablePromise; | ||
exports.destroy = destroy; | ||
exports.encode = encode; | ||
exports.shuffle = shuffle; | ||
exports.version = version; |
@@ -0,2 +1,7 @@ | ||
import { Headers } from '@algolia/transporter'; | ||
import { HostOptions } from '@algolia/transporter'; | ||
import { QueryParameters } from '@algolia/transporter'; | ||
import { RequestOptions } from '@algolia/transporter'; | ||
import { Transporter } from '@algolia/transporter'; | ||
import { TransporterOptions } from '@algolia/transporter'; | ||
@@ -10,16 +15,37 @@ export declare function addMethods<TBase, TMethods extends { | ||
export declare type Auth = { | ||
readonly headers: () => { | ||
readonly [key: string]: string; | ||
}; | ||
readonly queryParameters: () => { | ||
readonly [key: string]: string; | ||
}; | ||
/** | ||
* Returns the headers related to auth. Should be | ||
* merged to the transporter headers. | ||
*/ | ||
readonly headers: () => Readonly<Record<string, string>>; | ||
/** | ||
* Returns the query parameters related to auth. Should be | ||
* merged to the query parameters headers. | ||
*/ | ||
readonly queryParameters: () => Readonly<Record<string, string>>; | ||
}; | ||
export declare const AuthMode: { | ||
readonly [key: string]: AuthModeType; | ||
}; | ||
export declare const AuthMode: Readonly<Record<string, AuthModeType>>; | ||
export declare type AuthModeType = 0 | 1; | ||
export declare type ClientTransporterOptions = Pick<TransporterOptions, Exclude<keyof TransporterOptions, 'headers'> & Exclude<keyof TransporterOptions, 'queryParameters'> & Exclude<keyof TransporterOptions, 'hosts'>> & { | ||
/** | ||
* The hosts used by the requester. | ||
*/ | ||
readonly hosts?: readonly HostOptions[]; | ||
/** | ||
* The headers used by the requester. The transporter | ||
* layer may add some extra headers during the request | ||
* for the user agent, and others. | ||
*/ | ||
readonly headers?: Headers; | ||
/** | ||
* The query parameters used by the requester. The transporter | ||
* layer may add some extra headers during the request | ||
* for the user agent, and others. | ||
*/ | ||
readonly queryParameters?: QueryParameters; | ||
}; | ||
export declare function createAuth(authMode: AuthModeType, appId: string, apiKey: string): Auth; | ||
@@ -39,2 +65,6 @@ | ||
export declare const destroy: (base: { | ||
readonly transporter: Transporter; | ||
}) => () => Readonly<Promise<void>>; | ||
export declare function encode(format: string, ...args: readonly any[]): string; | ||
@@ -44,7 +74,25 @@ | ||
export declare const version = "4.0.0-beta.11"; | ||
export declare const version = "4.0.0-beta.12"; | ||
export declare type Wait<TResponse> = (result: TResponse, requestOptions?: RequestOptions) => Readonly<Promise<any>>; | ||
export declare type Wait<TResponse> = ( | ||
/** | ||
* The original response. | ||
*/ | ||
response: TResponse, | ||
/** | ||
* The custom request options. | ||
*/ | ||
requestOptions?: RequestOptions) => Readonly<Promise<any>>; | ||
export declare type WaitablePromise<TResponse> = Readonly<Promise<TResponse>> & { | ||
/** | ||
* Wait for a task to complete before executing the next line of code, to synchronize index updates. | ||
* | ||
* All write operations in Algolia are asynchronous by design. It means that when you add or | ||
* update an object to your index, our servers will reply to your request with a taskID as | ||
* soon as they understood the write operation. The actual insert and indexing will be | ||
* done after replying to your code. | ||
* | ||
* You can wait for a task to complete by using this method. | ||
*/ | ||
readonly wait: (requestOptions?: RequestOptions) => Readonly<WaitablePromise<TResponse>>; | ||
@@ -51,0 +99,0 @@ }; |
@@ -17,4 +17,3 @@ function createAuth(authMode, appId, apiKey) { | ||
function createRetryablePromise(callback) { | ||
// eslint-disable-next-line functional/no-let | ||
let retriesCount = 0; | ||
let retriesCount = 0; // eslint-disable-line functional/no-let | ||
const retry = () => { | ||
@@ -71,9 +70,21 @@ retriesCount++; | ||
const version = '4.0.0-beta.11'; | ||
const version = '4.0.0-beta.12'; | ||
const destroy = (base) => { | ||
return () => { | ||
return base.transporter.requester.destroy(); | ||
}; | ||
}; | ||
const AuthMode = { | ||
/** | ||
* If auth credentials should be in query parameters. | ||
*/ | ||
WithinQueryParameters: 0, | ||
/** | ||
* If auth credentials should be in headers. | ||
*/ | ||
WithinHeaders: 1, | ||
}; | ||
export { AuthMode, addMethods, createAuth, createRetryablePromise, createWaitablePromise, encode, shuffle, version }; | ||
export { AuthMode, addMethods, createAuth, createRetryablePromise, createWaitablePromise, destroy, encode, shuffle, version }; |
{ | ||
"name": "@algolia/client-common", | ||
"version": "4.0.0-beta.11", | ||
"version": "4.0.0-beta.12", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10243
256