Source code for aeat.application.filing._runtime_repository
"""Runtime-backed repository helpers for filing application persistence.Constructs a:class:`~adapters.persistence.storage.SecureObjectRepository` scoped tothe active filing bucket on demand. The concrete adapter import is deferred sothe application filing module graph does not acquire an adapters-layer edge atimport time; only callers that actually need runtime storage cross thatboundary.See Also: :class:`application.filing.ModeloHistoryRepository` Application repository that consumes these helpers to persist filing-history payloads. :func:`adapters.persistence.storage.secure_object_repository_for_bucket` Storage-runtime factory used after the filing bucket id is resolved. :mod:`adapters.persistence.profile._filing_runtime` Parallel persistence-adapter helper used by the governed draft and amendment repositories."""from__future__importannotationsfromtypingimportTYPE_CHECKINGfrom...coreimportresolve_repository_bucket_idfrom.errorsimportModeloApplicationErrorifTYPE_CHECKING:from...adapters.persistence.storageimportSecureObjectRepository
[docs]defresolve_application_filing_bucket_id(bucket_id:str|None)->str:"""Return the explicit or active profile bucket id for application repositories. Args: bucket_id: Optional bucket id supplied by the caller. Blank values are rejected; ``None`` falls back to the active profile bucket. Returns: Normalized bucket id used to scope application filing storage. Raises: ModeloApplicationError: When no explicit or active profile bucket is available. """returnresolve_repository_bucket_id(bucket_id,error_type=ModeloApplicationError)
[docs]defsecure_objects_for_application_filing_bucket(bucket_id:str)->SecureObjectRepository:"""Return runtime-created secure-object storage for ``bucket_id``. The concrete adapter is imported here (not at module scope) so that application/filing/_runtime_repository does not carry a module-scope import from the adapters layer. The import-time edge is eliminated; the runtime dependency remains transparent. Returns: A :class:`~adapters.persistence.storage.SecureObjectRepository` scoped to ``bucket_id``. """from...adapters.persistence.storageimport(secure_object_repository_for_bucket,)returnsecure_object_repository_for_bucket(bucket_id)