@protobase/cli 0.38.0 → 0.39.0

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.38.0";
2
+ var version = "0.39.0";
3
3
  //#endregion
4
4
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protobase/cli",
3
- "version": "0.38.0",
3
+ "version": "0.39.0",
4
4
  "description": "The protobase command: scaffold, doctor, dev, build and serve a Protobase project.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -36,11 +36,11 @@
36
36
  "@better-auth/core": "^1.7.12",
37
37
  "@hono/node-server": "^2.1.3",
38
38
  "@hono/vite-dev-server": "^0.26.1",
39
- "@protobase/layout": "0.38.0",
40
- "@protobase/query": "0.38.0",
41
- "@protobase/schema": "0.38.0",
42
- "@protobase/server": "0.38.0",
43
- "@protobase/ui": "0.38.0",
39
+ "@protobase/layout": "0.39.0",
40
+ "@protobase/query": "0.39.0",
41
+ "@protobase/schema": "0.39.0",
42
+ "@protobase/server": "0.39.0",
43
+ "@protobase/ui": "0.39.0",
44
44
  "@react-email/render": "^2.1.0",
45
45
  "@scalar/hono-api-reference": "^0.12.10",
46
46
  "@tailwindcss/vite": "^4.3.3",
@@ -116,6 +116,10 @@ Each item has `id`, `name`, `slug`, `price` and `image`, of published products o
116
116
 
117
117
  A field rule goes from the field to the roles: `cost_price` above is hidden from every role that reads products but those holding `costs.read`. Use it for the few sensitive columns of a resource that many roles read, such as a screening result (`f.text().access({ read: roles.can('screening.read') })`). A field list goes from the role to the fields: use it for a role that should see only some columns, such as an integration or anonymous visitors, so a new column stays hidden from it. When both apply, a field needs both.
118
118
 
119
+ ### Write-only fields
120
+
121
+ A role writes a field it cannot read only when the field's own `create` or `update` rule allows it: `f.text().access({ read: roles.is('loop'), create: roles.is('admin'), update: roles.is('admin') })` lets `admin` set a value only `loop` reads. A write rule the field follows from its resource never does, so hiding a field from a role does not let everyone who updates the resource overwrite it. The value is in no response, history, export or webhook of the writer, and `/meta` leaves it out, so the admin app offers no editor for it: set it through the API. A file field, or the field a resource orders its records by (`.position()`), is never write-only, and no `reorder` orders by a write-only field.
122
+
119
123
  ## Records that belong to another
120
124
 
121
125
  A record often belongs to another one through a relation, such as an operation to the VM it runs on, and who may write it follows from who may change that VM. `.parent((r) => r.vm_id, 'update')` says so: writing an operation needs `update` on the record `vm_id` points at, `'read'` needing only to see it, as for a comment on a ticket. A member below may run operations on their own VMs only, with no rule of your own:
@@ -92,7 +92,7 @@ Access is resolved once per request and resource ([`resolveAccess`](https://docs
92
92
  - **Operations**: a denied operation is `403`; a resource the caller can do nothing with does not exist for them (`404` everywhere, absent from `/meta` and the OpenAPI document).
93
93
  - **Readable fields**: the caller works with a restricted model that has only the fields they may read. `filter`, `order_by`, `fields`, `search(...)`, `:facets`, `:aggregate`, `:histogram`, `:series`, `:map`, `:seek` and `:search` bodies are checked against it, so a hidden field is refused exactly like an unknown one (same status, same message and hint, nothing that says it exists). List, get, create, update and delete responses contain readable fields only, and queries select only those columns.
94
94
  - **Sensitive fields** are readable fields that no response carries and no request may name, except `:reveal`; they can be written. See [Sensitive fields and audit](#sensitive-fields-and-audit).
95
- - **Writable fields**: only fields the caller may write (and read) are accepted; any other is `400`, worded as unknown (hidden) or read-only. Nobody writes a field blind.
95
+ - **Writable fields**: only fields the caller may write and read are accepted, and [write-only](access.md#write-only-fields)) ones; any other is `400`, worded as unknown (hidden) or read-only.
96
96
  - **Row filters**: a rule that returns a filter (`.own`, `.team`) narrows every read (list, get, aggregates) and the rows a write may target; the database applies it, so it may use columns the caller cannot see. A row outside it is a `404`.
97
97
  - **Record-level rules** (a rule that needs the record, such as `status != 'locked'`) run in the write transaction with the stored record; a filter they return is checked in the database against the row as written, and a miss rolls the write back with `403`.
98
98
  - **`.own` on create**: when the create rule is limited to rows, the owner field is set to the caller unless given, and a row owned by someone else is refused with `403`.