diff --git a/.changeset/many-stingrays-bow.md b/.changeset/many-stingrays-bow.md new file mode 100644 index 00000000000..2e38e8322a3 --- /dev/null +++ b/.changeset/many-stingrays-bow.md @@ -0,0 +1,5 @@ +--- +"@smithy/middleware-serde": patch +--- + +use SerdeFunctions as input type and SerdeContext as resolved type for serde plugin diff --git a/packages/middleware-serde/src/deserializerMiddleware.ts b/packages/middleware-serde/src/deserializerMiddleware.ts index ab4c2cf7b11..d5c2202fc4e 100644 --- a/packages/middleware-serde/src/deserializerMiddleware.ts +++ b/packages/middleware-serde/src/deserializerMiddleware.ts @@ -5,6 +5,7 @@ import { DeserializeMiddleware, HandlerExecutionContext, ResponseDeserializer, + SerdeContext, SerdeFunctions, } from "@smithy/types"; @@ -15,7 +16,7 @@ import { */ export const deserializerMiddleware = ( options: SerdeFunctions, - deserializer: ResponseDeserializer + deserializer: ResponseDeserializer ): DeserializeMiddleware => ( next: DeserializeHandler, context: HandlerExecutionContext @@ -24,7 +25,7 @@ export const deserializerMiddleware = > => { const { response } = await next(args); try { - const parsed = await deserializer(response, options); + const parsed = await deserializer(response, options as SerdeContext); return { response, output: parsed as Output, diff --git a/packages/middleware-serde/src/serdePlugin.ts b/packages/middleware-serde/src/serdePlugin.ts index c6db5c247f7..1115872c94d 100644 --- a/packages/middleware-serde/src/serdePlugin.ts +++ b/packages/middleware-serde/src/serdePlugin.ts @@ -1,13 +1,13 @@ import { DeserializeHandlerOptions, Endpoint, - EndpointBearer, MetadataBearer, MiddlewareStack, Pluggable, Provider, RequestSerializer, ResponseDeserializer, + SerdeContext, SerdeFunctions, SerializeHandlerOptions, UrlParser, @@ -47,8 +47,8 @@ export type V1OrV2Endpoint = { */ export function getSerdePlugin( config: V1OrV2Endpoint & SerdeFunctions, - serializer: RequestSerializer, - deserializer: ResponseDeserializer + serializer: RequestSerializer, + deserializer: ResponseDeserializer ): Pluggable { return { applyToStack: (commandStack: MiddlewareStack) => { diff --git a/packages/middleware-serde/src/serializerMiddleware.ts b/packages/middleware-serde/src/serializerMiddleware.ts index 777bc4f1aa8..f7a3a5123cb 100644 --- a/packages/middleware-serde/src/serializerMiddleware.ts +++ b/packages/middleware-serde/src/serializerMiddleware.ts @@ -1,7 +1,7 @@ import { - EndpointBearer, HandlerExecutionContext, RequestSerializer, + SerdeContext, SerdeFunctions, SerializeHandler, SerializeHandlerArguments, @@ -18,7 +18,7 @@ import type { V1OrV2Endpoint } from "./serdePlugin"; */ export const serializerMiddleware = ( options: V1OrV2Endpoint & SerdeFunctions, - serializer: RequestSerializer + serializer: RequestSerializer ): SerializeMiddleware => ( next: SerializeHandler, context: HandlerExecutionContext @@ -34,7 +34,7 @@ export const serializerMiddleware =