activitymap

package
v0.45.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 4 Imported by: 1

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

func WithActorFallback(actorID string) Option

WithActorFallback sets the final actor-id fallback when actor/user ids are empty.

func WithDefaultChannel

func WithDefaultChannel(channel string) Option

WithDefaultChannel sets the default channel for normalized records.

func WithDefaultObjectType

func WithDefaultObjectType(objectType string) Option

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址