import type { ClientRequest } from "node:http"; import type { S3Client, S3ClientConfig } from "@aws-sdk/client-s3"; import type middy from "@middy/core"; import type { Options as MiddyOptions } from "@middy/util"; import type { Context as LambdaContext } from "aws-lambda"; export interface S3ObjectResponseOptions extends Pick< MiddyOptions, | "AwsClient" | "awsClientOptions" | "awsClientAssumeRole" | "awsClientCapture" | "disablePrefetch" > { bodyType?: "stream" | "promise"; } export type Context = LambdaContext & { s3Object: TOptions extends { bodyType: "stream" } ? ClientRequest : TOptions extends { bodyType: "promise" } ? Promise : never; } & { s3ObjectFetch: Promise; }; export interface Internal extends Record { s3ObjectResponse: { RequestRoute: string; RequestToken: string; }; } declare function s3ObjectResponse< TOptions extends S3ObjectResponseOptions | undefined, >( options?: TOptions, ): middy.MiddlewareObj, Internal>; export default s3ObjectResponse;