New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@liteflow/service

Package Overview
Dependencies
Maintainers
2
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@liteflow/service

- [Installation](#installation) - [Service](#service) - [Task](#task)

  • 3.0.0
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

@liteflow/service

  • Installation
  • Service
  • Task

Installation

npm install @liteflow/service

Service

const Service = require('@liteflow/service')

const liteflow = new Service()

Task

The service have to call liteflow.listenTask to start listening for task to execute by passing an object containing the tasks' key and function.

liteflow.listenTask({
  'TASK_1_KEY': (inputs) => {
    // Function of the task 1
    // Can directly throw error
    if (inputs.foo === undefined) {
      throw new Error('foo is undefined')
    }
    // Return an object
    return { foo: inputs.a + 'bar' }
  }, 
  'TASK_2_KEY': async (inputs) => {
    // Function of the task 2
    // Return an Promise containing an object
    const response = await fetch('...')
    return response.json()
  },
})

The task functions accept inputs as parameter and returns the outputs as object or Promise of object. The task function can throw an Error in case of error. The lib will catch it and send it to the MESG Engine.

FAQs

Package last updated on 04 Dec 2020

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc