import type { EnvironmentId } from "@t3tools/contracts"; import { appAtomRegistry } from "./atom-registry"; import { createThreadOutboxManager } from "./thread-outbox-manager"; import type { QueuedThreadMessage } from "./thread-outbox-model"; import { expoThreadOutboxStorage } from "./thread-outbox-storage"; export * from "./thread-outbox-model"; export const threadOutboxManager = createThreadOutboxManager({ registry: appAtomRegistry, storage: expoThreadOutboxStorage, }); export function ensureThreadOutboxLoaded(): void { void threadOutboxManager.load(); } export function enqueueThreadOutboxMessage(message: QueuedThreadMessage): Promise { return threadOutboxManager.enqueue(message); } export function removeThreadOutboxMessage(message: QueuedThreadMessage): Promise { return threadOutboxManager.remove(message); } export function clearThreadOutboxEnvironment(environmentId: EnvironmentId): Promise { return threadOutboxManager.clearEnvironment(environmentId); }