@dynatrace-sdk/client-query 1.21.2 → 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.
Files changed (98) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +59 -36
  3. package/cjs/index.js +191 -188
  4. package/dynatrace-metadata.json +3 -3
  5. package/esm/index.js +191 -188
  6. package/package.json +2 -2
  7. package/types/packages/client/query/src/lib/apis/query-assistance-api.d.ts +48 -48
  8. package/types/packages/client/query/src/lib/apis/query-execution-api.d.ts +23 -23
  9. package/types/packages/client/query/src/lib/models/autocomplete-request.d.ts +12 -6
  10. package/types/packages/client/query/src/lib/models/autocomplete-response.d.ts +4 -4
  11. package/types/packages/client/query/src/lib/models/autocomplete-suggestion-part.d.ts +6 -6
  12. package/types/packages/client/query/src/lib/models/autocomplete-suggestion.d.ts +4 -4
  13. package/types/packages/client/query/src/lib/models/bucket-contribution.d.ts +6 -0
  14. package/types/packages/client/query/src/lib/models/contributions.d.ts +4 -0
  15. package/types/packages/client/query/src/lib/models/dql-alternative-node.d.ts +1 -1
  16. package/types/packages/client/query/src/lib/models/dql-container-node.d.ts +4 -4
  17. package/types/packages/client/query/src/lib/models/dql-node.d.ts +4 -4
  18. package/types/packages/client/query/src/lib/models/dql-terminal-node.d.ts +5 -5
  19. package/types/packages/client/query/src/lib/models/error-response-details-constraint-violations-item.d.ts +4 -4
  20. package/types/packages/client/query/src/lib/models/error-response-details.d.ts +21 -21
  21. package/types/packages/client/query/src/lib/models/error-response.d.ts +4 -4
  22. package/types/packages/client/query/src/lib/models/execute-request.d.ts +35 -31
  23. package/types/packages/client/query/src/lib/models/grail-metadata.d.ts +25 -23
  24. package/types/packages/client/query/src/lib/models/index.d.ts +2 -0
  25. package/types/packages/client/query/src/lib/models/metadata-notification.d.ts +12 -12
  26. package/types/packages/client/query/src/lib/models/metric-metadata.d.ts +12 -12
  27. package/types/packages/client/query/src/lib/models/parse-request.d.ts +8 -8
  28. package/types/packages/client/query/src/lib/models/query-options.d.ts +1 -1
  29. package/types/packages/client/query/src/lib/models/query-poll-response.d.ts +8 -8
  30. package/types/packages/client/query/src/lib/models/query-result.d.ts +4 -4
  31. package/types/packages/client/query/src/lib/models/query-start-response.d.ts +8 -8
  32. package/types/packages/client/query/src/lib/models/ranged-field-types-mappings.d.ts +1 -1
  33. package/types/packages/client/query/src/lib/models/ranged-field-types.d.ts +4 -4
  34. package/types/packages/client/query/src/lib/models/result-record.d.ts +1 -1
  35. package/types/packages/client/query/src/lib/models/timeframe.d.ts +4 -4
  36. package/types/packages/client/query/src/lib/models/token-position.d.ts +2 -2
  37. package/types/packages/client/query/src/lib/models/token-type.d.ts +3 -1
  38. package/types/packages/client/query/src/lib/models/verify-request.d.ts +9 -9
  39. package/types/packages/client/query/src/lib/models/verify-response.d.ts +4 -4
  40. package/types/packages/http-client/src/index.d.ts +0 -2
  41. package/types/packages/http-client/src/lib/platform/abort-controller.d.ts +0 -6
  42. package/types/packages/http-client/src/lib/platform/abort-signal.d.ts +0 -6
  43. package/types/packages/http-client/src/lib/platform/apply-content-type-header.d.ts +0 -2
  44. package/types/packages/http-client/src/lib/platform/base-error.d.ts +0 -5
  45. package/types/packages/http-client/src/lib/platform/binary.d.ts +0 -13
  46. package/types/packages/http-client/src/lib/platform/data-type-error.d.ts +0 -6
  47. package/types/packages/http-client/src/lib/platform/decode-form-data.d.ts +0 -48
  48. package/types/packages/http-client/src/lib/platform/decode-response-body.d.ts +0 -3
  49. package/types/packages/http-client/src/lib/platform/default-status-validator.d.ts +0 -2
  50. package/types/packages/http-client/src/lib/platform/encode-request-body.d.ts +0 -2
  51. package/types/packages/http-client/src/lib/platform/http-client-abort-error.d.ts +0 -7
  52. package/types/packages/http-client/src/lib/platform/http-client-request-error.d.ts +0 -7
  53. package/types/packages/http-client/src/lib/platform/http-client-response-error-serializer.d.ts +0 -3
  54. package/types/packages/http-client/src/lib/platform/http-client-response-error.d.ts +0 -11
  55. package/types/packages/http-client/src/lib/platform/http-client-response.d.ts +0 -10
  56. package/types/packages/http-client/src/lib/platform/http-client.d.ts +0 -24
  57. package/types/packages/http-client/src/lib/platform/index.d.ts +0 -12
  58. package/types/packages/http-client/src/lib/platform/oauth-http-client.d.ts +0 -41
  59. package/types/packages/http-client/src/lib/platform/unsupported-operation-error.d.ts +0 -6
  60. package/types/packages/http-client/src/lib/types/abort-controller.d.ts +0 -14
  61. package/types/packages/http-client/src/lib/types/abort-signal.d.ts +0 -18
  62. package/types/packages/http-client/src/lib/types/base-error.d.ts +0 -4
  63. package/types/packages/http-client/src/lib/types/binary.d.ts +0 -15
  64. package/types/packages/http-client/src/lib/types/data-type-error.d.ts +0 -14
  65. package/types/packages/http-client/src/lib/types/data-types.d.ts +0 -36
  66. package/types/packages/http-client/src/lib/types/form-data-request-body.d.ts +0 -83
  67. package/types/packages/http-client/src/lib/types/form-data-response-body.d.ts +0 -15
  68. package/types/packages/http-client/src/lib/types/headers.d.ts +0 -6
  69. package/types/packages/http-client/src/lib/types/http-client-abort-error.d.ts +0 -15
  70. package/types/packages/http-client/src/lib/types/http-client-network-error.d.ts +0 -15
  71. package/types/packages/http-client/src/lib/types/http-client-request-error.d.ts +0 -15
  72. package/types/packages/http-client/src/lib/types/http-client-request-options.d.ts +0 -42
  73. package/types/packages/http-client/src/lib/types/http-client-response-error.d.ts +0 -20
  74. package/types/packages/http-client/src/lib/types/http-client-response.d.ts +0 -33
  75. package/types/packages/http-client/src/lib/types/http-client.d.ts +0 -24
  76. package/types/packages/http-client/src/lib/types/index.d.ts +0 -20
  77. package/types/packages/http-client/src/lib/types/request-body-types.d.ts +0 -26
  78. package/types/packages/http-client/src/lib/types/response-body-types.d.ts +0 -46
  79. package/types/packages/http-client/src/lib/types/status-validator.d.ts +0 -7
  80. package/types/packages/http-client/src/lib/types/unsupported-operation-error.d.ts +0 -14
  81. package/types/packages/platform/error-handlers/src/index.d.ts +0 -2
  82. package/types/packages/platform/error-handlers/src/lib/add-global-error-serializer.d.ts +0 -13
  83. package/types/packages/platform/error-handlers/src/lib/types/common-serialized-error.d.ts +0 -13
  84. package/types/packages/platform/error-handlers/src/lib/types/dt-runtime-error-handlers.d.ts +0 -5
  85. package/types/packages/platform/error-handlers/src/lib/types/error-type.d.ts +0 -9
  86. package/types/packages/platform/error-handlers/src/lib/types/global-dt-runtime-with-error-handlers.d.ts +0 -7
  87. package/types/packages/platform/error-handlers/src/lib/types/global-error-serializer.d.ts +0 -10
  88. package/types/packages/platform/error-handlers/src/lib/types/http-serialized-error.d.ts +0 -16
  89. package/types/packages/platform/error-handlers/src/lib/types/index.d.ts +0 -6
  90. package/types/packages/platform/error-handlers/src/lib/types/serialized-error.d.ts +0 -10
  91. package/types/packages/platform/shared/index.d.ts +0 -1
  92. package/types/packages/platform/shared/utils/get-global-with-dt-runtime.d.ts +0 -1
  93. package/types/packages/shared-errors/src/api-client-error.d.ts +0 -23
  94. package/types/packages/shared-errors/src/api-gateway-error.d.ts +0 -37
  95. package/types/packages/shared-errors/src/client-request-error.d.ts +0 -39
  96. package/types/packages/shared-errors/src/index.d.ts +0 -5
  97. package/types/packages/shared-errors/src/invalid-response-error.d.ts +0 -26
  98. package/types/packages/shared-errors/src/types.d.ts +0 -88
@@ -1,3 +0,0 @@
1
- import * as types from '../types';
2
- import { ResponseBodyTypes } from '../types';
3
- export declare function decodeResponseBody<T extends keyof types.ResponseBodyTypes>(response: Response, responseBodyType: T): ResponseBodyTypes[T];
@@ -1,2 +0,0 @@
1
- import { StatusValidator } from '../types';
2
- export declare const defaultStatusValidator: StatusValidator;
@@ -1,2 +0,0 @@
1
- import { RequestBodyTypes } from '../types';
2
- export declare function encodeRequestBody<T extends keyof RequestBodyTypes>(body: RequestBodyTypes[T], requestBodyType: T): Promise<string | ArrayBuffer | Blob | ReadableStream<any> | FormData>;
@@ -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,3 +0,0 @@
1
- import { GlobalErrorSerializer } from '@dynatrace-sdk/error-handlers';
2
- export declare const httpClientResponseErrorSerializer: GlobalErrorSerializer;
3
- export declare function addHttpClientResponseErrorSerializer(): void;
@@ -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,4 +0,0 @@
1
- export interface BaseError extends Error {
2
- readonly name: string;
3
- readonly cause?: any;
4
- }
@@ -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,6 +0,0 @@
1
- /**
2
- * Represents http headers.
3
- */
4
- export interface Headers {
5
- [key: string]: string;
6
- }
@@ -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
- }