Source code for cadrumo.application.modelo.work_profile
"""The decrypted profile one modelo work command carries through its call chain.Core types::class:`~cadrumo.domain.user_profile.values.UserProfileRecord`."""from__future__importannotationsfromdataclassesimportdataclassfromtypingimportTYPE_CHECKINGfromuuidimportUUIDifTYPE_CHECKING:fromcollections.abcimportMappingfrom...domain.calculations.registry.authority_artifactimportProfileDecodeContextfrom...domain.user_profile.valuesimportUserProfileRecord
[docs]@dataclass(frozen=True,slots=True)classModeloWorkProfile:"""One authenticated profile record and the decode context its session used. A command loads this once for its target bucket and hands the same value to every gate, resolver and advisory it runs, instead of each of them decrypting the same unchanged record again. """record:UserProfileRecordprofile_decode_context:ProfileDecodeContext
[docs]@dataclass(frozen=True,slots=True)classModeloWorkProfilePathValues:"""Serve the path-keyed projection of an already-loaded work profile. Satisfies :class:`~application.user_profile.profile_read_ports.ProfilePathValuesReadPort` with the same absence semantics as the session-bound persistence reader: a bucket other than the loaded profile's own has no profile here. """profile:ModeloWorkProfile
[docs]defload_path_values(self,*,bucket_id:str)->Mapping[str,str]|None:"""Return the loaded record's path values, or ``None`` for any other bucket."""from..user_profile.projectionsimportrecord_to_path_valuesrecord=self.profile.recordifUUID(str(bucket_id))!=UUID(str(record.profile_id)):returnNonereturnrecord_to_path_values(record)