aeat.domain.transactions._protocols module

Domain-level repository Protocol for the transaction catalogue.

Application-layer code that persists or loads the TransactionCatalogue depends on TransactionCatalogueRepositoryProtocol, not on the concrete adapter-backed TransactionCatalogueRepository. This keeps the domain layer free of adapter imports while still providing a typed port surface.

class TransactionCatalogueRepositoryProtocol(*args, **kwargs)[source]

Bases: Protocol

Narrow domain-facing repository contract for the transaction catalogue.

Any object that provides exists, load, load_for_date_range, partition_by_date_range, and save over a per-bucket TransactionCatalogue satisfies this protocol. The concrete secure-object-backed implementation is TransactionCatalogueRepository.

property bucket_id: str

Return the profile bucket id this repository is bound to.

exists()[source]

Return whether this bucket’s transaction catalogue has been persisted.

Return type:

bool

load()[source]

Return the persisted catalogue or an empty catalogue if absent.

Return type:

TransactionCatalogue

Returns:

The TransactionCatalogue loaded from storage.

load_for_date_range(start, end)[source]

Return the persisted catalogue filtered to [start, end] inclusive.

Implementations MAY use a non-sensitive routing index to select candidate rows before decrypting, but MUST always return the same result load() filtered by filing date would return.

Parameters:
  • start (date) – Inclusive lower bound of the filing-date window.

  • end (date) – Inclusive upper bound of the filing-date window.

Return type:

TransactionCatalogue

partition_by_date_range(start, end)[source]

Split the persisted catalogue into an in-window half and an out-of-window remainder.

Implementations MAY use a non-sensitive routing index to decide the split without decrypting the out-of-window half, but MUST always return the same in-window transaction set load() filtered by filing date would return. They MUST also represent every remaining catalogue transaction (regardless of any other field) either as row-level out-of-window stubs during migration or as the compact count/date-span summary authorized by the latency ADR – never silently omit one from either half. Summary payloads must carry only plaintext date-index facts, never decrypted transaction fields.

Parameters:
  • start (date) – Inclusive lower bound of the filing-date window.

  • end (date) – Inclusive upper bound of the filing-date window.

Return type:

LedgerDatePartition

save(catalogue)[source]

Persist catalogue in the encrypted database object store.

Parameters:

catalogue (TransactionCatalogue) – The TransactionCatalogue to persist.

Return type:

None