# cf-helpers

> A set of utility functions for using Cloud Formation in nodeJS.

Latest version **1.0.1** (published 2018-08-03) · ISC license · 0 weekly downloads

## Install

```sh
npm install cf-helpers
pnpm add cf-helpers
yarn add cf-helpers
bun add cf-helpers
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2018-08-03 |
| First published | 2018-08-02 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 3.9 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Embedify |
| Maintainers | embedify |

## Links

- npm: https://www.npmjs.com/package/cf-helpers
- npm.io page: https://npm.io/package/cf-helpers

## Dependencies (1)

- [aws-sdk](https://npm.io/package/aws-sdk.md) ^2.286.1

## Recent versions

- 1.0.1 (latest) — 2018-08-03
- 1.0.0 — 2018-08-03
- 0.1.1 — 2018-08-03
- 0.1.0 — 2018-08-02

## README

# Cloud Formation Helpers

This library is untested and is a set of wrappers around the standard AWS NodeJS SDK functions which are much more capable. Use this library at your own risk.

### Importing the library

```js
let cfh = require('cf-helpers')({region: 'ap-southeast-2'});
```

### Structure of CFHelpers class

```js
// Structure of class returned from require('cf-helpers')
class CFHelpers{
    constructor({region}) => new CFHelpers()

    getRegion() => string

    stackExists({name}) => Promise, resolves(exists: boolean), rejects(err: Error)

    listStacks() => Promise, resolves(stacks: object[]), rejects(err: Error)

    createStack({template}) => Promise, resolves(created?: boolean), rejects(err: Error)

    updateStack({template}) => Promise, resolves(exists: boolean), rejects(err: Error)

    getExports({name}) => Promise, resolves(exports: object[]), rejects(err: Error)

    stackStatus({name}) => Promise, resolves(status: string), rejects(err: Error)
}
```

### Checking if a stack exists

```js
let cf = require('cf-helpers');

// returns a Promise
cf.stackExists('stack name')
    .then((exists: boolean) => { 
        // Do some work
    })
    .catch((err: Error) => {
        // Handle error case
    });
```

### Listing all stacks and their current status

```js
let cf = require('cf-helpers');

// returns a Promise
cf.listStacks('stack name')
    .then((stacks: object[]) => { 
        // Do some work

        stacks = [
            {
                StackName : "name of stack",
                StackStatus : "CREATE_IN_PROGRESS" | "CREATE_COMPLETE" | "ROLLBACK_IN_PROGRESS" | "ROLLBACK_FAILED" | "ROLLBACK_COMPLETE" | "DELETE_IN_PROGRESS" | "DELETE_FAILED" | "UPDATE_IN_PROGRESS" | "UPDATE_COMPLETE_CLEANUP_IN_PROGRESS" | "UPDATE_COMPLETE" | "UPDATE_ROLLBACK_IN_PROGRESS" | "UPDATE_ROLLBACK_FAILED" | "UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS" | "UPDATE_ROLLBACK_COMPLETE"
                // Other useful properties exist
            }
        ]
    })
    .catch((err: Error) => {
        // Handle error case
    });
```

---
_Source: https://npm.io/package/cf-helpers · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
