Comparing version 0.0.18 to 0.0.19
96
index.js
@@ -10,6 +10,9 @@ var debug = require('debug')('workflow:common') | ||
var taskPath | ||
var resolvers = {}; | ||
var workflow = { | ||
use: function(ns, taskLibrary) { | ||
resolvers[ns] = taskLibrary; | ||
}, | ||
discoverTaskType: function(taskType) { | ||
@@ -21,3 +24,11 @@ var processRelativePath = path.join(process.cwd(), taskPath, taskType + ".js"); | ||
getTaskType: function(taskType) { | ||
if (taskType.indexOf("/") > -1) { | ||
var taskSpec = taskType.split("/"); | ||
var ns = taskSpec[0]; | ||
if (resolvers[ns]) { | ||
return resolvers[ns](taskSpec[1]); | ||
} | ||
} | ||
var taskFile = taskTypeCache[taskType] || (taskTypeCache[taskType] = workflow.discoverTaskType(taskType)) | ||
return require(taskFile); | ||
@@ -202,81 +213,2 @@ }, | ||
module.exports = wfLoader; | ||
// var result | ||
// var builders = { | ||
// "[object Array]": function(o) { | ||
// return o.map(function(item) { | ||
// return workflow.readValue(item, object) | ||
// }) | ||
// }, | ||
// "[object Object]": function(o) { | ||
// var result = {} | ||
// Object.keys(o).forEach(function(key) { | ||
// result[key] = workflow.readValue(key, object) | ||
// }) | ||
// return result | ||
// } | ||
// } | ||
// value = (builders[Object.prototype.toString.call(mapDef)] || (function(o) { return o })) (mapDef) | ||
module.exports = wfLoader; |
{ | ||
"name": "worksmith", | ||
"version": "0.0.18", | ||
"version": "0.0.19", | ||
"description": "A purely functional workflow engine ", | ||
@@ -29,6 +29,8 @@ "main": "index.js", | ||
"lodash": "^3.7.0", | ||
"mocha": "^2.2.5", | ||
"pg": "^4.3.0", | ||
"xregexp": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"mocha": "^2.2.5" | ||
} | ||
} |
@@ -0,0 +0,0 @@ var debug = require('debug')('worksmith:activities:workflow') |
@@ -0,0 +0,0 @@ var assert = require('assert') |
@@ -0,0 +0,0 @@ var assert = require('assert') |
@@ -0,0 +0,0 @@ var assert = require('assert') |
@@ -0,0 +0,0 @@ module.exports = { |
@@ -238,4 +238,20 @@ # worksmith tutorial | ||
}); | ||
``` | ||
## Using a task collection module | ||
```javascript | ||
var worksmith = require('worksmith') | ||
worksmith.use("more", require('worksmith_example_module')) | ||
var wf = worksmith({ | ||
"task":"more/random", | ||
resultTo: "rnd" | ||
}); | ||
wf({},console.log) | ||
``` | ||
## How to create a task collection module | ||
Check out an example module [here](https://github.com/PeterAronZentai/worksmith_example_module). | ||
## The `workflow' task type | ||
@@ -242,0 +258,0 @@ You can execute a complete workflow as a task. |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
56793
6
42
1212
1
+ Addedminimist@0.0.10(transitive)
- Removedmocha@^2.2.5
- Removedcommander@0.6.12.3.0(transitive)
- Removeddebug@2.2.0(transitive)
- Removeddiff@1.4.0(transitive)
- Removedescape-string-regexp@1.0.2(transitive)
- Removedglob@3.2.11(transitive)
- Removedgrowl@1.9.2(transitive)
- Removedinherits@2.0.4(transitive)
- Removedjade@0.26.3(transitive)
- Removedlru-cache@2.7.3(transitive)
- Removedminimatch@0.3.0(transitive)
- Removedminimist@0.0.8(transitive)
- Removedmkdirp@0.3.00.5.1(transitive)
- Removedmocha@2.5.3(transitive)
- Removedms@0.7.1(transitive)
- Removedsigmund@1.0.1(transitive)
- Removedsupports-color@1.2.0(transitive)
- Removedto-iso-string@0.0.2(transitive)