@softr/sdk 0.0.71 → 0.0.72
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 +1 -1
- package/dist/auth/isomorphic.js +6 -1
- package/dist/favicon.js +37 -0
- package/dist/mcp.d.ts +2 -2
- package/dist/package.js +1 -1
- package/package.json +1 -1
|
@@ -21,7 +21,7 @@ import * as _tanstack_react_start0 from "@tanstack/react-start";
|
|
|
21
21
|
* requestMiddleware: [softrAuthMiddleware()],
|
|
22
22
|
* }))
|
|
23
23
|
*/
|
|
24
|
-
declare function softrAuthMiddleware(): _tanstack_react_start0.RequestMiddlewareAfterServer<{}, readonly [_tanstack_react_start0.RequestMiddlewareAfterServer<{}, undefined, undefined>, _tanstack_react_start0.RequestMiddlewareAfterServer<{}, undefined, undefined>], {
|
|
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>], {
|
|
25
25
|
user: User | null;
|
|
26
26
|
permissions: Permissions;
|
|
27
27
|
formatting: Formatting;
|
package/dist/auth/isomorphic.js
CHANGED
|
@@ -8,6 +8,7 @@ import { readLocaleSettings } from "../locale-settings.js";
|
|
|
8
8
|
import { settings } from "./methods/settings.js";
|
|
9
9
|
import { bootErrorMiddleware } from "../boot-error.js";
|
|
10
10
|
import { pwaMiddleware } from "../pwa.js";
|
|
11
|
+
import { faviconMiddleware } from "../favicon.js";
|
|
11
12
|
import { createContext, useContext } from "react";
|
|
12
13
|
import { createMiddleware, createServerFn, getGlobalStartContext } from "@tanstack/react-start";
|
|
13
14
|
import { getRequestHeader } from "@tanstack/react-start/server";
|
|
@@ -29,7 +30,11 @@ import { jsx } from "react/jsx-runtime";
|
|
|
29
30
|
* }))
|
|
30
31
|
*/
|
|
31
32
|
function softrAuthMiddleware() {
|
|
32
|
-
return createMiddleware({ type: "request" }).middleware([
|
|
33
|
+
return createMiddleware({ type: "request" }).middleware([
|
|
34
|
+
bootErrorMiddleware(),
|
|
35
|
+
pwaMiddleware(),
|
|
36
|
+
faviconMiddleware()
|
|
37
|
+
]).server(async ({ next }) => {
|
|
33
38
|
async function getSession() {
|
|
34
39
|
const token = readSessionToken();
|
|
35
40
|
if (process.env.NODE_ENV === "production") {
|
package/dist/favicon.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { logger } from "./logger.js";
|
|
2
|
+
import { fetch } from "./fetch.js";
|
|
3
|
+
import { createMiddleware } from "@tanstack/react-start";
|
|
4
|
+
|
|
5
|
+
//#region src/favicon.ts
|
|
6
|
+
const FAVICON_PATH = "/favicon.ico";
|
|
7
|
+
const DEFAULT_FAVICON_URL = "https://assets.softr-files.com/assets/images/favicon.ico";
|
|
8
|
+
const CACHE_CONTROL = "public, max-age=86400";
|
|
9
|
+
/**
|
|
10
|
+
* Serves the default Softr favicon at `/favicon.ico`. Every other request
|
|
11
|
+
* passes through untouched.
|
|
12
|
+
*
|
|
13
|
+
* Proxied, not redirected: some clients do not follow a redirect for an icon.
|
|
14
|
+
*
|
|
15
|
+
* Static files come before request middleware, both in the Vite dev server and
|
|
16
|
+
* on Cloudflare. So an app with its own `public/favicon.ico` keeps it, and this
|
|
17
|
+
* answers only when the app has none.
|
|
18
|
+
*/
|
|
19
|
+
function faviconMiddleware() {
|
|
20
|
+
return createMiddleware({ type: "request" }).server(async ({ next, pathname }) => {
|
|
21
|
+
if (pathname !== FAVICON_PATH) return next();
|
|
22
|
+
try {
|
|
23
|
+
const iconResponse = await fetch(DEFAULT_FAVICON_URL);
|
|
24
|
+
if (!iconResponse.ok) return new Response(null, { status: 404 });
|
|
25
|
+
return new Response(iconResponse.body, { headers: {
|
|
26
|
+
"content-type": "image/x-icon",
|
|
27
|
+
"cache-control": CACHE_CONTROL
|
|
28
|
+
} });
|
|
29
|
+
} catch (error) {
|
|
30
|
+
logger.warn("Could not fetch the default favicon:", error);
|
|
31
|
+
return new Response(null, { status: 404 });
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
export { faviconMiddleware };
|
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_start5 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_start5.RequestMiddlewareAfterServer<{}, undefined, undefined>;
|
|
35
35
|
//#endregion
|
|
36
36
|
export { softrMcpMiddleware };
|
package/dist/package.js
CHANGED