Skip to content

Commit be75ba9

Browse files
Chase Coalwellsrchase
authored andcommitted
Combine serde context (#418)
* feat: combine serde types, cleanup unused imports * feat: update model location * feat: change Injectable to Pluggable
1 parent 92acf3c commit be75ba9

File tree

5 files changed

+13
-19
lines changed

5 files changed

+13
-19
lines changed

packages/middleware-content-length/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
BodyLengthCalculator,
66
MetadataBearer,
77
BuildHandlerOutput,
8-
Injectable
8+
Pluggable
99
} from "@aws-sdk/types";
1010
import { HttpRequest } from "@aws-sdk/protocol-http";
1111

@@ -46,7 +46,7 @@ export function contentLengthMiddleware(
4646

4747
export const contentLengthPlugin = (options: {
4848
bodyLengthChecker: BodyLengthCalculator;
49-
}): Injectable<any, any> => clientStack => {
49+
}): Pluggable<any, any> => clientStack => {
5050
clientStack.add(contentLengthMiddleware(options.bodyLengthChecker), {
5151
step: "build",
5252
tags: { SET_CONTENT_LENGTH: true }
Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import {
22
RequestSerializer,
33
ResponseDeserializer,
4-
Injectable,
4+
Pluggable,
55
Protocol,
66
MetadataBearer,
77
MiddlewareStack,
8-
EndpointBearer,
9-
Provider
8+
EndpointBearer
109
} from "@aws-sdk/types";
1110
import { deserializerMiddleware } from "./deserializerMiddleware";
1211
import { serializerMiddleware } from "./serializerMiddleware";
@@ -17,11 +16,11 @@ export function serdePlugin<
1716
OutputType extends MetadataBearer,
1817
DeserializerRuntimeUtils
1918
>(
20-
config: PromisifyEndpoint<SerializerRuntimeUtils> &
19+
config: SerializerRuntimeUtils &
2120
DeserializerRuntimeUtils & { protocol: Protocol<any, any> },
2221
serializer: RequestSerializer<any, SerializerRuntimeUtils>,
2322
deserializer: ResponseDeserializer<OutputType, any, DeserializerRuntimeUtils>
24-
): Injectable<InputType, OutputType> {
23+
): Pluggable<InputType, OutputType> {
2524
return (commandStack: MiddlewareStack<InputType, OutputType>) => {
2625
commandStack.add(deserializerMiddleware(config, deserializer), {
2726
step: "deserialize",
@@ -33,7 +32,3 @@ export function serdePlugin<
3332
});
3433
};
3534
}
36-
37-
export type PromisifyEndpoint<T extends EndpointBearer> = {
38-
[K in keyof T]: K extends "endpoint" ? Provider<T[K]> : T[K];
39-
};

packages/middleware-serde/src/serializerMiddleware.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,13 @@ import {
77
Protocol,
88
EndpointBearer
99
} from "@aws-sdk/types";
10-
import { PromisifyEndpoint } from "./serdePlugin";
1110

1211
export function serializerMiddleware<
1312
Input extends object,
1413
Output extends object,
1514
RuntimeUtils extends EndpointBearer
1615
>(
17-
options: { protocol: Protocol<any, any> } & PromisifyEndpoint<RuntimeUtils>,
16+
options: { protocol: Protocol<any, any> } & RuntimeUtils,
1817
serializer: RequestSerializer<any, RuntimeUtils>
1918
): SerializeMiddleware<Input, Output> {
2019
return (

packages/smithy-client/src/client.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { MiddlewareStack } from "@aws-sdk/middleware-stack";
2-
import { Protocol, Command, MetadataBearer, Injectable } from "@aws-sdk/types";
2+
import { Protocol, Command, MetadataBearer, Pluggable } from "@aws-sdk/types";
33

44
export interface SmithyConfiguration<HandlerOptions> {
55
protocol: Protocol<any, any, HandlerOptions>;
@@ -19,8 +19,8 @@ export class Client<
1919
constructor(config: SmithyConfiguration<HandlerOptions>) {
2020
this.config = config;
2121
}
22-
use(injectable: Injectable<ClientInput, ClientOutput>) {
23-
injectable(this.middlewareStack);
22+
use(pluggable: Pluggable<ClientInput, ClientOutput>) {
23+
pluggable(this.middlewareStack);
2424
}
2525
send<InputType extends ClientInput, OutputType extends ClientOutput>(
2626
command: Command<

packages/smithy-client/src/command.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { MiddlewareStack } from "@aws-sdk/middleware-stack";
2-
import { Injectable, HandlerOptions as InjectOptions } from "@aws-sdk/types";
2+
import { Pluggable, HandlerOptions as InjectOptions } from "@aws-sdk/types";
33

44
export class Command<InputType extends object, OutputType extends object> {
55
readonly middlewareStack = new MiddlewareStack<InputType, OutputType>();
6-
use(injectable: Injectable<InputType, OutputType>) {
7-
injectable(this.middlewareStack);
6+
use(pluggable: Pluggable<InputType, OutputType>) {
7+
pluggable(this.middlewareStack);
88
}
99
}

0 commit comments

Comments
 (0)