@protobase/cli 0.63.2 → 0.63.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.
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "0.63.2";
2
+ var version = "0.63.4";
3
3
  //#endregion
4
4
  export { version };
@@ -6,6 +6,7 @@ import { checkResource } from "./check.js";
6
6
  import { indexIssues } from "./index-issues.js";
7
7
  import { readShapes } from "./read-shapes.js";
8
8
  import { relationIssues } from "./relation-issues.js";
9
+ import { sortIssues } from "./sort-issues.js";
9
10
  import { existsSync } from "node:fs";
10
11
  import path from "node:path";
11
12
  import { tableIndexes } from "@protobase/query";
@@ -24,6 +25,7 @@ const runDoctor = async (options, out) => {
24
25
  const issues = models.flatMap((model, i) => [
25
26
  ...checkResource(model, tables),
26
27
  ...relationIssues(model, models),
28
+ ...sortIssues(model, shapes),
27
29
  ...indexes[i]
28
30
  ]);
29
31
  for (const issue of issues) out(format(issue));
@@ -0,0 +1,26 @@
1
+ //#region src/doctor/sort-issues.ts
2
+ /**
3
+ * The reads of `model` that sort by a field it does not mark `.sortable()`, which the API refuses: one error per field,
4
+ * naming each read that sorts by it and where it comes from, the order a list opens in included.
5
+ */
6
+ const sortIssues = (model, shapes) => {
7
+ const refused = /* @__PURE__ */ new Map();
8
+ for (const shape of shapes) {
9
+ if (shape.resource !== model.name) continue;
10
+ for (const [name] of shape.query.sort ?? []) {
11
+ if ((Object.hasOwn(model.fields, name) ? model.fields[name] : void 0)?.sortable !== false) continue;
12
+ const requests = refused.get(name) ?? /* @__PURE__ */ new Map();
13
+ const from = requests.get(shape.request) ?? [];
14
+ if (!from.includes(shape.from)) requests.set(shape.request, [...from, shape.from]);
15
+ refused.set(name, requests);
16
+ }
17
+ }
18
+ return [...refused].map(([name, requests]) => ({
19
+ severity: "error",
20
+ resource: model.name,
21
+ message: `${name}: not sortable, so the API refuses:${[...requests].map(([request, from]) => `\n ${request} (${from.join("; ")})`).join("")}`,
22
+ suggestion: `mark "${name}" .sortable() in data.ts, or sort the list by a sortable field`
23
+ }));
24
+ };
25
+ //#endregion
26
+ export { sortIssues };
@@ -10,9 +10,12 @@ const request = (resource, filter, sort) => {
10
10
  const params = [...filter ? [`filter=${filter}`] : [], ...sort ? [`order_by=${sortText(sort)}`] : []];
11
11
  return `GET /${resource}${params.length > 0 ? `?${params.join("&")}` : ""}`;
12
12
  };
13
- /** The order a list opens in, as the app asks for it: the view's sort, or the primary key's. */
13
+ /** The order a list opens in, as the app asks for it: the view's sort, or the primary key's when it is sortable, else none. */
14
14
  const listSort = (model, view) => {
15
- return [view?.list?.sort?.[0] ?? [model.primaryKey[0], "asc"]];
15
+ const first = view?.list?.sort?.[0];
16
+ if (first) return [first];
17
+ const key = model.primaryKey[0];
18
+ return model.fields[key]?.sortable ? [[key, "asc"]] : void 0;
16
19
  };
17
20
  const widgetShapes = (model, widget, from) => {
18
21
  const shape = (request, query) => ({
@@ -149,7 +152,7 @@ const displayShapes = (model, view, models) => (view.list?.displays ?? []).flatM
149
152
  from: `the board display "${display.name}"`,
150
153
  query: {
151
154
  filter: compare(by),
152
- sort
155
+ ...sort && { sort }
153
156
  }
154
157
  }];
155
158
  }
@@ -223,7 +226,7 @@ const recentShapes = (model, view) => {
223
226
  from: "the recent records in the sidebar",
224
227
  query: {
225
228
  ...filter && { filter },
226
- sort
229
+ ...sort && { sort }
227
230
  }
228
231
  }];
229
232
  };
@@ -233,7 +236,7 @@ const openingShape = (model, view, list, sort) => {
233
236
  resource: model.name,
234
237
  request: request(model.name, void 0, sort),
235
238
  from: `${list}'s order`,
236
- query: { sort }
239
+ query: { ...sort && { sort } }
237
240
  };
238
241
  const filter = configFilter(model, source);
239
242
  return {
@@ -242,7 +245,7 @@ const openingShape = (model, view, list, sort) => {
242
245
  from: `${list} as it opens`,
243
246
  query: {
244
247
  ...filter && { filter },
245
- sort
248
+ ...sort && { sort }
246
249
  }
247
250
  };
248
251
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protobase/cli",
3
- "version": "0.63.2",
3
+ "version": "0.63.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": {
@@ -42,12 +42,12 @@
42
42
  "dependencies": {
43
43
  "@better-auth/core": "^1.7.12",
44
44
  "@hono/node-server": "^2.1.3",
45
- "@protobase/config": "0.63.2",
46
- "@protobase/layout": "0.63.2",
47
- "@protobase/query": "0.63.2",
48
- "@protobase/schema": "0.63.2",
49
- "@protobase/server": "0.63.2",
50
- "@protobase/ui": "0.63.2",
45
+ "@protobase/config": "0.63.4",
46
+ "@protobase/layout": "0.63.4",
47
+ "@protobase/query": "0.63.4",
48
+ "@protobase/schema": "0.63.4",
49
+ "@protobase/server": "0.63.4",
50
+ "@protobase/ui": "0.63.4",
51
51
  "@react-email/render": "^2.1.0",
52
52
  "@scalar/hono-api-reference": "^0.12.10",
53
53
  "@tailwindcss/vite": "^4.3.3",
@@ -20,7 +20,7 @@ The page of one record, with its sections, related records, galleries, charts an
20
20
  - [Conditional sections](../reference/ui-config.md#form-and-read-view): Sections and fields show only while editing, only while reading, or only when a condition on the record holds.
21
21
  - [Galleries](../reference/ui-config.md#galleries): A record's photos show as tiles that open a full-screen lightbox, with keyboard and swipe navigation.
22
22
  - [Related records](../reference/ui-config.md#related-records): Every record page shows how many records point at it, and can list related records, also through a join resource, as a table, another display or cards with buttons.
23
- - Record lines: Lines that belong to a record, with a position and a quantity, such as those of an invoice, show as a table with totals on its page. You drag them into a new order, and Save writes the record and the order together.
23
+ - [Record lines](../reference/ui-config.md#record-lines): All the lines of a record, such as those of an invoice, show as a table on its page, where you edit, add, remove and reorder them, and Save writes the record and its lines together.
24
24
  - [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.
25
25
  - [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.
26
26
  - [Safe deletes](../reference/ui-config.md#deleting-a-record): Deleting asks first, or offers Undo for a soft delete, offers a review when the record changed since it was opened, and names the records that still point at it.
@@ -336,7 +336,7 @@ export default defineUi({
336
336
  })
337
337
  ```
338
338
 
339
- `invoke(name, { method?, body?, path?, query?, headers? })` sends a `GET`, or a `POST` with a JSON `body`. It resolves to the parsed JSON, to text, or to `undefined` for a `204`. A problem rejects with an `ApiError`, as any call of the client does. Outside the admin, `createClient` from `@protobase/client` gives the same `invoke`, or you can call the URL with `fetch` and an `Authorization: Bearer` header.
339
+ `invoke(name, { method?, body?, path?, query?, headers? })` sends a `GET`, or a `POST` with a JSON `body`. It resolves to the parsed JSON, to text for a `text/*` answer or one without a content type, to a `Blob` of any other type, or to `undefined` for a `204`. A function sends a file, such as a PDF, as a plain `Response` with its type and name: `new Response(bytes, { headers: { 'content-type': 'application/pdf', 'content-disposition': 'attachment; filename="invoice.pdf"' } })`, and `invoke` gives the caller that `Blob`, with its `type`. A problem rejects with an `ApiError`, as any call of the client does. Outside the admin, `createClient` from `@protobase/client` gives the same `invoke`, or you can call the URL with `fetch` and an `Authorization: Bearer` header.
340
340
 
341
341
  ## Hono apps
342
342
 
@@ -159,7 +159,7 @@ await deleteUser(auth, email) // with sessions an
159
159
 
160
160
  The last active admin cannot be deleted, demoted or banned: those functions throw instead, and Better Auth's admin endpoints answer `400 LAST_ADMIN`, so every caller is protected. An account created by `createUser` or an admin counts as having a verified address, since whoever created it vouches for it; that lets it sign in with an [emailed code](#emailed-sign-in-codes).
161
161
 
162
- Until a user exists sign-in fails, and `GET /api/auth/status` (public) answers `{ "needsAdmin": true, "signInMethods": ["password", "passkey"], "passwordReset": false, "socialProviders": [] }` so a login page can say what to do. `signInMethods` lists the ways to sign in the [sign-in policy](#sign-in-policy) leaves on (`password`, `emailCode`, `passkey`), `passwordReset` is whether [reset mail](#password-reset) can be sent and passwords are on, `signInFirst`, when there, says the page leads with an [emailed code](#emailed-sign-in-codes), `signUp`, when there, says anyone can [make an account](#open-sign-up), and `staffSignIn`, when there, names the provider of [staff sign-in](#staff-sign-in). Further users are created by an admin on the [Users page](#users-page), or with `createUser` on the host. The auth store holds a connection pool; scripts that call these functions end the process themselves.
162
+ Until a user exists sign-in fails, and `GET /api/auth/status` (public) answers `{ "needsAdmin": true, "signInMethods": ["password", "passkey"], "passwordReset": false, "socialProviders": [] }` so a login page can say what to do. The admin app's page then shows the `users create` command to run on the host. A hosting platform where nobody runs commands on the host sets `PROTOBASE_FIRST_ADMIN_URL` to its own page where the first user is added, such as its console's; the status then also answers `firstAdminUrl`, and the page links there in place of the command. `signInMethods` lists the ways to sign in the [sign-in policy](#sign-in-policy) leaves on (`password`, `emailCode`, `passkey`), `passwordReset` is whether [reset mail](#password-reset) can be sent and passwords are on, `signInFirst`, when there, says the page leads with an [emailed code](#emailed-sign-in-codes), `signUp`, when there, says anyone can [make an account](#open-sign-up), and `staffSignIn`, when there, names the provider of [staff sign-in](#staff-sign-in). Further users are created by an admin on the [Users page](#users-page), or with `createUser` on the host. The auth store holds a connection pool; scripts that call these functions end the process themselves.
163
163
 
164
164
  ## Users page
165
165
 
@@ -119,6 +119,13 @@ Imports `config/index.ts` and the views of `config/*/ui.ts`, as the config modul
119
119
  ```
120
120
 
121
121
  Reads are judged as the scan guard's default `reject` mode judges them, for a role that reads every row, such as admin; other access rules are code doctor does not run. A resource on a plain view or a foreign table is not judged, as the scan guard does not judge it.
122
+ - error: a read of those that sorts by a field that is not `.sortable()`, which the API refuses with a `400` whatever the indexes: a list's order, from its view's `sort` or the order the app picks itself, such as a calendar's or timeline's start, a recent-records `orderBy`, a related section's, gallery's or page block's `sort`. One error per field, with every request that sorts by it:
123
+
124
+ ```
125
+ error seller: name: not sortable, so the API refuses:
126
+ GET /seller?order_by=name asc (the seller list's order)
127
+ fix: mark "name" .sortable() in data.ts, or sort the list by a sortable field
128
+ ```
122
129
  - warning: enum values differ
123
130
 
124
131
  Exit code is 1 when there are errors. Run it after the project's migrations and before a new version serves, as a platform's deploy does: a read it fails is one the API would refuse once the version runs. `protobase build` needs no database, so the indexes are doctor's to check.
@@ -396,6 +403,7 @@ Serves the API of a bundle from `protobase build` and owns the process around it
396
403
  | `PROTOBASE_VAPID_PUBLIC_KEY`, `PROTOBASE_VAPID_PRIVATE_KEY`, `PROTOBASE_VAPID_SUBJECT` | the key pair and contact of [Web Push](notifications.md#web-push), from [`notifications vapid-keys`](#notifications-vapid-keys) |
397
404
  | `PROTOBASE_ASSISTANT_URL`, `PROTOBASE_ASSISTANT_API_KEY`, `PROTOBASE_ASSISTANT_MODEL`, `PROTOBASE_ASSISTANT_BASE_URL` | the [assistant](assistant.md#which-backend): a backend elsewhere, or the built-in one on OpenRouter or another OpenAI-compatible endpoint; without them there is none |
398
405
  | `PROTOBASE_ASSISTANT_CHATS` | the folder the built-in assistant keeps its conversations in; default `.protobase/chats` |
406
+ | `PROTOBASE_FIRST_ADMIN_URL` | the hosting platform's page where the app's first user is added, such as its console's; while the app has no users, the sign-in page links there in place of the `protobase users create` command ([the first admin](auth.md#first-run)) |
399
407
  | `PROTOBASE_RUNTIME_URL` | the endpoint behind the top bar's [runtime update button](versioning.md#runtime-updates), such as a hosting platform's; without it there is no button |
400
408
  | `PROTOBASE_SENTRY_DSN` | the DSN of a Sentry-compatible error tracker the app's server and admin app send their errors to, after the config's `errorReporting` ([Error reporting](api.md#error-reporting)); without it nothing is sent |
401
409
  | `PROTOBASE_MAP_STYLE_URL` | the URL of the MapLibre style the record page's [maps](ui-config.md#maps) are drawn with, after the config's `maps`; without it there are no maps |
@@ -17,7 +17,7 @@ const { record, etag } = await api.get(orders, id)
17
17
  await api.update(orders, id, { status: 'shipped' }, etag) // 412 rejects with PreconditionFailedError
18
18
  ```
19
19
 
20
- Pass a resource builder to get its record type ([`InferRecord`](https://docs.protobase.net/api/schema/type-aliases/inferrecord/)), or a name for loose records. Filters are AIP-160 text or [`where`](https://docs.protobase.net/api/schema/variables/where/) results (printed with [`printFilter`](https://docs.protobase.net/api/schema/functions/printfilter/)). Errors are `ApiError` (`status`, `slug`, `errors`, `filterErrors` with spans, `blockedBy` for a delete other records point at), which `isApiError(error)` tells apart. Also: `search`, `create`, `remove`, `facets`, `series`, `histogram`, `map(resource, { latitude, longitude, zoom, filter?, orderBy?, fields? })` (the records in a map's view, or buckets of them, see [`:map`](api.md#maps)), `seek`, `reveal(resource, key, field)` (a [sensitive field](data-config.md#sensitive-fields)'s value), `generate(resource, key, action)` (runs an [AI action](ai.md#ai-actions) and resolves to the record as written), `meta(etag?, { signal? })`, `invoke(name, { body?, method?, path?, query? })` (one of the app's [API functions](../guides/api-functions.md#calling-a-function)), `upload(resource, field, file, { onProgress?, signal? })` (a file for a [file field](files.md#uploading); its `value` goes in the next write, and `onProgress` uses XMLHttpRequest, since fetch reports no upload progress), `live({ onChanges, onResync, onRetry? })` (hears which records of the [live](live.md) resources change until the function it returns is called, connecting again by itself; every caller of one client shares one stream), `channel(resource, key)` (a record's [channel](channels.md#from-a-page), with its presence and broadcasts, every channel of the client on one socket).
20
+ Pass a resource builder to get its record type ([`InferRecord`](https://docs.protobase.net/api/schema/type-aliases/inferrecord/)), or a name for loose records. Filters are AIP-160 text or [`where`](https://docs.protobase.net/api/schema/variables/where/) results (printed with [`printFilter`](https://docs.protobase.net/api/schema/functions/printfilter/)). Errors are `ApiError` (`status`, `slug`, `errors`, `filterErrors` with spans, `blockedBy` for a delete other records point at), which `isApiError(error)` tells apart. Also: `search`, `create`, `remove`, `facets`, `series`, `histogram`, `map(resource, { latitude, longitude, zoom, filter?, orderBy?, fields? })` (the records in a map's view, or buckets of them, see [`:map`](api.md#maps)), `seek`, `reveal(resource, key, field)` (a [sensitive field](data-config.md#sensitive-fields)'s value), `generate(resource, key, action)` (runs an [AI action](ai.md#ai-actions) and resolves to the record as written), `meta(etag?, { signal? })`, `invoke(name, { body?, method?, path?, query? })` (one of the app's [API functions](../guides/api-functions.md#calling-a-function); its answer as parsed JSON, text, or a `Blob` for any other type), `upload(resource, field, file, { onProgress?, signal? })` (a file for a [file field](files.md#uploading); its `value` goes in the next write, and `onProgress` uses XMLHttpRequest, since fetch reports no upload progress), `live({ onChanges, onResync, onRetry? })` (hears which records of the [live](live.md) resources change until the function it returns is called, connecting again by itself; every caller of one client shares one stream), `channel(resource, key)` (a record's [channel](channels.md#from-a-page), with its presence and broadcasts, every channel of the client on one socket).
21
21
 
22
22
  With an absolute `baseUrl`, such as another app's `https://desk.example.com/api/v1`, the `url` of each [file](files.md) in a record the client answers is absolute too, on that API's origin, where the API answers a path on its own origin. `routedClient(own, sourceOf)` is one client over several APIs: each call about a resource goes to the client `sourceOf(resource)` gives, else to `own`, as the admin app does for [remote resources](remote-resources.md), and `sourceMeta(meta, source)` keeps the part of another API's `/meta` an app draws.
23
23
 
@@ -51,7 +51,7 @@ export const repairsView = view<typeof repairs>('repairs')
51
51
  | `.title((r) => r.number)` | The field that names a record: in breadcrumbs, browser tabs, the record page's heading, relation links and search results. |
52
52
  | `.titleFrom(rule, (r) => [r.member_ids])` | A title derived in the browser for the person reading it, in place of `.title`, by the function `rule` names in the UI config's `titles`, from the fields picked. See [Titles per reader](#titles-per-reader). |
53
53
  | `.searchResult((r) => ({ title?, subtitle? }))` | A record in the [global search](client.md#global-search): `title` is one field or several joined by spaces (`[r.first_name, r.last_name]`, default: `.title`), `subtitle` the line under it (default: the first search field not in the title), replaced by the search field the text matched when neither line shows it. |
54
- | `.list((r, d, c) => ({ columns, sort?, search?, filter?, editable?, displays?, default? }))` | The list's columns in order, fields or [related records](#related-records-in-a-list) (`c.related`); the `filter` it [opens with](#a-filter-the-list-opens-with); its starting `sort` as `[[field, 'asc' \| 'desc'], ...]`, on `.sortable()` fields; the fields the search box suggests, among the resource's `.search` fields, which decide what search matches on the server; the columns [edited in their cell](#editing-in-the-list); other ways to show it, see [List displays](#list-displays). `protobase build` fails on a sort or search field outside those. |
54
+ | `.list((r, d, c) => ({ columns, sort?, search?, filter?, editable?, displays?, default? }))` | The list's columns in order, fields or [related records](#related-records-in-a-list) (`c.related`); the `filter` it [opens with](#a-filter-the-list-opens-with); its starting `sort` as `[[field, 'asc' \| 'desc'], ...]`, on `.sortable()` fields, else the primary key's order when it is `.sortable()`, else none, which the API orders by the key; the fields the search box suggests, among the resource's `.search` fields, which decide what search matches on the server; the columns [edited in their cell](#editing-in-the-list); other ways to show it, see [List displays](#list-displays). `protobase build` fails on a sort or search field outside those. |
55
55
  | `.fields((r) => ({ name: r.name.label(...) }))` | Hints per field, below. Calls add up. |
56
56
  | `.help(text)` | A line under the list's title. |
57
57
  | `.nav({ group, order, hidden, recent, tenant })` | Where the resource sits in the sidebar, its [recent-record group](sidebar.md#recent-records), and with `tenant: 'current'` that it opens on [the current organization](sidebar.md#the-current-organization). |
@@ -226,7 +226,7 @@ The list of a resource ordered as one, such as the products, has a **Reorder** b
226
226
 
227
227
  Each drop shows at once and is saved straight away: one [batch `reorder`](api.md#batch-writes) sends only the stretch of records whose place changed, with the ETags they were listed with, and numbers them on from the record before them; 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. 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). A refusal, such as a record someone else changed since, puts the rows back as the server has them, with the reason. Every list of the resource reloads afterwards.
228
228
 
229
- 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.
229
+ 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.
230
230
 
231
231
  ### Dragging in the list
232
232
 
@@ -773,6 +773,16 @@ The record's form and the create form edit each field as its type asks, under it
773
773
  - **Save conflicts.** When someone else saved the record after it was opened, Save writes nothing over their change: the form takes in the record as it is now, keeps your changes, and each field you both changed shows the value saved in the meantime, with **Keep mine** and **Use theirs**. The next Save writes what you kept.
774
774
  - **Leaving.** Leaving a page with changes not yet saved, by a link, a reload or closing the tab, asks first. The record's form keeps its changes in the browser, so they come back when the record opens again; the create page, a [`ModalForm`](blocks.md#modalform) and a comment being written lose theirs, and the question says so.
775
775
 
776
+ ### Record lines
777
+
778
+ A record with numbered lines, such as an invoice, shows all of them on its page as one table, without paging. The lines are the records of the first resource with a relation to the record's resource, an integer `position` field and a `quantity` field, and the table's columns are their list columns (`.list({ columns })` of their view, or their first fields), without the line's key, its tenant, the relation to the record and `position`, which is the order of the rows.
779
+
780
+ On the record's form the lines are edited in place, each field with the form's own editor and a relation with its picker. **Add line** adds an empty line at the end, which gets the record's key and the place after the last line when saved, and the database's defaults fill what is left empty. **Remove line**, in a line's menu, removes it, and the drag handle or **Move up** and **Move down** change the order, as in [Reordering by hand](#reordering-by-hand).
781
+
782
+ Nothing is written until **Save**, which writes the record and its lines in one [batch](api.md#batch-writes), all or nothing: the removed lines are deleted, the changed fields of a line updated with the ETag it was read with, the new lines created and the order written with `reorder`. A line the server turns down says why, under the field it names or under the line, and the changes stay to put right. When someone else changed the lines in the meantime, nothing is written and the lines load again.
783
+
784
+ **Add line** is there for a user who may create lines, a line's fields and the order change for one who may update them, and **Remove line** for one who may delete them, as each line's own permissions allow. On the read view, and on a record the user may not update, such as a sent invoice whose [rule](access.md#rules-that-read-the-record) allows updates to drafts only, the lines only show. The table loads up to 1,000 lines; a record with more shows them, the first 1,000, read-only.
785
+
776
786
  ### Deleting a record
777
787
 
778
788
  **Delete**, in the action rail of a user who may delete the record, asks first. A resource with a [soft delete](data-config.md#resource) deletes at once instead, and the toast offers **Undo**, which brings the record back. When someone saved the record after it was opened, the delete stops and says so, with **Review changes**, which shows the record as it is now, and **Delete anyway**. When other records still point at it, the delete is refused and the toast names them, such as "Orders still point at this company.", with a link to their list filtered on this record when the user may read it. Deleting a list's selected rows asks once, deletes only the rows that did not change since the list loaded, and lists each record it kept and why.