# @cumulus-test/common

> Common utilities used across tasks

Latest version **1.0.2-beta.0** (published 2018-01-11) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @cumulus-test/common
pnpm add @cumulus-test/common
yarn add @cumulus-test/common
bun add @cumulus-test/common
```

## Health

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

Positive: no vulnerabilities; high maintenance score.

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

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.0.2-beta.0 |
| Published | 2018-01-11 |
| First published | 2018-01-09 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 33 |
| Known vulnerabilities | 0 (+4 in 3 direct dependencies) |
| Install scripts | no |
| GitHub stars | 304 |
| Author | Cumulus Authors |
| Maintainers | kkelly51, scisco |
| Keywords | GIBS |

## Links

- npm: https://www.npmjs.com/package/@cumulus-test/common
- Repository: https://github.com/cumulus-nasa/cumulus
- Homepage: https://github.com/cumulus-nasa/cumulus#readme
- Issues: https://github.com/cumulus-nasa/cumulus/issues
- npm.io page: https://npm.io/package/@cumulus-test/common

## Dependencies (33)

- [ajv](https://npm.io/package/ajv.md) ^5.0.4-beta.3
- [glob](https://npm.io/package/glob.md) ^7.1.1
- [uuid](https://npm.io/package/uuid.md) ^3.1.0
- [async](https://npm.io/package/async.md) ^2.0.0
- [cwait](https://npm.io/package/cwait.md) ^1.0.0
- [mocha](https://npm.io/package/mocha.md) ^2.5.3
- [eslint](https://npm.io/package/eslint.md) ^3.2.2
- [lodash](https://npm.io/package/lodash.md) ^4.13.1
- [ajv-cli](https://npm.io/package/ajv-cli.md) ^1.1.1
- [aws-sdk](https://npm.io/package/aws-sdk.md) ^2.4.11
- [js-yaml](https://npm.io/package/js-yaml.md) ^3.8.3
- [webpack](https://npm.io/package/webpack.md) ^1.13.3
- [expect.js](https://npm.io/package/expect.js.md) ^0.3.1
- [babel-core](https://npm.io/package/babel-core.md) ^6.13.2
- [babel-eslint](https://npm.io/package/babel-eslint.md) ^6.1.2
- [babel-loader](https://npm.io/package/babel-loader.md) ^6.2.4
- [mocha-webpack](https://npm.io/package/mocha-webpack.md) ^0.7.0
- [babel-polyfill](https://npm.io/package/babel-polyfill.md) ^6.13.0
- [exports-loader](https://npm.io/package/exports-loader.md) ^0.6.3
- [prepend-loader](https://npm.io/package/prepend-loader.md) 0.0.2
- [babel-preset-env](https://npm.io/package/babel-preset-env.md) ^1.4.0
- [follow-redirects](https://npm.io/package/follow-redirects.md) ^1.2.4
- [transform-loader](https://npm.io/package/transform-loader.md) ^0.2.3
- [source-map-support](https://npm.io/package/source-map-support.md) ^0.4.2
- [babel-preset-es2015](https://npm.io/package/babel-preset-es2015.md) ^6.13.2
- [eslint-plugin-react](https://npm.io/package/eslint-plugin-react.md) ^6.0.0
- [eslint-config-airbnb](https://npm.io/package/eslint-config-airbnb.md) ^10.0.0
- [eslint-plugin-import](https://npm.io/package/eslint-plugin-import.md) ^1.13.0
- [mocha-junit-reporter](https://npm.io/package/mocha-junit-reporter.md) ^1.11.1
- [eslint-plugin-jsx-a11y](https://npm.io/package/eslint-plugin-jsx-a11y.md) ^2.1.0
- [webpack-node-externals](https://npm.io/package/webpack-node-externals.md) ^1.5.4
- [@cumulus-test/test-data](https://npm.io/package/@cumulus-test/test-data.md) ^1.0.2-beta.0
- [babel-plugin-transform-async-to-generator](https://npm.io/package/babel-plugin-transform-async-to-generator.md) ^6.8.0

## Recent versions

- 1.0.2-beta.0 (latest) — 2018-01-11
- 1.1.0-alpha.c0ebdcd8 (canary) — 2018-01-11
- 1.0.3 — 2018-01-11
- 1.0.2-beta.8a155f42 — 2018-01-11
- 1.0.2 — 2018-01-11
- 1.0.0 — 2018-01-11
- 0.0.1 — 2018-01-09

## README

# @cumulus/common

Common libraries for interacting with Cumulus ingest

## Tasks

Cumulus tasks written in node.js should extend [`Task`](./task.js) to benefit from
the protocol parsing and message interpretation it provides. A minimal task
class is as follows:

```javascript

const Task = require('@cumulus/common/task');

module.exports = class MyTask extends Task {
  run() {
    // Read inputs
    // this.config contains task configuration with all variables resolved
    // this.message contains the incoming message, with this.message.payload
    // being the input from the previous step

    // Do actual work

    // Return output, which is the incoming message with its payload overwritten
    // to contain the output of this task. The result may optionally be a promise.
    return Object.assign({}, this.message, { payload: someOutput });
  }


  /**
   * Entrypoint for Lambda
   */
  static handler(...args) {
    return MyTask.handle(...args);
  }
}
```

Several modules provide support for working with Tasks and the message protocol:

 * [@cumulus/common/config](./config.js)
   Utilities for working with configuration YAML files and resolving their resources
 * [@cumulus/common/local-helpers](./local-helpers.js):
   Provides methods for setting up message payloads for use in development / local testing
 * [@cumulus/common/step-functions](./step-functions.js):
   Provides initial inputs for step functions
 * [@cumulus/common/field-pattern](./field-pattern.js)
   String template interpretation, as used by the configuration parser
 * [@cumulus/common/message-source](./message-source.js)
   Utilities for serializing messages being sent to/from AWS Step Functions, STDIN/STDOUT, etc
 * [@cumulus/common/schema](./schema.js)
   JSON schema validation
 * [@cumulus/common/test-helpers](./test-helpers.js)
   Utilities for generating tasks and messages in unit tests

## General Utilities

 * [@cumulus/common/aws](./aws.js)
   Utilities for working with AWS. For ease of setup, testing, and credential management, code
   should obtain AWS client objects from helpers in this module.
 * [@cumulus/common/concurrency](./concurrency.js)
   Implementations of distributed concurrency primitives (mutex, semaphore) using DynamoDB
 * [@cumulus/common/errors](./errors.js)
   Classes for thrown errors
 * [@cumulus/common/log](./log.js)
   Log helpers. Code should use this instead of console.* directly to enable tagging, timestamping,
   muting or potentially shipping logs to alternative locations
 * [@cumulus/common/string](./string.js)
   Utilities for manipulating strings
 * [@cumulus/common/util](./util.js)
   Other misc general utilities

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