@softr/sdk 1.8.0 → 1.9.0-alpha.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @softr/sdk
2
2
 
3
+ ## 1.9.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
+
3
9
  ## 1.8.0
4
10
 
5
11
  ### Minor 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 { clearPendingAuth, makeSessionDataCookie, makeSessionTokenCookie, readPendingAuthToken, readSessionToken } from "../session.js";
6
- import { authError } from "./utils.js";
6
+ import { authError, isUserLimitReached } from "./utils.js";
7
7
 
8
8
  //#region src/auth/methods/authenticator.ts
9
9
  /**
@@ -40,6 +40,7 @@ async function startAuthenticatorSetup() {
40
40
  async function confirmAuthenticatorSetup(details) {
41
41
  const result = await makePlatform(sessionConfig().applicationId).authenticatorSetupComplete(readPendingAuthToken() ?? readSessionToken(), details.code);
42
42
  if (!result.ok) {
43
+ if (isUserLimitReached(result)) return authError("userLimitReached", result.message);
43
44
  if (result.status === 400 || result.status === 401) return authError("invalidCode", result.message);
44
45
  if (result.status === 429) return authError("tooManyAttempts", result.message);
45
46
  if (result.status >= 500) panic(`Expected authenticator setup to finish, but got ${result.status}: ` + result.message);
@@ -65,6 +66,7 @@ async function confirmAuthenticatorSetup(details) {
65
66
  async function skipAuthenticatorSetup() {
66
67
  const result = await makePlatform(sessionConfig().applicationId).authenticatorSetupDismiss(readPendingAuthToken() ?? readSessionToken());
67
68
  if (!result.ok) {
69
+ if (isUserLimitReached(result)) return authError("userLimitReached", result.message);
68
70
  if (result.status === 401) return authError("notAuthenticated", result.message);
69
71
  if (result.status === 429) return authError("tooManyAttempts", result.message);
70
72
  if (result.status >= 500) panic(`Expected to skip authenticator setup, but got ${result.status}: ` + result.message);
@@ -88,6 +90,7 @@ async function skipAuthenticatorSetup() {
88
90
  async function verifyAuthenticator(credentials) {
89
91
  const result = await makePlatform(sessionConfig().applicationId).authenticatorVerify(readPendingAuthToken() ?? readSessionToken(), "code" in credentials ? { totpCode: credentials.code } : { backupCode: credentials.backupCode });
90
92
  if (!result.ok) {
93
+ if (isUserLimitReached(result)) return authError("userLimitReached", result.message);
91
94
  if (result.status === 400 || result.status === 401) return authError("invalidCode", result.message);
92
95
  if (result.status === 429) return authError("tooManyAttempts", result.message);
93
96
  if (result.status >= 500) panic(`Expected to verify the authenticator, 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 { clearPendingAuth, makePendingAuthCookie, makeSessionDataCookie, makeSessionTokenCookie } from "../session.js";
6
- import { authError } from "./utils.js";
6
+ import { authError, 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"]]);
@@ -37,6 +37,7 @@ async function sendSignInCode(details) {
37
37
  async function signInWithCode(credentials) {
38
38
  const result = await makePlatform(sessionConfig().applicationId).signInWithCode(credentials);
39
39
  if (!result.ok) {
40
+ if (isUserLimitReached(result)) return authError("userLimitReached", result.message);
40
41
  if (result.status === 429) return authError("tooManyAttempts", result.message);
41
42
  if (result.status === 400 || result.status === 401) return authError("invalidCode", result.message);
42
43
  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 { clearPendingAuth, makePendingAuthCookie, makeSessionDataCookie, makeSessionTokenCookie, readPendingAuthToken } from "../session.js";
6
- import { authError } from "./utils.js";
6
+ import { authError, isUserLimitReached } from "./utils.js";
7
7
 
8
8
  //#region src/auth/methods/emailCode2fa.ts
9
9
  /**
@@ -17,6 +17,7 @@ import { authError } from "./utils.js";
17
17
  async function verifyEmailCode(details) {
18
18
  const result = await makePlatform(sessionConfig().applicationId).emailCodeVerify(readPendingAuthToken(), details.code);
19
19
  if (!result.ok) {
20
+ if (isUserLimitReached(result)) return authError("userLimitReached", result.message);
20
21
  if (result.status === 400 || result.status === 401) return authError("invalidCode", result.message);
21
22
  if (result.status === 429) return authError("tooManyAttempts", result.message);
22
23
  if (result.status >= 500) panic(`Expected to verify the emailed code, 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 { makePendingAuthCookie, makeSessionDataCookie, makeSessionTokenCookie } from "../session.js";
6
- import { authError } from "./utils.js";
6
+ import { authError, isUserLimitReached } from "./utils.js";
7
7
 
8
8
  //#region src/auth/methods/magicLink.ts
9
9
  /**
@@ -17,6 +17,7 @@ import { authError } from "./utils.js";
17
17
  async function signInWithMagicLink(credentials) {
18
18
  const result = await makePlatform(sessionConfig().applicationId).signInWithMagicLink(credentials);
19
19
  if (!result.ok) {
20
+ if (isUserLimitReached(result)) return authError("userLimitReached", result.message);
20
21
  if (result.status === 429) return authError("tooManyAttempts", result.message);
21
22
  if (result.status === 400 || result.status === 401) return authError("invalidCredentials", result.message);
22
23
  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 { clearPendingAuth, clearSession, makePendingAuthCookie, makeSessionDataCookie, makeSessionTokenCookie, readSessionToken } from "../session.js";
6
- import { authError } from "./utils.js";
6
+ import { authError, isUserLimitReached } from "./utils.js";
7
7
 
8
8
  //#region src/auth/methods/password.ts
9
9
  /**
@@ -17,6 +17,7 @@ import { authError } from "./utils.js";
17
17
  async function signIn(credentials) {
18
18
  const result = await makePlatform(sessionConfig().applicationId).tokens(credentials);
19
19
  if (!result.ok) {
20
+ if (isUserLimitReached(result)) return authError("userLimitReached", result.message);
20
21
  if (result.status === 401) return authError("invalidCredentials", result.message);
21
22
  if (result.status === 429) return authError("tooManyAttempts", result.message);
22
23
  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 { clearPendingAuth, makePendingAuthCookie, makeSessionDataCookie, makeSessionTokenCookie } from "../session.js";
6
- import { authError } from "./utils.js";
6
+ import { authError, isUserLimitReached } from "./utils.js";
7
7
 
8
8
  //#region src/auth/methods/passwordLink.ts
9
9
  /**
@@ -30,6 +30,7 @@ async function requestPasswordReset(details) {
30
30
  async function checkPasswordLink(details) {
31
31
  const result = await makePlatform(sessionConfig().applicationId).checkPasswordToken(details);
32
32
  if (!result.ok) {
33
+ if (isUserLimitReached(result)) return authError("userLimitReached", result.message);
33
34
  if (result.status === 429) return authError("tooManyAttempts", result.message);
34
35
  if (result.status === 400 || result.status === 401) return authError("linkExpired", result.message);
35
36
  panic(`Expected the link to be checked, but got ${result.status}: ${result.message}.`);
@@ -49,6 +50,7 @@ async function checkPasswordLink(details) {
49
50
  async function setPasswordWithLink(details) {
50
51
  const result = await makePlatform(sessionConfig().applicationId).setPassword(details);
51
52
  if (!result.ok) {
53
+ if (isUserLimitReached(result)) return authError("userLimitReached", result.message);
52
54
  if (result.status === 429) return authError("tooManyAttempts", result.message);
53
55
  if (result.status === 400 && result.message.startsWith("Password must be at least")) return authError("invalidDetails", result.message);
54
56
  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 { clearPendingAuth, makePendingAuthCookie, makeSessionDataCookie, makeSessionTokenCookie } from "../session.js";
6
- import { authError } from "./utils.js";
6
+ import { authError, isUserLimitReached } from "./utils.js";
7
7
 
8
8
  //#region src/auth/methods/signup.ts
9
9
  /**
@@ -14,6 +14,7 @@ import { authError } from "./utils.js";
14
14
  async function signUp(details) {
15
15
  const result = await makePlatform(sessionConfig().applicationId).sendSignUpCode(details);
16
16
  if (!result.ok) {
17
+ if (isUserLimitReached(result)) return authError("userLimitReached", result.message);
17
18
  if (result.status === 409) return authError("emailTaken", result.message);
18
19
  if (result.status === 429) return authError("tooManyAttempts", result.message);
19
20
  if (result.status === 400) return authError("invalidDetails", result.message);
@@ -46,6 +47,7 @@ async function confirmSignUp(details) {
46
47
  password
47
48
  });
48
49
  if (!result.ok) {
50
+ if (isUserLimitReached(result)) return authError("userLimitReached", result.message);
49
51
  if (result.status === 409) return authError("emailTaken", result.message);
50
52
  if (result.status === 429) return authError("tooManyAttempts", result.message);
51
53
  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 { clearPendingAuth, makePendingAuthCookie, makeSessionDataCookie, makeSessionTokenCookie } from "../session.js";
6
- import { authError } from "./utils.js";
6
+ import { authError, isUserLimitReached } from "./utils.js";
7
7
  import { z } from "zod";
8
8
 
9
9
  //#region src/auth/methods/social.ts
@@ -26,6 +26,7 @@ const errorBodySchema = z.object({ code: z.string() });
26
26
  async function signInWithGoogle(credentials) {
27
27
  const result = await makePlatform(sessionConfig().applicationId).signInWithGoogle(credentials);
28
28
  if (!result.ok) {
29
+ if (isUserLimitReached(result)) return authError("userLimitReached", result.message);
29
30
  if (result.status === 429) return authError("tooManyAttempts", result.message);
30
31
  const body = errorBodySchema.safeParse(result.body);
31
32
  if (body.success && body.data.code === "GOOGLE_NOT_IN_PLAN") return authError("notEnabled", result.message);
@@ -10,6 +10,6 @@ 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" | "fileTooLarge" | "notAnImage" | "avatarNotSupported";
13
+ type AuthErrorCode = "invalidCredentials" | "tooManyAttempts" | "emailTaken" | "invalidDetails" | "invalidCode" | "noAccount" | "accountDeactivated" | "notAuthenticated" | "emailDomainNotAllowed" | "notEnabled" | "linkExpired" | "invalidName" | "fileTooLarge" | "notAnImage" | "avatarNotSupported" | "userLimitReached";
14
14
  //#endregion
15
15
  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,16 @@ 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
+ }
11
23
 
12
24
  //#endregion
13
- export { authError };
25
+ export { authError, isUserLimitReached };
package/dist/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "1.8.0";
2
+ var version = "1.9.0-alpha.0";
3
3
 
4
4
  //#endregion
5
5
  export { version };
package/package.json CHANGED
@@ -1,16 +1,38 @@
1
1
  {
2
2
  "name": "@softr/sdk",
3
- "version": "1.8.0",
3
+ "version": "1.9.0-alpha.0",
4
4
  "type": "module",
5
5
  "exports": {
6
- ".": { "types": "./dist/index.d.ts", "import": "./dist/index.js" },
7
- "./client": { "types": "./dist/client.d.ts", "import": "./dist/client.js" },
8
- "./server": { "types": "./dist/server.d.ts", "import": "./dist/server.js" },
9
- "./vite": { "types": "./dist/vite.d.ts", "import": "./dist/vite.js" }
10
- },
11
- "bin": { "softr-sdk": "./dist/cli.js" },
12
- "files": ["dist", "schema", "skills", "!skills/_artifacts", "CHANGELOG.md"],
13
- "publishConfig": { "access": "public" },
6
+ ".": {
7
+ "types": "./dist/index.d.ts",
8
+ "import": "./dist/index.js"
9
+ },
10
+ "./client": {
11
+ "types": "./dist/client.d.ts",
12
+ "import": "./dist/client.js"
13
+ },
14
+ "./server": {
15
+ "types": "./dist/server.d.ts",
16
+ "import": "./dist/server.js"
17
+ },
18
+ "./vite": {
19
+ "types": "./dist/vite.d.ts",
20
+ "import": "./dist/vite.js"
21
+ }
22
+ },
23
+ "bin": {
24
+ "softr-sdk": "./dist/cli.js"
25
+ },
26
+ "files": [
27
+ "dist",
28
+ "schema",
29
+ "skills",
30
+ "!skills/_artifacts",
31
+ "CHANGELOG.md"
32
+ ],
33
+ "publishConfig": {
34
+ "access": "public"
35
+ },
14
36
  "scripts": {
15
37
  "build": "tsdown",
16
38
  "test": "node --import ./src/test-utils/setup.ts --test",
@@ -42,7 +64,9 @@
42
64
  "optional": true
43
65
  }
44
66
  },
45
- "keywords": ["tanstack-intent"],
67
+ "keywords": [
68
+ "tanstack-intent"
69
+ ],
46
70
  "intent": {
47
71
  "version": 1,
48
72
  "repo": "@softr/sdk",
@@ -10,7 +10,7 @@ description: >-
10
10
  metadata:
11
11
  type: core
12
12
  library: softr-sdk
13
- library_version: 1.8.0
13
+ library_version: 1.9.0-alpha.0
14
14
  ---
15
15
 
16
16
  # 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.8.0
16
+ library_version: 1.9.0-alpha.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.8.0
13
+ library_version: 1.9.0-alpha.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.
@@ -135,9 +135,10 @@ type AuthErrorCode =
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
137
  | 'notEnabled' // signInWithGoogle: the app's plan no longer includes Google sign-in
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.8.0
13
+ library_version: 1.9.0-alpha.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.8.0
14
+ library_version: 1.9.0-alpha.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.8.0
15
+ library_version: 1.9.0-alpha.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.8.0
10
+ library_version: 1.9.0-alpha.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.8.0
11
+ library_version: 1.9.0-alpha.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.8.0
10
+ library_version: 1.9.0-alpha.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.
@@ -9,7 +9,7 @@ description: >-
9
9
  metadata:
10
10
  type: sub-skill
11
11
  library: softr-sdk
12
- library_version: 1.8.0
12
+ library_version: 1.9.0-alpha.0
13
13
  ---
14
14
 
15
15
  **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.
@@ -9,7 +9,7 @@ description: >-
9
9
  metadata:
10
10
  type: sub-skill
11
11
  library: softr-sdk
12
- library_version: 1.8.0
12
+ library_version: 1.9.0-alpha.0
13
13
  ---
14
14
 
15
15
  # Push notifications
@@ -4,12 +4,13 @@ description: >-
4
4
  Let visitors install the app on their home screen: SoftrPwaHead for the
5
5
  manifest, icon, iOS name and launch screen tags, usePwaInstall to decide
6
6
  whether to show an install button, which platform's steps to show and, when
7
- the browser offers it, install() for its own install dialog, the PwaInstall and PwaPlatform types, and how to check that the app is
8
- installable. The manifest and icon are already served; never write them.
7
+ the browser offers it, install() for its own install dialog, the PwaInstall
8
+ and PwaPlatform types, and how to check that the app is installable. The
9
+ manifest and icon are already served; never write them.
9
10
  metadata:
10
11
  type: sub-skill
11
12
  library: softr-sdk
12
- library_version: 1.8.0
13
+ library_version: 1.9.0-alpha.0
13
14
  ---
14
15
 
15
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.8.0
13
+ library_version: 1.9.0-alpha.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.8.0
14
+ library_version: 1.9.0-alpha.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.8.0
12
+ library_version: 1.9.0-alpha.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.8.0
12
+ library_version: 1.9.0-alpha.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.8.0
12
+ library_version: 1.9.0-alpha.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.