@protobase/cli 0.53.8 → 0.54.1
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/cli/package.js +1 -1
- package/package.json +7 -7
- package/skills/protobase/references/features/navigation.md +1 -1
- package/skills/protobase/references/features/your-own-code.md +1 -0
- package/skills/protobase/references/reference/auth.md +1 -1
- package/skills/protobase/references/reference/custom-components.md +25 -0
- package/skills/protobase/references/reference/sidebar.md +12 -6
package/dist/cli/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.54.1",
|
|
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.
|
|
46
|
-
"@protobase/layout": "0.
|
|
47
|
-
"@protobase/query": "0.
|
|
48
|
-
"@protobase/schema": "0.
|
|
49
|
-
"@protobase/server": "0.
|
|
50
|
-
"@protobase/ui": "0.
|
|
45
|
+
"@protobase/config": "0.54.1",
|
|
46
|
+
"@protobase/layout": "0.54.1",
|
|
47
|
+
"@protobase/query": "0.54.1",
|
|
48
|
+
"@protobase/schema": "0.54.1",
|
|
49
|
+
"@protobase/server": "0.54.1",
|
|
50
|
+
"@protobase/ui": "0.54.1",
|
|
51
51
|
"@react-email/render": "^2.1.0",
|
|
52
52
|
"@scalar/hono-api-reference": "^0.12.10",
|
|
53
53
|
"@tailwindcss/vite": "^4.3.3",
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
The sidebar, the user menu, the bottom bar on phones and the global search.
|
|
6
6
|
|
|
7
7
|
- [Sidebar](../reference/sidebar.md): Resources and pages in groups, in the order you set.
|
|
8
|
-
- [Recent records](../reference/sidebar.md#recent-records): A sidebar entry lists a few records under it with status dots.
|
|
8
|
+
- [Recent records](../reference/sidebar.md#recent-records): A sidebar entry lists a few records under it, with status dots or as titles alone.
|
|
9
9
|
- [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.
|
|
10
10
|
- [User menu](../reference/user-menu.md): Account pages, help links, security settings, the theme switch and Sign out.
|
|
11
11
|
- [Bottom bar](../reference/bottom-bar.md): On phones, tabs along the bottom for each role's main screens.
|
|
@@ -14,6 +14,7 @@ React components, field types, pages and handlers of your own, loaded as plugins
|
|
|
14
14
|
- [Image carousel](../reference/custom-components.md#image-carousel): Step through screenshots or a record's files in your own components by swiping or with arrows, as cards step through photos.
|
|
15
15
|
- [Assistant parts](../reference/assistant.md#in-the-ui): The assistant's panel, chat messages, composer and action cards for your own components, with a frameless action card for a page that is already framed.
|
|
16
16
|
- [Chat parts](../reference/custom-components.md#chat-parts): A chat between people from the app's parts: messages with their author, avatar, time and a status line, day and new-message lines, a thread that loads earlier messages, keeps the reader's place and jumps to the end when they send, and a composer of several lines with @mentions.
|
|
17
|
+
- [Members' names](../reference/custom-components.md#members-names): The names and photos of the organization's members by user id, for message authors and @mentions in your own components; every member reads them, without email addresses.
|
|
17
18
|
- [Action handlers](../reference/custom-components.md#action-handlers): Your own code for a named action, with the record, the API client and the action's inputs.
|
|
18
19
|
- [Shell slots](../reference/custom-components.md#shell-slots): Your own components in the top bar, in a panel beside every page, or as the sidebar logo.
|
|
19
20
|
- [Plugins](../reference/plugins.md#how-a-plugin-stays-working): Your React code is a plugin that the app loads at start and that keeps working across Protobase releases without changes.
|
|
@@ -597,7 +597,7 @@ It is Better Auth's organization plugin, with its tables named in snake_case (`o
|
|
|
597
597
|
|
|
598
598
|
**Invitations.** Better Auth's `POST /api/auth/organization/invite-member` with `{ organizationId, email, role, appRoles }`; inviting again replaces the earlier invitation, and it works for `invitationDays` (default 7). The email links to `{url}/-/invitation?token=…` (`invitationUrl`), with a token signed with the app's `secret`, since members can read invitation ids; without a mailer, the answer carries the `link` to pass on. The link page shows `GET /api/auth/invitation?token=`, accepts with `POST /api/auth/invitation/accept` for someone signed in as the invited address, and makes an account with `POST /api/auth/invitation/sign-up` (`{ token, name, password? }`) for an address without one. Someone signed in sees the invitations for their own address with Better Auth's `GET /api/auth/organization/list-user-invitations`, on the organizations page, and accepts one there with `POST /api/auth/invitation/accept-own` (`{ invitationId }`). The link page and its sign-up serve [invitations to the app](#users-page) too. [Open sign-up](#open-sign-up) is not available with organizations: an invitation is the address someone vouched for.
|
|
599
599
|
|
|
600
|
-
**Members.** Better Auth's `list-members`, `update-member-role`, `remove-member` and `leave`; `POST /api/auth/organization/set-app-roles` (`{ memberId, appRoles }`); `POST /api/auth/organization/transfer-ownership` (`{ memberId, keepAs? }`) makes a member owner and the caller an admin in one step. `GET /api/auth/organization/current` answers the organization a session works in with the caller's roles there.
|
|
600
|
+
**Members.** Better Auth's `list-members`, `update-member-role`, `remove-member` and `leave`; `POST /api/auth/organization/set-app-roles` (`{ memberId, appRoles }`); `POST /api/auth/organization/transfer-ownership` (`{ memberId, keepAs? }`) makes a member owner and the caller an admin in one step. `GET /api/auth/organization/current` answers the organization a session works in with the caller's roles there. `GET /api/auth/organization/people` answers the members of that organization to any of its members, as `{ people: [{ id, name, image? }] }` with `id` the user id and no email addresses; anyone who is not a member of it, signed out or with a global role only, is refused.
|
|
601
601
|
|
|
602
602
|
**Deleting** an organization (Better Auth's `delete`, owners only) is refused with `409 ORGANIZATION_HAS_RECORDS` while a `.tenant` resource has rows in it; `deleteRecords: 'cascade'` leaves it to the project's foreign keys. The `beforeOrganizationDeleted` [hook](#hooks) may refuse too.
|
|
603
603
|
|
|
@@ -310,6 +310,31 @@ export const Channel = ({ messages, sent, members, onSend, onLoadEarlier }: Chan
|
|
|
310
310
|
)
|
|
311
311
|
```
|
|
312
312
|
|
|
313
|
+
### Members' names
|
|
314
|
+
|
|
315
|
+
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.
|
|
316
|
+
|
|
317
|
+
```tsx
|
|
318
|
+
import { ChatMessage, Composer, MentionedText, useMembers } from '@protobase/ui'
|
|
319
|
+
|
|
320
|
+
export const Message = ({ message }: { message: { author_id: string; body: string; mentions: string[]; sent_at: string } }) => {
|
|
321
|
+
const { member } = useMembers()
|
|
322
|
+
return (
|
|
323
|
+
<ChatMessage author={{ id: message.author_id, name: member(message.author_id)?.name ?? '' }} time={message.sent_at}>
|
|
324
|
+
<MentionedText text={message.body} mentions={message.mentions.map((id) => ({ name: member(id)?.name }))} />
|
|
325
|
+
</ChatMessage>
|
|
326
|
+
)
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
export const ChannelComposer = ({ onSend }: { onSend: (text: string, mentions: string[]) => void }) => {
|
|
330
|
+
const { data: members = [] } = useMembers()
|
|
331
|
+
const searchPeople = async (query: string) => members.filter((person) => person.name.toLowerCase().includes(query.toLowerCase())).slice(0, 8)
|
|
332
|
+
return <Composer onSend={onSend} searchPeople={searchPeople} />
|
|
333
|
+
}
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
`searchPeople` filters the list in the browser and shows at most 8, as comments' mentions do. <gap>`useMembers()` cannot page or search on the server because a server-side people resource is not implemented, so the whole list loads in the browser, which suits a team, not thousands of members.</gap> <gap>Old messages of someone who has left the organization cannot show their name because looking up former members is not implemented.</gap> A person who works in an organization without being a member of it, through a global role, gets no list.
|
|
337
|
+
|
|
313
338
|
## Components in the chat
|
|
314
339
|
|
|
315
340
|
The same components draw the assistant's [widget parts](assistant.md#widget-parts): a part names a component, and the dock draws it with the part's props, so one component can sit on a page and in the chat. In the chat there is no record around it, so a component that needs `useLayoutRecord()` works only on pages; take ids as props instead. Besides the API hooks, a widget can read the assistant backend with [`useBackendData`](assistant.md#reading-the-backend-from-a-widget).
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Sidebar
|
|
4
4
|
|
|
5
|
-
How sidebar entries are grouped, and how an entry lists recent records with status dots.
|
|
5
|
+
How sidebar entries are grouped, and how an entry lists recent records, with status dots or without.
|
|
6
6
|
|
|
7
7
|
The admin's sidebar has one entry per resource view, grouped by `nav.group` (default: the database schema, with no group name for `public`) and sorted by `nav.order`, then by the order `config/index.ts` exports them, in `protobase dev` and in a built bundle alike. The app opens on the first entry. A view's [named lists](ui-config.md#more-than-one-list) are entries of their own, placed by their own `nav`. `nav({ hidden: true })` leaves a resource out, for line and link tables; a resource in the [user menu](user-menu.md) is left out too. [Composed pages](layouts.md#setup) have entries of their own, and groups that hold pages come first. A [remote resource](remote-resources.md) has its entry where its source's view places it; while its source cannot be reached, it sits under the source's label, marked "Cannot reach" with the source's name.
|
|
8
8
|
|
|
@@ -37,11 +37,17 @@ export const ordersView = view<typeof orders>('orders')
|
|
|
37
37
|
})
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
+
Without a `status`, each record is its title alone, with no dot, such as a chat's channels:
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
export const channelsView = view<typeof channels>('channels').nav({ recent: { orderBy: 'name asc', limit: 20 } })
|
|
44
|
+
```
|
|
45
|
+
|
|
40
46
|
| Key | Meaning |
|
|
41
47
|
| --- | --- |
|
|
42
|
-
| `status` | The field whose value picks each record's dot. Typed against the resource's fields. |
|
|
43
|
-
| `tones` | Dot colour per status value: `neutral`, `info`, `success`, `warning` or `danger`. Values not listed are `neutral`. |
|
|
44
|
-
| `pulse` | Status values whose dot pulses, for states in progress (a deploy running, an order being picked). |
|
|
48
|
+
| `status` | The field whose value picks each record's dot. Typed against the resource's fields. Optional: without it, records have no dot, as a chat's channels. |
|
|
49
|
+
| `tones` | Dot colour per status value: `neutral`, `info`, `success`, `warning` or `danger`. Values not listed are `neutral`. Optional. |
|
|
50
|
+
| `pulse` | Status values whose dot pulses, for states in progress (a deploy running, an order being picked). Needs `status`. |
|
|
45
51
|
| `filter` | Which records qualify, as AIP-160 text, exactly as `?filter=` on the list API. Use it to leave out finished or inactive records, or to keep them while they are recent: `status != "stopped" OR updated_at > now() - 7d`. |
|
|
46
52
|
| `orderBy` | AIP-132 order, as `?order_by=`; the list's `sort` when omitted. |
|
|
47
53
|
| `limit` | How many records, 1 to 20; 3 when omitted. |
|
|
@@ -57,8 +63,8 @@ The records come from the list API with the caller's token, so they follow the s
|
|
|
57
63
|
|
|
58
64
|
### Checks
|
|
59
65
|
|
|
60
|
-
`createAdmin` refuses to start when a group does not fit its resource: an unknown `status` field, a tone outside the palette, a `limit` outside 1 to 20, or a `filter` or `orderBy` the list API would reject (unknown, non-filterable or non-sortable fields, bad syntax). `view.toModel(resourceModel)` runs the same checks.
|
|
66
|
+
`createAdmin` refuses to start when a group does not fit its resource: an unknown `status` field, `pulse` without a `status`, a tone outside the palette, a `limit` outside 1 to 20, or a `filter` or `orderBy` the list API would reject (unknown, non-filterable or non-sortable fields, bad syntax). `view.toModel(resourceModel)` runs the same checks.
|
|
61
67
|
|
|
62
|
-
`/meta` drops the group, and keeps the rest of `nav`, for a caller who cannot read a field it uses (its status, or a field in its filter or order), so it never names a hidden field.
|
|
68
|
+
`/meta` drops the group, and keeps the rest of `nav`, for a caller who cannot read a field it uses (its status when it has one, or a field in its filter or order), so it never names a hidden field.
|
|
63
69
|
|
|
64
70
|
`EMAIL=... PASSWORD=... bun scripts/e2e-shell.mjs` checks the groups and the user menu in a browser against a running `bun run --cwd tests/apps/erp dev` (`BASE` for another address), comparing them with what the API gives that user.
|