@softr/sdk 1.2.1 → 1.3.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.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Add `useIdleTimeout()`, which signs the visitor out of this browser after the idle time set in Studio's "End session if idle", and sends them to `/`. Action: call it once in the root route's document component, next to `useUserTimezone()`.
8
+
3
9
  ## 1.2.1
4
10
 
5
11
  ### Patch Changes
@@ -0,0 +1,17 @@
1
+ //#region src/auth/idle-timeout.d.ts
2
+ /**
3
+ * Signs the visitor out of this browser after the idle time set in Studio's
4
+ * "End session if idle", and sends them to `/`. Activity in any tab of the app
5
+ * keeps the session alive. Does nothing for anonymous visitors.
6
+ *
7
+ * Call it once, in the root route's document component.
8
+ *
9
+ * @example
10
+ * function RootDocument({ children }: { children: React.ReactNode }) {
11
+ * useIdleTimeout()
12
+ * // ...
13
+ * }
14
+ */
15
+ declare function useIdleTimeout(): void;
16
+ //#endregion
17
+ export { useIdleTimeout };
@@ -0,0 +1,200 @@
1
+ import { clearSession } from "./session.js";
2
+ import { readSoftrContext } from "./context.js";
3
+ import { settings } from "./methods/settings.js";
4
+ import { useCurrentUser } from "./isomorphic.js";
5
+ import { useEffect } from "react";
6
+ import { createServerFn } from "@tanstack/react-start";
7
+
8
+ //#region src/auth/idle-timeout.ts
9
+ /**
10
+ * The "End session if idle" setting from Studio, in milliseconds. `null` when it
11
+ * does not apply: nobody is signed in, it is set to never, or this is not a
12
+ * production build. Preview runs on a dev server and is the owner's own session.
13
+ */
14
+ const readIdleTimeout = createServerFn({ method: "GET" }).handler(async () => {
15
+ if (process.env.NODE_ENV !== "production") return null;
16
+ if (readSoftrContext().user === null) return null;
17
+ const minutes = (await settings()).inactivityTimeoutMinutes;
18
+ return minutes === null ? null : minutes * 6e4;
19
+ });
20
+ /**
21
+ * Signs this browser out and nothing else. Unlike `auth.signOut()`, the user's
22
+ * other devices stay signed in.
23
+ */
24
+ const endIdleSession = createServerFn({ method: "POST" }).handler(() => {
25
+ clearSession();
26
+ });
27
+ /**
28
+ * Signs the visitor out of this browser after the idle time set in Studio's
29
+ * "End session if idle", and sends them to `/`. Activity in any tab of the app
30
+ * keeps the session alive. Does nothing for anonymous visitors.
31
+ *
32
+ * Call it once, in the root route's document component.
33
+ *
34
+ * @example
35
+ * function RootDocument({ children }: { children: React.ReactNode }) {
36
+ * useIdleTimeout()
37
+ * // ...
38
+ * }
39
+ */
40
+ function useIdleTimeout() {
41
+ const signedIn = useCurrentUser() !== null;
42
+ useEffect(() => {
43
+ if (!signedIn) return;
44
+ let stop = null;
45
+ let unmounted = false;
46
+ readIdleTimeout().then((idleMs) => {
47
+ if (unmounted || idleMs === null) return;
48
+ stop = startIdleClock(idleMs);
49
+ }, () => {});
50
+ return () => {
51
+ unmounted = true;
52
+ stop?.();
53
+ };
54
+ }, [signedIn]);
55
+ }
56
+ const KEY_LAST_ACTIVITY = "softr.idle.v1.lastActivity";
57
+ const KEY_SIGNED_OUT = "softr.idle.v1.signedOutAt";
58
+ /** Shared clock writes at most this often, so a mousemove is not a storage write in every tab. */
59
+ const WRITE_EVERY_MS = 5e3;
60
+ /**
61
+ * Activity events, listened for on the document in the capture phase. `scroll`
62
+ * does not bubble, and capture still sees events a handler stops.
63
+ */
64
+ const ACTIVITY_EVENTS = [
65
+ "pointerdown",
66
+ "pointermove",
67
+ "mousedown",
68
+ "mousemove",
69
+ "wheel",
70
+ "keydown",
71
+ "touchstart",
72
+ "touchmove",
73
+ "scroll",
74
+ "click",
75
+ "input",
76
+ "focusin",
77
+ "submit"
78
+ ];
79
+ /**
80
+ * Starts the idle clock and returns what stops it.
81
+ *
82
+ * Idle time is checked against the wall clock on a tick, not with one long
83
+ * timeout. Browsers delay timers in background tabs, and a laptop that wakes
84
+ * from sleep resumes a pending timeout with its full delay left.
85
+ */
86
+ function startIdleClock(idleMs) {
87
+ const tickMs = Math.min(15e3, Math.max(2e3, Math.floor(idleMs / 30)));
88
+ const graceCapMs = idleMs;
89
+ let localLast = Date.now();
90
+ let lastWrite = 0;
91
+ let graceUsed = 0;
92
+ let ending = false;
93
+ let finished = false;
94
+ const listeners = new AbortController();
95
+ function lastActivity() {
96
+ const shared = Number(readStorage(KEY_LAST_ACTIVITY));
97
+ return Number.isFinite(shared) && shared > localLast ? shared : localLast;
98
+ }
99
+ function mark(now) {
100
+ if (now > localLast) localLast = now;
101
+ if (now - lastWrite >= WRITE_EVERY_MS) {
102
+ lastWrite = now;
103
+ writeStorage(KEY_LAST_ACTIVITY, String(now));
104
+ }
105
+ }
106
+ function onActivity() {
107
+ graceUsed = 0;
108
+ mark(Date.now());
109
+ }
110
+ function stop() {
111
+ finished = true;
112
+ clearInterval(ticker);
113
+ listeners.abort();
114
+ }
115
+ function leave() {
116
+ if (finished) return;
117
+ stop();
118
+ window.location.replace("/");
119
+ }
120
+ async function endSession() {
121
+ if (ending) return;
122
+ ending = true;
123
+ try {
124
+ await endIdleSession();
125
+ } catch {
126
+ ending = false;
127
+ return;
128
+ }
129
+ writeStorage(KEY_SIGNED_OUT, String(Date.now()));
130
+ leave();
131
+ }
132
+ function tick() {
133
+ if (finished) return;
134
+ if (readStorage(KEY_SIGNED_OUT)) {
135
+ leave();
136
+ return;
137
+ }
138
+ const now = Date.now();
139
+ if (now - lastActivity() < idleMs) return;
140
+ if (iframeHasFocus() && graceUsed < graceCapMs) {
141
+ graceUsed += tickMs;
142
+ mark(now);
143
+ return;
144
+ }
145
+ endSession();
146
+ }
147
+ removeStorage(KEY_SIGNED_OUT);
148
+ mark(Date.now());
149
+ const ticker = setInterval(tick, tickMs);
150
+ const { signal } = listeners;
151
+ for (const event of ACTIVITY_EVENTS) document.addEventListener(event, onActivity, {
152
+ capture: true,
153
+ passive: true,
154
+ signal
155
+ });
156
+ window.addEventListener("focus", onActivity, {
157
+ capture: true,
158
+ signal
159
+ });
160
+ document.addEventListener("visibilitychange", () => {
161
+ if (document.visibilityState !== "visible") return;
162
+ tick();
163
+ if (!finished && !ending) onActivity();
164
+ }, { signal });
165
+ window.addEventListener("storage", (event) => {
166
+ if (event.key === KEY_SIGNED_OUT && event.newValue) {
167
+ leave();
168
+ return;
169
+ }
170
+ if (event.key === KEY_LAST_ACTIVITY && event.newValue) {
171
+ const shared = Number(event.newValue);
172
+ if (Number.isFinite(shared) && shared > localLast) localLast = shared;
173
+ }
174
+ }, { signal });
175
+ return stop;
176
+ }
177
+ function iframeHasFocus() {
178
+ const active = document.activeElement;
179
+ return active !== null && active.tagName === "IFRAME" && document.hasFocus();
180
+ }
181
+ function readStorage(key) {
182
+ try {
183
+ return window.localStorage.getItem(key);
184
+ } catch {
185
+ return null;
186
+ }
187
+ }
188
+ function writeStorage(key, value) {
189
+ try {
190
+ window.localStorage.setItem(key, value);
191
+ } catch {}
192
+ }
193
+ function removeStorage(key) {
194
+ try {
195
+ window.localStorage.removeItem(key);
196
+ } catch {}
197
+ }
198
+
199
+ //#endregion
200
+ export { useIdleTimeout };
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import * as react0 from "react";
2
+ import * as react2 from "react";
3
3
  import { ReactNode } from "react";
4
4
 
5
5
  //#region src/formatting.d.ts
@@ -96,7 +96,7 @@ declare function FormattingScope({
96
96
  /** A BCP 47 locale, such as `de-DE`. It drops the app's fixed date format inside the scope. */
97
97
  locale?: string;
98
98
  children?: ReactNode;
99
- }): react0.FunctionComponentElement<react0.ProviderProps<Scope>>;
99
+ }): react2.FunctionComponentElement<react2.ProviderProps<Scope>>;
100
100
  /**
101
101
  * A date in the app's format, safe to render on the server. A timestamp whose
102
102
  * zone is not known yet renders `fallback` until the browser supplies it, so
@@ -118,6 +118,6 @@ declare function FormattedDate({
118
118
  time?: boolean;
119
119
  /** What renders while the visitor's zone is unknown. */
120
120
  fallback?: ReactNode;
121
- }): react0.FunctionComponentElement<react0.FragmentProps> | null;
121
+ }): react2.FunctionComponentElement<react2.FragmentProps> | null;
122
122
  //#endregion
123
123
  export { DateOptions, DateParts, DateSeparator, DateValue, FixedDateFormat, FormattedDate, Formatting, FormattingScope, WeekDay, formatDate, formatDateTime, formatNumber, useFormatting };
package/dist/index.d.ts CHANGED
@@ -11,6 +11,7 @@ import { Page, PageSettings, definePage, pageHead } from "./route/page.js";
11
11
  import { assertRouteAccess, guardRoute, isAccessError, isAlreadyAuthenticatedError, isForbiddenError, isUnauthenticatedError } from "./route/route.js";
12
12
  import { toReturnPath } from "./auth/returnPath.js";
13
13
  import { AuthOptions, AuthSettingsProvider, getAuthSettings, getSoftrContext, initialSoftrContext, softrAuthMiddleware, useAuthSettings, useCurrentUser } from "./auth/isomorphic.js";
14
+ import { useIdleTimeout } from "./auth/idle-timeout.js";
14
15
  import { softrMcpMiddleware } from "./mcp.js";
15
16
  import { FieldShape, SoftrFieldRegistry, fieldShape, formatDuration, formatField, formatValue, registerSoftrFields } from "./fields/format.js";
16
17
  import { useOverrides } from "./core/use-overrides.js";
@@ -19,4 +20,4 @@ import { PwaInstall, PwaPlatform, SoftrPwaHead, usePwaInstall } from "./pwa.js";
19
20
  import { PushNotifications, PushPrompt, usePushNotifications } from "./push.js";
20
21
  import { DefaultErrorOverlay } from "./default-error-overlay.js";
21
22
  import { Audience } from "./route/audience.js";
22
- export { type ActionPermissions, type AiAnswer, type AiFile, type AiGenerateInit, type AiMessage, type AiUsage, Audience, type AuthOptions, type AuthSettings, AuthSettingsProvider, type DateOptions, type DateParts, type DateSeparator, type DateValue, DefaultErrorOverlay, type FieldShape, type FileAttachment, type FileItem, type FixedDateFormat, FormattedDate, type Formatting, FormattingScope, type Page, type PageSettings, type PushNotifications, type PushPrompt, type PwaInstall, type PwaPlatform, type SoftrContext, type SoftrDatasources, type SoftrFieldRegistry, SoftrPwaHead, type SoftrUserGroupId, type SoftrUserGroups, type SoftrUserProperties, type User, type WeekDay, assertRouteAccess, checkAccess, defineAiAction, defineIntegration, defineMutation, definePage, defineQuery, defineVisibility, defineWorkflow, fieldShape, formatDate, formatDateTime, formatDuration, formatField, formatNumber, formatValue, getAuthSettings, getSoftrContext, guardRoute, initialSoftrContext, isAccessError, isAlreadyAuthenticatedError, isAuthorized, isForbiddenError, isUnauthenticatedError, pageHead, registerSoftrFields, softrAuthMiddleware, softrMcpMiddleware, toReturnPath, useAuthSettings, useCurrentUser, useFileUpload, useFormatting, useOverrides, usePushNotifications, usePwaInstall, useUserTimezone };
23
+ export { type ActionPermissions, type AiAnswer, type AiFile, type AiGenerateInit, type AiMessage, type AiUsage, Audience, type AuthOptions, type AuthSettings, AuthSettingsProvider, type DateOptions, type DateParts, type DateSeparator, type DateValue, DefaultErrorOverlay, type FieldShape, type FileAttachment, type FileItem, type FixedDateFormat, FormattedDate, type Formatting, FormattingScope, type Page, type PageSettings, type PushNotifications, type PushPrompt, type PwaInstall, type PwaPlatform, type SoftrContext, type SoftrDatasources, type SoftrFieldRegistry, SoftrPwaHead, type SoftrUserGroupId, type SoftrUserGroups, type SoftrUserProperties, type User, type WeekDay, assertRouteAccess, checkAccess, defineAiAction, defineIntegration, defineMutation, definePage, defineQuery, defineVisibility, defineWorkflow, fieldShape, formatDate, formatDateTime, formatDuration, formatField, formatNumber, formatValue, getAuthSettings, getSoftrContext, guardRoute, initialSoftrContext, isAccessError, isAlreadyAuthenticatedError, isAuthorized, isForbiddenError, isUnauthenticatedError, pageHead, registerSoftrFields, softrAuthMiddleware, softrMcpMiddleware, toReturnPath, useAuthSettings, useCurrentUser, useFileUpload, useFormatting, useIdleTimeout, useOverrides, usePushNotifications, usePwaInstall, useUserTimezone };
package/dist/index.js CHANGED
@@ -8,6 +8,7 @@ import { FormattedDate, FormattingScope, formatDate, formatDateTime, formatNumbe
8
8
  import { SoftrPwaHead, usePwaInstall } from "./pwa.js";
9
9
  import { usePushNotifications } from "./push.js";
10
10
  import { AuthSettingsProvider, getAuthSettings, getSoftrContext, initialSoftrContext, softrAuthMiddleware, useAuthSettings, useCurrentUser } from "./auth/isomorphic.js";
11
+ import { useIdleTimeout } from "./auth/idle-timeout.js";
11
12
  import { softrMcpMiddleware } from "./mcp.js";
12
13
  import { fieldShape, formatDuration, formatField, formatValue, registerSoftrFields } from "./fields/format.js";
13
14
  import { useOverrides } from "./core/use-overrides.js";
@@ -15,4 +16,4 @@ import { useUserTimezone } from "./timezone.js";
15
16
  import { DefaultErrorOverlay } from "./default-error-overlay.js";
16
17
  import { Audience } from "./route/audience.js";
17
18
 
18
- export { Audience, AuthSettingsProvider, DefaultErrorOverlay, FormattedDate, FormattingScope, SoftrPwaHead, assertRouteAccess, checkAccess, defineAiAction, defineIntegration, defineMutation, definePage, defineQuery, defineVisibility, defineWorkflow, fieldShape, formatDate, formatDateTime, formatDuration, formatField, formatNumber, formatValue, getAuthSettings, getSoftrContext, guardRoute, initialSoftrContext, isAccessError, isAlreadyAuthenticatedError, isAuthorized, isForbiddenError, isUnauthenticatedError, pageHead, registerSoftrFields, softrAuthMiddleware, softrMcpMiddleware, toReturnPath, useAuthSettings, useCurrentUser, useFileUpload, useFormatting, useOverrides, usePushNotifications, usePwaInstall, useUserTimezone };
19
+ export { Audience, AuthSettingsProvider, DefaultErrorOverlay, FormattedDate, FormattingScope, SoftrPwaHead, assertRouteAccess, checkAccess, defineAiAction, defineIntegration, defineMutation, definePage, defineQuery, defineVisibility, defineWorkflow, fieldShape, formatDate, formatDateTime, formatDuration, formatField, formatNumber, formatValue, getAuthSettings, getSoftrContext, guardRoute, initialSoftrContext, isAccessError, isAlreadyAuthenticatedError, isAuthorized, isForbiddenError, isUnauthenticatedError, pageHead, registerSoftrFields, softrAuthMiddleware, softrMcpMiddleware, toReturnPath, useAuthSettings, useCurrentUser, useFileUpload, useFormatting, useIdleTimeout, useOverrides, usePushNotifications, usePwaInstall, useUserTimezone };
package/dist/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "1.2.1";
2
+ var version = "1.3.0-alpha.0";
3
3
 
4
4
  //#endregion
5
5
  export { version };
package/dist/pwa.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import * as react4 from "react";
1
+ import * as react0 from "react";
2
2
  import "@tanstack/react-start";
3
3
 
4
4
  //#region src/pwa.d.ts
@@ -23,7 +23,7 @@ import "@tanstack/react-start";
23
23
  * )
24
24
  * }
25
25
  */
26
- declare function SoftrPwaHead(): react4.FunctionComponentElement<react4.FragmentProps>;
26
+ declare function SoftrPwaHead(): react0.FunctionComponentElement<react0.FragmentProps>;
27
27
  type PwaPlatform = "ios" | "android" | "desktop";
28
28
  type PwaInstall = {
29
29
  available: false;
package/package.json CHANGED
@@ -1,16 +1,38 @@
1
1
  {
2
2
  "name": "@softr/sdk",
3
- "version": "1.2.1",
3
+ "version": "1.3.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.2.1
13
+ library_version: 1.3.0
14
14
  ---
15
15
 
16
16
  # Softr SDK core
@@ -33,7 +33,7 @@ Each sub-skill stands alone for its task and repeats the boundary above, so most
33
33
 
34
34
  | Import | Runs | Holds |
35
35
  | --- | --- | --- |
36
- | `@softr/sdk` | Both | `defineQuery`, `defineMutation`, `defineAiAction`, `definePage`, `pageHead`, `defineVisibility`, `guardRoute`, `assertRouteAccess`, `isAuthorized`, `checkAccess`, `Audience`, `useCurrentUser`, `useUserTimezone`, `FormattedDate`, `FormattingScope`, `useFormatting`, `formatDate`, `formatDateTime`, `formatNumber`, `formatValue`, `formatField`, `fieldShape`, `registerSoftrFields`, `useOverrides`, `SoftrPwaHead`, `usePwaInstall`, `usePushNotifications`, `getSoftrContext`, `initialSoftrContext`, `softrAuthMiddleware`, the error predicates, and every type |
36
+ | `@softr/sdk` | Both | `defineQuery`, `defineMutation`, `defineAiAction`, `definePage`, `pageHead`, `defineVisibility`, `guardRoute`, `assertRouteAccess`, `isAuthorized`, `checkAccess`, `Audience`, `useCurrentUser`, `useUserTimezone`, `useIdleTimeout`, `FormattedDate`, `FormattingScope`, `useFormatting`, `formatDate`, `formatDateTime`, `formatNumber`, `formatValue`, `formatField`, `fieldShape`, `registerSoftrFields`, `useOverrides`, `SoftrPwaHead`, `usePwaInstall`, `usePushNotifications`, `getSoftrContext`, `initialSoftrContext`, `softrAuthMiddleware`, the error predicates, and every type |
37
37
  | `@softr/sdk/server` | Server only | `ds`, `auth`, `workflow`, `integration`, `ai` |
38
38
  | `@softr/sdk/client` | Browser only | `useFileUpload` |
39
39
  | `@softr/sdk/vite` | Build | `softr()`, already in `vite.config.ts` |
@@ -13,7 +13,7 @@ description: >-
13
13
  metadata:
14
14
  type: sub-skill
15
15
  library: softr-sdk
16
- library_version: 1.2.1
16
+ library_version: 1.3.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.
@@ -9,7 +9,7 @@ description: >-
9
9
  metadata:
10
10
  type: sub-skill
11
11
  library: softr-sdk
12
- library_version: 1.2.1
12
+ library_version: 1.3.0
13
13
  ---
14
14
 
15
15
  **Boundary.** `auth` lives on `@softr/sdk/server` and runs only inside a `createServerFn` handler — importing it into a component fails the build.
@@ -9,7 +9,7 @@ description: >-
9
9
  metadata:
10
10
  type: sub-skill
11
11
  library: softr-sdk
12
- library_version: 1.2.1
12
+ library_version: 1.3.0
13
13
  ---
14
14
 
15
15
  **Boundary.** `ds` lives on `@softr/sdk/server` and runs only inside a `createServerFn` handler or a server-side route hook — importing it into a component fails the build. `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.2.1
12
+ library_version: 1.3.0
13
13
  ---
14
14
 
15
15
  # The current user
@@ -7,7 +7,7 @@ description: >-
7
7
  metadata:
8
8
  type: sub-skill
9
9
  library: softr-sdk
10
- library_version: 1.2.1
10
+ library_version: 1.3.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.2.1
11
+ library_version: 1.3.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.2.1
10
+ library_version: 1.3.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.2.1
12
+ library_version: 1.3.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.2.1
12
+ library_version: 1.3.0
13
13
  ---
14
14
 
15
15
  # Push notifications
@@ -9,7 +9,7 @@ description: >-
9
9
  metadata:
10
10
  type: sub-skill
11
11
  library: softr-sdk
12
- library_version: 1.2.1
12
+ library_version: 1.3.0
13
13
  ---
14
14
 
15
15
  # Installing the app
@@ -9,7 +9,7 @@ description: >-
9
9
  metadata:
10
10
  type: sub-skill
11
11
  library: softr-sdk
12
- library_version: 1.2.1
12
+ library_version: 1.3.0
13
13
  ---
14
14
 
15
15
  **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.
@@ -10,7 +10,7 @@ description: >-
10
10
  metadata:
11
11
  type: sub-skill
12
12
  library: softr-sdk
13
- library_version: 1.2.1
13
+ library_version: 1.3.0
14
14
  ---
15
15
 
16
16
  **Boundary.** `ds` lives on `@softr/sdk/server` and runs only inside a `createServerFn` handler or a server-side route hook — importing it into a component fails the build. The same holds for any helper that calls `ds`: declare it inside the handler. A function at module level that calls `ds` keeps the server-only import in the browser bundle, and every page stops loading until it moves. `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.2.1
12
+ library_version: 1.3.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.2.1
12
+ library_version: 1.3.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.2.1
12
+ library_version: 1.3.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.