Source code for cadrumo.application.invoices.source_resolver_ports
"""Application-owned capabilities for invoice source resolution.The invoice source-mesh resolver needs only a read projection of the invoicecatalogue. The application owns that narrow capability and its translatedpersistence failure; an outer composition root binds the encrypted repositoryadapter for each bucket.Core types::class:`~cadrumo.domain.invoices.models.InvoiceCatalogue`."""from__future__importannotationsfromdataclassesimportdataclassfromtypingimportProtocolfrom...core.errors.hierarchyimportCadrumoErrorfrom...domain.invoices.modelsimportInvoiceCatalogue
[docs]classInvoiceSourcePersistenceError(CadrumoError):"""Translated failure while reading the invoice source catalogue."""def__init__(self,operation:str)->None:"""Carry only the application operation, never storage details."""self.operation=operationsuper().__init__(f"invoice source persistence operation failed: {operation}")
[docs]classInvoiceSourceCatalogueReader(Protocol):"""Read the bucket-bound invoice catalogue used by source resolution."""
[docs]defload(self)->InvoiceCatalogue:"""Return the validated invoice catalogue for the composed bucket."""...
[docs]@dataclass(frozen=True,slots=True)classInvoiceSourceResolverPorts:"""Required capabilities for one invoice source-mesh resolver."""catalogue_reader:InvoiceSourceCatalogueReader