@softr/sdk 0.0.52 → 0.0.53
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 +86 -2
- package/dist/package.js +1 -1
- package/package.json +1 -1
- 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,25 @@
|
|
|
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
|
+
/** Set by Studio's canvas engine, which ships apart from the SDK each app pins, so renaming it breaks older apps. */
|
|
7
|
+
const AGENT_TURN_ATTRIBUTE = "data-agent-turn";
|
|
8
|
+
function subscribeToAgentTurn(listener) {
|
|
9
|
+
const observer = new MutationObserver(listener);
|
|
10
|
+
observer.observe(document.documentElement, {
|
|
11
|
+
attributes: true,
|
|
12
|
+
attributeFilter: [AGENT_TURN_ATTRIBUTE]
|
|
13
|
+
});
|
|
14
|
+
return () => observer.disconnect();
|
|
15
|
+
}
|
|
16
|
+
function isAgentTurnRunning() {
|
|
17
|
+
return document.documentElement.getAttribute(AGENT_TURN_ATTRIBUTE) === "running";
|
|
18
|
+
}
|
|
5
19
|
function DefaultErrorOverlay({ error, reset }) {
|
|
6
20
|
if (process.env.NODE_ENV === "production") return /* @__PURE__ */ jsx("div", {
|
|
7
21
|
style: s.overlay,
|
|
22
|
+
"data-softr-error-overlay": "error",
|
|
8
23
|
children: /* @__PURE__ */ jsxs("div", {
|
|
9
24
|
style: s.card,
|
|
10
25
|
children: [
|
|
@@ -26,8 +41,33 @@ function DefaultErrorOverlay({ error, reset }) {
|
|
|
26
41
|
});
|
|
27
42
|
}
|
|
28
43
|
function DevView({ error, reset }) {
|
|
44
|
+
const running = useSyncExternalStore(subscribeToAgentTurn, isAgentTurnRunning, () => false);
|
|
45
|
+
const [retryPending, setRetryPending] = useState(running);
|
|
46
|
+
const router = useRouter();
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
if (running) {
|
|
49
|
+
setRetryPending(true);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (!retryPending) return;
|
|
53
|
+
const showError = () => setRetryPending(false);
|
|
54
|
+
const timer = setTimeout(() => {
|
|
55
|
+
router.invalidate().then(() => {
|
|
56
|
+
reset?.();
|
|
57
|
+
showError();
|
|
58
|
+
}, showError);
|
|
59
|
+
}, 1e3);
|
|
60
|
+
return () => clearTimeout(timer);
|
|
61
|
+
}, [
|
|
62
|
+
running,
|
|
63
|
+
retryPending,
|
|
64
|
+
reset,
|
|
65
|
+
router
|
|
66
|
+
]);
|
|
67
|
+
if (running || retryPending) return /* @__PURE__ */ jsx(UpdatingView, {});
|
|
29
68
|
return /* @__PURE__ */ jsx("div", {
|
|
30
69
|
style: s.overlay,
|
|
70
|
+
"data-softr-error-overlay": "error",
|
|
31
71
|
children: /* @__PURE__ */ jsxs("div", {
|
|
32
72
|
style: s.card,
|
|
33
73
|
children: [
|
|
@@ -56,6 +96,39 @@ function DevView({ error, reset }) {
|
|
|
56
96
|
})
|
|
57
97
|
});
|
|
58
98
|
}
|
|
99
|
+
function UpdatingView() {
|
|
100
|
+
return /* @__PURE__ */ jsx("div", {
|
|
101
|
+
style: s.overlay,
|
|
102
|
+
"data-softr-error-overlay": "updating",
|
|
103
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
104
|
+
style: s.card,
|
|
105
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
106
|
+
style: s.pending,
|
|
107
|
+
children: /* @__PURE__ */ jsxs("svg", {
|
|
108
|
+
style: icon.md,
|
|
109
|
+
viewBox: "0 0 24 24",
|
|
110
|
+
fill: "none",
|
|
111
|
+
stroke: "currentColor",
|
|
112
|
+
strokeWidth: "2",
|
|
113
|
+
strokeLinecap: "round",
|
|
114
|
+
strokeLinejoin: "round",
|
|
115
|
+
children: [
|
|
116
|
+
/* @__PURE__ */ jsx("path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8" }),
|
|
117
|
+
/* @__PURE__ */ jsx("path", { d: "M21 3v5h-5" }),
|
|
118
|
+
/* @__PURE__ */ jsx("path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16" }),
|
|
119
|
+
/* @__PURE__ */ jsx("path", { d: "M8 16H3v5" })
|
|
120
|
+
]
|
|
121
|
+
})
|
|
122
|
+
}), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h1", {
|
|
123
|
+
style: s.heading,
|
|
124
|
+
children: "Updating the app…"
|
|
125
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
126
|
+
style: s.body,
|
|
127
|
+
children: "The agent is still working on this change. The preview will recover once it is complete."
|
|
128
|
+
})] })]
|
|
129
|
+
})
|
|
130
|
+
});
|
|
131
|
+
}
|
|
59
132
|
function cleanStack(stack) {
|
|
60
133
|
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
134
|
}
|
|
@@ -228,6 +301,17 @@ const s = {
|
|
|
228
301
|
color: "var(--destructive, oklch(0.577 0.245 27.325))",
|
|
229
302
|
flexShrink: 0
|
|
230
303
|
},
|
|
304
|
+
pending: {
|
|
305
|
+
display: "flex",
|
|
306
|
+
alignItems: "center",
|
|
307
|
+
justifyContent: "center",
|
|
308
|
+
width: "2.5rem",
|
|
309
|
+
height: "2.5rem",
|
|
310
|
+
borderRadius: "var(--radius, 0.625rem)",
|
|
311
|
+
background: "var(--muted, oklch(0.97 0 0))",
|
|
312
|
+
color: "var(--muted-foreground, oklch(0.556 0 0))",
|
|
313
|
+
flexShrink: 0
|
|
314
|
+
},
|
|
231
315
|
heading: {
|
|
232
316
|
margin: 0,
|
|
233
317
|
fontSize: "1rem",
|
|
@@ -267,7 +351,7 @@ const s = {
|
|
|
267
351
|
border: "1px solid var(--input, oklch(0.922 0 0))",
|
|
268
352
|
borderRadius: "var(--radius, 0.625rem)",
|
|
269
353
|
background: "var(--input-fill, oklch(1 0 0))",
|
|
270
|
-
color: "var(--
|
|
354
|
+
color: "var(--foreground, oklch(0.145 0 0))",
|
|
271
355
|
fontFamily: "inherit",
|
|
272
356
|
fontSize: "0.875rem",
|
|
273
357
|
fontWeight: 500,
|
package/dist/package.js
CHANGED
package/package.json
CHANGED
|
@@ -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.53
|
|
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.53
|
|
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.53
|
|
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.53
|
|
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.53
|
|
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.53
|
|
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.53
|
|
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.53
|
|
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.
|