Skip to content

Commit 1f4c91e

Browse files
committed
refactor: updated constructor type + interface intersections
1 parent 3323c15 commit 1f4c91e

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

Diff for: packages/parameters/src/ssm/SSMProvider.ts

+9-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
import { BaseProvider, DEFAULT_PROVIDERS, transformValue } from '../BaseProvider';
22
import { GetParameterError } from '../Exceptions';
33
import { DEFAULT_MAX_AGE_SECS } from '../constants';
4-
import { SSMClient, GetParameterCommand, paginateGetParametersByPath, GetParametersCommand } from '@aws-sdk/client-ssm';
4+
import {
5+
SSMClient,
6+
GetParameterCommand,
7+
paginateGetParametersByPath,
8+
GetParametersCommand
9+
} from '@aws-sdk/client-ssm';
510
import type {
6-
SSMClientConfig,
711
GetParameterCommandInput,
812
GetParametersByPathCommandInput,
913
GetParametersCommandInput,
1014
GetParametersCommandOutput,
1115
} from '@aws-sdk/client-ssm';
1216
import type {
17+
SSMProviderOptionsInterface,
1318
SSMGetMultipleOptionsInterface,
1419
SSMGetOptionsInterface,
1520
SSMGetParametersByNameOutputInterface,
@@ -24,9 +29,9 @@ class SSMProvider extends BaseProvider {
2429
protected errorsKey = '_errors';
2530
protected maxGetParametersItems = 10;
2631

27-
public constructor(config: SSMClientConfig = {}) {
32+
public constructor(config?: SSMProviderOptionsInterface) {
2833
super();
29-
this.client = new SSMClient(config);
34+
this.client = new SSMClient(config?.clientConfig || {});
3035
}
3136

3237
public async get(

Diff for: packages/parameters/src/types/SSMProvider.ts

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1-
import type { GetParameterCommandInput, GetParametersByPathCommandInput } from '@aws-sdk/client-ssm';
1+
import type {
2+
SSMClientConfig,
3+
GetParameterCommandInput,
4+
GetParametersByPathCommandInput
5+
} from '@aws-sdk/client-ssm';
26
import type { GetOptionsInterface, GetMultipleOptionsInterface, TransformOptions } from './BaseProvider';
37

8+
interface SSMProviderOptionsInterface {
9+
clientConfig: SSMClientConfig
10+
}
11+
412
/**
513
* Options for the SSMProvider get method.
614
*
@@ -31,7 +39,7 @@ interface SSMGetParametersByNameOptionsInterface {
3139
type SSMSplitBatchAndDecryptParametersOutputType = {
3240
parametersToFetchInBatch: Record<string, SSMGetParametersByNameOptionsInterface>
3341
parametersToDecrypt: Record<string, SSMGetParametersByNameOptionsInterface>
34-
} & { [key: string]: SSMGetParametersByNameOptionsInterface };
42+
};
3543

3644
interface SSMGetParametersByNameOutputInterface {
3745
response: Record<string, unknown>
@@ -41,9 +49,10 @@ interface SSMGetParametersByNameOutputInterface {
4149
type SSMGetParametersByNameFromCacheOutputType = {
4250
cached: Record<string, string | Record<string, unknown>>
4351
toFetch: Record<string, SSMGetParametersByNameOptionsInterface>
44-
} & { [key: string]: SSMGetParametersByNameOptionsInterface };
52+
};
4553

4654
export {
55+
SSMProviderOptionsInterface,
4756
SSMGetOptionsInterface,
4857
SSMGetMultipleOptionsInterface,
4958
SSMGetParametersByNameOptionsInterface,

0 commit comments

Comments
 (0)