3.0.0 • Published 5 years ago
@liteflow/service v3.0.0
@liteflow/service
Installation
npm install @liteflow/serviceService
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.
3.0.0
5 years ago
2.1.1
5 years ago
2.1.0
5 years ago
2.1.0-alpha.0
5 years ago
2.0.0
5 years ago
1.2.0-alpha.0
5 years ago
1.1.0
6 years ago
1.0.7
6 years ago
1.0.6
6 years ago
1.0.5
6 years ago
1.0.4
6 years ago
1.0.3
6 years ago
1.0.2
6 years ago
1.0.1
6 years ago
1.0.0
6 years ago
1.0.0-alpha.5
6 years ago
1.0.0-alpha.4
6 years ago
1.0.0-alpha.3
6 years ago
1.0.0-alpha.2
6 years ago
1.0.0-alpha.1
6 years ago