@protobase/cli 0.100.1 → 0.100.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/package.js +1 -1
- package/package.json +8 -8
- package/skills/protobase/references/features/compatibility.md +2 -1
- package/skills/protobase/references/features/workflows.md +1 -0
- package/skills/protobase/references/reference/mcp.md +5 -4
- package/skills/protobase/references/reference/workflow-plugins.md +1 -1
- package/skills/protobase/references/reference/workflows.md +58 -8
package/dist/cli/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/cli",
|
|
3
|
-
"version": "0.100.
|
|
3
|
+
"version": "0.100.3",
|
|
4
4
|
"description": "The protobase command: scaffold, doctor, dev, build and serve a Protobase project.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -43,13 +43,13 @@
|
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@better-auth/core": "^1.7.12",
|
|
45
45
|
"@hono/node-server": "^2.1.3",
|
|
46
|
-
"@protobase/config": "0.100.
|
|
47
|
-
"@protobase/layout": "0.100.
|
|
48
|
-
"@protobase/query": "0.100.
|
|
49
|
-
"@protobase/schema": "0.100.
|
|
50
|
-
"@protobase/server": "0.100.
|
|
51
|
-
"@protobase/ui": "0.100.
|
|
52
|
-
"@protobase/workflows": "0.100.
|
|
46
|
+
"@protobase/config": "0.100.3",
|
|
47
|
+
"@protobase/layout": "0.100.3",
|
|
48
|
+
"@protobase/query": "0.100.3",
|
|
49
|
+
"@protobase/schema": "0.100.3",
|
|
50
|
+
"@protobase/server": "0.100.3",
|
|
51
|
+
"@protobase/ui": "0.100.3",
|
|
52
|
+
"@protobase/workflows": "0.100.3",
|
|
53
53
|
"@react-email/render": "^2.1.0",
|
|
54
54
|
"@scalar/hono-api-reference": "^0.12.10",
|
|
55
55
|
"@sentry/vite-plugin": "^11.10.0",
|
|
@@ -16,7 +16,8 @@ Apps written for other systems that keep working on Protobase, and moving their
|
|
|
16
16
|
|
|
17
17
|
## AWS Step Functions
|
|
18
18
|
|
|
19
|
-
- [Step Functions import](../reference/workflows.md#importing-from-step-functions) (beta): A JSONata state machine exported from AWS Step Functions saves and runs as a workflow as
|
|
19
|
+
- [Step Functions import](../reference/workflows.md#importing-from-step-functions) (beta): A JSONata state machine exported from AWS Step Functions saves and runs as a workflow, its HTTP tasks as `app:http` steps that send the same request and give the same result, and what does not run here exactly, its other service tasks included, is refused by name.
|
|
20
|
+
- [Task callbacks](../reference/workflows.md#waiting-for-an-outside-result) (beta): A step that waits for an outside result takes the SendTaskSuccess, SendTaskFailure and SendTaskHeartbeat calls a caller written for AWS Step Functions sends, unchanged.
|
|
20
21
|
|
|
21
22
|
## Template paths
|
|
22
23
|
|
|
@@ -15,6 +15,7 @@ Graphs of steps the server runs along their edges, written in a language a model
|
|
|
15
15
|
- [Build on the graph](../reference/workflows.md#the-workflows-page) (beta): Click a step's handle to add a step right there, or drag from it to another step to connect them; the wheel and a pinch zoom the graph, and dragging pans it.
|
|
16
16
|
- [Branches, steps per item and retries](../reference/workflows.md#states) (beta): Choices, a step per item with their results merged, waits, and per-step retries, timeouts and error paths.
|
|
17
17
|
- [Order from the data](../reference/workflows.md#execution-order-from-the-data) (beta): A workflow in data order runs each step once the steps it reads from have ended, steps that read nothing of each other at once, with a Condition on any step and skips that pass on; switch a workflow between data order and the States Language's own sequence in the editor.
|
|
18
|
+
- [Waiting for an outside result](../reference/workflows.md#waiting-for-an-outside-result) (beta): A step hands its work off with a token and the run waits, holding nothing, until an approver, a job elsewhere or a service sends the token back with a result, a failure or a heartbeat, through the app's API or over MCP, failing with `States.Timeout` or `States.HeartbeatTimeout` when it does not come in time.
|
|
18
19
|
- [HTTP request step](../reference/workflows.md#apphttp) (beta): Calls a URL built at run time through the outgoing-address guard, only at public addresses unless the config allows private ones, reading at most 10 MiB of the answer as JSON, text or a file, by its Content-Type unless the step says which. It can send its body as JSON whatever it holds, and check the answer's body against a JSON Schema, whose fields the editor then offers.
|
|
19
20
|
- [Records steps](../reference/workflows.md#apprecords) (beta): Create, update, get and list records as the workflow's last editor, with the roles they hold now.
|
|
20
21
|
- [Mail step](../reference/workflows.md#appmailsend) (beta): Sends mail, with files the run downloaded attached, from the app's own sender.
|
|
@@ -107,14 +107,15 @@ In an app with [workflows](workflows.md), the endpoint also offers tools to find
|
|
|
107
107
|
| `list_workflow_types` | The step types a Task names as its `Resource` and the triggers a definition holds, built-in and [plugin](workflow-plugins.md) ones alike, each by id with its label, description, input as JSON Schema and, when the type declares one, its output, the errors a step fails with, and whether the app can run it. |
|
|
108
108
|
| `list_workflows` | A page of the workflows the person may read, newest change first, without their definitions: `filter` on `name`, `page_size` (20 by default, at most 100) and `page_token`. |
|
|
109
109
|
| `get_workflow` | One workflow with its whole definition and its ETag. |
|
|
110
|
-
| `validate_workflow` | Checks a `
|
|
110
|
+
| `validate_workflow` | Checks a `state_machine`, with its `trigger` and `execution_order`, or a workflow's `id` with an `edit` of its saved definition, as a save checks it, and saves nothing: `{ valid: true }`, or `{ valid: false, problems }`. A valid one may come with `warnings` in the same shape, which a save goes through with, such as a [Wait after a Block](workflows.md#blocks); `create_workflow` and `update_workflow` return them with what they saved. A record trigger is checked against the resources and fields the person may read, so a resource they cannot read is not a resource of the app. |
|
|
111
111
|
| `get_workflow_run` | A run's status, input, output, error and cause, with its steps in the order they ran, each with its state, scope, try, status, input, output, assigned variables, logs, error and cause; `state` reads one state's steps, a page of 20 by default. |
|
|
112
112
|
| `list_connections` | The person's own [connected accounts](workflows.md#connecting-an-account), by each connection the app's plugins declare: its key and label, and each account's `id`, scopes and `needs_sign_in`. A definition's `connections` binds an account by its `id`. It returns no token, and no one else's accounts. |
|
|
113
|
-
| `create_workflow` | Creates a workflow from its `name`, `description` and `
|
|
114
|
-
| `update_workflow` | Changes a workflow's definition by an `edit` or whole, as `
|
|
113
|
+
| `create_workflow` | Creates a workflow from its `name`, `description` and `state_machine`, with its `trigger` and `execution_order`, and returns its `id`, `version` and ETag. A state machine from Step Functions [imports](workflows.md#importing-from-step-functions) its HTTP tasks as `app:http` steps, with `connection_headers` naming each connection's header; `update_workflow` and `validate_workflow` import one the same way. |
|
|
114
|
+
| `update_workflow` | Changes a workflow's definition by an `edit` or whole, as `state_machine`, `trigger` and `execution_order`, and its `name` or `description`, and returns its `id`, new `version` and ETag. With the `etag` that `get_workflow` gave, it fails when someone changed the workflow since; an edit without one is saved against the version it was applied to. |
|
|
115
115
|
| `run_workflow` | Starts a run of a workflow's version saved last, or of the `version` it names, with an `input`, and returns its `run_id` and `status`. With `rerun_of`, a failed run's id, it [re-runs](workflows.md#re-running-a-failed-run) that run from its last checkpoint instead, on its input, and with `rerun_from` any ended run that kept its trace from that state; with `replay: true` too, it [replays](workflows.md#replaying-a-run) any ended run of the workflow on its current version, with that run's input, sending none of its outside writes. |
|
|
116
116
|
| `enable_workflow` | Publishes the saved `version` it names (`enabled: true`), which puts the workflow's trigger on it, or turns the workflow off, and returns its `enabled_version`. A save never goes live by itself. One that uses a [connected account](workflows.md#connecting-an-account) is turned on only by the account's owner in the admin app: the tool answers `own-sign-in-only` and says so. |
|
|
117
117
|
| `new_webhook_url` | Issues a new URL and secret for a workflow that starts from a [webhook trigger](workflows.md#appwebhook), keeping a `secret` the sender makes when given one, and returns `{ url, secret }`, shown this once; the old URL stops. |
|
|
118
|
+
| `send_task_success`, `send_task_failure`, `send_task_heartbeat` | Answer a Task that [waits for an outside result](workflows.md#waiting-for-an-outside-result) with the `task_token` it handed off: its result, `output`, a string of JSON; its failure, `error` and `cause`; or a heartbeat. Each returns `{ run }`, or `{ error, message }` with the error Step Functions gives, such as `TaskTimedOut`. Only a caller who may read the run can answer it; to anyone else the token is unknown. |
|
|
118
119
|
|
|
119
120
|
An `edit` is a [JSON Merge Patch](https://www.rfc-editor.org/rfc/rfc7396) of the saved definition: only what changes, at its place in the document. An object merges into the object there, `null` removes a member, and any other value, a list included, replaces it. Changing one argument of one state:
|
|
120
121
|
|
|
@@ -124,7 +125,7 @@ An `edit` is a [JSON Merge Patch](https://www.rfc-editor.org/rfc/rfc7396) of the
|
|
|
124
125
|
|
|
125
126
|
A definition the save check refuses comes back as `{ "error": "invalid-workflow", "message": ..., "problems": [...] }`, each problem `{ state, field, message }` naming the state, the field and what was expected, as `validate_workflow` gives them; nothing is saved. A run goes on in the background on the app's jobs, so `run_workflow` returns while it is queued: the client reads it with `get_workflow_run` until it has `succeeded` or `failed`, fixes the step that failed and re-runs the run from that step.
|
|
126
127
|
|
|
127
|
-
`create_workflow`, `update_workflow`, `run_workflow`, `enable_workflow` and `
|
|
128
|
+
`create_workflow`, `update_workflow`, `run_workflow`, `enable_workflow`, `new_webhook_url` and the `send_task_*` answers come with [writes](#writes), and the person approves each first, as any write, unless they hold one of the [roles without approval](#writes-without-approval); with writes limited to some resources, they save, turn on and issue URLs on `workflows` and run on `workflow_runs` only when the list names them. A run does what its steps do, such as requests, mail and record writes, as the workflow's last editor.
|
|
128
129
|
|
|
129
130
|
### SQL for admins
|
|
130
131
|
|
|
@@ -82,7 +82,7 @@ What `run` gets, and nothing more:
|
|
|
82
82
|
| `mail` | `send(message)` from the app's own sender; `undefined` when the app sends no mail. |
|
|
83
83
|
| `connection` | `accessToken()` of the connection the step declares, or `undefined`. |
|
|
84
84
|
| `mailbox` | `send(message)` from the [own mailbox](email.md#from-someones-own-mailbox) of the person who turned on the version the run runs, signed in as themselves, while they may still change the workflow; otherwise it fails `not_linked` and sends nothing. `undefined` when the app links no mailboxes. |
|
|
85
|
-
| `runId`, `idempotencyKey` | The run, and a key that every retry of this visit of the step shares, while a later visit of the same state, such as in a loop, gets a new one: send it where the receiver deduplicates. |
|
|
85
|
+
| `runId`, `idempotencyKey` | The run, and a key that every retry of this visit of the step shares, while a later visit of the same state, such as in a loop, gets a new one: send it where the receiver deduplicates. A step that [waits for an outside result](workflows.md#waiting-for-an-outside-result) gets a new one with each token it hands off, so a receiver never drops the only token that can still answer. |
|
|
86
86
|
| `signal` | Aborted at the step's timeout, or when the worker stops; pass it on to `fetch`. |
|
|
87
87
|
| `log(message)`, `redact(text)` | A line in the step's logs, and the text with the app's secrets blanked out, both as the runner records them. |
|
|
88
88
|
| `earlier`, `reuse(output)` | For a type whose cache offers hits: the earlier call's result, as [Caching results](#caching-results) says. |
|
|
@@ -132,10 +132,23 @@ A workflow switches order in the editor (see [The editor](#the-editor)), or by s
|
|
|
132
132
|
|
|
133
133
|
:::caution[Beta]
|
|
134
134
|
- <gap>A JSONPath state machine cannot import because converting JSONPath to JSONata is not implemented.</gap>
|
|
135
|
-
- <gap>A state machine with a service task
|
|
135
|
+
- <gap>A state machine with a service task other than the HTTP task, a `Parallel` or a distributed Map cannot import because running them is not implemented: write such a task with one of this app's step types.</gap>
|
|
136
|
+
- <gap>An HTTP task's connection cannot send more than one header, or a token it fetches itself, because importing a connection's other parameters and OAuth sign-in is not implemented: its other headers, query and body parameters go in the task's own `Headers`, `QueryParameters` and `RequestBody`.</gap>
|
|
137
|
+
- <gap>An HTTP task that waits for a task token (`http:invoke.waitForTaskToken`) cannot import because turning it into an `app:http.waitForTaskToken` step is not implemented: write it as one.</gap>
|
|
136
138
|
:::
|
|
137
139
|
|
|
138
|
-
A JSONata state machine exported from AWS Step Functions saves and runs as
|
|
140
|
+
A JSONata state machine exported from AWS Step Functions saves and runs as a workflow, in sequence order: `create_workflow` over MCP takes it as `state_machine`, with a manual trigger unless one is given, and `update_workflow` and `validate_workflow` import a state machine, or an edit of a saved one, the same way. Refused, each by name: a JSONPath state machine (`QueryLanguage` missing or `JSONPath`, or a state with `InputPath`, `Parameters`, `ResultSelector`, `ResultPath`, `OutputPath` or `ItemsPath`), every service task but the HTTP task (`arn:aws:...`, `.sync` and `.waitForTaskToken` included), Parallel, a distributed Map, `Credentials` and a whole-run `TimeoutSeconds`.
|
|
141
|
+
|
|
142
|
+
An HTTP task (`arn:aws:states:::http:invoke`), in a Map or a Block too, imports as an [`app:http`](#apphttp) step that sends the same request and gives the same result, or is refused by name:
|
|
143
|
+
|
|
144
|
+
| HTTP task | Imports as |
|
|
145
|
+
| --- | --- |
|
|
146
|
+
| `ApiEndpoint`, `Method`, `Headers`, `QueryParameters` | `url`, `method`, `headers`, `query` |
|
|
147
|
+
| `RequestBody` | `body`, with `body_encoding: "json"`, as Step Functions sends it as JSON whatever it holds |
|
|
148
|
+
| `Authentication` or `InvocationConfig` | the header `connection_headers` names for its `ConnectionArn`, holding a [secret](#secrets) |
|
|
149
|
+
| `$states.result` in `Output` and `Assign` | the HTTP task's result, `{ StatusCode, StatusText, Headers, ResponseBody }`, each header's values as a list; without `Output`, that is the step's output, so later states and variables read what they read in Step Functions |
|
|
150
|
+
|
|
151
|
+
A connection's credentials stay with Step Functions, so the call names, for each connection's ARN, the header it sends and a secret holding the header's whole value: `"connection_headers": { "arn:aws:events:...:connection/tickets/...": { "header": "Authorization", "secret": "TICKETS_TOKEN" } }`, with `TICKETS_TOKEN` such as `Bearer ...` and listed in `workflows.secrets`; `null` sends no header. The header takes the place of one of the same name in `Headers`, as a connection's does. Refused: `Arguments` written as one expression, any other argument (`Transform`, which encodes the body as a form, among them), headers or query values that are lists, `HEAD` and `OPTIONS`, which `app:http` does not send, a `GET` with a `RequestBody`, a connection with no header given or with more than its `ConnectionArn`, an `Output` or `Assign` that reads `$states.result` in a form the import does not rewrite, such as `$states . result`, or `$states` as a whole, and a retrier or catcher of `States.Http.StatusCode.<code>`, `States.Http.Socket`, `Events.ConnectionResource.*` or `States.TaskFailed`: `app:http` fails with `Http.Status` for every status outside 2xx and `Http.Network` when no answer comes, and `States.TaskFailed` here matches only an error a step type does not name. A method written as an expression is checked when the step runs.
|
|
139
152
|
|
|
140
153
|
### Triggers
|
|
141
154
|
|
|
@@ -251,7 +264,7 @@ A save refuses a Task that leaves out an argument its step type needs, as [the e
|
|
|
251
264
|
|
|
252
265
|
| Type | |
|
|
253
266
|
| --- | --- |
|
|
254
|
-
| `Task` | Runs a step type, its `Resource`, with its `Arguments`; `TimeoutSeconds`, `Retry` and `Catch`. `Cache` reuses the result of an identical earlier call: `true` forces it on, `false` turns it off, and without it the step type decides, as [Caching results](workflow-plugins.md#caching-results) says. |
|
|
267
|
+
| `Task` | Runs a step type, its `Resource`, with its `Arguments`; `TimeoutSeconds`, `Retry` and `Catch`. A `Resource` ending in `.waitForTaskToken` hands the work off and waits for an outside result, with `HeartbeatSeconds`, as [Waiting for an outside result](#waiting-for-an-outside-result) says. `Cache` reuses the result of an identical earlier call: `true` forces it on, `false` turns it off, and without it the step type decides, as [Caching results](workflow-plugins.md#caching-results) says. |
|
|
255
268
|
| `Pass` | Shapes values with `Output` and `Assign`, and goes on. |
|
|
256
269
|
| `Choice` | Goes to the `Next` of the first of its `Choices` whose `Condition` is true, else to its `Default`; with neither it fails with `States.NoChoiceMatched`. A rule may carry its own `Output` and `Assign`. |
|
|
257
270
|
| `Wait` | Waits `Seconds`, or until a `Timestamp` (ISO 8601), as a number or an expression. |
|
|
@@ -264,7 +277,42 @@ A state's output is its `Output`, else its result (a Task or Map) or the input i
|
|
|
264
277
|
|
|
265
278
|
### Errors and retries
|
|
266
279
|
|
|
267
|
-
A failing Task or Map fails with an error name: a step type's own, such as `Http.Status`, `States.Timeout` when it ran past its timeout, `States.TaskFailed` for any other error it threw, and `States.QueryEvaluationError` for an expression that did not evaluate or ran past its limits. The first retrier whose `ErrorEquals` names it tries the state again after `IntervalSeconds` (default 1), times `BackoffRate` (default 2) for each earlier retry, up to `MaxDelaySeconds`; `MaxAttempts` counts the retries after the first try (default 3, 0 for none). Without `Retry` a failure is not retried. Once no retry is left, the first catcher that names it goes on to its `Next`; without one the run fails. `States.ALL` names every error but `States.DataLimitExceeded` and `States.Runtime`, which end the run even where a retrier or catcher names them.
|
|
280
|
+
A failing Task or Map fails with an error name: a step type's own, such as `Http.Status`, `States.Timeout` when it ran past its timeout, `States.HeartbeatTimeout` when a waiting Task's heartbeat was overdue, the error an outside failure names, `States.TaskFailed` for any other error it threw, and `States.QueryEvaluationError` for an expression that did not evaluate or ran past its limits. The first retrier whose `ErrorEquals` names it tries the state again after `IntervalSeconds` (default 1), times `BackoffRate` (default 2) for each earlier retry, up to `MaxDelaySeconds`; `MaxAttempts` counts the retries after the first try (default 3, 0 for none). Without `Retry` a failure is not retried. Once no retry is left, the first catcher that names it goes on to its `Next`; without one the run fails. `States.ALL` names every error but `States.DataLimitExceeded` and `States.Runtime`, which end the run even where a retrier or catcher names them.
|
|
281
|
+
|
|
282
|
+
### Waiting for an outside result
|
|
283
|
+
|
|
284
|
+
A Task whose `Resource` is a step type followed by `.waitForTaskToken`, the States Language's own suffix for it, hands its work off to someone or something outside the app and waits for the result: an approver, a job on another machine, a service that calls back. Its step type runs once with `Arguments` that pass on the try's token, `$states.context.Task.Token`; then the run waits, holding no worker, until that token comes back with a result, a failure, or not in time.
|
|
285
|
+
|
|
286
|
+
```json
|
|
287
|
+
"Approve": {
|
|
288
|
+
"Type": "Task",
|
|
289
|
+
"Resource": "app:http.waitForTaskToken",
|
|
290
|
+
"Arguments": {
|
|
291
|
+
"url": "https://approvals.example.com/ask",
|
|
292
|
+
"method": "POST",
|
|
293
|
+
"body": { "question": "{% 'Ship ' & $states.context.Execution.Input.version & '?' %}", "token": "{% $states.context.Task.Token %}" }
|
|
294
|
+
},
|
|
295
|
+
"TimeoutSeconds": 86400,
|
|
296
|
+
"HeartbeatSeconds": 3600,
|
|
297
|
+
"Assign": { "approval": "{% $states.result %}" },
|
|
298
|
+
"Next": "Ship"
|
|
299
|
+
}
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
- **Sending the result back.** Whoever holds the token answers with one of three calls, `SendTaskSuccess`, `SendTaskFailure` and `SendTaskHeartbeat`, whose bodies are the ones a States Language runtime takes, so an existing caller works unchanged ([compatibility](../features/compatibility.md#aws-step-functions)). They need no sign-in: the token is the proof, as a [webhook's](#appwebhook) address is.
|
|
303
|
+
|
|
304
|
+
| Call | Body | Does |
|
|
305
|
+
| --- | --- | --- |
|
|
306
|
+
| `POST /api/workflows/tasks/success` | `{ "taskToken": "...", "output": "{\"approved\": true}" }` | Ends the Task with `output`, a string of JSON up to 256 KiB, which `Output` and `Assign` read parsed as `$states.result`. |
|
|
307
|
+
| `POST /api/workflows/tasks/failure` | `{ "taskToken": "...", "error": "Approval.Refused", "cause": "Not on a Friday" }` | Fails the Task with that error (`States.TaskFailed` without one) and cause, which `Retry` and `Catch` take as any failure. |
|
|
308
|
+
| `POST /api/workflows/tasks/heartbeat` | `{ "taskToken": "..." }` | Says the work goes on, so `HeartbeatSeconds` counts again from now. |
|
|
309
|
+
|
|
310
|
+
Each answers `200 {}`, or a problem whose title names the error as those callers know it: `InvalidToken` (400, not a token), `InvalidOutput` (400, an `output` that is not JSON, too large or too deep, or an error or cause over 256 and 32,768 characters), `TaskDoesNotExist` (404, no Task was given this token) or `TaskTimedOut` (409, the Task already ended, by an answer, its time or its run). Over MCP, `send_task_success`, `send_task_failure` and `send_task_heartbeat` do the same for a caller who may read the run.
|
|
311
|
+
- **Its token.** Each try gets its own: a retry hands the work off again with a new one, and the old one answers nothing. A token settles its Task once, by a success or a failure, and expires with the wait. The app keeps only its SHA-256, and blanks the token out of the step's input, logs and every trace.
|
|
312
|
+
- **Its time.** `TimeoutSeconds` counts from the hand-off and may be up to 366 days, its default; past it the Task fails with `States.Timeout`. `HeartbeatSeconds`, less than `TimeoutSeconds`, fails it with `States.HeartbeatTimeout` when no heartbeat came in that time since the hand-off or the last one. The step type's own call still ends within 300 seconds.
|
|
313
|
+
- **Once only.** The hand-off happens once per try: a run that stops after it, as when its worker restarts, only waits again; one that stops before it was marked hands off again with a new token, under a new idempotency key, so a receiver that drops repeated keys still gets it. An answer that comes while the hand-off is still running counts, even if the hand-off then fails. A [replay](#replaying-a-run) hands nothing off and goes on with what the replayed run was sent. A Task that waits caches nothing, so `Cache` is refused on it.
|
|
314
|
+
- **Where it may be read.** `$states.context.Task.Token` is read only in such a Task's `Arguments`.
|
|
315
|
+
- **In the editor.** A Task's form has *Wait for an outside result*, which adds `.waitForTaskToken`, with *Wait at most* (`TimeoutSeconds`) and *Heartbeat within* (`HeartbeatSeconds`); its node is named for its step type, *then waits*.
|
|
268
316
|
|
|
269
317
|
### Blocks
|
|
270
318
|
|
|
@@ -374,12 +422,12 @@ One request to a URL built at run time:
|
|
|
374
422
|
| `method` | `GET` (default), `POST`, `PUT`, `PATCH` or `DELETE`. |
|
|
375
423
|
| `headers`, `query` | Objects of text values; `query` is added to the URL's query. |
|
|
376
424
|
| `body` | Text is sent as it is, a file value as its bytes with its type, any other value as JSON; a `GET` sends none. |
|
|
377
|
-
| `body_encoding` | `json` sends the body as JSON whatever it holds, a text as a JSON string, with `Content-Type: application/json` unless the headers give one. |
|
|
425
|
+
| `body_encoding` | `json` sends the body as JSON whatever it holds, a text as a JSON string, with `Content-Type: application/json` unless the headers give one; a `GET` with a body then fails with `Http.InvalidArguments` rather than leaving the body out. |
|
|
378
426
|
| `response` | How the answer's body is read: `json`, parsed (empty is `null`), `text`, or `file`, kept as a file of the run. Without it, by the answer's `Content-Type`: JSON for `application/json` and any `+json` type, text for `text/*` and other textual types (XML, JavaScript, YAML, TOML, NDJSON, form data), a file for any other type or none, and `null` for an empty body. |
|
|
379
427
|
| `body_schema` | The JSON Schema of the answer's body as it is read, such as `{ "type": "object", "properties": { "ip": { "type": "string" } } }`: a body that does not fit it fails the step with `Http.InvalidBody`, and the editor offers the body's fields by it. |
|
|
380
428
|
| `store` | `{ configuration, path? }`: streams the answer's body, of any size, into a [storage configuration](#storing-files), and gives the stored file as `body`. Takes no `response` or `body_schema`. |
|
|
381
429
|
|
|
382
|
-
A `GET` only reads; every other method is recorded. The result is `{ status, headers, body }`, without the cookies the answer sets. A status outside 2xx fails the step with `Http.Status`, whose cause names the status and holds at most the first 200 characters of the body, secrets blanked out first; a redirect is never followed. `Http.Network` is a request that got no answer. The step resolves the URL's host when it runs and refuses it with `Http.AddressRefused` unless every address is public, then connects to the very address it checked, so a URL built from a webhook's payload cannot reach the app's own network. It reads at most 10 MiB of the answer's body: a larger one fails the step with `Http.ResponseTooLarge`, rather than being cut short. With `store`, the body streams straight into the store, so its size is limited only by what the store takes, and the step is recorded, a `GET` too: a run taken up again keeps the stored file and does not fetch it again, from a link that may have expired by then.
|
|
430
|
+
A `GET` only reads; every other method is recorded. The result is `{ status, status_text, headers, body }`, `status_text` the reason phrase the server sent (empty when it sent none), without the cookies the answer sets. A status outside 2xx fails the step with `Http.Status`, whose cause names the status and holds at most the first 200 characters of the body, secrets blanked out first; a redirect is never followed. `Http.Network` is a request that got no answer. The step resolves the URL's host when it runs and refuses it with `Http.AddressRefused` unless every address is public, then connects to the very address it checked, so a URL built from a webhook's payload cannot reach the app's own network. It reads at most 10 MiB of the answer's body: a larger one fails the step with `Http.ResponseTooLarge`, rather than being cut short. With `store`, the body streams straight into the store, so its size is limited only by what the store takes, and the step is recorded, a `GET` too: a run taken up again keeps the stored file and does not fetch it again, from a link that may have expired by then.
|
|
383
431
|
|
|
384
432
|
### app:records
|
|
385
433
|
|
|
@@ -448,7 +496,7 @@ Steps store and read files with:
|
|
|
448
496
|
| --- | --- | --- |
|
|
449
497
|
| `app:storage.put` | `configuration`, `file`: a file of the run or a stored file, optional `path` | the stored file |
|
|
450
498
|
| `app:storage.get` | `file`: a stored file | a file of the run, up to 10 MiB, for steps that take one, such as mail attachments |
|
|
451
|
-
| `app:http` with `store` | `store: { configuration, path? }` | `{ status, headers, body }`, `body` the stored file |
|
|
499
|
+
| `app:http` with `store` | `store: { configuration, path? }` | `{ status, status_text, headers, body }`, `body` the stored file |
|
|
452
500
|
|
|
453
501
|
A stored file is `{ configuration, node, path, name, type, size }`: the configuration, the server that holds it for a local one, and its path there, never a folder, bucket or key. A `path` is relative: letters, digits, `.`, `_` and `-` in segments split by `/`, none starting with `.`; any other fails the step with `Storage.InvalidArguments` before anything is stored. Without a `path`, a step stores under a path of its own in its run, the same each time the step is tried, so a step a crash made run again replaces its file rather than leaving a second one. A put is recorded; a get only reads.
|
|
454
502
|
|
|
@@ -533,6 +581,8 @@ Each workflow has a status from its last 10 ended runs, so you see which ones ne
|
|
|
533
581
|
|
|
534
582
|
:::caution[Beta]
|
|
535
583
|
A re-run from a step needs the earlier run's trace, and a re-run from the failed step keeps in its trace only the steps it ran, so it cannot itself be re-run from a state before them.
|
|
584
|
+
|
|
585
|
+
<gap>A re-run from the failed step cannot apply an `Assign` of a step's whole result added since to a state that already ran because keeping each step's result in the checkpoints is not implemented: it goes on with the variables as they ran, and a re-run from that state applies it.</gap>
|
|
536
586
|
:::
|
|
537
587
|
|
|
538
588
|
A failed run keeps its [checkpoints](#how-a-run-is-run). `POST /api/v1/workflow_runs` with `{ "workflow_id": "...", "rerun_of": "..." }` starts a run that:
|
|
@@ -612,7 +662,7 @@ Every limit fails closed: a run or step that passes one fails, rather than going
|
|
|
612
662
|
| --- | --- |
|
|
613
663
|
| A definition | 256 KiB as JSON, 100 states, Maps included; an expression 4,096 characters. |
|
|
614
664
|
| An expression's evaluation | 1 second, and 300 levels deep; beyond, `States.QueryEvaluationError`. |
|
|
615
|
-
| A Task's `TimeoutSeconds` | 300 by default, and at most. |
|
|
665
|
+
| A Task's `TimeoutSeconds` | 300 by default, and at most; for a Task that [waits for an outside result](#waiting-for-an-outside-result), 366 days. |
|
|
616
666
|
| A retrier's `MaxAttempts` | 19. |
|
|
617
667
|
| The wait before a retry | 1 day, however `BackoffRate` grows it. |
|
|
618
668
|
| A Map's items | 10,000; beyond, the Map fails with `States.DataLimitExceeded` before any item runs. |
|