chore: Emit TypeScript declaration files so that we can type-check the extensions folder soon.

This commit is contained in:
cpojer
2026-01-31 21:57:21 +09:00
parent 1838ab019b
commit 59cfff02f6
7 changed files with 27 additions and 11 deletions
+2 -1
View File
@@ -1,4 +1,5 @@
import type { WebhookRequestBody } from "@line/bot-sdk";
import type { Request, Response, NextFunction } from "express";
import type { OpenClawConfig } from "../config/config.js";
import { loadConfig } from "../config/config.js";
import { logVerbose } from "../globals.js";
@@ -71,7 +72,7 @@ export function createLineWebhookCallback(
bot: LineBot,
channelSecret: string,
path = "/line/webhook",
) {
): { path: string; handler: (req: Request, res: Response, _next: NextFunction) => Promise<void> } {
const { handler } = startLineWebhook({
channelSecret,
onEvents: bot.handleWebhook,
+7 -2
View File
@@ -31,7 +31,9 @@ function parseWebhookBody(req: Request, rawBody: string): WebhookRequestBody | n
}
}
export function createLineWebhookMiddleware(options: LineWebhookOptions) {
export function createLineWebhookMiddleware(
options: LineWebhookOptions,
): (req: Request, res: Response, _next: NextFunction) => Promise<void> {
const { channelSecret, onEvents, runtime } = options;
return async (req: Request, res: Response, _next: NextFunction): Promise<void> => {
@@ -87,7 +89,10 @@ export interface StartLineWebhookOptions {
path?: string;
}
export function startLineWebhook(options: StartLineWebhookOptions) {
export function startLineWebhook(options: StartLineWebhookOptions): {
path: string;
handler: (req: Request, res: Response, _next: NextFunction) => Promise<void>;
} {
const path = options.path ?? "/line/webhook";
const middleware = createLineWebhookMiddleware({
channelSecret: options.channelSecret,