Documentation
¶
Index ¶
- Variables
- func CanonicalMenuCode(code string) string
- func CanonicalMenuItemPath(menuCode, raw string) (string, error)
- func GetMigrationsFS() embed.FS
- func NormalizeTranslationFields(label, labelKey, groupTitle, groupTitleKey string) (string, string, string, string)
- func SanitizeMenuItemSegment(seg string) string
- func SeedMenu(ctx context.Context, opts SeedMenuOptions) error
- func SeedPositionPtrForType(itemType string, pos int) *int
- func ShouldAutoCreateParentsSeed(items []SeedMenuItem) bool
- type ActivityConfig
- type BlockService
- type CacheConfig
- type Config
- type ContentConfig
- type ContentService
- type DerivedMenuItemPath
- type Features
- type GeneratorConfig
- type GeneratorService
- type I18NConfig
- type LoggingConfig
- type MarkdownConfig
- type MarkdownParserConfig
- type MediaService
- type MenuInfo
- type MenuItemInfo
- type MenuItemPath
- type MenuItemTranslationInput
- type MenuService
- type MenusConfig
- type Module
- func (m *Module) Blocks() BlockService
- func (m *Module) Container() *di.Container
- func (m *Module) Content() ContentService
- func (m *Module) Generator() GeneratorService
- func (m *Module) Markdown() interfaces.MarkdownService
- func (m *Module) Media() MediaService
- func (m *Module) Menus() MenuService
- func (m *Module) Pages() PageService
- func (m *Module) Scheduler() interfaces.Scheduler
- func (m *Module) Shortcodes() interfaces.ShortcodeService
- func (m *Module) StorageAdmin() StorageAdminService
- func (m *Module) Themes() ThemeService
- func (m *Module) TranslationAdmin() TranslationAdminService
- func (m *Module) TranslationsEnabled() bool
- func (m *Module) TranslationsRequired() bool
- func (m *Module) Widgets() WidgetService
- func (m *Module) WorkflowEngine() interfaces.WorkflowEngine
- type NavigationConfig
- type NavigationNode
- type PageService
- type ReconcileMenuResult
- type RetentionConfig
- type SeedMenuItem
- type SeedMenuOptions
- type ShortcodeCacheConfig
- type ShortcodeConfig
- type ShortcodeDefinitionConfig
- type ShortcodeSecurityConfig
- type StorageAdminService
- type StorageConfig
- type ThemeConfig
- type ThemeService
- type TranslationAdminService
- type URLKitResolverConfig
- type UpdateMenuItemByPathInput
- type UpsertMenuItemByPathInput
- type WidgetConfig
- type WidgetDefinitionConfig
- type WidgetService
- type WorkflowConfig
- type WorkflowDefinitionConfig
- type WorkflowStateConfig
- type WorkflowTransitionConfig
Constants ¶
This section is empty.
Variables ¶
var ( ErrThemesFeatureRequired = runtimeconfig.ErrThemesFeatureRequired ErrSchedulingFeatureRequiresVersioning = runtimeconfig.ErrSchedulingFeatureRequiresVersioning ErrAdvancedCacheRequiresEnabledCache = runtimeconfig.ErrAdvancedCacheRequiresEnabledCache ErrDefaultLocaleRequired = runtimeconfig.ErrDefaultLocaleRequired ErrLoggingProviderRequired = runtimeconfig.ErrLoggingProviderRequired ErrLoggingProviderUnknown = runtimeconfig.ErrLoggingProviderUnknown ErrLoggingLevelInvalid = runtimeconfig.ErrLoggingLevelInvalid ErrLoggingFormatInvalid = runtimeconfig.ErrLoggingFormatInvalid ErrActivityFeatureRequired = runtimeconfig.ErrActivityFeatureRequired ErrWorkflowProviderUnknown = runtimeconfig.ErrWorkflowProviderUnknown ErrWorkflowProviderConfiguredWhenDisabled = runtimeconfig.ErrWorkflowProviderConfiguredWhenDisabled )
var ( ErrMenuCodeRequired = errors.New("cms: menu code is required") ErrMenuItemPathRequired = errors.New("cms: menu item path is required") ErrMenuItemPathInvalid = errors.New("cms: menu item path is invalid") ErrMenuItemPathMismatch = errors.New("cms: menu item path does not match menu code") )
var ( ErrMenuNotFound = menus.ErrMenuNotFound ErrMenuInUse = menus.ErrMenuInUse )
Public menu errors.
var ErrSeedMenuServiceRequired = errors.New("cms: menu service is required")
Functions ¶
func CanonicalMenuCode ¶ added in v0.15.0
CanonicalMenuCode normalizes user input into a go-cms menu code.
Canonicalization rules are documented in MENU_CANONICALIZATION.md.
func CanonicalMenuItemPath ¶ added in v0.15.0
CanonicalMenuItemPath canonicalizes raw inputs (dot-path, slash-path, relative path) into a canonical dot-path for the provided menu code.
Output is guaranteed to belong to menuCode and pass ParseMenuItemPathForMenu invariants, or an error is returned.
func GetMigrationsFS ¶ added in v0.2.0
GetMigrationsFS returns the embedded migration files for this package
func NormalizeTranslationFields ¶ added in v0.15.0
func NormalizeTranslationFields(label, labelKey, groupTitle, groupTitleKey string) (string, string, string, string)
NormalizeTranslationFields implements common "fallback to key" behavior for label fields.
func SanitizeMenuItemSegment ¶ added in v0.15.0
SanitizeMenuItemSegment converts an arbitrary string into a safe segment used in dot-paths.
It returns an empty string when the input cannot be sanitized into a non-empty segment. Canonicalization rules are documented in MENU_CANONICALIZATION.md.
func SeedPositionPtrForType ¶ added in v0.15.0
SeedPositionPtrForType normalizes seed "optional position" semantics (nil vs 0).
Canonicalization rules are documented in MENU_CANONICALIZATION.md.
func ShouldAutoCreateParentsSeed ¶ added in v0.15.0
func ShouldAutoCreateParentsSeed(items []SeedMenuItem) bool
ShouldAutoCreateParentsSeed returns true when the provided seed spec suggests that intermediate parents are missing and should be auto-scaffolded.
Types ¶
type ActivityConfig ¶ added in v0.5.0
type ActivityConfig = runtimeconfig.ActivityConfig
type BlockService ¶
BlockService exports the blocks service contract.
type CacheConfig ¶
type CacheConfig = runtimeconfig.CacheConfig
type ContentConfig ¶
type ContentConfig = runtimeconfig.ContentConfig
type ContentService ¶
ContentService exports the content service contract for consumers of the cms package.
type DerivedMenuItemPath ¶ added in v0.15.0
func DeriveMenuItemPaths ¶ added in v0.15.0
func DeriveMenuItemPaths(menuCode string, id string, parent string, fallbackLabel string) (DerivedMenuItemPath, error)
DeriveMenuItemPaths canonicalizes and derives Path/ParentPath consistently from common user inputs.
Canonicalization and derivation rules are documented in MENU_CANONICALIZATION.md.
type Features ¶
type Features = runtimeconfig.Features
type GeneratorConfig ¶
type GeneratorConfig = runtimeconfig.GeneratorConfig
type GeneratorService ¶
GeneratorService exports the static site generator contract.
type I18NConfig ¶
type I18NConfig = runtimeconfig.I18NConfig
type LoggingConfig ¶
type LoggingConfig = runtimeconfig.LoggingConfig
type MarkdownConfig ¶
type MarkdownConfig = runtimeconfig.MarkdownConfig
type MarkdownParserConfig ¶
type MarkdownParserConfig = runtimeconfig.MarkdownParserConfig
type MediaService ¶
MediaService exports the media helper contract.
type MenuItemInfo ¶ added in v0.12.0
type MenuItemInfo struct {
Path string `json:"path"`
Type string `json:"type,omitempty"`
Position int `json:"position,omitempty"`
Target map[string]any `json:"target,omitempty"`
Icon string `json:"icon,omitempty"`
Badge map[string]any `json:"badge,omitempty"`
Permissions []string `json:"permissions,omitempty"`
Classes []string `json:"classes,omitempty"`
Styles map[string]string `json:"styles,omitempty"`
Collapsible bool `json:"collapsible,omitempty"`
Collapsed bool `json:"collapsed,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
}
MenuItemInfo is a stable public view of a menu item record. Identity is always expressed via Path (external_code), never via UUID.
type MenuItemPath ¶ added in v0.12.0
MenuItemPath captures parsed information about a dot-path menu item identifier.
Canonicalization contract
- Menu codes and path segments are treated as lowercase.
- Callers may supply dot-paths, slash-paths, or relative paths; go-cms will canonicalize inputs into a stable dot-path (`<menuCode>.<seg>...`) and validate against `isPathSegment`.
- Canonicalization rules are documented in `MENU_CANONICALIZATION.md`.
Example: - Path: "admin.content.pages" - MenuCode: "admin" - ParentPath:"admin.content" - Key: "pages"
func ParseMenuItemPath ¶ added in v0.12.0
func ParseMenuItemPath(path string) (MenuItemPath, error)
ParseMenuItemPath parses a dot-separated menu item path and derives menu code and parent path.
Invariants: - Path must include the menu code prefix and at least one item segment (min 2 segments). - No leading/trailing dots and no empty segments.
func ParseMenuItemPathForMenu ¶ added in v0.12.0
func ParseMenuItemPathForMenu(menuCode string, path string) (MenuItemPath, error)
ParseMenuItemPathForMenu validates that the provided path belongs to the given menu code.
type MenuItemTranslationInput ¶ added in v0.12.0
type MenuItemTranslationInput struct {
Locale string `json:"locale"`
Label string `json:"label,omitempty"`
LabelKey string `json:"label_key,omitempty"`
GroupTitle string `json:"group_title,omitempty"`
GroupTitleKey string `json:"group_title_key,omitempty"`
URLOverride *string `json:"url_override,omitempty"`
}
type MenuService ¶
type MenuService interface {
GetOrCreateMenu(ctx context.Context, code string, description *string, actor uuid.UUID) (*MenuInfo, error)
GetOrCreateMenuWithLocation(ctx context.Context, code string, location string, description *string, actor uuid.UUID) (*MenuInfo, error)
UpsertMenu(ctx context.Context, code string, description *string, actor uuid.UUID) (*MenuInfo, error)
UpsertMenuWithLocation(ctx context.Context, code string, location string, description *string, actor uuid.UUID) (*MenuInfo, error)
GetMenuByCode(ctx context.Context, code string) (*MenuInfo, error)
GetMenuByLocation(ctx context.Context, location string) (*MenuInfo, error)
ListMenuItemsByCode(ctx context.Context, menuCode string) ([]*MenuItemInfo, error)
ReconcileMenuByCode(ctx context.Context, menuCode string, actor uuid.UUID) (*ReconcileMenuResult, error)
ResetMenuByCode(ctx context.Context, code string, actor uuid.UUID, force bool) error
UpsertMenuItemByPath(ctx context.Context, input UpsertMenuItemByPathInput) (*MenuItemInfo, error)
UpdateMenuItemByPath(ctx context.Context, menuCode string, path string, input UpdateMenuItemByPathInput) (*MenuItemInfo, error)
DeleteMenuItemByPath(ctx context.Context, menuCode string, path string, actor uuid.UUID, cascadeChildren bool) error
UpsertMenuItemTranslationByPath(ctx context.Context, menuCode string, path string, input MenuItemTranslationInput) error
MoveMenuItemToTop(ctx context.Context, menuCode string, path string, actor uuid.UUID) error
MoveMenuItemToBottom(ctx context.Context, menuCode string, path string, actor uuid.UUID) error
MoveMenuItemBefore(ctx context.Context, menuCode string, path string, beforePath string, actor uuid.UUID) error
MoveMenuItemAfter(ctx context.Context, menuCode string, path string, afterPath string, actor uuid.UUID) error
SetMenuSiblingOrder(ctx context.Context, menuCode string, parentPath string, siblingPaths []string, actor uuid.UUID) error
}
MenuService is the public menus API for the cms package.
Identity rules: - Menus are addressed by code (e.g. "admin"). - Menu items are addressed by dot-paths (e.g. "admin.content.pages") and never by UUID.
UUIDs remain a persistence detail and must not be required for callers to use this API.
type MenusConfig ¶ added in v0.13.0
type MenusConfig = runtimeconfig.MenusConfig
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
Module represents the top level CMS runtime façade.
func (*Module) Blocks ¶
func (m *Module) Blocks() BlockService
Blocks returns the configured block service.
func (*Module) Content ¶
func (m *Module) Content() ContentService
Content returns the configured content service.
func (*Module) Generator ¶
func (m *Module) Generator() GeneratorService
Generator returns the configured generator service.
func (*Module) Markdown ¶
func (m *Module) Markdown() interfaces.MarkdownService
Markdown returns the markdown service when configured.
func (*Module) Media ¶
func (m *Module) Media() MediaService
Media returns the media helper used by the module.
func (*Module) Menus ¶
func (m *Module) Menus() MenuService
Menus returns the configured menu service.
func (*Module) Pages ¶
func (m *Module) Pages() PageService
Pages returns the configured page service.
func (*Module) Scheduler ¶
func (m *Module) Scheduler() interfaces.Scheduler
Scheduler returns the scheduler used for publish automation.
func (*Module) Shortcodes ¶ added in v0.2.0
func (m *Module) Shortcodes() interfaces.ShortcodeService
Shortcodes returns the configured shortcode service.
func (*Module) StorageAdmin ¶ added in v0.2.0
func (m *Module) StorageAdmin() StorageAdminService
StorageAdmin returns the storage admin helper service.
func (*Module) Themes ¶
func (m *Module) Themes() ThemeService
Themes returns the configured theme service.
func (*Module) TranslationAdmin ¶ added in v0.16.0
func (m *Module) TranslationAdmin() TranslationAdminService
TranslationAdmin returns the translations admin helper service.
func (*Module) TranslationsEnabled ¶ added in v0.2.0
TranslationsEnabled reports whether translations are globally enabled.
func (*Module) TranslationsRequired ¶ added in v0.2.0
TranslationsRequired reports whether translations are required when enabled.
func (*Module) Widgets ¶
func (m *Module) Widgets() WidgetService
Widgets returns the configured widget service.
func (*Module) WorkflowEngine ¶ added in v0.2.0
func (m *Module) WorkflowEngine() interfaces.WorkflowEngine
WorkflowEngine returns the configured workflow engine.
type NavigationConfig ¶
type NavigationConfig = runtimeconfig.NavigationConfig
type NavigationNode ¶ added in v0.12.0
type NavigationNode struct {
}
NavigationNode is a localized, presentation-ready navigation node. This type intentionally omits UUIDs; menu identity is expressed via menu codes and item paths.
type ReconcileMenuResult ¶ added in v0.12.0
type RetentionConfig ¶
type RetentionConfig = runtimeconfig.RetentionConfig
type SeedMenuItem ¶ added in v0.12.0
type SeedMenuItem struct {
Path string
Position *int
Type string
Target map[string]any
Icon string
Badge map[string]any
Permissions []string
Classes []string
Styles map[string]string
Collapsible bool
Collapsed bool
Metadata map[string]any
Translations []MenuItemTranslationInput
AllowMissingTranslations bool
}
type SeedMenuOptions ¶ added in v0.12.0
type SeedMenuOptions struct {
Menus MenuService
MenuCode string
Description *string
Locale string
Actor uuid.UUID
Items []SeedMenuItem
AutoCreateParents bool
// Ensure makes SeedMenu converge persisted menu items onto the provided spec.
// It performs reconciliation and enforces deterministic sibling ordering from the spec.
Ensure bool
// PruneUnspecified deletes menu items (by path) that exist in persistence but are not present in the spec.
// Deletions are performed by path and cascade through any descendant items.
PruneUnspecified bool
}
type ShortcodeCacheConfig ¶ added in v0.2.0
type ShortcodeCacheConfig = runtimeconfig.ShortcodeCacheConfig
type ShortcodeConfig ¶ added in v0.2.0
type ShortcodeConfig = runtimeconfig.ShortcodeConfig
type ShortcodeDefinitionConfig ¶ added in v0.2.0
type ShortcodeDefinitionConfig = runtimeconfig.ShortcodeDefinitionConfig
type ShortcodeSecurityConfig ¶ added in v0.2.0
type ShortcodeSecurityConfig = runtimeconfig.ShortcodeSecurityConfig
type StorageAdminService ¶ added in v0.2.0
type StorageAdminService = *adminstorage.Service
StorageAdminService exports the storage admin helper contract.
type StorageConfig ¶
type StorageConfig = runtimeconfig.StorageConfig
type ThemeConfig ¶
type ThemeConfig = runtimeconfig.ThemeConfig
type ThemeService ¶
ThemeService exports the themes service contract.
type TranslationAdminService ¶ added in v0.16.0
type TranslationAdminService = *admintranslations.Service
TranslationAdminService exports the translation settings admin helper contract.
type URLKitResolverConfig ¶
type URLKitResolverConfig = runtimeconfig.URLKitResolverConfig
type UpdateMenuItemByPathInput ¶ added in v0.12.0
type UpdateMenuItemByPathInput struct {
ParentPath *string
Type *string
Target map[string]any
Icon *string
Badge map[string]any
Permissions []string
Classes []string
Styles map[string]string
Collapsible *bool
Collapsed *bool
Metadata map[string]any
// Position is a 0-based insertion index among siblings.
// Values past the end are clamped to append. Nil leaves the current position unchanged.
Position *int
Actor uuid.UUID
}
type UpsertMenuItemByPathInput ¶ added in v0.12.0
type UpsertMenuItemByPathInput struct {
Path string
ParentPath string
// Position is a 0-based insertion index among siblings.
// Values past the end are clamped to append. Nil defaults to append for new items.
Position *int
Type string
Target map[string]any
Icon string
Badge map[string]any
Permissions []string
Classes []string
Styles map[string]string
Collapsible bool
Collapsed bool
Metadata map[string]any
Translations []MenuItemTranslationInput
AllowMissingTranslations bool
Actor uuid.UUID
}
type WidgetConfig ¶
type WidgetConfig = runtimeconfig.WidgetConfig
type WidgetDefinitionConfig ¶
type WidgetDefinitionConfig = runtimeconfig.WidgetDefinitionConfig
type WidgetService ¶
WidgetService exports the widgets service contract.
type WorkflowConfig ¶ added in v0.2.0
type WorkflowConfig = runtimeconfig.WorkflowConfig
type WorkflowDefinitionConfig ¶ added in v0.2.0
type WorkflowDefinitionConfig = runtimeconfig.WorkflowDefinitionConfig
type WorkflowStateConfig ¶ added in v0.2.0
type WorkflowStateConfig = runtimeconfig.WorkflowStateConfig
type WorkflowTransitionConfig ¶ added in v0.2.0
type WorkflowTransitionConfig = runtimeconfig.WorkflowTransitionConfig
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
example
command
|
|
|
markdown/import
command
|
|
|
markdown/preview
command
|
|
|
markdown/sync
command
|
|
|
examples
|
|
|
static
command
|
|
|
internal
|
|
|
markdown
Package markdown provides the concrete implementation of the Markdown ingestion workflows outlined in docs/FEAT_MARKDOWN.md.
|
Package markdown provides the concrete implementation of the Markdown ingestion workflows outlined in docs/FEAT_MARKDOWN.md. |
|
pkg
|
|
|
generator
Package generator exposes the static site generation API for go-cms hosts.
|
Package generator exposes the static site generation API for go-cms hosts. |