Changelog
0.5.5 (June 20th 2014)
StreamSender
affecting WirePattern components dealing with multiple levels of groupingCustomizeError
helper for passing information with Error objects in NoFlo. For example:err = new Error 'Something went wrong'
# Add metadata to it. Usually this should include groups and other machine-readable information
noflo.helpers.CustomizeError err,
groups: groups
foo: 'bar'
# Send it to error port
c.error err
Changelog
0.5.4 (June 11th 2014)
GroupedInput
helper has been renamed to WirePattern
due to a bigger collection of synchronization options.WirePattern
helper has a new ordered
option for choosing whether the output should be in same order as the incoming packetsgroup
and forwardGroups
of WirePattern
are made independent, so make sure to use forwardGroups: true
if you need this feature together with group: true
.WirePattern
.load
outport handing in WirePattern
to make it a complete replacement for AsyncComponent
.caching
option for OutPorts that makes them re-send their latest value to any newly-added connections, see #151 for example use cases.Changelog
0.5.3 (May 31st 2014)
integer
is accepted as an alias for the int
datatype for portsbuffer
is now an accepted port datatypegetSource
method when invoked early on in executionThe MapComponent
helper is usable for synchronous components that operate on a single inport-outport combination:
c = new noflo.Component
inPorts:
in:
datatype: 'number'
outPorts:
out:
datatype: 'number'
noflo.helpers.MapComponent c, (data, groups, out) ->
out.send data * 2
The GroupedInput
helper assists in building components that need to synchronize multiple inputs by groups:
c = new noflo.Component
inPorts:
x:
datatype: 'number'
y:
datatype: 'number'
outPorts:
radius:
datatype: 'number'
noflo.helpers.GroupedInput c,
in: ['x', 'y']
out: 'radius'
, (data, groups, out) ->
out.send Math.sqrt(data.x**2 + data.y**2)
GroupedInput
can also synchronize via specific fields of object-type packets:
helpers.GroupedInput c,
in: ['user', 'message']
out: 'signedMessage'
field: 'request'
, (data, groups, out) ->
out.send
request: data.request
user: data.user.name
text: data.message.text
user.send {request: 123, id: 42, name: 'John'}
message.send {request: 123, id: 17, text: 'Hello world'}
# Result:
{ request: 123, user: 'John', text: 'Hello world'}
Changelog
0.5.1 (May 8th 2014)
registerLoader
method of NoFlo's ComponentLoadercontains
method for buffered inports returns the number of data packets the buffer haserror
outport of AsyncComponents now sends the group information of the original input together with the errorerror
method of regular ports can now also handle groups as a second parameterlistAttached
methodfunction
is now an accepted datatype for portsIn the FBP format, these can be specified with the bracket syntax:
SomeNode OUT[2] -> IN OtherNode
'foo' -> OPTS[1] OtherNode
In the JSON file these are defined in connections by adding a integer to the index
key of the src
or tgt
definition.
The NoFlo Graph class provides these with the following methods:
addEdgeIndex(str outNode, str outPort, int outIndex, str inNode, str inPort, int inIndex, obj metadata)
addInitiaIndex(mixed data, str inNode, str inPort, int inIndex, obj metadata)
If indexes are not specified, the fall-back behavior is to automatically index the connections based on next available slot in the port.
Changelog
0.5.0 (March 28th 2014)
baseDir
of Node.js NoFlo environment with NOFLO_PROJECT_ROOT
env var (defaults to current working directory)getComponent
functionsetProperties
setInportMetadata
setOutportMetadata
setGroupMetadata
setNodeMetadata
setEdgeMetadata
addExport
, removeExport
, and renameExport
eventsstartTransaction
endTransaction
undo
and redo
inports
and outports
arrays to reduce ambiguityWith the new API component ports can be declared with:
@inPorts = new noflo.InPorts
@inPorts.add 'in', new noflo.InPort
datatype: 'object'
type: 'http://schema.org/Person'
description: 'Persons to be processed'
required: true
buffered: true
The noflo.Ports
objects emit add
and remove
events when ports change. They also support passing port information as options:
@outPorts = new noflo.OutPorts
out: new noflo.OutPort
datatype: 'object'
type: 'http://schema.org/Person'
description: 'Processed person objects'
required: true
addressable: true
The input ports also allow passing in an optional processing function that gets called on information packets events.
var noflo = require('noflo');
exports.getComponent = function() {
var c = new noflo.Component();
c.inPorts.add('in', function(event, payload) {
if (packet.event !== 'data')
return;
// Do something with the packet, then
c.outPorts.out.send(packet.data);
});
c.outPorts.add('out');
return c;
};
setSource
and getSource
methodsChangelog
0.4.3 (December 6th 2013)
true
for isAttached
checks. There is a separate canAttach
method for checking whether more can be addednoflo.icon
key in your package.json
(Node.js libraries) or component.json
(browser libraries)icon
attributeshutdown
methodloadGraph
methodnoflo.loader
key in the manifest pointing to a CommonJS moduleerror
helper method for sending errors to the error
outport, or throwing them if that isn't attached