@protobase/cli 0.118.0 → 0.118.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 +8 -8
- package/skills/protobase/references/features/sign-in-and-accounts.md +1 -0
- package/skills/protobase/references/reference/auth.md +23 -1
- package/skills/protobase/references/reference/config/sign-in.md +3 -3
- package/skills/protobase/references/reference/sidebar.md +16 -1
package/dist/cli/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/cli",
|
|
3
|
-
"version": "0.118.
|
|
3
|
+
"version": "0.118.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": {
|
|
@@ -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.118.
|
|
47
|
-
"@protobase/layout": "0.118.
|
|
48
|
-
"@protobase/query": "0.118.
|
|
49
|
-
"@protobase/schema": "0.118.
|
|
50
|
-
"@protobase/server": "0.118.
|
|
51
|
-
"@protobase/ui": "0.118.
|
|
52
|
-
"@protobase/workflows": "0.118.
|
|
46
|
+
"@protobase/config": "0.118.1",
|
|
47
|
+
"@protobase/layout": "0.118.1",
|
|
48
|
+
"@protobase/query": "0.118.1",
|
|
49
|
+
"@protobase/schema": "0.118.1",
|
|
50
|
+
"@protobase/server": "0.118.1",
|
|
51
|
+
"@protobase/ui": "0.118.1",
|
|
52
|
+
"@protobase/workflows": "0.118.1",
|
|
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",
|
|
@@ -38,6 +38,7 @@ Sign-in methods, users, roles, organizations and tokens.
|
|
|
38
38
|
- [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.
|
|
39
39
|
- [Roles](../reference/auth.md#roles): A user holds one or more roles and switches between them without signing in again.
|
|
40
40
|
- [Organizations](../reference/auth.md#organizations): People work in one organization at a time, see only its records, and are invited with their own roles.
|
|
41
|
+
- [First organization](../reference/auth.md#first-organization-and-start-address) (beta): People outside any organization name their first one in one step, or join one they are invited to, and land on the start address your app sets. You choose the word your app uses for an organization, such as workspace.
|
|
41
42
|
- [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, with your app's online or away mark on the members page and in the sidebar.
|
|
42
43
|
- [API tokens](../reference/auth.md#tokens-and-roles): A signed-in session gets short-lived tokens for the API.
|
|
43
44
|
- [Immediate revocation](../reference/auth.md#when-a-token-stops-working): A ban, removed role or ended session takes effect on the next request.
|
|
@@ -753,7 +753,29 @@ await listOrganizations(auth, { after?, size? })
|
|
|
753
753
|
await addAppRoleToOwners(auth, appRole) // a role the project added later, to every owner
|
|
754
754
|
```
|
|
755
755
|
|
|
756
|
-
The app's own pages are under the profile menu: the switcher, "Manage organizations" (theirs, a new one, and for global roles any one), "Organization" (details, leaving, handing over, deleting), and for owners and admins "Members" and "Invitations". The client has them as `session.organizations` (`list`, `current`, `switchTo`, `members`, `invite`, ...).
|
|
756
|
+
The app's own pages are under the profile menu: the switcher, "Manage organizations" (theirs, a new one, and for global roles any one), "Organization" (details, leaving, handing over, deleting), and for owners and admins "Members" and "Invitations". The client has them as `session.organizations` (`list`, `current`, `switchTo`, `members`, `invite`, ...). `session.organizations.create({ name })` makes one from its name alone: the server makes the slug from the name, and when another organization has that slug, adds a dash and six random letters and digits, such as `acme-k3x9q2`. The organization page changes the slug afterwards.
|
|
757
|
+
|
|
758
|
+
### First organization and start address
|
|
759
|
+
|
|
760
|
+
:::caution[Beta]
|
|
761
|
+
The start address is the same for everyone in an app; it does not yet remember where each person was last.
|
|
762
|
+
:::
|
|
763
|
+
|
|
764
|
+
Someone signed in who works in no organization, such as the first person in a new app, sees one screen before anything else, whatever address they opened: at `/-/first-organization`, with the app's mark and no sidebar entries, they name their first organization in one field and press Create. With invitations waiting for their address, the screen lists those first, each with Join, and "Create a new organization instead" leads to the form at `/-/first-organization/new`. Someone who may not create one (`create: 'admins'`) and has no invitation is told to ask for one. The screen names who is signed in, with Sign out, and for someone with a global role links to every organization. Creating or joining opens the app at its start address. Until they work in one, the shell shows none of the app's resources, on the account pages and the organizations page too.
|
|
765
|
+
|
|
766
|
+
The word the screens use for an organization is yours: `names` takes it as a view's names are written, and `createDescription` adds a line under the screen's title. The built-in texts around the word come in English and Dutch, on this screen, the organization pages and the profile menu:
|
|
767
|
+
|
|
768
|
+
```ts
|
|
769
|
+
auth: {
|
|
770
|
+
organizations: {
|
|
771
|
+
create: 'everyone',
|
|
772
|
+
names: { singular: 'Workspace', plural: 'Workspaces' },
|
|
773
|
+
createDescription: 'Your team talks here, in channels.',
|
|
774
|
+
},
|
|
775
|
+
}
|
|
776
|
+
```
|
|
777
|
+
|
|
778
|
+
The screen then reads "Create your workspace", its field "Workspace name" and its button "Create workspace". <gap>The organization word cannot come in each reader's language because translations of `auth.organizations.names` are not implemented.</gap> `/` opens the record a sidebar entry names with [`nav({ start })`](sidebar.md#start-record), such as a chat's #general channel, found by a filter on an indexed field; without one, or when nothing matches, the first sidebar entry, as before.
|
|
757
779
|
|
|
758
780
|
## Tokens and roles
|
|
759
781
|
|
|
@@ -50,13 +50,13 @@ export default defineConfig({ auth: { roles: ['admin', 'sales', 'warehouse'], de
|
|
|
50
50
|
|
|
51
51
|
## auth.organizations
|
|
52
52
|
|
|
53
|
-
- **Type:** `true | { create?: 'admins' | 'everyone'; creatorAppRoles?: 'all' | string[]; invitationDays?: number; membershipLimit?: number; deleteRecords?: 'refuse' | 'cascade'; invitationUrl?: string }`
|
|
53
|
+
- **Type:** `true | { create?: 'admins' | 'everyone'; names?: { singular: string; plural: string }; createDescription?: string; creatorAppRoles?: 'all' | string[]; invitationDays?: number; membershipLimit?: number; deleteRecords?: 'refuse' | 'cascade'; invitationUrl?: string }`
|
|
54
54
|
- **Default:** off: the app works as one organization
|
|
55
55
|
|
|
56
|
-
Turns on organizations: people work in one at a time, records of `.tenant` resources are scoped to it, and roles are held globally or per membership. `create` is who may create one (default `admins`), `creatorAppRoles` the roles its creator holds there (default `all`), `invitationDays` how long an invitation works (default 7), `membershipLimit` the most members (default 1000), `deleteRecords` whether deleting one is refused while it has records (`refuse`, the default) or left to the foreign keys (`cascade`), and `invitationUrl` the page an invitation opens (default `/-/invitation` on the origin the invitation was made on). Its hooks are in `auth/hooks.ts`. See [Organizations](../auth.md#organizations).
|
|
56
|
+
Turns on organizations: people work in one at a time, records of `.tenant` resources are scoped to it, and roles are held globally or per membership. `create` is who may create one (default `admins`), `names` what the screens call an organization, as a view's names are written (default Organization), `createDescription` a line under the title of the screen where someone names their first, `creatorAppRoles` the roles its creator holds there (default `all`), `invitationDays` how long an invitation works (default 7), `membershipLimit` the most members (default 1000), `deleteRecords` whether deleting one is refused while it has records (`refuse`, the default) or left to the foreign keys (`cascade`), and `invitationUrl` the page an invitation opens (default `/-/invitation` on the origin the invitation was made on). Its hooks are in `auth/hooks.ts`. See [Organizations](../auth.md#organizations) and [First organization](../auth.md#first-organization-and-start-address).
|
|
57
57
|
|
|
58
58
|
```ts
|
|
59
|
-
export default defineConfig({ auth: { organizations: { create: 'everyone', invitationDays: 14 } } })
|
|
59
|
+
export default defineConfig({ auth: { organizations: { create: 'everyone', invitationDays: 14, names: { singular: 'Workspace', plural: 'Workspaces' } } } })
|
|
60
60
|
```
|
|
61
61
|
|
|
62
62
|
## auth.signUp
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
How sidebar entries are grouped and which icon each shows, how an entry lists recent records, with status dots or without, and how it links to its create form.
|
|
6
6
|
|
|
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.
|
|
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, or on the [start record](#start-record) an entry names. 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
|
|
|
9
9
|
Below the `md` breakpoint (768px) the sidebar is a drawer, which the top bar's menu button opens, It is 88% of the screen wide, at most 384px. With a [bottom bar](bottom-bar.md#search-and-more), **More** opens the sidebar as a page of its own instead.
|
|
10
10
|
|
|
@@ -58,6 +58,21 @@ view<typeof apps>('apps')
|
|
|
58
58
|
|
|
59
59
|
`/meta` writes the session's organization into the list's opening filter, here `isNull(parent_id) AND organization_id = "<id>"`, and into the filter of its [recent records](#recent-records). Like any opening filter it applies when the address names no filter: the facet shows the organization chosen, and the person picks others or clears it, which lists every organization they are a member of. A link with its own filter replaces it, and switching organization opens the app again on the new one. A [named list](ui-config.md#more-than-one-list) takes `tenant` in its own `nav`. `createAdmin` refuses to start when the view has no `.list(...)`, or the resource has no `.tenant()` on a `.filterable()` field.
|
|
60
60
|
|
|
61
|
+
## Start record
|
|
62
|
+
|
|
63
|
+
`nav({ start: { filter } })` makes `/` open the first record of the entry's resource that the filter finds, such as a chat's #general channel, instead of the first sidebar entry:
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
export const channelsView = view<typeof channels>('channels').nav({ recent: { orderBy: 'name asc', limit: 20 }, start: { filter: 'name = "general"' } })
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
- The filter is AIP-160 text, as `?filter=` on the list API takes it, so it reads only `.filterable()` fields, which are indexed. `orderBy` picks among several matches; the list's sort when omitted.
|
|
70
|
+
- The record is read with the caller's token: their access rules apply, and an entry they do not see names no start. When several entries name one, the first in the sidebar's order does.
|
|
71
|
+
- When nothing matches, or the list is refused, `/` opens the first sidebar entry. Until the answer comes, `/` draws nothing, so no list shows first; the answer is kept for the next start.
|
|
72
|
+
- A [named list](ui-config.md#more-than-one-list) names no start of its own.
|
|
73
|
+
|
|
74
|
+
`createAdmin` refuses a filter or order that does not fit the resource; `/meta` leaves out a start whose filter or order reads a field the caller cannot read.
|
|
75
|
+
|
|
61
76
|
## Entries for creators
|
|
62
77
|
|
|
63
78
|
`nav({ creatorsOnly: true })` shows the entry only to whoever its list offers **New**, as for the [create link](#create-link), for a list that is there to make records, such as the [tables users add](user-tables.md#in-the-admin-app). Anyone else who may read the resource still opens it at its address.
|