@softr/sdk 0.0.94 → 0.0.96
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/auth/isomorphic.d.ts +3 -2
- package/dist/auth/isomorphic.js +2 -2
- package/dist/auth/session.js +2 -8
- package/dist/default-error-overlay.js +5 -1
- package/dist/package.js +1 -1
- package/package.json +1 -1
- 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 +1 -1
- package/skills/softr-sdk/integrations/SKILL.md +1 -1
- package/skills/softr-sdk/mcp/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
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { User } from "./user.js";
|
|
2
2
|
import { Formatting } from "../formatting.js";
|
|
3
|
-
import { Permissions } from "./permissions.js";
|
|
4
3
|
import { SoftrContext } from "./context.js";
|
|
5
4
|
import * as react0 from "react";
|
|
6
5
|
import { ReactNode } from "react";
|
|
@@ -24,7 +23,9 @@ import * as _tanstack_react_start0 from "@tanstack/react-start";
|
|
|
24
23
|
*/
|
|
25
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>], {
|
|
26
25
|
user: User | null;
|
|
27
|
-
permissions:
|
|
26
|
+
permissions: {
|
|
27
|
+
datasources: {};
|
|
28
|
+
};
|
|
28
29
|
formatting: Formatting;
|
|
29
30
|
}>;
|
|
30
31
|
/**
|
package/dist/auth/isomorphic.js
CHANGED
|
@@ -56,10 +56,10 @@ function softrAuthMiddleware() {
|
|
|
56
56
|
writeCookies([makeSessionDataCookie(session, token)]);
|
|
57
57
|
return session;
|
|
58
58
|
}
|
|
59
|
-
const [{ user
|
|
59
|
+
const [{ user }, settings$1] = await Promise.all([getSession(), readLocaleSettings()]);
|
|
60
60
|
return next({ context: {
|
|
61
61
|
user,
|
|
62
|
-
permissions,
|
|
62
|
+
permissions: { datasources: {} },
|
|
63
63
|
formatting: resolveFormatting(settings$1, getRequestHeader("accept-language") ?? null, readUserTimezone())
|
|
64
64
|
} });
|
|
65
65
|
});
|
package/dist/auth/session.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { expireCookie, expireOtherCopy, readRequestCookies, serializeCookie, writeCookies } from "../cookies.js";
|
|
2
|
-
import { permissionsSchema } from "./permissions.js";
|
|
3
2
|
import { sessionConfig } from "./config.js";
|
|
4
3
|
import { userSchema } from "./user.js";
|
|
5
4
|
import { z } from "zod";
|
|
@@ -53,17 +52,14 @@ function readSessionToken() {
|
|
|
53
52
|
const { name } = sessionCookie(SESSION_TOKEN);
|
|
54
53
|
return openEnvelope(readRequestCookies()[name], SESSION_TOKEN);
|
|
55
54
|
}
|
|
56
|
-
/** The cached
|
|
55
|
+
/** The cached visitor for `sessionToken`, or `null` on any kind of miss. */
|
|
57
56
|
function readSessionData(sessionToken) {
|
|
58
57
|
const { name } = sessionCookie(SESSION_DATA);
|
|
59
58
|
const payload = parseSessionData(openEnvelope(readRequestCookies()[name], SESSION_DATA));
|
|
60
59
|
if (payload === null) return null;
|
|
61
60
|
if (payload.exp <= Math.floor(Date.now() / 1e3)) return null;
|
|
62
61
|
if (payload.tb !== tokenBinding(sessionToken)) return null;
|
|
63
|
-
return {
|
|
64
|
-
user: payload.user,
|
|
65
|
-
permissions: payload.permissions
|
|
66
|
-
};
|
|
62
|
+
return { user: payload.user };
|
|
67
63
|
}
|
|
68
64
|
/**
|
|
69
65
|
* The token cookie, after a deletion of any copy from before `allowEmbedding`
|
|
@@ -80,7 +76,6 @@ function makeSessionDataCookie(session, sessionToken) {
|
|
|
80
76
|
const { name, secure } = sessionCookie(SESSION_DATA);
|
|
81
77
|
const payload = {
|
|
82
78
|
user: session.user,
|
|
83
|
-
permissions: session.permissions,
|
|
84
79
|
exp: Math.floor(Date.now() / 1e3) + SESSION_DATA_TTL_SECONDS,
|
|
85
80
|
tb: tokenBinding(sessionToken)
|
|
86
81
|
};
|
|
@@ -135,7 +130,6 @@ function clearSessionData() {
|
|
|
135
130
|
const standInToken = new AsyncLocalStorage();
|
|
136
131
|
const sessionDataSchema = z.object({
|
|
137
132
|
user: userSchema.nullable(),
|
|
138
|
-
permissions: permissionsSchema,
|
|
139
133
|
exp: z.number(),
|
|
140
134
|
tb: z.string()
|
|
141
135
|
});
|
|
@@ -64,7 +64,11 @@ function DevView({ error, reset }) {
|
|
|
64
64
|
reset,
|
|
65
65
|
router
|
|
66
66
|
]);
|
|
67
|
-
|
|
67
|
+
const shown = !running && !retryPending;
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
if (shown) reportError(error);
|
|
70
|
+
}, [shown, error]);
|
|
71
|
+
if (!shown) return /* @__PURE__ */ jsx(UpdatingView, {});
|
|
68
72
|
return /* @__PURE__ */ jsx("div", {
|
|
69
73
|
style: s.overlay,
|
|
70
74
|
"data-softr-error-overlay": "error",
|
package/dist/package.js
CHANGED
package/package.json
CHANGED
|
@@ -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.96
|
|
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: 0.0.
|
|
12
|
+
library_version: 0.0.96
|
|
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: 0.0.
|
|
12
|
+
library_version: 0.0.96
|
|
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: 0.0.
|
|
10
|
+
library_version: 0.0.96
|
|
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.
|
|
@@ -7,7 +7,7 @@ description: >-
|
|
|
7
7
|
metadata:
|
|
8
8
|
type: sub-skill
|
|
9
9
|
library: softr-sdk
|
|
10
|
-
library_version: 0.0.
|
|
10
|
+
library_version: 0.0.96
|
|
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: 0.0.
|
|
12
|
+
library_version: 0.0.96
|
|
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.
|
|
@@ -8,7 +8,7 @@ description: >-
|
|
|
8
8
|
metadata:
|
|
9
9
|
type: sub-skill
|
|
10
10
|
library: softr-sdk
|
|
11
|
-
library_version: 0.0.
|
|
11
|
+
library_version: 0.0.96
|
|
12
12
|
---
|
|
13
13
|
|
|
14
14
|
**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.
|
|
@@ -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.96
|
|
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. 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: 0.0.
|
|
12
|
+
library_version: 0.0.96
|
|
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: 0.0.
|
|
12
|
+
library_version: 0.0.96
|
|
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.
|