@updating-secrets/aws-secrets-manager-adapter
Version:
AWS Secrets Manager adapter for the updating-secrets package.
42 lines (41 loc) • 1.42 kB
TypeScript
import { type JsonCompatibleValue } from '@augment-vir/common';
import { GetSecretValueCommand, type GetSecretValueCommandOutput } from '@aws-sdk/client-secrets-manager';
import { type RequireExactlyOne } from 'type-fest';
/**
* Mock secrets setup for {@link MockAwsSecretsManagerClient}.
*
* @category Internal
*/
export type MockAwsSecrets = {
[AwsSecretId in string]: RequireExactlyOne<{
/**
* A value that will be JSON stringified for the `.SecretString` output of AWS Secrets
* Manager.
*/
preJson: JsonCompatibleValue;
/** Set the raw `.SecretString` output of AWS Secrets Manager directly. */
rawString: string;
}>;
};
/**
* A mock implementation of `SecretsManagerClient` from the
* [`@aws-sdk/client-secrets-manager`](https://www.npmjs.com/package/@aws-sdk/client-secrets-manager)
* package.
*
* This only mocks the following:
*
* - The `.send()` method
* - Sending a `GetSecretValueCommand` command
* - Returning a `.SecretString` value from that command
*
* @category Mocks
*/
export declare class MockAwsSecretsManagerClient {
private readonly mockSecrets;
constructor(mockSecrets: MockAwsSecrets);
/**
* A mock implementation of `SecretsManagerClient.send()`. Only the first parameter (the
* command) is used.
*/
send(command: GetSecretValueCommand): Promise<GetSecretValueCommandOutput>;
}