Documentation
¶
Index ¶
- Constants
- func BuildPayload(r *http.Request, req WebhookPayloadRequest) map[string]any
- func DecodeJSONObject(raw []byte) (map[string]any, string, error)
- func ExistingBodyHash(payloadJSON string) string
- func ExtractCorrelationID(r *http.Request, body map[string]any) string
- func ExtractDeliveryID(r *http.Request) string
- func ExtractIdempotencyKey(r *http.Request) string
- func IntentFromBody(body map[string]any) string
- func PresentedToken(r *http.Request, tokenHeader ...string) string
- func ProviderFromTopic(topic string) string
- func QueryValuesToMap(r *http.Request) map[string]any
- func ReadBody(r *http.Request, limit int64) ([]byte, error)
- func RegisterRoutes(app *echo.Echo, opts RouteOptions)
- func RequestContentTypeIsJSON(r *http.Request) bool
- func SanitizeHeaders(headers http.Header) map[string]string
- func TokenHash(token string) string
- func ValidTokenHash(r *http.Request, hash string, tokenHeader ...string) bool
- func ValidateExternalTopic(topic string) error
- type AcceptedResponse
- type EventQueryStore
- type EventRunJSON
- type EventRunTraceJSON
- type EventRunsResponse
- type EventSandboxJSON
- type EventSandboxSummaryJSON
- type EventSandboxesResponse
- type EventSchedulerEventJSON
- type EventSchedulerJSON
- type EventSchedulerRunJSON
- type EventSummaryJSON
- type EventSummaryListResponse
- type EventTopicJSON
- type EventTopicListResponse
- type EventTraceResponse
- type EventTraceSandboxJSON
- type Reservation
- type RouteOptions
- type RunQueue
- type RunStopper
- type SandboxSummaryReader
- type SourceJSON
- type SourceListResponse
- type SourceRequest
- type SourceResponse
- type Store
- type TopicEventJSON
- type TopicEventListResponse
- type TopicEventResponse
- type WebhookPayloadRequest
Constants ¶
View Source
const DefaultQueueName = "default"
Variables ¶
This section is empty.
Functions ¶
func BuildPayload ¶
func BuildPayload(r *http.Request, req WebhookPayloadRequest) map[string]any
func ExistingBodyHash ¶
func ExtractDeliveryID ¶
func ExtractIdempotencyKey ¶
func IntentFromBody ¶
func ProviderFromTopic ¶
func RegisterRoutes ¶
func RegisterRoutes(app *echo.Echo, opts RouteOptions)
func ValidateExternalTopic ¶
Types ¶
type AcceptedResponse ¶
type EventQueryStore ¶
type EventQueryStore interface {
ListEventSummaries(context.Context, domain.TopicEventFilter) ([]domain.EventSummary, int, error)
ListEventTopics(context.Context, string, int, int) ([]domain.EventTopicSummary, int, error)
GetEventTrace(context.Context, string, int) (domain.EventTrace, error)
}
EventQueryStore provides the lightweight HTTP event-query projections.
type EventRunJSON ¶
type EventRunJSON struct {
EventID string `json:"event_id"`
SchedulerID string `json:"scheduler_id"`
RunID string `json:"run_id,omitempty"`
TriggerID string `json:"trigger_id"`
Status string `json:"status"`
Error string `json:"error,omitempty"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
type EventRunTraceJSON ¶
type EventRunTraceJSON struct {
Delivery EventRunJSON `json:"delivery"`
Scheduler *EventSchedulerJSON `json:"scheduler,omitempty"`
Run *EventSchedulerRunJSON `json:"run,omitempty"`
Events []EventSchedulerEventJSON `json:"events"`
}
type EventRunsResponse ¶
type EventRunsResponse struct {
EventID string `json:"event_id"`
CorrelationID string `json:"correlation_id"`
Runs []EventRunJSON `json:"runs"`
}
func EventRunsResponseFor ¶
func EventRunsResponseFor(item domain.TopicEventRecord, deliveries []domain.EventDelivery) EventRunsResponse
type EventSandboxJSON ¶
type EventSandboxJSON struct {
SandboxID string `json:"sandbox_id"`
Relation string `json:"relation"`
SchedulerID string `json:"scheduler_id,omitempty"`
RunID string `json:"run_id,omitempty"`
TriggerID string `json:"trigger_id,omitempty"`
SchedulerEventID string `json:"scheduler_event_id,omitempty"`
EventID string `json:"event_id"`
CreatedAt string `json:"created_at"`
}
type EventSandboxSummaryJSON ¶
type EventSandboxSummaryJSON struct {
SandboxID string `json:"sandbox_id"`
Title string `json:"title"`
Status string `json:"status"`
ProjectID string `json:"project_id,omitempty"`
AgentName string `json:"agent_name,omitempty"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
type EventSandboxesResponse ¶
type EventSandboxesResponse struct {
EventID string `json:"event_id"`
CorrelationID string `json:"correlation_id"`
Sandboxes []EventSandboxJSON `json:"sandboxes"`
}
func EventSandboxesResponseFor ¶
func EventSandboxesResponseFor(item domain.TopicEventRecord, links []domain.EventSandboxTraceItem) EventSandboxesResponse
type EventSchedulerEventJSON ¶
type EventSchedulerJSON ¶
type EventSchedulerRunJSON ¶
type EventSummaryJSON ¶
type EventSummaryJSON struct {
EventID string `json:"event_id"`
Sequence int64 `json:"sequence"`
Topic string `json:"topic"`
Source string `json:"source"`
Provider string `json:"provider,omitempty"`
Intent string `json:"intent,omitempty"`
CorrelationID string `json:"correlation_id"`
DeliveryID string `json:"delivery_id,omitempty"`
DispatchStatus string `json:"dispatch_status"`
ParentEventID string `json:"parent_event_id,omitempty"`
PublisherType string `json:"publisher_type,omitempty"`
PublisherID string `json:"publisher_id,omitempty"`
PublisherRunID string `json:"publisher_run_id,omitempty"`
CreatedAt string `json:"created_at"`
DispatchedAt string `json:"dispatched_at,omitempty"`
}
type EventSummaryListResponse ¶
type EventSummaryListResponse struct {
Items []EventSummaryJSON `json:"items"`
Total int `json:"total"`
NextAfterSequence int64 `json:"next_after_sequence,omitempty"`
}
type EventTopicJSON ¶
type EventTopicListResponse ¶
type EventTopicListResponse struct {
Items []EventTopicJSON `json:"items"`
Total int `json:"total"`
}
type EventTraceResponse ¶
type EventTraceResponse struct {
SandboxSummariesIncomplete bool `json:"sandbox_summaries_incomplete,omitempty"`
Event EventSummaryJSON `json:"event"`
Runs []EventRunTraceJSON `json:"runs"`
Sandboxes []EventTraceSandboxJSON `json:"sandboxes"`
DescendantsTruncated bool `json:"descendants_truncated"`
}
type EventTraceSandboxJSON ¶
type EventTraceSandboxJSON struct {
EventSandboxJSON
Sandbox *EventSandboxSummaryJSON `json:"sandbox,omitempty"`
}
type Reservation ¶
type Reservation struct {
// contains filtered or unexported fields
}
func NoopReservations ¶
func NoopReservations(count int) []*Reservation
func (*Reservation) Release ¶
func (r *Reservation) Release()
type RouteOptions ¶
type RouteOptions struct {
Store Store
QueryStore EventQueryStore
Sandboxes SandboxSummaryReader
WebhookBodyLimit int64
NewEventID func() string
MarshalJSONCompact func(any) (string, error)
RunStopper RunStopper
}
type RunQueue ¶
type RunQueue struct {
// contains filtered or unexported fields
}
func NewRunQueue ¶
func NewRunQueueFromConfig ¶
func (*RunQueue) Reserve ¶
func (q *RunQueue) Reserve(event domain.SchedulerTopicEvent) (*Reservation, bool)
type RunStopper ¶
type SandboxSummaryReader ¶
type SandboxSummaryReader interface {
ListSandboxSummaries(context.Context, []string) (map[string]domain.SandboxSummary, error)
}
SandboxSummaryReader batches optional sandbox enrichment for event traces.
type SourceJSON ¶
type SourceJSON struct {
ID string `json:"id"`
Name string `json:"name"`
Enabled bool `json:"enabled"`
Provider string `json:"provider"`
TopicPrefix string `json:"topic_prefix"`
HasToken bool `json:"has_token"`
TokenHeader string `json:"token_header,omitempty"`
SignatureType string `json:"signature_type,omitempty"`
HasSignatureSecret bool `json:"has_signature_secret"`
BodyLimitBytes int64 `json:"body_limit_bytes,omitempty"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
func SourceToJSON ¶
func SourceToJSON(source domain.WebhookSource) SourceJSON
type SourceListResponse ¶
type SourceListResponse struct {
Items []SourceJSON `json:"items"`
}
type SourceRequest ¶
type SourceRequest struct {
Name string `json:"name"`
Enabled *bool `json:"enabled,omitempty"`
Provider string `json:"provider"`
TopicPrefix string `json:"topic_prefix"`
Token string `json:"token"`
TokenHash string `json:"token_hash"`
TokenHeader *string `json:"token_header,omitempty"`
ClearToken bool `json:"clear_token"`
SignatureType string `json:"signature_type"`
SignatureSecret string `json:"signature_secret"`
ClearSignature bool `json:"clear_signature"`
BodyLimitBytes int64 `json:"body_limit_bytes"`
}
type SourceResponse ¶
type SourceResponse struct {
Source SourceJSON `json:"source"`
}
type Store ¶
type Store interface {
FindEventByIdempotencyKey(context.Context, string, string) (domain.TopicEventRecord, bool, error)
CreateEvent(context.Context, domain.TopicEventRecord) (domain.TopicEventRecord, error)
GetEvent(context.Context, string) (domain.TopicEventRecord, error)
ListEvents(context.Context, domain.TopicEventFilter) ([]domain.TopicEventRecord, int, error)
ListDescendantEventIDs(context.Context, string, int) ([]string, error)
ListEventSandboxLinks(context.Context, []string) ([]domain.EventSandboxTraceItem, error)
ListEventDeliveries(context.Context, []string) ([]domain.EventDelivery, error)
CancelEventDispatch(context.Context, []string, string) (domain.EventDispatchCancellation, error)
ListWebhookSources(context.Context) ([]domain.WebhookSource, error)
GetWebhookSource(context.Context, string) (domain.WebhookSource, bool, error)
UpsertWebhookSource(context.Context, domain.WebhookSource) (domain.WebhookSource, error)
DeleteWebhookSource(context.Context, string) error
ListEnabledWebhookSourcesForTopic(context.Context, string) ([]domain.WebhookSource, error)
}
type TopicEventJSON ¶
type TopicEventJSON struct {
EventID string `json:"event_id"`
Sequence int64 `json:"sequence"`
Topic string `json:"topic"`
Source string `json:"source"`
Provider string `json:"provider,omitempty"`
Intent string `json:"intent,omitempty"`
CorrelationID string `json:"correlation_id"`
IdempotencyKey string `json:"idempotency_key,omitempty"`
DeliveryID string `json:"delivery_id,omitempty"`
DispatchStatus string `json:"dispatch_status"`
ParentEventID string `json:"parent_event_id,omitempty"`
PublisherType string `json:"publisher_type,omitempty"`
PublisherID string `json:"publisher_id,omitempty"`
PublisherRunID string `json:"publisher_run_id,omitempty"`
CreatedAt string `json:"created_at"`
DispatchedAt string `json:"dispatched_at,omitempty"`
Payload map[string]any `json:"payload"`
}
func TopicEventToJSON ¶
func TopicEventToJSON(item domain.TopicEventRecord) TopicEventJSON
type TopicEventListResponse ¶
type TopicEventListResponse struct {
Items []TopicEventJSON `json:"items"`
Total int `json:"total"`
NextAfterSequence int64 `json:"next_after_sequence,omitempty"`
}
type TopicEventResponse ¶
type TopicEventResponse struct {
Event TopicEventJSON `json:"event"`
}
type WebhookPayloadRequest ¶
type WebhookPayloadRequest struct {
EventID string
Sequence int64
Topic string
CorrelationID string
IdempotencyKey string
Source domain.WebhookSource
Body map[string]any
}
WebhookPayloadRequest describes the event metadata BuildPayload assembles alongside the inbound HTTP request into a delivery payload.
Click to show internal directories.
Click to hide internal directories.