Updated types
This commit is contained in:
10
index.d.ts
vendored
10
index.d.ts
vendored
@ -23,15 +23,14 @@ import { EventEmitter } from 'events';
|
||||
import { SecureContextOptions } from 'tls';
|
||||
import Transport, {
|
||||
ApiResponse,
|
||||
EventMeta,
|
||||
SniffMeta,
|
||||
RequestEvent,
|
||||
TransportRequestParams,
|
||||
TransportRequestOptions,
|
||||
nodeFilterFn,
|
||||
nodeSelectorFn
|
||||
} from './lib/Transport';
|
||||
import Connection, { AgentOptions } from './lib/Connection';
|
||||
import ConnectionPool, { ResurrectMeta } from './lib/ConnectionPool';
|
||||
import ConnectionPool, { ResurrectEvent } from './lib/ConnectionPool';
|
||||
import Serializer from './lib/Serializer';
|
||||
import * as RequestParams from './api/requestParams';
|
||||
import * as errors from './lib/errors';
|
||||
@ -569,9 +568,8 @@ export {
|
||||
Serializer,
|
||||
events,
|
||||
ApiResponse,
|
||||
EventMeta,
|
||||
SniffMeta,
|
||||
ResurrectMeta,
|
||||
RequestEvent,
|
||||
ResurrectEvent,
|
||||
RequestParams,
|
||||
ClientExtendsCallbackOptions
|
||||
};
|
||||
|
||||
2
lib/ConnectionPool.d.ts
vendored
2
lib/ConnectionPool.d.ts
vendored
@ -36,7 +36,7 @@ export interface getConnectionOptions {
|
||||
selector?: nodeSelectorFn;
|
||||
}
|
||||
|
||||
export interface ResurrectMeta {
|
||||
export interface ResurrectEvent {
|
||||
strategy: string;
|
||||
isAlive: boolean;
|
||||
connection: Connection;
|
||||
|
||||
34
lib/Transport.d.ts
vendored
34
lib/Transport.d.ts
vendored
@ -49,25 +49,29 @@ interface TransportOptions {
|
||||
headers?: anyObject;
|
||||
}
|
||||
|
||||
export interface ApiResponse {
|
||||
export interface RequestEvent {
|
||||
body: any;
|
||||
statusCode: number | null;
|
||||
headers: any;
|
||||
warnings: any[] | null;
|
||||
headers: anyObject | null;
|
||||
warnings: string[] | null;
|
||||
meta: {
|
||||
request: {
|
||||
params: TransportRequestParams;
|
||||
options: TransportRequestOptions;
|
||||
};
|
||||
connection: Connection;
|
||||
attempts: number;
|
||||
aborted: boolean;
|
||||
sniff?: {
|
||||
hosts: any[];
|
||||
reason: string;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
export interface EventMeta {
|
||||
connection: Connection;
|
||||
request: any;
|
||||
response: ApiResponse;
|
||||
attempts: number;
|
||||
aborted: boolean;
|
||||
}
|
||||
|
||||
export interface SniffMeta {
|
||||
hosts: any[];
|
||||
reason: string;
|
||||
}
|
||||
// ApiResponse and RequestEvent are the same thing
|
||||
// we are doing this for have more clear names
|
||||
export interface ApiResponse extends RequestEvent {}
|
||||
|
||||
declare type anyObject = {
|
||||
[key: string]: any;
|
||||
|
||||
45
lib/errors.d.ts
vendored
45
lib/errors.d.ts
vendored
@ -17,51 +17,58 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
export declare class TimeoutError extends Error {
|
||||
import { ApiResponse } from './Transport'
|
||||
|
||||
export declare class ElasticsearchClientError extends Error {
|
||||
name: string;
|
||||
message: string;
|
||||
request: any;
|
||||
constructor(message: string, request: any);
|
||||
}
|
||||
|
||||
export declare class ConnectionError extends Error {
|
||||
export declare class TimeoutError extends ElasticsearchClientError {
|
||||
name: string;
|
||||
message: string;
|
||||
request: any;
|
||||
constructor(message: string, request: any);
|
||||
meta: ApiResponse;
|
||||
constructor(message: string, meta: ApiResponse);
|
||||
}
|
||||
|
||||
export declare class NoLivingConnectionsError extends Error {
|
||||
export declare class ConnectionError extends ElasticsearchClientError {
|
||||
name: string;
|
||||
message: string;
|
||||
meta: ApiResponse;
|
||||
constructor(message: string, meta: ApiResponse);
|
||||
}
|
||||
|
||||
export declare class NoLivingConnectionsError extends ElasticsearchClientError {
|
||||
name: string;
|
||||
message: string;
|
||||
meta: ApiResponse;
|
||||
constructor(message: string, meta: ApiResponse);
|
||||
}
|
||||
|
||||
export declare class SerializationError extends ElasticsearchClientError {
|
||||
name: string;
|
||||
message: string;
|
||||
constructor(message: string);
|
||||
}
|
||||
|
||||
export declare class SerializationError extends Error {
|
||||
export declare class DeserializationError extends ElasticsearchClientError {
|
||||
name: string;
|
||||
message: string;
|
||||
constructor(message: string);
|
||||
}
|
||||
|
||||
export declare class DeserializationError extends Error {
|
||||
export declare class ConfigurationError extends ElasticsearchClientError {
|
||||
name: string;
|
||||
message: string;
|
||||
constructor(message: string);
|
||||
}
|
||||
|
||||
export declare class ConfigurationError extends Error {
|
||||
name: string;
|
||||
message: string;
|
||||
constructor(message: string);
|
||||
}
|
||||
|
||||
export declare class ResponseError extends Error {
|
||||
export declare class ResponseError extends ElasticsearchClientError {
|
||||
name: string;
|
||||
message: string;
|
||||
meta: ApiResponse;
|
||||
body: any;
|
||||
statusCode: number;
|
||||
headers: any;
|
||||
constructor({ body, statusCode, headers }: {
|
||||
[key: string]: any;
|
||||
});
|
||||
constructor(meta: ApiResponse);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user