Socket
Socket
Sign inDemoInstall

flowa

Package Overview
Dependencies
3
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.3.0 to 3.4.0

test/samples/basic/basic8.js

61

index.js

@@ -305,2 +305,4 @@ /**

* be called manually.
* - If the execution is terminated the callback will
* be called manually without executing the task.
*

@@ -318,2 +320,7 @@ * @param {String} taskName

// Is the execution terminated
if (runVariables.terminated) {
return callback();
}
// Debugging is on

@@ -331,4 +338,7 @@ if (runVariables.options.debug) {

// Execute the task
try {
task = task.bind(new FlowaTask(taskName, runVariables, self));
returnedValue = self._timeout(task, timeout, runVariables, taskName)(runVariables.context, callback);

@@ -459,2 +469,3 @@

options: typeof options == 'undefined' ? {} : options,
terminated: false,
timedout: false

@@ -490,2 +501,52 @@ };

/**
* A task object to be bound when calling a task
*
* @param {String} taskName
* @param {Object} runVariables
* @param {Flowa} flowa
*/
function FlowaTask(taskName, runVariables, flowa) {
/**
* The name of the task
* @type {String}
*/
this.name = taskName;
/**
* Variables needed for the current run
* @type {Object}
*/
this._runVariables = runVariables;
/**
* The task's runner type
* @type {String}
*/
this.runnerType = flowa._tasksRunnersTypes[taskName];
/**
* The task's depth
* @type {Number}
*/
depth = flowa._tasksDepths[taskName];
/**
* The task's parent
* @type {String}
*/
parent = flowa._tasksParents[taskName];
}
/**
* Set the execution as terminated
*/
FlowaTask.prototype.done = function() {
this._runVariables.terminated = true;
};
module.exports = Flowa;

2

package.json
{
"name": "flowa",
"version": "3.3.0",
"version": "3.4.0",
"description": "Service level control flow for Node.js",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -115,2 +115,26 @@ /**

* a key `task${id}` = callsCounter into the context
* and calls its callback on the next event loop tick
* using `setImmediate` and terminiates the flow
* by calling `this.done()`
*
* - The `callsCounter` is incremented for each call
*
* @param {Number} id
* @return {Function}
*/
function generateDummyTerminatingTask(id) {
var callsCounter = 1;
return function(context, callback) {
context['task' + id] = context['task' + id] ? context['task' + id] + 1 : 1;
this.done();
setImmediate(callback);
};
}
/**
* Generate a dummy task that adds
* a key `task${id}` = callsCounter into the context
* and returns a promise that gets resolved on the next event loop tick

@@ -217,2 +241,3 @@ * using `setImmediate` with the arguments (null, jumpToTask)

generateDummySyncTask: generateDummySyncTask,
generateDummyTerminatingTask: generateDummyTerminatingTask,
generateJumperPromiseTask: generateJumperPromiseTask,

@@ -219,0 +244,0 @@ generateDummyTimerTask: generateDummyTimerTask,

@@ -70,2 +70,8 @@ /**

describe('Sample: Basic/Basic8', function(callback) {
suites.properties(samples.basic.basic8);
suites.output(samples.basic.basic8);
suites.flow(samples.basic.basic8);
});
describe('Sample: Jump/Jump1', function(callback) {

@@ -72,0 +78,0 @@ suites.flow(samples.jump.jump1);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc