Comparing version 1.0.3 to 1.1.0
NoFlo ChangeLog | ||
=============== | ||
## 1.1.0 (February 19th 2018) | ||
* Added [noflo.asComponent](https://github.com/noflo/noflo/pull/591) for easy mapping of JavaScript functions into NoFlo components. Each argument will get its own inport with the name of the argument, and output is handled based on the type of function being wrapped: | ||
- Regular synchronous functions: return value gets sent to `out`. Thrown errors get sent to `error` | ||
- Functions returning a Promise: resolved promises get sent to `out`, rejected promises to `error` | ||
- Functions taking a Node.js style asynchronous callback: `err` argument to callback gets sent to `error`, result gets sent to `out` | ||
## 1.0.3 (November 24th 2017) | ||
@@ -5,0 +12,0 @@ |
// NoFlo - Flow-Based Programming for JavaScript | ||
// (c) 2017 Flowhub UG | ||
// (c) 2017-2018 Flowhub UG | ||
// NoFlo may be freely distributed under the MIT license | ||
// asCallback helper embedding NoFlo components or graphs in other JavaScript programs. | ||
var ComponentLoader, Graph, IP, Network, getType, internalSocket, normalizeOptions, normalizeOutput, prepareInputMap, prepareNetwork, runNetwork, sendOutputMap; | ||
@@ -18,2 +16,25 @@ | ||
// ## asCallback embedding API | ||
// asCallback is a helper for embedding NoFlo components or | ||
// graphs in other JavaScript programs. | ||
// By using the `noflo.asCallback` function, you can turn any | ||
// NoFlo component or NoFlo Graph instance into a regular, | ||
// Node.js-style JavaScript function. | ||
// Each call to that function starts a new NoFlo network where | ||
// the given input arguments are sent as IP objects to matching | ||
// inports. Once the network finishes, the IP objects received | ||
// from the network will be sent to the callback function. | ||
// If there was anything sent to an `error` outport, this will | ||
// be provided as the error argument to the callback. | ||
// ### Option normalization | ||
// Here we handle the input valus given to the `asCallback` | ||
// function. This allows passing things like a pre-initialized | ||
// NoFlo ComponentLoader, or giving the component loading | ||
// baseDir context. | ||
normalizeOptions = function(options, component) { | ||
@@ -41,2 +62,7 @@ if (!options) { | ||
// ### Network preparation | ||
// Each invocation of the asCallback-wrapped NoFlo graph | ||
// creates a new network. This way we can isolate multiple | ||
// executions of the function in their own contexts. | ||
prepareNetwork = function(component, options, callback) { | ||
@@ -91,2 +117,12 @@ var network; | ||
// ### Network execution | ||
// Once network is ready, we connect to all of its exported | ||
// in and outports and start the network. | ||
// Input data is sent to the inports, and we collect IP | ||
// packets received on the outports. | ||
// Once the network finishes, we send the resulting IP | ||
// objects to the callback. | ||
runNetwork = function(network, inputs, options, callback) { | ||
@@ -97,9 +133,2 @@ var inPorts, inSockets, outPorts, outSockets, received; | ||
inSockets = {}; | ||
inPorts.forEach(function(inport) { | ||
var portDef, process; | ||
portDef = network.graph.inports[inport]; | ||
process = network.getNode(portDef.process); | ||
inSockets[inport] = internalSocket.createSocket(); | ||
return process.component.inPorts[portDef.port].attach(inSockets[inport]); | ||
}); | ||
// Subscribe outports | ||
@@ -129,3 +158,3 @@ received = []; | ||
var port, socket; | ||
// Clear listeners | ||
// Clear listeners | ||
for (port in outSockets) { | ||
@@ -141,8 +170,8 @@ socket = outSockets[port]; | ||
return network.start(function(err) { | ||
var i, inputMap, len, port, results, value; | ||
var i, inputMap, len, port, portDef, process, results, value; | ||
if (err) { | ||
return callback(err); | ||
} | ||
// Send inputs | ||
results = []; | ||
// Send inputs | ||
for (i = 0, len = inputs.length; i < len; i++) { | ||
@@ -155,2 +184,8 @@ inputMap = inputs[i]; | ||
value = inputMap[port]; | ||
if (!inSockets[port]) { | ||
portDef = network.graph.inports[port]; | ||
process = network.getNode(portDef.process); | ||
inSockets[port] = internalSocket.createSocket(); | ||
process.component.inPorts[portDef.port].attach(inSockets[port]); | ||
} | ||
if (IP.isIP(value)) { | ||
@@ -157,0 +192,0 @@ inSockets[port].post(value); |
// NoFlo - Flow-Based Programming for JavaScript | ||
// (c) 2014-2017 Flowhub UG | ||
// NoFlo may be freely distributed under the MIT license | ||
// Base port type used for options normalization | ||
var BasePort, EventEmitter, validTypes; | ||
@@ -10,2 +8,7 @@ | ||
// ## NoFlo Port Base class | ||
// Base port type used for options normalization. Both inports and outports extend this class. | ||
// The list of valid datatypes for ports. | ||
validTypes = ['all', 'string', 'number', 'int', 'object', 'array', 'boolean', 'color', 'date', 'bang', 'function', 'buffer', 'stream']; | ||
@@ -16,5 +19,10 @@ | ||
super(); | ||
this.handleOptions(options); | ||
// Options holds all options of the current port | ||
this.options = this.handleOptions(options); | ||
// Sockets list contains all currently attached | ||
// connections to the port | ||
this.sockets = []; | ||
// Name of the graph node this port is in | ||
this.node = null; | ||
// Name of the port | ||
this.name = null; | ||
@@ -28,13 +36,19 @@ } | ||
if (!options.datatype) { | ||
// We default to the `all` type if no explicit datatype | ||
// was provided | ||
options.datatype = 'all'; | ||
} | ||
if (options.required === void 0) { | ||
// By default ports are not required for graph execution | ||
options.required = false; | ||
} | ||
if (options.datatype === 'integer') { | ||
// Normalize the legacy `integer` type to `int`. | ||
options.datatype = 'int'; | ||
} | ||
// Ensure datatype defined for the port is valid | ||
if (validTypes.indexOf(options.datatype) === -1) { | ||
throw new Error(`Invalid port datatype '${options.datatype}' specified, valid are ${validTypes.join(', ')}`); | ||
} | ||
// Ensure schema defined for the port is valid | ||
if (options.type && !options.schema) { | ||
@@ -47,3 +61,3 @@ options.schema = options.type; | ||
} | ||
return this.options = options; | ||
return options; | ||
} | ||
@@ -50,0 +64,0 @@ |
@@ -5,4 +5,2 @@ // NoFlo - Flow-Based Programming for JavaScript | ||
// NoFlo may be freely distributed under the MIT license | ||
// Baseclass for regular NoFlo components. | ||
var Component, EventEmitter, IP, ProcessContext, ProcessInput, ProcessOutput, debug, debugBrackets, debugSend, ports, | ||
@@ -24,2 +22,6 @@ boundMethodCheck = function(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new Error('Bound instance method accessed before binding'); } }; | ||
Component = (function() { | ||
// ## NoFlo Component Base class | ||
// The `noflo.Component` interface provides a way to instantiate | ||
// and extend NoFlo components. | ||
class Component extends EventEmitter { | ||
@@ -29,2 +31,7 @@ constructor(options) { | ||
super(); | ||
// ### Error emitting helper | ||
// If component has an `error` outport that is connected, errors | ||
// are sent as IP objects there. If the port is not connected, | ||
// errors are thrown. | ||
this.error = this.error.bind(this); | ||
@@ -35,2 +42,6 @@ if (!options) { | ||
if (!options.inPorts) { | ||
// Prepare inports, if any were given in options. | ||
// They can also be set up imperatively after component | ||
// instantiation by using the `component.inPorts.add` | ||
// method. | ||
options.inPorts = {}; | ||
@@ -44,2 +55,6 @@ } | ||
if (!options.outPorts) { | ||
// Prepare outports, if any were given in options. | ||
// They can also be set up imperatively after component | ||
// instantiation by using the `component.outPorts.add` | ||
// method. | ||
options.outPorts = {}; | ||
@@ -53,2 +68,3 @@ } | ||
if (options.icon) { | ||
// Set the default component icon and description | ||
this.icon = options.icon; | ||
@@ -59,7 +75,12 @@ } | ||
} | ||
// Initially the component is not started | ||
this.started = false; | ||
this.load = 0; | ||
// Whether the component should keep send packets | ||
// out in the order they were received | ||
this.ordered = (ref = options.ordered) != null ? ref : false; | ||
this.autoOrdering = (ref1 = options.autoOrdering) != null ? ref1 : null; | ||
// Queue for handling ordered output packets | ||
this.outputQ = []; | ||
// Context used for bracket forwarding | ||
this.bracketContext = { | ||
@@ -69,3 +90,7 @@ in: {}, | ||
}; | ||
// Whether the component should activate when it | ||
// receives packets | ||
this.activateOnInput = (ref2 = options.activateOnInput) != null ? ref2 : true; | ||
// Bracket forwarding rules. By default we forward | ||
// brackets from `in` port to `out` and `error` ports. | ||
this.forwardBrackets = { | ||
@@ -77,2 +102,5 @@ in: ['out', 'error'] | ||
} | ||
// The component's process function can either be | ||
// passed in options, or given imperatively after | ||
// instantation using the `component.process` method. | ||
if (typeof options.process === 'function') { | ||
@@ -125,8 +153,12 @@ this.process(options.process); | ||
} | ||
// @outPorts[errorPort].disconnect() | ||
throw e; | ||
} | ||
// The setUp method is for component-specific initialization. Called | ||
// at start-up | ||
// ### Setup | ||
// The setUp method is for component-specific initialization. | ||
// Called at network start-up. | ||
// Override in component implementation to do component-specific | ||
// setup work. | ||
setUp(callback) { | ||
@@ -136,4 +168,9 @@ callback(); | ||
// ### Setup | ||
// The tearDown method is for component-specific cleanup. Called | ||
// at shutdown | ||
// at network shutdown | ||
// Override in component implementation to do component-specific | ||
// cleanup work, like clearing any accumulated state. | ||
tearDown(callback) { | ||
@@ -143,2 +180,6 @@ callback(); | ||
// ### Start | ||
// Called when network starts. This sets calls the setUp | ||
// method and sets the component to a started state. | ||
start(callback) { | ||
@@ -158,2 +199,10 @@ if (this.isStarted()) { | ||
// ### Shutdown | ||
// Called when network is shut down. This sets calls the | ||
// tearDown method and sets the component back to a | ||
// non-started state. | ||
// The callback is called when tearDown finishes and | ||
// all active processing contexts have ended. | ||
shutdown(callback) { | ||
@@ -237,2 +286,4 @@ var finalize; | ||
// Method for determining if a component is using the modern | ||
// NoFlo Process API | ||
isLegacy() { | ||
@@ -249,3 +300,3 @@ if (this.handle) { | ||
process(handle) { | ||
var fn, name, port, ref; | ||
var name, port, ref; | ||
if (typeof handle !== 'function') { | ||
@@ -260,13 +311,12 @@ throw new Error("Process handler must be a function"); | ||
ref = this.inPorts.ports; | ||
fn = (name, port) => { | ||
if (!port.name) { | ||
port.name = name; | ||
} | ||
return port.on('ip', (ip) => { | ||
return this.handleIP(ip, port); | ||
}); | ||
}; | ||
for (name in ref) { | ||
port = ref[name]; | ||
fn(name, port); | ||
((name, port) => { | ||
if (!port.name) { | ||
port.name = name; | ||
} | ||
return port.on('ip', (ip) => { | ||
return this.handleIP(ip, port); | ||
}); | ||
})(name, port); | ||
} | ||
@@ -276,2 +326,4 @@ return this; | ||
// Method for checking if a given inport is set up for | ||
// automatic bracket forwarding | ||
isForwardingInport(port) { | ||
@@ -290,2 +342,4 @@ var portName; | ||
// Method for checking if a given outport is set up for | ||
// automatic bracket forwarding | ||
isForwardingOutport(inport, outport) { | ||
@@ -312,2 +366,4 @@ var inportName, outportName; | ||
// Method for checking whether the component sends packets | ||
// in the same order they were received. | ||
isOrdered() { | ||
@@ -323,5 +379,7 @@ if (this.ordered) { | ||
// The component has received an Information Packet. Call the processing function | ||
// so that firing pattern preconditions can be checked and component can do | ||
// processing as needed. | ||
// ### Handling IP objects | ||
// The component has received an Information Packet. Call the | ||
// processing function so that firing pattern preconditions can | ||
// be checked and component can do processing as needed. | ||
handleIP(ip, port) { | ||
@@ -398,2 +456,4 @@ var buf, context, dataPackets, e, input, output, result; | ||
} | ||
// If receiving an IP object didn't cause the component to | ||
// activate, log that input conditions were not met | ||
if (port.isAddressable()) { | ||
@@ -406,2 +466,3 @@ debug(`${this.nodeId} packet on '${port.name}[${ip.index}]' didn't match preconditions: ${ip.type}`); | ||
// Get the current bracket forwarding context for an IP object | ||
getBracketContext(type, port, scope, idx) { | ||
@@ -427,2 +488,4 @@ var index, name, portsList; | ||
// Add an IP object to the list of results to be sent in | ||
// order | ||
addToResult(result, port, ip, before = false) { | ||
@@ -450,2 +513,4 @@ var idx, index, method, name; | ||
// Get contexts that can be forwarded with this in/outport | ||
// pair. | ||
getForwardableContexts(inport, outport, contexts) { | ||
@@ -478,2 +543,3 @@ var forwardable, index, name; | ||
// Add any bracket forwards needed to the result queue | ||
addBracketForwards(result) { | ||
@@ -601,2 +667,4 @@ var context, i, ipClone, j, k, l, len1, len2, len3, len4, port, ref, ref1, ref2, ref3, ref4, ref5; | ||
// Whenever an execution context finishes, send all resolved | ||
// output from the queue in the order it is in. | ||
processOutputQueue() { | ||
@@ -674,2 +742,4 @@ var idx, idxIps, ip, ips, port, portIdentifier, result, results; | ||
// Signal that component has activated. There may be multiple | ||
// activated contexts at the same time | ||
activate(context) { | ||
@@ -688,2 +758,4 @@ if (context.activated) { // prevent double activation | ||
// Signal that component has deactivated. There may be multiple | ||
// activated contexts at the same time | ||
deactivate(context) { | ||
@@ -710,6 +782,4 @@ if (context.deactivated) { // prevent double deactivation | ||
})(); | ||
}).call(this); | ||
exports.Component = Component; | ||
ProcessContext = class ProcessContext { | ||
@@ -964,5 +1034,5 @@ constructor(ip1, nodeInstance, port1, result1) { | ||
} | ||
// Forwarding brackets that came before data packet need to manipulate context | ||
// and be added to result so they can be forwarded correctly to ports that | ||
// need them | ||
// Forwarding brackets that came before data packet need to manipulate context | ||
// and be added to result so they can be forwarded correctly to ports that | ||
// need them | ||
for (i = 0, len1 = prefix.length; i < len1; i++) { | ||
@@ -1282,1 +1352,3 @@ ip = prefix[i]; | ||
}; | ||
exports.Component = Component; |
@@ -5,8 +5,4 @@ // NoFlo - Flow-Based Programming for JavaScript | ||
// NoFlo may be freely distributed under the MIT license | ||
var ComponentLoader, EventEmitter, fbpGraph, platform, registerLoader; | ||
// This is the browser version of the ComponentLoader. | ||
var ComponentLoader, EventEmitter, fbpGraph, internalSocket, platform, registerLoader; | ||
internalSocket = require('./InternalSocket'); | ||
fbpGraph = require('fbp-graph'); | ||
@@ -20,2 +16,15 @@ | ||
// ## The NoFlo Component Loader | ||
// The Component Loader is responsible for discovering components | ||
// available in the running system, as well as for instantiating | ||
// them. | ||
// Internally the loader uses a registered, platform-specific | ||
// loader. NoFlo ships with a loader for Node.js that discovers | ||
// components from the current project's `components/` and | ||
// `graphs/` folders, as well as those folders of any installed | ||
// NPM dependencies. For browsers and embedded devices it is | ||
// possible to generate a statically configured component | ||
// loader using the [noflo-component-loader](https://github.com/noflo/noflo-component-loader) webpack plugin. | ||
ComponentLoader = class ComponentLoader extends EventEmitter { | ||
@@ -30,7 +39,15 @@ constructor(baseDir, options = {}) { | ||
this.ready = false; | ||
if (typeof this.setMaxListeners === 'function') { | ||
this.setMaxListeners(0); | ||
} | ||
this.setMaxListeners(0); | ||
} | ||
// Get the library prefix for a given module name. This | ||
// is mostly used for generating valid names for namespaced | ||
// NPM modules, as well as for convenience renaming all | ||
// `noflo-` prefixed modules with just their base name. | ||
// Examples: | ||
// * `my-project` becomes `my-project` | ||
// * `@foo/my-project` becomes `my-project` | ||
// * `noflo-core` becomes `core` | ||
getModulePrefix(name) { | ||
@@ -46,5 +63,6 @@ if (!name) { | ||
} | ||
return name.replace('noflo-', ''); | ||
return name.replace(/^noflo-/, ''); | ||
} | ||
// Get the list of all available components | ||
listComponents(callback) { | ||
@@ -79,2 +97,6 @@ if (this.processing) { | ||
// Load an instance of a specific component. If the | ||
// registered component is a JSON or FBP graph, it will | ||
// be loaded as an instance of the NoFlo subgraph | ||
// component. | ||
load(name, callback, metadata) { | ||
@@ -93,3 +115,3 @@ var component, componentName; | ||
if (!component) { | ||
// Try an alias | ||
// Try an alias | ||
for (componentName in this.components) { | ||
@@ -180,2 +202,3 @@ if (componentName.split('/')[1] === name) { | ||
// Check if a given filesystem path is actually a graph | ||
isGraph(cPath) { | ||
@@ -197,9 +220,8 @@ if (typeof cPath === 'object' && cPath instanceof fbpGraph.Graph) { | ||
// Load a graph as a NoFlo subgraph component instance | ||
loadGraph(name, component, callback, metadata) { | ||
this.createComponent(name, this.components['Graph'], metadata, (err, graph) => { | ||
var graphSocket; | ||
if (err) { | ||
return callback(err); | ||
} | ||
graphSocket = internalSocket.createSocket(); | ||
graph.loader = this; | ||
@@ -218,2 +240,7 @@ graph.baseDir = this.baseDir; | ||
// Set icon for the component instance. If the instance | ||
// has an icon set, then this is a no-op. Otherwise we | ||
// determine an icon based on the module it is coming | ||
// from, or use a fallback icon separately for subgraphs | ||
// and elementary components. | ||
setIcon(name, instance) { | ||
@@ -260,2 +287,10 @@ var componentName, library; | ||
// ### Registering components at runtime | ||
// In addition to components discovered by the loader, | ||
// it is possible to register components at runtime. | ||
// With the `registerComponent` method you can register | ||
// a NoFlo Component constructor or factory method | ||
// as a component available for loading. | ||
registerComponent(packageId, name, cPath, callback) { | ||
@@ -270,2 +305,4 @@ var fullName; | ||
// With the `registerGraph` method you can register new | ||
// graphs as loadable components. | ||
registerGraph(packageId, name, gPath, callback) { | ||
@@ -275,2 +312,5 @@ return this.registerComponent(packageId, name, gPath, callback); | ||
// With `registerLoader` you can register custom component | ||
// loaders. They will be called immediately and can register | ||
// any components or graphs they wish. | ||
registerLoader(loader, callback) { | ||
@@ -280,2 +320,7 @@ return loader(this, callback); | ||
// With `setSource` you can register a component by providing | ||
// a source code string. Supported languages and techniques | ||
// depend on the runtime environment, for example CoffeeScript | ||
// components can only be registered via `setSource` if | ||
// the environment has a CoffeeScript compiler loaded. | ||
setSource(packageId, name, source, language, callback) { | ||
@@ -297,2 +342,4 @@ if (!registerLoader.setSource) { | ||
// `getSource` allows fetching the source code of a registered | ||
// component as a string. | ||
getSource(name, callback) { | ||
@@ -299,0 +346,0 @@ if (!registerLoader.getSource) { |
@@ -17,2 +17,7 @@ // NoFlo - Flow-Based Programming for JavaScript | ||
// ## NoFlo WirePattern helper | ||
// **Note:** WirePattern is no longer the recommended way to build | ||
// NoFlo components. Please use [Process API](https://noflojs.org/documentation/components/) instead. | ||
// WirePattern makes your component collect data from several inports | ||
@@ -19,0 +24,0 @@ // and activates a handler `proc` only when a tuple from all of these |
// NoFlo - Flow-Based Programming for JavaScript | ||
// (c) 2014-2017 Flowhub UG | ||
// NoFlo may be freely distributed under the MIT license | ||
var BasePort, IP, InPort; | ||
// Input Port (inport) implementation for NoFlo components | ||
var BasePort, IP, InPort, platform; | ||
BasePort = require('./BasePort'); | ||
@@ -12,4 +10,6 @@ | ||
platform = require('./Platform'); | ||
// ## NoFlo inport | ||
// Input Port (inport) implementation for NoFlo components. These | ||
// ports are the way a component receives Information Packets. | ||
InPort = class InPort extends BasePort { | ||
@@ -28,7 +28,5 @@ constructor(options = {}) { | ||
throw new Error('InPort process callback is deprecated. Please use Process API'); | ||
delete options.process; | ||
} | ||
if (options.handle) { | ||
throw new Error('InPort handle callback is deprecated. Please use Process API'); | ||
delete options.handle; | ||
} | ||
@@ -35,0 +33,0 @@ super(options); |
// NoFlo - Flow-Based Programming for JavaScript | ||
// (c) 2016-2017 Flowhub UG | ||
// NoFlo may be freely distributed under the MIT license | ||
// ## Information Packets | ||
// IP objects are the way information is transmitted between | ||
// components running in a NoFlo network. IP objects contain | ||
// a `type` that defines whether they're regular `data` IPs | ||
// or whether they are the beginning or end of a stream | ||
// (`openBracket`, `closeBracket`). | ||
// The component currently holding an IP object is identified | ||
// with the `owner` key. | ||
// By default, IP objects may be sent to multiple components. | ||
// If they're set to be clonable, each component will receive | ||
// its own clone of the IP. This should be enabled for any | ||
// IP object working with data that is safe to clone. | ||
// It is also possible to carry metadata with an IP object. | ||
// For example, the `datatype` and `schema` of the sending | ||
// port is transmitted with the IP object. | ||
var IP; | ||
@@ -80,2 +100,2 @@ | ||
})(); | ||
}).call(this); |
@@ -85,5 +85,3 @@ var CoffeeScript, dynamicLoader, fbpGraph, fs, manifest, manifestLoader, path, registerModules, registerSubgraph, utils; | ||
options.recursive = typeof loader.options.recursive === 'undefined' ? true : loader.options.recursive; | ||
if (!options.manifest) { | ||
options.manifest = 'fbp.json'; | ||
} | ||
options.manifest = loader.options.manifest || 'fbp.json'; | ||
return options; | ||
@@ -231,3 +229,3 @@ }, | ||
if (!component) { | ||
// Try an alias | ||
// Try an alias | ||
for (componentName in loader.components) { | ||
@@ -234,0 +232,0 @@ if (componentName.split('/')[1] === name) { |
@@ -611,5 +611,3 @@ // NoFlo - Flow-Based Programming for JavaScript | ||
if (!process.component.isReady()) { | ||
if (process.component.setMaxListeners) { | ||
process.component.setMaxListeners(0); | ||
} | ||
process.component.setMaxListeners(0); | ||
process.component.once("ready", () => { | ||
@@ -624,5 +622,3 @@ return this.addDefaults(process, callback); | ||
// Attach a socket to any defaulted inPorts as long as they aren't already attached. | ||
// TODO: hasDefault existence check is for backwards compatibility, clean | ||
// up when legacy ports are removed. | ||
if (typeof port.hasDefault === 'function' && port.hasDefault() && !port.isAttached()) { | ||
if (port.hasDefault() && !port.isAttached()) { | ||
socket = internalSocket.createSocket(); | ||
@@ -654,5 +650,3 @@ socket.setDebug(this.debug); | ||
if (!(to.component.isReady() || to.component.inPorts[initializer.to.port])) { | ||
if (to.component.setMaxListeners) { | ||
to.component.setMaxListeners(0); | ||
} | ||
to.component.setMaxListeners(0); | ||
to.component.once("ready", () => { | ||
@@ -1030,4 +1024,4 @@ return this.addInitial(initializer, callback); | ||
})(); | ||
}).call(this); | ||
exports.Network = Network; |
// NoFlo - Flow-Based Programming for JavaScript | ||
// (c) 2013-2017 Flowhub UG | ||
// (c) 2013-2018 Flowhub UG | ||
// (c) 2011-2012 Henri Bergius, Nemein | ||
@@ -210,1 +210,14 @@ // NoFlo may be freely distributed under the MIT license | ||
exports.asCallback = require('./AsCallback').asCallback; | ||
// ## Generating components from JavaScript functions | ||
// The `asComponent` helper makes it easy to expose a JavaScript function as a | ||
// NoFlo component. All input arguments become input ports, and the function's | ||
// result will be sent to either `out` or `error` port. | ||
// exports.getComponent = function () { | ||
// return noflo.asComponent(Math.random, { | ||
// description: 'Generate a random number', | ||
// }); | ||
// }; | ||
exports.asComponent = require('./AsComponent').asComponent; |
// NoFlo - Flow-Based Programming for JavaScript | ||
// (c) 2014-2017 Flowhub UG | ||
// NoFlo may be freely distributed under the MIT license | ||
// Output Port (outport) implementation for NoFlo components | ||
var BasePort, IP, OutPort; | ||
@@ -12,2 +10,6 @@ | ||
// ## NoFlo outport | ||
// Outport Port (outport) implementation for NoFlo components. | ||
// These ports are the way a component sends Information Packets. | ||
OutPort = class OutPort extends BasePort { | ||
@@ -14,0 +16,0 @@ constructor(options = {}) { |
// NoFlo - Flow-Based Programming for JavaScript | ||
// (c) 2014-2017 Flowhub UG | ||
// NoFlo may be freely distributed under the MIT license | ||
// Ports collection classes for NoFlo components | ||
var EventEmitter, InPort, InPorts, OutPort, OutPorts, Ports; | ||
@@ -15,2 +13,6 @@ | ||
Ports = (function() { | ||
// NoFlo ports collections | ||
// Ports collection classes for NoFlo components. These are | ||
// used to hold a set of input or output ports of a component. | ||
class Ports extends EventEmitter { | ||
@@ -67,3 +69,3 @@ constructor(ports) { | ||
})(); | ||
}).call(this); | ||
@@ -130,3 +132,3 @@ exports.InPorts = InPorts = class InPorts extends Ports { | ||
})(); | ||
}).call(this); | ||
@@ -133,0 +135,0 @@ // Port name normalization: |
@@ -11,3 +11,3 @@ { | ||
"author": "Henri Bergius <henri.bergius@iki.fi>", | ||
"version": "1.0.3", | ||
"version": "1.1.0", | ||
"license": "MIT", | ||
@@ -18,7 +18,8 @@ "engines": { | ||
"dependencies": { | ||
"coffeescript": "^2.0.0", | ||
"coffeescript": "^2.2.1", | ||
"debug": "^3.0.0", | ||
"fbp": "^1.5.0", | ||
"fbp-graph": "^0.3.1", | ||
"fbp-manifest": "^0.2.0" | ||
"fbp-manifest": "^0.2.0", | ||
"get-function-params": "^2.0.3" | ||
}, | ||
@@ -30,3 +31,3 @@ "devDependencies": { | ||
"chai": "^4.0.0", | ||
"coffee-coverage": "^2.0.1", | ||
"coffee-coverage": "^3.0.0", | ||
"coveralls": "^3.0.0", | ||
@@ -42,3 +43,3 @@ "grunt": "^1.0.1", | ||
"grunt-noflo-browser": "^1.5.2", | ||
"mocha": "^4.0.0", | ||
"mocha": "^5.0.0", | ||
"nyc": "^11.2.1" | ||
@@ -45,0 +46,0 @@ }, |
@@ -42,2 +42,4 @@ NoFlo: Flow-based programming for JavaScript [![Build Status](https://secure.travis-ci.org/noflo/noflo.png?branch=master)](http://travis-ci.org/noflo/noflo) [![Build status](https://ci.appveyor.com/api/projects/status/k4jbqlpohq81pvny/branch/master)](https://ci.appveyor.com/project/bergie/noflo/branch/master) [![Coverage Status](https://coveralls.io/repos/github/noflo/noflo/badge.svg?branch=master)](https://coveralls.io/github/noflo/noflo?branch=master) | ||
By [subscribing to Flowhub](https://plans.flowhub.io) you directly support NoFlo development, and help us all get to the future of programming faster. | ||
## Requirements and installing | ||
@@ -44,0 +46,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
689985
79
5887
121
6
+ Addedget-function-params@^2.0.3
+ Addedget-function-params@2.0.7(transitive)
Updatedcoffeescript@^2.2.1