@protobase/cli 0.51.3 → 0.52.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.
Files changed (54) hide show
  1. package/dist/build/app-icons.js +2 -1
  2. package/dist/build/favicon-file.js +5 -0
  3. package/dist/build/favicon-ico.js +20 -0
  4. package/dist/build/favicon.js +1 -2
  5. package/dist/build/service-worker-code.js +1 -1
  6. package/dist/cli/package.js +1 -1
  7. package/dist/config/build-project.js +1 -0
  8. package/dist/dev/entry.js +2 -1
  9. package/dist/doctor/relation-issues.js +13 -0
  10. package/dist/doctor/run.js +6 -1
  11. package/dist/migration/adopt-public-record.js +15 -0
  12. package/dist/migration/apply-migrations.js +8 -4
  13. package/dist/migration/load-project.js +1 -0
  14. package/dist/migration/parts.js +6 -1
  15. package/dist/project/favicon-link.js +12 -2
  16. package/dist/project/project-admin.js +1 -0
  17. package/dist/project/service-worker.js +1 -1
  18. package/dist/scaffold/plan.d.ts +2 -0
  19. package/dist/scaffold/plan.js +7 -3
  20. package/dist/scaffold/protobase-tables.d.ts +1 -1
  21. package/dist/scaffold/protobase-tables.js +8 -1
  22. package/dist/scaffold/referenced.d.ts +6 -0
  23. package/dist/scaffold/referenced.js +38 -0
  24. package/dist/scaffold/run.js +2 -1
  25. package/dist/scaffold/tables.d.ts +2 -1
  26. package/dist/scaffold/tables.js +18 -9
  27. package/dist/scaffold-api.d.ts +2 -1
  28. package/dist/scaffold-api.js +2 -1
  29. package/dist/serve/lifecycle.js +2 -1
  30. package/dist/serve/static-site.js +3 -0
  31. package/dist/supabase/dump-phase.js +6 -5
  32. package/dist/supabase/load-phase.js +5 -6
  33. package/dist/supabase/platform-schemas.js +42 -0
  34. package/dist/supabase/project-users.d.ts +10 -0
  35. package/dist/supabase/project-users.js +38 -0
  36. package/dist/supabase/report.js +1 -1
  37. package/dist/supabase/source-facts.js +3 -35
  38. package/dist/supabase/users-migrations.js +2 -2
  39. package/package.json +7 -7
  40. package/skills/protobase/references/features/ai.md +5 -0
  41. package/skills/protobase/references/features/compatibility.md +1 -1
  42. package/skills/protobase/references/features/look-and-language.md +1 -1
  43. package/skills/protobase/references/getting-started.md +5 -3
  44. package/skills/protobase/references/guides/deploy.md +1 -1
  45. package/skills/protobase/references/reference/app-identity.md +3 -1
  46. package/skills/protobase/references/reference/assistant.md +2 -2
  47. package/skills/protobase/references/reference/cli.md +7 -7
  48. package/skills/protobase/references/reference/comments.md +2 -0
  49. package/skills/protobase/references/reference/config/api.md +13 -2
  50. package/skills/protobase/references/reference/config.md +1 -1
  51. package/skills/protobase/references/reference/mcp.md +43 -10
  52. package/skills/protobase/references/reference/notifications.md +1 -1
  53. package/skills/protobase/references/reference/supabase-realtime.md +4 -2
  54. package/skills/protobase/references/reference/webhooks.md +1 -0
@@ -46,7 +46,9 @@ A broadcast reaches the topic's other channels, and the sender's own with `self`
46
46
 
47
47
  Limits, near Supabase's Free plan, apply per socket and per topic. A socket sends at most 100 broadcast and presence messages a second, joins at most 100 times a second and holds at most 100 channels; on each channel it sends at most 5 presence updates in 30 seconds, also counted across a rejoin. A topic takes 100 broadcasts a second, whoever sends them, so one busy sender can use up a topic's budget. A topic is at most 255 bytes, and a tracked presence at most 10 000 bytes of JSON. A message over a limit gets an error reply and goes to no one, where Supabase would close the channel. A frame over 256 KiB closes the socket with 1009. It closes with 1008 when the client leaves more than 4 MiB unread, or sends more than 300 messages or 4 MiB while earlier ones wait, such as behind a token check.
48
48
 
49
- Broadcasts and presence go between the channels of one serving process, which is how a cloud app runs; <gap>Several processes behind one address do not reach each other's channels, because broadcasts and presence are not shared between processes.</gap>
49
+ ### Several processes
50
+
51
+ By default, one process serves the app, and broadcasts and presence go between its channels. When several processes serve it behind one address, set [`realtime: { processes: 'many' }`](config/api.md#realtime) and apply the migration [`protobase migration`](cli.md#migration) writes. Every channel on a topic then hears its broadcasts and presence, whichever process it joined, and so do broadcasts over the REST endpoint and from the database. Private and public channels of a topic stay apart across processes as on one. The processes share them through the `realtime_relay` schema of the app's database: each adds what it sends, and reads what the others sent ten times a second while one of its sockets is open, so a broadcast reaches another process's channels within about 100 ms. A topic's 100 broadcasts a second are counted across all the processes. A process that stops gracefully removes the presence its channels tracked; one that is killed has it removed by the others about 15 seconds after its last heartbeat, and their channels hear the leaves.
50
52
 
51
53
  ### Broadcast without a channel
52
54
 
@@ -58,7 +60,7 @@ await room.httpSend('cursor', { x: 1, y: 2 })
58
60
  await supabase.removeChannel(room)
59
61
  ```
60
62
 
61
- `POST /api/sb/realtime/v1/api/broadcast` takes Supabase's batch, `{ "messages": [{ "topic": "room", "event": "cursor", "payload": { "x": 1 }, "private": false }] }`, of at most 100 messages, each with an object payload. `httpSend()` sends one message to `POST /api/sb/realtime/v1/api/broadcast/<topic>/events/<event>`, `?private=true` for a private one, with a JSON object or, as `application/octet-stream`, binary bytes. A message reaches the channels joined on its topic in this process, under a broadcast's limits: a body is at most 256 KiB, a topic and an event at most 255 bytes each, and a request that would take a topic over its 100 broadcasts a second is refused with `429` and reaches no one. A public message reaches the topic's public channels; a private one reaches only its private channels that may receive broadcasts, and only when the caller may send broadcasts there by the [policies on `realtime.messages`](#private-channels): a batch drops one it may not send, as Supabase does, and `httpSend()` is refused with `403`. <gap>A policy cannot read a broadcast request's headers in `request.headers` because passing them to the checks is not implemented.</gap>
63
+ `POST /api/sb/realtime/v1/api/broadcast` takes Supabase's batch, `{ "messages": [{ "topic": "room", "event": "cursor", "payload": { "x": 1 }, "private": false }] }`, of at most 100 messages, each with an object payload. `httpSend()` sends one message to `POST /api/sb/realtime/v1/api/broadcast/<topic>/events/<event>`, `?private=true` for a private one, with a JSON object or, as `application/octet-stream`, binary bytes. A message reaches the channels joined on its topic, under a broadcast's limits: a body is at most 256 KiB, a topic and an event at most 255 bytes each, and a request that would take a topic over its 100 broadcasts a second is refused with `429` and reaches no one. A public message reaches the topic's public channels; a private one reaches only its private channels that may receive broadcasts, and only when the caller may send broadcasts there by the [policies on `realtime.messages`](#private-channels): a batch drops one it may not send, as Supabase does, and `httpSend()` is refused with `403`. <gap>A policy cannot read a broadcast request's headers in `request.headers` because passing them to the checks is not implemented.</gap>
62
64
 
63
65
  ### Broadcast from the database
64
66
 
@@ -95,6 +95,7 @@ A function target is called as the subscription's `as`, so `context.caller()` an
95
95
  - **`410 Gone`** fails the delivery at once.
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
+ - **Every retry and resend follows the subscription as it is now:** its event leaves out fields that became sensitive since it was first made, and a subscription with `as` roles that may no longer read the record gets nothing. <gap>A retry of a thin event cannot check the row rules of `as` roles again because reading the current record for it is not implemented.</gap>
98
99
  - **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
100
  - **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
101