refactor(channels): share legacy dm allowlist paths

This commit is contained in:
Peter Steinberger
2026-03-17 04:24:01 +00:00
parent 966b8656d2
commit 10660fe47d
4 changed files with 24 additions and 19 deletions

View File

@@ -11,6 +11,16 @@ type AllowlistConfigPaths = {
cleanupPaths?: string[][];
};
const LEGACY_DM_ALLOWLIST_CONFIG_PATHS: AllowlistConfigPaths = {
readPaths: [["allowFrom"], ["dm", "allowFrom"]],
writePath: ["allowFrom"],
cleanupPaths: [["dm", "allowFrom"]],
};
export function resolveLegacyDmAllowlistConfigPaths(scope: "dm" | "group") {
return scope === "dm" ? LEGACY_DM_ALLOWLIST_CONFIG_PATHS : null;
}
function resolveAccountScopedWriteTarget(
parsed: Record<string, unknown>,
channelId: ChannelId,

View File

@@ -270,7 +270,10 @@ export { buildChannelSendResult } from "./channel-send-result.js";
export type { ChannelSendRawResult } from "./channel-send-result.js";
export { createPluginRuntimeStore } from "./runtime-store.js";
export { createScopedChannelConfigBase } from "./channel-config-helpers.js";
export { buildAccountScopedAllowlistConfigEditor } from "./allowlist-config-edit.js";
export {
buildAccountScopedAllowlistConfigEditor,
resolveLegacyDmAllowlistConfigPaths,
} from "./allowlist-config-edit.js";
export {
AllowFromEntrySchema,
AllowFromListSchema,