@corva/node-sdk
TypeScript icon, indicating that this package has built-in type declarations

8.5.0 • Public • Published

@corva/node-sdk

Corva node-sdk is a framework for building Corva DevCenter apps.

Contents

Requirements

Quick start

Install

With npm (bundled with NodeJs, see docs):

$ npm i @corva/node-sdk

With yarn (docs):

$ yarn add @corva/node-sdk

With pnpm (docs):

$ pnpm add @corva/node-sdk

Create an app

A minimal app should export a handler that matches one defined in your manifest.json:

const { Corva } = require('@corva/node-sdk');

exports.handler = new Corva().task((event) => console.log(event));

For details on the app types, see App types.

App types

There are the following app types that you can build:

  • Stream - works with real-time data;
  • Scheduled - works with data at defined schedules/intervals (e.g., once a minute, once every three ft.);
  • Task - works with data on-demand.

Followable apps

Stream & scheduled apps can be followed. Followable apps must produce data to trigger the chain reaction of apps' runs.

There are the following possible ways to make the app produce the data:

Writing a handler

To implement an app with node-sdk, you have to write a handler function that accepts two arguments:

  • event - an event itself, see Events;
  • context - helpers that are bound to app execution's context, see Context.

Handler example

const handler = (event, context) => {
    console.log(event, context);
}

Event

There are following types of events that match the related app types:

Context

Context provides the next functionality:

  • cache - convenient methods to work with the state; see State class. Not available for task apps;
  • api - helper to interact with Corva API (and make any other generic request as well); see Api;
  • logger - Logger instance; secrets - the application's sensitive data (see DevCenter docs, usage example, testing);
  • config - some basic info about app invoke.

Readme

Keywords

Package Sidebar

Install

npm i @corva/node-sdk

Weekly Downloads

1,369

Version

8.5.0

License

UNLICENSED

Unpacked Size

178 kB

Total Files

133

Last publish

Collaborators

  • aj8k
  • leonid.khomenko
  • suchov
  • vasyl.skalozub
  • andrii.koval
  • yuliiahryhorchuk
  • mgdskr_corva
  • ruslan.shukiurov
  • maksymozymok
  • kostia.khozhay
  • ryandawson
  • bestfit
  • oleksandr_krupko
  • villeti
  • jordanambra
  • dumavit1
  • antonpyrlyk
  • corva-devops-automation