aeat.adapters.persistence.profile.invoices module¶
Governed-persistence repository for the invoice catalogue.
InvoiceCatalogueRepository is the sanctioned read/write path for the
InvoiceCatalogue. It stores the catalogue as an
encrypted byte object via
SecureObjectRepository at
FINANCIAL SensitivityClass using
an Envelope wrapper; no plaintext
invoice row, JSON catalogue, or envelope file lands on disk.
This concrete repository is the persistence adapter behind the read-side
InvoiceCatalogueRepositoryProtocol. It lives in
the persistence adapter (not in domain.invoices) because its
secure-object coupling is SQL/crypto-bound; the domain package owns only the
typed InvoiceCatalogue model, its narrow port,
and the InvoicePersistenceError boundary error.
- class InvoiceCatalogueRepository(*, bucket_id=None, objects=None)[source]¶
Bases:
objectRepository over encrypted SQL-backed
InvoiceCataloguestorage.adapters.persistence.storage.INVOICE_CATALOGUE_NAMESPACEis the central profile-local namespace, schema-version, sensitivity, and singleton-key contract for the encrypted invoice catalogue row. TheInvoiceCataloguepayload is wrapped inEnvelopebeforeSecureObjectRepositorypersists it, andto_secure_object_write()exposes the same write for transaction/event co-commit paths. This class exposes the concrete load/save implementation behindInvoiceCatalogueRepositoryProtocol.- Parameters:
bucket_id (str | None)
objects (SecureObjectRepository | None)
- load()[source]¶
Return the persisted catalogue or an empty catalogue if absent.
- Return type:
- Returns:
The deserialised
InvoiceCatalogue, or a fresh empty instance when no database object is present.- Raises:
ClassificationError – If the persisted object’s classification is not
SensitivityClass.FINANCIAL.EnvelopeVersionError – If the envelope schema version is higher than the consumer supports.
- save(catalogue)[source]¶
Persist
catalogueatomically under the file lock.The on-disk database value is an encrypted
EnvelopeBLOB at theSensitivityClassFINANCIALclassification declared byadapters.persistence.storage.INVOICE_CATALOGUE_NAMESPACE. No plaintext invoice row lands on disk.- Parameters:
catalogue (
InvoiceCatalogue) – TheInvoiceCatalogueto persist.- Return type:
- to_secure_object_write(catalogue)[source]¶
Return the secure-object upsert for
cataloguewithout committing it.The returned
SecureObjectWritecarries the sameEnvelopeandSensitivityClassclassification thatsave()would persist directly.- Parameters:
catalogue (
InvoiceCatalogue) – TheInvoiceCatalogueto serialise.- Return type: