refactor: migrate discord gateway ownership
This commit is contained in:
parent
4aca379dc5
commit
347610d1c7
@ -419,6 +419,18 @@ describe("channel import guardrails", () => {
|
||||
expect(text).toMatch(/from\s+"..\/..\/extensions\/discord\/runtime-api\.js";/);
|
||||
});
|
||||
|
||||
it("keeps Discord gateway 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(?:fetchVoiceStatusDiscord|getGateway|getPresence|monitorDiscordProvider)\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);
|
||||
|
||||
@ -33,6 +33,9 @@ import {
|
||||
fetchReactionsDiscord,
|
||||
fetchRoleInfoDiscord,
|
||||
fetchChannelInfoDiscord,
|
||||
fetchVoiceStatusDiscord,
|
||||
getGateway,
|
||||
getPresence,
|
||||
getThreadBindingManager,
|
||||
listDiscordDirectoryGroupsLive,
|
||||
listDiscordDirectoryPeersLive,
|
||||
@ -42,6 +45,7 @@ import {
|
||||
listPinsDiscord,
|
||||
listScheduledEventsDiscord,
|
||||
listThreadsDiscord,
|
||||
monitorDiscordProvider,
|
||||
moveChannelDiscord,
|
||||
pinMessageDiscord,
|
||||
reactMessageDiscord,
|
||||
@ -90,12 +94,8 @@ import {
|
||||
import {
|
||||
DISCORD_DEFAULT_INBOUND_WORKER_TIMEOUT_MS,
|
||||
DISCORD_DEFAULT_LISTENER_TIMEOUT_MS,
|
||||
fetchVoiceStatusDiscord,
|
||||
getGateway,
|
||||
getPresence,
|
||||
hasAnyGuildPermissionDiscord,
|
||||
kickMemberDiscord,
|
||||
monitorDiscordProvider,
|
||||
probeDiscord,
|
||||
unpinMessageDiscord,
|
||||
} from "../channels/discord/plugin-sdk-bridge.js";
|
||||
|
||||
@ -273,7 +273,11 @@ describe("plugin-sdk subpath exports", () => {
|
||||
expect(typeof discordSdk.listDiscordDirectoryGroupsLive).toBe("function");
|
||||
expect(typeof discordSdk.listDiscordDirectoryPeersLive).toBe("function");
|
||||
expect(typeof discordSdk.fetchChannelInfoDiscord).toBe("function");
|
||||
expect(typeof discordSdk.fetchVoiceStatusDiscord).toBe("function");
|
||||
expect(typeof discordSdk.getGateway).toBe("function");
|
||||
expect(typeof discordSdk.getPresence).toBe("function");
|
||||
expect(typeof discordSdk.listThreadsDiscord).toBe("function");
|
||||
expect(typeof discordSdk.monitorDiscordProvider).toBe("function");
|
||||
expect(typeof discordSdk.normalizeDiscordOutboundTarget).toBe("function");
|
||||
expect(typeof discordSdk.readMessagesDiscord).toBe("function");
|
||||
expect(typeof discordSdk.resolveDiscordChannelId).toBe("function");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user