feat(extensions): add extension loader infrastructure #3
1 changed files with 31 additions and 0 deletions
|
|
@ -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<string, string>
|
||||
query: Record<string, string>
|
||||
headers: Record<string, string>
|
||||
body?: any
|
||||
}
|
||||
|
||||
export interface HttpResponse {
|
||||
status: number
|
||||
body: any
|
||||
headers?: Record<string, string>
|
||||
}
|
||||
|
||||
export interface HttpRoute {
|
||||
method: 'GET' | 'POST'
|
||||
path: string
|
||||
handler: (req: HttpRequest) => Promise<HttpResponse>
|
||||
}
|
||||
|
||||
/**
|
||||
* Extension interface - what extensions must implement
|
||||
*/
|
||||
|
|
@ -217,6 +242,12 @@ export interface Extension {
|
|||
* Return true if extension is healthy
|
||||
*/
|
||||
healthCheck?(): Promise<boolean>
|
||||
|
||||
/**
|
||||
* Get HTTP routes exposed by this extension
|
||||
* The main HTTP server will mount these routes
|
||||
*/
|
||||
getHttpRoutes?(): HttpRoute[]
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue