Documentation
¶
Overview ¶
Package activitymap provides helpers to normalize auth activity events into transport-agnostic records for external activity systems.
Index ¶
Constants ¶
View Source
const ( // MetadataKeyActorType stores the actor type derived from auth.ActorRef.Type. MetadataKeyActorType = "actor_type" // MetadataKeyFromStatus stores the source user status for lifecycle transitions. MetadataKeyFromStatus = "from_status" // MetadataKeyToStatus stores the target user status for lifecycle transitions. MetadataKeyToStatus = "to_status" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Normalized ¶
type Normalized struct {
ActorID string `json:"actor_id"`
Verb string `json:"verb"`
ObjectType string `json:"object_type,omitempty"`
ObjectID string `json:"object_id,omitempty"`
Channel string `json:"channel,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
OccurredAt time.Time `json:"occurred_at"`
}
Normalized is a transport-agnostic activity shape for downstream systems.
func Normalize ¶
func Normalize(event auth.ActivityEvent, opts ...Option) Normalized
Normalize converts an auth.ActivityEvent into a generic normalized shape.
type Option ¶
type Option func(*normalizeOptions)
Option customizes normalization behavior.
func WithActorFallback ¶
WithActorFallback sets the final actor-id fallback when actor/user ids are empty.
func WithDefaultChannel ¶
WithDefaultChannel sets the default channel for normalized records.
func WithDefaultObjectType ¶
WithDefaultObjectType sets the default object type for normalized records.
func WithObjectIDResolver ¶
func WithObjectIDResolver(resolver func(auth.ActivityEvent) string) Option
WithObjectIDResolver overrides object-id extraction from ActivityEvent.
Click to show internal directories.
Click to hide internal directories.