@softr/sdk 1.1.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 +6 -0
- 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 +2 -2
- 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 +1 -1
- 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
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,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
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():
|
|
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.1.0",
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
@@ -9,7 +9,7 @@ description: >-
|
|
|
9
9
|
metadata:
|
|
10
10
|
type: sub-skill
|
|
11
11
|
library: softr-sdk
|
|
12
|
-
library_version: 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.
|
|
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.
|
|
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.
|