@aws-sdk/types 3.32.0 → 3.34.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 +11 -0
- package/package.json +3 -2
- package/src/abort.d.ts +42 -0
- package/src/client.d.ts +34 -0
- package/src/command.d.ts +17 -0
- package/src/credentials.d.ts +24 -0
- package/src/crypto.d.ts +45 -0
- package/src/eventStream.d.ts +100 -0
- package/src/http.d.ts +92 -0
- package/src/index.d.ts +17 -0
- package/src/logger.d.ts +26 -0
- package/src/middleware.d.ts +346 -0
- package/src/pagination.d.ts +14 -0
- package/src/response.d.ts +34 -0
- package/src/serde.d.ts +49 -0
- package/src/shapes.d.ts +51 -0
- package/src/signature.d.ts +100 -0
- package/src/transfer.d.ts +16 -0
- package/src/util.d.ts +100 -0
- package/src/waiter.d.ts +32 -0
- package/tsconfig.cjs.json +3 -4
- package/tsconfig.es.json +3 -4
- package/tsconfig.types.json +9 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [3.34.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.33.0...v3.34.0) (2021-09-24)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **non-clients:** remove comments from transpiled JS files ([#2813](https://github.com/aws/aws-sdk-js-v3/issues/2813)) ([e6fc7f3](https://github.com/aws/aws-sdk-js-v3/commit/e6fc7f3e0fa74785590ac19e7ed143c916bb9b6e))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [3.32.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.31.0...v3.32.0) (2021-09-17)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @aws-sdk/types
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/types",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.34.0",
|
|
4
4
|
"main": "./dist/cjs/index.js",
|
|
5
5
|
"module": "./dist/es/index.js",
|
|
6
6
|
"types": "./dist/types/index.d.ts",
|
|
@@ -9,9 +9,10 @@
|
|
|
9
9
|
"typescript": "~4.3.5"
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|
|
12
|
+
"build": "yarn build:cjs && yarn build:es && yarn build:types",
|
|
12
13
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
13
14
|
"build:es": "tsc -p tsconfig.es.json",
|
|
14
|
-
"build": "
|
|
15
|
+
"build:types": "tsc -p tsconfig.types.json",
|
|
15
16
|
"downlevel-dts": "downlevel-dts dist/types dist/types/ts3.4",
|
|
16
17
|
"test": "exit 0"
|
|
17
18
|
},
|
package/src/abort.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export interface AbortHandler {
|
|
2
|
+
(this: AbortSignal, ev: any): any;
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Holders of an AbortSignal object may query if the associated operation has
|
|
6
|
+
* been aborted and register an onabort handler.
|
|
7
|
+
*
|
|
8
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
|
|
9
|
+
*/
|
|
10
|
+
export interface AbortSignal {
|
|
11
|
+
/**
|
|
12
|
+
* Whether the action represented by this signal has been cancelled.
|
|
13
|
+
*/
|
|
14
|
+
readonly aborted: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* A function to be invoked when the action represented by this signal has
|
|
17
|
+
* been cancelled.
|
|
18
|
+
*/
|
|
19
|
+
onabort: AbortHandler | null;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The AWS SDK uses a Controller/Signal model to allow for cooperative
|
|
23
|
+
* cancellation of asynchronous operations. When initiating such an operation,
|
|
24
|
+
* the caller can create an AbortController and then provide linked signal to
|
|
25
|
+
* subtasks. This allows a single source to communicate to multiple consumers
|
|
26
|
+
* that an action has been aborted without dictating how that cancellation
|
|
27
|
+
* should be handled.
|
|
28
|
+
*
|
|
29
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/AbortController
|
|
30
|
+
*/
|
|
31
|
+
export interface AbortController {
|
|
32
|
+
/**
|
|
33
|
+
* An object that reports whether the action associated with this
|
|
34
|
+
* {AbortController} has been cancelled.
|
|
35
|
+
*/
|
|
36
|
+
readonly signal: AbortSignal;
|
|
37
|
+
/**
|
|
38
|
+
* Declares the operation associated with this AbortController to have been
|
|
39
|
+
* cancelled.
|
|
40
|
+
*/
|
|
41
|
+
abort(): void;
|
|
42
|
+
}
|
package/src/client.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Command } from "./command";
|
|
2
|
+
import { MiddlewareStack } from "./middleware";
|
|
3
|
+
import { MetadataBearer } from "./response";
|
|
4
|
+
/**
|
|
5
|
+
* function definition for different overrides of client's 'send' function.
|
|
6
|
+
*/
|
|
7
|
+
interface InvokeFunction<InputTypes extends object, OutputTypes extends MetadataBearer, ResolvedClientConfiguration> {
|
|
8
|
+
<InputType extends InputTypes, OutputType extends OutputTypes>(
|
|
9
|
+
command: Command<InputTypes, InputType, OutputTypes, OutputType, ResolvedClientConfiguration>,
|
|
10
|
+
options?: any
|
|
11
|
+
): Promise<OutputType>;
|
|
12
|
+
<InputType extends InputTypes, OutputType extends OutputTypes>(
|
|
13
|
+
command: Command<InputTypes, InputType, OutputTypes, OutputType, ResolvedClientConfiguration>,
|
|
14
|
+
options: any,
|
|
15
|
+
cb: (err: any, data?: OutputType) => void
|
|
16
|
+
): void;
|
|
17
|
+
<InputType extends InputTypes, OutputType extends OutputTypes>(
|
|
18
|
+
command: Command<InputTypes, InputType, OutputTypes, OutputType, ResolvedClientConfiguration>,
|
|
19
|
+
options?: any,
|
|
20
|
+
cb?: (err: any, data?: OutputType) => void
|
|
21
|
+
): Promise<OutputType> | void;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A general interface for service clients, idempotent to browser or node clients
|
|
25
|
+
* This type corresponds to SmithyClient(https://github.com/aws/aws-sdk-js-v3/blob/main/packages/smithy-client/src/client.ts).
|
|
26
|
+
* It's provided for using without importing the SmithyClient class.
|
|
27
|
+
*/
|
|
28
|
+
export interface Client<Input extends object, Output extends MetadataBearer, ResolvedClientConfiguration> {
|
|
29
|
+
readonly config: ResolvedClientConfiguration;
|
|
30
|
+
middlewareStack: MiddlewareStack<Input, Output>;
|
|
31
|
+
send: InvokeFunction<Input, Output, ResolvedClientConfiguration>;
|
|
32
|
+
destroy: () => void;
|
|
33
|
+
}
|
|
34
|
+
export {};
|
package/src/command.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Handler, MiddlewareStack } from "./middleware";
|
|
2
|
+
import { MetadataBearer } from "./response";
|
|
3
|
+
export interface Command<
|
|
4
|
+
ClientInput extends object,
|
|
5
|
+
InputType extends ClientInput,
|
|
6
|
+
ClientOutput extends MetadataBearer,
|
|
7
|
+
OutputType extends ClientOutput,
|
|
8
|
+
ResolvedConfiguration
|
|
9
|
+
> {
|
|
10
|
+
readonly input: InputType;
|
|
11
|
+
readonly middlewareStack: MiddlewareStack<InputType, OutputType>;
|
|
12
|
+
resolveMiddleware(
|
|
13
|
+
stack: MiddlewareStack<ClientInput, ClientOutput>,
|
|
14
|
+
configuration: ResolvedConfiguration,
|
|
15
|
+
options: any
|
|
16
|
+
): Handler<InputType, OutputType>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Provider } from "./util";
|
|
2
|
+
/**
|
|
3
|
+
* An object representing temporary or permanent AWS credentials.
|
|
4
|
+
*/
|
|
5
|
+
export interface Credentials {
|
|
6
|
+
/**
|
|
7
|
+
* AWS access key ID
|
|
8
|
+
*/
|
|
9
|
+
readonly accessKeyId: string;
|
|
10
|
+
/**
|
|
11
|
+
* AWS secret access key
|
|
12
|
+
*/
|
|
13
|
+
readonly secretAccessKey: string;
|
|
14
|
+
/**
|
|
15
|
+
* A security or session token to use with these credentials. Usually
|
|
16
|
+
* present for temporary credentials.
|
|
17
|
+
*/
|
|
18
|
+
readonly sessionToken?: string;
|
|
19
|
+
/**
|
|
20
|
+
* A {Date} when these credentials will no longer be accepted.
|
|
21
|
+
*/
|
|
22
|
+
readonly expiration?: Date;
|
|
23
|
+
}
|
|
24
|
+
export declare type CredentialProvider = Provider<Credentials>;
|
package/src/crypto.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export declare type SourceData = string | ArrayBuffer | ArrayBufferView;
|
|
2
|
+
/**
|
|
3
|
+
* An object that provides a hash of data provided in chunks to `update`. The
|
|
4
|
+
* hash may be performed incrementally as chunks are received or all at once
|
|
5
|
+
* when the hash is finalized, depending on the underlying implementation.
|
|
6
|
+
*/
|
|
7
|
+
export interface Hash {
|
|
8
|
+
/**
|
|
9
|
+
* Adds a chunk of data to the hash. If a buffer is provided, the `encoding`
|
|
10
|
+
* argument will be ignored. If a string is provided without a specified
|
|
11
|
+
* encoding, implementations must assume UTF-8 encoding.
|
|
12
|
+
*
|
|
13
|
+
* Not all encodings are supported on all platforms, though all must support
|
|
14
|
+
* UTF-8.
|
|
15
|
+
*/
|
|
16
|
+
update(toHash: SourceData, encoding?: "utf8" | "ascii" | "latin1"): void;
|
|
17
|
+
/**
|
|
18
|
+
* Finalizes the hash and provides a promise that will be fulfilled with the
|
|
19
|
+
* raw bytes of the calculated hash.
|
|
20
|
+
*/
|
|
21
|
+
digest(): Promise<Uint8Array>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A constructor for a hash that may be used to calculate an HMAC. Implementing
|
|
25
|
+
* classes should not directly hold the provided key in memory beyond the
|
|
26
|
+
* lexical scope of the constructor.
|
|
27
|
+
*/
|
|
28
|
+
export interface HashConstructor {
|
|
29
|
+
new (secret?: SourceData): Hash;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* A function that calculates the hash of a data stream. Determining the hash
|
|
33
|
+
* will consume the stream, so only replayable streams should be provided to an
|
|
34
|
+
* implementation of this interface.
|
|
35
|
+
*/
|
|
36
|
+
export interface StreamHasher<StreamType = any> {
|
|
37
|
+
(hashCtor: HashConstructor, stream: StreamType): Promise<Uint8Array>;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* A function that returns a promise fulfilled with bytes from a
|
|
41
|
+
* cryptographically secure pseudorandom number generator.
|
|
42
|
+
*/
|
|
43
|
+
export interface randomValues {
|
|
44
|
+
(byteLength: number): Promise<Uint8Array>;
|
|
45
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { HttpRequest } from "./http";
|
|
2
|
+
import {
|
|
3
|
+
FinalizeHandler,
|
|
4
|
+
FinalizeHandlerArguments,
|
|
5
|
+
FinalizeHandlerOutput,
|
|
6
|
+
HandlerExecutionContext,
|
|
7
|
+
} from "./middleware";
|
|
8
|
+
import { MetadataBearer } from "./response";
|
|
9
|
+
/**
|
|
10
|
+
* An event stream message. The headers and body properties will always be
|
|
11
|
+
* defined, with empty headers represented as an object with no keys and an
|
|
12
|
+
* empty body represented as a zero-length Uint8Array.
|
|
13
|
+
*/
|
|
14
|
+
export interface Message {
|
|
15
|
+
headers: MessageHeaders;
|
|
16
|
+
body: Uint8Array;
|
|
17
|
+
}
|
|
18
|
+
export interface MessageHeaders {
|
|
19
|
+
[name: string]: MessageHeaderValue;
|
|
20
|
+
}
|
|
21
|
+
export interface BooleanHeaderValue {
|
|
22
|
+
type: "boolean";
|
|
23
|
+
value: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface ByteHeaderValue {
|
|
26
|
+
type: "byte";
|
|
27
|
+
value: number;
|
|
28
|
+
}
|
|
29
|
+
export interface ShortHeaderValue {
|
|
30
|
+
type: "short";
|
|
31
|
+
value: number;
|
|
32
|
+
}
|
|
33
|
+
export interface IntegerHeaderValue {
|
|
34
|
+
type: "integer";
|
|
35
|
+
value: number;
|
|
36
|
+
}
|
|
37
|
+
export interface LongHeaderValue {
|
|
38
|
+
type: "long";
|
|
39
|
+
value: Int64;
|
|
40
|
+
}
|
|
41
|
+
export interface BinaryHeaderValue {
|
|
42
|
+
type: "binary";
|
|
43
|
+
value: Uint8Array;
|
|
44
|
+
}
|
|
45
|
+
export interface StringHeaderValue {
|
|
46
|
+
type: "string";
|
|
47
|
+
value: string;
|
|
48
|
+
}
|
|
49
|
+
export interface TimestampHeaderValue {
|
|
50
|
+
type: "timestamp";
|
|
51
|
+
value: Date;
|
|
52
|
+
}
|
|
53
|
+
export interface UuidHeaderValue {
|
|
54
|
+
type: "uuid";
|
|
55
|
+
value: string;
|
|
56
|
+
}
|
|
57
|
+
export declare type MessageHeaderValue =
|
|
58
|
+
| BooleanHeaderValue
|
|
59
|
+
| ByteHeaderValue
|
|
60
|
+
| ShortHeaderValue
|
|
61
|
+
| IntegerHeaderValue
|
|
62
|
+
| LongHeaderValue
|
|
63
|
+
| BinaryHeaderValue
|
|
64
|
+
| StringHeaderValue
|
|
65
|
+
| TimestampHeaderValue
|
|
66
|
+
| UuidHeaderValue;
|
|
67
|
+
export interface Int64 {
|
|
68
|
+
readonly bytes: Uint8Array;
|
|
69
|
+
valueOf: () => number;
|
|
70
|
+
toString: () => string;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Util functions for serializing or deserializing event stream
|
|
74
|
+
*/
|
|
75
|
+
export interface EventStreamSerdeContext {
|
|
76
|
+
eventStreamMarshaller: EventStreamMarshaller;
|
|
77
|
+
}
|
|
78
|
+
export interface EventStreamMarshaller {
|
|
79
|
+
deserialize: (body: any, deserializer: (input: { [event: string]: Message }) => any) => AsyncIterable<any>;
|
|
80
|
+
serialize: (input: AsyncIterable<any>, serializer: (event: any) => Message) => any;
|
|
81
|
+
}
|
|
82
|
+
export interface EventStreamRequestSigner {
|
|
83
|
+
sign(request: HttpRequest): Promise<HttpRequest>;
|
|
84
|
+
}
|
|
85
|
+
export interface EventStreamPayloadHandler {
|
|
86
|
+
handle: <Input extends object, Output extends MetadataBearer>(
|
|
87
|
+
next: FinalizeHandler<Input, Output>,
|
|
88
|
+
args: FinalizeHandlerArguments<Input>,
|
|
89
|
+
context?: HandlerExecutionContext
|
|
90
|
+
) => Promise<FinalizeHandlerOutput<Output>>;
|
|
91
|
+
}
|
|
92
|
+
export interface EventStreamPayloadHandlerProvider {
|
|
93
|
+
(options: any): EventStreamPayloadHandler;
|
|
94
|
+
}
|
|
95
|
+
export interface EventStreamSerdeProvider {
|
|
96
|
+
(options: any): EventStreamMarshaller;
|
|
97
|
+
}
|
|
98
|
+
export interface EventStreamSignerProvider {
|
|
99
|
+
(options: any): EventStreamRequestSigner;
|
|
100
|
+
}
|
package/src/http.d.ts
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { AbortSignal } from "./abort";
|
|
2
|
+
/**
|
|
3
|
+
* A collection of key/value pairs with case-insensitive keys.
|
|
4
|
+
*/
|
|
5
|
+
export interface Headers extends Map<string, string> {
|
|
6
|
+
/**
|
|
7
|
+
* Returns a new instance of Headers with the specified header set to the
|
|
8
|
+
* provided value. Does not modify the original Headers instance.
|
|
9
|
+
*
|
|
10
|
+
* @param headerName The name of the header to add or overwrite
|
|
11
|
+
* @param headerValue The value to which the header should be set
|
|
12
|
+
*/
|
|
13
|
+
withHeader(headerName: string, headerValue: string): Headers;
|
|
14
|
+
/**
|
|
15
|
+
* Returns a new instance of Headers without the specified header. Does not
|
|
16
|
+
* modify the original Headers instance.
|
|
17
|
+
*
|
|
18
|
+
* @param headerName The name of the header to remove
|
|
19
|
+
*/
|
|
20
|
+
withoutHeader(headerName: string): Headers;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A mapping of header names to string values. Multiple values for the same
|
|
24
|
+
* header should be represented as a single string with values separated by
|
|
25
|
+
* `, `.
|
|
26
|
+
*
|
|
27
|
+
* Keys should be considered case insensitive, even if this is not enforced by a
|
|
28
|
+
* particular implementation. For example, given the following HeaderBag, where
|
|
29
|
+
* keys differ only in case:
|
|
30
|
+
*
|
|
31
|
+
* {
|
|
32
|
+
* 'x-amz-date': '2000-01-01T00:00:00Z',
|
|
33
|
+
* 'X-Amz-Date': '2001-01-01T00:00:00Z'
|
|
34
|
+
* }
|
|
35
|
+
*
|
|
36
|
+
* The SDK may at any point during processing remove one of the object
|
|
37
|
+
* properties in favor of the other. The headers may or may not be combined, and
|
|
38
|
+
* the SDK will not deterministically select which header candidate to use.
|
|
39
|
+
*/
|
|
40
|
+
export interface HeaderBag {
|
|
41
|
+
[key: string]: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Represents an HTTP message with headers and an optional static or streaming
|
|
45
|
+
* body. bode: ArrayBuffer | ArrayBufferView | string | Uint8Array | Readable | ReadableStream;
|
|
46
|
+
*/
|
|
47
|
+
export interface HttpMessage {
|
|
48
|
+
headers: HeaderBag;
|
|
49
|
+
body?: any;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* A mapping of query parameter names to strings or arrays of strings, with the
|
|
53
|
+
* second being used when a parameter contains a list of values. Value can be set
|
|
54
|
+
* to null when query is not in key-value pairs shape
|
|
55
|
+
*/
|
|
56
|
+
export interface QueryParameterBag {
|
|
57
|
+
[key: string]: string | Array<string> | null;
|
|
58
|
+
}
|
|
59
|
+
export interface Endpoint {
|
|
60
|
+
protocol: string;
|
|
61
|
+
hostname: string;
|
|
62
|
+
port?: number;
|
|
63
|
+
path: string;
|
|
64
|
+
query?: QueryParameterBag;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Interface an HTTP request class. Contains
|
|
68
|
+
* addressing information in addition to standard message properties.
|
|
69
|
+
*/
|
|
70
|
+
export interface HttpRequest extends HttpMessage, Endpoint {
|
|
71
|
+
method: string;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Represents an HTTP message as received in reply to a request. Contains a
|
|
75
|
+
* numeric status code in addition to standard message properties.
|
|
76
|
+
*/
|
|
77
|
+
export interface HttpResponse extends HttpMessage {
|
|
78
|
+
statusCode: number;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Represents HTTP message whose body has been resolved to a string. This is
|
|
82
|
+
* used in parsing http message.
|
|
83
|
+
*/
|
|
84
|
+
export interface ResolvedHttpResponse extends HttpResponse {
|
|
85
|
+
body: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Represents the options that may be passed to an Http Handler.
|
|
89
|
+
*/
|
|
90
|
+
export interface HttpHandlerOptions {
|
|
91
|
+
abortSignal?: AbortSignal;
|
|
92
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export * from "./abort";
|
|
2
|
+
export * from "./client";
|
|
3
|
+
export * from "./command";
|
|
4
|
+
export * from "./credentials";
|
|
5
|
+
export * from "./crypto";
|
|
6
|
+
export * from "./eventStream";
|
|
7
|
+
export * from "./http";
|
|
8
|
+
export * from "./logger";
|
|
9
|
+
export * from "./pagination";
|
|
10
|
+
export * from "./serde";
|
|
11
|
+
export * from "./middleware";
|
|
12
|
+
export * from "./response";
|
|
13
|
+
export * from "./shapes";
|
|
14
|
+
export * from "./signature";
|
|
15
|
+
export * from "./transfer";
|
|
16
|
+
export * from "./util";
|
|
17
|
+
export * from "./waiter";
|
package/src/logger.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A list of logger's log level. These levels are sorted in
|
|
3
|
+
* order of increasing severity. Each log level includes itself and all
|
|
4
|
+
* the levels behind itself.
|
|
5
|
+
*
|
|
6
|
+
* @example new Logger({logLevel: 'warn'}) will print all the warn and error
|
|
7
|
+
* message.
|
|
8
|
+
*/
|
|
9
|
+
export declare type LogLevel = "all" | "log" | "info" | "warn" | "error" | "off";
|
|
10
|
+
/**
|
|
11
|
+
* An object consumed by Logger constructor to initiate a logger object.
|
|
12
|
+
*/
|
|
13
|
+
export interface LoggerOptions {
|
|
14
|
+
logger?: Logger;
|
|
15
|
+
logLevel?: LogLevel;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Represents a logger object that is available in HandlerExecutionContext
|
|
19
|
+
* throughout the middleware stack.
|
|
20
|
+
*/
|
|
21
|
+
export interface Logger {
|
|
22
|
+
debug(content: object): void;
|
|
23
|
+
info(content: object): void;
|
|
24
|
+
warn(content: object): void;
|
|
25
|
+
error(content: object): void;
|
|
26
|
+
}
|
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
import { Logger } from "./logger";
|
|
2
|
+
import { UserAgent } from "./util";
|
|
3
|
+
export interface InitializeHandlerArguments<Input extends object> {
|
|
4
|
+
/**
|
|
5
|
+
* User input to a command. Reflects the userland representation of the
|
|
6
|
+
* union of data types the command can effectively handle.
|
|
7
|
+
*/
|
|
8
|
+
input: Input;
|
|
9
|
+
}
|
|
10
|
+
export interface InitializeHandlerOutput<Output extends object> extends DeserializeHandlerOutput<Output> {
|
|
11
|
+
output: Output;
|
|
12
|
+
}
|
|
13
|
+
export interface SerializeHandlerArguments<Input extends object> extends InitializeHandlerArguments<Input> {
|
|
14
|
+
/**
|
|
15
|
+
* The user input serialized as a request object. The request object is unknown,
|
|
16
|
+
* so you cannot modify it directly. When work with request, you need to guard its
|
|
17
|
+
* type to e.g. HttpRequest with 'instanceof' operand
|
|
18
|
+
*
|
|
19
|
+
* During the build phase of the execution of a middleware stack, a built
|
|
20
|
+
* request may or may not be available.
|
|
21
|
+
*/
|
|
22
|
+
request?: unknown;
|
|
23
|
+
}
|
|
24
|
+
export interface SerializeHandlerOutput<Output extends object> extends InitializeHandlerOutput<Output> {}
|
|
25
|
+
export interface BuildHandlerArguments<Input extends object> extends FinalizeHandlerArguments<Input> {}
|
|
26
|
+
export interface BuildHandlerOutput<Output extends object> extends InitializeHandlerOutput<Output> {}
|
|
27
|
+
export interface FinalizeHandlerArguments<Input extends object> extends SerializeHandlerArguments<Input> {
|
|
28
|
+
/**
|
|
29
|
+
* The user input serialized as a request.
|
|
30
|
+
*/
|
|
31
|
+
request: unknown;
|
|
32
|
+
}
|
|
33
|
+
export interface FinalizeHandlerOutput<Output extends object> extends InitializeHandlerOutput<Output> {}
|
|
34
|
+
export interface DeserializeHandlerArguments<Input extends object> extends FinalizeHandlerArguments<Input> {}
|
|
35
|
+
export interface DeserializeHandlerOutput<Output extends object> {
|
|
36
|
+
/**
|
|
37
|
+
* The raw response object from runtime is deserialized to structured output object.
|
|
38
|
+
* The response object is unknown so you cannot modify it directly. When work with
|
|
39
|
+
* response, you need to guard its type to e.g. HttpResponse with 'instanceof' operand.
|
|
40
|
+
*
|
|
41
|
+
* During the deserialize phase of the execution of a middleware stack, a deserialized
|
|
42
|
+
* response may or may not be available
|
|
43
|
+
*/
|
|
44
|
+
response: unknown;
|
|
45
|
+
output?: Output;
|
|
46
|
+
}
|
|
47
|
+
export interface InitializeHandler<Input extends object, Output extends object> {
|
|
48
|
+
/**
|
|
49
|
+
* Asynchronously converts an input object into an output object.
|
|
50
|
+
*
|
|
51
|
+
* @param args An object containing a input to the command as well as any
|
|
52
|
+
* associated or previously generated execution artifacts.
|
|
53
|
+
*/
|
|
54
|
+
(args: InitializeHandlerArguments<Input>): Promise<InitializeHandlerOutput<Output>>;
|
|
55
|
+
}
|
|
56
|
+
export declare type Handler<Input extends object, Output extends object> = InitializeHandler<Input, Output>;
|
|
57
|
+
export interface SerializeHandler<Input extends object, Output extends object> {
|
|
58
|
+
/**
|
|
59
|
+
* Asynchronously converts an input object into an output object.
|
|
60
|
+
*
|
|
61
|
+
* @param args An object containing a input to the command as well as any
|
|
62
|
+
* associated or previously generated execution artifacts.
|
|
63
|
+
*/
|
|
64
|
+
(args: SerializeHandlerArguments<Input>): Promise<SerializeHandlerOutput<Output>>;
|
|
65
|
+
}
|
|
66
|
+
export interface FinalizeHandler<Input extends object, Output extends object> {
|
|
67
|
+
/**
|
|
68
|
+
* Asynchronously converts an input object into an output object.
|
|
69
|
+
*
|
|
70
|
+
* @param args An object containing a input to the command as well as any
|
|
71
|
+
* associated or previously generated execution artifacts.
|
|
72
|
+
*/
|
|
73
|
+
(args: FinalizeHandlerArguments<Input>): Promise<FinalizeHandlerOutput<Output>>;
|
|
74
|
+
}
|
|
75
|
+
export interface BuildHandler<Input extends object, Output extends object> {
|
|
76
|
+
(args: BuildHandlerArguments<Input>): Promise<BuildHandlerOutput<Output>>;
|
|
77
|
+
}
|
|
78
|
+
export interface DeserializeHandler<Input extends object, Output extends object> {
|
|
79
|
+
(args: DeserializeHandlerArguments<Input>): Promise<DeserializeHandlerOutput<Output>>;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* A factory function that creates functions implementing the {Handler}
|
|
83
|
+
* interface.
|
|
84
|
+
*/
|
|
85
|
+
export interface InitializeMiddleware<Input extends object, Output extends object> {
|
|
86
|
+
/**
|
|
87
|
+
* @param next The handler to invoke after this middleware has operated on
|
|
88
|
+
* the user input and before this middleware operates on the output.
|
|
89
|
+
*
|
|
90
|
+
* @param context Invariant data and functions for use by the handler.
|
|
91
|
+
*/
|
|
92
|
+
(next: InitializeHandler<Input, Output>, context: HandlerExecutionContext): InitializeHandler<Input, Output>;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* A factory function that creates functions implementing the {BuildHandler}
|
|
96
|
+
* interface.
|
|
97
|
+
*/
|
|
98
|
+
export interface SerializeMiddleware<Input extends object, Output extends object> {
|
|
99
|
+
/**
|
|
100
|
+
* @param next The handler to invoke after this middleware has operated on
|
|
101
|
+
* the user input and before this middleware operates on the output.
|
|
102
|
+
*
|
|
103
|
+
* @param context Invariant data and functions for use by the handler.
|
|
104
|
+
*/
|
|
105
|
+
(next: SerializeHandler<Input, Output>, context: HandlerExecutionContext): SerializeHandler<Input, Output>;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* A factory function that creates functions implementing the {FinalizeHandler}
|
|
109
|
+
* interface.
|
|
110
|
+
*/
|
|
111
|
+
export interface FinalizeRequestMiddleware<Input extends object, Output extends object> {
|
|
112
|
+
/**
|
|
113
|
+
* @param next The handler to invoke after this middleware has operated on
|
|
114
|
+
* the user input and before this middleware operates on the output.
|
|
115
|
+
*
|
|
116
|
+
* @param context Invariant data and functions for use by the handler.
|
|
117
|
+
*/
|
|
118
|
+
(next: FinalizeHandler<Input, Output>, context: HandlerExecutionContext): FinalizeHandler<Input, Output>;
|
|
119
|
+
}
|
|
120
|
+
export interface BuildMiddleware<Input extends object, Output extends object> {
|
|
121
|
+
(next: BuildHandler<Input, Output>, context: HandlerExecutionContext): BuildHandler<Input, Output>;
|
|
122
|
+
}
|
|
123
|
+
export interface DeserializeMiddleware<Input extends object, Output extends object> {
|
|
124
|
+
(next: DeserializeHandler<Input, Output>, context: HandlerExecutionContext): DeserializeHandler<Input, Output>;
|
|
125
|
+
}
|
|
126
|
+
export declare type MiddlewareType<Input extends object, Output extends object> =
|
|
127
|
+
| InitializeMiddleware<Input, Output>
|
|
128
|
+
| SerializeMiddleware<Input, Output>
|
|
129
|
+
| BuildMiddleware<Input, Output>
|
|
130
|
+
| FinalizeRequestMiddleware<Input, Output>
|
|
131
|
+
| DeserializeMiddleware<Input, Output>;
|
|
132
|
+
/**
|
|
133
|
+
* A factory function that creates the terminal handler atop which a middleware
|
|
134
|
+
* stack sits.
|
|
135
|
+
*/
|
|
136
|
+
export interface Terminalware {
|
|
137
|
+
<Input extends object, Output extends object>(context: HandlerExecutionContext): DeserializeHandler<Input, Output>;
|
|
138
|
+
}
|
|
139
|
+
export declare type Step = "initialize" | "serialize" | "build" | "finalizeRequest" | "deserialize";
|
|
140
|
+
export declare type Priority = "high" | "normal" | "low";
|
|
141
|
+
export interface HandlerOptions {
|
|
142
|
+
/**
|
|
143
|
+
* Handlers are ordered using a "step" that describes the stage of command
|
|
144
|
+
* execution at which the handler will be executed. The available steps are:
|
|
145
|
+
*
|
|
146
|
+
* - initialize: The input is being prepared. Examples of typical
|
|
147
|
+
* initialization tasks include injecting default options computing
|
|
148
|
+
* derived parameters.
|
|
149
|
+
* - serialize: The input is complete and ready to be serialized. Examples
|
|
150
|
+
* of typical serialization tasks include input validation and building
|
|
151
|
+
* an HTTP request from user input.
|
|
152
|
+
* - build: The input has been serialized into an HTTP request, but that
|
|
153
|
+
* request may require further modification. Any request alterations
|
|
154
|
+
* will be applied to all retries. Examples of typical build tasks
|
|
155
|
+
* include injecting HTTP headers that describe a stable aspect of the
|
|
156
|
+
* request, such as `Content-Length` or a body checksum.
|
|
157
|
+
* - finalizeRequest: The request is being prepared to be sent over the wire. The
|
|
158
|
+
* request in this stage should already be semantically complete and
|
|
159
|
+
* should therefore only be altered as match the recipient's
|
|
160
|
+
* expectations. Examples of typical finalization tasks include request
|
|
161
|
+
* signing and injecting hop-by-hop headers.
|
|
162
|
+
* - deserialize: The response has arrived, the middleware here will deserialize
|
|
163
|
+
* the raw response object to structured response
|
|
164
|
+
*
|
|
165
|
+
* Unlike initialization and build handlers, which are executed once
|
|
166
|
+
* per operation execution, finalization and deserialize handlers will be
|
|
167
|
+
* executed foreach HTTP request sent.
|
|
168
|
+
*
|
|
169
|
+
* @default 'initialize'
|
|
170
|
+
*/
|
|
171
|
+
step?: Step;
|
|
172
|
+
/**
|
|
173
|
+
* A list of strings to any that identify the general purpose or important
|
|
174
|
+
* characteristics of a given handler.
|
|
175
|
+
*/
|
|
176
|
+
tags?: Array<string>;
|
|
177
|
+
/**
|
|
178
|
+
* A unique name to refer to a middleware
|
|
179
|
+
*/
|
|
180
|
+
name?: string;
|
|
181
|
+
/**
|
|
182
|
+
* A flag to override the existing middleware with the same name. Without
|
|
183
|
+
* setting it, adding middleware with duplicated name will throw an exception.
|
|
184
|
+
* @internal
|
|
185
|
+
*/
|
|
186
|
+
override?: boolean;
|
|
187
|
+
}
|
|
188
|
+
export interface AbsoluteLocation {
|
|
189
|
+
/**
|
|
190
|
+
* By default middleware will be added to individual step in un-guaranteed order.
|
|
191
|
+
* In the case that
|
|
192
|
+
*
|
|
193
|
+
* @default 'normal'
|
|
194
|
+
*/
|
|
195
|
+
priority?: Priority;
|
|
196
|
+
}
|
|
197
|
+
export declare type Relation = "before" | "after";
|
|
198
|
+
export interface RelativeLocation {
|
|
199
|
+
/**
|
|
200
|
+
* Specify the relation to be before or after a know middleware.
|
|
201
|
+
*/
|
|
202
|
+
relation: Relation;
|
|
203
|
+
/**
|
|
204
|
+
* A known middleware name to indicate inserting middleware's location.
|
|
205
|
+
*/
|
|
206
|
+
toMiddleware: string;
|
|
207
|
+
}
|
|
208
|
+
export declare type RelativeMiddlewareOptions = RelativeLocation & Omit<HandlerOptions, "step">;
|
|
209
|
+
export interface InitializeHandlerOptions extends HandlerOptions {
|
|
210
|
+
step?: "initialize";
|
|
211
|
+
}
|
|
212
|
+
export interface SerializeHandlerOptions extends HandlerOptions {
|
|
213
|
+
step: "serialize";
|
|
214
|
+
}
|
|
215
|
+
export interface BuildHandlerOptions extends HandlerOptions {
|
|
216
|
+
step: "build";
|
|
217
|
+
}
|
|
218
|
+
export interface FinalizeRequestHandlerOptions extends HandlerOptions {
|
|
219
|
+
step: "finalizeRequest";
|
|
220
|
+
}
|
|
221
|
+
export interface DeserializeHandlerOptions extends HandlerOptions {
|
|
222
|
+
step: "deserialize";
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* A stack storing middleware. It can be resolved into a handler. It supports 2
|
|
226
|
+
* approaches for adding middleware:
|
|
227
|
+
* 1. Adding middleware to specific step with `add()`. The order of middleware
|
|
228
|
+
* added into same step is determined by order of adding them. If one middleware
|
|
229
|
+
* needs to be executed at the front of the step or at the end of step, set
|
|
230
|
+
* `priority` options to `high` or `low`.
|
|
231
|
+
* 2. Adding middleware to location relative to known middleware with `addRelativeTo()`.
|
|
232
|
+
* This is useful when given middleware must be executed before or after specific
|
|
233
|
+
* middleware(`toMiddleware`). You can add a middleware relatively to another
|
|
234
|
+
* middleware which also added relatively. But eventually, this relative middleware
|
|
235
|
+
* chain **must** be 'anchored' by a middleware that added using `add()` API
|
|
236
|
+
* with absolute `step` and `priority`. This mothod will throw if specified
|
|
237
|
+
* `toMiddleware` is not found.
|
|
238
|
+
*/
|
|
239
|
+
export interface MiddlewareStack<Input extends object, Output extends object> extends Pluggable<Input, Output> {
|
|
240
|
+
/**
|
|
241
|
+
* Add middleware to the stack to be executed during the "initialize" step,
|
|
242
|
+
* optionally specifying a priority, tags and name
|
|
243
|
+
*/
|
|
244
|
+
add(middleware: InitializeMiddleware<Input, Output>, options?: InitializeHandlerOptions & AbsoluteLocation): void;
|
|
245
|
+
/**
|
|
246
|
+
* Add middleware to the stack to be executed during the "serialize" step,
|
|
247
|
+
* optionally specifying a priority, tags and name
|
|
248
|
+
*/
|
|
249
|
+
add(middleware: SerializeMiddleware<Input, Output>, options: SerializeHandlerOptions & AbsoluteLocation): void;
|
|
250
|
+
/**
|
|
251
|
+
* Add middleware to the stack to be executed during the "build" step,
|
|
252
|
+
* optionally specifying a priority, tags and name
|
|
253
|
+
*/
|
|
254
|
+
add(middleware: BuildMiddleware<Input, Output>, options: BuildHandlerOptions & AbsoluteLocation): void;
|
|
255
|
+
/**
|
|
256
|
+
* Add middleware to the stack to be executed during the "finalizeRequest" step,
|
|
257
|
+
* optionally specifying a priority, tags and name
|
|
258
|
+
*/
|
|
259
|
+
add(
|
|
260
|
+
middleware: FinalizeRequestMiddleware<Input, Output>,
|
|
261
|
+
options: FinalizeRequestHandlerOptions & AbsoluteLocation
|
|
262
|
+
): void;
|
|
263
|
+
/**
|
|
264
|
+
* Add middleware to the stack to be executed during the "deserialize" step,
|
|
265
|
+
* optionally specifying a priority, tags and name
|
|
266
|
+
*/
|
|
267
|
+
add(middleware: DeserializeMiddleware<Input, Output>, options: DeserializeHandlerOptions & AbsoluteLocation): void;
|
|
268
|
+
/**
|
|
269
|
+
* Add middleware to a stack position before or after a known middleware,optionally
|
|
270
|
+
* specifying name and tags.
|
|
271
|
+
*/
|
|
272
|
+
addRelativeTo(middleware: MiddlewareType<Input, Output>, options: RelativeMiddlewareOptions): void;
|
|
273
|
+
/**
|
|
274
|
+
* Apply a customization function to mutate the middleware stack, often
|
|
275
|
+
* used for customizations that requires mutating multiple middleware.
|
|
276
|
+
*/
|
|
277
|
+
use(pluggable: Pluggable<Input, Output>): void;
|
|
278
|
+
/**
|
|
279
|
+
* Create a shallow clone of this stack. Step bindings and handler priorities
|
|
280
|
+
* and tags are preserved in the copy.
|
|
281
|
+
*/
|
|
282
|
+
clone(): MiddlewareStack<Input, Output>;
|
|
283
|
+
/**
|
|
284
|
+
* Removes middleware from the stack.
|
|
285
|
+
*
|
|
286
|
+
* If a string is provided, it will be treated as middleware name. If a middleware
|
|
287
|
+
* is inserted with the given name, it will be removed.
|
|
288
|
+
*
|
|
289
|
+
* If a middleware class is provided, all usages thereof will be removed.
|
|
290
|
+
*/
|
|
291
|
+
remove(toRemove: MiddlewareType<Input, Output> | string): boolean;
|
|
292
|
+
/**
|
|
293
|
+
* Removes middleware that contains given tag
|
|
294
|
+
*
|
|
295
|
+
* Multiple middleware will potentially be removed
|
|
296
|
+
*/
|
|
297
|
+
removeByTag(toRemove: string): boolean;
|
|
298
|
+
/**
|
|
299
|
+
* Create a stack containing the middlewares in this stack as well as the
|
|
300
|
+
* middlewares in the `from` stack. Neither source is modified, and step
|
|
301
|
+
* bindings and handler priorities and tags are preserved in the copy.
|
|
302
|
+
*/
|
|
303
|
+
concat<InputType extends Input, OutputType extends Output>(
|
|
304
|
+
from: MiddlewareStack<InputType, OutputType>
|
|
305
|
+
): MiddlewareStack<InputType, OutputType>;
|
|
306
|
+
/**
|
|
307
|
+
* Builds a single handler function from zero or more middleware classes and
|
|
308
|
+
* a core handler. The core handler is meant to send command objects to AWS
|
|
309
|
+
* services and return promises that will resolve with the operation result
|
|
310
|
+
* or be rejected with an error.
|
|
311
|
+
*
|
|
312
|
+
* When a composed handler is invoked, the arguments will pass through all
|
|
313
|
+
* middleware in a defined order, and the return from the innermost handler
|
|
314
|
+
* will pass through all middleware in the reverse of that order.
|
|
315
|
+
*/
|
|
316
|
+
resolve<InputType extends Input, OutputType extends Output>(
|
|
317
|
+
handler: DeserializeHandler<InputType, OutputType>,
|
|
318
|
+
context: HandlerExecutionContext
|
|
319
|
+
): InitializeHandler<InputType, OutputType>;
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Data and helper objects that are not expected to change from one execution of
|
|
323
|
+
* a composed handler to another.
|
|
324
|
+
*/
|
|
325
|
+
export interface HandlerExecutionContext {
|
|
326
|
+
/**
|
|
327
|
+
* A logger that may be invoked by any handler during execution of an
|
|
328
|
+
* operation.
|
|
329
|
+
*/
|
|
330
|
+
logger?: Logger;
|
|
331
|
+
/**
|
|
332
|
+
* Additional user agent that inferred by middleware. It can be used to save
|
|
333
|
+
* the internal user agent sections without overriding the `customUserAgent`
|
|
334
|
+
* config in clients.
|
|
335
|
+
*/
|
|
336
|
+
userAgent?: UserAgent;
|
|
337
|
+
[key: string]: any;
|
|
338
|
+
}
|
|
339
|
+
export interface Pluggable<Input extends object, Output extends object> {
|
|
340
|
+
/**
|
|
341
|
+
* A function that mutate the passed in middleware stack. Functions implementing
|
|
342
|
+
* this interface can add, remove, modify existing middleware stack from clients
|
|
343
|
+
* or commands
|
|
344
|
+
*/
|
|
345
|
+
applyToStack: (stack: MiddlewareStack<Input, Output>) => void;
|
|
346
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Client } from "./client";
|
|
2
|
+
/**
|
|
3
|
+
* Expected type definition of a paginator.
|
|
4
|
+
*/
|
|
5
|
+
export declare type Paginator<T> = AsyncGenerator<T, T, unknown>;
|
|
6
|
+
/**
|
|
7
|
+
* Expected paginator configuration passed to an operation. Services will extend
|
|
8
|
+
* this interface definition and may type client further.
|
|
9
|
+
*/
|
|
10
|
+
export interface PaginationConfiguration {
|
|
11
|
+
client: Client<any, any, any>;
|
|
12
|
+
pageSize?: number;
|
|
13
|
+
startingToken?: any;
|
|
14
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export interface ResponseMetadata {
|
|
2
|
+
/**
|
|
3
|
+
* The status code of the last HTTP response received for this operation.
|
|
4
|
+
*/
|
|
5
|
+
httpStatusCode?: number;
|
|
6
|
+
/**
|
|
7
|
+
* A unique identifier for the last request sent for this operation. Often
|
|
8
|
+
* requested by AWS service teams to aid in debugging.
|
|
9
|
+
*/
|
|
10
|
+
requestId?: string;
|
|
11
|
+
/**
|
|
12
|
+
* A secondary identifier for the last request sent. Used for debugging.
|
|
13
|
+
*/
|
|
14
|
+
extendedRequestId?: string;
|
|
15
|
+
/**
|
|
16
|
+
* A tertiary identifier for the last request sent. Used for debugging.
|
|
17
|
+
*/
|
|
18
|
+
cfId?: string;
|
|
19
|
+
/**
|
|
20
|
+
* The number of times this operation was attempted.
|
|
21
|
+
*/
|
|
22
|
+
attempts?: number;
|
|
23
|
+
/**
|
|
24
|
+
* The total amount of time (in milliseconds) that was spent waiting between
|
|
25
|
+
* retry attempts.
|
|
26
|
+
*/
|
|
27
|
+
totalRetryDelay?: number;
|
|
28
|
+
}
|
|
29
|
+
export interface MetadataBearer {
|
|
30
|
+
/**
|
|
31
|
+
* Metadata pertaining to this request.
|
|
32
|
+
*/
|
|
33
|
+
$metadata: ResponseMetadata;
|
|
34
|
+
}
|
package/src/serde.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Endpoint } from "./http";
|
|
2
|
+
import { RequestHandler } from "./transfer";
|
|
3
|
+
import { Decoder, Encoder, Provider } from "./util";
|
|
4
|
+
/**
|
|
5
|
+
* Interface for object requires an Endpoint set.
|
|
6
|
+
*/
|
|
7
|
+
export interface EndpointBearer {
|
|
8
|
+
endpoint: Provider<Endpoint>;
|
|
9
|
+
}
|
|
10
|
+
export interface StreamCollector {
|
|
11
|
+
/**
|
|
12
|
+
* A function that converts a stream into an array of bytes.
|
|
13
|
+
*
|
|
14
|
+
* @param stream The low-level native stream from browser or Nodejs runtime
|
|
15
|
+
*/
|
|
16
|
+
(stream: any): Promise<Uint8Array>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Request and Response serde util functions and settings for AWS services
|
|
20
|
+
*/
|
|
21
|
+
export interface SerdeContext extends EndpointBearer {
|
|
22
|
+
base64Encoder: Encoder;
|
|
23
|
+
base64Decoder: Decoder;
|
|
24
|
+
utf8Encoder: Encoder;
|
|
25
|
+
utf8Decoder: Decoder;
|
|
26
|
+
streamCollector: StreamCollector;
|
|
27
|
+
requestHandler: RequestHandler<any, any>;
|
|
28
|
+
disableHostPrefix: boolean;
|
|
29
|
+
}
|
|
30
|
+
export interface RequestSerializer<Request, Context extends EndpointBearer = any> {
|
|
31
|
+
/**
|
|
32
|
+
* Converts the provided `input` into a request object
|
|
33
|
+
*
|
|
34
|
+
* @param input The user input to serialize.
|
|
35
|
+
*
|
|
36
|
+
* @param context Context containing runtime-specific util functions.
|
|
37
|
+
*/
|
|
38
|
+
(input: any, context: Context): Promise<Request>;
|
|
39
|
+
}
|
|
40
|
+
export interface ResponseDeserializer<OutputType, ResponseType = any, Context = any> {
|
|
41
|
+
/**
|
|
42
|
+
* Converts the output of an operation into JavaScript types.
|
|
43
|
+
*
|
|
44
|
+
* @param output The HTTP response received from the service
|
|
45
|
+
*
|
|
46
|
+
* @param context context containing runtime-specific util functions.
|
|
47
|
+
*/
|
|
48
|
+
(output: ResponseType, context: Context): Promise<OutputType>;
|
|
49
|
+
}
|
package/src/shapes.d.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { MetadataBearer } from "./response";
|
|
2
|
+
/**
|
|
3
|
+
* A document type represents an untyped JSON-like value.
|
|
4
|
+
*
|
|
5
|
+
* Not all protocols support document types, and the serialization format of a
|
|
6
|
+
* document type is protocol specific. All JSON protocols SHOULD support
|
|
7
|
+
* document types and they SHOULD serialize document types inline as normal
|
|
8
|
+
* JSON values.
|
|
9
|
+
*/
|
|
10
|
+
export declare type DocumentType =
|
|
11
|
+
| null
|
|
12
|
+
| boolean
|
|
13
|
+
| number
|
|
14
|
+
| string
|
|
15
|
+
| DocumentType[]
|
|
16
|
+
| {
|
|
17
|
+
[prop: string]: DocumentType;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* A structure shape with the error trait.
|
|
21
|
+
* https://awslabs.github.io/smithy/spec/core.html#retryable-trait
|
|
22
|
+
*/
|
|
23
|
+
export interface RetryableTrait {
|
|
24
|
+
/**
|
|
25
|
+
* Indicates that the error is a retryable throttling error.
|
|
26
|
+
*/
|
|
27
|
+
readonly throttling?: boolean;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Type that is implemented by all Smithy shapes marked with the
|
|
31
|
+
* error trait.
|
|
32
|
+
*/
|
|
33
|
+
export interface SmithyException {
|
|
34
|
+
/**
|
|
35
|
+
* The shape ID name of the exception.
|
|
36
|
+
*/
|
|
37
|
+
readonly name: string;
|
|
38
|
+
/**
|
|
39
|
+
* Whether the client or server are at fault.
|
|
40
|
+
*/
|
|
41
|
+
readonly $fault: "client" | "server";
|
|
42
|
+
/**
|
|
43
|
+
* The service that encountered the exception.
|
|
44
|
+
*/
|
|
45
|
+
readonly $service?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Indicates that an error MAY be retried by the client.
|
|
48
|
+
*/
|
|
49
|
+
readonly $retryable?: RetryableTrait;
|
|
50
|
+
}
|
|
51
|
+
export declare type SdkError = Error & Partial<SmithyException> & Partial<MetadataBearer>;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { HttpRequest } from "./http";
|
|
2
|
+
/**
|
|
3
|
+
* A {Date} object, a unix (epoch) timestamp in seconds, or a string that can be
|
|
4
|
+
* understood by the JavaScript {Date} constructor.
|
|
5
|
+
*/
|
|
6
|
+
export declare type DateInput = number | string | Date;
|
|
7
|
+
export interface SigningArguments {
|
|
8
|
+
/**
|
|
9
|
+
* The date and time to be used as signature metadata. This value should be
|
|
10
|
+
* a Date object, a unix (epoch) timestamp, or a string that can be
|
|
11
|
+
* understood by the JavaScript `Date` constructor.If not supplied, the
|
|
12
|
+
* value returned by `new Date()` will be used.
|
|
13
|
+
*/
|
|
14
|
+
signingDate?: DateInput;
|
|
15
|
+
/**
|
|
16
|
+
* The service signing name. It will override the service name of the signer
|
|
17
|
+
* in current invocation
|
|
18
|
+
*/
|
|
19
|
+
signingService?: string;
|
|
20
|
+
/**
|
|
21
|
+
* The region name to sign the request. It will override the signing region of the
|
|
22
|
+
* signer in current invocation
|
|
23
|
+
*/
|
|
24
|
+
signingRegion?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface RequestSigningArguments extends SigningArguments {
|
|
27
|
+
/**
|
|
28
|
+
* A set of strings whose members represents headers that cannot be signed.
|
|
29
|
+
* All headers in the provided request will have their names converted to
|
|
30
|
+
* lower case and then checked for existence in the unsignableHeaders set.
|
|
31
|
+
*/
|
|
32
|
+
unsignableHeaders?: Set<string>;
|
|
33
|
+
/**
|
|
34
|
+
* A set of strings whose members represents headers that should be signed.
|
|
35
|
+
* Any values passed here will override those provided via unsignableHeaders,
|
|
36
|
+
* allowing them to be signed.
|
|
37
|
+
*
|
|
38
|
+
* All headers in the provided request will have their names converted to
|
|
39
|
+
* lower case before signing.
|
|
40
|
+
*/
|
|
41
|
+
signableHeaders?: Set<string>;
|
|
42
|
+
}
|
|
43
|
+
export interface RequestPresigningArguments extends RequestSigningArguments {
|
|
44
|
+
/**
|
|
45
|
+
* The number of seconds before the presigned URL expires
|
|
46
|
+
*/
|
|
47
|
+
expiresIn?: number;
|
|
48
|
+
/**
|
|
49
|
+
* A set of strings whose representing headers that should not be hoisted
|
|
50
|
+
* to presigned request's query string. If not supplied, the presigner
|
|
51
|
+
* moves all the AWS-specific headers (starting with `x-amz-`) to the request
|
|
52
|
+
* query string. If supplied, these headers remain in the presigned request's
|
|
53
|
+
* header.
|
|
54
|
+
* All headers in the provided request will have their names converted to
|
|
55
|
+
* lower case and then checked for existence in the unhoistableHeaders set.
|
|
56
|
+
*/
|
|
57
|
+
unhoistableHeaders?: Set<string>;
|
|
58
|
+
}
|
|
59
|
+
export interface EventSigningArguments extends SigningArguments {
|
|
60
|
+
priorSignature: string;
|
|
61
|
+
}
|
|
62
|
+
export interface RequestPresigner {
|
|
63
|
+
/**
|
|
64
|
+
* Signs a request for future use.
|
|
65
|
+
*
|
|
66
|
+
* The request will be valid until either the provided `expiration` time has
|
|
67
|
+
* passed or the underlying credentials have expired.
|
|
68
|
+
*
|
|
69
|
+
* @param requestToSign The request that should be signed.
|
|
70
|
+
* @param options Additional signing options.
|
|
71
|
+
*/
|
|
72
|
+
presign(requestToSign: HttpRequest, options?: RequestPresigningArguments): Promise<HttpRequest>;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* An object that signs request objects with AWS credentials using one of the
|
|
76
|
+
* AWS authentication protocols.
|
|
77
|
+
*/
|
|
78
|
+
export interface RequestSigner {
|
|
79
|
+
/**
|
|
80
|
+
* Sign the provided request for immediate dispatch.
|
|
81
|
+
*/
|
|
82
|
+
sign(requestToSign: HttpRequest, options?: RequestSigningArguments): Promise<HttpRequest>;
|
|
83
|
+
}
|
|
84
|
+
export interface StringSigner {
|
|
85
|
+
/**
|
|
86
|
+
* Sign the provided `stringToSign` for use outside of the context of
|
|
87
|
+
* request signing. Typical uses include signed policy generation.
|
|
88
|
+
*/
|
|
89
|
+
sign(stringToSign: string, options?: SigningArguments): Promise<string>;
|
|
90
|
+
}
|
|
91
|
+
export interface FormattedEvent {
|
|
92
|
+
headers: Uint8Array;
|
|
93
|
+
payload: Uint8Array;
|
|
94
|
+
}
|
|
95
|
+
export interface EventSigner {
|
|
96
|
+
/**
|
|
97
|
+
* Sign the individual event of the event stream.
|
|
98
|
+
*/
|
|
99
|
+
sign(event: FormattedEvent, options: EventSigningArguments): Promise<string>;
|
|
100
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare type RequestHandlerOutput<ResponseType> = {
|
|
2
|
+
response: ResponseType;
|
|
3
|
+
};
|
|
4
|
+
export interface RequestHandler<RequestType, ResponseType, HandlerOptions = {}> {
|
|
5
|
+
/**
|
|
6
|
+
* metadata contains information of a handler. For example
|
|
7
|
+
* 'h2' refers this handler is for handling HTTP/2 requests,
|
|
8
|
+
* whereas 'h1' refers handling HTTP1 requests
|
|
9
|
+
*/
|
|
10
|
+
metadata?: RequestHandlerMetadata;
|
|
11
|
+
destroy?: () => void;
|
|
12
|
+
handle: (request: RequestType, handlerOptions?: HandlerOptions) => Promise<RequestHandlerOutput<ResponseType>>;
|
|
13
|
+
}
|
|
14
|
+
export interface RequestHandlerMetadata {
|
|
15
|
+
handlerProtocol: string;
|
|
16
|
+
}
|
package/src/util.d.ts
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { Endpoint } from "./http";
|
|
2
|
+
import { FinalizeHandler, FinalizeHandlerArguments, FinalizeHandlerOutput } from "./middleware";
|
|
3
|
+
import { MetadataBearer } from "./response";
|
|
4
|
+
/**
|
|
5
|
+
* A function that, given a TypedArray of bytes, can produce a string
|
|
6
|
+
* representation thereof.
|
|
7
|
+
*
|
|
8
|
+
* @example An encoder function that converts bytes to hexadecimal
|
|
9
|
+
* representation would return `'deadbeef'` when given `new
|
|
10
|
+
* Uint8Array([0xde, 0xad, 0xbe, 0xef])`.
|
|
11
|
+
*/
|
|
12
|
+
export interface Encoder {
|
|
13
|
+
(input: Uint8Array): string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A function that, given a string, can derive the bytes represented by that
|
|
17
|
+
* string.
|
|
18
|
+
*
|
|
19
|
+
* @example A decoder function that converts bytes to hexadecimal
|
|
20
|
+
* representation would return `new Uint8Array([0xde, 0xad, 0xbe, 0xef])` when
|
|
21
|
+
* given the string `'deadbeef'`.
|
|
22
|
+
*/
|
|
23
|
+
export interface Decoder {
|
|
24
|
+
(input: string): Uint8Array;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* A function that, when invoked, returns a promise that will be fulfilled with
|
|
28
|
+
* a value of type T.
|
|
29
|
+
*
|
|
30
|
+
* @example A function that reads credentials from shared SDK configuration
|
|
31
|
+
* files, assuming roles and collecting MFA tokens as necessary.
|
|
32
|
+
*/
|
|
33
|
+
export interface Provider<T> {
|
|
34
|
+
(): Promise<T>;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* A function that, given a request body, determines the
|
|
38
|
+
* length of the body. This is used to determine the Content-Length
|
|
39
|
+
* that should be sent with a request.
|
|
40
|
+
*
|
|
41
|
+
* @example A function that reads a file stream and calculates
|
|
42
|
+
* the size of the file.
|
|
43
|
+
*/
|
|
44
|
+
export interface BodyLengthCalculator {
|
|
45
|
+
(body: any): number | undefined;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Interface that specifies the retry behavior
|
|
49
|
+
*/
|
|
50
|
+
export interface RetryStrategy {
|
|
51
|
+
/**
|
|
52
|
+
* The retry mode describing how the retry strategy control the traffic flow.
|
|
53
|
+
*/
|
|
54
|
+
mode?: string;
|
|
55
|
+
/**
|
|
56
|
+
* the retry behavior the will invoke the next handler and handle the retry accordingly.
|
|
57
|
+
* This function should also update the $metadata from the response accordingly.
|
|
58
|
+
* @see {@link ResponseMetadata}
|
|
59
|
+
*/
|
|
60
|
+
retry: <Input extends object, Output extends MetadataBearer>(
|
|
61
|
+
next: FinalizeHandler<Input, Output>,
|
|
62
|
+
args: FinalizeHandlerArguments<Input>
|
|
63
|
+
) => Promise<FinalizeHandlerOutput<Output>>;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Parses a URL in string form into an Endpoint object.
|
|
67
|
+
*/
|
|
68
|
+
export interface UrlParser {
|
|
69
|
+
(url: string): Endpoint;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Object containing regionalization information of
|
|
73
|
+
* AWS services.
|
|
74
|
+
*/
|
|
75
|
+
export interface RegionInfo {
|
|
76
|
+
hostname: string;
|
|
77
|
+
partition: string;
|
|
78
|
+
path?: string;
|
|
79
|
+
signingService?: string;
|
|
80
|
+
signingRegion?: string;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Function returns designated service's regionalization
|
|
84
|
+
* information from given region. Each service client
|
|
85
|
+
* comes with its regionalization provider. it serves
|
|
86
|
+
* to provide the default values of related configurations
|
|
87
|
+
*/
|
|
88
|
+
export interface RegionInfoProvider {
|
|
89
|
+
(region: string, options?: any): Promise<RegionInfo | undefined>;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* A tuple that represents an API name and optional version
|
|
93
|
+
* of a library built using the AWS SDK.
|
|
94
|
+
*/
|
|
95
|
+
export declare type UserAgentPair = [name: string, version?: string];
|
|
96
|
+
/**
|
|
97
|
+
* User agent data that to be put into the request's user
|
|
98
|
+
* agent.
|
|
99
|
+
*/
|
|
100
|
+
export declare type UserAgent = UserAgentPair[];
|
package/src/waiter.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { AbortController } from "./abort";
|
|
2
|
+
export interface WaiterConfiguration<Client> {
|
|
3
|
+
/**
|
|
4
|
+
* Required service client
|
|
5
|
+
*/
|
|
6
|
+
client: Client;
|
|
7
|
+
/**
|
|
8
|
+
* The amount of time in seconds a user is willing to wait for a waiter to complete.
|
|
9
|
+
*/
|
|
10
|
+
maxWaitTime: number;
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated Use abortSignal
|
|
13
|
+
* Abort controller. Used for ending the waiter early.
|
|
14
|
+
*/
|
|
15
|
+
abortController?: AbortController;
|
|
16
|
+
/**
|
|
17
|
+
* Abort Signal. Used for ending the waiter early.
|
|
18
|
+
*/
|
|
19
|
+
abortSignal?: AbortController["signal"];
|
|
20
|
+
/**
|
|
21
|
+
* The minimum amount of time to delay between retries in seconds. This is the
|
|
22
|
+
* floor of the exponential backoff. This value defaults to service default
|
|
23
|
+
* if not specified. This value MUST be less than or equal to maxDelay and greater than 0.
|
|
24
|
+
*/
|
|
25
|
+
minDelay?: number;
|
|
26
|
+
/**
|
|
27
|
+
* The maximum amount of time to delay between retries in seconds. This is the
|
|
28
|
+
* ceiling of the exponential backoff. This value defaults to service default
|
|
29
|
+
* if not specified. If specified, this value MUST be greater than or equal to 1.
|
|
30
|
+
*/
|
|
31
|
+
maxDelay?: number;
|
|
32
|
+
}
|
package/tsconfig.cjs.json
CHANGED
package/tsconfig.es.json
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
+
"baseUrl": ".",
|
|
3
4
|
"lib": ["es5", "es2015.promise", "es2015.collection", "es2015.iterable", "es2015.symbol.wellknown"],
|
|
4
|
-
"
|
|
5
|
-
"rootDir": "
|
|
6
|
-
"outDir": "./dist/es",
|
|
7
|
-
"baseUrl": "."
|
|
5
|
+
"outDir": "dist/es",
|
|
6
|
+
"rootDir": "src"
|
|
8
7
|
},
|
|
9
8
|
"extends": "../../tsconfig.es.json",
|
|
10
9
|
"include": ["src/"]
|