@protobase/cli 0.59.2 → 0.59.3

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.59.2";
2
+ var version = "0.59.3";
3
3
  //#endregion
4
4
  export { version };
@@ -1,5 +1,5 @@
1
1
  import { projectFiles, projectFunctions, projectJobs, projectNotifications, projectOptions, projectResources, projectWebhooks } from "./project-parts.js";
2
- import { buildAppAuth, buildAuthenticator, checkCallsOptions } from "@protobase/server/internal";
2
+ import { buildAppAuth, buildAuthenticator, checkCallsOptions, checkStatusOptions } from "@protobase/server/internal";
3
3
  //#region src/config/build-project.ts
4
4
  /**
5
5
  * The app's own mailer, the default export of its auth/mailer.ts: what sign-in and the jobs (`context.mail`) both send
@@ -70,6 +70,7 @@ const buildProject = async (config, database) => {
70
70
  ...webhooks && { webhooks },
71
71
  ...config.realtime && { realtime: config.realtime },
72
72
  ...notifications && { notifications },
73
+ ...config.status && { status: checkStatusOptions(config.status) },
73
74
  ...config.calls && { calls: checkCallsOptions(config.calls) },
74
75
  ...mailer && { mailer },
75
76
  ...config.mobile && { mobile: config.mobile },
package/dist/dev/entry.js CHANGED
@@ -7,7 +7,7 @@ import { devRealtimePrune } from "./dev-prune.js";
7
7
  import { devDatabase, loadDevConfig } from "./project.js";
8
8
  import { withDevServiceWorker } from "./service-worker-route.js";
9
9
  import { setMissing, supabaseEnv } from "./supabase-env.js";
10
- import { apiKeySettings, assistantSettings, authSchemaDrift, authStoreTables, checkAi, checkAuthSchema, checkChanges, checkChannelSends, checkComments, checkComputed, checkNotificationsSchema, checkQueryRunner, checkRealtimeRelay, checkResourcesOutsideAuthStore, checkWebhooksSchema, configExports, hasUsers, relayed, sqlSends } from "@protobase/server";
10
+ import { apiKeySettings, assistantSettings, authSchemaDrift, authStoreTables, checkAi, checkAuthSchema, checkChanges, checkChannelSends, checkComments, checkComputed, checkNotificationsSchema, checkQueryRunner, checkRealtimeRelay, checkResourcesOutsideAuthStore, checkStatusSchema, checkWebhooksSchema, configExports, hasUsers, relayed, sqlSends } from "@protobase/server";
11
11
  import { upgradeWebSocket } from "@hono/node-server";
12
12
  import { Hono } from "hono";
13
13
  //#region src/dev/entry.ts
@@ -40,6 +40,7 @@ if (project.webhooks) await checkWebhooksSchema(db, project.webhooks);
40
40
  if (relayed(project.realtime)) await checkRealtimeRelay(db);
41
41
  if (sqlSends(project.realtime)) await checkChannelSends(db);
42
42
  if (project.notifications) await checkNotificationsSchema(db, project.notifications, project.auth);
43
+ if (project.status) await checkStatusSchema(db, project.status, project.auth);
43
44
  setMissing(process.env, supabaseEnv({
44
45
  url: process.env.PROTOBASE_DEV_URL,
45
46
  databaseUrl: process.env.PROTOBASE_DATABASE_URL,
@@ -5,6 +5,7 @@ import { loadSourceConfig } from "../config/source-config.js";
5
5
  import { openAppDatabase } from "../project/pg-db.js";
6
6
  import pg from "pg";
7
7
  import { assistantSettings, authStoreTables, configExports } from "@protobase/server";
8
+ import { checkStatusOptions } from "@protobase/server/internal";
8
9
  //#region src/migration/load-project.ts
9
10
  /**
10
11
  * The project in `dir` as `protobase dev` merges it, for what its database needs: protobase.config.ts, with the
@@ -40,6 +41,7 @@ const migrationProject = async (config, url) => {
40
41
  ...webhooks && { webhooks },
41
42
  ...config.realtime && { realtime: config.realtime },
42
43
  ...notifications && { notifications },
44
+ ...config.status && { status: checkStatusOptions(config.status) },
43
45
  jobs,
44
46
  readOnlyQueries: assistantSettings(config.assistant, process.env)?.kind === "built-in",
45
47
  authTables: auth ? authStoreTables(auth) : {
@@ -1,5 +1,5 @@
1
1
  import { authMigrationTitle } from "../auth/migration-file.js";
2
- import { authSchemaMigration, changesMigration, channelSendsMigration, commentsMigration, computedMigration, isCaptured, jobsSchemaMigration, notificationsMigration, queryRunnerMigration, realtimeRelayMigration, relayed, sqlSends, webhooksMigration } from "@protobase/server";
2
+ import { authSchemaMigration, changesMigration, channelSendsMigration, commentsMigration, computedMigration, isCaptured, jobsSchemaMigration, notificationsMigration, queryRunnerMigration, realtimeRelayMigration, relayed, sqlSends, statusMigration, webhooksMigration } from "@protobase/server";
3
3
  //#region src/migration/parts.ts
4
4
  /** Every feature the project's config enables, in the order their files are written. */
5
5
  const migrationParts = (project) => {
@@ -46,6 +46,11 @@ const migrationParts = (project) => {
46
46
  title: "The tables of notifications",
47
47
  sql: () => notificationsMigration(project.db, project.notifications, project.auth)
48
48
  }] : [],
49
+ ...project.status ? [{
50
+ name: "status",
51
+ title: "The statuses table of people's own status",
52
+ sql: () => statusMigration(project.db, project.status, project.auth)
53
+ }] : [],
49
54
  ...relayed(project.realtime) ? [{
50
55
  name: "realtime_relay",
51
56
  title: "The relay of Realtime broadcasts and presence between the processes serving the app",
@@ -28,6 +28,7 @@ const projectAdmin = (project, db, ui, reporter, upgradeWebSocket) => {
28
28
  ...project.webhooks && { webhooks: project.webhooks },
29
29
  ...project.realtime && { realtime: project.realtime },
30
30
  ...project.notifications && { notifications: project.notifications },
31
+ ...project.status && { status: project.status },
31
32
  ...project.calls && { calls: project.calls },
32
33
  ...project.mobile && { mobile: project.mobile },
33
34
  ...project.app && { app: project.app },
@@ -9,7 +9,7 @@ import { startCleanupTimer } from "./cleanup-timer.js";
9
9
  import { closeSockets } from "./close-sockets.js";
10
10
  import { servedRelease } from "./mobile-release.js";
11
11
  import pg from "pg";
12
- import { assistantSettings, authStoreTables, backgroundSettled, checkAi, checkAuthSchema, checkChanges, checkChannelSends, checkComments, checkComputed, checkJobsSchema, checkNotificationsSchema, checkQueryRunner, checkRealtimeRelay, checkResourcesOutsideAuthStore, checkWebhooksSchema, configExports, createFileCleanup, relayed, sqlSends, startJobs } from "@protobase/server";
12
+ import { assistantSettings, authStoreTables, backgroundSettled, checkAi, checkAuthSchema, checkChanges, checkChannelSends, checkComments, checkComputed, checkJobsSchema, checkNotificationsSchema, checkQueryRunner, checkRealtimeRelay, checkResourcesOutsideAuthStore, checkStatusSchema, checkWebhooksSchema, configExports, createFileCleanup, relayed, sqlSends, startJobs } from "@protobase/server";
13
13
  import { createAdaptorServer, upgradeWebSocket } from "@hono/node-server";
14
14
  //#region src/serve/lifecycle.ts
15
15
  const listen = (server, port) => new Promise((resolve, reject) => {
@@ -46,6 +46,7 @@ const startServe = async ({ config, env, openDb = (url) => openAppDatabase(pg, u
46
46
  if (env.startupChecks && relayed(project.realtime)) await checkRealtimeRelay(db);
47
47
  if (env.startupChecks && sqlSends(project.realtime)) await checkChannelSends(db);
48
48
  if (env.startupChecks && project.notifications) await checkNotificationsSchema(db, project.notifications, project.auth);
49
+ if (env.startupChecks && project.status) await checkStatusSchema(db, project.status, project.auth);
49
50
  const { admin, jobs: definitions } = projectAdmin(project, db, ui, reporter, upgradeWebSocket);
50
51
  if (env.startupChecks && definitions.length > 0) await checkJobsSchema(db);
51
52
  const jobs = definitions.length > 0 ? await startJobs({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protobase/cli",
3
- "version": "0.59.2",
3
+ "version": "0.59.3",
4
4
  "description": "The protobase command: scaffold, doctor, dev, build and serve a Protobase project.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -42,12 +42,12 @@
42
42
  "dependencies": {
43
43
  "@better-auth/core": "^1.7.12",
44
44
  "@hono/node-server": "^2.1.3",
45
- "@protobase/config": "0.59.2",
46
- "@protobase/layout": "0.59.2",
47
- "@protobase/query": "0.59.2",
48
- "@protobase/schema": "0.59.2",
49
- "@protobase/server": "0.59.2",
50
- "@protobase/ui": "0.59.2",
45
+ "@protobase/config": "0.59.3",
46
+ "@protobase/layout": "0.59.3",
47
+ "@protobase/query": "0.59.3",
48
+ "@protobase/schema": "0.59.3",
49
+ "@protobase/server": "0.59.3",
50
+ "@protobase/ui": "0.59.3",
51
51
  "@react-email/render": "^2.1.0",
52
52
  "@scalar/hono-api-reference": "^0.12.10",
53
53
  "@tailwindcss/vite": "^4.3.3",
@@ -89,6 +89,7 @@ Reference:
89
89
  - When running background jobs → read [Jobs](references/reference/jobs.md)
90
90
  - When sending email → read [Email](references/reference/email.md)
91
91
  - When registering users' devices for push notifications → read [Notifications](references/reference/notifications.md)
92
+ - When people should set themselves busy, do not disturb or a status text, or see others' beside their names → read [Status](references/reference/status.md)
92
93
  - When adding audio and video calls, through LiveKit or peer to peer → read [Calls](references/reference/calls.md)
93
94
  - When setting roles, capabilities and row filters → read [Access](references/reference/access.md)
94
95
  - When configuring sign-in, tokens and the auth schema → read [Login with Better Auth](references/reference/auth.md)
@@ -8,7 +8,7 @@ The sidebar, the user menu, the bottom bar on phones and the global search.
8
8
  - [Recent records](../reference/sidebar.md#recent-records): A sidebar entry lists a few records under it, with status dots or as titles alone, and marked per reader, such as unread ones in bold with a count.
9
9
  - [Create link](../reference/sidebar.md#create-link): A sidebar entry links to its create form, such as "New message" under Direct messages, for whoever may create.
10
10
  - [The current organization](../reference/sidebar.md#the-current-organization): A sidebar entry opens its list on the organization you work in, which you can clear to see every organization you are a member of.
11
- - [User menu](../reference/user-menu.md): Account pages, help links, security settings, the theme switch and Sign out.
11
+ - [User menu](../reference/user-menu.md): Account pages, help links, security settings, setting a status, the theme switch and Sign out.
12
12
  - [Bottom bar](../reference/bottom-bar.md): On phones, tabs along the bottom for each role's main screens.
13
13
  - [Global search](../reference/client.md#global-search): A search box, also on Cmd+K or Ctrl+K, finds records in every resource and jumps to pages and New forms.
14
14
  - Breadcrumbs: The top bar shows the group, list and record you are on, each a link back.
@@ -13,4 +13,5 @@ A bell in the top bar and push to browsers and phones, for what your app tells i
13
13
  - [Web Push](../reference/notifications.md#web-push) (beta): Notifications reach desktop and Android browsers and home-screen web apps on iPhone through Web Push, with keys you generate.
14
14
  - Push on Android (coming soon): Notifications reach the Android build of the app on a user's phones.
15
15
  - Push on iOS (coming soon): Notifications reach the iOS build of the app on a user's iPhones and iPads.
16
+ - [Do not disturb](../reference/status.md#do-not-disturb) (beta): While someone is on do not disturb, sends push nothing to their devices and keep inbox notifications in the bell for later.
16
17
  - [Notification bell](../reference/notifications.md#the-bell) (beta): The top bar shows how many inbox notifications are unread; its panel opens each one, marks them read and turns push on or off for this device.
@@ -25,6 +25,7 @@ Sign-in methods, users, roles, organizations and tokens.
25
25
  - [Staff sign-in](../reference/auth.md#staff-sign-in): The team that runs an app signs in as a person to help them, with a reason and a log entry.
26
26
  - [Roles](../reference/auth.md#roles): A user holds one or more roles and switches between them without signing in again.
27
27
  - [Organizations](../reference/auth.md#organizations): People work in one organization at a time, see only its records, and are invited with their own roles.
28
+ - [Status](../reference/status.md) (beta): People set themselves busy or do not disturb, with a text of their own such as "Having lunch" and a time it clears, from the user menu; the people they share an organization with see it beside their name.
28
29
  - [API tokens](../reference/auth.md#tokens-and-roles): A signed-in session gets short-lived tokens for the API.
29
30
  - [Immediate revocation](../reference/auth.md#when-a-token-stops-working): A ban, removed role or ended session takes effect on the next request.
30
31
  - [Signing key rotation](../reference/auth.md#signing-keys): The keys that sign the tokens are replaced every 30 days on their own, and old ones keep verifying the tokens they signed for a week.
@@ -2,7 +2,7 @@
2
2
 
3
3
  # Jobs and events options
4
4
 
5
- The config keys of what the app does in the background and records as it changes, jobs, events, history, webhooks and notifications, with their types and defaults, and the files where a job's run and the stores of its own go.
5
+ The config keys of what the app does in the background and records as it changes, jobs, events, history, webhooks, notifications and status, with their types and defaults, and the files where a job's run and the stores of its own go.
6
6
 
7
7
  The keys of the app's background work and of what it keeps as records change, at the top level of [`protobase.config.ts`](../config.md).
8
8
 
@@ -265,3 +265,25 @@ The history table, each user's inbox: its name, and its columns named otherwise
265
265
  ```ts
266
266
  export default defineConfig({ notifications: { history: { table: 'inbox_items' } } })
267
267
  ```
268
+
269
+ ## status
270
+
271
+ - **Type:** `{ schema?: string }`
272
+ - **Default:** off; `{}` turns it on
273
+
274
+ People set their own status, busy, do not disturb or a text of their own, which the people they share an organization with see, and do not disturb holds their pushes. It needs `auth` with organizations, and its table is written by `protobase migration`. See [Status](../status.md).
275
+
276
+ ```ts
277
+ export default defineConfig({ auth: { organizations: true }, status: {} })
278
+ ```
279
+
280
+ ## status.schema
281
+
282
+ - **Type:** `string`
283
+ - **Default:** `status`
284
+
285
+ The schema of the statuses table.
286
+
287
+ ```ts
288
+ export default defineConfig({ status: { schema: 'presence' } })
289
+ ```
@@ -30,7 +30,7 @@ Each key is described with its type and default in the option pages:
30
30
  | [Sign-in options](config/sign-in.md) | `auth`, `authenticate`, `signingKeyDays`, `signingKeyGraceDays` |
31
31
  | [API options](config/api.md) | `apiPath`, `apiKeys`, `cors`, `defaultAccess`, `rowPermissions`, `statementTimeoutMs`, `scanGuard`, `errorReporting`, `writeHooks`, `mcpEndpoint`, `remoteResources`, `runtimeUpdates`, `realtime`, `calls` |
32
32
  | [Admin app options](config/admin-app.md) | `assistant`, `maps`, `plugins` |
33
- | [Jobs and events options](config/jobs-and-events.md) | `jobs`, `events`, `history`, `webhooks`, `notifications` |
33
+ | [Jobs and events options](config/jobs-and-events.md) | `jobs`, `events`, `history`, `webhooks`, `notifications`, `status` |
34
34
  | [Files options](config/files.md) | `files` |
35
35
 
36
36
  ## Config types
@@ -335,7 +335,7 @@ export const Channel = ({ messages, sent, members, onSend, onLoadEarlier }: Chan
335
335
 
336
336
  ### Members' names
337
337
 
338
- The author is a user id, and `useMembers()` from `@protobase/ui` turns it into a name: the members of the organization the signed-in person works in, `{ id, name, image? }` by name, with `id` the user id that `.author()` stores and that `onSend`'s mentions hold. Every member reads it, owners, admins and members alike; it holds no email addresses. It is a TanStack Query result (`data`, `isLoading`, `error`) with `member(id)`, which finds one and, for an id it does not know, such as a newcomer's first message, reads the list again once it is 10 seconds old; it is also read again when the window regains focus and the list is 30 seconds old. It needs [organizations](auth.md#organizations): without them, `error` says so.
338
+ The author is a user id, and `useMembers()` from `@protobase/ui` turns it into a name: the members of the organization the signed-in person works in, `{ id, name, image? }` by name, with `id` the user id that `.author()` stores and that `onSend`'s mentions hold. Every member reads it, owners, admins and members alike; it holds no email addresses. It is a TanStack Query result (`data`, `isLoading`, `error`) with `member(id)`, which finds one and, for an id it does not know, such as a newcomer's first message, reads the list again once it is 10 seconds old; it is also read again when the window regains focus and the list is 30 seconds old. It needs [organizations](auth.md#organizations): without them, `error` says so. In an app with [status](status.md#in-the-app), each member carries their `status` too, read again every 15 seconds.
339
339
 
340
340
  ```tsx
341
341
  import { ChatMessage, Composer, MentionedText, useMembers } from '@protobase/ui'
@@ -112,6 +112,8 @@ A send checks no permission. A device send reaches the devices whatever user hol
112
112
 
113
113
  A user send reaches the user's devices as they are when the job runs. A device that moved to someone else, or was removed, gets nothing. With Protobase's auth, a device whose sign-in session has [ended](#devices) is removed instead; a send whose devices' sessions cannot be read pushes to none of them and is retried. With an app's own authenticator, a device keeps receiving its user's notifications until it is removed. When a push service reports a device gone, the device is removed. A device whose push service asks to try again later is tried once more, on the job's next try, and then given up on without being removed. <gap>A push service's own wait before a retry cannot set when the device is tried again because retries follow the job's backoff and timing them per device is not implemented.</gap> A sender that fails is retried with its devices, up to 5 tries of the job. Devices of a kind without a sender are skipped. Without any sender, a send for the inbox is kept in the history and a send that is not does nothing.
114
114
 
115
+ In an app with [status](status.md#do-not-disturb), a user on do not disturb when the send's job runs gets nothing pushed, by any sender, built-in or the app's own, and a send to devices holds their devices too; a send for the inbox still keeps the notification in their history, which the bell shows unread. Nothing of the send is pushed to them once do not disturb ends, and the others in the send are pushed as usual.
116
+
115
117
  ## History
116
118
 
117
119
  :::caution[Beta]
@@ -0,0 +1,97 @@
1
+ <!-- Generated by scripts/protobase-skill.ts from docs/website/src/content/docs/reference/status.md: run `bun run docs:skill`, do not edit. -->
2
+
3
+ # Status
4
+
5
+ People set their own status, busy, do not disturb or a text such as "Having lunch", which the people they share an organization with see beside their name, and do not disturb holds their push notifications.
6
+
7
+ ## Turning it on
8
+
9
+ :::caution[Beta]
10
+ A status is the same in every organization; a status per organization and do-not-disturb schedules are not part of it.
11
+ :::
12
+
13
+ A status says whether someone wants to be reached: an availability, busy or do not disturb, and a short text of their own, such as "Having lunch" or "On vacation 🌴". You turn it on in `protobase.config.ts`:
14
+
15
+ ```ts
16
+ import { defineConfig } from '@protobase/config'
17
+
18
+ export default defineConfig({
19
+ auth: { organizations: true },
20
+ status: {},
21
+ })
22
+ ```
23
+
24
+ Then run `protobase migration`, which writes the statuses table, `status.statuses`, as a migration of the project's own, and apply it with the project's migrations. `status: { schema: 'presence' }` puts the table in another schema. `protobase dev` and `protobase serve` refuse to start while the table is missing. Without `status` there is none of it: no menu item, no endpoints, no table and no migration, and notifications go out as before.
25
+
26
+ People see the statuses of those they share an [organization](auth.md#organizations) with, so status needs organizations: an app without them stops at startup, and `protobase migration` says why.
27
+
28
+ ## Setting a status
29
+
30
+ Someone signed in as themselves opens "Set a status" in the [user menu](user-menu.md) and picks:
31
+
32
+ - an availability: automatic, the default, which says nothing; busy; or do not disturb;
33
+ - a text of at most 100 characters, one line of plain text; an emoji typed in it is one character;
34
+ - when it clears: never, in 30 minutes, 1 hour or 4 hours, at the end of today or of this week (midnight, Sunday night for the week, in their own time zone), or at a date and time they choose.
35
+
36
+ Their status then shows by their name at the bottom of the sidebar, and the item shows it; they change it or clear it there at any time. Staff [signed in as the person](auth.md#staff-sign-in) see no item.
37
+
38
+ Each person has one status, shown in every organization they are in. Only they set it: the server takes the person from the session, never from the request, and refuses staff signed in as them, visitors and outside apps acting for them, such as an MCP client. A text with control characters, a line break among them, or over 100 characters is refused with a `400` that says why, and so is a clear time that has passed. The text is always shown as text, never as HTML.
39
+
40
+ | Request | |
41
+ | --- | --- |
42
+ | `GET /api/status` | the caller's own status, `{ status }`, `null` without one |
43
+ | `PUT /api/status` | sets it from `{ availability, text, clearsAt }`, each required, `text` and `clearsAt` `null` for none and never; answers `{ status }` |
44
+ | `DELETE /api/status` | clears it; answers `204` |
45
+ | `GET /api/status/people` | `{ statuses }`, the statuses of everyone who shares an organization with the caller, their own among them |
46
+
47
+ A status is `{ userId, availability, text, clearsAt }`, with `availability` one of `automatic`, `busy` and `do_not_disturb`, and `clearsAt` an ISO time or `null`.
48
+
49
+ ## Who sees it
50
+
51
+ The members of every organization the person is in see their status. Someone who shares no organization with them gets nothing, as for a person they cannot see: `GET /api/status/people` leaves them out. A visitor, signed in as no one, is refused with a `401`. <gap>`GET /api/status/people` cannot page because paging statuses is not implemented, so it answers every status set by those who share an organization with the caller, which suits a team, not thousands of people.</gap>
52
+
53
+ ## How it clears
54
+
55
+ A status ends at its clear time for everyone, also while the person has no page open: the server reads a status whose time has passed as none, and do not disturb ends with it.
56
+
57
+ A page reads the statuses again every 15 seconds while it is in view, and when it comes back into view, over the connections it already has, so another person's change, or a status whose time has passed, shows within 15 seconds without reloading. It opens no connection of its own: a page near the 6 connections a browser keeps per server under HTTP/1.1 keeps working.
58
+
59
+ ## Do not disturb
60
+
61
+ While someone is on do not disturb, when a [send](notifications.md#sending)'s job runs, the send pushes to none of their devices, through any sender, built-in or the app's own. A send for the inbox still keeps the notification in their history, so the bell shows it and counts it unread. Nothing of that send is pushed later, when do not disturb ends. The others in the same send are pushed as usual. A send to devices, `{ deviceIds }`, holds the devices of someone on do not disturb too. Busy is a mark only, and holds nothing.
62
+
63
+ Your own server code asks the same question with `onDoNotDisturb(db, statusNames(options), userIds)` from `@protobase/server`, which answers the set of those on do not disturb now, so whatever else alerts people holds it alike.
64
+
65
+ ## In the app
66
+
67
+ The organization's members page shows each member's status beside their name. `useMembers()` from `@protobase/ui` gives each member their `status` when they have one, beside their name and photo, and `useStatuses()` the statuses alone. `StatusMark` draws a status beside a name: a mark for busy, one for do not disturb, and the text, in full or, with `textShown="hover"`, on hover. Who is online or away is each app's own, from its [presence](channels.md#presence); pass its mark as `presence`, and `StatusMark` draws it first, so the two sit side by side:
68
+
69
+ ```tsx
70
+ import { StatusMark, useMembers } from '@protobase/ui'
71
+
72
+ export const Person = ({ id, online }: { id: string; online: boolean }) => {
73
+ const person = useMembers().member(id)
74
+ if (!person) return null
75
+ const dot = <span role="img" aria-label={online ? 'Online' : 'Away'} className={online ? 'size-2 rounded-full bg-success' : 'size-2 rounded-full bg-muted'} />
76
+ return (
77
+ <span className="flex items-center gap-1.5">
78
+ {person.name}
79
+ <StatusMark status={person.status} presence={dot} textShown="hover" />
80
+ </span>
81
+ )
82
+ }
83
+ ```
84
+
85
+ `StatusMark` draws nothing of a status whose clear time has passed, even before the page reads the statuses again.
86
+
87
+ ## The client
88
+
89
+ `client.status` of `@protobase/client` reads and sets the signed-in person's own status and reads the others':
90
+
91
+ ```ts
92
+ const lunch = await client.status.set({ availability: 'busy', text: 'Having lunch', clearsAt: new Date(Date.now() + 3_600_000).toISOString() })
93
+ const everyone = await client.status.people()
94
+ await client.status.clear()
95
+ ```
96
+
97
+ `set` rejects with an `ApiError` whose `slug` is `invalid-status-text`, `invalid-clear-time` or `invalid-status` for what the server refuses, and `own-sign-in-only` for staff signed in as the person.
@@ -4,7 +4,7 @@
4
4
 
5
5
  The user menu at the bottom of the sidebar, with the app's own account pages and links.
6
6
 
7
- The signed-in user sits at the bottom of the sidebar. Clicking them opens a menu with their name and email, which link to their account, the app's own pages, the theme switch, and "Sign out". Account pages (organization, billing, users) and help links belong here rather than among the working resources.
7
+ The signed-in user sits at the bottom of the sidebar. Clicking them opens a menu with their name and email, which link to their account, "Set a status" in an app with [status](status.md), the app's own pages, the theme switch, and "Sign out". Account pages (organization, billing, users) and help links belong here rather than among the working resources.
8
8
 
9
9
  Export one [`userMenu(...)`](https://docs.protobase.net/api/schema/functions/usermenu/) from `config/index.ts`:
10
10