From ad0c1f1b86eba03480ea493ff7fdee1c05c51c98 Mon Sep 17 00:00:00 2001 From: AllanZhengYP Date: Sun, 10 Jul 2022 18:05:23 +0000 Subject: [PATCH 1/5] feat(codegen): move util-stream-* package to aws dependency to ts dependency --- .../aws/typescript/codegen/AddHttpChecksumDependency.java | 8 ++++---- .../smithy/aws/typescript/codegen/AwsDependency.java | 2 -- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddHttpChecksumDependency.java b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddHttpChecksumDependency.java index 4b67171eb0514..bc932bd7930d6 100644 --- a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddHttpChecksumDependency.java +++ b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AddHttpChecksumDependency.java @@ -116,9 +116,9 @@ public Map> getRuntimeConfigWriters( writer.write("Hash.bind(null, \"sha1\")"); }, "getAwsChunkedEncodingStream", writer -> { - writer.addDependency(AwsDependency.UTIL_STREAM_NODE); + writer.addDependency(TypeScriptDependency.UTIL_STREAM_NODE); writer.addImport("getAwsChunkedEncodingStream", "getAwsChunkedEncodingStream", - AwsDependency.UTIL_STREAM_NODE.packageName); + TypeScriptDependency.UTIL_STREAM_NODE.packageName); writer.write("getAwsChunkedEncodingStream"); } ); @@ -142,9 +142,9 @@ public Map> getRuntimeConfigWriters( writer.write("Sha1"); }, "getAwsChunkedEncodingStream", writer -> { - writer.addDependency(AwsDependency.UTIL_STREAM_BROWSER); + writer.addDependency(TypeScriptDependency.UTIL_STREAM_BROWSER); writer.addImport("getAwsChunkedEncodingStream", "getAwsChunkedEncodingStream", - AwsDependency.UTIL_STREAM_BROWSER.packageName); + TypeScriptDependency.UTIL_STREAM_BROWSER.packageName); writer.write("getAwsChunkedEncodingStream"); } ); diff --git a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsDependency.java b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsDependency.java index 697d1efb23e71..b07586225b23e 100644 --- a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsDependency.java +++ b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsDependency.java @@ -80,8 +80,6 @@ public enum AwsDependency implements SymbolDependencyContainer { MD5_BROWSER(NORMAL_DEPENDENCY, "@aws-sdk/md5-js"), STREAM_HASHER_NODE(NORMAL_DEPENDENCY, "@aws-sdk/hash-stream-node"), STREAM_HASHER_BROWSER(NORMAL_DEPENDENCY, "@aws-sdk/hash-blob-browser"), - UTIL_STREAM_NODE(NORMAL_DEPENDENCY, "@aws-sdk/util-stream-node"), - UTIL_STREAM_BROWSER(NORMAL_DEPENDENCY, "@aws-sdk/util-stream-browser"), FLEXIBLE_CHECKSUMS_MIDDLEWARE(NORMAL_DEPENDENCY, "@aws-sdk/middleware-flexible-checksums"); public final String packageName; From 15f00e627e3e312dd27615fcb6c52dfc25acad98 Mon Sep 17 00:00:00 2001 From: AllanZhengYP Date: Mon, 11 Jul 2022 06:43:17 +0000 Subject: [PATCH 2/5] feat(types): add sdk stream mixin injector type --- packages/types/src/serde.ts | 17 +++++++++++++++++ .../util-stream-browser/src/sdk-stream-mixin.ts | 8 ++++++++ 2 files changed, 25 insertions(+) diff --git a/packages/types/src/serde.ts b/packages/types/src/serde.ts index 7a16150fc0b46..dcb336a289f24 100644 --- a/packages/types/src/serde.ts +++ b/packages/types/src/serde.ts @@ -69,3 +69,20 @@ export interface SdkStreamMixin { * utility functions. */ export type SdkStream = BaseStream & SdkStreamMixin; + +/** + * Interface for internal function to inject stream utility functions + * implementation + * + * @internal + */ +export interface SdkStreamMixinInjector { + (stream: unknown): SdkStreamMixin; +} + +/** + * @internal + */ +export interface SdkStreamSerdeContext { + sdkStreamMixin: SdkStreamMixinInjector; +} diff --git a/packages/util-stream-browser/src/sdk-stream-mixin.ts b/packages/util-stream-browser/src/sdk-stream-mixin.ts index a6163b6540485..3a057b4b1b061 100644 --- a/packages/util-stream-browser/src/sdk-stream-mixin.ts +++ b/packages/util-stream-browser/src/sdk-stream-mixin.ts @@ -64,7 +64,11 @@ export const sdkStreamMixin = (stream: unknown): SdkStream>>>>>> a214cc92ce (feat(types): add sdk stream mixin injector type) return stream; } else { throw new Error(`Cannot transform payload to web stream, got ${stream}`); @@ -75,5 +79,9 @@ export const sdkStreamMixin = (stream: unknown): SdkStream typeof Blob === "function" && stream instanceof Blob; +<<<<<<< HEAD const isReadableStreamInstance = (stream: unknown): stream is ReadableStream => +======= +const isReadableStreamIntance = (stream: unknown): stream is ReadableStream => +>>>>>>> a214cc92ce (feat(types): add sdk stream mixin injector type) typeof ReadableStream === "function" && stream instanceof ReadableStream; From 27ec3b577d8649970baeaf0a584f610697ac2b8e Mon Sep 17 00:00:00 2001 From: AllanZhengYP Date: Tue, 30 Aug 2022 06:09:47 +0000 Subject: [PATCH 3/5] fix(util-stream-browser): fix typo --- packages/util-stream-browser/src/sdk-stream-mixin.ts | 8 -------- 1 file changed, 8 deletions(-) diff --git a/packages/util-stream-browser/src/sdk-stream-mixin.ts b/packages/util-stream-browser/src/sdk-stream-mixin.ts index 3a057b4b1b061..a6163b6540485 100644 --- a/packages/util-stream-browser/src/sdk-stream-mixin.ts +++ b/packages/util-stream-browser/src/sdk-stream-mixin.ts @@ -64,11 +64,7 @@ export const sdkStreamMixin = (stream: unknown): SdkStream>>>>>> a214cc92ce (feat(types): add sdk stream mixin injector type) return stream; } else { throw new Error(`Cannot transform payload to web stream, got ${stream}`); @@ -79,9 +75,5 @@ export const sdkStreamMixin = (stream: unknown): SdkStream typeof Blob === "function" && stream instanceof Blob; -<<<<<<< HEAD const isReadableStreamInstance = (stream: unknown): stream is ReadableStream => -======= -const isReadableStreamIntance = (stream: unknown): stream is ReadableStream => ->>>>>>> a214cc92ce (feat(types): add sdk stream mixin injector type) typeof ReadableStream === "function" && stream instanceof ReadableStream; From 5c8bb9463ac9622f124876434b3cfb238b252d4e Mon Sep 17 00:00:00 2001 From: AllanZhengYP Date: Fri, 2 Sep 2022 06:42:09 +0000 Subject: [PATCH 4/5] feat(util-stream-node): use TextDecoder --- .../src/sdk-stream-mixin.spec.ts | 18 ++++++++++++++++++ .../util-stream-node/src/sdk-stream-mixin.ts | 8 +++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/packages/util-stream-node/src/sdk-stream-mixin.spec.ts b/packages/util-stream-node/src/sdk-stream-mixin.spec.ts index 597518958d9b1..967d2b74f6efd 100644 --- a/packages/util-stream-node/src/sdk-stream-mixin.spec.ts +++ b/packages/util-stream-node/src/sdk-stream-mixin.spec.ts @@ -1,6 +1,7 @@ import { SdkStreamMixin } from "@aws-sdk/types"; import { fromArrayBuffer } from "@aws-sdk/util-buffer-from"; import { PassThrough, Readable, Writable } from "stream"; +import util from "util"; import { sdkStreamMixin } from "./sdk-stream-mixin"; @@ -92,6 +93,23 @@ describe(sdkStreamMixin.name, () => { } ); + it.each(["ibm866", "iso-8859-2", "koi8-r", "macintosh", "windows-874", "gbk", "gb18030", "euc-jp"])( + "should transform the stream to string with TextDecoder config %s", + async (encoding) => { + jest.spyOn(util, "TextDecoder").mockImplementation( + () => + ({ + decode: jest.fn(), + } as any) + ); + (fromArrayBuffer as jest.Mock).mockReturnValue({ toString: toStringMock }); + const sdkStream = sdkStreamMixin(passThrough); + await writeDataToStream(passThrough, [Buffer.from("foo")]); + await sdkStream.transformToString(encoding); + expect(util.TextDecoder).toBeCalledWith(encoding); + } + ); + it("should fail any subsequent tranform calls", async () => { const sdkStream = sdkStreamMixin(passThrough); await writeDataToStream(passThrough, [Buffer.from("foo")]); diff --git a/packages/util-stream-node/src/sdk-stream-mixin.ts b/packages/util-stream-node/src/sdk-stream-mixin.ts index 1408d226c72f1..4c7dcdf46a0bc 100644 --- a/packages/util-stream-node/src/sdk-stream-mixin.ts +++ b/packages/util-stream-node/src/sdk-stream-mixin.ts @@ -2,6 +2,7 @@ import { streamCollector } from "@aws-sdk/node-http-handler"; import { SdkStream, SdkStreamMixin } from "@aws-sdk/types"; import { fromArrayBuffer } from "@aws-sdk/util-buffer-from"; import { Readable } from "stream"; +import { TextDecoder } from "util"; const ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED = "The stream has already been transformed."; @@ -30,7 +31,12 @@ export const sdkStreamMixin = (stream: unknown): SdkStream => { transformToByteArray, transformToString: async (encoding?: string) => { const buf = await transformToByteArray(); - return fromArrayBuffer(buf.buffer, buf.byteOffset, buf.byteLength).toString(encoding); + if (encoding === undefined || Buffer.isEncoding(encoding)) { + return fromArrayBuffer(buf.buffer, buf.byteOffset, buf.byteLength).toString(encoding); + } else { + const decoder = new TextDecoder(encoding); + return decoder.decode(buf); + } }, transformToWebStream: () => { if (transformed) { From d147b9a34754b6d7c85fec8f05012efec6ad4feb Mon Sep 17 00:00:00 2001 From: AllanZhengYP Date: Mon, 29 Aug 2022 21:50:59 +0000 Subject: [PATCH 5/5] feat(clients): support util functions to consume response streams --- clients/client-backupstorage/package.json | 2 ++ .../src/BackupStorageClient.ts | 7 +++++++ .../src/commands/GetChunkCommand.ts | 19 +++++++++++++++++-- .../src/commands/GetObjectMetadataCommand.ts | 19 +++++++++++++++++-- .../src/protocols/Aws_restJson1.ts | 7 +++++-- .../src/runtimeConfig.browser.ts | 2 ++ .../client-backupstorage/src/runtimeConfig.ts | 2 ++ clients/client-codeartifact/package.json | 2 ++ .../src/CodeartifactClient.ts | 7 +++++++ .../commands/GetPackageVersionAssetCommand.ts | 19 +++++++++++++++++-- .../src/protocols/Aws_restJson1.ts | 4 +++- .../src/runtimeConfig.browser.ts | 2 ++ .../client-codeartifact/src/runtimeConfig.ts | 2 ++ clients/client-ebs/package.json | 2 ++ clients/client-ebs/src/EBSClient.ts | 7 +++++++ .../src/commands/GetSnapshotBlockCommand.ts | 19 +++++++++++++++++-- .../client-ebs/src/protocols/Aws_restJson1.ts | 4 +++- .../client-ebs/src/runtimeConfig.browser.ts | 2 ++ clients/client-ebs/src/runtimeConfig.ts | 2 ++ clients/client-glacier/package.json | 2 ++ clients/client-glacier/src/GlacierClient.ts | 7 +++++++ .../src/commands/GetJobOutputCommand.ts | 19 +++++++++++++++++-- .../src/protocols/Aws_restJson1.ts | 4 +++- .../src/runtimeConfig.browser.ts | 2 ++ clients/client-glacier/src/runtimeConfig.ts | 2 ++ .../package.json | 2 ++ .../src/KinesisVideoArchivedMediaClient.ts | 7 +++++++ .../src/commands/GetClipCommand.ts | 19 +++++++++++++++++-- .../GetMediaForFragmentListCommand.ts | 19 +++++++++++++++++-- .../src/protocols/Aws_restJson1.ts | 7 +++++-- .../src/runtimeConfig.browser.ts | 2 ++ .../src/runtimeConfig.ts | 2 ++ .../client-kinesis-video-media/package.json | 2 ++ .../src/KinesisVideoMediaClient.ts | 7 +++++++ .../src/commands/GetMediaCommand.ts | 19 +++++++++++++++++-- .../src/protocols/Aws_restJson1.ts | 4 +++- .../src/runtimeConfig.browser.ts | 2 ++ .../src/runtimeConfig.ts | 2 ++ clients/client-lakeformation/package.json | 2 ++ .../src/LakeFormationClient.ts | 7 +++++++ .../src/commands/GetWorkUnitResultsCommand.ts | 19 +++++++++++++++++-- .../src/protocols/Aws_restJson1.ts | 4 +++- .../src/runtimeConfig.browser.ts | 2 ++ .../client-lakeformation/src/runtimeConfig.ts | 2 ++ .../client-lex-runtime-service/package.json | 2 ++ .../src/LexRuntimeServiceClient.ts | 7 +++++++ .../src/commands/PostContentCommand.ts | 19 +++++++++++++++++-- .../src/commands/PutSessionCommand.ts | 19 +++++++++++++++++-- .../src/protocols/Aws_restJson1.ts | 7 +++++-- .../src/runtimeConfig.browser.ts | 2 ++ .../src/runtimeConfig.ts | 2 ++ clients/client-lex-runtime-v2/package.json | 2 ++ .../src/LexRuntimeV2Client.ts | 7 +++++++ .../src/commands/PutSessionCommand.ts | 19 +++++++++++++++++-- .../src/commands/RecognizeUtteranceCommand.ts | 19 +++++++++++++++++-- .../src/protocols/Aws_restJson1.ts | 7 +++++-- .../src/runtimeConfig.browser.ts | 2 ++ .../src/runtimeConfig.ts | 2 ++ clients/client-medialive/package.json | 2 ++ .../client-medialive/src/MediaLiveClient.ts | 7 +++++++ .../DescribeInputDeviceThumbnailCommand.ts | 18 ++++++++++++++---- .../src/protocols/Aws_restJson1.ts | 4 +++- .../src/runtimeConfig.browser.ts | 2 ++ clients/client-medialive/src/runtimeConfig.ts | 2 ++ clients/client-mediastore-data/package.json | 2 ++ .../src/MediaStoreDataClient.ts | 7 +++++++ .../src/commands/GetObjectCommand.ts | 19 +++++++++++++++++-- .../src/protocols/Aws_restJson1.ts | 4 +++- .../src/runtimeConfig.browser.ts | 2 ++ .../src/runtimeConfig.ts | 2 ++ clients/client-polly/package.json | 2 ++ clients/client-polly/src/PollyClient.ts | 7 +++++++ .../src/commands/SynthesizeSpeechCommand.ts | 19 +++++++++++++++++-- .../src/protocols/Aws_restJson1.ts | 4 +++- .../client-polly/src/runtimeConfig.browser.ts | 2 ++ clients/client-polly/src/runtimeConfig.ts | 2 ++ clients/client-s3/src/S3Client.ts | 7 +++++++ .../src/commands/GetObjectCommand.ts | 19 +++++++++++++++++-- .../src/commands/GetObjectTorrentCommand.ts | 19 +++++++++++++++++-- .../client-s3/src/protocols/Aws_restXml.ts | 7 +++++-- .../client-s3/src/runtimeConfig.browser.ts | 3 ++- clients/client-s3/src/runtimeConfig.ts | 3 ++- .../client-workmailmessageflow/package.json | 2 ++ .../src/WorkMailMessageFlowClient.ts | 7 +++++++ .../commands/GetRawMessageContentCommand.ts | 19 +++++++++++++++++-- .../src/protocols/Aws_restJson1.ts | 4 +++- .../src/runtimeConfig.browser.ts | 2 ++ .../src/runtimeConfig.ts | 2 ++ .../aws-protocoltests-restjson/package.json | 2 ++ .../src/RestJsonProtocolClient.ts | 7 +++++++ .../src/commands/StreamingTraitsCommand.ts | 19 +++++++++++++++++-- .../StreamingTraitsWithMediaTypeCommand.ts | 18 ++++++++++++++---- .../src/protocols/Aws_restJson1.ts | 7 +++++-- .../src/runtimeConfig.browser.ts | 2 ++ .../src/runtimeConfig.ts | 2 ++ 95 files changed, 601 insertions(+), 69 deletions(-) diff --git a/clients/client-backupstorage/package.json b/clients/client-backupstorage/package.json index cd7389dcff61b..0aba7a0e0ac1a 100644 --- a/clients/client-backupstorage/package.json +++ b/clients/client-backupstorage/package.json @@ -45,6 +45,8 @@ "@aws-sdk/util-body-length-node": "*", "@aws-sdk/util-defaults-mode-browser": "*", "@aws-sdk/util-defaults-mode-node": "*", + "@aws-sdk/util-stream-browser": "*", + "@aws-sdk/util-stream-node": "*", "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@aws-sdk/util-utf8-browser": "*", diff --git a/clients/client-backupstorage/src/BackupStorageClient.ts b/clients/client-backupstorage/src/BackupStorageClient.ts index 4b2076d547a95..a1abdee67c3ec 100644 --- a/clients/client-backupstorage/src/BackupStorageClient.ts +++ b/clients/client-backupstorage/src/BackupStorageClient.ts @@ -48,6 +48,7 @@ import { Provider as __Provider, Provider, RegionInfoProvider, + SdkStreamMixinInjector as __SdkStreamMixinInjector, StreamCollector as __StreamCollector, UrlParser as __UrlParser, UserAgent as __UserAgent, @@ -214,6 +215,12 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__ * The {@link DefaultsMode} that will be used to determine how certain default configuration options are resolved in the SDK. */ defaultsMode?: DefaultsMode | Provider; + + /** + * The internal function that inject utilities to runtime-specific stream to help users consume the data + * @internal + */ + sdkStreamMixin?: __SdkStreamMixinInjector; } type BackupStorageClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOptions>> & diff --git a/clients/client-backupstorage/src/commands/GetChunkCommand.ts b/clients/client-backupstorage/src/commands/GetChunkCommand.ts index c92219f7b4ca0..582e539711d13 100644 --- a/clients/client-backupstorage/src/commands/GetChunkCommand.ts +++ b/clients/client-backupstorage/src/commands/GetChunkCommand.ts @@ -9,6 +9,8 @@ import { HttpHandlerOptions as __HttpHandlerOptions, MetadataBearer as __MetadataBearer, MiddlewareStack, + SdkStream as __SdkStream, + SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; @@ -25,7 +27,17 @@ import { } from "../protocols/Aws_restJson1"; export interface GetChunkCommandInput extends GetChunkInput {} -export interface GetChunkCommandOutput extends GetChunkOutput, __MetadataBearer {} +type GetChunkCommandOutputType = __MetadataBearer & + Omit & { + /** + * For *`GetChunkOutput["Data"]`*, see {@link GetChunkOutput.Data}. + */ + Data: __SdkStream["Data"]>; + }; +/** + * This interface extends from `GetChunkOutput` interface. There are more parameters than `Data` defined in {@link GetChunkOutput} + */ +export interface GetChunkCommandOutput extends GetChunkCommandOutputType {} /** * Gets the specified object's chunk. @@ -92,7 +104,10 @@ export class GetChunkCommand extends $Command< return serializeAws_restJson1GetChunkCommand(input, context); } - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + private deserialize( + output: __HttpResponse, + context: __SerdeContext & __SdkStreamSerdeContext + ): Promise { return deserializeAws_restJson1GetChunkCommand(output, context); } diff --git a/clients/client-backupstorage/src/commands/GetObjectMetadataCommand.ts b/clients/client-backupstorage/src/commands/GetObjectMetadataCommand.ts index 1a2adeb7f9d5e..2fa8c7bd42af9 100644 --- a/clients/client-backupstorage/src/commands/GetObjectMetadataCommand.ts +++ b/clients/client-backupstorage/src/commands/GetObjectMetadataCommand.ts @@ -9,6 +9,8 @@ import { HttpHandlerOptions as __HttpHandlerOptions, MetadataBearer as __MetadataBearer, MiddlewareStack, + SdkStream as __SdkStream, + SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; @@ -25,7 +27,17 @@ import { } from "../protocols/Aws_restJson1"; export interface GetObjectMetadataCommandInput extends GetObjectMetadataInput {} -export interface GetObjectMetadataCommandOutput extends GetObjectMetadataOutput, __MetadataBearer {} +type GetObjectMetadataCommandOutputType = __MetadataBearer & + Omit & { + /** + * For *`GetObjectMetadataOutput["MetadataBlob"]`*, see {@link GetObjectMetadataOutput.MetadataBlob}. + */ + MetadataBlob?: __SdkStream["MetadataBlob"]>; + }; +/** + * This interface extends from `GetObjectMetadataOutput` interface. There are more parameters than `MetadataBlob` defined in {@link GetObjectMetadataOutput} + */ +export interface GetObjectMetadataCommandOutput extends GetObjectMetadataCommandOutputType {} /** * Get metadata associated with an Object. @@ -92,7 +104,10 @@ export class GetObjectMetadataCommand extends $Command< return serializeAws_restJson1GetObjectMetadataCommand(input, context); } - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + private deserialize( + output: __HttpResponse, + context: __SerdeContext & __SdkStreamSerdeContext + ): Promise { return deserializeAws_restJson1GetObjectMetadataCommand(output, context); } diff --git a/clients/client-backupstorage/src/protocols/Aws_restJson1.ts b/clients/client-backupstorage/src/protocols/Aws_restJson1.ts index dcc7eb27af324..a5307ddf82e98 100644 --- a/clients/client-backupstorage/src/protocols/Aws_restJson1.ts +++ b/clients/client-backupstorage/src/protocols/Aws_restJson1.ts @@ -15,6 +15,7 @@ import { import { Endpoint as __Endpoint, ResponseMetadata as __ResponseMetadata, + SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; @@ -413,7 +414,7 @@ const deserializeAws_restJson1DeleteObjectCommandError = async ( export const deserializeAws_restJson1GetChunkCommand = async ( output: __HttpResponse, - context: __SerdeContext + context: __SerdeContext & __SdkStreamSerdeContext ): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { return deserializeAws_restJson1GetChunkCommandError(output, context); @@ -428,6 +429,7 @@ export const deserializeAws_restJson1GetChunkCommand = async ( ChecksumAlgorithm: [, output.headers["x-amz-checksum-algorithm"]], }); const data: any = output.body; + context.sdkStreamMixin(data); contents.Data = data; return contents; }; @@ -476,7 +478,7 @@ const deserializeAws_restJson1GetChunkCommandError = async ( export const deserializeAws_restJson1GetObjectMetadataCommand = async ( output: __HttpResponse, - context: __SerdeContext + context: __SerdeContext & __SdkStreamSerdeContext ): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { return deserializeAws_restJson1GetObjectMetadataCommandError(output, context); @@ -492,6 +494,7 @@ export const deserializeAws_restJson1GetObjectMetadataCommand = async ( MetadataBlobChecksumAlgorithm: [, output.headers["x-amz-checksum-algorithm"]], }); const data: any = output.body; + context.sdkStreamMixin(data); contents.MetadataBlob = data; return contents; }; diff --git a/clients/client-backupstorage/src/runtimeConfig.browser.ts b/clients/client-backupstorage/src/runtimeConfig.browser.ts index 3d063d2afd4ee..ad6617e7317b3 100644 --- a/clients/client-backupstorage/src/runtimeConfig.browser.ts +++ b/clients/client-backupstorage/src/runtimeConfig.browser.ts @@ -9,6 +9,7 @@ import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; +import { sdkStreamMixin } from "@aws-sdk/util-stream-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; import { BackupStorageClientConfig } from "./BackupStorageClient"; @@ -40,6 +41,7 @@ export const getRuntimeConfig = (config: BackupStorageClientConfig) => { region: config?.region ?? invalidProvider("Region is missing"), requestHandler: config?.requestHandler ?? new RequestHandler(defaultConfigProvider), retryMode: config?.retryMode ?? (async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE), + sdkStreamMixin: config?.sdkStreamMixin ?? sdkStreamMixin, sha256: config?.sha256 ?? Sha256, streamCollector: config?.streamCollector ?? streamCollector, useDualstackEndpoint: config?.useDualstackEndpoint ?? (() => Promise.resolve(DEFAULT_USE_DUALSTACK_ENDPOINT)), diff --git a/clients/client-backupstorage/src/runtimeConfig.ts b/clients/client-backupstorage/src/runtimeConfig.ts index dce2e609bd9ba..41149c350c145 100644 --- a/clients/client-backupstorage/src/runtimeConfig.ts +++ b/clients/client-backupstorage/src/runtimeConfig.ts @@ -20,6 +20,7 @@ import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler as RequestHandler, streamCollector } from "@aws-sdk/node-http-handler"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; +import { sdkStreamMixin } from "@aws-sdk/util-stream-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; import { BackupStorageClientConfig } from "./BackupStorageClient"; @@ -58,6 +59,7 @@ export const getRuntimeConfig = (config: BackupStorageClientConfig) => { ...NODE_RETRY_MODE_CONFIG_OPTIONS, default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE, }), + sdkStreamMixin: config?.sdkStreamMixin ?? sdkStreamMixin, sha256: config?.sha256 ?? Hash.bind(null, "sha256"), streamCollector: config?.streamCollector ?? streamCollector, useDualstackEndpoint: config?.useDualstackEndpoint ?? loadNodeConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS), diff --git a/clients/client-codeartifact/package.json b/clients/client-codeartifact/package.json index 2da3cda76280d..0f63846c13132 100644 --- a/clients/client-codeartifact/package.json +++ b/clients/client-codeartifact/package.json @@ -45,6 +45,8 @@ "@aws-sdk/util-body-length-node": "*", "@aws-sdk/util-defaults-mode-browser": "*", "@aws-sdk/util-defaults-mode-node": "*", + "@aws-sdk/util-stream-browser": "*", + "@aws-sdk/util-stream-node": "*", "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@aws-sdk/util-utf8-browser": "*", diff --git a/clients/client-codeartifact/src/CodeartifactClient.ts b/clients/client-codeartifact/src/CodeartifactClient.ts index 539fed88979a7..eef16d70c8b8e 100644 --- a/clients/client-codeartifact/src/CodeartifactClient.ts +++ b/clients/client-codeartifact/src/CodeartifactClient.ts @@ -48,6 +48,7 @@ import { Provider as __Provider, Provider, RegionInfoProvider, + SdkStreamMixinInjector as __SdkStreamMixinInjector, StreamCollector as __StreamCollector, UrlParser as __UrlParser, UserAgent as __UserAgent, @@ -361,6 +362,12 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__ * The {@link DefaultsMode} that will be used to determine how certain default configuration options are resolved in the SDK. */ defaultsMode?: DefaultsMode | Provider; + + /** + * The internal function that inject utilities to runtime-specific stream to help users consume the data + * @internal + */ + sdkStreamMixin?: __SdkStreamMixinInjector; } type CodeartifactClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOptions>> & diff --git a/clients/client-codeartifact/src/commands/GetPackageVersionAssetCommand.ts b/clients/client-codeartifact/src/commands/GetPackageVersionAssetCommand.ts index a3da897addb45..c36420b198ff7 100644 --- a/clients/client-codeartifact/src/commands/GetPackageVersionAssetCommand.ts +++ b/clients/client-codeartifact/src/commands/GetPackageVersionAssetCommand.ts @@ -9,6 +9,8 @@ import { HttpHandlerOptions as __HttpHandlerOptions, MetadataBearer as __MetadataBearer, MiddlewareStack, + SdkStream as __SdkStream, + SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; @@ -25,7 +27,17 @@ import { } from "../protocols/Aws_restJson1"; export interface GetPackageVersionAssetCommandInput extends GetPackageVersionAssetRequest {} -export interface GetPackageVersionAssetCommandOutput extends GetPackageVersionAssetResult, __MetadataBearer {} +type GetPackageVersionAssetCommandOutputType = __MetadataBearer & + Omit & { + /** + * For *`GetPackageVersionAssetResult["asset"]`*, see {@link GetPackageVersionAssetResult.asset}. + */ + asset?: __SdkStream["asset"]>; + }; +/** + * This interface extends from `GetPackageVersionAssetResult` interface. There are more parameters than `asset` defined in {@link GetPackageVersionAssetResult} + */ +export interface GetPackageVersionAssetCommandOutput extends GetPackageVersionAssetCommandOutputType {} /** *

@@ -96,7 +108,10 @@ export class GetPackageVersionAssetCommand extends $Command< return serializeAws_restJson1GetPackageVersionAssetCommand(input, context); } - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + private deserialize( + output: __HttpResponse, + context: __SerdeContext & __SdkStreamSerdeContext + ): Promise { return deserializeAws_restJson1GetPackageVersionAssetCommand(output, context); } diff --git a/clients/client-codeartifact/src/protocols/Aws_restJson1.ts b/clients/client-codeartifact/src/protocols/Aws_restJson1.ts index 5d02cd6e48310..a8c6609832bfe 100644 --- a/clients/client-codeartifact/src/protocols/Aws_restJson1.ts +++ b/clients/client-codeartifact/src/protocols/Aws_restJson1.ts @@ -17,6 +17,7 @@ import { import { Endpoint as __Endpoint, ResponseMetadata as __ResponseMetadata, + SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; @@ -2188,7 +2189,7 @@ const deserializeAws_restJson1GetDomainPermissionsPolicyCommandError = async ( export const deserializeAws_restJson1GetPackageVersionAssetCommand = async ( output: __HttpResponse, - context: __SerdeContext + context: __SerdeContext & __SdkStreamSerdeContext ): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { return deserializeAws_restJson1GetPackageVersionAssetCommandError(output, context); @@ -2200,6 +2201,7 @@ export const deserializeAws_restJson1GetPackageVersionAssetCommand = async ( packageVersionRevision: [, output.headers["x-packageversionrevision"]], }); const data: any = output.body; + context.sdkStreamMixin(data); contents.asset = data; return contents; }; diff --git a/clients/client-codeartifact/src/runtimeConfig.browser.ts b/clients/client-codeartifact/src/runtimeConfig.browser.ts index 64f6ad573f496..7e818c7cc02be 100644 --- a/clients/client-codeartifact/src/runtimeConfig.browser.ts +++ b/clients/client-codeartifact/src/runtimeConfig.browser.ts @@ -9,6 +9,7 @@ import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; +import { sdkStreamMixin } from "@aws-sdk/util-stream-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; import { CodeartifactClientConfig } from "./CodeartifactClient"; @@ -40,6 +41,7 @@ export const getRuntimeConfig = (config: CodeartifactClientConfig) => { region: config?.region ?? invalidProvider("Region is missing"), requestHandler: config?.requestHandler ?? new RequestHandler(defaultConfigProvider), retryMode: config?.retryMode ?? (async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE), + sdkStreamMixin: config?.sdkStreamMixin ?? sdkStreamMixin, sha256: config?.sha256 ?? Sha256, streamCollector: config?.streamCollector ?? streamCollector, useDualstackEndpoint: config?.useDualstackEndpoint ?? (() => Promise.resolve(DEFAULT_USE_DUALSTACK_ENDPOINT)), diff --git a/clients/client-codeartifact/src/runtimeConfig.ts b/clients/client-codeartifact/src/runtimeConfig.ts index e984ed57d1782..2d11dbc399460 100644 --- a/clients/client-codeartifact/src/runtimeConfig.ts +++ b/clients/client-codeartifact/src/runtimeConfig.ts @@ -20,6 +20,7 @@ import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler as RequestHandler, streamCollector } from "@aws-sdk/node-http-handler"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; +import { sdkStreamMixin } from "@aws-sdk/util-stream-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; import { CodeartifactClientConfig } from "./CodeartifactClient"; @@ -58,6 +59,7 @@ export const getRuntimeConfig = (config: CodeartifactClientConfig) => { ...NODE_RETRY_MODE_CONFIG_OPTIONS, default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE, }), + sdkStreamMixin: config?.sdkStreamMixin ?? sdkStreamMixin, sha256: config?.sha256 ?? Hash.bind(null, "sha256"), streamCollector: config?.streamCollector ?? streamCollector, useDualstackEndpoint: config?.useDualstackEndpoint ?? loadNodeConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS), diff --git a/clients/client-ebs/package.json b/clients/client-ebs/package.json index 662cf00d18c36..f6e3325bf6570 100644 --- a/clients/client-ebs/package.json +++ b/clients/client-ebs/package.json @@ -45,6 +45,8 @@ "@aws-sdk/util-body-length-node": "*", "@aws-sdk/util-defaults-mode-browser": "*", "@aws-sdk/util-defaults-mode-node": "*", + "@aws-sdk/util-stream-browser": "*", + "@aws-sdk/util-stream-node": "*", "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@aws-sdk/util-utf8-browser": "*", diff --git a/clients/client-ebs/src/EBSClient.ts b/clients/client-ebs/src/EBSClient.ts index 17e8ea837905a..b71871a2a39af 100644 --- a/clients/client-ebs/src/EBSClient.ts +++ b/clients/client-ebs/src/EBSClient.ts @@ -48,6 +48,7 @@ import { Provider as __Provider, Provider, RegionInfoProvider, + SdkStreamMixinInjector as __SdkStreamMixinInjector, StreamCollector as __StreamCollector, UrlParser as __UrlParser, UserAgent as __UserAgent, @@ -202,6 +203,12 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__ * The {@link DefaultsMode} that will be used to determine how certain default configuration options are resolved in the SDK. */ defaultsMode?: DefaultsMode | Provider; + + /** + * The internal function that inject utilities to runtime-specific stream to help users consume the data + * @internal + */ + sdkStreamMixin?: __SdkStreamMixinInjector; } type EBSClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOptions>> & diff --git a/clients/client-ebs/src/commands/GetSnapshotBlockCommand.ts b/clients/client-ebs/src/commands/GetSnapshotBlockCommand.ts index 49e88c6d44dd1..55a829b8de990 100644 --- a/clients/client-ebs/src/commands/GetSnapshotBlockCommand.ts +++ b/clients/client-ebs/src/commands/GetSnapshotBlockCommand.ts @@ -9,6 +9,8 @@ import { HttpHandlerOptions as __HttpHandlerOptions, MetadataBearer as __MetadataBearer, MiddlewareStack, + SdkStream as __SdkStream, + SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; @@ -25,7 +27,17 @@ import { } from "../protocols/Aws_restJson1"; export interface GetSnapshotBlockCommandInput extends GetSnapshotBlockRequest {} -export interface GetSnapshotBlockCommandOutput extends GetSnapshotBlockResponse, __MetadataBearer {} +type GetSnapshotBlockCommandOutputType = __MetadataBearer & + Omit & { + /** + * For *`GetSnapshotBlockResponse["BlockData"]`*, see {@link GetSnapshotBlockResponse.BlockData}. + */ + BlockData?: __SdkStream["BlockData"]>; + }; +/** + * This interface extends from `GetSnapshotBlockResponse` interface. There are more parameters than `BlockData` defined in {@link GetSnapshotBlockResponse} + */ +export interface GetSnapshotBlockCommandOutput extends GetSnapshotBlockCommandOutputType {} /** *

Returns the data in a block in an Amazon Elastic Block Store snapshot.

@@ -92,7 +104,10 @@ export class GetSnapshotBlockCommand extends $Command< return serializeAws_restJson1GetSnapshotBlockCommand(input, context); } - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + private deserialize( + output: __HttpResponse, + context: __SerdeContext & __SdkStreamSerdeContext + ): Promise { return deserializeAws_restJson1GetSnapshotBlockCommand(output, context); } diff --git a/clients/client-ebs/src/protocols/Aws_restJson1.ts b/clients/client-ebs/src/protocols/Aws_restJson1.ts index e2571656ee442..7d2697bc40910 100644 --- a/clients/client-ebs/src/protocols/Aws_restJson1.ts +++ b/clients/client-ebs/src/protocols/Aws_restJson1.ts @@ -18,6 +18,7 @@ import { import { Endpoint as __Endpoint, ResponseMetadata as __ResponseMetadata, + SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; import { v4 as generateIdempotencyToken } from "uuid"; @@ -298,7 +299,7 @@ const deserializeAws_restJson1CompleteSnapshotCommandError = async ( export const deserializeAws_restJson1GetSnapshotBlockCommand = async ( output: __HttpResponse, - context: __SerdeContext + context: __SerdeContext & __SdkStreamSerdeContext ): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { return deserializeAws_restJson1GetSnapshotBlockCommandError(output, context); @@ -313,6 +314,7 @@ export const deserializeAws_restJson1GetSnapshotBlockCommand = async ( ChecksumAlgorithm: [, output.headers["x-amz-checksum-algorithm"]], }); const data: any = output.body; + context.sdkStreamMixin(data); contents.BlockData = data; return contents; }; diff --git a/clients/client-ebs/src/runtimeConfig.browser.ts b/clients/client-ebs/src/runtimeConfig.browser.ts index c6cdbfdb6787b..5d9f03d19c75a 100644 --- a/clients/client-ebs/src/runtimeConfig.browser.ts +++ b/clients/client-ebs/src/runtimeConfig.browser.ts @@ -9,6 +9,7 @@ import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; +import { sdkStreamMixin } from "@aws-sdk/util-stream-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; import { EBSClientConfig } from "./EBSClient"; @@ -40,6 +41,7 @@ export const getRuntimeConfig = (config: EBSClientConfig) => { region: config?.region ?? invalidProvider("Region is missing"), requestHandler: config?.requestHandler ?? new RequestHandler(defaultConfigProvider), retryMode: config?.retryMode ?? (async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE), + sdkStreamMixin: config?.sdkStreamMixin ?? sdkStreamMixin, sha256: config?.sha256 ?? Sha256, streamCollector: config?.streamCollector ?? streamCollector, useDualstackEndpoint: config?.useDualstackEndpoint ?? (() => Promise.resolve(DEFAULT_USE_DUALSTACK_ENDPOINT)), diff --git a/clients/client-ebs/src/runtimeConfig.ts b/clients/client-ebs/src/runtimeConfig.ts index 1d4346b77e433..1cba43c972959 100644 --- a/clients/client-ebs/src/runtimeConfig.ts +++ b/clients/client-ebs/src/runtimeConfig.ts @@ -20,6 +20,7 @@ import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler as RequestHandler, streamCollector } from "@aws-sdk/node-http-handler"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; +import { sdkStreamMixin } from "@aws-sdk/util-stream-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; import { EBSClientConfig } from "./EBSClient"; @@ -58,6 +59,7 @@ export const getRuntimeConfig = (config: EBSClientConfig) => { ...NODE_RETRY_MODE_CONFIG_OPTIONS, default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE, }), + sdkStreamMixin: config?.sdkStreamMixin ?? sdkStreamMixin, sha256: config?.sha256 ?? Hash.bind(null, "sha256"), streamCollector: config?.streamCollector ?? streamCollector, useDualstackEndpoint: config?.useDualstackEndpoint ?? loadNodeConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS), diff --git a/clients/client-glacier/package.json b/clients/client-glacier/package.json index a44798800f3c5..6a7fc2d3a3124 100644 --- a/clients/client-glacier/package.json +++ b/clients/client-glacier/package.json @@ -48,6 +48,8 @@ "@aws-sdk/util-body-length-node": "*", "@aws-sdk/util-defaults-mode-browser": "*", "@aws-sdk/util-defaults-mode-node": "*", + "@aws-sdk/util-stream-browser": "*", + "@aws-sdk/util-stream-node": "*", "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@aws-sdk/util-utf8-browser": "*", diff --git a/clients/client-glacier/src/GlacierClient.ts b/clients/client-glacier/src/GlacierClient.ts index 4cfb639e9be60..b60d8f5d09fe0 100644 --- a/clients/client-glacier/src/GlacierClient.ts +++ b/clients/client-glacier/src/GlacierClient.ts @@ -50,6 +50,7 @@ import { Provider as __Provider, Provider, RegionInfoProvider, + SdkStreamMixinInjector as __SdkStreamMixinInjector, StreamCollector as __StreamCollector, UrlParser as __UrlParser, UserAgent as __UserAgent, @@ -342,6 +343,12 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__ * The {@link DefaultsMode} that will be used to determine how certain default configuration options are resolved in the SDK. */ defaultsMode?: DefaultsMode | Provider; + + /** + * The internal function that inject utilities to runtime-specific stream to help users consume the data + * @internal + */ + sdkStreamMixin?: __SdkStreamMixinInjector; } type GlacierClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOptions>> & diff --git a/clients/client-glacier/src/commands/GetJobOutputCommand.ts b/clients/client-glacier/src/commands/GetJobOutputCommand.ts index 82dbba1416dc8..3ebee31f5ba8a 100644 --- a/clients/client-glacier/src/commands/GetJobOutputCommand.ts +++ b/clients/client-glacier/src/commands/GetJobOutputCommand.ts @@ -9,6 +9,8 @@ import { HttpHandlerOptions as __HttpHandlerOptions, MetadataBearer as __MetadataBearer, MiddlewareStack, + SdkStream as __SdkStream, + SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; @@ -25,7 +27,17 @@ import { } from "../protocols/Aws_restJson1"; export interface GetJobOutputCommandInput extends GetJobOutputInput {} -export interface GetJobOutputCommandOutput extends GetJobOutputOutput, __MetadataBearer {} +type GetJobOutputCommandOutputType = __MetadataBearer & + Omit & { + /** + * For *`GetJobOutputOutput["body"]`*, see {@link GetJobOutputOutput.body}. + */ + body?: __SdkStream["body"]>; + }; +/** + * This interface extends from `GetJobOutputOutput` interface. There are more parameters than `body` defined in {@link GetJobOutputOutput} + */ +export interface GetJobOutputCommandOutput extends GetJobOutputCommandOutputType {} /** *

This operation downloads the output of the job you initiated using InitiateJob. Depending on the job type you specified when you initiated the @@ -128,7 +140,10 @@ export class GetJobOutputCommand extends $Command< return serializeAws_restJson1GetJobOutputCommand(input, context); } - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + private deserialize( + output: __HttpResponse, + context: __SerdeContext & __SdkStreamSerdeContext + ): Promise { return deserializeAws_restJson1GetJobOutputCommand(output, context); } diff --git a/clients/client-glacier/src/protocols/Aws_restJson1.ts b/clients/client-glacier/src/protocols/Aws_restJson1.ts index 9da38521198a5..7537afe56915a 100644 --- a/clients/client-glacier/src/protocols/Aws_restJson1.ts +++ b/clients/client-glacier/src/protocols/Aws_restJson1.ts @@ -15,6 +15,7 @@ import { import { Endpoint as __Endpoint, ResponseMetadata as __ResponseMetadata, + SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; @@ -1688,7 +1689,7 @@ const deserializeAws_restJson1GetDataRetrievalPolicyCommandError = async ( export const deserializeAws_restJson1GetJobOutputCommand = async ( output: __HttpResponse, - context: __SerdeContext + context: __SerdeContext & __SdkStreamSerdeContext ): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { return deserializeAws_restJson1GetJobOutputCommandError(output, context); @@ -1702,6 +1703,7 @@ export const deserializeAws_restJson1GetJobOutputCommand = async ( archiveDescription: [, output.headers["x-amz-archive-description"]], }); const data: any = output.body; + context.sdkStreamMixin(data); contents.body = data; map(contents, { status: [, output.statusCode], diff --git a/clients/client-glacier/src/runtimeConfig.browser.ts b/clients/client-glacier/src/runtimeConfig.browser.ts index c4568ae6d7f5b..2f3d4efea38b3 100644 --- a/clients/client-glacier/src/runtimeConfig.browser.ts +++ b/clients/client-glacier/src/runtimeConfig.browser.ts @@ -10,6 +10,7 @@ import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; +import { sdkStreamMixin } from "@aws-sdk/util-stream-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; import { GlacierClientConfig } from "./GlacierClient"; @@ -42,6 +43,7 @@ export const getRuntimeConfig = (config: GlacierClientConfig) => { region: config?.region ?? invalidProvider("Region is missing"), requestHandler: config?.requestHandler ?? new RequestHandler(defaultConfigProvider), retryMode: config?.retryMode ?? (async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE), + sdkStreamMixin: config?.sdkStreamMixin ?? sdkStreamMixin, sha256: config?.sha256 ?? Sha256, streamCollector: config?.streamCollector ?? streamCollector, useDualstackEndpoint: config?.useDualstackEndpoint ?? (() => Promise.resolve(DEFAULT_USE_DUALSTACK_ENDPOINT)), diff --git a/clients/client-glacier/src/runtimeConfig.ts b/clients/client-glacier/src/runtimeConfig.ts index a74390bb3929e..6c748cd9eea2e 100644 --- a/clients/client-glacier/src/runtimeConfig.ts +++ b/clients/client-glacier/src/runtimeConfig.ts @@ -21,6 +21,7 @@ import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler as RequestHandler, streamCollector } from "@aws-sdk/node-http-handler"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; +import { sdkStreamMixin } from "@aws-sdk/util-stream-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; import { GlacierClientConfig } from "./GlacierClient"; @@ -60,6 +61,7 @@ export const getRuntimeConfig = (config: GlacierClientConfig) => { ...NODE_RETRY_MODE_CONFIG_OPTIONS, default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE, }), + sdkStreamMixin: config?.sdkStreamMixin ?? sdkStreamMixin, sha256: config?.sha256 ?? Hash.bind(null, "sha256"), streamCollector: config?.streamCollector ?? streamCollector, useDualstackEndpoint: config?.useDualstackEndpoint ?? loadNodeConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS), diff --git a/clients/client-kinesis-video-archived-media/package.json b/clients/client-kinesis-video-archived-media/package.json index 5bc60ad6a750d..5d16b28b8e2d8 100644 --- a/clients/client-kinesis-video-archived-media/package.json +++ b/clients/client-kinesis-video-archived-media/package.json @@ -45,6 +45,8 @@ "@aws-sdk/util-body-length-node": "*", "@aws-sdk/util-defaults-mode-browser": "*", "@aws-sdk/util-defaults-mode-node": "*", + "@aws-sdk/util-stream-browser": "*", + "@aws-sdk/util-stream-node": "*", "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@aws-sdk/util-utf8-browser": "*", diff --git a/clients/client-kinesis-video-archived-media/src/KinesisVideoArchivedMediaClient.ts b/clients/client-kinesis-video-archived-media/src/KinesisVideoArchivedMediaClient.ts index bf5ec0308814c..9fe39b8821925 100644 --- a/clients/client-kinesis-video-archived-media/src/KinesisVideoArchivedMediaClient.ts +++ b/clients/client-kinesis-video-archived-media/src/KinesisVideoArchivedMediaClient.ts @@ -48,6 +48,7 @@ import { Provider as __Provider, Provider, RegionInfoProvider, + SdkStreamMixinInjector as __SdkStreamMixinInjector, StreamCollector as __StreamCollector, UrlParser as __UrlParser, UserAgent as __UserAgent, @@ -211,6 +212,12 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__ * The {@link DefaultsMode} that will be used to determine how certain default configuration options are resolved in the SDK. */ defaultsMode?: DefaultsMode | Provider; + + /** + * The internal function that inject utilities to runtime-specific stream to help users consume the data + * @internal + */ + sdkStreamMixin?: __SdkStreamMixinInjector; } type KinesisVideoArchivedMediaClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOptions>> & diff --git a/clients/client-kinesis-video-archived-media/src/commands/GetClipCommand.ts b/clients/client-kinesis-video-archived-media/src/commands/GetClipCommand.ts index fcc7974618d46..ab19400558c6f 100644 --- a/clients/client-kinesis-video-archived-media/src/commands/GetClipCommand.ts +++ b/clients/client-kinesis-video-archived-media/src/commands/GetClipCommand.ts @@ -9,6 +9,8 @@ import { HttpHandlerOptions as __HttpHandlerOptions, MetadataBearer as __MetadataBearer, MiddlewareStack, + SdkStream as __SdkStream, + SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; @@ -29,7 +31,17 @@ import { } from "../protocols/Aws_restJson1"; export interface GetClipCommandInput extends GetClipInput {} -export interface GetClipCommandOutput extends GetClipOutput, __MetadataBearer {} +type GetClipCommandOutputType = __MetadataBearer & + Omit & { + /** + * For *`GetClipOutput["Payload"]`*, see {@link GetClipOutput.Payload}. + */ + Payload?: __SdkStream["Payload"]>; + }; +/** + * This interface extends from `GetClipOutput` interface. There are more parameters than `Payload` defined in {@link GetClipOutput} + */ +export interface GetClipCommandOutput extends GetClipCommandOutputType {} /** *

Downloads an MP4 file (clip) containing the archived, on-demand media from the @@ -136,7 +148,10 @@ export class GetClipCommand extends $Command< return serializeAws_restJson1GetClipCommand(input, context); } - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + private deserialize( + output: __HttpResponse, + context: __SerdeContext & __SdkStreamSerdeContext + ): Promise { return deserializeAws_restJson1GetClipCommand(output, context); } diff --git a/clients/client-kinesis-video-archived-media/src/commands/GetMediaForFragmentListCommand.ts b/clients/client-kinesis-video-archived-media/src/commands/GetMediaForFragmentListCommand.ts index 588018dadc844..d87c30c8da3cd 100644 --- a/clients/client-kinesis-video-archived-media/src/commands/GetMediaForFragmentListCommand.ts +++ b/clients/client-kinesis-video-archived-media/src/commands/GetMediaForFragmentListCommand.ts @@ -9,6 +9,8 @@ import { HttpHandlerOptions as __HttpHandlerOptions, MetadataBearer as __MetadataBearer, MiddlewareStack, + SdkStream as __SdkStream, + SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; @@ -29,7 +31,17 @@ import { } from "../protocols/Aws_restJson1"; export interface GetMediaForFragmentListCommandInput extends GetMediaForFragmentListInput {} -export interface GetMediaForFragmentListCommandOutput extends GetMediaForFragmentListOutput, __MetadataBearer {} +type GetMediaForFragmentListCommandOutputType = __MetadataBearer & + Omit & { + /** + * For *`GetMediaForFragmentListOutput["Payload"]`*, see {@link GetMediaForFragmentListOutput.Payload}. + */ + Payload?: __SdkStream["Payload"]>; + }; +/** + * This interface extends from `GetMediaForFragmentListOutput` interface. There are more parameters than `Payload` defined in {@link GetMediaForFragmentListOutput} + */ +export interface GetMediaForFragmentListCommandOutput extends GetMediaForFragmentListCommandOutputType {} /** *

Gets media for a list of fragments (specified by fragment number) from the archived @@ -132,7 +144,10 @@ export class GetMediaForFragmentListCommand extends $Command< return serializeAws_restJson1GetMediaForFragmentListCommand(input, context); } - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + private deserialize( + output: __HttpResponse, + context: __SerdeContext & __SdkStreamSerdeContext + ): Promise { return deserializeAws_restJson1GetMediaForFragmentListCommand(output, context); } diff --git a/clients/client-kinesis-video-archived-media/src/protocols/Aws_restJson1.ts b/clients/client-kinesis-video-archived-media/src/protocols/Aws_restJson1.ts index 5e3d76e504104..672b8f75611ee 100644 --- a/clients/client-kinesis-video-archived-media/src/protocols/Aws_restJson1.ts +++ b/clients/client-kinesis-video-archived-media/src/protocols/Aws_restJson1.ts @@ -14,6 +14,7 @@ import { import { Endpoint as __Endpoint, ResponseMetadata as __ResponseMetadata, + SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; @@ -251,7 +252,7 @@ export const serializeAws_restJson1ListFragmentsCommand = async ( export const deserializeAws_restJson1GetClipCommand = async ( output: __HttpResponse, - context: __SerdeContext + context: __SerdeContext & __SdkStreamSerdeContext ): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { return deserializeAws_restJson1GetClipCommandError(output, context); @@ -261,6 +262,7 @@ export const deserializeAws_restJson1GetClipCommand = async ( ContentType: [, output.headers["content-type"]], }); const data: any = output.body; + context.sdkStreamMixin(data); contents.Payload = data; return contents; }; @@ -492,7 +494,7 @@ const deserializeAws_restJson1GetImagesCommandError = async ( export const deserializeAws_restJson1GetMediaForFragmentListCommand = async ( output: __HttpResponse, - context: __SerdeContext + context: __SerdeContext & __SdkStreamSerdeContext ): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { return deserializeAws_restJson1GetMediaForFragmentListCommandError(output, context); @@ -502,6 +504,7 @@ export const deserializeAws_restJson1GetMediaForFragmentListCommand = async ( ContentType: [, output.headers["content-type"]], }); const data: any = output.body; + context.sdkStreamMixin(data); contents.Payload = data; return contents; }; diff --git a/clients/client-kinesis-video-archived-media/src/runtimeConfig.browser.ts b/clients/client-kinesis-video-archived-media/src/runtimeConfig.browser.ts index 5fea8883c687d..c03a1581ddbe7 100644 --- a/clients/client-kinesis-video-archived-media/src/runtimeConfig.browser.ts +++ b/clients/client-kinesis-video-archived-media/src/runtimeConfig.browser.ts @@ -9,6 +9,7 @@ import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; +import { sdkStreamMixin } from "@aws-sdk/util-stream-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; import { KinesisVideoArchivedMediaClientConfig } from "./KinesisVideoArchivedMediaClient"; @@ -40,6 +41,7 @@ export const getRuntimeConfig = (config: KinesisVideoArchivedMediaClientConfig) region: config?.region ?? invalidProvider("Region is missing"), requestHandler: config?.requestHandler ?? new RequestHandler(defaultConfigProvider), retryMode: config?.retryMode ?? (async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE), + sdkStreamMixin: config?.sdkStreamMixin ?? sdkStreamMixin, sha256: config?.sha256 ?? Sha256, streamCollector: config?.streamCollector ?? streamCollector, useDualstackEndpoint: config?.useDualstackEndpoint ?? (() => Promise.resolve(DEFAULT_USE_DUALSTACK_ENDPOINT)), diff --git a/clients/client-kinesis-video-archived-media/src/runtimeConfig.ts b/clients/client-kinesis-video-archived-media/src/runtimeConfig.ts index 8085176320dfe..fe695dee8017d 100644 --- a/clients/client-kinesis-video-archived-media/src/runtimeConfig.ts +++ b/clients/client-kinesis-video-archived-media/src/runtimeConfig.ts @@ -20,6 +20,7 @@ import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler as RequestHandler, streamCollector } from "@aws-sdk/node-http-handler"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; +import { sdkStreamMixin } from "@aws-sdk/util-stream-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; import { KinesisVideoArchivedMediaClientConfig } from "./KinesisVideoArchivedMediaClient"; @@ -58,6 +59,7 @@ export const getRuntimeConfig = (config: KinesisVideoArchivedMediaClientConfig) ...NODE_RETRY_MODE_CONFIG_OPTIONS, default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE, }), + sdkStreamMixin: config?.sdkStreamMixin ?? sdkStreamMixin, sha256: config?.sha256 ?? Hash.bind(null, "sha256"), streamCollector: config?.streamCollector ?? streamCollector, useDualstackEndpoint: config?.useDualstackEndpoint ?? loadNodeConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS), diff --git a/clients/client-kinesis-video-media/package.json b/clients/client-kinesis-video-media/package.json index bce79c18a2f2f..3281398cbc1c7 100644 --- a/clients/client-kinesis-video-media/package.json +++ b/clients/client-kinesis-video-media/package.json @@ -45,6 +45,8 @@ "@aws-sdk/util-body-length-node": "*", "@aws-sdk/util-defaults-mode-browser": "*", "@aws-sdk/util-defaults-mode-node": "*", + "@aws-sdk/util-stream-browser": "*", + "@aws-sdk/util-stream-node": "*", "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@aws-sdk/util-utf8-browser": "*", diff --git a/clients/client-kinesis-video-media/src/KinesisVideoMediaClient.ts b/clients/client-kinesis-video-media/src/KinesisVideoMediaClient.ts index 790aac82d9a42..acc7d51be1cc9 100644 --- a/clients/client-kinesis-video-media/src/KinesisVideoMediaClient.ts +++ b/clients/client-kinesis-video-media/src/KinesisVideoMediaClient.ts @@ -48,6 +48,7 @@ import { Provider as __Provider, Provider, RegionInfoProvider, + SdkStreamMixinInjector as __SdkStreamMixinInjector, StreamCollector as __StreamCollector, UrlParser as __UrlParser, UserAgent as __UserAgent, @@ -185,6 +186,12 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__ * The {@link DefaultsMode} that will be used to determine how certain default configuration options are resolved in the SDK. */ defaultsMode?: DefaultsMode | Provider; + + /** + * The internal function that inject utilities to runtime-specific stream to help users consume the data + * @internal + */ + sdkStreamMixin?: __SdkStreamMixinInjector; } type KinesisVideoMediaClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOptions>> & diff --git a/clients/client-kinesis-video-media/src/commands/GetMediaCommand.ts b/clients/client-kinesis-video-media/src/commands/GetMediaCommand.ts index 355ee8729094d..6b7a6dfff7145 100644 --- a/clients/client-kinesis-video-media/src/commands/GetMediaCommand.ts +++ b/clients/client-kinesis-video-media/src/commands/GetMediaCommand.ts @@ -9,6 +9,8 @@ import { HttpHandlerOptions as __HttpHandlerOptions, MetadataBearer as __MetadataBearer, MiddlewareStack, + SdkStream as __SdkStream, + SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; @@ -29,7 +31,17 @@ import { } from "../protocols/Aws_restJson1"; export interface GetMediaCommandInput extends GetMediaInput {} -export interface GetMediaCommandOutput extends GetMediaOutput, __MetadataBearer {} +type GetMediaCommandOutputType = __MetadataBearer & + Omit & { + /** + * For *`GetMediaOutput["Payload"]`*, see {@link GetMediaOutput.Payload}. + */ + Payload?: __SdkStream["Payload"]>; + }; +/** + * This interface extends from `GetMediaOutput` interface. There are more parameters than `Payload` defined in {@link GetMediaOutput} + */ +export interface GetMediaCommandOutput extends GetMediaCommandOutputType {} /** *

Use this API to retrieve media content from a Kinesis video stream. In the request, @@ -141,7 +153,10 @@ export class GetMediaCommand extends $Command< return serializeAws_restJson1GetMediaCommand(input, context); } - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + private deserialize( + output: __HttpResponse, + context: __SerdeContext & __SdkStreamSerdeContext + ): Promise { return deserializeAws_restJson1GetMediaCommand(output, context); } diff --git a/clients/client-kinesis-video-media/src/protocols/Aws_restJson1.ts b/clients/client-kinesis-video-media/src/protocols/Aws_restJson1.ts index 83ddebc7c5b50..2672739a767fa 100644 --- a/clients/client-kinesis-video-media/src/protocols/Aws_restJson1.ts +++ b/clients/client-kinesis-video-media/src/protocols/Aws_restJson1.ts @@ -9,6 +9,7 @@ import { import { Endpoint as __Endpoint, ResponseMetadata as __ResponseMetadata, + SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; @@ -54,7 +55,7 @@ export const serializeAws_restJson1GetMediaCommand = async ( export const deserializeAws_restJson1GetMediaCommand = async ( output: __HttpResponse, - context: __SerdeContext + context: __SerdeContext & __SdkStreamSerdeContext ): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { return deserializeAws_restJson1GetMediaCommandError(output, context); @@ -64,6 +65,7 @@ export const deserializeAws_restJson1GetMediaCommand = async ( ContentType: [, output.headers["content-type"]], }); const data: any = output.body; + context.sdkStreamMixin(data); contents.Payload = data; return contents; }; diff --git a/clients/client-kinesis-video-media/src/runtimeConfig.browser.ts b/clients/client-kinesis-video-media/src/runtimeConfig.browser.ts index f454bfbd29719..6dee3484a3651 100644 --- a/clients/client-kinesis-video-media/src/runtimeConfig.browser.ts +++ b/clients/client-kinesis-video-media/src/runtimeConfig.browser.ts @@ -9,6 +9,7 @@ import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; +import { sdkStreamMixin } from "@aws-sdk/util-stream-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; import { KinesisVideoMediaClientConfig } from "./KinesisVideoMediaClient"; @@ -40,6 +41,7 @@ export const getRuntimeConfig = (config: KinesisVideoMediaClientConfig) => { region: config?.region ?? invalidProvider("Region is missing"), requestHandler: config?.requestHandler ?? new RequestHandler(defaultConfigProvider), retryMode: config?.retryMode ?? (async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE), + sdkStreamMixin: config?.sdkStreamMixin ?? sdkStreamMixin, sha256: config?.sha256 ?? Sha256, streamCollector: config?.streamCollector ?? streamCollector, useDualstackEndpoint: config?.useDualstackEndpoint ?? (() => Promise.resolve(DEFAULT_USE_DUALSTACK_ENDPOINT)), diff --git a/clients/client-kinesis-video-media/src/runtimeConfig.ts b/clients/client-kinesis-video-media/src/runtimeConfig.ts index 7dde02d846589..4212345e82053 100644 --- a/clients/client-kinesis-video-media/src/runtimeConfig.ts +++ b/clients/client-kinesis-video-media/src/runtimeConfig.ts @@ -20,6 +20,7 @@ import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler as RequestHandler, streamCollector } from "@aws-sdk/node-http-handler"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; +import { sdkStreamMixin } from "@aws-sdk/util-stream-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; import { KinesisVideoMediaClientConfig } from "./KinesisVideoMediaClient"; @@ -58,6 +59,7 @@ export const getRuntimeConfig = (config: KinesisVideoMediaClientConfig) => { ...NODE_RETRY_MODE_CONFIG_OPTIONS, default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE, }), + sdkStreamMixin: config?.sdkStreamMixin ?? sdkStreamMixin, sha256: config?.sha256 ?? Hash.bind(null, "sha256"), streamCollector: config?.streamCollector ?? streamCollector, useDualstackEndpoint: config?.useDualstackEndpoint ?? loadNodeConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS), diff --git a/clients/client-lakeformation/package.json b/clients/client-lakeformation/package.json index ce9136cc4eeab..b93edac14df40 100644 --- a/clients/client-lakeformation/package.json +++ b/clients/client-lakeformation/package.json @@ -45,6 +45,8 @@ "@aws-sdk/util-body-length-node": "*", "@aws-sdk/util-defaults-mode-browser": "*", "@aws-sdk/util-defaults-mode-node": "*", + "@aws-sdk/util-stream-browser": "*", + "@aws-sdk/util-stream-node": "*", "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@aws-sdk/util-utf8-browser": "*", diff --git a/clients/client-lakeformation/src/LakeFormationClient.ts b/clients/client-lakeformation/src/LakeFormationClient.ts index ac99cee650128..bd52458ca6831 100644 --- a/clients/client-lakeformation/src/LakeFormationClient.ts +++ b/clients/client-lakeformation/src/LakeFormationClient.ts @@ -48,6 +48,7 @@ import { Provider as __Provider, Provider, RegionInfoProvider, + SdkStreamMixinInjector as __SdkStreamMixinInjector, StreamCollector as __StreamCollector, UrlParser as __UrlParser, UserAgent as __UserAgent, @@ -376,6 +377,12 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__ * The {@link DefaultsMode} that will be used to determine how certain default configuration options are resolved in the SDK. */ defaultsMode?: DefaultsMode | Provider; + + /** + * The internal function that inject utilities to runtime-specific stream to help users consume the data + * @internal + */ + sdkStreamMixin?: __SdkStreamMixinInjector; } type LakeFormationClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOptions>> & diff --git a/clients/client-lakeformation/src/commands/GetWorkUnitResultsCommand.ts b/clients/client-lakeformation/src/commands/GetWorkUnitResultsCommand.ts index 6a806517dd95c..8d3eca66c74d0 100644 --- a/clients/client-lakeformation/src/commands/GetWorkUnitResultsCommand.ts +++ b/clients/client-lakeformation/src/commands/GetWorkUnitResultsCommand.ts @@ -9,6 +9,8 @@ import { HttpHandlerOptions as __HttpHandlerOptions, MetadataBearer as __MetadataBearer, MiddlewareStack, + SdkStream as __SdkStream, + SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; @@ -25,7 +27,17 @@ import { } from "../protocols/Aws_restJson1"; export interface GetWorkUnitResultsCommandInput extends GetWorkUnitResultsRequest {} -export interface GetWorkUnitResultsCommandOutput extends GetWorkUnitResultsResponse, __MetadataBearer {} +type GetWorkUnitResultsCommandOutputType = __MetadataBearer & + Omit & { + /** + * For *`GetWorkUnitResultsResponse["ResultStream"]`*, see {@link GetWorkUnitResultsResponse.ResultStream}. + */ + ResultStream?: __SdkStream["ResultStream"]>; + }; +/** + * This interface extends from `GetWorkUnitResultsResponse` interface. There are more parameters than `ResultStream` defined in {@link GetWorkUnitResultsResponse} + */ +export interface GetWorkUnitResultsCommandOutput extends GetWorkUnitResultsCommandOutputType {} /** *

Returns the work units resulting from the query. Work units can be executed in any order and in parallel.

@@ -92,7 +104,10 @@ export class GetWorkUnitResultsCommand extends $Command< return serializeAws_restJson1GetWorkUnitResultsCommand(input, context); } - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + private deserialize( + output: __HttpResponse, + context: __SerdeContext & __SdkStreamSerdeContext + ): Promise { return deserializeAws_restJson1GetWorkUnitResultsCommand(output, context); } diff --git a/clients/client-lakeformation/src/protocols/Aws_restJson1.ts b/clients/client-lakeformation/src/protocols/Aws_restJson1.ts index 29cf0afcd359d..b0f8b40e57db7 100644 --- a/clients/client-lakeformation/src/protocols/Aws_restJson1.ts +++ b/clients/client-lakeformation/src/protocols/Aws_restJson1.ts @@ -20,6 +20,7 @@ import { import { Endpoint as __Endpoint, ResponseMetadata as __ResponseMetadata, + SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; @@ -2762,7 +2763,7 @@ const deserializeAws_restJson1GetTemporaryGlueTableCredentialsCommandError = asy export const deserializeAws_restJson1GetWorkUnitResultsCommand = async ( output: __HttpResponse, - context: __SerdeContext + context: __SerdeContext & __SdkStreamSerdeContext ): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { return deserializeAws_restJson1GetWorkUnitResultsCommandError(output, context); @@ -2771,6 +2772,7 @@ export const deserializeAws_restJson1GetWorkUnitResultsCommand = async ( $metadata: deserializeMetadata(output), }); const data: any = output.body; + context.sdkStreamMixin(data); contents.ResultStream = data; return contents; }; diff --git a/clients/client-lakeformation/src/runtimeConfig.browser.ts b/clients/client-lakeformation/src/runtimeConfig.browser.ts index 3505c5cfc03a7..811ba637a5a88 100644 --- a/clients/client-lakeformation/src/runtimeConfig.browser.ts +++ b/clients/client-lakeformation/src/runtimeConfig.browser.ts @@ -9,6 +9,7 @@ import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; +import { sdkStreamMixin } from "@aws-sdk/util-stream-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; import { LakeFormationClientConfig } from "./LakeFormationClient"; @@ -40,6 +41,7 @@ export const getRuntimeConfig = (config: LakeFormationClientConfig) => { region: config?.region ?? invalidProvider("Region is missing"), requestHandler: config?.requestHandler ?? new RequestHandler(defaultConfigProvider), retryMode: config?.retryMode ?? (async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE), + sdkStreamMixin: config?.sdkStreamMixin ?? sdkStreamMixin, sha256: config?.sha256 ?? Sha256, streamCollector: config?.streamCollector ?? streamCollector, useDualstackEndpoint: config?.useDualstackEndpoint ?? (() => Promise.resolve(DEFAULT_USE_DUALSTACK_ENDPOINT)), diff --git a/clients/client-lakeformation/src/runtimeConfig.ts b/clients/client-lakeformation/src/runtimeConfig.ts index a6342cd944bc4..4908a366e1c78 100644 --- a/clients/client-lakeformation/src/runtimeConfig.ts +++ b/clients/client-lakeformation/src/runtimeConfig.ts @@ -20,6 +20,7 @@ import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler as RequestHandler, streamCollector } from "@aws-sdk/node-http-handler"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; +import { sdkStreamMixin } from "@aws-sdk/util-stream-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; import { LakeFormationClientConfig } from "./LakeFormationClient"; @@ -58,6 +59,7 @@ export const getRuntimeConfig = (config: LakeFormationClientConfig) => { ...NODE_RETRY_MODE_CONFIG_OPTIONS, default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE, }), + sdkStreamMixin: config?.sdkStreamMixin ?? sdkStreamMixin, sha256: config?.sha256 ?? Hash.bind(null, "sha256"), streamCollector: config?.streamCollector ?? streamCollector, useDualstackEndpoint: config?.useDualstackEndpoint ?? loadNodeConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS), diff --git a/clients/client-lex-runtime-service/package.json b/clients/client-lex-runtime-service/package.json index 6d7a29ff638c9..2d6b15ef3e4d3 100644 --- a/clients/client-lex-runtime-service/package.json +++ b/clients/client-lex-runtime-service/package.json @@ -47,6 +47,8 @@ "@aws-sdk/util-body-length-node": "*", "@aws-sdk/util-defaults-mode-browser": "*", "@aws-sdk/util-defaults-mode-node": "*", + "@aws-sdk/util-stream-browser": "*", + "@aws-sdk/util-stream-node": "*", "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@aws-sdk/util-utf8-browser": "*", diff --git a/clients/client-lex-runtime-service/src/LexRuntimeServiceClient.ts b/clients/client-lex-runtime-service/src/LexRuntimeServiceClient.ts index fc9101bde6b56..bcd357c75acbe 100644 --- a/clients/client-lex-runtime-service/src/LexRuntimeServiceClient.ts +++ b/clients/client-lex-runtime-service/src/LexRuntimeServiceClient.ts @@ -48,6 +48,7 @@ import { Provider as __Provider, Provider, RegionInfoProvider, + SdkStreamMixinInjector as __SdkStreamMixinInjector, StreamCollector as __StreamCollector, UrlParser as __UrlParser, UserAgent as __UserAgent, @@ -199,6 +200,12 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__ * The {@link DefaultsMode} that will be used to determine how certain default configuration options are resolved in the SDK. */ defaultsMode?: DefaultsMode | Provider; + + /** + * The internal function that inject utilities to runtime-specific stream to help users consume the data + * @internal + */ + sdkStreamMixin?: __SdkStreamMixinInjector; } type LexRuntimeServiceClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOptions>> & diff --git a/clients/client-lex-runtime-service/src/commands/PostContentCommand.ts b/clients/client-lex-runtime-service/src/commands/PostContentCommand.ts index b202713705b81..c911b5b7325cc 100644 --- a/clients/client-lex-runtime-service/src/commands/PostContentCommand.ts +++ b/clients/client-lex-runtime-service/src/commands/PostContentCommand.ts @@ -9,6 +9,8 @@ import { HttpHandlerOptions as __HttpHandlerOptions, MetadataBearer as __MetadataBearer, MiddlewareStack, + SdkStream as __SdkStream, + SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; @@ -38,7 +40,17 @@ type PostContentCommandInputType = Omit & { * This interface extends from `PostContentRequest` interface. There are more parameters than `inputStream` defined in {@link PostContentRequest} */ export interface PostContentCommandInput extends PostContentCommandInputType {} -export interface PostContentCommandOutput extends PostContentResponse, __MetadataBearer {} +type PostContentCommandOutputType = __MetadataBearer & + Omit & { + /** + * For *`PostContentResponse["audioStream"]`*, see {@link PostContentResponse.audioStream}. + */ + audioStream?: __SdkStream["audioStream"]>; + }; +/** + * This interface extends from `PostContentResponse` interface. There are more parameters than `audioStream` defined in {@link PostContentResponse} + */ +export interface PostContentCommandOutput extends PostContentCommandOutputType {} /** *

Sends user input (text or speech) to Amazon Lex. Clients use this API to @@ -181,7 +193,10 @@ export class PostContentCommand extends $Command< return serializeAws_restJson1PostContentCommand(input, context); } - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + private deserialize( + output: __HttpResponse, + context: __SerdeContext & __SdkStreamSerdeContext + ): Promise { return deserializeAws_restJson1PostContentCommand(output, context); } diff --git a/clients/client-lex-runtime-service/src/commands/PutSessionCommand.ts b/clients/client-lex-runtime-service/src/commands/PutSessionCommand.ts index 8d2a37d11ea9e..5d62cc10feb57 100644 --- a/clients/client-lex-runtime-service/src/commands/PutSessionCommand.ts +++ b/clients/client-lex-runtime-service/src/commands/PutSessionCommand.ts @@ -9,6 +9,8 @@ import { HttpHandlerOptions as __HttpHandlerOptions, MetadataBearer as __MetadataBearer, MiddlewareStack, + SdkStream as __SdkStream, + SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; @@ -29,7 +31,17 @@ import { } from "../protocols/Aws_restJson1"; export interface PutSessionCommandInput extends PutSessionRequest {} -export interface PutSessionCommandOutput extends PutSessionResponse, __MetadataBearer {} +type PutSessionCommandOutputType = __MetadataBearer & + Omit & { + /** + * For *`PutSessionResponse["audioStream"]`*, see {@link PutSessionResponse.audioStream}. + */ + audioStream?: __SdkStream["audioStream"]>; + }; +/** + * This interface extends from `PutSessionResponse` interface. There are more parameters than `audioStream` defined in {@link PutSessionResponse} + */ +export interface PutSessionCommandOutput extends PutSessionCommandOutputType {} /** *

Creates a new session or modifies an existing session with an Amazon Lex @@ -100,7 +112,10 @@ export class PutSessionCommand extends $Command< return serializeAws_restJson1PutSessionCommand(input, context); } - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + private deserialize( + output: __HttpResponse, + context: __SerdeContext & __SdkStreamSerdeContext + ): Promise { return deserializeAws_restJson1PutSessionCommand(output, context); } diff --git a/clients/client-lex-runtime-service/src/protocols/Aws_restJson1.ts b/clients/client-lex-runtime-service/src/protocols/Aws_restJson1.ts index 28ef5c63f59d1..9687ab1da1924 100644 --- a/clients/client-lex-runtime-service/src/protocols/Aws_restJson1.ts +++ b/clients/client-lex-runtime-service/src/protocols/Aws_restJson1.ts @@ -16,6 +16,7 @@ import { import { Endpoint as __Endpoint, ResponseMetadata as __ResponseMetadata, + SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; @@ -349,7 +350,7 @@ const deserializeAws_restJson1GetSessionCommandError = async ( export const deserializeAws_restJson1PostContentCommand = async ( output: __HttpResponse, - context: __SerdeContext + context: __SerdeContext & __SdkStreamSerdeContext ): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { return deserializeAws_restJson1PostContentCommandError(output, context); @@ -403,6 +404,7 @@ export const deserializeAws_restJson1PostContentCommand = async ( ], }); const data: any = output.body; + context.sdkStreamMixin(data); contents.audioStream = data; return contents; }; @@ -564,7 +566,7 @@ const deserializeAws_restJson1PostTextCommandError = async ( export const deserializeAws_restJson1PutSessionCommand = async ( output: __HttpResponse, - context: __SerdeContext + context: __SerdeContext & __SdkStreamSerdeContext ): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { return deserializeAws_restJson1PutSessionCommandError(output, context); @@ -600,6 +602,7 @@ export const deserializeAws_restJson1PutSessionCommand = async ( ], }); const data: any = output.body; + context.sdkStreamMixin(data); contents.audioStream = data; return contents; }; diff --git a/clients/client-lex-runtime-service/src/runtimeConfig.browser.ts b/clients/client-lex-runtime-service/src/runtimeConfig.browser.ts index ee856f41f54cd..17fc89a6ee11e 100644 --- a/clients/client-lex-runtime-service/src/runtimeConfig.browser.ts +++ b/clients/client-lex-runtime-service/src/runtimeConfig.browser.ts @@ -9,6 +9,7 @@ import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; +import { sdkStreamMixin } from "@aws-sdk/util-stream-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; import { LexRuntimeServiceClientConfig } from "./LexRuntimeServiceClient"; @@ -40,6 +41,7 @@ export const getRuntimeConfig = (config: LexRuntimeServiceClientConfig) => { region: config?.region ?? invalidProvider("Region is missing"), requestHandler: config?.requestHandler ?? new RequestHandler(defaultConfigProvider), retryMode: config?.retryMode ?? (async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE), + sdkStreamMixin: config?.sdkStreamMixin ?? sdkStreamMixin, sha256: config?.sha256 ?? Sha256, streamCollector: config?.streamCollector ?? streamCollector, useDualstackEndpoint: config?.useDualstackEndpoint ?? (() => Promise.resolve(DEFAULT_USE_DUALSTACK_ENDPOINT)), diff --git a/clients/client-lex-runtime-service/src/runtimeConfig.ts b/clients/client-lex-runtime-service/src/runtimeConfig.ts index 8b220da41b355..b84d3be514395 100644 --- a/clients/client-lex-runtime-service/src/runtimeConfig.ts +++ b/clients/client-lex-runtime-service/src/runtimeConfig.ts @@ -20,6 +20,7 @@ import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler as RequestHandler, streamCollector } from "@aws-sdk/node-http-handler"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; +import { sdkStreamMixin } from "@aws-sdk/util-stream-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; import { LexRuntimeServiceClientConfig } from "./LexRuntimeServiceClient"; @@ -58,6 +59,7 @@ export const getRuntimeConfig = (config: LexRuntimeServiceClientConfig) => { ...NODE_RETRY_MODE_CONFIG_OPTIONS, default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE, }), + sdkStreamMixin: config?.sdkStreamMixin ?? sdkStreamMixin, sha256: config?.sha256 ?? Hash.bind(null, "sha256"), streamCollector: config?.streamCollector ?? streamCollector, useDualstackEndpoint: config?.useDualstackEndpoint ?? loadNodeConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS), diff --git a/clients/client-lex-runtime-v2/package.json b/clients/client-lex-runtime-v2/package.json index dd4af00bda898..e277d9b5adf2f 100644 --- a/clients/client-lex-runtime-v2/package.json +++ b/clients/client-lex-runtime-v2/package.json @@ -50,6 +50,8 @@ "@aws-sdk/util-body-length-node": "*", "@aws-sdk/util-defaults-mode-browser": "*", "@aws-sdk/util-defaults-mode-node": "*", + "@aws-sdk/util-stream-browser": "*", + "@aws-sdk/util-stream-node": "*", "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@aws-sdk/util-utf8-browser": "*", diff --git a/clients/client-lex-runtime-v2/src/LexRuntimeV2Client.ts b/clients/client-lex-runtime-v2/src/LexRuntimeV2Client.ts index 1e87cb3f8609f..deaa073f70ac9 100644 --- a/clients/client-lex-runtime-v2/src/LexRuntimeV2Client.ts +++ b/clients/client-lex-runtime-v2/src/LexRuntimeV2Client.ts @@ -60,6 +60,7 @@ import { Provider as __Provider, Provider, RegionInfoProvider, + SdkStreamMixinInjector as __SdkStreamMixinInjector, StreamCollector as __StreamCollector, UrlParser as __UrlParser, UserAgent as __UserAgent, @@ -225,6 +226,12 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__ * The {@link DefaultsMode} that will be used to determine how certain default configuration options are resolved in the SDK. */ defaultsMode?: DefaultsMode | Provider; + + /** + * The internal function that inject utilities to runtime-specific stream to help users consume the data + * @internal + */ + sdkStreamMixin?: __SdkStreamMixinInjector; } type LexRuntimeV2ClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOptions>> & diff --git a/clients/client-lex-runtime-v2/src/commands/PutSessionCommand.ts b/clients/client-lex-runtime-v2/src/commands/PutSessionCommand.ts index 420626dff02ea..d461994fad188 100644 --- a/clients/client-lex-runtime-v2/src/commands/PutSessionCommand.ts +++ b/clients/client-lex-runtime-v2/src/commands/PutSessionCommand.ts @@ -9,6 +9,8 @@ import { HttpHandlerOptions as __HttpHandlerOptions, MetadataBearer as __MetadataBearer, MiddlewareStack, + SdkStream as __SdkStream, + SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; @@ -25,7 +27,17 @@ import { } from "../protocols/Aws_restJson1"; export interface PutSessionCommandInput extends PutSessionRequest {} -export interface PutSessionCommandOutput extends PutSessionResponse, __MetadataBearer {} +type PutSessionCommandOutputType = __MetadataBearer & + Omit & { + /** + * For *`PutSessionResponse["audioStream"]`*, see {@link PutSessionResponse.audioStream}. + */ + audioStream?: __SdkStream["audioStream"]>; + }; +/** + * This interface extends from `PutSessionResponse` interface. There are more parameters than `audioStream` defined in {@link PutSessionResponse} + */ +export interface PutSessionCommandOutput extends PutSessionCommandOutputType {} /** *

Creates a new session or modifies an existing session with an Amazon Lex V2 @@ -94,7 +106,10 @@ export class PutSessionCommand extends $Command< return serializeAws_restJson1PutSessionCommand(input, context); } - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + private deserialize( + output: __HttpResponse, + context: __SerdeContext & __SdkStreamSerdeContext + ): Promise { return deserializeAws_restJson1PutSessionCommand(output, context); } diff --git a/clients/client-lex-runtime-v2/src/commands/RecognizeUtteranceCommand.ts b/clients/client-lex-runtime-v2/src/commands/RecognizeUtteranceCommand.ts index 14405cbddea7e..0909cb93a0524 100644 --- a/clients/client-lex-runtime-v2/src/commands/RecognizeUtteranceCommand.ts +++ b/clients/client-lex-runtime-v2/src/commands/RecognizeUtteranceCommand.ts @@ -9,6 +9,8 @@ import { HttpHandlerOptions as __HttpHandlerOptions, MetadataBearer as __MetadataBearer, MiddlewareStack, + SdkStream as __SdkStream, + SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; @@ -34,7 +36,17 @@ type RecognizeUtteranceCommandInputType = Omit & { + /** + * For *`RecognizeUtteranceResponse["audioStream"]`*, see {@link RecognizeUtteranceResponse.audioStream}. + */ + audioStream?: __SdkStream["audioStream"]>; + }; +/** + * This interface extends from `RecognizeUtteranceResponse` interface. There are more parameters than `audioStream` defined in {@link RecognizeUtteranceResponse} + */ +export interface RecognizeUtteranceCommandOutput extends RecognizeUtteranceCommandOutputType {} /** *

Sends user input to Amazon Lex V2. You can send text or speech. Clients use @@ -163,7 +175,10 @@ export class RecognizeUtteranceCommand extends $Command< return serializeAws_restJson1RecognizeUtteranceCommand(input, context); } - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + private deserialize( + output: __HttpResponse, + context: __SerdeContext & __SdkStreamSerdeContext + ): Promise { return deserializeAws_restJson1RecognizeUtteranceCommand(output, context); } diff --git a/clients/client-lex-runtime-v2/src/protocols/Aws_restJson1.ts b/clients/client-lex-runtime-v2/src/protocols/Aws_restJson1.ts index f6b09d228be3a..0c56abb3e794b 100644 --- a/clients/client-lex-runtime-v2/src/protocols/Aws_restJson1.ts +++ b/clients/client-lex-runtime-v2/src/protocols/Aws_restJson1.ts @@ -17,6 +17,7 @@ import { Message as __Message, MessageHeaders as __MessageHeaders, ResponseMetadata as __ResponseMetadata, + SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; @@ -385,7 +386,7 @@ const deserializeAws_restJson1GetSessionCommandError = async ( export const deserializeAws_restJson1PutSessionCommand = async ( output: __HttpResponse, - context: __SerdeContext + context: __SerdeContext & __SdkStreamSerdeContext ): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { return deserializeAws_restJson1PutSessionCommandError(output, context); @@ -399,6 +400,7 @@ export const deserializeAws_restJson1PutSessionCommand = async ( sessionId: [, output.headers["x-amz-lex-session-id"]], }); const data: any = output.body; + context.sdkStreamMixin(data); contents.audioStream = data; return contents; }; @@ -524,7 +526,7 @@ const deserializeAws_restJson1RecognizeTextCommandError = async ( export const deserializeAws_restJson1RecognizeUtteranceCommand = async ( output: __HttpResponse, - context: __SerdeContext + context: __SerdeContext & __SdkStreamSerdeContext ): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { return deserializeAws_restJson1RecognizeUtteranceCommandError(output, context); @@ -541,6 +543,7 @@ export const deserializeAws_restJson1RecognizeUtteranceCommand = async ( inputTranscript: [, output.headers["x-amz-lex-input-transcript"]], }); const data: any = output.body; + context.sdkStreamMixin(data); contents.audioStream = data; return contents; }; diff --git a/clients/client-lex-runtime-v2/src/runtimeConfig.browser.ts b/clients/client-lex-runtime-v2/src/runtimeConfig.browser.ts index 906779baf08d3..24073ec5a1533 100644 --- a/clients/client-lex-runtime-v2/src/runtimeConfig.browser.ts +++ b/clients/client-lex-runtime-v2/src/runtimeConfig.browser.ts @@ -10,6 +10,7 @@ import { invalidFunction, invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; +import { sdkStreamMixin } from "@aws-sdk/util-stream-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; import { LexRuntimeV2ClientConfig } from "./LexRuntimeV2Client"; @@ -45,6 +46,7 @@ export const getRuntimeConfig = (config: LexRuntimeV2ClientConfig) => { region: config?.region ?? invalidProvider("Region is missing"), requestHandler: config?.requestHandler ?? new RequestHandler(defaultConfigProvider), retryMode: config?.retryMode ?? (async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE), + sdkStreamMixin: config?.sdkStreamMixin ?? sdkStreamMixin, sha256: config?.sha256 ?? Sha256, streamCollector: config?.streamCollector ?? streamCollector, useDualstackEndpoint: config?.useDualstackEndpoint ?? (() => Promise.resolve(DEFAULT_USE_DUALSTACK_ENDPOINT)), diff --git a/clients/client-lex-runtime-v2/src/runtimeConfig.ts b/clients/client-lex-runtime-v2/src/runtimeConfig.ts index 8f8f8a994aa31..834e1d2c43508 100644 --- a/clients/client-lex-runtime-v2/src/runtimeConfig.ts +++ b/clients/client-lex-runtime-v2/src/runtimeConfig.ts @@ -22,6 +22,7 @@ import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttp2Handler as RequestHandler, streamCollector } from "@aws-sdk/node-http-handler"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; +import { sdkStreamMixin } from "@aws-sdk/util-stream-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; import { LexRuntimeV2ClientConfig } from "./LexRuntimeV2Client"; @@ -64,6 +65,7 @@ export const getRuntimeConfig = (config: LexRuntimeV2ClientConfig) => { ...NODE_RETRY_MODE_CONFIG_OPTIONS, default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE, }), + sdkStreamMixin: config?.sdkStreamMixin ?? sdkStreamMixin, sha256: config?.sha256 ?? Hash.bind(null, "sha256"), streamCollector: config?.streamCollector ?? streamCollector, useDualstackEndpoint: config?.useDualstackEndpoint ?? loadNodeConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS), diff --git a/clients/client-medialive/package.json b/clients/client-medialive/package.json index d4a2671807c04..c386f9427851c 100644 --- a/clients/client-medialive/package.json +++ b/clients/client-medialive/package.json @@ -45,6 +45,8 @@ "@aws-sdk/util-body-length-node": "*", "@aws-sdk/util-defaults-mode-browser": "*", "@aws-sdk/util-defaults-mode-node": "*", + "@aws-sdk/util-stream-browser": "*", + "@aws-sdk/util-stream-node": "*", "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@aws-sdk/util-utf8-browser": "*", diff --git a/clients/client-medialive/src/MediaLiveClient.ts b/clients/client-medialive/src/MediaLiveClient.ts index f210201a36cbf..3d73c544c08cf 100644 --- a/clients/client-medialive/src/MediaLiveClient.ts +++ b/clients/client-medialive/src/MediaLiveClient.ts @@ -48,6 +48,7 @@ import { Provider as __Provider, Provider, RegionInfoProvider, + SdkStreamMixinInjector as __SdkStreamMixinInjector, StreamCollector as __StreamCollector, UrlParser as __UrlParser, UserAgent as __UserAgent, @@ -424,6 +425,12 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__ * The {@link DefaultsMode} that will be used to determine how certain default configuration options are resolved in the SDK. */ defaultsMode?: DefaultsMode | Provider; + + /** + * The internal function that inject utilities to runtime-specific stream to help users consume the data + * @internal + */ + sdkStreamMixin?: __SdkStreamMixinInjector; } type MediaLiveClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOptions>> & diff --git a/clients/client-medialive/src/commands/DescribeInputDeviceThumbnailCommand.ts b/clients/client-medialive/src/commands/DescribeInputDeviceThumbnailCommand.ts index dfa0968a8ee1f..c248ee07c77e0 100644 --- a/clients/client-medialive/src/commands/DescribeInputDeviceThumbnailCommand.ts +++ b/clients/client-medialive/src/commands/DescribeInputDeviceThumbnailCommand.ts @@ -9,6 +9,8 @@ import { HttpHandlerOptions as __HttpHandlerOptions, MetadataBearer as __MetadataBearer, MiddlewareStack, + SdkStream as __SdkStream, + SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; @@ -25,9 +27,17 @@ import { } from "../protocols/Aws_restJson1"; export interface DescribeInputDeviceThumbnailCommandInput extends DescribeInputDeviceThumbnailRequest {} -export interface DescribeInputDeviceThumbnailCommandOutput - extends DescribeInputDeviceThumbnailResponse, - __MetadataBearer {} +type DescribeInputDeviceThumbnailCommandOutputType = __MetadataBearer & + Omit & { + /** + * For *`DescribeInputDeviceThumbnailResponse["Body"]`*, see {@link DescribeInputDeviceThumbnailResponse.Body}. + */ + Body?: __SdkStream["Body"]>; + }; +/** + * This interface extends from `DescribeInputDeviceThumbnailResponse` interface. There are more parameters than `Body` defined in {@link DescribeInputDeviceThumbnailResponse} + */ +export interface DescribeInputDeviceThumbnailCommandOutput extends DescribeInputDeviceThumbnailCommandOutputType {} /** * Get the latest thumbnail data for the input device. @@ -96,7 +106,7 @@ export class DescribeInputDeviceThumbnailCommand extends $Command< private deserialize( output: __HttpResponse, - context: __SerdeContext + context: __SerdeContext & __SdkStreamSerdeContext ): Promise { return deserializeAws_restJson1DescribeInputDeviceThumbnailCommand(output, context); } diff --git a/clients/client-medialive/src/protocols/Aws_restJson1.ts b/clients/client-medialive/src/protocols/Aws_restJson1.ts index 5d8cec9fed266..494bc8a8af8b6 100644 --- a/clients/client-medialive/src/protocols/Aws_restJson1.ts +++ b/clients/client-medialive/src/protocols/Aws_restJson1.ts @@ -19,6 +19,7 @@ import { import { Endpoint as __Endpoint, ResponseMetadata as __ResponseMetadata, + SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; import { v4 as generateIdempotencyToken } from "uuid"; @@ -3816,7 +3817,7 @@ const deserializeAws_restJson1DescribeInputDeviceCommandError = async ( export const deserializeAws_restJson1DescribeInputDeviceThumbnailCommand = async ( output: __HttpResponse, - context: __SerdeContext + context: __SerdeContext & __SdkStreamSerdeContext ): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { return deserializeAws_restJson1DescribeInputDeviceThumbnailCommandError(output, context); @@ -3835,6 +3836,7 @@ export const deserializeAws_restJson1DescribeInputDeviceThumbnailCommand = async ], }); const data: any = output.body; + context.sdkStreamMixin(data); contents.Body = data; return contents; }; diff --git a/clients/client-medialive/src/runtimeConfig.browser.ts b/clients/client-medialive/src/runtimeConfig.browser.ts index 6e9182e4a3649..765f95bfa642d 100644 --- a/clients/client-medialive/src/runtimeConfig.browser.ts +++ b/clients/client-medialive/src/runtimeConfig.browser.ts @@ -9,6 +9,7 @@ import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; +import { sdkStreamMixin } from "@aws-sdk/util-stream-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; import { MediaLiveClientConfig } from "./MediaLiveClient"; @@ -40,6 +41,7 @@ export const getRuntimeConfig = (config: MediaLiveClientConfig) => { region: config?.region ?? invalidProvider("Region is missing"), requestHandler: config?.requestHandler ?? new RequestHandler(defaultConfigProvider), retryMode: config?.retryMode ?? (async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE), + sdkStreamMixin: config?.sdkStreamMixin ?? sdkStreamMixin, sha256: config?.sha256 ?? Sha256, streamCollector: config?.streamCollector ?? streamCollector, useDualstackEndpoint: config?.useDualstackEndpoint ?? (() => Promise.resolve(DEFAULT_USE_DUALSTACK_ENDPOINT)), diff --git a/clients/client-medialive/src/runtimeConfig.ts b/clients/client-medialive/src/runtimeConfig.ts index d940d8ca8264d..061a75ee1ec35 100644 --- a/clients/client-medialive/src/runtimeConfig.ts +++ b/clients/client-medialive/src/runtimeConfig.ts @@ -20,6 +20,7 @@ import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler as RequestHandler, streamCollector } from "@aws-sdk/node-http-handler"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; +import { sdkStreamMixin } from "@aws-sdk/util-stream-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; import { MediaLiveClientConfig } from "./MediaLiveClient"; @@ -58,6 +59,7 @@ export const getRuntimeConfig = (config: MediaLiveClientConfig) => { ...NODE_RETRY_MODE_CONFIG_OPTIONS, default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE, }), + sdkStreamMixin: config?.sdkStreamMixin ?? sdkStreamMixin, sha256: config?.sha256 ?? Hash.bind(null, "sha256"), streamCollector: config?.streamCollector ?? streamCollector, useDualstackEndpoint: config?.useDualstackEndpoint ?? loadNodeConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS), diff --git a/clients/client-mediastore-data/package.json b/clients/client-mediastore-data/package.json index 4301ebd258d2b..c1ebebea0d32c 100644 --- a/clients/client-mediastore-data/package.json +++ b/clients/client-mediastore-data/package.json @@ -47,6 +47,8 @@ "@aws-sdk/util-body-length-node": "*", "@aws-sdk/util-defaults-mode-browser": "*", "@aws-sdk/util-defaults-mode-node": "*", + "@aws-sdk/util-stream-browser": "*", + "@aws-sdk/util-stream-node": "*", "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@aws-sdk/util-utf8-browser": "*", diff --git a/clients/client-mediastore-data/src/MediaStoreDataClient.ts b/clients/client-mediastore-data/src/MediaStoreDataClient.ts index c6daf31a758b5..5976b652989a1 100644 --- a/clients/client-mediastore-data/src/MediaStoreDataClient.ts +++ b/clients/client-mediastore-data/src/MediaStoreDataClient.ts @@ -48,6 +48,7 @@ import { Provider as __Provider, Provider, RegionInfoProvider, + SdkStreamMixinInjector as __SdkStreamMixinInjector, StreamCollector as __StreamCollector, UrlParser as __UrlParser, UserAgent as __UserAgent, @@ -199,6 +200,12 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__ * The {@link DefaultsMode} that will be used to determine how certain default configuration options are resolved in the SDK. */ defaultsMode?: DefaultsMode | Provider; + + /** + * The internal function that inject utilities to runtime-specific stream to help users consume the data + * @internal + */ + sdkStreamMixin?: __SdkStreamMixinInjector; } type MediaStoreDataClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOptions>> & diff --git a/clients/client-mediastore-data/src/commands/GetObjectCommand.ts b/clients/client-mediastore-data/src/commands/GetObjectCommand.ts index 86c33156f32f7..937d2cc91e436 100644 --- a/clients/client-mediastore-data/src/commands/GetObjectCommand.ts +++ b/clients/client-mediastore-data/src/commands/GetObjectCommand.ts @@ -9,6 +9,8 @@ import { HttpHandlerOptions as __HttpHandlerOptions, MetadataBearer as __MetadataBearer, MiddlewareStack, + SdkStream as __SdkStream, + SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; @@ -25,7 +27,17 @@ import { } from "../protocols/Aws_restJson1"; export interface GetObjectCommandInput extends GetObjectRequest {} -export interface GetObjectCommandOutput extends GetObjectResponse, __MetadataBearer {} +type GetObjectCommandOutputType = __MetadataBearer & + Omit & { + /** + * For *`GetObjectResponse["Body"]`*, see {@link GetObjectResponse.Body}. + */ + Body?: __SdkStream["Body"]>; + }; +/** + * This interface extends from `GetObjectResponse` interface. There are more parameters than `Body` defined in {@link GetObjectResponse} + */ +export interface GetObjectCommandOutput extends GetObjectCommandOutputType {} /** *

Downloads the object at the specified path. If the object’s upload availability is set to streaming, AWS Elemental MediaStore downloads the object even if it’s still uploading the object.

@@ -92,7 +104,10 @@ export class GetObjectCommand extends $Command< return serializeAws_restJson1GetObjectCommand(input, context); } - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + private deserialize( + output: __HttpResponse, + context: __SerdeContext & __SdkStreamSerdeContext + ): Promise { return deserializeAws_restJson1GetObjectCommand(output, context); } diff --git a/clients/client-mediastore-data/src/protocols/Aws_restJson1.ts b/clients/client-mediastore-data/src/protocols/Aws_restJson1.ts index e89ddf8850a5f..b9a9613cf6cc8 100644 --- a/clients/client-mediastore-data/src/protocols/Aws_restJson1.ts +++ b/clients/client-mediastore-data/src/protocols/Aws_restJson1.ts @@ -18,6 +18,7 @@ import { import { Endpoint as __Endpoint, ResponseMetadata as __ResponseMetadata, + SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; @@ -252,7 +253,7 @@ const deserializeAws_restJson1DescribeObjectCommandError = async ( export const deserializeAws_restJson1GetObjectCommand = async ( output: __HttpResponse, - context: __SerdeContext + context: __SerdeContext & __SdkStreamSerdeContext ): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { return deserializeAws_restJson1GetObjectCommandError(output, context); @@ -273,6 +274,7 @@ export const deserializeAws_restJson1GetObjectCommand = async ( ], }); const data: any = output.body; + context.sdkStreamMixin(data); contents.Body = data; map(contents, { StatusCode: [, output.statusCode], diff --git a/clients/client-mediastore-data/src/runtimeConfig.browser.ts b/clients/client-mediastore-data/src/runtimeConfig.browser.ts index 05704798527dc..287a4413d2eb6 100644 --- a/clients/client-mediastore-data/src/runtimeConfig.browser.ts +++ b/clients/client-mediastore-data/src/runtimeConfig.browser.ts @@ -9,6 +9,7 @@ import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; +import { sdkStreamMixin } from "@aws-sdk/util-stream-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; import { MediaStoreDataClientConfig } from "./MediaStoreDataClient"; @@ -40,6 +41,7 @@ export const getRuntimeConfig = (config: MediaStoreDataClientConfig) => { region: config?.region ?? invalidProvider("Region is missing"), requestHandler: config?.requestHandler ?? new RequestHandler(defaultConfigProvider), retryMode: config?.retryMode ?? (async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE), + sdkStreamMixin: config?.sdkStreamMixin ?? sdkStreamMixin, sha256: config?.sha256 ?? Sha256, streamCollector: config?.streamCollector ?? streamCollector, useDualstackEndpoint: config?.useDualstackEndpoint ?? (() => Promise.resolve(DEFAULT_USE_DUALSTACK_ENDPOINT)), diff --git a/clients/client-mediastore-data/src/runtimeConfig.ts b/clients/client-mediastore-data/src/runtimeConfig.ts index 18236c66cf8a3..da8578a55e387 100644 --- a/clients/client-mediastore-data/src/runtimeConfig.ts +++ b/clients/client-mediastore-data/src/runtimeConfig.ts @@ -20,6 +20,7 @@ import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler as RequestHandler, streamCollector } from "@aws-sdk/node-http-handler"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; +import { sdkStreamMixin } from "@aws-sdk/util-stream-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; import { MediaStoreDataClientConfig } from "./MediaStoreDataClient"; @@ -58,6 +59,7 @@ export const getRuntimeConfig = (config: MediaStoreDataClientConfig) => { ...NODE_RETRY_MODE_CONFIG_OPTIONS, default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE, }), + sdkStreamMixin: config?.sdkStreamMixin ?? sdkStreamMixin, sha256: config?.sha256 ?? Hash.bind(null, "sha256"), streamCollector: config?.streamCollector ?? streamCollector, useDualstackEndpoint: config?.useDualstackEndpoint ?? loadNodeConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS), diff --git a/clients/client-polly/package.json b/clients/client-polly/package.json index 0bd9cad996bcf..840136dce1e7c 100644 --- a/clients/client-polly/package.json +++ b/clients/client-polly/package.json @@ -45,6 +45,8 @@ "@aws-sdk/util-body-length-node": "*", "@aws-sdk/util-defaults-mode-browser": "*", "@aws-sdk/util-defaults-mode-node": "*", + "@aws-sdk/util-stream-browser": "*", + "@aws-sdk/util-stream-node": "*", "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@aws-sdk/util-utf8-browser": "*", diff --git a/clients/client-polly/src/PollyClient.ts b/clients/client-polly/src/PollyClient.ts index d70202c81e613..cd98561acdc48 100644 --- a/clients/client-polly/src/PollyClient.ts +++ b/clients/client-polly/src/PollyClient.ts @@ -48,6 +48,7 @@ import { Provider as __Provider, Provider, RegionInfoProvider, + SdkStreamMixinInjector as __SdkStreamMixinInjector, StreamCollector as __StreamCollector, UrlParser as __UrlParser, UserAgent as __UserAgent, @@ -220,6 +221,12 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__ * The {@link DefaultsMode} that will be used to determine how certain default configuration options are resolved in the SDK. */ defaultsMode?: DefaultsMode | Provider; + + /** + * The internal function that inject utilities to runtime-specific stream to help users consume the data + * @internal + */ + sdkStreamMixin?: __SdkStreamMixinInjector; } type PollyClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOptions>> & diff --git a/clients/client-polly/src/commands/SynthesizeSpeechCommand.ts b/clients/client-polly/src/commands/SynthesizeSpeechCommand.ts index ef30fbda5002f..fb68c9dd6e69f 100644 --- a/clients/client-polly/src/commands/SynthesizeSpeechCommand.ts +++ b/clients/client-polly/src/commands/SynthesizeSpeechCommand.ts @@ -9,6 +9,8 @@ import { HttpHandlerOptions as __HttpHandlerOptions, MetadataBearer as __MetadataBearer, MiddlewareStack, + SdkStream as __SdkStream, + SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; @@ -25,7 +27,17 @@ import { } from "../protocols/Aws_restJson1"; export interface SynthesizeSpeechCommandInput extends SynthesizeSpeechInput {} -export interface SynthesizeSpeechCommandOutput extends SynthesizeSpeechOutput, __MetadataBearer {} +type SynthesizeSpeechCommandOutputType = __MetadataBearer & + Omit & { + /** + * For *`SynthesizeSpeechOutput["AudioStream"]`*, see {@link SynthesizeSpeechOutput.AudioStream}. + */ + AudioStream?: __SdkStream["AudioStream"]>; + }; +/** + * This interface extends from `SynthesizeSpeechOutput` interface. There are more parameters than `AudioStream` defined in {@link SynthesizeSpeechOutput} + */ +export interface SynthesizeSpeechCommandOutput extends SynthesizeSpeechCommandOutputType {} /** *

Synthesizes UTF-8 input, plain text or SSML, to a stream of bytes. @@ -96,7 +108,10 @@ export class SynthesizeSpeechCommand extends $Command< return serializeAws_restJson1SynthesizeSpeechCommand(input, context); } - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + private deserialize( + output: __HttpResponse, + context: __SerdeContext & __SdkStreamSerdeContext + ): Promise { return deserializeAws_restJson1SynthesizeSpeechCommand(output, context); } diff --git a/clients/client-polly/src/protocols/Aws_restJson1.ts b/clients/client-polly/src/protocols/Aws_restJson1.ts index 69988136996f1..087c9ea726eda 100644 --- a/clients/client-polly/src/protocols/Aws_restJson1.ts +++ b/clients/client-polly/src/protocols/Aws_restJson1.ts @@ -17,6 +17,7 @@ import { import { Endpoint as __Endpoint, ResponseMetadata as __ResponseMetadata, + SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; @@ -717,7 +718,7 @@ const deserializeAws_restJson1StartSpeechSynthesisTaskCommandError = async ( export const deserializeAws_restJson1SynthesizeSpeechCommand = async ( output: __HttpResponse, - context: __SerdeContext + context: __SerdeContext & __SdkStreamSerdeContext ): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { return deserializeAws_restJson1SynthesizeSpeechCommandError(output, context); @@ -731,6 +732,7 @@ export const deserializeAws_restJson1SynthesizeSpeechCommand = async ( ], }); const data: any = output.body; + context.sdkStreamMixin(data); contents.AudioStream = data; return contents; }; diff --git a/clients/client-polly/src/runtimeConfig.browser.ts b/clients/client-polly/src/runtimeConfig.browser.ts index fb047315c1211..d77f8c0f5d4a9 100644 --- a/clients/client-polly/src/runtimeConfig.browser.ts +++ b/clients/client-polly/src/runtimeConfig.browser.ts @@ -9,6 +9,7 @@ import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; +import { sdkStreamMixin } from "@aws-sdk/util-stream-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; import { PollyClientConfig } from "./PollyClient"; @@ -40,6 +41,7 @@ export const getRuntimeConfig = (config: PollyClientConfig) => { region: config?.region ?? invalidProvider("Region is missing"), requestHandler: config?.requestHandler ?? new RequestHandler(defaultConfigProvider), retryMode: config?.retryMode ?? (async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE), + sdkStreamMixin: config?.sdkStreamMixin ?? sdkStreamMixin, sha256: config?.sha256 ?? Sha256, streamCollector: config?.streamCollector ?? streamCollector, useDualstackEndpoint: config?.useDualstackEndpoint ?? (() => Promise.resolve(DEFAULT_USE_DUALSTACK_ENDPOINT)), diff --git a/clients/client-polly/src/runtimeConfig.ts b/clients/client-polly/src/runtimeConfig.ts index a21cdf3d5f602..c82525387486d 100644 --- a/clients/client-polly/src/runtimeConfig.ts +++ b/clients/client-polly/src/runtimeConfig.ts @@ -20,6 +20,7 @@ import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler as RequestHandler, streamCollector } from "@aws-sdk/node-http-handler"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; +import { sdkStreamMixin } from "@aws-sdk/util-stream-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; import { PollyClientConfig } from "./PollyClient"; @@ -58,6 +59,7 @@ export const getRuntimeConfig = (config: PollyClientConfig) => { ...NODE_RETRY_MODE_CONFIG_OPTIONS, default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE, }), + sdkStreamMixin: config?.sdkStreamMixin ?? sdkStreamMixin, sha256: config?.sha256 ?? Hash.bind(null, "sha256"), streamCollector: config?.streamCollector ?? streamCollector, useDualstackEndpoint: config?.useDualstackEndpoint ?? loadNodeConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS), diff --git a/clients/client-s3/src/S3Client.ts b/clients/client-s3/src/S3Client.ts index 9eed461978be2..4cb1de3076f18 100644 --- a/clients/client-s3/src/S3Client.ts +++ b/clients/client-s3/src/S3Client.ts @@ -62,6 +62,7 @@ import { Provider as __Provider, Provider, RegionInfoProvider, + SdkStreamMixinInjector as __SdkStreamMixinInjector, StreamCollector as __StreamCollector, StreamHasher as __StreamHasher, UrlParser as __UrlParser, @@ -676,6 +677,12 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__ * The {@link DefaultsMode} that will be used to determine how certain default configuration options are resolved in the SDK. */ defaultsMode?: DefaultsMode | Provider; + + /** + * The internal function that inject utilities to runtime-specific stream to help users consume the data + * @internal + */ + sdkStreamMixin?: __SdkStreamMixinInjector; } type S3ClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOptions>> & diff --git a/clients/client-s3/src/commands/GetObjectCommand.ts b/clients/client-s3/src/commands/GetObjectCommand.ts index 50eb9e18865b9..1954905801442 100644 --- a/clients/client-s3/src/commands/GetObjectCommand.ts +++ b/clients/client-s3/src/commands/GetObjectCommand.ts @@ -12,6 +12,8 @@ import { HttpHandlerOptions as __HttpHandlerOptions, MetadataBearer as __MetadataBearer, MiddlewareStack, + SdkStream as __SdkStream, + SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; @@ -25,7 +27,17 @@ import { deserializeAws_restXmlGetObjectCommand, serializeAws_restXmlGetObjectCo import { S3ClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../S3Client"; export interface GetObjectCommandInput extends GetObjectRequest {} -export interface GetObjectCommandOutput extends GetObjectOutput, __MetadataBearer {} +type GetObjectCommandOutputType = __MetadataBearer & + Omit & { + /** + * For *`GetObjectOutput["Body"]`*, see {@link GetObjectOutput.Body}. + */ + Body?: __SdkStream["Body"]>; + }; +/** + * This interface extends from `GetObjectOutput` interface. There are more parameters than `Body` defined in {@link GetObjectOutput} + */ +export interface GetObjectCommandOutput extends GetObjectCommandOutputType {} /** *

Retrieves objects from Amazon S3. To use GET, you must have READ @@ -279,7 +291,10 @@ export class GetObjectCommand extends $Command { + private deserialize( + output: __HttpResponse, + context: __SerdeContext & __SdkStreamSerdeContext + ): Promise { return deserializeAws_restXmlGetObjectCommand(output, context); } diff --git a/clients/client-s3/src/commands/GetObjectTorrentCommand.ts b/clients/client-s3/src/commands/GetObjectTorrentCommand.ts index fe48aeadc2ac4..666a5e2aa49e4 100644 --- a/clients/client-s3/src/commands/GetObjectTorrentCommand.ts +++ b/clients/client-s3/src/commands/GetObjectTorrentCommand.ts @@ -10,6 +10,8 @@ import { HttpHandlerOptions as __HttpHandlerOptions, MetadataBearer as __MetadataBearer, MiddlewareStack, + SdkStream as __SdkStream, + SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; @@ -26,7 +28,17 @@ import { import { S3ClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../S3Client"; export interface GetObjectTorrentCommandInput extends GetObjectTorrentRequest {} -export interface GetObjectTorrentCommandOutput extends GetObjectTorrentOutput, __MetadataBearer {} +type GetObjectTorrentCommandOutputType = __MetadataBearer & + Omit & { + /** + * For *`GetObjectTorrentOutput["Body"]`*, see {@link GetObjectTorrentOutput.Body}. + */ + Body?: __SdkStream["Body"]>; + }; +/** + * This interface extends from `GetObjectTorrentOutput` interface. There are more parameters than `Body` defined in {@link GetObjectTorrentOutput} + */ +export interface GetObjectTorrentCommandOutput extends GetObjectTorrentCommandOutputType {} /** *

Returns torrent files from a bucket. BitTorrent can save you bandwidth when you're @@ -110,7 +122,10 @@ export class GetObjectTorrentCommand extends $Command< return serializeAws_restXmlGetObjectTorrentCommand(input, context); } - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + private deserialize( + output: __HttpResponse, + context: __SerdeContext & __SdkStreamSerdeContext + ): Promise { return deserializeAws_restXmlGetObjectTorrentCommand(output, context); } diff --git a/clients/client-s3/src/protocols/Aws_restXml.ts b/clients/client-s3/src/protocols/Aws_restXml.ts index de9738d1c0e35..cfe86969d4bd5 100644 --- a/clients/client-s3/src/protocols/Aws_restXml.ts +++ b/clients/client-s3/src/protocols/Aws_restXml.ts @@ -27,6 +27,7 @@ import { Endpoint as __Endpoint, EventStreamSerdeContext as __EventStreamSerdeContext, ResponseMetadata as __ResponseMetadata, + SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; import { XmlNode as __XmlNode, XmlText as __XmlText } from "@aws-sdk/xml-builder"; @@ -5275,7 +5276,7 @@ const deserializeAws_restXmlGetBucketWebsiteCommandError = async ( export const deserializeAws_restXmlGetObjectCommand = async ( output: __HttpResponse, - context: __SerdeContext + context: __SerdeContext & __SdkStreamSerdeContext ): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { return deserializeAws_restXmlGetObjectCommandError(output, context); @@ -5354,6 +5355,7 @@ export const deserializeAws_restXmlGetObjectCommand = async ( ], }); const data: any = output.body; + context.sdkStreamMixin(data); contents.Body = data; return contents; }; @@ -5634,7 +5636,7 @@ const deserializeAws_restXmlGetObjectTaggingCommandError = async ( export const deserializeAws_restXmlGetObjectTorrentCommand = async ( output: __HttpResponse, - context: __SerdeContext + context: __SerdeContext & __SdkStreamSerdeContext ): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { return deserializeAws_restXmlGetObjectTorrentCommandError(output, context); @@ -5644,6 +5646,7 @@ export const deserializeAws_restXmlGetObjectTorrentCommand = async ( RequestCharged: [, output.headers["x-amz-request-charged"]], }); const data: any = output.body; + context.sdkStreamMixin(data); contents.Body = data; return contents; }; diff --git a/clients/client-s3/src/runtimeConfig.browser.ts b/clients/client-s3/src/runtimeConfig.browser.ts index 72e00eba2b424..fa60174c30897 100644 --- a/clients/client-s3/src/runtimeConfig.browser.ts +++ b/clients/client-s3/src/runtimeConfig.browser.ts @@ -13,7 +13,7 @@ import { Md5 } from "@aws-sdk/md5-js"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; -import { getAwsChunkedEncodingStream } from "@aws-sdk/util-stream-browser"; +import { getAwsChunkedEncodingStream, sdkStreamMixin } from "@aws-sdk/util-stream-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; import { S3ClientConfig } from "./S3Client"; @@ -48,6 +48,7 @@ export const getRuntimeConfig = (config: S3ClientConfig) => { region: config?.region ?? invalidProvider("Region is missing"), requestHandler: config?.requestHandler ?? new RequestHandler(defaultConfigProvider), retryMode: config?.retryMode ?? (async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE), + sdkStreamMixin: config?.sdkStreamMixin ?? sdkStreamMixin, sha1: config?.sha1 ?? Sha1, sha256: config?.sha256 ?? Sha256, streamCollector: config?.streamCollector ?? streamCollector, diff --git a/clients/client-s3/src/runtimeConfig.ts b/clients/client-s3/src/runtimeConfig.ts index 8d81c67c05885..bc012cdeb3879 100644 --- a/clients/client-s3/src/runtimeConfig.ts +++ b/clients/client-s3/src/runtimeConfig.ts @@ -24,7 +24,7 @@ import { NodeHttpHandler as RequestHandler, streamCollector } from "@aws-sdk/nod import { HashConstructor as __HashConstructor } from "@aws-sdk/types"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; -import { getAwsChunkedEncodingStream } from "@aws-sdk/util-stream-node"; +import { getAwsChunkedEncodingStream, sdkStreamMixin } from "@aws-sdk/util-stream-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; import { S3ClientConfig } from "./S3Client"; @@ -66,6 +66,7 @@ export const getRuntimeConfig = (config: S3ClientConfig) => { ...NODE_RETRY_MODE_CONFIG_OPTIONS, default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE, }), + sdkStreamMixin: config?.sdkStreamMixin ?? sdkStreamMixin, sha1: config?.sha1 ?? Hash.bind(null, "sha1"), sha256: config?.sha256 ?? Hash.bind(null, "sha256"), streamCollector: config?.streamCollector ?? streamCollector, diff --git a/clients/client-workmailmessageflow/package.json b/clients/client-workmailmessageflow/package.json index 95a2911715205..969f7a28913dd 100644 --- a/clients/client-workmailmessageflow/package.json +++ b/clients/client-workmailmessageflow/package.json @@ -45,6 +45,8 @@ "@aws-sdk/util-body-length-node": "*", "@aws-sdk/util-defaults-mode-browser": "*", "@aws-sdk/util-defaults-mode-node": "*", + "@aws-sdk/util-stream-browser": "*", + "@aws-sdk/util-stream-node": "*", "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@aws-sdk/util-utf8-browser": "*", diff --git a/clients/client-workmailmessageflow/src/WorkMailMessageFlowClient.ts b/clients/client-workmailmessageflow/src/WorkMailMessageFlowClient.ts index 5de00922d24cb..137c09ab7cf49 100644 --- a/clients/client-workmailmessageflow/src/WorkMailMessageFlowClient.ts +++ b/clients/client-workmailmessageflow/src/WorkMailMessageFlowClient.ts @@ -48,6 +48,7 @@ import { Provider as __Provider, Provider, RegionInfoProvider, + SdkStreamMixinInjector as __SdkStreamMixinInjector, StreamCollector as __StreamCollector, UrlParser as __UrlParser, UserAgent as __UserAgent, @@ -192,6 +193,12 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__ * The {@link DefaultsMode} that will be used to determine how certain default configuration options are resolved in the SDK. */ defaultsMode?: DefaultsMode | Provider; + + /** + * The internal function that inject utilities to runtime-specific stream to help users consume the data + * @internal + */ + sdkStreamMixin?: __SdkStreamMixinInjector; } type WorkMailMessageFlowClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOptions>> & diff --git a/clients/client-workmailmessageflow/src/commands/GetRawMessageContentCommand.ts b/clients/client-workmailmessageflow/src/commands/GetRawMessageContentCommand.ts index b3c0269041604..69627a75932cd 100644 --- a/clients/client-workmailmessageflow/src/commands/GetRawMessageContentCommand.ts +++ b/clients/client-workmailmessageflow/src/commands/GetRawMessageContentCommand.ts @@ -9,6 +9,8 @@ import { HttpHandlerOptions as __HttpHandlerOptions, MetadataBearer as __MetadataBearer, MiddlewareStack, + SdkStream as __SdkStream, + SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; @@ -29,7 +31,17 @@ import { } from "../WorkMailMessageFlowClient"; export interface GetRawMessageContentCommandInput extends GetRawMessageContentRequest {} -export interface GetRawMessageContentCommandOutput extends GetRawMessageContentResponse, __MetadataBearer {} +type GetRawMessageContentCommandOutputType = __MetadataBearer & + Omit & { + /** + * For *`GetRawMessageContentResponse["messageContent"]`*, see {@link GetRawMessageContentResponse.messageContent}. + */ + messageContent: __SdkStream["messageContent"]>; + }; +/** + * This interface extends from `GetRawMessageContentResponse` interface. There are more parameters than `messageContent` defined in {@link GetRawMessageContentResponse} + */ +export interface GetRawMessageContentCommandOutput extends GetRawMessageContentCommandOutputType {} /** *

Retrieves the raw content of an in-transit email message, in MIME format.

@@ -96,7 +108,10 @@ export class GetRawMessageContentCommand extends $Command< return serializeAws_restJson1GetRawMessageContentCommand(input, context); } - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + private deserialize( + output: __HttpResponse, + context: __SerdeContext & __SdkStreamSerdeContext + ): Promise { return deserializeAws_restJson1GetRawMessageContentCommand(output, context); } diff --git a/clients/client-workmailmessageflow/src/protocols/Aws_restJson1.ts b/clients/client-workmailmessageflow/src/protocols/Aws_restJson1.ts index 6375e18a18267..5e52b4c94bdc0 100644 --- a/clients/client-workmailmessageflow/src/protocols/Aws_restJson1.ts +++ b/clients/client-workmailmessageflow/src/protocols/Aws_restJson1.ts @@ -10,6 +10,7 @@ import { import { Endpoint as __Endpoint, ResponseMetadata as __ResponseMetadata, + SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; @@ -78,7 +79,7 @@ export const serializeAws_restJson1PutRawMessageContentCommand = async ( export const deserializeAws_restJson1GetRawMessageContentCommand = async ( output: __HttpResponse, - context: __SerdeContext + context: __SerdeContext & __SdkStreamSerdeContext ): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { return deserializeAws_restJson1GetRawMessageContentCommandError(output, context); @@ -87,6 +88,7 @@ export const deserializeAws_restJson1GetRawMessageContentCommand = async ( $metadata: deserializeMetadata(output), }); const data: any = output.body; + context.sdkStreamMixin(data); contents.messageContent = data; return contents; }; diff --git a/clients/client-workmailmessageflow/src/runtimeConfig.browser.ts b/clients/client-workmailmessageflow/src/runtimeConfig.browser.ts index 610b2552a1fc7..b40f332a77cf9 100644 --- a/clients/client-workmailmessageflow/src/runtimeConfig.browser.ts +++ b/clients/client-workmailmessageflow/src/runtimeConfig.browser.ts @@ -9,6 +9,7 @@ import { invalidProvider } from "@aws-sdk/invalid-dependency"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; +import { sdkStreamMixin } from "@aws-sdk/util-stream-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; import { WorkMailMessageFlowClientConfig } from "./WorkMailMessageFlowClient"; @@ -40,6 +41,7 @@ export const getRuntimeConfig = (config: WorkMailMessageFlowClientConfig) => { region: config?.region ?? invalidProvider("Region is missing"), requestHandler: config?.requestHandler ?? new RequestHandler(defaultConfigProvider), retryMode: config?.retryMode ?? (async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE), + sdkStreamMixin: config?.sdkStreamMixin ?? sdkStreamMixin, sha256: config?.sha256 ?? Sha256, streamCollector: config?.streamCollector ?? streamCollector, useDualstackEndpoint: config?.useDualstackEndpoint ?? (() => Promise.resolve(DEFAULT_USE_DUALSTACK_ENDPOINT)), diff --git a/clients/client-workmailmessageflow/src/runtimeConfig.ts b/clients/client-workmailmessageflow/src/runtimeConfig.ts index 05b03181e5b65..d973358839ff4 100644 --- a/clients/client-workmailmessageflow/src/runtimeConfig.ts +++ b/clients/client-workmailmessageflow/src/runtimeConfig.ts @@ -20,6 +20,7 @@ import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider"; import { NodeHttpHandler as RequestHandler, streamCollector } from "@aws-sdk/node-http-handler"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; +import { sdkStreamMixin } from "@aws-sdk/util-stream-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; import { WorkMailMessageFlowClientConfig } from "./WorkMailMessageFlowClient"; @@ -58,6 +59,7 @@ export const getRuntimeConfig = (config: WorkMailMessageFlowClientConfig) => { ...NODE_RETRY_MODE_CONFIG_OPTIONS, default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE, }), + sdkStreamMixin: config?.sdkStreamMixin ?? sdkStreamMixin, sha256: config?.sha256 ?? Hash.bind(null, "sha256"), streamCollector: config?.streamCollector ?? streamCollector, useDualstackEndpoint: config?.useDualstackEndpoint ?? loadNodeConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS), diff --git a/private/aws-protocoltests-restjson/package.json b/private/aws-protocoltests-restjson/package.json index 15d5c06cebb3a..56d4bf16b5f32 100644 --- a/private/aws-protocoltests-restjson/package.json +++ b/private/aws-protocoltests-restjson/package.json @@ -48,6 +48,8 @@ "@aws-sdk/util-body-length-node": "*", "@aws-sdk/util-defaults-mode-browser": "*", "@aws-sdk/util-defaults-mode-node": "*", + "@aws-sdk/util-stream-browser": "*", + "@aws-sdk/util-stream-node": "*", "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@aws-sdk/util-utf8-browser": "*", diff --git a/private/aws-protocoltests-restjson/src/RestJsonProtocolClient.ts b/private/aws-protocoltests-restjson/src/RestJsonProtocolClient.ts index 90f3650dc5f3a..6ed194ac56af6 100644 --- a/private/aws-protocoltests-restjson/src/RestJsonProtocolClient.ts +++ b/private/aws-protocoltests-restjson/src/RestJsonProtocolClient.ts @@ -41,6 +41,7 @@ import { Provider as __Provider, Provider, RegionInfoProvider, + SdkStreamMixinInjector as __SdkStreamMixinInjector, StreamCollector as __StreamCollector, StreamHasher as __StreamHasher, UrlParser as __UrlParser, @@ -587,6 +588,12 @@ export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__ * The {@link DefaultsMode} that will be used to determine how certain default configuration options are resolved in the SDK. */ defaultsMode?: DefaultsMode | Provider; + + /** + * The internal function that inject utilities to runtime-specific stream to help users consume the data + * @internal + */ + sdkStreamMixin?: __SdkStreamMixinInjector; } type RestJsonProtocolClientConfigType = Partial<__SmithyConfiguration<__HttpHandlerOptions>> & diff --git a/private/aws-protocoltests-restjson/src/commands/StreamingTraitsCommand.ts b/private/aws-protocoltests-restjson/src/commands/StreamingTraitsCommand.ts index ade6f68fe6865..ecd8613b17d63 100644 --- a/private/aws-protocoltests-restjson/src/commands/StreamingTraitsCommand.ts +++ b/private/aws-protocoltests-restjson/src/commands/StreamingTraitsCommand.ts @@ -9,6 +9,8 @@ import { HttpHandlerOptions as __HttpHandlerOptions, MetadataBearer as __MetadataBearer, MiddlewareStack, + SdkStream as __SdkStream, + SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; @@ -29,7 +31,17 @@ type StreamingTraitsCommandInputType = Omit * This interface extends from `StreamingTraitsInputOutput` interface. There are more parameters than `blob` defined in {@link StreamingTraitsInputOutput} */ export interface StreamingTraitsCommandInput extends StreamingTraitsCommandInputType {} -export interface StreamingTraitsCommandOutput extends StreamingTraitsInputOutput, __MetadataBearer {} +type StreamingTraitsCommandOutputType = __MetadataBearer & + Omit & { + /** + * For *`StreamingTraitsInputOutput["blob"]`*, see {@link StreamingTraitsInputOutput.blob}. + */ + blob?: __SdkStream["blob"]>; + }; +/** + * This interface extends from `StreamingTraitsInputOutput` interface. There are more parameters than `blob` defined in {@link StreamingTraitsInputOutput} + */ +export interface StreamingTraitsCommandOutput extends StreamingTraitsCommandOutputType {} /** * This examples serializes a streaming blob shape in the request body. @@ -99,7 +111,10 @@ export class StreamingTraitsCommand extends $Command< return serializeAws_restJson1StreamingTraitsCommand(input, context); } - private deserialize(output: __HttpResponse, context: __SerdeContext): Promise { + private deserialize( + output: __HttpResponse, + context: __SerdeContext & __SdkStreamSerdeContext + ): Promise { return deserializeAws_restJson1StreamingTraitsCommand(output, context); } diff --git a/private/aws-protocoltests-restjson/src/commands/StreamingTraitsWithMediaTypeCommand.ts b/private/aws-protocoltests-restjson/src/commands/StreamingTraitsWithMediaTypeCommand.ts index 6713cff134e19..3d6a9c0a97aa8 100644 --- a/private/aws-protocoltests-restjson/src/commands/StreamingTraitsWithMediaTypeCommand.ts +++ b/private/aws-protocoltests-restjson/src/commands/StreamingTraitsWithMediaTypeCommand.ts @@ -9,6 +9,8 @@ import { HttpHandlerOptions as __HttpHandlerOptions, MetadataBearer as __MetadataBearer, MiddlewareStack, + SdkStream as __SdkStream, + SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; @@ -32,9 +34,17 @@ type StreamingTraitsWithMediaTypeCommandInputType = Omit & { + /** + * For *`StreamingTraitsWithMediaTypeInputOutput["blob"]`*, see {@link StreamingTraitsWithMediaTypeInputOutput.blob}. + */ + blob?: __SdkStream["blob"]>; + }; +/** + * This interface extends from `StreamingTraitsWithMediaTypeInputOutput` interface. There are more parameters than `blob` defined in {@link StreamingTraitsWithMediaTypeInputOutput} + */ +export interface StreamingTraitsWithMediaTypeCommandOutput extends StreamingTraitsWithMediaTypeCommandOutputType {} /** * This examples serializes a streaming media-typed blob shape in the request body. @@ -106,7 +116,7 @@ export class StreamingTraitsWithMediaTypeCommand extends $Command< private deserialize( output: __HttpResponse, - context: __SerdeContext + context: __SerdeContext & __SdkStreamSerdeContext ): Promise { return deserializeAws_restJson1StreamingTraitsWithMediaTypeCommand(output, context); } diff --git a/private/aws-protocoltests-restjson/src/protocols/Aws_restJson1.ts b/private/aws-protocoltests-restjson/src/protocols/Aws_restJson1.ts index 5868d3126f49f..6b611d3020a35 100644 --- a/private/aws-protocoltests-restjson/src/protocols/Aws_restJson1.ts +++ b/private/aws-protocoltests-restjson/src/protocols/Aws_restJson1.ts @@ -42,6 +42,7 @@ import { DocumentType as __DocumentType, Endpoint as __Endpoint, ResponseMetadata as __ResponseMetadata, + SdkStreamSerdeContext as __SdkStreamSerdeContext, SerdeContext as __SerdeContext, } from "@aws-sdk/types"; import { v4 as generateIdempotencyToken } from "uuid"; @@ -5509,7 +5510,7 @@ const deserializeAws_restJson1SimpleScalarPropertiesCommandError = async ( export const deserializeAws_restJson1StreamingTraitsCommand = async ( output: __HttpResponse, - context: __SerdeContext + context: __SerdeContext & __SdkStreamSerdeContext ): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { return deserializeAws_restJson1StreamingTraitsCommandError(output, context); @@ -5519,6 +5520,7 @@ export const deserializeAws_restJson1StreamingTraitsCommand = async ( foo: [, output.headers["x-foo"]], }); const data: any = output.body; + context.sdkStreamMixin(data); contents.blob = data; return contents; }; @@ -5575,7 +5577,7 @@ const deserializeAws_restJson1StreamingTraitsRequireLengthCommandError = async ( export const deserializeAws_restJson1StreamingTraitsWithMediaTypeCommand = async ( output: __HttpResponse, - context: __SerdeContext + context: __SerdeContext & __SdkStreamSerdeContext ): Promise => { if (output.statusCode !== 200 && output.statusCode >= 300) { return deserializeAws_restJson1StreamingTraitsWithMediaTypeCommandError(output, context); @@ -5585,6 +5587,7 @@ export const deserializeAws_restJson1StreamingTraitsWithMediaTypeCommand = async foo: [, output.headers["x-foo"]], }); const data: any = output.body; + context.sdkStreamMixin(data); contents.blob = data; return contents; }; diff --git a/private/aws-protocoltests-restjson/src/runtimeConfig.browser.ts b/private/aws-protocoltests-restjson/src/runtimeConfig.browser.ts index ffde223099dce..4a59235b6f2e3 100644 --- a/private/aws-protocoltests-restjson/src/runtimeConfig.browser.ts +++ b/private/aws-protocoltests-restjson/src/runtimeConfig.browser.ts @@ -10,6 +10,7 @@ import { Md5 } from "@aws-sdk/md5-js"; import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser"; import { calculateBodyLength } from "@aws-sdk/util-body-length-browser"; +import { sdkStreamMixin } from "@aws-sdk/util-stream-browser"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser"; import { RestJsonProtocolClientConfig } from "./RestJsonProtocolClient"; @@ -39,6 +40,7 @@ export const getRuntimeConfig = (config: RestJsonProtocolClientConfig) => { md5: config?.md5 ?? Md5, requestHandler: config?.requestHandler ?? new RequestHandler(defaultConfigProvider), retryMode: config?.retryMode ?? (async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE), + sdkStreamMixin: config?.sdkStreamMixin ?? sdkStreamMixin, sha256: config?.sha256 ?? Sha256, streamCollector: config?.streamCollector ?? streamCollector, streamHasher: config?.streamHasher ?? streamHasher, diff --git a/private/aws-protocoltests-restjson/src/runtimeConfig.ts b/private/aws-protocoltests-restjson/src/runtimeConfig.ts index 277bda61c7ee6..b9596ee6023b8 100644 --- a/private/aws-protocoltests-restjson/src/runtimeConfig.ts +++ b/private/aws-protocoltests-restjson/src/runtimeConfig.ts @@ -18,6 +18,7 @@ import { NodeHttpHandler as RequestHandler, streamCollector } from "@aws-sdk/nod import { HashConstructor as __HashConstructor } from "@aws-sdk/types"; import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node"; import { calculateBodyLength } from "@aws-sdk/util-body-length-node"; +import { sdkStreamMixin } from "@aws-sdk/util-stream-node"; import { defaultUserAgent } from "@aws-sdk/util-user-agent-node"; import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node"; import { RestJsonProtocolClientConfig } from "./RestJsonProtocolClient"; @@ -54,6 +55,7 @@ export const getRuntimeConfig = (config: RestJsonProtocolClientConfig) => { ...NODE_RETRY_MODE_CONFIG_OPTIONS, default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE, }), + sdkStreamMixin: config?.sdkStreamMixin ?? sdkStreamMixin, sha256: config?.sha256 ?? Hash.bind(null, "sha256"), streamCollector: config?.streamCollector ?? streamCollector, streamHasher: config?.streamHasher ?? streamHasher,