Documentation
¶
Index ¶
- Constants
- func BootstrapMenu(ctx context.Context, svc CMSMenuService, code string) error
- type CMSBlock
- type CMSBlockDefinition
- type CMSBlockDefinitionVersion
- type CMSContainer
- type CMSContent
- type CMSContentService
- type CMSContentType
- type CMSContentTypeService
- type CMSMenuService
- type CMSPage
- type CMSWidgetService
- type EnsureOptions
- type EnsureResult
- type Menu
- type MenuItem
- type WidgetAreaDefinition
- type WidgetDefinition
- type WidgetDefinitionSyncResult
- type WidgetDefinitionSyncStatus
- type WidgetInstance
- type WidgetInstanceFilter
- type WorkflowApplyEventRequest
- type WorkflowApplyEventResponse
- type WorkflowEngine
- type WorkflowExecutionContext
- type WorkflowGuardRejection
- type WorkflowMessage
- type WorkflowSnapshot
- type WorkflowSnapshotRequest
- type WorkflowTransition
- type WorkflowTransitionInfo
- type WorkflowTransitionResult
Constants ¶
const ( WidgetDefinitionSyncStatusCreated = dashinternal.WidgetDefinitionSyncStatusCreated WidgetDefinitionSyncStatusUpdated = dashinternal.WidgetDefinitionSyncStatusUpdated WidgetDefinitionSyncStatusUnchanged = dashinternal.WidgetDefinitionSyncStatusUnchanged )
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 `json:"id"`
DefinitionID string `json:"definition_id"`
ContentID string `json:"content_id"`
Region string `json:"region"`
Locale string `json:"locale"`
Status string `json:"status"`
Data map[string]any `json:"data"`
Position int `json:"position"`
BlockType string `json:"block_type"`
BlockSchemaKey string `json:"block_schema_key"`
}
CMSBlock represents a block instance attached to content/pages.
type CMSBlockDefinition ¶
type CMSBlockDefinition struct {
ID string `json:"id"`
Name string `json:"name"`
Slug string `json:"slug"`
Type string `json:"type"`
Description string `json:"description"`
DescriptionSet bool `json:"description_set"`
Icon string `json:"icon"`
IconSet bool `json:"icon_set"`
Category string `json:"category"`
CategorySet bool `json:"category_set"`
Status string `json:"status"`
Channel string `json:"channel"`
// Deprecated: use Channel for content scoping.
Environment string `json:"environment"`
Schema map[string]any `json:"schema"`
UISchema map[string]any `json:"ui_schema"`
SchemaVersion string `json:"schema_version"`
MigrationStatus string `json:"migration_status"`
Locale string `json:"locale"`
}
CMSBlockDefinition describes a reusable block schema.
type CMSBlockDefinitionVersion ¶ added in v0.24.0
type CMSBlockDefinitionVersion struct {
ID string `json:"id"`
DefinitionID string `json:"definition_id"`
SchemaVersion string `json:"schema_version"`
Schema map[string]any `json:"schema"`
Defaults map[string]any `json:"defaults"`
MigrationStatus string `json:"migration_status"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
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 `json:"id"`
Title string `json:"title"`
Slug string `json:"slug"`
RouteKey string `json:"route_key"`
Locale string `json:"locale"`
FamilyID string `json:"family_id"`
RequestedLocale string `json:"requested_locale"`
ResolvedLocale string `json:"resolved_locale"`
AvailableLocales []string `json:"available_locales"`
MissingRequestedLocale bool `json:"missing_requested_locale"`
EffectiveMenuLocations []string `json:"effective_menu_locations"`
ContentType string `json:"content_type"`
ContentTypeSlug string `json:"content_type_slug"`
Status string `json:"status"`
Blocks []string `json:"blocks"`
EmbeddedBlocks []map[string]any `json:"embedded_blocks"`
SchemaVersion string `json:"schema_version"`
Data map[string]any `json:"data"`
Metadata map[string]any `json:"metadata"`
}
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 `json:"id"`
Name string `json:"name"`
Slug string `json:"slug"`
Description string `json:"description"`
DescriptionSet bool `json:"description_set"`
Channel string `json:"channel"`
// Deprecated: use Channel for content scoping.
Environment string `json:"environment"`
Schema map[string]any `json:"schema"`
UISchema map[string]any `json:"ui_schema"`
Capabilities map[string]any `json:"capabilities"`
ReplaceCapabilities bool `json:"replace_capabilities"`
Icon string `json:"icon"`
IconSet bool `json:"icon_set"`
Status string `json:"status"`
AllowBreakingChanges bool `json:"allow_breaking_changes"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
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 `json:"id"`
Title string `json:"title"`
Slug string `json:"slug"`
RouteKey string `json:"route_key"`
TemplateID string `json:"template_id"`
Locale string `json:"locale"`
FamilyID string `json:"family_id"`
RequestedLocale string `json:"requested_locale"`
ResolvedLocale string `json:"resolved_locale"`
AvailableLocales []string `json:"available_locales"`
MissingRequestedLocale bool `json:"missing_requested_locale"`
EffectiveMenuLocations []string `json:"effective_menu_locations"`
ParentID string `json:"parent_id"`
Blocks []string `json:"blocks"`
EmbeddedBlocks []map[string]any `json:"embedded_blocks"`
SchemaVersion string `json:"schema_version"`
SEO map[string]any `json:"seo"`
Status string `json:"status"`
Data map[string]any `json:"data"`
Metadata map[string]any `json:"metadata"`
PreviewURL string `json:"preview_url"`
}
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
SyncDefinition(ctx context.Context, def WidgetDefinition) (*WidgetDefinitionSyncResult, 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 `json:"container"`
WidgetService CMSWidgetService `json:"widget_service"`
MenuService CMSMenuService `json:"menu_service"`
ContentService CMSContentService `json:"content_service"`
ContentTypeService CMSContentTypeService `json:"content_type_service"`
RequireCMS bool `json:"require_cms"`
BuildContainer func(context.Context) (CMSContainer, error) `json:"build_container"`
FallbackContainer func() CMSContainer `json:"fallback_container"`
}
EnsureOptions configure CMS container resolution.
type EnsureResult ¶
type EnsureResult struct {
Container CMSContainer `json:"container"`
WidgetService CMSWidgetService `json:"widget_service"`
MenuService CMSMenuService `json:"menu_service"`
ContentService CMSContentService `json:"content_service"`
ContentTypeService CMSContentTypeService `json:"content_type_service"`
}
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 WidgetAreaDefinition ¶
type WidgetAreaDefinition = dashinternal.WidgetAreaDefinition
WidgetAreaDefinition captures CMS widget area metadata.
type WidgetDefinition ¶
type WidgetDefinition = dashinternal.WidgetDefinition
WidgetDefinition captures admin widget metadata.
type WidgetDefinitionSyncResult ¶ added in v0.52.0
type WidgetDefinitionSyncResult = dashinternal.WidgetDefinitionSyncResult
WidgetDefinitionSyncResult reports the synced definition and resulting status.
type WidgetDefinitionSyncStatus ¶ added in v0.52.0
type WidgetDefinitionSyncStatus = dashinternal.WidgetDefinitionSyncStatus
WidgetDefinitionSyncStatus describes how a definition sync changed persistent state.
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 `json:"entity_id"`
EntityType string `json:"entity_type"`
CurrentState string `json:"current_state"`
TargetState string `json:"target_state"`
Event string `json:"event"`
Payload map[string]any `json:"payload"`
}
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
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 `json:"name"`
Description string `json:"description"`
From string `json:"from"`
To string `json:"to"`
Guard string `json:"guard"`
DynamicTo string `json:"dynamic_to"`
Metadata map[string]any `json:"metadata"`
}
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.