@protobase/server 0.46.13 → 0.46.15

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.
@@ -74,6 +74,12 @@ export type CreateAuthOptions = {
74
74
  * with everything else allowed. Checked at startup as an admin's save is. Default everything allowed.
75
75
  */
76
76
  signInPolicy?: Partial<SignInPolicy>;
77
+ /**
78
+ * What the sign-in page leads with: `password`, the email address and a password, with emailing a code below it; or
79
+ * `emailCode`, the address and "Email me a sign-in code", with the password behind "Use a password", for apps whose
80
+ * people mostly never set one. Only while the policy leaves both on; default `password`.
81
+ */
82
+ signInFirst?: 'password' | 'emailCode';
77
83
  /** Sign-in attempts allowed per minute and client, default 5; also the sign-up requests allowed. */
78
84
  signInPerMinute?: number;
79
85
  /**
@@ -467,7 +473,9 @@ export declare const createAuth: (options: CreateAuthOptions) => import("better-
467
473
  expiresAt: Date;
468
474
  token: string;
469
475
  ipAddress?: string | null | undefined;
470
- userAgent?: string | null | undefined;
476
+ userAgent?
477
+ /** Sign-in attempts allowed per minute and client, default 5; also the sign-up requests allowed. */
478
+ /** Sign-in attempts allowed per minute and client, default 5; also the sign-up requests allowed. */ : string | null | undefined;
471
479
  };
472
480
  };
473
481
  }>>[];
@@ -8820,6 +8828,8 @@ export declare const createAuth: (options: CreateAuthOptions) => import("better-
8820
8828
  mail: boolean;
8821
8829
  /** The policy until an admin saves one. */
8822
8830
  signInPolicy: SignInPolicy;
8831
+ /** What the sign-in page leads with (`signInFirst`). */
8832
+ signInFirst: "password" | "emailCode";
8823
8833
  passwordReset: boolean;
8824
8834
  /** New passwords are checked against Have I Been Pwned's list of leaked ones (`leakedPasswords`). */
8825
8835
  leakedPasswords: boolean;
@@ -391,6 +391,8 @@ const createAuth = (options) => {
391
391
  mail: Boolean(mailer),
392
392
  /** The policy until an admin saves one. */
393
393
  signInPolicy,
394
+ /** What the sign-in page leads with (`signInFirst`). */
395
+ signInFirst: options.signInFirst ?? "password",
394
396
  passwordReset: Boolean(mailer),
395
397
  /** New passwords are checked against Have I Been Pwned's list of leaked ones (`leakedPasswords`). */
396
398
  leakedPasswords: Boolean(options.leakedPasswords),
@@ -9,7 +9,7 @@ import { Hono } from "hono";
9
9
  * `GET {authBase}/status`: `needsAdmin` while the admin store has no user, so a login page can say how to create one;
10
10
  * `signInMethods`, the ways to sign in the sign-in policy leaves on (`password`, `emailCode`, `passkey`), so it offers
11
11
  * only those; `passwordReset` when reset mail can be sent and passwords are on, so it offers "Forgot password?" only
12
- * then; `changeEmail` when mail can be sent, so the account page offers to change the address with an emailed code; `signUp` when the app has open sign-up, so it offers "Create an account"; the ids of the `socialProviders` people can sign in with, so it offers "Continue with GitHub" when `github` is
12
+ * then; `signInFirst: 'emailCode'` when the app has the sign-in page lead with an emailed code and the policy leaves both it and passwords on; `changeEmail` when mail can be sent, so the account page offers to change the address with an emailed code; `signUp` when the app has open sign-up, so it offers "Create an account"; the ids of the `socialProviders` people can sign in with, so it offers "Continue with GitHub" when `github` is
13
13
  * one; `platformSignIn`, the id and name of the platform's provider when it is one of them; `samlProviders`, the id and name of each SAML provider, when the app has any; `staffSignIn`, the
14
14
  * operator provider's name, when staff can sign in as people; `passkeyDomains`, when people have passkeys for more than
15
15
  * one of the app's hosts, the RP IDs a passkey sign-in can ask for, the passkey domain first; with organizations, who may create them and the roles
@@ -37,6 +37,7 @@ const statusRoute = (auth, { anonymous = false, plugins = [], locale } = {}) =>
37
37
  needsAdmin: !await hasUsers(auth),
38
38
  signInMethods,
39
39
  passwordReset: auth.passwordReset && policy.password === "allowed",
40
+ ...auth.signInFirst === "emailCode" && signInMethods.includes("emailCode") && signInMethods.includes("password") && { signInFirst: "emailCode" },
40
41
  ...auth.mail && { changeEmail: true },
41
42
  ...auth.signUp && { signUp: true },
42
43
  socialProviders,
package/dist/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "0.46.13";
2
+ var version = "0.46.15";
3
3
  //#endregion
4
4
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protobase/server",
3
- "version": "0.46.13",
3
+ "version": "0.46.15",
4
4
  "description": "The Protobase REST API as a Hono app, with Better Auth sign-in.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -36,9 +36,9 @@
36
36
  "@better-auth/passkey": "^1.7.12",
37
37
  "@better-auth/sso": "^1.7.12",
38
38
  "@modelcontextprotocol/server": "^2.3.1",
39
- "@protobase/layout": "0.46.13",
40
- "@protobase/query": "0.46.13",
41
- "@protobase/schema": "0.46.13",
39
+ "@protobase/layout": "0.46.15",
40
+ "@protobase/query": "0.46.15",
41
+ "@protobase/schema": "0.46.15",
42
42
  "@react-email/render": "^2.1.0",
43
43
  "@scalar/hono-api-reference": "^0.12.10",
44
44
  "@sentry/core": "^11.7.0",