diff --git a/src/extensions/types.ts b/src/extensions/types.ts index 62abf5df..2027fb09 100644 --- a/src/extensions/types.ts +++ b/src/extensions/types.ts @@ -191,6 +191,31 @@ export interface ExtensionContext { log(level: 'debug' | 'info' | 'warn' | 'error', message: string, ...args: any[]): void } +/** + * HTTP route handler types + * Used by extensions that expose HTTP endpoints (e.g. LNURL, .well-known) + */ +export interface HttpRequest { + method: string + path: string + params: Record + query: Record + headers: Record + body?: any +} + +export interface HttpResponse { + status: number + body: any + headers?: Record +} + +export interface HttpRoute { + method: 'GET' | 'POST' + path: string + handler: (req: HttpRequest) => Promise +} + /** * Extension interface - what extensions must implement */ @@ -217,6 +242,12 @@ export interface Extension { * Return true if extension is healthy */ healthCheck?(): Promise + + /** + * Get HTTP routes exposed by this extension + * The main HTTP server will mount these routes + */ + getHttpRoutes?(): HttpRoute[] } /**