Skip to content

Commit

Permalink
fix(parameters): types in BaseProvider + added getMultiple alias to S…
Browse files Browse the repository at this point in the history
…ecretsProvider (#1214)
  • Loading branch information
dreamorosi committed Jan 5, 2023
1 parent a3daba9 commit 32bd7e8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 1 addition & 3 deletions packages/parameters/src/BaseProvider.ts
Expand Up @@ -5,7 +5,6 @@ import { ExpirableValue } from './ExpirableValue';
import { TRANSFORM_METHOD_BINARY, TRANSFORM_METHOD_JSON } from './constants';
import { GetParameterError, TransformParameterError } from './Exceptions';
import type { BaseProviderInterface, GetMultipleOptionsInterface, GetOptionsInterface, TransformOptions } from './types';
import type { SecretsGetOptionsInterface } from './types/SecretsProvider';

// These providers are dinamycally intialized on first use of the helper functions
const DEFAULT_PROVIDERS: Record<string, BaseProvider> = {};
Expand Down Expand Up @@ -39,9 +38,8 @@ abstract class BaseProvider implements BaseProviderInterface {
* this should be an acceptable tradeoff.
*
* @param {string} name - Parameter name
* @param {GetOptionsInterface|SecretsGetOptionsInterface} options - Options to configure maximum age, trasformation, AWS SDK options, or force fetch
* @param {GetOptionsInterface} options - Options to configure maximum age, trasformation, AWS SDK options, or force fetch
*/
public async get(name: string, options?: SecretsGetOptionsInterface): Promise<undefined | string | Uint8Array | Record<string, unknown>>;
public async get(name: string, options?: GetOptionsInterface): Promise<undefined | string | Uint8Array | Record<string, unknown>> {
const configs = new GetOptions(options);
const key = [ name, configs.transform ].toString();
Expand Down
10 changes: 10 additions & 0 deletions packages/parameters/src/secrets/SecretsProvider.ts
Expand Up @@ -26,6 +26,16 @@ class SecretsProvider extends BaseProvider {
return super.get(name, options);
}

/**
* Retrieving multiple parameter values is not supported with AWS Secrets Manager.
*/
public async getMultiple(
path: string,
_options?: unknown
): Promise<undefined | Record<string, unknown>> {
return super.getMultiple(path);
}

protected async _get(
name: string,
options?: SecretsGetOptionsInterface
Expand Down

0 comments on commit 32bd7e8

Please sign in to comment.