admin

package
v0.21.1 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2026 License: MIT Imports: 83 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActivityActorTypeKey       = "actor_type"
	ActivityActorTypeKeyLegacy = "actorType"
	ActivityActorTypeSystem    = "system"
	ActivityActorTypeJob       = "job"
	ActivityActorTypeTask      = "task"
)
View Source
const (
	DebugPanelTemplate = "template"
	DebugPanelSession  = "session"
	DebugPanelRequests = "requests"
	DebugPanelSQL      = "sql"
	DebugPanelLogs     = "logs"
	DebugPanelConfig   = "config"
	DebugPanelRoutes   = "routes"
	DebugPanelCustom   = "custom"
	DebugPanelShell    = "shell"
	DebugPanelConsole  = "console"
)
View Source
const (
	DebugREPLKindShell = "shell"
	DebugREPLKindApp   = "app"
)
View Source
const (
	DebugREPLOverrideKeyMetadata   = "override_key"
	DebugREPLOverrideTokenMetadata = "override_token"
)
View Source
const (
	MenuItemTypeItem      = navinternal.MenuItemTypeItem
	MenuItemTypeGroup     = navinternal.MenuItemTypeGroup
	MenuItemTypeSeparator = navinternal.MenuItemTypeSeparator
)
View Source
const NotificationMarkCommandName = "notifications.mark"

NotificationMarkCommandName is the registered command for marking notifications read/unread.

Variables

View Source
var (
	ErrForbidden = errors.New("forbidden")
	ErrNotFound  = errors.New("not found")
)

Standard errors to allow HTTP helpers to map to status codes.

View Source
var ErrFeatureDisabled = errors.New("feature disabled")

ErrFeatureDisabled signals a disabled feature gate.

View Source
var ErrInvalidDependencies = errors.New("invalid dependencies")

InvalidDependenciesError aggregates one or more dependency validation failures.

View Source
var ErrInvalidFeatureConfig = errors.New("invalid feature configuration")

ErrInvalidFeatureConfig signals invalid or conflicting feature selections.

View Source
var ErrMenuSlugConflict = errors.New("menu slug already exists")

ErrMenuSlugConflict signals an attempt to create a menu with a duplicate slug.

View Source
var ErrPathConflict = errors.New("path conflict")

ErrPathConflict signals a page path/slug collision.

View Source
var ErrPreferencesStoreRequired = ferrors.ErrPreferencesStoreRequired

ErrPreferencesStoreRequired indicates a missing preferences store.

View Source
var ErrREPLSessionLimit = errors.New("repl session limit reached")

Functions

func BoolPtr added in v0.16.0

func BoolPtr(value bool) *bool

BoolPtr returns a pointer to the provided boolean.

func CaptureViewContext added in v0.14.0

func CaptureViewContext(collector *DebugCollector, viewCtx router.ViewContext) router.ViewContext

CaptureViewContext stores template data in the debug collector and returns the view context. When the debug collector has ToolbarMode enabled, it also injects toolbar template variables: - debug_toolbar_enabled: true when toolbar should be shown - debug_path: the debug module base path - debug_toolbar_panels: comma-separated list of panels for the toolbar - debug_slow_threshold_ms: slow query threshold in milliseconds

func CaptureViewContextForRequest added in v0.16.0

func CaptureViewContextForRequest(collector *DebugCollector, c router.Context, viewCtx router.ViewContext) router.ViewContext

CaptureViewContextForRequest is like CaptureViewContext but honors ToolbarExcludePaths.

func DebugRequestMiddleware added in v0.14.0

func DebugRequestMiddleware(collector *DebugCollector) router.MiddlewareFunc

DebugRequestMiddleware captures request metadata for the debug collector.

func EnsureMenuParents

func EnsureMenuParents(ctx context.Context, opts EnsureMenuParentsOptions) error

EnsureMenuParents upserts parent/group/collapsible nodes with deterministic IDs before children are added. It tolerates existing menus/items (idempotent) and maps IDs/parents to UUIDs for adapter compatibility.

func EnsureMenuUUID

func EnsureMenuUUID(raw string) string

EnsureMenuUUID maps an arbitrary string to a UUID string, preserving valid UUID inputs.

func MenuUUIDFromSlug(slug string) string

MenuUUIDFromSlug derives a deterministic UUID string from a menu slug/name.

func NormalizeMenuSlug

func NormalizeMenuSlug(raw string) string

NormalizeMenuSlug converts an arbitrary name/code into a normalized slug. It lowercases, trims whitespace, and replaces non slug characters with '-'.

func RegisterCommand added in v0.12.0

func RegisterCommand[T any](bus *CommandBus, cmd command.Commander[T], runnerOpts ...runner.Option) (dispatcher.Subscription, error)

RegisterCommand wires a command handler into the go-command registry and dispatcher.

func RegisterCoreCommandFactories added in v0.12.0

func RegisterCoreCommandFactories(bus *CommandBus) error

RegisterCoreCommandFactories installs factories for built-in commands.

func RegisterDashboardProviderFactory added in v0.12.0

func RegisterDashboardProviderFactory(bus *CommandBus, commandName, code string, defaultConfig map[string]any) error

RegisterDashboardProviderFactory registers a factory for a dashboard provider command name.

func RegisterMessageFactory added in v0.12.0

func RegisterMessageFactory[T any](bus *CommandBus, name string, build func(payload map[string]any, ids []string) (T, error)) error

RegisterMessageFactory registers both a factory and a typed dispatcher for name-based routing.

func RegisterQuery added in v0.12.0

func RegisterQuery[T any, R any](bus *CommandBus, qry command.Querier[T, R], runnerOpts ...runner.Option) (dispatcher.Subscription, error)

RegisterQuery wires a query handler into the go-command registry and dispatcher.

func WithActivityRetention

func WithActivityRetention(limit int) func(*ActivityFeed)

WithActivityRetention caps the number of stored entries (0 = unlimited).

func WithThemeSelection

func WithThemeSelection(ctx context.Context, selector ThemeSelector) context.Context

WithThemeSelection stores a theme selector on the context for downstream resolution.

Types

type Action

type Action struct {
	Name        string
	CommandName string
	Permission  string
}

Action describes an action or bulk action linked to a command handler.

type ActivityEntry

type ActivityEntry struct {
	ID        string         `json:"id"`
	Actor     string         `json:"actor,omitempty"`
	Action    string         `json:"action,omitempty"`
	Object    string         `json:"object,omitempty"`
	Channel   string         `json:"channel,omitempty"`
	Metadata  map[string]any `json:"metadata,omitempty"`
	CreatedAt time.Time      `json:"created_at"`
}

ActivityEntry represents an activity feed entry.

type ActivityFeed

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

ActivityFeed stores activities in memory.

func NewActivityFeed

func NewActivityFeed(opts ...func(*ActivityFeed)) *ActivityFeed

NewActivityFeed constructs a feed.

func (*ActivityFeed) List

func (f *ActivityFeed) List(ctx context.Context, limit int, filters ...ActivityFilter) ([]ActivityEntry, error)

List returns the most recent entries.

func (*ActivityFeed) ListRecords

func (f *ActivityFeed) ListRecords(ctx context.Context, limit int, filters ...ActivityFilter) ([]ActivityRecord, error)

ListRecords returns ActivityRecords for adapter use.

func (*ActivityFeed) Log

func (f *ActivityFeed) Log(ctx context.Context, record ActivityRecord) error

Log implements a go-users-compatible logger.

func (*ActivityFeed) Record

func (f *ActivityFeed) Record(ctx context.Context, entry ActivityEntry) error

Record appends an activity entry.

type ActivityFeedQuerier added in v0.14.0

type ActivityFeedQuerier interface {
	Query(context.Context, types.ActivityFilter) (types.ActivityPage, error)
}

ActivityFeedQuerier represents the go-users activity feed query contract.

type ActivityFilter

type ActivityFilter struct {
	Actor   string
	Action  string
	Object  string
	Channel string
}

ActivityFilter narrows feed listings.

type ActivityLogger

type ActivityLogger interface {
	Log(context.Context, ActivityRecord) error
}

ActivityLogger matches the go-users ActivitySink shape (`Log` + ActivityRecord).

type ActivityModule added in v0.14.0

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

ActivityModule registers the activity log navigation and user detail tab.

func NewActivityModule added in v0.14.0

func NewActivityModule() *ActivityModule

NewActivityModule constructs the default activity module.

func (*ActivityModule) Manifest added in v0.14.0

func (m *ActivityModule) Manifest() ModuleManifest

Manifest describes the module metadata.

func (*ActivityModule) MenuItems added in v0.14.0

func (m *ActivityModule) MenuItems(locale string) []MenuItem

MenuItems contributes navigation for the activity module.

func (*ActivityModule) Register added in v0.14.0

func (m *ActivityModule) Register(ctx ModuleContext) error

Register wires the activity module metadata and user tab integration.

func (*ActivityModule) WithMenuParent added in v0.14.0

func (m *ActivityModule) WithMenuParent(parent string) *ActivityModule

WithMenuParent nests the activity navigation under a parent menu item ID.

type ActivityRecord

type ActivityRecord struct {
	ID         string         `json:"id"`
	UserID     string         `json:"user_id,omitempty"`
	ActorID    string         `json:"actor_id,omitempty"`
	Verb       string         `json:"verb,omitempty"`
	ObjectType string         `json:"object_type,omitempty"`
	ObjectID   string         `json:"object_id,omitempty"`
	Channel    string         `json:"channel,omitempty"`
	IP         string         `json:"ip,omitempty"`
	TenantID   string         `json:"tenant_id,omitempty"`
	OrgID      string         `json:"org_id,omitempty"`
	Data       map[string]any `json:"data,omitempty"`
	OccurredAt time.Time      `json:"occurred_at"`
}

ActivityRecord mirrors the go-users activity record contract for compatibility.

type ActivityRecordLister

type ActivityRecordLister interface {
	ListRecords(context.Context, int, ...ActivityFilter) ([]ActivityRecord, error)
}

ActivityRecordLister exposes listing ActivityRecords (for adapters backed by go-users).

type ActivitySink

type ActivitySink interface {
	Record(ctx context.Context, entry ActivityEntry) error
	List(ctx context.Context, limit int, filters ...ActivityFilter) ([]ActivityEntry, error)
}

ActivitySink records activity entries.

type ActivitySinkAdapter

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

ActivitySinkAdapter bridges a go-users style logger into the ActivitySink contract.

func NewActivitySinkAdapter

func NewActivitySinkAdapter(logger ActivityLogger, lister ActivityRecordLister) *ActivitySinkAdapter

NewActivitySinkAdapter builds an adapter that logs via the provided logger and, when possible, lists via lister; a fallback in-memory buffer preserves UI feeds.

func (*ActivitySinkAdapter) List

func (a *ActivitySinkAdapter) List(ctx context.Context, limit int, filters ...ActivityFilter) ([]ActivityEntry, error)

List returns entries from the lister when present, otherwise from the fallback buffer.

func (*ActivitySinkAdapter) Record

func (a *ActivitySinkAdapter) Record(ctx context.Context, entry ActivityEntry) error

Record converts ActivityEntry to ActivityRecord before delegating to the logger.

type Admin

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

Admin orchestrates CMS-backed admin features and adapters.

func New

func New(cfg Config, deps Dependencies) (*Admin, error)

New constructs an Admin orchestrator with explicit dependencies.

func (*Admin) ActivityFeed

func (a *Admin) ActivityFeed() ActivitySink

ActivityFeed returns the activity sink.

func (*Admin) ActivityWidget

func (a *Admin) ActivityWidget() error

ActivityWidget registers the activity widget provider.

func (*Admin) AuthWrapper

func (a *Admin) AuthWrapper() boot.HandlerWrapper

AuthWrapper returns the configured auth wrapper for boot steps.

func (*Admin) BasePath

func (a *Admin) BasePath() string

BasePath exposes the configured base path.

func (*Admin) Boot

func (a *Admin) Boot(steps ...boot.Step) error

Boot runs the admin boot pipeline with the given steps or the defaults.

func (*Admin) BootActivity

func (a *Admin) BootActivity() boot.ActivityBinding

BootActivity exposes the activity binding.

func (*Admin) BootBulk

func (a *Admin) BootBulk() boot.BulkBinding

BootBulk exposes the bulk binding.

func (*Admin) BootDashboard

func (a *Admin) BootDashboard() boot.DashboardBinding

BootDashboard exposes the dashboard binding.

func (*Admin) BootFeatureOverrides added in v0.20.0

func (a *Admin) BootFeatureOverrides() boot.FeatureOverridesBinding

BootFeatureOverrides exposes the feature overrides binding.

func (*Admin) BootJobs

func (a *Admin) BootJobs() boot.JobsBinding

BootJobs exposes the jobs binding.

func (*Admin) BootMedia

func (a *Admin) BootMedia() boot.MediaBinding

BootMedia exposes the media binding.

func (*Admin) BootNavigation

func (a *Admin) BootNavigation() boot.NavigationBinding

BootNavigation exposes the navigation binding.

func (*Admin) BootNotifications

func (a *Admin) BootNotifications() boot.NotificationsBinding

BootNotifications exposes the notifications binding.

func (*Admin) BootSearch

func (a *Admin) BootSearch() boot.SearchBinding

BootSearch exposes the search binding.

func (*Admin) BootSettings

func (a *Admin) BootSettings() boot.SettingsBinding

BootSettings exposes the settings binding.

func (*Admin) Bootstrap

func (a *Admin) Bootstrap(ctx context.Context) error

Bootstrap initializes CMS seed data (CMS container, admin menu, settings defaults).

func (*Admin) BulkService

func (a *Admin) BulkService() BulkService

BulkService exposes the bulk adapter.

func (*Admin) Commands

func (a *Admin) Commands() *CommandBus

Commands exposes the go-command registry hook.

func (*Admin) Dashboard

func (a *Admin) Dashboard() *Dashboard

Dashboard exposes the dashboard orchestration service.

func (*Admin) DashboardService

func (a *Admin) DashboardService() *Dashboard

DashboardService exposes the dashboard orchestration.

func (*Admin) Debug added in v0.14.0

func (a *Admin) Debug() *DebugCollector

Debug exposes the debug collector when the module is enabled.

func (*Admin) DebugQueryHook added in v0.14.0

func (a *Admin) DebugQueryHook() bun.QueryHook

DebugQueryHook returns a Bun query hook for capturing SQL in the debug collector.

func (*Admin) DebugQueryHookOptions added in v0.14.0

func (a *Admin) DebugQueryHookOptions() []repository.Option

DebugQueryHookOptions returns repository options for wiring SQL capture hooks.

func (*Admin) DebugREPLSessionManager added in v0.16.0

func (a *Admin) DebugREPLSessionManager() *DebugREPLSessionManager

DebugREPLSessionManager exposes the REPL session lifecycle manager.

func (*Admin) DebugREPLSessions added in v0.16.0

func (a *Admin) DebugREPLSessions() DebugREPLSessionStore

DebugREPLSessions exposes the REPL session store.

func (*Admin) DefaultLocale

func (a *Admin) DefaultLocale() string

DefaultLocale exposes the configured default locale.

func (*Admin) EnforceDashboardAreas

func (a *Admin) EnforceDashboardAreas(enable bool)

EnforceDashboardAreas toggles validation for unknown widget areas.

func (*Admin) ExportHTTPRegistrar

func (a *Admin) ExportHTTPRegistrar() ExportHTTPRegistrar

ExportHTTPRegistrar exposes the export HTTP registrar.

func (*Admin) ExportMetadataProvider

func (a *Admin) ExportMetadataProvider() ExportMetadataProvider

ExportMetadataProvider exposes export metadata resolution.

func (*Admin) ExportRegistrar

func (a *Admin) ExportRegistrar() boot.ExportRegistrar

ExportRegistrar exposes the export HTTP registrar.

func (*Admin) ExportRegistry

func (a *Admin) ExportRegistry() ExportRegistry

ExportRegistry exposes the export definition registry.

func (*Admin) FeatureGate added in v0.20.0

func (a *Admin) FeatureGate() fggate.FeatureGate

FeatureGate exposes the configured feature gate.

func (*Admin) Gates

func (a *Admin) Gates() boot.FeatureGates

Gates exposes feature gates.

func (*Admin) Initialize

func (a *Admin) Initialize(r AdminRouter) error

Initialize attaches the router, bootstraps, and mounts base routes.

func (*Admin) Jobs

func (a *Admin) Jobs() *JobRegistry

Jobs exposes the job registry.

func (*Admin) MediaLibrary

func (a *Admin) MediaLibrary() MediaLibrary

MediaLibrary exposes the media library adapter.

func (*Admin) Menu

func (a *Admin) Menu() *Navigation

Menu exposes the navigation resolver and fallback menu builder.

func (*Admin) MenuService

func (a *Admin) MenuService() CMSMenuService

MenuService exposes the configured CMS menu service for host seeding.

func (*Admin) NavMenuCode

func (a *Admin) NavMenuCode() string

NavMenuCode returns the default navigation menu code.

func (*Admin) Navigation

func (a *Admin) Navigation() *Navigation

Navigation returns the navigation resolver (alias for Menu).

func (*Admin) NotificationService

func (a *Admin) NotificationService() NotificationService

NotificationService returns the inbox service.

func (*Admin) NotificationsWidget

func (a *Admin) NotificationsWidget() error

NotificationsWidget registers the notifications widget provider.

func (*Admin) OrganizationService

func (a *Admin) OrganizationService() *OrganizationService

OrganizationService exposes the organization management service.

func (*Admin) Panel

func (a *Admin) Panel(_ string) *PanelBuilder

Panel returns a panel builder pre-wired with the command registry. The caller configures fields/actions/hooks and registers the panel via RegisterPanel.

func (*Admin) Panels

func (a *Admin) Panels() []boot.PanelBinding

Panels exposes panel bindings.

func (*Admin) ParseBody

func (a *Admin) ParseBody(c router.Context) (map[string]any, error)

ParseBody parses JSON into a map.

func (*Admin) PreferencesService

func (a *Admin) PreferencesService() *PreferencesService

PreferencesService exposes the user preferences service.

func (*Admin) Prepare

func (a *Admin) Prepare(ctx context.Context) error

Prepare runs the pre-route initialization pipeline (bootstrap, module loading).

func (*Admin) ProfileService

func (a *Admin) ProfileService() *ProfileService

ProfileService exposes the user profile service.

func (*Admin) PublicRouter added in v0.14.0

func (a *Admin) PublicRouter() AdminRouter

PublicRouter exposes the configured admin router for module route registration.

func (*Admin) RegisterCMSDemoPanels

func (a *Admin) RegisterCMSDemoPanels() error

RegisterCMSDemoPanels seeds CMS-backed panels (content/pages/blocks/widgets/menus) using the configured CMS services. It provides tree/blocks/SEO metadata needed for the CMS management UI and demo block editor routes.

func (*Admin) RegisterDashboardProviders

func (a *Admin) RegisterDashboardProviders() error

RegisterDashboardProviders registers built-in dashboard providers.

func (*Admin) RegisterModule

func (a *Admin) RegisterModule(module Module) error

RegisterModule registers a pluggable module before initialization. Duplicate IDs are rejected to preserve ordering and idempotency.

func (*Admin) RegisterPanel

func (a *Admin) RegisterPanel(name string, builder *PanelBuilder) (*Panel, error)

RegisterPanel registers a built panel with the admin.

func (*Admin) RegisterPanelTab added in v0.2.0

func (a *Admin) RegisterPanelTab(panelName string, tab PanelTab) error

RegisterPanelTab attaches a tab to an existing or future panel.

func (*Admin) RegisterWidgetArea

func (a *Admin) RegisterWidgetArea(def WidgetAreaDefinition)

RegisterWidgetArea registers an additional dashboard widget area.

func (*Admin) RegisterWidgetAreas

func (a *Admin) RegisterWidgetAreas() error

RegisterWidgetAreas registers default dashboard widget areas.

func (*Admin) RegisterWidgetDefinitions

func (a *Admin) RegisterWidgetDefinitions() error

RegisterWidgetDefinitions registers default widget definitions.

func (*Admin) Registry

func (a *Admin) Registry() *Registry

Registry exposes the central registry for panels/modules/widgets/settings.

func (*Admin) Responder

func (a *Admin) Responder() boot.Responder

Responder exposes response helpers.

func (*Admin) Router

func (a *Admin) Router() boot.Router

Router exposes the configured router for boot steps.

func (*Admin) SearchService

func (a *Admin) SearchService() *SearchEngine

SearchService exposes the search engine.

func (*Admin) SettingsService

func (a *Admin) SettingsService() *SettingsService

SettingsService exposes the settings resolver.

func (*Admin) SettingsWidget

func (a *Admin) SettingsWidget() error

SettingsWidget registers the settings widget provider.

func (*Admin) TenantService

func (a *Admin) TenantService() *TenantService

TenantService exposes the tenant management service.

func (*Admin) Theme

func (a *Admin) Theme(ctx context.Context) *ThemeSelection

func (*Admin) ThemePayload

func (a *Admin) ThemePayload(ctx context.Context) map[string]map[string]string

func (*Admin) URLs added in v0.21.0

func (a *Admin) URLs() urlkit.Resolver

URLs exposes the URL manager.

func (*Admin) UseCMS

func (a *Admin) UseCMS(container CMSContainer) *Admin

UseCMS overrides the default CMS container (menu/widget services). Call before Initialize to wire a real go-cms container.

func (*Admin) UserService

func (a *Admin) UserService() *UserManagementService

UserService exposes the user and role management service.

func (*Admin) WidgetAreas

func (a *Admin) WidgetAreas() []WidgetAreaDefinition

WidgetAreas returns known dashboard widget areas.

func (*Admin) WithActivitySink

func (a *Admin) WithActivitySink(sink ActivitySink) *Admin

WithActivitySink injects a shared activity sink (go-users compatible via adapter).

func (*Admin) WithAuth

func (a *Admin) WithAuth(auth Authenticator, cfg *AuthConfig) *Admin

WithAuth attaches an authenticator for route protection.

func (*Admin) WithAuthorizer

func (a *Admin) WithAuthorizer(authz Authorizer) *Admin

WithAuthorizer sets an authorizer for panel permissions.

func (*Admin) WithGoTheme

func (a *Admin) WithGoTheme(selector gotheme.ThemeSelector) *Admin

WithGoTheme wires a go-theme selector so CMS templates, dashboard widgets, and forms share the same selection.

func (*Admin) WithOrganizationManagement

func (a *Admin) WithOrganizationManagement(repo OrganizationRepository) *Admin

WithOrganizationManagement overrides the organization repository.

func (*Admin) WithPanelTabCollisionHandler added in v0.2.0

func (a *Admin) WithPanelTabCollisionHandler(fn PanelTabCollisionHandler) *Admin

WithPanelTabCollisionHandler sets a collision handler for tab registrations.

func (*Admin) WithPanelTabPermissionEvaluator added in v0.2.0

func (a *Admin) WithPanelTabPermissionEvaluator(fn PanelTabPermissionEvaluator) *Admin

WithPanelTabPermissionEvaluator sets a custom permission evaluator for tabs.

func (*Admin) WithRoleAssignmentLookup added in v0.2.0

func (a *Admin) WithRoleAssignmentLookup(lookup RoleAssignmentLookup) *Admin

WithRoleAssignmentLookup sets the lookup used to validate custom role assignments.

func (*Admin) WithTenantManagement

func (a *Admin) WithTenantManagement(repo TenantRepository) *Admin

WithTenantManagement overrides the tenant repository (go-users adapters or custom stores).

func (*Admin) WithThemeProvider

func (a *Admin) WithThemeProvider(provider ThemeProvider) *Admin

WithThemeProvider wires a theme selector/registry to downstream renderers.

func (*Admin) WithTranslator

func (a *Admin) WithTranslator(t Translator) *Admin

WithTranslator wires an i18n translator for modules and UI surfaces.

func (*Admin) WithUserManagement

func (a *Admin) WithUserManagement(users UserRepository, roles RoleRepository) *Admin

WithUserManagement overrides the user and role repositories (go-users adapters or custom stores).

type AdminContext

type AdminContext struct {
	Context  context.Context
	UserID   string
	TenantID string
	OrgID    string
	Locale   string
	Theme    *ThemeSelection
}

AdminContext carries request-scoped information into panel operations.

type AdminRouter

type AdminRouter interface {
	Get(path string, handler router.HandlerFunc, mw ...router.MiddlewareFunc) router.RouteInfo
	Post(path string, handler router.HandlerFunc, mw ...router.MiddlewareFunc) router.RouteInfo
	Put(path string, handler router.HandlerFunc, mw ...router.MiddlewareFunc) router.RouteInfo
	Delete(path string, handler router.HandlerFunc, mw ...router.MiddlewareFunc) router.RouteInfo
}

AdminRouter is the minimal subset of go-router Router needed by admin.

type AuthConfig

type AuthConfig struct {
	LoginPath    string
	LogoutPath   string
	RedirectPath string
}

AuthConfig captures login/logout endpoints and redirect defaults.

type Authenticator

type Authenticator interface {
	Wrap(ctx router.Context) error
}

Authenticator wraps HTTP handlers with auth checks.

type Authorizer

type Authorizer interface {
	Can(ctx context.Context, action string, resource string) bool
}

Authorizer determines whether a subject can perform an action on a resource.

type BulkCommand

type BulkCommand struct {
	Service BulkService
}

BulkCommand triggers a bulk job via the command bus.

func (*BulkCommand) CLIHandler added in v0.12.0

func (c *BulkCommand) CLIHandler() any

func (*BulkCommand) CLIOptions

func (c *BulkCommand) CLIOptions() command.CLIConfig

func (*BulkCommand) Execute

func (c *BulkCommand) Execute(ctx context.Context, msg BulkStartMsg) error

type BulkConfig

type BulkConfig struct {
	Endpoint         string `json:"endpoint"`
	SupportsRollback bool   `json:"supports_rollback,omitempty"`
}

BulkConfig captures bulk endpoint metadata and capabilities.

type BulkJob

type BulkJob struct {
	ID                string    `json:"id"`
	Name              string    `json:"name"`
	Action            string    `json:"action,omitempty"`
	Status            string    `json:"status"`
	Total             int       `json:"total"`
	Processed         int       `json:"processed"`
	Progress          float64   `json:"progress,omitempty"`
	Errors            []string  `json:"errors,omitempty"`
	StartedAt         time.Time `json:"started_at,omitempty"`
	CompletedAt       time.Time `json:"completed_at,omitempty"`
	RollbackAvailable bool      `json:"rollback_available,omitempty"`
}

BulkJob captures bulk job state for UI/progress.

type BulkRequest

type BulkRequest struct {
	Name   string
	Action string
	Total  int
}

BulkRequest describes a requested bulk job.

type BulkRollbacker

type BulkRollbacker interface {
	Rollback(ctx context.Context, id string) (BulkJob, error)
}

BulkRollbacker optionally supports rollback operations.

type BulkService

type BulkService interface {
	Start(ctx context.Context, req BulkRequest) (BulkJob, error)
	List(ctx context.Context) []BulkJob
}

BulkService manages bulk jobs.

type BulkStartMsg added in v0.12.0

type BulkStartMsg struct {
	Name    string
	Action  string
	Total   int
	Payload map[string]any
}

BulkStartMsg triggers a bulk job.

func (BulkStartMsg) Type added in v0.12.0

func (BulkStartMsg) Type() string

func (BulkStartMsg) Validate added in v0.12.0

func (m BulkStartMsg) Validate() error

type BunRecordMapper

type BunRecordMapper[T any] struct {
	ToRecord func(map[string]any) (T, error)
	ToMap    func(T) (map[string]any, error)
}

BunRecordMapper converts between map payloads and repository models.

type BunRepositoryAdapter

type BunRepositoryAdapter[T any] struct {
	// contains filtered or unexported fields
}

BunRepositoryAdapter wraps a go-repository-bun Repository to satisfy the admin Repository interface.

func NewBunRepositoryAdapter

func NewBunRepositoryAdapter[T any](repo repository.Repository[T], opts ...BunRepositoryOption[T]) *BunRepositoryAdapter[T]

NewBunRepositoryAdapter constructs an adapter around a go-repository-bun Repository.

func (*BunRepositoryAdapter[T]) Create

func (a *BunRepositoryAdapter[T]) Create(ctx context.Context, record map[string]any) (map[string]any, error)

Create inserts a new record.

func (*BunRepositoryAdapter[T]) Delete

func (a *BunRepositoryAdapter[T]) Delete(ctx context.Context, id string) error

Delete removes a record by id.

func (*BunRepositoryAdapter[T]) Get

func (a *BunRepositoryAdapter[T]) Get(ctx context.Context, id string) (map[string]any, error)

Get retrieves a single record by id.

func (*BunRepositoryAdapter[T]) List

func (a *BunRepositoryAdapter[T]) List(ctx context.Context, opts ListOptions) ([]map[string]any, int, error)

List delegates to the underlying repository with translated pagination/sort/filter/search.

func (*BunRepositoryAdapter[T]) Update

func (a *BunRepositoryAdapter[T]) Update(ctx context.Context, id string, record map[string]any) (map[string]any, error)

Update modifies an existing record by id.

type BunRepositoryOption

type BunRepositoryOption[T any] func(*BunRepositoryAdapter[T])

BunRepositoryOption configures the BunRepositoryAdapter.

func WithBunBaseCriteria

func WithBunBaseCriteria[T any](criteria ...repository.SelectCriteria) BunRepositoryOption[T]

WithBunBaseCriteria applies select criteria to every list/get call.

func WithBunDeleteCriteria

func WithBunDeleteCriteria[T any](criteria ...repository.DeleteCriteria) BunRepositoryOption[T]

WithBunDeleteCriteria applies delete criteria to every delete call.

func WithBunFilterMapping

func WithBunFilterMapping[T any](builders map[string]func(any) repository.SelectCriteria) BunRepositoryOption[T]

WithBunFilterMapping configures per-field filter builders (fallback is equality).

func WithBunRecordMapper

func WithBunRecordMapper[T any](mapper BunRecordMapper[T]) BunRepositoryOption[T]

WithBunRecordMapper overrides the default JSON-based mapper.

func WithBunSearchColumns

func WithBunSearchColumns[T any](columns ...string) BunRepositoryOption[T]

WithBunSearchColumns configures case-insensitive LIKE queries for the provided columns.

func WithBunUpdateCriteria

func WithBunUpdateCriteria[T any](criteria ...repository.UpdateCriteria) BunRepositoryOption[T]

WithBunUpdateCriteria applies update criteria to every update call.

type BunSettingsAdapter

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

BunSettingsAdapter persists settings using go-repository-bun and resolves values through go-options to preserve provenance and validation surface.

func NewBunSettingsAdapter

func NewBunSettingsAdapter(db *bun.DB, repoOptions ...repository.Option) (*BunSettingsAdapter, error)

func (*BunSettingsAdapter) Apply

func (a *BunSettingsAdapter) Apply(ctx context.Context, bundle SettingsBundle) error

Apply validates and persists scoped settings.

func (*BunSettingsAdapter) Definitions

func (a *BunSettingsAdapter) Definitions() []SettingDefinition

Definitions returns sorted definitions.

func (*BunSettingsAdapter) RegisterDefinition

func (a *BunSettingsAdapter) RegisterDefinition(def SettingDefinition)

RegisterDefinition records a setting definition.

func (*BunSettingsAdapter) Resolve

func (a *BunSettingsAdapter) Resolve(key, userID string) ResolvedSetting

Resolve returns a setting value with provenance.

func (*BunSettingsAdapter) ResolveAll

func (a *BunSettingsAdapter) ResolveAll(userID string) map[string]ResolvedSetting

ResolveAll resolves every definition for the given user.

func (*BunSettingsAdapter) Schema

func (a *BunSettingsAdapter) Schema(ctx context.Context, userID string) (opts.SchemaDocument, error)

Schema returns the go-options schema document for UI renderers.

func (*BunSettingsAdapter) WithSchemaOptions

func (a *BunSettingsAdapter) WithSchemaOptions(options ...opts.Option)

WithSchemaOptions appends schema merge options used during resolution.

type CLIConfig added in v0.12.0

type CLIConfig = command.CLIConfig

type CLIGroup added in v0.12.0

type CLIGroup = command.CLIGroup

type CMSBlock

type CMSBlock = cmsboot.CMSBlock

CMSBlock represents a block instance attached to content/pages.

type CMSBlockDefinition

type CMSBlockDefinition = cmsboot.CMSBlockDefinition

CMSBlockDefinition describes a reusable block schema.

type CMSBlockDefinitionRepository

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

CMSBlockDefinitionRepository manages block definitions through CMSContentService.

func NewCMSBlockDefinitionRepository

func NewCMSBlockDefinitionRepository(content CMSContentService) *CMSBlockDefinitionRepository

NewCMSBlockDefinitionRepository builds a block definition repository.

func (*CMSBlockDefinitionRepository) Create

func (r *CMSBlockDefinitionRepository) Create(ctx context.Context, record map[string]any) (map[string]any, error)

Create adds a block definition.

func (*CMSBlockDefinitionRepository) Delete

Delete removes a block definition.

func (*CMSBlockDefinitionRepository) Get

Get returns a single block definition.

func (*CMSBlockDefinitionRepository) List

List returns block definitions.

func (*CMSBlockDefinitionRepository) Update

func (r *CMSBlockDefinitionRepository) Update(ctx context.Context, id string, record map[string]any) (map[string]any, error)

Update modifies a block definition.

type CMSBlockRepository

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

CMSBlockRepository manages blocks assigned to content/pages.

func NewCMSBlockRepository

func NewCMSBlockRepository(content CMSContentService) *CMSBlockRepository

NewCMSBlockRepository builds a block repository.

func (*CMSBlockRepository) Create

func (r *CMSBlockRepository) Create(ctx context.Context, record map[string]any) (map[string]any, error)

Create saves a new block.

func (*CMSBlockRepository) Delete

func (r *CMSBlockRepository) Delete(ctx context.Context, id string) error

Delete removes a block.

func (*CMSBlockRepository) Get

func (r *CMSBlockRepository) Get(ctx context.Context, id string) (map[string]any, error)

Get returns a block by id.

func (*CMSBlockRepository) List

func (r *CMSBlockRepository) List(ctx context.Context, opts ListOptions) ([]map[string]any, int, error)

List returns blocks for a content ID (or all when unspecified).

func (*CMSBlockRepository) Update

func (r *CMSBlockRepository) Update(ctx context.Context, id string, record map[string]any) (map[string]any, error)

Update modifies an existing block.

type CMSContainer

type CMSContainer = cmsboot.CMSContainer

CMSContainer abstracts CMS services used by admin.

func BuildGoCMSContainer

func BuildGoCMSContainer(ctx context.Context, cfg Config) (CMSContainer, error)

BuildGoCMSContainer constructs a CMSContainer from go-cms configuration or module values.

type CMSContainerBuilder

type CMSContainerBuilder func(ctx context.Context, cfg Config) (CMSContainer, error)

CMSContainerBuilder constructs a CMSContainer from admin configuration.

type CMSContent

type CMSContent = cmsboot.CMSContent

CMSContent represents structured content managed by the CMS.

type CMSContentRepository

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

CMSContentRepository adapts CMSContentService for structured content entities.

func NewCMSContentRepository

func NewCMSContentRepository(content CMSContentService) *CMSContentRepository

NewCMSContentRepository builds a content repository.

func (*CMSContentRepository) Create

func (r *CMSContentRepository) Create(ctx context.Context, record map[string]any) (map[string]any, error)

Create inserts new content.

func (*CMSContentRepository) Delete

func (r *CMSContentRepository) Delete(ctx context.Context, id string) error

Delete removes a content item.

func (*CMSContentRepository) Get

func (r *CMSContentRepository) Get(ctx context.Context, id string) (map[string]any, error)

Get retrieves content by id.

func (*CMSContentRepository) List

func (r *CMSContentRepository) List(ctx context.Context, opts ListOptions) ([]map[string]any, int, error)

List returns content filtered by locale and search query.

func (*CMSContentRepository) Update

func (r *CMSContentRepository) Update(ctx context.Context, id string, record map[string]any) (map[string]any, error)

Update modifies content.

type CMSContentService

type CMSContentService = cmsboot.CMSContentService

CMSContentService manages pages/blocks backed by the CMS.

type CMSMenuRepository

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

CMSMenuRepository manages menu items for CMS-backed navigation.

func NewCMSMenuRepository

func NewCMSMenuRepository(menu CMSMenuService, defaultCode string) *CMSMenuRepository

NewCMSMenuRepository builds a menu repository with a default menu code.

func (*CMSMenuRepository) Create

func (r *CMSMenuRepository) Create(ctx context.Context, record map[string]any) (map[string]any, error)

Create inserts a menu item.

func (*CMSMenuRepository) Delete

func (r *CMSMenuRepository) Delete(ctx context.Context, id string) error

Delete removes a menu item.

func (*CMSMenuRepository) Get

func (r *CMSMenuRepository) Get(ctx context.Context, id string) (map[string]any, error)

Get returns a single menu item by id.

func (*CMSMenuRepository) List

func (r *CMSMenuRepository) List(ctx context.Context, opts ListOptions) ([]map[string]any, int, error)

List returns menu items for a menu code and locale.

func (*CMSMenuRepository) Update

func (r *CMSMenuRepository) Update(ctx context.Context, id string, record map[string]any) (map[string]any, error)

Update modifies a menu item.

type CMSMenuService

type CMSMenuService = cmsboot.CMSMenuService

CMSMenuService manages CMS-backed menus.

type CMSOptions

type CMSOptions struct {
	Container        CMSContainer
	ContainerBuilder CMSContainerBuilder
	GoCMSConfig      any
}

CMSOptions configures how the CMS container is resolved (in-memory, go-cms, or host-provided).

type CMSPage

type CMSPage = cmsboot.CMSPage

CMSPage represents a page managed by the CMS.

type CMSPageRepository

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

CMSPageRepository adapts a CMSContentService to the admin Repository contract. It supports locale-aware listings, basic search, parent/child metadata for tree views, and slug uniqueness validation for preview links.

func NewCMSPageRepository

func NewCMSPageRepository(content CMSContentService) *CMSPageRepository

NewCMSPageRepository builds a repository backed by a CMSContentService.

func (*CMSPageRepository) Create

func (r *CMSPageRepository) Create(ctx context.Context, record map[string]any) (map[string]any, error)

Create inserts a page with path collision checks.

func (*CMSPageRepository) Delete

func (r *CMSPageRepository) Delete(ctx context.Context, id string) error

Delete removes a page.

func (*CMSPageRepository) Get

func (r *CMSPageRepository) Get(ctx context.Context, id string) (map[string]any, error)

Get returns a page by id.

func (*CMSPageRepository) List

func (r *CMSPageRepository) List(ctx context.Context, opts ListOptions) ([]map[string]any, int, error)

List returns CMS pages filtered by locale and simple search.

func (*CMSPageRepository) Update

func (r *CMSPageRepository) Update(ctx context.Context, id string, record map[string]any) (map[string]any, error)

Update modifies a page while preventing slug/path collisions.

type CMSWidgetService

type CMSWidgetService = cmsboot.CMSWidgetService

CMSWidgetService registers dashboard widget areas/definitions.

type CRUDRepositoryAdapter

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

CRUDRepositoryAdapter wraps a go-crud Service so panels can target Bun-backed repos.

func NewCRUDRepositoryAdapter

func NewCRUDRepositoryAdapter(service crud.Service[map[string]any]) *CRUDRepositoryAdapter

NewCRUDRepositoryAdapter constructs the adapter.

func (*CRUDRepositoryAdapter) Create

func (r *CRUDRepositoryAdapter) Create(ctx context.Context, record map[string]any) (map[string]any, error)

Create inserts a record.

func (*CRUDRepositoryAdapter) Delete

func (r *CRUDRepositoryAdapter) Delete(ctx context.Context, id string) error

Delete removes a record by id.

func (*CRUDRepositoryAdapter) Get

func (r *CRUDRepositoryAdapter) Get(ctx context.Context, id string) (map[string]any, error)

Get retrieves a single record by id.

func (*CRUDRepositoryAdapter) List

func (r *CRUDRepositoryAdapter) List(ctx context.Context, opts ListOptions) ([]map[string]any, int, error)

List delegates to the go-crud service using translated list options.

func (*CRUDRepositoryAdapter) Update

func (r *CRUDRepositoryAdapter) Update(ctx context.Context, id string, record map[string]any) (map[string]any, error)

Update modifies a record.

type CommandBus added in v0.12.0

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

CommandBus registers command/query handlers and dispatches by name.

func NewCommandBus added in v0.12.0

func NewCommandBus(enabled bool) *CommandBus

NewCommandBus constructs a command bus that can be toggled off.

func (*CommandBus) Close added in v0.12.0

func (b *CommandBus) Close()

Close is an alias for Reset.

func (*CommandBus) DispatchByName added in v0.12.0

func (b *CommandBus) DispatchByName(ctx context.Context, name string, payload map[string]any, ids []string) error

DispatchByName routes a named command through the dispatcher.

func (*CommandBus) Enable added in v0.12.0

func (b *CommandBus) Enable(enabled bool)

Enable toggles the command bus on/off.

func (*CommandBus) RegisterFactory added in v0.12.0

func (b *CommandBus) RegisterFactory(name string, factory MessageFactory) error

RegisterFactory stores a message factory for name-based dispatch.

func (*CommandBus) Reset added in v0.12.0

func (b *CommandBus) Reset()

Reset unsubscribes registered handlers and clears factories.

type Config

type Config struct {
	Title            string
	BasePath         string
	URLs             URLConfig
	DefaultLocale    string
	Theme            string
	ThemeVariant     string
	ThemeTokens      map[string]string
	ThemeAssetPrefix string
	CMSConfig        any
	CMS              CMSOptions
	Debug            DebugConfig

	LogoURL    string
	FaviconURL string
	CustomCSS  string
	CustomJS   string

	SettingsPermission                string
	SettingsUpdatePermission          string
	FeatureFlagsViewPermission        string
	FeatureFlagsUpdatePermission      string
	SettingsThemeTokens               map[string]string
	NotificationsPermission           string
	NotificationsUpdatePermission     string
	ActivityPermission                string
	JobsPermission                    string
	JobsTriggerPermission             string
	PreferencesPermission             string
	PreferencesUpdatePermission       string
	PreferencesManageTenantPermission string
	PreferencesManageOrgPermission    string
	PreferencesManageSystemPermission string
	ProfilePermission                 string
	ProfileUpdatePermission           string
	UsersPermission                   string
	UsersCreatePermission             string
	UsersUpdatePermission             string
	UsersDeletePermission             string
	RolesPermission                   string
	RolesCreatePermission             string
	RolesUpdatePermission             string
	RolesDeletePermission             string
	TenantsPermission                 string
	TenantsCreatePermission           string
	TenantsUpdatePermission           string
	TenantsDeletePermission           string
	OrganizationsPermission           string
	OrganizationsCreatePermission     string
	OrganizationsUpdatePermission     string
	OrganizationsDeletePermission     string

	AuthConfig *AuthConfig

	NavMenuCode string

	FeatureFlagKeys []string
}

Config holds core admin settings and feature flags.

type CustomLogEntry added in v0.14.0

type CustomLogEntry struct {
	Timestamp time.Time      `json:"timestamp"`
	Category  string         `json:"category"`
	Message   string         `json:"message"`
	Fields    map[string]any `json:"fields,omitempty"`
}

CustomLogEntry captures custom debug logs.

type Dashboard

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

Dashboard orchestrates widget providers and instances.

func NewDashboard

func NewDashboard() *Dashboard

NewDashboard constructs a dashboard registry with in-memory defaults.

func (*Dashboard) AddDefaultInstance

func (d *Dashboard) AddDefaultInstance(area, defCode string, cfg map[string]any, span int, locale string)

AddDefaultInstance stores a default widget instance (used when no CMS/prefs are present).

func (*Dashboard) Areas

func (d *Dashboard) Areas() []WidgetAreaDefinition

Areas returns known widget areas sorted by code.

func (*Dashboard) EnforceKnownAreas

func (d *Dashboard) EnforceKnownAreas(enable bool)

EnforceKnownAreas toggles validation to prevent default instances from using unknown areas.

func (*Dashboard) HasRenderer

func (d *Dashboard) HasRenderer() bool

HasRenderer returns true if a renderer is configured.

func (*Dashboard) Providers

func (d *Dashboard) Providers() []DashboardProviderSpec

Providers returns registered provider metadata.

func (*Dashboard) RegisterArea

func (d *Dashboard) RegisterArea(def WidgetAreaDefinition)

RegisterArea registers a dashboard widget area for provider/default-instance use.

func (*Dashboard) RegisterManifest

func (d *Dashboard) RegisterManifest(providers []DashboardProviderSpec)

RegisterManifest bulk registers providers (lightweight manifest discovery hook).

func (*Dashboard) RegisterProvider

func (d *Dashboard) RegisterProvider(spec DashboardProviderSpec)

RegisterProvider registers a widget provider and optional default instance.

func (*Dashboard) RenderLayout

func (d *Dashboard) RenderLayout(ctx AdminContext, theme *ThemeSelection, basePath string) (*DashboardLayout, error)

RenderLayout builds a DashboardLayout with resolved widgets grouped by area. This is used for server-side rendering via the configured DashboardRenderer.

func (*Dashboard) Resolve

func (d *Dashboard) Resolve(ctx AdminContext) ([]map[string]any, error)

Resolve returns widgets for a viewer, applying per-user preferences when present.

func (*Dashboard) SetUserLayout

func (d *Dashboard) SetUserLayout(userID string, instances []DashboardWidgetInstance)

SetUserLayout stores per-user layout/preferences.

func (*Dashboard) SetUserLayoutWithContext

func (d *Dashboard) SetUserLayoutWithContext(ctx AdminContext, instances []DashboardWidgetInstance)

SetUserLayoutWithContext stores layouts with actor metadata for activity sinks.

func (*Dashboard) WithActivitySink

func (d *Dashboard) WithActivitySink(sink ActivitySink)

WithActivitySink wires an activity sink for layout or widget changes.

func (*Dashboard) WithAuthorizer

func (d *Dashboard) WithAuthorizer(authz Authorizer)

WithAuthorizer sets the authorizer for role/permission visibility.

func (*Dashboard) WithCommandBus

func (d *Dashboard) WithCommandBus(bus *CommandBus)

WithCommandBus wires the command bus so providers can expose commands.

func (*Dashboard) WithPreferenceService

func (d *Dashboard) WithPreferenceService(service *PreferencesService)

WithPreferenceService wires the PreferencesService used for go-dashboard overrides.

func (*Dashboard) WithPreferences

func (d *Dashboard) WithPreferences(store DashboardPreferences)

WithPreferences sets the preference store used for per-user layouts.

func (*Dashboard) WithRegistry

func (d *Dashboard) WithRegistry(reg *Registry)

WithRegistry wires the shared registry for discovery/use by other transports.

func (*Dashboard) WithRenderer

func (d *Dashboard) WithRenderer(renderer DashboardRenderer)

WithRenderer sets the dashboard renderer for HTML generation. When set, enables server-side rendering of dashboard HTML.

func (*Dashboard) WithWidgetService

func (d *Dashboard) WithWidgetService(svc CMSWidgetService)

WithWidgetService wires a CMS widget service for definitions/instances.

type DashboardHandle

type DashboardHandle = Dashboard

DashboardHandle and MenuHandle are kept for API compatibility and now alias real services.

type DashboardLayout

type DashboardLayout struct {
	// Areas contains all widget areas (main, sidebar, footer, etc.)
	Areas []*WidgetArea `json:"areas"`

	// Theme contains resolved theme configuration with tokens and assets
	Theme *ThemeSelection `json:"theme,omitempty"`

	// Metadata contains additional context for rendering
	Metadata map[string]any `json:"metadata,omitempty"`

	// BasePath is the admin base path for constructing URLs
	BasePath string `json:"base_path"`
}

DashboardLayout represents the complete dashboard state ready for rendering. It contains all areas, widgets, theme configuration, and metadata needed to produce a complete HTML page or fragment.

type DashboardLayoutOverrides

type DashboardLayoutOverrides struct {
	Locale        string                          `json:"locale,omitempty"`
	AreaOrder     map[string][]string             `json:"area_order,omitempty"`
	AreaRows      map[string][]DashboardLayoutRow `json:"area_rows,omitempty"`
	HiddenWidgets map[string]bool                 `json:"hidden_widgets,omitempty"`
}

DashboardLayoutOverrides persists go-dashboard layout adjustments.

type DashboardLayoutRow

type DashboardLayoutRow struct {
	Widgets []DashboardLayoutSlot `json:"widgets,omitempty"`
}

DashboardLayoutRow captures widget slots on a single row.

type DashboardLayoutSlot

type DashboardLayoutSlot struct {
	ID    string `json:"id,omitempty"`
	Width int    `json:"width,omitempty"`
}

DashboardLayoutSlot describes a widget placement and width.

type DashboardPreferences

type DashboardPreferences = dashinternal.DashboardPreferences

DashboardPreferences stores per-user layouts.

func NewDashboardPreferencesAdapter

func NewDashboardPreferencesAdapter(service *PreferencesService) DashboardPreferences

NewDashboardPreferencesAdapter bridges PreferencesService into the DashboardPreferences contract. When the service is nil, it falls back to in-memory preferences.

type DashboardPreferencesWithContext

type DashboardPreferencesWithContext = dashinternal.DashboardPreferencesWithContext

DashboardPreferencesWithContext allows contextual access to preferences (for activity/locale-aware stores).

type DashboardProviderMsg added in v0.12.0

type DashboardProviderMsg struct {
	CommandName string
	Code        string
	Config      map[string]any
}

DashboardProviderMsg routes dashboard provider commands.

func (DashboardProviderMsg) Type added in v0.12.0

func (DashboardProviderMsg) Validate added in v0.12.0

func (m DashboardProviderMsg) Validate() error

type DashboardProviderSpec

type DashboardProviderSpec struct {
	Code           string         `json:"code"`
	Name           string         `json:"name"`
	Schema         map[string]any `json:"schema,omitempty"`
	DefaultArea    string         `json:"default_area,omitempty"`
	DefaultConfig  map[string]any `json:"default_config,omitempty"`
	DefaultSpan    int            `json:"default_span,omitempty"`
	Permission     string         `json:"permission,omitempty"`
	Schedule       string         `json:"schedule,omitempty"`
	Description    string         `json:"description,omitempty"`
	CommandName    string         `json:"command_name,omitempty"`
	VisibilityRole []string       `json:"visibility_role,omitempty"`
	Handler        WidgetProvider `json:"-"`
}

DashboardProviderSpec captures provider metadata and behavior.

type DashboardRenderer

type DashboardRenderer interface {
	// Render matches the go-dashboard Renderer contract and returns the rendered HTML.
	Render(name string, data any, out ...io.Writer) (string, error)
}

DashboardRenderer defines the interface for rendering dashboards as HTML. Implementations can use any template engine or rendering approach.

type DashboardWidgetInstance

type DashboardWidgetInstance = dashinternal.DashboardWidgetInstance

DashboardWidgetInstance represents a widget placed in an area.

type DebugCollector added in v0.14.0

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

DebugCollector aggregates debug data from multiple sources.

func NewDebugCollector added in v0.14.0

func NewDebugCollector(cfg DebugConfig) *DebugCollector

NewDebugCollector initializes a collector with the provided configuration.

func (*DebugCollector) CaptureConfigSnapshot added in v0.14.0

func (c *DebugCollector) CaptureConfigSnapshot(snapshot map[string]any)

CaptureConfigSnapshot stores a config snapshot for the config panel.

func (*DebugCollector) CaptureLog added in v0.14.0

func (c *DebugCollector) CaptureLog(entry LogEntry)

CaptureLog adds a log entry.

func (*DebugCollector) CaptureRequest added in v0.14.0

func (c *DebugCollector) CaptureRequest(entry RequestEntry)

CaptureRequest logs an HTTP request.

func (*DebugCollector) CaptureRoutes added in v0.14.0

func (c *DebugCollector) CaptureRoutes(routes []RouteEntry)

CaptureRoutes stores a routes snapshot for the routes panel.

func (*DebugCollector) CaptureSQL added in v0.14.0

func (c *DebugCollector) CaptureSQL(entry SQLEntry)

CaptureSQL logs a database query.

func (*DebugCollector) CaptureSession added in v0.14.0

func (c *DebugCollector) CaptureSession(session map[string]any)

CaptureSession stores session information.

func (*DebugCollector) CaptureTemplateData added in v0.14.0

func (c *DebugCollector) CaptureTemplateData(viewCtx router.ViewContext)

CaptureTemplateData stores the current template context.

func (*DebugCollector) Clear added in v0.14.0

func (c *DebugCollector) Clear()

Clear removes all stored debug data across panels.

func (*DebugCollector) ClearPanel added in v0.14.0

func (c *DebugCollector) ClearPanel(panelID string) bool

ClearPanel removes stored data for a single panel.

func (*DebugCollector) Get added in v0.14.0

func (c *DebugCollector) Get(key string) (any, bool)

Get retrieves custom debug data.

func (*DebugCollector) Log added in v0.14.0

func (c *DebugCollector) Log(category, message string, fields ...any)

Log adds a custom debug message.

func (*DebugCollector) PanelDefinitions added in v0.17.0

func (c *DebugCollector) PanelDefinitions() []debugregistry.PanelDefinition

PanelDefinitions returns metadata for enabled panels.

func (*DebugCollector) PublishEvent added in v0.17.0

func (c *DebugCollector) PublishEvent(eventType string, payload any)

PublishEvent emits a custom debug event by event type.

func (*DebugCollector) PublishPanel added in v0.16.0

func (c *DebugCollector) PublishPanel(panelID string, payload any)

PublishPanel stores a custom panel snapshot and publishes it to subscribers.

func (*DebugCollector) RegisterPanel added in v0.14.0

func (c *DebugCollector) RegisterPanel(panel DebugPanel)

RegisterPanel adds a custom debug panel.

func (*DebugCollector) Set added in v0.14.0

func (c *DebugCollector) Set(key string, value any)

Set adds custom debug data.

func (*DebugCollector) Snapshot added in v0.14.0

func (c *DebugCollector) Snapshot() map[string]any

Snapshot returns current state of all panels.

func (*DebugCollector) Subscribe added in v0.14.0

func (c *DebugCollector) Subscribe(id string) <-chan DebugEvent

Subscribe creates a WebSocket subscriber channel.

func (*DebugCollector) Unsubscribe added in v0.14.0

func (c *DebugCollector) Unsubscribe(id string)

Unsubscribe removes a WebSocket subscriber.

type DebugConfig added in v0.14.0

type DebugConfig struct {
	Enabled          bool
	CaptureSQL       bool
	CaptureLogs      bool
	StrictQueryHooks bool
	MaxLogEntries    int
	MaxSQLQueries    int
	MaskFieldTypes   map[string]string
	Panels           []string
	FeatureKey       string
	Permission       string
	BasePath         string
	// LayoutMode controls which debug template is rendered for the HTML route.
	LayoutMode DebugLayoutMode
	// PageTemplate is the primary debug template used for HTML rendering.
	PageTemplate string
	// StandaloneTemplate is used when forcing a standalone render via query param.
	StandaloneTemplate string
	// DashboardTemplate overrides the go-dashboard HTML template for debug routes.
	DashboardTemplate string
	// ViewContextBuilder can inject navigation/session data for admin-layout templates.
	ViewContextBuilder DebugViewContextBuilder
	SlowQueryThreshold time.Duration
	AllowedIPs         []string
	PersistLayout      bool
	Repl               DebugREPLConfig
	// ToolbarMode injects a debug toolbar at the bottom of all admin pages.
	// When true, the toolbar is shown in addition to the /admin/debug page.
	ToolbarMode bool
	// ToolbarPanels specifies which panels appear in the toolbar.
	// Defaults to ["requests", "sql", "logs", "routes", "config"] if empty.
	ToolbarPanels []string
	// ToolbarExcludePaths disables the toolbar on matching paths.
	// Use exact paths ("/admin/debug") or prefix wildcards ("/admin/debug/*").
	ToolbarExcludePaths []string
}

DebugConfig controls the debug module behavior and feature flags.

type DebugEvent added in v0.14.0

type DebugEvent struct {
	Type      string    `json:"type"`
	Payload   any       `json:"payload"`
	Timestamp time.Time `json:"timestamp"`
}

DebugEvent is sent to WebSocket subscribers.

type DebugLayoutMode added in v0.16.0

type DebugLayoutMode string

DebugLayoutMode controls how the debug UI is rendered.

const (
	DebugLayoutStandalone DebugLayoutMode = "standalone"
	DebugLayoutAdmin      DebugLayoutMode = "admin"
)

type DebugLogHandler added in v0.14.0

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

DebugLogHandler forwards slog records into the debug collector.

func NewDebugLogHandler added in v0.14.0

func NewDebugLogHandler(collector *DebugCollector, next slog.Handler) *DebugLogHandler

NewDebugLogHandler creates a slog.Handler that forwards to the debug collector and an optional delegate.

func (*DebugLogHandler) Enabled added in v0.14.0

func (h *DebugLogHandler) Enabled(ctx context.Context, level slog.Level) bool

func (*DebugLogHandler) Handle added in v0.14.0

func (h *DebugLogHandler) Handle(ctx context.Context, r slog.Record) error

func (*DebugLogHandler) WithAttrs added in v0.14.0

func (h *DebugLogHandler) WithAttrs(attrs []slog.Attr) slog.Handler

func (*DebugLogHandler) WithGroup added in v0.14.0

func (h *DebugLogHandler) WithGroup(name string) slog.Handler

type DebugModule added in v0.14.0

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

DebugModule registers the debug dashboard integration and menu entry.

func NewDebugModule added in v0.14.0

func NewDebugModule(config DebugConfig) *DebugModule

NewDebugModule constructs a debug module with the provided configuration.

func (*DebugModule) Manifest added in v0.14.0

func (m *DebugModule) Manifest() ModuleManifest

func (*DebugModule) MenuItems added in v0.14.0

func (m *DebugModule) MenuItems(locale string) []MenuItem

func (*DebugModule) Register added in v0.14.0

func (m *DebugModule) Register(ctx ModuleContext) error

type DebugPanel added in v0.14.0

type DebugPanel interface {
	ID() string
	Label() string
	Icon() string
	Collect(ctx context.Context) map[string]any
}

DebugPanel defines a pluggable debug panel.

type DebugQueryHook added in v0.14.0

type DebugQueryHook struct {
	Collector         *DebugCollector
	CollectorProvider func() *DebugCollector
}

DebugQueryHook captures Bun query events and forwards them to the debug collector.

func NewDebugQueryHook added in v0.14.0

func NewDebugQueryHook(collector *DebugCollector) *DebugQueryHook

NewDebugQueryHook builds a query hook bound to a specific collector.

func NewDebugQueryHookProvider added in v0.14.0

func NewDebugQueryHookProvider(provider func() *DebugCollector) *DebugQueryHook

NewDebugQueryHookProvider builds a query hook that resolves the collector at runtime.

func (*DebugQueryHook) AfterQuery added in v0.14.0

func (h *DebugQueryHook) AfterQuery(ctx context.Context, event *bun.QueryEvent)

AfterQuery captures query details after execution.

func (*DebugQueryHook) BeforeQuery added in v0.14.0

func (h *DebugQueryHook) BeforeQuery(ctx context.Context, event *bun.QueryEvent) context.Context

BeforeQuery preserves the context; Bun requires the hook contract.

func (*DebugQueryHook) QueryHookKey added in v0.14.0

func (h *DebugQueryHook) QueryHookKey() string

QueryHookKey provides a stable identity for hook deduplication.

type DebugREPLCommand added in v0.16.0

type DebugREPLCommand struct {
	Command     string   `json:"command"`
	Path        []string `json:"path,omitempty"`
	Description string   `json:"description,omitempty"`
	Tags        []string `json:"tags,omitempty"`
	Aliases     []string `json:"aliases,omitempty"`
	Mutates     bool     `json:"mutates"`
	Permissions []string `json:"-"`
	Roles       []string `json:"-"`
	MessageType string   `json:"-"`
}

DebugREPLCommand describes a CLI command exposed to the REPL UI.

type DebugREPLCommandCatalog added in v0.16.0

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

DebugREPLCommandCatalog collects exposed CLI commands via go-command resolvers.

func NewDebugREPLCommandCatalog added in v0.16.0

func NewDebugREPLCommandCatalog() *DebugREPLCommandCatalog

NewDebugREPLCommandCatalog constructs a catalog and attaches its resolver.

func (*DebugREPLCommandCatalog) List added in v0.16.0

List returns all captured commands sorted by command path.

func (*DebugREPLCommandCatalog) VisibleCommands added in v0.16.0

func (c *DebugREPLCommandCatalog) VisibleCommands(admin *Admin, adminCtx AdminContext, cfg DebugREPLConfig) []DebugREPLCommand

VisibleCommands filters commands for a specific admin context + REPL config.

type DebugREPLConfig added in v0.16.0

type DebugREPLConfig struct {
	Enabled            bool
	ShellEnabled       bool
	AppEnabled         bool
	Permission         string
	ExecPermission     string
	ReadOnly           *bool
	AllowedRoles       []string
	AllowedIPs         []string
	ShellCommand       string
	ShellArgs          []string
	WorkingDir         string
	Environment        []string
	MaxSessionSeconds  int
	AppEvalTimeoutMs   int
	AppAllowedPackages []string
	OverrideStrategy   DebugREPLOverrideStrategy
	MaxSessionsPerUser int
}

DebugREPLConfig controls shell + app console access.

func (DebugREPLConfig) ReadOnlyEnabled added in v0.16.0

func (cfg DebugREPLConfig) ReadOnlyEnabled() bool

type DebugREPLOverrideStrategy added in v0.16.0

type DebugREPLOverrideStrategy interface {
	Allows(ctx context.Context, req DebugREPLRequest) (bool, error)
}

DebugREPLOverrideStrategy decides whether a request can override a disabled REPL.

type DebugREPLRequest added in v0.16.0

type DebugREPLRequest struct {
	UserID      string
	IP          string
	UserAgent   string
	Kind        string
	RequestedAt time.Time
	Metadata    map[string]any
}

DebugREPLRequest captures request metadata for override strategies.

type DebugREPLSession added in v0.16.0

type DebugREPLSession struct {
	ID        string
	UserID    string
	Username  string
	IP        string
	UserAgent string
	Kind      string
	ReadOnly  bool
	StartedAt time.Time
	ExpiresAt time.Time
	ClosedAt  *time.Time
	Metadata  map[string]any
}

DebugREPLSession tracks an active REPL session.

type DebugREPLSessionManager added in v0.16.0

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

DebugREPLSessionManager enforces REPL session lifecycle rules.

func NewDebugREPLSessionManager added in v0.16.0

func NewDebugREPLSessionManager(store DebugREPLSessionStore, cfg DebugREPLConfig) *DebugREPLSessionManager

NewDebugREPLSessionManager constructs a lifecycle manager.

func (*DebugREPLSessionManager) Active added in v0.16.0

Active returns sessions that are still active.

func (*DebugREPLSessionManager) Close added in v0.16.0

func (m *DebugREPLSessionManager) Close(ctx context.Context, id string, closedAt time.Time) error

Close marks a session as closed.

func (*DebugREPLSessionManager) Start added in v0.16.0

Start creates a new session after enforcing limits.

type DebugREPLSessionStore added in v0.16.0

type DebugREPLSessionStore interface {
	Create(ctx context.Context, session DebugREPLSession) error
	Close(ctx context.Context, id string, closedAt time.Time) error
	Get(ctx context.Context, id string) (DebugREPLSession, bool, error)
	ListActive(ctx context.Context) ([]DebugREPLSession, error)
}

DebugREPLSessionStore persists REPL sessions.

type DebugViewContextBuilder added in v0.16.0

type DebugViewContextBuilder func(adm *Admin, cfg DebugConfig, c router.Context, view router.ViewContext) router.ViewContext

DebugViewContextBuilder can augment the view context for debug templates.

type DenyAllStrategy added in v0.16.0

type DenyAllStrategy struct{}

DenyAllStrategy denies all override attempts.

func (DenyAllStrategy) Allows added in v0.16.0

type Dependencies

type Dependencies struct {
	Router AdminRouter

	CMSContainer        CMSContainer
	CMSContainerBuilder CMSContainerBuilder

	Registry    *Registry
	CommandBus  *CommandBus
	JobRegistry *JobRegistry
	URLManager  *urlkit.RouteManager

	Authorizer            Authorizer
	Authenticator         Authenticator
	Translator            Translator
	ActivitySink          ActivitySink
	ActivityRepository    types.ActivityRepository
	ActivityAccessPolicy  activity.ActivityAccessPolicy
	ActivityFeedQuery     ActivityFeedQuerier
	ActivityService       ActivityFeedQuerier
	DebugREPLSessionStore DebugREPLSessionStore

	NotificationService NotificationService
	ExportRegistry      ExportRegistry
	ExportRegistrar     ExportHTTPRegistrar
	ExportMetadata      ExportMetadataProvider
	BulkService         BulkService
	MediaLibrary        MediaLibrary

	PreferencesStore PreferencesStore
	ProfileStore     ProfileStore

	UserRepository         UserRepository
	RoleRepository         RoleRepository
	TenantRepository       TenantRepository
	OrganizationRepository OrganizationRepository

	SettingsService *SettingsService

	FeatureGate fggate.FeatureGate
}

Dependencies captures host-provided integrations and storage adapters. Optional dependencies fall back to in-memory defaults when omitted.

type DisabledBulkService

type DisabledBulkService struct{}

DisabledBulkService returns explicit errors when bulk is disabled.

func (DisabledBulkService) List

func (DisabledBulkService) Rollback

func (DisabledBulkService) Rollback(ctx context.Context, id string) (BulkJob, error)

func (DisabledBulkService) Start

type DisabledMediaLibrary

type DisabledMediaLibrary struct{}

DisabledMediaLibrary returns feature disabled errors.

func (DisabledMediaLibrary) Add

func (DisabledMediaLibrary) List

type DisabledNotificationService

type DisabledNotificationService struct{}

DisabledNotificationService returns explicit errors when notifications are disabled.

func (DisabledNotificationService) Add

func (DisabledNotificationService) List

func (DisabledNotificationService) Mark

type DispatchFactory added in v0.12.0

type DispatchFactory func(ctx context.Context, payload map[string]any, ids []string) error

DispatchFactory executes a typed dispatch using the provided payload.

type EnsureMenuParentsOptions

type EnsureMenuParentsOptions struct {
	MenuSvc  CMSMenuService
	MenuCode string
	Parents  []MenuItem
	Locale   string
}

EnsureMenuParentsOptions controls how parent/group menu items are scaffolded.

type ExportColumn

type ExportColumn struct {
	Key   string `json:"key"`
	Label string `json:"label,omitempty"`
}

ExportColumn describes a column available for export.

type ExportConfig

type ExportConfig struct {
	Definition string `json:"definition"`
	Variant    string `json:"variant,omitempty"`
	Endpoint   string `json:"endpoint"`
}

ExportConfig captures export metadata for UI consumers.

type ExportDefinition

type ExportDefinition struct {
	Name     string   `json:"name"`
	Label    string   `json:"label,omitempty"`
	Variants []string `json:"variants,omitempty"`
}

ExportDefinition is the minimal shape surfaced by the export registry.

type ExportHTTPRegistrar

type ExportHTTPRegistrar interface {
	RegisterExportRoutes(router AdminRouter, opts ExportRouteOptions) error
}

ExportHTTPRegistrar registers export HTTP endpoints on a router.

type ExportMetadata

type ExportMetadata struct {
	Formats []string       `json:"formats,omitempty"`
	Columns []ExportColumn `json:"columns,omitempty"`
}

ExportMetadata captures UI-facing export metadata.

type ExportMetadataProvider

type ExportMetadataProvider interface {
	ExportMetadata(ctx context.Context, definition, variant string) (ExportMetadata, error)
}

ExportMetadataProvider fetches formats/columns for a definition and variant.

type ExportRegistry

type ExportRegistry interface {
	ListDefinitions(ctx context.Context) ([]ExportDefinition, error)
	GetDefinition(ctx context.Context, name string) (ExportDefinition, error)
}

ExportRegistry lists or fetches export definitions.

type ExportRouteOptions

type ExportRouteOptions struct {
	BasePath string
	Wrap     ExportRouteWrapper
}

ExportRouteOptions configures export route registration.

type ExportRouteWrapper

type ExportRouteWrapper func(router.HandlerFunc) router.HandlerFunc

ExportRouteWrapper wraps export handlers with auth or middleware.

type FeatureDependencyError

type FeatureDependencyError struct {
	Feature string
	Missing []string
}

FeatureDependencyError captures missing dependencies for an enabled feature.

func (FeatureDependencyError) Error

func (e FeatureDependencyError) Error() string

func (FeatureDependencyError) Unwrap

func (e FeatureDependencyError) Unwrap() error

type FeatureDisabledError

type FeatureDisabledError struct {
	Feature string
	Reason  string
}

FeatureDisabledError includes the specific feature name and optional reason.

func (FeatureDisabledError) Error

func (e FeatureDisabledError) Error() string

func (FeatureDisabledError) Unwrap

func (e FeatureDisabledError) Unwrap() error

type FeatureFlagsModule added in v0.21.0

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

FeatureFlagsModule registers the feature flags UI navigation entry.

func NewFeatureFlagsModule added in v0.21.0

func NewFeatureFlagsModule() *FeatureFlagsModule

NewFeatureFlagsModule constructs the default feature flags module.

func (*FeatureFlagsModule) Manifest added in v0.21.0

func (m *FeatureFlagsModule) Manifest() ModuleManifest

func (*FeatureFlagsModule) MenuItems added in v0.21.0

func (m *FeatureFlagsModule) MenuItems(locale string) []MenuItem

func (*FeatureFlagsModule) Register added in v0.21.0

func (m *FeatureFlagsModule) Register(ctx ModuleContext) error

func (*FeatureFlagsModule) WithMenuParent added in v0.21.0

func (m *FeatureFlagsModule) WithMenuParent(parent string) *FeatureFlagsModule

WithMenuParent nests the feature flags navigation under a parent menu item ID.

type FeatureKey

type FeatureKey string

FeatureKey enumerates supported feature flag keys.

const (
	FeatureDashboard     FeatureKey = "dashboard"
	FeatureSearch        FeatureKey = "search"
	FeatureExport        FeatureKey = "export"
	FeatureCMS           FeatureKey = "cms"
	FeatureJobs          FeatureKey = "jobs"
	FeatureCommands      FeatureKey = "commands"
	FeatureSettings      FeatureKey = "settings"
	FeatureNotifications FeatureKey = "notifications"
	FeatureMedia         FeatureKey = "media"
	FeatureBulk          FeatureKey = "bulk"
	FeaturePreferences   FeatureKey = "preferences"
	FeatureProfile       FeatureKey = "profile"
	FeatureUsers         FeatureKey = "users"
	FeatureTenants       FeatureKey = "tenants"
	FeatureOrganizations FeatureKey = "organizations"
)

type Field

type Field struct {
	Name       string   `json:"name"`
	Label      string   `json:"label"`
	Type       string   `json:"type"`
	Required   bool     `json:"required"`
	ReadOnly   bool     `json:"read_only"`
	Hidden     bool     `json:"hidden"`
	Options    []Option `json:"options,omitempty"`
	Validation string   `json:"validation,omitempty"`
}

Field describes a panel field.

type Filter

type Filter struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

Filter defines a filter input.

type GoAuthAuthenticator

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

GoAuthAuthenticator adapts a go-auth RouteAuthenticator to the Authenticator contract.

func NewGoAuthAuthenticator

func NewGoAuthAuthenticator(routeAuth *auth.RouteAuthenticator, cfg auth.Config, opts ...GoAuthAuthenticatorOption) *GoAuthAuthenticator

NewGoAuthAuthenticator builds an Authenticator that executes the protected go-auth middleware.

func (*GoAuthAuthenticator) Wrap

func (a *GoAuthAuthenticator) Wrap(ctx router.Context) error

Wrap runs the underlying go-auth middleware to enforce authentication.

func (*GoAuthAuthenticator) WrapHandler

func (a *GoAuthAuthenticator) WrapHandler(handler router.HandlerFunc) router.HandlerFunc

WrapHandler runs the go-auth middleware around the provided handler.

type GoAuthAuthenticatorOption

type GoAuthAuthenticatorOption func(*GoAuthAuthenticator)

GoAuthAuthenticatorOption configures the go-auth authenticator adapter.

func WithAuthErrorHandler

func WithAuthErrorHandler(handler func(router.Context, error) error) GoAuthAuthenticatorOption

WithAuthErrorHandler overrides the error handler used by the wrapped go-auth middleware.

func WithOptionalAuth

func WithOptionalAuth(optional bool) GoAuthAuthenticatorOption

WithOptionalAuth allows requests without a valid token to proceed (client-side guards).

type GoAuthAuthorizer

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

GoAuthAuthorizer adapts auth claims/resource roles to the admin Authorizer contract.

func NewGoAuthAuthorizer

func NewGoAuthAuthorizer(cfg GoAuthAuthorizerConfig) *GoAuthAuthorizer

NewGoAuthAuthorizer builds an Authorizer backed by go-auth claims.

func (*GoAuthAuthorizer) Can

func (a *GoAuthAuthorizer) Can(ctx context.Context, permission string, resource string) bool

Can evaluates permission strings (admin.*.<action>) against go-auth claims. It normalizes the action (e.g., "view" → "read") and checks if the user's resource role grants that capability using the AuthClaims interface methods.

type GoAuthAuthorizerConfig

type GoAuthAuthorizerConfig struct {
	DefaultResource string
	Debug           bool
	Logger          func(format string, args ...any)
}

GoAuthAuthorizerConfig configures resource resolution.

type GoCMSContainerAdapter

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

GoCMSContainerAdapter maps go-cms containers/modules into the admin CMSContainer contract.

func NewGoCMSContainerAdapter

func NewGoCMSContainerAdapter(container any) *GoCMSContainerAdapter

NewGoCMSContainerAdapter inspects a go-cms module or container and wraps available services.

func (*GoCMSContainerAdapter) ContentService

func (c *GoCMSContainerAdapter) ContentService() CMSContentService

func (*GoCMSContainerAdapter) MenuService

func (c *GoCMSContainerAdapter) MenuService() CMSMenuService

func (*GoCMSContainerAdapter) WidgetService

func (c *GoCMSContainerAdapter) WidgetService() CMSWidgetService

type GoCMSMenuAdapter

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

GoCMSMenuAdapter maps the go-cms menu service into the Admin CMSMenuService contract.

It enforces a string-first identity: - menu identity: menu code (sanitized to satisfy go-cms menu code validation) - item identity: dot-paths (menuCode + "." + segments)

UUIDs remain a go-cms persistence detail and are never supplied by go-admin.

func NewGoCMSMenuAdapter

func NewGoCMSMenuAdapter(service cms.MenuService) *GoCMSMenuAdapter

NewGoCMSMenuAdapter wraps a go-cms MenuService.

func NewGoCMSMenuAdapterFromAny

func NewGoCMSMenuAdapterFromAny(service any) *GoCMSMenuAdapter

NewGoCMSMenuAdapterFromAny wraps a go-cms MenuService exposed as any (used by adapter hooks).

func (*GoCMSMenuAdapter) AddMenuItem

func (a *GoCMSMenuAdapter) AddMenuItem(ctx context.Context, menuCode string, item MenuItem) error

AddMenuItem upserts an item using go-cms path-based APIs.

func (*GoCMSMenuAdapter) CreateMenu

func (a *GoCMSMenuAdapter) CreateMenu(ctx context.Context, code string) (*Menu, error)

CreateMenu ensures a menu exists.

func (*GoCMSMenuAdapter) DeleteMenuItem

func (a *GoCMSMenuAdapter) DeleteMenuItem(ctx context.Context, menuCode, id string) error

DeleteMenuItem removes an item via go-cms path-based APIs.

func (*GoCMSMenuAdapter) GoCMSMenuService

func (a *GoCMSMenuAdapter) GoCMSMenuService() cms.MenuService

GoCMSMenuService exposes the underlying go-cms menu service (used by quickstart seeding).

func (*GoCMSMenuAdapter) Menu

func (a *GoCMSMenuAdapter) Menu(ctx context.Context, code, locale string) (*Menu, error)

Menu resolves a localized navigation tree from go-cms.

func (*GoCMSMenuAdapter) ReorderMenu

func (a *GoCMSMenuAdapter) ReorderMenu(ctx context.Context, menuCode string, orderedIDs []string) error

ReorderMenu updates item positions while preserving their parents.

orderedIDs are treated as item paths (preferred) or relative item IDs.

func (*GoCMSMenuAdapter) ResetMenuContext

func (a *GoCMSMenuAdapter) ResetMenuContext(ctx context.Context, code string) error

ResetMenuContext resets the menu contents. It is used by quickstart navigation tooling to allow rebuilds during development.

func (*GoCMSMenuAdapter) String

func (a *GoCMSMenuAdapter) String() string

func (*GoCMSMenuAdapter) UpdateMenuItem

func (a *GoCMSMenuAdapter) UpdateMenuItem(ctx context.Context, menuCode string, item MenuItem) error

UpdateMenuItem updates an item by path and refreshes its translation for the provided locale.

type GoCMSMenuProvider

type GoCMSMenuProvider = cmsboot.GoCMSMenuProvider

GoCMSMenuProvider exposes a raw go-cms menu service for adapter wiring.

type GoCMSWidgetAdapter

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

GoCMSWidgetAdapter maps the go-cms widget service into CMSWidgetService using reflection.

func NewGoCMSWidgetAdapter

func NewGoCMSWidgetAdapter(service any) *GoCMSWidgetAdapter

NewGoCMSWidgetAdapter wraps a go-cms WidgetService (or compatible type).

func (*GoCMSWidgetAdapter) Areas

func (*GoCMSWidgetAdapter) Definitions

func (a *GoCMSWidgetAdapter) Definitions() []WidgetDefinition

func (*GoCMSWidgetAdapter) DeleteDefinition

func (a *GoCMSWidgetAdapter) DeleteDefinition(ctx context.Context, code string) error

func (*GoCMSWidgetAdapter) DeleteInstance

func (a *GoCMSWidgetAdapter) DeleteInstance(ctx context.Context, id string) error

func (*GoCMSWidgetAdapter) ListInstances

func (a *GoCMSWidgetAdapter) ListInstances(ctx context.Context, filter WidgetInstanceFilter) ([]WidgetInstance, error)

func (*GoCMSWidgetAdapter) RegisterAreaDefinition

func (a *GoCMSWidgetAdapter) RegisterAreaDefinition(ctx context.Context, def WidgetAreaDefinition) error

func (*GoCMSWidgetAdapter) RegisterDefinition

func (a *GoCMSWidgetAdapter) RegisterDefinition(ctx context.Context, def WidgetDefinition) error

func (*GoCMSWidgetAdapter) SaveInstance

func (a *GoCMSWidgetAdapter) SaveInstance(ctx context.Context, instance WidgetInstance) (*WidgetInstance, error)

type GoOptionsSettingsAdapter

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

GoOptionsSettingsAdapter persists settings using go-options layering semantics. It mirrors the in-memory SettingsService storage but annotates scopes with snapshot metadata so provenance is visible in schemas and traces.

func NewGoOptionsSettingsAdapter

func NewGoOptionsSettingsAdapter() *GoOptionsSettingsAdapter

NewGoOptionsSettingsAdapter constructs an adapter with default schema options.

func (*GoOptionsSettingsAdapter) Apply

Apply validates and stores values for the requested scope.

func (*GoOptionsSettingsAdapter) Definitions

func (a *GoOptionsSettingsAdapter) Definitions() []SettingDefinition

Definitions returns the sorted definitions known to the adapter.

func (*GoOptionsSettingsAdapter) RegisterDefinition

func (a *GoOptionsSettingsAdapter) RegisterDefinition(def SettingDefinition)

RegisterDefinition stores a setting definition on the adapter.

func (*GoOptionsSettingsAdapter) Resolve

func (a *GoOptionsSettingsAdapter) Resolve(key, userID string) ResolvedSetting

Resolve returns a single resolved setting with provenance.

func (*GoOptionsSettingsAdapter) ResolveAll

func (a *GoOptionsSettingsAdapter) ResolveAll(userID string) map[string]ResolvedSetting

ResolveAll returns resolved values for every definition.

func (*GoOptionsSettingsAdapter) Schema

Schema emits the go-options schema document including scope descriptors.

func (*GoOptionsSettingsAdapter) WithSchemaOptions

func (a *GoOptionsSettingsAdapter) WithSchemaOptions(options ...opts.Option)

WithSchemaOptions appends schema generation options.

type GoUsersProfileStore

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

GoUsersProfileStore adapts a go-users ProfileRepository to the admin profile store contract.

func NewGoUsersProfileStore

func NewGoUsersProfileStore(repo users.ProfileRepository, scopeResolver func(context.Context) users.ScopeFilter) *GoUsersProfileStore

NewGoUsersProfileStore builds an adapter for go-users profile repositories.

func (*GoUsersProfileStore) Get

func (s *GoUsersProfileStore) Get(ctx context.Context, userID string) (UserProfile, error)

Get returns a user profile via the go-users repository.

func (*GoUsersProfileStore) Save

Save upserts a user profile via the go-users repository.

type GoUsersRoleRepository

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

GoUsersRoleRepository adapts a go-users RoleRegistry to the admin contract.

func NewGoUsersRoleRepository

func NewGoUsersRoleRepository(registry users.RoleRegistry, scopeResolver func(context.Context) users.ScopeFilter) *GoUsersRoleRepository

NewGoUsersRoleRepository constructs a role adapter.

func (*GoUsersRoleRepository) Assign

func (r *GoUsersRoleRepository) Assign(ctx context.Context, userID, roleID string) error

Assign a role to a user.

func (*GoUsersRoleRepository) Create

Create inserts a role.

func (*GoUsersRoleRepository) Delete

func (r *GoUsersRoleRepository) Delete(ctx context.Context, id string) error

Delete removes a role via go-users registry.

func (*GoUsersRoleRepository) Get

Get role by ID.

func (*GoUsersRoleRepository) List

List roles via go-users.

func (*GoUsersRoleRepository) RolesForUser

func (r *GoUsersRoleRepository) RolesForUser(ctx context.Context, userID string) ([]RoleRecord, error)

RolesForUser lists assignments.

func (*GoUsersRoleRepository) Unassign

func (r *GoUsersRoleRepository) Unassign(ctx context.Context, userID, roleID string) error

Unassign removes a role assignment.

func (*GoUsersRoleRepository) Update

Update modifies a role.

type GoUsersUserRepository

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

GoUsersUserRepository adapts go-users auth/inventory repositories to the admin contract.

func NewGoUsersUserRepository

func NewGoUsersUserRepository(auth users.AuthRepository, inventory users.UserInventoryRepository, scopeResolver func(context.Context) users.ScopeFilter) *GoUsersUserRepository

NewGoUsersUserRepository builds a repository using go-users collaborators.

func (*GoUsersUserRepository) Create

Create inserts a new user via go-users.

func (*GoUsersUserRepository) Delete

func (r *GoUsersUserRepository) Delete(ctx context.Context, id string) error

Delete marks a user as disabled (go-users does not hard delete via AuthRepository).

func (*GoUsersUserRepository) Get

Get fetches a user by ID.

func (*GoUsersUserRepository) List

List delegates to the go-users inventory repository.

func (*GoUsersUserRepository) Search

func (r *GoUsersUserRepository) Search(ctx context.Context, query string, limit int) ([]UserRecord, error)

Search proxies to List with a keyword.

func (*GoUsersUserRepository) Update

Update modifies a user via go-users.

type HandlerAuthenticator

type HandlerAuthenticator interface {
	WrapHandler(handler router.HandlerFunc) router.HandlerFunc
}

HandlerAuthenticator can wrap handlers directly to preserve middleware semantics.

type InMemoryBulkService

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

InMemoryBulkService stores jobs in memory and marks them completed immediately.

func NewInMemoryBulkService

func NewInMemoryBulkService() *InMemoryBulkService

NewInMemoryBulkService constructs a bulk service with a sample job.

func (*InMemoryBulkService) List

func (s *InMemoryBulkService) List(ctx context.Context) []BulkJob

List returns recorded jobs newest first.

func (*InMemoryBulkService) Rollback

func (s *InMemoryBulkService) Rollback(ctx context.Context, id string) (BulkJob, error)

Rollback marks a job as rolled back.

func (*InMemoryBulkService) Start

Start records a bulk job and immediately completes it for demo purposes.

type InMemoryContentService

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

InMemoryContentService stores CMS pages/content/blocks in memory for tests/demos.

func NewInMemoryContentService

func NewInMemoryContentService() *InMemoryContentService

NewInMemoryContentService constructs a content service.

func (*InMemoryContentService) BlockDefinitions

func (s *InMemoryContentService) BlockDefinitions(_ context.Context) ([]CMSBlockDefinition, error)

BlockDefinitions returns registered block definitions.

func (*InMemoryContentService) BlocksForContent

func (s *InMemoryContentService) BlocksForContent(_ context.Context, contentID, locale string) ([]CMSBlock, error)

BlocksForContent returns blocks attached to a content/page.

func (*InMemoryContentService) Content

func (s *InMemoryContentService) Content(_ context.Context, id, locale string) (*CMSContent, error)

Content returns a content entry by id and locale.

func (*InMemoryContentService) Contents

func (s *InMemoryContentService) Contents(_ context.Context, locale string) ([]CMSContent, error)

Contents returns structured content filtered by locale.

func (*InMemoryContentService) CreateBlockDefinition

func (s *InMemoryContentService) CreateBlockDefinition(ctx context.Context, def CMSBlockDefinition) (*CMSBlockDefinition, error)

CreateBlockDefinition adds a block definition.

func (*InMemoryContentService) CreateContent

func (s *InMemoryContentService) CreateContent(ctx context.Context, content CMSContent) (*CMSContent, error)

CreateContent inserts a content entry.

func (*InMemoryContentService) CreatePage

func (s *InMemoryContentService) CreatePage(ctx context.Context, page CMSPage) (*CMSPage, error)

CreatePage inserts a page.

func (*InMemoryContentService) DeleteBlock

func (s *InMemoryContentService) DeleteBlock(ctx context.Context, id string) error

DeleteBlock removes a block.

func (*InMemoryContentService) DeleteBlockDefinition

func (s *InMemoryContentService) DeleteBlockDefinition(ctx context.Context, id string) error

DeleteBlockDefinition removes a block definition.

func (*InMemoryContentService) DeleteContent

func (s *InMemoryContentService) DeleteContent(ctx context.Context, id string) error

DeleteContent removes a content entry.

func (*InMemoryContentService) DeletePage

func (s *InMemoryContentService) DeletePage(ctx context.Context, id string) error

DeletePage removes a page.

func (*InMemoryContentService) Page

func (s *InMemoryContentService) Page(_ context.Context, id, locale string) (*CMSPage, error)

Page returns a page by id and locale.

func (*InMemoryContentService) Pages

func (s *InMemoryContentService) Pages(_ context.Context, locale string) ([]CMSPage, error)

Pages returns all pages for a locale (or all when locale empty).

func (*InMemoryContentService) SaveBlock

func (s *InMemoryContentService) SaveBlock(ctx context.Context, block CMSBlock) (*CMSBlock, error)

SaveBlock creates or updates a block.

func (*InMemoryContentService) UpdateBlockDefinition

func (s *InMemoryContentService) UpdateBlockDefinition(ctx context.Context, def CMSBlockDefinition) (*CMSBlockDefinition, error)

UpdateBlockDefinition updates an existing block definition.

func (*InMemoryContentService) UpdateContent

func (s *InMemoryContentService) UpdateContent(ctx context.Context, content CMSContent) (*CMSContent, error)

UpdateContent updates an existing content entry.

func (*InMemoryContentService) UpdatePage

func (s *InMemoryContentService) UpdatePage(ctx context.Context, page CMSPage) (*CMSPage, error)

UpdatePage updates an existing page.

func (*InMemoryContentService) WithActivitySink

func (s *InMemoryContentService) WithActivitySink(sink ActivitySink)

WithActivitySink wires activity emission for CMS content changes.

type InMemoryDashboardPreferences

type InMemoryDashboardPreferences = dashinternal.InMemoryDashboardPreferences

InMemoryDashboardPreferences stores layouts in memory.

func NewInMemoryDashboardPreferences

func NewInMemoryDashboardPreferences() *InMemoryDashboardPreferences

NewInMemoryDashboardPreferences constructs a preference store.

type InMemoryDebugREPLSessionStore added in v0.16.0

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

InMemoryDebugREPLSessionStore keeps sessions in memory.

func NewInMemoryDebugREPLSessionStore added in v0.16.0

func NewInMemoryDebugREPLSessionStore() *InMemoryDebugREPLSessionStore

NewInMemoryDebugREPLSessionStore constructs a memory-backed store.

func (*InMemoryDebugREPLSessionStore) Close added in v0.16.0

func (*InMemoryDebugREPLSessionStore) Create added in v0.16.0

func (*InMemoryDebugREPLSessionStore) Get added in v0.16.0

func (*InMemoryDebugREPLSessionStore) ListActive added in v0.16.0

type InMemoryMediaLibrary

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

InMemoryMediaLibrary stores media items in memory.

func NewInMemoryMediaLibrary

func NewInMemoryMediaLibrary(baseURL string) *InMemoryMediaLibrary

NewInMemoryMediaLibrary seeds a few sample assets.

func (*InMemoryMediaLibrary) Add

Add stores a media item.

func (*InMemoryMediaLibrary) List

List returns items newest first.

type InMemoryMenuService

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

InMemoryMenuService stores menus in memory.

func NewInMemoryMenuService

func NewInMemoryMenuService() *InMemoryMenuService

NewInMemoryMenuService constructs a memory-backed menu service.

func (*InMemoryMenuService) AddMenuItem

func (s *InMemoryMenuService) AddMenuItem(ctx context.Context, menuCode string, item MenuItem) error

AddMenuItem appends an item to a menu identified by code.

func (*InMemoryMenuService) CreateMenu

func (s *InMemoryMenuService) CreateMenu(ctx context.Context, code string) (*Menu, error)

CreateMenu makes a menu entry if it does not exist.

func (*InMemoryMenuService) DeleteMenuItem

func (s *InMemoryMenuService) DeleteMenuItem(ctx context.Context, menuCode, id string) error

DeleteMenuItem deletes an item and its children.

func (*InMemoryMenuService) Menu

func (s *InMemoryMenuService) Menu(_ context.Context, code, locale string) (*Menu, error)

Menu returns a menu for a given locale. Items with locale match or empty locale are returned.

func (*InMemoryMenuService) ReorderMenu

func (s *InMemoryMenuService) ReorderMenu(ctx context.Context, menuCode string, orderedIDs []string) error

ReorderMenu applies a positional ordering to menu items.

func (*InMemoryMenuService) ResetMenu

func (s *InMemoryMenuService) ResetMenu(code string)

ResetMenu removes all items for the given menu code (debug/reset helper).

func (*InMemoryMenuService) ResetMenuContext

func (s *InMemoryMenuService) ResetMenuContext(ctx context.Context, code string) error

ResetMenuContext implements the MenuResetterWithContext interface used by quickstart helpers.

func (*InMemoryMenuService) UpdateMenuItem

func (s *InMemoryMenuService) UpdateMenuItem(ctx context.Context, menuCode string, item MenuItem) error

UpdateMenuItem updates an existing menu item.

func (*InMemoryMenuService) WithActivitySink

func (s *InMemoryMenuService) WithActivitySink(sink ActivitySink)

WithActivitySink wires activity emission for menu operations.

type InMemoryNotificationService

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

InMemoryNotificationService stores notifications in memory.

func NewInMemoryNotificationService

func NewInMemoryNotificationService() *InMemoryNotificationService

NewInMemoryNotificationService builds an inbox service.

func (*InMemoryNotificationService) Add

Add stores a notification.

func (*InMemoryNotificationService) List

List returns all notifications newest first.

func (*InMemoryNotificationService) Mark

func (s *InMemoryNotificationService) Mark(ctx context.Context, ids []string, read bool) error

Mark toggles read state for ids.

func (*InMemoryNotificationService) WithActivitySink

func (s *InMemoryNotificationService) WithActivitySink(sink ActivitySink)

WithActivitySink wires an activity sink for notification events.

type InMemoryOrganizationStore

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

InMemoryOrganizationStore keeps organizations and memberships in memory.

func NewInMemoryOrganizationStore

func NewInMemoryOrganizationStore() *InMemoryOrganizationStore

NewInMemoryOrganizationStore builds an empty org store.

func (*InMemoryOrganizationStore) Create

Create inserts an organization.

func (*InMemoryOrganizationStore) Delete

Delete removes an organization.

func (*InMemoryOrganizationStore) Get

Get returns an organization by ID.

func (*InMemoryOrganizationStore) List

List returns organizations with search and status filtering.

func (*InMemoryOrganizationStore) Search

func (s *InMemoryOrganizationStore) Search(ctx context.Context, query string, limit int) ([]OrganizationRecord, error)

Search performs a simple keyword search.

func (*InMemoryOrganizationStore) Update

Update modifies an organization.

type InMemoryPreferencesStore

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

InMemoryPreferencesStore keeps preferences per-scope in memory.

func NewInMemoryPreferencesStore

func NewInMemoryPreferencesStore() *InMemoryPreferencesStore

NewInMemoryPreferencesStore builds an empty in-memory preference store.

func (*InMemoryPreferencesStore) Delete added in v0.11.0

Delete removes stored preferences for a scoped level.

func (*InMemoryPreferencesStore) Resolve added in v0.11.0

Resolve returns stored preferences across scopes.

func (*InMemoryPreferencesStore) Upsert added in v0.11.0

Upsert stores preferences for a scoped level.

type InMemoryProfileStore

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

InMemoryProfileStore stores profiles keyed by user ID.

func NewInMemoryProfileStore

func NewInMemoryProfileStore() *InMemoryProfileStore

NewInMemoryProfileStore constructs an empty profile store.

func (*InMemoryProfileStore) Get

Get returns the stored profile for a user.

func (*InMemoryProfileStore) Save

Save upserts the stored profile for a user.

type InMemoryTenantStore

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

InMemoryTenantStore keeps tenants and memberships in memory.

func NewInMemoryTenantStore

func NewInMemoryTenantStore() *InMemoryTenantStore

NewInMemoryTenantStore builds an empty tenant store.

func (*InMemoryTenantStore) Create

Create inserts a tenant.

func (*InMemoryTenantStore) Delete

func (s *InMemoryTenantStore) Delete(ctx context.Context, id string) error

Delete removes a tenant.

func (*InMemoryTenantStore) Get

Get returns a tenant by ID.

func (*InMemoryTenantStore) List

List returns tenants with search and status filtering.

func (*InMemoryTenantStore) Search

func (s *InMemoryTenantStore) Search(ctx context.Context, query string, limit int) ([]TenantRecord, error)

Search performs a simple keyword search.

func (*InMemoryTenantStore) Update

Update modifies a tenant.

type InMemoryUserStore

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

InMemoryUserStore provides an in-memory implementation for users and roles.

func NewInMemoryUserStore

func NewInMemoryUserStore() *InMemoryUserStore

NewInMemoryUserStore constructs an empty in-memory store.

func (*InMemoryUserStore) Assign

func (s *InMemoryUserStore) Assign(ctx context.Context, userID, roleID string) error

Assign adds a role assignment for a user.

func (*InMemoryUserStore) Create

func (s *InMemoryUserStore) Create(ctx context.Context, role RoleRecord) (RoleRecord, error)

Create inserts a role (implements RoleRepository.Create).

func (*InMemoryUserStore) CreateUser

func (s *InMemoryUserStore) CreateUser(ctx context.Context, user UserRecord) (UserRecord, error)

CreateUser inserts a new user (implements UserRepository.Create).

func (*InMemoryUserStore) Delete

func (s *InMemoryUserStore) Delete(ctx context.Context, id string) error

Delete removes a role if not system-protected (implements RoleRepository.Delete).

func (*InMemoryUserStore) DeleteUser

func (s *InMemoryUserStore) DeleteUser(ctx context.Context, id string) error

DeleteUser removes a user (implements UserRepository.Delete).

func (*InMemoryUserStore) Get

Get returns a role by ID (implements RoleRepository.Get).

func (*InMemoryUserStore) GetUser

func (s *InMemoryUserStore) GetUser(ctx context.Context, id string) (UserRecord, error)

GetUser returns a user by ID (implements UserRepository.Get).

func (*InMemoryUserStore) List

func (s *InMemoryUserStore) List(ctx context.Context, opts ListOptions) ([]RoleRecord, int, error)

List roles (implements RoleRepository.List).

func (*InMemoryUserStore) ListUsers

func (s *InMemoryUserStore) ListUsers(ctx context.Context, opts ListOptions) ([]UserRecord, int, error)

ListUsers returns paginated users with simple search/filter support (implements UserRepository.List).

func (*InMemoryUserStore) RolesForUser

func (s *InMemoryUserStore) RolesForUser(ctx context.Context, userID string) ([]RoleRecord, error)

RolesForUser lists assigned roles.

func (*InMemoryUserStore) Search

func (s *InMemoryUserStore) Search(ctx context.Context, query string, limit int) ([]UserRecord, error)

Search performs a simple keyword search across users.

func (*InMemoryUserStore) Unassign

func (s *InMemoryUserStore) Unassign(ctx context.Context, userID, roleID string) error

Unassign removes a role assignment.

func (*InMemoryUserStore) Update

func (s *InMemoryUserStore) Update(ctx context.Context, role RoleRecord) (RoleRecord, error)

Update updates an existing role (implements RoleRepository.Update).

func (*InMemoryUserStore) UpdateUser

func (s *InMemoryUserStore) UpdateUser(ctx context.Context, user UserRecord) (UserRecord, error)

UpdateUser modifies an existing user (implements UserRepository.Update).

type InMemoryWidgetService

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

InMemoryWidgetService stores widget areas/definitions/instances in memory.

func NewInMemoryWidgetService

func NewInMemoryWidgetService() *InMemoryWidgetService

NewInMemoryWidgetService constructs a memory-backed widget service.

func (*InMemoryWidgetService) Areas

Areas returns all registered areas.

func (*InMemoryWidgetService) Definitions

func (s *InMemoryWidgetService) Definitions() []WidgetDefinition

Definitions returns all registered widget definitions.

func (*InMemoryWidgetService) DeleteDefinition

func (s *InMemoryWidgetService) DeleteDefinition(ctx context.Context, code string) error

DeleteDefinition removes a widget definition.

func (*InMemoryWidgetService) DeleteInstance

func (s *InMemoryWidgetService) DeleteInstance(ctx context.Context, id string) error

DeleteInstance removes a widget instance.

func (*InMemoryWidgetService) ListInstances

ListInstances returns widget instances filtered by area/page/locale.

func (*InMemoryWidgetService) RegisterAreaDefinition

func (s *InMemoryWidgetService) RegisterAreaDefinition(ctx context.Context, def WidgetAreaDefinition) error

RegisterAreaDefinition saves/overwrites a widget area.

func (*InMemoryWidgetService) RegisterDefinition

func (s *InMemoryWidgetService) RegisterDefinition(ctx context.Context, def WidgetDefinition) error

RegisterDefinition saves/overwrites a widget definition.

func (*InMemoryWidgetService) SaveInstance

func (s *InMemoryWidgetService) SaveInstance(ctx context.Context, instance WidgetInstance) (*WidgetInstance, error)

SaveInstance stores or updates a widget instance.

func (*InMemoryWidgetService) WithActivitySink

func (s *InMemoryWidgetService) WithActivitySink(sink ActivitySink)

WithActivitySink wires activity emission for widget events.

type InvalidDependenciesError

type InvalidDependenciesError struct {
	Issues []error
}

func (InvalidDependenciesError) Error

func (e InvalidDependenciesError) Error() string

func (InvalidDependenciesError) Unwrap

func (e InvalidDependenciesError) Unwrap() error

type InvalidFeatureConfigError

type InvalidFeatureConfigError struct {
	Issues []FeatureDependencyError
}

InvalidFeatureConfigError aggregates dependency validation failures.

func (InvalidFeatureConfigError) Error

func (InvalidFeatureConfigError) Unwrap

func (e InvalidFeatureConfigError) Unwrap() error

type Job

type Job struct {
	Name      string    `json:"name"`
	Schedule  string    `json:"schedule,omitempty"`
	LastRun   time.Time `json:"last_run,omitempty"`
	NextRun   time.Time `json:"next_run,omitempty"`
	Status    string    `json:"status,omitempty"`
	LastError string    `json:"last_error,omitempty"`
}

Job represents a scheduled or triggerable job.

type JobRegistry

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

JobRegistry keeps track of jobs registered via commands with cron metadata.

func NewJobRegistry

func NewJobRegistry() *JobRegistry

NewJobRegistry captures cron-enabled go-command registrations.

func (*JobRegistry) Enable

func (j *JobRegistry) Enable(enabled bool)

Enable toggles whether jobs are available.

func (*JobRegistry) List

func (j *JobRegistry) List() []Job

List returns registered cron jobs.

func (*JobRegistry) Sync

func (j *JobRegistry) Sync(ctx context.Context) error

Sync registers cron-capable commands with the go-job dispatcher and scheduler.

func (*JobRegistry) Trigger

func (j *JobRegistry) Trigger(ctx AdminContext, name string) error

Trigger dispatches a job by name through the go-job dispatcher.

func (*JobRegistry) WithActivitySink

func (j *JobRegistry) WithActivitySink(sink ActivitySink)

WithActivitySink records job triggers to the shared activity sink.

func (*JobRegistry) WithGoJob

func (j *JobRegistry) WithGoJob(registry gojob.Registry, scheduler goJobScheduler)

WithGoJob allows callers to inject a go-job registry and scheduler.

type ListOptions

type ListOptions struct {
	Page     int
	PerPage  int
	SortBy   string
	SortDesc bool
	Filters  map[string]any
	Search   string
}

ListOptions holds pagination and filtering input.

type LogEntry added in v0.14.0

type LogEntry struct {
	Timestamp time.Time      `json:"timestamp"`
	Level     string         `json:"level"`
	Message   string         `json:"message"`
	Fields    map[string]any `json:"fields,omitempty"`
	Source    string         `json:"source,omitempty"`
}

LogEntry captures server log messages.

type MediaConfig

type MediaConfig struct {
	LibraryPath string `json:"library_path"`
}

MediaConfig surfaces media library configuration for form widgets.

type MediaItem

type MediaItem struct {
	ID        string         `json:"id"`
	Name      string         `json:"name"`
	URL       string         `json:"url"`
	Thumbnail string         `json:"thumbnail,omitempty"`
	Size      int64          `json:"size,omitempty"`
	Metadata  map[string]any `json:"metadata,omitempty"`
	CreatedAt time.Time      `json:"created_at,omitempty"`
}

MediaItem describes a stored asset.

type MediaLibrary

type MediaLibrary interface {
	List(ctx context.Context) ([]MediaItem, error)
	Add(ctx context.Context, item MediaItem) (MediaItem, error)
}

MediaLibrary exposes media listing/creation.

type MemoryRepository

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

MemoryRepository is an in-memory implementation of Repository for testing/demo.

func NewMemoryRepository

func NewMemoryRepository() *MemoryRepository

NewMemoryRepository constructs a MemoryRepository.

func (*MemoryRepository) Create

func (r *MemoryRepository) Create(_ context.Context, record map[string]any) (map[string]any, error)

Create inserts a new record.

func (*MemoryRepository) Delete

func (r *MemoryRepository) Delete(_ context.Context, id string) error

Delete removes a record by id.

func (*MemoryRepository) Get

func (r *MemoryRepository) Get(_ context.Context, id string) (map[string]any, error)

Get retrieves a record by id.

func (*MemoryRepository) List

func (r *MemoryRepository) List(_ context.Context, opts ListOptions) ([]map[string]any, int, error)

List returns paginated records with simple filtering and sorting.

func (*MemoryRepository) Update

func (r *MemoryRepository) Update(_ context.Context, id string, record map[string]any) (map[string]any, error)

Update modifies an existing record.

type Menu = cmsboot.Menu

Menu represents a simple CMS menu tree.

type MenuContributor = modinternal.MenuContributor

MenuContributor optionally lets a module contribute navigation items.

type MenuHandle = Navigation
type MenuItem = cmsboot.MenuItem

MenuItem describes a single navigation node.

type MessageFactory added in v0.12.0

type MessageFactory func(payload map[string]any, ids []string) (command.Message, error)

MessageFactory builds typed command messages from request data.

type Module

type Module interface {
	Manifest() ModuleManifest
	Register(ctx ModuleContext) error
}

Module defines the minimal contract for pluggable slices. Modules should be registered before Admin.Initialize is called.

type ModuleContext

type ModuleContext struct {
	Admin      *Admin
	Router     AdminRouter
	Locale     string
	Translator Translator
}

ModuleContext is passed to modules so they can register panels, routes, commands, and other contributions against the admin orchestrator.

type ModuleManifest

type ModuleManifest = modinternal.Manifest

ModuleManifest captures identifying metadata and dependencies for a module. Labels/description keys are i18n-friendly and resolved by the host.

type Navigation = navinternal.Navigation

Navigation resolves menus from CMS or in-memory sources.

func NewNavigation

func NewNavigation(menuSvc CMSMenuService, authorizer Authorizer) *Navigation

NewNavigation builds a navigation helper.

type NavigationItem = navinternal.NavigationItem

NavigationItem represents a node in the admin navigation tree.

type NoopCLIHandler added in v0.12.0

type NoopCLIHandler struct{}

NoopCLIHandler is a placeholder for CLI commands without a dedicated CLI implementation.

func (NoopCLIHandler) Run added in v0.12.0

func (NoopCLIHandler) Run() error

type NoopCMSContainer

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

NoopCMSContainer returns in-memory services that satisfy the CMS contracts.

func NewNoopCMSContainer

func NewNoopCMSContainer() *NoopCMSContainer

NewNoopCMSContainer builds a container with in-memory services.

func (*NoopCMSContainer) ContentService

func (c *NoopCMSContainer) ContentService() CMSContentService

func (*NoopCMSContainer) MenuService

func (c *NoopCMSContainer) MenuService() CMSMenuService

func (*NoopCMSContainer) WidgetService

func (c *NoopCMSContainer) WidgetService() CMSWidgetService

type NoopTranslator

type NoopTranslator struct{}

NoopTranslator returns the key unchanged.

func (NoopTranslator) Translate

func (NoopTranslator) Translate(key, locale string) string

type Notification

type Notification struct {
	ID        string         `json:"id"`
	Title     string         `json:"title"`
	Message   string         `json:"message"`
	Locale    string         `json:"locale,omitempty"`
	ActionURL string         `json:"action_url,omitempty"`
	Metadata  map[string]any `json:"metadata,omitempty"`
	UserID    string         `json:"user_id,omitempty"`
	Read      bool           `json:"read"`
	CreatedAt time.Time      `json:"created_at"`
}

Notification represents an inbox item.

type NotificationMarkCommand

type NotificationMarkCommand struct {
	Service NotificationService
}

NotificationMarkCommand toggles read state for notifications via the command bus.

func (*NotificationMarkCommand) Execute

type NotificationMarkMsg added in v0.12.0

type NotificationMarkMsg struct {
	IDs  []string
	Read bool
}

NotificationMarkMsg toggles notification read state.

func (NotificationMarkMsg) Type added in v0.12.0

func (NotificationMarkMsg) Type() string

func (NotificationMarkMsg) Validate added in v0.12.0

func (m NotificationMarkMsg) Validate() error

type NotificationService

type NotificationService interface {
	List(ctx context.Context) ([]Notification, error)
	Add(ctx context.Context, n Notification) (Notification, error)
	Mark(ctx context.Context, ids []string, read bool) error
}

NotificationService manages inbox items.

type Option

type Option struct {
	Value any    `json:"value"`
	Label string `json:"label"`
}

Option is a select/choice option.

type OrganizationMember

type OrganizationMember struct {
	UserID      string   `json:"user_id"`
	Roles       []string `json:"roles,omitempty"`
	Permissions []string `json:"permissions,omitempty"`
}

OrganizationMember captures membership assignments for an organization.

type OrganizationPanelRepository

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

OrganizationPanelRepository adapts OrganizationService to the panel Repository contract.

func NewOrganizationPanelRepository

func NewOrganizationPanelRepository(service *OrganizationService) *OrganizationPanelRepository

NewOrganizationPanelRepository constructs a repository backed by OrganizationService.

func (*OrganizationPanelRepository) Create

func (r *OrganizationPanelRepository) Create(ctx context.Context, record map[string]any) (map[string]any, error)

func (*OrganizationPanelRepository) Delete

func (*OrganizationPanelRepository) Get

func (*OrganizationPanelRepository) List

func (*OrganizationPanelRepository) Update

func (r *OrganizationPanelRepository) Update(ctx context.Context, id string, record map[string]any) (map[string]any, error)

type OrganizationRecord

type OrganizationRecord struct {
	ID        string               `json:"id"`
	Name      string               `json:"name"`
	Slug      string               `json:"slug,omitempty"`
	Status    string               `json:"status,omitempty"`
	TenantID  string               `json:"tenant_id,omitempty"`
	Members   []OrganizationMember `json:"members,omitempty"`
	Metadata  map[string]any       `json:"metadata,omitempty"`
	CreatedAt time.Time            `json:"created_at,omitempty"`
	UpdatedAt time.Time            `json:"updated_at,omitempty"`
}

OrganizationRecord represents an organization managed by the admin.

type OrganizationRepository

type OrganizationRepository interface {
	List(ctx context.Context, opts ListOptions) ([]OrganizationRecord, int, error)
	Get(ctx context.Context, id string) (OrganizationRecord, error)
	Create(ctx context.Context, org OrganizationRecord) (OrganizationRecord, error)
	Update(ctx context.Context, org OrganizationRecord) (OrganizationRecord, error)
	Delete(ctx context.Context, id string) error
	Search(ctx context.Context, query string, limit int) ([]OrganizationRecord, error)
}

OrganizationRepository exposes CRUD/search operations for organizations with membership awareness.

type OrganizationService

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

OrganizationService orchestrates organization management and activity emission.

func NewOrganizationService

func NewOrganizationService(repo OrganizationRepository) *OrganizationService

NewOrganizationService constructs a service with the provided repository or an in-memory fallback.

func (*OrganizationService) AssignMember

func (s *OrganizationService) AssignMember(ctx context.Context, orgID string, member OrganizationMember) (OrganizationRecord, error)

AssignMember adds or updates an organization membership.

func (*OrganizationService) DeleteOrganization

func (s *OrganizationService) DeleteOrganization(ctx context.Context, id string) error

DeleteOrganization removes an organization by ID.

func (*OrganizationService) GetOrganization

func (s *OrganizationService) GetOrganization(ctx context.Context, id string) (OrganizationRecord, error)

GetOrganization fetches an organization by ID.

func (*OrganizationService) ListOrganizations

func (s *OrganizationService) ListOrganizations(ctx context.Context, opts ListOptions) ([]OrganizationRecord, int, error)

ListOrganizations returns organizations with filters applied.

func (*OrganizationService) RemoveMember

func (s *OrganizationService) RemoveMember(ctx context.Context, orgID, userID string) (OrganizationRecord, error)

RemoveMember detaches a user from an organization.

func (*OrganizationService) SaveOrganization

SaveOrganization creates or updates an organization record.

func (*OrganizationService) SearchOrganizations

func (s *OrganizationService) SearchOrganizations(ctx context.Context, query string, limit int) ([]OrganizationRecord, error)

SearchOrganizations performs a keyword search against organizations.

func (*OrganizationService) WithActivitySink

func (s *OrganizationService) WithActivitySink(sink ActivitySink)

WithActivitySink wires activity emission for organization mutations.

type OrganizationsModule

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

OrganizationsModule registers the organizations panel and navigation.

func NewOrganizationsModule

func NewOrganizationsModule() *OrganizationsModule

NewOrganizationsModule constructs the default organizations module.

func (*OrganizationsModule) Manifest

func (m *OrganizationsModule) Manifest() ModuleManifest

Manifest describes the module metadata.

func (*OrganizationsModule) MenuItems

func (m *OrganizationsModule) MenuItems(locale string) []MenuItem

MenuItems contributes navigation for organizations.

func (*OrganizationsModule) Register

func (m *OrganizationsModule) Register(ctx ModuleContext) error

Register wires the organizations panel and search adapter.

func (*OrganizationsModule) WithMenuParent

func (m *OrganizationsModule) WithMenuParent(parent string) *OrganizationsModule

WithMenuParent nests organization navigation under a parent menu item ID.

type Panel

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

Panel represents a registered panel.

func (*Panel) Create

func (p *Panel) Create(ctx AdminContext, record map[string]any) (map[string]any, error)

Create inserts a record with hooks and permissions.

func (*Panel) Delete

func (p *Panel) Delete(ctx AdminContext, id string) error

Delete removes a record with hooks and permissions.

func (*Panel) Get

func (p *Panel) Get(ctx AdminContext, id string) (map[string]any, error)

Get returns a single record if permitted.

func (*Panel) List

func (p *Panel) List(ctx AdminContext, opts ListOptions) ([]map[string]any, int, error)

List retrieves records with permissions enforced.

func (*Panel) RunAction

func (p *Panel) RunAction(ctx AdminContext, name string, payload map[string]any, ids []string) error

RunAction dispatches a command-backed action.

func (*Panel) RunBulkAction

func (p *Panel) RunBulkAction(ctx AdminContext, name string, payload map[string]any, ids []string) error

RunBulkAction dispatches a command-backed bulk action.

func (*Panel) Schema

func (p *Panel) Schema() Schema

Schema returns a basic schema description.

func (*Panel) SchemaWithTheme

func (p *Panel) SchemaWithTheme(theme map[string]map[string]string) Schema

SchemaWithTheme attaches the resolved theme payload for UI renderers.

func (*Panel) Update

func (p *Panel) Update(ctx AdminContext, id string, record map[string]any) (map[string]any, error)

Update modifies a record with hooks and permissions.

type PanelBuilder

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

PanelBuilder configures a panel before registration.

func (*PanelBuilder) Actions

func (b *PanelBuilder) Actions(actions ...Action) *PanelBuilder

Actions sets row-level actions.

func (*PanelBuilder) Build

func (b *PanelBuilder) Build() (*Panel, error)

Build finalizes the panel.

func (*PanelBuilder) BulkActions

func (b *PanelBuilder) BulkActions(actions ...Action) *PanelBuilder

BulkActions sets bulk actions.

func (*PanelBuilder) DetailFields

func (b *PanelBuilder) DetailFields(fields ...Field) *PanelBuilder

DetailFields configures detail fields.

func (*PanelBuilder) Filters

func (b *PanelBuilder) Filters(filters ...Filter) *PanelBuilder

Filters sets filters.

func (*PanelBuilder) FormFields

func (b *PanelBuilder) FormFields(fields ...Field) *PanelBuilder

FormFields configures form fields.

func (*PanelBuilder) Hooks

func (b *PanelBuilder) Hooks(h PanelHooks) *PanelBuilder

Hooks sets lifecycle hooks.

func (*PanelBuilder) ListFields

func (b *PanelBuilder) ListFields(fields ...Field) *PanelBuilder

ListFields configures list fields.

func (*PanelBuilder) Permissions

func (b *PanelBuilder) Permissions(p PanelPermissions) *PanelBuilder

Permissions sets panel permissions.

func (*PanelBuilder) Tabs added in v0.2.0

func (b *PanelBuilder) Tabs(tabs ...PanelTab) *PanelBuilder

Tabs sets owner tabs for the panel.

func (*PanelBuilder) TreeView

func (b *PanelBuilder) TreeView(enabled bool) *PanelBuilder

TreeView toggles hierarchical view.

func (*PanelBuilder) UseBlocks

func (b *PanelBuilder) UseBlocks(enabled bool) *PanelBuilder

UseBlocks enables block editing for CMS-backed panels.

func (*PanelBuilder) UseSEO

func (b *PanelBuilder) UseSEO(enabled bool) *PanelBuilder

UseSEO enables SEO metadata for CMS-backed panels.

func (*PanelBuilder) WithActivitySink

func (b *PanelBuilder) WithActivitySink(sink ActivitySink) *PanelBuilder

WithActivitySink wires the activity sink used to record panel events.

func (*PanelBuilder) WithAuthorizer

func (b *PanelBuilder) WithAuthorizer(a Authorizer) *PanelBuilder

WithAuthorizer sets an authorizer for permission checks.

func (*PanelBuilder) WithCRUDService

func (b *PanelBuilder) WithCRUDService(service crud.Service[map[string]any]) *PanelBuilder

WithCRUDService configures the panel to use a go-crud service (Bun-backed).

func (*PanelBuilder) WithCommandBus

func (b *PanelBuilder) WithCommandBus(bus *CommandBus) *PanelBuilder

WithCommandBus attaches the command bus.

func (*PanelBuilder) WithRepository

func (b *PanelBuilder) WithRepository(repo Repository) *PanelBuilder

WithRepository sets the panel repository.

type PanelFormAdapter

type PanelFormAdapter struct {
	ThemeResolver func(context.Context) *ThemeSelection
}

PanelFormAdapter maps panel definitions into a form request, injecting theme tokens and context. This is intentionally light so hosts can pass the payload to go-formgen orchestrators.

func (*PanelFormAdapter) Build

func (a *PanelFormAdapter) Build(panel *Panel, ctx AdminContext, values map[string]any, errors map[string]string) PanelFormRequest

Build assembles a PanelFormRequest for a panel and locale, merging theme payload and provided values/errors.

type PanelFormRequest

type PanelFormRequest struct {
	Schema   Schema                       `json:"schema"`
	Values   map[string]any               `json:"values"`
	Errors   map[string]string            `json:"errors"`
	Locale   string                       `json:"locale"`
	Theme    map[string]map[string]string `json:"theme"`
	Metadata map[string]any               `json:"metadata"`
}

PanelFormRequest captures the data needed to render a panel form via go-formgen.

type PanelHooks

type PanelHooks struct {
	BeforeCreate func(ctx AdminContext, record map[string]any) error
	AfterCreate  func(ctx AdminContext, record map[string]any) error
	BeforeUpdate func(ctx AdminContext, record map[string]any) error
	AfterUpdate  func(ctx AdminContext, record map[string]any) error
	BeforeDelete func(ctx AdminContext, id string) error
	AfterDelete  func(ctx AdminContext, id string) error
}

PanelHooks contains lifecycle callbacks.

type PanelPermissions

type PanelPermissions struct {
	View   string
	Create string
	Edit   string
	Delete string
}

PanelPermissions declares resource actions.

type PanelTab added in v0.2.0

type PanelTab struct {
	ID         string            `json:"id"`
	Label      string            `json:"label,omitempty"`
	LabelKey   string            `json:"label_key,omitempty"`
	Icon       string            `json:"icon,omitempty"`
	Position   int               `json:"position,omitempty"`
	Permission string            `json:"permission,omitempty"`
	Scope      PanelTabScope     `json:"scope,omitempty"`
	Target     PanelTabTarget    `json:"target"`
	Filters    map[string]string `json:"filters,omitempty"`
	Query      map[string]string `json:"query,omitempty"`
	Contexts   []string          `json:"contexts,omitempty"`
}

PanelTab defines panel tab metadata for list/detail/form views.

type PanelTabCollisionHandler added in v0.2.0

type PanelTabCollisionHandler func(panelName string, existing PanelTab, incoming PanelTab) (PanelTab, error)

PanelTabCollisionHandler is invoked when a duplicate tab ID is detected. Return the chosen tab, or an error to abort registration/merge.

type PanelTabPermissionEvaluator added in v0.2.0

type PanelTabPermissionEvaluator func(ctx AdminContext, tab PanelTab, panelName string) bool

PanelTabPermissionEvaluator allows custom permission checks for tabs.

type PanelTabScope added in v0.2.0

type PanelTabScope string

PanelTabScope defines where a tab is intended to render.

const (
	PanelTabScopeList   PanelTabScope = "list"
	PanelTabScopeDetail PanelTabScope = "detail"
	PanelTabScopeForm   PanelTabScope = "form"
)

type PanelTabTarget added in v0.2.0

type PanelTabTarget struct {
	Type  string `json:"type"`            // "panel" | "path" | "external"
	Panel string `json:"panel,omitempty"` // when Type == "panel"
	Path  string `json:"path,omitempty"`  // when Type == "path" or "external"
}

PanelTabTarget describes the navigation target for a tab.

type PermissionDeniedError added in v0.8.0

type PermissionDeniedError struct {
	Permission string
	Resource   string
}

PermissionDeniedError describes a missing authorization permission.

func (PermissionDeniedError) Error added in v0.8.0

func (e PermissionDeniedError) Error() string

func (PermissionDeniedError) Unwrap added in v0.8.0

func (e PermissionDeniedError) Unwrap() error

type PreferenceLevel added in v0.11.0

type PreferenceLevel string

PreferenceLevel represents the scope level for resolved preferences.

const (
	PreferenceLevelSystem PreferenceLevel = "system"
	PreferenceLevelTenant PreferenceLevel = "tenant"
	PreferenceLevelOrg    PreferenceLevel = "org"
	PreferenceLevelUser   PreferenceLevel = "user"
)

type PreferenceScope added in v0.11.0

type PreferenceScope struct {
	UserID   string `json:"user_id,omitempty"`
	TenantID string `json:"tenant_id,omitempty"`
	OrgID    string `json:"org_id,omitempty"`
}

PreferenceScope captures scope identifiers used during resolution.

type PreferenceSnapshot added in v0.11.0

type PreferenceSnapshot struct {
	Effective map[string]any
	Traces    []PreferenceTrace
	Versions  map[string]int
}

PreferenceSnapshot returns effective values plus optional metadata.

type PreferenceTrace added in v0.11.0

type PreferenceTrace struct {
	Key    string                 `json:"key"`
	Layers []PreferenceTraceLayer `json:"layers"`
}

PreferenceTrace records provenance for a single key.

type PreferenceTraceLayer added in v0.11.0

type PreferenceTraceLayer struct {
	Level   PreferenceLevel `json:"level"`
	Scope   PreferenceScope `json:"scope"`
	Found   bool            `json:"found"`
	Value   any             `json:"value,omitempty"`
	Version int             `json:"version,omitempty"`
}

PreferenceTraceLayer records a resolved value at a specific level.

type PreferencesDeleteInput added in v0.11.0

type PreferencesDeleteInput struct {
	Scope PreferenceScope
	Level PreferenceLevel
	Keys  []string
}

PreferencesDeleteInput represents a scoped preference delete.

type PreferencesModule

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

PreferencesModule registers a user preferences panel and navigation entry. It is feature-gated via FeaturePreferences and backed by PreferencesService.

func NewPreferencesModule

func NewPreferencesModule() *PreferencesModule

NewPreferencesModule constructs the default preferences module.

func (*PreferencesModule) Manifest

func (m *PreferencesModule) Manifest() ModuleManifest

func (*PreferencesModule) MenuItems

func (m *PreferencesModule) MenuItems(locale string) []MenuItem

func (*PreferencesModule) Register

func (m *PreferencesModule) Register(ctx ModuleContext) error

func (*PreferencesModule) WithMenuParent

func (m *PreferencesModule) WithMenuParent(parent string) *PreferencesModule

WithMenuParent nests the preferences navigation under a parent menu item ID.

type PreferencesOption added in v0.20.0

type PreferencesOption func(*PreferencesStoreAdapter)

PreferencesOption customizes the PreferencesStore adapter.

func WithKeyPrefix added in v0.20.0

func WithKeyPrefix(prefix string) PreferencesOption

WithKeyPrefix overrides the key prefix used for domain names.

func WithKeys added in v0.20.0

func WithKeys(keys ...string) PreferencesOption

WithKeys restricts loads to the provided feature keys (without prefix).

type PreferencesRepository

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

PreferencesRepository adapts PreferencesService to the panel Repository contract.

func NewPreferencesRepository

func NewPreferencesRepository(admin *Admin) *PreferencesRepository

NewPreferencesRepository constructs a repository backed by PreferencesService.

func (*PreferencesRepository) Create

func (r *PreferencesRepository) Create(ctx context.Context, record map[string]any) (map[string]any, error)

func (*PreferencesRepository) Delete

func (r *PreferencesRepository) Delete(ctx context.Context, id string) error

func (*PreferencesRepository) Get

func (r *PreferencesRepository) Get(ctx context.Context, id string) (map[string]any, error)

func (*PreferencesRepository) List

func (r *PreferencesRepository) List(ctx context.Context, opts ListOptions) ([]map[string]any, int, error)

func (*PreferencesRepository) Update

func (r *PreferencesRepository) Update(ctx context.Context, id string, record map[string]any) (map[string]any, error)

type PreferencesResolveInput added in v0.11.0

type PreferencesResolveInput struct {
	Scope          PreferenceScope
	Keys           []string
	Levels         []PreferenceLevel
	Base           map[string]any
	IncludeTraces  bool
	IncludeVersion bool
}

PreferencesResolveInput configures preference resolution.

type PreferencesService

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

PreferencesService orchestrates access to the PreferencesStore and applies defaults.

func NewPreferencesService

func NewPreferencesService(store PreferencesStore) *PreferencesService

NewPreferencesService constructs a service with the provided store (or in-memory fallback).

func (*PreferencesService) Clear added in v0.10.0

func (s *PreferencesService) Clear(ctx context.Context, userID string, keys []string) (UserPreferences, error)

Clear removes stored preference keys for a user.

func (*PreferencesService) DashboardLayout

func (s *PreferencesService) DashboardLayout(ctx context.Context, userID string) []DashboardWidgetInstance

DashboardLayout returns the stored dashboard layout, if any.

func (*PreferencesService) DashboardOverrides

func (s *PreferencesService) DashboardOverrides(ctx context.Context, userID string) DashboardLayoutOverrides

DashboardOverrides returns persisted go-dashboard layout overrides, if any.

func (*PreferencesService) Get

Get returns preferences for a user with defaults applied.

func (*PreferencesService) Resolve added in v0.11.0

Resolve returns an effective snapshot for the provided scope and options.

func (*PreferencesService) Save

Save updates preferences for a user, merging with existing values.

func (*PreferencesService) SaveDashboardLayout

func (s *PreferencesService) SaveDashboardLayout(ctx context.Context, userID string, layout []DashboardWidgetInstance) (UserPreferences, error)

SaveDashboardLayout stores dashboard layout preferences for a user.

func (*PreferencesService) SaveDashboardOverrides

func (s *PreferencesService) SaveDashboardOverrides(ctx context.Context, userID string, overrides DashboardLayoutOverrides) (UserPreferences, error)

SaveDashboardOverrides stores go-dashboard layout overrides for a user.

func (*PreferencesService) Store

Store returns the underlying preferences store (useful for adapters).

func (*PreferencesService) ThemeSelectorForUser

func (s *PreferencesService) ThemeSelectorForUser(ctx context.Context, userID string) ThemeSelector

ThemeSelectorForUser builds a ThemeSelector using stored preferences when present.

func (*PreferencesService) WithActivitySink

func (s *PreferencesService) WithActivitySink(sink ActivitySink)

WithActivitySink wires activity emission on preference updates.

func (*PreferencesService) WithDefaults

func (s *PreferencesService) WithDefaults(theme, variant string) *PreferencesService

WithDefaults sets the default theme selection used when user preferences are empty.

func (*PreferencesService) WithStore

WithStore swaps the underlying preferences store.

type PreferencesStore

type PreferencesStore interface {
	Resolve(ctx context.Context, input PreferencesResolveInput) (PreferenceSnapshot, error)
	Upsert(ctx context.Context, input PreferencesUpsertInput) (PreferenceSnapshot, error)
	Delete(ctx context.Context, input PreferencesDeleteInput) error
}

PreferencesStore defines the resolver-based preference contract.

type PreferencesStoreAdapter added in v0.20.0

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

PreferencesStoreAdapter adapts PreferencesStore into a state.Store.

func NewPreferencesStoreAdapter added in v0.20.0

func NewPreferencesStoreAdapter(store PreferencesStore, opts ...PreferencesOption) *PreferencesStoreAdapter

NewPreferencesStoreAdapter constructs a new adapter for PreferencesStore.

func (*PreferencesStoreAdapter) Load added in v0.20.0

Load implements state.Store.

func (*PreferencesStoreAdapter) Save added in v0.20.0

func (a *PreferencesStoreAdapter) Save(ctx context.Context, ref state.Ref, snapshot map[string]any, _ state.Meta) (state.Meta, error)

Save implements state.Store.

type PreferencesUpsertInput added in v0.11.0

type PreferencesUpsertInput struct {
	Scope  PreferenceScope
	Level  PreferenceLevel
	Values map[string]any
}

PreferencesUpsertInput represents a scoped preference update.

type ProfileModule

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

ProfileModule registers a user profile panel and navigation entry. Feature-gated via FeatureProfile and backed by ProfileService.

func NewProfileModule

func NewProfileModule() *ProfileModule

NewProfileModule constructs the default profile module.

func (*ProfileModule) Manifest

func (m *ProfileModule) Manifest() ModuleManifest

func (*ProfileModule) MenuItems

func (m *ProfileModule) MenuItems(locale string) []MenuItem

func (*ProfileModule) Register

func (m *ProfileModule) Register(ctx ModuleContext) error

func (*ProfileModule) WithMenuParent

func (m *ProfileModule) WithMenuParent(parent string) *ProfileModule

WithMenuParent nests the profile navigation under a parent menu item ID.

type ProfileRepository

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

ProfileRepository adapts ProfileService to the panel Repository contract.

func NewProfileRepository

func NewProfileRepository(service *ProfileService, defaultLocale string) *ProfileRepository

NewProfileRepository constructs a repository backed by ProfileService.

func (*ProfileRepository) Create

func (r *ProfileRepository) Create(ctx context.Context, record map[string]any) (map[string]any, error)

func (*ProfileRepository) Delete

func (r *ProfileRepository) Delete(ctx context.Context, id string) error

func (*ProfileRepository) Get

func (r *ProfileRepository) Get(ctx context.Context, id string) (map[string]any, error)

func (*ProfileRepository) List

func (r *ProfileRepository) List(ctx context.Context, opts ListOptions) ([]map[string]any, int, error)

func (*ProfileRepository) Update

func (r *ProfileRepository) Update(ctx context.Context, id string, record map[string]any) (map[string]any, error)

type ProfileService

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

ProfileService orchestrates profile retrieval and persistence.

func NewProfileService

func NewProfileService(store ProfileStore) *ProfileService

NewProfileService constructs a service with the provided store (or in-memory fallback).

func (*ProfileService) Get

func (s *ProfileService) Get(ctx context.Context, userID string) (UserProfile, error)

Get returns the profile for a user, applying defaults.

func (*ProfileService) Save

func (s *ProfileService) Save(ctx context.Context, userID string, profile UserProfile) (UserProfile, error)

Save merges and persists a profile for a user.

func (*ProfileService) Store

func (s *ProfileService) Store() ProfileStore

Store exposes the underlying profile store (useful for adapters).

func (*ProfileService) WithActivitySink

func (s *ProfileService) WithActivitySink(sink ActivitySink)

WithActivitySink wires activity emission on profile updates.

func (*ProfileService) WithStore

func (s *ProfileService) WithStore(store ProfileStore) *ProfileService

WithStore swaps the underlying profile store.

type ProfileStore

type ProfileStore interface {
	Get(ctx context.Context, userID string) (UserProfile, error)
	Save(ctx context.Context, profile UserProfile) (UserProfile, error)
}

ProfileStore persists profile data.

type Registry

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

Registry stores registered panels, modules, dashboard providers, and settings.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates an empty registry.

func (*Registry) DashboardProviders

func (r *Registry) DashboardProviders() []DashboardProviderSpec

DashboardProviders returns provider specs sorted by code.

func (*Registry) Module

func (r *Registry) Module(id string) (Module, bool)

Module returns a module by ID when present.

func (*Registry) Modules

func (r *Registry) Modules() []Module

Modules returns modules in registration order.

func (*Registry) Panel

func (r *Registry) Panel(name string) (*Panel, bool)

Panel returns a single panel by name.

func (*Registry) PanelTabs added in v0.2.0

func (r *Registry) PanelTabs(panelName string) []PanelTab

PanelTabs returns registered tabs for a panel, ordered by position then ID.

func (*Registry) Panels

func (r *Registry) Panels() map[string]*Panel

Panels returns a copy of registered panels keyed by name.

func (*Registry) RegisterDashboardProvider

func (r *Registry) RegisterDashboardProvider(spec DashboardProviderSpec)

RegisterDashboardProvider records a provider manifest for discovery/lookups.

func (*Registry) RegisterModule

func (r *Registry) RegisterModule(module Module) error

RegisterModule records a module in registration order; duplicate IDs are rejected.

func (*Registry) RegisterPanel

func (r *Registry) RegisterPanel(name string, panel *Panel) error

RegisterPanel stores a panel by name; duplicate names are rejected.

func (*Registry) RegisterPanelTab added in v0.2.0

func (r *Registry) RegisterPanelTab(panelName string, tab PanelTab) error

RegisterPanelTab records a panel tab for the named panel.

func (*Registry) RegisterSetting

func (r *Registry) RegisterSetting(def SettingDefinition)

RegisterSetting tracks a setting definition for lookups.

func (*Registry) SetPanelTab added in v0.2.0

func (r *Registry) SetPanelTab(panelName string, tab PanelTab) error

SetPanelTab upserts a panel tab for the named panel.

func (*Registry) Settings

func (r *Registry) Settings() []SettingDefinition

Settings returns registered setting definitions sorted by key.

type Repository

type Repository interface {
	List(ctx context.Context, opts ListOptions) ([]map[string]any, int, error)
	Get(ctx context.Context, id string) (map[string]any, error)
	Create(ctx context.Context, record map[string]any) (map[string]any, error)
	Update(ctx context.Context, id string, record map[string]any) (map[string]any, error)
	Delete(ctx context.Context, id string) error
}

Repository provides CRUD operations for panel data.

type RequestEntry added in v0.14.0

type RequestEntry struct {
	ID        string            `json:"id"`
	Timestamp time.Time         `json:"timestamp"`
	Method    string            `json:"method"`
	Path      string            `json:"path"`
	Status    int               `json:"status"`
	Duration  time.Duration     `json:"duration"`
	Headers   map[string]string `json:"headers,omitempty"`
	Query     map[string]string `json:"query,omitempty"`
	Error     string            `json:"error,omitempty"`
}

RequestEntry captures HTTP request details.

type ResolvedSetting

type ResolvedSetting struct {
	Key        string            `json:"key"`
	Value      any               `json:"value"`
	Scope      SettingsScope     `json:"scope"`
	Provenance string            `json:"provenance"`
	Definition SettingDefinition `json:"definition,omitempty"`
}

ResolvedSetting contains a resolved value and provenance.

type ResolvedWidget

type ResolvedWidget struct {
	// ID is the unique identifier for this widget instance
	ID string `json:"id"`

	// Definition is the widget type (e.g., "admin.widget.user_stats")
	Definition string `json:"definition"`

	// Area is the area code this widget belongs to
	Area string `json:"area"`

	// Data contains the widget's rendered data
	Data map[string]any `json:"data"`

	// Config contains widget configuration
	Config map[string]any `json:"config,omitempty"`

	// Metadata contains layout and state information
	Metadata *WidgetMetadata `json:"metadata,omitempty"`

	// Hidden indicates if the widget is hidden by user preference
	Hidden bool `json:"hidden,omitempty"`

	// Span defines the column span (1-12) for grid layout
	Span int `json:"span,omitempty"`
}

ResolvedWidget represents a widget instance with rendered content. This is the fully-prepared widget ready for HTML output.

type RingBuffer added in v0.14.0

type RingBuffer[T any] struct {
	// contains filtered or unexported fields
}

RingBuffer stores the most recent values up to a fixed capacity.

func NewRingBuffer added in v0.14.0

func NewRingBuffer[T any](capacity int) *RingBuffer[T]

NewRingBuffer creates a ring buffer with the provided capacity.

func (*RingBuffer[T]) Add added in v0.14.0

func (r *RingBuffer[T]) Add(value T)

Add appends a value, overwriting the oldest when full.

func (*RingBuffer[T]) Cap added in v0.14.0

func (r *RingBuffer[T]) Cap() int

Cap returns the buffer capacity.

func (*RingBuffer[T]) Clear added in v0.14.0

func (r *RingBuffer[T]) Clear()

Clear removes all buffered values.

func (*RingBuffer[T]) Len added in v0.14.0

func (r *RingBuffer[T]) Len() int

Len returns the current number of stored values.

func (*RingBuffer[T]) Values added in v0.14.0

func (r *RingBuffer[T]) Values() []T

Values returns the buffered values ordered from oldest to newest.

type RoleAssignmentLookup added in v0.2.0

type RoleAssignmentLookup interface {
	IsAssignable(ctx context.Context, roleID string) (bool, error)
}

RoleAssignmentLookup decides whether a role ID should be treated as an assignable custom role.

type RolePanelRepository

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

RolePanelRepository adapts roles to the panel Repository contract.

func NewRolePanelRepository

func NewRolePanelRepository(service *UserManagementService) *RolePanelRepository

NewRolePanelRepository constructs a repository backed by UserManagementService roles.

func (*RolePanelRepository) Create

func (r *RolePanelRepository) Create(ctx context.Context, record map[string]any) (map[string]any, error)

Create adds a role.

func (*RolePanelRepository) Delete

func (r *RolePanelRepository) Delete(ctx context.Context, id string) error

Delete removes a role.

func (*RolePanelRepository) Get

func (r *RolePanelRepository) Get(ctx context.Context, id string) (map[string]any, error)

Get returns a role.

func (*RolePanelRepository) List

func (r *RolePanelRepository) List(ctx context.Context, opts ListOptions) ([]map[string]any, int, error)

List returns roles.

func (*RolePanelRepository) Update

func (r *RolePanelRepository) Update(ctx context.Context, id string, record map[string]any) (map[string]any, error)

Update modifies a role.

type RoleRecord

type RoleRecord struct {
	ID          string
	Name        string
	Description string
	Permissions []string
	IsSystem    bool
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

RoleRecord captures custom roles and their permissions.

type RoleRepository

type RoleRepository interface {
	List(ctx context.Context, opts ListOptions) ([]RoleRecord, int, error)
	Get(ctx context.Context, id string) (RoleRecord, error)
	Create(ctx context.Context, role RoleRecord) (RoleRecord, error)
	Update(ctx context.Context, role RoleRecord) (RoleRecord, error)
	Delete(ctx context.Context, id string) error
	Assign(ctx context.Context, userID, roleID string) error
	Unassign(ctx context.Context, userID, roleID string) error
	RolesForUser(ctx context.Context, userID string) ([]RoleRecord, error)
}

RoleRepository exposes CRUD and assignment helpers for custom roles.

type RoleRepositoryLookup added in v0.2.0

type RoleRepositoryLookup struct {
	Roles RoleRepository
}

RoleRepositoryLookup uses a RoleRepository to validate assignable IDs.

func (RoleRepositoryLookup) IsAssignable added in v0.2.0

func (l RoleRepositoryLookup) IsAssignable(ctx context.Context, roleID string) (bool, error)

type RouteEntry added in v0.14.0

type RouteEntry struct {
	Method     string   `json:"method"`
	Path       string   `json:"path"`
	Name       string   `json:"name,omitempty"`
	Handler    string   `json:"handler,omitempty"`
	Middleware []string `json:"middleware,omitempty"`
	Summary    string   `json:"summary,omitempty"`
	Tags       []string `json:"tags,omitempty"`
}

RouteEntry captures router information for the routes panel.

type RouterContext

type RouterContext interface {
	Query(name string, defaultValue ...string) string
	Header(string) string
}

type SQLEntry added in v0.14.0

type SQLEntry struct {
	ID        string        `json:"id"`
	Timestamp time.Time     `json:"timestamp"`
	Query     string        `json:"query"`
	Args      []any         `json:"args,omitempty"`
	Duration  time.Duration `json:"duration"`
	RowCount  int           `json:"row_count"`
	Error     string        `json:"error,omitempty"`
}

SQLEntry captures database query details.

type Schema

type Schema struct {
	ListFields   []Field                      `json:"list_fields"`
	FormFields   []Field                      `json:"form_fields"`
	DetailFields []Field                      `json:"detail_fields"`
	Filters      []Filter                     `json:"filters,omitempty"`
	Actions      []Action                     `json:"actions,omitempty"`
	BulkActions  []Action                     `json:"bulk_actions,omitempty"`
	Tabs         []PanelTab                   `json:"tabs,omitempty"`
	FormSchema   map[string]any               `json:"form_schema,omitempty"`
	UseBlocks    bool                         `json:"use_blocks,omitempty"`
	UseSEO       bool                         `json:"use_seo,omitempty"`
	TreeView     bool                         `json:"tree_view,omitempty"`
	Permissions  PanelPermissions             `json:"permissions,omitempty"`
	Theme        map[string]map[string]string `json:"theme,omitempty"`
	Export       *ExportConfig                `json:"export,omitempty"`
	Bulk         *BulkConfig                  `json:"bulk,omitempty"`
	Media        *MediaConfig                 `json:"media,omitempty"`
}

Schema renders list/form/detail schema descriptions.

type SearchAdapter

type SearchAdapter interface {
	Search(ctx context.Context, query string, limit int) ([]SearchResult, error)
	Permission() string
}

SearchAdapter performs a search for a specific entity type.

type SearchEngine

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

SearchEngine aggregates adapters and executes queries across them.

func NewSearchEngine

func NewSearchEngine(authorizer Authorizer) *SearchEngine

NewSearchEngine constructs a search engine.

func (*SearchEngine) Enable

func (s *SearchEngine) Enable(enabled bool)

Enable toggles whether search is available.

func (*SearchEngine) Query

func (s *SearchEngine) Query(ctx AdminContext, query string, limit int) ([]SearchResult, error)

Query searches all adapters respecting permissions.

func (*SearchEngine) Register

func (s *SearchEngine) Register(key string, adapter SearchAdapter)

Register registers a search adapter under a key.

type SearchResult

type SearchResult struct {
	Type        string `json:"type"`
	ID          string `json:"id"`
	Title       string `json:"title"`
	Description string `json:"description,omitempty"`
	URL         string `json:"url,omitempty"`
	Icon        string `json:"icon,omitempty"`
	Thumbnail   string `json:"thumbnail,omitempty"`
}

SearchResult represents a single search hit.

type SettingDefinition

type SettingDefinition struct {
	Key             string                 `json:"key"`
	Title           string                 `json:"title,omitempty"`
	Description     string                 `json:"description,omitempty"`
	Default         any                    `json:"default,omitempty"`
	Type            string                 `json:"type,omitempty"`
	Group           string                 `json:"group,omitempty"`
	AllowedScopes   []SettingsScope        `json:"allowed_scopes,omitempty"`
	Enum            []any                  `json:"enum,omitempty"`
	Widget          string                 `json:"widget,omitempty"`
	VisibilityRule  string                 `json:"visibility_rule,omitempty"`
	Options         []SettingOption        `json:"options,omitempty"`
	OptionsProvider SettingOptionsProvider `json:"-"`
	Enrichers       []SettingFieldEnricher `json:"-"`
	Validator       SettingValidator       `json:"-"`
}

SettingDefinition describes a single setting and its defaults.

type SettingFieldEnricher

type SettingFieldEnricher func(ctx context.Context, field map[string]any)

SettingFieldEnricher can mutate the schema payload for a definition.

type SettingOption

type SettingOption struct {
	Label       string `json:"label,omitempty"`
	Value       any    `json:"value"`
	Description string `json:"description,omitempty"`
}

SettingOption represents an allowed value for select-like controls.

type SettingOptionsProvider

type SettingOptionsProvider func(ctx context.Context) ([]SettingOption, error)

SettingOptionsProvider dynamically resolves options for a definition.

type SettingRecord

type SettingRecord struct {
	bun.BaseModel `bun:"table:admin_settings"`

	ID        uuid.UUID       `bun:",pk,type:uuid"`
	Key       string          `bun:",notnull,unique:admin_settings_scope"`
	Scope     string          `bun:",notnull,unique:admin_settings_scope"`
	UserID    string          `bun:",nullzero,unique:admin_settings_scope"`
	Value     json.RawMessage `bun:"type:jsonb,nullzero"`
	CreatedAt time.Time       `bun:",nullzero,notnull,default:current_timestamp"`
	UpdatedAt time.Time       `bun:",nullzero,notnull,default:current_timestamp"`
}

type SettingValidator

type SettingValidator func(ctx context.Context, value any) error

SettingValidator applies custom validation logic for a definition.

type SettingsAdapter

type SettingsAdapter interface {
	RegisterDefinition(def SettingDefinition)
	Definitions() []SettingDefinition
	Apply(ctx context.Context, bundle SettingsBundle) error
	Resolve(key, userID string) ResolvedSetting
	ResolveAll(userID string) map[string]ResolvedSetting
	Schema(ctx context.Context, userID string) (opts.SchemaDocument, error)
	WithSchemaOptions(opts ...opts.Option)
}

SettingsAdapter allows the settings service to delegate persistence and resolution.

type SettingsBundle

type SettingsBundle struct {
	Scope  SettingsScope
	UserID string
	Values map[string]any
}

SettingsBundle captures a bulk mutation request.

type SettingsForm

type SettingsForm struct {
	Schema       map[string]any               `json:"schema"`
	SchemaFormat opts.SchemaFormat            `json:"schema_format,omitempty"`
	Scopes       []opts.SchemaScope           `json:"scopes,omitempty"`
	Values       map[string]ResolvedSetting   `json:"values"`
	Theme        map[string]map[string]string `json:"theme,omitempty"`
}

SettingsForm bundles schema, values, and theme for rendering.

type SettingsFormAdapter

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

SettingsFormAdapter maps definitions to a form-like payload with theme tokens.

func NewSettingsFormAdapter

func NewSettingsFormAdapter(service *SettingsService, theme string, tokens map[string]string) *SettingsFormAdapter

NewSettingsFormAdapter constructs a form adapter for settings.

func (*SettingsFormAdapter) Form

func (a *SettingsFormAdapter) Form(userID string) SettingsForm

Form returns a schema/value payload suitable for feeding form renderers.

func (*SettingsFormAdapter) FormWithContext

func (a *SettingsFormAdapter) FormWithContext(ctx context.Context, userID string) SettingsForm

FormWithContext is context-aware to allow theme providers to resolve per-request.

func (*SettingsFormAdapter) WithThemeResolver

func (a *SettingsFormAdapter) WithThemeResolver(resolver func(ctx context.Context) *ThemeSelection) *SettingsFormAdapter

WithThemeResolver injects a resolver that can fetch the current theme selection.

type SettingsScope

type SettingsScope string

SettingsScope represents the provenance of a setting value.

const (
	SettingsScopeSystem  SettingsScope = "system"
	SettingsScopeSite    SettingsScope = "site"
	SettingsScopeUser    SettingsScope = "user"
	SettingsScopeDefault SettingsScope = "default"
)

type SettingsService

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

SettingsService stores definitions and layered values (system/site/user).

func NewSettingsService

func NewSettingsService() *SettingsService

NewSettingsService constructs an empty settings service.

func (*SettingsService) Apply

func (s *SettingsService) Apply(ctx context.Context, bundle SettingsBundle) error

Apply validates and persists a bundle of settings.

func (*SettingsService) Definitions

func (s *SettingsService) Definitions() []SettingDefinition

Definitions returns all registered definitions sorted by key.

func (*SettingsService) Enable

func (s *SettingsService) Enable(enabled bool)

Enable toggles whether settings are available.

func (*SettingsService) RegisterDefinition

func (s *SettingsService) RegisterDefinition(def SettingDefinition)

RegisterDefinition adds or updates a definition.

func (*SettingsService) Resolve

func (s *SettingsService) Resolve(key, userID string) ResolvedSetting

Resolve returns a setting value with provenance.

func (*SettingsService) ResolveAll

func (s *SettingsService) ResolveAll(userID string) map[string]ResolvedSetting

ResolveAll returns all settings with provenance.

func (*SettingsService) Schema

func (s *SettingsService) Schema(ctx context.Context, userID string) (opts.SchemaDocument, error)

Schema returns the go-options schema document for the current settings stack.

func (*SettingsService) UseAdapter

func (s *SettingsService) UseAdapter(adapter SettingsAdapter)

UseAdapter delegates settings persistence and resolution to an external adapter.

func (*SettingsService) WithActivitySink

func (s *SettingsService) WithActivitySink(sink ActivitySink)

WithActivitySink wires a shared activity sink for settings mutations.

func (*SettingsService) WithRegistry

func (s *SettingsService) WithRegistry(reg *Registry)

WithRegistry wires the shared registry so definitions are discoverable.

func (*SettingsService) WithSchemaOptions

func (s *SettingsService) WithSchemaOptions(opts ...opts.Option)

WithSchemaOptions appends options used when generating schemas from go-options.

type SettingsUpdateCommand

type SettingsUpdateCommand struct {
	Service    *SettingsService
	Permission string
}

SettingsUpdateCommand wraps settings mutations in a go-command handler.

func (*SettingsUpdateCommand) CLIHandler added in v0.12.0

func (c *SettingsUpdateCommand) CLIHandler() any

CLIOptions exposes CLI metadata for the update command.

func (*SettingsUpdateCommand) CLIOptions

func (c *SettingsUpdateCommand) CLIOptions() command.CLIConfig

CLIOptions exposes CLI metadata for the update command.

func (*SettingsUpdateCommand) Execute

Execute applies the bundle found in the message.

type SettingsUpdateMsg added in v0.12.0

type SettingsUpdateMsg struct {
	Bundle SettingsBundle
}

SettingsUpdateMsg updates settings via the command bus.

func (SettingsUpdateMsg) Type added in v0.12.0

func (SettingsUpdateMsg) Type() string

func (SettingsUpdateMsg) Validate added in v0.12.0

func (m SettingsUpdateMsg) Validate() error

type SettingsValidationErrors

type SettingsValidationErrors struct {
	Fields map[string]string `json:"fields"`
	Scope  SettingsScope     `json:"scope,omitempty"`
}

SettingsValidationErrors aggregates field-level validation issues.

func (SettingsValidationErrors) Error

func (e SettingsValidationErrors) Error() string

type SignedTokenStrategy added in v0.16.0

type SignedTokenStrategy struct {
	Secret   []byte
	Audience string
	Issuer   string
}

SignedTokenStrategy allows overrides when a signed token validates.

func (SignedTokenStrategy) Allows added in v0.16.0

type StaticKeyStrategy added in v0.16.0

type StaticKeyStrategy struct {
	Key       string
	ExpiresAt time.Time
}

StaticKeyStrategy allows overrides when a shared key matches.

func (StaticKeyStrategy) Allows added in v0.16.0

type TenantMember

type TenantMember struct {
	UserID      string   `json:"user_id"`
	Roles       []string `json:"roles,omitempty"`
	Permissions []string `json:"permissions,omitempty"`
}

TenantMember captures membership assignments for a tenant, including scoped roles/permissions.

type TenantPanelRepository

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

TenantPanelRepository adapts TenantService to the panel Repository contract.

func NewTenantPanelRepository

func NewTenantPanelRepository(service *TenantService) *TenantPanelRepository

NewTenantPanelRepository constructs a repository backed by TenantService.

func (*TenantPanelRepository) Create

func (r *TenantPanelRepository) Create(ctx context.Context, record map[string]any) (map[string]any, error)

func (*TenantPanelRepository) Delete

func (r *TenantPanelRepository) Delete(ctx context.Context, id string) error

func (*TenantPanelRepository) Get

func (r *TenantPanelRepository) Get(ctx context.Context, id string) (map[string]any, error)

func (*TenantPanelRepository) List

func (r *TenantPanelRepository) List(ctx context.Context, opts ListOptions) ([]map[string]any, int, error)

func (*TenantPanelRepository) Update

func (r *TenantPanelRepository) Update(ctx context.Context, id string, record map[string]any) (map[string]any, error)

type TenantRecord

type TenantRecord struct {
	ID        string         `json:"id"`
	Name      string         `json:"name"`
	Slug      string         `json:"slug,omitempty"`
	Domain    string         `json:"domain,omitempty"`
	Status    string         `json:"status,omitempty"`
	Members   []TenantMember `json:"members,omitempty"`
	Metadata  map[string]any `json:"metadata,omitempty"`
	CreatedAt time.Time      `json:"created_at,omitempty"`
	UpdatedAt time.Time      `json:"updated_at,omitempty"`
}

TenantRecord represents a managed tenant.

type TenantRepository

type TenantRepository interface {
	List(ctx context.Context, opts ListOptions) ([]TenantRecord, int, error)
	Get(ctx context.Context, id string) (TenantRecord, error)
	Create(ctx context.Context, tenant TenantRecord) (TenantRecord, error)
	Update(ctx context.Context, tenant TenantRecord) (TenantRecord, error)
	Delete(ctx context.Context, id string) error
	Search(ctx context.Context, query string, limit int) ([]TenantRecord, error)
}

TenantRepository exposes CRUD/search operations for tenants with membership awareness.

type TenantService

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

TenantService orchestrates tenant management and activity emission.

func NewTenantService

func NewTenantService(repo TenantRepository) *TenantService

NewTenantService constructs a service with the provided repository or an in-memory fallback.

func (*TenantService) AssignMember

func (s *TenantService) AssignMember(ctx context.Context, tenantID string, member TenantMember) (TenantRecord, error)

AssignMember adds or updates a tenant membership.

func (*TenantService) DeleteTenant

func (s *TenantService) DeleteTenant(ctx context.Context, id string) error

DeleteTenant removes a tenant by ID.

func (*TenantService) GetTenant

func (s *TenantService) GetTenant(ctx context.Context, id string) (TenantRecord, error)

GetTenant fetches a tenant by ID.

func (*TenantService) ListTenants

func (s *TenantService) ListTenants(ctx context.Context, opts ListOptions) ([]TenantRecord, int, error)

ListTenants returns tenants with filters applied.

func (*TenantService) RemoveMember

func (s *TenantService) RemoveMember(ctx context.Context, tenantID, userID string) (TenantRecord, error)

RemoveMember detaches a user from a tenant.

func (*TenantService) SaveTenant

func (s *TenantService) SaveTenant(ctx context.Context, tenant TenantRecord) (TenantRecord, error)

SaveTenant creates or updates a tenant record.

func (*TenantService) SearchTenants

func (s *TenantService) SearchTenants(ctx context.Context, query string, limit int) ([]TenantRecord, error)

SearchTenants performs a keyword search against tenants.

func (*TenantService) WithActivitySink

func (s *TenantService) WithActivitySink(sink ActivitySink)

WithActivitySink wires activity emission for tenant mutations.

type TenantsModule

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

TenantsModule registers the tenants panel and navigation.

func NewTenantsModule

func NewTenantsModule() *TenantsModule

NewTenantsModule constructs the default tenants module.

func (*TenantsModule) Manifest

func (m *TenantsModule) Manifest() ModuleManifest

Manifest describes the module metadata.

func (*TenantsModule) MenuItems

func (m *TenantsModule) MenuItems(locale string) []MenuItem

MenuItems contributes navigation for tenants.

func (*TenantsModule) Register

func (m *TenantsModule) Register(ctx ModuleContext) error

Register wires the tenants panel and search adapter.

func (*TenantsModule) WithMenuParent

func (m *TenantsModule) WithMenuParent(parent string) *TenantsModule

WithMenuParent nests tenant navigation under a parent menu item ID.

type ThemeProvider

type ThemeProvider func(ctx context.Context, selector ThemeSelector) (*ThemeSelection, error)

ThemeProvider resolves the theme selection, typically backed by go-theme.

type ThemeSelection

type ThemeSelection struct {
	Name        string
	Variant     string
	Tokens      map[string]string
	Assets      map[string]string
	Partials    map[string]string
	ChartTheme  string
	AssetPrefix string
}

ThemeSelection captures resolved theme assets/tokens.

type ThemeSelector

type ThemeSelector struct {
	Name    string
	Variant string
}

ThemeSelector describes the requested theme/variant.

func ThemeSelectorFromContext

func ThemeSelectorFromContext(ctx context.Context) ThemeSelector

ThemeSelectorFromContext extracts a theme selector override from context, if present.

type Translator

type Translator = helpers.Translator

Translator resolves i18n keys into localized strings. Implementations can wrap go-i18n or any translation engine.

type TranslatorAware

type TranslatorAware = modinternal.TranslatorAware

TranslatorAware is implemented by modules that want a translator injected before registration.

type URLConfig added in v0.21.0

type URLConfig struct {
	APIPrefix  string
	APIVersion string
	URLKit     *urlkit.Config
}

URLConfig controls admin URL generation defaults.

type UUIDRoleAssignmentLookup added in v0.2.0

type UUIDRoleAssignmentLookup struct{}

UUIDRoleAssignmentLookup treats only UUID role IDs as assignable.

func (UUIDRoleAssignmentLookup) IsAssignable added in v0.2.0

func (UUIDRoleAssignmentLookup) IsAssignable(_ context.Context, roleID string) (bool, error)

type UserActivateMsg added in v0.12.0

type UserActivateMsg struct {
	IDs []string
}

UserActivateMsg updates users to active state.

func (UserActivateMsg) Type added in v0.12.0

func (UserActivateMsg) Type() string

func (UserActivateMsg) Validate added in v0.12.0

func (m UserActivateMsg) Validate() error

type UserArchiveMsg added in v0.12.0

type UserArchiveMsg struct {
	IDs []string
}

UserArchiveMsg updates users to archived state.

func (UserArchiveMsg) Type added in v0.12.0

func (UserArchiveMsg) Type() string

func (UserArchiveMsg) Validate added in v0.12.0

func (m UserArchiveMsg) Validate() error

type UserDisableMsg added in v0.12.0

type UserDisableMsg struct {
	IDs []string
}

UserDisableMsg updates users to disabled state.

func (UserDisableMsg) Type added in v0.12.0

func (UserDisableMsg) Type() string

func (UserDisableMsg) Validate added in v0.12.0

func (m UserDisableMsg) Validate() error

type UserManagementModule

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

UserManagementModule registers user and role management panels and navigation.

func NewUserManagementModule

func NewUserManagementModule() *UserManagementModule

NewUserManagementModule constructs the default user management module.

func (*UserManagementModule) Manifest

func (m *UserManagementModule) Manifest() ModuleManifest

Manifest describes the module metadata.

func (*UserManagementModule) MenuItems

func (m *UserManagementModule) MenuItems(locale string) []MenuItem

MenuItems contributes navigation for users and roles.

func (*UserManagementModule) Register

func (m *UserManagementModule) Register(ctx ModuleContext) error

Register wires the users and roles panels, search adapter, and permissions.

func (*UserManagementModule) WithMenuParent

func (m *UserManagementModule) WithMenuParent(parent string) *UserManagementModule

WithMenuParent nests the module navigation under a parent menu item ID.

type UserManagementService

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

UserManagementService orchestrates user/role management and activity emission.

func NewUserManagementService

func NewUserManagementService(users UserRepository, roles RoleRepository) *UserManagementService

NewUserManagementService constructs a service with the provided repositories or in-memory defaults.

func (*UserManagementService) DeleteRole

func (s *UserManagementService) DeleteRole(ctx context.Context, id string) error

DeleteRole removes a role and related assignments.

func (*UserManagementService) DeleteUser

func (s *UserManagementService) DeleteUser(ctx context.Context, id string) error

DeleteUser removes a user and related assignments.

func (*UserManagementService) GetUser

GetUser fetches a user and attached roles.

func (*UserManagementService) ListRoles

func (s *UserManagementService) ListRoles(ctx context.Context, opts ListOptions) ([]RoleRecord, int, error)

ListRoles returns registered roles.

func (*UserManagementService) ListUsers

func (s *UserManagementService) ListUsers(ctx context.Context, opts ListOptions) ([]UserRecord, int, error)

ListUsers returns users with role assignments populated.

func (*UserManagementService) SaveRole

func (s *UserManagementService) SaveRole(ctx context.Context, role RoleRecord) (RoleRecord, error)

SaveRole creates or updates a role.

func (*UserManagementService) SaveUser

func (s *UserManagementService) SaveUser(ctx context.Context, user UserRecord) (UserRecord, error)

SaveUser creates or updates a user and syncs role assignments.

func (*UserManagementService) SearchUsers

func (s *UserManagementService) SearchUsers(ctx context.Context, query string, limit int) ([]UserRecord, error)

SearchUsers performs a keyword search against users.

func (*UserManagementService) TransitionUser

func (s *UserManagementService) TransitionUser(ctx context.Context, id string, status string) (UserRecord, error)

TransitionUser updates the lifecycle state for a user and records activity.

func (*UserManagementService) WithActivitySink

func (s *UserManagementService) WithActivitySink(sink ActivitySink)

WithActivitySink wires activity emission for user and role mutations.

func (*UserManagementService) WithRoleAssignmentLookup added in v0.2.0

func (s *UserManagementService) WithRoleAssignmentLookup(lookup RoleAssignmentLookup) *UserManagementService

WithRoleAssignmentLookup sets the lookup used to validate custom role assignments.

type UserPanelRepository

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

UserPanelRepository adapts UserManagementService to the panel Repository contract.

func NewUserPanelRepository

func NewUserPanelRepository(service *UserManagementService) *UserPanelRepository

NewUserPanelRepository constructs a new panel repository.

func (*UserPanelRepository) Create

func (r *UserPanelRepository) Create(ctx context.Context, record map[string]any) (map[string]any, error)

Create adds a user.

func (*UserPanelRepository) Delete

func (r *UserPanelRepository) Delete(ctx context.Context, id string) error

Delete removes a user.

func (*UserPanelRepository) Get

func (r *UserPanelRepository) Get(ctx context.Context, id string) (map[string]any, error)

Get fetches a single user record.

func (*UserPanelRepository) List

func (r *UserPanelRepository) List(ctx context.Context, opts ListOptions) ([]map[string]any, int, error)

List returns user records.

func (*UserPanelRepository) Update

func (r *UserPanelRepository) Update(ctx context.Context, id string, record map[string]any) (map[string]any, error)

Update modifies a user.

type UserPreferences

type UserPreferences struct {
	UserID          string                    `json:"user_id,omitempty"`
	Theme           string                    `json:"theme,omitempty"`
	ThemeVariant    string                    `json:"theme_variant,omitempty"`
	DashboardLayout []DashboardWidgetInstance `json:"dashboard_layout,omitempty"`
	DashboardPrefs  DashboardLayoutOverrides  `json:"dashboard_overrides,omitempty"`
	Raw             map[string]any            `json:"raw,omitempty"`
}

UserPreferences captures persisted preferences along with derived defaults.

type UserProfile

type UserProfile struct {
	UserID      string
	DisplayName string
	Email       string
	AvatarURL   string
	Locale      string
	Timezone    string
	Bio         string
	Contact     map[string]any
	Metadata    map[string]any
	Raw         map[string]any
}

UserProfile mirrors the go-users profile model using string IDs for admin context.

type UserRecord

type UserRecord struct {
	ID          string
	Email       string
	Username    string
	FirstName   string
	LastName    string
	Status      string
	Role        string
	Roles       []string
	Permissions []string
	Metadata    map[string]any
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

UserRecord captures the fields managed by the user administration module.

type UserRepository

type UserRepository interface {
	List(ctx context.Context, opts ListOptions) ([]UserRecord, int, error)
	Get(ctx context.Context, id string) (UserRecord, error)
	Create(ctx context.Context, user UserRecord) (UserRecord, error)
	Update(ctx context.Context, user UserRecord) (UserRecord, error)
	Delete(ctx context.Context, id string) error
	Search(ctx context.Context, query string, limit int) ([]UserRecord, error)
}

UserRepository exposes CRUD operations for auth users.

type UserSuspendMsg added in v0.12.0

type UserSuspendMsg struct {
	IDs []string
}

UserSuspendMsg updates users to suspended state.

func (UserSuspendMsg) Type added in v0.12.0

func (UserSuspendMsg) Type() string

func (UserSuspendMsg) Validate added in v0.12.0

func (m UserSuspendMsg) Validate() error

type WidgetArea

type WidgetArea struct {
	// Code is the unique identifier for this area (e.g., "admin.dashboard.main")
	Code string `json:"code"`

	// Title is the display name for this area
	Title string `json:"title"`

	// Widgets contains all resolved widgets in this area
	Widgets []*ResolvedWidget `json:"widgets"`
}

WidgetArea represents a named area containing widgets (e.g., "admin.dashboard.main")

type WidgetAreaDefinition

type WidgetAreaDefinition = cmsboot.WidgetAreaDefinition

WidgetAreaDefinition captures CMS widget area metadata.

type WidgetDefinition

type WidgetDefinition = cmsboot.WidgetDefinition

WidgetDefinition captures admin widget metadata.

type WidgetDefinitionRepository

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

WidgetDefinitionRepository manages widget definitions through CMSWidgetService.

func NewWidgetDefinitionRepository

func NewWidgetDefinitionRepository(widgets CMSWidgetService) *WidgetDefinitionRepository

NewWidgetDefinitionRepository builds a widget definition repository.

func (*WidgetDefinitionRepository) Create

func (r *WidgetDefinitionRepository) Create(ctx context.Context, record map[string]any) (map[string]any, error)

Create registers a widget definition.

func (*WidgetDefinitionRepository) Delete

Delete removes a widget definition.

func (*WidgetDefinitionRepository) Get

Get returns a widget definition by code.

func (*WidgetDefinitionRepository) List

List returns widget definitions.

func (*WidgetDefinitionRepository) Update

func (r *WidgetDefinitionRepository) Update(ctx context.Context, id string, record map[string]any) (map[string]any, error)

Update updates a widget definition (overwrites).

type WidgetInstance

type WidgetInstance = cmsboot.WidgetInstance

WidgetInstance links a widget definition to a specific area/page.

type WidgetInstanceFilter

type WidgetInstanceFilter = cmsboot.WidgetInstanceFilter

WidgetInstanceFilter narrows widget instance queries.

type WidgetInstanceRepository

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

WidgetInstanceRepository manages widget instances.

func NewWidgetInstanceRepository

func NewWidgetInstanceRepository(widgets CMSWidgetService) *WidgetInstanceRepository

NewWidgetInstanceRepository builds a widget instance repository.

func (*WidgetInstanceRepository) Create

func (r *WidgetInstanceRepository) Create(ctx context.Context, record map[string]any) (map[string]any, error)

Create saves a widget instance.

func (*WidgetInstanceRepository) Delete

Delete removes a widget instance.

func (*WidgetInstanceRepository) Get

Get returns a widget instance by id.

func (*WidgetInstanceRepository) List

func (r *WidgetInstanceRepository) List(ctx context.Context, opts ListOptions) ([]map[string]any, int, error)

List returns widget instances filtered by area/page/locale.

func (*WidgetInstanceRepository) Update

func (r *WidgetInstanceRepository) Update(ctx context.Context, id string, record map[string]any) (map[string]any, error)

Update modifies a widget instance.

type WidgetLayout

type WidgetLayout struct {
	// Width is the column span (1-12)
	Width int `json:"width,omitempty"`

	// Height is reserved for future row spanning
	Height int `json:"height,omitempty"`
}

WidgetLayout contains grid positioning information

type WidgetMetadata

type WidgetMetadata struct {
	// Layout contains positioning information
	Layout *WidgetLayout `json:"layout,omitempty"`

	// Order is the display order within the area
	Order int `json:"order,omitempty"`
}

WidgetMetadata contains layout and state information for a widget

type WidgetProvider

type WidgetProvider func(ctx AdminContext, cfg map[string]any) (map[string]any, error)

WidgetProvider produces data for a widget given viewer context/config.

Source Files

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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