Socket
Book a DemoInstallSign in
Socket

@corva/node-sdk

Package Overview
Dependencies
Maintainers
14
Versions
195
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@corva/node-sdk

Node.js SDK to build corva.ai apps

latest
npmnpm
Version
8.5.0
Version published
Weekly downloads
35
-2.78%
Maintainers
14
Weekly downloads
 
Created
Source

@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.

Keywords

lambda

FAQs

Package last updated on 05 Dec 2023

Did you know?

Socket

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