config

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package config validates and normalizes the public authoring model into a canonical immutable schema manifest.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Resolve

func Resolve(input Input) (schema.Manifest, error)

Resolve performs a complete deterministic validation pass before freezing a manifest. It has no runtime plugin setup, database, filesystem, or network dependency.

func UploadFields added in v0.2.0

func UploadFields(authored field.Fields, path string) (field.Fields, error)

UploadFields completes the graph before plugin edits and occurrence binding. Managed metadata retains its required/index/read-only settings. Declarations may add field-owned behavior and presentation, but cannot change its storage shape or introduce static value constraints that uploads do not support.

Types

type Admin

type Admin struct {
	User         schema.CollectionSlug
	Localization AdminLocalization
}

type AdminLanguage

type AdminLanguage struct {
	Code              string
	Label             string
	LabelTranslations map[string]string
	RTL               bool
}

type AdminLocalization

type AdminLocalization struct {
	Languages       []AdminLanguage
	DefaultLanguage string
	TimeZones       []AdminTimeZone
	DefaultTimeZone string
}

type AdminTimeZone

type AdminTimeZone struct {
	ID                string
	Label             string
	LabelTranslations map[string]string
}

type Collection

type Collection struct {
	Slug                 schema.CollectionSlug
	Labels               schema.CollectionLabels
	Admin                CollectionAdmin
	Fields               field.Fields
	Indexes              []CollectionIndex
	Auth                 bool
	SessionDuration      time.Duration
	PasswordMinLength    int
	PasswordMaxBytes     int
	PasswordBcryptCost   int
	MaxLoginAttempts     int
	LockDuration         time.Duration
	PasswordReset        bool
	PasswordResetTTL     time.Duration
	VerifyEmail          bool
	VerificationTTL      time.Duration
	APIKeys              bool
	Upload               bool
	UploadConfig         UploadConfig
	Versions             bool
	Trash                bool
	LockDocuments        bool
	DocumentLockDuration time.Duration
	VersionConfig        VersionConfig
	Endpoints            []Endpoint
}

type CollectionAdmin

type CollectionAdmin struct {
	UseAsTitle              string
	DefaultColumns          []string
	Group                   string
	GroupTranslations       map[string]string
	Description             string
	DescriptionTranslations map[string]string
	FolderField             string
	ParentField             string
	LivePreview             LivePreviewConfig
}

type CollectionIndex

type CollectionIndex struct {
	Fields []string
	Unique bool
}

type Endpoint

type Endpoint struct {
	Method  string
	Path    string
	Summary string
}

type Global

type Global struct {
	Slug              schema.CollectionSlug
	Label             string
	LabelTranslations map[string]string
	Admin             GlobalAdmin
	Fields            field.Fields
	Versions          bool
	VersionConfig     VersionConfig
	Endpoints         []Endpoint
}

type GlobalAdmin

type GlobalAdmin struct {
	Group                   string
	GroupTranslations       map[string]string
	Description             string
	DescriptionTranslations map[string]string
	LivePreview             LivePreviewConfig
}

type Graph added in v0.2.0

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

Graph is the private companion to a manifest. Authoring nodes retain their executable attachments and placement metadata here; both remain private. Application construction lowers the companion once; requests never query it.

func ResolveGraph added in v0.2.0

func ResolveGraph(input Input) (schema.Manifest, Graph, error)

ResolveGraph binds field-owned selectors before lowering the manifest and retains their symbolic declarations in immutable occurrence views.

func (Graph) Binding added in v0.2.0

func (g Graph) Binding(id string) (field.View, bool)

Binding returns an immutable view, never an executable dispatch table.

func (Graph) Occurrences added in v0.2.0

func (g Graph) Occurrences() []Occurrence

type ImageSize

type ImageSize struct {
	Name   string
	Width  int
	Height int
	Fit    string
}

type Input

type Input struct {
	Blocks           []field.Block
	Name             string
	NameTranslations map[string]string
	AllowIDOnCreate  bool
	Admin            Admin
	Localization     *Localization
	Collections      []Collection
	Globals          []Global
	Endpoints        []Endpoint
	Plugins          []Plugin
}

type LivePreviewConfig

type LivePreviewConfig struct {
	URL         string
	Breakpoints []PreviewBreakpoint
}

type Locale

type Locale struct {
	Code            schema.LocaleCode
	Label           string
	RTL             bool
	FallbackLocales []schema.LocaleCode
}

type Localization

type Localization struct {
	Locales         []Locale
	DefaultLocale   schema.LocaleCode
	DisableFallback bool
}

type Occurrence added in v0.2.0

type Occurrence struct {
	ID           string                 `json:"id"`
	SchemaID     schema.StableID        `json:"schemaId,omitempty"`
	ResourceKind string                 `json:"resourceKind"`
	Resource     string                 `json:"resource"`
	Name         string                 `json:"name,omitempty"`
	Kind         field.Kind             `json:"kind,omitempty"`
	Boundary     string                 `json:"boundary"`
	Stored       bool                   `json:"stored"`
	AuthoredPath string                 `json:"authoredPath"`
	ResolvedPath string                 `json:"resolvedPath"`
	ParentID     string                 `json:"parentId,omitempty"`
	ScopeID      string                 `json:"scopeId"`
	LocaleOwner  string                 `json:"localeOwner,omitempty"`
	Repeated     []RepeatedAxis         `json:"repeated,omitempty"`
	Provenance   []string               `json:"provenance,omitempty"`
	References   []ReferenceBinding     `json:"references,omitempty"`
	Extensions   map[string]store.Value `json:"extensions,omitempty"`
}

Occurrence is a schema placement, not a concrete runtime row. Repeated axes retain the identity property and case needed by a later operation binding; LocaleOwner identifies the existing exact-locale dimension without inventing runtime rows or expanding localization semantics.

type Plugin

type Plugin struct {
	Key                   string
	Version               string
	GoPackage             string
	APIVersion            uint32
	Ridu                  *PluginCompatibility
	Admin                 *PluginAdmin
	FieldTypes            []PluginFieldType
	DatabaseContributions []PluginDatabaseContribution
	Endpoints             []PluginEndpoint
}

type PluginAdmin

type PluginAdmin struct {
	Package        string
	Export         string
	APIVersion     uint32
	PairingVersion uint32
	Routes         []string
	Assets         []string
}

type PluginCompatibility

type PluginCompatibility struct {
	Minimum          string
	MaximumExclusive string
}

type PluginDatabaseContribution

type PluginDatabaseContribution struct {
	Adapter    schema.PluginDatabaseAdapter
	Migrations []PluginMigration
	Tables     []string
}

type PluginEndpoint

type PluginEndpoint struct {
	Method  string
	Path    string
	Summary string
}

type PluginFieldType

type PluginFieldType struct {
	// EmbeddedTypes lists tree.case selectors supplying ordered generic payload type arguments.
	EmbeddedTypes     []string `json:"embeddedTypes,omitempty"`
	Key               string
	TypeScriptPackage string
	TypeScriptOutput  string
	TypeScriptInput   string
	TypeScriptWhere   string
	GoPackage         string
	GoType            string
	JSONSchema        []byte
}

type PluginMigration

type PluginMigration struct {
	Version uint32
	Name    string
	UpSQL   []string
	DownSQL []string
}

type PreviewBreakpoint

type PreviewBreakpoint struct {
	Name              string
	Label             string
	LabelTranslations map[string]string
	Width             int
	Height            int
}

type ReferenceBinding added in v0.2.0

type ReferenceBinding struct {
	Policy       string               `json:"policy"`
	Scope        field.ReferenceScope `json:"scope"`
	Path         string               `json:"path"`
	TargetID     string               `json:"targetId"`
	ResolvedPath string               `json:"resolvedPath"`
}

type RepeatedAxis added in v0.2.0

type RepeatedAxis struct {
	OccurrenceID string `json:"occurrenceId"`
	Identity     string `json:"identity"`
	Case         string `json:"case,omitempty"`
}

type UploadConfig

type UploadConfig struct {
	MaxFileSize int64
	MimeTypes   []string
	Private     bool
	ImageSizes  []ImageSize
}

type VersionConfig

type VersionConfig struct {
	Drafts           bool
	MaxPerDocument   int
	AutosaveInterval time.Duration
}

Jump to

Keyboard shortcuts

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