-
Notifications
You must be signed in to change notification settings - Fork 0
Overview
The best way to improve Originzero and make it do everything you need is to expand the node list. The two main purposes of making this application open-source are to make it useful and reliable for everyone, and to accelerate the development of the node list through contributors. This documentation is written to help you write your own node classes and customize the appearance of your nodes in the editor using only your typescript and javascript knowledge.
All nodes written so far are in the flow-runtime package. This package contains both the flow operating algorithm and the nodes.
- Clone the project to your local computer
- Go to the
/flow-runtime/src/nodes/core
folder. - Create a folder with the name of the new node. The folder name should be Pascal Case.
(For example NewNode)
- You should create 3 files under this folder.
NewNode.node.ts (Node logic class file)
NewNode.ui.ts (Node ui object file)
NewNode.icon.svg (Node icon file)
The file structure should look similar to the image below:
There are some general principles to follow when creating new nodes. These reflect the approach taken by the core nodes and help provided a consistent user-experience.
Nodes should:
-
be well-defined in their purpose.
If we think of nodes as functions, its name and the work it does must match exactly and it should not do more or less work than its purpose.
-
be easy to use and understand.
The name of the node should often clearly explain what it does. The input and output names of the node should be given in a way that explains its purpose well and should be designed accordingly.
-
input types determined well.
The value inputs of the nodes should have a type. This type directly affects the working mechanism of the node. The flow editor automatically prevents you from making a number type input from a string type output. Be sure to determine the input types of the node you are writing well and write your function according to this type.
-
be consistent in output value types.
The output end of the node should always produce the same type of value. For example, if you have determined the type of the node's A output as number, the node should produce number output no matter how it operates. It is important to pay attention to this because nodes with matching types can be connected to each other, but a node that produces the wrong type of output due to a function error will also disrupt the operation of the node it is connected to, and this will disrupt the entire system in a chain reaction.
-
catch errors.
Define well what action the node will take when it throw an error while running. Each node has an error event output. If the node gives an error, the node gives an output from this end.
The general principles and perspective are as follows. The rest of the document will explain what to consider when creating the content of each file. Thus, some abstract parts will become a little more concrete.
OriginZero - Collaborative low-code workflow automation tool
About | Code of conduct | Discord | Github Discussions | Linkedin