mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-30 02:20:38 +00:00
fix(ci): repair helper typing regressions
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import type { ChannelDirectoryAdapter } from "../../src/channels/plugins/types.js";
|
||||
|
||||
export function createDirectoryTestRuntime() {
|
||||
return {
|
||||
log: () => {},
|
||||
@@ -8,15 +10,7 @@ export function createDirectoryTestRuntime() {
|
||||
};
|
||||
}
|
||||
|
||||
export function expectDirectorySurface(
|
||||
directory:
|
||||
| {
|
||||
listPeers?: unknown;
|
||||
listGroups?: unknown;
|
||||
}
|
||||
| null
|
||||
| undefined,
|
||||
) {
|
||||
export function expectDirectorySurface(directory: ChannelDirectoryAdapter | null | undefined) {
|
||||
if (!directory) {
|
||||
throw new Error("expected directory");
|
||||
}
|
||||
@@ -27,7 +21,7 @@ export function expectDirectorySurface(
|
||||
throw new Error("expected listGroups");
|
||||
}
|
||||
return directory as {
|
||||
listPeers: NonNullable<typeof directory.listPeers>;
|
||||
listGroups: NonNullable<typeof directory.listGroups>;
|
||||
listPeers: NonNullable<ChannelDirectoryAdapter["listPeers"]>;
|
||||
listGroups: NonNullable<ChannelDirectoryAdapter["listGroups"]>;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,29 +1,11 @@
|
||||
type TestLogger = {
|
||||
info: () => void;
|
||||
warn: () => void;
|
||||
error: () => void;
|
||||
debug?: () => void;
|
||||
};
|
||||
import type { OpenClawPluginApi } from "../../src/plugins/types.js";
|
||||
|
||||
type TestPluginApiDefaults = {
|
||||
logger: TestLogger;
|
||||
registerTool: () => void;
|
||||
registerHook: () => void;
|
||||
registerHttpRoute: () => void;
|
||||
registerChannel: () => void;
|
||||
registerGatewayMethod: () => void;
|
||||
registerCli: () => void;
|
||||
registerService: () => void;
|
||||
registerProvider: () => void;
|
||||
registerCommand: () => void;
|
||||
registerContextEngine: () => void;
|
||||
resolvePath: (input: string) => string;
|
||||
on: () => void;
|
||||
};
|
||||
type TestPluginApiInput = Partial<OpenClawPluginApi> &
|
||||
Pick<OpenClawPluginApi, "id" | "name" | "source" | "config" | "runtime">;
|
||||
|
||||
export function createTestPluginApi<T extends object>(api: T): T & TestPluginApiDefaults {
|
||||
export function createTestPluginApi(api: TestPluginApiInput): OpenClawPluginApi {
|
||||
return {
|
||||
logger: { info() {}, warn() {}, error() {} },
|
||||
logger: { info() {}, warn() {}, error() {}, debug() {} },
|
||||
registerTool() {},
|
||||
registerHook() {},
|
||||
registerHttpRoute() {},
|
||||
|
||||
Reference in New Issue
Block a user