npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

jsai-jobprocessor

v0.0.33

Published

Job Processor and Task Framework

Downloads

7

Readme

JobProcessor

Job Processor and Task Framework for choregraphy of execution.

This project is open for contribution/comments/suggestions

Job Processors are a way to represent a process similarly to a workflow. Everything in job processor derives from a TaskNode. The general outline is that a request is created to start the process. The process then creates an execution context, which flows from one node to another during the life cycle of the process. It is possible for a flow to be stopped by generating an error or by requesting cancellation.

If an error is generated, the compensation part of a flow or a branch of the flow will get executed. Each node has a a successor. When the successor is set, it is executed once the current node is done with its execution. If there is no successor, this marks the end of the flow.

The components of a flow are

  • Processor, which is a specialized type of CompensatedTaskNode and is the starting point of any process.
  • CompensatedTaskNode
    • Has a start node, which is the beginning of the regular flow
    • Has a Compensation node, which is executed if an error happens during the execution of the normal flow
    • Successor, is executed after the normal flow is completed.
  • TaskNode, which are never used directly. They should be derived to do something useful to your process
  • ConditonNode, allows evaluating a condition.
    • Condition, is a function that should return either true or false. Works in conjunction with the jsai-ruleengine module, which allows composing evaluation of conditions in rule sets and rules
    • TrueSuccessor: this is the start node of a branch to be executed when the condition is true
    • FalseSuccessor: this is the start node of a branch to be executed when the condition is false
    • Successor: this is where the flow will resume after the true or false branch is executed.
  • LoopNode, allows a block of nodes to be executed while a condition is true
    • Condition, is a function that should return either true or false. Works in conjunction with the jsai-ruleengine module, which allows composing evaluation of conditions in rule sets and rules
    • StartNode, is the start of a block of nodes that will be executed while the condition is true
    • Successor, this is where the flow will resume after the loop is executed.
  • IteratorNode, allows a block of nodes to be executed for each element of an array or each property of an object
    • Iterator, is a string representing the path to a property in the execution context, which should contain an an array or an object to be enumerated.
    • StartNode, is the start of a block of nodes that will be executed for each item being enumerated. The execution context has a currentIteration property that points to the current item in the iterator
    • Successor, is where the flow resumes once all items have been enumerated.

Each processor gets cached in an object, along with its TaskNode. This means that processors and their tasks pretty much act as singleton. Don't set properties on a TaskNode with the intent of it being instance specific. If you need to pass data along in the process, add it to the execution context data property.

This is work in progress so feel free to make suggestions.