cmsboot

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BootstrapMenu

func BootstrapMenu(ctx context.Context, svc CMSMenuService, code string) error

BootstrapMenu ensures a menu exists for a given code.

Types

type CMSBlock

type CMSBlock struct {
	ID             string
	DefinitionID   string
	ContentID      string
	Region         string
	Locale         string
	Status         string
	Data           map[string]any
	Position       int
	BlockType      string
	BlockSchemaKey string
}

CMSBlock represents a block instance attached to content/pages.

type CMSBlockDefinition

type CMSBlockDefinition struct {
	ID             string
	Name           string
	Slug           string
	Type           string
	Description    string
	DescriptionSet bool
	Icon           string
	IconSet        bool
	Category       string
	CategorySet    bool
	Status         string
	Channel        string
	// Deprecated: use Channel for content scoping.
	Environment     string
	Schema          map[string]any
	UISchema        map[string]any
	SchemaVersion   string
	MigrationStatus string
	Locale          string
}

CMSBlockDefinition describes a reusable block schema.

type CMSBlockDefinitionVersion added in v0.24.0

type CMSBlockDefinitionVersion struct {
	ID              string
	DefinitionID    string
	SchemaVersion   string
	Schema          map[string]any
	Defaults        map[string]any
	MigrationStatus string
	CreatedAt       time.Time
	UpdatedAt       time.Time
}

CMSBlockDefinitionVersion captures a specific block definition schema version.

type CMSContainer

type CMSContainer interface {
	WidgetService() CMSWidgetService
	MenuService() CMSMenuService
	ContentService() CMSContentService
	ContentTypeService() CMSContentTypeService
}

CMSContainer abstracts CMS services used by admin.

type CMSContent

type CMSContent struct {
	ID                     string
	Title                  string
	Slug                   string
	Locale                 string
	TranslationGroupID     string
	RequestedLocale        string
	ResolvedLocale         string
	AvailableLocales       []string
	MissingRequestedLocale bool
	Navigation             map[string]string
	EffectiveMenuLocations []string
	ContentType            string
	ContentTypeSlug        string
	Status                 string
	Blocks                 []string
	EmbeddedBlocks         []map[string]any
	SchemaVersion          string
	Data                   map[string]any
	Metadata               map[string]any
}

CMSContent represents structured content managed by the CMS.

type CMSContentService

type CMSContentService interface {
	Pages(ctx context.Context, locale string) ([]CMSPage, error)
	Page(ctx context.Context, id, locale string) (*CMSPage, error)
	CreatePage(ctx context.Context, page CMSPage) (*CMSPage, error)
	UpdatePage(ctx context.Context, page CMSPage) (*CMSPage, error)
	DeletePage(ctx context.Context, id string) error
	Contents(ctx context.Context, locale string) ([]CMSContent, error)
	Content(ctx context.Context, id, locale string) (*CMSContent, error)
	CreateContent(ctx context.Context, content CMSContent) (*CMSContent, error)
	UpdateContent(ctx context.Context, content CMSContent) (*CMSContent, error)
	DeleteContent(ctx context.Context, id string) error
	BlockDefinitions(ctx context.Context) ([]CMSBlockDefinition, error)
	CreateBlockDefinition(ctx context.Context, def CMSBlockDefinition) (*CMSBlockDefinition, error)
	UpdateBlockDefinition(ctx context.Context, def CMSBlockDefinition) (*CMSBlockDefinition, error)
	DeleteBlockDefinition(ctx context.Context, id string) error
	BlockDefinitionVersions(ctx context.Context, id string) ([]CMSBlockDefinitionVersion, error)
	BlocksForContent(ctx context.Context, contentID, locale string) ([]CMSBlock, error)
	SaveBlock(ctx context.Context, block CMSBlock) (*CMSBlock, error)
	DeleteBlock(ctx context.Context, id string) error
}

CMSContentService manages pages/blocks backed by the CMS.

type CMSContentType added in v0.23.0

type CMSContentType struct {
	ID             string
	Name           string
	Slug           string
	Description    string
	DescriptionSet bool
	Channel        string
	// Deprecated: use Channel for content scoping.
	Environment          string
	Schema               map[string]any
	UISchema             map[string]any
	Capabilities         map[string]any
	ReplaceCapabilities  bool
	Icon                 string
	IconSet              bool
	Status               string
	AllowBreakingChanges bool
	CreatedAt            time.Time
	UpdatedAt            time.Time
}

CMSContentType describes a content type definition.

type CMSContentTypeService added in v0.23.0

type CMSContentTypeService interface {
	ContentTypes(ctx context.Context) ([]CMSContentType, error)
	ContentType(ctx context.Context, id string) (*CMSContentType, error)
	ContentTypeBySlug(ctx context.Context, slug string) (*CMSContentType, error)
	CreateContentType(ctx context.Context, contentType CMSContentType) (*CMSContentType, error)
	UpdateContentType(ctx context.Context, contentType CMSContentType) (*CMSContentType, error)
	DeleteContentType(ctx context.Context, id string) error
}

CMSContentTypeService manages content type definitions.

type CMSMenuService

type CMSMenuService interface {
	CreateMenu(ctx context.Context, code string) (*Menu, error)
	AddMenuItem(ctx context.Context, menuCode string, item MenuItem) error
	UpdateMenuItem(ctx context.Context, menuCode string, item MenuItem) error
	DeleteMenuItem(ctx context.Context, menuCode, id string) error
	ReorderMenu(ctx context.Context, menuCode string, orderedIDs []string) error
	Menu(ctx context.Context, code, locale string) (*Menu, error)
	MenuByLocation(ctx context.Context, location, locale string) (*Menu, error)
}

CMSMenuService manages CMS-backed menus.

type CMSPage

type CMSPage struct {
	ID                     string
	Title                  string
	Slug                   string
	TemplateID             string
	Locale                 string
	TranslationGroupID     string
	RequestedLocale        string
	ResolvedLocale         string
	AvailableLocales       []string
	MissingRequestedLocale bool
	Navigation             map[string]string
	EffectiveMenuLocations []string
	ParentID               string
	Blocks                 []string
	EmbeddedBlocks         []map[string]any
	SchemaVersion          string
	SEO                    map[string]any
	Status                 string
	Data                   map[string]any
	Metadata               map[string]any
	PreviewURL             string
}

CMSPage represents a page managed by the CMS.

type CMSWidgetService

type CMSWidgetService interface {
	RegisterAreaDefinition(ctx context.Context, def WidgetAreaDefinition) error
	RegisterDefinition(ctx context.Context, def WidgetDefinition) error
	DeleteDefinition(ctx context.Context, code string) error
	Areas() []WidgetAreaDefinition
	Definitions() []WidgetDefinition
	SaveInstance(ctx context.Context, instance WidgetInstance) (*WidgetInstance, error)
	DeleteInstance(ctx context.Context, id string) error
	ListInstances(ctx context.Context, filter WidgetInstanceFilter) ([]WidgetInstance, error)
}

CMSWidgetService registers dashboard widget areas/definitions.

type EnsureOptions

type EnsureOptions struct {
	Container          CMSContainer
	WidgetService      CMSWidgetService
	MenuService        CMSMenuService
	ContentService     CMSContentService
	ContentTypeService CMSContentTypeService
	RequireCMS         bool
	BuildContainer     func(context.Context) (CMSContainer, error)
	FallbackContainer  func() CMSContainer
}

EnsureOptions configure CMS container resolution.

type EnsureResult

type EnsureResult struct {
	Container          CMSContainer
	WidgetService      CMSWidgetService
	MenuService        CMSMenuService
	ContentService     CMSContentService
	ContentTypeService CMSContentTypeService
}

EnsureResult returns resolved CMS container/services.

func Ensure

func Ensure(ctx context.Context, opts EnsureOptions) (EnsureResult, error)

Ensure resolves a CMS container and required services, using builders or fallbacks when enabled.

type Menu = navinternal.Menu

Menu represents a simple CMS menu tree.

type MenuItem = navinternal.MenuItem

MenuItem describes a single navigation node.

type WidgetAreaDefinition

type WidgetAreaDefinition = dashinternal.WidgetAreaDefinition

WidgetAreaDefinition captures CMS widget area metadata.

type WidgetDefinition

type WidgetDefinition = dashinternal.WidgetDefinition

WidgetDefinition captures admin widget metadata.

type WidgetInstance

type WidgetInstance = dashinternal.WidgetInstance

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

type WidgetInstanceFilter

type WidgetInstanceFilter = dashinternal.WidgetInstanceFilter

WidgetInstanceFilter narrows widget instance queries.

type WorkflowApplyEventRequest added in v0.26.0

type WorkflowApplyEventRequest = flow.ApplyEventRequest[WorkflowMessage]

WorkflowApplyEventRequest aliases canonical FSM apply envelope.

type WorkflowApplyEventResponse added in v0.26.0

type WorkflowApplyEventResponse = flow.ApplyEventResponse[WorkflowMessage]

WorkflowApplyEventResponse aliases canonical FSM apply response envelope.

type WorkflowEngine added in v0.22.0

type WorkflowEngine interface {
	// ApplyEvent applies a workflow event to the entity and returns canonical FSM response envelope.
	ApplyEvent(ctx context.Context, input WorkflowApplyEventRequest) (*WorkflowApplyEventResponse, error)
	// Snapshot returns current state plus transition availability/rejections for the entity.
	Snapshot(ctx context.Context, input WorkflowSnapshotRequest) (*WorkflowSnapshot, error)
}

WorkflowEngine coordinates lifecycle transitions for domain entities.

type WorkflowExecutionContext added in v0.26.0

type WorkflowExecutionContext = flow.ExecutionContext

WorkflowExecutionContext aliases canonical FSM execution identity context.

type WorkflowGuardRejection added in v0.26.0

type WorkflowGuardRejection = flow.GuardRejection

WorkflowGuardRejection aliases canonical FSM guard rejection diagnostics.

type WorkflowMessage added in v0.26.0

type WorkflowMessage struct {
	EntityID     string
	EntityType   string
	CurrentState string
	TargetState  string
	Event        string
	Payload      map[string]any
}

WorkflowMessage captures workflow event payload used for guards/resolvers/hooks.

func (WorkflowMessage) Type added in v0.26.0

func (m WorkflowMessage) Type() string

Type implements command.Message.

type WorkflowSnapshot added in v0.26.0

type WorkflowSnapshot = flow.Snapshot

WorkflowSnapshot aliases canonical FSM snapshot response envelope.

type WorkflowSnapshotRequest added in v0.26.0

type WorkflowSnapshotRequest = flow.SnapshotRequest[WorkflowMessage]

WorkflowSnapshotRequest aliases canonical FSM snapshot request envelope.

type WorkflowTransition added in v0.22.0

type WorkflowTransition struct {
	Name        string
	Description string
	From        string
	To          string
	Guard       string
	DynamicTo   string
	Metadata    map[string]any
}

WorkflowTransition declares an allowed transition between two states.

type WorkflowTransitionInfo added in v0.26.0

type WorkflowTransitionInfo = flow.TransitionInfo

WorkflowTransitionInfo aliases canonical FSM transition snapshot metadata.

type WorkflowTransitionResult added in v0.26.0

type WorkflowTransitionResult = flow.TransitionResult[WorkflowMessage]

WorkflowTransitionResult aliases canonical FSM transition result.

Jump to

Keyboard shortcuts

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