Base class for all providers.

As an abstract class, it should not be used directly, but rather extended by other providers.

It implements the common logic for all providers, such as caching, transformation, etc. Each provider that extends this class must implement the _get and _getMultiple abstract methods.

These methods are responsible for retrieving the values from the underlying parameter store. They are called by the get and getMultiple methods, which are responsible for caching and transformation.

If there are multiple calls to the same parameter but in a different transform, they will be stored multiple times. This allows us to optimize by transforming the data only once per retrieval, thus there is no need to transform cached values multiple times.

However, this means that we need to make multiple calls to the underlying parameter store if we need to return it in different transforms.

Since the number of supported transform is small and the probability that a given parameter will always be used in a specific transform, this should be an acceptable tradeoff.

Hierarchy (View Summary)

Implements

Constructors

  • Parameters

    • __namedParameters: {
          awsSdkV3Client?: unknown;
          clientConfig?: unknown;
          proto: new (config?: unknown) => unknown;
      }

    Returns BaseProvider

Properties

client: unknown
store: Map<string, ExpirableValue>

Methods

  • Retrieve parameter value from the underlying parameter store.

    Parameters

    • name: string

      Parameter name

    • Optionaloptions: unknown

      Options to pass to the underlying implemented method

    Returns Promise<unknown>

  • Retrieve multiple parameter values from the underlying parameter store.

    Parameters

    • path: string

      Parameter name

    • Optionaloptions: unknown

      Options to pass to the underlying implementated method

    Returns Promise<undefined | Record<string, unknown>>

  • Add a value to the cache.

    Parameters

    • key: string

      Key of the cached value

    • value: unknown

      Value to be cached

    • maxAge: number

      Maximum age in seconds for the value to be cached

    Returns void

  • Check whether a key has expired in the cache or not.

    It returns true if the key is expired or not present in the cache.

    Parameters

    • key: string

      Stringified representation of the key to retrieve

    Returns boolean