@protobase/cli 0.94.19 → 0.94.21
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/lists.md +1 -0
- package/skills/protobase/references/features/record-pages.md +1 -0
- package/skills/protobase/references/reference/blocks.md +2 -0
- package/skills/protobase/references/reference/plugins.md +1 -1
- package/skills/protobase/references/reference/ui-config.md +44 -2
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.21",
|
|
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.21",
|
|
47
|
+
"@protobase/layout": "0.94.21",
|
|
48
|
+
"@protobase/query": "0.94.21",
|
|
49
|
+
"@protobase/schema": "0.94.21",
|
|
50
|
+
"@protobase/server": "0.94.21",
|
|
51
|
+
"@protobase/ui": "0.94.21",
|
|
52
|
+
"@protobase/workflows": "0.94.21",
|
|
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",
|
|
@@ -7,6 +7,7 @@ The list page of each resource, with its columns, filters, charts, search, expor
|
|
|
7
7
|
- [Names and columns](../reference/ui-config.md#names-and-columns): Each resource gets singular and plural names and a title field, and a list shows the columns you choose, with a starting sort and search.
|
|
8
8
|
- [Field display hints](../reference/ui-config.md#names-and-columns): Labels, help lines, badges, codes, percentages, currencies, units, decimals and relative times such as "5 minutes ago".
|
|
9
9
|
- [Email, phone and web links](../reference/ui-config.md#names-and-columns): Fields marked as email, phone or URL show as links and are edited with the matching phone keyboard and browser autofill.
|
|
10
|
+
- [JSON fields and link text](../reference/ui-config.md#json-fields-and-link-text) (experimental): Tables show JSON fields readably, and links can carry their own text.
|
|
10
11
|
- [Markdown and long text](../reference/ui-config.md#names-and-columns): Long text is edited in a box that grows with it. Markdown fields have Write and Preview and show rendered on the record page.
|
|
11
12
|
- [Enum labels and colours](../reference/ui-config.md#names-and-columns): Enum values get readable labels and badge colours that show everywhere the value appears, and badges can be drawn as arrows, as on a rating scale.
|
|
12
13
|
- [Value tones and currencies](../reference/ui-config.md#value-tones-and-currencies): An enum value's badge takes the tone or colour its view gives it, and a money field shows in the ISO 4217 currency its view names.
|
|
@@ -33,6 +33,7 @@ The page of one record, with its sections, related records, galleries, charts an
|
|
|
33
33
|
- [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
34
|
- [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.
|
|
35
35
|
- [Conversations](../reference/ui-config.md#conversations): A record page holds a chat about the record, such as a task's, with its messages in markdown and a box that sends one, declared in its layout with no component of the app's own.
|
|
36
|
+
- [Message status and a working indicator](../reference/ui-config.md#message-status-and-a-working-indicator) (experimental): Threads can show each message's status and when a reply is being written.
|
|
36
37
|
- [Charts of samples](../reference/ui-config.md#charts-of-related-records): A record page graphs numeric samples over the last hour, day or week, such as a server's CPU use.
|
|
37
38
|
- [Trends of related records](../reference/ui-config.md#trends-of-related-records) (experimental): Record pages can chart their related records over time.
|
|
38
39
|
- [Fresh data on return](../reference/ui-config.md#the-record-page): Records and lists reload when the browser tab is focused again, keeping unsaved edits.
|
|
@@ -465,6 +465,8 @@ The latest messages that match `filter`, oldest first, each under its sender's n
|
|
|
465
465
|
| `sender` | Who wrote each message: a relation, named as the record it points at, or a text field. Required. |
|
|
466
466
|
| `time` | When each was sent: a date or timestamp field the API can sort by, which orders them. Required. |
|
|
467
467
|
| `text` | The message; shown rendered when the message resource's view marks it [`.markdown()`](ui-config.md#names-and-columns). Required. |
|
|
468
|
+
| `status` | A short line under each message, such as whether it was delivered: a text or enum field, shown with its view's value labels, in red for a value it colours `red`; a message without a value shows none. Left out for a user who cannot read it. Experimental, see [Message status and a working indicator](ui-config.md#message-status-and-a-working-indicator). |
|
|
469
|
+
| `working` | A condition on the record around the thread, as [`Show`](#show) takes, such as `state = 'working'`: while it holds, the thread ends in a working indicator. Left out for a user who cannot read what it names. Experimental. |
|
|
468
470
|
| `limit` | How many of the latest it shows at first, and how many each **Load earlier messages** adds: 1 to 500, the API's largest page; default 50. |
|
|
469
471
|
| `title`, `description`, `actions` | The heading; no card is drawn around the thread, so it can sit in a `Card` with its composer. |
|
|
470
472
|
| `empty` | Text while there are no messages. |
|
|
@@ -151,7 +151,7 @@ Each part gets:
|
|
|
151
151
|
|
|
152
152
|
### JSON
|
|
153
153
|
|
|
154
|
-
`json` is a field type Protobase brings for any JSON field a form should edit, such as a workflow run's `input`: `r.input.widget('json')`. The form edits the value as JSON text, the record page shows it written out on several lines, and a list's table
|
|
154
|
+
`json` is a field type Protobase brings for any JSON field a form should edit, such as a workflow run's `input`: `r.input.widget('json')`. The form edits the value as JSON text, the record page shows it written out on several lines, and a list's table as a [short summary](ui-config.md#json-fields-and-link-text). Text that does not parse yet says so under the box and leaves the value as it last parsed; an emptied box is null. It takes the form's whole width. A plugin that registers a field type named `json` replaces it.
|
|
155
155
|
|
|
156
156
|
### Members
|
|
157
157
|
|
|
@@ -103,7 +103,7 @@ Field hints:
|
|
|
103
103
|
| `.help(text, { when? })` | A line under the field on the record page and in forms. `when: 'editing'` shows it only while the record is edited; see [Help while editing](#help-while-editing). |
|
|
104
104
|
| `.notOnCreate()` | Leaves the field off the create form, for one that makes sense only once the record exists, such as a choice among records added after it: the create leaves it empty or to its default, and the record page shows it as usual. The server stops at startup on a field a create needs, one that is not optional and has no default, a boolean too. |
|
|
105
105
|
| `.confirm(question)` | Asks `question` before a person changes the value in a form or a list cell, and Cancel keeps it. See [Confirming a change](#confirming-a-change). |
|
|
106
|
-
| `.format(format)` | `badge` shows statuses as coloured badges, `code` sets identifiers in monospace, as the list's identifier column too, `percent` adds a % sign, and `signed` shows a whole number in a list with its sign, green above zero and red below, such as a stock change of `+12` or `−3`; it needs an integer field. On a text field, `email`, `phone` and `url` show the value as a link that writes to it (`mailto:`), calls it (`tel:`, its digits and a leading +) or opens it in a new tab (only an `http` or `https` address; anything else stays text), on the record page, in its sidebar and in the list's cells but the title's, which links to the record; forms edit it in an email, phone or web address input, which brings up the keyboard for it on a mobile screen and offers the browser's autofill. Another field type with one of them stops the server at startup. `relative` on a timestamp shows it as "5 minutes ago" or "in 2 hours" in lists and on the record page, with the exact time on hover; `absolute` and `compact` are accepted and carried in `/meta` for apps that render their own lists. <gap>The admin does not use the `absolute` and `compact` formats yet.</gap> |
|
|
106
|
+
| `.format(format)` | `badge` shows statuses as coloured badges, `code` sets identifiers in monospace, as the list's identifier column too, `percent` adds a % sign, and `signed` shows a whole number in a list with its sign, green above zero and red below, such as a stock change of `+12` or `−3`; it needs an integer field. On a text field, `email`, `phone` and `url` show the value as a link that writes to it (`mailto:`), calls it (`tel:`, its digits and a leading +) or opens it in a new tab (only an `http` or `https` address; anything else stays text), and `.format('url', { text })` gives the link [its own text](#json-fields-and-link-text), on the record page, in its sidebar and in the list's cells but the title's, which links to the record; forms edit it in an email, phone or web address input, which brings up the keyboard for it on a mobile screen and offers the browser's autofill. Another field type with one of them stops the server at startup. `relative` on a timestamp shows it as "5 minutes ago" or "in 2 hours" in lists and on the record page, with the exact time on hover; `absolute` and `compact` are accepted and carried in `/meta` for apps that render their own lists. <gap>The admin does not use the `absolute` and `compact` formats yet.</gap> |
|
|
107
107
|
| `.multiline()` | A text of several lines, such as a description: forms edit it in a box that grows with the text, so the page scrolls rather than the box, and the record page's sections, a page's field blocks and a card's subtitle keep its line breaks (a card shows the first three lines); the record's sidebar shows it on one line. On the record page and the create form it takes the whole width of its section. Only a text field takes it; the list's table shows the text on one line. |
|
|
108
108
|
| `.markdown()` | Markdown, such as a task's notes: forms edit its source in a box that grows with it, with a Write and Preview switch above it, and store it exactly as typed. The record page's sections, a page's field blocks and a conversation's messages show it rendered as GitHub does, line breaks kept; raw HTML shows as text, links and images keep only http(s), mailto, tel and relative addresses, and links open in a new tab. A card's subtitle shows its first three lines rendered, its links as text; the list's table, the record's sidebar and a card's other lines show its text on one line without the marks. On the record page and the create form it takes the whole width of its section. Only a text field takes it, and the renderer loads with the first markdown shown. |
|
|
109
109
|
| `.prefix(text)`, `.suffix(text)`, `.decimals(n)` | Text around a number and its decimals: `€` and `2` show `€1,234.50`, `.suffix(' m²')` shows `120 m²`. They show wherever the number does: records, cards, table cells, forms and the range filter. A prefix is plain text, so a list does not show `€` as money; `.currency()` does. |
|
|
@@ -135,6 +135,27 @@ view<typeof orders>('orders').fields((r) => ({
|
|
|
135
135
|
|
|
136
136
|
The table's columns take their width from the first rows it shows, and keep it while it scrolls, filters and sorts: the `.title` column gets the largest share, other text a share as long as its values, and short values such as enums, booleans, numbers, amounts and dates their own width whole. A value cut short shows whole when hovered. On a desktop the title column is pinned to the left by default, with the column before it when it is the second, so it stays in view when the table scrolls sideways; the column menu unpins it, and pins any other column to the left edge, and the choice is kept in the browser for that list. A column of the table is made wider or narrower by dragging its header's right edge, or with the left and right arrow keys on that edge, down to 64 pixels; the other columns keep their width, a drag never sorts, and the widths last until the page is left or reloaded. The row menu stays at the table's right edge as it scrolls sideways. Embedded lists and a page's `Table` blocks size their columns the same way.
|
|
137
137
|
|
|
138
|
+
### JSON fields and link text
|
|
139
|
+
|
|
140
|
+
:::caution[Experimental]
|
|
141
|
+
JSON summaries and link text are new and may change in any release.
|
|
142
|
+
:::
|
|
143
|
+
|
|
144
|
+
Tables show JSON fields readably, and links can carry their own text. A JSON field, such as a tool call's input, shows in a list's table, a related table, a page's `Table` block and on cards and a phone's rows as a short summary on one line: an object as its keys and values, plain values before nested ones, `command: ls -la, cwd: /tmp, env: {…}`, a list of plain values as those values, and a list of objects as how many it holds, `3 items`. An object or list inside another shows as `{…}` or `[…]`, an empty text as `""`, each value is cut at 40 characters so one long value leaves room for the rest, and the summary at 160. The keys keep the order the database returns, which for a `jsonb` column is shortest first. The record page shows the whole value, written out on several lines across the width of its section.
|
|
145
|
+
|
|
146
|
+
A `url` field's link shows its address unless you give it a text. `.format('url', { text })` takes a fixed text, or one with `{field}` placeholders the record fills in, each as the record page shows it, such as an enum value by its label:
|
|
147
|
+
|
|
148
|
+
```ts
|
|
149
|
+
view<typeof errors>('errors').fields((r) => ({
|
|
150
|
+
report: r.report.format('url', { text: 'Error report' }),
|
|
151
|
+
trace: r.trace.format('url', { text: '{title}' }),
|
|
152
|
+
}))
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
The link still opens the address in a new tab, in the list's cells, related tables, the record page and its sidebar; cards and a phone's rows show the text too. When a field it names is empty, the link shows its address rather than a text with a gap, and so does it for a reader who cannot read a field it names. The list loads the fields a link's text names along with its columns. A text on another format, or one naming a field the resource does not have, stops the server at startup.
|
|
156
|
+
|
|
157
|
+
<gap>Cards, boards and a list's phone rows cannot open a url field's address because links on a card's one-line parts are not implemented; they show its text or address as plain text.</gap>
|
|
158
|
+
|
|
138
159
|
### Related records in a list
|
|
139
160
|
|
|
140
161
|
A list column can show the records of another resource that point at each row, as a dot per record: the tasks that serve an objective, say, each in its status's colour, so an objective's dots turn green as its tasks get done. `c`, the list's third argument, makes the column, and its name goes among the `columns`:
|
|
@@ -662,7 +683,7 @@ export const repairsView = filtered
|
|
|
662
683
|
| `l.custom(Component, { title?, props?, sidebar?, when?, fallback? })` | A [custom component](custom-components.md#record-sections) where it is listed: in the main column under `title`, or with `sidebar: true` as a sidebar card. [`fallback`](custom-components.md#record-section-fallbacks) shows in its place where it cannot be drawn. |
|
|
663
684
|
| `l.map(title, { latitude, longitude, zoom?, sidebar?, when? })` | A map with a pin at the record's position, in the main column or with `sidebar: true` as a sidebar card. See [Maps](#maps). |
|
|
664
685
|
| `l.chart(title, { resource, field, at, series, range?, help?, when? })` | Line graphs of numbers of the records that point at this one, such as a machine's samples, over the last hour, day or week. See [Charts of related records](#charts-of-related-records). |
|
|
665
|
-
| `l.thread(title, { resource, field, sender, time, text, limit?, empty?, help?, when? })` | The record's conversation: the latest messages that point at it, oldest first, under each sender's name and time. See [Conversations](#conversations). |
|
|
686
|
+
| `l.thread(title, { resource, field, sender, time, text, status?, working?, limit?, empty?, help?, when? })` | The record's conversation: the latest messages that point at it, oldest first, under each sender's name and time. See [Conversations](#conversations). |
|
|
666
687
|
| `l.composer({ resource, field, text, placeholder?, when? })` | A box that sends a message about the record, which the thread then shows. See [Conversations](#conversations). |
|
|
667
688
|
| `l.gallery(title, { image?, photos?, when? })` | The record's photos as tiles, opening a lightbox. See [Galleries](#galleries). |
|
|
668
689
|
| `l.history(title?, { limit?, when? })` | The record's changes, newest first, with who made each and the fields before and after; needs `.history()` on the resource, and a view without a layout shows it last by itself. See [Record history](history.md#on-the-record-page). |
|
|
@@ -1167,6 +1188,8 @@ The thread shows the latest messages oldest first, each under its sender's name
|
|
|
1167
1188
|
| `sender` | Who wrote each message: a relation, named as the record it points at, or a text field. Required. |
|
|
1168
1189
|
| `time` | When each was sent: a date or timestamp field the API can sort by, which orders them. Required. |
|
|
1169
1190
|
| `text` | The message, a text field. Required. |
|
|
1191
|
+
| `status` | A short line under each message, such as whether it was delivered: a text or enum field. See [Message status and a working indicator](#message-status-and-a-working-indicator). |
|
|
1192
|
+
| `working` | A condition on this record, such as `state = 'working'`, while which the thread ends in a working indicator. |
|
|
1170
1193
|
| `limit` | How many of the latest it shows at first, and how many each **Load earlier messages** adds: 1 to 500, the API's largest page; default 50. |
|
|
1171
1194
|
| `empty` | Text while there are no messages. |
|
|
1172
1195
|
| `help`, `when` | A line under the title, and whether it shows on the form, the read view or both. |
|
|
@@ -1191,6 +1214,25 @@ view<typeof tasks>('tasks').layout((r) => [
|
|
|
1191
1214
|
|
|
1192
1215
|
The messages are read with `field = <this record's key>` as the filter, newest first by `time`, so the user's access applies as on the list. That read needs an index on `(field, time)`, such as `create index on task_messages (task_id, sent_at)`, which [`protobase doctor`](cli.md#doctor) checks. A user who cannot read `field`, `sender`, `time` or `text` gets no thread, and one who may not create a message with `field` and `text` gets no composer. A `field` that is no relation to this resource, a `time` that is no date or timestamp the API can sort by, a `sender` that is no relation or text field, a thread `text` that is no text field, a sensitive field in the thread, or a composer `text` that is no writable text field stops the server at startup. As with a related section, the record page's count of the records that point at it leaves out the messages its thread shows.
|
|
1193
1216
|
|
|
1217
|
+
#### Message status and a working indicator
|
|
1218
|
+
|
|
1219
|
+
:::caution[Experimental]
|
|
1220
|
+
<gap>A message cannot show more than one status line because combining several status fields is not implemented.</gap> <gap>The working indicator cannot say who is writing because naming the writer is not implemented.</gap>
|
|
1221
|
+
:::
|
|
1222
|
+
|
|
1223
|
+
A thread can say whether each message arrived and whether a reply is on its way, as a chat with an assistant or a teammate does. `status` names a text or enum field of the messages, such as `delivery`, shown in small type under each message that has a value, with the labels the message resource's view gives its enum values; a message without one shows no line, and a value the view colours `red` with [`.valueColors()`](#value-tones-and-currencies), such as a failed send, shows in red beside an alert icon. `working` is a condition on the record the thread belongs to, written as for [conditional sections](#form-and-read-view), such as `state = 'working'`: while it holds, the thread ends in three pulsing dots and "Writing a reply…", which screen readers announce, and a reader at the end of the thread keeps seeing them.
|
|
1224
|
+
|
|
1225
|
+
```ts
|
|
1226
|
+
view<typeof chat_messages>('chat_messages').fields((r) => ({ delivery: r.delivery.valueLabels({ sent: 'Sent', delivered: 'Delivered', failed: 'Not sent' }).valueColors({ failed: 'red' }) }))
|
|
1227
|
+
|
|
1228
|
+
view<typeof chats>('chats').layout((r) => [
|
|
1229
|
+
l.thread('Conversation', { resource: 'chat_messages', field: 'chat_id', sender: 'sender', time: 'sent_at', text: 'body', status: 'delivery', working: "state = 'working'" }),
|
|
1230
|
+
l.composer({ resource: 'chat_messages', field: 'chat_id', text: 'body' }),
|
|
1231
|
+
])
|
|
1232
|
+
```
|
|
1233
|
+
|
|
1234
|
+
Both change without a reload when their resources are [live](live.md): a status as its message changes, and the indicator as the record does. A user who cannot read the status field sees the thread without the line, and one who cannot read what `working` names sees it without the indicator. A `status` that is no text or enum field, or is sensitive, and a `working` that does not parse or names a field the record does not have, stop the server at startup.
|
|
1235
|
+
|
|
1194
1236
|
## Actions and views per role
|
|
1195
1237
|
|
|
1196
1238
|
```ts title="docs-examples/bike-shop/step-5.ts"
|