@protobase/cli 0.35.0 → 0.36.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.
package/dist/cli/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.36.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.
|
|
40
|
-
"@protobase/query": "0.
|
|
41
|
-
"@protobase/schema": "0.
|
|
42
|
-
"@protobase/server": "0.
|
|
43
|
-
"@protobase/ui": "0.
|
|
39
|
+
"@protobase/layout": "0.36.0",
|
|
40
|
+
"@protobase/query": "0.36.0",
|
|
41
|
+
"@protobase/schema": "0.36.0",
|
|
42
|
+
"@protobase/server": "0.36.0",
|
|
43
|
+
"@protobase/ui": "0.36.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",
|
|
@@ -206,6 +206,8 @@ iban: f.text().sensitive().access({ read: roles.can('screening.read') }),
|
|
|
206
206
|
|
|
207
207
|
A sensitive field cannot be `.filterable()`, `.sortable()`, aliased, searched, or the key, tenant, owner or soft delete field, and a view may only put it in a record page section: in a list, filter, chart, sidebar, title, recent-record group or action it would always be empty, so the config fails to load.
|
|
208
208
|
|
|
209
|
+
A [webhook subscription](webhooks.md)) delivering `as` a role runs that role's access rules on a captured change, which holds no sensitive field. A rule or row filter that reads one there throws, and the change is kept as failed for that subscription instead of delivered, so decide that access on a field that is not sensitive. A rule that reads the field before it checks the role, such as `record.api_secret == null || ctx.user.roles.includes('admin')`, fails even for `as: { roles: ['admin'] }`: check the role first, as in `ctx.user.roles.includes('admin') || ...`.
|
|
210
|
+
|
|
209
211
|
## Encrypted fields
|
|
210
212
|
|
|
211
213
|
An encrypted field is a [sensitive field](#sensitive-fields) whose value the server encrypts before it reaches the database, so a dump, a backup, a replica, a realtime subscriber or anyone running SQL sees only ciphertext. Only its reveal decrypts it, for a caller who may read the record and the field, and every reveal is audited. Every API write encrypts it: the record form, REST, batches, imports, [public forms](forms.md)) and `records` in [API functions](../guides/api-functions.md)). The [Supabase-compatible REST API](supabase-rest.md#encrypted-fields)) refuses to write or filter it.
|
|
@@ -218,7 +220,7 @@ It takes `f.text()` only, and cannot be `.readOnly()` or have a `.dbDefault()`.
|
|
|
218
220
|
|
|
219
221
|
**Write it only through the API.** SQL of your own, in an API function's `db`, a write hook's transaction or the assistant's approved changes, stores the value unencrypted, and its reveal then fails until [`protobase encryption apply`](cli.md#encryption-apply)) encrypts it.
|
|
220
222
|
|
|
221
|
-
**Your code never sees the stored value, only whether it is set.** Access rules cannot filter on it: a rule that returns a filter on it fails the request. Record rules, validators and write hooks get a stored record with a set value as `encrypted` (exported from `@protobase/schema`) and an empty one as `null`. Check whether it is set with `== null`; the marker is never equal to anything, so a rule comparing it with a constant decides as if it held another value, and reading it as text throws.
|
|
223
|
+
**Your code never sees the stored value, only whether it is set.** Access rules cannot filter on it: a rule that returns a filter on it fails the request. Record rules, validators and write hooks get a stored record with a set value as `encrypted` (exported from `@protobase/schema`) and an empty one as `null`. Check whether it is set with `== null`; the marker is never equal to anything, so a rule comparing it with a constant decides as if it held another value, and reading it as text throws. A [webhook subscription's access check](#sensitive-fields) cannot know whether it is set, as for every sensitive field. Rules and validators see the plaintext only where a write gives it, so a validator written this way checks each value written and leaves a stored one alone:
|
|
222
224
|
|
|
223
225
|
```ts
|
|
224
226
|
.validate((r) => (typeof r.iban === 'string' && !r.iban.startsWith('NL') ? [{ field: 'iban', message: 'A Dutch IBAN' }] : undefined))
|
|
@@ -54,7 +54,7 @@ export const rushOrders = subscription('rushOrders', {
|
|
|
54
54
|
| --- | --- |
|
|
55
55
|
| `events` | Event names (`orders.created`), every event of a resource (`orders.*`), or all of them (`*`). Each must match a declared event. |
|
|
56
56
|
| `when` | A filter on the record after the change, or before it for a delete, in the language of access rules. |
|
|
57
|
-
| `as: { roles }` | Delivers as these roles: only records they may read, and only fields they may read. Without it, every record and every field but the sensitive ones. |
|
|
57
|
+
| `as: { roles }` | Delivers as these roles: only records they may read, and only fields they may read. Without it, every record and every field but the sensitive ones. Their access rules cannot read a sensitive field, which a captured change does not hold: a change they would need one for is kept as failed. Check the role before such a field, as in `ctx.user.roles.includes('admin') \|\| record.api_secret == null`, or decide on a field that is not sensitive (see [Sensitive fields](data-config.md#sensitive-fields))). |
|
|
58
58
|
| `tenant` | Only events of this tenant's records. |
|
|
59
59
|
| `payload` | `thin` leaves `after` and `before` out, for a receiver that reads the record through the API. Default `full`. |
|
|
60
60
|
| `ordered` | One delivery at a time per record, in commit order. Default false. |
|
|
@@ -96,7 +96,7 @@ A function target is called as the subscription's `as`, so `context.caller()` an
|
|
|
96
96
|
- **After the last try** the job is kept as failed, on the [failed jobs page](jobs.md#failed-jobs-page)), where it can be retried.
|
|
97
97
|
- **Ordered subscriptions** get no first try from the dispatch job: a `webhooks.deliver-ordered` job delivers a record's events of one dispatch in order, retried with doubling waits from 5 s up to a day, 10 tries. Meanwhile the record's later events to that subscription wait. A retry sends again the events of that job that went through before the one that failed.
|
|
98
98
|
- **At least once:** a process that stops after delivering but before recording it delivers again when the dispatch job is retried, under the same `webhook-id`.
|
|
99
|
-
- **Event code that throws**, such as a `match` that reads a field it did not expect to be empty, a subscription's `when` or an access rule of its `as` roles, keeps that change as a failed `webhooks.dispatch-change` job on the failed jobs page, naming the event or subscription and the error, and dispatch moves on to later changes. Retry it once the code is fixed to deliver the change's events. A database error instead fails the whole dispatch job, which is retried.
|
|
99
|
+
- **Event code that throws**, such as a `match` that reads a field it did not expect to be empty, a subscription's `when` or an access rule of its `as` roles, keeps that change as a failed `webhooks.dispatch-change` job on the failed jobs page, naming the event or subscription and the error, and dispatch moves on to later changes. Retry it once the code is fixed to deliver the change's events. An access rule of `as` roles keeps the change as failed for that subscription only: the other subscriptions still receive it, and the retry delivers it to that subscription alone. A database error instead fails the whole dispatch job, which is retried.
|
|
100
100
|
|
|
101
101
|
Every outcome is a line in the server log, such as `webhook newOrdersToSlack orders.created evt_48211_created delivered (200)`.
|
|
102
102
|
|