Compare commits

...

12 Commits

Author SHA1 Message Date
dswbx a4079804c2 release 0.2.2 2024-12-04 14:49:55 +01:00
dswbx 2bd4b720bb Merge pull request #18 from bknd-io/17-cannot-find-module-node_moduleslodash-esget
fix: lodash-es/* imports causing crash on astro
2024-12-04 14:49:19 +01:00
dswbx f3619bee26 fix lodash-es/* imports causing crash on astro 2024-12-04 14:47:52 +01:00
dswbx c54455870c fix: docs logo 2024-12-03 19:34:14 +01:00
dswbx 20477a655e update docs to navigate to web on logo click 2024-12-03 19:30:16 +01:00
dswbx 1497470d33 bump version for patch release 0.2.1 2024-12-03 17:21:06 +01:00
dswbx abe38fe69d Merge pull request #12 from bknd-io/chores/remove-deps
Remove unusued deps and fixing auth tests
2024-12-03 17:18:18 +01:00
dswbx 665c41f051 Merge pull request #16 from bknd-io/chores/export-data-prototype
export data prototype
2024-12-03 17:17:53 +01:00
dswbx 0184f47a41 added prototype to the list of exports from "bknd/data" 2024-12-03 17:15:53 +01:00
dswbx 5374afc9c8 remove the quick theme switcher if admin settings are overridden 2024-12-03 17:09:27 +01:00
dswbx d6978f9873 fix auth tests 2024-12-03 09:16:00 +01:00
dswbx 3c5bd95988 removed unused deps 2024-12-03 09:15:39 +01:00
9 changed files with 25 additions and 20 deletions
+7 -1
View File
@@ -39,7 +39,10 @@ describe("AppAuth", () => {
test("creates user on register", async () => { test("creates user on register", async () => {
const auth = new AppAuth( const auth = new AppAuth(
{ {
enabled: true enabled: true,
jwt: {
secret: "123456"
}
}, },
ctx ctx
); );
@@ -57,6 +60,9 @@ describe("AppAuth", () => {
disableConsoleLog(); disableConsoleLog();
const res = await app.request("/password/register", { const res = await app.request("/password/register", {
method: "POST", method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({ body: JSON.stringify({
email: "some@body.com", email: "some@body.com",
password: "123456" password: "123456"
+2 -5
View File
@@ -3,7 +3,7 @@
"type": "module", "type": "module",
"sideEffects": false, "sideEffects": false,
"bin": "./dist/cli/index.js", "bin": "./dist/cli/index.js",
"version": "0.2.0", "version": "0.2.2",
"scripts": { "scripts": {
"build:all": "bun run build && bun run build:cli", "build:all": "bun run build && bun run build:cli",
"dev": "vite", "dev": "vite",
@@ -45,7 +45,6 @@
"@uiw/react-codemirror": "^4.23.6", "@uiw/react-codemirror": "^4.23.6",
"@xyflow/react": "^12.3.2", "@xyflow/react": "^12.3.2",
"aws4fetch": "^1.0.18", "aws4fetch": "^1.0.18",
"codemirror-lang-liquid": "^1.0.0",
"dayjs": "^1.11.13", "dayjs": "^1.11.13",
"fast-xml-parser": "^4.4.0", "fast-xml-parser": "^4.4.0",
"hono": "^4.6.12", "hono": "^4.6.12",
@@ -57,12 +56,10 @@
"react-hook-form": "^7.53.1", "react-hook-form": "^7.53.1",
"react-icons": "5.2.1", "react-icons": "5.2.1",
"react-json-view-lite": "^2.0.1", "react-json-view-lite": "^2.0.1",
"reactflow": "^11.11.4",
"tailwind-merge": "^2.5.4", "tailwind-merge": "^2.5.4",
"tailwindcss-animate": "^1.0.7", "tailwindcss-animate": "^1.0.7",
"wouter": "^3.3.5", "wouter": "^3.3.5",
"zod": "^3.23.8", "zod": "^3.23.8"
"zod-to-json-schema": "^3.23.2"
}, },
"devDependencies": { "devDependencies": {
"@aws-sdk/client-s3": "^3.613.0", "@aws-sdk/client-s3": "^3.613.0",
+7 -2
View File
@@ -11,7 +11,7 @@ import {
} from "core/utils"; } from "core/utils";
import type { Context, Hono } from "hono"; import type { Context, Hono } from "hono";
import { deleteCookie, getSignedCookie, setSignedCookie } from "hono/cookie"; import { deleteCookie, getSignedCookie, setSignedCookie } from "hono/cookie";
import { decode, sign, verify } from "hono/jwt"; import { sign, verify } from "hono/jwt";
import type { CookieOptions } from "hono/utils/cookie"; import type { CookieOptions } from "hono/utils/cookie";
import { omit } from "lodash-es"; import { omit } from "lodash-es";
@@ -177,7 +177,12 @@ export class Authenticator<Strategies extends Record<string, Strategy> = Record<
payload.exp = Math.floor(Date.now() / 1000) + this.config.jwt.expires; payload.exp = Math.floor(Date.now() / 1000) + this.config.jwt.expires;
} }
return sign(payload, this.config.jwt?.secret ?? "", this.config.jwt?.alg ?? "HS256"); const secret = this.config.jwt.secret;
if (!secret || secret.length === 0) {
throw new Error("Cannot sign JWT without a secret");
}
return sign(payload, secret, this.config.jwt?.alg ?? "HS256");
} }
async verify(jwt: string): Promise<boolean> { async verify(jwt: string): Promise<boolean> {
+1
View File
@@ -4,6 +4,7 @@ export * from "./fields";
export * from "./entities"; export * from "./entities";
export * from "./relations"; export * from "./relations";
export * from "./schema/SchemaManager"; export * from "./schema/SchemaManager";
export * from "./prototype";
export { export {
type RepoQuery, type RepoQuery,
@@ -12,7 +12,7 @@ import type {
ValidatorType ValidatorType
} from "@rjsf/utils"; } from "@rjsf/utils";
import { toErrorSchema } from "@rjsf/utils"; import { toErrorSchema } from "@rjsf/utils";
import get from "lodash-es/get"; import { get } from "lodash-es";
function removeUndefinedKeys(obj: any): any { function removeUndefinedKeys(obj: any): any {
if (!obj) return obj; if (!obj) return obj;
@@ -14,9 +14,7 @@ import {
getWidget, getWidget,
mergeSchemas mergeSchemas
} from "@rjsf/utils"; } from "@rjsf/utils";
import get from "lodash-es/get"; import { get, isEmpty, omit } from "lodash-es";
import isEmpty from "lodash-es/isEmpty";
import omit from "lodash-es/omit";
import { Component } from "react"; import { Component } from "react";
import { twMerge } from "tailwind-merge"; import { twMerge } from "tailwind-merge";
import { Label } from "../templates/FieldTemplate"; import { Label } from "../templates/FieldTemplate";
+4 -1
View File
@@ -146,6 +146,7 @@ export function Header({ hasSidebar = true }) {
} }
function UserMenu() { function UserMenu() {
const { adminOverride } = useBknd();
const auth = useAuth(); const auth = useAuth();
const [navigate] = useNavigate(); const [navigate] = useNavigate();
const { logout_route } = useBkndWindowContext(); const { logout_route } = useBkndWindowContext();
@@ -170,7 +171,9 @@ function UserMenu() {
items.push({ label: `Logout ${auth.user.email}`, onClick: handleLogout, icon: IconKeyOff }); items.push({ label: `Logout ${auth.user.email}`, onClick: handleLogout, icon: IconKeyOff });
} }
items.push(() => <UserMenuThemeToggler />); if (!adminOverride) {
items.push(() => <UserMenuThemeToggler />);
}
return ( return (
<> <>
BIN
View File
Binary file not shown.
+2 -7
View File
@@ -3,7 +3,8 @@
"name": "bknd", "name": "bknd",
"logo": { "logo": {
"dark": "/_assets/logo/bknd_logo_white.svg", "dark": "/_assets/logo/bknd_logo_white.svg",
"light": "/_assets/logo/bknd_logo_black.svg" "light": "/_assets/logo/bknd_logo_black.svg",
"href": "https://bknd.io"
}, },
"theme": "prism", "theme": "prism",
"layout": "sidenav", "layout": "sidenav",
@@ -44,12 +45,6 @@
} }
], ],
"anchors": [ "anchors": [
{
"name": "Web",
"icon": "globe",
"iconType": "solid",
"url": "https://bknd.io"
},
{ {
"name": "Docs", "name": "Docs",
"icon": "book-open-cover", "icon": "book-open-cover",