Files
iios/packages/iios-contracts/src/ingest.ts
T
maaz519 29b64c3c4e feat(service): P5.3 inbound adapter pipeline (ACK-fast webhook + RawEventProjector) + traceId
POST /v1/adapters/:type/webhook verifies HMAC (fail-closed) -> stores raw ->
emits raw.received -> 202. RawEventProjector consumes it off the relay, normalizes
via the adapter, reuses IngestService (traceId threaded raw->interaction).
Deduped on (channelType, externalEventId). rawBody enabled. 48 tests.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 13:44:23 +05:30

45 lines
1.1 KiB
TypeScript

import type { ScopeVector } from './scope';
import type { HandleKind, InteractionKind, MessagePartKind } from './enums';
/**
* The ingest API contract (Data Model §11 OpenAPI `IngestInteractionRequest`).
* A trusted host app or channel adapter posts this to `/v1/interactions/ingest`.
*/
export interface IngestInteractionRequest {
scope: ScopeVector;
channel: {
type: string; // PORTAL, EMAIL, WHATSAPP, ...
externalChannelId?: string;
capabilityContract?: Record<string, unknown>;
};
source: {
handleKind: HandleKind;
externalId: string;
displayName?: string;
};
kind?: InteractionKind;
thread?: {
externalThreadId?: string;
subject?: string;
};
parts: Array<{
kind: MessagePartKind;
bodyText?: string;
contentRef?: string;
mimeType?: string;
}>;
occurredAt: string;
providerEventId?: string;
/** Optional trace id to carry onto the created interaction (e.g. from an adapter). */
traceId?: string;
metadata?: Record<string, unknown>;
}
export interface IngestInteractionResponse {
interactionId: string;
sourceHandleId: string;
threadId: string;
state: string;
next: string[];
}