refactor: unify channel config matching and gating

Co-authored-by: thewilloftheshadow <thewilloftheshadow@users.noreply.github.com>
This commit is contained in:
Peter Steinberger
2026-01-18 01:21:27 +00:00
parent 05f49d2846
commit f73dbdbaea
24 changed files with 430 additions and 120 deletions

View File

@@ -31,6 +31,8 @@ describe("msteams policy", () => {
expect(res.channelConfig?.requireMention).toBe(true);
expect(res.allowlistConfigured).toBe(true);
expect(res.allowed).toBe(true);
expect(res.channelMatchKey).toBe("chan456");
expect(res.channelMatchSource).toBe("direct");
});
it("returns undefined configs when teamId is missing", () => {

View File

@@ -13,6 +13,8 @@ export type MSTeamsResolvedRouteConfig = {
allowed: boolean;
teamKey?: string;
channelKey?: string;
channelMatchKey?: string;
channelMatchSource?: "direct" | "wildcard";
};
export function resolveMSTeamsRouteConfig(params: {
@@ -75,6 +77,8 @@ export function resolveMSTeamsRouteConfig(params: {
allowed,
teamKey,
channelKey,
channelMatchKey: channelKey,
channelMatchSource: channelKey ? (channelKey === "*" ? "wildcard" : "direct") : undefined,
};
}