refactor: migrate discord messaging ownership
This commit is contained in:
parent
beab2a6d00
commit
4aca379dc5
@ -18,20 +18,12 @@ export {
|
||||
export {
|
||||
DISCORD_DEFAULT_INBOUND_WORKER_TIMEOUT_MS,
|
||||
DISCORD_DEFAULT_LISTENER_TIMEOUT_MS,
|
||||
fetchChannelInfoDiscord,
|
||||
fetchVoiceStatusDiscord,
|
||||
getGateway,
|
||||
getPresence,
|
||||
hasAnyGuildPermissionDiscord,
|
||||
kickMemberDiscord,
|
||||
listGuildChannelsDiscord,
|
||||
listGuildEmojisDiscord,
|
||||
listPinsDiscord,
|
||||
listScheduledEventsDiscord,
|
||||
listThreadsDiscord,
|
||||
monitorDiscordProvider,
|
||||
probeDiscord,
|
||||
readMessagesDiscord,
|
||||
searchMessagesDiscord,
|
||||
unpinMessageDiscord,
|
||||
} from "../../../extensions/discord/runtime-api.js";
|
||||
|
||||
@ -407,6 +407,18 @@ describe("channel import guardrails", () => {
|
||||
expect(text).toMatch(/from\s+"..\/..\/extensions\/discord\/runtime-api\.js";/);
|
||||
});
|
||||
|
||||
it("keeps Discord messaging ownership on extension public seams", () => {
|
||||
const text = readSource("src/plugin-sdk/discord.ts");
|
||||
const bridgeImports = [...text.matchAll(/import(?: type)?\s*\{[\s\S]*?\}\s*from\s+"[^"]+";/g)]
|
||||
.map((match) => match[0])
|
||||
.filter((statement) => statement.includes("../channels/discord/plugin-sdk-bridge.js"))
|
||||
.join("\n");
|
||||
expect(bridgeImports).not.toMatch(
|
||||
/\b(?:fetchChannelInfoDiscord|listGuildChannelsDiscord|listGuildEmojisDiscord|listPinsDiscord|listScheduledEventsDiscord|listThreadsDiscord|readMessagesDiscord|searchMessagesDiscord)\b/,
|
||||
);
|
||||
expect(text).toMatch(/from\s+"..\/..\/extensions\/discord\/runtime-api\.js";/);
|
||||
});
|
||||
|
||||
it("keeps channel helper modules off their own SDK barrels", () => {
|
||||
for (const source of SAME_CHANNEL_SDK_GUARDS) {
|
||||
const text = readSource(source.path);
|
||||
|
||||
@ -32,10 +32,16 @@ import {
|
||||
fetchMessageDiscord,
|
||||
fetchReactionsDiscord,
|
||||
fetchRoleInfoDiscord,
|
||||
fetchChannelInfoDiscord,
|
||||
getThreadBindingManager,
|
||||
listDiscordDirectoryGroupsLive,
|
||||
listDiscordDirectoryPeersLive,
|
||||
listThreadBindingsBySessionKey,
|
||||
listGuildChannelsDiscord,
|
||||
listGuildEmojisDiscord,
|
||||
listPinsDiscord,
|
||||
listScheduledEventsDiscord,
|
||||
listThreadsDiscord,
|
||||
moveChannelDiscord,
|
||||
pinMessageDiscord,
|
||||
reactMessageDiscord,
|
||||
@ -62,6 +68,8 @@ import {
|
||||
unbindThreadBindingsBySessionKey,
|
||||
uploadEmojiDiscord,
|
||||
uploadStickerDiscord,
|
||||
readMessagesDiscord,
|
||||
searchMessagesDiscord,
|
||||
} from "../../extensions/discord/runtime-api.js";
|
||||
import { normalizeExplicitDiscordSessionKey } from "../../extensions/discord/session-key-api.js";
|
||||
import type {
|
||||
@ -82,21 +90,13 @@ import {
|
||||
import {
|
||||
DISCORD_DEFAULT_INBOUND_WORKER_TIMEOUT_MS,
|
||||
DISCORD_DEFAULT_LISTENER_TIMEOUT_MS,
|
||||
fetchChannelInfoDiscord,
|
||||
fetchVoiceStatusDiscord,
|
||||
getGateway,
|
||||
getPresence,
|
||||
hasAnyGuildPermissionDiscord,
|
||||
kickMemberDiscord,
|
||||
listGuildChannelsDiscord,
|
||||
listGuildEmojisDiscord,
|
||||
listPinsDiscord,
|
||||
listScheduledEventsDiscord,
|
||||
listThreadsDiscord,
|
||||
monitorDiscordProvider,
|
||||
probeDiscord,
|
||||
readMessagesDiscord,
|
||||
searchMessagesDiscord,
|
||||
unpinMessageDiscord,
|
||||
} from "../channels/discord/plugin-sdk-bridge.js";
|
||||
|
||||
|
||||
@ -272,7 +272,10 @@ describe("plugin-sdk subpath exports", () => {
|
||||
expect(typeof discordSdk.listDiscordDirectoryPeersFromConfig).toBe("function");
|
||||
expect(typeof discordSdk.listDiscordDirectoryGroupsLive).toBe("function");
|
||||
expect(typeof discordSdk.listDiscordDirectoryPeersLive).toBe("function");
|
||||
expect(typeof discordSdk.fetchChannelInfoDiscord).toBe("function");
|
||||
expect(typeof discordSdk.listThreadsDiscord).toBe("function");
|
||||
expect(typeof discordSdk.normalizeDiscordOutboundTarget).toBe("function");
|
||||
expect(typeof discordSdk.readMessagesDiscord).toBe("function");
|
||||
expect(typeof discordSdk.resolveDiscordChannelId).toBe("function");
|
||||
expect(typeof discordSdk.sendMessageDiscord).toBe("function");
|
||||
expect(typeof discordSdk.getThreadBindingManager).toBe("function");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user