@protobase/cli 0.76.1 → 0.76.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.
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "0.76.1";
2
+ var version = "0.76.3";
3
3
  //#endregion
4
4
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protobase/cli",
3
- "version": "0.76.1",
3
+ "version": "0.76.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.76.1",
47
- "@protobase/layout": "0.76.1",
48
- "@protobase/query": "0.76.1",
49
- "@protobase/schema": "0.76.1",
50
- "@protobase/server": "0.76.1",
51
- "@protobase/ui": "0.76.1",
52
- "@protobase/workflows": "0.76.1",
46
+ "@protobase/config": "0.76.3",
47
+ "@protobase/layout": "0.76.3",
48
+ "@protobase/query": "0.76.3",
49
+ "@protobase/schema": "0.76.3",
50
+ "@protobase/server": "0.76.3",
51
+ "@protobase/ui": "0.76.3",
52
+ "@protobase/workflows": "0.76.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",
@@ -12,6 +12,6 @@ A bell in the top bar and push to browsers and phones, for what your app tells i
12
12
  - [Notification history](../reference/notifications.md#history) (beta): Each user's inbox notifications are kept with when they were read, and the API lists them, counts the unread ones and marks them read.
13
13
  - [Web Push](../reference/notifications.md#web-push) (beta): Notifications reach desktop and Android browsers and home-screen web apps on iPhone through Web Push, with keys you generate.
14
14
  - [Push on Android](../reference/notifications.md#android) (beta): The server sends notifications to Android devices through Firebase Cloud Messaging with the service account key in `PROTOBASE_FCM_SERVICE_ACCOUNT`, and the mobile app receives them, set up by `protobase mobile` from a `google-services.json` in the project.
15
- - [Push on iOS](../reference/notifications.md#ios) (in development): The mobile app receives notifications on iPhone and iPad through the Apple Push Notification service, set up by `protobase mobile`.
15
+ - [Push on iOS](../reference/notifications.md#ios) (in development): The server sends notifications to iPhone and iPad through the Apple Push Notification service with the APNs key in `PROTOBASE_APNS_KEY`, `PROTOBASE_APNS_KEY_ID` and `PROTOBASE_APNS_TEAM_ID`; the mobile app registering for them and receiving them on iOS is coming soon.
16
16
  - [Do not disturb](../reference/status.md#do-not-disturb) (beta): While someone is on do not disturb, sends push nothing to their devices and keep inbox notifications in the bell for later.
17
17
  - [Notification bell](../reference/notifications.md#the-bell) (beta): The top bar shows how many inbox notifications are unread; its panel opens each one, marks them read and turns push on or off for this device.
@@ -8,13 +8,14 @@ Graphs of steps the server runs along their edges, written in a language a model
8
8
  - [Workflow language](../reference/workflows.md#the-document) (beta): The States Language with JSONata expressions, every value read by name, so a model writes and edits it as a small, local change.
9
9
  - [Checked on save](../reference/workflows.md#reading-values-by-name) (beta): A definition that does not fit the language, has an edge to no step, reads a value nothing gives or leaves out an argument its step type needs is refused, naming the step and the field. A workflow may start with no steps; such a version is kept, and refused as it is published or run.
10
10
  - [Workflow editor](../reference/workflows.md#the-editor) (beta): The admin app draws a workflow as a graph that lays itself out, to add, connect and remove steps of every trigger and step type of the app, its plugins' included, each with a form for its input beside the graph, with every problem the save would refuse shown on its step as it is edited.
11
- - [One page per workflow](../reference/workflows.md#the-workflows-page) (beta): A workflow's full-width page holds its graph, its saved versions to look at read-only, its runs shown on the graph and its trigger, so you build and debug without leaving it; the sidebar has only Workflows.
11
+ - [One page per workflow](../reference/workflows.md#the-workflows-page) (beta): A workflow's full-width page holds its graph, its saved versions to look at read-only, its runs shown on the graph and its trigger, so you build and debug without leaving it; in the sidebar, Workflows lists the workflows.
12
12
  - [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.
13
13
  - [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.
14
14
  - [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.
15
15
  - [Mail step](../reference/workflows.md#appmailsend) (beta): Sends mail, with files the run downloaded attached, from the app's own sender.
16
16
  - [Runs and step records](../reference/workflows.md#runs-and-their-steps) (beta): Each run started by hand through the API, from the app's code or by a trigger, with every step's input, output, logs, timing, tries and error recorded, secrets blanked out.
17
17
  - [Run debugger](../reference/workflows.md#following-and-debugging-a-run) (beta): Each workflow lists its runs with their status, who started them, when and for how long; a run shown on its workflow's page marks every step's status on the graph of the version it ran on, live while it runs, with each step's input, output, logs, timing, tries and error, secrets blanked out.
18
+ - [Run status](../reference/workflows.md#run-status) (beta): The sidebar lists your workflows under Workflows, each marked by how its last 10 ended runs went, red, orange, green or gray, in a shape of its own; a workflow's page says why in words, links to the run, and offers Mark as resolved.
18
19
  - [Re-run from a step](../reference/workflows.md#re-running-a-failed-run) (beta): Once the workflow is fixed, a run runs again from any step of the workflow itself it reached, outside For each, keeping what the steps before it gave; a test run starts the workflow with a sample input from its page.
19
20
  - [Replay a run](../reference/workflows.md#replaying-a-run) (beta): replay a finished run on your workflow as it is now, with the same input. Steps that write are held back and reads come from the step cache or run again, so you can try a change on the same data without sending anything again.
20
21
  - [Runs that survive restarts](../reference/workflows.md#how-a-run-is-run) (beta): A run takes up where it stood after a restart or a crashed worker, never running a saved step again, and every limit fails closed.
@@ -129,6 +129,12 @@ Each item has `id`, `name`, `slug`, `price` and `image`, of published products o
129
129
 
130
130
  A field rule goes from the field to the roles: `cost_price` above is hidden from every role that reads products but those holding `costs.read`. Use it for the few sensitive columns of a resource that many roles read, such as a screening result (`f.text().access({ read: roles.can('screening.read') })`). A field list goes from the role to the fields: use it for a role that should see only some columns, such as an integration or anonymous visitors, so a new column stays hidden from it. When both apply, a field needs both.
131
131
 
132
+ A field that shows what another resource holds, such as a summary of a project's invoices, can follow who reads that resource: a field rule gets `ctx.holds(capability)`, which is true when one of the caller's roles holds the capability on every row and field, such as `invoices.read` but not `invoices.read.own` or a limited one. A wildcard over resources such as `*.read` does not count, as on a resource with `.explicitGrants()`; without roles, it gives what an operation without a rule gets.
133
+
134
+ ```ts
135
+ invoiced: f.decimal({ precision: 12, scale: 2 }).readOnly().access({ read: (ctx) => ctx.holds?.('invoices.read') ?? false })
136
+ ```
137
+
132
138
  ### Write-only fields
133
139
 
134
140
  A role writes a field it cannot read only when the field's own `create` or `update` rule allows it: `f.text().access({ read: roles.is('loop'), create: roles.is('admin'), update: roles.is('admin') })` lets `admin` set a value only `loop` reads. A write rule the field follows from its resource never does, so hiding a field from a role does not let everyone who updates the resource overwrite it. The value is in no response, history, export or webhook of the writer, and no reveal shows it to them. `/meta` gives the writer the field marked `writeOnly: true`, sensitive and neither filterable nor sortable, and keeps it in the view's record sections and field hints only, so the admin app edits it only where a section of the layout names it: as a password-style input to type a new value in, with no stored value or eye to reveal one, never kept in a form's unsaved changes, and nowhere on the read view. The record's `permissions.fields` lists it as `edit` where the writer may update it. A file field, or the field a resource orders its records by (`.position()`), is never write-only, and no `reorder` orders by a write-only field.
@@ -217,7 +217,7 @@ export const PushButton = () => {
217
217
  The mobile app does not register for push on iOS yet.
218
218
  :::
219
219
 
220
- iOS devices receive push through the Apple Push Notification service (APNs), with token authentication. You create an APNs key in your Apple developer account, under Certificates, Identifiers & Profiles, Keys, and set it in three environment variables:
220
+ The server delivers push to iOS devices through the Apple Push Notification service (APNs), with token authentication. You create an APNs key in your Apple developer account, under Certificates, Identifiers & Profiles, Keys, and set it in three environment variables:
221
221
 
222
222
  | Variable | |
223
223
  | --- | --- |
@@ -84,7 +84,7 @@ export const channelsView = view<typeof channels>('channels').nav({ recent: { or
84
84
  | Key | Meaning |
85
85
  | --- | --- |
86
86
  | `status` | The field whose value picks each record's dot. Typed against the resource's fields. Optional: without it, records have no dot, as a chat's channels. |
87
- | `tones` | Dot colour per status value: `neutral`, `info`, `success`, `warning` or `danger`. Values not listed are `neutral`. Optional. |
87
+ | `tones` | Dot per status value, each with a colour and a shape of its own, so a status does not rest on colour alone: `neutral` a gray ring, `info` a diamond in the primary colour, `success` a green dot, `warning` an orange triangle, `danger` a red square. Values not listed are `neutral`. Optional. |
88
88
  | `pulse` | Status values whose dot pulses, for states in progress (a deploy running, an order being picked). Needs `status`. |
89
89
  | `filter` | Which records qualify, as AIP-160 text, exactly as `?filter=` on the list API. Use it to leave out finished or inactive records, or to keep them while they are recent: `status != "stopped" OR updated_at > now() - 7d`. |
90
90
  | `orderBy` | AIP-132 order, as `?order_by=`; the list's `sort` when omitted. |
@@ -145,6 +145,6 @@ A row shows one person's presence; a row for a group names no one and shows none
145
145
 
146
146
  `createAdmin` refuses to start when a group does not fit its resource: an unknown `status` field, `pulse` without a `status`, a tone outside the palette, a `limit` outside 1 to 20, `marks` without a name, or a `filter` or `orderBy` the list API would reject (unknown, non-filterable or non-sortable fields, bad syntax). `view.toModel(resourceModel)` runs the same checks.
147
147
 
148
- `/meta` drops the group, and keeps the rest of `nav`, for a caller who cannot read a field it uses (its status when it has one, or a field in its filter or order), so it never names a hidden field.
148
+ `/meta` drops the group, and keeps the rest of `nav`, for a caller who cannot read a field in its filter or order, and lists the records without dots for one who cannot read its status field, so it never names a hidden field.
149
149
 
150
150
  `EMAIL=... PASSWORD=... bun scripts/e2e-shell.mjs` checks the groups and the user menu in a browser against a running `bun run --cwd tests/apps/erp dev` (`BASE` for another address), comparing them with what the API gives that user.
@@ -18,7 +18,7 @@ import { defineConfig } from '@protobase/config'
18
18
  export default defineConfig({ workflows: { secrets: ['TICKETS_TOKEN'] } })
19
19
  ```
20
20
 
21
- It adds five resources, over a `workflows` schema that [`protobase migration`](cli.md#migration) writes (`NNN_workflows.sql`), and the `workflows.segment` [job](jobs.md) that runs them:
21
+ It adds six resources, over a `workflows` schema that [`protobase migration`](cli.md#migration) writes (`NNN_workflows.sql`), and the `workflows.segment` [job](jobs.md) that runs them:
22
22
 
23
23
  | Resource | |
24
24
  | --- | --- |
@@ -27,6 +27,7 @@ It adds five resources, over a `workflows` schema that [`protobase migration`](c
27
27
  | `workflow_runs` | A run, started by creating it with `workflow_id` and an `input`, and a saved `version` to run another than the published one, or on a workflow that is off the one saved last, or with `rerun_of` to [re-run a failed run](#re-running-a-failed-run), and `replay: true` too to [replay a run](#replaying-a-run); it runs the version its workflow had then, and a re-run or a replay the input of the run it names. Its status, output, error and timing are written by the runner. |
28
28
  | `workflow_steps` | Every step of every run. Read-only. |
29
29
  | `workflow_triggers` | The trigger of each enabled workflow that has one besides `manual`: its type, status and last error. Read-only. |
30
+ | `workflow_resolutions` | Each time someone [marked a workflow resolved](#run-status), by whom and when. Created only. |
30
31
 
31
32
  | `workflows` | |
32
33
  | --- | --- |
@@ -206,7 +207,7 @@ A failing Task or Map fails with an error name: a step type's own, such as `Http
206
207
 
207
208
  ## The editor
208
209
 
209
- A workflow's record page in the admin app, `/workflows/<id>`, and its create form draw the definition as a graph to edit, and save the same document the API saves. In the admin app's sidebar, Workflows is the only entry: a workflow's versions, runs, steps and trigger are on its page, and their resources and API stay as they are.
210
+ A workflow's record page in the admin app, `/workflows/<id>`, and its create form draw the definition as a graph to edit, and save the same document the API saves. In the admin app's sidebar, Workflows is the only entry, with the workflows listed under it by their [run status](#run-status): a workflow's versions, runs, steps and trigger are on its page, and their resources and API stay as they are.
210
211
 
211
212
  ### The workflow's page
212
213
 
@@ -327,6 +328,26 @@ A state that took more than one step, by its tries, its visits or a Map's items,
327
328
 
328
329
  While a run is queued, running or waiting, the page reads the run and its steps again every second, through the API as the person, so the marks, the step lists and the run's fields change as it goes, without a reload; it stops once the run has ended. The graph marks the states of a run's first 500 steps; the run's own page lists them all. <gap>The graph cannot mark the steps after a run's first 500 because reading a run's steps in more than one page for the trace is not implemented.</gap> Everything the page shows is what the run recorded, so a [secret](#secrets) shows as `[redacted]` wherever it would have been.
329
330
 
331
+ ### Run status
332
+
333
+ :::caution[Beta]
334
+ Who marked a workflow resolved shows by name only in an app with organizations.
335
+ :::
336
+
337
+ Each workflow has a status from its last 10 ended runs, so you see which ones need attention without opening them. Runs that are queued, running or waiting do not count. A failed run counts until someone marks the workflow as resolved after it ended, until a new version is saved, as a failure on an older version than the workflow's latest no longer counts, or until it is no longer among the last 10 ended runs, such as after ten later successful runs.
338
+
339
+ | Status | Mark | When |
340
+ | --- | --- | --- |
341
+ | Last run failed | red square | The latest ended run failed and still counts. |
342
+ | Earlier failure unresolved | orange triangle | The latest ended run succeeded, and an earlier one of the 10 failed and still counts. |
343
+ | No unresolved failures | green dot | The latest ended run succeeded, and no failure among the 10 still counts. |
344
+ | No runs yet, No runs since resolved, No runs since this version | gray ring | There is no ended run, or the latest is a failure that no longer counts. |
345
+
346
+ - **In the sidebar.** Workflows lists up to 20 workflows by name under it, each with its mark, and the status in its name for screen readers and in its tooltip, then *View all*. It refreshes as the sidebar's [recent records](sidebar.md#recent-records) do, and when a run you follow on a workflow's page ends. *View all* opens the list of every workflow, which shows each one's mark and status in a column of its own.
347
+ - **On the workflow's page.** *Status* says the reason in words with a link that opens the run on the graph, such as *Last run failed, 7 Nov 2026, 14:32* or *1 unresolved failure in the last 10 runs, latest 3 Nov 2026, 09:10*; a gray status says it without a link.
348
+ - **Mark as resolved.** While the status is red or orange, *Mark as resolved* beside it clears every failure so far, and the page then says who marked it and when. Anyone who may change the workflow may use it; through the API it is `POST /api/v1/workflow_resolutions` with `{ "workflow_id": "..." }`, each mark kept as a `workflow_resolutions` record, which `workflow_resolutions.read` reads. <gap>A mark as resolved cannot be undone because removing a resolution is not implemented.</gap>
349
+ - **Who sees it.** The status fields of a workflow, `run_status`, `status_run_id`, `status_run_at` and `unresolved_failures`, are real columns that the database keeps as runs end, so they cost nothing to read; only a caller whose roles hold `workflow_runs.read` on every run reads them. Anyone else sees the workflows listed without marks and no status. <gap>Who marked a workflow resolved shows as a user id in an app without organizations because naming users to every reader is not implemented.</gap>
350
+
330
351
  ### Re-running a failed run
331
352
 
332
353
  A failed run, shown on its workflow's page, offers *Re-run from the failed step*. It opens the form for a new run with `workflow_id` and `rerun_of` filled in; creating it, through the form or `POST /api/v1/workflow_runs` with `{ "workflow_id": "...", "rerun_of": "..." }`, starts a run that:
@@ -372,6 +393,7 @@ The workflow resources take only [named grants](access.md#resources-that-need-na
372
393
  | `workflows.create`, `workflows.update`, `workflows.delete` | Make, change and delete workflows, and turn them on and off. Each save that changes the definition makes the saver the workflow's last editor, whom its records steps and its trigger act as. |
373
394
  | `workflow_runs.create` | Run a workflow, with any input. The API writes only the fields a caller reads, so it goes with `workflow_runs.read`, and the caller must read the workflow too. |
374
395
  | `workflows.read`, `workflow_versions.read`, `workflow_runs.read`, `workflow_steps.read`, `workflow_triggers.read` | Read workflows, their versions, runs, steps and triggers, the steps' inputs and outputs included. |
396
+ | `workflow_resolutions.read` | Read who marked which workflow resolved and when. Marking one needs no grant of its own: whoever may change the workflow may. |
375
397
 
376
398
  ```ts
377
399
  defineRoles({
@@ -380,7 +402,7 @@ defineRoles({
380
402
  })
381
403
  ```
382
404
 
383
- All five are scoped to the tenant like any resource with `.tenant()`. A run takes its workflow's tenant; a start of another tenant's workflow is refused as one of a workflow that is not there.
405
+ All six are scoped to the tenant like any resource with `.tenant()`. A run takes its workflow's tenant; a start of another tenant's workflow is refused as one of a workflow that is not there.
384
406
 
385
407
  ## How a run is run
386
408