@dynatrace-sdk/client-query 1.15.0 → 1.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/README.md +111 -168
- package/cjs/index.js +316 -128
- package/dynatrace-metadata.json +2 -2
- package/esm/index.js +326 -129
- package/package.json +2 -2
- package/types/packages/client/query/src/lib/apis/query-assistance-api.d.ts +6 -9
- package/types/packages/client/query/src/lib/apis/query-execution-api.d.ts +6 -13
- package/types/packages/client/query/src/lib/error-envelopes/index.d.ts +3 -3
- package/types/packages/client/query/src/lib/models/autocomplete-request.d.ts +3 -0
- package/types/packages/client/query/src/lib/models/autocomplete-suggestion-part.d.ts +4 -2
- package/types/packages/client/query/src/lib/models/dql-container-node.d.ts +1 -1
- package/types/packages/client/query/src/lib/models/dql-container-node.transformation.d.ts +1 -1
- package/types/packages/client/query/src/lib/models/dql-node-node-type.d.ts +2 -0
- package/types/packages/client/query/src/lib/models/dql-node-node-type.transformation.d.ts +3 -4
- package/types/packages/client/query/src/lib/models/dql-node.d.ts +7 -2
- package/types/packages/client/query/src/lib/models/dql-terminal-node.d.ts +4 -2
- package/types/packages/client/query/src/lib/models/error-envelope.d.ts +3 -0
- package/types/packages/client/query/src/lib/models/error-response-details.d.ts +3 -0
- package/types/packages/client/query/src/lib/models/error-response.d.ts +3 -0
- package/types/packages/client/query/src/lib/models/execute-request.d.ts +6 -0
- package/types/packages/client/query/src/lib/models/field-type-type.d.ts +3 -0
- package/types/packages/client/query/src/lib/models/field-type-type.transformation.d.ts +3 -4
- package/types/packages/client/query/src/lib/models/field-type.d.ts +1 -2
- package/types/packages/client/query/src/lib/models/grail-metadata.d.ts +3 -0
- package/types/packages/client/query/src/lib/models/metadata-notification.d.ts +3 -0
- package/types/packages/client/query/src/lib/models/metadata.d.ts +3 -0
- package/types/packages/client/query/src/lib/models/parse-request.d.ts +3 -0
- package/types/packages/client/query/src/lib/models/query-poll-response.d.ts +7 -2
- package/types/packages/client/query/src/lib/models/query-result.d.ts +3 -0
- package/types/packages/client/query/src/lib/models/query-start-response.d.ts +7 -2
- package/types/packages/client/query/src/lib/models/query-state.d.ts +2 -0
- package/types/packages/client/query/src/lib/models/query-state.transformation.d.ts +3 -4
- package/types/packages/client/query/src/lib/models/ranged-field-types.d.ts +3 -0
- package/types/packages/client/query/src/lib/models/token-position.d.ts +6 -0
- package/types/packages/client/query/src/lib/models/token-type.d.ts +2 -0
- package/types/packages/client/query/src/lib/models/token-type.transformation.d.ts +3 -4
- package/types/packages/client/query/src/lib/models/verify-request.d.ts +3 -0
- package/types/packages/client/query/src/lib/utils/encoding.d.ts +10 -0
- package/types/packages/http-client/src/lib/types/binary.d.ts +2 -2
- package/types/packages/http-client/src/lib/types/http-client-response.d.ts +2 -2
- package/types/packages/shared-errors/src/api-client-error.d.ts +13 -1
- package/types/packages/shared-errors/src/api-gateway-error.d.ts +19 -0
- package/types/packages/shared-errors/src/client-request-error.d.ts +29 -0
- package/types/packages/shared-errors/src/index.d.ts +0 -1
- package/types/packages/shared-errors/src/invalid-response-error.d.ts +18 -1
- package/types/packages/shared-errors/src/types.d.ts +62 -5
- package/types/packages/shared-errors/src/sdk-error.d.ts +0 -5
|
@@ -1,10 +1,39 @@
|
|
|
1
1
|
import { HttpClientResponse } from '@dynatrace-sdk/http-client';
|
|
2
2
|
import { ApiClientError } from './api-client-error';
|
|
3
3
|
import { ErrorResponseBody } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* Generic error class for service errors, used to handle both expected and unexpected service-level errors.
|
|
6
|
+
* @example Handling unexpected error response, received by the SDK Client
|
|
7
|
+
* const responseValue = await response.body('json');
|
|
8
|
+
*
|
|
9
|
+
* throw new ClientRequestError(
|
|
10
|
+
* `${response.status}`,
|
|
11
|
+
* response,
|
|
12
|
+
* responseValue,
|
|
13
|
+
* getErrorMessage(
|
|
14
|
+
* responseValue,
|
|
15
|
+
* `Unexpected api response: code=${response.status} body="${responseValue}"`,
|
|
16
|
+
* ),
|
|
17
|
+
* e,
|
|
18
|
+
* );
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
4
21
|
export declare class ClientRequestError<DTO = ErrorResponseBody> extends ApiClientError {
|
|
5
22
|
readonly isClientRequestError = true;
|
|
6
23
|
body: DTO;
|
|
7
24
|
response: HttpClientResponse;
|
|
8
25
|
constructor(name: string, response: HttpClientResponse, body: DTO, message?: string, cause?: any);
|
|
9
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* ClientRequestError type guard function.
|
|
29
|
+
* Does a structural check of the passed object.
|
|
30
|
+
* @example
|
|
31
|
+
* try {
|
|
32
|
+
* doSomething();
|
|
33
|
+
* } catch (e: unknown) {
|
|
34
|
+
* if(isClientRequestError(e)) {
|
|
35
|
+
* handleTheError();
|
|
36
|
+
* }
|
|
37
|
+
* }
|
|
38
|
+
*/
|
|
10
39
|
export declare function isClientRequestError(e: any): e is ClientRequestError;
|
|
@@ -1,9 +1,26 @@
|
|
|
1
1
|
import { ApiClientError } from './api-client-error';
|
|
2
|
+
/**
|
|
3
|
+
* Dedicated error class for errors related to response serialization.
|
|
4
|
+
* Thrown when received service response can't be deserialized.
|
|
5
|
+
**/
|
|
2
6
|
export declare class InvalidResponseError extends ApiClientError {
|
|
3
7
|
readonly isInvalidResponseError = true;
|
|
4
8
|
responseBody: any;
|
|
5
9
|
expectedType?: string;
|
|
6
10
|
nestedError?: Error;
|
|
7
|
-
|
|
11
|
+
response: any;
|
|
12
|
+
constructor(name: string, nestedError: Error | any | undefined, body: any, expectedType?: string, message?: string, response?: any);
|
|
8
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* InvalidResponseError type guard function.
|
|
16
|
+
* Does a structural check of the passed object.
|
|
17
|
+
* @example
|
|
18
|
+
* try {
|
|
19
|
+
* doSomething();
|
|
20
|
+
* } catch (e: unknown) {
|
|
21
|
+
* if (isInvalidResponseError(e)) {
|
|
22
|
+
* throw e;
|
|
23
|
+
* }
|
|
24
|
+
* }
|
|
25
|
+
*/
|
|
9
26
|
export declare function isInvalidResponseError(e: any): e is InvalidResponseError;
|
|
@@ -1,31 +1,88 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Possible serialized error types
|
|
3
|
-
* `COMMON`: Common JS error
|
|
4
|
-
* `HTTP`: Error thrown by a http-client
|
|
5
|
-
*/
|
|
1
|
+
/** @ignore*/
|
|
6
2
|
export declare enum ErrorType {
|
|
7
3
|
COMMON = "JS Error",
|
|
8
4
|
HTTP = "Http Error"
|
|
9
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* Basic error envelope, that enforces all error to have mandatory "error" property.
|
|
8
|
+
* */
|
|
10
9
|
export interface ErrorResponseBody<T = CommonApiError> {
|
|
10
|
+
/**
|
|
11
|
+
* *error* object must have two mandatory fields (*code, message*) and may have two additional fields (*help, details*):
|
|
12
|
+
* refer to the *CommonApiError* for more details.
|
|
13
|
+
* */
|
|
11
14
|
error: T;
|
|
12
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Common API error structure, established by Dynatrace API guidelines.
|
|
18
|
+
* */
|
|
13
19
|
export interface CommonApiError<T extends Record<string, any> = Record<string, any>> {
|
|
20
|
+
/** The error code should be set to the HTTP error code by default.<br>
|
|
21
|
+
* The error code may be set to an API-specific error code which must be properly documented.*/
|
|
14
22
|
code: number;
|
|
23
|
+
/** The error message should be short and precise, it should not contain details.*/
|
|
15
24
|
message: string;
|
|
25
|
+
/**
|
|
26
|
+
* An additional help field may be added which must be a URL to further information on how to deal with the error.<br>
|
|
27
|
+
* This may be some detailed error documentation page or a link to the Dynatrace support system, etc.
|
|
28
|
+
* */
|
|
16
29
|
help?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Additional details about the error may be added in a details field.
|
|
32
|
+
* Refer to *CommonErrorDetails*
|
|
33
|
+
* */
|
|
17
34
|
details?: T;
|
|
18
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* *CommonApiError* details object reference. Contains common API error information.
|
|
38
|
+
* This object is used to convey additional information about the error like e.g., which query parameter exactly violated a precondition. <br>
|
|
39
|
+
* Details may contain any fields to further describe the error
|
|
40
|
+
* */
|
|
19
41
|
export interface CommonErrorDetails {
|
|
42
|
+
/**
|
|
43
|
+
* UUID string that represents a reference of the error into e.g., the log file of the service.
|
|
44
|
+
* */
|
|
20
45
|
errorRef?: string;
|
|
46
|
+
/**
|
|
47
|
+
* String containing a 32-character hex integer value that is used for tracing.
|
|
48
|
+
* */
|
|
21
49
|
traceId?: string;
|
|
50
|
+
/**
|
|
51
|
+
* String value representing a more detailed error information than the http response code alone.
|
|
52
|
+
* Must be a single word in CamelCase, and all possible values must be documented.
|
|
53
|
+
* */
|
|
22
54
|
errorCode?: string;
|
|
55
|
+
/**
|
|
56
|
+
* An array of *ConstraintViolation* object, refer to ConstraintViolation object reference for more details.
|
|
57
|
+
* */
|
|
23
58
|
constraintViolations?: ConstraintViolation[];
|
|
59
|
+
/**
|
|
60
|
+
* Must be an array of strings containing a complete list of missing IAM scopes necessary to successfully execute the request.
|
|
61
|
+
* Should be set if the API returns a 403 - Forbidden response in case of missing OAuth scopes.
|
|
62
|
+
* */
|
|
24
63
|
missingScopes?: string[];
|
|
64
|
+
/**
|
|
65
|
+
* Must be an array of strings containing a complete list of missing IAM permissions necessary to successfully execute the request.
|
|
66
|
+
* Should be set if the API returns a 403 - Forbidden response in case of missing OAuth user permissions.
|
|
67
|
+
* */
|
|
25
68
|
missingPermissions?: string[];
|
|
26
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* Contains information about an input parameter (path, query or request body)
|
|
72
|
+
* that violated some validation rule of the service API and caused the warning.<br>
|
|
73
|
+
* May contain additional fields further describing the warning.
|
|
74
|
+
* */
|
|
27
75
|
export interface ConstraintViolation extends Record<string, string | undefined> {
|
|
76
|
+
/**
|
|
77
|
+
* Mandatory field message describing the warning.
|
|
78
|
+
* */
|
|
28
79
|
message: string;
|
|
80
|
+
/**
|
|
81
|
+
* Describes the general location of the violating parameter (query parameter, request body, etc.)
|
|
82
|
+
*/
|
|
29
83
|
parameterLocation?: string;
|
|
84
|
+
/**
|
|
85
|
+
* Refers to the violating parameter within the parameterLocation.
|
|
86
|
+
*/
|
|
30
87
|
path?: string;
|
|
31
88
|
}
|