47 lines
1.1 KiB
TypeScript
47 lines
1.1 KiB
TypeScript
import type {
|
|
ChannelCapabilities,
|
|
ChannelId,
|
|
ChannelOutboundAdapter,
|
|
ChannelPlugin,
|
|
} from "../channels/plugins/types.js";
|
|
import type { PluginRegistry } from "../plugins/registry.js";
|
|
|
|
export const createTestRegistry = (channels: PluginRegistry["channels"] = []): PluginRegistry => ({
|
|
plugins: [],
|
|
tools: [],
|
|
hooks: [],
|
|
typedHooks: [],
|
|
channels,
|
|
providers: [],
|
|
gatewayHandlers: {},
|
|
httpHandlers: [],
|
|
httpRoutes: [],
|
|
cliRegistrars: [],
|
|
services: [],
|
|
commands: [],
|
|
diagnostics: [],
|
|
});
|
|
|
|
export const createOutboundTestPlugin = (params: {
|
|
id: ChannelId;
|
|
outbound: ChannelOutboundAdapter;
|
|
label?: string;
|
|
docsPath?: string;
|
|
capabilities?: ChannelCapabilities;
|
|
}): ChannelPlugin => ({
|
|
id: params.id,
|
|
meta: {
|
|
id: params.id,
|
|
label: params.label ?? String(params.id),
|
|
selectionLabel: params.label ?? String(params.id),
|
|
docsPath: params.docsPath ?? `/channels/${params.id}`,
|
|
blurb: "test stub.",
|
|
},
|
|
capabilities: params.capabilities ?? { chatTypes: ["direct"] },
|
|
config: {
|
|
listAccountIds: () => [],
|
|
resolveAccount: () => ({}),
|
|
},
|
|
outbound: params.outbound,
|
|
});
|