@protobase/cli 0.81.3 → 0.81.4
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/dist/migration/parts.js +1 -1
- package/package.json +8 -8
- package/skills/protobase/references/features/data-model.md +1 -0
- package/skills/protobase/references/features/list-displays.md +1 -1
- package/skills/protobase/references/features/rest-api.md +1 -1
- package/skills/protobase/references/reference/api.md +3 -1
- package/skills/protobase/references/reference/cli.md +1 -1
- package/skills/protobase/references/reference/data-config.md +71 -0
- package/skills/protobase/references/reference/ui-config.md +2 -2
package/dist/cli/package.js
CHANGED
package/dist/migration/parts.js
CHANGED
|
@@ -23,7 +23,7 @@ const migrationParts = (project) => {
|
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
25
|
name: "computed",
|
|
26
|
-
title: "The columns of the resources' rollup and formula fields,
|
|
26
|
+
title: "The columns of the resources' rollup and formula fields, the triggers that keep the rollups, and the tables and refresh functions of their time rollups",
|
|
27
27
|
sql: () => computedMigration(project.db, project.models)
|
|
28
28
|
},
|
|
29
29
|
...project.readOnlyQueries ? [{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/cli",
|
|
3
|
-
"version": "0.81.
|
|
3
|
+
"version": "0.81.4",
|
|
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.81.
|
|
47
|
-
"@protobase/layout": "0.81.
|
|
48
|
-
"@protobase/query": "0.81.
|
|
49
|
-
"@protobase/schema": "0.81.
|
|
50
|
-
"@protobase/server": "0.81.
|
|
51
|
-
"@protobase/ui": "0.81.
|
|
52
|
-
"@protobase/workflows": "0.81.
|
|
46
|
+
"@protobase/config": "0.81.4",
|
|
47
|
+
"@protobase/layout": "0.81.4",
|
|
48
|
+
"@protobase/query": "0.81.4",
|
|
49
|
+
"@protobase/schema": "0.81.4",
|
|
50
|
+
"@protobase/server": "0.81.4",
|
|
51
|
+
"@protobase/ui": "0.81.4",
|
|
52
|
+
"@protobase/workflows": "0.81.4",
|
|
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",
|
|
@@ -17,6 +17,7 @@ Describe the tables of an existing Postgres database as resources, with their fi
|
|
|
17
17
|
- [Opening an existing record](../reference/data-config.md#opening-an-existing-record): A create that repeats a record's unique values, such as a direct message with the same people, opens that record instead of failing, for whoever may read it; anyone else gets the usual conflict, which does not say the record exists.
|
|
18
18
|
- [Record validation](../reference/data-config.md#resource): A rule over the whole record runs on every create and update and reports each problem on the field it concerns.
|
|
19
19
|
- [Rollups and formulas](../reference/data-config.md#rollups-and-formulas) (beta): Fields that hold counts, sums, averages, minimums or maximums of related records, or values calculated from the record's own numbers, kept current by the database.
|
|
20
|
+
- [Time rollups](../reference/data-config.md#time-rollups) (in development): A large events table gets an hourly or daily rollup table that the app's migrations create, so charts over months of millions of rows can read a few thousand rows instead.
|
|
20
21
|
- [Sensitive fields](../reference/data-config.md#sensitive-fields): Values such as bank account numbers are left out of every response and shown masked. A permitted user reveals one value at a time, and each reveal is audited.
|
|
21
22
|
- [Recent strong sign-in](../reference/data-config.md#recent-strong-sign-in): A sensitive field can ask for a passkey or a second step in the last minutes before it is revealed, or an emailed code for an account with neither. The record page asks the person to confirm it's them, then shows it.
|
|
22
23
|
- [Computed reveals](../reference/data-config.md#computed-reveals) (beta): A secret kept elsewhere, or built from several values, is revealed like a sensitive field, with the same access, audit and recent sign-in check, but made when it is asked for.
|
|
@@ -12,7 +12,7 @@ Show a list as cards, a map, a board, a calendar or a timeline, and reorder reco
|
|
|
12
12
|
- [Timelines](../reference/ui-config.md#timelines): Each record is a bar from start to end over a week, month or quarter, optionally in lanes. Dragging a bar moves its dates.
|
|
13
13
|
- [Maps](../reference/ui-config.md#maps): Records on a map with clustered counts, and a pin on the record page. Rough locations show as an area, and extra layers such as aerial photos can be switched on.
|
|
14
14
|
- [Phone layout](../reference/ui-config.md#list-displays): On phones a list opens as cards or as one row per record, with filters and sort in a sheet.
|
|
15
|
-
- [Reordering by hand](../reference/ui-config.md#reordering-by-hand): Records with their own order are reordered by dragging, by touch or by keyboard. Each drop saves at once, and Undo puts it back.
|
|
15
|
+
- [Reordering by hand](../reference/ui-config.md#reordering-by-hand): Records with their own order are reordered by dragging, by touch or by keyboard. Each drop saves at once, even when someone else changed the list elsewhere, and Undo puts it back; when the list changed where it was dropped, it reloads by itself.
|
|
16
16
|
- [Drop rules](../reference/ui-config.md#drop-rules): Rules for where a dragged record may land, such as never above a task it waits for.
|
|
17
17
|
- [Ranked after dependencies](../reference/ui-config.md#ranked-after-what-they-depend-on): Ranked records stay below the records they depend on while those are pending.
|
|
18
18
|
- [Board drops](../reference/ui-config.md#board-drops): Dropping a card on a board column can run your own write, such as creating an approval.
|
|
@@ -14,7 +14,7 @@ The API every resource gets, with filters, writes, errors and the typed client.
|
|
|
14
14
|
- [Related names and photos](../reference/api.md#related-names): A list response can carry the names of related records and each record's first photos.
|
|
15
15
|
- [ETags](../reference/api.md#writes): Every record has a version, and a write based on an old version is refused.
|
|
16
16
|
- [Minimal responses](../reference/api.md#writes): A create or update can answer without the record, to save the transfer.
|
|
17
|
-
- [Batch writes](../reference/api.md#batch-writes): Up to 500 creates, updates, deletes and
|
|
17
|
+
- [Batch writes](../reference/api.md#batch-writes): Up to 500 creates, updates, deletes, reorders and moves across resources in one transaction.
|
|
18
18
|
- [Record permissions](../reference/api.md#record-permissions): Responses say which records and fields the caller may change.
|
|
19
19
|
- [Scan guard](../reference/api.md#safety): Lists, searches and facets on a column no index serves are refused, at any table size, with the index to create.
|
|
20
20
|
- [Statement timeouts](../reference/api.md#safety): Every request's queries stop after 1 second by default, with an error that names the request, and reads run read-only.
|
|
@@ -209,11 +209,13 @@ The rules behind these steps are described under [Access](#access).
|
|
|
209
209
|
| `update` | `resource`, `key`, `etag` (required, `*` allowed), `data` |
|
|
210
210
|
| `delete` | `resource`, `key`, `etag?` |
|
|
211
211
|
| `reorder` | `resource`, `field`, `keys` (in final order), `start` (optional, 1 by default), `etags` (per key text) |
|
|
212
|
+
| `move` | `resource`, `field`, `key`, `after` (a key or `null`), `before?` (a key or `null`), `filter?` |
|
|
212
213
|
|
|
213
214
|
- **Keys** are the URL text (`a,b` when composite), a number, a list of parts, or a reference.
|
|
214
215
|
- **`$ref`**: `ref: 'invoice'` on a create names the record; later operations use `{ "$ref": "invoice" }` as a key, a key part, or a value in `data` (it stands for that record's key, or with `{ "$ref": "invoice", "field": "number" }` a readable field's value). A ref must come after its create.
|
|
215
216
|
- **`reorder`** sets `field` to `start`, `start` + 1, ... in the order of `keys`, so a long list sends only the stretch that moved, and writes only the records whose value changes, each as an ordinary update (so each needs its `etags` entry, and hooks see each). To work with a non-deferrable unique index such as `(invoice_id, position)`, the changing records are first moved out of the range in use, in the same transaction and without touching their ETags: above the highest value of the column, or, when a check constraint refuses that (checked with a savepoint), below the lowest one. Then they get their final values, which collide with nothing. The field must be an integer the caller may write; the keys must all exist and be visible to the caller. When it is the resource's [position with `after`](ui-config.md#ranked-after-what-they-depend-on), a reorder that puts a record at or above a record it depends on, or one of those at or below it, fails with `409` and the type `ranks-above-dependency`, naming both keys in `record` and `dependsOn`; pairs out of order before it do not count.
|
|
216
|
-
-
|
|
217
|
+
- **`move`** puts the record `key` just after `after`, or first when it is `null`, in the list `filter` reads (as a list's `filter` does) ordered by `field`. It is anchored to that place rather than to ETags: it saves while the record after `after` there, leaving out the moved one, is still `before` (`null`: none), whatever else changed in the list or in the records, and fails with `412` otherwise, so the caller reads the list again. Leave `before` out when the caller did not load the record after `after`; then only `after` is checked. The server reads the list in its current order and renumbers the shortest stretch that saves the move, written as a `reorder` writes it, so the same field rules, unique index handling and `ranks-above-dependency` check apply. Moves of the same resource's `field` run one at a time. A filter needs indexes as a list's does.
|
|
218
|
+
- **Result**: `{ results: [...] }`, one entry per operation in order: `create` and `update` give `record` and `etag`, `delete` gives `deleted: true`, `reorder` gives `records` (every key in order, with its etag), and `move` the records it numbered, in order, with their etags.
|
|
217
219
|
- **Failure**: nothing is written. The problem is the failing operation's own (`400`, `403`, `404`, `409`, `412`, `428`, ...) with `operation` (its index), `op` and `resource` added. A stale ETag anywhere is a `412` for the whole batch.
|
|
218
220
|
|
|
219
221
|
## Authentication
|
|
@@ -605,7 +605,7 @@ Applies the project's `db/migrations/*.sql` that the database has not applied ye
|
|
|
605
605
|
protobase migration [--dir db/migrations] [--extend <dir>]
|
|
606
606
|
```
|
|
607
607
|
|
|
608
|
-
Writes what the database still needs for every feature the config enables, as the project's next migrations in `--dir`, one file per feature: the auth schema when sign-in is on (`NNN_auth.sql`, as [`auth migration`](#auth-migration) writes it), the [jobs schema](jobs.md#the-jobs-schema) when the config has jobs, `webhooks`, `workflows` or `notifications`, or a resource has events, history, comments or an [AI field](ai.md) (`NNN_jobs.sql`), the [capture of events](events.md#migrations-and-startup) and the [history table](history.md#the-table) (`NNN_changes.sql`), the columns of [rollup and formula fields](data-config.md#rollups-and-formulas)
|
|
608
|
+
Writes what the database still needs for every feature the config enables, as the project's next migrations in `--dir`, one file per feature: the auth schema when sign-in is on (`NNN_auth.sql`, as [`auth migration`](#auth-migration) writes it), the [jobs schema](jobs.md#the-jobs-schema) when the config has jobs, `webhooks`, `workflows` or `notifications`, or a resource has events, history, comments or an [AI field](ai.md) (`NNN_jobs.sql`), the [capture of events](events.md#migrations-and-startup) and the [history table](history.md#the-table) (`NNN_changes.sql`), the columns of [rollup and formula fields](data-config.md#rollups-and-formulas), the triggers that keep the rollups, and the tables, indexes and refresh functions of [time rollups](data-config.md#time-rollups) (`NNN_computed.sql`), the role the [assistant's read-only queries](assistant.md#the-built-in-backend) run as, when it finds the built-in assistant's key (`NNN_query.sql`), the [comments table](comments.md#the-table) (`NNN_comments.sql`), the [webhook subscriptions](webhooks.md#subscriptions-in-the-admin-app) of `webhooks` (`NNN_webhooks.sql`), the [workflows, versions, runs and steps](workflows.md#turning-them-on) of `workflows` (`NNN_workflows.sql`), the [devices and history tables](notifications.md#table-names) of `notifications` (`NNN_notifications.sql`), the `realtime_relay` schema of [`realtime: { processes: 'many' }`](supabase-realtime.md#several-processes) (`NNN_realtime_relay.sql`), the `channels` schema of [`realtime: { sqlSends: true }`](channels.md#from-sql) (`NNN_channel_sends.sql`), and, with [`userTables`](user-tables.md#the-switch), the schemas of user tables (`NNN_user_tables.sql`) and the delete of the definitions of tables that resources in code [own now](user-tables.md#taking-a-table-over-as-code) (`NNN_owned_definitions.sql`). It compares the database, with the project's migrations applied, with the config (for the auth schema, it reads the store's record of the migrations it applied), merged with those of `--extend` as `dev` merges them, and writes nothing when the database is current. Apply the files with the project's other migrations. It reads the `.env` nearest the current directory and needs `DATABASE_URL`.
|
|
609
609
|
|
|
610
610
|
```sh
|
|
611
611
|
bun run db:migrate # the database at the project's current schema
|
|
@@ -209,6 +209,77 @@ Empty values of `field` are left out, as in SQL. The migration adds the column,
|
|
|
209
209
|
|
|
210
210
|
Neither field can be written through the API, have a default, or be sensitive, an AI field, a file, or the key, tenant, owner or soft delete field, and a formula cannot read a sensitive field. The server does not start while a declared column, function or trigger is missing or out of date, with a message that names the fields; the migration fixes that. It stops with an error, without writing anything, when the column already exists as the project's own: a plain column where a formula is declared, a generated column it did not write, or a rollup column of another type.
|
|
211
211
|
|
|
212
|
+
## Time rollups
|
|
213
|
+
|
|
214
|
+
:::caution[In development]
|
|
215
|
+
Coming soon:
|
|
216
|
+
|
|
217
|
+
- <gap>A time rollup cannot keep itself up to date because the recurring job that refreshes its latest buckets is not implemented.</gap> Until then the migration fills it once, and calling its refresh function brings it up to date.
|
|
218
|
+
- <gap>Charts and `:aggregate` and `:series` cannot read a time rollup's counts, sums and averages correctly because mapping them onto its stored columns is not implemented.</gap>
|
|
219
|
+
:::
|
|
220
|
+
|
|
221
|
+
A large events table, such as millions of meter readings, gets a **time rollup**: a table with one row per hour or day and per group, holding how many records fell in it and the sums and greatest values of their numbers. A chart over months then reads a few thousand rows instead of millions. You declare the rollup as a resource over the events resource, and [`protobase migration`](cli.md#migration) writes its table, indexes and refresh function into the project's next migration (`NNN_computed.sql`), with the rollup filled once. It is plain Postgres: no extension.
|
|
222
|
+
|
|
223
|
+
```ts title="docs-examples/reference/time-rollups.ts"
|
|
224
|
+
import { f, resource } from '@protobase/schema'
|
|
225
|
+
|
|
226
|
+
// Meter readings, millions of rows, and their hourly rollup per organization and meter.
|
|
227
|
+
|
|
228
|
+
/** metering.readings: one row per reading. */
|
|
229
|
+
export const readings = resource('readings')
|
|
230
|
+
.table('metering.readings')
|
|
231
|
+
.fields({
|
|
232
|
+
id: f.bigint().readOnly().dbDefault(),
|
|
233
|
+
organization_id: f.integer().filterable(),
|
|
234
|
+
meter_id: f.relation('meters').filterable(),
|
|
235
|
+
taken_at: f.timestamp().filterable().sortable(),
|
|
236
|
+
watts: f.integer(),
|
|
237
|
+
cost: f.decimal({ precision: 10, scale: 4 }),
|
|
238
|
+
})
|
|
239
|
+
.primaryKey((r) => r.id)
|
|
240
|
+
.tenant((r) => r.organization_id)
|
|
241
|
+
|
|
242
|
+
/** metering.readings_hourly: one row per hour, organization and meter, which the migration creates. */
|
|
243
|
+
export const readingsHourly = resource('readings_hourly')
|
|
244
|
+
.table('metering.readings_hourly')
|
|
245
|
+
.bucketsOf(readings, {
|
|
246
|
+
time: (r) => r.taken_at,
|
|
247
|
+
every: 'hour',
|
|
248
|
+
by: (r) => [r.organization_id, r.meter_id],
|
|
249
|
+
measures: { watts: ['sum', 'max'], cost: ['sum'] },
|
|
250
|
+
late: '2 hours',
|
|
251
|
+
})
|
|
252
|
+
// Its access is its own: every member of an organization reads its totals.
|
|
253
|
+
.access({ read: () => true })
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
`.bucketsOf(source, { ... })` takes the source's resource and sets the rollup's fields, key and tenant from it:
|
|
257
|
+
|
|
258
|
+
| Option | What it is |
|
|
259
|
+
| --- | --- |
|
|
260
|
+
| `time` | The source's timestamp field. A record's bucket is its hour or day, in UTC. |
|
|
261
|
+
| `every` | `'hour'` or `'day'`. |
|
|
262
|
+
| `by` | The source's fields to group by besides the bucket. They must be required fields, and include the source's tenant field. |
|
|
263
|
+
| `measures` | Per integer, bigint or decimal field of the source, `['sum']`, `['max']` or both. Optional. |
|
|
264
|
+
| `late` | How late a record may arrive and still be counted by a refresh: a number of minutes, hours or days, such as `'2 hours'`. |
|
|
265
|
+
|
|
266
|
+
The rollup's records have these fields, all read-only:
|
|
267
|
+
|
|
268
|
+
| Field | Value |
|
|
269
|
+
| --- | --- |
|
|
270
|
+
| `id` | The record's key, a bigint. |
|
|
271
|
+
| `bucket` | The start of the hour or day. Filterable and sortable. |
|
|
272
|
+
| the `by` fields | The group's values, under the source's field names. Filterable and sortable. |
|
|
273
|
+
| `events` | How many records of the source fell in the bucket, as a bigint. |
|
|
274
|
+
| `<field>_sum` | The sum of the field: a bigint for an integer, a decimal of ten more digits for a bigint or a decimal. Empty when every value was. |
|
|
275
|
+
| `<field>_max` | The greatest value of the field, of its type. Empty when every value was. |
|
|
276
|
+
|
|
277
|
+
Records the source soft deleted are left out. The migration creates the table in the rollup's schema, with a unique index on `(bucket, by...)` and an index on `(group, bucket)` per group, so a list filtered on the bucket, on a group or on both passes the [scan guard](api.md#safety). It writes `rollups.<table>_refresh(from timestamptz)`, which recomputes every bucket from the one `from` falls in, in one statement: it upserts their counts and sums and deletes those left without records. `select rollups.readings_hourly_refresh(now() - interval '2 hours')` brings the example up to date. When the rollup's declaration changes, the migration drops its table and creates and fills it again. The table and function of a rollup the config no longer has stay; a migration of your own drops them, in a deploy after the one that stops reading them.
|
|
278
|
+
|
|
279
|
+
Only the database writes a rollup's rows: creates, updates and deletes are refused whatever its rules say, and it cannot have soft delete, a manual order, an author, a parent or `.openExisting()`. Its access is its own `.access()`: the source's rules do not reach it, so give it rules that let read only those who may see every record of a group. Its tenant is the source's, which is why `by` includes it. The server does not start while a role reads only some of the source's records that a bucket mixes with others: `.own` or `.team` while `by` does not include the source's owner field, or a role's filter on fields outside `by`. <gap>A time rollup cannot group by an optional field because a bucket key with empty parts is not implemented.</gap> <gap>A time rollup cannot roll up a resource whose reads follow a parent because applying the parent's access to buckets is not implemented.</gap> <gap>Startup cannot refuse a time rollup over a source whose own `.access()` rule filters rows because reading the fields such a rule filters on is not implemented.</gap>
|
|
280
|
+
|
|
281
|
+
The server does not start while a rollup's table or function is missing or out of date, with a message that names the rollup; the migration fixes that. It stops with an error, without writing anything, when the table already exists as the project's own.
|
|
282
|
+
|
|
212
283
|
## Sensitive fields
|
|
213
284
|
|
|
214
285
|
A sensitive field, such as a bank account number, is written like any other field but never read with the record: lists, gets, `:search`, `:seek`, create and update responses and batch results leave it out, and it cannot be filtered, sorted, searched, counted or picked with `fields`. The record page shows it masked, with an eye button. Showing it asks the server for that one value with `POST /{resource}/{key}:reveal` (see [REST API](api.md#sensitive-fields-and-audit)), which needs the same access as reading the record and the field, inside the caller's tenant, and publishes an audit event before it answers.
|
|
@@ -249,7 +249,7 @@ export const invoiceItemsView = view<typeof invoiceItems>('invoice_items')
|
|
|
249
249
|
|
|
250
250
|
The list of a resource ordered as one, such as the products, has a **Reorder** button beside its other buttons; a related section of records ordered within the page's record, such as the invoice's items, has one at the end of its title's line. **Reorder** shows every record in its order in the list's table, without the filters, search, chart and display switch, with a drag handle in each row where its checkbox was, and the page scrolls them; **Done** goes back. A row moves by dragging its handle, by a long press and drag on a touch screen, or from the keyboard: Space on a handle picks the row up, the up and down arrow keys move it, Space or Enter drops it and Escape puts it back, and a screen reader is told each step. The rest of the row still opens its record.
|
|
251
251
|
|
|
252
|
-
Each drop shows at once and is saved straight away
|
|
252
|
+
Each drop shows at once and is saved straight away as one [batch `move`](api.md#batch-writes), anchored to the record above where it was dropped: it saves while the record after that one is still the one that was below the drop, whatever else changed since the list loaded, such as another field of the records or records added elsewhere. The server numbers only the stretch whose place changed, from the record before it on; it reaches further only where a gap or a tie left by an earlier write needs it, so a list of thousands saves a short move as a few records. Drops made while one saves are saved after it, together. A saved drop says so in a toast with **Undo**, which puts back the positions it changed; see [Dragging in the list](#dragging-in-the-list). When someone else changed the list where the record was dropped, the move is not saved and a warning names the record and says the list now shows the current order; otherwise a refusal says why. Either way the rows go back to the order the server has, and every list of the resource reloads by itself, so the next move works from the current order.
|
|
253
253
|
|
|
254
254
|
A user who may not update the resource or write the field gets no **Reorder**, and `/api/meta` leaves out `position` for one who cannot read its field or its `within`. A related section offers it only when it lists all of the parent's records: its `field` is the `within` relation, without a `filter` or `through`. The list page does not offer it for a resource ordered within a parent, since its list mixes the parents. The field must be `.sortable()` and `within` a `.filterable()` relation, checked when the config loads, and [`protobase doctor`](cli.md#doctor) checks that an index serves each read in the field's order, such as `(invoice_id, position)`. Records created later are not numbered for you: give them a position, or the next drop numbers them, after the others when the field is empty; the [record lines](#record-lines) table numbers the lines it adds.
|
|
255
255
|
|
|
@@ -481,7 +481,7 @@ export const tasksView = view<typeof tasks>('tasks')
|
|
|
481
481
|
}))
|
|
482
482
|
```
|
|
483
483
|
|
|
484
|
-
With the list's `drag: { rank: true }`, a card then moves within its column by dragging it, or from the keyboard: Space, the up and down arrow keys, and Space again. In another column it lands where it is dropped, before the card under it or after the last one; the left and right arrow keys put it at the top. A screen reader is told the column and the place. A drop is one [batch write](api.md#batch-writes): in another column first the update of `by
|
|
484
|
+
With the list's `drag: { rank: true }`, a card then moves within its column by dragging it, or from the keyboard: Space, the up and down arrow keys, and Space again. In another column it lands where it is dropped, before the card under it or after the last one; the left and right arrow keys put it at the top. A screen reader is told the column and the place. A drop is one [batch write](api.md#batch-writes): in another column first the update of `by`, then a `move` of the card among the column's cards, anchored to the card above it as on a [list sorted by hand](#reordering-by-hand), so it saves whatever else changed meanwhile. Access and `validate` refuse it as they do a column move; a refusal puts the cards back with the reason, or warns that the card was not moved because the board changed where it was dropped, and the columns reload by themselves. The numbers are per column after a drop, so a unique index on the position alone would clash, while one that includes `by` is fine. Changing the order takes the right to update the position field, as **Reorder** does; a user without it, or a board without `rank`, moves cards between columns only, as on a board without a position, and one without `board` keeps each card in its column. A resource without a position, or with `within`, keeps the list's order.
|
|
485
485
|
|
|
486
486
|
`by` must be a filterable enum field, checked when the config loads and when the server starts, since each column filters by it. [`protobase doctor`](cli.md#doctor) checks that an index serves each column's filter in the list's order, or the position's, as it does the list's. In `/api/meta`, a user who cannot read `by` gets the list without the board, opening in the table when it was the default, and a card loses the fields they cannot read.
|
|
487
487
|
|