JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1766
  • Score
    100M100P100Q136667F
  • License MIT

Package Exports

  • ssm-parameter-store

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ssm-parameter-store) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

ssm-parameter-store

A safer, nicer abstraction over AWS SSM Parameter Store with built-in caching and idempotent preloading.

Usage:

import AWS from 'aws-sdk';
import SsmParameterStore from 'ssm-parameter-store';

AWS.config.update({ region: 'us-east-1' });

async function main() {
  const params = new SsmParameterStore({
    TestParameter: 'test_parameter',
    TestNestedParameter: '/this/is/a/test/nested/parameter',
    NonExistentParameter: 'doesntexist'
  });

  // Fetch all params and cache them
  await params.preload();

  console.log(await params.getAll());
  // -> {
  //      AmbassadorIsSandbox: '1',
  //      TestNestedParameter: 'Hello, World!',
  //      NonExistentParameter: undefined
  //    }

  console.log(await params.get('TestParameter')); // -> '1'
  console.log(await params.get('TestNestedParameter')); // -> 'Hello, World!'

  await params.preload(); // Resolves instantly since we already preloaded
  await params.preload({ ignoreCache: true }); // Force preloading everything again

  // Also updates the cache after fetching
  console.log(await params.get('NonExistentParameter', { ignoreCache: true })); // -> undefined

  console.log(await params.get('UndeclaredParameter'));
  // -> undefined (+ compile time error!);
  // Argument of type '"UndeclaredParameter"' is not assignable to parameter of type '"AmbassadorIsSandbox" | "TestNestedParameter" | "NonExistentParameter"'
}

main();