mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
cosmetics: fixed admin skeleton, use password field on auth, use $console in auth middleware
This commit is contained in:
@@ -5,7 +5,8 @@ import { DataApi } from "../../src/data/api/DataApi";
|
|||||||
import { DataController } from "../../src/data/api/DataController";
|
import { DataController } from "../../src/data/api/DataController";
|
||||||
import { dataConfigSchema } from "../../src/data/data-schema";
|
import { dataConfigSchema } from "../../src/data/data-schema";
|
||||||
import * as proto from "../../src/data/prototype";
|
import * as proto from "../../src/data/prototype";
|
||||||
import { disableConsoleLog, enableConsoleLog, schemaToEm } from "../helper";
|
import { schemaToEm } from "../helper";
|
||||||
|
import { disableConsoleLog, enableConsoleLog } from "core/utils/test";
|
||||||
|
|
||||||
beforeAll(disableConsoleLog);
|
beforeAll(disableConsoleLog);
|
||||||
afterAll(enableConsoleLog);
|
afterAll(enableConsoleLog);
|
||||||
@@ -64,6 +65,15 @@ describe("DataApi", () => {
|
|||||||
const res = await req;
|
const res = await req;
|
||||||
expect(res.data).toEqual(payload as any);
|
expect(res.data).toEqual(payload as any);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// make sure sort is working
|
||||||
|
const req = await api.readMany("posts", {
|
||||||
|
select: ["title"],
|
||||||
|
sort: "-id",
|
||||||
|
});
|
||||||
|
expect(req.data).toEqual(payload.reverse() as any);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it("updates many", async () => {
|
it("updates many", async () => {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"sideEffects": false,
|
"sideEffects": false,
|
||||||
"bin": "./dist/cli/index.js",
|
"bin": "./dist/cli/index.js",
|
||||||
"version": "0.11.0-rc.1",
|
"version": "0.11.0-rc.2",
|
||||||
"description": "Lightweight Firebase/Supabase alternative built to run anywhere — incl. Next.js, React Router, Astro, Cloudflare, Bun, Node, AWS Lambda & more.",
|
"description": "Lightweight Firebase/Supabase alternative built to run anywhere — incl. Next.js, React Router, Astro, Cloudflare, Bun, Node, AWS Lambda & more.",
|
||||||
"homepage": "https://bknd.io",
|
"homepage": "https://bknd.io",
|
||||||
"repository": {
|
"repository": {
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
"build:types": "tsc -p tsconfig.build.json --emitDeclarationOnly && tsc-alias",
|
"build:types": "tsc -p tsconfig.build.json --emitDeclarationOnly && tsc-alias",
|
||||||
"updater": "bun x npm-check-updates -ui",
|
"updater": "bun x npm-check-updates -ui",
|
||||||
"cli": "LOCAL=1 bun src/cli/index.ts",
|
"cli": "LOCAL=1 bun src/cli/index.ts",
|
||||||
"prepublishOnly": "bun run types && bun run test && bun run build:all && cp ../README.md ./",
|
"prepublishOnly": "bun run types && bun run test && bun run test:node && bun run build:all && cp ../README.md ./",
|
||||||
"postpublish": "rm -f README.md"
|
"postpublish": "rm -f README.md"
|
||||||
},
|
},
|
||||||
"license": "FSL-1.1-MIT",
|
"license": "FSL-1.1-MIT",
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { Permission } from "core";
|
import { $console, type Permission } from "core";
|
||||||
import { patternMatch } from "core/utils";
|
import { patternMatch } from "core/utils";
|
||||||
import type { Context } from "hono";
|
import type { Context } from "hono";
|
||||||
import { createMiddleware } from "hono/factory";
|
import { createMiddleware } from "hono/factory";
|
||||||
@@ -49,7 +49,7 @@ export const auth = (options?: {
|
|||||||
// make sure to only register once
|
// make sure to only register once
|
||||||
if (authCtx.registered) {
|
if (authCtx.registered) {
|
||||||
skipped = true;
|
skipped = true;
|
||||||
console.warn(`auth middleware already registered for ${getPath(c)}`);
|
$console.warn(`auth middleware already registered for ${getPath(c)}`);
|
||||||
} else {
|
} else {
|
||||||
authCtx.registered = true;
|
authCtx.registered = true;
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ export const permission = (
|
|||||||
if (app?.module.auth.enabled) {
|
if (app?.module.auth.enabled) {
|
||||||
throw new Error(msg);
|
throw new Error(msg);
|
||||||
} else {
|
} else {
|
||||||
console.warn(msg);
|
$console.warn(msg);
|
||||||
}
|
}
|
||||||
} else if (!authCtx.skip) {
|
} else if (!authCtx.skip) {
|
||||||
const guard = app.modules.ctx().guard;
|
const guard = app.modules.ctx().guard;
|
||||||
|
|||||||
@@ -66,15 +66,15 @@ const Skeleton = ({ theme }: { theme?: any }) => {
|
|||||||
<Logo theme={actualTheme} />
|
<Logo theme={actualTheme} />
|
||||||
</div>
|
</div>
|
||||||
<nav className="hidden md:flex flex-row gap-2.5 pl-0 p-2.5 items-center">
|
<nav className="hidden md:flex flex-row gap-2.5 pl-0 p-2.5 items-center">
|
||||||
{[...new Array(5)].map((item, key) => (
|
{[...new Array(4)].map((item, key) => (
|
||||||
<AppShell.NavLink key={key} as="span" className="active h-full opacity-50">
|
<AppShell.NavLink key={key} as="span" className="active h-full opacity-50">
|
||||||
<div className="w-10 h-3" />
|
<div className="w-18 h-3" />
|
||||||
</AppShell.NavLink>
|
</AppShell.NavLink>
|
||||||
))}
|
))}
|
||||||
</nav>
|
</nav>
|
||||||
<nav className="flex md:hidden flex-row items-center">
|
<nav className="flex md:hidden flex-row gap-2.5 pl-0 p-2.5 items-center">
|
||||||
<AppShell.NavLink as="span" className="active h-full opacity-50">
|
<AppShell.NavLink as="span" className="active h-full opacity-50">
|
||||||
<div className="w-10 h-3" />
|
<div className="w-20 h-3" />
|
||||||
</AppShell.NavLink>
|
</AppShell.NavLink>
|
||||||
</nav>
|
</nav>
|
||||||
<div className="flex flex-grow" />
|
<div className="flex flex-grow" />
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { Form } from "json-schema-form-react";
|
|||||||
import { transform } from "lodash-es";
|
import { transform } from "lodash-es";
|
||||||
import type { ComponentPropsWithoutRef } from "react";
|
import type { ComponentPropsWithoutRef } from "react";
|
||||||
import { Button } from "ui/components/buttons/Button";
|
import { Button } from "ui/components/buttons/Button";
|
||||||
import { Group, Input, Label } from "ui/components/form/Formy/components";
|
import { Group, Input, Password, Label } from "ui/components/form/Formy/components";
|
||||||
import { SocialLink } from "./SocialLink";
|
import { SocialLink } from "./SocialLink";
|
||||||
import type { ValueError } from "@sinclair/typebox/value";
|
import type { ValueError } from "@sinclair/typebox/value";
|
||||||
import { type TSchema, Value } from "core/utils";
|
import { type TSchema, Value } from "core/utils";
|
||||||
@@ -99,7 +99,7 @@ export function AuthForm({
|
|||||||
</Group>
|
</Group>
|
||||||
<Group>
|
<Group>
|
||||||
<Label htmlFor="password">Password</Label>
|
<Label htmlFor="password">Password</Label>
|
||||||
<Input type="password" name="password" />
|
<Password name="password" />
|
||||||
</Group>
|
</Group>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
Reference in New Issue
Block a user