@cumulus-test/common

1.0.2-beta.0 • Public • Published

@cumulus/common

Common libraries for interacting with Cumulus ingest

Tasks

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

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:

General Utilities

Readme

Keywords

Package Sidebar

Install

npm i @cumulus-test/common

Weekly Downloads

2

Version

1.0.2-beta.0

License

Apache-2.0

Last publish

Collaborators

  • kkelly51
  • scisco