refactor: share allowlist match metadata

Co-authored-by: thewilloftheshadow <thewilloftheshadow@users.noreply.github.com>
This commit is contained in:
Peter Steinberger
2026-01-18 01:49:13 +00:00
parent ccb30665f7
commit 62354dff9c
10 changed files with 94 additions and 55 deletions

View File

@@ -1,3 +1,5 @@
import type { AllowlistMatch } from "../../channels/allowlist-match.js";
export function normalizeSlackSlug(raw?: string) {
const trimmed = raw?.trim().toLowerCase() ?? "";
if (!trimmed) return "";
@@ -14,18 +16,9 @@ export function normalizeAllowListLower(list?: Array<string | number>) {
return normalizeAllowList(list).map((entry) => entry.toLowerCase());
}
export type SlackAllowListMatch = {
allowed: boolean;
matchKey?: string;
matchSource?:
| "wildcard"
| "id"
| "prefixed-id"
| "prefixed-user"
| "name"
| "prefixed-name"
| "slug";
};
export type SlackAllowListMatch = AllowlistMatch<
"wildcard" | "id" | "prefixed-id" | "prefixed-user" | "name" | "prefixed-name" | "slug"
>;
export function resolveSlackAllowListMatch(params: {
allowList: string[];