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

pipelineobject

v1.1.0

Published

Class to instantiate pipelines

Downloads

4

Readme

Pipelineobject

Class to instantiate pipelines. All the documentation here is in TypeScript.

Pre-requisite to understand and use this library : taskobject (GitHub repo, NPM package).

Installation

In your project directory :

npm install pipelineobject

Usage

All examples are related.

Import

import p = require("pipelineobject");

Instantiation - TO COMPLETE

To instantiate a pipeline object, you need :

  • a Job Manager object (JMobject) given by the function JMsetup() (in the ./node_modules/pipelineobject/ts/src/test/index.js)
  • a list of literals describing the pipeline nodes (see the List of nodes section),
  • a list of the links (see the List of links section).

Then you can instantiate your pipeline object :

import testFunc = require("./test/index")
testFunc.JMsetup().on('ready', (JMobject) => {
	let myPipeline = new p.Pipeline(JMobject, myNodes, myLinks);
});

Push input

You have to give the content of your input and a reference to the slot (see the Slot reference section) :

let contentInput = fs.readFileSync(myFile, "utf8");
myPipeline.push(contentInput, { taskIndex: 0, slotName: "slot1" });

New task modules

When you want to use a task newly created in a pipeline (myNewTask), you have to add it to the imports in the ./node_modules/pipelineobject/ts/src/index.ts script, at its beginning :

let taskModules = {
	naccesstask: require('naccesstask').naccesstask,
	hextask: require('hextask').hextask,
	myNewTask: require('myNewTask').myNewTask // added
}

Then you have to compile the code : go in the ./node_modules/pipelineobject/ directory and use the command :

tsc -p ./tsconfig.json

Warning : do not forget to install your new task module in ./node_modules !

Note : your task class need to respect the implementation explained in the taskobject documentation (GitHub repo, NPM package).

Data structures

This part helps to understand the data you have to give to your pipeline object and the data it creates. All examples are related.

List of nodes

When you want to instantiate a pipeline, you need to give it a list of nodes (see the Instantiation section).
It's a list of all the tasks composing the pipeline, like for example :

myNodes = [
	{ tagtask: "taskA" }, // index = 0
	{ tagtask: "taskB" }, // index = 1
	{ tagtask: "taskC" } // index = 2
];

Note : the "tagtask" designs the task module name (like "naccesstask" for example GitHub repo, NPM package). This task module must be required in the ./node_modules/pipelineobject/ts/src/index.ts script (see the New task modules section).

List of links

When you instantiate a pipeline, you have to give it a list of links (see the Instantiation section). A link is described by :

  1. the index of the source task,
  2. the index of the task to which the target slot belongs,
  3. the name of the target slot.

Thus, the list of links must be like :

myLinks = [
	{ source: 0, target: 2, slot: "slot1" },
	{ source: 1, target: 2, slot: "slot2" }
]

List of tasks

At the instantiation (see the Instantiation section), the pipeline class will create a list of task objects, like :

this.tasks = [
	[Object object], // taskA object
	[Object object], // taskB object
	[Object object] // taskC object
]

Literal of slots

At the instantiation (see the Instantiation section), the pipeline class will create a literal of slots objects, like :

this.slots = [
	{ slot1: [Object object] }, // belongs to taskA (index = 0)
	{ slot1: [Object object] }, // belongs to taskB (index = 1)
	{ slot1: [Object object], slot2: [Object object] } // belong to taskC (index = 2)
]

Note : each element of this list refers to a task (same index). An element is a literal containing all the slots of the task (the key is the name of the slot).

Slot reference

When you want to push an input onto a slot (see the Push Input section), you need to use a reference to this slot. A slot reference is described by :

  1. the index of the task to which the slot belongs,
  2. the name of the slot.

For example, the reference to the slot1 of the taskA is :

let slot1_taskA_ref = {
	taskIndex: 0,
	slotName: "slot1"
}