├── .gitignore ├── .vscode ├── launch.json ├── settings-online.json └── settings.json ├── LICENSE ├── docs └── yao-json-schema.gif ├── json-schemas ├── 0.10.3 │ ├── api_http.json │ ├── app.json │ ├── chart.json │ ├── connector.json │ ├── dashboard.json │ ├── flow.json │ ├── form.json │ ├── importer.json │ ├── list.json │ ├── login.json │ ├── model.json │ ├── query.json │ ├── query_param.json │ ├── schedule.json │ ├── service.json │ ├── socket.json │ ├── store.json │ ├── table.json │ ├── task.json │ ├── widget.json │ ├── ws_client.json │ └── ws_server.json └── 0.10.4 │ ├── api_http.json │ ├── app.json │ ├── chart.json │ ├── connector.json │ ├── dashboard.json │ ├── flow.json │ ├── form.json │ ├── importer.json │ ├── list.json │ ├── login.json │ ├── model.json │ ├── pipe.json │ ├── query.json │ ├── query_param.json │ ├── schedule.json │ ├── service.json │ ├── socket.json │ ├── store.json │ ├── table.json │ ├── task.json │ ├── widget.json │ ├── ws_client.json │ └── ws_server.json ├── make_schemas.sh ├── package.json ├── readme.md ├── src ├── build.ts ├── doc │ ├── in.txt │ ├── index.ts │ └── out.txt ├── index.d.ts ├── runtime.d.ts ├── sui.d.ts └── types │ ├── dsl │ ├── action.d.ts │ ├── antd │ │ └── rule.d.ts │ ├── api_http.d.ts │ ├── api_rest.d.ts │ ├── app.d.ts │ ├── chart.d.ts │ ├── component.d.ts │ ├── compute.d.ts │ ├── connector.d.ts │ ├── dashboard.d.ts │ ├── field.d.ts │ ├── flow.d.ts │ ├── form.d.ts │ ├── hook.d.ts │ ├── importer.d.ts │ ├── index.d.ts │ ├── list.d.ts │ ├── login.d.ts │ ├── mapping.d.ts │ ├── menu.d.ts │ ├── model.d.ts │ ├── neo.d.ts │ ├── pipe.d.ts │ ├── query.d.ts │ ├── query_param.d.ts │ ├── schedule.d.ts │ ├── service.d.ts │ ├── share_types.d.ts │ ├── socket.d.ts │ ├── store.d.ts │ ├── table.d.ts │ ├── task.d.ts │ ├── web_socket.d.ts │ └── widget.d.ts │ ├── global.d.ts │ ├── process_enum.d.ts │ ├── runtime │ ├── console.d.ts │ ├── exception.d.ts │ ├── fs.d.ts │ ├── global.d.ts │ ├── http.d.ts │ ├── io.d.ts │ ├── log.d.ts │ ├── neo.d.ts │ ├── process.d.ts │ ├── process │ │ ├── fs.d.ts │ │ ├── http.d.ts │ │ └── model.d.ts │ ├── query.d.ts │ ├── store.d.ts │ ├── sui.d.ts │ └── time.d.ts │ └── xgen │ ├── action.d.ts │ ├── app.d.ts │ ├── chart.d.ts │ ├── common.d.ts │ ├── component.d.ts │ ├── dashboard.d.ts │ ├── form.d.ts │ ├── global.d.ts │ ├── index.d.ts │ ├── list.d.ts │ ├── locale │ ├── index.d.ts │ ├── layout.d.ts │ ├── login.d.ts │ └── messages.d.ts │ ├── remote.d.ts │ ├── table.d.ts │ └── utils.d.ts ├── tsconfig.base.json └── tsconfig.json /.gitignore: -------------------------------------------------------------------------------- 1 | logs 2 | db/*.db 3 | db/*.session 4 | temp.json 5 | node_modules 6 | data 7 | dist 8 | dist_esm 9 | yao 10 | *.log 11 | *.tgz 12 | src/app -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "type": "node", 6 | "request": "launch", 7 | "name": "ts-node执行代码", 8 | "program": "${file}", 9 | "cwd": "${workspaceFolder}", 10 | "runtimeArgs": [ 11 | "--nolazy", 12 | "-r", 13 | "ts-node/register/transpile-only" //不检查类型会更快一些 14 | // "ts-node/register" 15 | ], 16 | "args": [ 17 | "-r", 18 | "tsconfig-paths/register", //解析@=>src 19 | "${file}" 20 | ], 21 | "outFiles": [ 22 | //"sourceMap": true 23 | "${workspaceFolder}/dist/**/*.js" 24 | ], 25 | "skipFiles": ["/**", "node_modules/**"], 26 | "console": "integratedTerminal", 27 | "internalConsoleOptions": "neverOpen" 28 | // "runtimeArgs": [ 29 | // "-r", 30 | // "esm" 31 | // ] 32 | } 33 | ] 34 | } 35 | -------------------------------------------------------------------------------- /.vscode/settings-online.json: -------------------------------------------------------------------------------- 1 | { 2 | "json.schemas": [ 3 | { 4 | "fileMatch": ["/**/*.mod.json", "/**/*.mod.jsonc", "/**/*.mod.yao"], 5 | "url": "https://raw.githubusercontent.com/wwsheng009/yao-app-ts-types/main/json-schemas/0.10.4/model.json" 6 | }, 7 | { 8 | "fileMatch": ["/**/*.app.json", "/**/*.app.jsonc", "/**/*.app.yao"], 9 | "url": "https://raw.githubusercontent.com/wwsheng009/yao-app-ts-types/main/json-schemas/0.10.4/app.json" 10 | }, 11 | { 12 | "fileMatch": ["/**/*.login.json", "/**/*.login.jsonc", "/**/*.login.yao"], 13 | "url": "https://raw.githubusercontent.com/wwsheng009/yao-app-ts-types/main/json-schemas/0.10.4/login.json" 14 | }, 15 | { 16 | "fileMatch": [ 17 | "/**/*.schedule.json", 18 | "/**/*.schedule.jsonc", 19 | "/**/*.schedule.yao" 20 | ], 21 | "url": "https://raw.githubusercontent.com/wwsheng009/yao-app-ts-types/main/json-schemas/0.10.4/schedule.json" 22 | }, 23 | { 24 | "fileMatch": [ 25 | "/**/*.service.json", 26 | "/**/*.service.jsonc", 27 | "/**/*.service.yao" 28 | ], 29 | "url": "https://raw.githubusercontent.com/wwsheng009/yao-app-ts-types/main/json-schemas/0.10.4/service.json" 30 | }, 31 | { 32 | "fileMatch": [ 33 | "/**/*.socket.json", 34 | "/**/*.socket.jsonc", 35 | "/**/*.socket.yao" 36 | ], 37 | "url": "https://raw.githubusercontent.com/wwsheng009/yao-app-ts-types/main/json-schemas/0.10.4/socket.json" 38 | }, 39 | { 40 | "fileMatch": ["/**/*.stor.json", "/**/*.stor.jsonc", "/**/*.stor.yao"], 41 | "url": "https://raw.githubusercontent.com/wwsheng009/yao-app-ts-types/main/json-schemas/0.10.4/store.json" 42 | }, 43 | { 44 | "fileMatch": ["/**/*.task.json", "/**/*.task.jsonc", "/**/*.task.yao"], 45 | "url": "https://raw.githubusercontent.com/wwsheng009/yao-app-ts-types/main/json-schemas/0.10.4/task.json" 46 | }, 47 | { 48 | "fileMatch": [ 49 | "/**/*.widget.json", 50 | "/**/*.widget.jsonc", 51 | "/**/*.widget.yao" 52 | ], 53 | "url": "https://raw.githubusercontent.com/wwsheng009/yao-app-ts-types/main/json-schemas/0.10.4/widget.json" 54 | }, 55 | { 56 | "fileMatch": [ 57 | "/**/apis/**/*.ws.json", 58 | "/**/apis/**/*.ws.jsonc", 59 | "/**/apis/**/*.ws.yao" 60 | ], 61 | "url": "https://raw.githubusercontent.com/wwsheng009/yao-app-ts-types/main/json-schemas/0.10.4/ws_server.json" 62 | }, 63 | { 64 | "fileMatch": [ 65 | "/**/websockets/**/*.ws.json", 66 | "/**/websockets/**/*.ws.jsonc", 67 | "/**/websockets/**/*.ws.yao" 68 | ], 69 | "url": "https://raw.githubusercontent.com/wwsheng009/yao-app-ts-types/main/json-schemas/0.10.4/ws_client.json" 70 | }, 71 | { 72 | "fileMatch": ["/**/*.imp.json", "/**/*.imp.jsonc", "/**/*.imp.yao"], 73 | "url": "https://raw.githubusercontent.com/wwsheng009/yao-app-ts-types/main/json-schemas/0.10.4/importer.json" 74 | }, 75 | { 76 | "fileMatch": ["/**/*.http.json", "/**/*.http.jsonc", "/**/*.http.yao"], 77 | "url": "https://raw.githubusercontent.com/wwsheng009/yao-app-ts-types/main/json-schemas/0.10.4/api_http.json" 78 | }, 79 | { 80 | "fileMatch": ["/**/*.rest.json", "/**/*.rest.jsonc", "/**/*.rest.yao"], 81 | "url": "https://raw.githubusercontent.com/wwsheng009/yao-app-ts-types/main/json-schemas/0.10.4/api_rest.json" 82 | }, 83 | { 84 | "fileMatch": ["/**/*.chart.json", "/**/*.chart.jsonc", "/**/*.chart.yao"], 85 | "url": "https://raw.githubusercontent.com/wwsheng009/yao-app-ts-types/main/json-schemas/0.10.4/chart.json" 86 | }, 87 | { 88 | "fileMatch": ["/**/*.tab.json", "/**/*.tab.jsonc", "/**/*.tab.yao"], 89 | "url": "https://raw.githubusercontent.com/wwsheng009/yao-app-ts-types/main/json-schemas/0.10.4/table.json" 90 | }, 91 | { 92 | "fileMatch": ["/**/*.list.json", "/**/*.list.jsonc", "/**/*.list.yao"], 93 | "url": "https://raw.githubusercontent.com/wwsheng009/yao-app-ts-types/main/json-schemas/0.10.4/list.json" 94 | }, 95 | { 96 | "fileMatch": ["/**/*.conn.json", "/**/*.conn.jsonc", "/**/*.conn.yao"], 97 | "url": "https://raw.githubusercontent.com/wwsheng009/yao-app-ts-types/main/json-schemas/0.10.4/connector.json" 98 | }, 99 | { 100 | "fileMatch": ["/**/*.model.json", "/**/*.model.jsonc", "/**/*.model.yao"], 101 | "url": "https://raw.githubusercontent.com/wwsheng009/yao-app-ts-types/main/json-schemas/0.10.4/model.json" 102 | }, 103 | { 104 | "fileMatch": [ 105 | "/**/*.form.json", 106 | "/**/*.form.jsonc", 107 | "/**/*.form.yao", 108 | "!/**/dyforms/**/*.form.json", 109 | "!/**/dyforms/**/*.form.jsonc", 110 | "!/**/dyforms/**/*.form.yao" 111 | ], 112 | "url": "https://raw.githubusercontent.com/wwsheng009/yao-app-ts-types/main/json-schemas/0.10.4/form.json" 113 | }, 114 | { 115 | "fileMatch": ["/**/*.flow.json", "/**/*.flow.jsonc", "/**/*.flow.yao"], 116 | "url": "https://raw.githubusercontent.com/wwsheng009/yao-app-ts-types/main/json-schemas/0.10.4/flow.json" 117 | }, 118 | { 119 | "fileMatch": ["/**/*.dash.json", "/**/*.dash.jsonc", "/**/*.dash.yao"], 120 | "url": "https://raw.githubusercontent.com/wwsheng009/yao-app-ts-types/main/json-schemas/0.10.4/dashboard.json" 121 | }, 122 | { 123 | "fileMatch": ["/**/*.pip.json", "/**/*.pip.jsonc", "/**/*.pip.yao"], 124 | "url": "https://raw.githubusercontent.com/wwsheng009/yao-app-ts-types/main/json-schemas/0.10.4/pipe.json" 125 | } 126 | ] 127 | } 128 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "json.schemas": [ 3 | { 4 | "fileMatch": ["/**/*.mod.json", "/**/*.mod.jsonc", "/**/*.mod.yao"], 5 | "url": "/json-schemas/0.10.3/model.json" 6 | }, 7 | { 8 | "fileMatch": ["/**/*app.json", "/**/*app.jsonc", "/**/*app.yao"], 9 | "url": "/json-schemas/0.10.3/app.json" 10 | }, 11 | { 12 | "fileMatch": ["/**/*.login.json", "/**/*.login.jsonc", "/**/*.login.yao"], 13 | "url": "/json-schemas/0.10.3/login.json" 14 | }, 15 | { 16 | "fileMatch": [ 17 | "/**/*.schedule.json", 18 | "/**/*.schedule.jsonc", 19 | "/**/*.schedule.yao" 20 | ], 21 | "url": "/json-schemas/0.10.3/schedule.json" 22 | }, 23 | { 24 | "fileMatch": [ 25 | "/**/*.service.json", 26 | "/**/*.service.jsonc", 27 | "/**/*.service.yao" 28 | ], 29 | "url": "/json-schemas/0.10.3/service.json" 30 | }, 31 | { 32 | "fileMatch": [ 33 | "/**/*.socket.json", 34 | "/**/*.socket.jsonc", 35 | "/**/*.socket.yao" 36 | ], 37 | "url": "/json-schemas/0.10.3/socket.json" 38 | }, 39 | { 40 | "fileMatch": ["/**/*.stor.json", "/**/*.stor.jsonc", "/**/*.stor.yao"], 41 | "url": "/json-schemas/0.10.3/store.json" 42 | }, 43 | { 44 | "fileMatch": ["/**/*.task.json", "/**/*.task.jsonc", "/**/*.task.yao"], 45 | "url": "/json-schemas/0.10.3/task.json" 46 | }, 47 | { 48 | "fileMatch": [ 49 | "/**/*.widget.json", 50 | "/**/*.widget.jsonc", 51 | "/**/*.widget.yao" 52 | ], 53 | "url": "/json-schemas/0.10.3/widget.json" 54 | }, 55 | { 56 | "fileMatch": [ 57 | "/**/apis/**/*.ws.json", 58 | "/**/apis/**/*.ws.jsonc", 59 | "/**/apis/**/*.ws.yao" 60 | ], 61 | "url": "/json-schemas/0.10.3/ws_server.json" 62 | }, 63 | { 64 | "fileMatch": [ 65 | "/**/websockets/**/*.ws.json", 66 | "/**/websockets/**/*.ws.jsonc", 67 | "/**/websockets/**/*.ws.yao" 68 | ], 69 | "url": "/json-schemas/0.10.3/ws_client.json" 70 | }, 71 | { 72 | "fileMatch": ["/**/*.imp.json", "/**/*.imp.jsonc", "/**/*.imp.yao"], 73 | "url": "/json-schemas/0.10.3/importer.json" 74 | }, 75 | { 76 | "fileMatch": ["/**/*.http.json", "/**/*.http.jsonc", "/**/*.http.yao"], 77 | "url": "/json-schemas/0.10.3/api_http.json" 78 | }, 79 | { 80 | "fileMatch": ["/**/*.rest.json", "/**/*.rest.jsonc", "/**/*.rest.yao"], 81 | "url": "/json-schemas/0.10.3/api_rest.json" 82 | }, 83 | { 84 | "fileMatch": ["/**/*.chart.json", "/**/*.chart.jsonc", "/**/*.chart.yao"], 85 | "url": "/json-schemas/0.10.3/chart.json" 86 | }, 87 | { 88 | "fileMatch": ["/**/*.tab.json", "/**/*.tab.jsonc", "/**/*.tab.yao"], 89 | "url": "/json-schemas/0.10.3/table.json" 90 | }, 91 | { 92 | "fileMatch": ["/**/*.list.json", "/**/*.list.jsonc", "/**/*.list.yao"], 93 | "url": "/json-schemas/0.10.3/list.json" 94 | }, 95 | { 96 | "fileMatch": ["/**/*.conn.json", "/**/*.conn.jsonc", "/**/*.conn.yao"], 97 | "url": "/json-schemas/0.10.3/connector.json" 98 | }, 99 | { 100 | "fileMatch": ["/**/*.model.json", "/**/*.model.jsonc", "/**/*.model.yao"], 101 | "url": "/json-schemas/0.10.3/model.json" 102 | }, 103 | { 104 | "fileMatch": [ 105 | "/**/*.form.json", 106 | "/**/*.form.jsonc", 107 | "/**/*.form.yao", 108 | "!/**/dyforms/**/*.form.json", 109 | "!/**/dyforms/**/*.form.jsonc", 110 | "!/**/dyforms/**/*.form.yao" 111 | ], 112 | "url": "/json-schemas/0.10.3/form.json" 113 | }, 114 | { 115 | "fileMatch": ["/**/*.flow.json", "/**/*.flow.jsonc", "/**/*.flow.yao"], 116 | "url": "/json-schemas/0.10.3/flow.json" 117 | }, 118 | { 119 | "fileMatch": ["/**/*.dash.json", "/**/*.dash.jsonc", "/**/*.dash.yao"], 120 | "url": "/json-schemas/0.10.3/dashboard.json" 121 | } 122 | ] 123 | } 124 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020-present, Vben 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /docs/yao-json-schema.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wwsheng009/yao-app-ts-types/a40dc9f15ce9a2a1a992e81c208cee61721da83c/docs/yao-json-schema.gif -------------------------------------------------------------------------------- /json-schemas/0.10.3/api_http.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$ref": "#/definitions/YaoHttp.HttpDSL", 4 | "definitions": { 5 | "YaoHttp.HttpDSL": { 6 | "type": "object", 7 | "properties": { 8 | "version": { 9 | "type": "string", 10 | "description": "版本【管理字段】" 11 | }, 12 | "decription": { 13 | "type": "string", 14 | "description": "描述【管理字段】" 15 | }, 16 | "comment": { 17 | "type": "string", 18 | "description": "备注【管理字段】" 19 | }, 20 | "name": { 21 | "type": "string", 22 | "description": "API 呈现名称" 23 | }, 24 | "description": { 25 | "type": "string", 26 | "description": "描述" 27 | }, 28 | "group": { 29 | "type": "string", 30 | "description": "API 分组名称,访问时作为 API 路由前缀目录。 `/api//`" 31 | }, 32 | "guard": { 33 | "type": "string", 34 | "description": "API 全局中间件,多个用 \",\" 分割。除特别声明,组内所有 API 都将使用全局中间件\n\n常用bearer-jwt" 35 | }, 36 | "paths": { 37 | "type": "array", 38 | "items": { 39 | "$ref": "#/definitions/YaoHttp.Path" 40 | }, 41 | "description": "API 列表。具体查看 `Object Path` 数据结构" 42 | }, 43 | "$schema": { 44 | "type": "string" 45 | } 46 | }, 47 | "additionalProperties": false 48 | }, 49 | "YaoHttp.Path": { 50 | "type": "object", 51 | "properties": { 52 | "label": { 53 | "type": "string", 54 | "description": "标签" 55 | }, 56 | "description": { 57 | "type": "string", 58 | "description": "描述" 59 | }, 60 | "path": { 61 | "type": "string", 62 | "description": "API 路由名称。完整路由地址为 `/api//` ,变量使用 `:` 声明,如 `/api/user/find/:id`, 可以使用 `$param.id` 访问路由请求参数" 63 | }, 64 | "method": { 65 | "type": "string", 66 | "description": "请求类型。许可值 `GET`、`POST`、`PUT`、`DELETE`、 `HEAD`、`OPTIONS`、`Any`. 其中 `Any` 将响应任何类型的请求" 67 | }, 68 | "process": { 69 | "type": "string", 70 | "description": "调用处理器 `process`" 71 | }, 72 | "guard": { 73 | "type": "string", 74 | "description": "API 中间件. 如不设置,默认使用全局中间件。如不希望使用全局中间件,可将数值设置为 `-` 。|\n\n常用bearer-jwt" 75 | }, 76 | "in": { 77 | "type": "array", 78 | "items": { 79 | "type": "string" 80 | }, 81 | "description": "请求参数表,将作为 `process` 的输入参数(`args`)。可以引用传入参数,可以为空数组 [查看输入参数](#输入参数)" 82 | }, 83 | "out": { 84 | "$ref": "#/definitions/YaoHttp.Out", 85 | "description": "请求响应结果定义。 具体查看 `Object Out` 数据结构" 86 | } 87 | }, 88 | "required": [ 89 | "path", 90 | "method", 91 | "process" 92 | ], 93 | "additionalProperties": false 94 | }, 95 | "YaoHttp.Out": { 96 | "type": "object", 97 | "properties": { 98 | "status": { 99 | "type": "number", 100 | "description": "请求响应状态码" 101 | }, 102 | "type": { 103 | "type": "string", 104 | "description": "请求响应 Content Type" 105 | }, 106 | "body": { 107 | "description": "请求响应内容" 108 | }, 109 | "headers": { 110 | "type": "object", 111 | "additionalProperties": { 112 | "type": "string" 113 | }, 114 | "description": "请求响应 Headers" 115 | } 116 | }, 117 | "required": [ 118 | "status" 119 | ], 120 | "additionalProperties": false 121 | } 122 | } 123 | } -------------------------------------------------------------------------------- /json-schemas/0.10.3/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$ref": "#/definitions/YaoApp.AppDSL", 4 | "definitions": { 5 | "YaoApp.AppDSL": { 6 | "type": "object", 7 | "properties": { 8 | "version": { 9 | "type": "string", 10 | "description": "版本【管理字段】" 11 | }, 12 | "decription": { 13 | "type": "string", 14 | "description": "描述【管理字段】" 15 | }, 16 | "comment": { 17 | "type": "string", 18 | "description": "备注【管理字段】" 19 | }, 20 | "xgen": { 21 | "type": "string", 22 | "description": "XGen 界面引擎版本, 推荐使用 `1.0` 版,旧版已停止维护" 23 | }, 24 | "name": { 25 | "type": "string", 26 | "description": "应用名称, 支持多语言" 27 | }, 28 | "short": { 29 | "type": "string", 30 | "description": "应用简称, 支持多语言。" 31 | }, 32 | "description": { 33 | "type": "string", 34 | "description": "应用介绍, 支持多语言。" 35 | }, 36 | "theme": { 37 | "type": "string", 38 | "enum": [ 39 | "light", 40 | "dark" 41 | ], 42 | "description": "默认主题" 43 | }, 44 | "lang": { 45 | "type": "string", 46 | "description": "配置xgen语言 zh-cn/en-us" 47 | }, 48 | "sid": { 49 | "type": "string" 50 | }, 51 | "logo": { 52 | "type": "string", 53 | "description": "logo文件地址,根目录/public" 54 | }, 55 | "favicon": { 56 | "type": "string", 57 | "description": "网站favicon文件地址,根目录/public" 58 | }, 59 | "menu": { 60 | "$ref": "#/definitions/YaoApp.MenuDSL", 61 | "description": "管理后台菜单读取处理器" 62 | }, 63 | "adminRoot": { 64 | "type": "string", 65 | "description": "管理后台路由前缀,默认为/yao" 66 | }, 67 | "optional": { 68 | "$ref": "#/definitions/YaoApp.OptionalDSL", 69 | "description": "应用可选配置项" 70 | }, 71 | "setting": { 72 | "type": "string", 73 | "description": "xgen获取配置的处理器,默认是yao.app.Xgen" 74 | }, 75 | "setup": { 76 | "type": "string", 77 | "description": "应用首次安装后运行的处理器名称, 一般可以用来建立初始化数据;处理器第一个参数为应用配置信息。支持使用 `studio` 命名空间,调用 studio 脚本函数" 78 | }, 79 | "$schema": { 80 | "type": "string" 81 | } 82 | }, 83 | "additionalProperties": false 84 | }, 85 | "YaoApp.MenuDSL": { 86 | "type": "object", 87 | "properties": { 88 | "process": { 89 | "type": "string", 90 | "description": "处理器名称" 91 | }, 92 | "args": { 93 | "type": "array", 94 | "items": { 95 | "type": "string" 96 | }, 97 | "description": "处理器参数表" 98 | } 99 | }, 100 | "additionalProperties": false 101 | }, 102 | "YaoApp.OptionalDSL": { 103 | "type": "object", 104 | "properties": { 105 | "hideNotification": { 106 | "type": "boolean", 107 | "description": "隐藏系统通知面板。 **字段名大小写敏感**" 108 | }, 109 | "hideSetting": { 110 | "type": "boolean", 111 | "description": "隐藏导航栏下方配置菜单。 **字段名大小写敏感**" 112 | }, 113 | "remoteCache": { 114 | "type": "boolean", 115 | "description": "在xgen中缓存远程select控件选项" 116 | }, 117 | "neo": { 118 | "type": "object", 119 | "properties": { 120 | "api": { 121 | "type": "string", 122 | "description": "neo chat api" 123 | } 124 | }, 125 | "required": [ 126 | "api" 127 | ], 128 | "additionalProperties": false, 129 | "description": "neo config, for chatgpt service" 130 | } 131 | } 132 | } 133 | } 134 | } -------------------------------------------------------------------------------- /json-schemas/0.10.3/importer.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$ref": "#/definitions/YaoImport.Importer", 4 | "definitions": { 5 | "YaoImport.Importer": { 6 | "type": "object", 7 | "properties": { 8 | "version": { 9 | "type": "string", 10 | "description": "版本【管理字段】" 11 | }, 12 | "decription": { 13 | "type": "string", 14 | "description": "描述【管理字段】" 15 | }, 16 | "comment": { 17 | "type": "string", 18 | "description": "备注【管理字段】" 19 | }, 20 | "title": { 21 | "type": "string", 22 | "description": "导入名称" 23 | }, 24 | "process": { 25 | "type": "string", 26 | "description": "处理器名称" 27 | }, 28 | "output": { 29 | "type": "string", 30 | "description": "The process import output" 31 | }, 32 | "columns": { 33 | "type": "array", 34 | "items": { 35 | "$ref": "#/definitions/YaoImport.Column" 36 | }, 37 | "description": "字段列表" 38 | }, 39 | "option": { 40 | "$ref": "#/definitions/YaoImport.Option", 41 | "description": "导入配置项" 42 | }, 43 | "rules": { 44 | "type": "object", 45 | "additionalProperties": { 46 | "type": "string" 47 | }, 48 | "description": "许可导入规则" 49 | }, 50 | "$schema": { 51 | "type": "string" 52 | } 53 | }, 54 | "required": [ 55 | "process", 56 | "columns" 57 | ], 58 | "additionalProperties": false, 59 | "description": "数据导入器" 60 | }, 61 | "YaoImport.Column": { 62 | "type": "object", 63 | "properties": { 64 | "label": { 65 | "type": "string", 66 | "description": "字段标签" 67 | }, 68 | "name": { 69 | "type": "string", 70 | "description": "字段名称" 71 | }, 72 | "field": { 73 | "type": "string", 74 | "description": "字段名称(原始值),不需要配置" 75 | }, 76 | "match": { 77 | "type": "array", 78 | "items": { 79 | "type": "string" 80 | }, 81 | "description": "匹配建议" 82 | }, 83 | "rules": { 84 | "type": "array", 85 | "items": { 86 | "type": "string" 87 | }, 88 | "description": "清洗规则定义" 89 | }, 90 | "nullable": { 91 | "type": "boolean", 92 | "description": "是否可以为空" 93 | }, 94 | "primary": { 95 | "type": "boolean", 96 | "description": "是否为主键" 97 | } 98 | }, 99 | "required": [ 100 | "label", 101 | "name" 102 | ], 103 | "additionalProperties": false, 104 | "description": "导入字段定义" 105 | }, 106 | "YaoImport.Option": { 107 | "type": "object", 108 | "properties": { 109 | "useTemplate": { 110 | "type": "boolean", 111 | "description": "使用已匹配过的模板" 112 | }, 113 | "templateLink": { 114 | "type": "string", 115 | "description": "默认数据模板链接" 116 | }, 117 | "chunkSize": { 118 | "type": "number", 119 | "description": "每次处理记录数量" 120 | }, 121 | "mappingPreview": { 122 | "type": "string", 123 | "description": "显示字段映射界面方式 auto 匹配模板失败显示, always 一直显示, never 不显示" 124 | }, 125 | "dataPreview": { 126 | "type": "string", 127 | "description": "数据预览界面方式 auto 有异常数据时显示, always 一直显示, never 不显示" 128 | } 129 | }, 130 | "additionalProperties": false, 131 | "description": "导入配置项定" 132 | } 133 | } 134 | } -------------------------------------------------------------------------------- /json-schemas/0.10.3/login.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$ref": "#/definitions/YaoLogin.LoginDSL", 4 | "definitions": { 5 | "YaoLogin.LoginDSL": { 6 | "type": "object", 7 | "properties": { 8 | "version": { 9 | "type": "string", 10 | "description": "版本【管理字段】" 11 | }, 12 | "decription": { 13 | "type": "string", 14 | "description": "描述【管理字段】" 15 | }, 16 | "comment": { 17 | "type": "string", 18 | "description": "备注【管理字段】" 19 | }, 20 | "name": { 21 | "type": "string", 22 | "description": "登录界面名称, 支持多语言" 23 | }, 24 | "action": { 25 | "$ref": "#/definitions/YaoLogin.ActionDSL", 26 | "description": "自定义用户登录逻辑处理器,默认是yao.login.Admin" 27 | }, 28 | "layout": { 29 | "$ref": "#/definitions/YaoLogin.LayoutDSL", 30 | "description": "页面布局定义。设置登录界面封面、登录后跳转路由地址等" 31 | }, 32 | "thirdPartyLogin": { 33 | "type": "array", 34 | "items": { 35 | "$ref": "#/definitions/YaoLogin.ThirdPartyLoginDSL" 36 | }, 37 | "description": "第三方登录" 38 | }, 39 | "$schema": { 40 | "type": "string" 41 | } 42 | }, 43 | "additionalProperties": false 44 | }, 45 | "YaoLogin.ActionDSL": { 46 | "type": "object", 47 | "properties": { 48 | "process": { 49 | "type": "string", 50 | "description": "用户登录处理逻辑" 51 | }, 52 | "args": { 53 | "type": "array", 54 | "items": {}, 55 | "description": "登录处理器参数,参考http 接口的传参数,可使用:payload引用传入参数" 56 | } 57 | }, 58 | "additionalProperties": false 59 | }, 60 | "YaoLogin.LayoutDSL": { 61 | "type": "object", 62 | "properties": { 63 | "entry": { 64 | "type": "string", 65 | "description": "成功登录后,转向此地址。**注意: 不含管理后台路由前缀**" 66 | }, 67 | "captcha": { 68 | "type": "string", 69 | "description": "自定义动态认证码生成处理器,默认是yao.utils.Captcha" 70 | }, 71 | "cover": { 72 | "type": "string", 73 | "description": "登录界面封面图片, 图片相对地址。可将图片放到应用公开目录 `public` ,例如: `/data/app/public/images/cover.png`, 填写的地址为 `/images/cover.png`" 74 | }, 75 | "slogan": { 76 | "type": "string", 77 | "description": "登录界面广告语,支持多语言" 78 | }, 79 | "site": { 80 | "type": "string", 81 | "description": "登录界面封面图片下方链接地址" 82 | } 83 | }, 84 | "additionalProperties": false 85 | }, 86 | "YaoLogin.ThirdPartyLoginDSL": { 87 | "type": "object", 88 | "properties": { 89 | "title": { 90 | "type": "string", 91 | "description": "按钮标题" 92 | }, 93 | "href": { 94 | "type": "string", 95 | "description": "第三方登录跳转地址" 96 | }, 97 | "icon": { 98 | "type": "string", 99 | "description": "按钮前缀图标" 100 | }, 101 | "blank": { 102 | "type": "boolean", 103 | "description": "是否在浏览器打开新标签" 104 | } 105 | }, 106 | "additionalProperties": false 107 | } 108 | } 109 | } -------------------------------------------------------------------------------- /json-schemas/0.10.3/query_param.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$ref": "#/definitions/YaoQueryParam.QueryParam", 4 | "definitions": { 5 | "YaoQueryParam.QueryParam": { 6 | "type": "object", 7 | "properties": { 8 | "comment": { 9 | "type": "string", 10 | "description": "备注【管理字段】" 11 | }, 12 | "model": { 13 | "type": "string", 14 | "description": "模型名称" 15 | }, 16 | "table": { 17 | "type": "string", 18 | "description": "表格名称" 19 | }, 20 | "alias": { 21 | "type": "string", 22 | "description": "别名" 23 | }, 24 | "export": { 25 | "type": "string", 26 | "description": "导出数据时的前缀" 27 | }, 28 | "select": { 29 | "type": "array", 30 | "items": { 31 | "type": "string" 32 | }, 33 | "description": "选择字段清单" 34 | }, 35 | "wheres": { 36 | "type": "array", 37 | "items": { 38 | "$ref": "#/definitions/YaoQueryParam.QueryWhere" 39 | }, 40 | "description": "查询条件" 41 | }, 42 | "orders": { 43 | "type": "array", 44 | "items": { 45 | "$ref": "#/definitions/YaoQueryParam.QueryOrder" 46 | }, 47 | "description": "排序条件" 48 | }, 49 | "limit": { 50 | "type": "number", 51 | "description": "限制返回记录条目" 52 | }, 53 | "page": { 54 | "type": "number", 55 | "description": "当前页码" 56 | }, 57 | "pagesize": { 58 | "type": "number", 59 | "description": "每页显示记录数量" 60 | }, 61 | "withs": { 62 | "type": "object", 63 | "additionalProperties": { 64 | "$ref": "#/definitions/YaoQueryParam.QueryWith" 65 | }, 66 | "description": "读取关联模型" 67 | } 68 | }, 69 | "additionalProperties": false, 70 | "description": "QueryParam 数据查询器参数" 71 | }, 72 | "YaoQueryParam.QueryWhere": { 73 | "type": "object", 74 | "properties": { 75 | "rel": { 76 | "type": "string", 77 | "description": "如按关联模型的字段查询,则填写关联模型名称" 78 | }, 79 | "column": { 80 | "type": "string", 81 | "description": "字段名称" 82 | }, 83 | "value": { 84 | "description": "匹配数值" 85 | }, 86 | "method": { 87 | "type": "string", 88 | "description": "查询方法 `where`,`orwhere`, `wherein`, `orwherein`... 默认为 `where`,\n\n| 查询方法 | 说明 | | -------- | ------------------------------------- | | where | WHERE 字段 = 数值, WHERE 字段 >= 数值 | | orwhere | ... OR WHERE 字段 = 数值 |" 89 | }, 90 | "op": { 91 | "type": "string", 92 | "enum": [ 93 | "eq", 94 | "like", 95 | "match", 96 | "gt", 97 | "ge", 98 | "lt", 99 | "le", 100 | "null", 101 | "notnull", 102 | "in", 103 | "ne" 104 | ], 105 | "description": "匹配关系 `eq`,`like`,`in`,`gt` 等默认为 `eq`\n\n| 匹配关系 | 说明 | | -------- | -------------------------------- | | eq | 默认值 等于 WHERE 字段 = 数值 | | like | 匹配 WHERE 字段 like 数值 | | match | 匹配 WHERE 字段 全文检索 数值 | | gt | 大于 WHERE 字段 > 数值 | | ge | 大于等于 WHERE 字段 >= 数值 | | lt | 小于 WHERE 字段 < 数值 | | le | 小于等于 WHERE 字段 <= 数值 | | null | 为空 WHERE 字段 IS NULL | | notnull | 不为空 WHERE 字段 IS NOT NULL | | in | 列表包含 WHERE 字段 IN (数值...) | | ne | 不等于匹配值 |" 106 | }, 107 | "wheres": { 108 | "type": "array", 109 | "items": { 110 | "$ref": "#/definitions/YaoQueryParam.QueryWhere" 111 | }, 112 | "description": "分组查询" 113 | } 114 | }, 115 | "additionalProperties": false, 116 | "description": "QueryWhere Where 查询条件" 117 | }, 118 | "YaoQueryParam.QueryOrder": { 119 | "type": "object", 120 | "properties": { 121 | "rel": { 122 | "type": "string", 123 | "description": "如按关联模型的字段排序,则填写关联模型名称" 124 | }, 125 | "column": { 126 | "type": "string", 127 | "description": "字段名称" 128 | }, 129 | "option": { 130 | "type": "string", 131 | "enum": [ 132 | "desc", 133 | "asc" 134 | ], 135 | "description": "排序方式, `desc`, `asc`, 默认为 `asc`" 136 | } 137 | }, 138 | "required": [ 139 | "column" 140 | ], 141 | "additionalProperties": false, 142 | "description": "QueryOrder Order 查询排序" 143 | }, 144 | "YaoQueryParam.QueryWith": { 145 | "type": "object", 146 | "properties": { 147 | "name": { 148 | "type": "string" 149 | }, 150 | "query": { 151 | "$ref": "#/definitions/YaoQueryParam.QueryParam" 152 | } 153 | }, 154 | "additionalProperties": false, 155 | "description": "With relations 关联查询" 156 | } 157 | } 158 | } -------------------------------------------------------------------------------- /json-schemas/0.10.3/schedule.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$ref": "#/definitions/YaoSchedule.Schedule", 4 | "definitions": { 5 | "YaoSchedule.Schedule": { 6 | "type": "object", 7 | "properties": { 8 | "version": { 9 | "type": "string", 10 | "description": "版本【管理字段】" 11 | }, 12 | "decription": { 13 | "type": "string", 14 | "description": "描述【管理字段】" 15 | }, 16 | "comment": { 17 | "type": "string", 18 | "description": "备注【管理字段】" 19 | }, 20 | "name": { 21 | "type": "string", 22 | "description": "名称" 23 | }, 24 | "process": { 25 | "type": "string", 26 | "description": "处理器,处理器与task二选一" 27 | }, 28 | "schedule": { 29 | "type": "string", 30 | "description": "计划定时执行的时间,写法和 Linux 的 crontab 是一样的" 31 | }, 32 | "task": { 33 | "type": "string", 34 | "description": "任务名称,使用task.json定义的任务" 35 | }, 36 | "args": { 37 | "type": "array", 38 | "items": {}, 39 | "description": "处理器参数" 40 | }, 41 | "$schema": { 42 | "type": "string" 43 | } 44 | }, 45 | "required": [ 46 | "name", 47 | "schedule" 48 | ], 49 | "additionalProperties": false 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /json-schemas/0.10.3/service.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$ref": "#/definitions/YaoService.Service", 4 | "definitions": { 5 | "YaoService.Service": { 6 | "type": "object", 7 | "properties": { 8 | "version": { 9 | "type": "string", 10 | "description": "版本【管理字段】" 11 | }, 12 | "decription": { 13 | "type": "string", 14 | "description": "描述【管理字段】" 15 | }, 16 | "comment": { 17 | "type": "string", 18 | "description": "备注【管理字段】" 19 | }, 20 | "name": { 21 | "type": "string", 22 | "description": "名称" 23 | }, 24 | "process": { 25 | "type": "string", 26 | "description": "处理器,运行目录是环境变量YAO_ROOT,或是使用当前目录" 27 | }, 28 | "command": { 29 | "type": "string", 30 | "description": "作业运行命令,默认是`yao run `,使用yao执行脚本等,可替换成其它的系统命令" 31 | }, 32 | "requires": { 33 | "type": "array", 34 | "items": { 35 | "type": "string" 36 | }, 37 | "description": "前置作业" 38 | }, 39 | "after": { 40 | "type": "array", 41 | "items": { 42 | "type": "string" 43 | }, 44 | "description": "前置作业" 45 | }, 46 | "restart": { 47 | "type": "string", 48 | "description": "重启条件,默认on-failure" 49 | }, 50 | "workdir": { 51 | "type": "string", 52 | "description": "工作目录" 53 | }, 54 | "args": { 55 | "type": "array", 56 | "items": {}, 57 | "description": "处理器运行的参数" 58 | }, 59 | "error": { 60 | "type": "string", 61 | "description": "错误日志文件路径,默认/var/log/yao-{{.Name}}-error.log" 62 | }, 63 | "output": { 64 | "type": "string", 65 | "description": "结果输出文件路径,默认/var/log/yao-{{.Name}}.log" 66 | }, 67 | "user": { 68 | "type": "string", 69 | "description": "运行用户,默认User=root" 70 | }, 71 | "group": { 72 | "type": "string", 73 | "description": "运行用户组,Group=root" 74 | }, 75 | "$schema": { 76 | "type": "string" 77 | } 78 | }, 79 | "additionalProperties": false, 80 | "description": "后台服务定义,不支持windows操作系统" 81 | } 82 | } 83 | } -------------------------------------------------------------------------------- /json-schemas/0.10.3/socket.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$ref": "#/definitions/YaoSocket.Socket", 4 | "definitions": { 5 | "YaoSocket.Socket": { 6 | "type": "object", 7 | "properties": { 8 | "version": { 9 | "type": "string", 10 | "description": "版本【管理字段】" 11 | }, 12 | "decription": { 13 | "type": "string", 14 | "description": "描述【管理字段】" 15 | }, 16 | "comment": { 17 | "type": "string", 18 | "description": "备注【管理字段】" 19 | }, 20 | "name": { 21 | "type": "string" 22 | }, 23 | "mode": { 24 | "type": "string", 25 | "enum": [ 26 | "server", 27 | "client" 28 | ] 29 | }, 30 | "description": { 31 | "type": "string" 32 | }, 33 | "protocol": { 34 | "type": "string" 35 | }, 36 | "host": { 37 | "type": "string" 38 | }, 39 | "port": { 40 | "type": "string" 41 | }, 42 | "event": { 43 | "$ref": "#/definitions/YaoSocket.SocketEvent" 44 | }, 45 | "timeout": { 46 | "type": "number" 47 | }, 48 | "buffer": { 49 | "type": "number" 50 | }, 51 | "keep": { 52 | "type": "number" 53 | }, 54 | "process": { 55 | "type": "string" 56 | }, 57 | "attempt_after": { 58 | "type": "number" 59 | }, 60 | "attempts": { 61 | "type": "number" 62 | }, 63 | "$schema": { 64 | "type": "string" 65 | } 66 | }, 67 | "required": [ 68 | "name" 69 | ], 70 | "additionalProperties": false 71 | }, 72 | "YaoSocket.SocketEvent": { 73 | "type": "object", 74 | "properties": { 75 | "data": { 76 | "type": "string" 77 | }, 78 | "error": { 79 | "type": "string" 80 | }, 81 | "closed": { 82 | "type": "string" 83 | }, 84 | "connected": { 85 | "type": "string" 86 | } 87 | }, 88 | "additionalProperties": false 89 | } 90 | } 91 | } -------------------------------------------------------------------------------- /json-schemas/0.10.3/store.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$ref": "#/definitions/YaoStore.Store", 4 | "definitions": { 5 | "YaoStore.Store": { 6 | "type": "object", 7 | "properties": { 8 | "version": { 9 | "type": "string", 10 | "description": "版本【管理字段】" 11 | }, 12 | "decription": { 13 | "type": "string", 14 | "description": "描述【管理字段】" 15 | }, 16 | "comment": { 17 | "type": "string", 18 | "description": "备注【管理字段】" 19 | }, 20 | "name": { 21 | "type": "string", 22 | "description": "名称" 23 | }, 24 | "description": { 25 | "type": "string", 26 | "description": "描述" 27 | }, 28 | "connector": { 29 | "type": "string", 30 | "description": "绑定连接器名称(连接器) Yao v0.10.2+" 31 | }, 32 | "type": { 33 | "type": "string", 34 | "description": "类型 `lru` LRU 缓存 (connector 为空时有效)" 35 | }, 36 | "option": { 37 | "type": "object", 38 | "description": "配置项 `{\"size\":10240}` type 为 `lru` 时有效, size 为 LRU 缓存大小" 39 | }, 40 | "$schema": { 41 | "type": "string" 42 | } 43 | }, 44 | "required": [ 45 | "name" 46 | ], 47 | "additionalProperties": false 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /json-schemas/0.10.3/task.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$ref": "#/definitions/YaoTask.Task", 4 | "definitions": { 5 | "YaoTask.Task": { 6 | "type": "object", 7 | "properties": { 8 | "version": { 9 | "type": "string", 10 | "description": "版本【管理字段】" 11 | }, 12 | "decription": { 13 | "type": "string", 14 | "description": "描述【管理字段】" 15 | }, 16 | "comment": { 17 | "type": "string", 18 | "description": "备注【管理字段】" 19 | }, 20 | "name": { 21 | "type": "string", 22 | "description": "任务名称" 23 | }, 24 | "process": { 25 | "type": "string", 26 | "description": "该task绑定的处理器,必须配置" 27 | }, 28 | "size": { 29 | "type": "number", 30 | "description": "作业对列大小,默认1024" 31 | }, 32 | "worker_nums": { 33 | "type": "number", 34 | "description": "指定进程数,默认是1" 35 | }, 36 | "attempt_after": { 37 | "type": "number", 38 | "description": "重试间隔" 39 | }, 40 | "attempts": { 41 | "type": "number", 42 | "description": "失败重试次数" 43 | }, 44 | "timeout": { 45 | "type": "number", 46 | "description": "超时时间,秒钟,默认300" 47 | }, 48 | "event": { 49 | "type": "object", 50 | "properties": { 51 | "next": { 52 | "type": "string", 53 | "description": "生成任务唯一id的回调处理器" 54 | }, 55 | "add": { 56 | "type": "string", 57 | "description": "添加任务时触发的处理器" 58 | }, 59 | "success": { 60 | "type": "string", 61 | "description": "添加任务时触发的处理器" 62 | }, 63 | "error": { 64 | "type": "string", 65 | "description": "任务失败后触发处理器" 66 | }, 67 | "progress": { 68 | "type": "string", 69 | "description": "任务处理中调用处理器" 70 | } 71 | }, 72 | "additionalProperties": false, 73 | "description": "事件处理" 74 | }, 75 | "$schema": { 76 | "type": "string" 77 | } 78 | }, 79 | "required": [ 80 | "name", 81 | "process", 82 | "event" 83 | ], 84 | "additionalProperties": false, 85 | "description": "并发任务" 86 | } 87 | } 88 | } -------------------------------------------------------------------------------- /json-schemas/0.10.3/widget.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$ref": "#/definitions/YaoCustomWidget.Widget", 4 | "definitions": { 5 | "YaoCustomWidget.Widget": { 6 | "type": "object", 7 | "properties": { 8 | "version": { 9 | "type": "string", 10 | "description": "版本【管理字段】" 11 | }, 12 | "decription": { 13 | "type": "string", 14 | "description": "描述【管理字段】" 15 | }, 16 | "comment": { 17 | "type": "string", 18 | "description": "备注【管理字段】" 19 | }, 20 | "label": { 21 | "type": "string", 22 | "description": "Widget 名称" 23 | }, 24 | "description": { 25 | "type": "string", 26 | "description": "Widget 介绍" 27 | }, 28 | "root": { 29 | "type": "string", 30 | "description": "DSL 文件保存路径(相对于项目根目录)" 31 | }, 32 | "extension": { 33 | "type": "string", 34 | "description": "DSL 文件扩展名" 35 | }, 36 | "modules": { 37 | "type": "array", 38 | "items": { 39 | "type": "string" 40 | }, 41 | "description": "需要导出的模块。 在 export.js 中根据 DSL 描述,转换的 YAO 内建 widgets。 如 model, table 等。这些 widgets 与保存在项目目录中的 DSL 文件等效。" 42 | }, 43 | "$schema": { 44 | "type": "string" 45 | } 46 | }, 47 | "additionalProperties": false 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /json-schemas/0.10.3/ws_client.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$ref": "#/definitions/YaoWebSocket.Client", 4 | "definitions": { 5 | "YaoWebSocket.Client": { 6 | "type": "object", 7 | "properties": { 8 | "version": { 9 | "type": "string", 10 | "description": "版本【管理字段】" 11 | }, 12 | "decription": { 13 | "type": "string", 14 | "description": "描述【管理字段】" 15 | }, 16 | "comment": { 17 | "type": "string", 18 | "description": "备注【管理字段】" 19 | }, 20 | "name": { 21 | "type": "string", 22 | "description": "名称" 23 | }, 24 | "description": { 25 | "type": "string", 26 | "description": "描述" 27 | }, 28 | "url": { 29 | "type": "string", 30 | "description": "地址" 31 | }, 32 | "protocols": { 33 | "type": "array", 34 | "items": { 35 | "type": "string" 36 | }, 37 | "description": "协议" 38 | }, 39 | "guard": { 40 | "type": "string" 41 | }, 42 | "buffer": { 43 | "$ref": "#/definitions/YaoWebSocket.BufferSize", 44 | "description": "缓存设置" 45 | }, 46 | "timeout": { 47 | "type": "number", 48 | "description": "超时设置(秒),默认5" 49 | }, 50 | "ping": { 51 | "type": "number", 52 | "description": "ping超时(秒),默认2592000" 53 | }, 54 | "keep": { 55 | "type": "number", 56 | "description": "-1 not keep alive, 0 keep alive always, keep alive n seconds." 57 | }, 58 | "attempt_after": { 59 | "type": "number", 60 | "description": "多久时间后多试连接(秒),默认50" 61 | }, 62 | "attempts": { 63 | "type": "number", 64 | "description": "max times try to reconnect server when connection break (client mode only)" 65 | }, 66 | "timestamp": { 67 | "type": "number", 68 | "description": "时间戳" 69 | }, 70 | "ip": { 71 | "type": "string", 72 | "description": "ip地址" 73 | }, 74 | "port": { 75 | "type": "number", 76 | "description": "端口号" 77 | }, 78 | "event": { 79 | "$ref": "#/definitions/YaoWebSocket.WebSocketEvent", 80 | "description": "ws事件处理" 81 | }, 82 | "$schema": { 83 | "type": "string" 84 | } 85 | }, 86 | "additionalProperties": false 87 | }, 88 | "YaoWebSocket.BufferSize": { 89 | "type": "object", 90 | "properties": { 91 | "read": { 92 | "type": "number", 93 | "description": "读取缓存区大小(大小),默认1024" 94 | }, 95 | "write": { 96 | "type": "number", 97 | "description": "写入缓存区大小(字节),默认1024" 98 | } 99 | }, 100 | "additionalProperties": false 101 | }, 102 | "YaoWebSocket.WebSocketEvent": { 103 | "type": "object", 104 | "properties": { 105 | "data": { 106 | "type": "string", 107 | "description": "ws数据连接回调处理器" 108 | }, 109 | "error": { 110 | "type": "string", 111 | "description": "ws连接错误时回调处理器" 112 | }, 113 | "closed": { 114 | "type": "string", 115 | "description": "ws连接关闭时回调处理器" 116 | }, 117 | "connected": { 118 | "type": "string", 119 | "description": "ws连接后回调处理器" 120 | } 121 | }, 122 | "additionalProperties": false, 123 | "description": "客户端事件处理" 124 | } 125 | } 126 | } -------------------------------------------------------------------------------- /json-schemas/0.10.3/ws_server.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$ref": "#/definitions/YaoWebSocket.Server", 4 | "definitions": { 5 | "YaoWebSocket.Server": { 6 | "type": "object", 7 | "properties": { 8 | "name": { 9 | "type": "string", 10 | "description": "名称" 11 | }, 12 | "description": { 13 | "type": "string", 14 | "description": "描述" 15 | }, 16 | "version": { 17 | "type": "string", 18 | "description": "版本" 19 | }, 20 | "protocols": { 21 | "type": "array", 22 | "items": { 23 | "type": "string" 24 | }, 25 | "description": "ws协议" 26 | }, 27 | "guard": { 28 | "type": "string" 29 | }, 30 | "buffer": { 31 | "$ref": "#/definitions/YaoWebSocket.BufferSize", 32 | "description": "接收的缓存区大小,按字节算" 33 | }, 34 | "limit": { 35 | "$ref": "#/definitions/YaoWebSocket.Limit", 36 | "description": "限制" 37 | }, 38 | "timeout": { 39 | "type": "number", 40 | "description": "ws连接超时时间(秒),默认5秒" 41 | }, 42 | "process": { 43 | "type": "string", 44 | "description": "ws消息处理器" 45 | }, 46 | "$schema": { 47 | "type": "string" 48 | } 49 | }, 50 | "additionalProperties": false 51 | }, 52 | "YaoWebSocket.BufferSize": { 53 | "type": "object", 54 | "properties": { 55 | "read": { 56 | "type": "number", 57 | "description": "读取缓存区大小(大小),默认1024" 58 | }, 59 | "write": { 60 | "type": "number", 61 | "description": "写入缓存区大小(字节),默认1024" 62 | } 63 | }, 64 | "additionalProperties": false 65 | }, 66 | "YaoWebSocket.Limit": { 67 | "type": "object", 68 | "properties": { 69 | "write-wait": { 70 | "type": "number", 71 | "description": "写等待(秒),默认10" 72 | }, 73 | "pong-wait": { 74 | "type": "number", 75 | "description": "回应等待(秒),默认60" 76 | }, 77 | "max-message": { 78 | "type": "number", 79 | "description": "最大消息大小限制,单位字节,默认1024" 80 | } 81 | }, 82 | "additionalProperties": false 83 | } 84 | } 85 | } -------------------------------------------------------------------------------- /json-schemas/0.10.4/api_http.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$ref": "#/definitions/YaoHttp.HttpDSL", 4 | "definitions": { 5 | "YaoHttp.HttpDSL": { 6 | "type": "object", 7 | "properties": { 8 | "version": { 9 | "type": "string", 10 | "description": "版本【管理字段】" 11 | }, 12 | "decription": { 13 | "type": "string", 14 | "description": "描述【管理字段】" 15 | }, 16 | "comment": { 17 | "type": "string", 18 | "description": "备注【管理字段】" 19 | }, 20 | "name": { 21 | "type": "string", 22 | "description": "API 呈现名称" 23 | }, 24 | "description": { 25 | "type": "string", 26 | "description": "描述" 27 | }, 28 | "group": { 29 | "type": "string", 30 | "description": "API 分组名称,访问时作为 API 路由前缀目录。 `/api//`" 31 | }, 32 | "guard": { 33 | "type": "string", 34 | "description": "API 全局中间件,多个用 \",\" 分割。除特别声明,组内所有 API 都将使用全局中间件\n\n常用bearer-jwt" 35 | }, 36 | "paths": { 37 | "type": "array", 38 | "items": { 39 | "$ref": "#/definitions/YaoHttp.Path" 40 | }, 41 | "description": "API 列表。具体查看 `Object Path` 数据结构" 42 | }, 43 | "$schema": { 44 | "type": "string" 45 | } 46 | }, 47 | "additionalProperties": false 48 | }, 49 | "YaoHttp.Path": { 50 | "type": "object", 51 | "properties": { 52 | "label": { 53 | "type": "string", 54 | "description": "标签" 55 | }, 56 | "description": { 57 | "type": "string", 58 | "description": "描述" 59 | }, 60 | "path": { 61 | "type": "string", 62 | "description": "API 路由名称。完整路由地址为 `/api//` ,变量使用 `:` 声明,如 `/api/user/find/:id`, 可以使用 `$param.id` 访问路由请求参数" 63 | }, 64 | "method": { 65 | "type": "string", 66 | "description": "请求类型。许可值 `GET`、`POST`、`PUT`、`DELETE`、 `HEAD`、`OPTIONS`、`Any`. 其中 `Any` 将响应任何类型的请求" 67 | }, 68 | "process": { 69 | "type": "string", 70 | "description": "调用处理器 `process`" 71 | }, 72 | "guard": { 73 | "type": "string", 74 | "description": "API 中间件. 如不设置,默认使用全局中间件。如不希望使用全局中间件,可将数值设置为 `-` 。|\n\n常用bearer-jwt" 75 | }, 76 | "in": { 77 | "type": "array", 78 | "items": { 79 | "type": "string" 80 | }, 81 | "description": "请求参数表,将作为 `process` 的输入参数(`args`)。可以引用传入参数,可以为空数组 [查看输入参数](#输入参数)" 82 | }, 83 | "out": { 84 | "$ref": "#/definitions/YaoHttp.Out", 85 | "description": "请求响应结果定义。 具体查看 `Object Out` 数据结构" 86 | } 87 | }, 88 | "required": [ 89 | "path", 90 | "method", 91 | "process" 92 | ], 93 | "additionalProperties": false 94 | }, 95 | "YaoHttp.Out": { 96 | "type": "object", 97 | "properties": { 98 | "status": { 99 | "type": "number", 100 | "description": "请求响应状态码" 101 | }, 102 | "type": { 103 | "type": "string", 104 | "description": "请求响应 Content Type" 105 | }, 106 | "body": { 107 | "description": "请求响应内容" 108 | }, 109 | "headers": { 110 | "type": "object", 111 | "additionalProperties": { 112 | "type": "string" 113 | }, 114 | "description": "请求响应 Headers" 115 | } 116 | }, 117 | "required": [ 118 | "status" 119 | ], 120 | "additionalProperties": false 121 | } 122 | } 123 | } -------------------------------------------------------------------------------- /json-schemas/0.10.4/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$ref": "#/definitions/YaoApp.AppDSL", 4 | "definitions": { 5 | "YaoApp.AppDSL": { 6 | "type": "object", 7 | "properties": { 8 | "version": { 9 | "type": "string", 10 | "description": "版本【管理字段】" 11 | }, 12 | "decription": { 13 | "type": "string", 14 | "description": "描述【管理字段】" 15 | }, 16 | "comment": { 17 | "type": "string", 18 | "description": "备注【管理字段】" 19 | }, 20 | "xgen": { 21 | "type": "string", 22 | "description": "XGen 界面引擎版本, 推荐使用 `1.0` 版,旧版已停止维护" 23 | }, 24 | "name": { 25 | "type": "string", 26 | "description": "应用名称, 支持多语言" 27 | }, 28 | "short": { 29 | "type": "string", 30 | "description": "应用简称, 支持多语言。" 31 | }, 32 | "description": { 33 | "type": "string", 34 | "description": "应用介绍, 支持多语言。" 35 | }, 36 | "theme": { 37 | "type": "string", 38 | "enum": [ 39 | "light", 40 | "dark" 41 | ], 42 | "description": "默认主题" 43 | }, 44 | "lang": { 45 | "type": "string", 46 | "description": "配置xgen语言 zh-cn/en-us" 47 | }, 48 | "sid": { 49 | "type": "string" 50 | }, 51 | "logo": { 52 | "type": "string", 53 | "description": "logo文件地址,根目录/public" 54 | }, 55 | "favicon": { 56 | "type": "string", 57 | "description": "网站favicon文件地址,根目录/public" 58 | }, 59 | "menu": { 60 | "$ref": "#/definitions/YaoApp.MenuDSL", 61 | "description": "管理后台菜单读取处理器" 62 | }, 63 | "adminRoot": { 64 | "type": "string", 65 | "description": "管理后台路由前缀,默认为/yao" 66 | }, 67 | "optional": { 68 | "$ref": "#/definitions/YaoApp.OptionalDSL", 69 | "description": "应用可选配置项" 70 | }, 71 | "setting": { 72 | "type": "string", 73 | "description": "xgen获取配置的处理器,默认是yao.app.Xgen" 74 | }, 75 | "setup": { 76 | "type": "string", 77 | "description": "应用首次安装后运行的处理器名称, 一般可以用来建立初始化数据;处理器第一个参数为应用配置信息。支持使用 `studio` 命名空间,调用 studio 脚本函数" 78 | }, 79 | "$schema": { 80 | "type": "string" 81 | } 82 | }, 83 | "additionalProperties": false 84 | }, 85 | "YaoApp.MenuDSL": { 86 | "type": "object", 87 | "properties": { 88 | "process": { 89 | "type": "string", 90 | "description": "处理器名称" 91 | }, 92 | "args": { 93 | "type": "array", 94 | "items": { 95 | "type": "string" 96 | }, 97 | "description": "处理器参数表" 98 | } 99 | }, 100 | "additionalProperties": false 101 | }, 102 | "YaoApp.OptionalDSL": { 103 | "type": "object", 104 | "properties": { 105 | "hideNotification": { 106 | "type": "boolean", 107 | "description": "隐藏系统通知面板。 **字段名大小写敏感**" 108 | }, 109 | "hideSetting": { 110 | "type": "boolean", 111 | "description": "隐藏导航栏下方配置菜单。 **字段名大小写敏感**" 112 | }, 113 | "remoteCache": { 114 | "type": "boolean", 115 | "description": "在xgen中缓存远程select控件选项" 116 | }, 117 | "neo": { 118 | "type": "object", 119 | "properties": { 120 | "api": { 121 | "type": "string", 122 | "description": "neo chat api" 123 | } 124 | }, 125 | "required": [ 126 | "api" 127 | ], 128 | "additionalProperties": false, 129 | "description": "neo config, for chatgpt service" 130 | } 131 | } 132 | } 133 | } 134 | } -------------------------------------------------------------------------------- /json-schemas/0.10.4/importer.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$ref": "#/definitions/YaoImport.Importer", 4 | "definitions": { 5 | "YaoImport.Importer": { 6 | "type": "object", 7 | "properties": { 8 | "version": { 9 | "type": "string", 10 | "description": "版本【管理字段】" 11 | }, 12 | "decription": { 13 | "type": "string", 14 | "description": "描述【管理字段】" 15 | }, 16 | "comment": { 17 | "type": "string", 18 | "description": "备注【管理字段】" 19 | }, 20 | "title": { 21 | "type": "string", 22 | "description": "导入名称" 23 | }, 24 | "process": { 25 | "type": "string", 26 | "description": "处理器名称" 27 | }, 28 | "output": { 29 | "type": "string", 30 | "description": "The process import output" 31 | }, 32 | "columns": { 33 | "type": "array", 34 | "items": { 35 | "$ref": "#/definitions/YaoImport.Column" 36 | }, 37 | "description": "字段列表" 38 | }, 39 | "option": { 40 | "$ref": "#/definitions/YaoImport.Option", 41 | "description": "导入配置项" 42 | }, 43 | "rules": { 44 | "type": "object", 45 | "additionalProperties": { 46 | "type": "string" 47 | }, 48 | "description": "许可导入规则" 49 | }, 50 | "$schema": { 51 | "type": "string" 52 | } 53 | }, 54 | "required": [ 55 | "process", 56 | "columns" 57 | ], 58 | "additionalProperties": false, 59 | "description": "数据导入器" 60 | }, 61 | "YaoImport.Column": { 62 | "type": "object", 63 | "properties": { 64 | "label": { 65 | "type": "string", 66 | "description": "字段标签" 67 | }, 68 | "name": { 69 | "type": "string", 70 | "description": "字段名称" 71 | }, 72 | "field": { 73 | "type": "string", 74 | "description": "字段名称(原始值),不需要配置" 75 | }, 76 | "match": { 77 | "type": "array", 78 | "items": { 79 | "type": "string" 80 | }, 81 | "description": "匹配建议" 82 | }, 83 | "rules": { 84 | "type": "array", 85 | "items": { 86 | "type": "string" 87 | }, 88 | "description": "清洗规则定义" 89 | }, 90 | "nullable": { 91 | "type": "boolean", 92 | "description": "是否可以为空" 93 | }, 94 | "primary": { 95 | "type": "boolean", 96 | "description": "是否为主键" 97 | } 98 | }, 99 | "required": [ 100 | "label", 101 | "name" 102 | ], 103 | "additionalProperties": false, 104 | "description": "导入字段定义" 105 | }, 106 | "YaoImport.Option": { 107 | "type": "object", 108 | "properties": { 109 | "useTemplate": { 110 | "type": "boolean", 111 | "description": "使用已匹配过的模板" 112 | }, 113 | "templateLink": { 114 | "type": "string", 115 | "description": "默认数据模板链接" 116 | }, 117 | "chunkSize": { 118 | "type": "number", 119 | "description": "每次处理记录数量" 120 | }, 121 | "mappingPreview": { 122 | "type": "string", 123 | "description": "显示字段映射界面方式 auto 匹配模板失败显示, always 一直显示, never 不显示" 124 | }, 125 | "dataPreview": { 126 | "type": "string", 127 | "description": "数据预览界面方式 auto 有异常数据时显示, always 一直显示, never 不显示" 128 | } 129 | }, 130 | "additionalProperties": false, 131 | "description": "导入配置项定" 132 | } 133 | } 134 | } -------------------------------------------------------------------------------- /json-schemas/0.10.4/login.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$ref": "#/definitions/YaoLogin.LoginDSL", 4 | "definitions": { 5 | "YaoLogin.LoginDSL": { 6 | "type": "object", 7 | "properties": { 8 | "version": { 9 | "type": "string", 10 | "description": "版本【管理字段】" 11 | }, 12 | "decription": { 13 | "type": "string", 14 | "description": "描述【管理字段】" 15 | }, 16 | "comment": { 17 | "type": "string", 18 | "description": "备注【管理字段】" 19 | }, 20 | "name": { 21 | "type": "string", 22 | "description": "登录界面名称, 支持多语言" 23 | }, 24 | "action": { 25 | "$ref": "#/definitions/YaoLogin.ActionDSL", 26 | "description": "自定义用户登录逻辑处理器,默认是yao.login.Admin" 27 | }, 28 | "layout": { 29 | "$ref": "#/definitions/YaoLogin.LayoutDSL", 30 | "description": "页面布局定义。设置登录界面封面、登录后跳转路由地址等" 31 | }, 32 | "thirdPartyLogin": { 33 | "type": "array", 34 | "items": { 35 | "$ref": "#/definitions/YaoLogin.ThirdPartyLoginDSL" 36 | }, 37 | "description": "第三方登录" 38 | }, 39 | "$schema": { 40 | "type": "string" 41 | } 42 | }, 43 | "additionalProperties": false 44 | }, 45 | "YaoLogin.ActionDSL": { 46 | "type": "object", 47 | "properties": { 48 | "process": { 49 | "type": "string", 50 | "description": "用户登录处理逻辑" 51 | }, 52 | "args": { 53 | "type": "array", 54 | "items": {}, 55 | "description": "登录处理器参数,参考http 接口的传参数,可使用:payload引用传入参数" 56 | } 57 | }, 58 | "additionalProperties": false 59 | }, 60 | "YaoLogin.LayoutDSL": { 61 | "type": "object", 62 | "properties": { 63 | "entry": { 64 | "type": "string", 65 | "description": "成功登录后,转向此地址。**注意: 不含管理后台路由前缀**" 66 | }, 67 | "captcha": { 68 | "type": "string", 69 | "description": "自定义动态认证码生成处理器,默认是yao.utils.Captcha" 70 | }, 71 | "cover": { 72 | "type": "string", 73 | "description": "登录界面封面图片, 图片相对地址。可将图片放到应用公开目录 `public` ,例如: `/data/app/public/images/cover.png`, 填写的地址为 `/images/cover.png`" 74 | }, 75 | "slogan": { 76 | "type": "string", 77 | "description": "登录界面广告语,支持多语言" 78 | }, 79 | "site": { 80 | "type": "string", 81 | "description": "登录界面封面图片下方链接地址" 82 | } 83 | }, 84 | "additionalProperties": false 85 | }, 86 | "YaoLogin.ThirdPartyLoginDSL": { 87 | "type": "object", 88 | "properties": { 89 | "title": { 90 | "type": "string", 91 | "description": "按钮标题" 92 | }, 93 | "href": { 94 | "type": "string", 95 | "description": "第三方登录跳转地址" 96 | }, 97 | "icon": { 98 | "type": "string", 99 | "description": "按钮前缀图标" 100 | }, 101 | "blank": { 102 | "type": "boolean", 103 | "description": "是否在浏览器打开新标签" 104 | } 105 | }, 106 | "additionalProperties": false 107 | } 108 | } 109 | } -------------------------------------------------------------------------------- /json-schemas/0.10.4/pipe.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$ref": "#/definitions/YaoPipe.Pipe", 4 | "definitions": { 5 | "YaoPipe.Pipe": { 6 | "type": "object", 7 | "properties": { 8 | "name": { 9 | "type": "string", 10 | "description": "名称" 11 | }, 12 | "nodes": { 13 | "type": "array", 14 | "items": { 15 | "$ref": "#/definitions/YaoPipe.Node" 16 | }, 17 | "description": "节点配置" 18 | }, 19 | "label": { 20 | "type": "string", 21 | "description": "标签说明" 22 | }, 23 | "hooks": { 24 | "$ref": "#/definitions/YaoPipe.Hooks", 25 | "description": "钩子设置" 26 | }, 27 | "output": { 28 | "description": "输出" 29 | }, 30 | "input": { 31 | "$ref": "#/definitions/YaoPipe.Input", 32 | "description": "输入" 33 | }, 34 | "whitelist": { 35 | "$ref": "#/definitions/YaoPipe.Whitelist", 36 | "description": "处理器白名单,只有在白名单中的处理器才会被调用" 37 | }, 38 | "goto": { 39 | "type": "string", 40 | "description": "节点跳转" 41 | } 42 | }, 43 | "required": [ 44 | "name", 45 | "nodes" 46 | ], 47 | "additionalProperties": false 48 | }, 49 | "YaoPipe.Node": { 50 | "type": "object", 51 | "properties": { 52 | "name": { 53 | "type": "string", 54 | "description": "节点名称,同时作为节点引用的依据" 55 | }, 56 | "type": { 57 | "type": "string", 58 | "enum": [ 59 | "user-input", 60 | "ai", 61 | "process", 62 | "switch", 63 | "request" 64 | ], 65 | "description": "内部节点类型,不需要直接设置,优先级:process > request > ai > user-input > switch" 66 | }, 67 | "label": { 68 | "type": "string", 69 | "description": "标签说明" 70 | }, 71 | "process": { 72 | "$ref": "#/definitions/YaoPipe.YaoProcess", 73 | "description": "处理器,设置处理器后,节点类型自动设置成process" 74 | }, 75 | "prompts": { 76 | "type": "array", 77 | "items": { 78 | "$ref": "#/definitions/YaoPipe.Prompt" 79 | }, 80 | "description": "ai提示词,设置后节点类型自动设置成ai" 81 | }, 82 | "model": { 83 | "type": "string", 84 | "description": "ai模型,默认是 gpt-3.5-turbo" 85 | }, 86 | "options": { 87 | "type": "object", 88 | "description": "ai请求时的payload选项" 89 | }, 90 | "request": { 91 | "$ref": "#/definitions/YaoPipe.Request", 92 | "description": "请求" 93 | }, 94 | "ui": { 95 | "type": "string", 96 | "description": "接受用户输入时的客户端cli | web | app | wxapp" 97 | }, 98 | "autofill": { 99 | "$ref": "#/definitions/YaoPipe.AutoFill", 100 | "description": "自动填写" 101 | }, 102 | "case": { 103 | "type": "object", 104 | "additionalProperties": { 105 | "$ref": "#/definitions/YaoPipe.Pipe" 106 | }, 107 | "description": "当是switch节点时,进行条件判断,只有一个条件生效" 108 | }, 109 | "input": { 110 | "$ref": "#/definitions/YaoPipe.Input", 111 | "description": "节点输入参数" 112 | }, 113 | "output": { 114 | "description": "节点输出参数" 115 | }, 116 | "goto": { 117 | "type": "string", 118 | "description": "跳转表达式,满足一定条件后跳转到指定的节点" 119 | } 120 | }, 121 | "required": [ 122 | "name" 123 | ], 124 | "additionalProperties": false, 125 | "description": "Pipe节点配置" 126 | }, 127 | "YaoPipe.YaoProcess": { 128 | "type": "object", 129 | "properties": { 130 | "name": { 131 | "type": "string" 132 | }, 133 | "args": { 134 | "$ref": "#/definitions/YaoPipe.Args" 135 | } 136 | }, 137 | "required": [ 138 | "name" 139 | ], 140 | "additionalProperties": false 141 | }, 142 | "YaoPipe.Args": { 143 | "type": "array", 144 | "items": {} 145 | }, 146 | "YaoPipe.Prompt": { 147 | "type": "object", 148 | "properties": { 149 | "role": { 150 | "type": "string" 151 | }, 152 | "content": { 153 | "type": "string" 154 | } 155 | }, 156 | "required": [ 157 | "content" 158 | ], 159 | "additionalProperties": false 160 | }, 161 | "YaoPipe.Request": { 162 | "type": "object", 163 | "additionalProperties": false 164 | }, 165 | "YaoPipe.AutoFill": { 166 | "type": "object", 167 | "properties": { 168 | "value": { 169 | "description": "可以是表达式,解析后的值作为客户端命令的输入参数" 170 | }, 171 | "action": { 172 | "type": "string", 173 | "description": "自动处理,如果是exit,会自动的退出处理" 174 | } 175 | }, 176 | "required": [ 177 | "value" 178 | ], 179 | "additionalProperties": false 180 | }, 181 | "YaoPipe.Input": { 182 | "type": "array", 183 | "items": {} 184 | }, 185 | "YaoPipe.Hooks": { 186 | "type": "object", 187 | "properties": { 188 | "progress": { 189 | "type": "string" 190 | } 191 | }, 192 | "additionalProperties": false 193 | }, 194 | "YaoPipe.Whitelist": { 195 | "type": "object", 196 | "additionalProperties": { 197 | "type": "boolean" 198 | } 199 | } 200 | } 201 | } -------------------------------------------------------------------------------- /json-schemas/0.10.4/query_param.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$ref": "#/definitions/YaoQueryParam.QueryParam", 4 | "definitions": { 5 | "YaoQueryParam.QueryParam": { 6 | "type": "object", 7 | "properties": { 8 | "comment": { 9 | "type": "string", 10 | "description": "备注【管理字段】" 11 | }, 12 | "model": { 13 | "type": "string", 14 | "description": "模型名称" 15 | }, 16 | "table": { 17 | "type": "string", 18 | "description": "表格名称" 19 | }, 20 | "alias": { 21 | "type": "string", 22 | "description": "别名" 23 | }, 24 | "export": { 25 | "type": "string", 26 | "description": "导出数据时的前缀" 27 | }, 28 | "select": { 29 | "type": "array", 30 | "items": { 31 | "type": "string" 32 | }, 33 | "description": "选择字段清单" 34 | }, 35 | "wheres": { 36 | "type": "array", 37 | "items": { 38 | "$ref": "#/definitions/YaoQueryParam.QueryWhere" 39 | }, 40 | "description": "查询条件" 41 | }, 42 | "orders": { 43 | "type": "array", 44 | "items": { 45 | "$ref": "#/definitions/YaoQueryParam.QueryOrder" 46 | }, 47 | "description": "排序条件" 48 | }, 49 | "limit": { 50 | "type": "number", 51 | "description": "限制返回记录条目" 52 | }, 53 | "offset": { 54 | "type": "number", 55 | "description": "偏移量" 56 | }, 57 | "page": { 58 | "type": "number", 59 | "description": "当前页码" 60 | }, 61 | "pagesize": { 62 | "type": "number", 63 | "description": "每页显示记录数量" 64 | }, 65 | "withs": { 66 | "type": "object", 67 | "additionalProperties": { 68 | "$ref": "#/definitions/YaoQueryParam.QueryWith" 69 | }, 70 | "description": "读取关联模型" 71 | } 72 | }, 73 | "additionalProperties": false, 74 | "description": "QueryParam 数据查询器参数" 75 | }, 76 | "YaoQueryParam.QueryWhere": { 77 | "type": "object", 78 | "properties": { 79 | "rel": { 80 | "type": "string", 81 | "description": "如按关联模型的字段查询,则填写关联模型名称" 82 | }, 83 | "column": { 84 | "type": "string", 85 | "description": "字段名称" 86 | }, 87 | "value": { 88 | "description": "匹配数值" 89 | }, 90 | "method": { 91 | "type": "string", 92 | "description": "查询方法 `where`,`orwhere`, `wherein`, `orwherein`... 默认为 `where`,\n\n| 查询方法 | 说明 | | -------- | ------------------------------------- | | where | WHERE 字段 = 数值, WHERE 字段 >= 数值 | | orwhere | ... OR WHERE 字段 = 数值 |" 93 | }, 94 | "op": { 95 | "type": "string", 96 | "enum": [ 97 | "eq", 98 | "like", 99 | "match", 100 | "gt", 101 | "ge", 102 | "lt", 103 | "le", 104 | "null", 105 | "notnull", 106 | "in", 107 | "ne" 108 | ], 109 | "description": "匹配关系 `eq`,`like`,`in`,`gt` 等,默认为 `eq`\n\n| 匹配关系 | 说明 | | -------- | -------------------------------- | | eq | 默认值 等于 WHERE 字段 = 数值 | | like | 匹配 WHERE 字段 like 数值 | | match | 匹配 WHERE 字段 全文检索 | | gt | 大于 WHERE 字段 > 数值 | | ge | 大于等于 WHERE 字段 >= 数值 | | lt | 小于 WHERE 字段 < 数值 | | le | 小于等于 WHERE 字段 <= 数值 | | null | 为空 WHERE 字段 IS NULL | | notnull | 不为空 WHERE 字段 IS NOT NULL | | in | 列表包含 WHERE 字段 IN (数值...) | | ne | 不等于匹配值 |" 110 | }, 111 | "wheres": { 112 | "type": "array", 113 | "items": { 114 | "$ref": "#/definitions/YaoQueryParam.QueryWhere" 115 | }, 116 | "description": "分组查询" 117 | } 118 | }, 119 | "additionalProperties": false, 120 | "description": "QueryWhere Where 查询条件" 121 | }, 122 | "YaoQueryParam.QueryOrder": { 123 | "type": "object", 124 | "properties": { 125 | "rel": { 126 | "type": "string", 127 | "description": "如按关联模型的字段排序,则填写关联模型名称" 128 | }, 129 | "column": { 130 | "type": "string", 131 | "description": "字段名称" 132 | }, 133 | "option": { 134 | "type": "string", 135 | "enum": [ 136 | "desc", 137 | "asc" 138 | ], 139 | "description": "排序方式, `desc`, `asc`, 默认为 `asc`" 140 | } 141 | }, 142 | "required": [ 143 | "column" 144 | ], 145 | "additionalProperties": false, 146 | "description": "QueryOrder Order 查询排序" 147 | }, 148 | "YaoQueryParam.QueryWith": { 149 | "type": "object", 150 | "properties": { 151 | "name": { 152 | "type": "string" 153 | }, 154 | "query": { 155 | "$ref": "#/definitions/YaoQueryParam.QueryParam" 156 | } 157 | }, 158 | "additionalProperties": false, 159 | "description": "With relations 关联查询" 160 | } 161 | } 162 | } -------------------------------------------------------------------------------- /json-schemas/0.10.4/schedule.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$ref": "#/definitions/YaoSchedule.Schedule", 4 | "definitions": { 5 | "YaoSchedule.Schedule": { 6 | "type": "object", 7 | "properties": { 8 | "version": { 9 | "type": "string", 10 | "description": "版本【管理字段】" 11 | }, 12 | "decription": { 13 | "type": "string", 14 | "description": "描述【管理字段】" 15 | }, 16 | "comment": { 17 | "type": "string", 18 | "description": "备注【管理字段】" 19 | }, 20 | "name": { 21 | "type": "string", 22 | "description": "名称" 23 | }, 24 | "process": { 25 | "type": "string", 26 | "description": "处理器,处理器与task二选一" 27 | }, 28 | "schedule": { 29 | "type": "string", 30 | "description": "计划定时执行的时间,写法和 Linux 的 crontab 是一样的" 31 | }, 32 | "task": { 33 | "type": "string", 34 | "description": "任务名称,使用task.json定义的任务" 35 | }, 36 | "args": { 37 | "type": "array", 38 | "items": {}, 39 | "description": "处理器参数" 40 | }, 41 | "$schema": { 42 | "type": "string" 43 | } 44 | }, 45 | "required": [ 46 | "name", 47 | "schedule" 48 | ], 49 | "additionalProperties": false 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /json-schemas/0.10.4/service.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$ref": "#/definitions/YaoService.Service", 4 | "definitions": { 5 | "YaoService.Service": { 6 | "type": "object", 7 | "properties": { 8 | "version": { 9 | "type": "string", 10 | "description": "版本【管理字段】" 11 | }, 12 | "decription": { 13 | "type": "string", 14 | "description": "描述【管理字段】" 15 | }, 16 | "comment": { 17 | "type": "string", 18 | "description": "备注【管理字段】" 19 | }, 20 | "name": { 21 | "type": "string", 22 | "description": "名称" 23 | }, 24 | "process": { 25 | "type": "string", 26 | "description": "处理器,运行目录是环境变量YAO_ROOT,或是使用当前目录" 27 | }, 28 | "command": { 29 | "type": "string", 30 | "description": "作业运行命令,默认是`yao run `,使用yao执行脚本等,可替换成其它的系统命令" 31 | }, 32 | "requires": { 33 | "type": "array", 34 | "items": { 35 | "type": "string" 36 | }, 37 | "description": "前置作业" 38 | }, 39 | "after": { 40 | "type": "array", 41 | "items": { 42 | "type": "string" 43 | }, 44 | "description": "前置作业" 45 | }, 46 | "restart": { 47 | "type": "string", 48 | "description": "重启条件,默认on-failure" 49 | }, 50 | "workdir": { 51 | "type": "string", 52 | "description": "工作目录" 53 | }, 54 | "args": { 55 | "type": "array", 56 | "items": {}, 57 | "description": "处理器运行的参数" 58 | }, 59 | "error": { 60 | "type": "string", 61 | "description": "错误日志文件路径,默认/var/log/yao-{{.Name}}-error.log" 62 | }, 63 | "output": { 64 | "type": "string", 65 | "description": "结果输出文件路径,默认/var/log/yao-{{.Name}}.log" 66 | }, 67 | "user": { 68 | "type": "string", 69 | "description": "运行用户,默认User=root" 70 | }, 71 | "group": { 72 | "type": "string", 73 | "description": "运行用户组,Group=root" 74 | }, 75 | "$schema": { 76 | "type": "string" 77 | } 78 | }, 79 | "additionalProperties": false, 80 | "description": "后台服务定义,不支持windows操作系统" 81 | } 82 | } 83 | } -------------------------------------------------------------------------------- /json-schemas/0.10.4/socket.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$ref": "#/definitions/YaoSocket.Socket", 4 | "definitions": { 5 | "YaoSocket.Socket": { 6 | "type": "object", 7 | "properties": { 8 | "version": { 9 | "type": "string", 10 | "description": "版本【管理字段】" 11 | }, 12 | "decription": { 13 | "type": "string", 14 | "description": "描述【管理字段】" 15 | }, 16 | "comment": { 17 | "type": "string", 18 | "description": "备注【管理字段】" 19 | }, 20 | "name": { 21 | "type": "string" 22 | }, 23 | "mode": { 24 | "type": "string", 25 | "enum": [ 26 | "server", 27 | "client" 28 | ] 29 | }, 30 | "description": { 31 | "type": "string" 32 | }, 33 | "protocol": { 34 | "type": "string" 35 | }, 36 | "host": { 37 | "type": "string" 38 | }, 39 | "port": { 40 | "type": "string" 41 | }, 42 | "event": { 43 | "$ref": "#/definitions/YaoSocket.SocketEvent" 44 | }, 45 | "timeout": { 46 | "type": "number" 47 | }, 48 | "buffer": { 49 | "type": "number" 50 | }, 51 | "keep": { 52 | "type": "number" 53 | }, 54 | "process": { 55 | "type": "string" 56 | }, 57 | "attempt_after": { 58 | "type": "number" 59 | }, 60 | "attempts": { 61 | "type": "number" 62 | }, 63 | "$schema": { 64 | "type": "string" 65 | } 66 | }, 67 | "required": [ 68 | "name" 69 | ], 70 | "additionalProperties": false 71 | }, 72 | "YaoSocket.SocketEvent": { 73 | "type": "object", 74 | "properties": { 75 | "data": { 76 | "type": "string" 77 | }, 78 | "error": { 79 | "type": "string" 80 | }, 81 | "closed": { 82 | "type": "string" 83 | }, 84 | "connected": { 85 | "type": "string" 86 | } 87 | }, 88 | "additionalProperties": false 89 | } 90 | } 91 | } -------------------------------------------------------------------------------- /json-schemas/0.10.4/store.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$ref": "#/definitions/YaoStore.Store", 4 | "definitions": { 5 | "YaoStore.Store": { 6 | "type": "object", 7 | "properties": { 8 | "version": { 9 | "type": "string", 10 | "description": "版本【管理字段】" 11 | }, 12 | "decription": { 13 | "type": "string", 14 | "description": "描述【管理字段】" 15 | }, 16 | "comment": { 17 | "type": "string", 18 | "description": "备注【管理字段】" 19 | }, 20 | "name": { 21 | "type": "string", 22 | "description": "名称" 23 | }, 24 | "description": { 25 | "type": "string", 26 | "description": "描述" 27 | }, 28 | "connector": { 29 | "type": "string", 30 | "description": "绑定连接器名称(连接器) Yao v0.10.2+" 31 | }, 32 | "type": { 33 | "type": "string", 34 | "description": "类型 `lru` LRU 缓存 (connector 为空时有效)" 35 | }, 36 | "option": { 37 | "type": "object", 38 | "description": "配置项 `{\"size\":10240}` type 为 `lru` 时有效, size 为 LRU 缓存大小" 39 | }, 40 | "$schema": { 41 | "type": "string" 42 | } 43 | }, 44 | "required": [ 45 | "name" 46 | ], 47 | "additionalProperties": false 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /json-schemas/0.10.4/task.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$ref": "#/definitions/YaoTask.Task", 4 | "definitions": { 5 | "YaoTask.Task": { 6 | "type": "object", 7 | "properties": { 8 | "version": { 9 | "type": "string", 10 | "description": "版本【管理字段】" 11 | }, 12 | "decription": { 13 | "type": "string", 14 | "description": "描述【管理字段】" 15 | }, 16 | "comment": { 17 | "type": "string", 18 | "description": "备注【管理字段】" 19 | }, 20 | "name": { 21 | "type": "string", 22 | "description": "任务名称" 23 | }, 24 | "process": { 25 | "type": "string", 26 | "description": "该task绑定的处理器,必须配置" 27 | }, 28 | "size": { 29 | "type": "number", 30 | "description": "作业对列大小,默认1024" 31 | }, 32 | "worker_nums": { 33 | "type": "number", 34 | "description": "指定进程数,默认是1" 35 | }, 36 | "attempt_after": { 37 | "type": "number", 38 | "description": "重试间隔" 39 | }, 40 | "attempts": { 41 | "type": "number", 42 | "description": "失败重试次数" 43 | }, 44 | "timeout": { 45 | "type": "number", 46 | "description": "超时时间,秒钟,默认300" 47 | }, 48 | "event": { 49 | "type": "object", 50 | "properties": { 51 | "next": { 52 | "type": "string", 53 | "description": "生成任务唯一id的回调处理器" 54 | }, 55 | "add": { 56 | "type": "string", 57 | "description": "添加任务时触发的处理器" 58 | }, 59 | "success": { 60 | "type": "string", 61 | "description": "添加任务时触发的处理器" 62 | }, 63 | "error": { 64 | "type": "string", 65 | "description": "任务失败后触发处理器" 66 | }, 67 | "progress": { 68 | "type": "string", 69 | "description": "任务处理中调用处理器" 70 | } 71 | }, 72 | "additionalProperties": false, 73 | "description": "事件处理" 74 | }, 75 | "$schema": { 76 | "type": "string" 77 | } 78 | }, 79 | "required": [ 80 | "name", 81 | "process", 82 | "event" 83 | ], 84 | "additionalProperties": false, 85 | "description": "并发任务" 86 | } 87 | } 88 | } -------------------------------------------------------------------------------- /json-schemas/0.10.4/widget.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$ref": "#/definitions/YaoCustomWidget.Widget", 4 | "definitions": { 5 | "YaoCustomWidget.Widget": { 6 | "type": "object", 7 | "properties": { 8 | "version": { 9 | "type": "string", 10 | "description": "版本【管理字段】" 11 | }, 12 | "decription": { 13 | "type": "string", 14 | "description": "描述【管理字段】" 15 | }, 16 | "comment": { 17 | "type": "string", 18 | "description": "备注【管理字段】" 19 | }, 20 | "label": { 21 | "type": "string", 22 | "description": "Widget 名称" 23 | }, 24 | "description": { 25 | "type": "string", 26 | "description": "Widget 介绍" 27 | }, 28 | "root": { 29 | "type": "string", 30 | "description": "DSL 文件保存路径(相对于项目根目录)" 31 | }, 32 | "extension": { 33 | "type": "string", 34 | "description": "DSL 文件扩展名" 35 | }, 36 | "modules": { 37 | "type": "array", 38 | "items": { 39 | "type": "string" 40 | }, 41 | "description": "需要导出的模块。 在 export.js 中根据 DSL 描述,转换的 YAO 内建 widgets。 如 model, table 等。这些 widgets 与保存在项目目录中的 DSL 文件等效。" 42 | }, 43 | "$schema": { 44 | "type": "string" 45 | } 46 | }, 47 | "additionalProperties": false 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /json-schemas/0.10.4/ws_client.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$ref": "#/definitions/YaoWebSocket.Client", 4 | "definitions": { 5 | "YaoWebSocket.Client": { 6 | "type": "object", 7 | "properties": { 8 | "version": { 9 | "type": "string", 10 | "description": "版本【管理字段】" 11 | }, 12 | "decription": { 13 | "type": "string", 14 | "description": "描述【管理字段】" 15 | }, 16 | "comment": { 17 | "type": "string", 18 | "description": "备注【管理字段】" 19 | }, 20 | "name": { 21 | "type": "string", 22 | "description": "名称" 23 | }, 24 | "description": { 25 | "type": "string", 26 | "description": "描述" 27 | }, 28 | "url": { 29 | "type": "string", 30 | "description": "地址" 31 | }, 32 | "protocols": { 33 | "type": "array", 34 | "items": { 35 | "type": "string" 36 | }, 37 | "description": "协议" 38 | }, 39 | "guard": { 40 | "type": "string" 41 | }, 42 | "buffer": { 43 | "$ref": "#/definitions/YaoWebSocket.BufferSize", 44 | "description": "缓存设置" 45 | }, 46 | "timeout": { 47 | "type": "number", 48 | "description": "超时设置(秒),默认5" 49 | }, 50 | "ping": { 51 | "type": "number", 52 | "description": "ping超时(秒),默认2592000" 53 | }, 54 | "keep": { 55 | "type": "number", 56 | "description": "-1 not keep alive, 0 keep alive always, keep alive n seconds." 57 | }, 58 | "attempt_after": { 59 | "type": "number", 60 | "description": "多久时间后多试连接(秒),默认50" 61 | }, 62 | "attempts": { 63 | "type": "number", 64 | "description": "max times try to reconnect server when connection break (client mode only)" 65 | }, 66 | "timestamp": { 67 | "type": "number", 68 | "description": "时间戳" 69 | }, 70 | "ip": { 71 | "type": "string", 72 | "description": "ip地址" 73 | }, 74 | "port": { 75 | "type": "number", 76 | "description": "端口号" 77 | }, 78 | "event": { 79 | "$ref": "#/definitions/YaoWebSocket.WebSocketEvent", 80 | "description": "ws事件处理" 81 | }, 82 | "$schema": { 83 | "type": "string" 84 | } 85 | }, 86 | "additionalProperties": false 87 | }, 88 | "YaoWebSocket.BufferSize": { 89 | "type": "object", 90 | "properties": { 91 | "read": { 92 | "type": "number", 93 | "description": "读取缓存区大小(大小),默认1024" 94 | }, 95 | "write": { 96 | "type": "number", 97 | "description": "写入缓存区大小(字节),默认1024" 98 | } 99 | }, 100 | "additionalProperties": false 101 | }, 102 | "YaoWebSocket.WebSocketEvent": { 103 | "type": "object", 104 | "properties": { 105 | "data": { 106 | "type": "string", 107 | "description": "ws数据连接回调处理器" 108 | }, 109 | "error": { 110 | "type": "string", 111 | "description": "ws连接错误时回调处理器" 112 | }, 113 | "closed": { 114 | "type": "string", 115 | "description": "ws连接关闭时回调处理器" 116 | }, 117 | "connected": { 118 | "type": "string", 119 | "description": "ws连接后回调处理器" 120 | } 121 | }, 122 | "additionalProperties": false, 123 | "description": "客户端事件处理" 124 | } 125 | } 126 | } -------------------------------------------------------------------------------- /json-schemas/0.10.4/ws_server.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "$ref": "#/definitions/YaoWebSocket.Server", 4 | "definitions": { 5 | "YaoWebSocket.Server": { 6 | "type": "object", 7 | "properties": { 8 | "name": { 9 | "type": "string", 10 | "description": "名称" 11 | }, 12 | "description": { 13 | "type": "string", 14 | "description": "描述" 15 | }, 16 | "version": { 17 | "type": "string", 18 | "description": "版本" 19 | }, 20 | "protocols": { 21 | "type": "array", 22 | "items": { 23 | "type": "string" 24 | }, 25 | "description": "ws协议" 26 | }, 27 | "guard": { 28 | "type": "string" 29 | }, 30 | "buffer": { 31 | "$ref": "#/definitions/YaoWebSocket.BufferSize", 32 | "description": "接收的缓存区大小,按字节算" 33 | }, 34 | "limit": { 35 | "$ref": "#/definitions/YaoWebSocket.Limit", 36 | "description": "限制" 37 | }, 38 | "timeout": { 39 | "type": "number", 40 | "description": "ws连接超时时间(秒),默认5秒" 41 | }, 42 | "process": { 43 | "type": "string", 44 | "description": "ws消息处理器" 45 | }, 46 | "$schema": { 47 | "type": "string" 48 | } 49 | }, 50 | "additionalProperties": false 51 | }, 52 | "YaoWebSocket.BufferSize": { 53 | "type": "object", 54 | "properties": { 55 | "read": { 56 | "type": "number", 57 | "description": "读取缓存区大小(大小),默认1024" 58 | }, 59 | "write": { 60 | "type": "number", 61 | "description": "写入缓存区大小(字节),默认1024" 62 | } 63 | }, 64 | "additionalProperties": false 65 | }, 66 | "YaoWebSocket.Limit": { 67 | "type": "object", 68 | "properties": { 69 | "write-wait": { 70 | "type": "number", 71 | "description": "写等待(秒),默认10" 72 | }, 73 | "pong-wait": { 74 | "type": "number", 75 | "description": "回应等待(秒),默认60" 76 | }, 77 | "max-message": { 78 | "type": "number", 79 | "description": "最大消息大小限制,单位字节,默认1024" 80 | } 81 | }, 82 | "additionalProperties": false 83 | } 84 | } 85 | } -------------------------------------------------------------------------------- /make_schemas.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | pnpm run build 5 | 6 | # convert the typescript type to json-schema files 7 | 8 | # format : sourcefile|type|targetfile 9 | # 10 | array=( 11 | "api_http|YaoHttp.HttpDSL|api_http.json" 12 | # "api_rest|YaoRest.RestDSL|api_rest.json" 13 | "form||YaoForm.FormDSL|form.json" 14 | "table|YaoTable.TableDSL|table.json" 15 | "app|YaoApp.AppDSL|app.json" 16 | "chart|YaoChart.ChartDSL|chart.json" 17 | "connector|YaoConnector.ConnectorDSL|connector.json" 18 | "dashboard|YaoDashboard.DashboardDSL|dashboard.json" 19 | "flow|YaoFlow.Flow|flow.json" 20 | "form|YaoForm.FormDSL|form.json" 21 | "importer|YaoImport.Importer|importer.json" 22 | "list|YaoList.ListDSL|list.json" 23 | "login|YaoLogin.LoginDSL|login.json" 24 | "model|YaoModel.ModelDSL|model.json" 25 | "query_param|YaoQueryParam.QueryParam|query_param.json" 26 | "query|YaoQuery.QueryDSL|query.json" 27 | "schedule|YaoSchedule.Schedule|schedule.json" 28 | "service|YaoService.Service|service.json" 29 | "socket|YaoSocket.Socket|socket.json" 30 | "store|YaoStore.Store|store.json" 31 | "task|YaoTask.Task|task.json" 32 | "web_socket|YaoWebSocket.Server|ws_server.json" 33 | "web_socket|YaoWebSocket.Client|ws_client.json" 34 | "widget|YaoCustomWidget.Widget|widget.json" 35 | ) 36 | if [ ! -d "json-schemas" ]; then 37 | mkdir json-schemas 38 | fi 39 | 40 | # array=( 41 | # "model|YaoModel.ModelDSL|model.json" 42 | # ) 43 | for line in "${array[@]}" 44 | do 45 | words=($(echo $line | tr "|" "\n")) 46 | echo "begin convert schema ${words[1]}" 47 | npx ts-json-schema-generator --path "src/types/dsl/${words[0]}.d.ts" --type "${words[1]}" > "./json-schemas/0.10.4/${words[2]}" 48 | echo "schema ${words[1]} converted" 49 | done 50 | 51 | echo "done" -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "yao-app-ts-types", 3 | "version": "1.1.4", 4 | "description": "typescript types for yao application", 5 | "main": "src/index.d.ts", 6 | "types": "src/index.d.ts", 7 | "scripts": { 8 | "build": "tsc && tsc-alias", 9 | "doc": "ts-node -r tsconfig-paths/register src/doc/index.ts", 10 | "schema:flow": "ts-json-schema-generator --path src/types/dsl/flow.ts --type YaoFlow.Flow > ./json-schemas/flow.json", 11 | "schema:api_http": "ts-json-schema-generator --path src/types/dsl/api_http.ts --type YaoHttp.HttpDSL > ./json-schemas/api_http.json", 12 | "schema:form": "ts-json-schema-generator --path src/types/dsl/form.ts --type YaoForm.FormDSL > ./json-schemas/form.json", 13 | "schema:table": "ts-json-schema-generator --path src/types/dsl/table.ts --type YaoTable.TableDSL > ./json-schemas/table.json", 14 | "npm-publish": "npm run build && npm pack && npm publish", 15 | "build-schema": "ts-node src/build.ts" 16 | }, 17 | "files": [ 18 | "src", 19 | "LICENSE", 20 | "json-schemas", 21 | "README.md", 22 | "package.json" 23 | ], 24 | "keywords": [ 25 | "yao", 26 | "yao-engine" 27 | ], 28 | "author": "vincentwwsheng@gmail.com", 29 | "license": "MIT", 30 | "devDependencies": { 31 | "antd": "^5.4.0", 32 | "axios": "^1.3.5", 33 | "ts-json-schema-generator": "^1.2.0", 34 | "@types/node": "^18.14.1", 35 | "ts-node": "^10.9.1", 36 | "tsc-alias": "^1.8.5", 37 | "tsconfig-paths": "^4.1.2", 38 | "typescript": "^4.9.5", 39 | "@types/antd": "^1.0.0", 40 | "@types/axios": "^0.14.0", 41 | "@types/react": "^18.0.33" 42 | }, 43 | "dependencies": { 44 | 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # YAO 应用 JSON-SCHEMA 2 | 3 | 开发 yao 应用需要频繁的编写 json 格式的配置文件。文件的配置项又特别的多,如果没有辅助工具,写起来比较累。而目前想到比较好的方法是使用 json-schema 文件帮助校验 json 语法,并且在 vscode 中使用 json-schema 也可以进行语法提示与自动完成。 4 | 5 | 本项目整理了 yao 应用中常用配置文件的 typescript 类型,并使用工具生成对应的 json-schema 文件。配置好 vscode 编辑器后测试使用效果还是不错的。 6 | 7 | 测试效果: 8 | 9 | - 检验 json 配置文件的有效性 10 | 11 | - 编辑器自动完成与代码提示 12 | 13 | ![演示效果](./docs/yao-json-schema.gif "json-schema演示") 14 | 15 | **此项目非官方文档,有可能部分信息不准确,仅供参考学习** 16 | 17 | yao 应用引擎目前有 3 个发行版本:0.10.2/0.10.1/0.9.1,还有正在开发中的开发版本 0.10.3。 18 | 19 | _注意_:0.10.3 与 0.10.2 在 dsl 配置文件的语法格式上存在差异。这里的 json-schema**并不适用于**目前官方发布的 0.10.2 版本,**只适用于 0.10.3 版本的开发版本**。 20 | 21 | 发行版本可以在官方上下载,开发版本需要从 github 的 action 中下载。 22 | 23 | 发行版本地址:https://yaoapps.com/release 24 | 25 | 开发版本:https://github.com/YaoApp/yao/actions 26 | 27 | 如何确定当前使用的是哪一个版本的 yao,请执行命令 yao version 28 | 29 | ```sh 30 | yao version 31 | 32 | 0.10.3 33 | ``` 34 | 35 | ## 使用方法 36 | 37 | 需要使用 vscode 编辑器 38 | 39 | ### 在线配置文件 40 | 41 | 直接使用 github 上的文件,优点是不需要下载 json-schema 文件,但是前提是电脑的网络能够直接连接到 github。 42 | 43 | 切换到 yao 应用目录执行以下命令。 44 | 45 | ```sh 46 | mkdir .vscode 47 | wget https://raw.githubusercontent.com/wwsheng009/yao-app-ts-types/main/.vscode/settings-online.json -O .vscode/settings.json 48 | ``` 49 | yao 应用引擎目前有多个发行版本,vscode默认使用最新版本。 50 | 51 | ### 本地 json-schema 文件 52 | 53 | - 下载项目中的 json-schema 文件夹中所有的配置文件到本地 54 | - 下载项目中.vscode/settings.json 到本地目录.vscode/settings.json,这会对项目内所有的配置文件生效 55 | - 如果只是效验单个文件,也可以在需要编辑的 json 文件中加入字段 "$schema"引用对应的 json-schema 文件 56 | ```json 57 | { 58 | "$schema": "../../../json-schemas/0.10.4/flow.json" 59 | } 60 | ``` 61 | 62 | ## 目前支持的 yao DSL 列表 63 | 64 | - 表单: form 文件 65 | - 表格: table 文件 66 | - 模型: model 文件 67 | - HTTP API: http api 文件 68 | - 流程: flow 文件 69 | - Chart: 图表文件 70 | - Dashboard: 大屏文件 71 | - Connector: 数据库连接器 72 | - Store: 存储 73 | - List: 列表 74 | - Login: 用户登录配置 75 | - App: 应用信息 76 | - Service 77 | - Web socket 78 | - Socket _官方还没支持_ 79 | - Task: 并发任务 80 | - Widget: 自定义 widget 81 | - Pipe: 管道 82 | 83 | ## 如何增加自定义的类型或是进行扩展 84 | 85 | 项目提供了一些内置处理器的 ts 类型定义与语法提示,方便用户理解 yao 的特有对象。 86 | 87 | 在目录 src/types/dsl 下包含了 yao 的各种 dsl 类型定义,每一个文件都包含了一种 DSL 类型的定义。用户可以根据自己的需要自行调整。 88 | 89 | ### 生成 json-schema 文件 90 | 91 | 完成 ts 类型定义后,可以使用工具生成对应的 json-schema 文件。生成的方式分两种:一个是单个生成会比较快,另外一个是批量生成,省事,但是会慢一点。 92 | 93 | ### 单个生成 94 | 95 | 利用工具 ts-json-schema-generator 生成 json-schema。 96 | 97 | ```sh 98 | npx ts-json-schema-generator --path 'src/types/dsl/**/*.ts' --type 'YaoPipe.Pipe' >./json-schemas/0.10.4/pipe.json 99 | ``` 100 | 101 | ### 批量生成 102 | 103 | 项目中提供了一个简单的批量生成的 bash 脚本,执行后会把所有的 ts 类型定义都转换成 json-schema 定义文件。 104 | 105 | ```sh 106 | pnpm run build-schema 107 | ``` 108 | 109 | ## 其它 110 | 111 | 如果需要 vscode 支持后缀名为.yao 的配置文件 112 | 113 | > - 使用 vscode 命令:更改语言模型/Change Language Mode,再修改文件类型关联。 114 | > - 直接编辑 setting.json 配置 115 | 116 | ```json 117 |  "files.associations": { 118 |    "*.yao": "jsonc" 119 | }, 120 | ``` 121 | 122 | 如果需要直接修改 json-schema,配置额外的配置,请参考:https://code.visualstudio.com/docs/languages/json 123 | -------------------------------------------------------------------------------- /src/build.ts: -------------------------------------------------------------------------------- 1 | import * as tsj from "ts-json-schema-generator"; 2 | import fs from "fs"; 3 | 4 | let array: string[] = [ 5 | "api_http|YaoHttp.HttpDSL|api_http.json", 6 | "form|YaoForm.FormDSL|form.json", 7 | "table|YaoTable.TableDSL|table.json", 8 | "app|YaoApp.AppDSL|app.json", 9 | "chart|YaoChart.ChartDSL|chart.json", 10 | "connector|YaoConnector.ConnectorDSL|connector.json", 11 | "dashboard|YaoDashboard.DashboardDSL|dashboard.json", 12 | "flow|YaoFlow.Flow|flow.json", 13 | "importer|YaoImport.Importer|importer.json", 14 | "list|YaoList.ListDSL|list.json", 15 | "login|YaoLogin.LoginDSL|login.json", 16 | "model|YaoModel.ModelDSL|model.json", 17 | "query_param|YaoQueryParam.QueryParam|query_param.json", 18 | "query|YaoQuery.QueryDSL|query.json", 19 | "schedule|YaoSchedule.Schedule|schedule.json", 20 | "service|YaoService.Service|service.json", 21 | "socket|YaoSocket.Socket|socket.json", 22 | "store|YaoStore.Store|store.json", 23 | "task|YaoTask.Task|task.json", 24 | "web_socket|YaoWebSocket.Server|ws_server.json", 25 | "web_socket|YaoWebSocket.Client|ws_client.json", 26 | "widget|YaoCustomWidget.Widget|widget.json", 27 | "pipe|YaoPipe.Pipe|pipe.json", 28 | ]; 29 | function main() { 30 | array.forEach((line) => { 31 | const words = line.split("|"); 32 | const config = { 33 | path: `src/types/dsl/${words[0]}.d.ts`, 34 | tsconfig: "tsconfig.json", 35 | type: `${words[1]}`, // Or if you want to generate schema for that one type only 36 | }; 37 | 38 | const output_path = `./json-schemas/0.10.4/${words[2]}`; 39 | 40 | const schema = tsj.createGenerator(config).createSchema(config.type); 41 | const schemaString = JSON.stringify(schema, null, 2); 42 | fs.writeFile(output_path, schemaString, (err) => { 43 | if (err) throw err; 44 | }); 45 | console.log(`processing file:${output_path}`) 46 | }); 47 | } 48 | 49 | main(); 50 | -------------------------------------------------------------------------------- /src/doc/in.txt: -------------------------------------------------------------------------------- 1 | | path | String | API 路由名称。完整路由地址为 `/api//` ,变量使用 `:` 声明,如 `/api/user/find/:id`, 可以使用 `$param.id` 访问路由请求参数 | 是 | 2 | | method | String | 请求类型。许可值 `GET`、`POST`、`PUT`、`DELETE`、 `HEAD`、`OPTIONS`、`Any`. 其中 `Any` 将响应任何类型的请求 | 是 | 3 | | guard | String | API 中间件. 如不设置,默认使用全局中间件。如不希望使用全局中间件,可将数值设置为 `-` 。 | 否 | 4 | | process | String | 调用处理器 `process` | 是 | 5 | | in | Array\ | 请求参数表,将作为 `process` 的输入参数(`args`)。可以引用传入参数,可以为空数组 [查看输入参数](#输入参数) | 是 | 6 | | out | Object Out | 请求响应结果定义。 具体查看 `Object Out` 数据结构 | 是 | 7 | | err | Object Out | 自定义调用失败时的响应结果。 **尚未实现** | 否 | 8 | -------------------------------------------------------------------------------- /src/doc/index.ts: -------------------------------------------------------------------------------- 1 | import fs from "fs"; 2 | import path from "node:path"; 3 | 4 | /**转换markdown 文档为ts注释 5 | * 6 | * */ 7 | function ConvertDoc() { 8 | let p = path.resolve("./src/doc/in.txt"); 9 | let o = path.resolve("./src/doc/out.txt"); 10 | // console.log(p); 11 | let content = fs.readFileSync(p, "utf8"); 12 | 13 | const lines = content.split("\n"); 14 | const new_lines: string[] = []; 15 | lines.forEach((line) => { 16 | const columns = line.split("|"); 17 | const fname = columns[1]; 18 | if (!fname) { 19 | return; 20 | } 21 | const method = fname.split(".").pop(); 22 | const nline = columns 23 | .map((l) => l.trim()) 24 | .slice(2) 25 | .join("|"); 26 | const commentLine = `/**${nline}*/`; 27 | const newLine = `${method?.trim()} = "${fname.trim()}",`; 28 | new_lines.push(commentLine); 29 | new_lines.push(newLine); 30 | }); 31 | // console.log(new_lines.join("\n")); 32 | fs.writeFileSync(o, new_lines.join("\n")); 33 | console.log("done!"); 34 | } 35 | 36 | ConvertDoc(); 37 | -------------------------------------------------------------------------------- /src/doc/out.txt: -------------------------------------------------------------------------------- 1 | | status | integer | 请求响应状态码 | 是 | 2 | | type | String | 请求响应 Content Type | 是 | 3 | | headers | Array\ | 请求响应 Headers **尚未实现** | 否 | -------------------------------------------------------------------------------- /src/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from "./types/dsl/index"; 2 | 3 | export * from "./types/process_enum"; 4 | 5 | export * from "./types/xgen/index"; 6 | 7 | export * from "./types/runtime/global"; 8 | 9 | export * from "./types/global"; 10 | -------------------------------------------------------------------------------- /src/runtime.d.ts: -------------------------------------------------------------------------------- 1 | export * from "./types/runtime/process"; 2 | export * from "./types/runtime/fs"; 3 | export * from "./types/runtime/store"; 4 | export * from "./types/runtime/query"; 5 | export * from "./types/runtime/http"; 6 | export * from "./types/runtime/time"; 7 | export * from "./types/runtime/log"; 8 | export * from "./types/runtime/exception"; 9 | export * from "./types/runtime/console"; 10 | export * from "./types/runtime/global"; 11 | export * from "./types/runtime/io"; 12 | export * from "./types/runtime/neo"; 13 | export * from "./types/runtime/sui"; 14 | -------------------------------------------------------------------------------- /src/types/dsl/action.d.ts: -------------------------------------------------------------------------------- 1 | import { YaoQueryParam } from "./query_param"; 2 | 3 | 4 | export type ActionDefault = YaoQueryParam.QueryParam | any 5 | export namespace YaoAction { 6 | /**自定义关联处理器*/ 7 | export type Process = { 8 | /**备注【管理字段】 */ 9 | comment?: string; 10 | // name?: string; 11 | /**关联处理器名称 */ 12 | process?: string; 13 | /**框架默认的关联处理器名称,如果不指定process,会使用的处理器 */ 14 | bind?: string; 15 | /**鉴权方式,可使用多个,使用逗号隔开 */ 16 | guard?: string; 17 | /**关联处理器默认值,null 表示不设定默认值*/ 18 | default?: ActionDefault[]; 19 | /**未使用 */ 20 | disable?: boolean; 21 | // before?: hook.Before; 22 | // after?: hook.After; 23 | // handler?: Function; 24 | }; 25 | } 26 | export default YaoAction; 27 | -------------------------------------------------------------------------------- /src/types/dsl/antd/rule.d.ts: -------------------------------------------------------------------------------- 1 | export type StoreValue = any; 2 | export type RuleType = 3 | | "string" 4 | | "number" 5 | | "boolean" 6 | | "method" 7 | | "regexp" 8 | | "integer" 9 | | "float" 10 | | "object" 11 | | "enum" 12 | | "date" 13 | | "url" 14 | | "hex" 15 | | "email"; 16 | 17 | export interface BaseRule { 18 | warningOnly?: boolean; 19 | enum?: StoreValue[]; 20 | len?: number; 21 | max?: number; 22 | message?: string; 23 | min?: number; 24 | pattern?: RegExp; 25 | required?: boolean; 26 | type?: RuleType; 27 | whitespace?: boolean; 28 | /** Customize rule level `validateTrigger`. Must be subset of Field `validateTrigger` */ 29 | validateTrigger?: string | string[]; 30 | } 31 | 32 | export type AggregationRule = BaseRule & Partial; 33 | 34 | export interface ArrayRule extends Omit { 35 | type: "array"; 36 | defaultField?: RuleObject; 37 | } 38 | 39 | export type RuleObject = AggregationRule | ArrayRule; 40 | 41 | export interface ValidatorRule { 42 | warningOnly?: boolean; 43 | message?: string; 44 | } 45 | -------------------------------------------------------------------------------- /src/types/dsl/api_http.d.ts: -------------------------------------------------------------------------------- 1 | export namespace YaoHttp { 2 | // API 数据接口 3 | // export interface API { 4 | // id: string; 5 | // // name: string; 6 | // // source: string; 7 | // // type: string; 8 | // http: HttpDSL; 9 | // } 10 | 11 | // HTTP http 协议服务 12 | export interface HttpDSL { 13 | /**版本【管理字段】 */ 14 | version?: string; 15 | /**描述【管理字段】 */ 16 | decription?: string; 17 | /**备注【管理字段】 */ 18 | comment?: string; 19 | /**API 呈现名称 */ 20 | name?: string; 21 | /**描述*/ 22 | description?: string; 23 | /**API 分组名称,访问时作为 API 路由前缀目录。 `/api//`*/ 24 | group?: string; 25 | /**API 全局中间件,多个用 "," 分割。除特别声明,组内所有 API 都将使用全局中间件 26 | * 27 | * 常用bearer-jwt 28 | */ 29 | guard?: string; 30 | /**API 列表。具体查看 `Object Path` 数据结构*/ 31 | paths?: Path[]; 32 | $schema?: string; 33 | } 34 | 35 | // Path HTTP Path 36 | export interface Path { 37 | /**标签 */ 38 | label?: string; 39 | /**描述 */ 40 | description?: string; 41 | /**API 路由名称。完整路由地址为 `/api//` ,变量使用 `:` 声明,如 `/api/user/find/:id`, 可以使用 `$param.id` 访问路由请求参数*/ 42 | path: string; 43 | /**请求类型。许可值 `GET`、`POST`、`PUT`、`DELETE`、 `HEAD`、`OPTIONS`、`Any`. 其中 `Any` 将响应任何类型的请求*/ 44 | method: string; 45 | /**调用处理器 `process`*/ 46 | process: string; 47 | /**API 中间件. 如不设置,默认使用全局中间件。如不希望使用全局中间件,可将数值设置为 `-` 。| 48 | * 49 | * 常用bearer-jwt 50 | */ 51 | guard?: string; 52 | /**请求参数表,将作为 `process` 的输入参数(`args`)。可以引用传入参数,可以为空数组 [查看输入参数](#输入参数)*/ 53 | in?: string[]; 54 | /**请求响应结果定义。 具体查看 `Object Out` 数据结构*/ 55 | out?: Out; 56 | } 57 | 58 | // Out http 输出 59 | export interface Out { 60 | /**请求响应状态码*/ 61 | status: number; 62 | /**请求响应 Content Type*/ 63 | type?: string; 64 | /**请求响应内容*/ 65 | body?: any; 66 | /**请求响应 Headers */ 67 | headers?: { [key: string]: string }; 68 | // redirect?: Redirect; 69 | } 70 | 71 | // Redirect out redirect 72 | export interface Redirect { 73 | code?: number; 74 | location?: string; 75 | } 76 | 77 | // Server API 服务配置 78 | export interface Server { 79 | debug?: boolean; 80 | port?: number; 81 | host?: string; 82 | root?: string; // API 根目录 83 | allows?: string[]; // 许可跨域访问域名 84 | } 85 | 86 | // UploadFile upload file 87 | export interface UploadFile { 88 | name: string; 89 | tempFile: string; 90 | size: number; 91 | header: { [key: string]: string }; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /src/types/dsl/api_rest.d.ts: -------------------------------------------------------------------------------- 1 | export namespace YaoRest { 2 | // REST The RESTFul API 3 | export interface RestDSL { 4 | /**版本【管理字段】 */ 5 | version?: string; 6 | /**描述【管理字段】 */ 7 | decription?: string; 8 | /**备注【管理字段】 */ 9 | comment?: string; 10 | /**API 呈现名称 */ 11 | name?: string; 12 | // group?: string; 13 | /**描述*/ 14 | description?: string; 15 | /**API 全局中间件,多个用 "," 分割。除特别声明,组内所有 API 都将使用全局中间件 16 | * 17 | * 常用bearer-jwt 18 | */ 19 | guard?: string; 20 | /**API 列表。具体查看 `Object Path` 数据结构*/ 21 | paths?: Path[]; 22 | $schema?: string; 23 | } 24 | 25 | // Path The RESTFul API Route path 26 | export interface Path { 27 | /**标签 */ 28 | label?: string; 29 | /**描述 */ 30 | description?: string; 31 | /**API 路由名称。完整路由地址为 `/api//` ,变量使用 `:` 声明,如 `/api/user/find/:id`, 可以使用 `$param.id` 访问路由请求参数*/ 32 | path: string; 33 | /**请求类型。许可值 `GET`、`POST`、`PUT`、`DELETE`、 `HEAD`、`OPTIONS`、`Any`. 其中 `Any` 将响应任何类型的请求*/ 34 | method: string; 35 | /**调用处理器 `process`*/ 36 | process: string; 37 | /**API 中间件. 如不设置,默认使用全局中间件。如不希望使用全局中间件,可将数值设置为 `-` 。| 38 | * 39 | * 常用bearer-jwt 40 | */ 41 | guard?: string; 42 | /**请求参数表,将作为 `process` 的输入参数(`args`)。可以引用传入参数,可以为空数组 [查看输入参数](#输入参数)*/ 43 | in?: any[]; 44 | /**请求响应结果定义。 具体查看 `Object Out` 数据结构*/ 45 | out?: Out; 46 | } 47 | 48 | // Out The RESTFul API output 49 | export interface Out { 50 | /**请求响应状态码*/ 51 | status: number; 52 | /**请求响应 Content Type*/ 53 | type?: string; 54 | /**请求响应 Headers */ 55 | headers?: { [key: string]: string }; 56 | } 57 | 58 | // Option the server option 59 | // export interface Option { 60 | // mode?: string; // the server mode production / development 61 | // root?: string; // the root route path of the RESTFul API server 62 | // } 63 | } 64 | -------------------------------------------------------------------------------- /src/types/dsl/app.d.ts: -------------------------------------------------------------------------------- 1 | export namespace YaoApp { 2 | export type AppDSL = { 3 | /**版本【管理字段】 */ 4 | version?: string; 5 | /**描述【管理字段】 */ 6 | decription?: string; 7 | /**备注【管理字段】 */ 8 | comment?: string; 9 | /**XGen 界面引擎版本, 推荐使用 `1.0` 版,旧版已停止维护*/ 10 | xgen?: string; 11 | /**应用名称, 支持多语言 */ 12 | name?: string; 13 | /**应用简称, 支持多语言。 */ 14 | short?: string; 15 | /**应用介绍, 支持多语言。 */ 16 | description?: string; 17 | /**默认主题*/ 18 | theme?: "light" | "dark"; 19 | /**配置xgen语言 zh-cn/en-us*/ 20 | lang?: string; 21 | /** */ 22 | sid?: string; 23 | /**logo文件地址,根目录/public */ 24 | logo?: string; 25 | /**网站favicon文件地址,根目录/public */ 26 | favicon?: string; 27 | /**管理后台菜单读取处理器 */ 28 | menu?: MenuDSL; 29 | /**管理后台路由前缀,默认为/yao*/ 30 | adminRoot?: string; 31 | /**应用可选配置项 */ 32 | optional?: OptionalDSL; 33 | /**xgen获取配置的处理器,默认是yao.app.Xgen*/ 34 | setting?: string; 35 | /**应用首次安装后运行的处理器名称, 一般可以用来建立初始化数据;处理器第一个参数为应用配置信息。支持使用 `studio` 命名空间,调用 studio 脚本函数*/ 36 | setup?: string; 37 | 38 | $schema?: string; 39 | }; 40 | 41 | export type MenuDSL = { 42 | /**处理器名称 */ 43 | process?: string; 44 | /**处理器参数表 */ 45 | args?: string[]; 46 | }; 47 | 48 | export type OptionalDSL = { [key: string]: any } & { 49 | /**隐藏系统通知面板。 **字段名大小写敏感** */ 50 | hideNotification?: boolean; 51 | /**隐藏导航栏下方配置菜单。 **字段名大小写敏感** */ 52 | hideSetting?: boolean; 53 | /**在xgen中缓存远程select控件选项 */ 54 | remoteCache?: boolean; 55 | /** neo config, for chatgpt service */ 56 | neo?: { 57 | /** neo chat api */ 58 | api: string; 59 | }; 60 | }; 61 | 62 | // export type CFUN = { 63 | // method: string; 64 | // args?: any[]; 65 | // }; 66 | } 67 | export default YaoApp; 68 | -------------------------------------------------------------------------------- /src/types/dsl/chart.d.ts: -------------------------------------------------------------------------------- 1 | import { CommonConfig } from "./share_types"; 2 | import YaoAction from "./action"; 3 | import YaoComponent from "./component"; 4 | import YaoField from "./field"; 5 | import YaoHook from "./hook"; 6 | 7 | export namespace YaoChart { 8 | export enum ChartComponentEnum { 9 | "Bar" = "Bar", 10 | "Funnel" = "Funnel", 11 | "Line" = "Line", 12 | "LineBar" = "LineBar", 13 | "Number" = "Number", 14 | "NumberChart" = "NumberChart", 15 | "Pie" = "Pie", 16 | "Table" = "Table", 17 | } 18 | export interface ChartDSL { 19 | /**版本【管理字段】 */ 20 | version?: string; 21 | /**描述【管理字段】 */ 22 | decription?: string; 23 | /**备注【管理字段】 */ 24 | comment?: string; 25 | /**唯一标识 */ 26 | id?: string; 27 | /**图表名称, 支持多语言 */ 28 | name?: string; 29 | /**图表数据交互。用于指定统计数据读取处理器,设置数据 Hook,绑定模型等 */ 30 | action?: ActionDSL; 31 | /**图表界面布局。字段、筛选器等 */ 32 | layout?: LayoutDSL; 33 | /**图表字段定义。指定图表字段, 图表筛选器字段定义 */ 34 | fields?: FieldsDSL; 35 | /**图表界面配置项。图表满屏显示等配置*/ 36 | config?: CommonConfig; 37 | // cProps: field.CloudProps; 38 | // computable: compute.Computable; 39 | // mapping: mapping.Mapping; 40 | $schema?: string; 41 | } 42 | 43 | export interface ActionDSL { 44 | /**关联处理器。返回图表页面配置 */ 45 | setting?: YaoAction.Process; 46 | // component?: action.Process; 47 | /**关联处理器。指定数据图表分析结果处理器,返回图表数据*/ 48 | data?: YaoAction.Process; 49 | /**Before Hook。在关联处理器之前运行,输入用户输入的参数表,返回处理后的参数表 */ 50 | "before:data"?: YaoHook.Before; 51 | /**After Hook。在关联处理器之后运行,输入关联处理器返回结果,返回处理后的结果 */ 52 | "after:data"?: YaoHook.After; 53 | } 54 | 55 | export interface FieldsDSL { 56 | filter?: YaoField.Filters; 57 | chart?: ChartColumns; 58 | // filterMap?: { [key: string]: field.FilterDSL }; 59 | // chartMap?: { [key: string]: field.ColumnDSL }; 60 | } 61 | 62 | // Columns the columns DSL 63 | export type ChartColumns = { [key: string]: ChartColumnDSL }; 64 | 65 | // ColumnDSL the field column dsl 66 | export type ChartColumnDSL = { 67 | /**唯一标识 */ 68 | id?: string; 69 | $data?: YaoComponent.CloudPropsDSL; 70 | /**列主键名,不需要显式设置 */ 71 | key?: string; 72 | /**默认绑定API接口返回字段名称 */ 73 | bind?: string; 74 | /**chart图表链接地址 */ 75 | link?: string; 76 | /** 显示控件设置 */ 77 | view?: ChartComponentDSL; 78 | /** 编辑控件设置 */ 79 | // edit?: YaoComponent.EditComponentDSL; 80 | }; 81 | 82 | export interface ChartComponentDSL { 83 | /**绑定字段名称,如不指定使用默认值 */ 84 | bind?: string; 85 | /**组件名称,可用组件参考文档 https://yaoapps.com/components */ 86 | type?: ChartComponentEnum | string | "public/xxx"; 87 | /**数据数值计算 */ 88 | compute?: YaoComponent.Compute | string; 89 | /**控件属性,可参考antd控件 */ 90 | props?: YaoComponent.PropsDSL & { 91 | /**显示成卡片的样式 */ 92 | cardStyle?: YaoComponent.PropsDSL & { 93 | padding?: number; 94 | }; 95 | type?: string; 96 | /**图表高度 */ 97 | chartHeight?: number; 98 | /**颜色 */ 99 | color?: string; 100 | /**显示单位 */ 101 | unit?: string; 102 | /**显示前缀 */ 103 | prefix?: string; 104 | /** */ 105 | decimals?: number; 106 | /**绑定数据的key字段 */ 107 | nameKey?: string; 108 | /**绑定数据的value字段 */ 109 | valueKey?: string; 110 | }; 111 | } 112 | 113 | export interface LayoutDSL { 114 | /**图表界面头部布局。设置批量操作、导入配置等 */ 115 | operation?: OperationLayoutDSL; 116 | /**图表布局。设置显示,行操作按钮等 */ 117 | chart?: ViewLayoutDSL; 118 | /**图表筛选器。设置筛选条件和右上角操作按钮等 */ 119 | filter?: FilterLayoutDSL; 120 | } 121 | 122 | export interface FilterLayoutDSL { 123 | /**自定义操作按钮 */ 124 | actions?: YaoComponent.Actions; 125 | /**筛选条件, 在 fields.filter 中定义的筛选条件字段 */ 126 | columns?: YaoComponent.LayoutColumns; 127 | } 128 | 129 | export interface OperationLayoutDSL { 130 | actions?: YaoComponent.Actions; 131 | } 132 | 133 | export interface ViewLayoutDSL { 134 | columns?: YaoComponent.LayoutColumns; 135 | } 136 | } 137 | export default YaoChart; 138 | -------------------------------------------------------------------------------- /src/types/dsl/compute.d.ts: -------------------------------------------------------------------------------- 1 | export namespace YaoCompute { 2 | export const View = 0; 3 | export const Edit = 1; 4 | export const Filter = 2; 5 | 6 | export interface Computable { 7 | Computes: Maps; 8 | } 9 | 10 | export interface Maps { 11 | Edit: { [key: string]: Unit[] }; 12 | View: { [key: string]: Unit[] }; 13 | Filter: { [key: string]: Unit[] }; 14 | } 15 | 16 | export interface Unit { 17 | Name: string; 18 | Kind: number; 19 | } 20 | } 21 | export default YaoCompute; 22 | -------------------------------------------------------------------------------- /src/types/dsl/connector.d.ts: -------------------------------------------------------------------------------- 1 | export namespace YaoConnector { 2 | export type ConnectorEnum = 3 | | "mysql" 4 | | "sqlite" 5 | | "sqlite3" 6 | | "postgres" 7 | | "redis" 8 | | "mongo" 9 | | "openai" 10 | | "hdb"; 11 | 12 | export interface ConnectorDSL { 13 | /**语言 */ 14 | lang?: string; 15 | /**版本【管理字段】 */ 16 | version?: string; 17 | /**描述【管理字段】 */ 18 | decription?: string; 19 | /**备注【管理字段】 */ 20 | comment?: string; 21 | /**连接器类型, 当前支持 `mysql`, `sqlite3`, `mongo` 和 `redis` */ 22 | type: ConnectorEnum; 23 | /**连接器名称 */ 24 | name?: string; 25 | /**标签显示 */ 26 | label?: string; 27 | /**连接器配置项 */ 28 | options?: 29 | | XunOption 30 | | RedisOption 31 | | Sqlite3Option 32 | | MongoDBOption 33 | | OpenAIOption; 34 | 35 | $schema?: string; 36 | } 37 | 38 | export interface XunOption { 39 | /**数据库名称, 支持使用`$EVN.变量名` 读取环境变量 */ 40 | db?: string; 41 | /**表前缀 */ 42 | prefix?: string; 43 | /**MySQL charset */ 44 | charset?: string; 45 | /**MySQL collation */ 46 | collation?: string; 47 | /**解析时间 */ 48 | parseTime?: boolean; 49 | /**连接超时 */ 50 | timeout?: boolean; 51 | /**sqlite3数据库文件地址, 支持使用`$EVN.变量名` 读取环境变量*/ 52 | file?: string; 53 | /**其它参数 */ 54 | params?: { [key: string]: any }; 55 | /**服务器列表 */ 56 | hosts?: XunDBHost[]; 57 | } 58 | 59 | export interface RedisOption { 60 | /**Redis Host, 支持使用`$EVN.变量名` 读取环境变量 */ 61 | host?: string; 62 | /**Redis Port, 支持使用`$EVN.变量名` 读取环境变量 */ 63 | port?: string; 64 | /**Redis User name, 支持使用`$EVN.变量名` 读取环境变量*/ 65 | user?: string; 66 | /**Redis Password, 支持使用`$EVN.变量名` 读取环境变量 */ 67 | pass?: string; 68 | /**Redis DB, 支持使用`$EVN.变量名` 读取环境变量 */ 69 | db?: string; 70 | } 71 | export interface Sqlite3Option { 72 | /**数据库文件地址, 支持使用`$EVN.变量名` 读取环境变量 */ 73 | file?: string; 74 | } 75 | 76 | export interface MongoDBOption { 77 | /**数据库名称, 支持使用`$EVN.变量名` 读取环境变量 */ 78 | db?: string; 79 | /**连接超时 */ 80 | timeout?: boolean; 81 | /**服务器列表 */ 82 | hosts?: MongoHost[]; 83 | /**连接参数 */ 84 | params?: { [key: string]: any }; 85 | } 86 | 87 | export interface OpenAIOption { 88 | /**api.openai.com对应的代理网站 */ 89 | proxy?: string; 90 | /**open ai模型*/ 91 | model?: string; 92 | /**openai 接口调用token key */ 93 | key?: string; 94 | } 95 | /**服务器列表 */ 96 | export interface MongoHost { 97 | /**MySQL Host, 支持使用`$EVN.变量名` 读取环境变量 */ 98 | host?: string; 99 | /**MySQL Port, 支持使用`$EVN.变量名` 读取环境变量 */ 100 | port?: string; 101 | /**MySQL User name, 支持使用`$EVN.变量名` 读取环境变量 */ 102 | user?: string; 103 | /**MySQL Password, 支持使用`$EVN.变量名` 读取环境变量 */ 104 | pass?: string; 105 | } 106 | /**服务器列表 */ 107 | export interface XunDBHost { 108 | /**MySQL Host, 支持使用`$EVN.变量名` 读取环境变量 */ 109 | host?: string; 110 | /**MySQL Port, 支持使用`$EVN.变量名` 读取环境变量 */ 111 | port?: string; 112 | /**MySQL User name, 支持使用`$EVN.变量名` 读取环境变量 */ 113 | user?: string; 114 | /**MySQL Password, 支持使用`$EVN.变量名` 读取环境变量 */ 115 | pass?: string; 116 | /**`true` 为主库, `false`为从库 */ 117 | primary?: boolean; 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /src/types/dsl/dashboard.d.ts: -------------------------------------------------------------------------------- 1 | import { CommonConfig, HookType } from "./share_types"; 2 | import YaoHook from "./hook"; 3 | import action from "./action"; 4 | import field from "./field"; 5 | import YaoComponent from "./component"; 6 | import YaoChart from "./chart"; 7 | 8 | export namespace YaoDashboard { 9 | export interface DashboardDSL { 10 | /**版本【管理字段】 */ 11 | version?: string; 12 | /**描述【管理字段】 */ 13 | decription?: string; 14 | /**备注【管理字段】 */ 15 | comment?: string; 16 | /**唯一标识 */ 17 | id?: string; 18 | /**名称 */ 19 | name?: string; 20 | /**操作 */ 21 | action: ActionDSL; 22 | /**页面布局 */ 23 | layout: LayoutDSL; 24 | /**字段配置 */ 25 | fields: FieldsDSL; 26 | /**全局配置项 */ 27 | config?: CommonConfig; 28 | // CProps?: any; 29 | // Computable?: any; 30 | // Mapping?: any; 31 | /**hook事件,框架自动生成 */ 32 | hooks?: HookType; 33 | $schema?: string; 34 | } 35 | 36 | export interface ActionDSL { 37 | /**读取配置的处理器 */ 38 | setting?: action.Process; 39 | // component?: any; 40 | /**数据读取处理器 */ 41 | data?: action.Process; 42 | /**在data处理器之前调用 */ 43 | "before:data"?: YaoHook.Before; 44 | /**在data处理器之后调用 */ 45 | "after:data"?: YaoHook.After; 46 | } 47 | 48 | export interface FieldsDSL { 49 | /**筛选字段配置 */ 50 | filter?: field.Filters; 51 | /**大屏字段配置 */ 52 | dashboard?: DashColumns; 53 | // filterMap?: { [key: string]: any }; 54 | // dashboardMap?: { [key: string]: any }; 55 | } 56 | 57 | // Columns the columns DSL 58 | export type DashColumns = { [key: string]: DashColumnDSL }; 59 | 60 | // ColumnDSL the field column dsl 61 | export type DashColumnDSL = { 62 | /**唯一标识 */ 63 | id?: string; 64 | /**读取数据的处理器 */ 65 | $data?: YaoComponent.CloudPropsDSL; 66 | /**列主键名,不需要显式设置 */ 67 | key?: string; 68 | /**默认绑定API接口返回字段名称 */ 69 | bind?: string; 70 | /**chart图表链接地址 */ 71 | link?: string; 72 | /** 显示控件设置 */ 73 | view?: DashComponentDSL; 74 | /** 编辑控件设置 */ 75 | // edit?: YaoComponent.EditComponentDSL; 76 | }; 77 | 78 | export enum DashComponentEnum { 79 | "Bar" = "chart/Bar", 80 | "Funnel" = "chart/Funnel", 81 | "Line" = "chart/Line", 82 | "LineBar" = "chart/LineBar", 83 | "Number" = "chart/Number", 84 | "NumberChart" = "chart/NumberChart", 85 | "Pie" = "chart/Pie", 86 | } 87 | 88 | export interface DashComponentDSL { 89 | /**绑定字段名称,如不指定使用默认值 */ 90 | bind?: string; 91 | /**组件名称,可用组件参考文档 https://yaoapps.com/components */ 92 | type?: string | "base/Table" | "base/Form" | DashComponentEnum; 93 | /**数据数值计算 */ 94 | compute?: YaoComponent.Compute | string; 95 | /**控件属性,可参考antd控件 */ 96 | props?: YaoComponent.PropsDSL & { 97 | /**显示成卡片的样式 */ 98 | cardStyle?: YaoComponent.PropsDSL & { 99 | padding?: number; 100 | }; 101 | type?: string; 102 | /**图表高度 */ 103 | chartHeight?: number; 104 | /**颜色 */ 105 | color?: string; 106 | /**显示单位 */ 107 | unit?: string; 108 | /**显示前缀 */ 109 | prefix?: string; 110 | /** */ 111 | decimals?: number; 112 | /**绑定数据的key字段 */ 113 | nameKey?: string; 114 | /**绑定数据的value字段 */ 115 | valueKey?: string; 116 | }; 117 | } 118 | 119 | export interface LayoutDSL { 120 | /**操作 */ 121 | actions?: YaoComponent.Actions; 122 | /**大屏配置 */ 123 | dashboard?: ViewLayoutDSL; 124 | /**筛选条件 */ 125 | filter?: FilterLayoutDSL; 126 | } 127 | 128 | export interface FilterLayoutDSL { 129 | /**筛选操作 */ 130 | actions?: YaoComponent.Actions; 131 | /**字段列表配置 */ 132 | columns?: YaoComponent.LayoutColumns; 133 | } 134 | 135 | // Instances the Instances 136 | export type LayoutColumns = LayoutColumnDSL[]; 137 | 138 | // InstanceDSL the component instance DSL 139 | export interface LayoutColumnDSL { 140 | /**字段标称名Label */ 141 | name?: string; 142 | /**宽度 */ 143 | width?: any; 144 | /**高度 */ 145 | height?: any; 146 | /**固定 */ 147 | fixed?: boolean; // for widget table 148 | /**配置rows */ 149 | rows?: LayoutColumnDSL[]; 150 | } 151 | export interface ViewLayoutDSL { 152 | /**字段列表配置 */ 153 | columns?: LayoutColumns; 154 | } 155 | } 156 | export default YaoDashboard; 157 | -------------------------------------------------------------------------------- /src/types/dsl/field.d.ts: -------------------------------------------------------------------------------- 1 | import YaoComponent from "./component"; 2 | 3 | export namespace YaoField { 4 | // Filters the filters DSL 5 | export type Filters = { [key: string]: FilterDSL }; 6 | 7 | // Columns the columns DSL 8 | export type Columns = { [key: string]: ColumnDSL }; 9 | 10 | // ComputeFields the Compute filelds 11 | export type ComputeFields = { [key: string]: string }; 12 | 13 | // CloudProps the cloud props 14 | export type CloudProps = { [key: string]: YaoComponent.CloudPropsDSL }; 15 | 16 | // ColumnDSL the field column dsl 17 | export type ColumnDSL = { 18 | /**备注【管理字段】 */ 19 | comment?: string; 20 | /**唯一标识 */ 21 | id?: string; 22 | /**远程data数据接口 */ 23 | $data?: YaoComponent.CloudPropsDSL; 24 | /**列主键名,不需要显式设置 */ 25 | key?: string; 26 | /**默认绑定API接口返回字段名称 */ 27 | bind?: string; 28 | /**chart图表链接地址,只有图表才会使用*/ 29 | link?: string; 30 | /** 显示控件设置 */ 31 | view?: YaoComponent.ViewComponentDSL; 32 | /** 编辑控件设置 */ 33 | edit?: YaoComponent.EditComponentDSL; 34 | }; 35 | 36 | export type aliasColumnDSL = ColumnDSL; 37 | 38 | // FilterDSL the field filter dsl 39 | export type FilterDSL = { 40 | /**唯一标识 */ 41 | id?: string; 42 | key?: string; 43 | /**绑定字段列标识 */ 44 | bind?: string; 45 | /**关联编辑控件 */ 46 | edit?: YaoComponent.EditComponentDSL; 47 | }; 48 | 49 | export type aliasFilterDSL = FilterDSL; 50 | 51 | // Compute the compute filed 52 | export type Compute = string; 53 | 54 | // Transform the field transform 55 | export type Transform = { 56 | variables?: { [key: string]: any }; 57 | aliases?: { [key: string]: string }; 58 | fields?: { [key: string]: TransformField }; 59 | }; 60 | 61 | // TransformField the transform.types[*] 62 | export type TransformField = { 63 | filter?: FilterDSL; 64 | form?: ColumnDSL; 65 | table?: ColumnDSL; 66 | }; 67 | } 68 | export default YaoField; 69 | -------------------------------------------------------------------------------- /src/types/dsl/flow.d.ts: -------------------------------------------------------------------------------- 1 | import { YaoQuery } from "./query"; 2 | export namespace YaoFlow { 3 | // 可以使用 JavaScript 脚本,对数据流节点返回值进行处理,按需返回数据结构。 4 | // Flow 工作流 5 | export interface Flow { 6 | name?: string; 7 | // source: string; 8 | // scripts: { [key: string]: string }; 9 | /**数据流呈现名称,用于开发平台呈现*/ 10 | label?: string; 11 | /**版本号,用于依赖关系校验和开发平台呈现*/ 12 | version?: string; 13 | /**数据流介绍,用于开发平台呈现*/ 14 | description?: string; 15 | /**查询节点*/ 16 | nodes?: FlowNode[]; 17 | /**输出结果定义*/ 18 | output?: any; 19 | // global?: { [key: string]: any }; // 全局变量 20 | // sid?: string; // 会话ID 21 | $schema?: string; 22 | } 23 | 24 | // FlowNode 工作流节点 25 | export interface FlowNode { 26 | /**版本【管理字段】 */ 27 | version?: string; 28 | /**描述【管理字段】 */ 29 | decription?: string; 30 | /**备注【管理字段】 */ 31 | comment?: string; 32 | /**查询节点名称*/ 33 | name?: string; 34 | /**调用处理器 `process`*/ 35 | process?: string; 36 | /**数据分析引擎名称,默认`xiang` */ 37 | engine?: string; 38 | /**数据分析语言*/ 39 | query?: YaoQuery.QueryDSL; 40 | /**关联的脚本名称*/ 41 | script?: string; 42 | /**处理器参数表.可以引用输入输出或上下文数据*/ 43 | args?: any[]; 44 | /**查询节点结果输出.使用 `{{$out}}` 引用处理器返回结果。如不设置,返回值等于处理器返回结果。*/ 45 | outs?: any[]; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/types/dsl/form.d.ts: -------------------------------------------------------------------------------- 1 | import { CommonConfig, HookType } from "./share_types"; 2 | import YaoAction from "./action"; 3 | import YaoComponent from "./component"; 4 | import YaoField from "./field"; 5 | import YaoHook from "./hook"; 6 | import { YaoQueryParam } from "./query_param"; 7 | 8 | export namespace YaoForm { 9 | // DSL the form DSL 10 | export interface FormDSL { 11 | /**版本【管理字段】 */ 12 | version?: string; 13 | /**描述【管理字段】 */ 14 | decription?: string; 15 | /**备注【管理字段】 */ 16 | comment?: string; 17 | /**唯一标识 */ 18 | id?: string; 19 | // root?: string; 20 | /**表单名称, 支持多语言 */ 21 | name: string; 22 | /**表单数据交互。用于指定数据读取、保存等操作的处理器,设置数据 Hook,绑定模型等 */ 23 | action: ActionDSL; 24 | /**表单界面布局 */ 25 | layout?: LayoutDSL; 26 | /**表单字段定义。指定表单字段定义 */ 27 | fields?: FieldsDSL; 28 | /**表单界面配置项。表单满屏显示等配置 */ 29 | config?: CommonConfig & { 30 | /**是否在表单右边显示导航栏 */ 31 | showAnchor?: boolean; 32 | }; 33 | // cProps?: field.CloudProps; 34 | // computable?: compute.Computable; 35 | // mapping?: mapping.Mapping; 36 | /**hook事件,框架自动生成 */ 37 | hooks?: HookType; 38 | $schema?: string; 39 | } 40 | 41 | // ActionDSL the form action DSL 42 | export interface ActionDSL { 43 | guard?: string; // the default guard 44 | /**绑定 model 或 form。 根据关联 Widget ID 设定表单关联处理器和界面呈现默认值 */ 45 | bind?: BindActionDSL; 46 | /**关联处理器。返回表单页面配置 */ 47 | setting?: YaoAction.Process; 48 | component?: YaoAction.Process; 49 | upload?: YaoAction.Process; 50 | download?: YaoAction.Process; 51 | /**关联处理器。指定按主键查询单条数据处理器和默认参数, 返回单条数据记录 */ 52 | find?: YaoAction.Process; 53 | /**关联处理器。指定保存单条数据处理器 */ 54 | save?: YaoAction.Process; 55 | /**关联处理器。指定按主键更新单条数据处理器 */ 56 | update?: YaoAction.Process; 57 | /**关联处理器。指定新建单条数据处理器 */ 58 | create?: YaoAction.Process; 59 | /**关联处理器。指定按主键删除单条数据处理器 */ 60 | delete?: YaoAction.Process; 61 | /**Before Hook。在关联处理器之前运行,输入用户输入的参数表,返回处理后的参数表 */ 62 | "before:find"?: YaoHook.Before; 63 | /**在关联处理器 find 之后运行 */ 64 | "after:find"?: YaoHook.After; 65 | /**Before Hook。在关联处理器之前运行,输入用户输入的参数表,返回处理后的参数表 */ 66 | "before:save"?: YaoHook.Before; 67 | /**在关联处理器 save 之后运行 */ 68 | "after:save"?: YaoHook.After; 69 | /**Before Hook。在关联处理器之前运行,输入用户输入的参数表,返回处理后的参数表 */ 70 | "before:create"?: YaoHook.Before; 71 | /**在关联处理器 create 之后运行 */ 72 | "after:create"?: YaoHook.After; 73 | /**Before Hook。在关联处理器之前运行,输入用户输入的参数表,返回处理后的参数表 */ 74 | "before:delete"?: YaoHook.Before; 75 | /**在关联处理器 delete 之后运行 */ 76 | "after:delete"?: YaoHook.After; 77 | /**在关联处理器 update 之后运行 */ 78 | "before:update"?: YaoHook.Before; 79 | /**After Hook。在关联处理器之前运行,输入关联处理器返回结果,返回处理后的结果 */ 80 | "after:update"?: YaoHook.After; 81 | } 82 | 83 | // BindActionDSL action.bind 84 | export interface BindActionDSL { 85 | /**绑定模型名称 */ 86 | model?: string; 87 | /**操作store名称 */ 88 | store?: string; 89 | /**绑定表格 */ 90 | table?: string; 91 | /**绑定另外一个表单 */ 92 | form?: string; 93 | /**绑定选项 */ 94 | option?: { [key: string]: any } & { 95 | form?: string; 96 | withs?: { [key: string]: YaoQueryParam.QueryWith }; 97 | }; 98 | } 99 | 100 | // LayoutDSL the form layout DSL 101 | /**表单布局配置 */ 102 | export interface LayoutDSL { 103 | /**主键字段 */ 104 | primary?: string; 105 | /**自定义操作 */ 106 | actions?: YaoComponent.Actions; 107 | /**表单布局配置 */ 108 | form?: ViewLayoutDSL; 109 | /**全局配置 */ 110 | config?: FormConfig; 111 | } 112 | 113 | /**表单布局配置项 */ 114 | type FormConfig = { 115 | /**是否隐藏面包屑导航 */ 116 | hideBreadcrumb?: boolean; 117 | /**是否显示字段锚点 */ 118 | showAnchor?: boolean; 119 | /**自定义查看模式标题 */ 120 | viewTitle?: string; 121 | /**自定义编辑模式标题 */ 122 | editTitle?: string; 123 | } & CommonConfig; 124 | 125 | // FieldsDSL the form fields DSL 126 | export interface FieldsDSL { 127 | /**Form页面字段列表布局 */ 128 | form?: YaoField.Columns; 129 | // formMap?: { [key: string]: field.ColumnDSL }; 130 | } 131 | 132 | export interface OpenRef { 133 | /**引用表单 */ 134 | Form?: { 135 | /**查看或是编辑 */ 136 | type: "view" | "edit"; 137 | /**模型*/ 138 | model: string; 139 | /**id标识可使用{{}} */ 140 | id: string; 141 | }; 142 | /**引用页面,Xgen未启用 */ 143 | Page?: { 144 | /**图表 */ 145 | type: "chart"; 146 | /**模型 */ 147 | model: string; 148 | /**标识 */ 149 | id: string; 150 | }; 151 | } 152 | export interface FloatContentItem { 153 | /**名称标识 */ 154 | name: string; 155 | /**参数 */ 156 | payload: OpenRef; 157 | } 158 | 159 | export interface Reference { 160 | flatContent?: { 161 | /**名称标识 */ 162 | name: string; 163 | /**默认打开 */ 164 | defaultOpen?: boolean; 165 | /**参数 */ 166 | payload: OpenRef & { 167 | /**宽度px,默认600 */ 168 | width?: number | string; 169 | }; 170 | }; 171 | /**浮动页面 */ 172 | floatContents?: Array; 173 | } 174 | 175 | export interface FormProperty { 176 | // extends YaoComponent.PropsDSL { 177 | /**页面加载时是否触发Form字段的onValueChange事件 */ 178 | onLoadSync?: boolean; 179 | /**参照对象 */ 180 | reference?: Reference; 181 | /**显示分区分隔线 */ 182 | showSectionDivideLine?: true; 183 | } 184 | // ViewLayoutDSL layout.form 185 | export interface ViewLayoutDSL { 186 | props?: FormProperty; 187 | /**节点配置 */ 188 | sections?: SectionDSL[]; 189 | /** 自定义页面 */ 190 | frame?: Frame; 191 | } 192 | 193 | export interface Frame { 194 | url: string; 195 | params?: Record; 196 | } 197 | 198 | // SectionDSL layout.form.sections[*] 199 | /**布局中的分区配置 */ 200 | export interface SectionDSL { 201 | /*标题*/ 202 | title?: string; 203 | /**长描述 */ 204 | desc?: string; 205 | /**列 */ 206 | columns?: Column[]; 207 | } 208 | 209 | // Column table columns 210 | export interface Column extends YaoComponent.LayoutColumnDSL { 211 | /**Tab标签页配置 */ 212 | tabs?: SectionDSL[]; 213 | // instanceDSL?: ; 214 | } 215 | } 216 | export default YaoForm; 217 | -------------------------------------------------------------------------------- /src/types/dsl/hook.d.ts: -------------------------------------------------------------------------------- 1 | export namespace YaoHook { 2 | export type Before = string; 3 | export type After = string; 4 | } 5 | export default YaoHook; 6 | -------------------------------------------------------------------------------- /src/types/dsl/importer.d.ts: -------------------------------------------------------------------------------- 1 | export namespace YaoImport { 2 | //yao/importer/types.go 3 | 4 | /**数据导入器 */ 5 | export interface Importer { 6 | /**版本【管理字段】 */ 7 | version?: string; 8 | /**描述【管理字段】 */ 9 | decription?: string; 10 | /**备注【管理字段】 */ 11 | comment?: string; 12 | /**导入名称*/ 13 | title?: string; 14 | /**处理器名称*/ 15 | process: string; 16 | /**The process import output*/ 17 | output?: string; 18 | /**字段列表*/ 19 | columns: Column[]; 20 | /**导入配置项*/ 21 | option?: Option; 22 | /**许可导入规则*/ 23 | rules?: { [key: string]: string }; 24 | // sid?: string; sid 25 | $schema?: string; 26 | } 27 | 28 | /**导入字段定义 */ 29 | export interface Column { 30 | /**字段标签 */ 31 | label: string; 32 | /**字段名称 */ 33 | name: string; 34 | /**字段名称(原始值),不需要配置*/ 35 | field?: string; 36 | /**匹配建议 */ 37 | match?: string[]; 38 | /**清洗规则定义 */ 39 | rules?: string[]; 40 | /**是否可以为空 */ 41 | nullable?: boolean; 42 | /**是否为主键 */ 43 | primary?: boolean; 44 | 45 | // key?: string; 字段键名 Object Only 46 | // isArray?: boolean; 字段是否为 Array 47 | // isObject?: boolean; 字段是否为 Object 48 | } 49 | 50 | /**导入配置项定 */ 51 | export interface Option { 52 | /**使用已匹配过的模板 */ 53 | useTemplate?: boolean; 54 | /**默认数据模板链接 */ 55 | templateLink?: string; 56 | /**每次处理记录数量 */ 57 | chunkSize?: number; 58 | /**显示字段映射界面方式 auto 匹配模板失败显示, always 一直显示, never 不显示 */ 59 | mappingPreview?: string; 60 | /**数据预览界面方式 auto 有异常数据时显示, always 一直显示, never 不显示 */ 61 | dataPreview?: string; 62 | } 63 | 64 | /**字段映射表,输出值*/ 65 | export interface Mapping { 66 | /**数据表 */ 67 | sheet: string; 68 | /**第一列的位置 */ 69 | colStart: number; 70 | /**第一行的位置 */ 71 | rowStart: number; 72 | /**字段数据列表 */ 73 | data: Binding[]; 74 | /**是否自动匹配 */ 75 | autoMatching: boolean; 76 | /**是否通过已传模板匹配 */ 77 | templateMatching: boolean; 78 | } 79 | 80 | /** 数据绑定*/ 81 | export interface Binding { 82 | /**目标字段标签 */ 83 | label: string; 84 | /**目标字段名称 */ 85 | field: string; 86 | /**源关联字段名称 */ 87 | name: string; 88 | /**源关联字段坐标 */ 89 | axis: string; 90 | /**示例数据 */ 91 | value: string; 92 | /**清洗规则 */ 93 | rules: string[]; 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /src/types/dsl/index.d.ts: -------------------------------------------------------------------------------- 1 | export * from "./model"; 2 | export * from "./table"; 3 | export * from "./form"; 4 | export * from "./list"; 5 | export * from "./chart"; 6 | export * from "./dashboard"; 7 | 8 | export * from "./flow"; 9 | export * from "./query"; 10 | export * from "./query_param"; 11 | 12 | export * from "./app"; 13 | export * from "./login"; 14 | export * from "./api_http"; 15 | export * from "./api_rest"; 16 | 17 | export * from "./connector"; 18 | export * from "./schedule"; 19 | export * from "./service"; 20 | export * from "./socket"; 21 | export * from "./store"; 22 | export * from "./task"; 23 | export * from "./web_socket"; 24 | export * from "./widget"; 25 | export * from "./importer"; 26 | 27 | export * from "./component"; 28 | export * from "./field"; 29 | 30 | export * from "./share_types"; 31 | 32 | export * from "./menu"; 33 | -------------------------------------------------------------------------------- /src/types/dsl/list.d.ts: -------------------------------------------------------------------------------- 1 | import { CommonConfig, HookType } from "./share_types"; 2 | import YaoAction from "./action"; 3 | import YaoComponent from "./component"; 4 | import YaoField from "./field"; 5 | import YaoHook from "./hook"; 6 | 7 | export namespace YaoList { 8 | // DSL the list DSL 9 | export interface ListDSL { 10 | /**版本【管理字段】 */ 11 | version?: string; 12 | /**描述【管理字段】 */ 13 | decription?: string; 14 | /**备注【管理字段】 */ 15 | comment?: string; 16 | /**唯一标识 */ 17 | id?: string; 18 | // root?: string; 19 | name: string; 20 | /**处理器操作 */ 21 | action: ActionDSL; 22 | /**布局 */ 23 | layout?: LayoutDSL; 24 | /**字段定义 */ 25 | fields?: FieldsDSL; 26 | /**配置 */ 27 | config?: CommonConfig; 28 | // cprops?: field.CloudProps; 29 | // computable?: compute.Computable; 30 | // mapping?: mapping.Mapping; 31 | /**hook事件,框架自动生成 */ 32 | hooks?: HookType; 33 | $schema?: string; 34 | } 35 | 36 | // ActionDSL the list action DSL 37 | export interface ActionDSL { 38 | bind?: BindActionDSL; 39 | setting?: YaoAction.Process; 40 | component?: YaoAction.Process; 41 | upload?: YaoAction.Process; 42 | download?: YaoAction.Process; 43 | get?: YaoAction.Process; 44 | save?: YaoAction.Process; 45 | "before:find"?: YaoHook.Before; 46 | "after:find"?: YaoHook.After; 47 | "before:save"?: YaoHook.Before; 48 | "after:save"?: YaoHook.After; 49 | } 50 | 51 | // BindActionDSL action.bind 52 | export interface BindActionDSL { 53 | model?: string; 54 | store?: string; 55 | table?: string; 56 | option?: { [key: string]: any }; 57 | } 58 | 59 | // LayoutDSL the list layout DSL 60 | export interface LayoutDSL { 61 | list?: ViewLayoutDSL; 62 | config?: CommonConfig; 63 | } 64 | 65 | // OperationLayoutDSL layout.operation 66 | export interface OperationLayoutDSL { 67 | preset?: { [key: string]: { [key: string]: any } }; 68 | actions?: YaoComponent.ActionDSL[]; 69 | } 70 | 71 | // FieldsDSL the list fields DSL 72 | export interface FieldsDSL { 73 | list?: YaoField.Columns; 74 | // listMap?: { [key: string]: field.ColumnDSL }; 75 | } 76 | 77 | // ViewLayoutDSL layout.list 78 | export interface ViewLayoutDSL { 79 | props?: YaoComponent.PropsDSL; 80 | columns?: YaoComponent.LayoutColumnDSL[]; 81 | } 82 | } 83 | export default YaoList; 84 | -------------------------------------------------------------------------------- /src/types/dsl/login.d.ts: -------------------------------------------------------------------------------- 1 | export namespace YaoLogin { 2 | // { 3 | // "name": "::Admin Login", 4 | // "action": { 5 | // "process": "yao.login.Admin", 6 | // "args": [":payload"] 7 | // }, 8 | // "layout": { 9 | // "entry": "/x/Chart/dashboard", 10 | // "captcha": "yao.utils.Captcha", 11 | // "cover": "/assets/images/login/cover.svg", 12 | // "slogan": "::Make Your Dream With Yao App Engine", 13 | // "site": "https://yaoapps.com" 14 | // } 15 | // } 16 | 17 | export interface LoginDSL { 18 | /**版本【管理字段】 */ 19 | version?: string; 20 | /**描述【管理字段】 */ 21 | decription?: string; 22 | /**备注【管理字段】 */ 23 | comment?: string; 24 | /**唯一标识 */ 25 | // id?: string; 26 | /**登录界面名称, 支持多语言 */ 27 | name?: string; 28 | /**自定义用户登录逻辑处理器,默认是yao.login.Admin */ 29 | action?: ActionDSL; 30 | /**页面布局定义。设置登录界面封面、登录后跳转路由地址等 */ 31 | layout?: LayoutDSL; 32 | /**第三方登录 */ 33 | thirdPartyLogin?: ThirdPartyLoginDSL[]; 34 | $schema?: string; 35 | } 36 | 37 | export interface ActionDSL { 38 | /**用户登录处理逻辑 */ 39 | process?: string; 40 | /**登录处理器参数,参考http 接口的传参数,可使用:payload引用传入参数*/ 41 | args?: any[]; 42 | } 43 | 44 | export interface LayoutDSL { 45 | /**成功登录后,转向此地址。**注意: 不含管理后台路由前缀** */ 46 | entry?: string; 47 | /**自定义动态认证码生成处理器,默认是yao.utils.Captcha*/ 48 | captcha?: string; 49 | /**登录界面封面图片, 图片相对地址。可将图片放到应用公开目录 `public` ,例如: `/data/app/public/images/cover.png`, 填写的地址为 `/images/cover.png` */ 50 | cover?: string; 51 | /**登录界面广告语,支持多语言 */ 52 | slogan?: string; 53 | /**登录界面封面图片下方链接地址 */ 54 | site?: string; 55 | } 56 | 57 | export interface ThirdPartyLoginDSL { 58 | /**按钮标题 */ 59 | title?: string; 60 | /**第三方登录跳转地址 */ 61 | href?: string; 62 | /**按钮前缀图标 */ 63 | icon?: string; 64 | /**是否在浏览器打开新标签 */ 65 | blank?: boolean; 66 | } 67 | } 68 | export default YaoLogin; 69 | -------------------------------------------------------------------------------- /src/types/dsl/mapping.d.ts: -------------------------------------------------------------------------------- 1 | export namespace YaoMapping { 2 | // Mapping common 3 | export interface Mapping { 4 | filters: { [key: string]: string }; 5 | columns: { [key: string]: string }; 6 | actions: { [key: string]: string }; 7 | } 8 | } 9 | export default YaoMapping; 10 | -------------------------------------------------------------------------------- /src/types/dsl/menu.d.ts: -------------------------------------------------------------------------------- 1 | export namespace YaoMenu { 2 | export interface Menu { 3 | items: MenuItem[]; 4 | setting: MenuItem[]; 5 | } 6 | /**0.10.3以前的版本 */ 7 | export type MenuItems = MenuItem[]; 8 | export interface MenuItem { 9 | /**版本【管理字段】 */ 10 | version?: string; 11 | /**描述【管理字段】 */ 12 | decription?: string; 13 | /**备注【管理字段】 */ 14 | comment?: string; 15 | /**唯一标识 */ 16 | id?: number; 17 | /**菜单名称,显示标题 */ 18 | name: string; 19 | /**菜单图标,一级菜单有效. 命名为 `icon-<图标名称>`, [查看可用图标](https://feathericons.com/)*/ 20 | icon?: string; 21 | /**上级菜单 */ 22 | parent?: string; 23 | /**菜单路由地址,**不含管理后台路由前缀** */ 24 | path: string; 25 | /**是否显示为图标, 二级菜单有效 `0` 文字, `1` 图标 */ 26 | blocks?: boolean | 0 | 1; 27 | /**二级菜单默认显示方式, `1` 打开, `0` 关闭*/ 28 | visible_menu?: boolean | 0 | 1; 29 | /**状态 */ 30 | status?: "enabled" | "disabled"; 31 | /**排名 */ 32 | rank?: number; 33 | /**上标 */ 34 | badge?: number; 35 | /**二级菜单列表*/ 36 | children?: MenuItem[]; 37 | /**不展示数字,只有一个小红点 */ 38 | dot?: boolean; 39 | /**额外字段 */ 40 | extra?: any; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/types/dsl/neo.d.ts: -------------------------------------------------------------------------------- 1 | export declare namespace YaoNeo { 2 | 3 | } -------------------------------------------------------------------------------- /src/types/dsl/pipe.d.ts: -------------------------------------------------------------------------------- 1 | export namespace YaoPipe { 2 | export interface Pipe { 3 | /** 名称 */ 4 | name: string; 5 | /** 节点配置 */ 6 | nodes: Node[]; 7 | /** 标签说明 */ 8 | label?: string; 9 | /** 钩子设置 */ 10 | hooks?: Hooks; 11 | /** 输出 */ 12 | output?: any; // Consider using a more specific type or generics if possible 13 | /** 输入 */ 14 | input?: Input; 15 | /** 处理器白名单,只有在白名单中的处理器才会被调用 */ 16 | whitelist?: Whitelist; 17 | /** 节点跳转 */ 18 | goto?: string; 19 | } 20 | 21 | export interface Context { 22 | // Note: In TypeScript, there's no direct equivalent of Golang's embedded types. Use composition instead. 23 | pipe: Pipe; 24 | // Other fields like id, parent, context, global, sid, current, in, out, history, input, and output are not directly translatable to TypeScript interfaces due to their private nature or complex types in Golang that have no direct TypeScript equivalents. 25 | } 26 | 27 | export interface Hooks { 28 | progress?: string; 29 | } 30 | 31 | /** Pipe节点配置 */ 32 | export interface Node { 33 | /** 节点名称,同时作为节点引用的依据 */ 34 | name: string; 35 | /** 内部节点类型,不需要直接设置,优先级:process > request > ai > user-input > switch */ 36 | type?: "user-input" | "ai" | "process" | "switch" | "request"; 37 | /** 标签说明 */ 38 | label?: string; 39 | /** 处理器,设置处理器后,节点类型自动设置成process */ 40 | process?: YaoProcess; 41 | /** ai提示词,设置后节点类型自动设置成ai */ 42 | prompts?: Prompt[]; 43 | /** ai模型,默认是 gpt-3.5-turbo*/ 44 | model?: string; 45 | /** ai请求时的payload选项 */ 46 | options?: Record; // Map in Golang to an object in TypeScript 47 | /** 请求 */ 48 | request?: Request; 49 | /** 接受用户输入时的客户端cli | web | app | wxapp */ 50 | ui?: string; 51 | /** 自动填写 */ 52 | autofill?: AutoFill; 53 | /** 当是switch节点时,进行条件判断,只有一个条件生效 */ 54 | case?: Record; // Map in Golang to an object in TypeScript, where key is string and value is Pipe 55 | /** 节点输入参数 */ 56 | input?: Input; 57 | /** 节点输出参数 */ 58 | output?: any; // Consider using a more specific type or generics if possible 59 | /** 跳转表达式,满足一定条件后跳转到指定的节点 */ 60 | goto?: string; 61 | } 62 | 63 | // Assuming Whitelist, Input, and Args are simple type aliases in TypeScript 64 | export type Whitelist = Record; 65 | export type Input = any[]; // Consider using a more specific type or generics if possible 66 | export type Args = any[]; // Consider using a more specific type or generics if possible 67 | 68 | export interface Data extends Record {} // Simple extension of Record for better semantics 69 | 70 | export interface ResumeContext { 71 | __id: string; 72 | __type: string; 73 | __ui: string; 74 | input: Input; 75 | node: Node; 76 | data: Data; 77 | } 78 | 79 | export interface AutoFill { 80 | /** 可以是表达式,解析后的值作为客户端命令的输入参数 */ 81 | value: any; // Consider using a more specific type or generics if possible 82 | /** 自动处理,如果是exit,会自动的退出处理 */ 83 | action?: string; 84 | } 85 | 86 | export interface Case { 87 | input?: Input; 88 | output?: any; // Consider using a more specific type or generics if possible 89 | /** 条件子节点,满足case条件后,会处理子节点的配置 */ 90 | nodes?: Node[]; 91 | } 92 | 93 | export interface Prompt { 94 | role?: string; 95 | content: string; 96 | } 97 | 98 | export interface YaoProcess { 99 | name: string; 100 | args?: Args; 101 | } 102 | 103 | interface Request { 104 | // Assuming the Request struct will have fields defined later 105 | } 106 | 107 | export interface ChatCompletionChunk { 108 | id: string; 109 | object: string; 110 | created: number; 111 | model: string; 112 | systemFingerprint: any; // Consider using a more specific type or generics if possible 113 | choices: Choice[]; 114 | } 115 | 116 | export interface Choice { 117 | index: number; 118 | delta: DeltaStruct; 119 | logprobs?: any; // Consider using a more specific type or generics if possible 120 | finishReason?: any; // Consider using a more specific type or generics if possible 121 | } 122 | 123 | export interface DeltaStruct { 124 | content: string; 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /src/types/dsl/query.d.ts: -------------------------------------------------------------------------------- 1 | /**QueryOrder Order 查询排序 */ 2 | 3 | export namespace YaoQuery { 4 | /**QueryDSL Gou Query Domain Specific Language*/ 5 | 6 | export interface QueryDSL { 7 | /**备注 */ 8 | comment?: string; 9 | /**选择字段列表*/ 10 | select?: Expression[]; 11 | /**查询数据表名称或数据模型*/ 12 | from?: string; 13 | /**数据查询条件*/ 14 | wheres?: Array; 15 | /**排序条件*/ 16 | orders?: Orders; 17 | /**记录开始位置*/ 18 | offset?: number; 19 | /**只读取第一条 */ 20 | first?: boolean | any; 21 | /**读取数据的数量*/ 22 | limit?: number; 23 | /**分页查询当前页面页码*/ 24 | page?: number; 25 | /**每页读取记录数量*/ 26 | pagesize?: number; 27 | /**设定为 true, 查询结果为 []Record; 设定为 false, 查询结果为 Paginate, 仅在设定 `page` 或 `pagesize`时有效。*/ 28 | "data-only"?: boolean; 29 | /**聚合字段和统计层级设置*/ 30 | groups?: (Group | string)[]; 31 | /**聚合查询结果筛选, 仅在设定 `groups` 时有效*/ 32 | havings?: Array; 33 | /**联合查询。多个查询将结果合并为一张表*/ 34 | unions?: Array; 35 | /**子查询。按 QueryDSL 描述查询逻辑,生成一张二维数据表或数值。*/ 36 | query?: QueryDSL; 37 | /**子查询别名*/ 38 | name?: string; 39 | /**表连接。连接数据量较大的数据表时 **不推荐使用**。| 否 |*/ 40 | joins?: Array; 41 | /**SQL 语句。**非必要,勿使用***/ 42 | sql?: SQL; 43 | /**是否开启调试(开启后计入查询日志)*/ 44 | debug?: boolean; 45 | } 46 | 47 | export type Expression = string; 48 | 49 | /**QueryCondition 查询条件*/ 50 | export interface Condition { 51 | /**查询字段*/ 52 | field?: string; 53 | /**匹配数值*/ 54 | value?: string; 55 | /** 56 | * 匹配关系运算符 `=`,`like`,`in`,`>=` 等,默认为 `=` 57 | * 58 | *| 匹配关系 | 说明 | 59 | *| -------- | -------------------------------- | 60 | *| = | 默认值 等于 WHERE 字段 = 数值 | 61 | *| like | 匹配 WHERE 字段 like 数值 | 62 | *| match | 匹配 WHERE 字段 全文检索 | 63 | *| > | 大于 WHERE 字段 > 数值 | 64 | *| >= | 大于等于 WHERE 字段 >= 数值 | 65 | *| < | 小于 WHERE 字段 < 数值 | 66 | *| <= | 小于等于 WHERE 字段 <= 数值 | 67 | *| is | 为空 WHERE 字段 null / not null | 68 | *| in | 列表包含 WHERE 字段 IN (数值...) | 69 | *| <> | 不等于匹配值 | 70 | */ 71 | op?: string; 72 | /**true 查询条件逻辑关系为 or, 默认为 false 查询条件逻辑关系为 and*/ 73 | or?: boolean; 74 | /**子查询, 如设定 query 则忽略 value 数值。*/ 75 | query?: QueryDSL; 76 | /**查询条件注释*/ 77 | comment?: string; 78 | 79 | /** Supported operators with their respective value types */ 80 | "="?: any; 81 | ">"?: any; 82 | ">="?: any; 83 | "<"?: any; 84 | "<="?: any; 85 | "<>"?: any; 86 | like?: any; 87 | match?: any; 88 | in?: any; 89 | /** 90 | * check is field is null or not 91 | * 92 | * example: 93 | * 94 | * { "field": "name", "is": "null" }, 95 | * 96 | * { "field": "name", "is": "not null" }, 97 | */ 98 | is?: null; 99 | } 100 | /**Where 查询条件*/ 101 | export interface Where extends Condition { 102 | /**分组查询。用于 condition 1 and ( condition 2 OR condition 3) 的场景*/ 103 | wheres?: Where[]; 104 | /**可以使用类似简化的操作,比如:{ ":score": "分数", "in": [10, 20] }*/ 105 | [key: string]: any; 106 | } 107 | /**Order 排序条件*/ 108 | export interface Order { 109 | /**排序字段*/ 110 | field: string; 111 | /**排序方式*/ 112 | sort?: string; 113 | /**查询条件注释*/ 114 | comment?: string; 115 | } 116 | 117 | /**Orders 排序条件集合*/ 118 | export type Orders = Order[]; 119 | 120 | /**Group 聚合条件*/ 121 | export interface Group { 122 | /**排序字段*/ 123 | field?: Expression; 124 | /**同时返回多层级统计结果,对应聚合字段数值的名称。*/ 125 | rollup?: string; 126 | /**查询条件注释*/ 127 | comment?: string; 128 | } 129 | /**Groups 聚合条件集合*/ 130 | export type Groups = Group[] | string[]; 131 | 132 | /**Having 聚合结果筛选条件*/ 133 | export interface Having { 134 | /**分组查询。用于 condition 1 and ( condition 2 OR condition 3) 的场景*/ 135 | havings?: Having[]; 136 | } 137 | 138 | /**Join 数据表连接*/ 139 | export interface Join { 140 | /**查询数据表名称或数据模型*/ 141 | from?: string; 142 | /**关联连接表字段名称*/ 143 | key?: Expression | string; 144 | /**关联目标表字段名称(需指定表名或别名)*/ 145 | foreign?: Expression | string; 146 | /**true 连接方式为 LEFT JOIN, 默认为 false 连接方式为 JOIN*/ 147 | left?: boolean; 148 | /**true 连接方式为 RIGHT JOIN, 默认为 false 连接方式为 JOIN*/ 149 | right?: boolean; 150 | /**关联条件注释*/ 151 | comment?: string; 152 | } 153 | 154 | /**SQL 语句*/ 155 | export interface SQL { 156 | /**SQL 语句,不可跟其它sql查询条件一起混用*/ 157 | stmt?: string; 158 | /**绑定参数表*/ 159 | args?: any[]; 160 | /**SQL语句注释*/ 161 | comment?: string; 162 | } 163 | } 164 | -------------------------------------------------------------------------------- /src/types/dsl/query_param.d.ts: -------------------------------------------------------------------------------- 1 | export namespace YaoQueryParam { 2 | /**QueryParam 数据查询器参数 */ 3 | export interface QueryParam { 4 | /**备注【管理字段】 */ 5 | comment?: string; 6 | /**模型名称 */ 7 | model?: string; 8 | /**表格名称 */ 9 | table?: string; 10 | /**别名 */ 11 | alias?: string; 12 | /**导出数据时的前缀 */ 13 | export?: string; 14 | /**选择字段清单*/ 15 | select?: string[]; 16 | /**查询条件*/ 17 | wheres?: QueryWhere[]; 18 | /**排序条件*/ 19 | orders?: QueryOrder[]; 20 | /**限制返回记录条目*/ 21 | limit?: number; 22 | /**偏移量*/ 23 | offset?: number; 24 | /**当前页码*/ 25 | page?: number; 26 | /**每页显示记录数量*/ 27 | pagesize?: number; 28 | /**读取关联模型*/ 29 | withs?: { [key: string]: QueryWith }; //Map; 30 | } 31 | 32 | /**QueryOrder Order 查询排序 */ 33 | export interface QueryOrder { 34 | /**如按关联模型的字段排序,则填写关联模型名称*/ 35 | rel?: string; 36 | /**字段名称*/ 37 | column: string; 38 | /**排序方式, `desc`, `asc`, 默认为 `asc`*/ 39 | option?: "desc" | "asc"; 40 | } 41 | /** 42 | * QueryWhere Where 查询条件 43 | */ 44 | export interface QueryWhere { 45 | /**如按关联模型的字段查询,则填写关联模型名称 */ 46 | rel?: string; 47 | /**字段名称*/ 48 | column?: string; 49 | /**匹配数值*/ 50 | value?: any; 51 | 52 | /**查询方法 `where`,`orwhere`, `wherein`, `orwherein`... 默认为 `where`, 53 | * 54 | *| 查询方法 | 说明 | 55 | *| -------- | ------------------------------------- | 56 | *| where | WHERE 字段 = 数值, WHERE 字段 >= 数值 | 57 | *| orwhere | ... OR WHERE 字段 = 数值 | 58 | */ 59 | method?: string; 60 | 61 | /** 62 | * 匹配关系 `eq`,`like`,`in`,`gt` 等,默认为 `eq` 63 | * 64 | *| 匹配关系 | 说明 | 65 | *| -------- | -------------------------------- | 66 | *| eq | 默认值 等于 WHERE 字段 = 数值 | 67 | *| like | 匹配 WHERE 字段 like 数值 | 68 | *| match | 匹配 WHERE 字段 全文检索 | 69 | *| gt | 大于 WHERE 字段 > 数值 | 70 | *| ge | 大于等于 WHERE 字段 >= 数值 | 71 | *| lt | 小于 WHERE 字段 < 数值 | 72 | *| le | 小于等于 WHERE 字段 <= 数值 | 73 | *| null | 为空 WHERE 字段 IS NULL | 74 | *| notnull | 不为空 WHERE 字段 IS NOT NULL | 75 | *| in | 列表包含 WHERE 字段 IN (数值...) | 76 | *| ne | 不等于匹配值 | 77 | */ 78 | op?: 79 | | "eq" 80 | | "like" 81 | | "match" 82 | | "gt" 83 | | "ge" 84 | | "lt" 85 | | "le" 86 | | "null" 87 | | "notnull" 88 | | "in" 89 | | "ne"; 90 | /**分组查询 */ 91 | wheres?: QueryWhere[]; 92 | } 93 | 94 | /**With relations 关联查询 */ 95 | export interface QueryWith { 96 | name?: string; 97 | query?: QueryParam; 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /src/types/dsl/schedule.d.ts: -------------------------------------------------------------------------------- 1 | export namespace YaoSchedule { 2 | export interface Schedule { 3 | /**版本【管理字段】 */ 4 | version?: string; 5 | /**描述【管理字段】 */ 6 | decription?: string; 7 | /**备注【管理字段】 */ 8 | comment?: string; 9 | /**名称 */ 10 | name: string; 11 | /**处理器,处理器与task二选一*/ 12 | process?: string; 13 | /**计划定时执行的时间,写法和 Linux 的 crontab 是一样的*/ 14 | schedule: string; 15 | /**任务名称,使用task.json定义的任务*/ 16 | task?: string; 17 | /**处理器参数 */ 18 | args?: any[]; 19 | // id?: cron.EntryID; 20 | // enabled?: boolean; 21 | // cron?: cron.Cron; 22 | $schema?: string; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/types/dsl/service.d.ts: -------------------------------------------------------------------------------- 1 | export namespace YaoService { 2 | /** 3 | [Unit] 4 | Description={{.Description}} 5 | Requires={{.Dependencies}} 6 | After={{.Dependencies}} 7 | 8 | [Service] 9 | PIDFile=/var/run/{{.Name}}.pid 10 | ExecStartPre=/bin/rm -f /var/run/{{.Name}}.pid 11 | ExecStart={{.Path}} {{.Args}} 12 | Restart=on-failure 13 | WorkingDirectory=/ 14 | User=root 15 | Group=root 16 | StandardOutput=file:/var/log/yao-{{.Name}}.log 17 | StandardError=file:/var/log/yao-{{.Name}}-error.log 18 | */ 19 | 20 | // [Install] 21 | // WantedBy=multi-user.target 22 | 23 | // Service embedded daemon 24 | // 25 | // { 26 | // "name": "Server for receiving RFID", 27 | // "description": "Server for receiving RFID", 28 | // "version": "0.9.2", 29 | // "restart": "on-failure", 30 | // "requires": ["servers.rfid_server"], 31 | // "after": ["servers.rfid_server"], 32 | // "error": "/var/log/test.err" 33 | // "output": "/var/log/test.log" 34 | // "process": "servers.rfid_client", 35 | // "args": ["192.168.1.192", 6000], 36 | // "user": "root", 37 | // "group": "root" 38 | // } 39 | 40 | //gou/service/types.go 41 | 42 | /**后台服务定义,不支持windows操作系统 */ 43 | export interface Service { 44 | /**版本【管理字段】 */ 45 | version?: string; 46 | /**描述【管理字段】 */ 47 | decription?: string; 48 | /**备注【管理字段】 */ 49 | comment?: string; 50 | /**名称 */ 51 | name?: string; 52 | /**处理器,运行目录是环境变量YAO_ROOT,或是使用当前目录 */ 53 | process?: string; 54 | /**作业运行命令,默认是`yao run `,使用yao执行脚本等,可替换成其它的系统命令*/ 55 | command?: string; 56 | /**前置作业 */ 57 | requires?: string[]; 58 | /**前置作业 */ 59 | after?: string[]; 60 | /**重启条件,默认on-failure */ 61 | restart?: string; 62 | /**工作目录 */ 63 | workdir?: string; 64 | /**处理器运行的参数 */ 65 | args?: any[]; 66 | /**错误日志文件路径,默认/var/log/yao-{{.Name}}-error.log*/ 67 | error?: string; 68 | /**结果输出文件路径,默认/var/log/yao-{{.Name}}.log */ 69 | output?: string; 70 | /**运行用户,默认User=root*/ 71 | user?: string; 72 | /**运行用户组,Group=root*/ 73 | group?: string; 74 | // Daemon?: Daemon; 75 | $schema?: string; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/types/dsl/share_types.d.ts: -------------------------------------------------------------------------------- 1 | export type CommonConfig = { 2 | /**是否满屏显示表格 */ 3 | full?: boolean; 4 | }; 5 | 6 | /**hook事件,收集编辑控件的$on:change事件 */ 7 | export type HookType = { 8 | [key: string]: any; 9 | /**收集编辑控件的$on:change事件 */ 10 | onChange: { [key: string]: any }; 11 | }; 12 | 13 | export type MapStr = { 14 | [key: string]: string; 15 | }; 16 | export type MapAny = { 17 | [key: string]: any; 18 | }; 19 | -------------------------------------------------------------------------------- /src/types/dsl/socket.d.ts: -------------------------------------------------------------------------------- 1 | export namespace YaoSocket { 2 | // export interface Option { 3 | // protocol?: string; // TCP/UDP 4 | // host?: string; 5 | // port?: string; 6 | // timeout?: number; // timeout (seconds) 7 | // bufferSize?: number; // bufferSize 8 | // keepAlive?: number; // -1 not keep alive, 0 keep alive always, keep alive n seconds. 9 | // attemptAfter?: number; // Attempt attempt_after 10 | // attempts?: number; // max times try to reconnect server when connection break (client mode only) 11 | // } 12 | 13 | // Socket struct 14 | export interface Socket { 15 | /**版本【管理字段】 */ 16 | version?: string; 17 | /**描述【管理字段】 */ 18 | decription?: string; 19 | /**备注【管理字段】 */ 20 | comment?: string; 21 | name: string; 22 | mode?: "server" | "client"; // Server | client 23 | description?: string; 24 | protocol?: string; 25 | host?: string; 26 | port?: string; 27 | event?: SocketEvent; 28 | timeout?: number; // timeout (seconds) 29 | buffer?: number; // bufferSize 30 | keep?: number; // -1 not keep alive, 0 keep alive always, keep alive n seconds. 31 | process?: string; 32 | attempt_after?: number; // Attempt attempt_after 33 | attempts?: number; // max times try to reconnect server when connection break (client mode only) 34 | // client?: SocketIOClient; 35 | $schema?: string; 36 | } 37 | 38 | // SocketEvent struct 39 | export interface SocketEvent { 40 | data?: string; 41 | error?: string; 42 | closed?: string; 43 | connected?: string; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/types/dsl/store.d.ts: -------------------------------------------------------------------------------- 1 | export namespace YaoStore { 2 | // Store the kv-store setting 3 | export interface Store { 4 | /**版本【管理字段】 */ 5 | version?: string; 6 | /**描述【管理字段】 */ 7 | decription?: string; 8 | /**备注【管理字段】 */ 9 | comment?: string; 10 | /**名称 */ 11 | name: string; 12 | /**描述 */ 13 | description?: string; 14 | /**绑定连接器名称(连接器) Yao v0.10.2+ */ 15 | connector?: string; 16 | /**类型 `lru` LRU 缓存 (connector 为空时有效) */ 17 | type?: string; // warning: type is deprecated in the future new version 18 | /**配置项 `{"size":10240}` type 为 `lru` 时有效, size 为 LRU 缓存大小 */ 19 | option?: { [key: string]: any }; 20 | $schema?: string; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/types/dsl/task.d.ts: -------------------------------------------------------------------------------- 1 | export namespace YaoTask { 2 | // TaskOption the task option 3 | /**并发任务*/ 4 | export interface Task { 5 | /**版本【管理字段】 */ 6 | version?: string; 7 | /**描述【管理字段】 */ 8 | decription?: string; 9 | /**备注【管理字段】 */ 10 | comment?: string; 11 | /**任务名称*/ 12 | name: string; 13 | /**该task绑定的处理器,必须配置*/ 14 | process: string; 15 | /**作业对列大小,默认1024*/ 16 | size?: number; 17 | /**指定进程数,默认是1*/ 18 | worker_nums?: number; 19 | /**重试间隔*/ 20 | attempt_after?: number; 21 | /**失败重试次数*/ 22 | attempts?: number; 23 | /**超时时间,秒钟,默认300*/ 24 | timeout?: number; 25 | /**事件处理 */ 26 | event: { 27 | /**生成任务唯一id的回调处理器*/ 28 | next?: string; 29 | /**添加任务时触发的处理器*/ 30 | add?: string; 31 | /**添加任务时触发的处理器*/ 32 | success?: string; 33 | /**任务失败后触发处理器*/ 34 | error?: string; 35 | /**任务处理中调用处理器*/ 36 | progress?: string; 37 | }; 38 | $schema?: string; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/types/dsl/web_socket.d.ts: -------------------------------------------------------------------------------- 1 | export namespace YaoWebSocket { 2 | // export type WebSocket = Server | Client; 3 | 4 | export interface Server { 5 | /**名称 */ 6 | name?: string; 7 | /**描述 */ 8 | description?: string; 9 | /**版本 */ 10 | version?: string; 11 | /**ws协议 */ 12 | protocols?: string[]; 13 | 14 | guard?: string; 15 | /**接收的缓存区大小,按字节算 */ 16 | buffer?: BufferSize; 17 | /**限制 */ 18 | limit?: Limit; 19 | /**ws连接超时时间(秒),默认5秒 */ 20 | timeout?: number; 21 | /**ws消息处理器 */ 22 | process?: string; 23 | $schema?: string; 24 | } 25 | 26 | // WebSocket the websocket struct 27 | export interface Client extends WSClientOption { 28 | /**ws事件处理 */ 29 | event?: WebSocketEvent; 30 | // Client: WSClient; 31 | $schema?: string; 32 | } 33 | 34 | // WebSocketEvent the websocket struct 35 | /**客户端事件处理 */ 36 | export interface WebSocketEvent { 37 | /**ws数据连接回调处理器 */ 38 | data?: string; 39 | /**ws连接错误时回调处理器 */ 40 | error?: string; 41 | /**ws连接关闭时回调处理器 */ 42 | closed?: string; 43 | /**ws连接后回调处理器 */ 44 | connected?: string; 45 | } 46 | export interface WSClientOption { 47 | /**版本【管理字段】 */ 48 | version?: string; 49 | /**描述【管理字段】 */ 50 | decription?: string; 51 | /**备注【管理字段】 */ 52 | comment?: string; 53 | /**名称 */ 54 | name?: string; 55 | /**描述 */ 56 | description?: string; 57 | /**地址 */ 58 | url?: string; 59 | /**协议 */ 60 | protocols?: string[]; 61 | guard?: string; 62 | /**缓存设置 */ 63 | buffer?: BufferSize; 64 | /**超时设置(秒),默认5*/ 65 | timeout?: number; 66 | /**ping超时(秒),默认2592000 */ 67 | ping?: number; 68 | /**-1 not keep alive, 0 keep alive always, keep alive n seconds. */ 69 | keep?: number; 70 | /**多久时间后多试连接(秒),默认50 */ 71 | attempt_after?: number; 72 | /** max times try to reconnect server when connection break (client mode only) */ 73 | attempts?: number; 74 | /**时间戳 */ 75 | timestamp?: number; 76 | /**ip地址 */ 77 | ip?: string; 78 | /**端口号 */ 79 | port?: number; 80 | } 81 | 82 | export interface BufferSize { 83 | /**读取缓存区大小(大小),默认1024 */ 84 | read?: number; 85 | /**写入缓存区大小(字节),默认1024 */ 86 | write?: number; 87 | } 88 | 89 | export interface Limit { 90 | /**写等待(秒),默认10 */ 91 | "write-wait"?: number; 92 | /**回应等待(秒),默认60 */ 93 | "pong-wait"?: number; 94 | /**最大消息大小限制,单位字节,默认1024 */ 95 | "max-message"?: number; 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /src/types/dsl/widget.d.ts: -------------------------------------------------------------------------------- 1 | export namespace YaoCustomWidget { 2 | // gou/widget/types.go 3 | export interface Widget { 4 | /**版本【管理字段】 */ 5 | version?: string; 6 | /**描述【管理字段】 */ 7 | decription?: string; 8 | /**备注【管理字段】 */ 9 | comment?: string; 10 | /**Widget 名称*/ 11 | label?: string; 12 | /**Widget 介绍*/ 13 | description?: string; 14 | /**DSL 文件保存路径(相对于项目根目录) */ 15 | root?: string; 16 | /**DSL 文件扩展名 */ 17 | extension?: string; 18 | /**需要导出的模块。 在 export.js 中根据 DSL 描述,转换的 YAO 内建 widgets。 如 model, table 等。这些 widgets 与保存在项目目录中的 DSL 文件等效。 */ 19 | modules?: string[]; 20 | $schema?: string; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/types/global.d.ts: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 分页处理器返回结果 4 | */ 5 | export interface ModelPaginateResult { 6 | /**数据记录集合 */ 7 | data: T[]; 8 | /**下一页,如没有下一页返回-1*/ 9 | next: number; 10 | /**上一页,如没有上一页返回-1*/ 11 | prev: number; 12 | /**当前页码 */ 13 | page: number; 14 | /**每页记录数量 */ 15 | pagesize: number; 16 | /**总页数 */ 17 | pagecnt: number; 18 | /**总记录数 */ 19 | total: number; 20 | } -------------------------------------------------------------------------------- /src/types/runtime/console.d.ts: -------------------------------------------------------------------------------- 1 | export interface Console { 2 | /** 3 | * [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/log_static) 4 | * @param data Data to log 5 | */ 6 | log(...data: any[]): void; 7 | } 8 | 9 | export declare var console: Console; 10 | -------------------------------------------------------------------------------- /src/types/runtime/exception.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Represents a Javascript Exception. 3 | */ 4 | export declare class Exception { 5 | /** Exception code */ 6 | code: number; 7 | 8 | /** Exception message */ 9 | message: string; 10 | 11 | /** 12 | * Constructs a new Exception. 13 | * 14 | * @param message - The message describing the exception. 15 | * @param code - The code associated with the exception. 16 | * Additional arguments are supported to align with the Golang function signature. 17 | */ 18 | constructor(message: string, code: number, ...args: any[]); 19 | 20 | // /** 21 | // * Retrieves the code of the exception. 22 | // * @returns The exception code. 23 | // */ 24 | // Code(): number; 25 | 26 | // /** 27 | // * Retrieves the message of the exception. 28 | // * @returns The exception message. 29 | // */ 30 | // Message(): string; 31 | } 32 | -------------------------------------------------------------------------------- /src/types/runtime/global.d.ts: -------------------------------------------------------------------------------- 1 | // atob Decodes a base64-encoded string to its original form. 2 | // btoa Encodes a string to base64 format. 3 | 4 | /** 5 | * Encodes a string to base64 format. 6 | * 7 | * @param string The string to encode. 8 | * @returns The base64-encoded string. 9 | */ 10 | export declare function atob(encodedString: string): string; 11 | 12 | /** 13 | * Decodes a base64-encoded string to its original form. 14 | * 15 | * @param base64String The base64-encoded string to decode. 16 | * @returns The original string. 17 | */ 18 | export declare function btoa(string: string): string; 19 | 20 | /** 21 | * The engine load options. 22 | */ 23 | export type LoadOption = { 24 | /** 25 | * The action to perform. 26 | */ 27 | action: "start" | "run" | "migrate"; 28 | 29 | /** 30 | * The mode to run the action in. 31 | */ 32 | ignoredAfterLoad: boolean; 33 | 34 | /** 35 | * Is reloading the environment required? 36 | */ 37 | reload: boolean; 38 | }; 39 | 40 | /** 41 | * The migration options. 42 | */ 43 | export type MigrateOption = { 44 | /** 45 | * YAO_ENV environment variable. 46 | */ 47 | mode: "production" | "development"; 48 | 49 | /** 50 | * Is the force flag set? 51 | */ 52 | force: boolean; 53 | 54 | /** 55 | * Is the reset flag set? 56 | */ 57 | reset: boolean; 58 | }; 59 | 60 | /** 61 | * Represents a dataset with pagination information. 62 | * This type is commonly used for paginated data retrieval, 63 | * such as search results or lists with multiple pages. 64 | */ 65 | export type PagedData = { 66 | /** 67 | * The data items. 68 | */ 69 | data: Record[]; 70 | 71 | /** 72 | * The next page number. -1 no next page. 73 | */ 74 | next: number; 75 | 76 | /** 77 | * The current page number. 78 | */ 79 | page: number; 80 | 81 | /** 82 | * The total number of pages. 83 | */ 84 | pagecnt: number; 85 | 86 | /** 87 | * The number of items per page. 88 | */ 89 | pagesize: number; 90 | 91 | /** 92 | * The previous page number. -1 no previous page. 93 | */ 94 | prev: number; 95 | 96 | /** 97 | * The total number of items. 98 | */ 99 | total: number; 100 | }; 101 | -------------------------------------------------------------------------------- /src/types/runtime/http.d.ts: -------------------------------------------------------------------------------- 1 | import { HttpFile, HttpResponse } from "./process"; 2 | 3 | /** 4 | * Interface for the HTTP operations. 5 | * Provides methods to make HTTP requests using various methods like GET, POST, etc. 6 | */ 7 | export interface HTTP { 8 | /** 9 | * Sends a GET request. 10 | * @param url - The URL to send the request to. 11 | * @param query - Optional query parameters. 12 | * @param headers - Optional headers for the request. 13 | * @returns HttpResponse - The HTTP response from the GET request. 14 | */ 15 | Get( 16 | url: string, 17 | query?: 18 | | Record 19 | | [string, string][] 20 | | Array> 21 | | string, 22 | headers?: Record | Record[] 23 | ): HttpResponse; 24 | 25 | /** 26 | * Sends a POST request. 27 | * @param url - The URL to send the request to. 28 | * @param payload - Optional payload for the POST request. 29 | * @param files - Optional files for multipart/form-data requests. 30 | * @param query - Optional query parameters. 31 | * @param headers - Optional headers for the request. 32 | * @returns HttpResponse - The HTTP response from the POST request. 33 | */ 34 | Post( 35 | url: string, 36 | payload?: any, 37 | files?: Record, 38 | query?: 39 | | Record 40 | | [string, string][] 41 | | Array> 42 | | string, 43 | headers?: Record | Record[] 44 | ): HttpResponse; 45 | 46 | /** 47 | * a PUT request. 48 | * @param url - The URL to send the request to. 49 | * @param payload - Optional payload for the PUT request. 50 | * @param query - Optional query parameters. 51 | * @param headers - Optional headers for the request. 52 | * @returns HttpResponse - The HTTP response from the PUT request. 53 | */ 54 | Put( 55 | url: string, 56 | payload?: any, 57 | query?: 58 | | Record 59 | | [string, string][] 60 | | Array> 61 | | string, 62 | headers?: Record | Record[] 63 | ): HttpResponse; 64 | 65 | /** 66 | * Sends a PATCH request. 67 | * @param url - The URL to send the request to. 68 | * @param payload - Optional payload for the PATCH request. 69 | * @param query - Optional query parameters. 70 | * @param headers - Optional headers for the request. 71 | * @returns HttpResponse - The HTTP response from the PATCH request. 72 | */ 73 | Patch( 74 | url: string, 75 | payload?: any, 76 | query?: 77 | | Record 78 | | [string, string][] 79 | | Array> 80 | | string, 81 | headers?: Record | Record[] 82 | ): HttpResponse; 83 | 84 | /** 85 | * Sends a DELETE request. 86 | * @param url - The URL to send the request to. 87 | * @param payload - Optional payload for the DELETE request. 88 | * @param query - Optional query parameters. 89 | * @param headers - Optional headers for the request. 90 | * @returns HttpResponse - The HTTP response from the DELETE request. 91 | */ 92 | Delete( 93 | url: string, 94 | payload?: any, 95 | query?: 96 | | Record 97 | | [string, string][] 98 | | Array> 99 | | string, 100 | headers?: Record | Record[] 101 | ): HttpResponse; 102 | 103 | /** 104 | * Sends an HTTP request with a specified method. 105 | * @param method - The HTTP method to use (GET, POST, PUT, etc.). 106 | * @param url - The URL to send the request to. 107 | * @param payload - Optional payload for the request. 108 | * @param query - Optional query parameters. 109 | * @param headers - Optional headers for the request. 110 | * @param files - Optional files for multipart requests. 111 | * @returns HttpResponse - The HTTP response from the request. 112 | */ 113 | Send( 114 | method: string, 115 | url: string, 116 | payload?: any, 117 | query?: 118 | | Record 119 | | [string, string][] 120 | | Array> 121 | | string, 122 | headers?: Record | Record[], 123 | files?: HttpFile[] 124 | ): HttpResponse; 125 | 126 | /** 127 | * Streams the HTTP response. 128 | * @param method - The HTTP method to use (GET, POST, PUT, etc.). 129 | * @param url - The URL to send the request to. 130 | * @param callback - Callback function to handle stream data. 131 | * @param payload - Optional payload for the request. 132 | * @param query - Optional query parameters. 133 | * @param headers - Optional headers for the request. 134 | * @returns void 135 | */ 136 | Stream( 137 | method: string, 138 | url: string, 139 | callback: (data: string) => number, 140 | payload?: any, 141 | query?: 142 | | Record 143 | | [string, string][] 144 | | Array> 145 | | string, 146 | headers?: Record | Record[] 147 | ): void; 148 | } 149 | 150 | export interface UploadFile { 151 | /** 152 | * Content-Uid: The unique identifier of the file (for chunk upload) 153 | */ 154 | uid?: string; 155 | 156 | /** 157 | * Content-Range: bytes start-end/total (for chunk upload) 158 | */ 159 | range?: string; 160 | 161 | /** 162 | * Content-Sync: sync upload or not. Default is false (for chunk upload) 163 | */ 164 | sync?: boolean; 165 | 166 | /** 167 | * The name of the file 168 | */ 169 | name: string; 170 | 171 | /** 172 | * The temporary file path 173 | */ 174 | tempFile: string; 175 | 176 | /** 177 | * The size of the file 178 | */ 179 | size: number; 180 | 181 | /** 182 | * The MIME type of the file 183 | */ 184 | header: { [key: string]: string[] }; // Equivalent to textproto.MIMEHeader in Go 185 | 186 | /** 187 | * Error message 188 | */ 189 | error?: string; 190 | } 191 | 192 | export interface UploadProgress { 193 | /** 194 | * Total bytes to upload 195 | */ 196 | total: number; 197 | 198 | /** 199 | * Bytes uploaded 200 | */ 201 | uploaded: number; 202 | 203 | /** 204 | * Upload is completed 205 | */ 206 | completed: boolean; 207 | } 208 | 209 | /** 210 | * Upload File Response 211 | */ 212 | export type UploadFileResponse = 213 | | string 214 | | { 215 | /** 216 | * File path or URL 217 | */ 218 | path: string; // File path 219 | 220 | /** 221 | * Upload progress 222 | */ 223 | progress?: UploadProgress; 224 | 225 | /** 226 | * Content-Uid: The unique identifier of the file (for chunk upload) 227 | */ 228 | uid?: string; 229 | 230 | /** 231 | * additional information, can be used to previewURL, etc. 232 | */ 233 | [key: string]: any; 234 | }; 235 | /** 236 | * Http Exception 237 | */ 238 | export type HttpException = { 239 | /** 240 | * The error code. 241 | */ 242 | code: number; 243 | 244 | /** 245 | * The error message. 246 | */ 247 | message: string; 248 | }; 249 | 250 | /** 251 | * Declaration of the HTTP object. 252 | */ 253 | export declare var http: HTTP; 254 | -------------------------------------------------------------------------------- /src/types/runtime/io.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Namespace defining I/O-related types and interfaces. 3 | */ 4 | export declare namespace io { 5 | /** 6 | * Represents a generic writer interface. 7 | */ 8 | export type Writer = object; 9 | 10 | /** 11 | * Represents a generic reader interface. 12 | */ 13 | export type Reader = object; 14 | 15 | /** 16 | * Represents a combined reader and closer interface. 17 | */ 18 | export type ReadCloser = object; 19 | 20 | /** 21 | * Represents a combined writer and closer interface. 22 | */ 23 | export type WriteCloser = object; 24 | 25 | /** 26 | * Represents a response writer for handling output. 27 | */ 28 | export type ResponseWriter = object; 29 | } 30 | -------------------------------------------------------------------------------- /src/types/runtime/log.d.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | /** 4 | * Log Level enum to represent different levels of logging. 5 | */ 6 | export enum LogLevel { 7 | Trace, 8 | Debug, 9 | Info, 10 | Warn, 11 | Error, 12 | Fatal, 13 | Panic 14 | } 15 | 16 | /** 17 | * Interface for the logging functions available in the log package. 18 | */ 19 | export interface Log { 20 | /** 21 | * Logs a message at the trace level. 22 | * @param message - The message to log. 23 | * @param values - Additional values to log. 24 | */ 25 | Trace(message: string, ...values: any[]): void; 26 | 27 | /** 28 | * Logs a message at the debug level. 29 | * @param message - The message to log. 30 | * @param values - Additional values to log. 31 | */ 32 | Debug(message: string, ...values: any[]): void; 33 | 34 | /** 35 | * Logs a message at the info level. 36 | * @param message - The message to log. 37 | * @param values - Additional values to log. 38 | */ 39 | Info(message: string, ...values: any[]): void; 40 | 41 | /** 42 | * Logs a message at the warning level. 43 | * @param message - The message to log. 44 | * @param values - Additional values to log. 45 | */ 46 | Warn(message: string, ...values: any[]): void; 47 | 48 | /** 49 | * Logs a message at the error level. 50 | * @param message - The message to log. 51 | * @param values - Additional values to log. 52 | */ 53 | Error(message: string, ...values: any[]): void; 54 | 55 | /** 56 | * Logs a message at the fatal level. 57 | * @param message - The message to log. 58 | * @param values - Additional values to log. 59 | */ 60 | Fatal(message: string, ...values: any[]): void; 61 | 62 | /** 63 | * Logs a message at the panic level. 64 | * @param message - The message to log. 65 | * @param values - Additional values to log. 66 | */ 67 | Panic(message: string, ...values: any[]): void; 68 | } 69 | 70 | /** 71 | * Export a singleton instance of the Log interface. 72 | */ 73 | export declare var log: Log; 74 | 75 | -------------------------------------------------------------------------------- /src/types/runtime/neo.d.ts: -------------------------------------------------------------------------------- 1 | import { io } from "runtime/io"; 2 | /** 3 | * Namespace containing types and interfaces for the Neo system. 4 | */ 5 | export declare namespace neo { 6 | /** 7 | * Represents the context of an operation or request. 8 | */ 9 | export interface Context { 10 | /** Session ID, optional. */ 11 | sid?: string; 12 | /** The current path of the operation. */ 13 | path: string; 14 | /** Stack trace or operation stack. */ 15 | stack: string; 16 | /** The namespace where the operation is executed. */ 17 | namespace: string; 18 | /** Form data associated with the context. */ 19 | formdata: Record; 20 | /** Configuration settings for the context. */ 21 | config: Record; 22 | /** The current field being processed. */ 23 | field: Field; 24 | /** Signal data for triggering or handling events. */ 25 | signal: any; 26 | } 27 | 28 | /** 29 | * Represents a message exchanged within the system. 30 | */ 31 | export interface Message { 32 | /** Optional name of the message sender or identifier. */ 33 | name?: string; 34 | /** Optional session ID of the message sender. */ 35 | sid?: string; 36 | /** The content of the message. */ 37 | content: string; 38 | /** The role of the message sender, e.g., "user" or "agent". */ 39 | role: string; 40 | } 41 | 42 | /** 43 | * Represents the response structure of an operation or request. 44 | */ 45 | export interface Response { 46 | /** Optional text content of the response. */ 47 | text?: string; 48 | /** Error message, if any occurred. */ 49 | error?: string; 50 | /** Indicates whether the operation is completed. */ 51 | done?: boolean; 52 | /** Indicates whether the response requires confirmation. */ 53 | confirm?: boolean; 54 | /** Optional command to execute. */ 55 | command?: Command | null; 56 | /** List of actions to be performed. */ 57 | actions?: Action[]; 58 | /** Additional data returned with the response. */ 59 | data?: Record; 60 | } 61 | 62 | /** 63 | * Represents a command to be executed within the system. 64 | */ 65 | export interface Command { 66 | /** Optional unique identifier for the command. */ 67 | id?: string; 68 | /** Name of the command. */ 69 | name?: string; 70 | /** Optional request data for the command. */ 71 | request?: string; 72 | } 73 | 74 | /** 75 | * Represents an action to be performed within the system. 76 | */ 77 | export interface Action { 78 | /** Name of the action. */ 79 | name?: string; 80 | /** Type of the action, e.g., "update" or "notify". */ 81 | type: string; 82 | /** Optional payload data for the action. */ 83 | payload?: any; 84 | /** Optional identifier for the next action. */ 85 | next?: string; 86 | } 87 | 88 | /** 89 | * Represents a field in a form or data structure. 90 | */ 91 | export interface Field { 92 | /** The binding key for the field. */ 93 | bind: string; 94 | /** The value associated with the field. */ 95 | value: any; 96 | } 97 | 98 | /** 99 | * Interface for an agent that processes messages and responses. 100 | */ 101 | export interface IAgent { 102 | /** 103 | * Prepares the messages before further processing. 104 | * @param context - The current context of the operation. 105 | * @param messages - The list of messages to prepare. 106 | * @returns The modified list of messages. 107 | */ 108 | Prepare: (context: Context, messages: Message[]) => Message[]; 109 | 110 | /** 111 | * Writes responses based on the given context and messages. 112 | * @param context - The current context of the operation. 113 | * @param messages - The list of messages to process. 114 | * @param response - The initial response structure. 115 | * @param content - Optional additional content to include. 116 | * @param writer - Optional response writer for output. 117 | * @returns The final list of responses. 118 | */ 119 | Write: ( 120 | context: Context, 121 | messages: Message[], 122 | response: Response, 123 | content?: string, 124 | writer?: io.ResponseWriter 125 | ) => Response[]; 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /src/types/runtime/process/http.d.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | /** 4 | * Represents an HTTP response. 5 | */ 6 | export interface HttpResponse { 7 | // The status code of the response. 8 | status: number; 9 | 10 | // The data returned by the response. 11 | data: any; 12 | 13 | // The headers returned by the response. 14 | headers: Record; 15 | 16 | // The code of the response. 17 | code: number; 18 | 19 | // The message included in the response. 20 | message: string; 21 | } 22 | 23 | /** 24 | * Represents an HTTP file to be uploaded. 25 | */ 26 | export interface HttpFile { 27 | // The name of the file. 28 | name: string; 29 | 30 | // Optional path to the file. 31 | path?: string; 32 | 33 | // Optional base64 encoded data of the file. 34 | data?: string; 35 | } 36 | 37 | /** 38 | * Read file content 39 | * @param process http.Get 40 | * @param url string The URL to send the GET request to. 41 | * @param query Optional query parameters to include in the request. 42 | * @param headers Optional headers to include in the request. 43 | */ 44 | export declare function Process( 45 | process: `http.Get`, 46 | url: string, 47 | query?: Record | [string, string][] | Array> | string, 48 | headers?: Record | Record[], 49 | ): HttpResponse; 50 | 51 | /** 52 | * Send a POST request 53 | * @param process http.Post 54 | * @param url string The URL to send the POST request to. 55 | * @param payload Optional data to send in the body of the request. 56 | * @param files Optional files to upload with the request. 57 | * @param query Optional query parameters to include in the request. 58 | * @param headers Optional headers to include in the request. 59 | */ 60 | export declare function Process( 61 | process: `http.Post`, 62 | url: string, 63 | payload?: any, 64 | files?: Record, 65 | query?: Record | [string, string][] | Array> | string, 66 | headers?: Record | Record[], 67 | ): HttpResponse; 68 | 69 | /** 70 | * Send a PUT request 71 | * @param process http.Put 72 | * @param url string The URL to send the PUT request to. 73 | * @param payload Optional data to send in the body of the request. 74 | * @param query Optional query parameters to include in the request. 75 | * @param headers Optional headers to include in the request. 76 | */ 77 | export declare function Process( 78 | process: `http.Put`, 79 | url: string, 80 | payload?: any, 81 | query?: Record | [string, string][] | Array> | string, 82 | headers?: Record | Record[], 83 | ): HttpResponse; 84 | 85 | /** 86 | * Send a PATCH request 87 | * @param process http.Patch 88 | * @param url string The URL to send the PATCH request to. 89 | * @param payload Optional data to send in the body of the request. 90 | * @param query Optional query parameters to include in the request. 91 | * @param headers Optional headers to include in the request. 92 | */ 93 | export declare function Process( 94 | process: `http.Patch`, 95 | url: string, 96 | payload?: any, 97 | query?: Record | [string, string][] | Array> | string, 98 | headers?: Record | Record[], 99 | ): HttpResponse; 100 | 101 | /** 102 | * Send a DELETE request 103 | * @param process http.Delete 104 | * @param url string The URL to send the DELETE request to. 105 | * @param payload Optional data to send in the body of the request. 106 | * @param query Optional query parameters to include in the request. 107 | * @param headers Optional headers to include in the request. 108 | */ 109 | export declare function Process( 110 | process: `http.Delete`, 111 | url: string, 112 | payload?: any, 113 | query?: Record | [string, string][] | Array> | string, 114 | headers?: Record | Record[], 115 | ): HttpResponse; 116 | 117 | /** 118 | * Send a HEAD request 119 | * @param process http.Head 120 | * @param url string The URL to send the HEAD request to. 121 | * @param payload Optional data to send in the request. 122 | * @param query Optional query parameters to include in the request. 123 | * @param headers Optional headers to include in the request. 124 | */ 125 | export declare function Process( 126 | process: `http.Head`, 127 | url: string, 128 | payload?: any, 129 | query?: Record | [string, string][] | Array> | string, 130 | headers?: Record | Record[], 131 | ): HttpResponse; 132 | 133 | /** 134 | * Send an HTTP request 135 | * @param process http.Send 136 | * @param method string The HTTP method to use for the request (e.g., GET, POST, etc.). 137 | * @param url string The URL to send the request to. 138 | * @param payload Optional data to send in the body of the request. 139 | * @param query Optional query parameters to include in the request. 140 | * @param headers Optional headers to include in the request. 141 | * @param files Optional files to upload with the request. 142 | */ 143 | export declare function Process( 144 | process: `http.Send`, 145 | method: string, 146 | url: string, 147 | payload?: any, 148 | query?: Record | [string, string][] | Array> | string, 149 | headers?: Record | Record[], 150 | files?: HttpFile[], 151 | ): HttpResponse; 152 | 153 | /** 154 | * Stream HTTP request 155 | * @param process http.Stream 156 | * @param method string The HTTP method to use for the request (e.g., GET, POST, etc.). 157 | * @param url string The URL to send the request to. 158 | * @param handler string The handler process name for streaming data. 159 | * @param payload Optional data to send in the body of the request. 160 | * @param query Optional query parameters to include in the request. 161 | * @param headers Optional headers to include in the request. 162 | */ 163 | export declare function Process( 164 | process: `http.Stream`, 165 | method: string, 166 | url: string, 167 | handler: string, 168 | payload?: any, 169 | query?: Record | [string, string][] | Array> | string, 170 | headers?: Record | Record[], 171 | ): any; 172 | 173 | -------------------------------------------------------------------------------- /src/types/runtime/query.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Represents the query conditions used in QueryDSL. 3 | */ 4 | export interface Condition { 5 | /** Field in the query condition */ 6 | field?: Expression | string; 7 | /** Operator for the condition */ 8 | op?: string; 9 | /** Value to match against the field */ 10 | value?: any; 11 | /** Logical OR operator flag */ 12 | or?: boolean; 13 | /** Subquery for complex conditions */ 14 | query?: QueryDSL; 15 | /** A comment regarding this query condition */ 16 | comment?: string; 17 | 18 | /** Supported operators with their respective value types */ 19 | "="?: any; 20 | ">"?: any; 21 | ">="?: any; 22 | "<"?: any; 23 | "<="?: any; 24 | "<>"?: any; 25 | like?: any; 26 | match?: any; 27 | in?: any; 28 | is?: null; 29 | } 30 | 31 | /** 32 | * Represents a where clause in QueryDSL. 33 | */ 34 | export interface Where extends Condition { 35 | /** Nested where clauses for complex conditions */ 36 | wheres?: Where[]; 37 | } 38 | 39 | /** 40 | * Represents an order condition in QueryDSL. 41 | */ 42 | export interface Order { 43 | /** Field by which to sort */ 44 | field: Expression | string; 45 | /** Sort direction, e.g., ASC or DESC */ 46 | sort?: string; 47 | /** A comment regarding this order condition */ 48 | comment?: string; 49 | } 50 | 51 | /** 52 | * Represents an individual group in grouping conditions. 53 | */ 54 | export interface Group { 55 | /** Field to be grouped */ 56 | field: Expression | string; 57 | /** Rollup field name for multi-level aggregation results */ 58 | rollup?: string; 59 | /** A comment regarding this grouping condition */ 60 | comment?: string; 61 | } 62 | 63 | /** 64 | * Represents a having clause in grouping results. 65 | */ 66 | export interface Having extends Condition { 67 | /** Nested having clauses for complex conditions */ 68 | havings?: Having[]; 69 | } 70 | 71 | /** 72 | * Represents a join condition between tables. 73 | */ 74 | export interface Join { 75 | /** Source table for the join */ 76 | from: Table | string; 77 | /** Key field for the join */ 78 | key: Expression | string; 79 | /** Foreign key field for the join */ 80 | foreign: Expression | string; 81 | /** LEFT JOIN flag */ 82 | left?: boolean; 83 | /** RIGHT JOIN flag */ 84 | right?: boolean; 85 | /** A comment regarding this join condition */ 86 | comment?: string; 87 | } 88 | 89 | /** 90 | * Represents a SQL statement. 91 | */ 92 | export interface SQL { 93 | /** SQL statement string */ 94 | stmt?: string; 95 | /** List of bound parameters */ 96 | args?: any[]; 97 | /** A comment regarding this SQL statement */ 98 | comment?: string; 99 | } 100 | 101 | export type Expression = string; 102 | 103 | /** 104 | * Represents a complete QueryDSL with multiple options for querying fields. 105 | */ 106 | export interface QueryDSL { 107 | /** List of fields to select */ 108 | select: Expression[]; 109 | /** Main table or model to select from */ 110 | from?: string; 111 | /** A list of where clauses */ 112 | wheres?: Where[]; 113 | /** A list of order conditions */ 114 | orders?: Order[]; 115 | /** Grouping fields and options */ 116 | groups?: (Group | string)[]; 117 | /** Filtering options for group results */ 118 | havings?: Having[]; 119 | /** Return only the first result */ 120 | first?: boolean | any; 121 | /** Limit the number of records */ 122 | limit?: number; 123 | /** Offset to start returning records from */ 124 | offset?: number; 125 | /** Page number for pagination */ 126 | page?: number; 127 | /** Number of records per page */ 128 | pagesize?: number; 129 | /** Restrict result to data only or not */ 130 | "data-only"?: boolean; 131 | /** Union query options */ 132 | unions?: QueryDSL[]; 133 | /** Subquery option */ 134 | query?: QueryDSL; 135 | /** Query alias */ 136 | alias?: string; 137 | /** Join conditions */ 138 | joins?: Join[]; 139 | /** Direct SQL statement if provided */ 140 | sql?: SQL; 141 | /** A general comment on the query */ 142 | comment?: string; 143 | /** Enable or disable debugging */ 144 | debug?: boolean; 145 | } 146 | 147 | /** 148 | * Provides methods for executing different types of queries. 149 | */ 150 | export declare class Query { 151 | /** 152 | * Create a new Query instance 153 | * @param connector - The connector ID to use for the query 154 | */ 155 | constructor(connector: string); 156 | 157 | /** 158 | * Execute a SELECT query with provided QueryDSL. 159 | * @param query - The QueryDSL object containing SELECT conditions 160 | */ 161 | Get(query: QueryDSL): any; 162 | 163 | /** 164 | * Execute a SQL statement with the given QueryDSL. 165 | * @param query - The QueryDSL object containing SQL statement and parameters 166 | */ 167 | Run(query: QueryDSL): any; 168 | 169 | /** 170 | * Execute a paginated query using QueryDSL. 171 | * @param query - The QueryDSL object containing conditions and pagination setup 172 | */ 173 | Paginate(query: QueryDSL): any; 174 | 175 | /** 176 | * Execute a query to get the first matching record using QueryDSL. 177 | * @param query - The QueryDSL object containing selection conditions 178 | */ 179 | First(query: QueryDSL): any; 180 | } 181 | -------------------------------------------------------------------------------- /src/types/runtime/store.d.ts: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Represents a map of options for store configuration. 4 | */ 5 | export type Option = { [key: string]: any }; 6 | 7 | /** 8 | * Represents the store instance configuration. 9 | */ 10 | export interface Instance { 11 | /** Store name */ 12 | name: string; 13 | /** Optional store description */ 14 | description?: string; 15 | /** Optional connector */ 16 | connector?: string; 17 | /** Store type (deprecated in new versions) */ 18 | type?: string; 19 | /** Store options */ 20 | option?: Option; 21 | } 22 | 23 | /** 24 | * Represents the Store class for interacting with the key-value store. 25 | */ 26 | export declare class Store { 27 | /** 28 | * Create a new instance of Store 29 | * @param widgetID - The Store Widget ID 30 | */ 31 | constructor(widgetID: string); 32 | 33 | /** 34 | * Sets a value in the store. 35 | * @param key - The key for the store item 36 | * @param value - The value to store 37 | * @param ttl - Time to live in seconds 38 | */ 39 | Set(key: string, value: any, ttl?: number): void; 40 | 41 | /** 42 | * Gets a value from the store. 43 | * @param key - The key for the store item to get 44 | * @returns The value from the store or undefined if not found 45 | */ 46 | Get(key: string): any; 47 | 48 | /** 49 | * Gets a value from the store, or sets it using the provided function if not found. 50 | * @param key - The key for the store item 51 | * @param getValue - Function to get the value if not found 52 | * @param ttl - Time to live in seconds 53 | * @returns The value from the store 54 | */ 55 | GetSet(key: string, getValue: (key: string) => any, ttl?: number): any; 56 | 57 | /** 58 | * Gets a value from the store and deletes it. 59 | * @param key - The key for the store item 60 | * @returns The value from the store or undefined if not found 61 | */ 62 | GetDel(key: string): any; 63 | 64 | /** 65 | * Checks if a key exists in the store. 66 | * @param key - The key to check 67 | * @returns True if the key exists, otherwise false 68 | */ 69 | Has(key: string): boolean; 70 | 71 | /** 72 | * Deletes a key from the store. 73 | * @param key - The key to delete 74 | */ 75 | Del(key: string): void; 76 | 77 | /** 78 | * Retrieves all keys in the store. 79 | * @returns An array of keys in the store 80 | */ 81 | Keys(): string[]; 82 | 83 | /** 84 | * Retrieves the number of items in the store. 85 | * @returns The number of items in the store 86 | */ 87 | Len(): number; 88 | 89 | /** 90 | * Clears all items in the store. 91 | */ 92 | Clear(): void; 93 | } 94 | -------------------------------------------------------------------------------- /src/types/runtime/sui.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Namespace defining types and interfaces for SUI Templating Engine. 3 | */ 4 | export declare namespace sui { 5 | /** 6 | * Represents a request structure in the Sui framework. 7 | */ 8 | export interface Request { 9 | /** The HTTP method of the request, e.g., "GET" or "POST". */ 10 | method: string; 11 | /** The root URL for accessing assets, optional. */ 12 | asset_root?: string; 13 | /** The referer URL, indicating the source of the request. */ 14 | referer?: string; 15 | /** Payload data sent with the request. */ 16 | payload?: Record; 17 | /** Query parameters in the request URL as key-value pairs. */ 18 | query?: Record; 19 | /** Path parameters extracted from the URL. */ 20 | params?: Record; 21 | /** Headers included in the request as key-value pairs. */ 22 | headers?: Record; 23 | /** The body of the request, containing any payload data. */ 24 | body?: any; 25 | /** Details about the request URL. */ 26 | url?: URL; 27 | /** Session ID for the request, optional. */ 28 | sid?: string; 29 | /** The theme preference associated with the request, optional. */ 30 | theme?: string; 31 | /** The locale setting for the request, optional. */ 32 | locale?: string; 33 | } 34 | 35 | /** 36 | * Represents the structure of a request URL in the Sui framework. 37 | */ 38 | export interface URL { 39 | /** The host of the request, e.g., "www.example.com". */ 40 | host?: string; 41 | /** The domain of the request, e.g., "example.com". */ 42 | domain?: string; 43 | /** The path of the request, e.g., "/path/to/route". */ 44 | path?: string; 45 | /** The scheme of the request, e.g., "http" or "https". */ 46 | scheme?: string; 47 | /** The full URL of the request. */ 48 | url?: string; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/types/runtime/time.d.ts: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Represents the Time interface for scheduling operations. 4 | */ 5 | export interface Time { 6 | /** 7 | * Pauses the execution for a specified number of milliseconds. 8 | * @param ms The time to sleep in milliseconds. 9 | */ 10 | Sleep(ms: number): void; 11 | 12 | /** 13 | * Schedules a function to execute after a specific duration. 14 | * @param ms The time to wait before executing the function, in milliseconds. 15 | * @param name The name of the process to call. 16 | * @param args Additional arguments to pass to the process. 17 | */ 18 | After(ms: number, name: string, ...args: any[]): void; 19 | } 20 | 21 | /** 22 | * Declare the global `time` variable implementing the Time interface. 23 | */ 24 | export declare var time: Time; 25 | -------------------------------------------------------------------------------- /src/types/xgen/action.d.ts: -------------------------------------------------------------------------------- 1 | import { XgenGlobal as Global } from "@/types/xgen"; 2 | 3 | export declare namespace XgenAction { 4 | interface OpenModal { 5 | width?: number | string; 6 | byDrawer?: { mask?: boolean }; 7 | Form?: { 8 | type: "view" | "edit"; 9 | model: string; 10 | }; 11 | Page?: { 12 | type: "chart"; 13 | model: string; 14 | }; 15 | } 16 | 17 | interface HistoryPush { 18 | pathname: string; 19 | search?: any; 20 | public?: boolean; 21 | } 22 | 23 | interface Confirm { 24 | title: string; 25 | content: string; 26 | } 27 | 28 | interface YaoParams { 29 | method: string; 30 | args: Array; 31 | } 32 | 33 | interface ActionMap { 34 | "Common.openModal": OpenModal; 35 | "Common.closeModal": {}; 36 | "Common.historyPush": HistoryPush; 37 | "Common.historyBack": {}; 38 | "Common.confirm": Confirm; 39 | "Table.search": {}; 40 | "Table.save": Global.StringObject; 41 | "Table.delete": {}; 42 | "Form.find": {}; 43 | "Form.submit": Global.StringObject; 44 | "Form.delete": {}; 45 | "Form.fullscreen": {}; 46 | "Service.*": YaoParams; 47 | "Studio.*": YaoParams; 48 | } 49 | 50 | type ActionParams = { 51 | [T in keyof ActionMap]: { 52 | name: string; 53 | type: T; 54 | payload: ActionMap[T]; 55 | next?: string; 56 | error?: string; 57 | }; 58 | }[keyof ActionMap]; 59 | 60 | interface Props { 61 | title: string; 62 | icon: string; 63 | action: Array; 64 | style?: "danger" | "success" | "primary"; 65 | divideLine?: boolean; 66 | showWhenAdd?: boolean; 67 | showWhenView?: boolean; 68 | hideWhenEdit?: boolean; 69 | disabled?: { 70 | bind: string; 71 | value: string | Array; 72 | }; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/types/xgen/app.d.ts: -------------------------------------------------------------------------------- 1 | export declare namespace XgenApp { 2 | type Theme = "light" | "dark"; 3 | 4 | interface ChatInfo { 5 | is_neo: boolean; 6 | text: string; 7 | actions?: []; 8 | } 9 | 10 | type Role = { 11 | captcha: string; 12 | login: string; 13 | /** Configure login page brand and cover */ 14 | layout?: { 15 | /** login page cover image */ 16 | cover?: string; 17 | /** default is 'Make Your Dream With Yao App Engine' */ 18 | slogan?: string; 19 | /** default is yaoapps.com */ 20 | site?: string; 21 | }; 22 | thirdPartyLogin?: Array<{ 23 | /** button text */ 24 | title: string; 25 | /** third party login href text */ 26 | href: string; 27 | /** button prefix icon */ 28 | icon?: string; 29 | /** set whether the target of the a tag is _blank */ 30 | blank?: boolean; 31 | }>; 32 | }; 33 | 34 | interface Info { 35 | /** Application Name */ 36 | name: string; 37 | /** Application description */ 38 | description?: string; 39 | /** api prefix, default is __yao */ 40 | apiPrefix?: string; 41 | /** brand logo, default is YAO */ 42 | logo?: string; 43 | /** favicon, default is YAO */ 44 | favicon?: string; 45 | /** login config */ 46 | login: { 47 | /** Configure admin login setting */ 48 | admin: Role; 49 | /** Configure user login setting */ 50 | user?: Role; 51 | /** Configure the jump page after administrator and user login */ 52 | entry: { 53 | admin: string; 54 | user: string; 55 | }; 56 | }; 57 | /** define token behavior, default is sessionStorage */ 58 | token?: { 59 | /** way of token storage */ 60 | storage: "sessionStorage" | "localStorage"; 61 | }; 62 | optional?: { 63 | /** remote api cache, default is true */ 64 | remoteCache?: boolean; 65 | }; 66 | } 67 | 68 | interface User { 69 | email: string; 70 | id: number; 71 | mobile?: any; 72 | name: string; 73 | type: string; 74 | } 75 | 76 | interface Menu { 77 | id: number; 78 | name: string; 79 | icon: string; 80 | path: string; 81 | badge?: number; 82 | dot?: boolean; 83 | children?: Array; 84 | } 85 | 86 | interface Menus { 87 | items: Array; 88 | setting: Array; 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /src/types/xgen/chart.d.ts: -------------------------------------------------------------------------------- 1 | import type { XgenAction as Action, XgenCommon as Common } from "@/types/xgen"; 2 | import type { CSSProperties } from "react"; 3 | 4 | export declare namespace XgenChart { 5 | interface Filter { 6 | columns: Array; 7 | } 8 | 9 | interface FieldDetail { 10 | bind: string; 11 | link?: string; 12 | cardStyle?: CSSProperties; 13 | view: { 14 | type: string; 15 | props: any; 16 | }; 17 | refer?: { 18 | type: string; 19 | props: any; 20 | }; 21 | } 22 | 23 | interface Fields { 24 | [key: string]: FieldDetail; 25 | } 26 | 27 | interface Setting { 28 | name: string; 29 | actions?: Array; 30 | filter?: Filter; 31 | chart: { 32 | columns: Array; 33 | }; 34 | fields: { 35 | filter?: Common.Fields; 36 | chart: Fields; 37 | }; 38 | config?: Common.Config; 39 | } 40 | 41 | interface Column extends Common.WideColumn, FieldDetail {} 42 | } 43 | -------------------------------------------------------------------------------- /src/types/xgen/common.d.ts: -------------------------------------------------------------------------------- 1 | export declare namespace XgenCommon { 2 | interface Config { 3 | full?: boolean; 4 | } 5 | 6 | interface BaseColumn { 7 | name: string; 8 | width?: number; 9 | } 10 | 11 | interface TableBaseColumn extends BaseColumn { 12 | fixed?: boolean; 13 | } 14 | 15 | interface WideColumn { 16 | name: string; 17 | width: number; 18 | } 19 | 20 | interface ViewComponents { 21 | [key: string]: string | FieldDetail; 22 | } 23 | 24 | interface FieldDetail { 25 | bind: string; 26 | view: { 27 | bind?: string; 28 | type: string; 29 | props: any & { components?: ViewComponents }; 30 | }; 31 | edit: { 32 | bind?: string; 33 | type: string; 34 | props: any; 35 | }; 36 | } 37 | 38 | type ViewFieldDetail = Omit; 39 | type EditFieldDetail = Omit; 40 | 41 | interface Fields { 42 | [key: string]: FieldDetail; 43 | } 44 | 45 | interface ViewFields { 46 | [key: string]: ViewFieldDetail; 47 | } 48 | 49 | interface EditFields { 50 | [key: string]: EditFieldDetail; 51 | } 52 | 53 | interface Column extends BaseColumn, FieldDetail {} 54 | interface TableColumn extends TableBaseColumn, FieldDetail {} 55 | interface EditColumn extends BaseColumn, EditFieldDetail {} 56 | } 57 | -------------------------------------------------------------------------------- /src/types/xgen/component.d.ts: -------------------------------------------------------------------------------- 1 | import type { FormItemProps } from "antd"; 2 | import type { CSSProperties } from "react"; 3 | import type { XgenGlobal as Global } from "@/types/xgen"; 4 | 5 | export declare namespace XgenComponent { 6 | type IdType = number; 7 | type FormType = "view" | "edit"; 8 | 9 | interface BindValue { 10 | form_bind: string; 11 | form_value: any; 12 | } 13 | 14 | interface BaseComponent { 15 | parent: "Page" | "Modal" | "Form" | "Dashboard" | "Custom"; 16 | model: string; 17 | search_params?: Global.StringObject; 18 | } 19 | 20 | interface StackComponent extends BaseComponent { 21 | id?: IdType; 22 | form?: { type: FormType }; 23 | } 24 | 25 | interface FormComponent extends StackComponent { 26 | parentNamespace?: string; 27 | onBack?: () => void; 28 | } 29 | 30 | interface Props { 31 | __namespace: string; 32 | __primary: string; 33 | __type: FormType; 34 | __bind: string; 35 | __name: string; 36 | } 37 | 38 | interface PropsEditComponent extends Props { 39 | style?: CSSProperties; 40 | itemProps?: FormItemProps; 41 | } 42 | 43 | interface PropsViewComponent extends Props { 44 | __value: any; 45 | onSave: (v: any) => void; 46 | } 47 | 48 | interface PropsChartComponent 49 | extends Omit {} 50 | 51 | interface Params { 52 | [key: string]: any; 53 | } 54 | 55 | interface Request { 56 | api: string; 57 | params?: { [key: string]: any }; 58 | } 59 | 60 | interface Option { 61 | label: string; 62 | value: string; 63 | } 64 | 65 | interface TagOption { 66 | label: string; 67 | value: string; 68 | color?: string; 69 | textColor?: string; 70 | } 71 | 72 | type Options = Array