@softr/sdk 1.15.3 → 1.16.0-se23079.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.
Files changed (32) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/auth/methods/authenticator.js +7 -1
  3. package/dist/auth/methods/code.d.ts +3 -0
  4. package/dist/auth/methods/code.js +7 -1
  5. package/dist/auth/methods/emailCode2fa.js +4 -1
  6. package/dist/auth/methods/magicLink.js +3 -1
  7. package/dist/auth/methods/password.js +3 -1
  8. package/dist/auth/methods/passwordLink.js +4 -1
  9. package/dist/auth/methods/signup.js +5 -1
  10. package/dist/auth/methods/social.js +3 -1
  11. package/dist/auth/methods/utils.d.ts +3 -1
  12. package/dist/auth/methods/utils.js +22 -1
  13. package/dist/auth/sso.js +2 -1
  14. package/dist/package.js +1 -1
  15. package/package.json +1 -1
  16. package/skills/softr-sdk/SKILL.md +1 -1
  17. package/skills/softr-sdk/ai/SKILL.md +1 -1
  18. package/skills/softr-sdk/auth/SKILL.md +4 -3
  19. package/skills/softr-sdk/charts-and-metrics/SKILL.md +1 -1
  20. package/skills/softr-sdk/current-user/SKILL.md +1 -1
  21. package/skills/softr-sdk/email/SKILL.md +1 -1
  22. package/skills/softr-sdk/file-uploads/SKILL.md +1 -1
  23. package/skills/softr-sdk/formatting/SKILL.md +1 -1
  24. package/skills/softr-sdk/integrations/SKILL.md +1 -1
  25. package/skills/softr-sdk/mcp/SKILL.md +1 -1
  26. package/skills/softr-sdk/push-notifications/SKILL.md +1 -1
  27. package/skills/softr-sdk/pwa/SKILL.md +1 -1
  28. package/skills/softr-sdk/record-mutations/SKILL.md +1 -1
  29. package/skills/softr-sdk/record-queries/SKILL.md +1 -1
  30. package/skills/softr-sdk/region-visibility/SKILL.md +1 -1
  31. package/skills/softr-sdk/routes-and-visibility/SKILL.md +1 -1
  32. package/skills/softr-sdk/workflows/SKILL.md +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @softr/sdk
2
2
 
3
+ ## 1.16.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Every `auth` call that signs a visitor in or up fails as `userLimitReached` when the plan of the app's workspace has no room for this user. Before, `auth.signIn` threw, and the other calls answered `invalidCode`, `invalidCredentials`, `invalidDetails` or `linkExpired`. Action: on the login and sign-up pages, give `userLimitReached` its own `case` and say the app has reached its user limit and the app owner can fix it.
8
+ - A sign-in or a sign-up that needs a one-time email code or an authenticator app fails as `notEnabled` when the plan of the app's workspace does not include it, as after a downgrade. For the email code these are `auth.sendSignInCode`, `auth.signInWithCode`, `auth.signUp` and `auth.confirmSignUp` without a password, `auth.verifyEmailCode`, `auth.resendEmailCode`, and `auth.signIn` in an app that asks for an emailed code after the password. For the authenticator app it is every call that signs a visitor in, in an app that asks that visitor for an authenticator step. Before, these calls worked on every plan. Action: on the login and sign-up pages, give `notEnabled` its own `case` and say this way to sign in is not available and the app owner can fix it.
9
+
3
10
  ## 1.15.3
4
11
 
5
12
  ### Patch Changes
@@ -3,7 +3,7 @@ import { writeCookies } from "../../cookies.js";
3
3
  import { sessionConfig } from "../config.js";
4
4
  import { makePlatform } from "../platform.js";
5
5
  import { assertCanChange, clearPendingAuth, makeSessionDataCookie, makeSessionTokenCookie, readPendingAuthToken, readSessionToken } from "../session.js";
6
- import { authError } from "./utils.js";
6
+ import { authError, isNotInPlan, isUserLimitReached } from "./utils.js";
7
7
 
8
8
  //#region src/auth/methods/authenticator.ts
9
9
  /**
@@ -42,6 +42,8 @@ async function confirmAuthenticatorSetup(details) {
42
42
  assertCanChange("auth.confirmAuthenticatorSetup");
43
43
  const result = await makePlatform(sessionConfig().applicationId).authenticatorSetupComplete(readPendingAuthToken() ?? readSessionToken(), details.code);
44
44
  if (!result.ok) {
45
+ if (isUserLimitReached(result)) return authError("userLimitReached", result.message);
46
+ if (isNotInPlan(result)) return authError("notEnabled", result.message);
45
47
  if (result.status === 400 || result.status === 401) return authError("invalidCode", result.message);
46
48
  if (result.status === 429) return authError("tooManyAttempts", result.message);
47
49
  if (result.status >= 500) panic(`Expected authenticator setup to finish, but got ${result.status}: ` + result.message);
@@ -68,6 +70,8 @@ async function skipAuthenticatorSetup() {
68
70
  assertCanChange("auth.skipAuthenticatorSetup");
69
71
  const result = await makePlatform(sessionConfig().applicationId).authenticatorSetupDismiss(readPendingAuthToken() ?? readSessionToken());
70
72
  if (!result.ok) {
73
+ if (isUserLimitReached(result)) return authError("userLimitReached", result.message);
74
+ if (isNotInPlan(result)) return authError("notEnabled", result.message);
71
75
  if (result.status === 401) return authError("notAuthenticated", result.message);
72
76
  if (result.status === 429) return authError("tooManyAttempts", result.message);
73
77
  if (result.status >= 500) panic(`Expected to skip authenticator setup, but got ${result.status}: ` + result.message);
@@ -92,6 +96,8 @@ async function verifyAuthenticator(credentials) {
92
96
  assertCanChange("auth.verifyAuthenticator");
93
97
  const result = await makePlatform(sessionConfig().applicationId).authenticatorVerify(readPendingAuthToken() ?? readSessionToken(), "code" in credentials ? { totpCode: credentials.code } : { backupCode: credentials.backupCode });
94
98
  if (!result.ok) {
99
+ if (isUserLimitReached(result)) return authError("userLimitReached", result.message);
100
+ if (isNotInPlan(result)) return authError("notEnabled", result.message);
95
101
  if (result.status === 400 || result.status === 401) return authError("invalidCode", result.message);
96
102
  if (result.status === 429) return authError("tooManyAttempts", result.message);
97
103
  if (result.status >= 500) panic(`Expected to verify the authenticator, but got ${result.status}: ` + result.message);
@@ -9,6 +9,9 @@ import { AuthError, Result } from "./utils.js";
9
9
  *
10
10
  * An address with no account fails as `noAccount`, and a deactivated one as
11
11
  * `accountDeactivated`, so the visitor is not left waiting for an email.
12
+ *
13
+ * It fails as `notEnabled` when the app's plan no longer includes one-time
14
+ * email codes, as after a downgrade.
12
15
  */
13
16
  declare function sendSignInCode(details: {
14
17
  email: string;
@@ -3,7 +3,7 @@ import { writeCookies } from "../../cookies.js";
3
3
  import { sessionConfig } from "../config.js";
4
4
  import { makePlatform } from "../platform.js";
5
5
  import { assertCanChange, clearPendingAuth, makePendingAuthCookie, makeSessionDataCookie, makeSessionTokenCookie } from "../session.js";
6
- import { authError } from "./utils.js";
6
+ import { authError, isNotInPlan, isUserLimitReached } from "./utils.js";
7
7
 
8
8
  //#region src/auth/methods/code.ts
9
9
  const SEND_CODE_ERRORS = new Map([["No account exists for this email.", "noAccount"], ["This account is deactivated. Please contact the application owner.", "accountDeactivated"]]);
@@ -13,11 +13,15 @@ const SEND_CODE_ERRORS = new Map([["No account exists for this email.", "noAccou
13
13
  *
14
14
  * An address with no account fails as `noAccount`, and a deactivated one as
15
15
  * `accountDeactivated`, so the visitor is not left waiting for an email.
16
+ *
17
+ * It fails as `notEnabled` when the app's plan no longer includes one-time
18
+ * email codes, as after a downgrade.
16
19
  */
17
20
  async function sendSignInCode(details) {
18
21
  assertCanChange("auth.sendSignInCode");
19
22
  const result = await makePlatform(sessionConfig().applicationId).sendSignInCode(details.email);
20
23
  if (!result.ok) {
24
+ if (isNotInPlan(result)) return authError("notEnabled", result.message);
21
25
  if (result.status === 429) return authError("tooManyAttempts", result.message);
22
26
  if (result.status === 400) return authError(SEND_CODE_ERRORS.get(result.message) ?? "invalidDetails", result.message);
23
27
  if (result.status >= 500) panic(`Expected the sign-in code to be emailed, but got ${result.status}: ` + result.message);
@@ -39,6 +43,8 @@ async function signInWithCode(credentials) {
39
43
  assertCanChange("auth.signInWithCode");
40
44
  const result = await makePlatform(sessionConfig().applicationId).signInWithCode(credentials);
41
45
  if (!result.ok) {
46
+ if (isUserLimitReached(result)) return authError("userLimitReached", result.message);
47
+ if (isNotInPlan(result)) return authError("notEnabled", result.message);
42
48
  if (result.status === 429) return authError("tooManyAttempts", result.message);
43
49
  if (result.status === 400 || result.status === 401) return authError("invalidCode", result.message);
44
50
  if (result.status >= 500) panic(`Expected sign-in to succeed, but got ${result.status}: ` + result.message);
@@ -3,7 +3,7 @@ import { writeCookies } from "../../cookies.js";
3
3
  import { sessionConfig } from "../config.js";
4
4
  import { makePlatform } from "../platform.js";
5
5
  import { assertCanChange, clearPendingAuth, makePendingAuthCookie, makeSessionDataCookie, makeSessionTokenCookie, readPendingAuthToken } from "../session.js";
6
- import { authError } from "./utils.js";
6
+ import { authError, isNotInPlan, isUserLimitReached } from "./utils.js";
7
7
 
8
8
  //#region src/auth/methods/emailCode2fa.ts
9
9
  /**
@@ -18,6 +18,8 @@ async function verifyEmailCode(details) {
18
18
  assertCanChange("auth.verifyEmailCode");
19
19
  const result = await makePlatform(sessionConfig().applicationId).emailCodeVerify(readPendingAuthToken(), details.code);
20
20
  if (!result.ok) {
21
+ if (isUserLimitReached(result)) return authError("userLimitReached", result.message);
22
+ if (isNotInPlan(result)) return authError("notEnabled", result.message);
21
23
  if (result.status === 400 || result.status === 401) return authError("invalidCode", result.message);
22
24
  if (result.status === 429) return authError("tooManyAttempts", result.message);
23
25
  if (result.status >= 500) panic(`Expected to verify the emailed code, but got ${result.status}: ` + result.message);
@@ -55,6 +57,7 @@ async function resendEmailCode() {
55
57
  assertCanChange("auth.resendEmailCode");
56
58
  const result = await makePlatform(sessionConfig().applicationId).emailCodeResend(readPendingAuthToken());
57
59
  if (!result.ok) {
60
+ if (isNotInPlan(result)) return authError("notEnabled", result.message);
58
61
  if (result.status === 401) return authError("notAuthenticated", result.message);
59
62
  if (result.status === 429) return authError("tooManyAttempts", result.message);
60
63
  if (result.status >= 500) panic(`Expected the code to be emailed again, but got ${result.status}: ` + result.message);
@@ -3,7 +3,7 @@ import { writeCookies } from "../../cookies.js";
3
3
  import { sessionConfig } from "../config.js";
4
4
  import { makePlatform } from "../platform.js";
5
5
  import { assertCanChange, makePendingAuthCookie, makeSessionDataCookie, makeSessionTokenCookie } from "../session.js";
6
- import { authError } from "./utils.js";
6
+ import { authError, isNotInPlan, isUserLimitReached } from "./utils.js";
7
7
 
8
8
  //#region src/auth/methods/magicLink.ts
9
9
  /**
@@ -18,6 +18,8 @@ async function signInWithMagicLink(credentials) {
18
18
  assertCanChange("auth.signInWithMagicLink");
19
19
  const result = await makePlatform(sessionConfig().applicationId).signInWithMagicLink(credentials);
20
20
  if (!result.ok) {
21
+ if (isUserLimitReached(result)) return authError("userLimitReached", result.message);
22
+ if (isNotInPlan(result)) return authError("notEnabled", result.message);
21
23
  if (result.status === 429) return authError("tooManyAttempts", result.message);
22
24
  if (result.status === 400 || result.status === 401) return authError("invalidCredentials", result.message);
23
25
  if (result.status >= 500) panic(`Expected magic-link sign-in to succeed, but got ${result.status}: ` + result.message);
@@ -3,7 +3,7 @@ import { writeCookies } from "../../cookies.js";
3
3
  import { sessionConfig } from "../config.js";
4
4
  import { makePlatform } from "../platform.js";
5
5
  import { assertCanChange, clearPendingAuth, clearSession, makePendingAuthCookie, makeSessionDataCookie, makeSessionTokenCookie, readSessionToken } from "../session.js";
6
- import { authError } from "./utils.js";
6
+ import { authError, isNotInPlan, isUserLimitReached } from "./utils.js";
7
7
 
8
8
  //#region src/auth/methods/password.ts
9
9
  /**
@@ -18,6 +18,8 @@ async function signIn(credentials) {
18
18
  assertCanChange("auth.signIn");
19
19
  const result = await makePlatform(sessionConfig().applicationId).tokens(credentials);
20
20
  if (!result.ok) {
21
+ if (isUserLimitReached(result)) return authError("userLimitReached", result.message);
22
+ if (isNotInPlan(result)) return authError("notEnabled", result.message);
21
23
  if (result.status === 401) return authError("invalidCredentials", result.message);
22
24
  if (result.status === 429) return authError("tooManyAttempts", result.message);
23
25
  if (result.status >= 500) panic(`Expected sign-in to succeed, but got ${result.status}: ` + result.message);
@@ -3,7 +3,7 @@ import { writeCookies } from "../../cookies.js";
3
3
  import { sessionConfig } from "../config.js";
4
4
  import { makePlatform } from "../platform.js";
5
5
  import { assertCanChange, clearPendingAuth, makePendingAuthCookie, makeSessionDataCookie, makeSessionTokenCookie } from "../session.js";
6
- import { authError } from "./utils.js";
6
+ import { authError, isNotInPlan, isUserLimitReached } from "./utils.js";
7
7
 
8
8
  //#region src/auth/methods/passwordLink.ts
9
9
  /**
@@ -31,6 +31,7 @@ async function requestPasswordReset(details) {
31
31
  async function checkPasswordLink(details) {
32
32
  const result = await makePlatform(sessionConfig().applicationId).checkPasswordToken(details);
33
33
  if (!result.ok) {
34
+ if (isUserLimitReached(result)) return authError("userLimitReached", result.message);
34
35
  if (result.status === 429) return authError("tooManyAttempts", result.message);
35
36
  if (result.status === 400 || result.status === 401) return authError("linkExpired", result.message);
36
37
  panic(`Expected the link to be checked, but got ${result.status}: ${result.message}.`);
@@ -51,6 +52,8 @@ async function setPasswordWithLink(details) {
51
52
  assertCanChange("auth.setPasswordWithLink");
52
53
  const result = await makePlatform(sessionConfig().applicationId).setPassword(details);
53
54
  if (!result.ok) {
55
+ if (isUserLimitReached(result)) return authError("userLimitReached", result.message);
56
+ if (isNotInPlan(result)) return authError("notEnabled", result.message);
54
57
  if (result.status === 429) return authError("tooManyAttempts", result.message);
55
58
  if (result.status === 400 && result.message.startsWith("Password must be at least")) return authError("invalidDetails", result.message);
56
59
  if (result.status === 400 || result.status === 401) return authError("linkExpired", result.message);
@@ -3,7 +3,7 @@ import { writeCookies } from "../../cookies.js";
3
3
  import { sessionConfig } from "../config.js";
4
4
  import { makePlatform } from "../platform.js";
5
5
  import { assertCanChange, clearPendingAuth, makePendingAuthCookie, makeSessionDataCookie, makeSessionTokenCookie } from "../session.js";
6
- import { authError } from "./utils.js";
6
+ import { authError, isNotInPlan, isUserLimitReached } from "./utils.js";
7
7
 
8
8
  //#region src/auth/methods/signup.ts
9
9
  /**
@@ -15,6 +15,8 @@ async function signUp(details) {
15
15
  assertCanChange("auth.signUp");
16
16
  const result = await makePlatform(sessionConfig().applicationId).sendSignUpCode(details);
17
17
  if (!result.ok) {
18
+ if (isUserLimitReached(result)) return authError("userLimitReached", result.message);
19
+ if (isNotInPlan(result)) return authError("notEnabled", result.message);
18
20
  if (result.status === 409) return authError("emailTaken", result.message);
19
21
  if (result.status === 429) return authError("tooManyAttempts", result.message);
20
22
  if (result.status === 400) return authError("invalidDetails", result.message);
@@ -48,6 +50,8 @@ async function confirmSignUp(details) {
48
50
  password
49
51
  });
50
52
  if (!result.ok) {
53
+ if (isUserLimitReached(result)) return authError("userLimitReached", result.message);
54
+ if (isNotInPlan(result)) return authError("notEnabled", result.message);
51
55
  if (result.status === 409) return authError("emailTaken", result.message);
52
56
  if (result.status === 429) return authError("tooManyAttempts", result.message);
53
57
  if (result.status === 400 && result.message.startsWith("Password must be at least")) return authError("invalidDetails", result.message);
@@ -3,7 +3,7 @@ import { writeCookies } from "../../cookies.js";
3
3
  import { sessionConfig } from "../config.js";
4
4
  import { makePlatform } from "../platform.js";
5
5
  import { assertCanChange, clearPendingAuth, makePendingAuthCookie, makeSessionDataCookie, makeSessionTokenCookie } from "../session.js";
6
- import { authError } from "./utils.js";
6
+ import { authError, isNotInPlan, isUserLimitReached } from "./utils.js";
7
7
  import { z } from "zod";
8
8
 
9
9
  //#region src/auth/methods/social.ts
@@ -27,6 +27,8 @@ async function signInWithGoogle(credentials) {
27
27
  assertCanChange("auth.signInWithGoogle");
28
28
  const result = await makePlatform(sessionConfig().applicationId).signInWithGoogle(credentials);
29
29
  if (!result.ok) {
30
+ if (isUserLimitReached(result)) return authError("userLimitReached", result.message);
31
+ if (isNotInPlan(result)) return authError("notEnabled", result.message);
30
32
  if (result.status === 429) return authError("tooManyAttempts", result.message);
31
33
  const body = errorBodySchema.safeParse(result.body);
32
34
  if (body.success && body.data.code === "GOOGLE_NOT_IN_PLAN") return authError("notEnabled", result.message);
@@ -10,6 +10,8 @@ type AuthError = {
10
10
  code: AuthErrorCode;
11
11
  message: string;
12
12
  };
13
- type AuthErrorCode = "invalidCredentials" | "tooManyAttempts" | "emailTaken" | "invalidDetails" | "invalidCode" | "noAccount" | "accountDeactivated" | "notAuthenticated" | "emailDomainNotAllowed" | "notEnabled" | "linkExpired" | "invalidName" | "invalidPhoto" | "fileTooLarge" | "notAnImage" | "avatarNotSupported";
13
+ type AuthErrorCode = "invalidCredentials" | "tooManyAttempts" | "emailTaken" | "invalidDetails" | "invalidCode" | "noAccount" | "accountDeactivated" | "notAuthenticated" | "emailDomainNotAllowed"
14
+ /** The plan of the app's workspace no longer includes this way to sign in, as after a downgrade. */ | "notEnabled" | "linkExpired" | "invalidName" | "invalidPhoto" | "fileTooLarge" | "notAnImage" | "avatarNotSupported"
15
+ /** Any call that signs a visitor in or up: the plan of the app's workspace has no room for this user. */ | "userLimitReached";
14
16
  //#endregion
15
17
  export { AuthError, Result };
@@ -1,3 +1,5 @@
1
+ import { z } from "zod";
2
+
1
3
  //#region src/auth/methods/utils.ts
2
4
  function authError(code, message) {
3
5
  return {
@@ -8,6 +10,25 @@ function authError(code, message) {
8
10
  }
9
11
  };
10
12
  }
13
+ const errorBodySchema = z.object({ code: z.string() });
14
+ /**
15
+ * True when Softr refused because the plan of the app's workspace has no room
16
+ * for this user. It arrives as a 400, like a wrong code, so the status cannot
17
+ * tell them apart.
18
+ */
19
+ function isUserLimitReached(result) {
20
+ const body = errorBodySchema.safeParse(result.body);
21
+ return body.success && body.data.code === "USER_LIMIT_REACHED";
22
+ }
23
+ /**
24
+ * True when Softr refused because the plan of the app's workspace does not
25
+ * include the emailed code or the authenticator app this sign-in needs, as
26
+ * after a downgrade.
27
+ */
28
+ function isNotInPlan(result) {
29
+ const body = errorBodySchema.safeParse(result.body);
30
+ return body.success && (body.data.code === "EMAIL_CODE_NOT_IN_PLAN" || body.data.code === "AUTHENTICATOR_NOT_IN_PLAN");
31
+ }
11
32
 
12
33
  //#endregion
13
- export { authError };
34
+ export { authError, isNotInPlan, isUserLimitReached };
package/dist/auth/sso.js CHANGED
@@ -145,7 +145,8 @@ function failure(result) {
145
145
  case "SSO_IDP_REJECTED": return { error: "idp" };
146
146
  case "SSO_NOT_ENABLED":
147
147
  case "SSO_NOT_IN_PLAN":
148
- case "SSO_MISCONFIGURED": return { error: "not-enabled" };
148
+ case "SSO_MISCONFIGURED":
149
+ case "AUTHENTICATOR_NOT_IN_PLAN": return { error: "not-enabled" };
149
150
  case "SSO_SIGN_UP_DISABLED": return { error: "sign-up-disabled" };
150
151
  case "USER_DEACTIVATED":
151
152
  case "SIGN_IN_RESTRICTED": return { error: "restricted" };
package/dist/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "1.15.3";
2
+ var version = "1.16.0-se23079.0";
3
3
 
4
4
  //#endregion
5
5
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softr/sdk",
3
- "version": "1.15.3",
3
+ "version": "1.16.0-se23079.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": { "types": "./dist/index.d.ts", "import": "./dist/index.js" },
@@ -11,7 +11,7 @@ description: >-
11
11
  metadata:
12
12
  type: core
13
13
  library: softr-sdk
14
- library_version: 1.15.3
14
+ library_version: 1.16.0
15
15
  ---
16
16
 
17
17
  # Softr SDK core
@@ -13,7 +13,7 @@ description: >-
13
13
  metadata:
14
14
  type: sub-skill
15
15
  library: softr-sdk
16
- library_version: 1.15.3
16
+ library_version: 1.16.0
17
17
  ---
18
18
 
19
19
  **Boundary.** `ai` lives on `@softr/sdk/server` and runs only inside a `createServerFn` handler — importing it into a component fails the build. `defineAiAction` and every type come from `@softr/sdk` and can be imported anywhere.
@@ -10,7 +10,7 @@ description: >-
10
10
  metadata:
11
11
  type: sub-skill
12
12
  library: softr-sdk
13
- library_version: 1.15.3
13
+ library_version: 1.16.0
14
14
  ---
15
15
 
16
16
  **Boundary.** `auth` lives on `@softr/sdk/server` and runs only inside a `createServerFn` handler — importing it into a component fails the build.
@@ -134,10 +134,11 @@ type AuthErrorCode =
134
134
  | 'notAuthenticated' // a call that needs a signed-in visitor, made by one who is not
135
135
  | 'emailDomainNotAllowed' // signUp, signInWithGoogle: the app lets only some email domains sign up, and this is not one
136
136
  | 'linkExpired' // checkPasswordLink, setPasswordWithLink: the link is used, expired or no longer valid
137
- | 'notEnabled' // signInWithGoogle: the app's plan no longer includes Google sign-in
137
+ | 'notEnabled' // any call that signs a visitor in or up, or emails a code: the app's plan no longer includes Google sign-in, emailed codes or the authenticator app
138
+ | 'userLimitReached' // any call that signs a visitor in or up: the plan of the app's workspace has no room for this user
138
139
  ```
139
140
 
140
- Branch on `error.code` with a `switch` and write your own wording. Never put `error.message` in front of the visitor. The one exception is `invalidDetails` from `setPasswordWithLink` and `confirmSignUp`. Show its message: it names the password rule that failed.
141
+ Branch on `error.code` with a `switch` and write your own wording. Never put `error.message` in front of the visitor. The one exception is `invalidDetails` from `setPasswordWithLink` and `confirmSignUp`. Show its message: it names the password rule that failed. On `userLimitReached` the visitor did nothing wrong, and a retry does not help. Say the app has reached its user limit and that the app owner can fix it. Give it its own `case` on the login and sign-up pages, so it does not fall to a "wrong password" or "wrong code" message.
141
142
 
142
143
  `code` is typed as every code the SDK produces, not the ones a given call can answer, so a `switch` needs a `default` even when the cases above it are complete. Give it a message rather than leaving it out.
143
144
 
@@ -10,7 +10,7 @@ description: >-
10
10
  metadata:
11
11
  type: sub-skill
12
12
  library: softr-sdk
13
- library_version: 1.15.3
13
+ library_version: 1.16.0
14
14
  ---
15
15
 
16
16
  **Boundary.** `ds` lives on `@softr/sdk/server` and runs only inside a `createServerFn` handler — importing it into a component fails the build. A helper that calls `ds` outside a handler goes in `createServerOnlyFn` from `@tanstack/react-start` (the `record-queries` boundary). `defineQuery` and every type come from `@softr/sdk` and can be imported anywhere.
@@ -11,7 +11,7 @@ description: >-
11
11
  metadata:
12
12
  type: sub-skill
13
13
  library: softr-sdk
14
- library_version: 1.15.3
14
+ library_version: 1.16.0
15
15
  ---
16
16
 
17
17
  # The current user
@@ -12,7 +12,7 @@ description: >-
12
12
  metadata:
13
13
  type: sub-skill
14
14
  library: softr-sdk
15
- library_version: 1.15.3
15
+ library_version: 1.16.0
16
16
  ---
17
17
 
18
18
  **Boundary.** `email` and `EmailError` live on `@softr/sdk/server` and run only inside a `createServerFn` handler — importing them into a component fails the build. `defineEmailAction` and every type come from `@softr/sdk` and can be imported anywhere.
@@ -7,7 +7,7 @@ description: >-
7
7
  metadata:
8
8
  type: sub-skill
9
9
  library: softr-sdk
10
- library_version: 1.15.3
10
+ library_version: 1.16.0
11
11
  ---
12
12
 
13
13
  **Boundary.** `upload` lives on `@softr/sdk/server` and runs inside server functions. `useFileUpload` and `FileItem` live on `@softr/sdk` and run in components. `FileAttachment` comes from `@softr/sdk` and can be imported anywhere.
@@ -8,7 +8,7 @@ description: >-
8
8
  metadata:
9
9
  type: sub-skill
10
10
  library: softr-sdk
11
- library_version: 1.15.3
11
+ library_version: 1.16.0
12
12
  ---
13
13
 
14
14
  # Dates, times and numbers
@@ -7,7 +7,7 @@ description: >-
7
7
  metadata:
8
8
  type: sub-skill
9
9
  library: softr-sdk
10
- library_version: 1.15.3
10
+ library_version: 1.16.0
11
11
  ---
12
12
 
13
13
  **Boundary.** `integration` lives on `@softr/sdk/server` and runs only inside a `createServerFn` handler — importing it into a component fails the build. `defineIntegration` and every type come from `@softr/sdk` and can be imported anywhere.
@@ -11,7 +11,7 @@ description: >-
11
11
  metadata:
12
12
  type: sub-skill
13
13
  library: softr-sdk
14
- library_version: 1.15.3
14
+ library_version: 1.16.0
15
15
  ---
16
16
 
17
17
  **Boundary.** `softrMcpMiddleware` lives on `@softr/sdk` and is registered once, in `src/start.ts`. The actions you hand it are the same `defineQuery` / `defineMutation` values the app's own pages use — declared wherever they already live, not duplicated for MCP. The tools you hand it come from `defineTool`, also on `@softr/sdk`, and call the same server logic the pages do.
@@ -9,7 +9,7 @@ description: >-
9
9
  metadata:
10
10
  type: sub-skill
11
11
  library: softr-sdk
12
- library_version: 1.15.3
12
+ library_version: 1.16.0
13
13
  ---
14
14
 
15
15
  # Push notifications
@@ -10,7 +10,7 @@ description: >-
10
10
  metadata:
11
11
  type: sub-skill
12
12
  library: softr-sdk
13
- library_version: 1.15.3
13
+ library_version: 1.16.0
14
14
  ---
15
15
 
16
16
  # Installing the app
@@ -10,7 +10,7 @@ description: >-
10
10
  metadata:
11
11
  type: sub-skill
12
12
  library: softr-sdk
13
- library_version: 1.15.3
13
+ library_version: 1.16.0
14
14
  ---
15
15
 
16
16
  **Boundary.** `ds` lives on `@softr/sdk/server` and runs only inside a `createServerFn` handler — importing it into a component fails the build. `defineMutation` and every type come from `@softr/sdk` and can be imported anywhere.
@@ -11,7 +11,7 @@ description: >-
11
11
  metadata:
12
12
  type: sub-skill
13
13
  library: softr-sdk
14
- library_version: 1.15.3
14
+ library_version: 1.16.0
15
15
  ---
16
16
 
17
17
  **Boundary.** `ds` lives on `@softr/sdk/server` and runs only inside a `createServerFn` handler — importing it into a component fails the build. A route `loader` also runs in the browser, so it calls a server function, never `ds`. A helper that calls `ds` outside a handler, in this file or in another one, goes in `createServerOnlyFn` from `@tanstack/react-start`, or inside the handler. An exported helper without it keeps the server-only import in the browser bundle, and every page stops loading until it moves. Do not make such a helper a server function when it takes an id: any visitor can call a server function with any id. `defineQuery` and every type come from `@softr/sdk` and can be imported anywhere.
@@ -9,7 +9,7 @@ description: >-
9
9
  metadata:
10
10
  type: sub-skill
11
11
  library: softr-sdk
12
- library_version: 1.15.3
12
+ library_version: 1.16.0
13
13
  ---
14
14
 
15
15
  **Boundary.** `Audience` and `defineVisibility` come from `@softr/sdk` and work anywhere.
@@ -9,7 +9,7 @@ description: >-
9
9
  metadata:
10
10
  type: sub-skill
11
11
  library: softr-sdk
12
- library_version: 1.15.3
12
+ library_version: 1.16.0
13
13
  ---
14
14
 
15
15
  **Boundary.** `definePage`, `pageHead`, the access functions and the error predicates come from `@softr/sdk` and work anywhere.
@@ -9,7 +9,7 @@ description: >-
9
9
  metadata:
10
10
  type: sub-skill
11
11
  library: softr-sdk
12
- library_version: 1.15.3
12
+ library_version: 1.16.0
13
13
  ---
14
14
 
15
15
  **Boundary.** `workflow` lives on `@softr/sdk/server` and runs only inside a `createServerFn` handler — importing it into a component fails the build. `defineWorkflow` and every type come from `@softr/sdk` and can be imported anywhere.