mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 18:18:28 +00:00
27 lines
1021 B
TypeScript
27 lines
1021 B
TypeScript
import type { ChannelChoice } from "../onboard-types.js";
|
|
import type { ChannelOnboardingAdapter } from "./types.js";
|
|
import { listChannelPlugins } from "../../channels/plugins/index.js";
|
|
|
|
const CHANNEL_ONBOARDING_ADAPTERS = () =>
|
|
new Map<ChannelChoice, ChannelOnboardingAdapter>(
|
|
listChannelPlugins()
|
|
.map((plugin) => (plugin.onboarding ? ([plugin.id, plugin.onboarding] as const) : null))
|
|
.filter((entry): entry is readonly [ChannelChoice, ChannelOnboardingAdapter] =>
|
|
Boolean(entry),
|
|
),
|
|
);
|
|
|
|
export function getChannelOnboardingAdapter(
|
|
channel: ChannelChoice,
|
|
): ChannelOnboardingAdapter | undefined {
|
|
return CHANNEL_ONBOARDING_ADAPTERS().get(channel);
|
|
}
|
|
|
|
export function listChannelOnboardingAdapters(): ChannelOnboardingAdapter[] {
|
|
return Array.from(CHANNEL_ONBOARDING_ADAPTERS().values());
|
|
}
|
|
|
|
// Legacy aliases (pre-rename).
|
|
export const getProviderOnboardingAdapter = getChannelOnboardingAdapter;
|
|
export const listProviderOnboardingAdapters = listChannelOnboardingAdapters;
|