mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-18 21:40:53 +00:00
* refactor: make OutboundSendDeps dynamic with channel-ID keys
Replace hardcoded per-channel send fields (sendTelegram, sendDiscord,
etc.) with a dynamic index-signature type keyed by channel ID. This
unblocks moving channel implementations to extensions without breaking
the outbound dispatch contract.
- OutboundSendDeps and CliDeps are now { [channelId: string]: unknown }
- Each outbound adapter resolves its send fn via bracket access with cast
- Lazy-loading preserved via createLazySender with module cache
- Delete 6 deps-send-*.runtime.ts one-liner re-export files
- Harden guardrail scan against deleted-but-tracked files
* fix: preserve outbound send-deps compatibility
* style: fix formatting issues (import order, extra bracket, trailing whitespace)
* fix: resolve type errors from dynamic OutboundSendDeps in tests and extension
* fix: remove unused OutboundSendDeps import from deliver.test-helpers
33 lines
911 B
TypeScript
33 lines
911 B
TypeScript
import { describe, expect, it, vi } from "vitest";
|
|
import { createOutboundSendDepsFromCliSource } from "./outbound-send-mapping.js";
|
|
|
|
describe("createOutboundSendDepsFromCliSource", () => {
|
|
it("adds legacy aliases for channel-keyed send deps", () => {
|
|
const deps = {
|
|
whatsapp: vi.fn(),
|
|
telegram: vi.fn(),
|
|
discord: vi.fn(),
|
|
slack: vi.fn(),
|
|
signal: vi.fn(),
|
|
imessage: vi.fn(),
|
|
};
|
|
|
|
const outbound = createOutboundSendDepsFromCliSource(deps);
|
|
|
|
expect(outbound).toEqual({
|
|
whatsapp: deps.whatsapp,
|
|
telegram: deps.telegram,
|
|
discord: deps.discord,
|
|
slack: deps.slack,
|
|
signal: deps.signal,
|
|
imessage: deps.imessage,
|
|
sendWhatsApp: deps.whatsapp,
|
|
sendTelegram: deps.telegram,
|
|
sendDiscord: deps.discord,
|
|
sendSlack: deps.slack,
|
|
sendSignal: deps.signal,
|
|
sendIMessage: deps.imessage,
|
|
});
|
|
});
|
|
});
|