mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 12:37:20 +00:00
refactor: extracted auth as middleware to be added manually to endpoints
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import type { App } from "App";
|
||||
import type { Guard } from "auth";
|
||||
import { SchemaObject } from "core";
|
||||
import type { EventManager } from "core/events";
|
||||
@@ -5,9 +6,17 @@ import type { Static, TSchema } from "core/utils";
|
||||
import type { Connection, EntityManager } from "data";
|
||||
import type { Hono } from "hono";
|
||||
|
||||
export type ServerEnv = {
|
||||
Variables: {
|
||||
app: App;
|
||||
auth_resolved: boolean;
|
||||
html?: string;
|
||||
};
|
||||
};
|
||||
|
||||
export type ModuleBuildContext = {
|
||||
connection: Connection;
|
||||
server: Hono<any>;
|
||||
server: Hono<ServerEnv>;
|
||||
em: EntityManager;
|
||||
emgr: EventManager<any>;
|
||||
guard: Guard;
|
||||
@@ -78,6 +87,10 @@ export abstract class Module<Schema extends TSchema = TSchema, ConfigSchema = St
|
||||
return this._schema;
|
||||
}
|
||||
|
||||
getMiddleware() {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
get ctx() {
|
||||
if (!this._ctx) {
|
||||
throw new Error("Context not set");
|
||||
|
||||
Reference in New Issue
Block a user