工作流的每个步骤都运行一个动作。参数可以是固定值或表达式;结果存入 steps.<stepId>。控制流动作(branch、switch、loop、parallel、try/catch、stop、log)在客户端和服务端工作流中都可用。
客户端动作
数据
| 操作 | 参数 | 结果 |
|---|---|---|
Set variablecore.setVarSets a variable, or a dotted path inside it (filters.category). | var Variable name or path, without vars.value New value. | The value that was set. |
Reset variablecore.resetVarRestores a variable to its default value. | var Variable name or path. | The value after the reset. |
Refetch querycore.refetchRuns a client query again and waits for it. | query Query name. | The query state after the run (data, error, updatedAt). |
Run operationcore.runOperationNot available in client workflows: plugin operations need secret keys and run in server workflows. | integrationId Integration id.operation Plugin operation id, e.g. rest.request.input? Operation input. | Nothing: the step always fails in a client workflow. |
Run server workflowcore.runServerWorkflowRuns a server workflow called from pages (plugin operations, tables, emails) and waits for its result. | workflow Server workflow with the trigger "Called from pages".input? Becomes input in that workflow. | The value of its Return step. |
控制流
| 操作 | 参数 | 结果 |
|---|---|---|
If / elsecore.branchRuns then when the condition is truthy, otherwise else. | if Condition.[then] 步骤列表[else] 步骤列表 | The branch that ran: "then" or "else". |
For eachcore.loopRuns body once per item, with item and index in scope (outer loop row in parent). At most 1000 items. | items An array (null or undefined runs zero times).[body] 步骤列表 | The number of iterations. |
Try / catchcore.tryCatchRuns try; if a step fails, runs catch with error in scope. Limits and cancellation are not caught. | [try] 步骤列表[catch] 步骤列表 | { ok: true }, or { ok: false, error } when catch ran. |
Switchcore.switchRuns the steps of the first case whose value equals value, otherwise default. | value Value to match.cases? Cases { id, label, equals } (at most 32); each id is a branch.[default] 步骤列表 | The id of the case that ran, or "default". |
Run in parallelcore.parallelRuns every lane at the same time and waits for all (at most 8 lanes). A failing lane fails the step. | — | { a: true, b: true, … } once every lane finished. |
Breakcore.breakLeaves the nearest For each loop. Only inside a loop body. | — | Nothing. |
Continuecore.continueSkips to the next item of the nearest For each loop. Only inside a loop body. | — | Nothing. |
Waitcore.delayWaits a number of milliseconds (at most 60000). | ms Duration in ms. | The milliseconds waited. |
Stopcore.stopEnds this workflow successfully. Later steps do not run. | — | Nothing. |
Run workflowcore.runWorkflowRuns another workflow of the page and waits for it (call depth at most 8, no cycles). | workflow Workflow id.input? Becomes input in the called workflow. | The called workflow's step results (steps). |
导航
| 操作 | 参数 | 结果 |
|---|---|---|
Go to pagecore.navigateNavigates to a page of the site or a URL. | to A page ({ pageId }), a path (/about) or an http(s) URL. | Nothing. |
Open URLcore.openUrlOpens a URL (http, https, mailto, tel or a relative path). | url URL to open.newTab? Open in a new tab. | Nothing. |
界面
| 操作 | 参数 | 结果 |
|---|---|---|
Show toastcore.toastShows a short notification. | message Text to show.variant? Style. | Nothing. |
Scroll to elementcore.scrollToScrolls an element into view. | node Node id.behavior? Scroll behavior. | Nothing. |
Copy to clipboardcore.copyToClipboardCopies text to the clipboard. | text Text to copy (non-strings are JSON-encoded). | Nothing. |
Play interactioncore.playInteractionPlays an interaction (animation) of the page. | interaction Interaction id. | Nothing. |
访客账户
| 操作 | 参数 | 结果 |
|---|---|---|
Log in visitorcore.loginSigns a site visitor in with email and password and updates user. 仅限已发布的站点。 | email Visitor email.password Visitor password (bind it to a form field). | The signed-in user. |
Sign up visitorcore.signupCreates a visitor account, signs it in and updates user. 仅限已发布的站点。 | email Visitor email.password New password.name? Display name. | The new user. |
Log out visitorcore.logoutSigns the visitor out and resets user. 仅限已发布的站点。 | — | null. |
Send sign-in linkcore.sendMagicLinkEmails the visitor a one-time sign-in link (same answer whether or not the account exists). 仅限已发布的站点。 | email Visitor email. | true. |
Refresh usercore.refreshUserReloads the signed-in visitor into user. 仅限已发布的站点。 | — | The signed-in user, or null. |
调试
| 操作 | 参数 | 结果 |
|---|---|---|
Logcore.logWrites a value to the run log (the browser console on the published site). | value Value to log. | The logged value. |
仅限服务端的动作
在服务端工作流中可用,每个步骤可选配置重试。
| 动作 | 参数 | 作用 |
|---|---|---|
HTTP requestcore.httpRequest | url, method, headers, body | 从服务端调用外部 HTTPS URL(禁止私有地址,15 秒,1 MB)。 |
Send emailcore.sendEmail | to, subject, text, html | 发送一封事务性邮件。 |
Run operationcore.runOperation | integrationId, operation, input | 使用集成的密钥运行该集成的一个操作。 |
Run server workflowcore.runServerWorkflow | workflow, input | 运行另一个服务端工作流并等待其结果。 |
Run JavaScriptcore.runJs | code, input | 在沙箱中运行代码,作用域内有 input 和 steps;无网络、无绑定、无密钥。 |
Returncore.return | value | 以一个结果结束本次运行;对端点而言即响应体。 |
Query tablecore.tableQuery | table, filter, limit, cursor | 读取原生表的行。结果:{ rows, nextCursor }。 |
Get rowcore.tableGet | table, id | 按 id 读取一行。 |
Insert rowcore.tableInsert | table, values | 插入一行。 |
Update rowcore.tableUpdate | table, id, values | 更新一行。 |
Delete rowcore.tableDelete | table, id | 删除一行。 |
Set visitor rolescore.visitorSetRoles | userId, roles | 替换访客的角色。角色必须已在站点中存在。 |
Sleepcore.sleep | duration | 暂停本次运行,例如 "5 minutes"。会让工作流变为持久化运行。 |
Wait for eventcore.waitForEvent | event, timeout | 暂停直到该类型的事件到达;结果是事件的载荷。持久化。 |
Emit eventcore.emitEvent | runId, type, payload | 恢复一个正在等待该事件类型的运行。 |