refactor(slack): share channel config entry type

This commit is contained in:
Peter Steinberger
2026-02-16 01:06:18 +00:00
parent 067509fa44
commit 260a514467
2 changed files with 15 additions and 24 deletions

View File

@@ -19,6 +19,18 @@ export type SlackChannelConfigResolved = {
matchSource?: ChannelMatchSource;
};
export type SlackChannelConfigEntry = {
enabled?: boolean;
allow?: boolean;
requireMention?: boolean;
allowBots?: boolean;
users?: Array<string | number>;
skills?: string[];
systemPrompt?: string;
};
export type SlackChannelConfigEntries = Record<string, SlackChannelConfigEntry>;
function firstDefined<T>(...values: Array<T | undefined>) {
for (const value of values) {
if (typeof value !== "undefined") {
@@ -74,18 +86,7 @@ export function resolveSlackChannelLabel(params: { channelId?: string; channelNa
export function resolveSlackChannelConfig(params: {
channelId: string;
channelName?: string;
channels?: Record<
string,
{
enabled?: boolean;
allow?: boolean;
requireMention?: boolean;
allowBots?: boolean;
users?: Array<string | number>;
skills?: string[];
systemPrompt?: string;
}
>;
channels?: SlackChannelConfigEntries;
defaultRequireMention?: boolean;
}): SlackChannelConfigResolved | null {
const { channelId, channelName, channels, defaultRequireMention } = params;