Skip to main content

Module list_record

Module list_record 

Source
Expand description

Generic atproto “list” + “listitem” record shapes, shared by every list-style lexicon in this crate (ai.hyprstream.placement.group/ groupItem, ai.hyprstream.event.group/groupItem, and any future one).

Mirrors app.bsky.graph.list/listitem: a list record names a group (name/ownerDid/purpose?/createdAt); a listitem record (in the owner’s repo) claims a member of it (group/subject/createdAt). Two independently-signed-off lexicons (ai.hyprstream.placement.* and ai.hyprstream.event.*) need this exact shape but are NOT the same record type — placement membership (who can be scheduled together) and event-group membership (who shares a broadcast key) are distinct axes that happen to share identical list/listitem mechanics. Keeping them as separate NSIDs preserves cheap collection-based firehose/AppView filtering and avoids reopening either lexicon’s frozen sign-off; this module is where the mechanics they share live, so neither duplicates it by hand.

ListItemRecord is used directly (group/subject/createdAt is identical across every list lexicon so far — no per-lexicon fields needed). ListRecord<E> is generic over E: ListExtra, the lexicon-specific extra fields beyond the common name/ownerDid/purpose/createdAt shape (() for no extra fields; a lexicon-specific payload otherwise).

Structs§

ListItemRecord
An atproto listitem record: { group: at-uri, subject: did, createdAt: datetime }. The owner’s claim that subject belongs to group; bidirectional consent (the subject’s own record separately consenting) is a fact about the wider system, not this record — see check_bidirectional_consent.
ListRecord
An atproto list record: { name, ownerDid, purpose?, createdAt } plus lexicon-specific extra fields E. Mirrors app.bsky.graph.list.

Traits§

ListExtra
A list record’s lexicon-specific extra fields beyond the common name/ownerDid/purpose/createdAt shape (e.g. keysetId for event groups; none — () — for placement groups).

Functions§

check_bidirectional_consent
Generic bidirectional-consent check: the owner’s claim (a fetched ListItemRecord) names subject as a member of group_uri AND the member’s own consent set (an already-resolved list of group at-uris from whatever member-side lexicon — caller’s responsibility) includes group_uri.
map_get_opt_str
Read an optional string field. Returns None when the field is omitted; an error if it is present but not a text string.
map_get_str
Read a required string field, attributing errors to nsid.
validate_at_uri
format: "at-uri" — must start with at:// and carry a non-empty, whitespace-free authority. (DID grammar is enforced by the resolver.)
validate_datetime
format: "datetime" — atproto ISO-8601 UTC, millisecond precision, Z.
validate_did
A DID string — must start with did: and carry a non-empty, whitespace-free method-specific identifier. Both did:web:… and did:key:… are accepted.
validate_nonempty
A required free-form string that must not be empty (field names it for the error message).