dataentry

package
v0.0.0-...-6013caa Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: AGPL-3.0 Imports: 50 Imported by: 0

Documentation

Overview

Package dataentry provides a config-driven data entry web application built on top of rela's metamodel system. It reads a data-entry.yaml config file alongside a rela project and serves an interactive UI for CRUD operations on entities stored as markdown files.

Configuration types and validation logic live in the dataentryconfig package so that the CLI can validate configs without importing the full web layer. This file re-exports those types for backward compatibility.

Index

Constants

Widget and direction constants — re-exported from dataentryconfig.

ConfigFile is the conventional filename for data-entry configuration within a rela project.

Variables

ResolvePalette is re-exported from dataentryconfig.

ValidateConfig re-exports the validation function from dataentryconfig.

Functions

func CheckEmbeddedSPA

func CheckEmbeddedSPA() error

CheckEmbeddedSPA verifies that the embedded Vue SPA bundle is present and usable. Production entry points (cmd/rela-server, cmd/rela-desktop) should call this at startup so a missing or empty build fails loudly with a clear message instead of silently serving a directory listing (the BUG-W144 regression class). Tests that construct routers via NewRouter do not need to call this.

Types

type APIAnalysisResult

type APIAnalysisResult struct {
	Errors   int            `json:"errors"`
	Warnings int            `json:"warnings"`
	Issues   []APIIssue     `json:"issues"`
	ByCheck  map[string]int `json:"byCheck"`
}

APIAnalysisResult is the JSON representation of analysis results.

type APICreateEntityRequest

type APICreateEntityRequest struct {
	ID         string                 `json:"id,omitempty"` // Optional, auto-generated if empty
	Type       string                 `json:"type"`
	Properties map[string]interface{} `json:"properties"`
	Content    string                 `json:"content,omitempty"`
}

APICreateEntityRequest is the request body for creating an entity.

type APICreateRelationRequest

type APICreateRelationRequest struct {
	From       string                 `json:"from"`
	Type       string                 `json:"type"`
	To         string                 `json:"to"`
	Properties map[string]interface{} `json:"properties,omitempty"`
}

APICreateRelationRequest is the request body for creating a relation.

type APIDefaultOverride

type APIDefaultOverride struct {
	Types            []string          `json:"types"`
	Defaults         map[string]string `json:"defaults"`
	RelationDefaults map[string]string `json:"relationDefaults"`
}

APIDefaultOverride is the JSON representation of a default override.

type APIEntity

type APIEntity struct {
	ID         string                 `json:"id"`
	Type       string                 `json:"type"`
	Properties map[string]interface{} `json:"properties"`
	Content    string                 `json:"content,omitempty"`
	Relations  []APIRelation          `json:"relations,omitempty"`
}

APIEntity is the JSON representation of an entity for the API.

type APIEntityType

type APIEntityType struct {
	Name       string                 `json:"name"`
	Plural     string                 `json:"plural"`
	Primary    string                 `json:"primary,omitempty"`
	Properties map[string]APIProperty `json:"properties"`
}

APIEntityType is the JSON representation of an entity type definition.

type APIIssue

type APIIssue struct {
	EntityID   string `json:"entityId"`
	EntityType string `json:"entityType"`
	Message    string `json:"message"`
	Severity   string `json:"severity"` // "error" or "warning"
	CheckType  string `json:"checkType"`
}

APIIssue is the JSON representation of a single analysis issue.

type APIMetamodel

type APIMetamodel struct {
	EntityTypes   []APIEntityType   `json:"entityTypes"`
	RelationTypes []APIRelationType `json:"relationTypes"`
}

APIMetamodel is the JSON representation of the project metamodel.

type APIProperty

type APIProperty struct {
	Type     string   `json:"type"`
	Required bool     `json:"required"`
	Default  string   `json:"default,omitempty"`
	Values   []string `json:"values,omitempty"` // for enum types
}

APIProperty is the JSON representation of a property definition.

type APIPropertyDef

type APIPropertyDef struct {
	Name   string   `json:"name"`
	Type   string   `json:"type"`
	Values []string `json:"values"`
}

APIPropertyDef describes a property for the settings page.

type APIRelation

type APIRelation struct {
	Type        string                 `json:"type"`
	From        string                 `json:"from"`
	To          string                 `json:"to"`
	Direction   Direction              `json:"direction"` // "outgoing" or "incoming"
	TargetID    string                 `json:"targetId"`
	TargetTitle string                 `json:"targetTitle"`
	TargetType  string                 `json:"targetType"`
	Properties  map[string]interface{} `json:"properties,omitempty"`
}

APIRelation is the JSON representation of a relation for the API.

type APIRelationDef

type APIRelationDef struct {
	Name       string              `json:"name"`
	Label      string              `json:"label"`
	TargetType string              `json:"targetType"`
	Targets    []APIRelationTarget `json:"targets"`
}

APIRelationDef describes a relation for the settings page.

type APIRelationTarget

type APIRelationTarget struct {
	ID    string `json:"id"`
	Title string `json:"title"`
}

APIRelationTarget is a possible target for a relation.

type APIRelationType

type APIRelationType struct {
	Name   string   `json:"name"`
	From   []string `json:"from"`
	To     []string `json:"to"`
	Plural string   `json:"plural,omitempty"`
}

APIRelationType is the JSON representation of a relation type definition.

type APISettingsData

type APISettingsData struct {
	UserDefaults  APIUserDefaults                `json:"userDefaults"`
	UserPalette   *dataentryconfig.PaletteConfig `json:"userPalette,omitempty"`
	AllProperties []APIPropertyDef               `json:"allProperties"`
	AllRelations  []APIRelationDef               `json:"allRelations"`
	EntityTypes   []string                       `json:"entityTypes"`
}

APISettingsData contains all data needed for the settings page.

type APIUpdateEntityRequest

type APIUpdateEntityRequest struct {
	Properties map[string]interface{} `json:"properties,omitempty"`
	Content    *string                `json:"content,omitempty"` // Pointer to distinguish empty from not provided
}

APIUpdateEntityRequest is the request body for updating an entity.

type APIUserDefaults

type APIUserDefaults struct {
	Defaults         map[string]string    `json:"defaults"`
	RelationDefaults map[string]string    `json:"relationDefaults"`
	Overrides        []APIDefaultOverride `json:"overrides"`
}

APIUserDefaults is the JSON representation of user defaults.

type AnalysisIssue

type AnalysisIssue struct {
	EntityID   string // Empty for non-entity issues (e.g., ID gaps)
	EntityType string
	Title      string
	Message    string
	Severity   string // "error" or "warning"
}

AnalysisIssue represents a single validation issue, optionally linked to an entity.

type AnalysisResult

type AnalysisResult struct {
	Sections     []AnalysisSection
	ErrorCount   int
	WarningCount int
}

AnalysisResult is the complete output of running all analyses.

type AnalysisSection

type AnalysisSection struct {
	Name        string
	Description string
	Issues      []AnalysisIssue
}

AnalysisSection groups issues by analysis category.

func (AnalysisSection) ErrorCount

func (s AnalysisSection) ErrorCount() int

ErrorCount returns the number of error-severity issues in this section.

func (AnalysisSection) WarningCount

func (s AnalysisSection) WarningCount() int

WarningCount returns the number of warning-severity issues in this section.

type App

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

App is the central application struct for the data-entry server.

Concurrency model

All reloadable state (config, metamodel, graph, style map, palette, user defaults, OpenAPI generator) lives in an immutable AppState struct held via atomic.Pointer. Handlers call a.State() once at entry and work against a coherent snapshot for the duration of the request — no lock acquisition, no risk of observing a half-reloaded world.

Reloads (triggered by the file watcher or by Reload) build a new AppState and publish it atomically via a.state.Store. The previous state is garbage-collected once no reader holds it.

Mutations (CreateEntity, UpdateEntity, DeleteEntity, CreateRelation, UpdateRelation, DeleteRelation, SetProperty, action scripts) serialize via writeMu. writeMu excludes concurrent mutations but does NOT block readers — readers go through state.Load(). The workspace's internal reloadMu coordinates the reload itself with the mutation path.

func NewApp

func NewApp(ws *workspace.Workspace) (*App, error)

NewApp creates and initializes an App using the given workspace.

func (*App) Cfg

func (a *App) Cfg() *Config

Cfg returns the current data-entry config (convenience accessor). Equivalent to a.State().Cfg.

func (*App) Graph

func (a *App) Graph() *graph.Graph

Graph returns the current in-memory graph (convenience accessor).

func (*App) Meta

func (a *App) Meta() *metamodel.Metamodel

Meta returns the current metamodel (convenience accessor).

func (*App) NewRouter

func (a *App) NewRouter() http.Handler

NewRouter returns an http.Handler with all data entry routes registered. The Vue SPA serves as the primary UI at the root path.

func (*App) ProjectName

func (a *App) ProjectName() string

ProjectName returns the display name of the loaded project.

func (*App) ProjectRoot

func (a *App) ProjectRoot() string

ProjectRoot returns the root directory of the loaded project.

func (*App) SetSecurityConfig

func (a *App) SetSecurityConfig(cfg SecurityConfig) error

SetSecurityConfig configures the HTTP security middlewares applied by NewRouter. It must be called before NewRouter.

func (*App) StartGitFetch

func (a *App) StartGitFetch() (stop func())

StartGitFetch begins periodic git fetch in the background. Returns a stop function to shut down the fetcher.

coverage-ignore: background goroutine with timer

func (*App) StartWatching

func (a *App) StartWatching() error

StartWatching begins file watching for live-reload of views when project files change. The workspace handles metamodel + graph reload; this method adds dataentry-specific side-effects (config reload, SSE broadcast). Stop via a.ws.StopWatching().

coverage-ignore: requires real filesystem events via fsnotify

func (*App) State

func (a *App) State() *AppState

State returns the current reloadable snapshot. Handlers should call State() once at entry and use the returned snapshot consistently throughout, instead of making multiple calls that could see different snapshots after a concurrent reload.

type AppConfig

type AppConfig = dataentryconfig.AppConfig

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type AppState

type AppState struct {
	Cfg          *Config
	Meta         *metamodel.Metamodel
	Graph        *graph.Graph
	StyleMap     map[string]map[string]string
	StyledTypes  map[string]bool
	UserDefaults *UserDefaults
	Palette      *ResolvedPalette
	UserPalette  *PaletteConfig
	OpenAPIGen   *openapi.Generator
}

AppState bundles the reloadable fields of App into an immutable snapshot.

During this PR, App still holds the same fields as plain struct fields (Cfg, meta, g, styleMap, styledTypes, userDefaults, palette, userPalette, openAPIGen) and the AppState is published in parallel via atomic.Pointer. Handlers will be migrated to read from the snapshot in a subsequent PR.

The fields here mirror the workspace.workspaceState pattern: callers Load() once and work against a coherent snapshot, instead of holding a read lock around the entire request.

type CheckboxStats

type CheckboxStats struct {
	Checked int
	Total   int
}

CheckboxStats holds completion counts for task list items.

type CommandConfig

type CommandConfig = dataentryconfig.CommandConfig

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type CommandMessage

type CommandMessage struct {
	Type       string `json:"type"`
	Text       string `json:"text,omitempty"`
	Level      string `json:"level,omitempty"`
	Path       string `json:"path,omitempty"`
	Label      string `json:"label,omitempty"`
	Action     string `json:"action,omitempty"`
	ID         string `json:"id,omitempty"`
	EntityType string `json:"entity_type,omitempty"`
	URL        string `json:"url,omitempty"`
}

CommandMessage is a structured message parsed from a command's stdout.

type CommandScope

type CommandScope = dataentryconfig.CommandScope

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type Config

type Config = dataentryconfig.Config

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type ConfigValidationError

type ConfigValidationError = dataentryconfig.ConfigValidationError

ConfigValidationError is re-exported from dataentryconfig.

type DashboardCard

type DashboardCard = dataentryconfig.DashboardCard

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type DashboardConfig

type DashboardConfig = dataentryconfig.DashboardConfig

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type DefaultOverride

type DefaultOverride = dataentryconfig.DefaultOverride

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type Direction

type Direction = dataentryconfig.Direction

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type DocumentConfig

type DocumentConfig = dataentryconfig.DocumentConfig

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type FilterConfig

type FilterConfig = dataentryconfig.FilterConfig

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type FilterControl

type FilterControl = dataentryconfig.FilterControl

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type Form

type Form = dataentryconfig.Form

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type FormField

type FormField = dataentryconfig.FormField

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type FormRelation

type FormRelation = dataentryconfig.FormRelation

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type GitStatusResponse

type GitStatusResponse struct {
	Available     bool     `json:"available"`
	Branch        string   `json:"branch,omitempty"`
	LocalChanges  int      `json:"local_changes"`
	RemoteAhead   int      `json:"remote_ahead"`
	Syncing       bool     `json:"syncing"`
	Conflict      bool     `json:"conflict"`
	ConflictFiles []string `json:"conflict_files,omitempty"`
}

GitStatusResponse is the JSON response for /api/git/status.

type GitSyncResponse

type GitSyncResponse struct {
	Success       bool     `json:"success"`
	Error         string   `json:"error,omitempty"`
	ConflictFiles []string `json:"conflict_files,omitempty"`
}

GitSyncResponse is the JSON response for /api/git/sync.

type GroupData

type GroupData struct {
	GroupName string
	Rows      []SectionRowData
	Entities  []SectionEntityData
}

GroupData holds a group of rows/entities for grouped table/card display.

type Kanban

type Kanban = dataentryconfig.Kanban

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type KanbanCard

type KanbanCard = dataentryconfig.KanbanCard

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type KanbanColumn

type KanbanColumn = dataentryconfig.KanbanColumn

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type KanbanSwimlane

type KanbanSwimlane = dataentryconfig.KanbanSwimlane

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type List

type List = dataentryconfig.List

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type ListColumn

type ListColumn = dataentryconfig.ListColumn

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type NavElement struct {
	Item  *NavItem
	Group *NavGroup
}

NavElement is a union of either a direct NavItem or a NavGroup. Exactly one of Item or Group is non-nil.

type NavGroup struct {
	Group     string
	Collapsed bool
	Items     []NavItem
}

NavGroup is an enriched navigation group containing resolved nav items.

type NavItem struct {
	Label      string
	List       string
	Dashboard  bool
	Graph      bool
	Kanban     string
	EntityType string
	Count      int
}

NavItem is an enriched navigation entry that includes the entity type for client-side matching.

type NavigationEntry = dataentryconfig.NavigationEntry

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type PaletteColors

type PaletteColors = dataentryconfig.PaletteColors

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type PaletteConfig

type PaletteConfig = dataentryconfig.PaletteConfig

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type PropertyHelp

type PropertyHelp struct {
	Name        string
	Type        string
	Required    bool
	Description htmltemplate.HTML
}

PropertyHelp holds documentation for a single property.

type RelationHelp

type RelationHelp struct {
	Name        string
	Label       string
	TargetType  string // target type for outgoing, source type for incoming
	Cardinality string
	Required    bool // true if min cardinality >= 1
	Description htmltemplate.HTML
}

RelationHelp holds documentation for a single relation.

type RelationProperty

type RelationProperty = dataentryconfig.RelationProperty

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type ResolvedCommand

type ResolvedCommand struct {
	ID       string
	Label    string
	Confirm  string
	Context  string
	AutoOpen *bool
}

ResolvedCommand is a command that has been matched to a specific page context.

type ResolvedField

type ResolvedField struct {
	Name           string              // HTML input name attribute (defaults to Property if empty)
	Property       string              // Property name (used for IDs)
	Label          string              // Display label
	Placeholder    string              // Input placeholder
	Help           string              // Help text shown below field
	Required       bool                // Field is required
	Default        string              // Default value
	Value          string              // Current value
	SelectedValues []string            // For multi-select widgets
	Hidden         bool                // Field is hidden (rendered as hidden input)
	Widget         string              // Widget type: text, textarea, select, multi-select, checkbox
	InputType      string              // HTML input type: text, date, number, etc.
	Values         []string            // Allowed values for select/multi-select
	Transitions    map[string][]string // Status transitions (for workflow fields)
	Error          string              // Validation error message
}

ResolvedField represents a form field with all values resolved for rendering. Used by form templates to render property inputs consistently.

type ResolvedPalette

type ResolvedPalette = dataentryconfig.ResolvedPalette

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type ScopeNav

type ScopeNav struct {
	PrevURL  string // URL for previous entity (empty if at first)
	NextURL  string // URL for next entity (empty if at last)
	Progress string // e.g. "[3/12]"
	Label    string // e.g. "12 tickets" or "5 results for 'auth'"
	BackURL  string // URL to return to the list/search
}

ScopeNav holds prev/next navigation context for browsing through a list of entities.

type SectionAddInfo

type SectionAddInfo struct {
	Relation string
	LinkAs   string // "from" or "to" — role of the new entity in the relation
	PeerID   string // entry entity ID
	Targets  []SectionAddTarget
}

SectionAddInfo describes an "Add" button on a view section.

type SectionAddTarget

type SectionAddTarget struct {
	EntityType string
	FormID     string
	Label      string
}

SectionAddTarget holds a possible entity type target for an "Add" button.

type SectionColumnData

type SectionColumnData struct {
	Values     []string
	PropType   string
	Widget     string
	Link       string // resolved link URL or empty
	EntityID   string
	EntityType string
}

SectionColumnData holds a resolved table cell for template rendering.

type SectionData

type SectionData struct {
	Heading      string
	SectionID    string
	Display      string
	Fields       []SectionFieldData
	Entities     []SectionEntityData
	Columns      []ListColumn
	Rows         []SectionRowData
	Groups       []GroupData
	IsGrouped    bool
	EmptyMessage string
	IsEmpty      bool
	Link         string // section-level link configuration (currently unused in templates)
	Content      string
	HasContent   bool
	AddInfo      *SectionAddInfo
	LinkInfo     *SectionLinkInfo
}

SectionData holds all resolved data for a single view section.

type SectionEntityData

type SectionEntityData struct {
	ID         string
	Title      string
	Type       string
	EditFormID string
	Fields     []SectionFieldData
	Content    string
	HasContent bool
}

SectionEntityData holds a resolved entity for template rendering.

type SectionFieldData

type SectionFieldData struct {
	Label    string
	Value    string
	PropType string
}

SectionFieldData holds a single resolved field for template rendering.

type SectionLinkInfo

type SectionLinkInfo struct {
	Relation    string   // relation type name
	LinkAs      string   // "from" or "to" — role of the linked entity
	PeerID      string   // entry entity ID
	EntityTypes []string // valid target entity types
}

SectionLinkInfo describes a "Link existing" button on a view section.

type SectionRowData

type SectionRowData struct {
	EntityID   string
	EntityType string
	EditFormID string
	Cells      []SectionColumnData
	Content    string
}

SectionRowData holds a resolved table row for template rendering.

type SecurityConfig

type SecurityConfig struct {
	// BindAddress is the host:port (or :port) the server is bound to.
	// Used to derive the default Host and Origin allowlists.
	BindAddress string
	// AllowedOrigins are extra origins permitted in addition to the
	// loopback defaults derived from BindAddress. Used to allow dev servers
	// such as Vite running on a different port.
	AllowedOrigins []string
}

SecurityConfig configures the HTTP security middlewares.

rela-server is intended to run on a local port, but a browser visiting any other site is already inside the loopback trust boundary. These middlewares reject:

  • Requests whose Host header is not in the loopback allowlist (DNS rebinding defense).
  • Requests to sensitive endpoints whose Origin (or Referer fallback) is not in the allowlist (CSRF / cross-origin read defense).

All sensitive endpoints are protected on every method, not just non-safe ones, because some handlers (e.g. /api/command/) historically accept GET for state-changing operations and a method-based filter would miss `<img src=...>` style attacks.

type SidePanelConfig

type SidePanelConfig = dataentryconfig.SidePanelConfig

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type SortSpec

type SortSpec = dataentryconfig.SortSpec

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type UIState

type UIState = dataentryconfig.UIState

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type UserDefaults

type UserDefaults = dataentryconfig.UserDefaults

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type V1ActionResponse

type V1ActionResponse struct {
	Redirect      string `json:"redirect,omitempty"`
	Message       string `json:"message,omitempty"`
	MessageType   string `json:"message_type,omitempty"`
	Error         string `json:"error,omitempty"`
	CorrelationID string `json:"correlation_id,omitempty"`
}

V1ActionResponse mirrors script.ActionResponse for API JSON output. Has both successful response fields and error fields with correlation ID.

type V1ActionStatus

type V1ActionStatus struct {
	Allowed bool   `json:"allowed"`
	Reason  string `json:"reason,omitempty"`
}

V1ActionStatus describes whether an action is allowed.

type V1Actions

type V1Actions struct {
	Delete      *V1ActionStatus `json:"delete,omitempty"`
	Transitions []string        `json:"transitions,omitempty"`
}

V1Actions describes available actions for an entity.

type V1AppConfig

type V1AppConfig struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

V1AppConfig is the JSON representation of the app config.

type V1Command

type V1Command struct {
	ID       string `json:"id"`
	Label    string `json:"label"`
	Confirm  string `json:"confirm,omitempty"`
	Context  string `json:"context"`
	AutoOpen *bool  `json:"auto_open,omitempty"`
}

V1Command is the JSON representation of an available command.

type V1Config

type V1Config struct {
	App        V1AppConfig                               `json:"app"`
	Styles     map[string]map[string]string              `json:"styles"`
	Forms      map[string]dataentryconfig.Form           `json:"forms"`
	Lists      map[string]dataentryconfig.List           `json:"lists"`
	Views      map[string]dataentryconfig.ViewConfig     `json:"views"`
	Kanbans    map[string]dataentryconfig.Kanban         `json:"kanbans"`
	Dashboard  *dataentryconfig.DashboardConfig          `json:"dashboard,omitempty"`
	Navigation []dataentryconfig.NavigationEntry         `json:"navigation"`
	Documents  map[string]dataentryconfig.DocumentConfig `json:"documents,omitempty"`
	Palette    *dataentryconfig.ResolvedPalette          `json:"palette,omitempty"`
}

V1Config is the JSON representation of the UI config.

type V1ConflictDetail

type V1ConflictDetail struct {
	Path          string           `json:"path"`
	EntityType    string           `json:"entity_type,omitempty"`
	EntityID      string           `json:"entity_id,omitempty"`
	PropertyDiffs []V1PropertyDiff `json:"property_diffs"`
	ContentSame   bool             `json:"content_same"`
	ContentOurs   string           `json:"content_ours,omitempty"`
	ContentTheirs string           `json:"content_theirs,omitempty"`
}

V1ConflictDetail contains detailed info for resolving a conflict.

type V1ConflictItem

type V1ConflictItem struct {
	Path        string `json:"path"`
	EntityType  string `json:"entity_type,omitempty"`
	EntityID    string `json:"entity_id,omitempty"`
	MarkerCount int    `json:"marker_count"`
}

V1ConflictItem represents a conflicted file.

type V1ConflictResolveRequest

type V1ConflictResolveRequest struct {
	Path            string            `json:"path"`
	PropertyChoices map[string]string `json:"property_choices"`
	ContentChoice   string            `json:"content_choice"`
	ManualContent   string            `json:"manual_content,omitempty"`
}

V1ConflictResolveRequest contains the resolution choices.

type V1ConflictsResponse

type V1ConflictsResponse struct {
	Conflicts []V1ConflictItem `json:"conflicts"`
	Count     int              `json:"count"`
}

V1ConflictsResponse contains the list of conflicts.

type V1CustomType

type V1CustomType struct {
	Values  []string `json:"values"`
	Default string   `json:"default,omitempty"`
}

V1CustomType is the JSON representation of a custom type.

type V1DocumentResponse

type V1DocumentResponse struct {
	HTML      string   `json:"html"`
	Cached    bool     `json:"cached"`
	EntityIDs []string `json:"entity_ids"` // IDs of entities involved in this document (for SSE filtering)
}

V1DocumentResponse contains the rendered document content.

type V1Entity

type V1Entity struct {
	ID         string                 `json:"id"`
	Type       string                 `json:"type"`
	Title      string                 `json:"_title,omitempty"`
	Properties map[string]interface{} `json:"properties"`
	Content    string                 `json:"content,omitempty"`
	Relations  map[string][]string    `json:"relations,omitempty"`
	Included   map[string]V1Entity    `json:"included,omitempty"`
	Self       string                 `json:"_self,omitempty"`
	Actions    *V1Actions             `json:"_actions,omitempty"`
}

V1Entity is the JSON representation of an entity for API v1.

type V1EntityType

type V1EntityType struct {
	Label       string                   `json:"label"`
	Plural      string                   `json:"plural"`
	Description string                   `json:"description,omitempty"`
	Primary     string                   `json:"primary,omitempty"`
	IDType      string                   `json:"id_type,omitempty"`
	IDPrefix    string                   `json:"id_prefix,omitempty"`
	Properties  map[string]V1PropertyDef `json:"properties"`
}

V1EntityType is the JSON representation of an entity type.

type V1Error

type V1Error struct {
	Type     string         `json:"type"`
	Title    string         `json:"title"`
	Status   int            `json:"status"`
	Detail   string         `json:"detail,omitempty"`
	Instance string         `json:"instance,omitempty"`
	Errors   []V1FieldError `json:"errors,omitempty"`
}

V1Error is an RFC 7807 Problem Details response.

type V1ErrorSource

type V1ErrorSource struct {
	Pointer string `json:"pointer"`
}

V1ErrorSource points to the location of an error.

type V1FieldError

type V1FieldError struct {
	Source V1ErrorSource `json:"source"`
	Code   string        `json:"code"`
	Detail string        `json:"detail"`
}

V1FieldError represents a validation error on a specific field.

type V1ListMeta

type V1ListMeta struct {
	Total   int  `json:"total"`
	Page    int  `json:"page"`
	PerPage int  `json:"per_page"`
	HasMore bool `json:"has_more"`
}

V1ListMeta contains pagination metadata.

type V1ListResponse

type V1ListResponse struct {
	Data []V1Entity `json:"data"`
	Meta V1ListMeta `json:"meta"`
}

V1ListResponse is the response for listing entities.

type V1PropertyDef

type V1PropertyDef struct {
	Type        string   `json:"type"`
	Required    bool     `json:"required"`
	Default     string   `json:"default,omitempty"`
	Values      []string `json:"values,omitempty"`
	Description string   `json:"description,omitempty"`
	List        bool     `json:"list,omitempty"`
}

V1PropertyDef is the JSON representation of a property definition.

type V1PropertyDiff

type V1PropertyDiff struct {
	Property    string `json:"property"`
	OursValue   string `json:"ours_value"`
	TheirsValue string `json:"theirs_value"`
	IsSame      bool   `json:"is_same"`
}

V1PropertyDiff represents a property difference.

type V1RelationType

type V1RelationType struct {
	Label       string                   `json:"label"`
	Description string                   `json:"description,omitempty"`
	From        []string                 `json:"from"`
	To          []string                 `json:"to"`
	MinOutgoing *int                     `json:"min_outgoing,omitempty"`
	MaxOutgoing *int                     `json:"max_outgoing,omitempty"`
	MinIncoming *int                     `json:"min_incoming,omitempty"`
	MaxIncoming *int                     `json:"max_incoming,omitempty"`
	Properties  map[string]V1PropertyDef `json:"properties,omitempty"`
}

V1RelationType is the JSON representation of a relation type.

type V1Schema

type V1Schema struct {
	Entities  map[string]V1EntityType   `json:"entities"`
	Relations map[string]V1RelationType `json:"relations"`
	Types     map[string]V1CustomType   `json:"types,omitempty"`
}

V1Schema is the JSON representation of the metamodel.

type V1SectionField

type V1SectionField struct {
	Label    string `json:"label"`
	Value    string `json:"value"`
	PropType string `json:"propType,omitempty"`
}

V1SectionField represents a field in a side panel section.

type V1SidePanelEntity

type V1SidePanelEntity struct {
	ID         string           `json:"id"`
	Title      string           `json:"title"`
	Type       string           `json:"type"`
	EditFormID string           `json:"editFormId,omitempty"`
	Fields     []V1SectionField `json:"fields,omitempty"`
	Content    string           `json:"content,omitempty"`
	HasContent bool             `json:"hasContent"`
}

V1SidePanelEntity represents an entity in a side panel section.

type V1SidePanelSection

type V1SidePanelSection struct {
	Heading      string              `json:"heading"`
	SectionID    string              `json:"sectionId"`
	Display      string              `json:"display"`
	IsEmpty      bool                `json:"isEmpty"`
	EmptyMessage string              `json:"emptyMessage,omitempty"`
	Fields       []V1SectionField    `json:"fields,omitempty"`
	Entities     []V1SidePanelEntity `json:"entities,omitempty"`
	AddInfo      *V1ViewAddInfo      `json:"addInfo,omitempty"`
	LinkInfo     *V1ViewLinkInfo     `json:"linkInfo,omitempty"`
}

V1SidePanelSection represents a section in the side panel response.

type V1SidebarGroup

type V1SidebarGroup struct {
	Group     string          `json:"group,omitempty"`
	Collapsed bool            `json:"collapsed,omitempty"`
	Items     []V1SidebarItem `json:"items"`
}

V1SidebarGroup represents a navigation group with items.

type V1SidebarItem

type V1SidebarItem struct {
	Label  string `json:"label"`
	Href   string `json:"href"`
	Icon   string `json:"icon,omitempty"`
	Count  *int   `json:"count,omitempty"`
	Action string `json:"action,omitempty"`
}

V1SidebarItem represents a navigation item with count.

type V1SidebarResponse

type V1SidebarResponse struct {
	App        V1AppConfig      `json:"app"`
	Navigation []V1SidebarGroup `json:"navigation"`
}

V1SidebarResponse contains the sidebar data with app info and navigation.

type V1Template

type V1Template struct {
	Name       string                 `json:"name"`
	Properties map[string]interface{} `json:"properties"`
	Content    string                 `json:"content"`
	Relations  []V1TemplateRelation   `json:"relations"`
}

V1Template represents a template for API responses.

type V1TemplateRelation

type V1TemplateRelation struct {
	Relation string `json:"relation"`
	Target   string `json:"target"`
}

V1TemplateRelation represents a pre-filled relation in a template.

type V1ViewAddInfo

type V1ViewAddInfo struct {
	Relation string            `json:"relation"`
	LinkAs   string            `json:"linkAs"`
	PeerID   string            `json:"peerId"`
	Targets  []V1ViewAddTarget `json:"targets"`
}

V1ViewAddInfo describes an add button configuration.

type V1ViewAddTarget

type V1ViewAddTarget struct {
	EntityType string `json:"entityType"`
	FormID     string `json:"formId"`
	Label      string `json:"label"`
}

V1ViewAddTarget represents a possible target for add action.

type V1ViewCell

type V1ViewCell struct {
	Values     []string `json:"values"`
	PropType   string   `json:"propType,omitempty"`
	Widget     string   `json:"widget,omitempty"`
	Link       string   `json:"link,omitempty"`
	EntityID   string   `json:"entityId,omitempty"`
	EntityType string   `json:"entityType,omitempty"`
}

V1ViewCell represents a table cell.

type V1ViewColumn

type V1ViewColumn struct {
	Property string `json:"property,omitempty"`
	Label    string `json:"label,omitempty"`
	Relation string `json:"relation,omitempty"`
	Link     string `json:"link,omitempty"`
}

V1ViewColumn represents a column definition.

type V1ViewEntity

type V1ViewEntity struct {
	ID         string           `json:"id"`
	Title      string           `json:"title"`
	Type       string           `json:"type"`
	EditFormID string           `json:"editFormId,omitempty"`
	Fields     []V1SectionField `json:"fields,omitempty"`
	Content    string           `json:"content,omitempty"`
	HasContent bool             `json:"hasContent"`
}

V1ViewEntity represents an entity in a view section.

type V1ViewGroup

type V1ViewGroup struct {
	GroupName string         `json:"groupName"`
	Rows      []V1ViewRow    `json:"rows,omitempty"`
	Entities  []V1ViewEntity `json:"entities,omitempty"`
}

V1ViewGroup represents a group of rows.

type V1ViewLinkInfo

type V1ViewLinkInfo struct {
	Relation    string   `json:"relation"`
	LinkAs      string   `json:"linkAs"`
	PeerID      string   `json:"peerId"`
	EntityTypes []string `json:"entityTypes"`
}

V1ViewLinkInfo describes a link existing button configuration.

type V1ViewResponse

type V1ViewResponse struct {
	Entry    V1Entity        `json:"entry"`
	Sections []V1ViewSection `json:"sections"`
}

V1ViewResponse contains the executed view data.

type V1ViewRow

type V1ViewRow struct {
	EntityID   string       `json:"entityId"`
	EntityType string       `json:"entityType"`
	EditFormID string       `json:"editFormId,omitempty"`
	Cells      []V1ViewCell `json:"cells"`
	Content    string       `json:"content,omitempty"`
}

V1ViewRow represents a table row.

type V1ViewSection

type V1ViewSection struct {
	Heading      string           `json:"heading"`
	SectionID    string           `json:"sectionId"`
	Display      string           `json:"display"`
	IsEmpty      bool             `json:"isEmpty"`
	EmptyMessage string           `json:"emptyMessage,omitempty"`
	Fields       []V1SectionField `json:"fields,omitempty"`
	Entities     []V1ViewEntity   `json:"entities,omitempty"`
	Columns      []V1ViewColumn   `json:"columns,omitempty"`
	Rows         []V1ViewRow      `json:"rows,omitempty"`
	Groups       []V1ViewGroup    `json:"groups,omitempty"`
	IsGrouped    bool             `json:"isGrouped"`
	Content      string           `json:"content,omitempty"`
	HasContent   bool             `json:"hasContent"`
	AddInfo      *V1ViewAddInfo   `json:"addInfo,omitempty"`
	LinkInfo     *V1ViewLinkInfo  `json:"linkInfo,omitempty"`
}

V1ViewSection represents a section with resolved data.

type ViewConfig

type ViewConfig = dataentryconfig.ViewConfig

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type ViewEntry

type ViewEntry = dataentryconfig.ViewEntry

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type ViewSection

type ViewSection = dataentryconfig.ViewSection

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type ViewSectionField

type ViewSectionField = dataentryconfig.ViewSectionField

Config type aliases — re-exported from dataentryconfig for backward compatibility.

type ViewTraverse

type ViewTraverse = dataentryconfig.ViewTraverse

Config type aliases — re-exported from dataentryconfig for backward compatibility.

Jump to

Keyboard shortcuts

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