@@ -5,6 +5,8 @@ import { ExpirableValue } from './ExpirableValue';
5
5
import { TRANSFORM_METHOD_BINARY , TRANSFORM_METHOD_JSON } from './constants' ;
6
6
import { GetParameterError , TransformParameterError } from './Exceptions' ;
7
7
import type { BaseProviderInterface , GetMultipleOptionsInterface , GetOptionsInterface , TransformOptions } from './types' ;
8
+ import { isSSMGetOptionsInterface } from './types/SSMProvider' ;
9
+ import type { SSMGetOptionsInterface } from './types/SSMProvider' ;
8
10
9
11
abstract class BaseProvider implements BaseProviderInterface {
10
12
protected store : Map < string , ExpirableValue > ;
@@ -35,8 +37,9 @@ abstract class BaseProvider implements BaseProviderInterface {
35
37
* this should be an acceptable tradeoff.
36
38
*
37
39
* @param {string } name - Parameter name
38
- * @param {GetOptionsInterface } options - Options to configure maximum age, trasformation, AWS SDK options, or force fetch
40
+ * @param {GetOptionsInterface|SSMGetOptionsInterface } options - Options to configure maximum age, trasformation, AWS SDK options, or force fetch
39
41
*/
42
+ public async get ( name : string , options ?: SSMGetOptionsInterface ) : Promise < undefined | string | Record < string , unknown > > ;
40
43
public async get ( name : string , options ?: GetOptionsInterface ) : Promise < undefined | string | Record < string , unknown > > {
41
44
const configs = new GetOptions ( options ) ;
42
45
const key = [ name , configs . transform ] . toString ( ) ;
@@ -49,6 +52,11 @@ abstract class BaseProvider implements BaseProviderInterface {
49
52
50
53
let value ;
51
54
try {
55
+ // Type assertion is needed because the SSM provider has a different signature for the get method
56
+ if ( options && isSSMGetOptionsInterface ( options ) && options . decrypt ) {
57
+ options . sdkOptions = options . sdkOptions || { } ;
58
+ options . sdkOptions . WithDecryption = true ;
59
+ }
52
60
value = await this . _get ( name , options ?. sdkOptions ) ;
53
61
} catch ( error ) {
54
62
throw new GetParameterError ( ( error as Error ) . message ) ;
0 commit comments