@softr/sdk 0.0.95 → 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.
@@ -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: Permissions;
26
+ permissions: {
27
+ datasources: {};
28
+ };
28
29
  formatting: Formatting;
29
30
  }>;
30
31
  /**
@@ -56,10 +56,10 @@ function softrAuthMiddleware() {
56
56
  writeCookies([makeSessionDataCookie(session, token)]);
57
57
  return session;
58
58
  }
59
- const [{ user, permissions }, settings$1] = await Promise.all([getSession(), readLocaleSettings()]);
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
  });
@@ -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 session for `sessionToken`, or `null` on any kind of miss. */
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
  });
package/dist/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "0.0.95";
2
+ var version = "0.0.96";
3
3
 
4
4
  //#endregion
5
5
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softr/sdk",
3
- "version": "0.0.95",
3
+ "version": "0.0.96",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": { "types": "./dist/index.d.ts", "import": "./dist/index.js" },
@@ -9,7 +9,7 @@ description: >-
9
9
  metadata:
10
10
  type: core
11
11
  library: softr-sdk
12
- library_version: 0.0.95
12
+ library_version: 0.0.96
13
13
  ---
14
14
 
15
15
  # Softr SDK core
@@ -13,7 +13,7 @@ description: >-
13
13
  metadata:
14
14
  type: sub-skill
15
15
  library: softr-sdk
16
- library_version: 0.0.95
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.95
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.95
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.
@@ -9,7 +9,7 @@ description: >-
9
9
  metadata:
10
10
  type: sub-skill
11
11
  library: softr-sdk
12
- library_version: 0.0.95
12
+ library_version: 0.0.96
13
13
  ---
14
14
 
15
15
  # The current user
@@ -7,7 +7,7 @@ description: >-
7
7
  metadata:
8
8
  type: sub-skill
9
9
  library: softr-sdk
10
- library_version: 0.0.95
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.
@@ -8,7 +8,7 @@ description: >-
8
8
  metadata:
9
9
  type: sub-skill
10
10
  library: softr-sdk
11
- library_version: 0.0.95
11
+ library_version: 0.0.96
12
12
  ---
13
13
 
14
14
  # Dates, times and numbers
@@ -7,7 +7,7 @@ description: >-
7
7
  metadata:
8
8
  type: sub-skill
9
9
  library: softr-sdk
10
- library_version: 0.0.95
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.95
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.
@@ -9,7 +9,7 @@ description: >-
9
9
  metadata:
10
10
  type: sub-skill
11
11
  library: softr-sdk
12
- library_version: 0.0.95
12
+ library_version: 0.0.96
13
13
  ---
14
14
 
15
15
  # Installing the app
@@ -8,7 +8,7 @@ description: >-
8
8
  metadata:
9
9
  type: sub-skill
10
10
  library: softr-sdk
11
- library_version: 0.0.95
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.95
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.95
12
+ library_version: 0.0.96
13
13
  ---
14
14
 
15
15
  **Boundary.** `Audience` and `defineVisibility` 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.95
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.95
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.