"""Ports that application layers of all modules depend on.""" from collections.abc import Callable from contextlib import AbstractContextManager from datetime import date from types import TracebackType from typing import Protocol class UnitOfWork(Protocol): """Transaction boundary of a use case: ``with uow: ...``.""" def __enter__(self) -> object: ... def __exit__( self, exc_type: type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None, ) -> bool | None: ... class EventPublisher(Protocol): def publish(self, event: object) -> None: ... class Clock(Protocol): def today(self) -> date: """Current date in the business time zone.""" ... EventHandler = Callable[[object], None] TransactionFactory = Callable[[], AbstractContextManager[object]]