@protobase/cli 0.53.7 → 0.54.0
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/sign-in-and-accounts.md +1 -0
- package/skills/protobase/references/guides/mobile-app.md +1 -0
- package/skills/protobase/references/reference/auth.md +17 -2
- package/skills/protobase/references/reference/blocks.md +1 -1
- package/skills/protobase/references/reference/config/sign-in.md +11 -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.0",
|
|
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.0",
|
|
46
|
+
"@protobase/layout": "0.54.0",
|
|
47
|
+
"@protobase/query": "0.54.0",
|
|
48
|
+
"@protobase/schema": "0.54.0",
|
|
49
|
+
"@protobase/server": "0.54.0",
|
|
50
|
+
"@protobase/ui": "0.54.0",
|
|
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 @@ Sign-in methods, users, roles, organizations and tokens.
|
|
|
14
14
|
- [Leaked passwords](../reference/auth.md#leaked-passwords): New passwords that appear in a known data breach are refused, when the app turns the check on.
|
|
15
15
|
- [Emailed sign-in codes](../reference/auth.md#emailed-sign-in-codes): People sign in with a code sent to their email. An address with no account is emailed that it has none, so the person tries the one they signed up with. An app can have the sign-in page lead with the code and put the password behind "Use a password".
|
|
16
16
|
- [Changing the address](../reference/auth.md#changing-the-address): People move their account to a new email address from the account page, once they enter the code sent there.
|
|
17
|
+
- [Deleting the account](../reference/auth.md#deleting-the-account): People delete their own account from the account page, after confirming it, in the web app and the mobile app. On by default; an app whose accounts an organization's admins manage turns it off.
|
|
17
18
|
- [Open sign-up](../reference/auth.md#open-sign-up): Anyone can create an account after confirming an emailed code.
|
|
18
19
|
- [Passkeys](../reference/auth.md#passkeys): People sign in with their device's face or fingerprint unlock, or with a security key.
|
|
19
20
|
- [Two-factor authentication](../reference/auth.md#two-factor-authentication): A second step with an authenticator app, backup codes or emailed codes.
|
|
@@ -127,4 +127,5 @@ You submit the app under your own developer account, on both stores: Apple rejec
|
|
|
127
127
|
- **What may change without a store release:** the app's files, which a later Protobase release can update over the air: the shell, UI plugins, theme, in-app logo and copy, and fixes and features within the app's purpose. Apple allows downloaded interpreted code that does not change the app's primary purpose ([Apple Developer Program License Agreement](https://developer.apple.com/support/terms/apple-developer-program-license-agreement/) 3.3.1(B)), and Google Play allows JavaScript in a WebView ([Device and Network Abuse](https://support.google.com/googleplay/android-developer/answer/9888379)).
|
|
128
128
|
- **What needs a store release:** native code, Capacitor or plugin changes (`mobile.plugins`), permissions, the app's name, its home-screen icon and its splash screen.
|
|
129
129
|
- **Big new features** still go through Apple's review with a store release, even when they could ship over the air: Apple asks that an app's features be documented and reviewed, none hidden (App Review Guidelines 2.3.1 and 2.5.19).
|
|
130
|
+
- **Account deletion is built in:** Apple requires an app that lets people create an account to let them delete it in the app too (App Review Guidelines 5.1.1(v)). The account page's [Delete account](../reference/auth.md#deleting-the-account) does that, on by default; keep `auth.accountDeletion` on for an app you submit.
|
|
130
131
|
- **A plain WebView of an admin app risks rejection:** Apple expects an app to be more than a repackaged website (4.2). Native touches help, such as push notifications, sharing, the camera or biometric sign-in, through `mobile.plugins`.
|
|
@@ -173,12 +173,12 @@ Everyone signed in has an account page at `/-/account`, which "Account" in the u
|
|
|
173
173
|
|
|
174
174
|
| Tab | Address | Blocks |
|
|
175
175
|
| --- | --- | --- |
|
|
176
|
-
| Profile | `/-/account` | `Profile` |
|
|
176
|
+
| Profile | `/-/account` | `Profile`, `DeleteAccount` |
|
|
177
177
|
| Sign-in & security | `/-/account/security` | `Password`, `Passkeys`, `TwoFactor`, `ConnectedAccounts` |
|
|
178
178
|
| Devices | `/-/account/devices` | `Devices` |
|
|
179
179
|
| Connected apps | `/-/account/apps` | `ConnectedApps` |
|
|
180
180
|
|
|
181
|
-
A tab whose blocks all leave themselves out is not offered, such as Connected apps in an app without [MCP](#oauth-for-mcp-clients).
|
|
181
|
+
A tab whose blocks all leave themselves out is not offered, such as Connected apps in an app without [MCP](#oauth-for-mcp-clients). `DeleteAccount` leaves itself out when the app turns [account deletion](#deleting-the-account) off.
|
|
182
182
|
|
|
183
183
|
To change it, export a page named `account` of your own: it replaces the standard one at `/-/account`, and is neither at `/account` nor in the sidebar. `accountTabs` holds the standard tabs by name (`profile`, `security`, `devices`, `apps`), so the page lists the ones it keeps beside its own:
|
|
184
184
|
|
|
@@ -258,6 +258,21 @@ On the [account page](#account-page), the `Password` block does both: with a pas
|
|
|
258
258
|
|
|
259
259
|
The [account page](#account-page)'s Devices tab lists the sessions with this one first and marked, a Sign out on each other one and Sign out of all other devices. It names each by its browser and system from the user agent, and a staff session by the operator alone, such as "Protobase staff" with when it signed in and until when, never the staff member.
|
|
260
260
|
|
|
261
|
+
## Deleting the account
|
|
262
|
+
|
|
263
|
+
Everyone signed in can delete their own account: the account page's Profile tab ends with "Delete account", which asks them to confirm in a dialog, with their password when the account has one. It is on by default, since an app store requires an app that makes accounts to let people delete them in the app, and `accountDeletion: false` turns it off, for an app whose accounts an organization's admins manage:
|
|
264
|
+
|
|
265
|
+
```ts
|
|
266
|
+
auth: { accountDeletion: false }
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
It is Better Auth's own deletion, `POST /api/auth/delete-user` with `{ password }`, which the client has as `session.deleteAccount(password?)` and `GET /api/auth/status` offers as `"accountDeletion": true`. It deletes the user with their sessions, sign-in methods and linked accounts, as an admin's [removal](#users-page) does, along with what the app keeps of them elsewhere, such as their [devices for push](../guides/push-notifications.md), and their [MCP clients](#oauth-for-mcp-clients)' grants; the app's own records that point at the user stay. This device is signed out, and the address can no longer sign in.
|
|
270
|
+
|
|
271
|
+
- Without a password, as for someone who signs in with [emailed codes](#emailed-sign-in-codes) or a passkey, the session must have signed in within the last day, else it is `SESSION_EXPIRED`, which the page shows as "sign out and sign in again first". A wrong password is `INVALID_PASSWORD`.
|
|
272
|
+
- The last active admin cannot delete themselves (`400 LAST_ADMIN`), nor can an account in `PROTOBASE_LOCKED_ACCOUNTS` (`403 ACCOUNT_LOCKED`); nothing is deleted then.
|
|
273
|
+
- A [staff session](#staff-sign-in) cannot delete the account (`STAFF_CANNOT_CHANGE_SIGN_IN`).
|
|
274
|
+
- With `accountDeletion: false` the endpoint answers `404` and the page offers nothing. Better Auth's emailed confirmation link (`/delete-user/callback`) is always off.
|
|
275
|
+
|
|
261
276
|
## Leaked passwords
|
|
262
277
|
|
|
263
278
|
`leakedPasswords: true` refuses a new password that appears in a known data breach. It is off by default, since it sends a request to an outside service each time a password is set.
|
|
@@ -390,7 +390,7 @@ Everyone who can sign in, for admins: find them by address, tick their roles, bl
|
|
|
390
390
|
|
|
391
391
|
### Account blocks
|
|
392
392
|
|
|
393
|
-
`Profile`, `Password`, `Passkeys`, `TwoFactor`, `ConnectedAccounts`, `Devices` and `
|
|
393
|
+
`Profile`, `Password`, `Passkeys`, `TwoFactor`, `ConnectedAccounts`, `Devices`, `ConnectedApps` and `DeleteAccount` are the parts of the signed-in person's own account: their name and address (which they can change, the address with an [emailed code](auth.md#changing-the-address)), their [password](auth.md#name-password-and-devices) (changed, or set for the first time), their [passkeys](auth.md#passkeys), [two-factor authentication](auth.md#two-factor-authentication), the sign-in providers they linked, the devices signed in as them (each one but this one to [sign out](auth.md#name-password-and-devices)), the apps such as MCP clients they allowed to act as them, below the app's MCP address to connect one, and the [deletion of their account](auth.md#deleting-the-account). Each takes no props or children, reads its own data, and leaves itself out where it does not apply: `ConnectedAccounts` without an OAuth sign-in provider, `ConnectedApps` without MCP, `DeleteAccount` with `auth.accountDeletion: false`. They act on whoever is signed in, so they are allowed on the page named `account` alone; anywhere else stops the config. That page is the [account page](auth.md#account-page) at `/-/account`, which `accountTabs` helps build from the standard tabs.
|
|
394
394
|
|
|
395
395
|
```tsx
|
|
396
396
|
export const account = page('account',
|
|
@@ -198,6 +198,17 @@ Refuses a new password that appears in a known data breach, by Have I Been Pwned
|
|
|
198
198
|
export default defineConfig({ auth: { leakedPasswords: true } })
|
|
199
199
|
```
|
|
200
200
|
|
|
201
|
+
## auth.accountDeletion
|
|
202
|
+
|
|
203
|
+
- **Type:** `boolean`
|
|
204
|
+
- **Default:** `true`
|
|
205
|
+
|
|
206
|
+
Lets the signed-in person delete their own account from the account page, as app stores require of an app that makes accounts. `false` turns it off, for an app whose accounts an organization's admins manage. See [Deleting the account](../auth.md#deleting-the-account).
|
|
207
|
+
|
|
208
|
+
```ts
|
|
209
|
+
export default defineConfig({ auth: { accountDeletion: false } })
|
|
210
|
+
```
|
|
211
|
+
|
|
201
212
|
## auth.users
|
|
202
213
|
|
|
203
214
|
- **Type:** `{ table?: string; columns?: Record<string, string>; metadata?: string }`
|
|
@@ -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.
|