admin

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 License: MIT Imports: 133 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ActionDisabledReasonCodeTranslationMissing = "TRANSLATION_MISSING"
	ActionDisabledReasonCodeInvalidStatus      = "INVALID_STATUS"
	ActionDisabledReasonCodePermissionDenied   = "PERMISSION_DENIED"
	ActionDisabledReasonCodeMissingContext     = "MISSING_CONTEXT"
	ActionDisabledReasonCodeFeatureDisabled    = TextCodeFeatureDisabled
)

Canonical action disabled reason codes consumed by frontend action renderers.

View Source
const (
	ActivityActorTypeKey       = "actor_type"
	ActivityActorTypeKeyLegacy = "actorType"
	ActivityActorTypeSystem    = "system"
	ActivityActorTypeJob       = "job"
	ActivityActorTypeTask      = "task"
)
View Source
const (
	ActivityObjectTypeUser             = "user"
	ActivityObjectTypeRole             = "role"
	ActivityObjectTypeTenant           = "tenant"
	ActivityObjectTypeOrganization     = "organization"
	ActivityObjectTypeSettings         = "settings"
	ActivityObjectTypeDashboard        = "dashboard"
	ActivityObjectTypePanel            = "panel"
	ActivityObjectTypeNotification     = "notification"
	ActivityObjectTypePreferences      = "preferences"
	ActivityObjectTypeProfile          = "profile"
	ActivityObjectTypeJob              = "job"
	ActivityObjectTypeWidgetArea       = "widget_area"
	ActivityObjectTypeWidgetDefinition = "widget_def"
	ActivityObjectTypeWidgetInstance   = "widget_instance"
	ActivityObjectTypeMenu             = "menu"
	ActivityObjectTypeMenuItem         = "menu_item"
	ActivityObjectTypePage             = "page"
	ActivityObjectTypeContent          = "content"
	ActivityObjectTypeBlockDefinition  = "block_def"
	ActivityObjectTypeBlock            = "block"
)
View Source
const (
	DebugPanelTemplate = "template"
	DebugPanelSession  = "session"
	DebugPanelRequests = "requests"
	DebugPanelSQL      = "sql"
	DebugPanelLogs     = "logs"
	DebugPanelConfig   = "config"
	DebugPanelRoutes   = "routes"
	DebugPanelCustom   = "custom"
	DebugPanelJSErrors = "jserrors"
	DebugPanelShell    = "shell"
	DebugPanelConsole  = "console"
	DebugPanelDoctor   = "doctor"
)
View Source
const (
	DebugREPLKindShell = "shell"
	DebugREPLKindApp   = "app"
)
View Source
const (
	DebugREPLOverrideKeyMetadata   = "override_key"
	DebugREPLOverrideTokenMetadata = "override_token"
)
View Source
const (
	TextCodeValidationError                      = "VALIDATION_ERROR"
	TextCodeInvalidFeatureConfig                 = "INVALID_FEATURE_CONFIG"
	TextCodeForbidden                            = "FORBIDDEN"
	TextCodeNotFound                             = "NOT_FOUND"
	TextCodeFeatureDisabled                      = "FEATURE_DISABLED"
	TextCodeReplSessionLimit                     = "REPL_SESSION_LIMIT"
	TextCodeWorkflowNotFound                     = "WORKFLOW_NOT_FOUND"
	TextCodeWorkflowInvalidTransition            = "WORKFLOW_INVALID_TRANSITION"
	TextCodeTranslationMissing                   = "TRANSLATION_MISSING"
	TextCodeTranslationExists                    = "TRANSLATION_EXISTS"
	TextCodeAutosaveConflict                     = "AUTOSAVE_CONFLICT"
	TextCodeTranslationQueueConflict             = "TRANSLATION_QUEUE_CONFLICT"
	TextCodeTranslationQueueVersionConflict      = "TRANSLATION_QUEUE_VERSION_CONFLICT"
	TextCodeTranslationExchangeUnsupportedFormat = "TRANSLATION_EXCHANGE_UNSUPPORTED_FORMAT"
	TextCodeTranslationExchangeInvalidPayload    = "TRANSLATION_EXCHANGE_INVALID_PAYLOAD"
	TextCodeTranslationExchangeMissingLinkage    = "TRANSLATION_EXCHANGE_MISSING_LINKAGE"
	TextCodeTranslationExchangeStaleSourceHash   = "TRANSLATION_EXCHANGE_STALE_SOURCE_HASH"
	TextCodeContentTypeSchemaBreaking            = "CONTENT_TYPE_SCHEMA_BREAKING"
	TextCodeFeatureEnabledRequired               = "FEATURE_ENABLED_REQUIRED"
	TextCodeFeatureAliasDisabled                 = "FEATURE_ALIAS_DISABLED"
	TextCodeMissingPanel                         = "MISSING_PANEL"
	TextCodeRawUINotSupported                    = "RAW_UI_NOT_SUPPORTED"
	TextCodeClearKeysNotSupported                = "CLEAR_KEYS_NOT_SUPPORTED"
	TextCodeReplDebugDisabled                    = "REPL_DEBUG_DISABLED"
	TextCodeReplShellDisabled                    = "REPL_SHELL_DISABLED"
	TextCodeReplAppDisabled                      = "REPL_APP_DISABLED"
	TextCodeReplDisabled                         = "REPL_DISABLED"
	TextCodeReplOverrideDenied                   = "REPL_OVERRIDE_DENIED"
	TextCodeReplRoleDenied                       = "REPL_ROLE_DENIED"
	TextCodeReplPermissionDenied                 = "REPL_PERMISSION_DENIED"
	TextCodeReplExecPermissionDenied             = "REPL_EXEC_PERMISSION_DENIED"
	TextCodeReplReadOnly                         = "REPL_READ_ONLY"
	TextCodeReplIPDenied                         = "REPL_IP_DENIED"
	TextCodePathConflict                         = "PATH_CONFLICT"
	TextCodeConflict                             = "CONFLICT"
	TextCodeServiceUnavailable                   = "SERVICE_UNAVAILABLE"
	TextCodeActivityActorContextInvalid          = "ACTIVITY_ACTOR_CONTEXT_INVALID"
)
View Source
const (
	MenuItemTypeItem      = navinternal.MenuItemTypeItem
	MenuItemTypeGroup     = navinternal.MenuItemTypeGroup
	MenuItemTypeSeparator = navinternal.MenuItemTypeSeparator
)
View Source
const (
	RolesOpenAPISource  = "roles.json"
	CreateRoleOperation = "createRole"
	UpdateRoleOperation = "updateRole"
)
View Source
const (
	// DefaultSchemaMaxSizeBytes is the maximum JSON schema size in bytes (1MB)
	DefaultSchemaMaxSizeBytes = 1 * 1024 * 1024
	// DefaultSchemaMaxFields is the maximum number of fields allowed in a schema
	DefaultSchemaMaxFields = 200
	// DefaultSchemaMaxDepth is the maximum nesting depth for properties/items
	DefaultSchemaMaxDepth = 10
	// DefaultUISchemaMaxSizeBytes is the maximum UI schema overlay size (512KB)
	DefaultUISchemaMaxSizeBytes = 512 * 1024
	// DefaultPreviewHTMLMaxSizeBytes is the maximum generated HTML preview size (2MB)
	DefaultPreviewHTMLMaxSizeBytes = 2 * 1024 * 1024
)

Schema validation limits

View Source
const (
	// SchemaFormatOpenAPI identifies OpenAPI documents for formgen.
	SchemaFormatOpenAPI = formgenopenapi.DefaultAdapterName
	// SchemaFormatJSONSchema identifies JSON Schema documents for formgen.
	SchemaFormatJSONSchema = formgenjsonschema.DefaultAdapterName
)
View Source
const (
	PermAdminTranslationsView           = "admin.translations.view"
	PermAdminTranslationsEdit           = "admin.translations.edit"
	PermAdminTranslationsManage         = "admin.translations.manage"
	PermAdminTranslationsAssign         = "admin.translations.assign"
	PermAdminTranslationsApprove        = "admin.translations.approve"
	PermAdminTranslationsClaim          = "admin.translations.claim"
	PermAdminTranslationsExport         = "admin.translations.export"
	PermAdminTranslationsImportView     = "admin.translations.import.view"
	PermAdminTranslationsImportValidate = "admin.translations.import.validate"
	PermAdminTranslationsImportApply    = "admin.translations.import.apply"
)
View Source
const (
	WidgetUserStats           = widgetcodes.WidgetUserStats
	WidgetActivityFeed        = widgetcodes.WidgetActivityFeed
	WidgetUserActivityFeed    = widgetcodes.WidgetUserActivityFeed
	WidgetQuickActions        = widgetcodes.WidgetQuickActions
	WidgetNotifications       = widgetcodes.WidgetNotifications
	WidgetSettingsOverview    = widgetcodes.WidgetSettingsOverview
	WidgetUserProfileOverview = widgetcodes.WidgetUserProfileOverview
	WidgetTranslationProgress = widgetcodes.WidgetTranslationProgress
	WidgetContentStats        = widgetcodes.WidgetContentStats
	WidgetStorageStats        = widgetcodes.WidgetStorageStats
	WidgetSystemHealth        = widgetcodes.WidgetSystemHealth
	WidgetChartSample         = widgetcodes.WidgetChartSample
	WidgetBarChart            = widgetcodes.WidgetBarChart
	WidgetLineChart           = widgetcodes.WidgetLineChart
	WidgetPieChart            = widgetcodes.WidgetPieChart
	WidgetGaugeChart          = widgetcodes.WidgetGaugeChart
	WidgetScatterChart        = widgetcodes.WidgetScatterChart
)

Canonical dashboard widget definition codes.

View Source
const (
	ActivityActorTypeUser = "user"
)
View Source
const (
	// CreateTranslationKey is the payload flag that explicitly allows creating a missing translation.
	CreateTranslationKey = "create_translation"
)
View Source
const (
	DebugPanelPermissions = "permissions"
)
View Source
const DefaultIconLibrary = "iconoir"

DefaultIconLibrary is the library used when no prefix is specified.

View Source
const NotificationMarkCommandName = "notifications.mark"

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

Variables

View Source
var (
	ErrDoctorCheckNotFound     = errors.New("doctor check not found")
	ErrDoctorActionUnavailable = errors.New("doctor action unavailable")
	ErrDoctorActionNotRunnable = errors.New("doctor action not runnable")
)
View Source
var (
	// ErrPreferencesStoreRequired indicates a missing preferences store.
	ErrPreferencesStoreRequired = optionsadapter.ErrPreferencesStoreRequired
	// ErrPreferencesScopeMetadataInvalid indicates malformed options scope metadata.
	ErrPreferencesScopeMetadataInvalid = optionsadapter.ErrPreferencesScopeMetadataInvalid
	// ErrPreferencesPathInvalid indicates an invalid flatten/unflatten path.
	ErrPreferencesPathInvalid = optionsadapter.ErrPreferencesPathInvalid
)
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 (
	// ErrTranslationAssignmentConflict indicates an active assignment uniqueness conflict.
	ErrTranslationAssignmentConflict = errors.New("translation assignment conflict")
	// ErrTranslationAssignmentVersionConflict indicates optimistic locking/version mismatch.
	ErrTranslationAssignmentVersionConflict = errors.New("translation assignment version conflict")
)
View Source
var (
	// ErrTranslationExchangeUnsupportedFormat indicates a format outside CSV/JSON v1 support.
	ErrTranslationExchangeUnsupportedFormat = errors.New("translation exchange unsupported format")
	// ErrTranslationExchangeInvalidPayload indicates malformed exchange payloads.
	ErrTranslationExchangeInvalidPayload = errors.New("translation exchange invalid payload")
	// ErrTranslationExchangeMissingLinkage indicates unresolved deterministic linkage.
	ErrTranslationExchangeMissingLinkage = errors.New("translation exchange missing linkage")
	// ErrTranslationExchangeStaleSourceHash indicates stale source hash conflicts.
	ErrTranslationExchangeStaleSourceHash = errors.New("translation exchange stale source hash")
)
View Source
var (
	ErrWorkflowNotFound          = errors.New("workflow not found for entity type")
	ErrWorkflowInvalidTransition = errors.New("invalid transition")
)
View Source
var (
	ErrWorkflowVersionConflict         = errors.New("workflow version conflict")
	ErrWorkflowBindingConflict         = errors.New("workflow binding conflict")
	ErrWorkflowBindingVersionConflict  = errors.New("workflow binding version conflict")
	ErrWorkflowRollbackVersionNotFound = errors.New("workflow rollback version not found")
)
View Source
var ErrAutosaveConflict = errors.New("autosave conflict")

ErrAutosaveConflict marks optimistic concurrency conflicts reported by autosave-aware updates.

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 ErrMissingTranslations = errors.New("missing required translations")

ErrMissingTranslations marks translation policy failures due to missing locales.

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

ErrPathConflict signals a page path/slug collision.

View Source
var ErrREPLSessionLimit = errors.New("repl session limit reached")
View Source
var ErrTranslationAlreadyExists = errors.New("translation already exists")

ErrTranslationAlreadyExists marks duplicate translation creation attempts.

View Source
var ErrTranslationCreateUnsupported = errors.New("translation create unsupported")

ErrTranslationCreateUnsupported indicates the backing provider does not expose a first-class translation create command.

View Source
var (
	// ErrTranslationExchangeLinkageNotFound indicates missing deterministic row linkage.
	ErrTranslationExchangeLinkageNotFound = errors.New("translation exchange linkage not found")
)

Functions

func ActionDisabledReasonCodes added in v0.25.0

func ActionDisabledReasonCodes() []string

ActionDisabledReasonCodes returns the canonical disabled reason-code vocabulary.

func AttachErrorContext added in v0.24.0

func AttachErrorContext(err error, mapped *goerrors.Error) *goerrors.Error

AttachErrorContext ensures stack trace + location are present for API responses.

func BlockEditorDescriptor added in v0.23.0

func BlockEditorDescriptor(basePath string) components.Descriptor

BlockEditorDescriptor returns the component descriptor for registration.

func BlockLibraryPickerDescriptor added in v0.24.0

func BlockLibraryPickerDescriptor(basePath string) components.Descriptor

BlockLibraryPickerDescriptor returns the component descriptor for registration.

func BlockLibraryPickerDescriptorWithAPIBase added in v0.24.0

func BlockLibraryPickerDescriptorWithAPIBase(basePath, apiBase string) components.Descriptor

BlockLibraryPickerDescriptorWithAPIBase returns the component descriptor with an explicit API base. apiBase should point to the admin API root (e.g. /admin/api or /admin/api/v0).

func BoolPtr added in v0.16.0

func BoolPtr(value bool) *bool

BoolPtr returns a pointer to the provided boolean.

func CanAll added in v0.25.0

func CanAll(authorizer Authorizer, ctx context.Context, resource string, permissions ...string) bool

CanAll returns true when all provided permissions are allowed.

func CanAny added in v0.25.0

func CanAny(authorizer Authorizer, ctx context.Context, resource string, permissions ...string) bool

CanAny returns true when any provided permission is allowed.

func CanonicalPolicyEntityKey added in v0.25.0

func CanonicalPolicyEntityKey(value string) string

CanonicalPolicyEntityKey performs structural normalization for policy entities. Semantic aliasing (for example singular/plural preferences) is resolved by policy-level lookup code where configured entity keys are available.

func CaptureJSErrorContext added in v0.24.0

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

CaptureJSErrorContext injects JS error collector variables into the view context without capturing template data or injecting toolbar variables. Use this on non-admin pages (public site, login) that need the global error collector but not the full debug integration.

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

Note: this variant cannot inject JS error nonce cookies because it does not have access to the router.Context. Use CaptureViewContextForRequest when possible to get full JS error collector support.

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 and injects JS error collector variables (with nonce) when CaptureJSErrors is enabled.

func CollectIconContributions added in v0.25.0

func CollectIconContributions(contributor IconContributor, callbacks IconContributorCallbacks) error

CollectIconContributions processes icon contributions from a module.

func DebugRequestMiddleware added in v0.14.0

func DebugRequestMiddleware(collector *DebugCollector) router.MiddlewareFunc

DebugRequestMiddleware captures request metadata for the debug collector.

func DecodeWidgetConfig added in v0.25.0

func DecodeWidgetConfig[T any](cfg map[string]any) (T, error)

DecodeWidgetConfig strictly decodes provider config into a typed struct. Unknown fields are rejected.

func DefaultDebugPanels added in v0.24.0

func DefaultDebugPanels() []string

DefaultDebugPanels returns the default debug panel IDs.

func DefaultDebugToolbarPanels added in v0.24.0

func DefaultDebugToolbarPanels() []string

DefaultDebugToolbarPanels returns the default toolbar panel IDs.

func DeliveryGraphQLControllers added in v0.23.0

func DeliveryGraphQLControllers() []registrar.Controller

DeliveryGraphQLControllers exposes delivery schema controllers for go-crud/gql registration.

func EnrichLayoutViewContext added in v0.25.0

func EnrichLayoutViewContext(adm *Admin, c router.Context, view router.ViewContext, active string) router.ViewContext

EnrichLayoutViewContext injects standard layout keys (paths, nav, session, theme, capabilities). It is intended for module/host handlers rendering templates that extend layout.html.

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 EnvironmentFromContext added in v0.24.0

func EnvironmentFromContext(ctx context.Context) string

EnvironmentFromContext returns the active environment stored on the context.

func GetSVGFieldTypeMapping added in v0.25.0

func GetSVGFieldTypeMapping() map[string]string

GetSVGFieldTypeMapping returns the svgFieldTypeKeys map for backward compatibility.

func GetTranslationAssignmentMigrationsFS added in v0.25.0

func GetTranslationAssignmentMigrationsFS() fs.FS

GetTranslationAssignmentMigrationsFS returns queue assignment migrations from top-level data/sql/migrations.

func GetWorkflowRuntimeMigrationsFS added in v0.25.0

func GetWorkflowRuntimeMigrationsFS() fs.FS

GetWorkflowRuntimeMigrationsFS returns runtime workflow migrations rooted for sqlite usage.

func IsTranslationMissing added in v0.24.0

func IsTranslationMissing(err error) bool

IsTranslationMissing reports whether an error indicates a missing translation.

func LocaleFromContext added in v0.23.0

func LocaleFromContext(ctx context.Context) string

LocaleFromContext exposes locale lookup for external adapters.

func ManagementGraphQLControllers added in v0.23.0

func ManagementGraphQLControllers() []registrar.Controller

ManagementGraphQLControllers exposes management schema controllers for go-crud/gql registration.

func MenuUUIDFromSlug(slug string) string

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

func NewAdminActivityEnricher added in v0.22.0

func NewAdminActivityEnricher(cfg AdminActivityEnricherConfig) usersactivity.ActivityEnricher

NewAdminActivityEnricher builds an activity enricher that adds missing metadata keys.

func NewAdminObjectResolver added in v0.22.0

func NewAdminObjectResolver(cfg AdminObjectResolverConfig) usersactivity.ObjectResolver

NewAdminObjectResolver returns an object resolver map for admin object types.

func NewCRUDContext added in v0.24.0

func NewCRUDContext(ctx context.Context) crud.Context

NewCRUDContext builds a minimal crud.Context backed by the provided context.

func NewDomainError added in v0.24.0

func NewDomainError(code, message string, meta map[string]any) *goerrors.Error

NewDomainError builds a go-errors Error from a registered domain error code.

func NewRoleFormGenerator added in v0.22.0

func NewRoleFormGenerator(cfg Config) (*formgenorchestrator.Orchestrator, error)

NewRoleFormGenerator builds a roles form generator using embedded OpenAPI + UI schema.

func NormalizeBasePath added in v0.24.0

func NormalizeBasePath(basePath string) string

NormalizeBasePath exposes admin base-path normalization.

func NormalizeFilterType added in v0.24.0

func NormalizeFilterType(raw string) string

NormalizeFilterType normalizes field/filter input types into UI filter types.

func NormalizeMenuItemTranslationFields added in v0.24.0

func NormalizeMenuItemTranslationFields(item MenuItem) (label, labelKey, groupTitle, groupTitleKey string)

NormalizeMenuItemTranslationFields derives translation display fallbacks.

func NormalizeMenuItemType added in v0.24.0

func NormalizeMenuItemType(raw string) string

NormalizeMenuItemType normalizes menu item type values.

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 ParseListPredicateKey added in v0.24.0

func ParseListPredicateKey(key string) (string, string)

ParseListPredicateKey splits field operator keys like "status__in".

func PermissionMatrixDescriptor added in v0.22.0

func PermissionMatrixDescriptor(basePath string) components.Descriptor

PermissionMatrixDescriptor returns the component descriptor for registration.

func PrefixBasePath added in v0.24.0

func PrefixBasePath(basePath, routePath string) string

PrefixBasePath exposes admin path prefix behavior.

func RateLimitError added in v0.23.0

func RateLimitError() error

RateLimitError creates an error for rate limit violations

func RegisterBuiltinIconLibraries added in v0.25.0

func RegisterBuiltinIconLibraries(svc *IconService) error

RegisterBuiltinIconLibraries registers all built-in icon libraries.

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 RegisterDefaultCMSWorkflows added in v0.24.0

func RegisterDefaultCMSWorkflows(registrar WorkflowRegistrar)

RegisterDefaultCMSWorkflows registers the default CMS workflow definitions. If the registrar supports WorkflowDefinitionChecker, existing definitions are preserved.

func RegisterDeliveryGraphQLSchemas added in v0.23.0

func RegisterDeliveryGraphQLSchemas()

RegisterDeliveryGraphQLSchemas registers delivery schemas into the go-crud registry.

func RegisterDoctorDebugPanel added in v0.25.0

func RegisterDoctorDebugPanel(admin *Admin)

RegisterDoctorDebugPanel registers the doctor panel with the debug collector.

func RegisterDomainErrorCodes added in v0.24.0

func RegisterDomainErrorCodes(codes ...DomainErrorCode)

RegisterDomainErrorCodes adds or replaces domain error code metadata.

func RegisterManagementGraphQLSchemas added in v0.23.0

func RegisterManagementGraphQLSchemas()

RegisterManagementGraphQLSchemas registers management schemas into the go-crud registry.

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 RegisterPermissionsDebugPanel added in v0.25.0

func RegisterPermissionsDebugPanel(admin *Admin)

RegisterPermissionsDebugPanel registers the permissions panel with the debug collector.

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 RegisterTranslationExchangeCommandFactories added in v0.25.0

func RegisterTranslationExchangeCommandFactories(bus *CommandBus) error

RegisterTranslationExchangeCommandFactories installs name-based factory dispatch for exchange commands.

func RegisterTranslationProgressWidget added in v0.25.0

func RegisterTranslationProgressWidget(dash *Dashboard, stats TranslationQueueStatsService, urls urlkit.Resolver)

RegisterTranslationProgressWidget registers queue progress dashboard provider.

func RegisterTranslationQueueCommandFactories added in v0.25.0

func RegisterTranslationQueueCommandFactories(bus *CommandBus) error

RegisterTranslationQueueCommandFactories installs name-based message factories for queue commands.

func RegisterTranslationQueueCommands added in v0.25.0

func RegisterTranslationQueueCommands(bus *CommandBus, service TranslationQueueService) error

RegisterTranslationQueueCommands registers typed queue handlers and name-based factories.

func RegisterTranslationQueueTabs added in v0.25.0

func RegisterTranslationQueueTabs(admin *Admin) error

RegisterTranslationQueueTabs attaches translation queue tabs to translation-enabled detail views.

func ResolvedPermissionsFromAuthorizer added in v0.25.0

func ResolvedPermissionsFromAuthorizer(ctx context.Context, authorizer Authorizer) []string

ResolvedPermissionsFromAuthorizer extracts resolved permissions when supported by the authorizer implementation.

func SchemaEditorDescriptor added in v0.23.0

func SchemaEditorDescriptor(basePath string) components.Descriptor

SchemaEditorDescriptor returns the component descriptor for registration.

func SetDefaultErrorPresenter added in v0.24.0

func SetDefaultErrorPresenter(presenter ErrorPresenter)

SetDefaultErrorPresenter overrides the package-level presenter used by helpers.

func TranslationCapabilities added in v0.25.0

func TranslationCapabilities(adm *Admin) map[string]any

TranslationCapabilities returns a translation capability snapshot for the admin instance. The payload shape is stable for template/frontend gating: - profile - schema_version - modules - features - routes - panels - resolver_keys - warnings - contracts

func TranslationCapabilitiesForContext added in v0.25.0

func TranslationCapabilitiesForContext(adm *Admin, reqCtx context.Context) map[string]any

TranslationCapabilitiesForContext returns a translation capability snapshot with request-scoped permission states when context is available.

func TranslationSharedContractsPayload added in v0.25.0

func TranslationSharedContractsPayload() map[string]any

TranslationSharedContractsPayload returns the canonical shared translation contracts consumed by frontend status/reason renderers.

func TranslationSourceTargetDriftContract added in v0.25.0

func TranslationSourceTargetDriftContract() map[string]any

TranslationSourceTargetDriftContract documents the source-target drift metadata contract expected by side-by-side editor surfaces.

func TranslationStatusEnumContract added in v0.25.0

func TranslationStatusEnumContract() map[string]any

TranslationStatusEnumContract returns stable status enums shared across core translation readiness, queue, and exchange payloads.

func ValidateJSONPointerFormat added in v0.23.0

func ValidateJSONPointerFormat(pointer string) bool

ValidateJSONPointerFormat checks if a string is a valid JSON Pointer

func WithActivityRetention

func WithActivityRetention(limit int) func(*ActivityFeed)

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

func WithEnvironment added in v0.24.0

func WithEnvironment(ctx context.Context, environment string) context.Context

WithEnvironment stores the active environment on the context.

func WithLocale added in v0.24.0

func WithLocale(ctx context.Context, locale string) context.Context

WithLocale stores the active locale on the context.

func WithResolvedPermissionsCache added in v0.25.0

func WithResolvedPermissionsCache(ctx context.Context) context.Context

WithResolvedPermissionsCache injects a request-scoped permission resolution cache into context.

func WithStack added in v0.24.0

func WithStack(err error) error

WithStack wraps an error with a captured stack trace for later mapping.

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         `json:"name"`
	Label            string         `json:"label,omitempty"`
	LabelKey         string         `json:"label_key,omitempty"`
	CommandName      string         `json:"command_name"`
	Permission       string         `json:"permission,omitempty"`
	Type             string         `json:"type,omitempty"`
	Href             string         `json:"href,omitempty"`
	Order            int            `json:"order,omitempty"`
	Scope            ActionScope    `json:"scope,omitempty"`
	ContextRequired  []string       `json:"context_required,omitempty"`
	Icon             string         `json:"icon,omitempty"`
	Confirm          string         `json:"confirm,omitempty"`
	Variant          string         `json:"variant,omitempty"`
	Overflow         bool           `json:"overflow,omitempty"`
	Idempotent       bool           `json:"idempotent,omitempty"`
	IdempotencyField string         `json:"idempotency_field,omitempty"`
	PayloadRequired  []string       `json:"payload_required,omitempty"`
	PayloadSchema    map[string]any `json:"payload_schema,omitempty"`
}

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

func DefaultCMSWorkflowActions added in v0.24.0

func DefaultCMSWorkflowActions() []Action

DefaultCMSWorkflowActions returns the default workflow actions for CMS demo panels.

type ActionScope added in v0.25.0

type ActionScope string
const (
	ActionScopeAny    ActionScope = "all"
	ActionScopeRow    ActionScope = "row"
	ActionScopeDetail ActionScope = "detail"
	ActionScopeBulk   ActionScope = "bulk"
)

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 ActivityFeedWidgetPayload added in v0.25.0

type ActivityFeedWidgetPayload struct {
	Entries []ActivityEntry `json:"entries"`
}

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) ActivityReadEnabled added in v0.25.0

func (a *Admin) ActivityReadEnabled() bool

ActivityReadEnabled reports whether the activity read API is wired.

func (*Admin) ActivityWidget

func (a *Admin) ActivityWidget() error

ActivityWidget registers the activity widget provider.

func (*Admin) AddInitHook added in v0.24.0

func (a *Admin) AddInitHook(hook func(AdminRouter) error)

AddInitHook registers a hook that runs after Initialize sets the router.

func (*Admin) AdminAPIBasePath added in v0.24.0

func (a *Admin) AdminAPIBasePath() string

AdminAPIBasePath returns the base path for admin API routes (including version when configured).

func (*Admin) AdminAPIGroup added in v0.24.0

func (a *Admin) AdminAPIGroup() string

AdminAPIGroup exposes the URLKit admin API group path.

func (*Admin) AttachDebugLogBridge added in v0.25.0

func (a *Admin) AttachDebugLogBridge()

AttachDebugLogBridge wraps the admin DI logger/provider so application logs are captured by the debug collector in addition to any slog capture path.

func (*Admin) AuthWrapper

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

AuthWrapper returns the configured auth wrapper for boot steps.

func (*Admin) Authorizer added in v0.22.0

func (a *Admin) Authorizer() Authorizer

Authorizer exposes the configured authorizer (if any).

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) BootIcons added in v0.25.0

func (a *Admin) BootIcons() boot.IconsBinding

BootIcons exposes the icons binding for icon discovery and rendering.

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) BootSchemaRegistry added in v0.23.0

func (a *Admin) BootSchemaRegistry() boot.SchemaRegistryBinding

BootSchemaRegistry exposes schema registry bindings.

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) BootTranslationExchange added in v0.25.0

func (a *Admin) BootTranslationExchange() boot.TranslationExchangeBinding

BootTranslationExchange exposes translation exchange bindings.

func (*Admin) BootTranslationQueue added in v0.25.0

func (a *Admin) BootTranslationQueue() boot.TranslationQueueBinding

BootTranslationQueue exposes translation queue aggregate bindings.

func (*Admin) BootUserImport added in v0.22.0

func (a *Admin) BootUserImport() boot.UserImportBinding

BootUserImport exposes the user import binding.

func (*Admin) BootWorkflows added in v0.25.0

func (a *Admin) BootWorkflows() boot.WorkflowManagementBinding

BootWorkflows exposes persisted workflow management bindings.

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) ContentService added in v0.24.0

func (a *Admin) ContentService() CMSContentService

ContentService exposes the configured CMS content service.

func (*Admin) ContentTypeService added in v0.24.0

func (a *Admin) ContentTypeService() CMSContentTypeService

ContentTypeService exposes the configured CMS content type service.

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) DebugUserSessions added in v0.24.0

func (a *Admin) DebugUserSessions() DebugUserSessionStore

DebugUserSessions exposes the debug user session store.

func (*Admin) DefaultLocale

func (a *Admin) DefaultLocale() string

DefaultLocale exposes the configured default locale.

func (*Admin) DoctorChecks added in v0.25.0

func (a *Admin) DoctorChecks() []DoctorCheck

DoctorChecks returns a stable, sorted copy of registered doctor checks.

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) FeatureCatalog added in v0.22.0

func (a *Admin) FeatureCatalog() catalog.Catalog

FeatureCatalog exposes the configured feature catalog.

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) IconService added in v0.25.0

func (a *Admin) IconService() *IconService

IconService returns the icon service for icon resolution and rendering.

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) Logger added in v0.25.0

func (a *Admin) Logger() Logger

Logger exposes the base configured logger.

func (*Admin) LoggerProvider added in v0.25.0

func (a *Admin) LoggerProvider() LoggerProvider

LoggerProvider exposes the configured logger provider.

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) NamedLogger added in v0.25.0

func (a *Admin) NamedLogger(name string) Logger

NamedLogger resolves a named logger via the configured provider.

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) Preview added in v0.22.0

func (a *Admin) Preview() *PreviewService

Preview returns the preview service.

func (*Admin) ProfileService

func (a *Admin) ProfileService() *ProfileService

ProfileService exposes the user profile service.

func (*Admin) ProtectedRouter added in v0.25.0

func (a *Admin) ProtectedRouter() AdminRouter

ProtectedRouter exposes the admin router wrapped with auth middleware when configured.

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/tree/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) RegisterDoctorChecks added in v0.25.0

func (a *Admin) RegisterDoctorChecks(checks ...DoctorCheck) *Admin

RegisterDoctorChecks registers checks used by RunDoctor and the doctor debug panel.

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) RegisterPublicAPI added in v0.22.0

func (a *Admin) RegisterPublicAPI(r AdminRouter)

RegisterPublicAPI registers read-only endpoints for content delivery.

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) ResolvePanelTabs added in v0.24.0

func (a *Admin) ResolvePanelTabs(ctx AdminContext, panelName string) ([]PanelTab, error)

ResolvePanelTabs returns the effective tabs for a panel using the provided admin context.

func (*Admin) ResolvePanelTabsFromRequest added in v0.24.0

func (a *Admin) ResolvePanelTabsFromRequest(c router.Context, panelName, locale string) ([]PanelTab, error)

ResolvePanelTabsFromRequest resolves panel tabs using request-derived context and permissions.

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) RunDoctor added in v0.25.0

func (a *Admin) RunDoctor(ctx context.Context) DoctorReport

RunDoctor executes registered checks and returns a full diagnostics report.

func (*Admin) RunDoctorAction added in v0.25.0

func (a *Admin) RunDoctorAction(ctx context.Context, checkID string, input map[string]any) (DoctorActionExecution, error)

RunDoctorAction executes a check action when configured and runnable.

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) UnregisterPanel added in v0.23.0

func (a *Admin) UnregisterPanel(name string) error

UnregisterPanel removes a previously registered panel.

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) UserImportAllowed added in v0.25.0

func (a *Admin) UserImportAllowed(ctx context.Context) bool

UserImportAllowed reports whether the current actor can access users import.

func (*Admin) UserImportEnabled added in v0.25.0

func (a *Admin) UserImportEnabled() bool

UserImportEnabled reports whether the users bulk-import backend is wired.

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) WithCMSWorkflowActions added in v0.24.0

func (a *Admin) WithCMSWorkflowActions(actions ...Action) *Admin

WithCMSWorkflowActions overrides the default CMS workflow actions for demo panels.

func (*Admin) WithCMSWorkflowDefaults added in v0.24.0

func (a *Admin) WithCMSWorkflowDefaults() *Admin

WithCMSWorkflowDefaults enables registering default CMS workflows on a custom engine that can report existing definitions.

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) WithModuleStartupPolicy added in v0.25.0

func (a *Admin) WithModuleStartupPolicy(policy ModuleStartupPolicy) *Admin

WithModuleStartupPolicy configures how module startup validation errors are handled.

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) WithThemeManifest added in v0.24.0

func (a *Admin) WithThemeManifest(manifest *theme.Manifest) *Admin

WithThemeManifest wires a go-theme manifest for downstream UI option building.

func (*Admin) WithThemeProvider

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

WithThemeProvider wires a theme selector/registry to downstream renderers.

func (*Admin) WithTraitWorkflowDefaults added in v0.25.0

func (a *Admin) WithTraitWorkflowDefaults(defaults map[string]string) *Admin

WithTraitWorkflowDefaults sets default workflow IDs by panel trait.

func (*Admin) WithTranslationPolicy added in v0.24.0

func (a *Admin) WithTranslationPolicy(policy TranslationPolicy) *Admin

WithTranslationPolicy attaches a translation policy used during workflow transitions.

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).

func (*Admin) WithWorkflow added in v0.22.0

func (a *Admin) WithWorkflow(w WorkflowEngine) *Admin

WithWorkflow attaches a workflow engine to the admin orchestrator.

func (*Admin) WithWorkflowRuntime added in v0.25.0

func (a *Admin) WithWorkflowRuntime(runtime WorkflowRuntime) *Admin

WithWorkflowRuntime wires persisted workflow definitions/bindings.

type AdminActivityEnricherConfig added in v0.22.0

type AdminActivityEnricherConfig struct {
	ActorResolver   usersactivity.ActorResolver
	ObjectResolver  usersactivity.ObjectResolver
	EnricherVersion string
	Now             func() time.Time
}

AdminActivityEnricherConfig wires the actor/object resolvers for activity enrichment.

type AdminActorResolver added in v0.22.0

type AdminActorResolver struct {
	Users    UserRepository
	Profiles ProfileStore
}

AdminActorResolver enriches actor details using admin user sources.

func (AdminActorResolver) ResolveActors added in v0.22.0

ResolveActors resolves actor details in batch.

type AdminContext

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

AdminContext carries request-scoped information into panel operations.

type AdminObjectResolverConfig added in v0.22.0

type AdminObjectResolverConfig struct {
	Users         UserRepository
	Roles         RoleRepository
	Tenants       TenantRepository
	Organizations OrganizationRepository
	Profiles      ProfileStore
	Settings      *SettingsService
	Jobs          *JobRegistry
	Widgets       CMSWidgetService
	Menus         CMSMenuService
	Content       CMSContentService
	Fallback      usersactivity.ObjectResolver
}

AdminObjectResolverConfig wires admin object resolvers.

type AdminPageGetOptions added in v0.24.0

type AdminPageGetOptions struct {
	Locale                   string
	FallbackLocale           string
	AllowMissingTranslations bool
	IncludeContent           bool
	IncludeBlocks            bool
	IncludeData              bool
	EnvironmentKey           string
}

AdminPageGetOptions configures admin page detail reads.

type AdminPageListOptions added in v0.24.0

type AdminPageListOptions struct {
	Locale                   string
	FallbackLocale           string
	AllowMissingTranslations bool
	IncludeContent           bool
	IncludeBlocks            bool
	IncludeData              bool
	EnvironmentKey           string
	Page                     int
	PerPage                  int
	SortBy                   string
	SortDesc                 bool
	Search                   string
	Filters                  map[string]any
}

AdminPageListOptions configures admin page list reads.

type AdminPageReadService added in v0.24.0

type AdminPageReadService interface {
	List(ctx context.Context, opts AdminPageListOptions) ([]AdminPageRecord, int, error)
	Get(ctx context.Context, id string, opts AdminPageGetOptions) (*AdminPageRecord, error)
}

AdminPageReadService provides list/detail admin read operations.

func NewGoCMSAdminPageReadAdapter added in v0.24.0

func NewGoCMSAdminPageReadAdapter(service cms.AdminPageReadService) AdminPageReadService

NewGoCMSAdminPageReadAdapter wraps a go-cms admin read service.

type AdminPageRecord added in v0.24.0

type AdminPageRecord struct {
	ID                 string
	ContentID          string
	TranslationGroupID string
	TemplateID         string
	Title              string
	Slug               string
	Path               string
	RequestedLocale    string
	ResolvedLocale     string
	Translation        TranslationBundle[PageTranslation]
	ContentTranslation TranslationBundle[ContentTranslation]
	Status             string
	ParentID           string
	MetaTitle          string
	MetaDescription    string
	Summary            *string
	Tags               []string
	SchemaVersion      string
	Data               map[string]any
	Content            any
	Blocks             any
	PreviewURL         string
	PublishedAt        *time.Time
	CreatedAt          *time.Time
	UpdatedAt          *time.Time
}

AdminPageRecord mirrors the admin read model contract for page data.

type AdminPageWriteService added in v0.24.0

type AdminPageWriteService interface {
	Create(ctx context.Context, payload map[string]any) (*AdminPageRecord, error)
	Update(ctx context.Context, id string, payload map[string]any) (*AdminPageRecord, error)
	Delete(ctx context.Context, id string) error
	Publish(ctx context.Context, id string, payload map[string]any) (*AdminPageRecord, error)
	Unpublish(ctx context.Context, id string, payload map[string]any) (*AdminPageRecord, error)
}

AdminPageWriteService provides admin write operations for pages.

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 AssignmentStatus added in v0.25.0

type AssignmentStatus string

AssignmentStatus captures the translation queue lifecycle.

const (
	AssignmentStatusPending    AssignmentStatus = "pending"
	AssignmentStatusAssigned   AssignmentStatus = "assigned"
	AssignmentStatusInProgress AssignmentStatus = "in_progress"
	AssignmentStatusReview     AssignmentStatus = "review"
	AssignmentStatusRejected   AssignmentStatus = "rejected"
	AssignmentStatusApproved   AssignmentStatus = "approved"
	AssignmentStatusPublished  AssignmentStatus = "published"
	AssignmentStatusArchived   AssignmentStatus = "archived"
)

func (AssignmentStatus) IsTerminal added in v0.25.0

func (s AssignmentStatus) IsTerminal() bool

func (AssignmentStatus) IsValid added in v0.25.0

func (s AssignmentStatus) IsValid() bool

type AssignmentType added in v0.25.0

type AssignmentType string

AssignmentType controls how an assignment is picked up.

const (
	AssignmentTypeDirect   AssignmentType = "assigned"
	AssignmentTypeOpenPool AssignmentType = "open_pool"
)

func (AssignmentType) IsValid added in v0.25.0

func (t AssignmentType) IsValid() bool

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 AutosaveConflictError added in v0.25.0

type AutosaveConflictError struct {
	Panel             string
	EntityID          string
	Version           string
	ExpectedVersion   string
	LatestStatePath   string
	LatestServerState map[string]any
}

AutosaveConflictError captures the typed autosave conflict contract returned to clients.

func (AutosaveConflictError) Error added in v0.25.0

func (e AutosaveConflictError) Error() string

func (AutosaveConflictError) Unwrap added in v0.25.0

func (e AutosaveConflictError) Unwrap() error

type BatchAuthorizer added in v0.25.0

type BatchAuthorizer interface {
	Authorizer
	CanAny(ctx context.Context, resource string, permissions ...string) bool
	CanAll(ctx context.Context, resource string, permissions ...string) bool
}

BatchAuthorizer allows evaluating multiple permissions in one call.

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"`
	Payload           map[string]any `json:"payload,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
	// Payload carries optional job metadata for downstream processors.
	Payload map[string]any
}

BulkRequest describes a requested bulk job.

type BulkRoleChangeRequest added in v0.25.0

type BulkRoleChangeRequest struct {
	UserIDs []string
	RoleID  string
	Assign  bool
	Replace bool
}

BulkRoleChangeRequest captures inputs for bulk role assignment operations.

type BulkRoleChangeResponse added in v0.25.0

type BulkRoleChangeResponse struct {
	Summary BulkRoleChangeSummary  `json:"summary"`
	Results []BulkRoleChangeResult `json:"results"`
	RoleID  string                 `json:"role_id"`
	Action  string                 `json:"action"`
	Replace bool                   `json:"replace"`
}

BulkRoleChangeResponse is the public API contract returned by bulk role endpoints.

type BulkRoleChangeResult added in v0.25.0

type BulkRoleChangeResult struct {
	UserID string `json:"user_id"`
	Status string `json:"status"`
	Error  string `json:"error,omitempty"`
}

BulkRoleChangeResult captures per-user execution details for bulk role changes.

type BulkRoleChangeSummary added in v0.25.0

type BulkRoleChangeSummary struct {
	Processed int `json:"processed"`
	Succeeded int `json:"succeeded"`
	Failed    int `json:"failed"`
	Skipped   int `json:"skipped"`
}

BulkRoleChangeSummary aggregates per-user execution status for bulk role changes.

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 WithBunPatchAllowedFields added in v0.24.0

func WithBunPatchAllowedFields[T any](fields ...string) BunRepositoryOption[T]

WithBunPatchAllowedFields restricts update patch payloads to a known allowlist.

func WithBunRecordMapper

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

WithBunRecordMapper overrides the default map-native 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 BunWorkflowBindingRepository added in v0.25.0

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

BunWorkflowBindingRepository persists workflow bindings with active uniqueness checks.

func NewBunWorkflowBindingRepository added in v0.25.0

func NewBunWorkflowBindingRepository(db *bun.DB) *BunWorkflowBindingRepository

NewBunWorkflowBindingRepository constructs a Bun-backed binding repository.

func (*BunWorkflowBindingRepository) Create added in v0.25.0

func (*BunWorkflowBindingRepository) Delete added in v0.25.0

func (*BunWorkflowBindingRepository) Get added in v0.25.0

func (*BunWorkflowBindingRepository) List added in v0.25.0

func (*BunWorkflowBindingRepository) ListByScope added in v0.25.0

func (*BunWorkflowBindingRepository) Update added in v0.25.0

func (r *BunWorkflowBindingRepository) Update(ctx context.Context, binding WorkflowBinding, expectedVersion int) (WorkflowBinding, error)

type BunWorkflowDefinitionRepository added in v0.25.0

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

BunWorkflowDefinitionRepository persists workflow definitions and version snapshots.

func NewBunWorkflowDefinitionRepository added in v0.25.0

func NewBunWorkflowDefinitionRepository(db *bun.DB) *BunWorkflowDefinitionRepository

NewBunWorkflowDefinitionRepository constructs a Bun-backed workflow repository.

func (*BunWorkflowDefinitionRepository) Create added in v0.25.0

func (*BunWorkflowDefinitionRepository) Get added in v0.25.0

func (*BunWorkflowDefinitionRepository) GetVersion added in v0.25.0

func (*BunWorkflowDefinitionRepository) List added in v0.25.0

func (*BunWorkflowDefinitionRepository) Update added in v0.25.0

func (r *BunWorkflowDefinitionRepository) Update(ctx context.Context, workflow PersistedWorkflow, expectedVersion int) (PersistedWorkflow, error)

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 CMSBlockConflictRepository added in v0.23.0

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

CMSBlockConflictRepository reports mismatches between embedded and legacy blocks.

func NewCMSBlockConflictRepository added in v0.23.0

func NewCMSBlockConflictRepository(content CMSContentService) *CMSBlockConflictRepository

NewCMSBlockConflictRepository builds a conflict repository.

func (*CMSBlockConflictRepository) Create added in v0.23.0

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

Create is not supported.

func (*CMSBlockConflictRepository) Delete added in v0.23.0

Delete is not supported.

func (*CMSBlockConflictRepository) Get added in v0.23.0

Get returns conflict detail by id.

func (*CMSBlockConflictRepository) List added in v0.23.0

List returns block conflicts.

func (*CMSBlockConflictRepository) Update added in v0.23.0

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

Update is not supported.

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, types CMSContentTypeService) *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 CMSBlockDefinitionVersion added in v0.24.0

type CMSBlockDefinitionVersion = cmsboot.CMSBlockDefinitionVersion

CMSBlockDefinitionVersion captures a block definition schema version.

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 CMSContentListOption added in v0.24.0

type CMSContentListOption = string

CMSContentListOption represents list option tokens understood by go-cms List. It is a string alias so options can be forwarded without importing go-cms internals.

func WithDerivedFields added in v0.25.0

func WithDerivedFields() CMSContentListOption

WithDerivedFields requests canonical top-level derived content fields from go-cms.

func WithTranslations added in v0.24.0

func WithTranslations() CMSContentListOption

WithTranslations requests that list operations preload translations for CMS content. This opt-in token mirrors the go-cms list option of the same name.

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) CreateTranslation added in v0.25.0

func (r *CMSContentRepository) CreateTranslation(ctx context.Context, input TranslationCreateInput) (map[string]any, error)

CreateTranslation creates a locale variant through a first-class translation command.

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.

func NewGoCMSContentAdapter added in v0.23.0

func NewGoCMSContentAdapter(contentSvc any, blockSvc any, contentTypeSvc CMSContentTypeService) CMSContentService

NewGoCMSContentAdapter wraps go-cms services into the admin CMSContentService contract.

type CMSContentTranslationCreator added in v0.25.0

type CMSContentTranslationCreator interface {
	CreateTranslation(ctx context.Context, input TranslationCreateInput) (*CMSContent, error)
}

CMSContentTranslationCreator allows CMS content services/adapters to expose a first-class translation creation command.

type CMSContentType added in v0.23.0

type CMSContentType = cmsboot.CMSContentType

CMSContentType represents a content type definition.

type CMSContentTypeEntryRepository added in v0.23.0

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

CMSContentTypeEntryRepository scopes content CRUD to a specific content type.

func NewCMSContentTypeEntryRepository added in v0.23.0

func NewCMSContentTypeEntryRepository(content CMSContentService, contentType CMSContentType) *CMSContentTypeEntryRepository

NewCMSContentTypeEntryRepository builds a content repository scoped to the supplied content type.

func (*CMSContentTypeEntryRepository) Create added in v0.23.0

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

Create inserts new content with the bound content type.

func (*CMSContentTypeEntryRepository) CreateTranslation added in v0.25.0

func (r *CMSContentTypeEntryRepository) CreateTranslation(ctx context.Context, input TranslationCreateInput) (map[string]any, error)

CreateTranslation creates a locale variant through a first-class translation command.

func (*CMSContentTypeEntryRepository) Delete added in v0.23.0

Delete removes a content item after validating its type.

func (*CMSContentTypeEntryRepository) Get added in v0.23.0

Get retrieves content by id, enforcing content type membership.

func (*CMSContentTypeEntryRepository) List added in v0.23.0

List returns content filtered by the bound content type.

func (*CMSContentTypeEntryRepository) Update added in v0.23.0

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

Update modifies content with the bound content type.

type CMSContentTypeRepository added in v0.23.0

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

CMSContentTypeRepository adapts CMSContentTypeService for content type definitions.

func NewCMSContentTypeRepository added in v0.23.0

func NewCMSContentTypeRepository(types CMSContentTypeService) *CMSContentTypeRepository

NewCMSContentTypeRepository builds a repository backed by a CMSContentTypeService.

func (*CMSContentTypeRepository) Create added in v0.23.0

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

Create inserts a content type.

func (*CMSContentTypeRepository) Delete added in v0.23.0

Delete removes a content type.

func (*CMSContentTypeRepository) Get added in v0.23.0

Get returns a single content type by slug (preferred) or id.

func (*CMSContentTypeRepository) List added in v0.23.0

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

List returns content types filtered by search query.

func (*CMSContentTypeRepository) Update added in v0.23.0

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

Update modifies a content type (slug preferred, id fallback).

type CMSContentTypeService added in v0.23.0

type CMSContentTypeService = cmsboot.CMSContentTypeService

CMSContentTypeService manages content type definitions.

func NewGoCMSContentTypeAdapter added in v0.23.0

func NewGoCMSContentTypeAdapter(service any) CMSContentTypeService

NewGoCMSContentTypeAdapter wraps a typed go-cms content type service.

type CMSLegacyBlockService added in v0.23.0

type CMSLegacyBlockService interface {
	LegacyBlocksForContent(ctx context.Context, contentID, locale string) ([]CMSBlock, error)
}

CMSLegacyBlockService exposes legacy block retrieval for conflict reports.

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 ChartPointWidgetPayload added in v0.25.0

type ChartPointWidgetPayload struct {
	Label string `json:"label"`
	Value int    `json:"value"`
}

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) HasFactory added in v0.25.0

func (b *CommandBus) HasFactory(name string) bool

HasFactory reports whether a named message factory is registered.

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
	PreviewSecret    string
	CMSConfig        any
	CMS              CMSOptions
	Debug            DebugConfig
	Errors           ErrorConfig

	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
	// ActivityTabPermissionFailureMode controls how users detail activity tab handles
	// activity permission failures. Supported values:
	// - "strict": return a 403 error
	// - "inline": render tab-level unavailable state
	// - "": auto mode (strict in dev, inline otherwise)
	ActivityTabPermissionFailureMode     string
	ActivityActionLabels                 map[string]string
	JobsPermission                       string
	JobsTriggerPermission                string
	PreferencesPermission                string
	PreferencesUpdatePermission          string
	DashboardPreferencesPermission       string
	DashboardPreferencesUpdatePermission string
	PreferencesManageTenantPermission    string
	PreferencesManageOrgPermission       string
	PreferencesManageSystemPermission    string
	ProfilePermission                    string
	ProfileUpdatePermission              string
	UsersPermission                      string
	UsersCreatePermission                string
	UsersImportPermission                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
	FeatureCatalogPath string
	EnablePublicAPI    bool

	ScopeMode       string
	DefaultTenantID string
	DefaultOrgID    string
}

Config holds core admin settings and feature flags.

type ContentTranslation added in v0.24.0

type ContentTranslation = cmsinterfaces.ContentTranslation

ContentTranslation mirrors the go-cms content translation DTO.

type ContentTypeBuilderModule added in v0.23.0

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

ContentTypeBuilderModule wires the content type builder UI and dynamic panels.

func NewContentTypeBuilderModule added in v0.23.0

func NewContentTypeBuilderModule(opts ...ContentTypeBuilderOption) *ContentTypeBuilderModule

NewContentTypeBuilderModule constructs a content type builder module.

func (*ContentTypeBuilderModule) AfterMenuSeed added in v0.24.0

func (m *ContentTypeBuilderModule) AfterMenuSeed(_ context.Context, admin *Admin) error

AfterMenuSeed refreshes panels/navigation after menu seeding.

func (*ContentTypeBuilderModule) Manifest added in v0.23.0

Manifest describes the module metadata.

func (*ContentTypeBuilderModule) MenuItems added in v0.23.0

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

MenuItems contributes navigation for content modeling. TODO: we should be able to configure menu icons

func (*ContentTypeBuilderModule) Register added in v0.23.0

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

Register wires the module panels, commands, and dynamic panel registration.

type ContentTypeBuilderOption added in v0.23.0

type ContentTypeBuilderOption func(*ContentTypeBuilderModule)

ContentTypeBuilderOption configures the content type builder module.

func WithContentTypeBuilderBasePath added in v0.23.0

func WithContentTypeBuilderBasePath(path string) ContentTypeBuilderOption

WithContentTypeBuilderBasePath configures the module base path.

func WithContentTypeBuilderEntryMenuParent added in v0.24.0

func WithContentTypeBuilderEntryMenuParent(menuParent string) ContentTypeBuilderOption

WithContentTypeBuilderEntryMenuParent configures the menu parent for content type entry panels.

func WithContentTypeBuilderGuardrails added in v0.23.0

func WithContentTypeBuilderGuardrails(guardrails *SchemaGuardrails) ContentTypeBuilderOption

WithContentTypeBuilderGuardrails sets custom schema guardrails.

func WithContentTypeBuilderMenu added in v0.23.0

func WithContentTypeBuilderMenu(menuCode, menuParent string) ContentTypeBuilderOption

WithContentTypeBuilderMenu configures the menu code + parent.

func WithContentTypeBuilderPanelFactory added in v0.23.0

func WithContentTypeBuilderPanelFactory(factory *DynamicPanelFactory) ContentTypeBuilderOption

WithContentTypeBuilderPanelFactory injects a custom panel factory.

func WithContentTypeBuilderPermission added in v0.23.0

func WithContentTypeBuilderPermission(permission string) ContentTypeBuilderOption

WithContentTypeBuilderPermission sets the module permission guard.

func WithContentTypeBuilderPreviewFallback added in v0.24.0

func WithContentTypeBuilderPreviewFallback(fallback SchemaPreviewFallback) ContentTypeBuilderOption

WithContentTypeBuilderPreviewFallback sets a fallback renderer for preview errors.

func WithContentTypeBuilderRateLimiter added in v0.23.0

func WithContentTypeBuilderRateLimiter(limiter *RateLimiter) ContentTypeBuilderOption

WithContentTypeBuilderRateLimiter sets a custom rate limiter.

func WithContentTypeBuilderSchemaValidator added in v0.23.0

func WithContentTypeBuilderSchemaValidator(validator SchemaValidator) ContentTypeBuilderOption

WithContentTypeBuilderSchemaValidator injects a schema validator.

func WithContentTypeBuilderWorkflow added in v0.24.0

func WithContentTypeBuilderWorkflow(workflow WorkflowEngine) ContentTypeBuilderOption

WithContentTypeBuilderWorkflow sets a workflow engine for content type builder panels.

func WithContentTypeBuilderWorkflowAuthorizer added in v0.24.0

func WithContentTypeBuilderWorkflowAuthorizer(authorizer WorkflowAuthorizer) ContentTypeBuilderOption

WithContentTypeBuilderWorkflowAuthorizer sets a workflow authorizer for builder panels.

type ContentTypeCreateMsg added in v0.23.0

type ContentTypeCreateMsg struct {
	ContentType CMSContentType
}

ContentTypeCreateMsg is a command payload for creating content types.

func (ContentTypeCreateMsg) Type added in v0.23.0

func (ContentTypeCreateMsg) Validate added in v0.23.0

func (m ContentTypeCreateMsg) Validate() error

type ContentTypeDeleteMsg added in v0.23.0

type ContentTypeDeleteMsg struct {
	ID string
}

ContentTypeDeleteMsg is a command payload for deleting content types.

func (ContentTypeDeleteMsg) Type added in v0.23.0

func (ContentTypeDeleteMsg) Validate added in v0.23.0

func (m ContentTypeDeleteMsg) Validate() error

type ContentTypePublishMsg added in v0.23.0

type ContentTypePublishMsg struct {
	ID                   string
	Status               string
	AllowBreakingChanges bool
}

ContentTypePublishMsg is a command payload for publishing content types.

func (ContentTypePublishMsg) Type added in v0.23.0

func (ContentTypePublishMsg) Validate added in v0.23.0

func (m ContentTypePublishMsg) Validate() error

type ContentTypeUpdateMsg added in v0.23.0

type ContentTypeUpdateMsg struct {
	ContentType CMSContentType
}

ContentTypeUpdateMsg is a command payload for updating content types.

func (ContentTypeUpdateMsg) Type added in v0.23.0

func (ContentTypeUpdateMsg) Validate added in v0.23.0

func (m ContentTypeUpdateMsg) Validate() error

type ConvertedFields added in v0.23.0

type ConvertedFields struct {
	List    []Field
	Form    []Field
	Detail  []Field
	Filters []Filter
}

ConvertedFields captures the derived list/form/detail fields and filters.

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) WithLogger added in v0.25.0

func (d *Dashboard) WithLogger(logger Logger)

WithLogger sets the runtime logger used by dashboard internals.

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 DashboardDiagnosticsMsg added in v0.24.0

type DashboardDiagnosticsMsg struct {
	Locale string `json:"locale,omitempty"`
	Area   string `json:"area,omitempty"`
}

DashboardDiagnosticsMsg requests dashboard diagnostics for a locale/area.

func (DashboardDiagnosticsMsg) Type added in v0.24.0

Type identifies the dashboard diagnostics query.

type DashboardDiagnosticsReport added in v0.24.0

type DashboardDiagnosticsReport struct {
	Locale           string                 `json:"locale"`
	Areas            []WidgetAreaDefinition `json:"areas"`
	Providers        int                    `json:"providers"`
	Definitions      int                    `json:"definitions"`
	Instances        int                    `json:"instances"`
	InstancesByArea  map[string]int         `json:"instances_by_area"`
	ResolvedByArea   map[string]int         `json:"resolved_by_area"`
	ResolveErrors    map[string]string      `json:"resolve_errors,omitempty"`
	WidgetService    string                 `json:"widget_service,omitempty"`
	HasWidgetService bool                   `json:"has_widget_service"`
}

DashboardDiagnosticsReport captures resolved dashboard state for troubleshooting.

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) CaptureJSError added in v0.24.0

func (c *DebugCollector) CaptureJSError(entry JSErrorEntry)

CaptureJSError records a frontend JavaScript error.

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) SessionSnapshot added in v0.24.0

func (c *DebugCollector) SessionSnapshot(sessionID string, opts DebugSessionSnapshotOptions) map[string]any

SessionSnapshot returns session-scoped debug data filtered by session ID.

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 using a background context.

func (*DebugCollector) SnapshotWithContext added in v0.25.0

func (c *DebugCollector) SnapshotWithContext(ctx context.Context) map[string]any

SnapshotWithContext returns current state of all panels using the provided context.

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.

func (*DebugCollector) WithSessionStore added in v0.24.0

func (c *DebugCollector) WithSessionStore(store DebugUserSessionStore) *DebugCollector

WithSessionStore configures the debug user session store.

func (*DebugCollector) WithURLs added in v0.24.0

func (c *DebugCollector) WithURLs(urls urlkit.Resolver) *DebugCollector

WithURLs sets the URL resolver used for debug integrations.

type DebugConfig added in v0.14.0

type DebugConfig struct {
	Enabled            bool
	CaptureSQL         bool
	CaptureLogs        bool
	CaptureRequestBody bool
	// CaptureJSErrors enables the global JS error collector on all pages.
	// When true, an inline script is injected into every page <head> that
	// captures uncaught exceptions, unhandled rejections, and console.error
	// calls, then reports them to the debug backend. This flag is independent
	// of ToolbarMode — the collector works in production without the toolbar.
	CaptureJSErrors  bool
	StrictQueryHooks bool
	MaxLogEntries    int
	MaxSQLQueries    int
	MaskFieldTypes   map[string]string
	MaskPlaceholder  string
	Panels           []string
	FeatureKey       string
	Permission       string
	BasePath         string
	// AppID identifies the running application instance for remote debug clients.
	AppID string
	// AppName is a human-friendly application name for remote debug clients.
	AppName string
	// Environment labels the current deployment (e.g., "staging", "prod").
	Environment string
	// RemoteEnabled toggles the remote debug identity/token endpoints.
	RemoteEnabled bool
	// TokenTTL overrides the default TTL for debug exchange tokens.
	TokenTTL time.Duration
	// AllowedOrigins restricts remote debug origins (identity/token/ws).
	AllowedOrigins []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
	// SessionTracking enables debug session tracking with optional cookie fallback.
	SessionTracking bool
	// SessionIncludeGlobalPanels controls whether global panels are included in session views.
	SessionIncludeGlobalPanels *bool
	// SessionCookieName controls the debug session cookie name.
	SessionCookieName string
	// SessionInactivityExpiry controls the TTL for session cookies and session registry expiry.
	SessionInactivityExpiry time.Duration
}

DebugConfig controls the debug module behavior and feature flags.

func (DebugConfig) SessionIncludeGlobalPanelsEnabled added in v0.24.0

func (cfg DebugConfig) SessionIncludeGlobalPanelsEnabled() bool

SessionIncludeGlobalPanelsEnabled returns the effective session global panel toggle.

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

func (*DebugModule) WithMenuParent added in v0.24.0

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

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

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 DebugPanelWidgetPayload added in v0.25.0

type DebugPanelWidgetPayload struct {
	Panel string `json:"panel"`
	Label string `json:"label"`
	Icon  string `json:"icon,omitempty"`
	Data  any    `json:"data"`
}

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 DebugSessionSnapshotOptions added in v0.24.0

type DebugSessionSnapshotOptions struct {
	IncludeGlobalPanels bool
}

DebugSessionSnapshotOptions controls session-scoped snapshot behavior.

type DebugUserSession added in v0.24.0

type DebugUserSession struct {
	SessionID    string         `json:"session_id"`
	UserID       string         `json:"user_id"`
	Username     string         `json:"username"`
	IP           string         `json:"ip"`
	UserAgent    string         `json:"user_agent"`
	CurrentPage  string         `json:"current_page"`
	StartedAt    time.Time      `json:"started_at"`
	LastActivity time.Time      `json:"last_activity"`
	RequestCount int            `json:"request_count"`
	Metadata     map[string]any `json:"metadata,omitempty"`
}

DebugUserSession tracks an active user session for session-scoped debug views.

type DebugUserSessionStore added in v0.24.0

type DebugUserSessionStore interface {
	Upsert(ctx context.Context, session DebugUserSession) error
	Get(ctx context.Context, sessionID string) (DebugUserSession, bool, error)
	ListActive(ctx context.Context) ([]DebugUserSession, error)
	Expire(ctx context.Context, olderThan time.Duration) (int, error)
}

DebugUserSessionStore persists active debug user 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 DefaultIconRenderer added in v0.25.0

type DefaultIconRenderer struct {
	// CDNURLs maps library IDs to their CDN stylesheet URLs.
	CDNURLs map[string]string
	// ClassPatterns maps library IDs to class patterns (e.g., "iconoir-{name}").
	ClassPatterns map[string]string
	// DefaultSize is the default icon size CSS value.
	DefaultSize string
	// SecurityValidator validates and sanitizes icon content.
	SecurityValidator *IconSecurityValidator
}

DefaultIconRenderer implements IconRenderer with standard HTML output.

func NewDefaultIconRenderer added in v0.25.0

func NewDefaultIconRenderer(policy IconSecurityPolicy) *DefaultIconRenderer

NewDefaultIconRenderer creates a new DefaultIconRenderer with sensible defaults.

func (*DefaultIconRenderer) Render added in v0.25.0

Render produces HTML for the given icon reference.

type DefaultPageMapper added in v0.24.0

type DefaultPageMapper struct{}

DefaultPageMapper provides a baseline mapping of admin read models to form values.

func (DefaultPageMapper) ToFormValues added in v0.24.0

func (DefaultPageMapper) ToFormValues(record AdminPageRecord) map[string]any

ToFormValues maps an admin record into form values.

type DefaultTranslationQueueAutoCreateHook added in v0.25.0

type DefaultTranslationQueueAutoCreateHook struct {
	Repository TranslationAssignmentRepository
	Logger     *slog.Logger
}

DefaultTranslationQueueAutoCreateHook implements auto-create using the assignment repository.

func (*DefaultTranslationQueueAutoCreateHook) OnTranslationBlocker added in v0.25.0

OnTranslationBlocker creates or reuses queue assignments for missing locales. Errors are logged but not propagated to preserve primary policy response.

type DefaultTranslationQueueService added in v0.25.0

type DefaultTranslationQueueService struct {
	Repository    TranslationAssignmentRepository
	Activity      ActivitySink
	Notifications NotificationService
	URLs          urlkit.Resolver
}

DefaultTranslationQueueService implements queue lifecycle transitions over a repository.

func (*DefaultTranslationQueueService) Approve added in v0.25.0

func (*DefaultTranslationQueueService) Archive added in v0.25.0

func (*DefaultTranslationQueueService) Assign added in v0.25.0

func (*DefaultTranslationQueueService) BulkArchive added in v0.25.0

func (*DefaultTranslationQueueService) BulkAssign added in v0.25.0

func (*DefaultTranslationQueueService) BulkPriority added in v0.25.0

func (*DefaultTranslationQueueService) BulkRelease added in v0.25.0

func (*DefaultTranslationQueueService) Claim added in v0.25.0

func (*DefaultTranslationQueueService) Reject added in v0.25.0

func (*DefaultTranslationQueueService) Release added in v0.25.0

func (*DefaultTranslationQueueService) SubmitReview added in v0.25.0

type DeliveryContentService added in v0.23.0

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

DeliveryContentService adapts CMS content for delivery.

func NewDeliveryContentService added in v0.23.0

func NewDeliveryContentService(container CMSContainer, opts DeliveryOptions) *DeliveryContentService

NewDeliveryContentService constructs a delivery content service.

func (*DeliveryContentService) Create added in v0.23.0

func (*DeliveryContentService) CreateBatch added in v0.23.0

func (*DeliveryContentService) Delete added in v0.23.0

func (*DeliveryContentService) DeleteBatch added in v0.23.0

func (*DeliveryContentService) Index added in v0.23.0

func (*DeliveryContentService) Show added in v0.23.0

func (*DeliveryContentService) Update added in v0.23.0

func (*DeliveryContentService) UpdateBatch added in v0.23.0

type DeliveryMenuService added in v0.23.0

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

DeliveryMenuService adapts CMS menus for delivery.

func NewDeliveryMenuService added in v0.23.0

func NewDeliveryMenuService(container CMSContainer, opts DeliveryOptions) *DeliveryMenuService

NewDeliveryMenuService constructs a delivery menu service.

func (*DeliveryMenuService) Create added in v0.23.0

func (*DeliveryMenuService) CreateBatch added in v0.23.0

func (s *DeliveryMenuService) CreateBatch(crud.Context, []delivery.Menu) ([]delivery.Menu, error)

func (*DeliveryMenuService) Delete added in v0.23.0

func (*DeliveryMenuService) DeleteBatch added in v0.23.0

func (s *DeliveryMenuService) DeleteBatch(crud.Context, []delivery.Menu) error

func (*DeliveryMenuService) Index added in v0.23.0

func (*DeliveryMenuService) Show added in v0.23.0

func (*DeliveryMenuService) Update added in v0.23.0

func (*DeliveryMenuService) UpdateBatch added in v0.23.0

func (s *DeliveryMenuService) UpdateBatch(crud.Context, []delivery.Menu) ([]delivery.Menu, error)

type DeliveryOptions added in v0.23.0

type DeliveryOptions struct {
	DefaultLocale string
}

DeliveryOptions configures delivery adapters.

type DeliveryPageService added in v0.23.0

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

DeliveryPageService adapts CMS pages for delivery.

func NewDeliveryPageService added in v0.23.0

func NewDeliveryPageService(container CMSContainer, opts DeliveryOptions) *DeliveryPageService

NewDeliveryPageService constructs a delivery page service.

func (*DeliveryPageService) Create added in v0.23.0

func (*DeliveryPageService) CreateBatch added in v0.23.0

func (s *DeliveryPageService) CreateBatch(crud.Context, []delivery.Page) ([]delivery.Page, error)

func (*DeliveryPageService) Delete added in v0.23.0

func (*DeliveryPageService) DeleteBatch added in v0.23.0

func (s *DeliveryPageService) DeleteBatch(crud.Context, []delivery.Page) error

func (*DeliveryPageService) Index added in v0.23.0

func (*DeliveryPageService) Show added in v0.23.0

func (*DeliveryPageService) Update added in v0.23.0

func (*DeliveryPageService) UpdateBatch added in v0.23.0

func (s *DeliveryPageService) UpdateBatch(crud.Context, []delivery.Page) ([]delivery.Page, error)

type DeliveryServices added in v0.23.0

type DeliveryServices struct {
	Contents crud.Service[delivery.Content]
	Pages    crud.Service[delivery.Page]
	Menus    crud.Service[delivery.Menu]
}

DeliveryServices bundles CRUD-compatible services for GraphQL resolvers.

func NewDeliveryServices added in v0.23.0

func NewDeliveryServices(container CMSContainer, opts DeliveryOptions) DeliveryServices

NewDeliveryServices builds read-only services backed by CMS adapters.

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
	Logger Logger

	LoggerProvider LoggerProvider

	CMSContainer        CMSContainer
	CMSContainerBuilder CMSContainerBuilder

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

	Authorizer                     Authorizer
	Authenticator                  Authenticator
	Translator                     Translator
	Workflow                       WorkflowEngine
	WorkflowRuntime                WorkflowRuntime
	TranslationPolicy              TranslationPolicy
	ActivitySink                   ActivitySink
	ActivityRepository             types.ActivityRepository
	ActivityAccessPolicy           activity.ActivityAccessPolicy
	ActivityFeedQuery              ActivityFeedQuerier
	ActivityService                ActivityFeedQuerier
	ActivityEnricher               activity.ActivityEnricher
	ActivityEnrichmentErrorHandler activity.EnrichmentErrorHandler
	ActivityEnrichmentWriteMode    activity.EnrichmentWriteMode
	ActivitySessionIDProvider      activity.SessionIDProvider
	ActivitySessionIDKey           string
	DebugREPLSessionStore          DebugREPLSessionStore
	DebugUserSessionStore          DebugUserSessionStore

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

	PreferencesStore PreferencesStore
	ProfileStore     ProfileStore

	UserRepository         UserRepository
	RoleRepository         RoleRepository
	TenantRepository       TenantRepository
	OrganizationRepository OrganizationRepository
	BulkUserImport         *command.BulkUserImportCommand

	SettingsService *SettingsService

	IconService *IconService

	FeatureGate            fggate.FeatureGate
	FeatureCatalog         catalog.Catalog
	FeatureCatalogResolver catalog.MessageResolver
}

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

type DevErrorContext added in v0.24.0

type DevErrorContext struct {
	ErrorMessage    string           `json:"error_message"`
	ErrorType       string           `json:"error_type,omitempty"`
	TextCode        string           `json:"text_code,omitempty"`
	Category        string           `json:"category,omitempty"`
	PrimarySource   *SourceContext   `json:"primary_source,omitempty"`
	StackFrames     []StackFrameInfo `json:"stack_frames,omitempty"`
	RequestInfo     *RequestInfo     `json:"request_info,omitempty"`
	EnvironmentInfo *EnvironmentInfo `json:"environment_info,omitempty"`
	Metadata        map[string]any   `json:"metadata,omitempty"`
}

DevErrorContext holds all developer-friendly error context.

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 DoctorAction added in v0.25.0

type DoctorAction struct {
	Label                string           `json:"label,omitempty"`
	CTA                  string           `json:"cta,omitempty"`
	Description          string           `json:"description,omitempty"`
	Kind                 DoctorActionKind `json:"kind,omitempty"`
	AllowedStatuses      []DoctorSeverity `json:"allowed_statuses,omitempty"`
	RequiresConfirmation bool             `json:"requires_confirmation,omitempty"`
	ConfirmText          string           `json:"confirm_text,omitempty"`
	Metadata             map[string]any   `json:"metadata,omitempty"`
	Run                  DoctorActionRun  `json:"-"`
}

DoctorAction describes the "how to fix" metadata for a check and optional executable action.

func NewManualDoctorAction added in v0.25.0

func NewManualDoctorAction(description, cta string) *DoctorAction

NewManualDoctorAction returns a manual CTA descriptor for checks that require human intervention.

type DoctorActionExecution added in v0.25.0

type DoctorActionExecution struct {
	CheckID  string            `json:"check_id"`
	Status   string            `json:"status,omitempty"`
	Message  string            `json:"message,omitempty"`
	Metadata map[string]any    `json:"metadata,omitempty"`
	Snapshot DoctorCheckResult `json:"snapshot,omitempty"`
}

DoctorActionExecution is returned when a doctor action is invoked.

type DoctorActionKind added in v0.25.0

type DoctorActionKind string

DoctorActionKind indicates whether a doctor action is automated or manual guidance.

const (
	DoctorActionKindManual DoctorActionKind = "manual"
	DoctorActionKindAuto   DoctorActionKind = "auto"
)

type DoctorActionRun added in v0.25.0

type DoctorActionRun func(ctx context.Context, adm *Admin, check DoctorCheckResult, input map[string]any) (DoctorActionExecution, error)

DoctorActionRun executes a doctor action handler.

type DoctorActionState added in v0.25.0

type DoctorActionState struct {
	Label                string           `json:"label,omitempty"`
	CTA                  string           `json:"cta,omitempty"`
	Description          string           `json:"description,omitempty"`
	Kind                 DoctorActionKind `json:"kind,omitempty"`
	AllowedStatuses      []DoctorSeverity `json:"allowed_statuses,omitempty"`
	RequiresConfirmation bool             `json:"requires_confirmation,omitempty"`
	ConfirmText          string           `json:"confirm_text,omitempty"`
	Applicable           bool             `json:"applicable"`
	Runnable             bool             `json:"runnable"`
	Metadata             map[string]any   `json:"metadata,omitempty"`
}

DoctorActionState is the frontend-safe action descriptor for an evaluated check result.

type DoctorCheck added in v0.25.0

type DoctorCheck struct {
	ID          string        `json:"id"`
	Label       string        `json:"label,omitempty"`
	Description string        `json:"description,omitempty"`
	Help        string        `json:"help,omitempty"`
	Action      *DoctorAction `json:"action,omitempty"`
	Run         func(ctx context.Context, adm *Admin) DoctorCheckOutput
}

DoctorCheck defines a diagnostic check that can run in the debug doctor panel.

type DoctorCheckOutput added in v0.25.0

type DoctorCheckOutput struct {
	Summary  string          `json:"summary,omitempty"`
	Findings []DoctorFinding `json:"findings,omitempty"`
	Metadata map[string]any  `json:"metadata,omitempty"`
}

DoctorCheckOutput is produced by a single diagnostic check.

type DoctorCheckResult added in v0.25.0

type DoctorCheckResult struct {
	ID          string             `json:"id"`
	Label       string             `json:"label"`
	Description string             `json:"description,omitempty"`
	Help        string             `json:"help,omitempty"`
	Status      DoctorSeverity     `json:"status"`
	Summary     string             `json:"summary,omitempty"`
	DurationMS  int64              `json:"duration_ms"`
	Findings    []DoctorFinding    `json:"findings,omitempty"`
	Action      *DoctorActionState `json:"action,omitempty"`
	Metadata    map[string]any     `json:"metadata,omitempty"`
}

DoctorCheckResult is the rendered output for a check run.

type DoctorDebugPanel added in v0.25.0

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

DoctorDebugPanel implements the DebugPanel interface for setup diagnostics.

func NewDoctorDebugPanel added in v0.25.0

func NewDoctorDebugPanel(admin *Admin) *DoctorDebugPanel

NewDoctorDebugPanel creates a new doctor debug panel.

func (*DoctorDebugPanel) Collect added in v0.25.0

func (p *DoctorDebugPanel) Collect(ctx context.Context) map[string]any

Collect gathers doctor diagnostics for the current request context.

func (*DoctorDebugPanel) ID added in v0.25.0

func (p *DoctorDebugPanel) ID() string

ID returns the panel identifier.

func (*DoctorDebugPanel) Icon added in v0.25.0

func (p *DoctorDebugPanel) Icon() string

Icon returns the panel icon class.

func (*DoctorDebugPanel) Label added in v0.25.0

func (p *DoctorDebugPanel) Label() string

Label returns the panel display label.

func (*DoctorDebugPanel) Span added in v0.25.0

func (p *DoctorDebugPanel) Span() int

Span returns the panel grid span.

type DoctorFinding added in v0.25.0

type DoctorFinding struct {
	CheckID   string         `json:"check_id,omitempty"`
	Severity  DoctorSeverity `json:"severity"`
	Code      string         `json:"code,omitempty"`
	Component string         `json:"component,omitempty"`
	Message   string         `json:"message"`
	Hint      string         `json:"hint,omitempty"`
	Metadata  map[string]any `json:"metadata,omitempty"`
}

DoctorFinding captures one actionable diagnostic item.

type DoctorReport added in v0.25.0

type DoctorReport struct {
	GeneratedAt time.Time           `json:"generated_at"`
	Verdict     DoctorSeverity      `json:"verdict"`
	Summary     DoctorSummary       `json:"summary"`
	Checks      []DoctorCheckResult `json:"checks"`
	Findings    []DoctorFinding     `json:"findings,omitempty"`
	NextActions []string            `json:"next_actions,omitempty"`
}

DoctorReport is the complete diagnostics snapshot for the app setup.

type DoctorSeverity added in v0.25.0

type DoctorSeverity string

DoctorSeverity describes diagnostic severity levels.

const (
	DoctorSeverityOK    DoctorSeverity = "ok"
	DoctorSeverityInfo  DoctorSeverity = "info"
	DoctorSeverityWarn  DoctorSeverity = "warn"
	DoctorSeverityError DoctorSeverity = "error"
)

type DoctorSummary added in v0.25.0

type DoctorSummary struct {
	Checks int `json:"checks"`
	OK     int `json:"ok"`
	Info   int `json:"info"`
	Warn   int `json:"warn"`
	Error  int `json:"error"`
}

DoctorSummary aggregates overall doctor counts.

type DomainErrorCode added in v0.24.0

type DomainErrorCode struct {
	Code        string
	Description string
	Category    goerrors.Category
	HTTPStatus  int
}

DomainErrorCode describes a text code exposed to clients.

func DomainErrorCodeFor added in v0.24.0

func DomainErrorCodeFor(code string) (DomainErrorCode, bool)

DomainErrorCodeFor returns metadata for a registered domain error code.

func DomainErrorCodes added in v0.24.0

func DomainErrorCodes() []DomainErrorCode

DomainErrorCodes returns all registered codes sorted by code.

type DynamicPanelFactory added in v0.23.0

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

DynamicPanelFactory builds CRUD panels from CMS content types.

func NewDynamicPanelFactory added in v0.23.0

func NewDynamicPanelFactory(admin *Admin, opts ...DynamicPanelFactoryOption) *DynamicPanelFactory

NewDynamicPanelFactory constructs a factory for dynamic content type panels.

func (*DynamicPanelFactory) CreatePanelFromContentType added in v0.23.0

func (f *DynamicPanelFactory) CreatePanelFromContentType(ctx context.Context, contentType *CMSContentType) (*Panel, error)

CreatePanelFromContentType generates and registers a panel for a content type.

func (*DynamicPanelFactory) RefreshPanel added in v0.23.0

func (f *DynamicPanelFactory) RefreshPanel(ctx context.Context, contentType *CMSContentType) error

RefreshPanel updates an existing panel when the content type changes.

func (*DynamicPanelFactory) RemovePanel added in v0.23.0

func (f *DynamicPanelFactory) RemovePanel(ctx context.Context, slugOrID string) error

RemovePanel removes a panel when a content type is deleted.

type DynamicPanelFactoryOption added in v0.23.0

type DynamicPanelFactoryOption func(*DynamicPanelFactory)

DynamicPanelFactoryOption customizes the factory.

func WithDynamicPanelHooks added in v0.23.0

func WithDynamicPanelHooks(hooks DynamicPanelHooks) DynamicPanelFactoryOption

WithDynamicPanelHooks sets lifecycle hooks for the factory.

func WithDynamicPanelMenu added in v0.23.0

func WithDynamicPanelMenu(basePath, menuCode, menuParent, locale string) DynamicPanelFactoryOption

WithDynamicPanelMenu configures navigation defaults for dynamic panels.

func WithDynamicPanelSchemaConverter added in v0.23.0

func WithDynamicPanelSchemaConverter(converter *SchemaToFieldsConverter) DynamicPanelFactoryOption

WithDynamicPanelSchemaConverter sets a schema converter.

func WithDynamicPanelSchemaValidator added in v0.23.0

func WithDynamicPanelSchemaValidator(validator SchemaValidator) DynamicPanelFactoryOption

WithDynamicPanelSchemaValidator sets a schema validator.

type DynamicPanelHooks added in v0.23.0

type DynamicPanelHooks struct {
	BeforeCreate func(ctx context.Context, contentType *CMSContentType) error
	AfterCreate  func(ctx context.Context, panel *Panel) error
	BeforeUpdate func(ctx context.Context, contentType *CMSContentType) error
	AfterUpdate  func(ctx context.Context, panel *Panel) error
}

DynamicPanelHooks exposes lifecycle callbacks for panel creation.

type EnsureMenuParentsOptions

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

EnsureMenuParentsOptions controls how parent/group menu items are scaffolded.

type EnvironmentInfo added in v0.24.0

type EnvironmentInfo struct {
	GoVersion   string            `json:"go_version,omitempty"`
	AppVersion  string            `json:"app_version,omitempty"`
	Environment string            `json:"environment,omitempty"`
	Debug       bool              `json:"debug"`
	ConfigVars  map[string]string `json:"config_vars,omitempty"`
}

EnvironmentInfo holds runtime environment details.

type ErrorConfig added in v0.24.0

type ErrorConfig struct {
	// DevMode enables developer-friendly error responses.
	DevMode bool
	// IncludeStackTrace controls stack trace inclusion when DevMode is false.
	IncludeStackTrace bool
	// ExposeInternalMessages allows internal error messages to reach clients.
	ExposeInternalMessages bool
	// InternalMessage is the default message for internal errors when not exposed.
	InternalMessage string
	// SourceContextLines controls how many lines of source code to show around errors.
	// Default is 7 lines before and after.
	SourceContextLines int
	// MaxStackFrames limits the number of stack frames to display.
	// Default is 20 frames.
	MaxStackFrames int
	// ShowRequestHeaders includes HTTP headers in dev error pages.
	ShowRequestHeaders bool
	// ShowRequestBody includes request body in dev error pages.
	ShowRequestBody bool
	// ShowEnvironment includes environment info in dev error pages.
	ShowEnvironment bool
	// AppVersion is displayed in the error page environment section.
	AppVersion string
}

ErrorConfig controls how errors are presented to clients.

type ErrorPresenter added in v0.24.0

type ErrorPresenter struct {
	Config  ErrorConfig
	Mappers []goerrors.ErrorMapper
}

func DefaultErrorPresenter added in v0.24.0

func DefaultErrorPresenter() ErrorPresenter

DefaultErrorPresenter returns the presenter used by writeError.

func NewErrorPresenter added in v0.24.0

func NewErrorPresenter(cfg ErrorConfig, mappers ...goerrors.ErrorMapper) ErrorPresenter

NewErrorPresenter constructs an error presenter with default mappers.

func (ErrorPresenter) BuildDevErrorContext added in v0.24.0

func (p ErrorPresenter) BuildDevErrorContext(err error, reqInfo *RequestInfo) *DevErrorContext

BuildDevErrorContext creates an enriched error context for developer error pages.

func (ErrorPresenter) IncludeStackTrace added in v0.24.0

func (p ErrorPresenter) IncludeStackTrace() bool

IncludeStackTrace returns whether stack traces should be included in responses.

func (ErrorPresenter) Present added in v0.24.0

func (p ErrorPresenter) Present(err error) (*goerrors.Error, int)

Present maps an error to a go-errors error and status code.

func (ErrorPresenter) PresentWithContext added in v0.24.0

func (p ErrorPresenter) PresentWithContext(c router.Context, err error) (*goerrors.Error, int)

PresentWithContext maps an error and enriches it with request metadata.

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) WithBasePath added in v0.24.0

func (m *FeatureFlagsModule) WithBasePath(basePath string) *FeatureFlagsModule

WithBasePath sets the base path used for menu item targets (e.g., /admin).

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"
	FeatureActivity            FeatureKey = "activity"
	FeaturePreview             FeatureKey = "preview"
	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"
	FeatureTranslationExchange FeatureKey = "translations.exchange"
	FeatureTranslationQueue    FeatureKey = "translations.queue"
)

type Field

type Field struct {
	Name       string   `json:"name"`
	Label      string   `json:"label"`
	LabelKey   string   `json:"label_key,omitempty"`
	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 FieldTypeCategory added in v0.24.0

type FieldTypeCategory struct {
	ID        string `json:"id"`
	Label     string `json:"label"`
	Icon      string `json:"icon,omitempty"`
	Order     int    `json:"order"`
	Collapsed bool   `json:"collapsed,omitempty"`
}

FieldTypeCategory describes a palette group.

type FieldTypeCategoryGroup added in v0.24.0

type FieldTypeCategoryGroup struct {
	Category   FieldTypeCategory     `json:"category"`
	FieldTypes []FieldTypeDefinition `json:"field_types"`
}

FieldTypeCategoryGroup bundles field types by category.

func BlockFieldTypeGroups added in v0.24.0

func BlockFieldTypeGroups() []FieldTypeCategoryGroup

BlockFieldTypeGroups exposes the default grouped palette for the Block IDE.

type FieldTypeDefinition added in v0.24.0

type FieldTypeDefinition struct {
	Type        string         `json:"type"`
	Label       string         `json:"label"`
	Description string         `json:"description,omitempty"`
	Category    string         `json:"category"`
	Icon        string         `json:"icon,omitempty"`
	Defaults    map[string]any `json:"defaults,omitempty"`
	Order       int            `json:"order"`
}

FieldTypeDefinition describes a single field option in the Block Library palette.

type FieldTypeRegistry added in v0.24.0

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

FieldTypeRegistry stores field type metadata for the Block Library palette.

func DefaultBlockFieldTypeRegistry added in v0.24.0

func DefaultBlockFieldTypeRegistry() *FieldTypeRegistry

DefaultBlockFieldTypeRegistry returns the default block field type registry.

func NewFieldTypeRegistry added in v0.24.0

func NewFieldTypeRegistry() *FieldTypeRegistry

NewFieldTypeRegistry constructs an empty registry.

func (*FieldTypeRegistry) Categories added in v0.24.0

func (r *FieldTypeRegistry) Categories() []FieldTypeCategory

Categories returns registered categories ordered by position then ID.

func (*FieldTypeRegistry) FieldTypes added in v0.24.0

func (r *FieldTypeRegistry) FieldTypes() []FieldTypeDefinition

FieldTypes returns registered field types ordered by category then position.

func (*FieldTypeRegistry) Groups added in v0.24.0

Groups returns field types grouped by category in order.

func (*FieldTypeRegistry) Register added in v0.24.0

func (r *FieldTypeRegistry) Register(def FieldTypeDefinition)

Register adds or replaces a field type definition.

func (*FieldTypeRegistry) RegisterCategory added in v0.24.0

func (r *FieldTypeRegistry) RegisterCategory(category FieldTypeCategory)

RegisterCategory adds or replaces a category definition.

type FieldsLogger added in v0.25.0

type FieldsLogger = glog.FieldsLogger

FieldsLogger is an optional structured logging extension.

type Filter

type Filter struct {
	Name            string   `json:"name"`
	Label           string   `json:"label,omitempty"`
	LabelKey        string   `json:"label_key,omitempty"`
	Type            string   `json:"type"`
	Operators       []string `json:"operators,omitempty"`
	DefaultOperator string   `json:"default_operator,omitempty"`
	Options         []Option `json:"options,omitempty"`
}

Filter defines a filter input.

type FormgenSchemaValidator added in v0.23.0

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

func NewFormgenSchemaValidator added in v0.23.0

func NewFormgenSchemaValidator(basePath string) (*FormgenSchemaValidator, error)

NewFormgenSchemaValidator builds a formgen-backed schema validator/previewer.

func NewFormgenSchemaValidatorWithAPIBase added in v0.24.0

func NewFormgenSchemaValidatorWithAPIBase(basePath, apiBase string) (*FormgenSchemaValidator, error)

NewFormgenSchemaValidatorWithAPIBase builds a formgen-backed schema validator/previewer with an explicit API base.

func (*FormgenSchemaValidator) Preview added in v0.23.0

func (v *FormgenSchemaValidator) Preview(ctx context.Context, schema map[string]any, opts SchemaValidationOptions) ([]byte, error)

Preview renders a form preview from a schema.

func (*FormgenSchemaValidator) RenderForm added in v0.24.0

func (v *FormgenSchemaValidator) RenderForm(ctx context.Context, schema map[string]any, opts SchemaValidationOptions, renderOpts formgenrender.RenderOptions) (string, error)

RenderForm renders HTML for a schema using formgen with custom render options.

func (*FormgenSchemaValidator) Validate added in v0.23.0

func (v *FormgenSchemaValidator) Validate(ctx context.Context, schema map[string]any, opts SchemaValidationOptions) error

Validate verifies that a schema can be normalized by go-formgen.

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.

func (*GoAuthAuthorizer) CanAll added in v0.25.0

func (a *GoAuthAuthorizer) CanAll(ctx context.Context, resource string, permissions ...string) bool

CanAll returns true when all permissions are allowed.

func (*GoAuthAuthorizer) CanAny added in v0.25.0

func (a *GoAuthAuthorizer) CanAny(ctx context.Context, resource string, permissions ...string) bool

CanAny returns true when at least one permission is allowed.

func (*GoAuthAuthorizer) PermissionResolverMetrics added in v0.25.0

func (a *GoAuthAuthorizer) PermissionResolverMetrics() PermissionResolverMetrics

PermissionResolverMetrics exposes resolver/caching runtime counters.

func (*GoAuthAuthorizer) ResolvedPermissions added in v0.25.0

func (a *GoAuthAuthorizer) ResolvedPermissions(ctx context.Context) []string

ResolvedPermissions returns the deduplicated permission set resolved for the request context.

type GoAuthAuthorizerConfig

type GoAuthAuthorizerConfig struct {
	DefaultResource    string
	Debug              bool
	Logger             Logger
	StrictResolver     bool
	ResolvePermissions PermissionResolverFunc
}

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) ContentTypeService added in v0.23.0

func (c *GoCMSContainerAdapter) ContentTypeService() CMSContentTypeService

func (*GoCMSContainerAdapter) MenuService

func (c *GoCMSContainerAdapter) MenuService() CMSMenuService

func (*GoCMSContainerAdapter) WidgetService

func (c *GoCMSContainerAdapter) WidgetService() CMSWidgetService

type GoCMSContentAdapter added in v0.23.0

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

GoCMSContentAdapter maps go-cms content/block services into CMSContentService. It uses the typed public go-cms contracts.

func (*GoCMSContentAdapter) BlockDefinitionVersions added in v0.24.0

func (a *GoCMSContentAdapter) BlockDefinitionVersions(ctx context.Context, id string) ([]CMSBlockDefinitionVersion, error)

BlockDefinitionVersions returns the schema version history for a block definition.

func (*GoCMSContentAdapter) BlockDefinitions added in v0.23.0

func (a *GoCMSContentAdapter) BlockDefinitions(ctx context.Context) ([]CMSBlockDefinition, error)

func (*GoCMSContentAdapter) BlocksForContent added in v0.23.0

func (a *GoCMSContentAdapter) BlocksForContent(ctx context.Context, contentID, locale string) ([]CMSBlock, error)

func (*GoCMSContentAdapter) Content added in v0.23.0

func (a *GoCMSContentAdapter) Content(ctx context.Context, id, locale string) (*CMSContent, error)

func (*GoCMSContentAdapter) Contents added in v0.23.0

func (a *GoCMSContentAdapter) Contents(ctx context.Context, locale string) ([]CMSContent, error)

func (*GoCMSContentAdapter) ContentsWithOptions added in v0.24.0

func (a *GoCMSContentAdapter) ContentsWithOptions(ctx context.Context, locale string, opts ...CMSContentListOption) ([]CMSContent, error)

ContentsWithOptions lists CMS content using go-cms list options (for example WithTranslations). Contents remains the default behavior (no opt-in options).

func (*GoCMSContentAdapter) CreateBlockDefinition added in v0.23.0

func (a *GoCMSContentAdapter) CreateBlockDefinition(ctx context.Context, def CMSBlockDefinition) (*CMSBlockDefinition, error)

func (*GoCMSContentAdapter) CreateContent added in v0.23.0

func (a *GoCMSContentAdapter) CreateContent(ctx context.Context, content CMSContent) (*CMSContent, error)

func (*GoCMSContentAdapter) CreatePage added in v0.23.0

func (a *GoCMSContentAdapter) CreatePage(ctx context.Context, page CMSPage) (*CMSPage, error)

func (*GoCMSContentAdapter) CreateTranslation added in v0.25.0

func (a *GoCMSContentAdapter) CreateTranslation(ctx context.Context, input TranslationCreateInput) (*CMSContent, error)

CreateTranslation attempts to use a first-class go-cms translation command when available.

func (*GoCMSContentAdapter) DeleteBlock added in v0.23.0

func (a *GoCMSContentAdapter) DeleteBlock(ctx context.Context, id string) error

func (*GoCMSContentAdapter) DeleteBlockDefinition added in v0.23.0

func (a *GoCMSContentAdapter) DeleteBlockDefinition(ctx context.Context, id string) error

func (*GoCMSContentAdapter) DeleteContent added in v0.23.0

func (a *GoCMSContentAdapter) DeleteContent(ctx context.Context, id string) error

func (*GoCMSContentAdapter) DeletePage added in v0.23.0

func (a *GoCMSContentAdapter) DeletePage(ctx context.Context, id string) error

func (*GoCMSContentAdapter) LegacyBlocksForContent added in v0.23.0

func (a *GoCMSContentAdapter) LegacyBlocksForContent(ctx context.Context, contentID, locale string) ([]CMSBlock, error)

func (*GoCMSContentAdapter) Page added in v0.23.0

func (a *GoCMSContentAdapter) Page(ctx context.Context, id, locale string) (*CMSPage, error)

func (*GoCMSContentAdapter) Pages added in v0.23.0

func (a *GoCMSContentAdapter) Pages(ctx context.Context, locale string) ([]CMSPage, error)

func (*GoCMSContentAdapter) SaveBlock added in v0.23.0

func (a *GoCMSContentAdapter) SaveBlock(ctx context.Context, block CMSBlock) (*CMSBlock, error)

func (*GoCMSContentAdapter) UpdateBlockDefinition added in v0.23.0

func (a *GoCMSContentAdapter) UpdateBlockDefinition(ctx context.Context, def CMSBlockDefinition) (*CMSBlockDefinition, error)

func (*GoCMSContentAdapter) UpdateContent added in v0.23.0

func (a *GoCMSContentAdapter) UpdateContent(ctx context.Context, content CMSContent) (*CMSContent, error)

func (*GoCMSContentAdapter) UpdatePage added in v0.23.0

func (a *GoCMSContentAdapter) UpdatePage(ctx context.Context, page CMSPage) (*CMSPage, error)

type GoCMSContentTypeAdapter added in v0.23.0

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

GoCMSContentTypeAdapter maps go-cms content type service into CMSContentTypeService.

func (*GoCMSContentTypeAdapter) ContentType added in v0.23.0

func (a *GoCMSContentTypeAdapter) ContentType(ctx context.Context, id string) (*CMSContentType, error)

func (*GoCMSContentTypeAdapter) ContentTypeBySlug added in v0.23.0

func (a *GoCMSContentTypeAdapter) ContentTypeBySlug(ctx context.Context, slug string) (*CMSContentType, error)

func (*GoCMSContentTypeAdapter) ContentTypes added in v0.23.0

func (a *GoCMSContentTypeAdapter) ContentTypes(ctx context.Context) ([]CMSContentType, error)

func (*GoCMSContentTypeAdapter) CreateContentType added in v0.23.0

func (a *GoCMSContentTypeAdapter) CreateContentType(ctx context.Context, contentType CMSContentType) (*CMSContentType, error)

func (*GoCMSContentTypeAdapter) DeleteContentType added in v0.23.0

func (a *GoCMSContentTypeAdapter) DeleteContentType(ctx context.Context, id string) error

func (*GoCMSContentTypeAdapter) UpdateContentType added in v0.23.0

func (a *GoCMSContentTypeAdapter) UpdateContentType(ctx context.Context, contentType CMSContentType) (*CMSContentType, error)

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) MenuByLocation added in v0.22.0

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

MenuByLocation resolves a localized navigation tree using menu locations.

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 GoCMSTranslationPolicy added in v0.24.0

type GoCMSTranslationPolicy struct {
	Pages    cmsinterfaces.PageService
	Content  cmsinterfaces.ContentService
	Resolver TranslationRequirementsResolver
}

GoCMSTranslationPolicy enforces translation requirements using go-cms checks.

func (GoCMSTranslationPolicy) Requirements added in v0.25.0

Requirements resolves transition requirements when the policy exposes a resolver.

func (GoCMSTranslationPolicy) Validate added in v0.24.0

Validate enforces the translation requirements resolved for the transition.

type GoCMSWidgetAdapter

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

GoCMSWidgetAdapter maps go-cms widgets.Service into CMSWidgetService.

func NewGoCMSWidgetAdapter

func NewGoCMSWidgetAdapter(service any) *GoCMSWidgetAdapter

NewGoCMSWidgetAdapter wraps a go-cms widgets.Service (or compatible typed service).

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) HasInstanceForDefinition added in v0.24.0

func (a *GoCMSWidgetAdapter) HasInstanceForDefinition(ctx context.Context, definitionCode string, filter WidgetInstanceFilter) (bool, error)

HasInstanceForDefinition reports whether at least one instance exists for the given definition code.

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 GuardrailedSchemaValidator added in v0.23.0

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

GuardrailedSchemaValidator wraps a SchemaValidator with guardrail checks

func NewGuardrailedSchemaValidator added in v0.23.0

func NewGuardrailedSchemaValidator(inner SchemaValidator, guardrails *SchemaGuardrails) *GuardrailedSchemaValidator

NewGuardrailedSchemaValidator creates a validator with guardrail checks

func (*GuardrailedSchemaValidator) Guardrails added in v0.23.0

Guardrails returns the underlying guardrails instance

func (*GuardrailedSchemaValidator) Preview added in v0.23.0

func (v *GuardrailedSchemaValidator) Preview(ctx context.Context, schema map[string]any, opts SchemaValidationOptions) ([]byte, error)

Preview renders a form preview after guardrail validation

func (*GuardrailedSchemaValidator) Validate added in v0.23.0

Validate applies guardrails then delegates to the inner validator

type HandlerAuthenticator

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

HandlerAuthenticator can wrap handlers directly to preserve middleware semantics.

type IconCategory added in v0.25.0

type IconCategory struct {
	// ID is the unique identifier for this category.
	ID string `json:"id"`
	// Label is the human-readable display name.
	Label string `json:"label"`
	// LabelKey is the i18n translation key for the label.
	LabelKey string `json:"label_key,omitempty"`
	// Count is the number of icons in this category (populated at runtime).
	Count int `json:"count,omitempty"`
}

IconCategory groups related icons within a library.

type IconContributor added in v0.25.0

type IconContributor interface {
	// IconLibraries returns icon libraries this module provides.
	// Libraries are registered during module loading and available for
	// icon resolution and rendering.
	IconLibraries() []IconLibrary

	// IconDefinitions returns standalone icon definitions.
	// Icons without an explicit library are added to the "custom" library.
	IconDefinitions() []IconDefinition
}

IconContributor allows modules to contribute icon libraries and definitions. Modules implementing this interface can register custom icon sets that will be available for icon pickers and rendering throughout the admin panel.

type IconContributorAdapter added in v0.25.0

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

IconContributorAdapter provides a simple way to create an IconContributor from functions or static data.

func NewIconContributorAdapter added in v0.25.0

func NewIconContributorAdapter(libraries []IconLibrary, icons []IconDefinition) *IconContributorAdapter

NewIconContributorAdapter creates a new adapter with the given libraries and icons.

func (*IconContributorAdapter) IconDefinitions added in v0.25.0

func (a *IconContributorAdapter) IconDefinitions() []IconDefinition

IconDefinitions implements IconContributor.

func (*IconContributorAdapter) IconLibraries added in v0.25.0

func (a *IconContributorAdapter) IconLibraries() []IconLibrary

IconLibraries implements IconContributor.

func (*IconContributorAdapter) WithIcon added in v0.25.0

WithIcon adds an icon to the adapter.

func (*IconContributorAdapter) WithLibrary added in v0.25.0

WithLibrary adds a library to the adapter.

type IconContributorCallbacks added in v0.25.0

type IconContributorCallbacks struct {
	// OnLibrary is called for each library contributed by a module.
	OnLibrary func(lib IconLibrary) error
	// OnIcon is called for each standalone icon contributed by a module.
	OnIcon func(icon IconDefinition) error
}

IconContributorCallbacks holds callbacks for processing icon contributions.

type IconDefinition added in v0.25.0

type IconDefinition struct {
	// ID is the unique identifier for this icon (e.g., "iconoir:settings").
	ID string `json:"id"`
	// Name is the short key used in menus/panels (e.g., "settings").
	Name string `json:"name"`
	// Label is the human-readable display name.
	Label string `json:"label,omitempty"`
	// LabelKey is the i18n translation key for the label.
	LabelKey string `json:"label_key,omitempty"`
	// Type categorizes the icon source.
	Type IconType `json:"type"`
	// Library identifies the icon library (e.g., "iconoir", "lucide", "custom").
	Library string `json:"library,omitempty"`
	// Content holds the icon data: emoji char, SVG markup, or URL.
	Content string `json:"content,omitempty"`
	// Keywords for search/filtering.
	Keywords []string `json:"keywords,omitempty"`
	// Category groups related icons.
	Category string `json:"category,omitempty"`
	// Variants maps variant names to alternate content (e.g., "dark" -> SVG with fill:#fff).
	Variants map[string]string `json:"variants,omitempty"`
	// Trusted indicates whether this icon definition comes from a trusted source.
	Trusted bool `json:"trusted,omitempty"`
	// Metadata for additional icon properties.
	Metadata map[string]any `json:"metadata,omitempty"`
}

IconDefinition represents a single icon with metadata.

type IconLibrary added in v0.25.0

type IconLibrary struct {
	// ID is the unique library identifier (e.g., "iconoir", "lucide", "app-icons").
	ID string `json:"id"`
	// Name is the display name.
	Name string `json:"name"`
	// Description explains the library.
	Description string `json:"description,omitempty"`
	// Version tracks library version for cache invalidation.
	Version string `json:"version,omitempty"`
	// CDN is the optional CSS/JS CDN URL for library icons.
	CDN string `json:"cdn,omitempty"`
	// CSSClass is the class prefix pattern (e.g., "iconoir-{name}").
	CSSClass string `json:"css_class,omitempty"`
	// RenderMode specifies how to render icons from this library.
	RenderMode IconRenderMode `json:"render_mode,omitempty"`
	// Priority determines sort order in picker (lower = first).
	Priority int `json:"priority,omitempty"`
	// Icons contains all icons in this library.
	Icons []IconDefinition `json:"icons,omitempty"`
	// Categories groups icons within the library.
	Categories []IconCategory `json:"categories,omitempty"`
	// Trusted indicates whether icons from this library are trusted.
	Trusted bool `json:"trusted,omitempty"`
}

IconLibrary represents a collection of icons from a single source.

func BuiltinEmojiLibrary added in v0.25.0

func BuiltinEmojiLibrary() IconLibrary

BuiltinEmojiLibrary returns the emoji "library" configuration. Emojis are detected automatically; this library provides metadata.

func BuiltinIconoirLibrary added in v0.25.0

func BuiltinIconoirLibrary() IconLibrary

BuiltinIconoirLibrary returns the default Iconoir library configuration with a curated set of sidebar/navigation icons.

func BuiltinLucideLibrary added in v0.25.0

func BuiltinLucideLibrary() IconLibrary

BuiltinLucideLibrary returns the Lucide icon library configuration.

type IconReference added in v0.25.0

type IconReference struct {
	// Raw is the original input string.
	Raw string `json:"raw"`
	// Type is the resolved icon type.
	Type IconType `json:"type"`
	// Library is the resolved library ID for library icons.
	Library string `json:"library,omitempty"`
	// Value is the resolved icon value (name, emoji, SVG content, or URL).
	Value string `json:"value"`
	// Qualified indicates whether the input used explicit prefix syntax.
	Qualified bool `json:"qualified,omitempty"`
	// LegacyMapped indicates whether svgFieldTypeKeys mapping was applied.
	LegacyMapped bool `json:"legacy_mapped,omitempty"`
}

IconReference is a parsed icon string with resolved type and library.

func ParseIconReference added in v0.25.0

func ParseIconReference(value string) IconReference

ParseIconReference parses an icon string into a structured reference.

Parsing precedence (strict order):

  1. Empty string -> empty reference
  2. emoji:<value> -> emoji
  3. svg:<svg...> -> svg
  4. url:<value> -> url
  5. Raw <svg...> -> svg (legacy convenience)
  6. Raw http://, https://, or data: -> url
  7. Qualified <library>:<name> -> library
  8. Legacy iconoir-<name> -> library iconoir, name stripped
  9. Legacy svgFieldTypeKeys mapping -> mapped Iconoir name with LegacyMapped=true
  10. Bare name -> default library (iconoir)

func (IconReference) IsEmpty added in v0.25.0

func (r IconReference) IsEmpty() bool

IsEmpty returns true if the reference represents an empty icon.

type IconRenderMode added in v0.25.0

type IconRenderMode string

IconRenderMode specifies how an icon should be rendered to HTML.

const (
	// IconRenderModeUnknown indicates the render mode is not specified.
	IconRenderModeUnknown IconRenderMode = ""
	// IconRenderModeCSS renders as <i class="prefix-{name}">.
	IconRenderModeCSS IconRenderMode = "css-class"
	// IconRenderModeSVG renders as inline <svg>...</svg>.
	IconRenderModeSVG IconRenderMode = "inline-svg"
	// IconRenderModeImg renders as <img src="...">.
	IconRenderModeImg IconRenderMode = "img-url"
	// IconRenderModeSpan renders as <span>content</span>.
	IconRenderModeSpan IconRenderMode = "span"
)

type IconRenderOptions added in v0.25.0

type IconRenderOptions struct {
	// Variant selects a specific icon variant (e.g., "dark", "light").
	Variant string
	// TrustedInput indicates the icon value comes from a trusted source.
	TrustedInput bool
	// AllowCustomUntrusted permits custom SVG/URL for untrusted input.
	AllowCustomUntrusted bool
	// Size is the CSS size value (e.g., "20px", "1.5rem").
	Size string
	// Classes are additional CSS classes to apply.
	Classes []string
	// Style is additional inline CSS.
	Style string
	// AriaLabel sets the aria-label for accessibility.
	AriaLabel string
	// AriaHidden hides the icon from screen readers.
	AriaHidden bool
}

IconRenderOptions configures icon rendering behavior.

func RenderOptionsForAPI added in v0.25.0

func RenderOptionsForAPI(trusted bool) IconRenderOptions

RenderOptionsForAPI returns render options for API-requested icon rendering.

func RenderOptionsForModule added in v0.25.0

func RenderOptionsForModule() IconRenderOptions

RenderOptionsForModule returns render options for module-contributed icons.

func RenderOptionsForTemplate added in v0.25.0

func RenderOptionsForTemplate() IconRenderOptions

RenderOptions returns the render options for a specific context.

type IconRenderer added in v0.25.0

type IconRenderer interface {
	// Render produces HTML for the given icon reference.
	Render(ref IconReference, def *IconDefinition, opts IconRenderOptions) string
}

IconRenderer produces HTML output for icons.

type IconSecurityPolicy added in v0.25.0

type IconSecurityPolicy struct {
	// AllowUntrustedCustom permits custom SVG/URL for untrusted input.
	// Default: false
	AllowUntrustedCustom bool

	// AllowDataURI permits data: URIs.
	// For trusted input, default is true. For untrusted, follows AllowUntrustedCustom.
	AllowDataURI bool

	// AllowedExternalSchemes lists permitted URL schemes.
	// Default: ["https"]
	AllowedExternalSchemes []string

	// AllowedDataMIMEs lists permitted MIME types for data URIs.
	// Default: ["image/svg+xml", "image/png", "image/jpeg", "image/webp", "image/gif"]
	AllowedDataMIMEs []string

	// MaxSVGBytes is the maximum allowed size for SVG content.
	// Default: 65536 (64KB)
	MaxSVGBytes int

	// MaxDataURIBytes is the maximum allowed size for data URI payloads.
	// Default: 131072 (128KB)
	MaxDataURIBytes int

	// AllowedExternalHosts is an optional allowlist of external hosts.
	// Empty means any host with allowed scheme is permitted.
	AllowedExternalHosts []string
}

IconSecurityPolicy configures security restrictions for icon rendering.

func DefaultIconSecurityPolicy added in v0.25.0

func DefaultIconSecurityPolicy() IconSecurityPolicy

DefaultIconSecurityPolicy returns the default security policy.

type IconSecurityResult added in v0.25.0

type IconSecurityResult struct {
	// Allowed indicates whether the icon can be rendered.
	Allowed bool
	// Reason explains why the icon was blocked (empty if allowed).
	Reason string
	// SanitizedContent contains sanitized SVG content (if applicable).
	SanitizedContent string
	// ValidatedURL contains the validated URL (if applicable).
	ValidatedURL string
}

IconSecurityResult represents the result of security validation.

type IconSecurityValidator added in v0.25.0

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

IconSecurityValidator validates and sanitizes icon content.

func NewIconSecurityValidator added in v0.25.0

func NewIconSecurityValidator(policy IconSecurityPolicy) *IconSecurityValidator

NewIconSecurityValidator creates a new validator with the given policy.

func (*IconSecurityValidator) ValidateIcon added in v0.25.0

ValidateIcon validates an icon reference based on trust level.

type IconService added in v0.25.0

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

IconService manages icon libraries and provides icon resolution and rendering.

func NewIconService added in v0.25.0

func NewIconService(opts ...IconServiceOption) *IconService

NewIconService creates a new IconService with optional configuration.

func (*IconService) Categories added in v0.25.0

func (s *IconService) Categories(libraryID string) []IconCategory

Categories returns the categories for a library with icon counts.

func (*IconService) Defaults added in v0.25.0

func (s *IconService) Defaults() IconServiceDefaults

Defaults returns the current default settings.

func (*IconService) Libraries added in v0.25.0

func (s *IconService) Libraries() []IconLibrary

Libraries returns all registered libraries sorted by priority then ID.

func (*IconService) Library added in v0.25.0

func (s *IconService) Library(id string) (IconLibrary, bool)

Library returns a library by ID.

func (*IconService) LibraryIcons added in v0.25.0

func (s *IconService) LibraryIcons(libraryID, category string) []IconDefinition

LibraryIcons returns icons from a specific library, optionally filtered by category.

func (*IconService) RegisterIcon added in v0.25.0

func (s *IconService) RegisterIcon(icon IconDefinition) error

RegisterIcon adds a single icon definition, using the "custom" library if no library is specified.

func (*IconService) RegisterLibrary added in v0.25.0

func (s *IconService) RegisterLibrary(lib IconLibrary) error

RegisterLibrary adds an icon library to the service.

func (*IconService) Render added in v0.25.0

func (s *IconService) Render(ref IconReference, opts IconRenderOptions) string

Render produces HTML for the given icon reference.

func (*IconService) RenderFromString added in v0.25.0

func (s *IconService) RenderFromString(rawRef string, trusted bool, variant string) string

RenderFromString parses and renders an icon string with explicit trust and variant. This method satisfies the quickstart.TemplateIconRenderer interface for template integration.

func (*IconService) RenderString added in v0.25.0

func (s *IconService) RenderString(value string, opts IconRenderOptions) string

RenderString parses and renders an icon string.

func (*IconService) Renderer added in v0.25.0

func (s *IconService) Renderer() *DefaultIconRenderer

Renderer returns the icon renderer.

func (*IconService) Resolve added in v0.25.0

func (s *IconService) Resolve(ref IconReference) (*IconDefinition, error)

Resolve returns the icon definition for a reference.

func (*IconService) ResolveString added in v0.25.0

func (s *IconService) ResolveString(value string) (*IconDefinition, error)

ResolveString parses and resolves an icon string.

func (*IconService) Search added in v0.25.0

func (s *IconService) Search(ctx context.Context, query string, limit int, libraryIDs ...string) []IconDefinition

Search finds icons matching a query across all or specified libraries.

func (*IconService) SecurityPolicy added in v0.25.0

func (s *IconService) SecurityPolicy() IconSecurityPolicy

SecurityPolicy returns the current security policy.

func (*IconService) UnregisterLibrary added in v0.25.0

func (s *IconService) UnregisterLibrary(id string) error

UnregisterLibrary removes a library and its icons from the service.

type IconServiceDefaults added in v0.25.0

type IconServiceDefaults struct {
	// DefaultLibrary is used when no library prefix is specified.
	DefaultLibrary string
	// FallbackIcon is rendered when an icon cannot be resolved.
	FallbackIcon string
	// DefaultVariant is the default theme variant.
	DefaultVariant string
}

IconServiceDefaults configures fallback behavior for icon resolution.

type IconServiceOption added in v0.25.0

type IconServiceOption func(*IconService)

IconServiceOption configures the icon service.

func WithDefaultLibrary added in v0.25.0

func WithDefaultLibrary(library string) IconServiceOption

WithDefaultLibrary sets the default library for bare icon names.

func WithDefaultVariant added in v0.25.0

func WithDefaultVariant(variant string) IconServiceOption

WithDefaultVariant sets the default theme variant.

func WithFallbackIcon added in v0.25.0

func WithFallbackIcon(icon string) IconServiceOption

WithFallbackIcon sets the fallback icon for unresolved references.

func WithIconSecurityPolicy added in v0.25.0

func WithIconSecurityPolicy(policy IconSecurityPolicy) IconServiceOption

WithIconSecurityPolicy sets the security policy.

func WithIconServiceLogger added in v0.25.0

func WithIconServiceLogger(logger Logger) IconServiceOption

WithIconServiceLogger sets the logger for the icon service.

type IconType added in v0.25.0

type IconType string

IconType categorizes the source/format of an icon.

const (
	// IconTypeUnknown indicates the icon type could not be determined.
	IconTypeUnknown IconType = ""
	// IconTypeEmoji represents a Unicode emoji character.
	IconTypeEmoji IconType = "emoji"
	// IconTypeLibrary represents a named icon from an icon library.
	IconTypeLibrary IconType = "library"
	// IconTypeSVG represents inline SVG markup.
	IconTypeSVG IconType = "svg"
	// IconTypeURL represents an external URL or data URI.
	IconTypeURL IconType = "url"
)

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) BlockDefinitionVersions added in v0.24.0

func (s *InMemoryContentService) BlockDefinitionVersions(ctx context.Context, id string) ([]CMSBlockDefinitionVersion, error)

BlockDefinitionVersions returns the schema versions for a definition.

func (*InMemoryContentService) BlockDefinitions

func (s *InMemoryContentService) BlockDefinitions(ctx 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) ContentType added in v0.23.0

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

ContentType returns a content type by id.

func (*InMemoryContentService) ContentTypeBySlug added in v0.23.0

func (s *InMemoryContentService) ContentTypeBySlug(ctx context.Context, slug string) (*CMSContentType, error)

ContentTypeBySlug returns a content type by slug.

func (*InMemoryContentService) ContentTypes added in v0.23.0

func (s *InMemoryContentService) ContentTypes(ctx context.Context) ([]CMSContentType, error)

ContentTypes returns all content type definitions.

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) CreateContentType added in v0.23.0

func (s *InMemoryContentService) CreateContentType(ctx context.Context, contentType CMSContentType) (*CMSContentType, error)

CreateContentType inserts a content type definition.

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) DeleteContentType added in v0.23.0

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

DeleteContentType removes a content type definition.

func (*InMemoryContentService) DeletePage

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

DeletePage removes a page.

func (*InMemoryContentService) LegacyBlocksForContent added in v0.23.0

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

LegacyBlocksForContent returns legacy block instances without embedded fallback.

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) UpdateContentType added in v0.23.0

func (s *InMemoryContentService) UpdateContentType(ctx context.Context, contentType CMSContentType) (*CMSContentType, error)

UpdateContentType updates an existing content type definition.

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 InMemoryDebugUserSessionStore added in v0.24.0

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

InMemoryDebugUserSessionStore keeps sessions in memory.

func NewInMemoryDebugUserSessionStore added in v0.24.0

func NewInMemoryDebugUserSessionStore() *InMemoryDebugUserSessionStore

NewInMemoryDebugUserSessionStore constructs a memory-backed store.

func (*InMemoryDebugUserSessionStore) Expire added in v0.24.0

func (s *InMemoryDebugUserSessionStore) Expire(_ context.Context, olderThan time.Duration) (int, error)

Expire removes sessions whose last activity is older than the threshold.

func (*InMemoryDebugUserSessionStore) Get added in v0.24.0

Get returns a session by session ID.

func (*InMemoryDebugUserSessionStore) ListActive added in v0.24.0

ListActive returns active session snapshots.

func (*InMemoryDebugUserSessionStore) Upsert added in v0.24.0

Upsert inserts or updates a session entry, deduping by user_id + session_id.

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) MenuByLocation added in v0.22.0

func (s *InMemoryMenuService) MenuByLocation(ctx context.Context, location, locale string) (*Menu, error)

MenuByLocation returns a menu resolved by location.

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 InMemoryTranslationAssignmentRepository added in v0.25.0

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

InMemoryTranslationAssignmentRepository provides active-key uniqueness and optimistic locking constraints.

func NewInMemoryTranslationAssignmentRepository added in v0.25.0

func NewInMemoryTranslationAssignmentRepository() *InMemoryTranslationAssignmentRepository

NewInMemoryTranslationAssignmentRepository builds an empty in-memory queue store.

func (*InMemoryTranslationAssignmentRepository) Create added in v0.25.0

Create inserts a new assignment and enforces one active assignment per canonical key.

func (*InMemoryTranslationAssignmentRepository) CreateOrReuseActive added in v0.25.0

CreateOrReuseActive inserts a new assignment or reuses/refreshed an existing active one.

func (*InMemoryTranslationAssignmentRepository) Get added in v0.25.0

Get retrieves an assignment by id.

func (*InMemoryTranslationAssignmentRepository) List added in v0.25.0

List returns queue assignments filtered by list options.

func (*InMemoryTranslationAssignmentRepository) Update added in v0.25.0

Update updates an assignment when the expected version matches the current stored version.

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) HasInstanceForDefinition added in v0.24.0

func (s *InMemoryWidgetService) HasInstanceForDefinition(_ context.Context, definitionCode string, filter WidgetInstanceFilter) (bool, error)

HasInstanceForDefinition reports whether a widget instance exists for a definition.

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 InMemoryWorkflowBindingRepository added in v0.25.0

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

InMemoryWorkflowBindingRepository stores scope bindings with active uniqueness.

func NewInMemoryWorkflowBindingRepository added in v0.25.0

func NewInMemoryWorkflowBindingRepository() *InMemoryWorkflowBindingRepository

NewInMemoryWorkflowBindingRepository constructs an empty binding store.

func (*InMemoryWorkflowBindingRepository) Create added in v0.25.0

func (*InMemoryWorkflowBindingRepository) Delete added in v0.25.0

func (*InMemoryWorkflowBindingRepository) Get added in v0.25.0

func (*InMemoryWorkflowBindingRepository) List added in v0.25.0

func (*InMemoryWorkflowBindingRepository) ListByScope added in v0.25.0

func (*InMemoryWorkflowBindingRepository) Update added in v0.25.0

func (r *InMemoryWorkflowBindingRepository) Update(_ context.Context, binding WorkflowBinding, expectedVersion int) (WorkflowBinding, error)

type InMemoryWorkflowDefinitionRepository added in v0.25.0

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

InMemoryWorkflowDefinitionRepository stores workflows with revision snapshots.

func NewInMemoryWorkflowDefinitionRepository added in v0.25.0

func NewInMemoryWorkflowDefinitionRepository() *InMemoryWorkflowDefinitionRepository

NewInMemoryWorkflowDefinitionRepository constructs an empty workflow definition store.

func (*InMemoryWorkflowDefinitionRepository) Create added in v0.25.0

func (*InMemoryWorkflowDefinitionRepository) Get added in v0.25.0

func (*InMemoryWorkflowDefinitionRepository) GetVersion added in v0.25.0

func (*InMemoryWorkflowDefinitionRepository) List added in v0.25.0

func (*InMemoryWorkflowDefinitionRepository) Update added in v0.25.0

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 JSErrorEntry added in v0.24.0

type JSErrorEntry struct {
	ID        string         `json:"id"`
	Timestamp time.Time      `json:"timestamp"`
	Type      string         `json:"type"`
	Message   string         `json:"message"`
	Source    string         `json:"source,omitempty"`
	Line      int            `json:"line,omitempty"`
	Column    int            `json:"column,omitempty"`
	Stack     string         `json:"stack,omitempty"`
	URL       string         `json:"url,omitempty"`
	UserAgent string         `json:"user_agent,omitempty"`
	Extra     map[string]any `json:"extra,omitempty"`
}

JSErrorEntry captures a frontend JavaScript error reported by the browser.

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 LegacyChartSampleWidgetPayload added in v0.25.0

type LegacyChartSampleWidgetPayload struct {
	Title string                    `json:"title"`
	Type  string                    `json:"type"`
	Data  []ChartPointWidgetPayload `json:"data"`
}

type ListOptions

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

ListOptions holds pagination and filtering input.

type ListPredicate added in v0.24.0

type ListPredicate struct {
	Field    string   `json:"field"`
	Operator string   `json:"operator"`
	Values   []string `json:"values,omitempty"`
}

ListPredicate defines an operator-aware list filter predicate.

func NormalizeListPredicates added in v0.24.0

func NormalizeListPredicates(opts ListOptions) []ListPredicate

NormalizeListPredicates returns operator-aware predicates for list filtering. It prefers explicit opts.Predicates and falls back to legacy opts.Filters.

type LogEntry added in v0.14.0

type LogEntry struct {
	Timestamp time.Time      `json:"timestamp"`
	SessionID string         `json:"session_id,omitempty"`
	UserID    string         `json:"user_id,omitempty"`
	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 Logger added in v0.25.0

type Logger = glog.Logger

Logger is a go-logger compatible leveled logger contract.

type LoggerProvider added in v0.25.0

type LoggerProvider = glog.LoggerProvider

LoggerProvider resolves named loggers.

type ManagementContentService added in v0.23.0

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

ManagementContentService adapts CMS content for management APIs.

func NewManagementContentService added in v0.23.0

func NewManagementContentService(container CMSContainer, opts DeliveryOptions) *ManagementContentService

func (*ManagementContentService) Create added in v0.23.0

func (*ManagementContentService) CreateBatch added in v0.23.0

func (s *ManagementContentService) CreateBatch(ctx crud.Context, records []admingraphql.Content) ([]admingraphql.Content, error)

func (*ManagementContentService) Delete added in v0.23.0

func (*ManagementContentService) DeleteBatch added in v0.23.0

func (s *ManagementContentService) DeleteBatch(ctx crud.Context, records []admingraphql.Content) error

func (*ManagementContentService) Index added in v0.23.0

func (*ManagementContentService) Show added in v0.23.0

func (*ManagementContentService) Update added in v0.23.0

func (*ManagementContentService) UpdateBatch added in v0.23.0

func (s *ManagementContentService) UpdateBatch(ctx crud.Context, records []admingraphql.Content) ([]admingraphql.Content, error)

type ManagementContentTypeService added in v0.23.0

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

ManagementContentTypeService adapts CMS content types for management APIs.

func NewManagementContentTypeService added in v0.23.0

func NewManagementContentTypeService(container CMSContainer) *ManagementContentTypeService

func (*ManagementContentTypeService) Create added in v0.23.0

func (*ManagementContentTypeService) CreateBatch added in v0.23.0

func (*ManagementContentTypeService) Delete added in v0.23.0

func (*ManagementContentTypeService) DeleteBatch added in v0.23.0

func (s *ManagementContentTypeService) DeleteBatch(ctx crud.Context, records []admingraphql.ContentType) error

func (*ManagementContentTypeService) Index added in v0.23.0

func (*ManagementContentTypeService) Show added in v0.23.0

func (*ManagementContentTypeService) Update added in v0.23.0

func (*ManagementContentTypeService) UpdateBatch added in v0.23.0

type ManagementPageService added in v0.23.0

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

ManagementPageService adapts CMS pages for management APIs.

func NewManagementPageService added in v0.23.0

func NewManagementPageService(container CMSContainer, opts DeliveryOptions) *ManagementPageService

func (*ManagementPageService) Create added in v0.23.0

func (*ManagementPageService) CreateBatch added in v0.23.0

func (s *ManagementPageService) CreateBatch(ctx crud.Context, records []admingraphql.Page) ([]admingraphql.Page, error)

func (*ManagementPageService) Delete added in v0.23.0

func (s *ManagementPageService) Delete(ctx crud.Context, record admingraphql.Page) error

func (*ManagementPageService) DeleteBatch added in v0.23.0

func (s *ManagementPageService) DeleteBatch(ctx crud.Context, records []admingraphql.Page) error

func (*ManagementPageService) Index added in v0.23.0

func (*ManagementPageService) Show added in v0.23.0

func (*ManagementPageService) Update added in v0.23.0

func (*ManagementPageService) UpdateBatch added in v0.23.0

func (s *ManagementPageService) UpdateBatch(ctx crud.Context, records []admingraphql.Page) ([]admingraphql.Page, error)

type ManagementServices added in v0.23.0

type ManagementServices struct {
	Contents     crud.Service[admingraphql.Content]
	Pages        crud.Service[admingraphql.Page]
	ContentTypes crud.Service[admingraphql.ContentType]
}

ManagementServices bundles CRUD-compatible services for management GraphQL.

func NewManagementServices added in v0.23.0

func NewManagementServices(container CMSContainer, opts DeliveryOptions) ManagementServices

NewManagementServices builds management services backed by CMS adapters.

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 MissingTranslationsError added in v0.24.0

type MissingTranslationsError struct {
	EntityType              string
	PolicyEntity            string
	EntityID                string
	Transition              string
	Environment             string
	RequestedLocale         string
	MissingLocales          []string
	MissingFieldsByLocale   map[string][]string
	RequiredFieldsEvaluated bool
}

MissingTranslationsError reports which locales are required but absent.

func (MissingTranslationsError) Error added in v0.24.0

func (e MissingTranslationsError) Error() string

func (MissingTranslationsError) Unwrap added in v0.24.0

func (e MissingTranslationsError) Unwrap() error

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 is the default module router and is auth-protected when auth is configured.
	Router AdminRouter
	// ProtectedRouter always wraps routes with admin auth middleware when auth is configured.
	ProtectedRouter AdminRouter
	// PublicRouter bypasses auth middleware and must be used explicitly for public endpoints.
	PublicRouter AdminRouter
	// AuthMiddleware exposes the admin auth middleware for selective route protection.
	AuthMiddleware router.MiddlewareFunc
	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 ModuleStartupPolicy added in v0.25.0

type ModuleStartupPolicy string

ModuleStartupPolicy controls how startup validation errors are handled.

const (
	// ModuleStartupPolicyEnforce treats module startup validation errors as fatal.
	ModuleStartupPolicyEnforce ModuleStartupPolicy = "enforce"
	// ModuleStartupPolicyWarn logs module startup validation errors and continues.
	ModuleStartupPolicyWarn ModuleStartupPolicy = "warn"
)

type ModuleStartupValidator added in v0.25.0

type ModuleStartupValidator interface {
	ValidateStartup(ctx context.Context) error
}

ModuleStartupValidator can run additional startup checks after module registration.

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) ContentTypeService added in v0.23.0

func (c *NoopCMSContainer) ContentTypeService() CMSContentTypeService

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(locale, key string, args ...any) (string, error)

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 NotificationsWidgetPayload added in v0.25.0

type NotificationsWidgetPayload struct {
	Notifications []Notification `json:"notifications"`
	Unread        int            `json:"unread"`
}

type ObjectResolverFunc added in v0.22.0

type ObjectResolverFunc func(ctx context.Context, objectType string, ids []string, meta usersactivity.ResolveContext) (map[string]usersactivity.ObjectInfo, error)

ObjectResolverFunc adapts a function into an ObjectResolver.

func (ObjectResolverFunc) ResolveObjects added in v0.22.0

func (f ObjectResolverFunc) ResolveObjects(ctx context.Context, objectType string, ids []string, meta usersactivity.ResolveContext) (map[string]usersactivity.ObjectInfo, error)

ResolveObjects satisfies usersactivity.ObjectResolver.

type ObjectResolverMap added in v0.22.0

type ObjectResolverMap struct {
	Resolvers map[string]usersactivity.ObjectResolver
	Fallback  usersactivity.ObjectResolver
}

ObjectResolverMap dispatches object resolution by object type.

func (ObjectResolverMap) ResolveObjects added in v0.22.0

func (m ObjectResolverMap) ResolveObjects(ctx context.Context, objectType string, ids []string, meta usersactivity.ResolveContext) (map[string]usersactivity.ObjectInfo, error)

ResolveObjects resolves objects by type, falling back when needed.

type Option

type Option struct {
	Value    any    `json:"value"`
	Label    string `json:"label"`
	LabelKey string `json:"label_key,omitempty"`
}

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 PageApplicationService added in v0.24.0

type PageApplicationService struct {
	Read              AdminPageReadService
	Write             AdminPageWriteService
	Mapper            PageMapper
	Workflow          WorkflowEngine
	TranslationPolicy TranslationPolicy
	IncludeDefaults   *PageReadDefaults
}

PageApplicationService orchestrates admin page reads/writes plus mapping/workflow.

func (PageApplicationService) Create added in v0.24.0

func (s PageApplicationService) Create(ctx context.Context, payload map[string]any) (*AdminPageRecord, error)

Create writes a new page record, applying workflow transitions when configured.

func (PageApplicationService) Delete added in v0.24.0

Delete removes a page record.

func (PageApplicationService) Get added in v0.24.0

Get retrieves a single admin page record using get include defaults.

func (PageApplicationService) List added in v0.24.0

List returns admin page records using list include defaults.

func (PageApplicationService) Publish added in v0.24.0

func (s PageApplicationService) Publish(ctx context.Context, id string, payload map[string]any) (*AdminPageRecord, error)

Publish applies the publish transition before delegating to the write service.

func (PageApplicationService) ToFormValues added in v0.24.0

func (s PageApplicationService) ToFormValues(record AdminPageRecord) map[string]any

ToFormValues maps an admin record into form values.

func (PageApplicationService) Unpublish added in v0.24.0

func (s PageApplicationService) Unpublish(ctx context.Context, id string, payload map[string]any) (*AdminPageRecord, error)

Unpublish applies the unpublish transition before delegating to the write service.

func (PageApplicationService) Update added in v0.24.0

func (s PageApplicationService) Update(ctx context.Context, id string, payload map[string]any) (*AdminPageRecord, error)

Update writes an existing page record, applying workflow transitions when configured.

type PageGetOptions added in v0.24.0

type PageGetOptions struct {
	PageReadOptions
}

PageGetOptions captures get options plus read overrides.

type PageIncludeDefaults added in v0.24.0

type PageIncludeDefaults struct {
	IncludeContent bool
	IncludeBlocks  bool
	IncludeData    bool
}

PageIncludeDefaults defines default include flags for read operations.

type PageListOptions added in v0.24.0

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

PageListOptions captures list options plus read overrides.

type PageMapper added in v0.24.0

type PageMapper interface {
	ToFormValues(record AdminPageRecord) map[string]any
}

PageMapper centralizes mapping between admin read models and form values.

type PageReadDefaults added in v0.24.0

type PageReadDefaults struct {
	List PageIncludeDefaults
	Get  PageIncludeDefaults
}

PageReadDefaults captures include defaults for list/get endpoints.

type PageReadOptions added in v0.24.0

type PageReadOptions struct {
	Locale                   string
	FallbackLocale           string
	AllowMissingTranslations bool
	IncludeContent           *bool
	IncludeBlocks            *bool
	IncludeData              *bool
	EnvironmentKey           string
}

PageReadOptions captures caller overrides for read behavior.

type PageTranslation added in v0.24.0

type PageTranslation = cmsinterfaces.PageTranslation

PageTranslation mirrors the go-cms page translation DTO.

type Panel

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

Panel represents a registered panel.

func RegisterTranslationQueuePanel added in v0.25.0

func RegisterTranslationQueuePanel(admin *Admin, repo TranslationAssignmentRepository) (*Panel, error)

RegisterTranslationQueuePanel registers the translation queue 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) EntryMode added in v0.25.0

func (p *Panel) EntryMode() PanelEntryMode

EntryMode returns the canonical panel entry behavior.

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) ServeSubresource added in v0.25.0

func (p *Panel) ServeSubresource(ctx AdminContext, c router.Context, id, subresource, value string) error

ServeSubresource resolves a panel subresource request.

func (*Panel) Subresources added in v0.25.0

func (p *Panel) Subresources() []PanelSubresource

Subresources returns normalized panel subresource declarations.

func (*Panel) UIRouteMode added in v0.25.0

func (p *Panel) UIRouteMode() PanelUIRouteMode

UIRouteMode returns the panel UI route ownership mode.

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 NewTranslationQueuePanel added in v0.25.0

func NewTranslationQueuePanel(repo Repository) *PanelBuilder

NewTranslationQueuePanel builds the translation queue panel schema and actions.

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) FormSchema added in v0.23.0

func (b *PanelBuilder) FormSchema(schema map[string]any) *PanelBuilder

FormSchema overrides the generated form schema for the panel.

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) Subresources added in v0.25.0

func (b *PanelBuilder) Subresources(subresources ...PanelSubresource) *PanelBuilder

Subresources sets panel subresource route declarations.

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) WithEntryMode added in v0.25.0

func (b *PanelBuilder) WithEntryMode(mode PanelEntryMode) *PanelBuilder

WithEntryMode configures how the panel resolves its canonical entry route.

func (*PanelBuilder) WithRepository

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

WithRepository sets the panel repository.

func (*PanelBuilder) WithTranslationPolicy added in v0.24.0

func (b *PanelBuilder) WithTranslationPolicy(policy TranslationPolicy) *PanelBuilder

WithTranslationPolicy attaches a translation policy to the panel.

func (*PanelBuilder) WithTranslationQueueAutoCreateHook added in v0.25.0

func (b *PanelBuilder) WithTranslationQueueAutoCreateHook(hook TranslationQueueAutoCreateHook) *PanelBuilder

WithTranslationQueueAutoCreateHook attaches a queue auto-create hook to the panel. When set, workflow transitions blocked by missing translations will automatically create/reuse queue assignments for the missing locales.

func (*PanelBuilder) WithUIRouteMode added in v0.25.0

func (b *PanelBuilder) WithUIRouteMode(mode PanelUIRouteMode) *PanelBuilder

WithUIRouteMode configures whether canonical panel UI routes should be auto-wired.

func (*PanelBuilder) WithWorkflow added in v0.22.0

func (b *PanelBuilder) WithWorkflow(w WorkflowEngine) *PanelBuilder

WithWorkflow attaches a workflow engine to the panel.

func (*PanelBuilder) WithWorkflowAuthorizer added in v0.22.0

func (b *PanelBuilder) WithWorkflowAuthorizer(auth WorkflowAuthorizer) *PanelBuilder

WithWorkflowAuthorizer attaches a workflow authorizer to the panel.

type PanelEntryMode added in v0.25.0

type PanelEntryMode string

PanelEntryMode declares which surface a panel should use as its canonical entry point when the base panel route (for example /admin/<panel>) is opened.

const (
	// PanelEntryModeList renders the panel list/datagrid view.
	PanelEntryModeList PanelEntryMode = "list"
	// PanelEntryModeDetailCurrentUser renders the detail view for the current
	// authenticated user ID from request context.
	PanelEntryModeDetailCurrentUser PanelEntryMode = "detail_current_user"
)

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
	BeforeUpdateWithID func(ctx AdminContext, id string, 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 PanelSubresource added in v0.25.0

type PanelSubresource struct {
	Name       string `json:"name"`
	Label      string `json:"label,omitempty"`
	Method     string `json:"method,omitempty"`
	Permission string `json:"permission,omitempty"`
}

PanelSubresource defines a panel-owned HTTP subresource endpoint addressable as /:panel/:id/:name/:value.

type PanelSubresourceRepository added in v0.25.0

type PanelSubresourceRepository interface {
	ResolvePanelSubresource(ctx context.Context, id, subresource, value string) (any, error)
}

PanelSubresourceRepository resolves panel subresource payloads. Responses are JSON encoded by the default panel route handler.

type PanelSubresourceResponder added in v0.25.0

type PanelSubresourceResponder interface {
	ServePanelSubresource(ctx AdminContext, c router.Context, id, subresource, value string) error
}

PanelSubresourceResponder writes panel subresource responses directly. This is useful for non-JSON responses such as binary file downloads.

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 PanelUIRouteMode added in v0.25.0

type PanelUIRouteMode string

PanelUIRouteMode declares who owns the panel's HTML UI route surface.

const (
	// PanelUIRouteModeCanonical means generic canonical UI routes may be auto-wired.
	PanelUIRouteModeCanonical PanelUIRouteMode = "canonical"
	// PanelUIRouteModeCustom means module-specific handlers own the panel UI routes.
	PanelUIRouteModeCustom PanelUIRouteMode = "custom"
)

type PermissionDeniedError added in v0.8.0

type PermissionDeniedError struct {
	Permission     string
	Resource       string
	Hint           string
	ReauthRequired bool
}

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 PermissionEntry added in v0.25.0

type PermissionEntry struct {
	Permission string `json:"permission"`
	Required   bool   `json:"required"`
	InClaims   bool   `json:"in_claims"`
	Allows     bool   `json:"allows"`
	Diagnosis  string `json:"diagnosis"`
	Status     string `json:"status"` // ok, error, warning, info
	Module     string `json:"module,omitempty"`
}

PermissionEntry represents a single permission with its diagnostic status.

type PermissionResolverFunc added in v0.25.0

type PermissionResolverFunc func(context.Context) ([]string, error)

PermissionResolverFunc resolves the effective permission set for a request context.

type PermissionResolverMetrics added in v0.25.0

type PermissionResolverMetrics struct {
	Calls              uint64
	ResolverRuns       uint64
	CacheHits          uint64
	CacheMisses        uint64
	Errors             uint64
	ContextCacheAbsent uint64
}

PermissionResolverMetrics captures resolver/caching behavior counters.

type PermissionsDebugPanel added in v0.25.0

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

PermissionsDebugPanel implements the DebugPanel interface for permissions diagnostics.

func NewPermissionsDebugPanel added in v0.25.0

func NewPermissionsDebugPanel(admin *Admin) *PermissionsDebugPanel

NewPermissionsDebugPanel creates a new permissions debug panel.

func (*PermissionsDebugPanel) Collect added in v0.25.0

func (p *PermissionsDebugPanel) Collect(ctx context.Context) map[string]any

Collect gathers permissions diagnostic data.

func (*PermissionsDebugPanel) ID added in v0.25.0

func (p *PermissionsDebugPanel) ID() string

ID returns the panel identifier.

func (*PermissionsDebugPanel) Icon added in v0.25.0

func (p *PermissionsDebugPanel) Icon() string

Icon returns the panel icon class.

func (*PermissionsDebugPanel) Label added in v0.25.0

func (p *PermissionsDebugPanel) Label() string

Label returns the panel display label.

func (*PermissionsDebugPanel) Span added in v0.25.0

func (p *PermissionsDebugPanel) Span() int

Span returns the panel grid span.

type PermissionsDebugSnapshot added in v0.25.0

type PermissionsDebugSnapshot struct {
	Verdict             string            `json:"verdict"`
	EnabledModules      []string          `json:"enabled_modules"`
	RequiredPermissions map[string]string `json:"required_permissions"` // permission -> module
	ClaimsPermissions   []string          `json:"claims_permissions"`
	PermissionChecks    map[string]bool   `json:"permission_checks"`
	MissingPermissions  []string          `json:"missing_permissions"`
	Entries             []PermissionEntry `json:"entries"`
	Summary             struct {
		ModuleCount  int `json:"module_count"`
		RequiredKeys int `json:"required_keys"`
		ClaimsKeys   int `json:"claims_keys"`
		MissingKeys  int `json:"missing_keys"`
	} `json:"summary"`
	NextActions []string `json:"next_actions"`
	UserInfo    struct {
		UserID   string `json:"user_id,omitempty"`
		Username string `json:"username,omitempty"`
		Role     string `json:"role,omitempty"`
		TenantID string `json:"tenant_id,omitempty"`
		OrgID    string `json:"org_id,omitempty"`
	} `json:"user_info"`
}

PermissionsDebugSnapshot contains the full permissions diagnostic data.

type PersistedWorkflow added in v0.25.0

type PersistedWorkflow struct {
	ID          string                  `json:"id"`
	Name        string                  `json:"name"`
	Definition  WorkflowDefinition      `json:"definition"`
	Status      PersistedWorkflowStatus `json:"status"`
	Version     int                     `json:"version"`
	Environment string                  `json:"environment,omitempty"`
	CreatedAt   time.Time               `json:"created_at"`
	UpdatedAt   time.Time               `json:"updated_at"`
}

PersistedWorkflow stores a workflow definition with lifecycle metadata.

type PersistedWorkflowListOptions added in v0.25.0

type PersistedWorkflowListOptions struct {
	Status      PersistedWorkflowStatus
	Environment string
}

PersistedWorkflowListOptions filters workflow list queries.

type PersistedWorkflowStatus added in v0.25.0

type PersistedWorkflowStatus string

PersistedWorkflowStatus controls rollout state for stored workflow definitions.

const (
	WorkflowStatusDraft      PersistedWorkflowStatus = "draft"
	WorkflowStatusActive     PersistedWorkflowStatus = "active"
	WorkflowStatusDeprecated PersistedWorkflowStatus = "deprecated"
)

func (PersistedWorkflowStatus) IsValid added in v0.25.0

func (s PersistedWorkflowStatus) IsValid() bool

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) WithBasePath added in v0.24.0

func (m *PreferencesModule) WithBasePath(basePath string) *PreferencesModule

WithBasePath sets the base path used for menu item targets (e.g., /admin).

func (*PreferencesModule) WithJSONEditorStrict added in v0.24.0

func (m *PreferencesModule) WithJSONEditorStrict(strict bool) *PreferencesModule

WithJSONEditorStrict toggles client-side JSON editor strictness.

func (*PreferencesModule) WithMenuParent

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

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

func (*PreferencesModule) WithSchemaPath added in v0.24.0

func (m *PreferencesModule) WithSchemaPath(path string) *PreferencesModule

WithSchemaPath overrides the default preferences form schema path.

func (*PreferencesModule) WithSkipMenu added in v0.24.0

func (m *PreferencesModule) WithSkipMenu(skip bool) *PreferencesModule

WithSkipMenu suppresses navigation menu contribution while keeping panel registration.

func (*PreferencesModule) WithViewContextBuilder added in v0.24.0

func (m *PreferencesModule) WithViewContextBuilder(builder PreferencesViewContextBuilder) *PreferencesModule

WithViewContextBuilder injects navigation/session/theme data for the preferences UI.

type PreferencesOption added in v0.20.0

type PreferencesOption func(*PreferencesStoreAdapter)

PreferencesOption customizes the PreferencesStore adapter.

func WithDeleteMissing added in v0.24.0

func WithDeleteMissing(enabled bool) PreferencesOption

WithDeleteMissing controls whether Save deletes persisted keys missing in snapshot.

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 admin.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, meta 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 PreferencesViewContextBuilder added in v0.24.0

type PreferencesViewContextBuilder func(adm *Admin, c router.Context, view router.ViewContext, active string) router.ViewContext

PreferencesViewContextBuilder augments the view context for the preferences UI.

type PreviewService added in v0.22.0

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

PreviewService manages generation and validation of preview tokens.

func NewPreviewService added in v0.22.0

func NewPreviewService(secret string) *PreviewService

NewPreviewService creates a new preview service.

func (*PreviewService) Generate added in v0.22.0

func (s *PreviewService) Generate(entityType, contentID string, duration time.Duration) (string, error)

Generate creates a signed preview token for a record.

func (*PreviewService) GenerateJWT added in v0.22.0

func (s *PreviewService) GenerateJWT(entityType, contentID string, duration time.Duration) (string, error)

GenerateJWT creates a JWT-formatted preview token.

func (*PreviewService) Validate added in v0.22.0

func (s *PreviewService) Validate(tokenString string) (*PreviewToken, error)

Validate parses and verifies a preview token.

type PreviewToken added in v0.22.0

type PreviewToken struct {
	ContentID  string `json:"content_id"`
	EntityType string `json:"entity_type"`
	Expiry     int64  `json:"expiry"`
}

PreviewToken carries metadata for content preview.

type Priority added in v0.25.0

type Priority string

Priority controls assignment urgency.

const (
	PriorityLow    Priority = "low"
	PriorityNormal Priority = "normal"
	PriorityHigh   Priority = "high"
	PriorityUrgent Priority = "urgent"
)

func (Priority) IsValid added in v0.25.0

func (p Priority) IsValid() bool

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.

func (*ProfileModule) WithSkipMenu added in v0.24.0

func (m *ProfileModule) WithSkipMenu(skip bool) *ProfileModule

WithSkipMenu suppresses navigation menu contribution while keeping panel registration.

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 QuickActionWidgetPayload added in v0.25.0

type QuickActionWidgetPayload struct {
	Label       string `json:"label"`
	URL         string `json:"url"`
	Icon        string `json:"icon,omitempty"`
	Method      string `json:"method,omitempty"`
	Description string `json:"description,omitempty"`
}

type QuickActionsWidgetPayload added in v0.25.0

type QuickActionsWidgetPayload struct {
	Actions []QuickActionWidgetPayload `json:"actions"`
}

type RateLimiter added in v0.23.0

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

RateLimiter provides simple rate limiting for schema validation endpoints

func DefaultSchemaRateLimiter added in v0.23.0

func DefaultSchemaRateLimiter() *RateLimiter

DefaultSchemaRateLimiter returns a rate limiter with default settings (30 requests per minute per client)

func NewRateLimiter added in v0.23.0

func NewRateLimiter(maxRequests int, window time.Duration) *RateLimiter

NewRateLimiter creates a rate limiter with the specified limits

func (*RateLimiter) Allow added in v0.23.0

func (r *RateLimiter) Allow(key string) bool

Allow checks if a request from the given key should be allowed

func (*RateLimiter) Cleanup added in v0.23.0

func (r *RateLimiter) Cleanup()

Cleanup removes expired entries from the rate limiter

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.

func (*Registry) UnregisterPanel added in v0.23.0

func (r *Registry) UnregisterPanel(name string) error

UnregisterPanel removes a panel by name and clears associated tab registrations.

func (*Registry) WithLogger added in v0.25.0

func (r *Registry) WithLogger(logger Logger) *Registry

WithLogger sets the registry logger used for runtime diagnostics.

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 RepositoryTranslationCreator added in v0.25.0

type RepositoryTranslationCreator interface {
	CreateTranslation(ctx context.Context, input TranslationCreateInput) (map[string]any, error)
}

RepositoryTranslationCreator allows repositories to provide a first-class translation creation command.

type RequestEntry added in v0.14.0

type RequestEntry struct {
	ID              string            `json:"id"`
	Timestamp       time.Time         `json:"timestamp"`
	SessionID       string            `json:"session_id,omitempty"`
	UserID          string            `json:"user_id,omitempty"`
	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"`
	ContentType     string            `json:"content_type,omitempty"`
	RequestBody     string            `json:"request_body,omitempty"`
	RequestSize     int64             `json:"request_size,omitempty"`
	BodyTruncated   bool              `json:"body_truncated,omitempty"`
	ResponseHeaders map[string]string `json:"response_headers,omitempty"`
	ResponseBody    string            `json:"response_body,omitempty"`
	ResponseSize    int64             `json:"response_size,omitempty"`
	RemoteIP        string            `json:"remote_ip,omitempty"`
	Error           string            `json:"error,omitempty"`
}

RequestEntry captures HTTP request details.

type RequestInfo added in v0.24.0

type RequestInfo struct {
	Method      string            `json:"method"`
	Path        string            `json:"path"`
	FullURL     string            `json:"full_url,omitempty"`
	Headers     map[string]string `json:"headers,omitempty"`
	QueryParams map[string]string `json:"query_params,omitempty"`
	FormData    map[string]string `json:"form_data,omitempty"`
	Body        string            `json:"body,omitempty"`
	ContentType string            `json:"content_type,omitempty"`
	RemoteIP    string            `json:"remote_ip,omitempty"`
	UserAgent   string            `json:"user_agent,omitempty"`
}

RequestInfo holds HTTP request details.

type RequiredFieldsValidationStrategy added in v0.24.0

type RequiredFieldsValidationStrategy = cmsinterfaces.RequiredFieldsValidationStrategy

RequiredFieldsValidationStrategy mirrors go-cms required field validation strategy.

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 (for example, WidgetUserStats).
	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
	RoleKey     string
	Description string
	Permissions []string
	Metadata    map[string]any
	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 RoleWorkflowAuthorizer added in v0.24.0

type RoleWorkflowAuthorizer struct {
	MinRole    string
	Resource   string
	Permission string
	Extra      func(context.Context, TransitionInput) bool
}

RoleWorkflowAuthorizer enforces minimum role requirements and optional permission checks.

func (*RoleWorkflowAuthorizer) CanTransition added in v0.24.0

func (a *RoleWorkflowAuthorizer) CanTransition(ctx context.Context, input TransitionInput) bool

CanTransition validates the workflow transition against role + optional permission checks.

type RoleWorkflowAuthorizerOption added in v0.24.0

type RoleWorkflowAuthorizerOption func(*RoleWorkflowAuthorizer)

RoleWorkflowAuthorizerOption customizes a RoleWorkflowAuthorizer.

func WithWorkflowExtraCheck added in v0.24.0

func WithWorkflowExtraCheck(fn func(context.Context, TransitionInput) bool) RoleWorkflowAuthorizerOption

WithWorkflowExtraCheck adds an extra custom check for workflow transitions.

func WithWorkflowPermission added in v0.24.0

func WithWorkflowPermission(resource, permission string) RoleWorkflowAuthorizerOption

WithWorkflowPermission adds a permission check using authlib.Can.

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"`
	SessionID string        `json:"session_id,omitempty"`
	UserID    string        `json:"user_id,omitempty"`
	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"`
	Subresources []PanelSubresource           `json:"subresources,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 SchemaGuardrails added in v0.23.0

type SchemaGuardrails struct {
	MaxSizeBytes            int
	MaxFields               int
	MaxDepth                int
	UISchemaMaxSizeBytes    int
	PreviewHTMLMaxSizeBytes int
	ReservedFields          map[string]bool
}

SchemaGuardrails provides validation and security checks for content type schemas

func NewSchemaGuardrails added in v0.23.0

func NewSchemaGuardrails() *SchemaGuardrails

NewSchemaGuardrails creates guardrails with default limits

func (*SchemaGuardrails) IsReservedFieldName added in v0.23.0

func (g *SchemaGuardrails) IsReservedFieldName(name string) bool

IsReservedFieldName checks if a field name is reserved

func (*SchemaGuardrails) ValidatePreviewHTML added in v0.23.0

func (g *SchemaGuardrails) ValidatePreviewHTML(html []byte) error

ValidatePreviewHTML checks generated HTML size limits

func (*SchemaGuardrails) ValidateSchema added in v0.23.0

func (g *SchemaGuardrails) ValidateSchema(schema map[string]any) (*SchemaValidationResult, error)

ValidateSchema performs comprehensive schema validation

func (*SchemaGuardrails) ValidateUISchema added in v0.23.0

func (g *SchemaGuardrails) ValidateUISchema(uiSchema map[string]any, jsonSchema map[string]any) error

ValidateUISchema validates UI schema overlay format and JSON Pointer targets

type SchemaGuardrailsOption added in v0.23.0

type SchemaGuardrailsOption func(*SchemaGuardrails)

SchemaGuardrailsOption configures guardrails

func WithSchemaMaxDepth added in v0.23.0

func WithSchemaMaxDepth(depth int) SchemaGuardrailsOption

WithSchemaMaxDepth sets the maximum nesting depth

func WithSchemaMaxFields added in v0.23.0

func WithSchemaMaxFields(count int) SchemaGuardrailsOption

WithSchemaMaxFields sets the maximum number of fields

func WithSchemaMaxSize added in v0.23.0

func WithSchemaMaxSize(bytes int) SchemaGuardrailsOption

WithSchemaMaxSize sets the maximum schema size in bytes

type SchemaPreviewFallback added in v0.24.0

type SchemaPreviewFallback func(ctx AdminContext, schema map[string]any, opts SchemaValidationOptions, err error) (html string, handled bool)

SchemaPreviewFallback renders preview HTML when preview generation fails.

type SchemaPreviewer added in v0.23.0

type SchemaPreviewer interface {
	Preview(ctx context.Context, schema map[string]any, opts SchemaValidationOptions) ([]byte, error)
}

SchemaPreviewer renders preview output for a schema.

type SchemaRegistryEntry added in v0.23.0

type SchemaRegistryEntry struct {
	Resource     string         `json:"resource"`
	Plural       string         `json:"plural,omitempty"`
	SchemaFormat string         `json:"schema_format"`
	Document     map[string]any `json:"document"`
	UpdatedAt    time.Time      `json:"updated_at"`
}

SchemaRegistryEntry captures a projected schema document from the registry.

type SchemaRegistryPayload added in v0.23.0

type SchemaRegistryPayload struct {
	Schemas []SchemaRegistryEntry `json:"schemas"`
}

SchemaRegistryPayload wraps schema registry entries for UI consumption.

type SchemaToFieldsConverter added in v0.23.0

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

SchemaToFieldsConverter maps JSON Schema properties into panel field definitions.

func NewSchemaToFieldsConverter added in v0.23.0

func NewSchemaToFieldsConverter() *SchemaToFieldsConverter

NewSchemaToFieldsConverter builds a converter with default mappings.

func (*SchemaToFieldsConverter) Convert added in v0.23.0

func (c *SchemaToFieldsConverter) Convert(schema map[string]any, uiSchema map[string]any) ConvertedFields

Convert maps a JSON schema + UI overlay into panel fields.

type SchemaValidationOptions added in v0.23.0

type SchemaValidationOptions struct {
	Slug     string
	FormID   string
	UISchema map[string]any
}

SchemaValidationOptions captures schema validation/preview context.

type SchemaValidationResult added in v0.23.0

type SchemaValidationResult struct {
	Valid      bool              `json:"valid"`
	FieldCount int               `json:"field_count,omitempty"`
	MaxDepth   int               `json:"max_depth,omitempty"`
	SizeBytes  int               `json:"size_bytes,omitempty"`
	Errors     map[string]string `json:"errors,omitempty"`
}

SchemaValidationResult holds validation results

type SchemaValidator added in v0.23.0

type SchemaValidator interface {
	Validate(ctx context.Context, schema map[string]any, opts SchemaValidationOptions) error
}

SchemaValidator validates JSON schema input for content types.

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 SettingOverviewValuePayload added in v0.25.0

type SettingOverviewValuePayload struct {
	Value      any    `json:"value"`
	Provenance string `json:"provenance"`
}

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 SettingsOverviewWidgetPayload added in v0.25.0

type SettingsOverviewWidgetPayload struct {
	Values map[string]SettingOverviewValuePayload `json:"values"`
}

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 SimpleWorkflowEngine added in v0.22.0

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

SimpleWorkflowEngine provides a basic implementation of WorkflowEngine.

func NewSimpleWorkflowEngine added in v0.22.0

func NewSimpleWorkflowEngine() *SimpleWorkflowEngine

NewSimpleWorkflowEngine creates a new simple workflow engine.

func (*SimpleWorkflowEngine) AvailableTransitions added in v0.22.0

func (e *SimpleWorkflowEngine) AvailableTransitions(ctx context.Context, entityType, state string) ([]WorkflowTransition, error)

AvailableTransitions lists the possible transitions from a given state.

func (*SimpleWorkflowEngine) HasWorkflow added in v0.24.0

func (e *SimpleWorkflowEngine) HasWorkflow(entityType string) bool

HasWorkflow reports whether a workflow definition exists for an entity type.

func (*SimpleWorkflowEngine) RegisterWorkflow added in v0.22.0

func (e *SimpleWorkflowEngine) RegisterWorkflow(entityType string, definition WorkflowDefinition)

RegisterWorkflow installs or replaces a workflow definition for an entity type.

func (*SimpleWorkflowEngine) Transition added in v0.22.0

Transition applies a transition to an entity.

type SourceContext added in v0.24.0

type SourceContext struct {
	File       string       `json:"file"`
	Line       int          `json:"line"`
	StartLine  int          `json:"start_line"`
	Lines      []SourceLine `json:"lines"`
	Function   string       `json:"function,omitempty"`
	Language   string       `json:"language,omitempty"`
	Snippet    string       `json:"snippet,omitempty"`
	RelPath    string       `json:"rel_path,omitempty"`
	IsAppCode  bool         `json:"is_app_code"`
	CanOpenIDE bool         `json:"can_open_ide"`
}

SourceContext holds source code lines around an error location.

func ExtractSourceContext added in v0.24.0

func ExtractSourceContext(filePath string, errorLine, contextLines int) *SourceContext

ExtractSourceContext reads source code around the given file and line. contextLines specifies how many lines to show before and after the error line.

type SourceLine added in v0.24.0

type SourceLine struct {
	Number    int    `json:"number"`
	Content   string `json:"content"`
	IsError   bool   `json:"is_error"`
	IsContext bool   `json:"is_context"`
}

SourceLine represents a single line of source code.

type StackFrameInfo added in v0.24.0

type StackFrameInfo struct {
	File       string         `json:"file"`
	Line       int            `json:"line"`
	Function   string         `json:"function"`
	Package    string         `json:"package,omitempty"`
	IsAppCode  bool           `json:"is_app_code"`
	IsExpanded bool           `json:"is_expanded"`
	Source     *SourceContext `json:"source,omitempty"`
	IDELink    string         `json:"ide_link,omitempty"`
}

StackFrameInfo holds enriched stack frame data.

func EnrichStackFrames added in v0.24.0

func EnrichStackFrames(frames []StackFrameInfo, contextLines int, maxFrames int) []StackFrameInfo

EnrichStackFrames adds source context to stack frames.

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 TransitionInput added in v0.22.0

type TransitionInput = cmsboot.TransitionInput

TransitionInput captures the data required to run a workflow transition.

type TransitionResult added in v0.22.0

type TransitionResult = cmsboot.TransitionResult

TransitionResult describes the outcome of a workflow transition.

type TranslationAlreadyExistsError added in v0.25.0

type TranslationAlreadyExistsError struct {
	Panel              string
	EntityID           string
	SourceLocale       string
	Locale             string
	TranslationGroupID string
}

TranslationAlreadyExistsError reports locale-level duplicate translation attempts.

func (TranslationAlreadyExistsError) Error added in v0.25.0

func (TranslationAlreadyExistsError) Unwrap added in v0.25.0

type TranslationAssignment added in v0.25.0

type TranslationAssignment struct {
	ID                 string `json:"id"`
	TranslationGroupID string `json:"translation_group_id"`
	EntityType         string `json:"entity_type"`

	SourceRecordID string `json:"source_record_id"`
	SourceLocale   string `json:"source_locale"`
	TargetLocale   string `json:"target_locale"`
	TargetRecordID string `json:"target_record_id,omitempty"`

	SourceTitle string `json:"source_title,omitempty"`
	SourcePath  string `json:"source_path,omitempty"`

	AssignmentType      AssignmentType   `json:"assignment_type"`
	Status              AssignmentStatus `json:"status"`
	Priority            Priority         `json:"priority"`
	DueDate             *time.Time       `json:"due_date,omitempty"`
	AssigneeID          string           `json:"assignee_id,omitempty"`
	AssignerID          string           `json:"assigner_id,omitempty"`
	LastReviewerID      string           `json:"last_reviewer_id,omitempty"`
	LastRejectionReason string           `json:"last_rejection_reason,omitempty"`

	Version int64 `json:"version"`

	CreatedAt   time.Time  `json:"created_at"`
	UpdatedAt   time.Time  `json:"updated_at"`
	ClaimedAt   *time.Time `json:"claimed_at,omitempty"`
	SubmittedAt *time.Time `json:"submitted_at,omitempty"`
	ApprovedAt  *time.Time `json:"approved_at,omitempty"`
	PublishedAt *time.Time `json:"published_at,omitempty"`
	ArchivedAt  *time.Time `json:"archived_at,omitempty"`
}

TranslationAssignment coordinates translation work for one target locale.

func (TranslationAssignment) ActiveUniquenessKey added in v0.25.0

func (a TranslationAssignment) ActiveUniquenessKey() string

ActiveUniquenessKey returns the canonical idempotency key for active assignments.

func (TranslationAssignment) Validate added in v0.25.0

func (a TranslationAssignment) Validate() error

Validate ensures required model fields and enum values are present.

type TranslationAssignmentConflictError added in v0.25.0

type TranslationAssignmentConflictError struct {
	AssignmentID         string
	ExistingAssignmentID string
	TranslationGroupID   string
	EntityType           string
	SourceLocale         string
	TargetLocale         string
}

TranslationAssignmentConflictError captures active uniqueness conflicts.

func (TranslationAssignmentConflictError) Error added in v0.25.0

func (TranslationAssignmentConflictError) Unwrap added in v0.25.0

type TranslationAssignmentPanelRepository added in v0.25.0

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

TranslationAssignmentPanelRepository adapts typed queue storage to panel CRUD contracts.

func NewTranslationAssignmentPanelRepository added in v0.25.0

func NewTranslationAssignmentPanelRepository(repo TranslationAssignmentRepository) *TranslationAssignmentPanelRepository

NewTranslationAssignmentPanelRepository wraps a typed assignment repository for panel usage.

func (*TranslationAssignmentPanelRepository) Create added in v0.25.0

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

func (*TranslationAssignmentPanelRepository) Delete added in v0.25.0

func (*TranslationAssignmentPanelRepository) Get added in v0.25.0

func (*TranslationAssignmentPanelRepository) List added in v0.25.0

func (*TranslationAssignmentPanelRepository) Update added in v0.25.0

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

type TranslationAssignmentRepository added in v0.25.0

type TranslationAssignmentRepository interface {
	List(ctx context.Context, opts ListOptions) ([]TranslationAssignment, int, error)
	Create(ctx context.Context, assignment TranslationAssignment) (TranslationAssignment, error)
	CreateOrReuseActive(ctx context.Context, assignment TranslationAssignment) (TranslationAssignment, bool, error)
	Get(ctx context.Context, id string) (TranslationAssignment, error)
	Update(ctx context.Context, assignment TranslationAssignment, expectedVersion int64) (TranslationAssignment, error)
}

TranslationAssignmentRepository stores translation queue assignments.

type TranslationAssignmentVersionConflictError added in v0.25.0

type TranslationAssignmentVersionConflictError struct {
	AssignmentID    string
	ExpectedVersion int64
	ActualVersion   int64
}

TranslationAssignmentVersionConflictError captures optimistic locking conflicts.

func (TranslationAssignmentVersionConflictError) Error added in v0.25.0

func (TranslationAssignmentVersionConflictError) Unwrap added in v0.25.0

type TranslationBundle added in v0.24.0

type TranslationBundle[T any] = cmsinterfaces.TranslationBundle[T]

TranslationBundle wraps requested/resolved translations with locale metadata.

type TranslationCheckOptions added in v0.24.0

type TranslationCheckOptions = cmsinterfaces.TranslationCheckOptions

TranslationCheckOptions mirrors go-cms translation check options.

type TranslationCreateInput added in v0.25.0

type TranslationCreateInput struct {
	SourceID     string
	Locale       string
	Environment  string
	PolicyEntity string
	ContentType  string
	Status       string
}

TranslationCreateInput captures canonical translation creation intent.

type TranslationExchangeApplier added in v0.25.0

type TranslationExchangeApplier interface {
	ApplyImport(ctx context.Context, input TranslationImportApplyInput) (TranslationExchangeResult, error)
}

TranslationExchangeApplier defines import apply behavior for command handlers.

type TranslationExchangeApplyRequest added in v0.25.0

type TranslationExchangeApplyRequest struct {
	Key               TranslationExchangeLinkageKey
	TranslatedText    string
	CreateTranslation bool
	WorkflowStatus    string
}

type TranslationExchangeConflictError added in v0.25.0

type TranslationExchangeConflictError struct {
	Type               string
	Index              int
	Resource           string
	EntityID           string
	TranslationGroupID string
	TargetLocale       string
	FieldPath          string
	CurrentSourceHash  string
	ProvidedSourceHash string
}

TranslationExchangeConflictError captures row-level deterministic linkage conflicts.

func (TranslationExchangeConflictError) Error added in v0.25.0

func (TranslationExchangeConflictError) Unwrap added in v0.25.0

type TranslationExchangeConflictInfo added in v0.25.0

type TranslationExchangeConflictInfo struct {
	Type               string `json:"type"`
	Message            string `json:"message,omitempty"`
	CurrentSourceHash  string `json:"current_source_hash,omitempty"`
	ProvidedSourceHash string `json:"provided_source_hash,omitempty"`
}

TranslationExchangeConflictInfo captures deterministic row conflict metadata.

type TranslationExchangeExporter added in v0.25.0

type TranslationExchangeExporter interface {
	Export(ctx context.Context, input TranslationExportInput) (TranslationExportResult, error)
}

TranslationExchangeExporter defines export behavior for command handlers.

type TranslationExchangeInvalidPayloadError added in v0.25.0

type TranslationExchangeInvalidPayloadError struct {
	Message  string
	Field    string
	Format   string
	Metadata map[string]any
}

TranslationExchangeInvalidPayloadError captures invalid payload details.

func (TranslationExchangeInvalidPayloadError) Error added in v0.25.0

func (TranslationExchangeInvalidPayloadError) Unwrap added in v0.25.0

type TranslationExchangeLinkage added in v0.25.0

type TranslationExchangeLinkage struct {
	Key          TranslationExchangeLinkageKey
	SourceHash   string
	TargetExists bool
}

type TranslationExchangeLinkageKey added in v0.25.0

type TranslationExchangeLinkageKey struct {
	Resource           string
	EntityID           string
	TranslationGroupID string
	TargetLocale       string
	FieldPath          string
}

func ResolveTranslationExchangeLinkageKey added in v0.25.0

func ResolveTranslationExchangeLinkageKey(row TranslationExchangeRow) (TranslationExchangeLinkageKey, error)

ResolveTranslationExchangeLinkageKey canonicalizes deterministic row linkage identifiers.

func (TranslationExchangeLinkageKey) String added in v0.25.0

type TranslationExchangeResult added in v0.25.0

type TranslationExchangeResult struct {
	Summary   TranslationExchangeSummary     `json:"summary"`
	Results   []TranslationExchangeRowResult `json:"results"`
	TotalRows int                            `json:"total_rows,omitempty"`
}

TranslationExchangeResult captures structured validate/apply responses.

func (*TranslationExchangeResult) Add added in v0.25.0

Add appends a row result and updates aggregate counters.

type TranslationExchangeRow added in v0.25.0

type TranslationExchangeRow struct {
	Index              int            `json:"index,omitempty"`
	Resource           string         `json:"resource"`
	EntityID           string         `json:"entity_id"`
	TranslationGroupID string         `json:"translation_group_id"`
	SourceLocale       string         `json:"source_locale,omitempty"`
	TargetLocale       string         `json:"target_locale"`
	FieldPath          string         `json:"field_path"`
	SourceText         string         `json:"source_text,omitempty"`
	TranslatedText     string         `json:"translated_text,omitempty"`
	SourceHash         string         `json:"source_hash,omitempty"`
	Path               string         `json:"path,omitempty"`
	Title              string         `json:"title,omitempty"`
	Status             string         `json:"status,omitempty"`
	Notes              string         `json:"notes,omitempty"`
	Metadata           map[string]any `json:"metadata,omitempty"`
}

TranslationExchangeRow defines a normalized translation row used by command handlers.

type TranslationExchangeRowResult added in v0.25.0

type TranslationExchangeRowResult struct {
	Index              int                              `json:"index"`
	Resource           string                           `json:"resource"`
	EntityID           string                           `json:"entity_id"`
	TranslationGroupID string                           `json:"translation_group_id"`
	TargetLocale       string                           `json:"target_locale"`
	FieldPath          string                           `json:"field_path"`
	Status             string                           `json:"status"`
	Error              string                           `json:"error,omitempty"`
	Conflict           *TranslationExchangeConflictInfo `json:"conflict,omitempty"`
	Metadata           map[string]any                   `json:"metadata,omitempty"`
}

TranslationExchangeRowResult captures per-row validate/apply status.

type TranslationExchangeService added in v0.25.0

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

TranslationExchangeService contains transport-agnostic exchange domain behavior.

func NewTranslationExchangeService added in v0.25.0

func NewTranslationExchangeService(store TranslationExchangeStore) *TranslationExchangeService

func (*TranslationExchangeService) ApplyImport added in v0.25.0

func (*TranslationExchangeService) Export added in v0.25.0

func (*TranslationExchangeService) ValidateImport added in v0.25.0

type TranslationExchangeStore added in v0.25.0

type TranslationExchangeStore interface {
	ExportRows(ctx context.Context, filter TranslationExportFilter) ([]TranslationExchangeRow, error)
	ResolveLinkage(ctx context.Context, key TranslationExchangeLinkageKey) (TranslationExchangeLinkage, error)
	ApplyTranslation(ctx context.Context, req TranslationExchangeApplyRequest) error
}

TranslationExchangeStore abstracts deterministic linkage resolution and row writes.

type TranslationExchangeSummary added in v0.25.0

type TranslationExchangeSummary struct {
	Processed int `json:"processed"`
	Succeeded int `json:"succeeded"`
	Failed    int `json:"failed"`
}

TranslationExchangeSummary captures aggregate validate/apply outcomes.

type TranslationExchangeUnsupportedFormatError added in v0.25.0

type TranslationExchangeUnsupportedFormatError struct {
	Format    string
	Supported []string
}

TranslationExchangeUnsupportedFormatError captures unsupported upload format details.

func (TranslationExchangeUnsupportedFormatError) Error added in v0.25.0

func (TranslationExchangeUnsupportedFormatError) Unwrap added in v0.25.0

type TranslationExchangeValidator added in v0.25.0

type TranslationExchangeValidator interface {
	ValidateImport(ctx context.Context, input TranslationImportValidateInput) (TranslationExchangeResult, error)
}

TranslationExchangeValidator defines import validate behavior for command handlers.

type TranslationExportCommand added in v0.25.0

type TranslationExportCommand struct {
	Service TranslationExchangeExporter
}

func (*TranslationExportCommand) CLIHandler added in v0.25.0

func (c *TranslationExportCommand) CLIHandler() any

func (*TranslationExportCommand) CLIOptions added in v0.25.0

func (*TranslationExportCommand) Execute added in v0.25.0

type TranslationExportFilter added in v0.25.0

type TranslationExportFilter struct {
	Resources         []string       `json:"resources"`
	EntityIDs         []string       `json:"entity_ids,omitempty"`
	SourceLocale      string         `json:"source_locale,omitempty"`
	TargetLocales     []string       `json:"target_locales,omitempty"`
	FieldPaths        []string       `json:"field_paths,omitempty"`
	IncludeSourceHash bool           `json:"include_source_hash,omitempty"`
	Options           map[string]any `json:"options,omitempty"`
}

TranslationExportFilter captures normalized export criteria.

type TranslationExportInput added in v0.25.0

type TranslationExportInput struct {
	Filter TranslationExportFilter  `json:"filter"`
	Output *TranslationExportResult `json:"-"`
}

TranslationExportInput is the typed export command input.

func (TranslationExportInput) Type added in v0.25.0

func (TranslationExportInput) Validate added in v0.25.0

func (m TranslationExportInput) Validate() error

type TranslationExportResult added in v0.25.0

type TranslationExportResult struct {
	RowCount int                      `json:"row_count"`
	Format   string                   `json:"format,omitempty"`
	Rows     []TranslationExchangeRow `json:"rows,omitempty"`
}

TranslationExportResult captures exported rows and aggregate metadata.

type TranslationImportApplyCommand added in v0.25.0

type TranslationImportApplyCommand struct {
	Service TranslationExchangeApplier
}

func (*TranslationImportApplyCommand) CLIHandler added in v0.25.0

func (c *TranslationImportApplyCommand) CLIHandler() any

func (*TranslationImportApplyCommand) CLIOptions added in v0.25.0

func (*TranslationImportApplyCommand) Execute added in v0.25.0

type TranslationImportApplyInput added in v0.25.0

type TranslationImportApplyInput struct {
	Rows                    []TranslationExchangeRow   `json:"rows"`
	AllowCreateMissing      bool                       `json:"allow_create_missing,omitempty"`
	AllowSourceHashOverride bool                       `json:"allow_source_hash_override,omitempty"`
	ContinueOnError         bool                       `json:"continue_on_error,omitempty"`
	DryRun                  bool                       `json:"dry_run,omitempty"`
	Result                  *TranslationExchangeResult `json:"-"`
}

TranslationImportApplyInput is the typed import-apply command input.

func (TranslationImportApplyInput) Type added in v0.25.0

func (TranslationImportApplyInput) Validate added in v0.25.0

func (m TranslationImportApplyInput) Validate() error

type TranslationImportRunCommand added in v0.25.0

type TranslationImportRunCommand struct {
	Validator TranslationExchangeValidator
	Applier   TranslationExchangeApplier
}

func (*TranslationImportRunCommand) CLIHandler added in v0.25.0

func (c *TranslationImportRunCommand) CLIHandler() any

func (*TranslationImportRunCommand) CLIOptions added in v0.25.0

func (*TranslationImportRunCommand) Execute added in v0.25.0

type TranslationImportRunInput added in v0.25.0

type TranslationImportRunInput struct {
	ValidateInput TranslationImportValidateInput `json:"validate"`
	ApplyInput    TranslationImportApplyInput    `json:"apply"`
	Result        *TranslationImportRunResult    `json:"-"`
}

TranslationImportRunInput is an optional typed wrapper that composes validate+apply.

func (TranslationImportRunInput) Type added in v0.25.0

func (TranslationImportRunInput) Validate added in v0.25.0

func (m TranslationImportRunInput) Validate() error

type TranslationImportRunResult added in v0.25.0

type TranslationImportRunResult struct {
	Validate TranslationExchangeResult `json:"validate"`
	Apply    TranslationExchangeResult `json:"apply"`
}

TranslationImportRunResult captures the optional run-command two-step result.

type TranslationImportRunTriggerBuilder added in v0.25.0

type TranslationImportRunTriggerBuilder func(context.Context, TranslationImportRunTriggerInput) (TranslationImportRunInput, error)

TranslationImportRunTriggerBuilder resolves scheduled/manual trigger input into a typed run input.

type TranslationImportRunTriggerCommand added in v0.25.0

type TranslationImportRunTriggerCommand struct {
	Schedule   string
	BuildInput TranslationImportRunTriggerBuilder
}

TranslationImportRunTriggerCommand composes run input and dispatches the run command.

func (*TranslationImportRunTriggerCommand) CronHandler added in v0.25.0

func (c *TranslationImportRunTriggerCommand) CronHandler() func() error

func (*TranslationImportRunTriggerCommand) CronOptions added in v0.25.0

func (*TranslationImportRunTriggerCommand) Execute added in v0.25.0

type TranslationImportRunTriggerInput added in v0.25.0

type TranslationImportRunTriggerInput struct {
	RunInput *TranslationImportRunInput `json:"run_input,omitempty"`
}

TranslationImportRunTriggerInput is a typed trigger message for scheduled imports.

func (TranslationImportRunTriggerInput) Type added in v0.25.0

func (TranslationImportRunTriggerInput) Validate added in v0.25.0

type TranslationImportValidateCommand added in v0.25.0

type TranslationImportValidateCommand struct {
	Service TranslationExchangeValidator
}

func (*TranslationImportValidateCommand) CLIHandler added in v0.25.0

func (c *TranslationImportValidateCommand) CLIHandler() any

func (*TranslationImportValidateCommand) CLIOptions added in v0.25.0

func (*TranslationImportValidateCommand) Execute added in v0.25.0

type TranslationImportValidateInput added in v0.25.0

type TranslationImportValidateInput struct {
	Rows   []TranslationExchangeRow   `json:"rows"`
	Result *TranslationExchangeResult `json:"-"`
}

TranslationImportValidateInput is the typed import-validate command input.

func (TranslationImportValidateInput) Type added in v0.25.0

func (TranslationImportValidateInput) Validate added in v0.25.0

type TranslationLinkWidgetPayload added in v0.25.0

type TranslationLinkWidgetPayload struct {
	Label       string            `json:"label"`
	ResolverKey string            `json:"resolver_key,omitempty"`
	Group       string            `json:"group,omitempty"`
	Route       string            `json:"route,omitempty"`
	URL         string            `json:"url,omitempty"`
	Query       map[string]string `json:"query,omitempty"`
}

type TranslationMeta added in v0.24.0

type TranslationMeta = cmsinterfaces.TranslationMeta

TranslationMeta mirrors the go-cms translation metadata contract.

type TranslationMetrics added in v0.25.0

type TranslationMetrics interface {
	IncrementBlockedTransition(ctx context.Context, tags map[string]string)
	IncrementCreateAction(ctx context.Context, tags map[string]string)
}

TranslationMetrics captures counters for translation workflow observability.

type TranslationPolicy added in v0.24.0

type TranslationPolicy interface {
	Validate(ctx context.Context, input TranslationPolicyInput) error
}

TranslationPolicy validates workflow transitions against translation requirements.

type TranslationPolicyFunc added in v0.24.0

type TranslationPolicyFunc func(context.Context, TranslationPolicyInput) error

TranslationPolicyFunc adapts a function into a TranslationPolicy.

func (TranslationPolicyFunc) Validate added in v0.24.0

Validate executes the policy function.

type TranslationPolicyInput added in v0.24.0

type TranslationPolicyInput struct {
	EntityType      string
	EntityID        string
	Transition      string
	Environment     string
	State           string
	PolicyEntity    string
	RequestedLocale string
}

TranslationPolicyInput captures workflow context needed for translation checks.

type TranslationProgressWidgetPayload added in v0.25.0

type TranslationProgressWidgetPayload struct {
	Summary      TranslationSummaryWidgetPayload `json:"summary"`
	StatusCounts map[string]int                  `json:"status_counts"`
	LocaleCounts map[string]int                  `json:"locale_counts"`
	UpdatedAt    string                          `json:"updated_at"`
	Links        []TranslationLinkWidgetPayload  `json:"links"`
}

type TranslationQueueApproveCommand added in v0.25.0

type TranslationQueueApproveCommand struct {
	Service TranslationQueueService
}

TranslationQueueApproveCommand dispatches approve lifecycle actions.

func (*TranslationQueueApproveCommand) Execute added in v0.25.0

type TranslationQueueApproveInput added in v0.25.0

type TranslationQueueApproveInput struct {
	AssignmentID    string                 `json:"assignment_id"`
	ReviewerID      string                 `json:"reviewer_id"`
	ExpectedVersion int64                  `json:"expected_version"`
	Result          *TranslationAssignment `json:"-"`
}

TranslationQueueApproveInput approves a review item.

func (TranslationQueueApproveInput) Type added in v0.25.0

func (TranslationQueueApproveInput) Validate added in v0.25.0

func (m TranslationQueueApproveInput) Validate() error

type TranslationQueueArchiveCommand added in v0.25.0

type TranslationQueueArchiveCommand struct {
	Service TranslationQueueService
}

TranslationQueueArchiveCommand dispatches archive lifecycle actions.

func (*TranslationQueueArchiveCommand) Execute added in v0.25.0

type TranslationQueueArchiveInput added in v0.25.0

type TranslationQueueArchiveInput struct {
	AssignmentID    string                 `json:"assignment_id"`
	ActorID         string                 `json:"actor_id"`
	ExpectedVersion int64                  `json:"expected_version"`
	Result          *TranslationAssignment `json:"-"`
}

TranslationQueueArchiveInput archives a queue assignment.

func (TranslationQueueArchiveInput) Type added in v0.25.0

func (TranslationQueueArchiveInput) Validate added in v0.25.0

func (m TranslationQueueArchiveInput) Validate() error

type TranslationQueueAssignCommand added in v0.25.0

type TranslationQueueAssignCommand struct {
	Service TranslationQueueService
}

TranslationQueueAssignCommand dispatches assign lifecycle actions.

func (*TranslationQueueAssignCommand) Execute added in v0.25.0

type TranslationQueueAssignInput added in v0.25.0

type TranslationQueueAssignInput struct {
	AssignmentID    string                 `json:"assignment_id"`
	AssigneeID      string                 `json:"assignee_id"`
	AssignerID      string                 `json:"assigner_id"`
	Priority        Priority               `json:"priority,omitempty"`
	DueDate         *time.Time             `json:"due_date,omitempty"`
	ExpectedVersion int64                  `json:"expected_version"`
	Result          *TranslationAssignment `json:"-"`
}

TranslationQueueAssignInput assigns an item to a translator.

func (TranslationQueueAssignInput) Type added in v0.25.0

func (TranslationQueueAssignInput) Validate added in v0.25.0

func (m TranslationQueueAssignInput) Validate() error

type TranslationQueueAutoCreateHook added in v0.25.0

type TranslationQueueAutoCreateHook interface {
	// OnTranslationBlocker is called when a workflow transition is blocked
	// due to missing required translations. It creates or reuses queue assignments
	// for each missing locale. This is a side-effect hook that must not alter
	// the primary policy response - errors are logged but not returned.
	OnTranslationBlocker(ctx context.Context, input TranslationQueueAutoCreateInput) TranslationQueueAutoCreateResult
}

TranslationQueueAutoCreateHook handles automatic queue item creation when translation policy blocks a transition due to missing locales.

type TranslationQueueAutoCreateInput added in v0.25.0

type TranslationQueueAutoCreateInput struct {
	TranslationGroupID string
	EntityType         string
	EntityID           string
	SourceLocale       string
	MissingLocales     []string
	Transition         string
	Environment        string
	SourceTitle        string
	SourcePath         string
	ActorID            string
	Priority           Priority
}

TranslationQueueAutoCreateInput captures the context needed to create queue items.

type TranslationQueueAutoCreateResult added in v0.25.0

type TranslationQueueAutoCreateResult struct {
	Created     int
	Reused      int
	Failed      int
	Errors      []error
	Assignments []TranslationAssignment
}

TranslationQueueAutoCreateResult captures the outcome of auto-create operations.

type TranslationQueueBulkArchiveCommand added in v0.25.0

type TranslationQueueBulkArchiveCommand struct {
	Service TranslationQueueService
}

TranslationQueueBulkArchiveCommand dispatches bulk-archive lifecycle actions.

func (*TranslationQueueBulkArchiveCommand) Execute added in v0.25.0

type TranslationQueueBulkArchiveInput added in v0.25.0

type TranslationQueueBulkArchiveInput struct {
	AssignmentIDs []string                 `json:"assignment_ids"`
	ActorID       string                   `json:"actor_id"`
	Result        *[]TranslationAssignment `json:"-"`
}

TranslationQueueBulkArchiveInput bulk-archives queue items.

func (TranslationQueueBulkArchiveInput) Type added in v0.25.0

func (TranslationQueueBulkArchiveInput) Validate added in v0.25.0

type TranslationQueueBulkAssignCommand added in v0.25.0

type TranslationQueueBulkAssignCommand struct {
	Service TranslationQueueService
}

TranslationQueueBulkAssignCommand dispatches bulk-assign lifecycle actions.

func (*TranslationQueueBulkAssignCommand) Execute added in v0.25.0

type TranslationQueueBulkAssignInput added in v0.25.0

type TranslationQueueBulkAssignInput struct {
	AssignmentIDs []string                 `json:"assignment_ids"`
	AssigneeID    string                   `json:"assignee_id"`
	AssignerID    string                   `json:"assigner_id"`
	Priority      Priority                 `json:"priority,omitempty"`
	DueDate       *time.Time               `json:"due_date,omitempty"`
	Result        *[]TranslationAssignment `json:"-"`
}

TranslationQueueBulkAssignInput bulk-assigns queue items.

func (TranslationQueueBulkAssignInput) Type added in v0.25.0

func (TranslationQueueBulkAssignInput) Validate added in v0.25.0

type TranslationQueueBulkPriorityCommand added in v0.25.0

type TranslationQueueBulkPriorityCommand struct {
	Service TranslationQueueService
}

TranslationQueueBulkPriorityCommand dispatches bulk-priority lifecycle actions.

func (*TranslationQueueBulkPriorityCommand) Execute added in v0.25.0

type TranslationQueueBulkPriorityInput added in v0.25.0

type TranslationQueueBulkPriorityInput struct {
	AssignmentIDs []string                 `json:"assignment_ids"`
	Priority      Priority                 `json:"priority"`
	ActorID       string                   `json:"actor_id"`
	Result        *[]TranslationAssignment `json:"-"`
}

TranslationQueueBulkPriorityInput bulk-updates priority.

func (TranslationQueueBulkPriorityInput) Type added in v0.25.0

func (TranslationQueueBulkPriorityInput) Validate added in v0.25.0

type TranslationQueueBulkReleaseCommand added in v0.25.0

type TranslationQueueBulkReleaseCommand struct {
	Service TranslationQueueService
}

TranslationQueueBulkReleaseCommand dispatches bulk-release lifecycle actions.

func (*TranslationQueueBulkReleaseCommand) Execute added in v0.25.0

type TranslationQueueBulkReleaseInput added in v0.25.0

type TranslationQueueBulkReleaseInput struct {
	AssignmentIDs []string                 `json:"assignment_ids"`
	ActorID       string                   `json:"actor_id"`
	Result        *[]TranslationAssignment `json:"-"`
}

TranslationQueueBulkReleaseInput bulk-releases queue items.

func (TranslationQueueBulkReleaseInput) Type added in v0.25.0

func (TranslationQueueBulkReleaseInput) Validate added in v0.25.0

type TranslationQueueClaimCommand added in v0.25.0

type TranslationQueueClaimCommand struct {
	Service TranslationQueueService
}

TranslationQueueClaimCommand dispatches claim lifecycle actions.

func (*TranslationQueueClaimCommand) Execute added in v0.25.0

type TranslationQueueClaimInput added in v0.25.0

type TranslationQueueClaimInput struct {
	AssignmentID    string                 `json:"assignment_id"`
	ClaimerID       string                 `json:"claimer_id"`
	ExpectedVersion int64                  `json:"expected_version"`
	Result          *TranslationAssignment `json:"-"`
}

TranslationQueueClaimInput claims or starts an assignment in progress.

func (TranslationQueueClaimInput) Type added in v0.25.0

func (TranslationQueueClaimInput) Validate added in v0.25.0

func (m TranslationQueueClaimInput) Validate() error

type TranslationQueueRejectCommand added in v0.25.0

type TranslationQueueRejectCommand struct {
	Service TranslationQueueService
}

TranslationQueueRejectCommand dispatches reject lifecycle actions.

func (*TranslationQueueRejectCommand) Execute added in v0.25.0

type TranslationQueueRejectInput added in v0.25.0

type TranslationQueueRejectInput struct {
	AssignmentID    string                 `json:"assignment_id"`
	ReviewerID      string                 `json:"reviewer_id"`
	Reason          string                 `json:"reason"`
	ExpectedVersion int64                  `json:"expected_version"`
	Result          *TranslationAssignment `json:"-"`
}

TranslationQueueRejectInput rejects a review item with required reason.

func (TranslationQueueRejectInput) Type added in v0.25.0

func (TranslationQueueRejectInput) Validate added in v0.25.0

func (m TranslationQueueRejectInput) Validate() error

type TranslationQueueReleaseCommand added in v0.25.0

type TranslationQueueReleaseCommand struct {
	Service TranslationQueueService
}

TranslationQueueReleaseCommand dispatches release lifecycle actions.

func (*TranslationQueueReleaseCommand) Execute added in v0.25.0

type TranslationQueueReleaseInput added in v0.25.0

type TranslationQueueReleaseInput struct {
	AssignmentID    string                 `json:"assignment_id"`
	ActorID         string                 `json:"actor_id"`
	ExpectedVersion int64                  `json:"expected_version"`
	Result          *TranslationAssignment `json:"-"`
}

TranslationQueueReleaseInput returns an assignment back to open pool.

func (TranslationQueueReleaseInput) Type added in v0.25.0

func (TranslationQueueReleaseInput) Validate added in v0.25.0

func (m TranslationQueueReleaseInput) Validate() error

type TranslationQueueStatsFromRepository added in v0.25.0

type TranslationQueueStatsFromRepository struct {
	Repository TranslationAssignmentRepository
}

TranslationQueueStatsFromRepository computes queue stats from assignment storage.

func (*TranslationQueueStatsFromRepository) Snapshot added in v0.25.0

type TranslationQueueStatsService added in v0.25.0

type TranslationQueueStatsService interface {
	Snapshot(ctx context.Context) (TranslationQueueStatsSnapshot, error)
}

TranslationQueueStatsService provides aggregate queue metrics for dashboard providers.

type TranslationQueueStatsSnapshot added in v0.25.0

type TranslationQueueStatsSnapshot struct {
	Summary        map[string]int `json:"summary"`
	StatusCounts   map[string]int `json:"status_counts"`
	LocaleCounts   map[string]int `json:"locale_counts"`
	UpdatedAt      time.Time      `json:"updated_at"`
	AssignmentRows int            `json:"assignment_rows"`
}

TranslationQueueStatsSnapshot captures queue dashboard aggregate counts.

type TranslationQueueSubmitCommand added in v0.25.0

type TranslationQueueSubmitCommand struct {
	Service TranslationQueueService
}

TranslationQueueSubmitCommand dispatches submit-review lifecycle actions.

func (*TranslationQueueSubmitCommand) Execute added in v0.25.0

type TranslationQueueSubmitInput added in v0.25.0

type TranslationQueueSubmitInput struct {
	AssignmentID    string                 `json:"assignment_id"`
	TranslatorID    string                 `json:"translator_id"`
	ExpectedVersion int64                  `json:"expected_version"`
	Result          *TranslationAssignment `json:"-"`
}

TranslationQueueSubmitInput submits in-progress work for review.

func (TranslationQueueSubmitInput) Type added in v0.25.0

func (TranslationQueueSubmitInput) Validate added in v0.25.0

func (m TranslationQueueSubmitInput) Validate() error

type TranslationRequirements added in v0.24.0

type TranslationRequirements struct {
	Locales                []string
	RequiredFields         map[string][]string
	RequiredFieldsStrategy RequiredFieldsValidationStrategy
}

TranslationRequirements captures required locales and optional field checks.

type TranslationRequirementsResolver added in v0.24.0

type TranslationRequirementsResolver interface {
	Requirements(ctx context.Context, input TranslationPolicyInput) (TranslationRequirements, bool, error)
}

TranslationRequirementsResolver resolves translation requirements for a transition.

type TranslationRequirementsResolverFunc added in v0.24.0

type TranslationRequirementsResolverFunc func(context.Context, TranslationPolicyInput) (TranslationRequirements, bool, error)

TranslationRequirementsResolverFunc adapts a function into a requirements resolver.

func (TranslationRequirementsResolverFunc) Requirements added in v0.24.0

Requirements executes the resolver function.

type TranslationSummaryWidgetPayload added in v0.25.0

type TranslationSummaryWidgetPayload struct {
	Total    int `json:"total"`
	Active   int `json:"active"`
	Overdue  int `json:"overdue"`
	Review   int `json:"review"`
	Approved int `json:"approved"`
}

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 {
	Admin  URLNamespaceConfig
	Public URLNamespaceConfig
	URLKit *urlkit.Config
}

URLConfig controls admin URL generation defaults.

type URLNamespaceConfig added in v0.24.0

type URLNamespaceConfig struct {
	BasePath     string
	APIPrefix    string
	APIVersion   string
	URLTemplate  string
	TemplateVars map[string]string
}

URLNamespaceConfig defines URL defaults for a namespace (admin or public).

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 UserBulkAssignRoleMsg added in v0.25.0

type UserBulkAssignRoleMsg struct {
	IDs     []string
	RoleID  string
	Replace bool
}

UserBulkAssignRoleMsg assigns a role for multiple users.

func (UserBulkAssignRoleMsg) Type added in v0.25.0

func (UserBulkAssignRoleMsg) Validate added in v0.25.0

func (m UserBulkAssignRoleMsg) Validate() error

type UserBulkUnassignRoleMsg added in v0.25.0

type UserBulkUnassignRoleMsg struct {
	IDs    []string
	RoleID string
}

UserBulkUnassignRoleMsg unassigns a role for multiple users.

func (UserBulkUnassignRoleMsg) Type added in v0.25.0

func (UserBulkUnassignRoleMsg) Validate added in v0.25.0

func (m UserBulkUnassignRoleMsg) 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(opts ...UserManagementModuleOption) *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 UserManagementModuleOption added in v0.24.0

type UserManagementModuleOption func(*UserManagementModule)

UserManagementModuleOption configures a UserManagementModule.

func WithMenuPositions added in v0.24.0

func WithMenuPositions(usersPos, rolesPos *int) UserManagementModuleOption

WithMenuPositions overrides menu positions for users and roles.

func WithRolesPanelConfigurer added in v0.24.0

func WithRolesPanelConfigurer(fn func(*PanelBuilder) *PanelBuilder) UserManagementModuleOption

WithRolesPanelConfigurer customizes the roles panel builder after defaults are set.

func WithUserMenuParent added in v0.24.0

func WithUserMenuParent(parent string) UserManagementModuleOption

WithUserMenuParent nests menu items under the provided parent ID.

func WithUserPanelTabs added in v0.24.0

func WithUserPanelTabs(tabs ...PanelTab) UserManagementModuleOption

WithUserPanelTabs appends tabs to the users panel.

func WithUserProfilesPanel added in v0.24.0

func WithUserProfilesPanel() UserManagementModuleOption

WithUserProfilesPanel enables the managed user profiles panel.

func WithUserProfilesPanelConfigurer added in v0.24.0

func WithUserProfilesPanelConfigurer(fn func(*PanelBuilder) *PanelBuilder) UserManagementModuleOption

WithUserProfilesPanelConfigurer customizes the user profiles panel builder when enabled.

func WithUsersPanelConfigurer added in v0.24.0

func WithUsersPanelConfigurer(fn func(*PanelBuilder) *PanelBuilder) UserManagementModuleOption

WithUsersPanelConfigurer customizes the users panel builder after defaults are set.

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) AssignRole added in v0.22.0

func (s *UserManagementService) AssignRole(ctx context.Context, userID, roleID string) error

AssignRole assigns a role to a user.

func (*UserManagementService) BulkRoleChange added in v0.25.0

BulkRoleChange applies assign/unassign role mutations for multiple users.

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) GetRole added in v0.22.0

GetRole fetches a role by ID.

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) RolesForUser added in v0.22.0

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

RolesForUser returns assigned roles for the given user.

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) UnassignRole added in v0.22.0

func (s *UserManagementService) UnassignRole(ctx context.Context, userID, roleID string) error

UnassignRole removes a role assignment from a user.

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 UserProfilesPanelRepository added in v0.24.0

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

UserProfilesPanelRepository adapts ProfileStore to managed user profile panels.

func NewUserProfilesPanelRepository added in v0.24.0

func NewUserProfilesPanelRepository(users *UserManagementService, profiles ProfileStore, defaultLocale string) *UserProfilesPanelRepository

NewUserProfilesPanelRepository constructs a repository backed by UserManagementService and ProfileStore.

func (*UserProfilesPanelRepository) Create added in v0.24.0

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

Create adds a user profile.

func (*UserProfilesPanelRepository) Delete added in v0.24.0

Delete removes a user profile if supported by the backing store.

func (*UserProfilesPanelRepository) Get added in v0.24.0

Get fetches a single user profile.

func (*UserProfilesPanelRepository) List added in v0.24.0

List returns user profiles for managed users.

func (*UserProfilesPanelRepository) Update added in v0.24.0

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

Update modifies a user profile.

type UserRecord

type UserRecord struct {
	ID          string
	Email       string
	Username    string
	FirstName   string
	LastName    string
	Status      string
	Role        string
	Roles       []string
	RoleDisplay string
	RoleLabels  []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 UserStatsWidgetPayload added in v0.25.0

type UserStatsWidgetPayload struct {
	Title  string `json:"title"`
	Metric string `json:"metric"`
	Value  int    `json:"value"`
}

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 WidgetPayload added in v0.25.0

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

WidgetPayload is the canonical widget payload container. Providers must return typed structs (or pointers to structs) wrapped in WidgetPayload.

func EmptyWidgetPayload added in v0.25.0

func EmptyWidgetPayload() WidgetPayload

EmptyWidgetPayload returns an empty payload object.

func WidgetPayloadOf added in v0.25.0

func WidgetPayloadOf[T any](value T) WidgetPayload

WidgetPayloadOf wraps a typed payload for dashboard providers.

func (WidgetPayload) Value added in v0.25.0

func (p WidgetPayload) Value() any

Value returns the wrapped payload value.

type WidgetProvider

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

WidgetProvider produces data for a widget given viewer context/config. Providers must return a canonical WidgetPayload.

type WorkflowAuthorizer added in v0.22.0

type WorkflowAuthorizer interface {
	CanTransition(ctx context.Context, input TransitionInput) bool
}

WorkflowAuthorizer optionally guards workflow transitions.

func NewRoleWorkflowAuthorizer added in v0.24.0

func NewRoleWorkflowAuthorizer(minRole string, opts ...RoleWorkflowAuthorizerOption) WorkflowAuthorizer

NewRoleWorkflowAuthorizer builds a WorkflowAuthorizer enforcing a minimum role with optional checks.

type WorkflowBinding added in v0.25.0

type WorkflowBinding struct {
	ID          string                   `json:"id"`
	ScopeType   WorkflowBindingScopeType `json:"scope_type"`
	ScopeRef    string                   `json:"scope_ref"`
	WorkflowID  string                   `json:"workflow_id"`
	Priority    int                      `json:"priority"`
	Status      WorkflowBindingStatus    `json:"status"`
	Environment string                   `json:"environment,omitempty"`
	Version     int                      `json:"version"`
	CreatedAt   time.Time                `json:"created_at"`
	UpdatedAt   time.Time                `json:"updated_at"`
}

WorkflowBinding stores a scoped workflow assignment.

type WorkflowBindingConflictError added in v0.25.0

type WorkflowBindingConflictError struct {
	BindingID         string
	ExistingBindingID string
	ScopeType         WorkflowBindingScopeType
	ScopeRef          string
	Environment       string
	Priority          int
}

WorkflowBindingConflictError indicates duplicate active binding scope+priority+environment.

func (WorkflowBindingConflictError) Error added in v0.25.0

func (WorkflowBindingConflictError) Unwrap added in v0.25.0

type WorkflowBindingListOptions added in v0.25.0

type WorkflowBindingListOptions struct {
	ScopeType   WorkflowBindingScopeType
	ScopeRef    string
	Environment string
	Status      WorkflowBindingStatus
}

WorkflowBindingListOptions filters binding list queries.

type WorkflowBindingRepository added in v0.25.0

type WorkflowBindingRepository interface {
	List(ctx context.Context, opts WorkflowBindingListOptions) ([]WorkflowBinding, int, error)
	ListByScope(ctx context.Context, scopeType WorkflowBindingScopeType, scopeRef string, status WorkflowBindingStatus) ([]WorkflowBinding, error)
	Get(ctx context.Context, id string) (WorkflowBinding, error)
	Create(ctx context.Context, binding WorkflowBinding) (WorkflowBinding, error)
	Update(ctx context.Context, binding WorkflowBinding, expectedVersion int) (WorkflowBinding, error)
	Delete(ctx context.Context, id string) error
}

WorkflowBindingRepository stores workflow scope bindings.

type WorkflowBindingResolution added in v0.25.0

type WorkflowBindingResolution struct {
	WorkflowID  string                   `json:"workflow_id"`
	Source      string                   `json:"source"`
	BindingID   string                   `json:"binding_id,omitempty"`
	ScopeType   WorkflowBindingScopeType `json:"scope_type,omitempty"`
	ScopeRef    string                   `json:"scope_ref,omitempty"`
	Priority    int                      `json:"priority,omitempty"`
	Environment string                   `json:"environment,omitempty"`
}

WorkflowBindingResolution describes the resolved binding winner.

type WorkflowBindingResolveInput added in v0.25.0

type WorkflowBindingResolveInput struct {
	ContentType string
	Traits      []string
	Environment string
}

WorkflowBindingResolveInput captures scope details used for runtime resolution.

type WorkflowBindingScopeType added in v0.25.0

type WorkflowBindingScopeType string

WorkflowBindingScopeType identifies where a binding applies.

const (
	WorkflowBindingScopeTrait       WorkflowBindingScopeType = "trait"
	WorkflowBindingScopeContentType WorkflowBindingScopeType = "content_type"
	WorkflowBindingScopeGlobal      WorkflowBindingScopeType = "global"
)

func (WorkflowBindingScopeType) IsValid added in v0.25.0

func (s WorkflowBindingScopeType) IsValid() bool

type WorkflowBindingStatus added in v0.25.0

type WorkflowBindingStatus string

WorkflowBindingStatus controls whether a binding participates in resolution.

const (
	WorkflowBindingStatusActive   WorkflowBindingStatus = "active"
	WorkflowBindingStatusInactive WorkflowBindingStatus = "inactive"
)

func (WorkflowBindingStatus) IsValid added in v0.25.0

func (s WorkflowBindingStatus) IsValid() bool

type WorkflowBindingVersionConflictError added in v0.25.0

type WorkflowBindingVersionConflictError struct {
	BindingID       string
	ExpectedVersion int
	ActualVersion   int
}

WorkflowBindingVersionConflictError indicates optimistic-lock mismatch for bindings.

func (WorkflowBindingVersionConflictError) Error added in v0.25.0

func (WorkflowBindingVersionConflictError) Unwrap added in v0.25.0

type WorkflowDefinition added in v0.22.0

type WorkflowDefinition struct {
	EntityType   string
	InitialState string
	Transitions  []WorkflowTransition
}

WorkflowDefinition describes a state machine for a specific entity type.

type WorkflowDefinitionChecker added in v0.24.0

type WorkflowDefinitionChecker interface {
	HasWorkflow(entityType string) bool
}

WorkflowDefinitionChecker reports whether a workflow exists for an entity type.

type WorkflowDefinitionRepository added in v0.25.0

type WorkflowDefinitionRepository interface {
	List(ctx context.Context, opts PersistedWorkflowListOptions) ([]PersistedWorkflow, int, error)
	Get(ctx context.Context, id string) (PersistedWorkflow, error)
	GetVersion(ctx context.Context, id string, version int) (PersistedWorkflow, error)
	Create(ctx context.Context, workflow PersistedWorkflow) (PersistedWorkflow, error)
	Update(ctx context.Context, workflow PersistedWorkflow, expectedVersion int) (PersistedWorkflow, error)
}

WorkflowDefinitionRepository stores persisted workflow definitions.

type WorkflowEngine added in v0.22.0

type WorkflowEngine = cmsboot.WorkflowEngine

WorkflowEngine coordinates lifecycle transitions for domain entities.

type WorkflowRegistrar added in v0.24.0

type WorkflowRegistrar interface {
	RegisterWorkflow(entityType string, definition WorkflowDefinition)
}

WorkflowRegistrar registers workflow definitions for entity types.

type WorkflowRuntime added in v0.25.0

type WorkflowRuntime interface {
	ListWorkflows(ctx context.Context, opts PersistedWorkflowListOptions) ([]PersistedWorkflow, int, error)
	CreateWorkflow(ctx context.Context, workflow PersistedWorkflow) (PersistedWorkflow, error)
	UpdateWorkflow(ctx context.Context, workflow PersistedWorkflow, expectedVersion int) (PersistedWorkflow, error)
	RollbackWorkflow(ctx context.Context, id string, targetVersion, expectedVersion int) (PersistedWorkflow, error)

	ListBindings(ctx context.Context, opts WorkflowBindingListOptions) ([]WorkflowBinding, int, error)
	CreateBinding(ctx context.Context, binding WorkflowBinding) (WorkflowBinding, error)
	UpdateBinding(ctx context.Context, binding WorkflowBinding, expectedVersion int) (WorkflowBinding, error)
	DeleteBinding(ctx context.Context, id string) error

	ResolveBinding(ctx context.Context, input WorkflowBindingResolveInput) (WorkflowBindingResolution, error)
	BindWorkflowEngine(engine WorkflowEngine) error
}

WorkflowRuntime exposes persisted workflow definition/binding operations.

type WorkflowRuntimeService added in v0.25.0

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

WorkflowRuntimeService orchestrates persisted workflow definitions + bindings.

func NewWorkflowRuntimeService added in v0.25.0

func NewWorkflowRuntimeService(workflows WorkflowDefinitionRepository, bindings WorkflowBindingRepository) *WorkflowRuntimeService

NewWorkflowRuntimeService constructs a runtime service (in-memory when nil repos are passed).

func (*WorkflowRuntimeService) BindWorkflowEngine added in v0.25.0

func (s *WorkflowRuntimeService) BindWorkflowEngine(engine WorkflowEngine) error

func (*WorkflowRuntimeService) CreateBinding added in v0.25.0

func (s *WorkflowRuntimeService) CreateBinding(ctx context.Context, binding WorkflowBinding) (WorkflowBinding, error)

func (*WorkflowRuntimeService) CreateWorkflow added in v0.25.0

func (s *WorkflowRuntimeService) CreateWorkflow(ctx context.Context, workflow PersistedWorkflow) (PersistedWorkflow, error)

func (*WorkflowRuntimeService) DeleteBinding added in v0.25.0

func (s *WorkflowRuntimeService) DeleteBinding(ctx context.Context, id string) error

func (*WorkflowRuntimeService) ListBindings added in v0.25.0

func (*WorkflowRuntimeService) ListWorkflows added in v0.25.0

func (*WorkflowRuntimeService) ResolveBinding added in v0.25.0

func (*WorkflowRuntimeService) RollbackWorkflow added in v0.25.0

func (s *WorkflowRuntimeService) RollbackWorkflow(ctx context.Context, id string, targetVersion, expectedVersion int) (PersistedWorkflow, error)

func (*WorkflowRuntimeService) UpdateBinding added in v0.25.0

func (s *WorkflowRuntimeService) UpdateBinding(ctx context.Context, binding WorkflowBinding, expectedVersion int) (WorkflowBinding, error)

func (*WorkflowRuntimeService) UpdateWorkflow added in v0.25.0

func (s *WorkflowRuntimeService) UpdateWorkflow(ctx context.Context, workflow PersistedWorkflow, expectedVersion int) (PersistedWorkflow, error)

type WorkflowTransition added in v0.22.0

type WorkflowTransition = cmsboot.WorkflowTransition

WorkflowTransition declares an allowed transition between two states.

type WorkflowValidationErrors added in v0.25.0

type WorkflowValidationErrors struct {
	Fields map[string]string `json:"fields"`
}

WorkflowValidationErrors aggregates field-level workflow API validation issues.

func (WorkflowValidationErrors) Error added in v0.25.0

func (e WorkflowValidationErrors) Error() string

type WorkflowVersionConflictError added in v0.25.0

type WorkflowVersionConflictError struct {
	WorkflowID      string
	ExpectedVersion int
	ActualVersion   int
}

WorkflowVersionConflictError indicates optimistic-lock mismatch for workflows.

func (WorkflowVersionConflictError) Error added in v0.25.0

func (WorkflowVersionConflictError) Unwrap added in v0.25.0

Source Files

Directories

Path Synopsis
internal
Package txoutbox provides reusable transaction hook and outbox dispatch helpers.
Package txoutbox provides reusable transaction hook and outbox dispatch helpers.

Jump to

Keyboard shortcuts

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