66import type { GetSecretValueCommandInput } from '@aws-sdk/client-secrets-manager' ;
77import type {
88 SecretsProviderOptions ,
9- SecretsGetOptionsInterface
9+ SecretsGetOptions ,
10+ SecretsGetOutput ,
11+ SecretsGetOptionsUnion ,
1012} from '../types/SecretsProvider' ;
1113
1214/**
@@ -157,7 +159,7 @@ class SecretsProvider extends BaseProvider {
157159 *
158160 * @param {SecretsProviderOptions } config - The configuration object.
159161 */
160- public constructor ( config ?: SecretsProviderOptions ) {
162+ public constructor ( config ?: SecretsProviderOptions ) {
161163 super ( ) ;
162164
163165 if ( config ?. awsSdkV3Client ) {
@@ -170,7 +172,6 @@ class SecretsProvider extends BaseProvider {
170172 const clientConfig = config ?. clientConfig || { } ;
171173 this . client = new SecretsManagerClient ( clientConfig ) ;
172174 }
173-
174175 }
175176
176177 /**
@@ -197,14 +198,20 @@ class SecretsProvider extends BaseProvider {
197198 * For usage examples check {@link SecretsProvider}.
198199 *
199200 * @param {string } name - The name of the secret
200- * @param {SecretsGetOptionsInterface } options - Options to customize the retrieval of the secret
201+ * @param {SecretsGetOptions } options - Options to customize the retrieval of the secret
201202 * @see https://awslabs.github.io/aws-lambda-powertools-typescript/latest/utilities/parameters/
202203 */
203- public async get (
204+ public async get <
205+ ExplicitUserProvidedType = undefined ,
206+ InferredFromOptionsType extends SecretsGetOptionsUnion | undefined = SecretsGetOptionsUnion
207+ > (
204208 name : string ,
205- options ?: SecretsGetOptionsInterface
206- ) : Promise < undefined | string | Uint8Array | Record < string , unknown > > {
207- return super . get ( name , options ) ;
209+ options ?: InferredFromOptionsType & SecretsGetOptions
210+ ) : Promise < SecretsGetOutput < ExplicitUserProvidedType , InferredFromOptionsType > | undefined > {
211+ return super . get (
212+ name ,
213+ options
214+ ) as Promise < SecretsGetOutput < ExplicitUserProvidedType , InferredFromOptionsType > | undefined > ;
208215 }
209216
210217 /**
@@ -221,11 +228,11 @@ class SecretsProvider extends BaseProvider {
221228 * Retrieve a configuration from AWS AppConfig.
222229 *
223230 * @param {string } name - Name of the configuration or its ID
224- * @param {SecretsGetOptionsInterface } options - SDK options to propagate to the AWS SDK v3 for JavaScript client
231+ * @param {SecretsGetOptions } options - SDK options to propagate to the AWS SDK v3 for JavaScript client
225232 */
226233 protected async _get (
227234 name : string ,
228- options ?: SecretsGetOptionsInterface
235+ options ?: SecretsGetOptions
229236 ) : Promise < string | Uint8Array | undefined > {
230237 const sdkOptions : GetSecretValueCommandInput = {
231238 ...( options ?. sdkOptions || { } ) ,
@@ -249,7 +256,7 @@ class SecretsProvider extends BaseProvider {
249256 _options ?: unknown
250257 ) : Promise < Record < string , string | undefined > > {
251258 throw new Error ( 'Method not implemented.' ) ;
252- }
259+ }
253260}
254261
255262export {
0 commit comments