@dynatrace-sdk/client-query 1.22.0 → 1.22.1
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 +8 -2
- package/README.md +2 -2
- package/dynatrace-metadata.json +1 -1
- package/package.json +2 -2
- package/types/packages/client/query/src/lib/models/execute-request.d.ts +1 -1
- package/types/packages/http-client/src/index.d.ts +0 -2
- package/types/packages/http-client/src/lib/platform/abort-controller.d.ts +0 -6
- package/types/packages/http-client/src/lib/platform/abort-signal.d.ts +0 -6
- package/types/packages/http-client/src/lib/platform/apply-content-type-header.d.ts +0 -2
- package/types/packages/http-client/src/lib/platform/base-error.d.ts +0 -5
- package/types/packages/http-client/src/lib/platform/binary.d.ts +0 -13
- package/types/packages/http-client/src/lib/platform/data-type-error.d.ts +0 -6
- package/types/packages/http-client/src/lib/platform/decode-form-data.d.ts +0 -48
- package/types/packages/http-client/src/lib/platform/decode-response-body.d.ts +0 -3
- package/types/packages/http-client/src/lib/platform/default-status-validator.d.ts +0 -2
- package/types/packages/http-client/src/lib/platform/encode-request-body.d.ts +0 -2
- package/types/packages/http-client/src/lib/platform/http-client-abort-error.d.ts +0 -7
- package/types/packages/http-client/src/lib/platform/http-client-request-error.d.ts +0 -7
- package/types/packages/http-client/src/lib/platform/http-client-response-error-serializer.d.ts +0 -3
- package/types/packages/http-client/src/lib/platform/http-client-response-error.d.ts +0 -11
- package/types/packages/http-client/src/lib/platform/http-client-response.d.ts +0 -10
- package/types/packages/http-client/src/lib/platform/http-client.d.ts +0 -24
- package/types/packages/http-client/src/lib/platform/index.d.ts +0 -12
- package/types/packages/http-client/src/lib/platform/oauth-http-client.d.ts +0 -41
- package/types/packages/http-client/src/lib/platform/unsupported-operation-error.d.ts +0 -6
- package/types/packages/http-client/src/lib/types/abort-controller.d.ts +0 -14
- package/types/packages/http-client/src/lib/types/abort-signal.d.ts +0 -18
- package/types/packages/http-client/src/lib/types/base-error.d.ts +0 -4
- package/types/packages/http-client/src/lib/types/binary.d.ts +0 -15
- package/types/packages/http-client/src/lib/types/data-type-error.d.ts +0 -14
- package/types/packages/http-client/src/lib/types/data-types.d.ts +0 -36
- package/types/packages/http-client/src/lib/types/form-data-request-body.d.ts +0 -83
- package/types/packages/http-client/src/lib/types/form-data-response-body.d.ts +0 -15
- package/types/packages/http-client/src/lib/types/headers.d.ts +0 -6
- package/types/packages/http-client/src/lib/types/http-client-abort-error.d.ts +0 -15
- package/types/packages/http-client/src/lib/types/http-client-network-error.d.ts +0 -15
- package/types/packages/http-client/src/lib/types/http-client-request-error.d.ts +0 -15
- package/types/packages/http-client/src/lib/types/http-client-request-options.d.ts +0 -42
- package/types/packages/http-client/src/lib/types/http-client-response-error.d.ts +0 -20
- package/types/packages/http-client/src/lib/types/http-client-response.d.ts +0 -33
- package/types/packages/http-client/src/lib/types/http-client.d.ts +0 -24
- package/types/packages/http-client/src/lib/types/index.d.ts +0 -20
- package/types/packages/http-client/src/lib/types/request-body-types.d.ts +0 -26
- package/types/packages/http-client/src/lib/types/response-body-types.d.ts +0 -46
- package/types/packages/http-client/src/lib/types/status-validator.d.ts +0 -7
- package/types/packages/http-client/src/lib/types/unsupported-operation-error.d.ts +0 -14
- package/types/packages/platform/error-handlers/src/index.d.ts +0 -2
- package/types/packages/platform/error-handlers/src/lib/add-global-error-serializer.d.ts +0 -13
- package/types/packages/platform/error-handlers/src/lib/types/common-serialized-error.d.ts +0 -13
- package/types/packages/platform/error-handlers/src/lib/types/dt-runtime-error-handlers.d.ts +0 -5
- package/types/packages/platform/error-handlers/src/lib/types/error-type.d.ts +0 -9
- package/types/packages/platform/error-handlers/src/lib/types/global-dt-runtime-with-error-handlers.d.ts +0 -7
- package/types/packages/platform/error-handlers/src/lib/types/global-error-serializer.d.ts +0 -10
- package/types/packages/platform/error-handlers/src/lib/types/http-serialized-error.d.ts +0 -16
- package/types/packages/platform/error-handlers/src/lib/types/index.d.ts +0 -6
- package/types/packages/platform/error-handlers/src/lib/types/serialized-error.d.ts +0 -10
- package/types/packages/platform/shared/index.d.ts +0 -1
- package/types/packages/platform/shared/utils/get-global-with-dt-runtime.d.ts +0 -1
- package/types/packages/shared-errors/src/api-client-error.d.ts +0 -23
- package/types/packages/shared-errors/src/api-gateway-error.d.ts +0 -37
- package/types/packages/shared-errors/src/client-request-error.d.ts +0 -39
- package/types/packages/shared-errors/src/index.d.ts +0 -5
- package/types/packages/shared-errors/src/invalid-response-error.d.ts +0 -26
- package/types/packages/shared-errors/src/types.d.ts +0 -88
package/CHANGELOG.md
CHANGED
|
@@ -2,11 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
@dynatrace-sdk/client-query
|
|
4
4
|
|
|
5
|
+
## 1.22.1
|
|
6
|
+
|
|
7
|
+
Patch Changes
|
|
8
|
+
- Improve description of query-api spec
|
|
9
|
+
|
|
5
10
|
## 1.22.0
|
|
6
11
|
|
|
7
12
|
### Minor Changes
|
|
8
|
-
|
|
9
|
-
-
|
|
13
|
+
|
|
14
|
+
- Add new token types to the `TokenType` enum
|
|
15
|
+
- Add new body parameter `includeContributions` to indicate whether contribution information should be included in the query response metadata.
|
|
10
16
|
|
|
11
17
|
## 1.21.3
|
|
12
18
|
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @dynatrace-sdk/client-query
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/@dynatrace-sdk/client-query/v/1.22.1)
|
|
4
4
|
[](https://opensource.org/licenses/Apache-2.0)
|
|
5
5
|
|
|
6
6
|
Exposes an API to fetch records stored in Grail
|
|
@@ -914,7 +914,7 @@ Detailed information about the error.
|
|
|
914
914
|
|defaultTimeframeStart|[string](https://developer.mozilla.org/en-US/docs/Glossary/String)|The query timeframe 'start' timestamp in ISO-8601 or RFC3339 format. If the timeframe 'end' parameter is missing, the whole timeframe is ignored. <em>Note that if a timeframe is specified within the query string (query) then it has precedence over this query request parameter.</em> |
|
|
915
915
|
|enablePreview|[boolean](https://developer.mozilla.org/en-US/docs/Glossary/Boolean)|Request preview results. If a preview is available within the requestTimeoutMilliseconds, then it will be returned as part of the response. <i>default:</i> <code>false</code>|
|
|
916
916
|
|enforceQueryConsumptionLimit|[boolean](https://developer.mozilla.org/en-US/docs/Glossary/Boolean)|Boolean to indicate if the query consumption limit should be enforced |
|
|
917
|
-
|fetchTimeoutSeconds|[number](https://developer.mozilla.org/en-US/docs/Glossary/Number)|The time limit for fetching data.
|
|
917
|
+
|fetchTimeoutSeconds|[number](https://developer.mozilla.org/en-US/docs/Glossary/Number)|The time limit for fetching data. It is a soft limit as further data processing can happen. This limit is configurable and subject to default (typically 300s) and maximum (typically 900s) values defined in the query engine. If the specified value exceeds the maximum allowed value, it will be automatically reduced to the maximum. |
|
|
918
918
|
|filterSegments|<a href="#filtersegments" target="_blank" rel="noopener noreferrer">FilterSegments</a>|Represents a collection of filter segments. |
|
|
919
919
|
|includeContributions|[boolean](https://developer.mozilla.org/en-US/docs/Glossary/Boolean)|Indicates whether bucket contribution information should be included in the query response metadata. When set to true, the response will contain details about how each bucket contributed to the query result. <i>default:</i> <code>false</code>|
|
|
920
920
|
|includeTypes|[boolean](https://developer.mozilla.org/en-US/docs/Glossary/Boolean)|Parameter to exclude the type information from the query result. In case not specified, the type information will be included. <i>default:</i> <code>true</code>|
|
package/dynatrace-metadata.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynatrace-sdk/client-query",
|
|
3
|
-
"version": "1.22.
|
|
3
|
+
"version": "1.22.1",
|
|
4
4
|
"description": "Exposes an API to fetch records stored in Grail.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"dependencies": {
|
|
@@ -10,4 +10,4 @@
|
|
|
10
10
|
"main": "./cjs/index.js",
|
|
11
11
|
"module": "./esm/index.js",
|
|
12
12
|
"types": "./types/index.d.ts"
|
|
13
|
-
}
|
|
13
|
+
}
|
|
@@ -26,7 +26,7 @@ export interface ExecuteRequest {
|
|
|
26
26
|
*/
|
|
27
27
|
enforceQueryConsumptionLimit?: boolean;
|
|
28
28
|
/**
|
|
29
|
-
* The time limit for fetching data.
|
|
29
|
+
* The time limit for fetching data. It is a soft limit as further data processing can happen. This limit is configurable and subject to default (typically 300s) and maximum (typically 900s) values defined in the query engine. If the specified value exceeds the maximum allowed value, it will be automatically reduced to the maximum.
|
|
30
30
|
*/
|
|
31
31
|
fetchTimeoutSeconds?: number;
|
|
32
32
|
/**
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export { AbortController, AbortSignal, BaseError, Binary, BinaryFormDataRequestField, BinaryFormDataResponseField, DataTypeError, DataTypes, FormDataRequestBody, FormDataRequestField, FormDataResponseBody, FormDataResponseField, Headers, HttpClient, HttpClientAbortError, HttpClientNetworkError, HttpClientRequestError, HttpClientRequestOptions, HttpClientResponse, HttpClientResponseError, JsonFormDataRequestField, RequestBodyTypes, ResponseBodyTypes, StatusValidator, TextFormDataRequestField, TextFormDataResponseField, UnsupportedOperationError, isHttpClientResponseError, isHttpClientAbortError, isHttpClientNetworkError, isHttpClientRequestError, } from './lib/types';
|
|
2
|
-
export { AbortController as PlatformAbortController, AbortSignal as PlatformAbortSignal, BaseError as PlatformBaseError, Binary as PlatformBinary, DataTypeError as PlatformDataTypeError, HttpClient as PlatformHttpClient, HttpClientAbortError as PlatformHttpClientAbortError, HttpClientRequestError as PlatformHttpClientRequestError, HttpClientResponse as PlatformHttpClientResponse, HttpClientResponseError as PlatformHttpClientResponseError, OAuthHttpClient as _OAuthHttpClient, OAuthHttpClientConfig as _OAuthHttpClientConfig, UnsupportedOperationError as PlatformUnsupportedOperationError, httpClient, } from './lib/platform';
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
import type * as stream from 'stream';
|
|
4
|
-
import * as types from '../types';
|
|
5
|
-
export declare class Binary implements types.Binary {
|
|
6
|
-
readonly data: Blob | ArrayBuffer | ReadableStream<Uint8Array>;
|
|
7
|
-
static fromText(text: string): Binary;
|
|
8
|
-
static fromJson(json: any): Binary;
|
|
9
|
-
static from(data: Blob | ArrayBuffer | ReadableStream<Uint8Array> | Buffer | stream.Readable): Binary;
|
|
10
|
-
private constructor();
|
|
11
|
-
get<T extends keyof types.DataTypes>(type: T): types.DataTypes[T];
|
|
12
|
-
}
|
|
13
|
-
export declare function isBinary(body: any): body is Binary;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
export declare function isTextContentType(contentType: string): boolean;
|
|
2
|
-
export declare function parseContentDisposition(contentDisposition: string): {
|
|
3
|
-
name: string;
|
|
4
|
-
fileName: string | undefined;
|
|
5
|
-
};
|
|
6
|
-
export declare function parseFormDataBoundary(contentType: string): string | undefined;
|
|
7
|
-
export interface FormDataSection {
|
|
8
|
-
name: string;
|
|
9
|
-
headers: Record<string, string>;
|
|
10
|
-
rawData: Uint8Array;
|
|
11
|
-
text?: string;
|
|
12
|
-
file?: File;
|
|
13
|
-
fileName?: string;
|
|
14
|
-
payloadStartOffset?: number;
|
|
15
|
-
payloadEndOffset?: number;
|
|
16
|
-
headersStartOffset?: number;
|
|
17
|
-
}
|
|
18
|
-
export declare class FormDataParser {
|
|
19
|
-
private sourceArray;
|
|
20
|
-
private boundary;
|
|
21
|
-
private currentChar;
|
|
22
|
-
private currentByte;
|
|
23
|
-
offset: number;
|
|
24
|
-
private utf8Decoder;
|
|
25
|
-
constructor(sourceArray: Uint8Array, boundary: string);
|
|
26
|
-
get previousByte(): number | undefined;
|
|
27
|
-
get previousChar(): string | undefined;
|
|
28
|
-
private next;
|
|
29
|
-
charAt(offset: number): string | null;
|
|
30
|
-
nextChar(): string | null;
|
|
31
|
-
nextByte(): number | null;
|
|
32
|
-
get nextTwoChars(): string;
|
|
33
|
-
findNextBoundaryOffset(startOffset?: number): number | null;
|
|
34
|
-
skipPastNextBoundary(): boolean;
|
|
35
|
-
readLine(): Uint8Array | null;
|
|
36
|
-
readSectionHeaders(): {
|
|
37
|
-
headersLength: number;
|
|
38
|
-
headers: Record<string, string>;
|
|
39
|
-
};
|
|
40
|
-
extractData(): {
|
|
41
|
-
payloadStartOffset: number;
|
|
42
|
-
payloadEndOffset: number;
|
|
43
|
-
data: Uint8Array;
|
|
44
|
-
};
|
|
45
|
-
parse(): FormDataSection[];
|
|
46
|
-
}
|
|
47
|
-
export declare function isAppleBrowser(): boolean;
|
|
48
|
-
export declare function parseMultipartFormDataResponse(response: Uint8Array, boundary: string): FormDataSection[];
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import * as types from '../types';
|
|
2
|
-
export declare class HttpClientAbortError extends Error implements types.HttpClientAbortError {
|
|
3
|
-
readonly cause: any;
|
|
4
|
-
readonly name = "AbortError";
|
|
5
|
-
constructor(cause: any);
|
|
6
|
-
}
|
|
7
|
-
export declare const throwIfAbortError: (e: unknown) => void;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import * as types from '../types';
|
|
2
|
-
import { BaseError } from './base-error';
|
|
3
|
-
export declare class HttpClientRequestError extends BaseError implements types.HttpClientRequestError {
|
|
4
|
-
readonly cause: any;
|
|
5
|
-
readonly name = "RequestError";
|
|
6
|
-
constructor(cause: any);
|
|
7
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import * as types from '../types';
|
|
2
|
-
import { HttpClientResponse } from './http-client-response';
|
|
3
|
-
import { BaseError } from './base-error';
|
|
4
|
-
export declare class HttpClientResponseError extends BaseError implements types.HttpClientResponseError {
|
|
5
|
-
readonly name = "ResponseError";
|
|
6
|
-
readonly response: HttpClientResponse;
|
|
7
|
-
readonly requestMethod?: string;
|
|
8
|
-
constructor(response: Response, data?: {
|
|
9
|
-
requestMethod?: string;
|
|
10
|
-
});
|
|
11
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import * as types from '../types';
|
|
2
|
-
export declare class HttpClientResponse implements types.HttpClientResponse {
|
|
3
|
-
private response;
|
|
4
|
-
constructor(response: Response);
|
|
5
|
-
get url(): string;
|
|
6
|
-
get status(): number;
|
|
7
|
-
get statusText(): string;
|
|
8
|
-
get headers(): types.Headers;
|
|
9
|
-
body<T extends keyof types.ResponseBodyTypes = 'json'>(responseBodyType?: T): types.ResponseBodyTypes[T];
|
|
10
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import * as types from '../types';
|
|
2
|
-
import { Headers } from '../types';
|
|
3
|
-
interface HttpClientConfiguration {
|
|
4
|
-
baseUrl?: string;
|
|
5
|
-
defaultHeaders?: Headers;
|
|
6
|
-
}
|
|
7
|
-
export declare class HttpClient implements types.HttpClient {
|
|
8
|
-
private _baseUrl;
|
|
9
|
-
private _defaultHeaders;
|
|
10
|
-
constructor(options?: HttpClientConfiguration);
|
|
11
|
-
/**
|
|
12
|
-
* Sets HTTP Client Instance baseUrl param to the incoming value `baseUrl`.
|
|
13
|
-
* @param baseUrl Base URL used in the request path.
|
|
14
|
-
*/
|
|
15
|
-
_setBaseURL(baseUrl: string): void;
|
|
16
|
-
/**
|
|
17
|
-
* Sets HTTP Client Instance defaultHeaders param to the incoming value `defaultHeaders`.
|
|
18
|
-
* @param defaultHeaders HTTP Headers to be used in outgoing requests.
|
|
19
|
-
*/
|
|
20
|
-
_setDefaultHeaders(defaultHeaders: Headers): void;
|
|
21
|
-
send<T extends keyof types.RequestBodyTypes = 'json'>(options: types.HttpClientRequestOptions<T>): Promise<types.HttpClientResponse>;
|
|
22
|
-
}
|
|
23
|
-
export declare const httpClient: HttpClient;
|
|
24
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export * from './abort-controller';
|
|
2
|
-
export * from './abort-signal';
|
|
3
|
-
export * from './base-error';
|
|
4
|
-
export * from './binary';
|
|
5
|
-
export * from './data-type-error';
|
|
6
|
-
export * from './http-client';
|
|
7
|
-
export * from './http-client-abort-error';
|
|
8
|
-
export * from './http-client-request-error';
|
|
9
|
-
export * from './http-client-response';
|
|
10
|
-
export * from './http-client-response-error';
|
|
11
|
-
export * from './oauth-http-client';
|
|
12
|
-
export * from './unsupported-operation-error';
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import * as types from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* DO NOT USE - internal use only.
|
|
4
|
-
*/
|
|
5
|
-
export interface OAuthHttpClientConfig {
|
|
6
|
-
clientId: string;
|
|
7
|
-
secret: string;
|
|
8
|
-
scopes: string[];
|
|
9
|
-
environmentUrl: string;
|
|
10
|
-
authUrl: string;
|
|
11
|
-
}
|
|
12
|
-
export interface OAuthTokenResponse {
|
|
13
|
-
scope: string;
|
|
14
|
-
token_type: string;
|
|
15
|
-
expires_in: number;
|
|
16
|
-
access_token: string;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* DO NOT USE - internal use only.
|
|
20
|
-
*/
|
|
21
|
-
export declare class OAuthToken {
|
|
22
|
-
private readonly _scope;
|
|
23
|
-
private readonly _tokenType;
|
|
24
|
-
private readonly _expirationDate;
|
|
25
|
-
private readonly _accessToken;
|
|
26
|
-
constructor(oauthTokenResponse: OAuthTokenResponse);
|
|
27
|
-
get scope(): string;
|
|
28
|
-
get tokenType(): string;
|
|
29
|
-
isExpired(): boolean;
|
|
30
|
-
get accessToken(): string;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* DO NOT USE - internal use only.
|
|
34
|
-
*/
|
|
35
|
-
export declare class OAuthHttpClient implements types.HttpClient {
|
|
36
|
-
private readonly config;
|
|
37
|
-
private oauthToken?;
|
|
38
|
-
constructor(config: OAuthHttpClientConfig);
|
|
39
|
-
send<T extends keyof types.RequestBodyTypes = 'json'>(options: types.HttpClientRequestOptions<T>): Promise<types.HttpClientResponse>;
|
|
40
|
-
private requestToken;
|
|
41
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import * as types from '../types';
|
|
2
|
-
import { BaseError } from './base-error';
|
|
3
|
-
export declare class UnsupportedOperationError extends BaseError implements types.UnsupportedOperationError {
|
|
4
|
-
readonly name = "UnsupportedOperationError";
|
|
5
|
-
constructor(message: string, cause?: any);
|
|
6
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { AbortSignal } from './abort-signal';
|
|
2
|
-
/**
|
|
3
|
-
* Represents a controller object that allows to abort one or more requests as and when desired.
|
|
4
|
-
*/
|
|
5
|
-
export interface AbortController {
|
|
6
|
-
/**
|
|
7
|
-
* Aborts a request before it has completed.
|
|
8
|
-
*/
|
|
9
|
-
abort(): void;
|
|
10
|
-
/**
|
|
11
|
-
* Returns an AbortSignal object instance, which can be used to communicate with a request.
|
|
12
|
-
*/
|
|
13
|
-
signal: AbortSignal;
|
|
14
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents a signal object that allows to communicate with the request and abort it using the `AbortController`.
|
|
3
|
-
* @deprecated Will be removed from HttpClient. We encourage using native interface for AbortSignal.
|
|
4
|
-
*/
|
|
5
|
-
interface HttpClientAbortSignal extends EventTarget {
|
|
6
|
-
readonly reason: any;
|
|
7
|
-
throwIfAborted(): void;
|
|
8
|
-
/**
|
|
9
|
-
* A flag indicating whether the requests the signal is communicating with are aborted.
|
|
10
|
-
*/
|
|
11
|
-
readonly aborted: boolean;
|
|
12
|
-
/**
|
|
13
|
-
* Invoked when the requests the signal is communicating with are aborted.
|
|
14
|
-
*/
|
|
15
|
-
onabort: ((this: AbortSignal, event: Event) => void) | null;
|
|
16
|
-
}
|
|
17
|
-
export type AbortSignal = HttpClientAbortSignal | globalThis.AbortSignal;
|
|
18
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { DataTypes } from './data-types';
|
|
2
|
-
/**
|
|
3
|
-
* Represents an environment agnostic (browser vs node) abstraction layer for binary data.
|
|
4
|
-
*/
|
|
5
|
-
export interface Binary {
|
|
6
|
-
/**
|
|
7
|
-
* Returns the binary data in a form that conforms to the specified type.
|
|
8
|
-
*
|
|
9
|
-
* @param type The type of the data.
|
|
10
|
-
* Can be `text`, `json`, `array-buffer`, `blob`, `readable-stream`, `buffer` or `stream`.
|
|
11
|
-
* @throws {DataTypeError} Data does not conform to the specified type.
|
|
12
|
-
* @throws {UnsupportedOperationError} Type is not supported by the platform.
|
|
13
|
-
*/
|
|
14
|
-
get<T extends keyof DataTypes>(type: T): DataTypes[T];
|
|
15
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents a situation when the response body does not conform to the specified response body type.
|
|
3
|
-
*/
|
|
4
|
-
import { BaseError } from './base-error';
|
|
5
|
-
export interface DataTypeError extends BaseError {
|
|
6
|
-
/**
|
|
7
|
-
* The error name.
|
|
8
|
-
*/
|
|
9
|
-
readonly name: 'DataTypeError';
|
|
10
|
-
/**
|
|
11
|
-
* The error root cause.
|
|
12
|
-
*/
|
|
13
|
-
readonly cause?: any;
|
|
14
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
import type * as stream from 'stream';
|
|
4
|
-
/**
|
|
5
|
-
* Mapping between the data type names and types.
|
|
6
|
-
*/
|
|
7
|
-
export type DataTypes = {
|
|
8
|
-
/**
|
|
9
|
-
* A text type.
|
|
10
|
-
*/
|
|
11
|
-
text: Promise<string>;
|
|
12
|
-
/**
|
|
13
|
-
* A JSON type.
|
|
14
|
-
*/
|
|
15
|
-
json: Promise<any>;
|
|
16
|
-
/**
|
|
17
|
-
* An ArrayBuffer type.
|
|
18
|
-
*/
|
|
19
|
-
'array-buffer': Promise<ArrayBuffer>;
|
|
20
|
-
/**
|
|
21
|
-
* A Blob type. Browser only.
|
|
22
|
-
*/
|
|
23
|
-
blob: Promise<Blob>;
|
|
24
|
-
/**
|
|
25
|
-
* A ReadableStream type. Browser only.
|
|
26
|
-
*/
|
|
27
|
-
'readable-stream': ReadableStream<Uint8Array>;
|
|
28
|
-
/**
|
|
29
|
-
* A Buffer type. Node only.
|
|
30
|
-
*/
|
|
31
|
-
buffer: Promise<Buffer>;
|
|
32
|
-
/**
|
|
33
|
-
* A Stream type. Node only.
|
|
34
|
-
*/
|
|
35
|
-
stream: stream.Readable;
|
|
36
|
-
};
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
import type * as stream from 'stream';
|
|
4
|
-
import { Binary } from './binary';
|
|
5
|
-
/**
|
|
6
|
-
* Represents a plain text field. No filename and content type is set.
|
|
7
|
-
*/
|
|
8
|
-
export interface TextFormDataRequestField {
|
|
9
|
-
/**
|
|
10
|
-
* A plain text field type discriminator.
|
|
11
|
-
*/
|
|
12
|
-
type: 'text';
|
|
13
|
-
/**
|
|
14
|
-
* The name of the field.
|
|
15
|
-
*/
|
|
16
|
-
name: string;
|
|
17
|
-
/**
|
|
18
|
-
* The field's value.
|
|
19
|
-
*/
|
|
20
|
-
value: string;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Represents a JSON field.
|
|
24
|
-
*/
|
|
25
|
-
export interface JsonFormDataRequestField {
|
|
26
|
-
/**
|
|
27
|
-
* A JSON field type discriminator.
|
|
28
|
-
*/
|
|
29
|
-
type: 'json';
|
|
30
|
-
/**
|
|
31
|
-
* The name of the field.
|
|
32
|
-
*/
|
|
33
|
-
name: string;
|
|
34
|
-
/**
|
|
35
|
-
* The content type of the data contained in `value`.
|
|
36
|
-
* The default content type for the JSON is 'application/json'.
|
|
37
|
-
*/
|
|
38
|
-
contentType?: string;
|
|
39
|
-
/**
|
|
40
|
-
* The filename reported to the server.
|
|
41
|
-
* The default filename for the JSON is 'json'.
|
|
42
|
-
*/
|
|
43
|
-
filename?: string;
|
|
44
|
-
/**
|
|
45
|
-
* The field's value.
|
|
46
|
-
*/
|
|
47
|
-
value: any;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Represents an binary field.
|
|
51
|
-
*/
|
|
52
|
-
export interface BinaryFormDataRequestField {
|
|
53
|
-
/**
|
|
54
|
-
* A binary field type discriminator.
|
|
55
|
-
*/
|
|
56
|
-
type: 'binary';
|
|
57
|
-
/**
|
|
58
|
-
* The name of the field.
|
|
59
|
-
*/
|
|
60
|
-
name: string;
|
|
61
|
-
/**
|
|
62
|
-
* The content type of the data contained in `value`.
|
|
63
|
-
* The default content type for the binary is 'application/octet-stream'.
|
|
64
|
-
*/
|
|
65
|
-
contentType?: string;
|
|
66
|
-
/**
|
|
67
|
-
* The filename reported to the server.
|
|
68
|
-
* The default filename for the binary is 'binary'.
|
|
69
|
-
*/
|
|
70
|
-
filename?: string;
|
|
71
|
-
/**
|
|
72
|
-
* The field's value.
|
|
73
|
-
*/
|
|
74
|
-
value: ArrayBuffer | Blob | ReadableStream | Buffer | stream.Readable | Binary | File;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Represents a multipart/form-data field.
|
|
78
|
-
*/
|
|
79
|
-
export type FormDataRequestField = TextFormDataRequestField | JsonFormDataRequestField | BinaryFormDataRequestField;
|
|
80
|
-
/**
|
|
81
|
-
* Represents a multipart/form-data body.
|
|
82
|
-
*/
|
|
83
|
-
export type FormDataRequestBody = Array<FormDataRequestField>;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Binary } from './binary';
|
|
2
|
-
export interface TextFormDataResponseField {
|
|
3
|
-
type: 'text';
|
|
4
|
-
name: string;
|
|
5
|
-
value: string;
|
|
6
|
-
}
|
|
7
|
-
export interface BinaryFormDataResponseField {
|
|
8
|
-
type: 'binary';
|
|
9
|
-
name: string;
|
|
10
|
-
contentType: string;
|
|
11
|
-
filename: string;
|
|
12
|
-
value: Binary;
|
|
13
|
-
}
|
|
14
|
-
export type FormDataResponseField = TextFormDataResponseField | BinaryFormDataResponseField;
|
|
15
|
-
export type FormDataResponseBody = Array<FormDataResponseField>;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { BaseError } from './base-error';
|
|
2
|
-
/**
|
|
3
|
-
* Represents a situation when the request was aborted.
|
|
4
|
-
*/
|
|
5
|
-
export interface HttpClientAbortError extends BaseError {
|
|
6
|
-
/**
|
|
7
|
-
* The error name.
|
|
8
|
-
*/
|
|
9
|
-
readonly name: 'AbortError';
|
|
10
|
-
/**
|
|
11
|
-
* The error root cause.
|
|
12
|
-
*/
|
|
13
|
-
readonly cause?: any;
|
|
14
|
-
}
|
|
15
|
-
export declare function isHttpClientAbortError(e: any): e is HttpClientAbortError;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { BaseError } from './base-error';
|
|
2
|
-
/**
|
|
3
|
-
* Represents a situation when a network error occurred.
|
|
4
|
-
*/
|
|
5
|
-
export interface HttpClientNetworkError extends BaseError {
|
|
6
|
-
/**
|
|
7
|
-
* The error name.
|
|
8
|
-
*/
|
|
9
|
-
readonly name: 'NetworkError';
|
|
10
|
-
/**
|
|
11
|
-
* The error root cause.
|
|
12
|
-
*/
|
|
13
|
-
readonly cause?: any;
|
|
14
|
-
}
|
|
15
|
-
export declare function isHttpClientNetworkError(e: any): e is HttpClientNetworkError;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { BaseError } from './base-error';
|
|
2
|
-
/**
|
|
3
|
-
* Represents a situation when the request is invalid and cannot be sent.
|
|
4
|
-
*/
|
|
5
|
-
export interface HttpClientRequestError extends BaseError {
|
|
6
|
-
/**
|
|
7
|
-
* The error name.
|
|
8
|
-
*/
|
|
9
|
-
readonly name: 'RequestError';
|
|
10
|
-
/**
|
|
11
|
-
* The error root cause.
|
|
12
|
-
*/
|
|
13
|
-
readonly cause?: any;
|
|
14
|
-
}
|
|
15
|
-
export declare function isHttpClientRequestError(e: any): e is HttpClientRequestError;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { RequestBodyTypes } from './request-body-types';
|
|
2
|
-
import { Headers } from './headers';
|
|
3
|
-
import { AbortSignal } from './abort-signal';
|
|
4
|
-
import { StatusValidator } from './status-validator';
|
|
5
|
-
/**
|
|
6
|
-
* Represents the options used to configure the request.
|
|
7
|
-
*/
|
|
8
|
-
export interface HttpClientRequestOptions<T extends keyof RequestBodyTypes = 'json'> {
|
|
9
|
-
/**
|
|
10
|
-
* The URL of the resource to fetch.
|
|
11
|
-
*/
|
|
12
|
-
url: string;
|
|
13
|
-
/**
|
|
14
|
-
* The request method, e.g. `GET`, `POST`.
|
|
15
|
-
*/
|
|
16
|
-
method?: string;
|
|
17
|
-
/**
|
|
18
|
-
* The request headers.
|
|
19
|
-
*/
|
|
20
|
-
headers?: Headers;
|
|
21
|
-
/**
|
|
22
|
-
* A request body that will be send along with the request.
|
|
23
|
-
* The structure of the request body needs to conform to the specified request body type.
|
|
24
|
-
*/
|
|
25
|
-
body?: RequestBodyTypes[T];
|
|
26
|
-
/**
|
|
27
|
-
* The type of the request body. Can be `text`, `json`, `binary` or `form-data`.
|
|
28
|
-
* The default request body type is `json`.
|
|
29
|
-
*/
|
|
30
|
-
requestBodyType?: T;
|
|
31
|
-
/**
|
|
32
|
-
* An AbortSignal instance that can be used to cancel the request.
|
|
33
|
-
*/
|
|
34
|
-
abortSignal?: AbortSignal;
|
|
35
|
-
/**
|
|
36
|
-
* A custom status validator function.
|
|
37
|
-
* If the status validator function returns `true` the returned promise resolves with the `HttpClientResponse`
|
|
38
|
-
* Otherwise the promise rejects with the `StatusError`.
|
|
39
|
-
* The default status validator function considers the `2xx` status codes as valid.
|
|
40
|
-
*/
|
|
41
|
-
statusValidator?: StatusValidator;
|
|
42
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { HttpClientResponse } from './http-client-response';
|
|
2
|
-
import { BaseError } from './base-error';
|
|
3
|
-
/**
|
|
4
|
-
* Represents a situation when the response status is considered invalid by the status validator.
|
|
5
|
-
*/
|
|
6
|
-
export interface HttpClientResponseError extends BaseError {
|
|
7
|
-
/**
|
|
8
|
-
* The error name.
|
|
9
|
-
*/
|
|
10
|
-
readonly name: 'ResponseError';
|
|
11
|
-
/**
|
|
12
|
-
* The error root cause.
|
|
13
|
-
*/
|
|
14
|
-
readonly cause?: any;
|
|
15
|
-
/**
|
|
16
|
-
* The response.
|
|
17
|
-
*/
|
|
18
|
-
readonly response: HttpClientResponse;
|
|
19
|
-
}
|
|
20
|
-
export declare function isHttpClientResponseError(e: any): e is HttpClientResponseError;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { ResponseBodyTypes } from './response-body-types';
|
|
2
|
-
import { Headers } from './headers';
|
|
3
|
-
/**
|
|
4
|
-
* Represents the response to a request.
|
|
5
|
-
*/
|
|
6
|
-
export interface HttpClientResponse {
|
|
7
|
-
/**
|
|
8
|
-
* The URL of the response.
|
|
9
|
-
*/
|
|
10
|
-
readonly url: string;
|
|
11
|
-
/**
|
|
12
|
-
* The status code of the response.
|
|
13
|
-
*/
|
|
14
|
-
readonly status: number;
|
|
15
|
-
/**
|
|
16
|
-
* The status message corresponding to the status code.
|
|
17
|
-
*/
|
|
18
|
-
readonly statusText: string;
|
|
19
|
-
/**
|
|
20
|
-
* The response headers.
|
|
21
|
-
*/
|
|
22
|
-
readonly headers: Headers;
|
|
23
|
-
/**
|
|
24
|
-
* Returns the response body in a form that conforms to the specified response body type.
|
|
25
|
-
*
|
|
26
|
-
* @param responseBodyType The type of the response body.
|
|
27
|
-
* Can be `text`, `json`, `binary`, `form-data`, `array-buffer`, `blob`, `readable-stream`, `buffer` or `stream`.
|
|
28
|
-
* The default response body type is `json`.
|
|
29
|
-
* @throws {DataTypeError} Response body does not conform to the specified response body type.
|
|
30
|
-
* @throws {UnsupportedOperationError} Response body type is not supported by the platform.
|
|
31
|
-
*/
|
|
32
|
-
body<T extends keyof ResponseBodyTypes = 'json'>(responseBodyType?: T): ResponseBodyTypes[T];
|
|
33
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { RequestBodyTypes } from './request-body-types';
|
|
2
|
-
import { HttpClientRequestOptions } from './http-client-request-options';
|
|
3
|
-
import { HttpClientResponse } from './http-client-response';
|
|
4
|
-
/**
|
|
5
|
-
* The http client that serves as an environment agnostic (browser vs node) abstraction for making http calls.
|
|
6
|
-
* It handles the authentication of the requests made to the Platform Services and the Serverless Functions.
|
|
7
|
-
*
|
|
8
|
-
* Currently, only the requests to the Platform Services and the Serverless Functions are supported.
|
|
9
|
-
*/
|
|
10
|
-
export interface HttpClient {
|
|
11
|
-
/**
|
|
12
|
-
* Sends an http request as configured by the `options`.
|
|
13
|
-
* Returns a promise that resolves with a response object for successful requests or rejects with an appropriate error
|
|
14
|
-
* when one of the following situations happen:
|
|
15
|
-
* - `DataTypeError` - request body does not conform to the specified request body type,
|
|
16
|
-
* - `HttpClientRequestError` - request cannot be sent (e.g. due to network error or invalid request),
|
|
17
|
-
* - `HttpClientResponseError` - response status is considered invalid by the status validator,
|
|
18
|
-
* - `HttpClientAbortError` - request was aborted.
|
|
19
|
-
*
|
|
20
|
-
* @param options Options used to configure the request.
|
|
21
|
-
* @return Promise<HttpClientResponse> A promise that resolves with the response object or rejects with an error.
|
|
22
|
-
*/
|
|
23
|
-
send<T extends keyof RequestBodyTypes = 'json'>(options: HttpClientRequestOptions<T>): Promise<HttpClientResponse>;
|
|
24
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export * from './base-error';
|
|
2
|
-
export * from './http-client-request-error';
|
|
3
|
-
export * from './unsupported-operation-error';
|
|
4
|
-
export * from './status-validator';
|
|
5
|
-
export * from './response-body-types';
|
|
6
|
-
export * from './http-client';
|
|
7
|
-
export * from './http-client-response';
|
|
8
|
-
export * from './data-types';
|
|
9
|
-
export * from './http-client-request-options';
|
|
10
|
-
export * from './http-client-abort-error';
|
|
11
|
-
export * from './abort-controller';
|
|
12
|
-
export * from './form-data-response-body';
|
|
13
|
-
export * from './abort-signal';
|
|
14
|
-
export * from './http-client-response-error';
|
|
15
|
-
export * from './form-data-request-body';
|
|
16
|
-
export * from './binary';
|
|
17
|
-
export * from './headers';
|
|
18
|
-
export * from './request-body-types';
|
|
19
|
-
export * from './data-type-error';
|
|
20
|
-
export * from './http-client-network-error';
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
import { FormDataRequestBody } from './form-data-request-body';
|
|
4
|
-
import type * as stream from 'stream';
|
|
5
|
-
import { Binary } from './binary';
|
|
6
|
-
/**
|
|
7
|
-
* Mapping between the request body type names and types.
|
|
8
|
-
*/
|
|
9
|
-
export type RequestBodyTypes = {
|
|
10
|
-
/**
|
|
11
|
-
* A text request body type.
|
|
12
|
-
*/
|
|
13
|
-
text: string;
|
|
14
|
-
/**
|
|
15
|
-
* A JSON request body type.
|
|
16
|
-
*/
|
|
17
|
-
json: any;
|
|
18
|
-
/**
|
|
19
|
-
* A multipart/form-data request body type.
|
|
20
|
-
*/
|
|
21
|
-
'form-data': FormDataRequestBody;
|
|
22
|
-
/**
|
|
23
|
-
* A binary request body type.
|
|
24
|
-
*/
|
|
25
|
-
binary: Binary | ArrayBuffer | Blob | ReadableStream | Buffer | stream.Readable;
|
|
26
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
import type * as stream from 'stream';
|
|
4
|
-
import { FormDataResponseBody } from './form-data-response-body';
|
|
5
|
-
import { Binary } from './binary';
|
|
6
|
-
/**
|
|
7
|
-
* Mapping between the response body type names and types.
|
|
8
|
-
*/
|
|
9
|
-
export type ResponseBodyTypes = {
|
|
10
|
-
/**
|
|
11
|
-
* A text response body type.
|
|
12
|
-
*/
|
|
13
|
-
text: Promise<string>;
|
|
14
|
-
/**
|
|
15
|
-
* A JSON response body type.
|
|
16
|
-
*/
|
|
17
|
-
json: Promise<any>;
|
|
18
|
-
/**
|
|
19
|
-
* A binary body type.
|
|
20
|
-
*/
|
|
21
|
-
binary: Promise<Binary>;
|
|
22
|
-
/**
|
|
23
|
-
* A multipart/form-data body type.
|
|
24
|
-
*/
|
|
25
|
-
'form-data': Promise<FormDataResponseBody>;
|
|
26
|
-
/**
|
|
27
|
-
* An ArrayBuffer response body type.
|
|
28
|
-
*/
|
|
29
|
-
'array-buffer': Promise<ArrayBuffer>;
|
|
30
|
-
/**
|
|
31
|
-
* A Blob response body type. Browser only.
|
|
32
|
-
*/
|
|
33
|
-
blob: Promise<Blob>;
|
|
34
|
-
/**
|
|
35
|
-
* A ReadableStream response body type. Browser only.
|
|
36
|
-
*/
|
|
37
|
-
'readable-stream': ReadableStream<Uint8Array>;
|
|
38
|
-
/**
|
|
39
|
-
* A Buffer response body type. Node only.
|
|
40
|
-
*/
|
|
41
|
-
buffer: Promise<Buffer>;
|
|
42
|
-
/**
|
|
43
|
-
* A Stream response body type. Node only.
|
|
44
|
-
*/
|
|
45
|
-
stream: stream.Readable;
|
|
46
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents a function used to validate the response status code.
|
|
3
|
-
* If `true` is returned, the status is considered valid (request succeeded), otherwise it's considered invalid (request failed).
|
|
4
|
-
*/
|
|
5
|
-
export interface StatusValidator {
|
|
6
|
-
(status: number): boolean;
|
|
7
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents a situation when the requested operation is not supported.
|
|
3
|
-
*/
|
|
4
|
-
import { BaseError } from './base-error';
|
|
5
|
-
export interface UnsupportedOperationError extends BaseError {
|
|
6
|
-
/**
|
|
7
|
-
* The error name.
|
|
8
|
-
*/
|
|
9
|
-
readonly name: 'UnsupportedOperationError';
|
|
10
|
-
/**
|
|
11
|
-
* The error root cause.
|
|
12
|
-
*/
|
|
13
|
-
readonly cause?: any;
|
|
14
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { GlobalErrorSerializer } from './types/global-error-serializer';
|
|
2
|
-
/**
|
|
3
|
-
* Registers a global error serializer for handling uncatched errors.
|
|
4
|
-
*
|
|
5
|
-
* @param {GlobalErrorSerializer} serializer Asynchronous function which serializes error if it match the condition
|
|
6
|
-
*/
|
|
7
|
-
export declare function addGlobalErrorSerializer(serializer: GlobalErrorSerializer): void;
|
|
8
|
-
/**
|
|
9
|
-
* Checks if global error serializer is supported.
|
|
10
|
-
*
|
|
11
|
-
* @return {boolean} information if global error serializer is supported on current environment.
|
|
12
|
-
*/
|
|
13
|
-
export declare function isGlobalErrorSerializerSupported(): boolean;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ErrorType } from './error-type';
|
|
2
|
-
/**
|
|
3
|
-
* Common serialized JS Error
|
|
4
|
-
*/
|
|
5
|
-
export interface CommonSerializedError {
|
|
6
|
-
name: string;
|
|
7
|
-
message: string;
|
|
8
|
-
stack?: string;
|
|
9
|
-
type: ErrorType.COMMON;
|
|
10
|
-
errorRef?: string;
|
|
11
|
-
cause?: any;
|
|
12
|
-
details?: any;
|
|
13
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { SerializedError } from './serialized-error';
|
|
2
|
-
/**
|
|
3
|
-
* Custom error serializing function.
|
|
4
|
-
* Should check the received error and, when the error matches, return a serialized error with the specified error type.
|
|
5
|
-
* Otherwise, nothing should be returned so that the error can be handled further.
|
|
6
|
-
*
|
|
7
|
-
* @param {any} error Error to be serialized
|
|
8
|
-
* @returns {TypedError | undefined} Serialized error or nothing
|
|
9
|
-
*/
|
|
10
|
-
export type GlobalErrorSerializer = (error: any) => Promise<SerializedError | undefined>;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { ErrorType } from './error-type';
|
|
2
|
-
/**
|
|
3
|
-
* Serialized http exception with response status
|
|
4
|
-
*/
|
|
5
|
-
export interface HttpSerializedError {
|
|
6
|
-
name: string;
|
|
7
|
-
message: string;
|
|
8
|
-
stack?: string;
|
|
9
|
-
type: ErrorType.HTTP;
|
|
10
|
-
status: number;
|
|
11
|
-
/** @deprecated */
|
|
12
|
-
body?: unknown;
|
|
13
|
-
errorRef?: string;
|
|
14
|
-
cause?: any;
|
|
15
|
-
details?: any;
|
|
16
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { CommonSerializedError } from './common-serialized-error';
|
|
2
|
-
import { HttpSerializedError } from './http-serialized-error';
|
|
3
|
-
/**
|
|
4
|
-
* Serialized error object contains error type
|
|
5
|
-
*
|
|
6
|
-
* @property {ErrorType} type error type
|
|
7
|
-
*/
|
|
8
|
-
export type SerializedError = (HttpSerializedError | CommonSerializedError) & {
|
|
9
|
-
traceId?: string;
|
|
10
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './utils/get-global-with-dt-runtime';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const getGlobalWithDtRuntime: <T extends typeof globalThis>() => T;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ErrorType } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Base error for all client SDKs. All other errors extend this class.
|
|
4
|
-
*/
|
|
5
|
-
export declare class ApiClientError extends Error {
|
|
6
|
-
readonly cause?: any;
|
|
7
|
-
readonly isApiClientError = true;
|
|
8
|
-
errorType: ErrorType;
|
|
9
|
-
constructor(name: string, message?: string, cause?: any);
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* ApiClientError type guard function.
|
|
13
|
-
* Does a structural check of the passed object.
|
|
14
|
-
* @example
|
|
15
|
-
* try {
|
|
16
|
-
* doSomething();
|
|
17
|
-
* } catch (e: unknown) {
|
|
18
|
-
* if(isApiClientError(e)) {
|
|
19
|
-
* handleTheError();
|
|
20
|
-
* }
|
|
21
|
-
* }
|
|
22
|
-
*/
|
|
23
|
-
export declare function isApiClientError(e: any): e is ApiClientError;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { HttpClientResponse } from '@dynatrace-sdk/http-client';
|
|
2
|
-
import { ClientRequestError } from './client-request-error';
|
|
3
|
-
import { CommonApiError, CommonErrorDetails, ErrorResponseBody } from './types';
|
|
4
|
-
export type ApiGatewayErrorResponseBody = ErrorResponseBody<CommonApiError<ApiGatewayErrorDetails> & {
|
|
5
|
-
retryAfterSeconds?: number;
|
|
6
|
-
}>;
|
|
7
|
-
/**
|
|
8
|
-
* Reference for *ApiGatewayError* details object. Contains information about received API Getaway error.
|
|
9
|
-
* */
|
|
10
|
-
export interface ApiGatewayErrorDetails extends CommonErrorDetails {
|
|
11
|
-
errorCodeProperties?: {
|
|
12
|
-
[key: string]: string;
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Dedicated error response class for errors thrown by API Gateway.
|
|
17
|
-
* Autogenerated SDK Clients have built-in handler for API Gateway errors that throws this error.
|
|
18
|
-
*/
|
|
19
|
-
export declare class ApiGatewayError extends ClientRequestError<ApiGatewayErrorResponseBody> {
|
|
20
|
-
readonly isApiGatewayError = true;
|
|
21
|
-
readonly code: number;
|
|
22
|
-
readonly retryAfterSeconds: number | undefined;
|
|
23
|
-
constructor(response: HttpClientResponse, body: ApiGatewayErrorResponseBody);
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* APIGatewayError type guard function.
|
|
27
|
-
* Does a structural check of the passed object.
|
|
28
|
-
* @example
|
|
29
|
-
* try {
|
|
30
|
-
* doSomething();
|
|
31
|
-
* } catch (e: unknown) {
|
|
32
|
-
* if(isApiClientError(e)) {
|
|
33
|
-
* handleTheError();
|
|
34
|
-
* }
|
|
35
|
-
* }
|
|
36
|
-
*/
|
|
37
|
-
export declare function isApiGatewayError(e: any): e is ApiGatewayError;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { HttpClientResponse } from '@dynatrace-sdk/http-client';
|
|
2
|
-
import { ApiClientError } from './api-client-error';
|
|
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
|
-
*/
|
|
21
|
-
export declare class ClientRequestError<DTO = ErrorResponseBody> extends ApiClientError {
|
|
22
|
-
readonly isClientRequestError = true;
|
|
23
|
-
body: DTO;
|
|
24
|
-
response: HttpClientResponse;
|
|
25
|
-
constructor(name: string, response: HttpClientResponse, body: DTO, message?: string, cause?: any);
|
|
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
|
-
*/
|
|
39
|
-
export declare function isClientRequestError<T = ErrorResponseBody>(e: any): e is ClientRequestError<T>;
|
|
@@ -1,26 +0,0 @@
|
|
|
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
|
-
**/
|
|
6
|
-
export declare class InvalidResponseError extends ApiClientError {
|
|
7
|
-
readonly isInvalidResponseError = true;
|
|
8
|
-
responseBody: any;
|
|
9
|
-
expectedType?: string;
|
|
10
|
-
nestedError?: Error;
|
|
11
|
-
response: any;
|
|
12
|
-
constructor(name: string, nestedError: Error | any | undefined, body: any, expectedType?: string, message?: string, response?: any);
|
|
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
|
-
*/
|
|
26
|
-
export declare function isInvalidResponseError(e: any): e is InvalidResponseError;
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
/** @ignore*/
|
|
2
|
-
export declare enum ErrorType {
|
|
3
|
-
COMMON = "JS Error",
|
|
4
|
-
HTTP = "Http Error"
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Basic error envelope, that enforces all error to have mandatory "error" property.
|
|
8
|
-
* */
|
|
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
|
-
* */
|
|
14
|
-
error: T;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Common API error structure, established by Dynatrace API guidelines.
|
|
18
|
-
* */
|
|
19
|
-
export interface CommonApiError<T extends CommonErrorDetails & Record<string, any> = CommonErrorDetails & 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.*/
|
|
22
|
-
code: number;
|
|
23
|
-
/** The error message should be short and precise, it should not contain details.*/
|
|
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
|
-
* */
|
|
29
|
-
help?: string;
|
|
30
|
-
/**
|
|
31
|
-
* Additional details about the error may be added in a details field.
|
|
32
|
-
* Refer to *CommonErrorDetails*
|
|
33
|
-
* */
|
|
34
|
-
details?: T;
|
|
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
|
-
* */
|
|
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
|
-
* */
|
|
45
|
-
errorRef?: string;
|
|
46
|
-
/**
|
|
47
|
-
* String containing a 32-character hex integer value that is used for tracing.
|
|
48
|
-
* */
|
|
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
|
-
* */
|
|
54
|
-
errorCode?: string;
|
|
55
|
-
/**
|
|
56
|
-
* An array of *ConstraintViolation* object, refer to ConstraintViolation object reference for more details.
|
|
57
|
-
* */
|
|
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
|
-
* */
|
|
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
|
-
* */
|
|
68
|
-
missingPermissions?: string[];
|
|
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
|
-
* */
|
|
75
|
-
export interface ConstraintViolation extends Record<string, string | undefined> {
|
|
76
|
-
/**
|
|
77
|
-
* Mandatory field message describing the warning.
|
|
78
|
-
* */
|
|
79
|
-
message: string;
|
|
80
|
-
/**
|
|
81
|
-
* Describes the general location of the violating parameter (query parameter, request body, etc.)
|
|
82
|
-
*/
|
|
83
|
-
parameterLocation?: string;
|
|
84
|
-
/**
|
|
85
|
-
* Refers to the violating parameter within the parameterLocation.
|
|
86
|
-
*/
|
|
87
|
-
path?: string;
|
|
88
|
-
}
|