@aws-sdk/types 1.0.0-rc.8 → 3.4.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 (49) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/README.md +1 -1
  3. package/dist/cjs/middleware.js +1 -1
  4. package/dist/cjs/pagination.js +1 -1
  5. package/dist/cjs/response.js +1 -1
  6. package/dist/cjs/util.js +1 -1
  7. package/dist/es/middleware.js +1 -1
  8. package/dist/es/pagination.js +1 -1
  9. package/dist/es/response.js +1 -1
  10. package/dist/es/util.js +1 -1
  11. package/package.json +10 -2
  12. package/src/middleware.ts +15 -0
  13. package/src/pagination.ts +1 -1
  14. package/src/response.ts +0 -7
  15. package/src/util.ts +22 -1
  16. package/tsconfig.cjs.json +1 -0
  17. package/tsconfig.es.json +1 -0
  18. package/{dist/cjs → types}/abort.d.ts +0 -0
  19. package/{dist/cjs → types}/client.d.ts +0 -0
  20. package/{dist/cjs → types}/command.d.ts +0 -0
  21. package/{dist/cjs → types}/credentials.d.ts +0 -0
  22. package/{dist/cjs → types}/crypto.d.ts +0 -0
  23. package/{dist/cjs → types}/eventStream.d.ts +0 -0
  24. package/{dist/cjs → types}/http.d.ts +0 -0
  25. package/{dist/cjs → types}/index.d.ts +0 -0
  26. package/{dist/cjs → types}/logger.d.ts +0 -0
  27. package/{dist/cjs → types}/middleware.d.ts +13 -0
  28. package/{dist/cjs → types}/pagination.d.ts +1 -1
  29. package/{dist/cjs → types}/response.d.ts +0 -5
  30. package/{dist/cjs → types}/serde.d.ts +0 -0
  31. package/{dist/cjs → types}/signature.d.ts +0 -0
  32. package/{dist/cjs → types}/transfer.d.ts +0 -0
  33. package/{dist/es → types/ts3.4}/abort.d.ts +42 -42
  34. package/{dist/es → types/ts3.4}/client.d.ts +23 -23
  35. package/{dist/es → types/ts3.4}/command.d.ts +7 -7
  36. package/{dist/es → types/ts3.4}/credentials.d.ts +24 -24
  37. package/{dist/es → types/ts3.4}/crypto.d.ts +47 -47
  38. package/{dist/es → types/ts3.4}/eventStream.d.ts +84 -84
  39. package/{dist/es → types/ts3.4}/http.d.ts +92 -92
  40. package/{dist/es → types/ts3.4}/index.d.ts +15 -15
  41. package/{dist/es → types/ts3.4}/logger.d.ts +26 -26
  42. package/{dist/es → types/ts3.4}/middleware.d.ts +338 -325
  43. package/{dist/es → types/ts3.4}/pagination.d.ts +14 -14
  44. package/{dist/es → types/ts3.4}/response.d.ts +34 -39
  45. package/{dist/es → types/ts3.4}/serde.d.ts +49 -49
  46. package/{dist/es → types/ts3.4}/signature.d.ts +100 -100
  47. package/{dist/es → types/ts3.4}/transfer.d.ts +16 -16
  48. package/{dist/es → types/ts3.4}/util.d.ts +100 -83
  49. package/{dist/cjs → types}/util.d.ts +14 -0
@@ -1,325 +1,338 @@
1
- import { Logger } from "./logger";
2
- export interface InitializeHandlerArguments<Input extends object> {
3
- /**
4
- * User input to a command. Reflects the userland representation of the
5
- * union of data types the command can effectively handle.
6
- */
7
- input: Input;
8
- }
9
- export interface InitializeHandlerOutput<Output extends object> extends DeserializeHandlerOutput<Output> {
10
- output: Output;
11
- }
12
- export interface SerializeHandlerArguments<Input extends object> extends InitializeHandlerArguments<Input> {
13
- /**
14
- * The user input serialized as a request object. The request object is unknown,
15
- * so you cannot modify it directly. When work with request, you need to guard its
16
- * type to e.g. HttpRequest with 'instanceof' operand
17
- *
18
- * During the build phase of the execution of a middleware stack, a built
19
- * request may or may not be available.
20
- */
21
- request?: unknown;
22
- }
23
- export interface SerializeHandlerOutput<Output extends object> extends InitializeHandlerOutput<Output> {
24
- }
25
- export interface BuildHandlerArguments<Input extends object> extends FinalizeHandlerArguments<Input> {
26
- }
27
- export interface BuildHandlerOutput<Output extends object> extends InitializeHandlerOutput<Output> {
28
- }
29
- export interface FinalizeHandlerArguments<Input extends object> extends SerializeHandlerArguments<Input> {
30
- /**
31
- * The user input serialized as a request.
32
- */
33
- request: unknown;
34
- }
35
- export interface FinalizeHandlerOutput<Output extends object> extends InitializeHandlerOutput<Output> {
36
- }
37
- export interface DeserializeHandlerArguments<Input extends object> extends FinalizeHandlerArguments<Input> {
38
- }
39
- export interface DeserializeHandlerOutput<Output extends object> {
40
- /**
41
- * The raw response object from runtime is deserialized to structured output object.
42
- * The response object is unknown so you cannot modify it directly. When work with
43
- * response, you need to guard its type to e.g. HttpResponse with 'instanceof' operand.
44
- *
45
- * During the deserialize phase of the execution of a middleware stack, a deserialized
46
- * response may or may not be available
47
- */
48
- response: unknown;
49
- output?: Output;
50
- }
51
- export interface InitializeHandler<Input extends object, Output extends object> {
52
- /**
53
- * Asynchronously converts an input object into an output object.
54
- *
55
- * @param args An object containing a input to the command as well as any
56
- * associated or previously generated execution artifacts.
57
- */
58
- (args: InitializeHandlerArguments<Input>): Promise<InitializeHandlerOutput<Output>>;
59
- }
60
- export declare type Handler<Input extends object, Output extends object> = InitializeHandler<Input, Output>;
61
- export interface SerializeHandler<Input extends object, Output extends object> {
62
- /**
63
- * Asynchronously converts an input object into an output object.
64
- *
65
- * @param args An object containing a input to the command as well as any
66
- * associated or previously generated execution artifacts.
67
- */
68
- (args: SerializeHandlerArguments<Input>): Promise<SerializeHandlerOutput<Output>>;
69
- }
70
- export interface FinalizeHandler<Input extends object, Output extends object> {
71
- /**
72
- * Asynchronously converts an input object into an output object.
73
- *
74
- * @param args An object containing a input to the command as well as any
75
- * associated or previously generated execution artifacts.
76
- */
77
- (args: FinalizeHandlerArguments<Input>): Promise<FinalizeHandlerOutput<Output>>;
78
- }
79
- export interface BuildHandler<Input extends object, Output extends object> {
80
- (args: BuildHandlerArguments<Input>): Promise<BuildHandlerOutput<Output>>;
81
- }
82
- export interface DeserializeHandler<Input extends object, Output extends object> {
83
- (args: DeserializeHandlerArguments<Input>): Promise<DeserializeHandlerOutput<Output>>;
84
- }
85
- /**
86
- * A factory function that creates functions implementing the {Handler}
87
- * interface.
88
- */
89
- export interface InitializeMiddleware<Input extends object, Output extends object> {
90
- /**
91
- * @param next The handler to invoke after this middleware has operated on
92
- * the user input and before this middleware operates on the output.
93
- *
94
- * @param context Invariant data and functions for use by the handler.
95
- */
96
- (next: InitializeHandler<Input, Output>, context: HandlerExecutionContext): InitializeHandler<Input, Output>;
97
- }
98
- /**
99
- * A factory function that creates functions implementing the {BuildHandler}
100
- * interface.
101
- */
102
- export interface SerializeMiddleware<Input extends object, Output extends object> {
103
- /**
104
- * @param next The handler to invoke after this middleware has operated on
105
- * the user input and before this middleware operates on the output.
106
- *
107
- * @param context Invariant data and functions for use by the handler.
108
- */
109
- (next: SerializeHandler<Input, Output>, context: HandlerExecutionContext): SerializeHandler<Input, Output>;
110
- }
111
- /**
112
- * A factory function that creates functions implementing the {FinalizeHandler}
113
- * interface.
114
- */
115
- export interface FinalizeRequestMiddleware<Input extends object, Output extends object> {
116
- /**
117
- * @param next The handler to invoke after this middleware has operated on
118
- * the user input and before this middleware operates on the output.
119
- *
120
- * @param context Invariant data and functions for use by the handler.
121
- */
122
- (next: FinalizeHandler<Input, Output>, context: HandlerExecutionContext): FinalizeHandler<Input, Output>;
123
- }
124
- export interface BuildMiddleware<Input extends object, Output extends object> {
125
- (next: BuildHandler<Input, Output>, context: HandlerExecutionContext): BuildHandler<Input, Output>;
126
- }
127
- export interface DeserializeMiddleware<Input extends object, Output extends object> {
128
- (next: DeserializeHandler<Input, Output>, context: HandlerExecutionContext): DeserializeHandler<Input, Output>;
129
- }
130
- export declare type MiddlewareType<Input extends object, Output extends object> = InitializeMiddleware<Input, Output> | SerializeMiddleware<Input, Output> | BuildMiddleware<Input, Output> | FinalizeRequestMiddleware<Input, Output> | DeserializeMiddleware<Input, Output>;
131
- /**
132
- * A factory function that creates the terminal handler atop which a middleware
133
- * stack sits.
134
- */
135
- export interface Terminalware {
136
- <Input extends object, Output extends object>(context: HandlerExecutionContext): DeserializeHandler<Input, Output>;
137
- }
138
- export declare type Step = "initialize" | "serialize" | "build" | "finalizeRequest" | "deserialize";
139
- export declare type Priority = "high" | "normal" | "low";
140
- export interface HandlerOptions {
141
- /**
142
- * Handlers are ordered using a "step" that describes the stage of command
143
- * execution at which the handler will be executed. The available steps are:
144
- *
145
- * - initialize: The input is being prepared. Examples of typical
146
- * initialization tasks include injecting default options computing
147
- * derived parameters.
148
- * - serialize: The input is complete and ready to be serialized. Examples
149
- * of typical serialization tasks include input validation and building
150
- * an HTTP request from user input.
151
- * - build: The input has been serialized into an HTTP request, but that
152
- * request may require further modification. Any request alterations
153
- * will be applied to all retries. Examples of typical build tasks
154
- * include injecting HTTP headers that describe a stable aspect of the
155
- * request, such as `Content-Length` or a body checksum.
156
- * - finalizeRequest: The request is being prepared to be sent over the wire. The
157
- * request in this stage should already be semantically complete and
158
- * should therefore only be altered as match the recipient's
159
- * expectations. Examples of typical finalization tasks include request
160
- * signing and injecting hop-by-hop headers.
161
- * - deserialize: The response has arrived, the middleware here will deserialize
162
- * the raw response object to structured response
163
- *
164
- * Unlike initialization and build handlers, which are executed once
165
- * per operation execution, finalization and deserialize handlers will be
166
- * executed foreach HTTP request sent.
167
- *
168
- * @default 'initialize'
169
- */
170
- step?: Step;
171
- /**
172
- * A list of strings to any that identify the general purpose or important
173
- * characteristics of a given handler.
174
- */
175
- tags?: Array<string>;
176
- /**
177
- * A unique name to refer to a middleware
178
- */
179
- name?: string;
180
- }
181
- export interface AbsoluteLocation {
182
- /**
183
- * By default middleware will be added to individual step in un-guaranteed order.
184
- * In the case that
185
- *
186
- * @default 'normal'
187
- */
188
- priority?: Priority;
189
- }
190
- export declare type Relation = "before" | "after";
191
- export interface RelativeLocation {
192
- /**
193
- * Specify the relation to be before or after a know middleware.
194
- */
195
- relation: Relation;
196
- /**
197
- * A known middleware name to indicate inserting middleware's location.
198
- */
199
- toMiddleware: string;
200
- }
201
- export declare type RelativeMiddlewareOptions = RelativeLocation & Omit<HandlerOptions, "step">;
202
- export interface InitializeHandlerOptions extends HandlerOptions {
203
- step?: "initialize";
204
- }
205
- export interface SerializeHandlerOptions extends HandlerOptions {
206
- step: "serialize";
207
- }
208
- export interface BuildHandlerOptions extends HandlerOptions {
209
- step: "build";
210
- }
211
- export interface FinalizeRequestHandlerOptions extends HandlerOptions {
212
- step: "finalizeRequest";
213
- }
214
- export interface DeserializeHandlerOptions extends HandlerOptions {
215
- step: "deserialize";
216
- }
217
- /**
218
- * A stack storing middleware. It can be resolved into a handler. It supports 2
219
- * approaches for adding middleware:
220
- * 1. Adding middleware to specific step with `add()`. The order of middleware
221
- * added into same step is determined by order of adding them. If one middleware
222
- * needs to be executed at the front of the step or at the end of step, set
223
- * `priority` options to `high` or `low`.
224
- * 2. Adding middleware to location relative to known middleware with `addRelativeTo()`.
225
- * This is useful when given middleware must be executed before or after specific
226
- * middleware(`toMiddleware`). You can add a middleware relatively to another
227
- * middleware which also added relatively. But eventually, this relative middleware
228
- * chain **must** be 'anchored' by a middleware that added using `add()` API
229
- * with absolute `step` and `priority`. This mothod will throw if specified
230
- * `toMiddleware` is not found.
231
- */
232
- export interface MiddlewareStack<Input extends object, Output extends object> extends Pluggable<Input, Output> {
233
- /**
234
- * Add middleware to the stack to be executed during the "initialize" step,
235
- * optionally specifying a priority, tags and name
236
- */
237
- add(middleware: InitializeMiddleware<Input, Output>, options?: InitializeHandlerOptions & AbsoluteLocation): void;
238
- /**
239
- * Add middleware to the stack to be executed during the "serialize" step,
240
- * optionally specifying a priority, tags and name
241
- */
242
- add(middleware: SerializeMiddleware<Input, Output>, options: SerializeHandlerOptions & AbsoluteLocation): void;
243
- /**
244
- * Add middleware to the stack to be executed during the "build" step,
245
- * optionally specifying a priority, tags and name
246
- */
247
- add(middleware: BuildMiddleware<Input, Output>, options: BuildHandlerOptions & AbsoluteLocation): void;
248
- /**
249
- * Add middleware to the stack to be executed during the "finalizeRequest" step,
250
- * optionally specifying a priority, tags and name
251
- */
252
- add(middleware: FinalizeRequestMiddleware<Input, Output>, options: FinalizeRequestHandlerOptions & AbsoluteLocation): void;
253
- /**
254
- * Add middleware to the stack to be executed during the "deserialize" step,
255
- * optionally specifying a priority, tags and name
256
- */
257
- add(middleware: DeserializeMiddleware<Input, Output>, options: DeserializeHandlerOptions & AbsoluteLocation): void;
258
- /**
259
- * Add middleware to a stack position before or after a known middleware,optionally
260
- * specifying name and tags.
261
- */
262
- addRelativeTo(middleware: MiddlewareType<Input, Output>, options: RelativeMiddlewareOptions): void;
263
- /**
264
- * Apply a customization function to mutate the middleware stack, often
265
- * used for customizations that requires mutating multiple middleware.
266
- */
267
- use(pluggable: Pluggable<Input, Output>): void;
268
- /**
269
- * Create a shallow clone of this stack. Step bindings and handler priorities
270
- * and tags are preserved in the copy.
271
- */
272
- clone(): MiddlewareStack<Input, Output>;
273
- /**
274
- * Removes middleware from the stack.
275
- *
276
- * If a string is provided, it will be treated as middleware name. If a middleware
277
- * is inserted with the given name, it will be removed.
278
- *
279
- * If a middleware class is provided, all usages thereof will be removed.
280
- */
281
- remove(toRemove: MiddlewareType<Input, Output> | string): boolean;
282
- /**
283
- * Removes middleware that contains given tag
284
- *
285
- * Multiple middleware will potentially be removed
286
- */
287
- removeByTag(toRemove: string): boolean;
288
- /**
289
- * Create a stack containing the middlewares in this stack as well as the
290
- * middlewares in the `from` stack. Neither source is modified, and step
291
- * bindings and handler priorities and tags are preserved in the copy.
292
- */
293
- concat<InputType extends Input, OutputType extends Output>(from: MiddlewareStack<InputType, OutputType>): MiddlewareStack<InputType, OutputType>;
294
- /**
295
- * Builds a single handler function from zero or more middleware classes and
296
- * a core handler. The core handler is meant to send command objects to AWS
297
- * services and return promises that will resolve with the operation result
298
- * or be rejected with an error.
299
- *
300
- * When a composed handler is invoked, the arguments will pass through all
301
- * middleware in a defined order, and the return from the innermost handler
302
- * will pass through all middleware in the reverse of that order.
303
- */
304
- resolve<InputType extends Input, OutputType extends Output>(handler: DeserializeHandler<InputType, OutputType>, context: HandlerExecutionContext): InitializeHandler<InputType, OutputType>;
305
- }
306
- /**
307
- * Data and helper objects that are not expected to change from one execution of
308
- * a composed handler to another.
309
- */
310
- export interface HandlerExecutionContext {
311
- /**
312
- * A logger that may be invoked by any handler during execution of an
313
- * operation.
314
- */
315
- logger?: Logger;
316
- [key: string]: any;
317
- }
318
- export interface Pluggable<Input extends object, Output extends object> {
319
- /**
320
- * A function that mutate the passed in middleware stack. Functions implementing
321
- * this interface can add, remove, modify existing middleware stack from clients
322
- * or commands
323
- */
324
- applyToStack: (stack: MiddlewareStack<Input, Output>) => void;
325
- }
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
+ }
26
+ export interface BuildHandlerArguments<Input extends object> extends FinalizeHandlerArguments<Input> {
27
+ }
28
+ export interface BuildHandlerOutput<Output extends object> extends InitializeHandlerOutput<Output> {
29
+ }
30
+ export interface FinalizeHandlerArguments<Input extends object> extends SerializeHandlerArguments<Input> {
31
+ /**
32
+ * The user input serialized as a request.
33
+ */
34
+ request: unknown;
35
+ }
36
+ export interface FinalizeHandlerOutput<Output extends object> extends InitializeHandlerOutput<Output> {
37
+ }
38
+ export interface DeserializeHandlerArguments<Input extends object> extends FinalizeHandlerArguments<Input> {
39
+ }
40
+ export interface DeserializeHandlerOutput<Output extends object> {
41
+ /**
42
+ * The raw response object from runtime is deserialized to structured output object.
43
+ * The response object is unknown so you cannot modify it directly. When work with
44
+ * response, you need to guard its type to e.g. HttpResponse with 'instanceof' operand.
45
+ *
46
+ * During the deserialize phase of the execution of a middleware stack, a deserialized
47
+ * response may or may not be available
48
+ */
49
+ response: unknown;
50
+ output?: Output;
51
+ }
52
+ export interface InitializeHandler<Input extends object, Output extends object> {
53
+ /**
54
+ * Asynchronously converts an input object into an output object.
55
+ *
56
+ * @param args An object containing a input to the command as well as any
57
+ * associated or previously generated execution artifacts.
58
+ */
59
+ (args: InitializeHandlerArguments<Input>): Promise<InitializeHandlerOutput<Output>>;
60
+ }
61
+ export declare type Handler<Input extends object, Output extends object> = InitializeHandler<Input, Output>;
62
+ export interface SerializeHandler<Input extends object, Output extends object> {
63
+ /**
64
+ * Asynchronously converts an input object into an output object.
65
+ *
66
+ * @param args An object containing a input to the command as well as any
67
+ * associated or previously generated execution artifacts.
68
+ */
69
+ (args: SerializeHandlerArguments<Input>): Promise<SerializeHandlerOutput<Output>>;
70
+ }
71
+ export interface FinalizeHandler<Input extends object, Output extends object> {
72
+ /**
73
+ * Asynchronously converts an input object into an output object.
74
+ *
75
+ * @param args An object containing a input to the command as well as any
76
+ * associated or previously generated execution artifacts.
77
+ */
78
+ (args: FinalizeHandlerArguments<Input>): Promise<FinalizeHandlerOutput<Output>>;
79
+ }
80
+ export interface BuildHandler<Input extends object, Output extends object> {
81
+ (args: BuildHandlerArguments<Input>): Promise<BuildHandlerOutput<Output>>;
82
+ }
83
+ export interface DeserializeHandler<Input extends object, Output extends object> {
84
+ (args: DeserializeHandlerArguments<Input>): Promise<DeserializeHandlerOutput<Output>>;
85
+ }
86
+ /**
87
+ * A factory function that creates functions implementing the {Handler}
88
+ * interface.
89
+ */
90
+ export interface InitializeMiddleware<Input extends object, Output extends object> {
91
+ /**
92
+ * @param next The handler to invoke after this middleware has operated on
93
+ * the user input and before this middleware operates on the output.
94
+ *
95
+ * @param context Invariant data and functions for use by the handler.
96
+ */
97
+ (next: InitializeHandler<Input, Output>, context: HandlerExecutionContext): InitializeHandler<Input, Output>;
98
+ }
99
+ /**
100
+ * A factory function that creates functions implementing the {BuildHandler}
101
+ * interface.
102
+ */
103
+ export interface SerializeMiddleware<Input extends object, Output extends object> {
104
+ /**
105
+ * @param next The handler to invoke after this middleware has operated on
106
+ * the user input and before this middleware operates on the output.
107
+ *
108
+ * @param context Invariant data and functions for use by the handler.
109
+ */
110
+ (next: SerializeHandler<Input, Output>, context: HandlerExecutionContext): SerializeHandler<Input, Output>;
111
+ }
112
+ /**
113
+ * A factory function that creates functions implementing the {FinalizeHandler}
114
+ * interface.
115
+ */
116
+ export interface FinalizeRequestMiddleware<Input extends object, Output extends object> {
117
+ /**
118
+ * @param next The handler to invoke after this middleware has operated on
119
+ * the user input and before this middleware operates on the output.
120
+ *
121
+ * @param context Invariant data and functions for use by the handler.
122
+ */
123
+ (next: FinalizeHandler<Input, Output>, context: HandlerExecutionContext): FinalizeHandler<Input, Output>;
124
+ }
125
+ export interface BuildMiddleware<Input extends object, Output extends object> {
126
+ (next: BuildHandler<Input, Output>, context: HandlerExecutionContext): BuildHandler<Input, Output>;
127
+ }
128
+ export interface DeserializeMiddleware<Input extends object, Output extends object> {
129
+ (next: DeserializeHandler<Input, Output>, context: HandlerExecutionContext): DeserializeHandler<Input, Output>;
130
+ }
131
+ export declare type MiddlewareType<Input extends object, Output extends object> = InitializeMiddleware<Input, Output> | SerializeMiddleware<Input, Output> | BuildMiddleware<Input, Output> | FinalizeRequestMiddleware<Input, Output> | 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 & Pick<HandlerOptions, Exclude<keyof 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(middleware: FinalizeRequestMiddleware<Input, Output>, options: FinalizeRequestHandlerOptions & AbsoluteLocation): void;
260
+ /**
261
+ * Add middleware to the stack to be executed during the "deserialize" step,
262
+ * optionally specifying a priority, tags and name
263
+ */
264
+ add(middleware: DeserializeMiddleware<Input, Output>, options: DeserializeHandlerOptions & AbsoluteLocation): void;
265
+ /**
266
+ * Add middleware to a stack position before or after a known middleware,optionally
267
+ * specifying name and tags.
268
+ */
269
+ addRelativeTo(middleware: MiddlewareType<Input, Output>, options: RelativeMiddlewareOptions): void;
270
+ /**
271
+ * Apply a customization function to mutate the middleware stack, often
272
+ * used for customizations that requires mutating multiple middleware.
273
+ */
274
+ use(pluggable: Pluggable<Input, Output>): void;
275
+ /**
276
+ * Create a shallow clone of this stack. Step bindings and handler priorities
277
+ * and tags are preserved in the copy.
278
+ */
279
+ clone(): MiddlewareStack<Input, Output>;
280
+ /**
281
+ * Removes middleware from the stack.
282
+ *
283
+ * If a string is provided, it will be treated as middleware name. If a middleware
284
+ * is inserted with the given name, it will be removed.
285
+ *
286
+ * If a middleware class is provided, all usages thereof will be removed.
287
+ */
288
+ remove(toRemove: MiddlewareType<Input, Output> | string): boolean;
289
+ /**
290
+ * Removes middleware that contains given tag
291
+ *
292
+ * Multiple middleware will potentially be removed
293
+ */
294
+ removeByTag(toRemove: string): boolean;
295
+ /**
296
+ * Create a stack containing the middlewares in this stack as well as the
297
+ * middlewares in the `from` stack. Neither source is modified, and step
298
+ * bindings and handler priorities and tags are preserved in the copy.
299
+ */
300
+ concat<InputType extends Input, OutputType extends Output>(from: MiddlewareStack<InputType, OutputType>): MiddlewareStack<InputType, OutputType>;
301
+ /**
302
+ * Builds a single handler function from zero or more middleware classes and
303
+ * a core handler. The core handler is meant to send command objects to AWS
304
+ * services and return promises that will resolve with the operation result
305
+ * or be rejected with an error.
306
+ *
307
+ * When a composed handler is invoked, the arguments will pass through all
308
+ * middleware in a defined order, and the return from the innermost handler
309
+ * will pass through all middleware in the reverse of that order.
310
+ */
311
+ resolve<InputType extends Input, OutputType extends Output>(handler: DeserializeHandler<InputType, OutputType>, context: HandlerExecutionContext): InitializeHandler<InputType, OutputType>;
312
+ }
313
+ /**
314
+ * Data and helper objects that are not expected to change from one execution of
315
+ * a composed handler to another.
316
+ */
317
+ export interface HandlerExecutionContext {
318
+ /**
319
+ * A logger that may be invoked by any handler during execution of an
320
+ * operation.
321
+ */
322
+ logger?: Logger;
323
+ /**
324
+ * Additional user agent that inferred by middleware. It can be used to save
325
+ * the internal user agent sections without overriding the `customUserAgent`
326
+ * config in clients.
327
+ */
328
+ userAgent?: UserAgent;
329
+ [key: string]: any;
330
+ }
331
+ export interface Pluggable<Input extends object, Output extends object> {
332
+ /**
333
+ * A function that mutate the passed in middleware stack. Functions implementing
334
+ * this interface can add, remove, modify existing middleware stack from clients
335
+ * or commands
336
+ */
337
+ applyToStack: (stack: MiddlewareStack<Input, Output>) => void;
338
+ }