@protobase/cli 0.40.8 → 0.40.10

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.
Files changed (78) hide show
  1. package/dist/cli/package.js +1 -1
  2. package/package.json +6 -6
  3. package/skills/protobase/SKILL.md +1 -0
  4. package/skills/protobase/references/features/access.md +16 -0
  5. package/skills/protobase/references/features/actions.md +11 -0
  6. package/skills/protobase/references/features/ai.md +14 -0
  7. package/skills/protobase/references/features/api-functions.md +13 -0
  8. package/skills/protobase/references/features/build-and-run.md +19 -0
  9. package/skills/protobase/references/features/compatibility.md +14 -0
  10. package/skills/protobase/references/features/composed-pages.md +18 -0
  11. package/skills/protobase/references/features/data-model.md +19 -0
  12. package/skills/protobase/references/features/email-and-public-forms.md +12 -0
  13. package/skills/protobase/references/features/events-webhooks-and-jobs.md +18 -0
  14. package/skills/protobase/references/features/files-and-images.md +16 -0
  15. package/skills/protobase/references/features/history-comments-and-live-updates.md +14 -0
  16. package/skills/protobase/references/features/list-displays.md +18 -0
  17. package/skills/protobase/references/features/lists.md +28 -0
  18. package/skills/protobase/references/features/look-and-language.md +13 -0
  19. package/skills/protobase/references/features/navigation.md +14 -0
  20. package/skills/protobase/references/features/record-pages.md +20 -0
  21. package/skills/protobase/references/features/releases.md +11 -0
  22. package/skills/protobase/references/features/rest-api.md +24 -0
  23. package/skills/protobase/references/features/several-apps.md +8 -0
  24. package/skills/protobase/references/features/sign-in-and-accounts.md +27 -0
  25. package/skills/protobase/references/features/start-a-project.md +14 -0
  26. package/skills/protobase/references/features/your-own-code.md +19 -0
  27. package/skills/protobase/references/features.md +39 -0
  28. package/skills/protobase/references/getting-started.md +8 -8
  29. package/skills/protobase/references/guides/api-functions.md +12 -12
  30. package/skills/protobase/references/guides/billing-page.md +2 -2
  31. package/skills/protobase/references/guides/create-page.md +5 -5
  32. package/skills/protobase/references/guides/deploy.md +6 -6
  33. package/skills/protobase/references/guides/export-a-list.md +2 -2
  34. package/skills/protobase/references/guides/field-type.md +2 -2
  35. package/skills/protobase/references/guides/first-composed-page.md +4 -4
  36. package/skills/protobase/references/guides/first-plugin.md +3 -3
  37. package/skills/protobase/references/guides/import-records.md +1 -1
  38. package/skills/protobase/references/guides/mobile-app.md +14 -3
  39. package/skills/protobase/references/guides/plugin-build.md +5 -5
  40. package/skills/protobase/references/guides/record-card.md +3 -3
  41. package/skills/protobase/references/guides/remote-resources.md +10 -10
  42. package/skills/protobase/references/guides/table-to-admin.md +5 -5
  43. package/skills/protobase/references/guides/theme-an-app.md +4 -4
  44. package/skills/protobase/references/reference/access.md +9 -9
  45. package/skills/protobase/references/reference/ai.md +6 -6
  46. package/skills/protobase/references/reference/api.md +25 -25
  47. package/skills/protobase/references/reference/app-identity.md +4 -4
  48. package/skills/protobase/references/reference/architecture.md +1 -1
  49. package/skills/protobase/references/reference/assistant.md +6 -6
  50. package/skills/protobase/references/reference/auth.md +20 -20
  51. package/skills/protobase/references/reference/blocks.md +13 -13
  52. package/skills/protobase/references/reference/bottom-bar.md +5 -5
  53. package/skills/protobase/references/reference/cli.md +63 -63
  54. package/skills/protobase/references/reference/client.md +5 -5
  55. package/skills/protobase/references/reference/comments.md +8 -8
  56. package/skills/protobase/references/reference/custom-components.md +18 -18
  57. package/skills/protobase/references/reference/data-config.md +30 -26
  58. package/skills/protobase/references/reference/email.md +8 -8
  59. package/skills/protobase/references/reference/events.md +5 -5
  60. package/skills/protobase/references/reference/files.md +11 -7
  61. package/skills/protobase/references/reference/forms.md +6 -6
  62. package/skills/protobase/references/reference/history.md +7 -7
  63. package/skills/protobase/references/reference/installable-app.md +1 -1
  64. package/skills/protobase/references/reference/jobs.md +5 -5
  65. package/skills/protobase/references/reference/layouts.md +11 -11
  66. package/skills/protobase/references/reference/live.md +4 -4
  67. package/skills/protobase/references/reference/mcp.md +15 -7
  68. package/skills/protobase/references/reference/plugins.md +20 -20
  69. package/skills/protobase/references/reference/remote-resources.md +15 -15
  70. package/skills/protobase/references/reference/sidebar.md +1 -1
  71. package/skills/protobase/references/reference/supabase-realtime.md +2 -2
  72. package/skills/protobase/references/reference/supabase-rest.md +2 -2
  73. package/skills/protobase/references/reference/supabase-storage.md +1 -1
  74. package/skills/protobase/references/reference/theme.md +5 -5
  75. package/skills/protobase/references/reference/ui-config.md +60 -60
  76. package/skills/protobase/references/reference/user-menu.md +3 -3
  77. package/skills/protobase/references/reference/versioning.md +5 -5
  78. package/skills/protobase/references/reference/webhooks.md +7 -7
@@ -48,7 +48,7 @@ Every commit message follows [Conventional Commits](https://www.conventionalcomm
48
48
  2. `bun run release` (`scripts/release.mjs`, with [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version)) computes the next version and its notes from the commits since the last `v<version>` tag, as above, and tags the pushed commit `v<version>`. It commits nothing and changes no file. Without a fix, feature or breaking change it tags nothing.
49
49
  3. The tag is pushed, and the GitHub release of the tag gets the notes.
50
50
  4. `scripts/stamp-version.mjs` writes the tag's version into every `package.json` and `bun.lock` in the runner, never committed. `scripts/publish.mjs` then builds every package at the tag to `dist` and packs it with Bun (the private `@protobase/presets` is not published), and npm, under Node, publishes it with [trusted publishing](https://docs.npmjs.com/trusted-publishers) and provenance; there is no npm token. A run that cut no release publishes nothing.
51
- 5. Once npm serves the packages, the tag's version is written into the `package.json` files the same way, and `bun run images:context <image>` writes each image's build context at the tag from them, and the images are built natively for `linux/amd64` and `linux/arm64` and pushed to GitHub's registry as `ghcr.io/prototeamhq/protobase:<version>` and `ghcr.io/prototeamhq/protobase-dev:<version>` (see [Deploy](../guides/deploy.md#images))). A release whose publish failed has no images.
51
+ 5. Once npm serves the packages, the tag's version is written into the `package.json` files the same way, and `bun run images:context <image>` writes each image's build context at the tag from them, and the images are built natively for `linux/amd64` and `linux/arm64` and pushed to GitHub's registry as `ghcr.io/prototeamhq/protobase:<version>` and `ghcr.io/prototeamhq/protobase-dev:<version>` (see [Deploy](../guides/deploy.md#images)). A release whose publish failed has no images.
52
52
 
53
53
  When `main` moved on while the checks ran, the run of the newer push releases both. `bun run release --dry-run` prints the next version and its notes without tagging anything.
54
54
 
@@ -56,7 +56,7 @@ Running the workflow by hand with a tag (`gh workflow run release.yml -f tag=v0.
56
56
 
57
57
  ## Bundles and runtimes
58
58
 
59
- `protobase build` writes the Protobase version that built the bundle into [the manifest](cli.md#the-manifest)) as `protobase`. The serve runtime knows its own version, inlined into `protobase-serve.js` by `protobase build-serve` and inlined into the CLI's `dist` when the package is built, and read from `@protobase/cli`'s `package.json` when `protobase serve` runs from source in this repository. Before it loads a bundle, it compares the two:
59
+ `protobase build` writes the Protobase version that built the bundle into [the manifest](cli.md#the-manifest) as `protobase`. The serve runtime knows its own version, inlined into `protobase-serve.js` by `protobase build-serve` and inlined into the CLI's `dist` when the package is built, and read from `@protobase/cli`'s `package.json` when `protobase serve` runs from source in this repository. Before it loads a bundle, it compares the two:
60
60
 
61
61
  - **From 1.0:** the major versions are the same and the runtime's minor is the bundle's or newer. A 1.4.x runtime serves bundles built by 1.0.0 up to 1.4.x.
62
62
  - **Below 1.0:** the minor versions are the same. A 0.2.x runtime serves only bundles built by 0.2.x, not those of 0.1.x or 0.3.x.
@@ -72,9 +72,9 @@ Rebuild the bundle with the runtime's version of Protobase, or upgrade the runti
72
72
 
73
73
  ## Plugins
74
74
 
75
- [Plugins](plugins.md)) are versioned by a plugin API of their own, not by the bundle's rule above: `@protobase/ui`'s `pluginApi`, 1 so far. A plugin's `plugin.json` names the plugin API it is built for and a range of Protobase versions, from the `@protobase/ui` it is built with on. An app loads a plugin of its own plugin API whose range holds its version, and turns off any other, telling its admins why.
75
+ [Plugins](plugins.md) are versioned by a plugin API of their own, not by the bundle's rule above: `@protobase/ui`'s `pluginApi`, 1 so far. A plugin's `plugin.json` names the plugin API it is built for and a range of Protobase versions, from the `@protobase/ui` it is built with on. An app loads a plugin of its own plugin API whose range holds its version, and turns off any other, telling its admins why.
76
76
 
77
- A project's own `protobase.ui.tsx` is a plugin of its bundle, so the same rule holds for it. The admin app it runs in, the shell, is prebuilt once per release; a host that serves a newer release's shell for a bundle whose plugins all load in it gives the app that release's fixes without a rebuild (see [the shell](plugins.md#the-shell))). The server config still follows the bundle's rule above.
77
+ A project's own `protobase.ui.tsx` is a plugin of its bundle, so the same rule holds for it. The admin app it runs in, the shell, is prebuilt once per release; a host that serves a newer release's shell for a bundle whose plugins all load in it gives the app that release's fixes without a rebuild (see [the shell](plugins.md#the-shell)). The server config still follows the bundle's rule above.
78
78
 
79
79
  Releases keep the plugin API, below 1.0 too, where a minor version may change the config: they add exports to `@protobase/ui`, but remove or change one, add or remove a module the app shares with plugins, or move to a new major version of React only with a new plugin API. A test pins every export of `@protobase/ui` (`packages/ui/src/plugins/plugin-api.exports.json`) and fails when one goes away while `pluginApi` stays the same.
80
80
 
@@ -82,7 +82,7 @@ Releases keep the plugin API, below 1.0 too, where a minor version may change th
82
82
 
83
83
  An app whose host can update its runtime, such as a hosting platform, can show admins an **Update** button in the top bar. `PROTOBASE_RUNTIME_URL` (or `createAdmin`'s `options.runtime.url`) names the host's endpoint, and `/api/meta` passes it on as `runtime: { url }` to callers with the `admin` role only. Without it, or for anyone else, the app shows nothing and asks nothing.
84
84
 
85
- The app sends the signed-in user's API token as `Authorization: Bearer <token>` (verified like an [assistant backend](assistant.md#another-backend)) does) and expects:
85
+ The app sends the signed-in user's API token as `Authorization: Bearer <token>` (verified like an [assistant backend](assistant.md#another-backend) does) and expects:
86
86
 
87
87
  - `GET {url}`: `200` with `{ version, latest, updateAvailable, indicator, policy, nextUpdateAt, updating }`. `version` is the runtime the app is pinned to, `policy` one of `immediate`, `weekly`, `scheduled` or `manual`, and `nextUpdateAt` when that policy applies `latest` (null when it never will or nothing is pending).
88
88
  It may also send `updateStage` (`job` or `build`) and `updateStartedAt` while an update runs, and `lastUpdate`, `{ toVersion, outcome, errorCode, message, finishedAt }` with `outcome` one of `succeeded`, `unchanged` or `failed` and `message` plain text for the app's owner. A host that leaves them out gets the dialog without them.
@@ -4,7 +4,7 @@
4
4
 
5
5
  Subscriptions that deliver resource events to URLs, API functions and code, signed with Standard Webhooks, retried and shaped for who receives them.
6
6
 
7
- A **subscription** delivers the [events](events.md)) of resources as they happen: to a URL, to one of the app's [API functions](../guides/api-functions.md)), or to code of its own. Subscriptions are config: export them from the config module like resources, so the server has them and the admin UI never does. A URL or secret usually comes from the environment.
7
+ A **subscription** delivers the [events](events.md) of resources as they happen: to a URL, to one of the app's [API functions](../guides/api-functions.md), or to code of its own. Subscriptions are config: export them from the config module like resources, so the server has them and the admin UI never does. A URL or secret usually comes from the environment.
8
8
 
9
9
  ```ts title="docs-examples/events/subscriptions.ts"
10
10
  import { subscription } from '@protobase/server'
@@ -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. 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))). |
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. |
@@ -81,7 +81,7 @@ webhook-signature: v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj9o9NDN/H/pI4=
81
81
  ```
82
82
 
83
83
  - **`webhook-id`** is the same on every retry: a receiver that keeps the ids it handled ignores a second copy.
84
- - **The signature** follows [Standard Webhooks](https://www.standardwebhooks.com): an HMAC-SHA256 of `id.timestamp.body` with the secret. A Protobase function checks it with [`verifyStandardWebhook`](../guides/api-functions.md)), and the Standard Webhooks libraries do the same elsewhere.
84
+ - **The signature** follows [Standard Webhooks](https://www.standardwebhooks.com): an HMAC-SHA256 of `id.timestamp.body` with the secret. A Protobase function checks it with [`verifyStandardWebhook`](../guides/api-functions.md), and the Standard Webhooks libraries do the same elsewhere.
85
85
  - **Records** use field names and values as `GET /orders/{key}` returns them, never sensitive fields. `changed` lists sensitive fields that changed, by name only.
86
86
  - **`sequence`** grows with every change of a record, so a receiver can drop an event older than one it already has.
87
87
  - **`actor`** is the caller of a write through the API, `null` for any other write (`source: "database"`).
@@ -93,7 +93,7 @@ A function target is called as the subscription's `as`, so `context.caller()` an
93
93
  - **The first try** goes out from the dispatch job, right after the write: within milliseconds for a write through the API, within two seconds for one from elsewhere.
94
94
  - **A failed try** becomes a `webhooks.deliver` job, retried on the Standard Webhooks schedule with up to 10% jitter: 5 s, 5 m, 30 m, 2 h, 5 h, 10 h, 14 h, 20 h and 24 h, 10 tries over about three days. A `Retry-After` header makes the wait longer, up to a day.
95
95
  - **`410 Gone`** fails the delivery at once.
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.
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
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.
@@ -110,14 +110,14 @@ import { defineConfig, webhooks } from '@protobase/server'
110
110
  export default defineConfig({ extends: [webhooks()], config, auth, authenticate })
111
111
  ```
112
112
 
113
- It adds two pages, over a `webhooks` schema that [`protobase migration`](cli.md#migration)) writes (`NNN_webhooks.sql`):
113
+ It adds two pages, over a `webhooks` schema that [`protobase migration`](cli.md#migration) writes (`NNN_webhooks.sql`):
114
114
 
115
- - **Webhook subscriptions** (`webhook_subscriptions`, the table `webhooks.subscriptions`): a name, the events (`orders.created orders.large`, or `orders.*`), the URL, a filter, extra headers, full or thin payload, and whether it is enabled. The server sets the tenant and the owner, the person who made it, and makes the secret, which only a [reveal](api.md#sensitive-fields-and-audit)) shows. Saving checks the events and the filter against the resources, and refuses a URL whose host is a private, loopback or link-local address.
115
+ - **Webhook subscriptions** (`webhook_subscriptions`, the table `webhooks.subscriptions`): a name, the events (`orders.created orders.large`, or `orders.*`), the URL, a filter, extra headers, full or thin payload, and whether it is enabled. The server sets the tenant and the owner, the person who made it, and makes the secret, which only a [reveal](api.md#sensitive-fields-and-audit) shows. Saving checks the events and the filter against the resources, and refuses a URL whose host is a private, loopback or link-local address.
116
116
  - **Webhook deliveries** (`webhook_deliveries`, a view over the delivery jobs): the deliveries that wait for their next try or failed for good, with their last error. A delivery leaves the list once it succeeds.
117
117
 
118
118
  Both are scoped to the tenant like any resource with `.tenant()`, and their access decides who may do what: `webhook_subscriptions.create`, `webhook_deliveries.update` and so on, as for the app's own resources.
119
119
 
120
- A subscription made here **delivers as its owner**, with the role they act with now in its tenant (the [active role](auth.md#active-role)) they last chose, else their first): only records and fields it may read. Letting people make subscriptions therefore grants them nothing they could not read already. The roles are read from the project's Better Auth; a project that signs people in otherwise passes `webhooks({ ownerRoles: async ({ id, tenant }) => [...] })`.
120
+ A subscription made here **delivers as its owner**, with the role they act with now in its tenant (the [active role](auth.md#active-role) they last chose, else their first): only records and fields it may read. Letting people make subscriptions therefore grants them nothing they could not read already. The roles are read from the project's Better Auth; a project that signs people in otherwise passes `webhooks({ ownerRoles: async ({ id, tenant }) => [...] })`.
121
121
 
122
122
  | Action | |
123
123
  | --- | --- |