refactor: register channel bootstrap capabilities

This commit is contained in:
Peter Steinberger
2026-04-05 09:13:30 +01:00
parent a5b6b71468
commit 41e39eb46f
58 changed files with 444 additions and 949 deletions

View File

@@ -14,6 +14,10 @@ import {
} from "./accounts.js";
import { getChatChannelMeta, type ChannelPlugin } from "./channel-api.js";
import { IMessageChannelConfigSchema } from "./config-schema.js";
import {
resolveIMessageAttachmentRoots,
resolveIMessageRemoteAttachmentRoots,
} from "./media-contract.js";
import { createIMessageSetupWizardProxy } from "./setup-core.js";
export const IMESSAGE_CHANNEL = "imessage" as const;
@@ -65,8 +69,9 @@ export function createIMessagePluginBase(params: {
| "config"
| "security"
| "setup"
| "messaging"
> {
return createChannelPluginBase({
const base = createChannelPluginBase({
id: IMESSAGE_CHANNEL,
meta: {
...getChatChannelMeta(IMESSAGE_CHANNEL),
@@ -91,7 +96,16 @@ export function createIMessagePluginBase(params: {
},
security: imessageSecurityAdapter,
setup: params.setup,
}) as Pick<
});
return {
...base,
messaging: {
resolveInboundAttachmentRoots: (params) =>
resolveIMessageAttachmentRoots({ accountId: params.accountId, cfg: params.cfg }),
resolveRemoteInboundAttachmentRoots: (params) =>
resolveIMessageRemoteAttachmentRoots({ accountId: params.accountId, cfg: params.cfg }),
},
} as Pick<
ChannelPlugin<ResolvedIMessageAccount>,
| "id"
| "meta"
@@ -102,5 +116,6 @@ export function createIMessagePluginBase(params: {
| "config"
| "security"
| "setup"
| "messaging"
>;
}