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

taskcontrol

v1.0.0

Published

Create named isolated/shared workflow task controls and run the tasks with respective before and after middlewares in ordered manner

Downloads

3

Readme

taskcontrol (js-taskcontrol)

Workflow Automation Library with support for Concurrent or Event based processes or activities in Local/Network Automation Tasks, including CI/CD activities.
  • taskcontrol (js-taskcontrol) is a python library to create tasks in and based on named workflow controls. It allows middlewares before and after each task with support for concurrent processing. taskcontrol can run single or multiple tasks during task invocation/runs.
  • It provides a simple decorator called workflow that takes arguments to set up the named workflow controls. It also provides methods to create a plugin and allow working with tasks as a module and/or pre-created ordered task list. Taskcontrol allows for scaling of plugin development with various utilities like authentication, logging, concurrency, sockets, events, publisher-subscriber architectures, webhooks, client-server http api servers etc.

Features

  • In-Development: Create Named task controls (tasks) - instance and isolated
  • In-Development: Allows middlewares before / after each task (data fetch, auth, data save, logging, logout, cleanup, etc)
  • In-Development: Access read-only contexts and results of middlewares/tasks
  • In-Development: Allows Merging two instances of task controls with namespace clash handling
  • In-Development: Run instance, shared, and mix of tasks (individual or all groups)
  • In-Development: Allows working with Logging, Sockets, Events, Queues, Publisher-Subscriber Architectures, etc
  • In-Development: Allows working with commands (Todo), ssh (Todo), etc
  • In-Development: Allows working with Files (Todo - normal, yaml, ini, and csv), Scheduling (Todo), etc
  • In-Development: Allows working with best practices like Dependency Injection (Todo), ORMs/Databases (Todo), Authentication (Todo), etc from within the library and workflows/tasks
  • In-Development: Allows creating, registering, and using tasks/workflows as a plugin

Installation

Command:
  • Node.js

      npm install ***TBD***
Version:
In Development Version: py-taskcontrol V1.2.6 equivalent (functional - production ready with plugin and concurrency support, fully tested) 

Releases Lists in short the releases of the package

Package Link:
https://github.com/taskcontrols/js-taskcontrol
https://npmjs.com/...
Website:
https://taskcontrols.github.io/

Technical Specifications

Requirements:
  • Node 11.x and above
  • Any OS supporting Node 11.x and above
Package Dependencies:
  • None
Quick Demo:

demo example - main.js



const workflow = require("./lib/index").workflow
const Tasks = require("./lib/index").Tasks

sparrow = Tasks()

function middleware_trees(ctx, result, k, c, d){
    console.log("Running my Middleware Function: middleware_trees - task items", k, c, d)
}
    

function taskone(ctx, result, a, b):
    console.log("Running my task function: taskone", a, b)

// decorator not allowed
// decorator support for TS, use TS version
workflow(
    // JS-Python version difference
    // taskfunction to run
    taskone,
    // name
    "taskname",
    // task_order
    1,
    // task_instance
    sparrow,
    // shared
    False,
    // args
    [1, 2],
    // JS-Python version difference
    // // kwargs ()
    // {},
    // before
    [
        {
            "function": middleware_trees,
            "args": [11, 12],
            // JS-Python version difference
            // "kwargs": {"d": "Before Testing message Middleware "},
            "options": {"error": "next", "error_next_value": ""}
        }
    ],
    // after
    [
        {
            "function": middleware_trees,
            "args": [13, 14],
            // JS-Python version difference
            // "kwargs": {"d": "After Middleware Testing message"},
            "options": {
                "error": "error_handler",
                "error_next_value": "value",
                "error_handler": lambda err, value: (err, None)
            }
        }
    ],
    // log
    False
)

// Run single task
tasks="taskname"
sparrow.run(tasks)


// Run all tasks
tasks=["1"]
sparrow.run(tasks)

// tasks=["taskname", ..., "anothertask"]
// sparrow.run(tasks)


Note:

Though it does not support Node version 8.x and above. However, it has not been tested in 8.x. The Syntax and Features of the library supports Node version 11.x due to multithreading environment. All other features may work. However, use at your own risk.

Wiki

Crazy Hint:

You can also create a simple workflow without taskcontrol using a simple list or nested list and loop through them using a for/while loop and invoke them during looping



// Loop the lists below and invoke the functions 
let lst = ["f1", "f2", "f3"]
let nest_lst = [["f1", "f2"], "f3", "f4", ["f5"]]


// Use a reducer if you want to send args to next function like below
function test(a,b){
    console.log(a,b)
    return {"a":a, "b":b}
}
    
function tester(a,b){
    console.log(a,b)
    return null
}


kwargs_for_first_function_the_its_returns_or_other_value_for_next_func = {"a":"a", "b":"b"}
ls = [kwargs_for_first_function_the_its_returns_or_other_value_for_next_func, test, tester]
 
function red(kwargs_for_first_then_func, p){
    let i = p(kwargs.get("a"), kwargs.get("b"))
    return i
}
    
ls.reduce(red)

Todo

  • e2e and Unit Tests - Add Tests (Structure of package created - to be cleaned after writing tests)
  • Allow creating and registering a set of task controls as a plugin
  • Allow working with commands (Todo), ssh (Todo), Files (Todo - normal, yaml, ini, json, and csv), Scheduling (Todo), Dependency Injection (Todo), ORMs/Databases (Todo), Authentication (Todo)
  • [C?] Consider Workflow/Tasks tracking system and Dashboard with its own progress and logging
  • [C?] Consider compatibility to Chef/CircleCI/Github/Other Automation tools, atleast as external added plugins

Status

  • In Active Development (taskcontrol version py-taskcontrol V1.2.6 equivalent)
    • Check https://github.com/taskcontrols/py-taskcontrol/ for features

Support

Paypal.me/taskcontrols

Be a Patreon

License

The MIT License (MIT) - See LICENSE for further details

Copyright © 2020 - till library works

[email protected]