cadrumo.adapters.persistence.profile.catalogue_creation module

Outward adapters for the catalogue-invoice creation capability.

The application bundle exposes only domain catalogue values and application errors. These wrappers bind the existing encrypted repositories and ECB provider to that contract, translating storage/upstream failures before they reach an application caller.

class CatalogueCreationInvoiceRepositoryAdapter(*, repository)[source]

Bases: CatalogueInvoiceRepositoryPort

Translate the encrypted invoice repository to the creation port.

Parameters:

repository (InvoiceCatalogueRepository)

load()[source]

Load one catalogue, hiding storage-specific failure types.

Return type:

InvoiceCatalogue

mutate(mutation)[source]

Apply one guarded mutation, preserving domain validation refusals.

Core types: InvoiceCatalogue.

Return type:

InvoiceCatalogue

Parameters:

mutation (Callable[[InvoiceCatalogue], InvoiceCatalogue])

class CatalogueCreationEventRepositoryAdapter(*, repository)[source]

Bases: CatalogueInvoiceEventRepositoryPort

Translate the encrypted bucket-event repository to the creation port.

Parameters:

repository (BucketEventHistoryRepository)

exists()[source]

Report event-history presence through the application contract.

Return type:

bool

load()[source]

Load event history, hiding storage-specific failure types.

Return type:

BucketEventHistoryCatalogue

save(catalogue)[source]

Persist event history through the existing encrypted repository.

Return type:

None

Parameters:

catalogue (BucketEventHistoryCatalogue)

to_secure_object_write(catalogue, *, expected_revision_id=None)[source]

Prepare the inherited co-commit write capability.

Return type:

SecureObjectWrite

Parameters:
append_guarded(appender, *, attempts=4)[source]

Append one event through the repository revision guard.

Return type:

BucketEventHistoryCatalogue

Parameters:
class CatalogueCreationRateProviderAdapter(*, provider)[source]

Bases: CatalogueInvoiceRateProviderPort

Translate the host’s exchange-rate provider to the application rate capability.

Parameters:

provider (ExchangeRateProvider)

property rate_source_id: str

Return the provider’s stable authority identifier.

get_eur_rate(currency, rate_date)[source]

Fetch a rate while hiding outbound-provider failure types.

Return type:

Decimal | None

Parameters:
build_catalogue_creation_ports(*, bucket_id)[source]

Bind the existing encrypted repositories and the host’s rate provider for a bucket.

Return type:

CatalogueCreationPorts

Parameters:

bucket_id (str)

build_catalogue_lifecycle_ports(*, bucket_id)[source]

Bind read, mutation, and audit adapters for one invoice bucket.

Return type:

CatalogueLifecyclePorts

Parameters:

bucket_id (str)