flowbased / fbp-protocol Goto Github PK
View Code? Open in Web Editor NEWTests, schemas, and specifications for the Flow Based Programming Network Protocol
Home Page: https://flowbased.github.io/fbp-protocol/
License: MIT License
Tests, schemas, and specifications for the Flow Based Programming Network Protocol
Home Page: https://flowbased.github.io/fbp-protocol/
License: MIT License
Now noflo-ui uses a per-runtime-type hard-coded list of languages. However, in some cases this may depend on the installation. For example:
So, runtime:runtime
message could return an array of supported languages.
Needed for noflo/noflo-ui#206
https://www.asyncapi.com is a standard for making messaging specs. Would provide nicer tooling around the FBP Protocol.
program.command
is a method name in commander.js
fbp-init --name chix-runtime --collection test
Stored the following configuration to /home/ubuntu/workspace/fbp-config.json
name: chix-runtime
command: function (name, desc) {
var args = name.split(/ +/);
var cmd = new Command(args.shift());
if (desc) {
cmd.description(desc);
this.executables = true;
this._execs[cmd._name] = true;
}
this.commands.push(cmd);
cmd.parseExpectedArgs(args);
cmd.parent = this;
if (desc) return this;
return cmd;
}
host: localhost
port: 8080
collection: test
To test, run `fbp-test` from this directory
Easiest fix will be to change the name for the --command
option.
run
or exec
maybe?
or else use a different cli tool.
update:
I guess command could still be used, just beware if no command option is passed the value will not be empty.
Hi,
it would be great if I could add my own metadata to a component and to each port.
This would be useful if for instance I want to choose a graphical representation of the data carried in a component in the UI.
Example:
.... description:"...",
metadata: '{ "viewer":"griddata", .... }
The UI would do a component:list over the fbp protocol, get this metadata 'viewer' and draw a UI element which shows the components/processes data in a 2d grid.
The metadata should carry a JSON string which can be set completely free by the user.
At the moment I put a JSON string with metadata in the description field. But this is only a temporary solution.
Is this possible ?
Thanks,
Josef
I think this would be much more clear. Any reason not to?
Now the generated HTML contains mixed up input/output messages with duplicated keys, and some properties missing
Every other message in the network protocol contains graph information, allowing one runtime to have multiple networks/graphs.
I think such messages should optionally also include "node", which should be a valid node identifier in "graph".
Migrated from noflo/noflo#164
Hi,
I think we need a command which lists all graphs which are set up in the runtime.
This will be needed for a UI which connects to the runtime through the fbp protocol. It doesn't know anything about formerly dynamically created graphs in the beginning.
The command graph:list should return an array of strings with the names of the graphs (ids?).
This should be pretty easy to implement.
Best regards,
Josef
Currently https://flowbased.github.io/fbp-protocol/ looks a bit basic...
Branch | Build failing 🚨 |
---|---|
Dependency | semver |
Current Version | 5.4.1 |
Type | dependency |
This version is covered by your current version range and after updating it in your project the build failed.
semver is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.
The new version differs by 7 commits.
44cbc84
v5.5.0
1d37529
Cleaned up coerce behavior
e7092b4
Improved coerce regex and added coerce to README.
68cef2d
Added version coercion to the module and CLI.
ec6f97a
range.bnf: Fix invalid bracket expression
906b664
travis: don't cache node_modules
7184ff4
range.bnf: Remove unnecessary empty entry
See the full diff
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
Currently "values" on "inport" of component:component message just takes an array of values. I think it instead should take an array of { "id": "my-id", "name": "MyHumanId" }.
The "id" would be what is stored as an IIP, and "name" what is shown in UI. id could potentially be an integer value.
This is also more extensible in case there are other things we have not thought about.
Migrated from noflo/noflo#173
As a user of a UI that is compatible with fbp-protocol such as noflo-ui, I want UI widgets with finer grained controls to make my life easier.
I propose that we expand the definition of our port types to allow json schema documents so that developers can use this to provide a better UX for users.
We currently support enums and defaults.
For starters, I would like to add things like:
[<input>]
MB)As well as the ability to reinterpret a base datatype with a more specific widget. For example:
Here is an example sub-document for an integer port:
{
"id": "input_size",
"required": true,
"addressable": true,
"type":
{
"$schema": "http://json-schema.org/schema#",
"title": "input size",
"description": "input size in megabytes",
"type": "integer",
"default": 10,
"minimum": 0,
"maximum": 100000,
"softMaximum": 1000,
"labelSuffix": "MB"
}
}
Notes:
Other advantages:
object
type, but unfortunately, since the UI knows nothing of an object's schema, it can't provide a proper UI or validation. With json-schema, runtimes can provide more information for these compound types and noflo-ui can build appropriate UIs.Related issues:
To get out of this, we should make the schemas the canonical single-source-of-truth for all protocol description. Currently this information is in https://github.com/noflo/noflo.github.io/blob/master/documentation/_posts/2013-07-09-protocol.md
The human-readable documentation page should be generated from the JSON schemas
If we can use graphs as components we should be able to specify an icon and description for when the graph is displayed in the component library of noflo-ui or anywhere else component description is used.
I've been digging around in the code to try and implement this but can't find the right hooks to add this functionality. If anyone could give me some pointers I'd be glad to implement this myself and send a pull request.
Migrated from noflo/noflo#196
When thinking about the ability for one graph to load another graph within it (i.e. subgraphs), it seems to me that the storage of such graphs can take 3 forms:
#1
, these are the product of a graph editor (stored as .json or .fbp), rather than code. it may or may not be editable from the parent graph editor, depending on the abilities of the UIfbp-protocol already supports #1
(in reality it requires no additional support as these subgraphs can simply be treated as components). This ticket is for #3
. EDIT: and #2
Below is a bare-bones example of a command sequence that creates a graph within a graph:
protocol: graph
command: clear
payload:
id: myGraph
---
protocol: graph
command: addnode
payload:
id: myNode
graph: myGraph
---
protocol: graph
command: clear
payload:
id: mySubGraph
parent: myGraph
---
protocol: graph
command: addnode
payload:
id: mySubNode
graph: myGraph/mySubGraph
---
protocol: graph
command: addinport
payload:
public: IN
node: mySubNode
port: IN
graph: myGraph/mySubGraph
This adds 2 new concepts:
graph
attribute using /
, as in parentGraph/childGraph
graph clear
gets an optional parent
attributeI chose to add the parent
attribute because I wanted this action to be explicit. An alternative would be to use the parent/child
notation for the graph clear
, like this:
protocol: graph
command: clear
payload:
id: myGraph/mySubGraph
I'm open to suggestions and opinions.
fbp-spec exercises the FBP protocol implementation of a runtime quite a lot, and is generally useful, so we could include it here.
A testcase for core/Repeat (like
https://github.com/flowbased/fbp-spec/blob/master/examples/simple-passing.yaml)
but covering all JSON types would be a really good start.
It can be trivally integrated with Mocha like this https://github.com/flowbased/fbp-spec/blob/master/spec/mocha.coffee
Running "exec:fbp_test" (exec) task
>> '.' is not recognized as an internal or external command,
>> operable program or batch file.
https://ci.appveyor.com/project/bergie/noflo-runtime-websocket/build/1.0.165#L146
It is not neccearily that the programming language/format of tests are the same as the code
(for which we have language
key). This makes it impossible to know if tests are for instance fbp-spec YAML/JSON, JavaScript, C - and to validate the contents.
So should have a sepate key for testslanguage
(or some other name).
Currently secrets are transmitted in message payload. We should instead shape the message so that we have something like:
{
"protocol": "graph",
"command": "clear",
"payload": {...},
"secret": "xx"
}
Likely we have discrepancies right now as nothing has really checked compliance before.
Clients/tools
Runtimes (only listing known maintained ones)
On the client-side, like noflo-ui / fbp-spec etc, I think that flowbased/fbp-protocol-client#50 is the way to go. This will also give some tools for checking that the various runtimes are doing OK, and maybe provide some debugging help if things behave wierdly
Hi!
I'm trying to implement the FBP protocol by using fbp-test
and implementing the required commands one by one.
What I have now is this:
--> {"protocol":"runtime","command":"getruntime","payload":{}}
<-- {"protocol":"runtime","command":"runtime","payload":{"id":"30a1eb22-a999-11ea-a909-93c8afee90c7","label":"deno-fbp","version":"0.1","type":"deno-fbp","capabilities":["network:control","network:data","network:persist","network:status","protocol:component","protocol:graph","protocol:network","protocol:runtime"]}}
--> {"protocol":"graph","command":"clear","payload":{"baseDir":"/home/tom/Code/code9/deno-fbp/test/node_modules/fbp-protocol","id":"foo","main":true,"name":"Foo graph"}}
<-- {"protocol":"graph","command":"clear","payload":{"id":"foo","main":false}}
--> {"protocol":"graph","command":"addedge","payload":{"src":{"node":"Repeat1","port":"out"},"tgt":{"node":"Drop1","port":"in"},"metadata":{"route":5},"graph":"foo"}}
graph.addEdge
graph.addEdge:graph {
id: "foo",
nodes: {},
edges: {},
initial: {},
components: [],
status: { running: false, started: false, debugging: false, startTime: null }
}
TypeError: Cannot read properties of undefined (reading 'ports')
at addEdge (file:///home/tom/Code/code9/deno-fbp/src/domain/graph.ts:156:33)
at addedge (file:///home/tom/Code/code9/deno-fbp/src/runtime/protocols/graph.ts:174:39)
at WebSocketAcceptedClient.<anonymous> (file:///home/tom/Code/code9/deno-fbp/src/runtime/runtime.ts:51:35)
at WebSocketAcceptedClient.emit (https://deno.land/[email protected]/node/events.ts:134:20)
at WebSocketAcceptedClient.open (https://deno.land/x/[email protected]/lib/websocket.ts:92:16)
As you can see graph/addedge
is sent to the server but the graph has 0 nodes at this point.
fbp-test
send two graph/addnode
events first, before connecting them? When connecting Repeat1:out
to in:Drop1
I do not know which components the nodes are so I can not create the nodes when the graph/addedge
event happens.Looking through the schema files I realized that these are quite a few problems and shortcomings with the current schema files:
The schema files actually contain many schemas: one for each message type under "output" and "input". While it might make it easier to edit and read, there seems to be some expectation in the json-schema spec and community that there is only one schema per document. For example, each schema doc is expected to have an "id" attribute specifying where the file can be downloaded on the web. more here. One-file-per-schema also makes it easier when working with command-line tools which seem to have this expectation.
we can improve the schemas by using the $ref
keyword to avoid duplication. Note that this can be used to refer to other objects in the same doc { "$ref": "#/definitions/address" }
or in another doc { "$ref": "definitions.json#/address" }
.
no $schema
keyword: it's good form to indicate what version of the draft is being used
many required properties are not indicated as such (there are none in component.json). easy enough to cross reference properties with "optional" in their description.
the "required" keyword must be a list of properties and can only exist for compound schemas. e.g. this is bad:
"changenode": {
"description": "Change the metadata associated to a node in the graph",
"properties": {
"id": {
"type": "string",
"description": "identifier for the node",
"required": true
},
"metadata": {
"type": "object",
"description": "structure of key-value pairs for node metadata",
"required": true
},
"graph": {
"type": "string",
"description": "graph the action targets",
"required": true
}
}
}
this is good:
"changenode": {
"description": "Change the metadata associated to a node in the graph",
"properties": {
"id": {
"type": "string",
"description": "identifier for the node",
},
"metadata": {
"type": "object",
"description": "structure of key-value pairs for node metadata",
},
"graph": {
"type": "string",
"description": "graph the action targets",
}
},
"required": ["id", "metadata", "graph"]
}
nested schemas don't indicate "type": "object"
. it's implicit, but should probably be there.
"outPorts" and "inPorts" should indicate that they are an array of objects
by default, extra keywords in the document are allowed. I think we should set "additionalProperties": false
for all schemas to prevent typos from slipping through without error.
I tried using one of our schemas for validation (after extracting it from its parent doc) and got an error ("schema/json/component.json#/properties/name: true is not a valid "required", must be a array."), so I think technically our schemas are not valid as they are. we should definitely be running validation of our schema files in the tests for this repo
This ticket should be done in conjunction with converting fbp-test
to use the schemas.
Some resources for learning more about json-schema:
The tests validate two aspects of messages sent from the runtime: their structure and their values. We should replace all the structural tests with validation against the schema files. This looks to be the most popular json-schema validator for node: https://www.npmjs.com/package/jsonschema
Requires #13
To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:
.travis.yml
If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.
Greenkeeper has checked the engines
key in any package.json
file, the .nvmrc
file, and the .travis.yml
file, if present.
engines
was only updated if it defined a single version, not a range..nvmrc
was updated to Node.js 10.travis.yml
was only changed if there was a root-level node_js
that didn’t already include Node.js 10, such as node
or lts/*
. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.For many simpler .travis.yml
configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
In many places e.g.
https://github.com/noflo/noflo-runtime-base/blob/master/src/protocol/Runtime.coffee#L44-51
I see component:setsource, but it is missing in https://github.com/flowbased/fbp-protocol/blob/master/schema/json/component.json
It is not clear, by reading the FBP protocol, what is required that runtimes send to clients in the Graph Protocol.
For example, by reading the spec, I understood that the runtime is expected to react to a removenode
with a succession of changeedge
, removeedge
, changenode
and finally removenode
. What is the rationale behind deleting the metadata of an edge before removing it? I believe noflo-ui takes care of deleting dependent edges/IIPs before removing a node; why is that not expected of every client, requiring the runtime to handle only simple cases? Or assume the runtime takes care of all dependent resources in a removenode
, requiring it to reply with a single removenode
?
I was also confused with the response to changing the metadata of edges or nodes.
I noticed another related issue, a bit more severe: when "removing an IIP", the spec indicates the runtime "should provide response that iip was removed". The message it expects is a removeinitial
command but contains a src
field, which is not accepted in removeinitial
messages.
The rationale behind the requests and responses/events should be clarified in the spec, so people implementing runtimes have a clear idea of how to handle those cases. My personal opinion is that request message types should not be used also as "notification event" message types, as the contents differ in some cases and drawing that line that would result in a clearer protocol. However, anything that is defined a bit more formally would be great for me! :)
One of the most confusing aspects of the protocol description is that it does not clearly specify which messages are requests, and if so, what type of message should be sent in response. It would be good to identify whether something is a request, response, or both, and have hyperlinks to jump between.
changenode
, changeedge
and so on which allow changing metadata are nice but should not be treated as mandatory. The metadata is not required for building/running functional graphs, it is merely informational.
When connected to a runtime, it would be useful to know the runtime's project metadata, including:
namespace
: Project namespace. Should be used as the prefix of component namesrepository
: A URL for the source-code respository of the running project. Preferably git
This would allow clients to know which components in the library listing are part of the project, and which are from dependencies. Related to noflo/noflo-ui#695
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.