
Security News
GitHub Actions Supply Chain Attack Puts Thousands of Projects at Risk
A compromised GitHub Action exposed secrets in CI/CD logs, putting thousands of projects at risk and forcing developers to urgently secure their workflows.
#WorkSmith
npm i worksmith --save
A seriously functional
workflow library.
Compose hyper complex async program parts in a way that is easy to understand and also to maintain, and favors configuration over coding.
sequence
or parallel
or the warezSequence
to manage program flow##usage
###The workflow definition:
{ "task": "sequence",
"items": [
{
task: "set",
value: ["some_id", 1, 1],
resultTo: "@insertParams"
},
{
task:"sql/pg",
connection: "@connection",
command: "insert into order (order_id, version, type) \
values ($1, $2, $3) returning id",
params: "@insertParams",
resultTo: "insertResult"
},
{...}
]
}
###The code:
var worksmith = require('worksmith')
var Workflow = worksmith('./workflow.json')
var context = {connection:"postgres://login:pw@host/db", other:"data"}
var task = Workflow(context);
task(function(err, result) {
console.log("workflow completed, context potentially changed")
})
mini-workflow has some core workflow task types for controlling process flow. These are the -sequence -parallel -warezSequence activities
##How to create your own activity
mini-workflow lets you build your activities on a super easy way
Place the following code as "hello-world.js"
in the tasks
folder
var utils = require('worksmith')
module.exports = function (node) {
//use the node variable to access workflow params
return function(context) {
//use the context to access workflow execution state
return function(done) {
//set done when your acitivity finished its job
//read and write data from the context
console.log("Hello world", utils.readValue(node.inParam, context))
utils.setValue(context,"myresult","myvalue")
done();
}
}
}
Now you can use it the same way as the core activities
var wf = workflow.define({ "task": "sequence",
"items": [
{"task":"hello-world", "inParam":"some thing"} ]});
var ctx = {"some":"value"};
wf(ctx)(function(err) {
console.log(ctx)
})
##List of core activities
###log Write a log to the console ####options message
###delay Waits a bit ####options duration
###insertDbRecord Like the name suggests ####options table data connection resultTo
###softDeleteDbRecord
###deleteDbRecord
###parallel Execute sub tasks in parallel ####options items array
###sequence Execute sub tasks in sequence ####options items array
###warezSequence Define a sequence on a patching compatible way ####options items array
###set Set variable on the workflow context ####options name value
FAQs
A purely functional workflow engine
We found that worksmith demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
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.
Security News
A compromised GitHub Action exposed secrets in CI/CD logs, putting thousands of projects at risk and forcing developers to urgently secure their workflows.
Research
Security News
A malicious Maven package typosquatting a popular library is secretly stealing OAuth credentials on the 15th of each month, putting Java developers at risk.
Security News
Socket and Seal Security collaborate to fix a critical npm overrides bug, resolving a three-year security issue in the JavaScript ecosystem's most popular package manager.