feat(iios): register EmailAdapter for EMAIL + email-shaped egress provider
AdapterRegistry now backs the EMAIL channel with the email-native EmailAdapter
(RFC threading) instead of the generic WebhookAdapter. Adds EmailProvider — an
email-envelope egress provider ({to,subject,text,html,inReplyTo}) registered for
EMAIL when IIOS_PROVIDER_URL_EMAIL is set (sandbox stays the default). Spec:
signed email → normalized interaction on the email thread; a reply joins the
same thread (one conversation); bad signature → rejected (fail-closed).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import type { ScopeVector } from '@insignia/iios-contracts';
|
||||
import { WebhookAdapter, type ChannelAdapter } from '@insignia/iios-adapter-sdk';
|
||||
import { WebhookAdapter, EmailAdapter, type ChannelAdapter } from '@insignia/iios-adapter-sdk';
|
||||
|
||||
export interface AdapterConfig {
|
||||
secret: string;
|
||||
@@ -8,10 +8,9 @@ export interface AdapterConfig {
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers channel adapters + their per-channel config (secret + scope). In P5
|
||||
* one reference WebhookAdapter backs several channelTypes (WEBHOOK/EMAIL/WHATSAPP)
|
||||
* so the fixtures exercise the same anti-corruption pipeline. Secrets come from
|
||||
* ADAPTER_SECRETS (JSON map); scope defaults to the demo scope.
|
||||
* Registers channel adapters + their per-channel config (secret + scope). EMAIL uses
|
||||
* the email-native EmailAdapter (RFC threading); the rest use the reference
|
||||
* WebhookAdapter. Secrets come from ADAPTER_SECRETS (JSON map); scope defaults to demo.
|
||||
*/
|
||||
@Injectable()
|
||||
export class AdapterRegistry {
|
||||
@@ -29,8 +28,9 @@ export class AdapterRegistry {
|
||||
appId: process.env.ADAPTER_APP ?? 'portal-demo',
|
||||
};
|
||||
for (const channelType of ['WEBHOOK', 'EMAIL', 'WHATSAPP', 'PORTAL']) {
|
||||
const adapter: ChannelAdapter = channelType === 'EMAIL' ? new EmailAdapter() : new WebhookAdapter(channelType);
|
||||
this.adapters.set(channelType, {
|
||||
adapter: new WebhookAdapter(channelType),
|
||||
adapter,
|
||||
config: { secret: secrets[channelType] ?? 'dev-adapter-secret', scope },
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user