@softr/sdk 0.0.49 → 0.0.50-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/dist/default-error-overlay.js +84 -2
- package/dist/mcp.js +2 -2
- package/dist/package.js +1 -1
- package/package.json +33 -10
- package/skills/softr-sdk/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/integrations/SKILL.md +1 -1
- package/skills/softr-sdk/mcp/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
|
@@ -1,10 +1,23 @@
|
|
|
1
|
-
import { useRef, useState } from "react";
|
|
1
|
+
import { useEffect, useRef, useState, useSyncExternalStore } from "react";
|
|
2
|
+
import { useRouter } from "@tanstack/react-router";
|
|
2
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
4
|
|
|
4
5
|
//#region src/default-error-overlay.tsx
|
|
6
|
+
function subscribeToAgentTurn(listener) {
|
|
7
|
+
const observer = new MutationObserver(listener);
|
|
8
|
+
observer.observe(document.documentElement, {
|
|
9
|
+
attributes: true,
|
|
10
|
+
attributeFilter: ["data-agent-turn"]
|
|
11
|
+
});
|
|
12
|
+
return () => observer.disconnect();
|
|
13
|
+
}
|
|
14
|
+
function isAgentTurnRunning() {
|
|
15
|
+
return document.documentElement.dataset.agentTurn === "running";
|
|
16
|
+
}
|
|
5
17
|
function DefaultErrorOverlay({ error, reset }) {
|
|
6
18
|
if (process.env.NODE_ENV === "production") return /* @__PURE__ */ jsx("div", {
|
|
7
19
|
style: s.overlay,
|
|
20
|
+
"data-softr-error-overlay": "error",
|
|
8
21
|
children: /* @__PURE__ */ jsxs("div", {
|
|
9
22
|
style: s.card,
|
|
10
23
|
children: [
|
|
@@ -26,8 +39,33 @@ function DefaultErrorOverlay({ error, reset }) {
|
|
|
26
39
|
});
|
|
27
40
|
}
|
|
28
41
|
function DevView({ error, reset }) {
|
|
42
|
+
const running = useSyncExternalStore(subscribeToAgentTurn, isAgentTurnRunning, () => false);
|
|
43
|
+
const [caughtDuringTurn, setCaughtDuringTurn] = useState(running);
|
|
44
|
+
const router = useRouter();
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
if (running) {
|
|
47
|
+
setCaughtDuringTurn(true);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (!caughtDuringTurn) return;
|
|
51
|
+
const showError = () => setCaughtDuringTurn(false);
|
|
52
|
+
const timer = setTimeout(() => {
|
|
53
|
+
router.invalidate().then(() => {
|
|
54
|
+
reset?.();
|
|
55
|
+
showError();
|
|
56
|
+
}, showError);
|
|
57
|
+
}, 1e3);
|
|
58
|
+
return () => clearTimeout(timer);
|
|
59
|
+
}, [
|
|
60
|
+
running,
|
|
61
|
+
caughtDuringTurn,
|
|
62
|
+
reset,
|
|
63
|
+
router
|
|
64
|
+
]);
|
|
65
|
+
if (running || caughtDuringTurn) return /* @__PURE__ */ jsx(UpdatingView, {});
|
|
29
66
|
return /* @__PURE__ */ jsx("div", {
|
|
30
67
|
style: s.overlay,
|
|
68
|
+
"data-softr-error-overlay": "error",
|
|
31
69
|
children: /* @__PURE__ */ jsxs("div", {
|
|
32
70
|
style: s.card,
|
|
33
71
|
children: [
|
|
@@ -56,6 +94,39 @@ function DevView({ error, reset }) {
|
|
|
56
94
|
})
|
|
57
95
|
});
|
|
58
96
|
}
|
|
97
|
+
function UpdatingView() {
|
|
98
|
+
return /* @__PURE__ */ jsx("div", {
|
|
99
|
+
style: s.overlay,
|
|
100
|
+
"data-softr-error-overlay": "updating",
|
|
101
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
102
|
+
style: s.card,
|
|
103
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
104
|
+
style: s.pending,
|
|
105
|
+
children: /* @__PURE__ */ jsxs("svg", {
|
|
106
|
+
style: icon.md,
|
|
107
|
+
viewBox: "0 0 24 24",
|
|
108
|
+
fill: "none",
|
|
109
|
+
stroke: "currentColor",
|
|
110
|
+
strokeWidth: "2",
|
|
111
|
+
strokeLinecap: "round",
|
|
112
|
+
strokeLinejoin: "round",
|
|
113
|
+
children: [
|
|
114
|
+
/* @__PURE__ */ jsx("path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8" }),
|
|
115
|
+
/* @__PURE__ */ jsx("path", { d: "M21 3v5h-5" }),
|
|
116
|
+
/* @__PURE__ */ jsx("path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16" }),
|
|
117
|
+
/* @__PURE__ */ jsx("path", { d: "M8 16H3v5" })
|
|
118
|
+
]
|
|
119
|
+
})
|
|
120
|
+
}), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h1", {
|
|
121
|
+
style: s.heading,
|
|
122
|
+
children: "Updating the app…"
|
|
123
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
124
|
+
style: s.body,
|
|
125
|
+
children: "The agent is still working on this change. The preview will recover once it is complete."
|
|
126
|
+
})] })]
|
|
127
|
+
})
|
|
128
|
+
});
|
|
129
|
+
}
|
|
59
130
|
function cleanStack(stack) {
|
|
60
131
|
return stack.split("\n").slice(1).filter((line) => line.trim().startsWith("at ") && !line.includes("/node_modules/")).map((line) => line.replace(/https?:\/\/[^/]+\//, "").replace(/\?[^):]+/g, "")).join("\n");
|
|
61
132
|
}
|
|
@@ -228,6 +299,17 @@ const s = {
|
|
|
228
299
|
color: "var(--destructive, oklch(0.577 0.245 27.325))",
|
|
229
300
|
flexShrink: 0
|
|
230
301
|
},
|
|
302
|
+
pending: {
|
|
303
|
+
display: "flex",
|
|
304
|
+
alignItems: "center",
|
|
305
|
+
justifyContent: "center",
|
|
306
|
+
width: "2.5rem",
|
|
307
|
+
height: "2.5rem",
|
|
308
|
+
borderRadius: "var(--radius, 0.625rem)",
|
|
309
|
+
background: "var(--muted, oklch(0.97 0 0))",
|
|
310
|
+
color: "var(--muted-foreground, oklch(0.556 0 0))",
|
|
311
|
+
flexShrink: 0
|
|
312
|
+
},
|
|
231
313
|
heading: {
|
|
232
314
|
margin: 0,
|
|
233
315
|
fontSize: "1rem",
|
|
@@ -267,7 +349,7 @@ const s = {
|
|
|
267
349
|
border: "1px solid var(--input, oklch(0.922 0 0))",
|
|
268
350
|
borderRadius: "var(--radius, 0.625rem)",
|
|
269
351
|
background: "var(--input-fill, oklch(1 0 0))",
|
|
270
|
-
color: "var(--
|
|
352
|
+
color: "var(--foreground, oklch(0.145 0 0))",
|
|
271
353
|
fontFamily: "inherit",
|
|
272
354
|
fontSize: "0.875rem",
|
|
273
355
|
fontWeight: 500,
|
package/dist/mcp.js
CHANGED
|
@@ -226,10 +226,10 @@ async function platformSession(accessToken) {
|
|
|
226
226
|
ok: false,
|
|
227
227
|
refused: response.status === 401 || response.status === 403
|
|
228
228
|
};
|
|
229
|
-
const parsed = z.object({
|
|
229
|
+
const parsed = z.object({ sessionJwt: z.string() }).safeParse(await response.json().catch(() => null));
|
|
230
230
|
return parsed.success ? {
|
|
231
231
|
ok: true,
|
|
232
|
-
sessionToken: parsed.data.
|
|
232
|
+
sessionToken: parsed.data.sessionJwt
|
|
233
233
|
} : {
|
|
234
234
|
ok: false,
|
|
235
235
|
refused: false
|
package/dist/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,16 +1,37 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@softr/sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.50-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
|
+
],
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public"
|
|
34
|
+
},
|
|
14
35
|
"scripts": {
|
|
15
36
|
"build": "tsdown",
|
|
16
37
|
"test": "node --import ./src/test-utils/setup.ts --test",
|
|
@@ -42,7 +63,9 @@
|
|
|
42
63
|
"optional": true
|
|
43
64
|
}
|
|
44
65
|
},
|
|
45
|
-
"keywords": [
|
|
66
|
+
"keywords": [
|
|
67
|
+
"tanstack-intent"
|
|
68
|
+
],
|
|
46
69
|
"intent": {
|
|
47
70
|
"version": 1,
|
|
48
71
|
"repo": "@softr/sdk",
|
|
@@ -16,7 +16,7 @@ description: >-
|
|
|
16
16
|
metadata:
|
|
17
17
|
type: sub-skill
|
|
18
18
|
library: softr-sdk
|
|
19
|
-
library_version: 0.0.
|
|
19
|
+
library_version: 0.0.50
|
|
20
20
|
---
|
|
21
21
|
|
|
22
22
|
**Boundary.** `auth` lives on `@softr/sdk/server` and runs only inside a `createServerFn` handler — importing it into a component fails the build.
|
|
@@ -12,7 +12,7 @@ description: >-
|
|
|
12
12
|
metadata:
|
|
13
13
|
type: sub-skill
|
|
14
14
|
library: softr-sdk
|
|
15
|
-
library_version: 0.0.
|
|
15
|
+
library_version: 0.0.50
|
|
16
16
|
---
|
|
17
17
|
|
|
18
18
|
**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.
|
|
@@ -10,7 +10,7 @@ description: >-
|
|
|
10
10
|
metadata:
|
|
11
11
|
type: sub-skill
|
|
12
12
|
library: softr-sdk
|
|
13
|
-
library_version: 0.0.
|
|
13
|
+
library_version: 0.0.50
|
|
14
14
|
---
|
|
15
15
|
|
|
16
16
|
**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.
|
|
@@ -10,7 +10,7 @@ description: >-
|
|
|
10
10
|
metadata:
|
|
11
11
|
type: sub-skill
|
|
12
12
|
library: softr-sdk
|
|
13
|
-
library_version: 0.0.
|
|
13
|
+
library_version: 0.0.50
|
|
14
14
|
---
|
|
15
15
|
|
|
16
16
|
**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: 0.0.
|
|
12
|
+
library_version: 0.0.50
|
|
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.
|
|
@@ -11,7 +11,7 @@ description: >-
|
|
|
11
11
|
metadata:
|
|
12
12
|
type: sub-skill
|
|
13
13
|
library: softr-sdk
|
|
14
|
-
library_version: 0.0.
|
|
14
|
+
library_version: 0.0.50
|
|
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. `defineMutation` and every type come from `@softr/sdk` and can be imported anywhere.
|
|
@@ -13,7 +13,7 @@ description: >-
|
|
|
13
13
|
metadata:
|
|
14
14
|
type: sub-skill
|
|
15
15
|
library: softr-sdk
|
|
16
|
-
library_version: 0.0.
|
|
16
|
+
library_version: 0.0.50
|
|
17
17
|
---
|
|
18
18
|
|
|
19
19
|
**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: 0.0.
|
|
12
|
+
library_version: 0.0.50
|
|
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.
|