@protobase/cli 0.94.24 → 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.
package/dist/cli/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/cli",
|
|
3
|
-
"version": "0.94.
|
|
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.
|
|
47
|
-
"@protobase/layout": "0.94.
|
|
48
|
-
"@protobase/query": "0.94.
|
|
49
|
-
"@protobase/schema": "0.94.
|
|
50
|
-
"@protobase/server": "0.94.
|
|
51
|
-
"@protobase/ui": "0.94.
|
|
52
|
-
"@protobase/workflows": "0.94.
|
|
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.
|
|
@@ -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. |
|
|
@@ -279,6 +280,37 @@ Each row can decide where its button goes:
|
|
|
279
280
|
|
|
280
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>
|
|
281
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>
|
|
313
|
+
|
|
282
314
|
### RecordCard
|
|
283
315
|
|
|
284
316
|
One record and what is inside it: the one `recordKey` names (the key as the record's URL has it), else the first that matches `filter` in `sort` order. Its children and its heading `actions` work on that record.
|
|
@@ -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
|
|
@@ -1347,6 +1353,8 @@ a.update('answer', { label: 'Answer', inputs: (i) => [i.text('answer', { label:
|
|
|
1347
1353
|
| `i.date(name, o)` | A date, `YYYY-MM-DD`. |
|
|
1348
1354
|
| `i.choice(name, { options })` | One of `options`, each a `value` with the `label` it reads as. |
|
|
1349
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). |
|
|
1350
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. |
|
|
1351
1359
|
|
|
1352
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.
|
|
@@ -1385,6 +1393,6 @@ Any action whose handler fails with a function's [mailbox problem](email.md#from
|
|
|
1385
1393
|
])
|
|
1386
1394
|
```
|
|
1387
1395
|
|
|
1388
|
-
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`
|
|
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>
|
|
1389
1397
|
|
|
1390
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.
|