1 | import middy from '@middy/core'
|
2 | import { Options as MiddyOptions } from '@middy/util'
|
3 | import { Context as LambdaContext } from 'aws-lambda'
|
4 | import { SecretsManagerClient, SecretsManagerClientConfig } from '@aws-sdk/client-secrets-manager'
|
5 |
|
6 | interface Options<AwsSecretsManagerClient = SecretsManagerClient>
|
7 | extends MiddyOptions<
|
8 | AwsSecretsManagerClient,
|
9 | SecretsManagerClientConfig
|
10 | > {}
|
11 |
|
12 | export type Context<TOptions extends Options | undefined> = TOptions extends {
|
13 | setToContext: true
|
14 | }
|
15 | ? LambdaContext & Record<keyof TOptions['fetchData'], any>
|
16 | : LambdaContext
|
17 |
|
18 | declare function secretsManager<TOptions extends Options | undefined> (
|
19 | options?: TOptions
|
20 | ): middy.MiddlewareObj<unknown, any, Error, Context<TOptions>>
|
21 |
|
22 | export default secretsManager
|
23 |
|
\ | No newline at end of file |