@@ -22,7 +22,7 @@ import type {
22
22
SSMGetMultipleOutput ,
23
23
SSMGetParametersByNameOutput ,
24
24
SSMGetParametersByNameOutputInterface ,
25
- SSMGetParametersByNameOptionsInterface ,
25
+ SSMGetParametersByNameOptions ,
26
26
SSMSplitBatchAndDecryptParametersOutputType ,
27
27
SSMGetParametersByNameFromCacheOutputType ,
28
28
} from '../types/SSMProvider' ;
@@ -319,11 +319,11 @@ class SSMProvider extends BaseProvider {
319
319
* @param {SSMGetOptions } options - Options to configure the provider
320
320
* @see https://awslabs.github.io/aws-lambda-powertools-typescript/latest/utilities/parameters/
321
321
*/
322
- public async get < T = undefined , O extends SSMGetOptions | undefined = SSMGetOptions > (
322
+ public async get < ExplicitUserProvidedType = undefined , InferredFromOptionsType extends SSMGetOptions | undefined = SSMGetOptions > (
323
323
name : string ,
324
- options ?: O & SSMGetOptions
325
- ) : Promise < SSMGetOutput < T , O > | undefined > {
326
- return super . get ( name , options ) as Promise < SSMGetOutput < T , O > | undefined > ;
324
+ options ?: InferredFromOptionsType & SSMGetOptions
325
+ ) : Promise < SSMGetOutput < ExplicitUserProvidedType , InferredFromOptionsType > | undefined > {
326
+ return super . get ( name , options ) as Promise < SSMGetOutput < ExplicitUserProvidedType , InferredFromOptionsType > | undefined > ;
327
327
}
328
328
329
329
/**
@@ -356,11 +356,11 @@ class SSMProvider extends BaseProvider {
356
356
* @param {SSMGetMultipleOptions } options - Options to configure the retrieval
357
357
* @see https://awslabs.github.io/aws-lambda-powertools-typescript/latest/utilities/parameters/
358
358
*/
359
- public async getMultiple < T = undefined , O extends SSMGetMultipleOptionsUnion | undefined = undefined > (
359
+ public async getMultiple < ExplicitUserProvidedType = undefined , InferredFromOptionsType extends SSMGetMultipleOptionsUnion | undefined = undefined > (
360
360
path : string ,
361
- options ?: O & SSMGetMultipleOptions
362
- ) : Promise < SSMGetMultipleOutput < T , O > | undefined > {
363
- return super . getMultiple ( path , options ) as Promise < SSMGetMultipleOutput < T , O > | undefined > ;
361
+ options ?: InferredFromOptionsType & SSMGetMultipleOptions
362
+ ) : Promise < SSMGetMultipleOutput < ExplicitUserProvidedType , InferredFromOptionsType > | undefined > {
363
+ return super . getMultiple ( path , options ) as Promise < SSMGetMultipleOutput < ExplicitUserProvidedType , InferredFromOptionsType > | undefined > ;
364
364
}
365
365
366
366
/**
@@ -409,19 +409,21 @@ class SSMProvider extends BaseProvider {
409
409
* └────────────────────┘
410
410
* ```
411
411
*
412
- * @param {Record<string, SSMGetParametersByNameOptionsInterface > } parameters - Object containing parameter names and any optional overrides
413
- * @param {SSMGetParametersByNameOptionsInterface } options - Options to configure the retrieval
412
+ * @param {Record<string, SSMGetParametersByNameOptions > } parameters - Object containing parameter names and any optional overrides
413
+ * @param {SSMGetParametersByNameOptions } options - Options to configure the retrieval
414
414
* @see https://awslabs.github.io/aws-lambda-powertools-typescript/latest/utilities/parameters/
415
415
*/
416
- public async getParametersByName < T = undefined > (
417
- parameters : Record < string , SSMGetParametersByNameOptionsInterface > ,
418
- options ?: SSMGetParametersByNameOptionsInterface
419
- ) : Promise < SSMGetParametersByNameOutput < T > > {
420
- const configs = { ...{
421
- decrypt : this . resolveDecryptionConfigValue ( { } ) || false ,
422
- maxAge : DEFAULT_MAX_AGE_SECS ,
423
- throwOnError : true ,
424
- } , ...options } ;
416
+ public async getParametersByName < ExplicitUserProvidedType = undefined > (
417
+ parameters : Record < string , SSMGetParametersByNameOptions > ,
418
+ options ?: SSMGetParametersByNameOptions
419
+ ) : Promise < SSMGetParametersByNameOutput < ExplicitUserProvidedType > > {
420
+ const configs = {
421
+ ...{
422
+ decrypt : this . resolveDecryptionConfigValue ( { } ) || false ,
423
+ maxAge : DEFAULT_MAX_AGE_SECS ,
424
+ throwOnError : true ,
425
+ } , ...options
426
+ } ;
425
427
426
428
let response : Record < string , unknown > = { } ;
427
429
@@ -464,7 +466,7 @@ class SSMProvider extends BaseProvider {
464
466
}
465
467
}
466
468
467
- return response as unknown as Promise < SSMGetParametersByNameOutput < T > > ;
469
+ return response as unknown as Promise < SSMGetParametersByNameOutput < ExplicitUserProvidedType > > ;
468
470
}
469
471
470
472
/**
@@ -537,12 +539,12 @@ class SSMProvider extends BaseProvider {
537
539
/**
538
540
* Retrieve multiple items by name from AWS Systems Manager.
539
541
*
540
- * @param {Record<string, SSMGetParametersByNameOptionsInterface > } parameters - An object of parameter names and their options
542
+ * @param {Record<string, SSMGetParametersByNameOptions > } parameters - An object of parameter names and their options
541
543
* @param {throwOnError } throwOnError - Whether to throw an error if any of the parameters' retrieval throws an error or handle them gracefully
542
544
* @param {boolean } decrypt - Whether to decrypt the parameters or not
543
545
*/
544
546
protected async _getParametersByName (
545
- parameters : Record < string , SSMGetParametersByNameOptionsInterface > ,
547
+ parameters : Record < string , SSMGetParametersByNameOptions > ,
546
548
throwOnError : boolean ,
547
549
decrypt : boolean
548
550
) : Promise < SSMGetParametersByNameOutputInterface > {
@@ -570,12 +572,12 @@ class SSMProvider extends BaseProvider {
570
572
/**
571
573
* Slice batch and fetch parameters using GetPrameters API by max permissible batch size
572
574
*
573
- * @param {Record<string, SSMGetParametersByNameOptionsInterface > } parameters - An object of parameter names and their options
575
+ * @param {Record<string, SSMGetParametersByNameOptions > } parameters - An object of parameter names and their options
574
576
* @param {throwOnError } throwOnError - Whether to throw an error if any of the parameters' retrieval throws an error or handle them gracefully
575
577
* @param {boolean } decrypt - Whether to decrypt the parameters or not
576
578
*/
577
579
protected async getParametersBatchByName (
578
- parameters : Record < string , SSMGetParametersByNameOptionsInterface > ,
580
+ parameters : Record < string , SSMGetParametersByNameOptions > ,
579
581
throwOnError : boolean ,
580
582
decrypt : boolean
581
583
) : Promise < SSMGetParametersByNameOutputInterface > {
@@ -610,13 +612,13 @@ class SSMProvider extends BaseProvider {
610
612
/**
611
613
* Fetch each parameter from batch that hasn't expired from cache
612
614
*
613
- * @param {Record<string, SSMGetParametersByNameOptionsInterface > } parameters - An object of parameter names and their options
615
+ * @param {Record<string, SSMGetParametersByNameOptions > } parameters - An object of parameter names and their options
614
616
*/
615
617
protected async getParametersByNameFromCache (
616
- parameters : Record < string , SSMGetParametersByNameOptionsInterface >
618
+ parameters : Record < string , SSMGetParametersByNameOptions >
617
619
) : Promise < SSMGetParametersByNameFromCacheOutputType > {
618
620
const cached : Record < string , string | Record < string , unknown > > = { } ;
619
- const toFetch : Record < string , SSMGetParametersByNameOptionsInterface > = { } ;
621
+ const toFetch : Record < string , SSMGetParametersByNameOptions > = { } ;
620
622
621
623
for ( const [ parameterName , parameterOptions ] of Object . entries ( parameters ) ) {
622
624
const cacheKey = [ parameterName , parameterOptions . transform ] . toString ( ) ;
@@ -638,12 +640,12 @@ class SSMProvider extends BaseProvider {
638
640
/**
639
641
* Slice object into chunks of max permissible batch size and fetch parameters
640
642
*
641
- * @param {Record<string, SSMGetParametersByNameOptionsInterface > } parameters - An object of parameter names and their options
643
+ * @param {Record<string, SSMGetParametersByNameOptions > } parameters - An object of parameter names and their options
642
644
* @param {boolean } throwOnError - Whether to throw an error if any of the parameters' retrieval throws an error or handle them gracefully
643
645
* @param {boolean } decrypt - Whether to decrypt the parameters or not
644
646
*/
645
647
protected async getParametersByNameInChunks (
646
- parameters : Record < string , SSMGetParametersByNameOptionsInterface > ,
648
+ parameters : Record < string , SSMGetParametersByNameOptions > ,
647
649
throwOnError : boolean ,
648
650
decrypt : boolean
649
651
) : Promise < SSMGetParametersByNameOutputInterface > {
@@ -663,7 +665,7 @@ class SSMProvider extends BaseProvider {
663
665
acc [ chunkIndex ] [ parameterName ] = parameterOptions ;
664
666
665
667
return acc ;
666
- } , [ ] as Record < string , SSMGetParametersByNameOptionsInterface > [ ] ) ;
668
+ } , [ ] as Record < string , SSMGetParametersByNameOptions > [ ] ) ;
667
669
668
670
// Fetch each chunk and merge results
669
671
for ( const chunk of chunks ) {
@@ -685,11 +687,11 @@ class SSMProvider extends BaseProvider {
685
687
/**
686
688
* Fetch parameters by name while also decrypting them
687
689
*
688
- * @param {Record<string, SSMGetParametersByNameOptionsInterface > } parameters - An object of parameter names and their options
690
+ * @param {Record<string, SSMGetParametersByNameOptions > } parameters - An object of parameter names and their options
689
691
* @param {boolean } throwOnError - Whether to throw an error if any of the parameters' retrieval throws an error or handle them gracefully
690
692
*/
691
693
protected async getParametersByNameWithDecryptOption (
692
- parameters : Record < string , SSMGetParametersByNameOptionsInterface > ,
694
+ parameters : Record < string , SSMGetParametersByNameOptions > ,
693
695
throwOnError : boolean
694
696
) : Promise < SSMGetParametersByNameOutputInterface > {
695
697
const response : Record < string , unknown > = { } ;
@@ -752,15 +754,15 @@ class SSMProvider extends BaseProvider {
752
754
/**
753
755
* Split parameters that can be fetched by GetParameters vs GetParameter.
754
756
*
755
- * @param {Record<string, SSMGetParametersByNameOptionsInterface > } parameters - An object of parameter names and their options
756
- * @param {SSMGetParametersByNameOptionsInterface } configs - The configs passed down
757
+ * @param {Record<string, SSMGetParametersByNameOptions > } parameters - An object of parameter names and their options
758
+ * @param {SSMGetParametersByNameOptions } configs - The configs passed down
757
759
*/
758
760
protected static splitBatchAndDecryptParameters (
759
- parameters : Record < string , SSMGetParametersByNameOptionsInterface > ,
760
- configs : SSMGetParametersByNameOptionsInterface
761
+ parameters : Record < string , SSMGetParametersByNameOptions > ,
762
+ configs : SSMGetParametersByNameOptions
761
763
) : SSMSplitBatchAndDecryptParametersOutputType {
762
- const parametersToFetchInBatch : Record < string , SSMGetParametersByNameOptionsInterface > = { } ;
763
- const parametersToDecrypt : Record < string , SSMGetParametersByNameOptionsInterface > = { } ;
764
+ const parametersToFetchInBatch : Record < string , SSMGetParametersByNameOptions > = { } ;
765
+ const parametersToDecrypt : Record < string , SSMGetParametersByNameOptions > = { } ;
764
766
765
767
for ( const [ parameterName , parameterOptions ] of Object . entries ( parameters ) ) {
766
768
const overrides = parameterOptions ;
@@ -807,12 +809,12 @@ class SSMProvider extends BaseProvider {
807
809
* Transform and cache the response from GetParameters API call
808
810
*
809
811
* @param {GetParametersCommandOutput } response - The response from the GetParameters API call
810
- * @param {Record<string, SSMGetParametersByNameOptionsInterface > } parameters - An object of parameter names and their options
812
+ * @param {Record<string, SSMGetParametersByNameOptions > } parameters - An object of parameter names and their options
811
813
* @param {boolean } throwOnError - Whether to throw an error if any of the parameters' retrieval throws an error or handle them gracefully
812
814
*/
813
815
protected transformAndCacheGetParametersResponse (
814
816
response : GetParametersCommandOutput ,
815
- parameters : Record < string , SSMGetParametersByNameOptionsInterface > ,
817
+ parameters : Record < string , SSMGetParametersByNameOptions > ,
816
818
throwOnError : boolean
817
819
) : Record < string , unknown > {
818
820
const processedParameters : Record < string , unknown > = { } ;
0 commit comments