@chix/flow
Version:
204 lines (203 loc) • 4.16 kB
YAML
_id: 526de934cad1214984832006
title: 'Flow with actions'
description: ""
keywords: []
env: server
type: flow
actions:
readFileWaitLog:
title: readFileWaitLog
description: ""
nodes:
- node1
- node2
- node3
links:
-
id: 529beed48131110000efa941
source:
id: node1
port: data
target:
id: node2
port: in
settings: { }
-
id: 529beede8131110000efa942
source:
id: node2
port: out
target:
id: node3
port: msg
-
id: 529bef018131110000efa945
source:
id: node1
port: data
target:
id: node4
port: in
-
id: 529bef098131110000efa946
source:
id: node4
port: out
target:
id: node3
port: msg
-
id: 529bef428131110000efa948
source:
id: node1
port: error
target:
id: node5
port: msg
-
id: 529bef748131110000efa949
source:
id: node4
port: out
target:
id: node5
port: msg
nodes:
-
id: node1
ns: fs
name: readFile
context:
filename: /etc/passwd
encoding: utf-8
flag: r
-
id: node2
ns: util
name: wait
context:
timeout: 0
ports:
output:
out:
expose: true
-
id: node3
ns: console
name: log
context: { }
-
id: node4
ns: util
name: wait
context:
timeout: 0
-
id: node5
ns: console
name: log
context: { }
nodeDefinitions:
fs:
stat:
_id: 526dd2e4744e31bb6f000033
description: 'fs stat'
env: server
fn: "output = [fs, 'stat', input.path]\n"
name: stat
ns: fs
phrases:
active: 'Reading stats for {{input.path}}'
ports:
input:
path:
title: Path
type: string
required: true
output:
error:
title: Error
type: object
stats:
title: Stats
type: object
dependencies:
npm:
fs: latest
readFile:
_id: 526dd2e4744e31bb6f00002d
description: 'fs readFile'
env: server
fn: "output = [fs, 'readFile', input.filename, { encoding: input.encoding, mode: input.mode, flag: input.flag }]\n"
name: readFile
ns: fs
phrases:
active: 'Reading file {{input.filename}} ({{input.encoding}}, {{input.flag}})'
ports:
input:
filename:
title: Filename
type: string
required: true
encoding:
title: Encoding
type: string
flag:
title: Flag
type: string
default: r
output:
error:
type: object
data:
type: object
dependencies:
npm:
fs: latest
title: 'fs readFile'
console:
log:
_id: 526dd2e4744e31bb6f000017
description: 'Console log'
fn: ""
name: log
ns: console
phrases:
active: 'Logging to console'
ports:
input:
msg:
type: any
title: 'Log message'
description: 'Logs a message to the console'
required: true
output: { }
util:
wait:
_id: 527330c6cad121498483204c
description: 'Holds the input for a while'
expose:
- setTimeout
fn: "var slow = {\n down: function(to, cb) {\n setTimeout(function () { cb($.in); }, to)\n }\n}\noutput = [slow, 'down', $.timeout]\n"
name: wait
ns: util
phrases:
active: 'Holding input for {{input.timeout}} milliseconds.'
ports:
input:
in:
type: any
title: Input
description: 'Input to be delayed'
readonly: true
required: true
timeout:
type: number
title: Timeout
description: 'Timeout in milliseconds'
format: time
output:
out:
type: any
title: Output
description: 'Outputs the delayed input'