@protobase/cli 0.25.5 → 0.25.7
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/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/cli",
|
|
3
|
-
"version": "0.25.
|
|
3
|
+
"version": "0.25.7",
|
|
4
4
|
"description": "The protobase command: scaffold, doctor, dev, build and serve a Protobase project.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@hono/node-server": "^2.1.3",
|
|
37
37
|
"@hono/vite-dev-server": "^0.26.1",
|
|
38
|
-
"@protobase/layout": "0.25.
|
|
39
|
-
"@protobase/query": "0.25.
|
|
40
|
-
"@protobase/schema": "0.25.
|
|
41
|
-
"@protobase/server": "0.25.
|
|
42
|
-
"@protobase/ui": "0.25.
|
|
38
|
+
"@protobase/layout": "0.25.7",
|
|
39
|
+
"@protobase/query": "0.25.7",
|
|
40
|
+
"@protobase/schema": "0.25.7",
|
|
41
|
+
"@protobase/server": "0.25.7",
|
|
42
|
+
"@protobase/ui": "0.25.7",
|
|
43
43
|
"@react-email/render": "^2.1.0",
|
|
44
44
|
"@scalar/hono-api-reference": "^0.12.10",
|
|
45
45
|
"@tailwindcss/vite": "^4.3.3",
|
|
@@ -203,7 +203,7 @@ The API sends no CORS headers until it has something to allow: other websites in
|
|
|
203
203
|
|
|
204
204
|
## Errors
|
|
205
205
|
|
|
206
|
-
Every error is `application/problem+json` (RFC 9457) with `type` (`urn:protobase:problem:<slug>`), `title`, `status`, `detail`, `instance`. Filter and `order_by` errors add `parameter` and `errors: [{ code, message, hint, span: { start, end } }]`; invalid parameters add `errors: [{ parameter, message }]`. A create or update whose body fails the checks is `invalid-record` with `errors: [{ field, code, message, params }]`, `code` one of `required`, `invalid-value`, `read-only`, `unknown-field` and `invalid-record` (a `.validate()` rule); `params` is the limit an invalid value broke, such as `{ min }`, `{ max }` or a decimal's `{ precision, scale }`. Database constraint failures map to `409` or `400` without the raw message. A delete that other records still point at is a `409` `conflict` with `blockedBy: { resource, field? }`: their resource, when the caller may list it, and its relation field pointing at the record, when they may filter by it, so a client can open those records; the admin app's toast names them, such as "Orders still point at this company.", with a link to that list. Postgres names one table of them only, so `blockedBy` holds one resource; anything unexpected is a `500` with a fixed detail, reported to `options.onUnhandledError` and, when it is set, the [error tracker](#error-reporting).
|
|
206
|
+
Every error is `application/problem+json` (RFC 9457) with `type` (`urn:protobase:problem:<slug>`), `title`, `status`, `detail`, `instance`. Filter and `order_by` errors add `parameter` and `errors: [{ code, message, hint, span: { start, end } }]`; invalid parameters add `errors: [{ parameter, message }]`. A create or update whose body fails the checks is `invalid-record` with `errors: [{ field, code, message, params }]`, `code` one of `required`, `invalid-value`, `read-only`, `unknown-field` and `invalid-record` (a `.validate()` rule); `params` is the limit an invalid value broke, such as `{ min }`, `{ max }` or a decimal's `{ precision, scale }`. Database constraint failures map to `409` or `400` without the raw message. A create or update that writes the position of a resource with `after` so a record ranks at or above one it depends on is a `409` `ranks-above-dependency`, as in a [`reorder`](#batch-writes). A delete that other records still point at is a `409` `conflict` with `blockedBy: { resource, field? }`: their resource, when the caller may list it, and its relation field pointing at the record, when they may filter by it, so a client can open those records; the admin app's toast names them, such as "Orders still point at this company.", with a link to that list. Postgres names one table of them only, so `blockedBy` holds one resource; anything unexpected is a `500` with a fixed detail, reported to `options.onUnhandledError` and, when it is set, the [error tracker](#error-reporting).
|
|
207
207
|
|
|
208
208
|
| Status | Slugs |
|
|
209
209
|
| --- | --- |
|
|
@@ -248,7 +248,7 @@ Some records wait for others, such as a task blocked by another task. With `afte
|
|
|
248
248
|
|
|
249
249
|
`field` and `key` are filterable relations of the join resource to the ranked one: `field` holds the record that waits, `key` the record it waits for. `filter` narrows the join records and `while` the records waited for, both optional. The ranked resource needs a key of one field; the config is checked when it loads.
|
|
250
250
|
|
|
251
|
-
The server's [`reorder`](api.md#batch-writes))
|
|
251
|
+
The server's [`reorder`](api.md#batch-writes)), and a create or update that writes the position, refuse an order that puts a record at or above a pending record it depends on, or one of those at or below it. Pairs already out of order, such as a dependency added after the ranking, do not block other moves. The list's `drag: { rank: true }` follows it on the table and the board without another option. Before it saves a drop, it reads the record's dependencies through the list API, so the join resource's `field` and `key` need an index. A card or row dropped above a record it depends on lands in the first place below that keeps the order, and a warning names that record by its title. On a board the ranks are those of every column, so a card whose dependency in another column ranks above its whole column takes the last place, with a rank just above that dependency. With no such place, it stays where it was, with the same warning.
|
|
252
252
|
|
|
253
253
|
#### Board drops
|
|
254
254
|
|
|
@@ -600,7 +600,7 @@ export const repairsView = filtered
|
|
|
600
600
|
| `l.group(title, items, { collapsed?, when? })` | A heading over sections and related tables, closed until opened with `collapsed: true`. `when` also takes a [condition](#form-and-read-view). See [Groups](#groups). |
|
|
601
601
|
| `l.tab(title, items)` | A tab holding main-column items; a view's tabs show as one strip on the read view and the form. See [Tabs](#tabs). |
|
|
602
602
|
| `l.sidebar(fields, { when? })` | A summary card beside it, read-only. `when` also takes a [condition](#form-and-read-view). |
|
|
603
|
-
| `l.related(title, { ... })` | A table of the records of another resource that point at this one, in the main column. See [Related records](#related-records). |
|
|
603
|
+
| `l.related(title, { ... })` | A table or cards of the records of another resource that point at this one, in the main column. See [Related records](#related-records). |
|
|
604
604
|
| `l.custom(Component, { title?, props?, sidebar?, when? })` | 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. |
|
|
605
605
|
| `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). |
|
|
606
606
|
| `l.gallery(title, { image?, photos?, when? })` | The record's photos as tiles, opening a lightbox. See [Galleries](#galleries). |
|
|
@@ -800,10 +800,12 @@ Without any configuration, the record page's rail has a **Related records** card
|
|
|
800
800
|
| `from` | A field of this record whose value `field` must hold, instead of this record's key, such as the task of a question, to list the task's links: `{ resource: 'task_links', field: 'task_id', from: 'task_id' }`. Same type as `field` (a relation to the same resource), not sensitive, and not with `through`. A record with no value lists nothing. |
|
|
801
801
|
| `through` | `{ resource, field, key?, filter? }`: the join records whose `field` (a filterable relation) holds this record's key; their `key` values (default their primary key) pick the listed records. All of them are read. |
|
|
802
802
|
| `filter`, `sort` | AIP-160 and AIP-132 on `resource`, as in the list API. `filter` narrows the listed records, `through.filter` the join records. |
|
|
803
|
-
| `columns` | Fields of `resource`, through relations too (`unit_id.property_id`); default the view's list columns without `field`. The first links to the record a row opens. |
|
|
803
|
+
| `columns` | Fields of `resource`, through relations too (`unit_id.property_id`); default the view's list columns without `field`. The first links to the record a row opens. With `presentation: 'cards'`, the fields each card shows. |
|
|
804
|
+
| `presentation` | `'cards'` shows the records as [cards](#related-records-as-cards) instead of the table or display. |
|
|
805
|
+
| `actions` | Named actions of `resource`'s view, by name, as buttons on each card; only with `presentation: 'cards'`. |
|
|
804
806
|
| `open` | The relation of `resource` whose record a row opens, for rows that link this record to another. By default the one relation in `resource`'s primary key besides `field`, when there is exactly one (a join resource such as `task_dependencies` keyed on `[task_id, type, depends_on_id]`); otherwise rows open their own records. The row's menu then has **Open** for the other record and **Edit** for the link itself. |
|
|
805
807
|
| `limit` | How many records it shows, 1 to 100; default 10. When there are more, the section says so beside View all, such as "The first 10 of 37.". Before 0.13 this was `pageSize`, rows per page; rename it. |
|
|
806
|
-
| `display` | The display of `resource`'s list it opens in, such as `cards`; default the list's. |
|
|
808
|
+
| `display` | The display of `resource`'s list it opens in, and View all opens, such as `cards`; default the list's. |
|
|
807
809
|
| `help`, `empty` | A line under the title, and the text when nothing matches (default "Nothing here yet."). |
|
|
808
810
|
| `hideEmpty` | `true` leaves the section off the page while it has no records. |
|
|
809
811
|
|
|
@@ -857,6 +859,24 @@ When `resource` is ordered by hand within the record on the page (`.position(...
|
|
|
857
859
|
|
|
858
860
|
Every name is checked when the config loads. In `/meta` a caller who cannot read a resource the section names, or a field its filter or sort uses, does not get the section, and columns they cannot read are left out; the rows come from the list API with the caller's token, so row filters apply as everywhere else.
|
|
859
861
|
|
|
862
|
+
#### Related records as cards
|
|
863
|
+
|
|
864
|
+
With `presentation: 'cards'` the section shows each record as a card, the cards stacked full width so a long value has room: the record's title, a link to its page, then each of `columns` under its label as the record page shows it (a markdown field rendered, a relation by its name), and a button for each of `actions`. A value taller than a few lines is cut short with **Show more**, which shows it all. The buttons run the actions as the record page does: one with `confirm` asks first, one with [inputs](#actions-that-ask-for-input) opens its dialog (a sheet on a phone), and an `a.action` runs the app's handler; a card leaves out an action the user does not get and disables one they cannot run on that record. After an action the section loads again, so a record it no longer matches leaves it, and with `hideEmpty` the section goes once nothing matches.
|
|
865
|
+
|
|
866
|
+
```ts
|
|
867
|
+
l.related('Waiting on you', {
|
|
868
|
+
resource: 'task_preconditions',
|
|
869
|
+
field: 'task_id',
|
|
870
|
+
filter: 'state = "waiting"',
|
|
871
|
+
presentation: 'cards',
|
|
872
|
+
columns: ['plan'],
|
|
873
|
+
actions: ['approve', 'request_changes'],
|
|
874
|
+
hideEmpty: true,
|
|
875
|
+
})
|
|
876
|
+
```
|
|
877
|
+
|
|
878
|
+
An action that `actions` names must be a named action of `resource`'s view. The cards have no display switch or **Reorder**; View all opens the list as a table section would.
|
|
879
|
+
|
|
860
880
|
## Actions and views per role
|
|
861
881
|
|
|
862
882
|
```ts title="docs-examples/bike-shop/step-5.ts"
|