eventshttp

package
v1.162.2 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package eventshttp serves how a managed script's event runs stand (#2332): each event a webhook source stores enqueues one run of every script with a webhook handler for it (#2434), with trigger event. Which sources a script runs for is its handlers', set through internal/httpserver/scripthttp/ handlerhttp.

The composition root mounts it beside scripthttp (ForPortal), whose owner check it uses.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Summary is how the script's event runs stand (scriptevents.PostgresStore).
	Summary func(ctx context.Context, scriptID string, since time.Time) (scriptevents.EventSummary, error)
	// MaxQueued is scripts.events.max_queued; zero is the default.
	MaxQueued int
}

Config is the store event runs are read from.

func ConfigFor

func ConfigFor(db *sql.DB, maxQueued int) Config

ConfigFor is the Config over the platform's database.

type Deps

type Deps struct {
	// Config is the event run store.
	Config Config
	// Owned resolves the script in the path for its owner or an
	// administrator, writing any refusal itself.
	Owned func(w http.ResponseWriter, r *http.Request) (scriptID, actor string, ok bool)
	// Now is the clock; nil is time.Now.
	Now func() time.Time
}

Deps carries what the routes need.

type Handler

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

Handler serves the routes.

func ForPortal

func ForPortal(scripts *scripthttp.Handler, cfg Config) *Handler

ForPortal is the handler over scripthttp's owner check.

func New

func New(deps Deps) *Handler

New builds the handler.

func (*Handler) Register

func (h *Handler) Register(mux *http.ServeMux, wrap func(http.Handler) http.Handler)

Register mounts the routes, wrapped in the portal authentication middleware.

Jump to

Keyboard shortcuts

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