@protobase/cli 0.102.9 → 0.103.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.
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "0.102.9";
2
+ var version = "0.103.1";
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.102.9",
3
+ "version": "0.103.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.102.9",
47
- "@protobase/layout": "0.102.9",
48
- "@protobase/query": "0.102.9",
49
- "@protobase/schema": "0.102.9",
50
- "@protobase/server": "0.102.9",
51
- "@protobase/ui": "0.102.9",
52
- "@protobase/workflows": "0.102.9",
46
+ "@protobase/config": "0.103.1",
47
+ "@protobase/layout": "0.103.1",
48
+ "@protobase/query": "0.103.1",
49
+ "@protobase/schema": "0.103.1",
50
+ "@protobase/server": "0.103.1",
51
+ "@protobase/ui": "0.103.1",
52
+ "@protobase/workflows": "0.103.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",
@@ -19,6 +19,7 @@ Sign-in methods, users, roles, organizations and tokens.
19
19
  - [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.
20
20
  - [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.
21
21
  - [Open sign-up](../reference/auth.md#open-sign-up): Anyone can create an account after confirming an emailed code.
22
+ - [Sign-up for email domains](../reference/auth.md#sign-up-for-email-domains): Open sign-up can take only addresses at your company's email domains, so colleagues make their own account and everyone else still needs an invitation.
22
23
  - [Passkeys](../reference/auth.md#passkeys): People sign in with their device's face or fingerprint unlock, or with a security key.
23
24
  - [Two-factor authentication](../reference/auth.md#two-factor-authentication): A second step with an authenticator app, backup codes or emailed codes.
24
25
  - [Emailed confirmation code](../reference/auth.md#emailed-confirmation-code): Someone without a passkey or a second step confirms it's them with a code emailed on request, where they are, such as before a secret is shown.
@@ -92,6 +92,7 @@ The store's migrations then make nothing of the user table, which a migration of
92
92
  | `PROTOBASE_ORIGINS` | the other origins the app is served on, comma separated, passed by the platform; see [Several origins](#several-origins) |
93
93
  | `PROTOBASE_PASSKEY_DOMAIN` | the host new [passkeys](#passkeys) are made for, passed by the platform; default the host of the app's `url` |
94
94
  | `PROTOBASE_LOCKED_ACCOUNTS` | the addresses of accounts no one may take over, comma separated, passed by the platform, such as a demo's shared account: their address, password, passkeys, two-factor authentication, linked accounts and [personal access tokens](personal-access-tokens.md) stay as they are, from any endpoint or host call, which fails with `403 ACCOUNT_LOCKED`, and they cannot be deleted |
95
+ | `PROTOBASE_SIGN_UP_DOMAINS` | the email domains [open sign-up](#sign-up-for-email-domains) takes, comma separated, passed by the platform: it replaces `signUp.domains`, and empty it leaves open sign-up off |
95
96
  | `PROTOBASE_CORS_ORIGINS` | other websites whose browser code may call the API, `*` or comma separated http and https origins, passed by the platform; see [CORS](api.md#cors) |
96
97
  | `PROTOBASE_SMTP_URL`, `PROTOBASE_MAIL_FROM` | the mail server and sender for [password reset](#password-reset), [emailed sign-in codes](#emailed-sign-in-codes), emailed [two-factor](#two-factor-authentication) codes and [open sign-up](#open-sign-up), passed by the platform; all four are off without them |
97
98
  | `PROTOBASE_APP_NAME` | the app's name, passed by the platform: it overrides `name` |
@@ -360,6 +361,22 @@ The sign-in page then offers "Create an account", and so do [sign-in prompts](ui
360
361
  - The `onUserCreated` [hook](#hooks) runs for every account made this way.
361
362
  - `createAuthSession` from `@protobase/client` has the three steps as `sendSignUpCode(email)`, `verifySignUpCode(email, code)`, which resolves to the ticket, and `signUp({ ticket, name, password? })`, which resolves to the signed-in user.
362
363
 
364
+ ### Sign-up for email domains
365
+
366
+ A company's app can let colleagues make their own account while everyone else still needs an invitation, with the email domains open sign-up takes:
367
+
368
+ ```ts
369
+ auth: { roles: ['admin', 'member'], signUp: { role: 'member', domains: ['example.com'] } }
370
+ ```
371
+
372
+ - An address at one of `domains` (subdomains count, letter case does not) signs up as above, with the emailed code; domains are matched as [SAML providers'](#sign-in-with-saml) are.
373
+ - Any other address is refused at each step with `403` (`EMAIL_DOMAIN_NOT_ALLOWED`) before anything is mailed or made, and the sign-up page says the address cannot make an account here. The answer does not name the domains, and `GET /api/auth/status` still only says `signUp`. Invitations and sign-in work as before, whatever the domain.
374
+ - `PROTOBASE_SIGN_UP_DOMAINS`, comma separated, replaces `domains` when set, so the deployment or the platform hosting the app decides them, and knows which it set. It only narrows open sign-up: without `signUp` in the config it turns nothing on.
375
+ - An empty list, from either, takes nobody: open sign-up is then off, as without `signUp`, never open to all. Without `domains` and the variable, every address may sign up.
376
+ - On the [GoTrue-compatible endpoints](#supabase-js-and-supabasessr), `POST /signup` from another address answers `422 signup_disabled`, and `POST /otp` sends a sign-in code, as with open sign-up off.
377
+ - On the host, `auth.signUpDomains` is the list in effect and `auth.signUpTakes(email)` whether open sign-up takes an address.
378
+ - <gap>A platform cannot read over HTTP the domains an app lists only in its own config because an endpoint that tells them to the platform is not implemented.</gap>
379
+
363
380
  ## Passkeys
364
381
 
365
382
  People add passkeys (Face ID, Touch ID, Windows Hello, a phone or a security key) on their account page, and sign in with "Sign in with a passkey". It is Better Auth's [passkey](https://www.better-auth.com/docs/plugins/passkey) plugin from `@better-auth/passkey`, under `/api/auth/passkey/*`.
@@ -524,6 +541,7 @@ These work for every provider, the project's own and the [platform's](#platform-
524
541
  - **Connected accounts:** the [account page](#account-page)'s **Sign-in & security** tab lists the providers and offers "Connect GitHub" for one the account is not linked to. Connecting signs in at the provider and links that account whatever its address (`accountLinking.allowDifferentEmails`, which applies only to this explicit link by someone signed in). A provider account linked to another person already is refused (`account_already_linked_to_different_user`); a [staff session](#staff-sign-in) cannot link.
525
542
  - **Linked up front:** `protobase users create <email> --github-id <id>`, or `createUser(auth, { ..., accounts: [{ providerId: 'github', accountId }] })`, links a new user to a GitHub user id, so GitHub finds them by it whatever address it reports.
526
543
  - Without a link, a provider finds someone by address only when it vouches for the address (`email_verified`) and the account's address is verified; accounts created by an admin or on the host are.
544
+ - **Through the provider's pages only:** signing in or connecting with an ID token a client posts instead (`idToken` on `/api/auth/sign-in/social` or `/api/auth/link-social`, as `signIn.social({ provider, idToken })` of Better Auth's client sends it) is refused with `403 TOKEN_SIGN_IN_OFF`, for every provider: such a token would sign in without the nonce of a sign-in the app started, as often as it is posted, and without the app's [second step](#two-factor-authentication).
527
545
 
528
546
  ## Sign-in with SAML
529
547
 
@@ -61,10 +61,10 @@ export default defineConfig({ auth: { organizations: { create: 'everyone', invit
61
61
 
62
62
  ## auth.signUp
63
63
 
64
- - **Type:** `{ role: string }`
64
+ - **Type:** `{ role: string; domains?: string[] }`
65
65
  - **Default:** off
66
66
 
67
- Open sign-up: anyone makes their own account from the sign-in page, with `role`, after proving their address with an emailed code. Needs a mailer. `role` is one of [`roles`](#authroles) and never `admin`. Not with organizations. See [Open sign-up](../auth.md#open-sign-up).
67
+ Open sign-up: anyone makes their own account from the sign-in page, with `role`, after proving their address with an emailed code. Needs a mailer. `role` is one of [`roles`](#authroles) and never `admin`. `domains` takes only addresses at those email domains, subdomains included, and `PROTOBASE_SIGN_UP_DOMAINS` replaces it; an empty list leaves sign-up off. Not with organizations. See [Open sign-up](../auth.md#open-sign-up) and [Sign-up for email domains](../auth.md#sign-up-for-email-domains).
68
68
 
69
69
  ```ts
70
70
  export default defineConfig({ auth: { roles: ['admin', 'customer'], signUp: { role: 'customer' } } })