@protobase/cli 0.100.11 → 0.100.12
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
|
@@ -38,7 +38,7 @@ const relatedShapes = (term, models, from) => {
|
|
|
38
38
|
const title = (page, read) => {
|
|
39
39
|
const node = elementAt(page.tree, read.block);
|
|
40
40
|
const named = node && (text(node.props.title) ?? text(node.props.label));
|
|
41
|
-
const part = read.part === "calls" ? " calls" : read.part === "chosen" ? " chosen row" : read.part === "condition" ? " condition" : "";
|
|
41
|
+
const part = read.part === "calls" ? " calls" : read.part === "chosen" ? " chosen row" : read.part === "condition" ? " condition" : read.part === "total" ? " total" : "";
|
|
42
42
|
return `page "${page.name}", <${node?.type ?? "Page"}${named ? ` "${named}"` : ""}>${part}`;
|
|
43
43
|
};
|
|
44
44
|
const readSort = (page, read, model, view) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/cli",
|
|
3
|
-
"version": "0.100.
|
|
3
|
+
"version": "0.100.12",
|
|
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.100.
|
|
47
|
-
"@protobase/layout": "0.100.
|
|
48
|
-
"@protobase/query": "0.100.
|
|
49
|
-
"@protobase/schema": "0.100.
|
|
50
|
-
"@protobase/server": "0.100.
|
|
51
|
-
"@protobase/ui": "0.100.
|
|
52
|
-
"@protobase/workflows": "0.100.
|
|
46
|
+
"@protobase/config": "0.100.12",
|
|
47
|
+
"@protobase/layout": "0.100.12",
|
|
48
|
+
"@protobase/query": "0.100.12",
|
|
49
|
+
"@protobase/schema": "0.100.12",
|
|
50
|
+
"@protobase/server": "0.100.12",
|
|
51
|
+
"@protobase/ui": "0.100.12",
|
|
52
|
+
"@protobase/workflows": "0.100.12",
|
|
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",
|
|
@@ -19,7 +19,7 @@ Pages of your own, built from blocks in a JSX layout.
|
|
|
19
19
|
- [Full-width pages](../reference/blocks.md#page): A page fills the whole area beside the sidebar instead of a centred column, for a dashboard with many blocks.
|
|
20
20
|
- [Data blocks](../reference/blocks.md#data): Counts, tables, single records, rows of cards, field values and progress bars.
|
|
21
21
|
- [Related records](../reference/layouts.md#related-records) (beta): Layouts repeat over a record's related records, the records a JSON list of keys points at and the items of a JSON list with `ReferenceManyField`, `ReferenceArrayField`, `ArrayField`, `RecordsIterator` and `ReferenceField`, nested as deep as needed, and a table draws such a list.
|
|
22
|
-
- [Read plans](../reference/layouts.md#how-a-page-reads-its-data) (beta): The build plans one read per data block ahead of time, derives the fields each read needs, and checks every nested read's indexes. Every read of a page's records, card rows, record rows, tables, threads, charts, counts, related lists and the custom components that declare their reads starts at once when it opens, and a data block's [text form](../reference/layouts.md#a-pages-text-with-its-records) lists its records; record rows of favorites or saved searches,
|
|
22
|
+
- [Read plans](../reference/layouts.md#how-a-page-reads-its-data) (beta): The build plans one read per data block ahead of time, derives the fields each read needs, and checks every nested read's indexes. Every read of a page's records, card rows, record rows, tables, threads, charts, counts, related lists and the custom components that declare their reads starts at once when it opens, those inside the records of another block included, and a data block's [text form](../reference/layouts.md#a-pages-text-with-its-records) lists its records; record rows of favorites or saved searches, record rows inside the records of another block, and custom components that fetch their own data, still load on their own.
|
|
23
23
|
- [Table columns on a phone](../reference/blocks.md#columns-on-a-phone): Table blocks choose which columns show at mobile width by priority, with a sensible default, and fall back to a Markdown table.
|
|
24
24
|
- [Row buttons](../reference/blocks.md#row-buttons) (experimental): A table's rows carry a button labelled by a field of the row, such as its next step; the row decides where it goes: a record tab a field names, a list with a filter built from its fields, a list whose resource and filter its fields hold, or an outside https link a field holds. On mobile width the button sits under the row's first cell.
|
|
25
25
|
- [Record rows](../reference/blocks.md#recordrow): A sideways row of cards for a filter, favorites or saved searches, with a count and new-record marks.
|
|
@@ -166,20 +166,20 @@ On the web, a `RecordRow` of a view with `listOf` or `searchesOf`, and a `Table`
|
|
|
166
166
|
|
|
167
167
|
The build compiles each page into a read plan: one ordinary API read per data block, each known before any record is read, so all of them start together when the page opens and none waits for another's rows. There is no combined page query: each read is a request of its own. `/api/meta` sends each user the plan of the page as they see it, so it holds no read of a resource they cannot read and no field they cannot read.
|
|
168
168
|
|
|
169
|
-
- **One read per block.** `Stat`, `RecordCard`, `Table`, `CardRow`, `RecordRow`, `RecordCards`, `Thread`, `Chart`, `Timeline`, `ReferenceManyField`, `ReferenceArrayField` and `ReferenceField` each make one list, count or `:aggregate` read. A `Thread`'s tool calls, the row a `Table`'s or the bar a `Timeline`'s `select` chose
|
|
169
|
+
- **One read per block.** `Stat`, `RecordCard`, `Table`, `CardRow`, `RecordRow`, `RecordCards`, `Thread`, `Chart`, `Timeline`, `ReferenceManyField`, `ReferenceArrayField` and `ReferenceField` each make one list, count or `:aggregate` read. A `Thread`'s tool calls, the row a `Table`'s or the bar a `Timeline`'s `select` chose, each `<resource>.count` a condition names and the total per record of a `Table` or `RecordCards` inside the records of another (`#total`) are reads of their own. A block under `Show` or `Match` is read anyway: the condition decides only what is drawn.
|
|
170
170
|
- **Fields are derived.** You never write `fields`. Each read asks for its key and every field drawn in its scope: by `Field`s, [field components](#field-values), `{{path}}`s, conditions and table columns, and the fields a nested list ties itself by. A block whose view decides what it draws, such as a `Table` without `columns` or a `RecordRow`, reads every field. So does a read whose records an `Action` or an edit form changes, since it asks for each record's ETag and an ETag covers the whole record. The other reads ask for no ETag (`etag=false`), so the database reads only their fields.
|
|
171
171
|
- **A nested read carries the read around it.** A block inside the records of another ties itself to them by a field: a `ReferenceManyField`'s `target`, a `ReferenceField`'s or `ReferenceArrayField`'s `source`, or `task_id = {{id}}` as a top-level `AND` term of a filter. Its read takes that as a [`related()`](api.md#filtering-through-related-records) term holding the outer read's own filter, order and page size, such as `related(task_id, tasks.id, (status = "open"), "id desc", 10)`, never the values of records read first. A `ReferenceArrayField` ties itself by the JSON list of keys the same way, `related(id, tasks.waits, …)`. Terms nest for a list two levels deep.
|
|
172
172
|
- **Per record, in one read.** Inside a repeated record, such as a `CardRow` or a `RecordsIterator`, a list reads its `perPage` (or `limit`) for each record with [`limit_per`](api.md#first-rows-per-value), and a `Stat` count is one `:aggregate` grouped by the field it ties itself by. Each nested read holds at most 500 records in all, the API's largest page, and the build warns when the records around it times its page are more, as some records would show fewer. A `ReferenceArrayField` there reads one page for all the records around it, of up to `perPage` records for each of them, since one record can sit in several lists. A `RecordRow` there needs a `limit`.
|
|
173
173
|
- **The page's own record.** A field of it that the address does not hold, `{{@root.project_id}}`, becomes `related()` on that record by its key, so the page's record is not read first. Page parameters and the page record's key stay `{{…}}` slots in the plan, which the address fills.
|
|
174
174
|
- **Indexes.** [`protobase doctor`](cli.md#doctor) judges every planned read with the scan guard's rule, the outer reads its `related()` terms carry included, so it reports a nested read's missing index before the API refuses the read.
|
|
175
175
|
|
|
176
|
-
When a page opens, the web starts every read of its plan at once, with the page's parameters filled in, whatever a condition says and however deep a block sits. A `RecordCard`, `CardRow`, `Stat`, `ReferenceManyField`, `ReferenceArrayField` and `ReferenceField` then draw from their read and read nothing themselves; one inside the records of another takes the rows of its own record out of its read, by the field it ties itself by. Inside a record the plan did not read, such as one of a list's later pages, it reads its rows itself. A `Table`, `Thread`, `Chart` and `RecordCards`, the row a `select` chose, a `Thread`'s tool calls and each `<resource>.count` a condition names start in the same wave with the very request their block makes, labels, photos and totals included, so the block finds it loading or loaded once it draws and nothing is read twice. A `Show` or `Match` decides only what is drawn: switching what it shows starts no new read. A change to a resource, live or the page's own, reads again exactly the reads of that resource, and a nested read also when the records around it change.
|
|
176
|
+
When a page opens, the web starts every read of its plan at once, with the page's parameters filled in, whatever a condition says and however deep a block sits. A `RecordCard`, `CardRow`, `Stat`, `ReferenceManyField`, `ReferenceArrayField` and `ReferenceField` then draw from their read and read nothing themselves; one inside the records of another takes the rows of its own record out of its read, by the field it ties itself by. Inside a record the plan did not read, such as one of a list's later pages, it reads its rows itself. A `Table`, `Thread`, `Chart` and `RecordCards`, the row a `select` chose, a `Thread`'s tool calls and each `<resource>.count` a condition names start in the same wave with the very request their block makes, labels, photos and totals included, so the block finds it loading or loaded once it draws and nothing is read twice. A `Table`, `Thread` or `RecordCards` inside the records of another draws its first rows from its planned read in the same way, its own record's out of all: that read asks for the names of the records its relations point at and its cards' photos, as the block's own read would, and beside it a count gives each record its total, so a table says "The first 10 of 37." for each record. Only what comes after, such as a thread's earlier messages or a table sorted by one of its headers, the block reads itself. A `Show` or `Match` decides only what is drawn: switching what it shows starts no new read. A change to a resource, live or the page's own, reads again exactly the reads of that resource, and a nested read also when the records around it change.
|
|
177
177
|
|
|
178
178
|
Each read in the plan (`page.reads.reads`) names its block by a JSON Pointer into the page's tree, such as `/children/0/children/2`, which `elementAt(tree, pointer)` finds. It gives the read's `resource`, its `kind` (`list`, `count` or `aggregate`), `filter`, `orderBy`, `pageSize`, `limitPer`, `groupBy`, `fields` (absent for every field), `etag`, and for a read inside the records of another its `split`: the `field` its rows hold the value `source`, a path, reads where the block draws, and the `parent` read, by `planReadId(read)`. `compileReadPlan(tree, { models })` makes the same plan from a tree of your own. `runReadPlan(plan, read, { params })` starts every read at once through `read` and gives each outcome by `planReadId`, and `plannedRows(read, rows, scope)` the rows of one record around a block.
|
|
179
179
|
|
|
180
180
|
A [custom component](custom-components.md#reads) is planned when it declares its reads: the page starts them with the others, each of several a part of its own named by its resource prop (`/children/0#edges`), and the component draws from them. One that declares none is outside the plan (`page.reads.outside`): whatever it reads, it reads by itself once it draws, and `protobase doctor` lists it.
|
|
181
181
|
|
|
182
|
-
<gap>A `RecordRow` of a view with `listOf` or `searchesOf` cannot start its read when the page opens because starting the user's saved records or searches ahead of it is not implemented, so it reads once it draws, under a `Show` or `Match` once its condition holds.</gap> <gap>A `
|
|
182
|
+
<gap>A `RecordRow` of a view with `listOf` or `searchesOf` cannot start its read when the page opens because starting the user's saved records or searches ahead of it is not implemented, so it reads once it draws, under a `Show` or `Match` once its condition holds.</gap> <gap>A `RecordRow` inside the records of another block cannot start its read when the page opens because a planned first page per record is not implemented, so it reads once it draws.</gap> <gap>A `Chart` cannot sit inside a repeated record because grouping a chart per record is not implemented.</gap>
|
|
183
183
|
|
|
184
184
|
## Field values
|
|
185
185
|
|