@protobase/cli 0.26.1 → 0.26.2
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/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/cli",
|
|
3
|
-
"version": "0.26.
|
|
3
|
+
"version": "0.26.2",
|
|
4
4
|
"description": "The protobase command: scaffold, doctor, dev, build and serve a Protobase project.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@hono/node-server": "^2.1.3",
|
|
37
37
|
"@hono/vite-dev-server": "^0.26.1",
|
|
38
|
-
"@protobase/layout": "0.26.
|
|
39
|
-
"@protobase/query": "0.26.
|
|
40
|
-
"@protobase/schema": "0.26.
|
|
41
|
-
"@protobase/server": "0.26.
|
|
42
|
-
"@protobase/ui": "0.26.
|
|
38
|
+
"@protobase/layout": "0.26.2",
|
|
39
|
+
"@protobase/query": "0.26.2",
|
|
40
|
+
"@protobase/schema": "0.26.2",
|
|
41
|
+
"@protobase/server": "0.26.2",
|
|
42
|
+
"@protobase/ui": "0.26.2",
|
|
43
43
|
"@react-email/render": "^2.1.0",
|
|
44
44
|
"@scalar/hono-api-reference": "^0.12.10",
|
|
45
45
|
"@tailwindcss/vite": "^4.3.3",
|
|
@@ -66,7 +66,7 @@ Reference:
|
|
|
66
66
|
- When keeping or showing the changes of records → read [Record history](references/reference/history.md)
|
|
67
67
|
- When adding comments to records → read [Record comments](references/reference/comments.md)
|
|
68
68
|
- When open pages should refresh as records change → read [Live updates](references/reference/live.md)
|
|
69
|
-
- When an app
|
|
69
|
+
- When an app uses supabase-js Realtime (`postgres_changes` under RLS, broadcast, presence) → read [Supabase Realtime](references/reference/supabase-realtime.md)
|
|
70
70
|
- When filling fields with a model → read [AI fields and actions](references/reference/ai.md)
|
|
71
71
|
- When letting people without an account create records → read [Public forms](references/reference/forms.md)
|
|
72
72
|
- When running background jobs → read [Jobs](references/reference/jobs.md)
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
# Supabase Realtime
|
|
4
4
|
|
|
5
|
-
The Realtime-compatible /realtime/v1 that supabase-js's channel()
|
|
5
|
+
The Realtime-compatible /realtime/v1 that supabase-js's channel() joins, for postgres_changes checked under the subscriber's RLS policies, broadcasts and presence.
|
|
6
6
|
|
|
7
|
-
An app with API keys
|
|
7
|
+
An app with API keys also serves `/realtime/v1/websocket`, the socket that supabase-js's `channel()` joins. An app moved from Supabase keeps its `postgres_changes` listeners, broadcasts and presence: point the client at the app and give it the publishable key.
|
|
8
8
|
|
|
9
9
|
```ts
|
|
10
10
|
import { createClient } from '@supabase/supabase-js'
|
|
@@ -24,7 +24,27 @@ The server serves the socket when the host gives `createAdmin` its WebSocket upg
|
|
|
24
24
|
|
|
25
25
|
## Which tables
|
|
26
26
|
|
|
27
|
-
A channel may listen to the tables of the resources with [`.live()`](live.md)), by `schema` (`*` for any), `table` (every live table of the schema when left out), `event` (`INSERT`, `UPDATE`, `DELETE` or `*`) and `filter`. A table that is not live is refused when the channel joins, with Supabase's message. A filter is Supabase's: `column=operator.value`, with `eq`, `neq`, `lt`, `lte`, `gt`, `gte`, `in.(a,b)`, `like`, `ilike`, `match`, `imatch`, `is` and `isdistinct`, `not.` before the operator, and several conditions joined by commas, all of which must hold. Postgres compares each value as the column's type. `select` of columns is not supported yet;
|
|
27
|
+
A channel may listen to the tables of the resources with [`.live()`](live.md)), by `schema` (`*` for any), `table` (every live table of the schema when left out), `event` (`INSERT`, `UPDATE`, `DELETE` or `*`) and `filter`. A table that is not live is refused when the channel joins, with Supabase's message. A filter is Supabase's: `column=operator.value`, with `eq`, `neq`, `lt`, `lte`, `gt`, `gte`, `in.(a,b)`, `like`, `ilike`, `match`, `imatch`, `is` and `isdistinct`, `not.` before the operator, and several conditions joined by commas, all of which must hold. Postgres compares each value as the column's type. `select` of columns is not supported yet; private channels neither.
|
|
28
|
+
|
|
29
|
+
## Broadcast and presence
|
|
30
|
+
|
|
31
|
+
Channels on the same topic exchange broadcasts and see each other's presence, as on Supabase:
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
const room = supabase.channel('room', { config: { broadcast: { self: false, ack: true }, presence: { key: 'alice' } } })
|
|
35
|
+
room
|
|
36
|
+
.on('broadcast', { event: 'cursor' }, ({ payload }) => console.log(payload))
|
|
37
|
+
.on('presence', { event: 'sync' }, () => console.log(room.presenceState()))
|
|
38
|
+
.subscribe(async (status) => {
|
|
39
|
+
if (status !== 'SUBSCRIBED') return
|
|
40
|
+
await room.track({ online_at: new Date().toISOString() })
|
|
41
|
+
await room.send({ type: 'broadcast', event: 'cursor', payload: { x: 1, y: 2 } })
|
|
42
|
+
})
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
A broadcast reaches the topic's other channels, and the sender's own with `self`; with `ack`, `send` resolves once the server has it. Binary payloads go to clients on the default serializer (`vsn` 2.0.0) only. Presence follows Phoenix Presence: a channel tracks one presence under its `presence.key` (a random one when it names none), tracking again replaces it, and channels with presence enabled get the state when they join and each join and leave after, their own included. A channel that leaves, closes or whose token expires leaves the presence it tracked.
|
|
46
|
+
|
|
47
|
+
Broadcasts and presence go between the channels of one serving process, which is how a cloud app runs; several processes behind one address do not reach each other's channels. Sending without a joined channel, which supabase-js does over `POST /realtime/v1/api/broadcast`, is not supported.
|
|
28
48
|
|
|
29
49
|
## What a subscriber receives
|
|
30
50
|
|