aeat.adapters.persistence.profile.assets module¶
Encrypted SQL persistence for actividad economica asset and amortizacion ledgers.
AssetRecord, AssetsLedgerDocument, and
AmortizacionLedger payloads are stored as
FINANCIAL adapters.persistence.storage.SensitivityClass
secure objects in the primary database through
adapters.persistence.storage.SecureObjectRepository. The
singleton namespace, default object key, schema version, and custody contracts
come from
adapters.persistence.storage.PROFILE_ASSETS_LEDGER_NAMESPACE and
adapters.persistence.storage.PROFILE_ASSETS_AMORTIZATION_LEDGER_NAMESPACE.
See also
domain.contribuyente.assetsTyped asset and amortizacion payload models persisted here.
adapters.persistence.profile.inventorySibling profile-local secure-object adapter for stock valuation ledgers.
- load_assets()[source]¶
Load persisted asset records from the encrypted ledger.
- Return type:
- Returns:
Tuple of
AssetRecordentries, empty when the ledger is absent.
- save_assets(assets)[source]¶
Persist
assetsas a governed FINANCIAL-class encrypted envelope.The storage contract comes from
adapters.persistence.storage.PROFILE_ASSETS_LEDGER_NAMESPACE.- Parameters:
assets (
tuple[AssetRecord,...]) – Asset records to persist.- Return type:
Path- Returns:
Logical secure-object marker for the persisted ledger.
- add_asset(asset)[source]¶
Atomically add
assetto the encrypted asset ledger.- Parameters:
asset (
AssetRecord) – Asset record to insert.- Return type:
- Returns:
The updated
AssetsLedgerDocumentincluding the newly inserted asset.
- load_amortizacion_ledger()[source]¶
Load the amortizacion ledger, returning an empty ledger when absent.
- Return type:
- Returns:
Persisted
AmortizacionLedgeror an empty one when no envelope exists.
- save_amortizacion_ledger(ledger)[source]¶
Persist
ledgeras a governed FINANCIAL-class encrypted envelope.The storage contract comes from
adapters.persistence.storage.PROFILE_ASSETS_AMORTIZATION_LEDGER_NAMESPACE.- Parameters:
ledger (
AmortizacionLedger) – Amortizacion ledger to persist.- Return type:
Path- Returns:
Logical secure-object marker for the persisted ledger.
- class AssetsLedgerRepository(*, objects=None)[source]¶
Bases:
objectGoverned repository for the encrypted
AssetsLedgerDocumentsingleton.The singleton row is owned by
adapters.persistence.storage.PROFILE_ASSETS_LEDGER_NAMESPACEand persisted throughadapters.persistence.storage.SecureObjectRepository.- Parameters:
objects (SecureObjectRepository | None)
- load()[source]¶
Load the ledger, returning an empty document when absent.
- Return type:
- Returns:
Decrypted
AssetsLedgerDocument.- Raises:
AssetRecordError – When the envelope exists but cannot be loaded or decrypted.
- save(document)[source]¶
Persist
documentas FINANCIAL-class ciphertext.The classification, schema version, namespace, and object key are taken from
adapters.persistence.storage.PROFILE_ASSETS_LEDGER_NAMESPACE.- Parameters:
document (
AssetsLedgerDocument) – Ledger document to encrypt and write.- Return type:
- add(asset)[source]¶
Atomically add
assetand refuse duplicate identifiers.- Parameters:
asset (
AssetRecord) – Asset record to insert.- Return type:
- Returns:
The
AssetsLedgerDocumentincluding the new asset.- Raises:
AssetRecordError – When an asset with the same identifier already exists.
- class AmortizacionLedgerRepository(*, objects=None)[source]¶
Bases:
objectGoverned repository for the encrypted
AmortizacionLedgersingleton.Mirrors
AssetsLedgerRepositoryfor amortizacion entries; the payload type isAmortizacionLedger. Its singleton row is owned byadapters.persistence.storage.PROFILE_ASSETS_AMORTIZATION_LEDGER_NAMESPACEand persisted throughadapters.persistence.storage.SecureObjectRepository.- Parameters:
objects (SecureObjectRepository | None)
- load()[source]¶
Load the ledger, returning an empty document when absent.
- Return type:
- Returns:
Decrypted
AmortizacionLedger.- Raises:
AssetRecordError – When the envelope exists but cannot be loaded or decrypted.
- save(ledger)[source]¶
Persist
ledgeras FINANCIAL-class ciphertext.The classification, schema version, namespace, and object key are taken from
adapters.persistence.storage.PROFILE_ASSETS_AMORTIZATION_LEDGER_NAMESPACE.- Parameters:
ledger (
AmortizacionLedger) – Amortizacion ledger to encrypt and write.- Return type: