import type { DwnServerConfig } from './config.js'; import type { DidResolver } from '@enbox/dids'; import type { Dwn, GenericMessage } from '@enbox/dwn-sdk-js'; import type { MessageProcessedContext, MessageProcessedHook } from './message-processed-hook.js'; /** * Server-side service that handles two complementary features: * * 1. **Endpoint forwarding** — When a RecordsWrite/RecordsDelete is processed, * forwards the original signed message to the tenant's *other* DWN service * endpoints (peer replication without the agent mediating). * * 2. **Record delivery** — When a RecordsWrite/RecordsDelete is processed at a * module path with `$delivery`, proactively delivers to participants' DWN * endpoints determined from module `$actions` role records. * * Both operations are fire-and-forget: failures are logged but never propagate * to the original request handler. */ export declare class DeliveryService implements MessageProcessedHook { #private; private constructor(); /** * Factory method following the established server service pattern. */ static create(dwn: Dwn, didResolver: DidResolver, config: DwnServerConfig): DeliveryService; /** * Hook entry point invoked by the hooks runner after `dwn.processMessage()`. */ onMessageProcessed(context: MessageProcessedContext): void; /** * Evaluates whether forwarding or delivery should occur for a successfully * processed message, and dispatches outbound requests asynchronously. * * This method does NOT await the outbound requests — it returns immediately * after scheduling them. * * @param tenant - The tenant DID that owns the DWN. * @param message - The original signed DWN message. * @param statusCode - The reply status code from `dwn.processMessage()`. */ dispatchIfNeeded(tenant: string, message: GenericMessage, statusCode: number): void; } //# sourceMappingURL=delivery-service.d.ts.map