parse

package
v0.0.0-...-69ce26b Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrAssetTooLarge    = "ErrAssetTooLarge"
	ErrAssetSizeUnknown = "ErrAssetSizeUnknown"
	ErrFailedToFetch    = "ErrFailedToFetch"
	ErrFetchNotOk       = "ErrFetchNotOk"
	// MaxAssetSize = 200 GB storage per ECS node / 64 parallel kafka workers
	MaxAssetSize    = 3 * 1e9
	MaxSnapshotSize = 64 * 1024 * 1024
)
View Source
const (
	ScriptPlaceholder = "SCRIPT_PLACEHOLDER"
)

Variables

View Source
var DisallowedTagPrefixes = []string{
	"onchange",
	"onclick",
	"onkey",
	"onload",
	"onmouse",
}
View Source
var ProxyURL = fmt.Sprintf("%s/cors", env.Config.PublicGraphUri)

Functions

func GetHostUrlFromEvents

func GetHostUrlFromEvents(events []*ReplayEvent) *string

Types

type Event

type Event struct {
	Type      EventType
	Timestamp int64
	Data      interface{}
}

func FilterEventsForInsights

func FilterEventsForInsights(events []interface{}) ([]*Event, error)

type EventSource

type EventSource int
const (
	Mutation EventSource = iota
	MouseMove
	MouseInteraction
	Scroll
	ViewportResize
	Input
	TouchMove
	MediaInteraction
	StyleSheetRule
	CanvasMutation
	Font
	Log
	Drag
)

type EventType

type EventType int
const (
	DomContentLoaded EventType = iota
	Load
	FullSnapshot
	IncrementalSnapshot
	Meta
	Custom
)

type MouseInteractionEventData

type MouseInteractionEventData struct {
	X      *float64           `json:"x"`
	Y      *float64           `json:"y"`
	Source *EventSource       `json:"source"`
	Type   *MouseInteractions `json:"type"`
}

MouseInteractionEventData represents the data field for click events from the following parent events

func UnmarshallMouseInteractionEvent

func UnmarshallMouseInteractionEvent(data json.RawMessage) (*MouseInteractionEventData, error)

type MouseInteractions

type MouseInteractions int
const (
	MouseUp MouseInteractions = iota
	MouseDown
	Click
	ContextMenu
	DblClick
	Focus
	Blur
	TouchStart
	TouchMove_Departed
	TouchEnd
	TouchCancel
)

type ReplayEvent

type ReplayEvent struct {
	Timestamp    time.Time       `json:"-"`
	Type         EventType       `json:"type"`
	Data         json.RawMessage `json:"data"`
	TimestampRaw float64         `json:"timestamp"`
	SID          float64         `json:"_sid"`
}

ReplayEvent represents a single event that represents a change on the DOM.

func (*ReplayEvent) UnmarshalJSON

func (r *ReplayEvent) UnmarshalJSON(b []byte) error

type ReplayEvents

type ReplayEvents struct {
	Events []*ReplayEvent `json:"events"`
}

ReplayEvents is a set of ReplayEvent(s).

func EventsFromString

func EventsFromString(eventsString string) (*ReplayEvents, error)

EventsFromString parses a json string in the form {events: [ev1, ev2, ...]}.

type Snapshot

type Snapshot struct {
	// contains filtered or unexported fields
}

func NewSnapshot

func NewSnapshot(inputData json.RawMessage, hostUrl *string) (*Snapshot, error)

func (*Snapshot) Encode

func (s *Snapshot) Encode() (json.RawMessage, error)

func (*Snapshot) EscapeJavascript

func (s *Snapshot) EscapeJavascript(ctx context.Context) error

EscapeJavascript adds a guardrail to prevent javascript from being stored in the recording.

func (*Snapshot) InjectStylesheets

func (s *Snapshot) InjectStylesheets(ctx context.Context) error

InjectStylesheets injects custom stylesheets into a given snapshot event.

func (*Snapshot) ReplaceAssets

func (s *Snapshot) ReplaceAssets(ctx context.Context, projectId int, store *store.Store, retentionPeriod modelInputs.RetentionPeriod) error

Jump to

Keyboard shortcuts

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