@protobase/cli 0.121.5 → 0.121.7

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.121.5";
2
+ var version = "0.121.7";
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.121.5",
3
+ "version": "0.121.7",
4
4
  "description": "The protobase command: scaffold, doctor, dev, build and serve a Protobase project.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -43,13 +43,13 @@
43
43
  "dependencies": {
44
44
  "@better-auth/core": "^1.7.12",
45
45
  "@hono/node-server": "^2.1.3",
46
- "@protobase/config": "0.121.5",
47
- "@protobase/layout": "0.121.5",
48
- "@protobase/query": "0.121.5",
49
- "@protobase/schema": "0.121.5",
50
- "@protobase/server": "0.121.5",
51
- "@protobase/ui": "0.121.5",
52
- "@protobase/workflows": "0.121.5",
46
+ "@protobase/config": "0.121.7",
47
+ "@protobase/layout": "0.121.7",
48
+ "@protobase/query": "0.121.7",
49
+ "@protobase/schema": "0.121.7",
50
+ "@protobase/server": "0.121.7",
51
+ "@protobase/ui": "0.121.7",
52
+ "@protobase/workflows": "0.121.7",
53
53
  "@react-email/render": "^2.1.0",
54
54
  "@scalar/hono-api-reference": "^0.12.10",
55
55
  "@sentry/vite-plugin": "^11.10.0",
@@ -5,6 +5,7 @@
5
5
  Audio and video calls between an app's users, through LiveKit or peer to peer, with Protobase deciding who is in a call and who hears whom.
6
6
 
7
7
  - [Calls](../reference/calls.md) (beta): Voice and video calls on any record, with screen sharing, a ready-made call view and ringing on any open page, and guest links that let someone from outside join one call.
8
+ - [Calls on conversation pages](../reference/ui-config.md#calls) (beta): A configured conversation starts and joins its record's call from its header, and shows the call beside the messages, or above them at mobile width, with no component of your own.
8
9
  - [LiveKit](../reference/calls.md#livekit) (in development): The media goes through a LiveKit server, self-hosted or LiveKit Cloud, which Protobase speaks to for each member.
9
10
  - [Peer to peer](../reference/calls.md#peer-to-peer) (in development): With no media server, the members' browsers send their media straight to each other, for small calls.
10
11
  - [Admitting members](../reference/calls.md#admitting-members) (in development): A function of your own admits the caller to a call with what they may send and whose tracks they hear.
@@ -11,7 +11,7 @@ The page of one record, with its sections, related records, galleries, charts an
11
11
  - [Record pages that open another](../reference/ui-config.md#a-record-page-that-opens-another): A record's page opens another address built from its fields in its place, such as a workflow run opening its workflow's page with the run shown.
12
12
  - [Record page opens elsewhere](../reference/ui-config.md#open-elsewhere) (beta): A view can send its record's address to another page its fields name, such as a message opening in its conversation, so search results and links land where the record is read.
13
13
  - [Full-area record pages](../reference/ui-config.md#full-area-record-pages) (beta): A view draws its record pages with a component of its own that fills the area beside the sidebar and under the top bar, such as a chat channel, and links to the standard page.
14
- - [Conversation pages](../reference/ui-config.md#conversation-pages) (beta): A record's page is its conversation, configured with no component of your own: a header with its title, topic and details, its messages grouped by day and author with mentions and edits shown, and a box that sends one, opening on a New messages line at the reader's place, on the web and at mobile width.
14
+ - [Conversation pages](../reference/ui-config.md#conversation-pages) (beta): A record's page is its conversation, configured with no component of your own: a header with its title, topic and details, its messages grouped by day and author with mentions and edits shown, and a box that sends one, opening on a New messages line at the reader's place, on the web and at mobile width. People react to its messages, edit and delete them and reply in threads beside the conversation, by pointer or touch, and start or join the record's call from its header, shown beside the messages, or above them at mobile width.
15
15
  - [Read view and edit](../reference/ui-config.md#read-view-and-edit): A record opens as a read-only fact sheet or a form, and Edit opens the form at its own address.
16
16
  - [Unsaved edits](../reference/ui-config.md#editing-a-record): Unsaved changes to a record stay in the browser and can be resumed, and leaving a form, a dialog or a comment with changes asks first.
17
17
  - [Record forms](../reference/ui-config.md#editing-a-record): Relations are picked from a list that narrows as you type, numbers are read as the browser's language writes them, and a refused save says under each field what is wrong.
@@ -125,6 +125,8 @@ await call.publish({ camera: media.getVideoTracks()[0], microphone: media.getAud
125
125
  | `connections()` | How each of the member's connections fares now, to each other member peer-to-peer or to the media server with LiveKit: `{ member?, state, roundTripMs?, lostRatio? }`, the round trip and the share of received media lost once connected. |
126
126
  | `leave()` | Leaves the call. |
127
127
 
128
+ `client.functionSocketUrl(name, query)` of `@protobase/client` gives the socket of your function beside the client's API, such as `wss://app.example/api/functions/meeting?meeting=7` for `('meeting', { meeting: '7' })`, to pass as `url`.
129
+
128
130
  `call.id` is the call, as the record's calls list it and `calls.remove` takes it. `onSpeakers` gets who speaks how loudly, and `onUnpublished` a source the media server stopped, such as after the member lost the right to send.
129
131
 
130
132
  A call that is left rejects the join, or ends a joined call, with its reason in `onState`: `ended`, `removed` (by `calls.remove`, or by a check that refused the member), `full`, `refused` (the function refused the caller), or `unavailable`, when the server failed to take the member in `maxRetries` times in a row.
@@ -159,6 +161,8 @@ The view checks the microphone and camera first, with a preview of the camera, a
159
161
  | `url` | Your function's socket, which admits the member. |
160
162
  | `nameOf` | A person's name by the member your function admits them as, such as a user id; the member itself by default. |
161
163
 
164
+ A [conversation page](ui-config.md#calls) with `call` places the call view and the call mark for you.
165
+
162
166
  `CallView` is the view on its own, with `leave`, where Leave goes, in place of the record: for a call you place without the record's address.
163
167
 
164
168
  ### A record's call
@@ -775,7 +775,7 @@ The standard record page, with the layout's sections, the related records, Edit
775
775
  ### Conversation pages
776
776
 
777
777
  :::caution[Beta]
778
- A conversation page shows each message's text with its mentions and keeps line breaks, without markdown; it has no replies in threads, reactions, editing, deleting, files or calls yet.
778
+ A conversation page shows each message's text with its mentions and keeps line breaks, without markdown; it has no files yet, and a deleted message leaves no trace in its place.
779
779
  :::
780
780
 
781
781
  `.record({ conversation })` makes the record page the record's conversation, for a record that holds one, such as a chat channel, a direct message or a support case, with no component of the app's own. It fills the content area as a [full-area record page](#full-area-record-pages) does, on the web and at mobile width: a header row, the messages that point at the record, and a box that sends one, which stays in view while the messages scroll above it.
@@ -793,6 +793,17 @@ view<typeof channels>('channels').record({
793
793
  subtitle: 'topic',
794
794
  readPosition: { resource: 'read_positions', field: 'channel_id', message: 'last_read_id' },
795
795
  placeholder: 'Message the channel',
796
+ edit: true,
797
+ delete: { unless: 'reply_count > 0' },
798
+ reactions: {
799
+ resource: 'reactions',
800
+ field: 'message_id',
801
+ user: 'user_id',
802
+ emoji: 'emoji',
803
+ labels: { thumbs_up: { symbol: '👍', name: 'Thumbs up' }, heart: { symbol: '❤️', name: 'Heart' } },
804
+ },
805
+ thread: { field: 'thread_id', count: 'reply_count', last: 'last_reply_at' },
806
+ call: 'call',
796
807
  },
797
808
  })
798
809
  ```
@@ -811,11 +822,45 @@ view<typeof channels>('channels').record({
811
822
  | `readPosition` | Where each reader's read position is kept: `{ resource, field, message }`. |
812
823
  | `placeholder` | The hint in the empty box. |
813
824
  | `empty` | What the conversation says while it has no messages. |
825
+ | `edit` | `true`: a message's author changes its text and mentions in place, as the message resource's update access allows. |
826
+ | `delete` | `true`: anyone the message resource's delete access allows deletes a message, after confirming; or `{ unless }`, a condition on the message's own fields that keeps it, such as `reply_count > 0`. |
827
+ | `reactions` | Emoji reactions under each message: `{ resource, field, user, emoji, labels }`. |
828
+ | `thread` | Replies in a thread under a message, in a panel beside the conversation: `{ field, count, last }`. |
829
+ | `call` | The record's [call](calls.md), by the name of the [API function](../guides/api-functions.md) that admits people to it. |
814
830
 
815
- The header shows the record's title, which the top bar repeats at mobile width and so shows there only with `members`, the subtitle, and *Details*, a link to the record's standard page at `?standard=true`, with its sections, Edit and Delete. The latest 50 messages show oldest first, with *Load earlier messages* at the top for more. A day divider opens each day, and one person's messages sent within five minutes of each other show under their name once. A message resource with [`.live()`](live.md) shows new, changed and deleted messages as they happen. Every read goes through the reader's own access: a message they may not read never shows, and a reader who may not read the messages or a field each one needs gets the standard page. The box shows for a reader who may create messages.
831
+ The header shows the record's title, which the top bar repeats at mobile width and so shows there only with `members`, the subtitle, the call with `call`, and *Details*, a link to the record's standard page at `?standard=true`, with its sections, Edit and Delete. The latest 50 messages show oldest first, with *Load earlier messages* at the top for more. A day divider opens each day, and one person's messages sent within five minutes of each other show under their name once. A message resource with [`.live()`](live.md) shows new, changed and deleted messages as they happen. Every read goes through the reader's own access: a message they may not read never shows, and a reader who may not read the messages, a field each one needs or the fields of `thread` gets the standard page. The box shows for a reader who may create messages.
816
832
 
817
833
  With `readPosition`, the conversation opens on a *New messages* line above the first message someone else wrote since the reader's position, and moves the position to the newest message whenever they read to the end. The read position resource keeps one record per reader and record: its `.author()` is the reader, `field` is a relation to the record and `message` an integer field holding the key of the newest message read, so the message resource's key is one integer column that grows as messages arrive. The page reads and writes only the reader's own position. Without `readPosition`, there is no line and nothing is written.
818
834
 
835
+ #### Reactions, edits, deletes and threads
836
+
837
+ With `reactions`, `edit`, `delete` or `thread`, people act on the messages where they read them. With a pointer, a bar over a message's corner shows while they point at it or move into it with the keyboard: an emoji they have not reacted with yet, *Reply in thread*, *Edit* and *Delete*. On a touch screen, a tap or a long-press of half a second opens the same actions in a sheet from the bottom at mobile width, with every emoji and *Copy text*; a tap while the reader types only lowers the keyboard, and a button that only a keyboard or screen reader reaches opens the sheet too. The message's own links and buttons keep their tap and click. Each action shows only where the reader's access allows it, and the server checks every write again: a refused one changes nothing and shows the server's reason.
838
+
839
+ - **Reactions**: `resource` keeps one record per person, message and emoji: `field` is its filterable relation to the message, `user` the text field of the user id of the person who reacted, set by the server, such as its `.author()`, and `emoji` an enum field whose values, in their order, are the emoji offered. `labels` gives each value its `symbol` and its `name`, which a screen reader reads. Under a message, one chip per emoji shows how many reacted, naming them on hover: pressing your own takes it back, and another's adds yours. The reactions of a page of messages are read together with it, and with [`.live()`](live.md) they change as people react.
840
+ - **Edit**: *Edit* turns the author's message into a box with its mentions kept: Enter saves, Shift+Enter starts a new line and Escape cancels.
841
+ - **Delete**: *Delete* asks before the message goes for everyone. A reader who may not read the fields `unless` reads gets no *Delete*.
842
+ - **Threads**: `field` is the filterable relation of the messages to themselves that holds a reply's first message, empty for a message of the conversation itself, `count` an integer field holding a first message's number of replies and `last` a date or timestamp field holding when its last reply came, both kept by the database, such as by a trigger. The conversation shows only messages outside threads; under a message with replies, a link names how many and when the last came. It and *Reply in thread* open the thread at `?thread=<key>`, so a link can open it too: in a panel beside the conversation, covering the screen at mobile width, with the first message, its replies and a box of its own that replies in the thread. An address naming a message of another conversation opens no thread there. A reply gets its first message's conversation from the box, so keep the two the same in the database, such as by a check in the trigger that counts the replies, as an API create can set them apart.
843
+
844
+ #### Calls
845
+
846
+ With `call`, people start or join the record's call from the conversation's header, and talk in it beside the messages, while what they write stays the conversation's own messages. `call` names the [API function](../guides/api-functions.md) that admits people to the call with `calls.join`, as in [Admitting members](calls.md#admitting-members); the page opens its socket with the record's key as `key`:
847
+
848
+ ```ts
849
+ // functions/call.ts
850
+ import { defineFunction } from '@protobase/server'
851
+
852
+ export default defineFunction(async (request, { session, acceptWebSocket, calls }) => {
853
+ const key = new URL(request.url).searchParams.get('key')!
854
+ return acceptWebSocket(await calls.join({ record: { resource: 'channels', key }, member: String(session.user.id), publish: true }))
855
+ })
856
+ ```
857
+
858
+ The header shows *Start call* while no call goes on, and "Call in progress · 3 · Join" while one does, live, as the [call mark](calls.md#a-records-call) does. *Start call* and *Join* are links to the record's page joining its call, `?call=join`, which shows the [call view](calls.md#the-call-view) beside the messages, or above them at mobile width, each taking half the space, so the box stays in view. People in the call are named after the organization's members. A thread opens after both, covering the screen at mobile width while the call goes on under it, and opening or closing a thread keeps the call. *Leave* goes back to the conversation alone.
859
+
860
+ <gap>Joining or leaving the call from a conversation page cannot keep an open thread because the call's links do not carry the page's other address values.</gap>
861
+
862
+ <gap>A conversation page cannot offer *Edit* when its `sender` is a relation because matching a related record to the reader is not implemented; a `sender` of user ids, such as the resource's `.author()`, gets it.</gap>
863
+
819
864
  <gap>A conversation page cannot open at a given message, such as a search result, because opening a conversation at a message is not implemented.</gap> <gap>A conversation page cannot show a message's markdown because rendering markdown together with mentions is not implemented.</gap>
820
865
 
821
866
  ### Focus pages