{"modulePath":"github.com/GoCodeAlone/workflow-plugin-cms","version":"v0.1.10","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package internal\n\nPackage internal implements the workflow-plugin-cms plugin — the CMS engine used by gocodealone-multisite to serve multi-tenant content sites from a single workflow app.\n\nModule types provided:\n\n  - cms.tenant\\_resolver         — Host → tenant\\_id middleware (V1, V2)\n  - cms.static\\_serve\\_before\\_dynamic — static-wins routing (V3)\n  - cms.engine                  — page CRUD + render + dynamic-section substitution + theme resolver\n  - analytics.injection         — per-tenant Google Analytics injection (delegated to workflow-plugin-analytics when present; V25)\n\nStep types provided:\n\n  - step.cms\\_render\\_page        — render a CMS page for the resolved tenant\n  - step.cms\\_bundle\\_activate    — atomic-swap a fetched bundle into place\n\n## Constants\n\n```go\nconst MaxTenantTemplateBytes = 1 \u003c\u003c 20\n```\nTenant template admission is shared by runtime resolution and bundle import.\n\n## Variables\n\n```go\nvar Version = \"0.0.0\"\n```\nVersion is set at build time via -ldflags.\n\n## Functions\n\n```go\nfunc CMSAdminContributionMetadata(authorized bool) map[string]string\n```\nCMSAdminContributionMetadata returns API routes only after the host has already established admin authorization for this contribution.\n\n```go\nfunc DisableOverlay(overlay *StaticPageOverlay)\n```\n\n```go\nfunc NewPlugin() sdk.PluginProvider\n```\nNewPlugin returns a new plugin instance.\n\n```go\nfunc OverlayActiveForRender(overlay *StaticPageOverlay) bool\n```\n\n```go\nfunc PagePubliclyRenderable(page *store.Page, now time.Time) bool\n```\nPagePubliclyRenderable reports whether a page should be served publicly at now. Admin preview flows should use a separate path and explicit authz.\n\n```go\nfunc RenderPageBody(page *store.Page) (string, error)\n```\nRenderPageBody shares the actual canonical serve-time renderer with content preparation. Link validation follows rendered semantics, not arbitrary text.\n\n```go\nfunc RenderPageDocument(page *store.Page, template PageTemplate, now time.Time) (string, bool, error)\n```\nRenderPageDocument renders a public CMS page. It returns rendered=false for non-public states so callers can continue to fallback routing without exposing draft or future content.\n\n```go\nfunc RenderWidgetInstance(instance WidgetInstance, registry WidgetRegistry) (string, error)\n```\n\n```go\nfunc ValidTenantTemplateID(id string) bool\n```\n\n```go\nfunc ValidateNavigationItem(item NavigationItem) error\n```\n\n```go\nfunc ValidatePublishedMediaReference(reference string, policy MediaPolicy) error\n```\n\n```go\nfunc ValidateWidgetRegistry(registry WidgetRegistry) error\n```\n\n```go\nfunc WithTenant(ctx context.Context, info TenantInfo) context.Context\n```\nWithTenant returns a context carrying the resolved tenant.\n\n## Types\n\n```go\ntype AdminAPI struct {\n\tReloadFunc   func() error\n\tPreviewBase  string\n\tAudit        *audit.Logger\n\tAuditActor   func(*http.Request) string\n\tTenantAccess func(*http.Request, int64) bool\n\t// PlatformAccess must authorize current platform authority, including reads.\n\t// Missing configuration fails closed for global and domain administration.\n\tPlatformAccess func(*http.Request) bool\n\t// RequestAccess projects page permissions without dispatching a write and\n\t// repeats the host's authorization inside this handler when configured.\n\tRequestAccess   func(*http.Request) bool\n\tResolveTemplate func(context.Context, int64, string) (PageTemplate, error)\n\tListTemplates   func(context.Context, int64) ([]string, error)\n\t// contains filtered or unexported fields\n}\n```\nAdminAPI is the HTTP surface for the multisite admin.\n\nPer SPEC §I/T16: tenant CRUD, domain CRUD, page CRUD. Routes are mounted by the host at /api/v1/admin/\\* (see gocodealone-multisite app.yaml). The host wraps every endpoint with auth + authz middleware; this layer assumes the request is already authenticated.\n\nTenant scope for page endpoints comes from the URL path (/api/v1/admin/tenants/:id/pages...) — V12 isolation is enforced by passing tenantID as the first arg after ctx into every store call.\n\nReloadFunc is optional; when set, POST /api/v1/admin/reload invokes it to flush in-memory caches (tenant resolver, page renderer). See SPEC T31.\n\nPreviewBase is the FQDN suffix for auto-provisioned preview subdomains. When non-empty, CreateTenant also creates a \\`\\\u003cslug\u003e.\\\u003cpreview\\_base\u003e\\` domain row (V18 / T32). Empty disables auto-provision.\n\n```go\nfunc NewAdminAPI(tenants store.TenantAdminStore, pages store.PageStore) *AdminAPI\n```\nNewAdminAPI returns a handler using the given stores. Either store may be the in-memory implementation (default) or a postgres-backed production impl.\n\n```go\nfunc (a *AdminAPI) ServeHTTP(w http.ResponseWriter, r *http.Request)\n```\nServeHTTP dispatches by method + path.\n\n```go\ntype AdminContribution struct {\n\tID          string\n\tTitle       string\n\tCategory    string\n\tPath        string\n\tRenderMode  string\n\tAppContext  string\n\tPermissions []string\n\tMetadata    map[string]string\n\tActions     []string\n}\n```\nAdminContribution describes a CMS admin surface in the shape expected by workflow-plugin-admin, without depending on that plugin's generated types.\n\n```go\nfunc CMSAdminContribution() AdminContribution\n```\nCMSAdminContribution returns the site-management admin surface metadata.\n\n```go\ntype CMSPlugin struct{}\n```\nCMSPlugin implements sdk.PluginProvider.\n\n```go\nfunc (p *CMSPlugin) ContractRegistry() *pb.ContractRegistry\n```\nContractRegistry returns the CMS plugin's strict protobuf contracts.\n\n```go\nfunc (p *CMSPlugin) CreateModule(typeName, name string, config map[string]any) (sdk.ModuleInstance, error)\n```\nCreateModule creates a module instance of the given type.\n\n```go\nfunc (p *CMSPlugin) CreateStep(typeName, name string, config map[string]any) (sdk.StepInstance, error)\n```\nCreateStep creates a pipeline step instance of the given type.\n\n```go\nfunc (p *CMSPlugin) Manifest() sdk.PluginManifest\n```\nManifest returns plugin metadata.\n\n```go\nfunc (p *CMSPlugin) ModuleTypes() []string\n```\nModuleTypes returns the module types this plugin provides.\n\n```go\nfunc (p *CMSPlugin) StepTypes() []string\n```\nStepTypes returns the step types this plugin provides.\n\n```go\ntype MediaPolicy struct {\n\tAllowedObjectPrefixes []string `json:\"allowed_object_prefixes\"`\n}\n```\n\n```go\ntype NavStatus string\n```\n\n```go\nconst (\n\tNavStatusDraft     NavStatus = \"draft\"\n\tNavStatusPublished NavStatus = \"published\"\n\tNavStatusScheduled NavStatus = \"scheduled\"\n\tNavStatusArchived  NavStatus = \"archived\"\n)\n```\n\n```go\ntype NavTargetKind string\n```\n\n```go\nconst (\n\tNavTargetStatic   NavTargetKind = \"static\"\n\tNavTargetCMSPage  NavTargetKind = \"cms_page\"\n\tNavTargetOverlay  NavTargetKind = \"overlay\"\n\tNavTargetExternal NavTargetKind = \"external\"\n)\n```\n\n```go\ntype NavigationItem struct {\n\tLabel     string        `json:\"label\"`\n\tKind      NavTargetKind `json:\"kind\"`\n\tTarget    string        `json:\"target\"`\n\tStatus    NavStatus     `json:\"status\"`\n\tPublishAt *time.Time    `json:\"publish_at\"`\n}\n```\n\n```go\nfunc PublishedNavigation(items []NavigationItem, now time.Time) ([]NavigationItem, error)\n```\n\n```go\ntype OverlayMode string\n```\n\n```go\nconst (\n\tOverlayModeReplace OverlayMode = \"replace\"\n\tOverlayModeAppend  OverlayMode = \"append\"\n\tOverlayModePrepend OverlayMode = \"prepend\"\n\tOverlayModeRemove  OverlayMode = \"remove\"\n)\n```\n\n```go\ntype OverlayPublishResult struct {\n\tPublished      bool\n\tConflictReason string\n\tSourceHash     string\n}\n```\n\n```go\nfunc PublishOverlay(overlay *StaticPageOverlay, currentSourceHash string, force bool) (OverlayPublishResult, error)\n```\n\n```go\ntype OverlaySelector struct {\n\tSelector string      `json:\"selector\"`\n\tMode     OverlayMode `json:\"mode\"`\n}\n```\n\n```go\ntype OverlayStatus string\n```\n\n```go\nconst (\n\tOverlayStatusDraft          OverlayStatus = \"draft\"\n\tOverlayStatusPublished      OverlayStatus = \"published\"\n\tOverlayStatusConflictReview OverlayStatus = \"conflict_review\"\n\tOverlayStatusDisabled       OverlayStatus = \"disabled\"\n)\n```\n\n```go\ntype PageTemplate struct {\n\tID   string\n\tHTML string\n}\n```\nPageTemplate is the shell used to wrap a CMS page body.\n\n```go\ntype StaticPageOverlay struct {\n\tTenantID    int64\n\tSourcePath  string\n\tSourceHash  string\n\tSelectors   []OverlaySelector\n\tDraftBlocks json.RawMessage\n\tStatus      OverlayStatus\n\tEnabled     bool\n}\n```\n\n```go\nfunc NewStaticPageOverlay(input StaticPageOverlayInput) (*StaticPageOverlay, error)\n```\n\n```go\ntype StaticPageOverlayInput struct {\n\tTenantID    int64             `json:\"tenant_id\"`\n\tSourcePath  string            `json:\"source_path\"`\n\tSourceHash  string            `json:\"source_hash\"`\n\tSelectors   []OverlaySelector `json:\"selectors\"`\n\tDraftBlocks json.RawMessage   `json:\"draft_blocks\"`\n}\n```\n\n```go\ntype TenantInfo struct {\n\tTenantID     int64\n\tTenantSlug   string\n\tSubsiteLabel string // empty if no subsite scope\n\tKind         string // \"vanity\" | \"preview\" | \"subdomain\"\n}\n```\nTenantInfo is the resolved tenant + optional subsite for a request.\n\n```go\nfunc TenantFromContext(ctx context.Context) (TenantInfo, bool)\n```\nTenantFromContext returns the tenant resolved upstream, or ok=false if none was set (request would not have reached this point through the normal flow).\n\n```go\ntype TenantStore interface {\n\t// Lookup returns the tenant for an exact domain match. ok=false on miss.\n\tLookup(ctx context.Context, host string) (TenantInfo, bool)\n\t// LookupBySlug resolves a preview subdomain pattern (\u003cslug\u003e.\u003cbase\u003e).\n\tLookupBySlug(ctx context.Context, slug string) (TenantInfo, bool)\n}\n```\nTenantStore looks up tenants by domain. Host wires the production postgres-backed implementation at boot.\n\n```go\ntype WidgetInstance struct {\n\tID   string `json:\"id\"`\n\tType string `json:\"type\"`\n}\n```\n\n```go\ntype WidgetRegistry struct {\n\tTypes map[string]WidgetType `json:\"types\"`\n}\n```\n\n```go\ntype WidgetType struct {\n\tType   string `json:\"type\"`\n\tMarkup string `json:\"markup\"`\n}\n```\n\n","path":"github.com/GoCodeAlone/workflow-plugin-cms/internal","name":"internal","synopsis":"Package internal implements the workflow-plugin-cms plugin — the CMS engine used by gocodealone-multisite to serve multi-tenant content sites from a single workflow app.","isRedistributable":true}
