Refactored type definitions (#1119)
* Updated types generation script * Refactored api method definitions * Updated test - Removed old test code - Added tsd dev dependency - Rewritten test with tsd * Removed unused dependencies * Fixed definition * Updated test * Updated docs * Improved events type definitions * Updated test * Minor fixes in the type definitons * More type test * Improved Transport type definitions * Updated test * Addressed comments * Code generation * Use RequestBody, Response and Context everywhere, also default Context to unknown * Updated test * body -> hasBody * Fixed conflicts * Updated code generation * Improved request body type definition * Updated code generation * Use BodyType for both request and reponses generics - Use extends for defining the RequestBody generic to force the user following the same shape. - BodyType and NDBodyType now accepts a generics to allow injecting more specific types in the future * API generation * Updated test * Updated docs * Use BodyType also in ReponseError * Removed useless client generics * Renamed generics and types - prefixed all generics with a T - BodyType => RequestBody - NDBodyType => RequestNDBody - Added ResponseBody * Updated test * Updated docs * Test ResponseBody as well * Simplify overloads * API generation * Updated test * Updated error types
This commit is contained in:
committed by
GitHub
parent
a80f510a9a
commit
6c82a4967e
10
lib/errors.d.ts
vendored
10
lib/errors.d.ts
vendored
@ -2,7 +2,7 @@
|
||||
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
|
||||
// See the LICENSE file in the project root for more information
|
||||
|
||||
import { ApiResponse } from './Transport'
|
||||
import { ApiResponse, ResponseBody } from './Transport'
|
||||
|
||||
export declare class ElasticsearchClientError extends Error {
|
||||
name: string;
|
||||
@ -33,8 +33,8 @@ export declare class NoLivingConnectionsError extends ElasticsearchClientError {
|
||||
export declare class SerializationError extends ElasticsearchClientError {
|
||||
name: string;
|
||||
message: string;
|
||||
data: object;
|
||||
constructor(message: string, data: object);
|
||||
data: any;
|
||||
constructor(message: string, data: any);
|
||||
}
|
||||
|
||||
export declare class DeserializationError extends ElasticsearchClientError {
|
||||
@ -54,8 +54,8 @@ export declare class ResponseError extends ElasticsearchClientError {
|
||||
name: string;
|
||||
message: string;
|
||||
meta: ApiResponse;
|
||||
body: any;
|
||||
body: ResponseBody;
|
||||
statusCode: number;
|
||||
headers: any;
|
||||
headers: Record<string, any>;
|
||||
constructor(meta: ApiResponse);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user