Yao Built-in data atomic operations, network requests, process control and a series of processes. These processes can be used in scenarios such as data interfaces, data tables, data charts, data streams, etc. 80% of business logic processing requirements.
The process supports writing using data streams, JS scripts, and GRPC plugins.
A process is a function Process( ...args:any[] ) any
that performs a specific function, consisting of the process name, parameter list, and return value. processes include the following types:
process | Description |
---|---|
xiang.*.* | Built-in process |
models.<model name>.* | built-in processes, atomic operations on data models |
flows.<data flow name> | built-in handlers, handlers written with data flows |
scripts.<script name>.* | Built-in handlers, scripting handlers via JavaScript |
plugins.<plugin name>.* | Write processes via GRPC plugins |
session.* | built-in, session data handler |
The process yao run <process> [args...]
can be run using the run
command.
yao run models.pet.Get '::{}'
Specify process
in the API to set the process. query
sets the parameter list for the handler.
{..."paths": [{"path": "/search","method": "GET","process": "models.pet.Paginate","query": [":query-param", "$query.page", "$quey.pagesize"],"out": {"status": 200,"type": "application/json"}}]...}
The process is specified by process
in the data flow node, and args
is passed in the process parameter table.
{..."nodes": [{"name": "pet","process": "models.pet.Find","args": [1, { "select": ["id","name"] }]},{"name": "print","process": "yao.sys.Print","args": ["{{$res.pet}}"]}]...}
The same method can also be used on the data flow nodes of Kanban, large screen, and graph.
{..."nodes": [{"name": "Type summary","process": "flows.stat.kind","args": [["dog","cat"]]}]...}
Use process
to overload tabular data reading logic
{..."apis": {"search": {"process": "flows.pet.latest"},"find": {"process": "flows.pet.find"}}...}
Used as a form Hook
to handle contextual data
{..."hooks": {"after:search": "flows.pet.fliter.data","after:find": "flows.pet.fliter.row"}...}
To be used as a table Guard
, to handle the validation logic, write the following in the table's apis
:
{..."apis": {"save": {"guard": "bearer-jwt,scripts.user.login"},"delete": {"guard": "bearer-jwt"}},...}
scripts/user.js
content, can print out the requested url path, parameters, and request headers, with Exception
can verify certain data or permissions
function login(path, params, query, payload, headers) {console.log([path, params, query, payload, headers]);throw new Exception("Not logged in", 403);}
Yao Built-in data atomic operations, network requests, process control and a series of processes. These processes can be used in scenarios such as data interfaces, data tables, data charts, data streams, etc. 80% of business logic processing requirements.
The process supports writing using data streams, JS scripts, and GRPC plugins.
A process is a function Process( ...args:any[] ) any
that performs a specific function, consisting of the process name, parameter list, and return value. processes include the following types:
process | Description |
---|---|
xiang.*.* | Built-in process |
models.<model name>.* | built-in processes, atomic operations on data models |
flows.<data flow name> | built-in handlers, handlers written with data flows |
scripts.<script name>.* | Built-in handlers, scripting handlers via JavaScript |
plugins.<plugin name>.* | Write processes via GRPC plugins |
session.* | built-in, session data handler |
The process yao run <process> [args...]
can be run using the run
command.
yao run models.pet.Get '::{}'
Specify process
in the API to set the process. query
sets the parameter list for the handler.
{..."paths": [{"path": "/search","method": "GET","process": "models.pet.Paginate","query": [":query-param", "$query.page", "$quey.pagesize"],"out": {"status": 200,"type": "application/json"}}]...}
The process is specified by process
in the data flow node, and args
is passed in the process parameter table.
{..."nodes": [{"name": "pet","process": "models.pet.Find","args": [1, { "select": ["id","name"] }]},{"name": "print","process": "yao.sys.Print","args": ["{{$res.pet}}"]}]...}
The same method can also be used on the data flow nodes of Kanban, large screen, and graph.
{..."nodes": [{"name": "Type summary","process": "flows.stat.kind","args": [["dog","cat"]]}]...}
Use process
to overload tabular data reading logic
{..."apis": {"search": {"process": "flows.pet.latest"},"find": {"process": "flows.pet.find"}}...}
Used as a form Hook
to handle contextual data
{..."hooks": {"after:search": "flows.pet.fliter.data","after:find": "flows.pet.fliter.row"}...}
To be used as a table Guard
, to handle the validation logic, write the following in the table's apis
:
{..."apis": {"save": {"guard": "bearer-jwt,scripts.user.login"},"delete": {"guard": "bearer-jwt"}},...}
scripts/user.js
content, can print out the requested url path, parameters, and request headers, with Exception
can verify certain data or permissions
function login(path, params, query, payload, headers) {console.log([path, params, query, payload, headers]);throw new Exception("Not logged in", 403);}