Skip to content

Commit f311cab

Browse files
authored
feat(types): add types to sdk stream utility mixin (#3779)
1 parent b272b15 commit f311cab

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

packages/types/src/serde.ts

+17
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,20 @@ export interface ResponseDeserializer<OutputType, ResponseType = any, Context =
5252
*/
5353
(output: ResponseType, context: Context): Promise<OutputType>;
5454
}
55+
56+
/**
57+
* The interface contains mix-in utility functions to transfer the runtime-specific
58+
* stream implementation to specified format. Each stream can ONLY be transformed
59+
* once.
60+
*/
61+
export interface SdkStreamMixin {
62+
transformToByteArray: () => Promise<Uint8Array>;
63+
transformToString: (encoding?: string) => Promise<string>;
64+
transformToWebStream: () => ReadableStream;
65+
}
66+
67+
/**
68+
* The type describing a runtime-specific stream implementation with mix-in
69+
* utility functions.
70+
*/
71+
export type SdkStream<BaseStream> = BaseStream & SdkStreamMixin;

0 commit comments

Comments
 (0)