Socket
Socket
Sign inDemoInstall

ssm-parameter-store

Package Overview
Dependencies
1
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ssm-parameter-store

A safer, nicer abstraction over AWS SSM Parameter Store with built-in caching and idempotent preloading. TypeScript compile time checks, plus handy autocompletion:


Version published
Weekly downloads
863
increased by106.95%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

ssm-parameter-store

A safer, nicer abstraction over AWS SSM Parameter Store with built-in caching and idempotent preloading. TypeScript compile time checks, plus handy autocompletion:

Installation

  • npm install --save ssm-parameter-store

Or

  • yarn add ssm-parameter-store

Usage

import AWS from 'aws-sdk';
import SsmParameterStore from './src';

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'
  });

  await params.preload();

  console.log(await params.getAll());
  // -> {
  //      TestParameter: '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!);
  // ts(2345) Argument of type '"UndeclaredParameter"' is not assignable to parameter of type '"TestParameter" | "TestNestedParameter" | "NonExistentParameter"
}

main();

Keywords

FAQs

Last updated on 19 Jun 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc