Skip to content

Commit f084181

Browse files
committed
feat: rename stack finalize step to finalizeRequest
1 parent 5378332 commit f084181

File tree

4 files changed

+26
-29
lines changed

4 files changed

+26
-29
lines changed

packages/middleware-stack/src/index.spec.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
FinalizeHandlerArguments,
66
Middleware,
77
HandlerExecutionContext,
8-
FinalizeMiddleware,
8+
FinalizeRequestMiddleware,
99
FinalizeHandler,
1010
BuildMiddleware,
1111
HandlerOutput,
@@ -19,7 +19,7 @@ type output = object;
1919
//return tagged union to make compiler happy
2020
function getConcatMiddleware(
2121
message: string
22-
): Middleware<input, output> | FinalizeMiddleware<input, output> {
22+
): Middleware<input, output> | FinalizeRequestMiddleware<input, output> {
2323
return (next: Handler<input, output>): Handler<input, output> => {
2424
return (args: HandlerArguments<input>): Promise<HandlerOutput<output>> =>
2525
next({
@@ -47,8 +47,8 @@ describe("MiddlewareStack", () => {
4747
[getConcatMiddleware("first"), { priority: 10 }],
4848
[getConcatMiddleware("fourth"), { step: "build" }],
4949
[getConcatMiddleware("third"), { step: "build", priority: 1 }],
50-
[getConcatMiddleware("fifth"), { step: "finalize" }],
51-
[getConcatMiddleware("sixth"), { step: "finalize", priority: -1 }],
50+
[getConcatMiddleware("fifth"), { step: "finalizeRequest" }],
51+
[getConcatMiddleware("sixth"), { step: "finalizeRequest", priority: -1 }],
5252
[getConcatMiddleware("seven"), { step: "deserialize" }]
5353
]);
5454

@@ -93,11 +93,11 @@ describe("MiddlewareStack", () => {
9393

9494
const secondStack = new MiddlewareStack<input, output>();
9595
secondStack.add(
96-
getConcatMiddleware("fourth") as FinalizeMiddleware<input, output>,
96+
getConcatMiddleware("fourth") as FinalizeRequestMiddleware<input, output>,
9797
{ step: "build" }
9898
);
9999
secondStack.add(
100-
getConcatMiddleware("third") as FinalizeMiddleware<input, output>,
100+
getConcatMiddleware("third") as FinalizeRequestMiddleware<input, output>,
101101
{ step: "build", priority: 100 }
102102
);
103103

@@ -187,9 +187,9 @@ describe("MiddlewareStack", () => {
187187
step: "build"
188188
});
189189
stack.add(
190-
getConcatMiddleware("sixth") as FinalizeMiddleware<input, output>,
190+
getConcatMiddleware("sixth") as FinalizeRequestMiddleware<input, output>,
191191
{
192-
step: "finalize"
192+
step: "finalizeRequest"
193193
}
194194
);
195195
const filteredStack = stack.filter(middlewareStats => {

packages/middleware-stack/src/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import {
22
BuildHandlerOptions,
33
FinalizeHandler,
4-
FinalizeHandlerOptions,
4+
FinalizeRequestHandlerOptions,
55
SerializeMiddleware,
6-
FinalizeMiddleware,
6+
FinalizeRequestMiddleware,
77
BuildMiddleware,
88
Handler,
99
HandlerExecutionContext,
@@ -42,13 +42,13 @@ export class MiddlewareStack<Input extends object, Output extends object> {
4242
): void;
4343

4444
add(
45-
middleware: FinalizeMiddleware<Input, Output>,
45+
middleware: FinalizeRequestMiddleware<Input, Output>,
4646
options: BuildHandlerOptions
4747
): void;
4848

4949
add(
50-
middleware: FinalizeMiddleware<Input, Output>,
51-
options: FinalizeHandlerOptions
50+
middleware: FinalizeRequestMiddleware<Input, Output>,
51+
options: FinalizeRequestHandlerOptions
5252
): void;
5353

5454
add(
@@ -165,6 +165,6 @@ const stepWeights = {
165165
initialize: 5,
166166
serialize: 4,
167167
build: 3,
168-
finalize: 2,
168+
finalizeRequest: 2,
169169
deserialize: 1
170170
};

packages/types/src/client.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,7 @@ interface InvokeFunction<
136136
* A general interface for service clients, idempotent to browser or node clients
137137
*/
138138
export interface AWSClient {
139-
readonly config: ClientResolvedConfigurationBase;
139+
// readonly config: ClientResolvedConfigurationBase;
140140
middlewareStack: MiddlewareStack<any, any>;
141141
send: InvokeFunction<any, any>;
142142
}
143-
144-
export interface Injectable {
145-
injectInto: (client: AWSClient) => AWSClient;
146-
}

packages/types/src/middleware.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Logger } from "./logger";
2+
import { AWSClient } from "./client";
23

34
export interface HandlerArguments<Input extends object> {
45
/**
@@ -149,7 +150,7 @@ export interface SerializeMiddleware<
149150
* A factory function that creates functions implementing the {FinalizeHandler}
150151
* interface.
151152
*/
152-
export interface FinalizeMiddleware<
153+
export interface FinalizeRequestMiddleware<
153154
Input extends object,
154155
Output extends object
155156
> {
@@ -166,7 +167,7 @@ export interface FinalizeMiddleware<
166167
}
167168

168169
export interface BuildMiddleware<Input extends object, Output extends object>
169-
extends FinalizeMiddleware<Input, Output> {}
170+
extends FinalizeRequestMiddleware<Input, Output> {}
170171

171172
export interface DeserializeMiddleware<
172173
Input extends object,
@@ -189,7 +190,7 @@ export type Step =
189190
| "initialize"
190191
| "serialize"
191192
| "build"
192-
| "finalize"
193+
| "finalizeRequest"
193194
| "deserialize";
194195

195196
export interface HandlerOptions {
@@ -208,7 +209,7 @@ export interface HandlerOptions {
208209
* will be applied to all retries. Examples of typical build tasks
209210
* include injecting HTTP headers that describe a stable aspect of the
210211
* request, such as `Content-Length` or a body checksum.
211-
* - finalize: The request is being prepared to be sent over the wire. The
212+
* - finalizeRequest: The request is being prepared to be sent over the wire. The
212213
* request in this stage should already be semantically complete and
213214
* should therefore only be altered as match the recipient's
214215
* expectations. Examples of typical finalization tasks include request
@@ -251,8 +252,8 @@ export interface BuildHandlerOptions extends HandlerOptions {
251252
step: "build";
252253
}
253254

254-
export interface FinalizeHandlerOptions extends HandlerOptions {
255-
step: "finalize";
255+
export interface FinalizeRequestHandlerOptions extends HandlerOptions {
256+
step: "finalizeRequest";
256257
}
257258

258259
export interface DeserializeHandlerOptions extends HandlerOptions {
@@ -282,17 +283,17 @@ export interface MiddlewareStack<Input extends object, Output extends object> {
282283
* optionally specifying a priority and tags.
283284
*/
284285
add(
285-
middleware: FinalizeMiddleware<Input, Output>,
286+
middleware: FinalizeRequestMiddleware<Input, Output>,
286287
options: BuildHandlerOptions
287288
): void;
288289

289290
/**
290-
* Add middleware to the list to be executed during the "finalize" phase,
291+
* Add middleware to the list to be executed during the "finalizeRequest" phase,
291292
* optionally specifying a priority and tags.
292293
*/
293294
add(
294-
middleware: FinalizeMiddleware<Input, Output>,
295-
options: FinalizeHandlerOptions
295+
middleware: FinalizeRequestMiddleware<Input, Output>,
296+
options: FinalizeRequestHandlerOptions
296297
): void;
297298

298299
/**

0 commit comments

Comments
 (0)