server

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	RequestService  *service.RequestService
	PolicyService   *service.PolicyService
	WebhookService  *service.WebhookService
	TenantService   *service.TenantService
	OperatorService *service.OperatorService
	AuditStore      store.AuditStore
	OutboxStore     store.OutboxStore
	SignalWorker    func()
	AuthProvider    auth.Provider
	ConsoleEnabled  bool
	SecureCookies   bool
	Suggestions     config.SuggestionsConfig
	ConsoleSPA      http.Handler // SPA handler from console package (nil when built without tag)
	EmbedHandler    http.Handler // Widget JS handler from widgets package (nil when built without tag)
	HealthCheckers  []health.HealthChecker
	Metrics         *metrics.Metrics
	EventHub        *sse.Hub
	MetricsPath     string
	Registry        *prometheus.Registry
}

type ConsoleHandler

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

ConsoleHandler handles admin console API endpoints for operator management.

func NewConsoleHandler

func NewConsoleHandler(os *service.OperatorService, ts *service.TenantService, secureCookies bool, suggestions config.SuggestionsConfig) *ConsoleHandler

func (*ConsoleHandler) ChangePassword

func (h *ConsoleHandler) ChangePassword(w http.ResponseWriter, r *http.Request)

ChangePassword changes the current operator's password.

func (*ConsoleHandler) CreateOperator

func (h *ConsoleHandler) CreateOperator(w http.ResponseWriter, r *http.Request)

CreateOperator creates a new operator.

func (*ConsoleHandler) CreateTenant

func (h *ConsoleHandler) CreateTenant(w http.ResponseWriter, r *http.Request)

CreateTenant registers a new tenant.

func (*ConsoleHandler) DeleteOperator

func (h *ConsoleHandler) DeleteOperator(w http.ResponseWriter, r *http.Request)

DeleteOperator deletes an operator by ID.

func (*ConsoleHandler) DeleteTenant

func (h *ConsoleHandler) DeleteTenant(w http.ResponseWriter, r *http.Request)

DeleteTenant removes a tenant by ID.

func (*ConsoleHandler) ListOperators

func (h *ConsoleHandler) ListOperators(w http.ResponseWriter, r *http.Request)

func (*ConsoleHandler) ListTenants

func (h *ConsoleHandler) ListTenants(w http.ResponseWriter, r *http.Request)

func (*ConsoleHandler) Login

func (h *ConsoleHandler) Login(w http.ResponseWriter, r *http.Request)

Login authenticates an operator and returns a JWT.

func (*ConsoleHandler) Logout

func (h *ConsoleHandler) Logout(w http.ResponseWriter, r *http.Request)

Logout clears the session cookie.

func (*ConsoleHandler) Me

Me returns the current authenticated operator.

func (*ConsoleHandler) NeedsSetup

func (h *ConsoleHandler) NeedsSetup(w http.ResponseWriter, r *http.Request)

NeedsSetup returns whether the system needs initial setup.

func (*ConsoleHandler) ProxySuggestions added in v0.1.2

func (h *ConsoleHandler) ProxySuggestions(w http.ResponseWriter, r *http.Request)

func (*ConsoleHandler) Setup

func (h *ConsoleHandler) Setup(w http.ResponseWriter, r *http.Request)

Setup creates the first operator. Only works when no operators exist.

func (*ConsoleHandler) SuggestionsConfig added in v0.1.2

func (h *ConsoleHandler) SuggestionsConfig(w http.ResponseWriter, r *http.Request)

type DeliveryHandler

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

DeliveryHandler exposes outbox/delivery status and manual retry to the console.

func NewDeliveryHandler

func NewDeliveryHandler(outbox store.OutboxStore, signalWorker func()) *DeliveryHandler

func (*DeliveryHandler) List

func (*DeliveryHandler) Retry

func (*DeliveryHandler) RetryAllFailed added in v0.1.2

func (h *DeliveryHandler) RetryAllFailed(w http.ResponseWriter, r *http.Request)

func (*DeliveryHandler) RetryAllForRequest

func (h *DeliveryHandler) RetryAllForRequest(w http.ResponseWriter, r *http.Request)

func (*DeliveryHandler) Stats

type PolicyHandler

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

func NewPolicyHandler

func NewPolicyHandler(ps *service.PolicyService) *PolicyHandler

func (*PolicyHandler) Create

func (h *PolicyHandler) Create(w http.ResponseWriter, r *http.Request)

func (*PolicyHandler) Delete

func (h *PolicyHandler) Delete(w http.ResponseWriter, r *http.Request)

func (*PolicyHandler) Get

func (*PolicyHandler) List

func (h *PolicyHandler) List(w http.ResponseWriter, r *http.Request)

func (*PolicyHandler) RequestTypes added in v0.1.2

func (h *PolicyHandler) RequestTypes(w http.ResponseWriter, r *http.Request)

func (*PolicyHandler) Update

func (h *PolicyHandler) Update(w http.ResponseWriter, r *http.Request)

type RequestHandler

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

func NewRequestHandler

func NewRequestHandler(rs *service.RequestService) *RequestHandler

func (*RequestHandler) Approve

func (h *RequestHandler) Approve(w http.ResponseWriter, r *http.Request)

func (*RequestHandler) Cancel

func (h *RequestHandler) Cancel(w http.ResponseWriter, r *http.Request)

func (*RequestHandler) Create

func (h *RequestHandler) Create(w http.ResponseWriter, r *http.Request)

func (*RequestHandler) Get

func (*RequestHandler) List

func (*RequestHandler) Reject

func (h *RequestHandler) Reject(w http.ResponseWriter, r *http.Request)

type SSEHandler

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

SSEHandler serves Server-Sent Events for real-time request status updates.

func NewSSEHandler

func NewSSEHandler(hub *sse.Hub, rs *service.RequestService) *SSEHandler

NewSSEHandler creates a new SSE handler.

func (*SSEHandler) Events

func (h *SSEHandler) Events(w http.ResponseWriter, r *http.Request)

Events streams SSE notifications for a single request. The client receives an "updated" event whenever the request's state changes (approval, rejection, stage advance, cancellation, expiry). The payload is minimal — the widget re-fetches the full state via the REST API on each event.

type Server

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

func New

func New(cfg Config) *Server

func (*Server) Handler

func (s *Server) Handler() http.Handler

type WebhookHandler

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

func NewWebhookHandler

func NewWebhookHandler(ws *service.WebhookService) *WebhookHandler

func (*WebhookHandler) Create

func (h *WebhookHandler) Create(w http.ResponseWriter, r *http.Request)

func (*WebhookHandler) Delete

func (h *WebhookHandler) Delete(w http.ResponseWriter, r *http.Request)

func (*WebhookHandler) List

Jump to

Keyboard shortcuts

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