@softr/sdk 1.1.1-alpha.0 → 1.1.2-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 +1 -1
- package/dist/auth/isomorphic.d.ts +6 -6
- package/dist/default-error-overlay.d.ts +2 -2
- package/dist/formatting.d.ts +3 -3
- package/dist/mcp.d.ts +2 -2
- package/dist/package.js +1 -1
- package/dist/pwa.d.ts +4 -5
- package/dist/pwa.js +5 -36
- package/package.json +34 -10
- package/skills/softr-sdk/SKILL.md +1 -1
- package/skills/softr-sdk/ai/SKILL.md +1 -1
- package/skills/softr-sdk/auth/SKILL.md +1 -1
- package/skills/softr-sdk/charts-and-metrics/SKILL.md +1 -1
- package/skills/softr-sdk/current-user/SKILL.md +1 -1
- package/skills/softr-sdk/file-uploads/SKILL.md +1 -1
- package/skills/softr-sdk/formatting/SKILL.md +29 -3
- package/skills/softr-sdk/integrations/SKILL.md +1 -1
- package/skills/softr-sdk/mcp/SKILL.md +1 -1
- package/skills/softr-sdk/push-notifications/SKILL.md +1 -1
- package/skills/softr-sdk/pwa/SKILL.md +7 -7
- package/skills/softr-sdk/record-mutations/SKILL.md +1 -1
- package/skills/softr-sdk/record-queries/SKILL.md +1 -1
- package/skills/softr-sdk/region-visibility/SKILL.md +1 -1
- package/skills/softr-sdk/routes-and-visibility/SKILL.md +1 -1
- package/skills/softr-sdk/workflows/SKILL.md +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- The formatting skill names the keys `parts` takes and says there is no `timeStyle`.
|
|
8
8
|
|
|
9
9
|
## 1.1.0
|
|
10
10
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { User } from "./user.js";
|
|
2
2
|
import { Formatting } from "../formatting.js";
|
|
3
3
|
import { SoftrContext } from "./context.js";
|
|
4
|
-
import * as
|
|
4
|
+
import * as react0 from "react";
|
|
5
5
|
import { ReactNode } from "react";
|
|
6
|
-
import * as
|
|
6
|
+
import * as _tanstack_react_start0 from "@tanstack/react-start";
|
|
7
7
|
|
|
8
8
|
//#region src/auth/isomorphic.d.ts
|
|
9
9
|
|
|
@@ -21,7 +21,7 @@ import * as _tanstack_react_start2 from "@tanstack/react-start";
|
|
|
21
21
|
* requestMiddleware: [softrAuthMiddleware()],
|
|
22
22
|
* }))
|
|
23
23
|
*/
|
|
24
|
-
declare function softrAuthMiddleware():
|
|
24
|
+
declare function softrAuthMiddleware(): _tanstack_react_start0.RequestMiddlewareAfterServer<{}, readonly [_tanstack_react_start0.RequestMiddlewareAfterServer<{}, undefined, undefined>, _tanstack_react_start0.RequestMiddlewareAfterServer<{}, undefined, undefined>, _tanstack_react_start0.RequestMiddlewareAfterServer<{}, undefined, undefined>, _tanstack_react_start0.RequestMiddlewareAfterServer<{}, undefined, undefined>, _tanstack_react_start0.RequestMiddlewareAfterServer<{}, undefined, undefined>, _tanstack_react_start0.RequestMiddlewareAfterServer<{}, undefined, undefined>], {
|
|
25
25
|
user: User | null;
|
|
26
26
|
permissions: {
|
|
27
27
|
datasources: {};
|
|
@@ -37,7 +37,7 @@ declare function softrAuthMiddleware(): _tanstack_react_start2.RequestMiddleware
|
|
|
37
37
|
* beforeLoad: async () => await getSoftrContext(),
|
|
38
38
|
* })
|
|
39
39
|
*/
|
|
40
|
-
declare const getSoftrContext:
|
|
40
|
+
declare const getSoftrContext: _tanstack_react_start0.OptionalFetcher<undefined, undefined, Promise<SoftrContext>>;
|
|
41
41
|
/**
|
|
42
42
|
* The context to hand `createRouter`, before any request has resolved one.
|
|
43
43
|
*
|
|
@@ -85,7 +85,7 @@ type AuthOptions = {
|
|
|
85
85
|
* staleTime: 60_000,
|
|
86
86
|
* })
|
|
87
87
|
*/
|
|
88
|
-
declare const getAuthSettings:
|
|
88
|
+
declare const getAuthSettings: _tanstack_react_start0.OptionalFetcher<undefined, undefined, Promise<AuthOptions>>;
|
|
89
89
|
/**
|
|
90
90
|
* Makes the auth options readable with {@link useAuthSettings} anywhere below.
|
|
91
91
|
*
|
|
@@ -105,7 +105,7 @@ declare function AuthSettingsProvider({
|
|
|
105
105
|
}: {
|
|
106
106
|
value: AuthOptions;
|
|
107
107
|
children?: ReactNode;
|
|
108
|
-
}):
|
|
108
|
+
}): react0.JSX.Element;
|
|
109
109
|
/**
|
|
110
110
|
* Which ways in this app offers. Requires an {@link AuthSettingsProvider}
|
|
111
111
|
* above it.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react6 from "react";
|
|
2
2
|
|
|
3
3
|
//#region src/default-error-overlay.d.ts
|
|
4
4
|
type Props = {
|
|
@@ -8,6 +8,6 @@ type Props = {
|
|
|
8
8
|
declare function DefaultErrorOverlay({
|
|
9
9
|
error,
|
|
10
10
|
reset
|
|
11
|
-
}: Props):
|
|
11
|
+
}: Props): react6.JSX.Element;
|
|
12
12
|
//#endregion
|
|
13
13
|
export { DefaultErrorOverlay };
|
package/dist/formatting.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import * as
|
|
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
|
-
}):
|
|
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
|
-
}):
|
|
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/mcp.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DatasourceAction } from "./action.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _tanstack_react_start0 from "@tanstack/react-start";
|
|
3
3
|
|
|
4
4
|
//#region src/mcp.d.ts
|
|
5
5
|
|
|
@@ -31,6 +31,6 @@ type SoftrMcpOptions = {
|
|
|
31
31
|
* ],
|
|
32
32
|
* }))
|
|
33
33
|
*/
|
|
34
|
-
declare function softrMcpMiddleware(options?: SoftrMcpOptions):
|
|
34
|
+
declare function softrMcpMiddleware(options?: SoftrMcpOptions): _tanstack_react_start0.RequestMiddlewareAfterServer<{}, undefined, undefined>;
|
|
35
35
|
//#endregion
|
|
36
36
|
export { softrMcpMiddleware };
|
package/dist/package.js
CHANGED
package/dist/pwa.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react0 from "react";
|
|
2
2
|
import "@tanstack/react-start";
|
|
3
3
|
|
|
4
4
|
//#region src/pwa.d.ts
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* The
|
|
8
|
-
*
|
|
9
|
-
* Render it once, in `<head>` in the root route's `RootDocument`.
|
|
7
|
+
* The links that make the app installable: its manifest and its home screen
|
|
8
|
+
* icon. Render it once, in `<head>` in the root route's `RootDocument`.
|
|
10
9
|
*
|
|
11
10
|
* @example
|
|
12
11
|
* function RootDocument({ children }: { children: React.ReactNode }) {
|
|
@@ -24,7 +23,7 @@ import "@tanstack/react-start";
|
|
|
24
23
|
* )
|
|
25
24
|
* }
|
|
26
25
|
*/
|
|
27
|
-
declare function SoftrPwaHead():
|
|
26
|
+
declare function SoftrPwaHead(): react0.FunctionComponentElement<react0.FragmentProps>;
|
|
28
27
|
type PwaPlatform = "ios" | "android" | "desktop";
|
|
29
28
|
type PwaInstall = {
|
|
30
29
|
available: false;
|
package/dist/pwa.js
CHANGED
|
@@ -18,13 +18,8 @@ const pwaSchema = z.object({
|
|
|
18
18
|
install: z.object({
|
|
19
19
|
name: z.string(),
|
|
20
20
|
iconUrl: z.string()
|
|
21
|
-
})
|
|
22
|
-
startupImages: z.array(z.object({
|
|
23
|
-
media: z.string(),
|
|
24
|
-
href: z.string()
|
|
25
|
-
})).default([])
|
|
21
|
+
})
|
|
26
22
|
});
|
|
27
|
-
const iosHeadSchema = pwaSchema.pick({ startupImages: true }).extend({ name: z.string() });
|
|
28
23
|
let cached;
|
|
29
24
|
/** The app's PWA, or `null` when it is not installable right now. */
|
|
30
25
|
function readPwa() {
|
|
@@ -54,10 +49,7 @@ function pwaMiddleware() {
|
|
|
54
49
|
"content-type": "application/manifest+json",
|
|
55
50
|
"cache-control": CACHE_CONTROL
|
|
56
51
|
} });
|
|
57
|
-
if (pathname === INSTALL_PATH) return Response.json({
|
|
58
|
-
...pwa.install,
|
|
59
|
-
startupImages: pwa.startupImages
|
|
60
|
-
}, { headers: { "cache-control": CACHE_CONTROL } });
|
|
52
|
+
if (pathname === INSTALL_PATH) return Response.json(pwa.install, { headers: { "cache-control": CACHE_CONTROL } });
|
|
61
53
|
try {
|
|
62
54
|
const iconResponse = await fetch(pwa.install.iconUrl);
|
|
63
55
|
if (!iconResponse.ok) return new Response(null, { status: 404 });
|
|
@@ -72,9 +64,8 @@ function pwaMiddleware() {
|
|
|
72
64
|
});
|
|
73
65
|
}
|
|
74
66
|
/**
|
|
75
|
-
* The
|
|
76
|
-
*
|
|
77
|
-
* Render it once, in `<head>` in the root route's `RootDocument`.
|
|
67
|
+
* The links that make the app installable: its manifest and its home screen
|
|
68
|
+
* icon. Render it once, in `<head>` in the root route's `RootDocument`.
|
|
78
69
|
*
|
|
79
70
|
* @example
|
|
80
71
|
* function RootDocument({ children }: { children: React.ReactNode }) {
|
|
@@ -93,35 +84,13 @@ function pwaMiddleware() {
|
|
|
93
84
|
* }
|
|
94
85
|
*/
|
|
95
86
|
function SoftrPwaHead() {
|
|
96
|
-
const [iosHead, setIosHead] = useState(null);
|
|
97
|
-
useEffect(() => {
|
|
98
|
-
if (detectPlatform() !== "ios") return;
|
|
99
|
-
let cancelled = false;
|
|
100
|
-
globalThis.fetch(INSTALL_PATH, { headers: { accept: "application/json" } }).then(async (response) => {
|
|
101
|
-
if (!response.ok) return;
|
|
102
|
-
const parsed = iosHeadSchema.safeParse(await response.json());
|
|
103
|
-
if (!parsed.success || cancelled) return;
|
|
104
|
-
setIosHead(parsed.data);
|
|
105
|
-
}).catch(() => {});
|
|
106
|
-
return () => {
|
|
107
|
-
cancelled = true;
|
|
108
|
-
};
|
|
109
|
-
}, []);
|
|
110
87
|
return createElement(Fragment, null, createElement("link", {
|
|
111
88
|
rel: "manifest",
|
|
112
89
|
href: MANIFEST_PATH
|
|
113
90
|
}), createElement("link", {
|
|
114
91
|
rel: "apple-touch-icon",
|
|
115
92
|
href: ICON_PATH
|
|
116
|
-
})
|
|
117
|
-
name: "apple-mobile-web-app-title",
|
|
118
|
-
content: iosHead.name
|
|
119
|
-
}), ...(iosHead?.startupImages ?? []).map((image) => createElement("link", {
|
|
120
|
-
key: image.href,
|
|
121
|
-
rel: "apple-touch-startup-image",
|
|
122
|
-
media: image.media,
|
|
123
|
-
href: image.href
|
|
124
|
-
})));
|
|
93
|
+
}));
|
|
125
94
|
}
|
|
126
95
|
const installSchema = pwaSchema.shape.install;
|
|
127
96
|
/**
|
package/package.json
CHANGED
|
@@ -1,16 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@softr/sdk",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2-alpha.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
|
-
".": {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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": [
|
|
67
|
+
"keywords": [
|
|
68
|
+
"tanstack-intent"
|
|
69
|
+
],
|
|
46
70
|
"intent": {
|
|
47
71
|
"version": 1,
|
|
48
72
|
"repo": "@softr/sdk",
|
|
@@ -13,7 +13,7 @@ description: >-
|
|
|
13
13
|
metadata:
|
|
14
14
|
type: sub-skill
|
|
15
15
|
library: softr-sdk
|
|
16
|
-
library_version: 1.1.1
|
|
16
|
+
library_version: 1.1.1
|
|
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.1.1
|
|
12
|
+
library_version: 1.1.1
|
|
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.1.1
|
|
12
|
+
library_version: 1.1.1
|
|
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.
|
|
@@ -7,7 +7,7 @@ description: >-
|
|
|
7
7
|
metadata:
|
|
8
8
|
type: sub-skill
|
|
9
9
|
library: softr-sdk
|
|
10
|
-
library_version: 1.1.1
|
|
10
|
+
library_version: 1.1.1
|
|
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.1.1
|
|
11
|
+
library_version: 1.1.1
|
|
12
12
|
---
|
|
13
13
|
|
|
14
14
|
# Dates, times and numbers
|
|
@@ -41,7 +41,7 @@ type Formatting = {
|
|
|
41
41
|
|
|
42
42
|
type DateOptions = {
|
|
43
43
|
dateStyle?: 'short' | 'medium' | 'long' | 'full'
|
|
44
|
-
parts?: { weekday?, year?, month?, day?, hour?, minute?, timeZoneName? } //
|
|
44
|
+
parts?: { weekday?, year?, month?, day?, hour?, minute?, timeZoneName? } // only these seven keys
|
|
45
45
|
timeZone?: string // IANA, such as 'America/New_York'
|
|
46
46
|
}
|
|
47
47
|
```
|
|
@@ -58,9 +58,11 @@ type DateOptions = {
|
|
|
58
58
|
|
|
59
59
|
A timestamp (`DATETIME`, `CREATED_AT`, `UPDATED_AT`) is a UTC instant and needs a time zone. On a visitor's first page load their zone can be unknown, and then `FormattedDate` renders its `fallback` (nothing by default) until the browser supplies it. A calendar day (`DATE`, such as `2026-10-06`) names the same day everywhere and always renders at once. `dateStyle` applies only when the app uses the visitor's format; a fixed format ignores it.
|
|
60
60
|
|
|
61
|
+
There is no `timeStyle`. `time` and `formatDateTime` add the time in the app's style, with or without `dateStyle`. For the time alone, use `parts`.
|
|
62
|
+
|
|
61
63
|
### Part of a date: `parts`
|
|
62
64
|
|
|
63
|
-
A list already filtered to this year needs only the month. A schedule needs only the time. `parts` takes
|
|
65
|
+
A list already filtered to this year needs only the month. A schedule needs only the time. `parts` takes seven keys, with their `Intl` values: `weekday`, `year`, `month`, `day`, `hour`, `minute` and `timeZoneName`. Nothing else, so no `dateStyle`, `timeStyle` or `hour12`. It wins over `dateStyle` and the app's fixed format. The locale and the zone still come from the app.
|
|
64
66
|
|
|
65
67
|
```tsx
|
|
66
68
|
<FormattedDate value={post.fields.published} parts={{ month: 'long', year: 'numeric' }} /> // October 2026
|
|
@@ -68,6 +70,12 @@ A list already filtered to this year needs only the month. A schedule needs only
|
|
|
68
70
|
<FormattedDate value={shift.fields.starts} parts={{ hour: 'numeric', minute: 'numeric' }} /> // 14:30
|
|
69
71
|
```
|
|
70
72
|
|
|
73
|
+
The format functions take the same keys inside `parts`, never at the top level:
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
formatDate(post.fields.published, formatting, { parts: { month: 'long', year: 'numeric' } })
|
|
77
|
+
```
|
|
78
|
+
|
|
71
79
|
### A zone or a locale the user names
|
|
72
80
|
|
|
73
81
|
"Show this page in New York time" or "use German formatting here" is a fixed value. It wins over the visitor's and the app's settings. A date in a named zone renders on the server at once, with no fallback.
|
|
@@ -224,6 +232,24 @@ Correct:
|
|
|
224
232
|
|
|
225
233
|
On a first visit `formatting.timeZone` is `null`. `undefined` makes the server use its own zone and the browser use the visitor's, so the text differs and hydration fails. Use the helpers, or render nothing until the zone is known.
|
|
226
234
|
|
|
235
|
+
### HIGH: Passing `Intl` options the helpers do not take
|
|
236
|
+
|
|
237
|
+
Wrong:
|
|
238
|
+
|
|
239
|
+
```ts
|
|
240
|
+
formatDateTime(shift.fields.starts, formatting, { dateStyle: 'medium', timeStyle: 'short' })
|
|
241
|
+
formatDate(post.fields.published, formatting, { month: 'long', year: 'numeric' })
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
Correct:
|
|
245
|
+
|
|
246
|
+
```ts
|
|
247
|
+
formatDateTime(shift.fields.starts, formatting, { dateStyle: 'medium' })
|
|
248
|
+
formatDate(post.fields.published, formatting, { parts: { month: 'long', year: 'numeric' } })
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
The options are `dateStyle`, `parts` and `timeZone`, not `Intl.DateTimeFormatOptions`. Anything else fails the type check. `formatDateTime` adds the time itself, and the date parts go inside `parts`.
|
|
252
|
+
|
|
227
253
|
## References
|
|
228
254
|
|
|
229
255
|
- [SKILL.md](../SKILL.md): the entrypoints and which one each export lives on
|
|
@@ -7,7 +7,7 @@ description: >-
|
|
|
7
7
|
metadata:
|
|
8
8
|
type: sub-skill
|
|
9
9
|
library: softr-sdk
|
|
10
|
-
library_version: 1.1.1
|
|
10
|
+
library_version: 1.1.1
|
|
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.1.1
|
|
12
|
+
library_version: 1.1.1
|
|
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.
|
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
name: pwa
|
|
3
3
|
description: >-
|
|
4
4
|
Let visitors install the app on their home screen: SoftrPwaHead for the
|
|
5
|
-
manifest
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
manifest and icon links, usePwaInstall to decide whether to show an install
|
|
6
|
+
button and which platform's steps to show, the PwaInstall and PwaPlatform
|
|
7
|
+
types, and how to check that the app is installable. The manifest and icon are
|
|
8
|
+
already served; never write them.
|
|
9
9
|
metadata:
|
|
10
10
|
type: sub-skill
|
|
11
11
|
library: softr-sdk
|
|
12
|
-
library_version: 1.1.1
|
|
12
|
+
library_version: 1.1.1
|
|
13
13
|
---
|
|
14
14
|
|
|
15
15
|
# Installing the app
|
|
16
16
|
|
|
17
17
|
The builder turns installing on in Studio, under Settings → Mobile app, and sets the name, colour and icon there. The app already answers with its manifest and icon once they do. What the app adds is two things: the links that point the browser at them, and a button that tells visitors how to install.
|
|
18
18
|
|
|
19
|
-
> **CRITICAL**: Never write a web app manifest, icon files, a service worker, or `manifest` / `apple-touch-icon`
|
|
19
|
+
> **CRITICAL**: Never write a web app manifest, icon files, a service worker, or `manifest` / `apple-touch-icon` links of your own, in `public/` or in `head()`. The app already serves them from Studio's settings, and a file of your own shadows those settings.
|
|
20
20
|
>
|
|
21
21
|
> **CRITICAL**: Render an install button only while `usePwaInstall()` returns `available: true`. Never show it unconditionally, never cache the answer, never replace the check with your own. Softr can switch installing off for an app, and this check is the only way that reaches the button.
|
|
22
22
|
|
|
@@ -48,7 +48,7 @@ The builder switches installing on in Studio, and `usePwaInstall()` reads that s
|
|
|
48
48
|
|
|
49
49
|
### The links: `<SoftrPwaHead />`
|
|
50
50
|
|
|
51
|
-
Render it once, in `<head>` next to `<HeadContent />`, in `RootDocument` in `src/routes/__root.tsx`.
|
|
51
|
+
Render it once, in `<head>` next to `<HeadContent />`, in `RootDocument` in `src/routes/__root.tsx`.
|
|
52
52
|
|
|
53
53
|
```tsx
|
|
54
54
|
function RootDocument({ children }: { children: React.ReactNode }) {
|
|
@@ -9,7 +9,7 @@ description: >-
|
|
|
9
9
|
metadata:
|
|
10
10
|
type: sub-skill
|
|
11
11
|
library: softr-sdk
|
|
12
|
-
library_version: 1.1.1
|
|
12
|
+
library_version: 1.1.1
|
|
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.1.1
|
|
13
|
+
library_version: 1.1.1
|
|
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.1.1
|
|
12
|
+
library_version: 1.1.1
|
|
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.1.1
|
|
12
|
+
library_version: 1.1.1
|
|
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.
|