aeat.domain.user_profile._values module¶
Strict Pydantic value records for centralized user profiles.
The portable-export bundle (UserProfilePortableExport) lives in
the sibling _portable_export module so its heavy domain-type
imports do not enter sys.modules at user-profile package init.
- class UserProfileStatus(*values)[source]¶
Bases:
StrEnumLifecycle status for a live profile root.
- ACTIVE¶
- TOMBSTONED¶
- new_profile_id()[source]¶
Mint a fresh immutable profile identity.
A profile’s identity is a generated UUIDv4 in the canonical hyphenated 36-character form. It is created once at profile creation and never changes — the bucket directory, keystore directory, secure-object key, and active-profile pointer all key on it. The operator-chosen display name is a fully decoupled mutable label with no role in any key or path.
- Return type:
- new_profile_snapshot_id(profile_id, *, created_at=None)[source]¶
Create a deterministic-shape but unique snapshot id.
- class UserProfileFact(**data)[source]¶
Bases:
BaseModelOne effective-dated user-profile fact.
- Parameters:
path (Annotated[str, StringConstraints(strip_whitespace=True, to_upper=None, to_lower=None, strict=None, min_length=3, max_length=192, pattern=^[a-z][a-z0-9_]*(?:\.(?:[0-9]+|[a-z][a-z0-9_]*))+$, ascii_only=None)])
value (UserProfileFactValue)
source (Annotated[str, StringConstraints(strip_whitespace=True, to_upper=None, to_lower=None, strict=None, min_length=1, max_length=80, pattern=None, ascii_only=None)])
valid_from (date | None)
valid_to (date | None)
- path: _FieldPath¶
- value: UserProfileFactValue¶
- source: _Source¶
- valid_from: date | None¶
- valid_to: date | None¶
- class UserProfileRecord(**data)[source]¶
Bases:
BaseModelLive secure user-profile aggregate before persistence encoding.
- Parameters:
schema_id (str)
schema_version (int)
profile_id (Annotated[str, StringConstraints(strip_whitespace=True, to_upper=None, to_lower=None, strict=None, min_length=1, max_length=36, pattern=^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$, ascii_only=None)])
display_name (Annotated[str, StringConstraints(strip_whitespace=True, to_upper=None, to_lower=None, strict=None, min_length=1, max_length=160, pattern=None, ascii_only=None)])
status (UserProfileStatus)
facts (tuple[UserProfileFact, ...])
created_at (datetime)
updated_at (datetime)
removed_at (datetime | None)
- schema_id: str¶
- schema_version: int¶
- profile_id: _ProfileId¶
- display_name: _DisplayName¶
- status: UserProfileStatus¶
- facts: tuple[UserProfileFact, ...]¶
- created_at: datetime¶
- updated_at: datetime¶
- removed_at: datetime | None¶
- tombstone(*, removed_at=None)[source]¶
Return a tombstoned
UserProfileRecordcopy of the live profile root.- Return type:
- Parameters:
removed_at (datetime | None)
- reactivate(*, reactivated_at=None)[source]¶
Return an active
UserProfileRecordcopy of a tombstoned profile root.The symmetric inverse of
tombstone(): clearsremoved_atand restoresstatustoUserProfileStatus.ACTIVEso the lifecycle invariant (activeprofiles never carryremoved_at) holds on the returned copy.- Return type:
- Parameters:
reactivated_at (datetime | None)
- class UserProfileSnapshot(**data)[source]¶
Bases:
BaseModelImmutable filing/export profile snapshot.
- Parameters:
snapshot_id (Annotated[str, StringConstraints(strip_whitespace=True, to_upper=None, to_lower=None, strict=None, min_length=1, max_length=128, pattern=^[A-Za-z0-9][A-Za-z_0-9.:-]*$, ascii_only=None)])
profile_id (Annotated[str, StringConstraints(strip_whitespace=True, to_upper=None, to_lower=None, strict=None, min_length=1, max_length=36, pattern=^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$, ascii_only=None)])
schema_id (str)
schema_version (int)
created_at (datetime)
facts (tuple[UserProfileFact, ...])
canonical_hash (str)
- snapshot_id: _SnapshotId¶
- profile_id: _ProfileId¶
- schema_id: str¶
- schema_version: int¶
- created_at: datetime¶
- facts: tuple[UserProfileFact, ...]¶
- canonical_hash: str¶
- classmethod from_profile(profile, *, snapshot_id=None, created_at=None)[source]¶
Create an immutable snapshot from a live profile record.
- Parameters:
profile (
UserProfileRecord) – TheUserProfileRecordto snapshot.snapshot_id (
str|None) – Optional explicit snapshot identifier; whenNonea deterministic id is derived from the profile state.created_at (
datetime|None) – Optional UTC timestamp stamped on the snapshot; defaults toutc_now()whenNone.
- Return type:
- Returns:
An immutable
UserProfileSnapshotfor the given profile.