@protobase/cli 0.94.23 → 0.94.25

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.94.23";
2
+ var version = "0.94.25";
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.94.23",
3
+ "version": "0.94.25",
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.94.23",
47
- "@protobase/layout": "0.94.23",
48
- "@protobase/query": "0.94.23",
49
- "@protobase/schema": "0.94.23",
50
- "@protobase/server": "0.94.23",
51
- "@protobase/ui": "0.94.23",
52
- "@protobase/workflows": "0.94.23",
46
+ "@protobase/config": "0.94.25",
47
+ "@protobase/layout": "0.94.25",
48
+ "@protobase/query": "0.94.25",
49
+ "@protobase/schema": "0.94.25",
50
+ "@protobase/server": "0.94.25",
51
+ "@protobase/ui": "0.94.25",
52
+ "@protobase/workflows": "0.94.25",
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",
@@ -8,6 +8,7 @@ Buttons that change records, ask for input or run your own code, per role.
8
8
  - [Actions that ask for input](../reference/ui-config.md#actions-that-ask-for-input): An action opens a dialog for text, numbers, dates, choices or records before it runs.
9
9
  - [Actions that send from someone's mailbox](../reference/ui-config.md#actions-that-send-from-someones-mailbox) (beta): An action that sends from the person's own mailbox offers to connect it right in its dialog while none is linked or its link expired.
10
10
  - [Conditional and bulk actions](../reference/ui-config.md#where-an-action-applies): Actions show, or show disabled with a reason, only where a condition holds, and run on several selected rows at once.
11
+ - [Signing several records off](../reference/blocks.md#signing-several-records-off) (experimental): An action can sign several records off at once, after a checklist.
11
12
  - [Views per role](../reference/ui-config.md#actions-and-views-per-role): Each role can get its own view of a resource, with other columns, filters, layout and actions.
12
13
  - [Named actions](../reference/layouts.md#named-actions): An action is declared once in a view and used as a button on lists, record pages and composed pages.
13
14
  - [Links to a resource the record names](../reference/layouts.md#links-to-a-resource-the-record-names): A link action goes to the list or a record of the resource a field of the record names, and shows once the app serves it.
@@ -29,6 +29,7 @@ The page of one record, with its sections, related records, galleries, charts an
29
29
  - [Related records](../reference/ui-config.md#related-records): Every record page shows how many records point at it, and can list related records, also through a join resource, as a table, another display or cards with buttons, each row or card with a button to an address its fields name.
30
30
  - [Compact related cards](../reference/ui-config.md#compact-related-cards) (experimental): Related records can show as compact cards, coloured by a field.
31
31
  - [Counts in headings](../reference/ui-config.md#counts-in-headings) (experimental): Related lists can show their count in the heading.
32
+ - [Group help lines](../reference/ui-config.md#groups) (experimental): A group can show a short line under its heading, also while it is closed.
32
33
  - [A related record in full](../reference/ui-config.md#a-related-record-in-full): A related record can show its fields in full, without a card, for reading tabs such as notes.
33
34
  - [Record lines](../reference/ui-config.md#record-lines): The related table a record's view marks as its lines, such as an invoice's, shows all of them on its page, where you edit, add, remove and reorder them, and Save writes the record and its lines together.
34
35
  - [Custom section fallbacks](../reference/custom-components.md#record-section-fallbacks) (experimental): Where your own component on a record page cannot be drawn, such as on a watch, what you declare shows in its place: any main-column item in the main column, conversations included, and sidebar maps and sidebar custom components in the sidebar.
@@ -227,6 +227,7 @@ The first records of a list, drawn the way the resource's list page draws them:
227
227
  | `resource`, `filter`, `sort` | Which records, in which order. `resource` is required; `sort` defaults to the list's. |
228
228
  | `columns` | Field names for the table; default the view's list columns. |
229
229
  | `button` | A [button on each row](#row-buttons) to an address the row's fields name, or to the outside page a field holds; a list of these gives each row the first whose fields it holds. |
230
+ | `bulk` | `true`: rows can be selected, and the view's `bulk` actions run on the selected rows, as on the list page; see [signing several records off](#signing-several-records-off). |
230
231
  | `limit` | How many records it shows; default 10. It has no pages: the rest are in the list. Before 0.13 this was `pageSize`, rows per page; rename it. |
231
232
  | `display` | The display it opens in, such as `cards`; default the list's. |
232
233
  | `title`, `description`, `actions` | The heading. |
@@ -239,6 +240,10 @@ The first records of a list, drawn the way the resource's list page draws them:
239
240
 
240
241
  #### Row buttons
241
242
 
243
+ :::caution[Experimental]
244
+ Row buttons may change in any release. They do not show when a table switches to a list display such as cards, and on a mobile screen they sit at the end of the row, out of view until the table scrolls sideways.
245
+ :::
246
+
242
247
  `button: { label, to }` adds a last column with a button on each row: a link, drawn as a button, to `to`, an [address](layouts.md#addresses) in the app, such as a record on one of its [tabs](ui-config.md#tabs). `{field}` in the address or the label is replaced by the row's value, the label's as the record page shows it (an enum value by its label), so each row can name its own next step. A row with no value for a field the button names shows no button. The button is checked when the config loads, and `/meta` gives it, on the block or the related section, to callers who can read the fields it names and follow its address, and leaves it out for the others. A [related section](ui-config.md#related-records) takes the same `button`, on its table's rows or its cards.
243
248
 
244
249
  ```tsx
@@ -254,7 +259,7 @@ The first records of a list, drawn the way the resource's list page draws them:
254
259
  Each row can decide where its button goes:
255
260
 
256
261
  - **A record's tab from a field**: `tab: '{tab}'` opens the tab the row's `tab` field names; a name the record page has no tab for opens its first tab.
257
- - **A filtered list**: `{ kind: 'list', resource: 'holds', filter: 'task_id = {task_id} AND state = "{state}"' }` opens the list with a filter built from the row. A text value goes in quotes, escaped so a title with quotes in it stays one value; a value outside quotes must be a number or `true`/`false`, and a row with any other value there shows no button. The filter's fields must be filterable, as in any address.
262
+ - **A filtered list**: `{ kind: 'list', resource: 'holds', filter: 'task_id = {task_id} AND state = "{state}"' }` opens the list with a filter built from the row. A text value goes in quotes, on its own, escaped so a title with quotes in it stays one value; a `{field}` inside a longer quoted value, such as `'re {verb}'`, is refused when the config loads; a value outside quotes must be a number or `true`/`false`, and a row with any other value there shows no button. The filter's fields must be filterable, as in any address.
258
263
  - **An outside page**: `{ label: 'Error report', href: '{report_url}' }` opens the page the row's `report_url` field holds, in a new tab without the referrer, and the button carries the outside-link mark, which screen readers hear as "opens in a new tab". The `href` is one field, never a URL put together from parts, and a row whose field holds no `https:` URL shows no button.
259
264
  - **A different kind per row**: `button` takes a list of these, and each row shows the first whose fields it holds, so one list can hold items that each need a different act. A row whose first such choice leads nowhere, such as an `href` field without an `https:` URL, shows no button rather than the next choice. A caller who cannot read a choice's fields or follow its address gets the list without it.
260
265
 
@@ -273,7 +278,38 @@ Each row can decide where its button goes:
273
278
 
274
279
  <gap>A row button cannot show when the table switches to a list display such as cards because drawing it on a display is not implemented.</gap>
275
280
 
276
- <gap>A row button cannot show beside its row's first cell on a phone, where the table scrolls sideways to reach it, because a phone layout for table rows is not implemented.</gap>
281
+ <gap>A row button cannot show beside its row's first cell on a phone, where the table scrolls sideways to reach it, because a mobile layout for table rows is not implemented.</gap>
282
+
283
+ #### Signing several records off
284
+
285
+ :::caution[Experimental]
286
+ It may change in any release. On a phone the list page offers no selection, so there the records are signed off from a `Table` with `bulk`.
287
+ :::
288
+
289
+ Records that wait on the same act, such as several steps one approval unlocks, are signed off together: select them in the list, or in a `Table` with `bulk`, and press the action, such as **Approve (3)**. Its dialog names the records and shows a checklist, and the action runs only once every box is ticked. The checklist is an [input](ui-config.md#actions-that-ask-for-input), `i.checklist`, of an action with `bulk`:
290
+
291
+ ```ts
292
+ .actions((a) => [
293
+ a.update('approve', {
294
+ label: 'Approve',
295
+ bulk: true,
296
+ when: "state = 'waiting'",
297
+ confirm: 'Tick each detail you confirm.',
298
+ inputs: (i) => [i.checklist('checked', { label: 'What you checked', from: 'checklist' })],
299
+ set: { checked: '{checked}', state: 'approved' },
300
+ }),
301
+ ])
302
+ ```
303
+
304
+ ```tsx
305
+ <Table title="Waiting on you" resource="approvals" filter="state = 'waiting'" bulk />
306
+ ```
307
+
308
+ With `from`, each record brings its own boxes from that JSON field, a list of texts, and the dialog shows each box once, however many of the records hold it. Each record then gets the boxes it holds as its answer, so `'{checked}'` writes what was signed off for that record; a record that holds no boxes needs none ticked. With `items`, every record shows and gets the same boxes. The record page's button for the action opens the same dialog with that record's boxes.
309
+
310
+ Access is checked per record: a record the person may not change, by its permissions or by the API's answer, is refused while the others are signed off, and the toast names it, such as **Approve: done on 2, refused on 1** with "Not done on “Rotate the signing key”: you may not change it.". `protobase build` refuses a `from` that is no JSON field of the resource, and `/api/meta` leaves the action out for someone who cannot read that field.
311
+
312
+ <gap>A sign-off cannot show its progress or each record's result in its dialog because a result step for bulk actions is not implemented; the toast reports them.</gap>
277
313
 
278
314
  ### RecordCard
279
315
 
@@ -781,8 +781,14 @@ view<typeof listings>('listings').recordMode('read')
781
781
 
782
782
  ### Groups
783
783
 
784
+ :::caution[Experimental]
785
+ A group's `help` and `count` options may change in any release. A group's help line takes no `helpWhen`, so it shows on the read view and the form alike, and the create form, which shows a group's sections as plain sections, leaves it out.
786
+ :::
787
+
784
788
  `l.group(title, items, { help?, count?, collapsed?, when? })` puts a heading over sections and related tables, so a long record page shows what matters first and tucks rarely needed parts away. A group holds only `l.section` and `l.related` items, and not another group. With `collapsed: true` it shows only its heading until the person clicks it; clicking again closes it. A closed group draws nothing, so its related tables load nothing until it opens. Without `collapsed` it is a plain heading over its items. `help` is a line under the heading, shown while the group is closed too, and `count: true` shows beside the heading how many records its related tables hold together; see [Counts in headings](#counts-in-headings).
785
789
 
790
+ <gap>A group's help line cannot show only while the record is edited because `helpWhen` on `l.group` is not implemented.</gap>
791
+
786
792
  The open groups are in the address, as `?open=<title>` once per group, so a link, a copied URL or a new tab opens the page with the group open. Titles are unique among a view's groups, as the address names a group by its title. The page scrolls as a whole; opening a group adds no scroll box. On the form, a group that holds a field with an error or a conflict opens by itself. The create form shows the sections of a group as plain sections.
787
793
 
788
794
  ### Tabs
@@ -1099,6 +1105,10 @@ A `time` or `tone` field the caller cannot read is left out of their cards. <gap
1099
1105
 
1100
1106
  #### Counts in headings
1101
1107
 
1108
+ :::caution[Experimental]
1109
+ Counts in headings may change in any release. A count covers only the records the reader may see, and none shows when its query fails or the server gives no total.
1110
+ :::
1111
+
1102
1112
  With `count: true` a related section shows beside its title how many records match, such as **Doing 2**, so the reader sees what is behind each heading without scrolling. A group with `count: true` shows how many records its related tables hold together, while it is closed too, so a closed group still says whether opening it is worth it. A section with no records shows 0. The count is the records the reader may see, as the list API counts them with their access rules, and it follows the page's own changes and, on a [live](live.md) resource, everyone else's. The count is a quiet pill after the title, 0 as an outline, and a screen reader hears it with the records' name, such as "Doing (2 tasks)"; while it loads, a placeholder of its size holds its place, and a count that cannot be read shows no pill rather than 0. `help` puts a line under the heading of either.
1103
1113
 
1104
1114
  ```ts
@@ -1343,6 +1353,8 @@ a.update('answer', { label: 'Answer', inputs: (i) => [i.text('answer', { label:
1343
1353
  | `i.date(name, o)` | A date, `YYYY-MM-DD`. |
1344
1354
  | `i.choice(name, { options })` | One of `options`, each a `value` with the `label` it reads as. |
1345
1355
  | `i.choice(name, { resource })` | A record of `resource`, picked as the create form picks a relation; the handler gets its key. |
1356
+ | `i.checklist(name, { items })` | Boxes to tick, every one, before the action runs: the same `items` for every record. The answer is the list of their texts. |
1357
+ | `i.checklist(name, { from })` | The same, with each record's own boxes, which its JSON field `from` holds as a list of texts. See [signing several records off at once](blocks.md#signing-several-records-off). |
1346
1358
  | `i.custom(name, { component, props? })` | What a [component](custom-components.md) of the app's `protobase.ui.tsx`, by the name it is registered under, edits. |
1347
1359
 
1348
1360
  Each takes `label`, and optionally `help`, a `default`, `optional: true` to allow an empty answer (every other input is required) and `when`, an AIP-160 condition over the inputs before it, as [`<Show when>`](layouts.md#conditions) is over a record: `"start = 'github' OR code = 'github'"`. An input whose condition does not hold is hidden, not required and left out of `values`, and the inputs after it read it as empty. A `when` that names no input before it, a `default` that is not one of the options and a name given twice stop the config from loading; so does a choice of a resource the app does not have, when the server starts.
@@ -1381,6 +1393,6 @@ Any action whose handler fails with a function's [mailbox problem](email.md#from
1381
1393
  ])
1382
1394
  ```
1383
1395
 
1384
- Besides the record page, the list's row menu offers each named action without `inputs` on the rows it applies to, disabled where it is disabled on the record page, and in red when it is a delete or a danger action; a link is a link there, or a disabled item without one where it is disabled. An `a.update` or `a.action` with `bulk` and no `inputs` is also offered for the selected rows, as **Start (2)**, while one of them applies: it asks its `confirm` once, runs on each row it applies to, one after another, and its toast says how many it ran on, skipped and failed on. An `a.action`'s handler is called once per row.
1396
+ Besides the record page, the list's row menu offers each named action without `inputs` on the rows it applies to, disabled where it is disabled on the record page, and in red when it is a delete or a danger action; a link is a link there, or a disabled item without one where it is disabled. An `a.update` or `a.action` with `bulk` is also offered for the selected rows, as **Start (2)**, while one of them applies: it asks its `confirm` or its inputs once, naming the records, runs on each row it applies to, one after another, and its toast says how many it ran on, skipped, refused and failed on. An `a.action`'s handler is called once per row. A row the person may not change is refused, by its record's permissions or by the API's `403`, while the others run, and the toast names each refused record by its title. <gap>The list page cannot offer bulk actions on a phone because selecting its mobile rows is not implemented; a [`Table`](blocks.md#signing-several-records-off) with `bulk` offers them there.</gap>
1385
1397
 
1386
1398
  A condition reads only the record's own fields, so the list decides it for each row from the row itself: `protobase build` refuses one that names a relation's field (`host_id.name`), counts records (`hosts.count`) or names a field the resource does not have, a disabled button without a `reason`, and a `reason` or `otherwise` without `when`. In `/api/meta`, a user who cannot read a field the condition reads does not get the action. The condition only decides what the buttons show: the resource's [access rules](access.md) decide what the API lets the user do.