content

package
v0.51.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: MIT Imports: 14 Imported by: 3

Documentation

Index

Constants

View Source
const (
	ContentTypeStatusDraft      = "draft"
	ContentTypeStatusActive     = "active"
	ContentTypeStatusDeprecated = "deprecated"
)
View Source
const (
	ContentProjectionAdmin         = "admin"
	ContentProjectionDerivedFields = "derived_fields"
)

Variables

View Source
var (
	ErrContentTypeRequired                   = errors.New("content: content type does not exist")
	ErrSlugRequired                          = errors.New("content: slug is required")
	ErrSlugInvalid                           = errors.New("content: slug contains invalid characters")
	ErrSlugExists                            = errors.New("content: slug already exists")
	ErrSlugConflict                          = errors.New("content: slug conflict")
	ErrNoTranslations                        = errors.New("content: at least one translation is required")
	ErrDefaultLocaleRequired                 = errors.New("content: default locale translation is required")
	ErrDuplicateLocale                       = errors.New("content: duplicate locale provided")
	ErrUnknownLocale                         = errors.New("content: unknown locale")
	ErrInvalidLocale                         = errors.New("content: invalid locale")
	ErrSourceNotFound                        = errors.New("content: source not found")
	ErrTranslationAlreadyExists              = errors.New("content: translation already exists")
	ErrTranslationInvariantViolation         = errors.New("content: translation invariant violation")
	ErrContentSchemaInvalid                  = errors.New("content: schema validation failed")
	ErrContentSoftDeleteUnsupported          = errors.New("content: soft delete not supported")
	ErrContentIDRequired                     = errors.New("content: content id required")
	ErrContentMetadataInvalid                = errors.New("content: metadata invalid")
	ErrVersioningDisabled                    = errors.New("content: versioning feature disabled")
	ErrContentVersionRequired                = errors.New("content: version identifier required")
	ErrContentVersionConflict                = errors.New("content: base version mismatch")
	ErrContentVersionAlreadyPublished        = errors.New("content: version already published")
	ErrContentVersionRetentionExceeded       = errors.New("content: version retention limit reached")
	ErrSchedulingDisabled                    = errors.New("content: scheduling feature disabled")
	ErrScheduleWindowInvalid                 = errors.New("content: publish_at must be before unpublish_at")
	ErrScheduleTimestampInvalid              = errors.New("content: schedule timestamp is invalid")
	ErrContentTranslationsDisabled           = errors.New("content: translations feature disabled")
	ErrContentTranslationNotFound            = errors.New("content: translation not found")
	ErrContentSchemaMigrationRequired        = errors.New("content: schema migration required")
	ErrContentTranslationLookupUnsupported   = errors.New("content: translation lookup unsupported")
	ErrContentProjectionModeInvalid          = errors.New("content: projection translation mode is invalid")
	ErrContentProjectionUnsupported          = errors.New("content: projection is not supported")
	ErrContentProjectionRequiresTranslations = errors.New("content: projection requires translations")
	ErrEmbeddedBlocksResolverMissing         = errors.New("content: embedded blocks resolver not configured")

	ErrContentTypeNameRequired        = errors.New("content type: name is required")
	ErrContentTypeSchemaRequired      = errors.New("content type: schema is required")
	ErrContentTypeSchemaInvalid       = errors.New("content type: schema is invalid")
	ErrContentTypeIDRequired          = errors.New("content type: id required")
	ErrContentTypeSlugInvalid         = errors.New("content type: slug contains invalid characters")
	ErrContentTypeSchemaVersion       = errors.New("content type: schema version invalid")
	ErrContentTypeSchemaBreaking      = errors.New("content type: schema has breaking changes")
	ErrContentTypeStatusInvalid       = errors.New("content type: status invalid")
	ErrContentTypeStatusChange        = errors.New("content type: status transition invalid")
	ErrContentTypeCapabilitiesInvalid = errors.New("content type: capabilities invalid")
)
View Source
var ContentVersionSnapshotSchema = map[string]any{
	"type": "object",
	"properties": map[string]any{
		"fields": map[string]any{
			"type":                 "object",
			"additionalProperties": true,
		},
		"translations": map[string]any{
			"type": "array",
			"items": map[string]any{
				"type":     "object",
				"required": []string{"locale", "title", "content"},
				"properties": map[string]any{
					"locale": map[string]any{"type": "string"},
					"title":  map[string]any{"type": "string"},
					"summary": map[string]any{
						"type": []any{"string", "null"},
					},
					"content": map[string]any{
						"type":                 "object",
						"additionalProperties": true,
					},
					"metadata": map[string]any{
						"type":                 "object",
						"additionalProperties": true,
					},
				},
			},
		},
		"metadata": map[string]any{
			"type":                 "object",
			"additionalProperties": true,
		},
	},
}

ContentVersionSnapshotSchema captures the JSON schema used to validate snapshots.

Functions

func BackfillContentTypeNavigationDefaults added in v0.38.0

func BackfillContentTypeNavigationDefaults(ctx context.Context, service ContentTypeService, env ...string) (int, error)

BackfillContentTypeNavigationDefaults normalizes persisted content type capabilities and writes canonical navigation defaults when needed.

func IsValidSlug added in v0.20.0

func IsValidSlug(value string) bool

IsValidSlug reports whether the slug matches the default rules.

func NormalizeContentTypeCapabilities added in v0.38.0

func NormalizeContentTypeCapabilities(capabilities map[string]any) (map[string]any, map[string]string)

NormalizeContentTypeCapabilities returns canonical capability objects and validation metadata without mutating the input payload.

func NormalizeSlug added in v0.20.0

func NormalizeSlug(value string) (string, error)

NormalizeSlug applies the default slug normalization rules.

func ValidateAndNormalizeContentTypeCapabilities added in v0.38.0

func ValidateAndNormalizeContentTypeCapabilities(capabilities map[string]any) (map[string]any, error)

ValidateAndNormalizeContentTypeCapabilities validates and canonicalizes capability payloads.

Types

type Content

type Content struct {
	bun.BaseModel `bun:"table:contents,alias:c"`

	ID               uuid.UUID             `bun:",pk,type:uuid" json:"id"`
	ContentTypeID    uuid.UUID             `bun:"content_type_id,notnull,type:uuid" json:"content_type_id"`
	CurrentVersion   int                   `bun:"current_version,notnull,default:1" json:"current_version"`
	PublishedVersion *int                  `bun:"published_version" json:"published_version,omitempty"`
	Status           string                `bun:"status,notnull,default:'draft'" json:"status"`
	Slug             string                `bun:"slug,notnull" json:"slug"`
	PrimaryLocale    string                `bun:"primary_locale" json:"primary_locale,omitempty"`
	Metadata         map[string]any        `bun:"metadata,type:jsonb" json:"metadata,omitempty"`
	PublishAt        *time.Time            `bun:"publish_at,nullzero" json:"publish_at,omitempty"`
	UnpublishAt      *time.Time            `bun:"unpublish_at,nullzero" json:"unpublish_at,omitempty"`
	PublishedAt      *time.Time            `bun:"published_at,nullzero" json:"published_at,omitempty"`
	PublishedBy      *uuid.UUID            `bun:"published_by,type:uuid" json:"published_by,omitempty"`
	EnvironmentID    uuid.UUID             `bun:"environment_id,type:uuid" json:"environment_id,omitempty"`
	CreatedBy        uuid.UUID             `bun:"created_by,notnull,type:uuid" json:"created_by"`
	UpdatedBy        uuid.UUID             `bun:"updated_by,notnull,type:uuid" json:"updated_by"`
	DeletedAt        *time.Time            `bun:"deleted_at,nullzero" json:"deleted_at,omitempty"`
	CreatedAt        time.Time             `bun:"created_at,nullzero,default:current_timestamp" json:"created_at"`
	UpdatedAt        time.Time             `bun:"updated_at,nullzero,default:current_timestamp" json:"updated_at"`
	Type             *ContentType          `bun:"rel:belongs-to,join:content_type_id=id" json:"content_type,omitempty"`
	Translations     []*ContentTranslation `bun:"rel:has-many,join:id=content_id"        json:"translations,omitempty"`
	Versions         []*ContentVersion     `bun:"rel:has-many,join:id=content_id"        json:"versions,omitempty"`
	EffectiveStatus  domain.Status         `bun:"-" json:"effective_status"`
	IsVisible        bool                  `bun:"-" json:"is_visible"`
}

Content is the canonical record for translatable entries.

type ContentGetOption added in v0.33.0

type ContentGetOption = ContentListOption

ContentGetOption configures content get behavior. It reuses list option tokens.

type ContentListOption added in v0.33.0

type ContentListOption = string

ContentListOption configures content list behavior. It is an alias to string to preserve the existing List(ctx, env ...string) call pattern.

func WithContentTypeID added in v0.51.0

func WithContentTypeID(id uuid.UUID) ContentListOption

WithContentTypeID scopes list reads to one content type before loading translations or projections.

func WithDerivedFields added in v0.35.0

func WithDerivedFields() ContentListOption

WithDerivedFields enables the canonical derived-content-fields projection.

func WithProjection added in v0.35.0

func WithProjection(name string) ContentListOption

WithProjection configures a named read projection for content list/get calls.

func WithProjectionMode added in v0.35.0

func WithProjectionMode(mode ProjectionTranslationMode) ContentListOption

WithProjectionMode controls projection behavior when translations are not explicitly requested.

func WithTranslations added in v0.33.0

func WithTranslations() ContentListOption

WithTranslations preloads translations when listing or fetching content records.

type ContentPreview added in v0.33.0

type ContentPreview struct {
	Content *Content
	Version *ContentVersion
}

ContentPreview bundles a preview snapshot with the derived content record.

type ContentTranslation

type ContentTranslation struct {
	bun.BaseModel `bun:"table:content_translations,alias:ctn"`

	ID        uuid.UUID      `bun:",pk,type:uuid" json:"id"`
	ContentID uuid.UUID      `bun:"content_id,notnull,type:uuid" json:"content_id"`
	LocaleID  uuid.UUID      `bun:"locale_id,notnull,type:uuid" json:"locale_id"`
	FamilyID  *uuid.UUID     `bun:"family_id,type:uuid,nullzero" json:"family_id,omitempty"`
	Title     string         `bun:"title,notnull" json:"title"`
	Summary   *string        `bun:"summary" json:"summary,omitempty"`
	Content   map[string]any `bun:"content,type:jsonb,notnull" json:"content"`
	Metadata  map[string]any `bun:"metadata,type:jsonb" json:"metadata,omitempty"`
	DeletedAt *time.Time     `bun:"deleted_at,nullzero" json:"deleted_at,omitempty"`
	CreatedAt time.Time      `bun:"created_at,nullzero,default:current_timestamp" json:"created_at"`
	UpdatedAt time.Time      `bun:"updated_at,nullzero,default:current_timestamp" json:"updated_at"`

	Locale *Locale `bun:"rel:belongs-to,join:locale_id=id" json:"locale,omitempty"`
}

ContentTranslation stores localized variants of a content entry.

type ContentTranslationInput added in v0.33.0

type ContentTranslationInput struct {
	Locale  string
	Title   string
	Summary *string
	Content map[string]any
	Blocks  []map[string]any
}

ContentTranslationInput represents localized fields supplied during create or update.

type ContentType

type ContentType struct {
	bun.BaseModel `bun:"table:content_types,alias:ct"`

	ID            uuid.UUID                   `bun:",pk,type:uuid"                                json:"id"`
	Name          string                      `bun:"name,notnull"                                 json:"name"`
	Slug          string                      `bun:"slug,notnull"                                 json:"slug"`
	Description   *string                     `bun:"description"                                  json:"description,omitempty"`
	Schema        map[string]any              `bun:"schema,type:jsonb,notnull"                    json:"schema"`
	UISchema      map[string]any              `bun:"ui_schema,type:jsonb"                         json:"ui_schema,omitempty"`
	Capabilities  map[string]any              `bun:"capabilities,type:jsonb"                      json:"capabilities,omitempty"`
	Icon          *string                     `bun:"icon"                                         json:"icon,omitempty"`
	SchemaVersion string                      `bun:"schema_version"                               json:"schema_version,omitempty"`
	SchemaHistory []ContentTypeSchemaSnapshot `bun:"schema_history,type:jsonb"                    json:"schema_history,omitempty"`
	Status        string                      `bun:"status"                                       json:"status,omitempty"`
	EnvironmentID uuid.UUID                   `bun:"environment_id,type:uuid"                     json:"environment_id,omitempty"`
	DeletedAt     *time.Time                  `bun:"deleted_at,nullzero"                          json:"deleted_at,omitempty"`
	CreatedAt     time.Time                   `bun:"created_at,nullzero,default:current_timestamp" json:"created_at"`
	UpdatedAt     time.Time                   `bun:"updated_at,nullzero,default:current_timestamp" json:"updated_at"`
}

ContentType defines available content schemas.

type ContentTypeCapabilityContracts added in v0.38.0

type ContentTypeCapabilityContracts struct {
	Normalized           map[string]any
	Delivery             map[string]any
	Navigation           map[string]any
	Search               map[string]any
	Validation           map[string]string
	MigratedDeliveryMenu bool
}

ContentTypeCapabilityContracts captures normalized capability payloads and per-field validation metadata for callers that need canonical contracts.

func ParseContentTypeCapabilityContracts added in v0.38.0

func ParseContentTypeCapabilityContracts(capabilities map[string]any) ContentTypeCapabilityContracts

ParseContentTypeCapabilityContracts resolves normalized capability contracts from a raw capabilities payload.

func ReadContentTypeCapabilityContracts added in v0.38.0

func ReadContentTypeCapabilityContracts(contentType ContentType) ContentTypeCapabilityContracts

ReadContentTypeCapabilityContracts resolves normalized capability contracts from a content type payload.

type ContentTypeCapabilityValidationError added in v0.38.0

type ContentTypeCapabilityValidationError struct {
	Fields map[string]string
}

ContentTypeCapabilityValidationError captures per-field capability validation failures.

func (*ContentTypeCapabilityValidationError) Error added in v0.38.0

func (*ContentTypeCapabilityValidationError) Unwrap added in v0.38.0

type ContentTypeSchemaSnapshot added in v0.23.0

type ContentTypeSchemaSnapshot struct {
	Version      string         `json:"version"`
	Schema       map[string]any `json:"schema"`
	UISchema     map[string]any `json:"ui_schema,omitempty"`
	Capabilities map[string]any `json:"capabilities,omitempty"`
	Status       string         `json:"status,omitempty"`
	UpdatedAt    time.Time      `json:"updated_at"`
	UpdatedBy    *uuid.UUID     `json:"updated_by,omitempty"`
}

ContentTypeSchemaSnapshot captures schema metadata for version history.

type ContentTypeService added in v0.33.0

type ContentTypeService interface {
	Create(ctx context.Context, req CreateContentTypeRequest) (*ContentType, error)
	Update(ctx context.Context, req UpdateContentTypeRequest) (*ContentType, error)
	Delete(ctx context.Context, req DeleteContentTypeRequest) error
	Get(ctx context.Context, id uuid.UUID) (*ContentType, error)
	GetBySlug(ctx context.Context, slug string, env ...string) (*ContentType, error)
	List(ctx context.Context, env ...string) ([]*ContentType, error)
	Find(ctx context.Context, query string, env ...string) ([]*ContentType, error)
}

ContentTypeService provides CRUD operations for content types.

type ContentVersion

type ContentVersion struct {
	bun.BaseModel `bun:"table:content_versions,alias:cv"`

	ID          uuid.UUID              `bun:",pk,type:uuid" json:"id"`
	ContentID   uuid.UUID              `bun:"content_id,notnull,type:uuid" json:"content_id"`
	Version     int                    `bun:"version,notnull" json:"version"`
	Status      domain.Status          `bun:"status,notnull,default:'draft'" json:"status"`
	Snapshot    ContentVersionSnapshot `bun:"snapshot,type:jsonb,notnull" json:"snapshot"`
	CreatedBy   uuid.UUID              `bun:"created_by,notnull,type:uuid" json:"created_by"`
	CreatedAt   time.Time              `bun:"created_at,nullzero,default:current_timestamp" json:"created_at"`
	PublishedAt *time.Time             `bun:"published_at,nullzero" json:"published_at,omitempty"`
	PublishedBy *uuid.UUID             `bun:"published_by,type:uuid" json:"published_by,omitempty"`
	Content     *Content               `bun:"rel:belongs-to,join:content_id=id" json:"content,omitempty"`
}

ContentVersion captures immutable snapshots of content payloads.

type ContentVersionSnapshot

type ContentVersionSnapshot struct {
	Fields       map[string]any                      `json:"fields,omitempty"`
	Translations []ContentVersionTranslationSnapshot `json:"translations,omitempty"`
	Metadata     map[string]any                      `json:"metadata,omitempty"`
}

ContentVersionSnapshot describes the persisted JSON snapshot for version history.

type ContentVersionTranslationSnapshot

type ContentVersionTranslationSnapshot struct {
	Locale   string         `json:"locale"`
	Title    string         `json:"title"`
	Summary  *string        `json:"summary,omitempty"`
	Content  map[string]any `json:"content"`
	Metadata map[string]any `json:"metadata,omitempty"`
}

ContentVersionTranslationSnapshot encodes a localized payload captured in a version.

type CreateContentDraftRequest added in v0.33.0

type CreateContentDraftRequest struct {
	ContentID   uuid.UUID
	Snapshot    ContentVersionSnapshot
	CreatedBy   uuid.UUID
	UpdatedBy   uuid.UUID
	BaseVersion *int
}

CreateContentDraftRequest captures the payload needed to record a draft snapshot.

type CreateContentRequest added in v0.33.0

type CreateContentRequest struct {
	ContentTypeID            uuid.UUID
	Slug                     string
	Status                   string
	EnvironmentKey           string
	CreatedBy                uuid.UUID
	UpdatedBy                uuid.UUID
	Metadata                 map[string]any
	Translations             []ContentTranslationInput
	AllowMissingTranslations bool
}

CreateContentRequest captures the information required to create content.

type CreateContentTranslationRequest added in v0.36.0

type CreateContentTranslationRequest struct {
	SourceID         uuid.UUID
	SourceLocale     string
	TargetLocale     string
	EnvironmentKey   string
	ActorID          uuid.UUID
	Status           string
	Path             string
	RouteKey         string
	Metadata         map[string]any
	ConflictStrategy TranslationConflictStrategy
}

CreateContentTranslationRequest captures the payload required to clone one locale into another.

type CreateContentTypeRequest added in v0.33.0

type CreateContentTypeRequest struct {
	Name           string
	Slug           string
	Description    *string
	Schema         map[string]any
	UISchema       map[string]any
	Capabilities   map[string]any
	Icon           *string
	Status         string
	EnvironmentKey string
	CreatedBy      uuid.UUID
	UpdatedBy      uuid.UUID
}

CreateContentTypeRequest captures required fields to create a content type.

type DeleteContentRequest added in v0.33.0

type DeleteContentRequest struct {
	ID         uuid.UUID
	DeletedBy  uuid.UUID
	HardDelete bool
}

DeleteContentRequest captures the information required to remove a content entry.

type DeleteContentTranslationRequest added in v0.33.0

type DeleteContentTranslationRequest struct {
	ContentID uuid.UUID
	Locale    string
	DeletedBy uuid.UUID
}

DeleteContentTranslationRequest captures the payload required to drop a translation.

type DeleteContentTypeRequest added in v0.33.0

type DeleteContentTypeRequest struct {
	ID         uuid.UUID
	DeletedBy  uuid.UUID
	HardDelete bool
}

DeleteContentTypeRequest captures details required to delete a content type.

type InvalidLocaleError added in v0.36.0

type InvalidLocaleError struct {
	EntityID     uuid.UUID
	SourceLocale string
	TargetLocale string
	Environment  string
}

InvalidLocaleError captures invalid locale inputs for translation operations.

func (*InvalidLocaleError) Error added in v0.36.0

func (e *InvalidLocaleError) Error() string

func (*InvalidLocaleError) Unwrap added in v0.36.0

func (e *InvalidLocaleError) Unwrap() error

type Locale

type Locale struct {
	bun.BaseModel `bun:"table:locales,alias:l"`

	ID         uuid.UUID      `bun:",pk,type:uuid"         json:"id"`
	Code       string         `bun:"code,notnull"          json:"code"`
	Display    string         `bun:"display_name,notnull"  json:"display_name"`
	NativeName *string        `bun:"native_name"           json:"native_name,omitempty"`
	IsActive   bool           `bun:"is_active,notnull,default:true"  json:"is_active"`
	IsDefault  bool           `bun:"is_default,notnull,default:false" json:"is_default"`
	Metadata   map[string]any `bun:"metadata,type:jsonb"   json:"metadata,omitempty"`
	DeletedAt  *time.Time     `bun:"deleted_at,nullzero"   json:"deleted_at,omitempty"`
	CreatedAt  time.Time      `bun:"created_at,nullzero,default:current_timestamp" json:"created_at"`
}

Locale represents supported languages for the CMS.

type PreviewContentDraftRequest added in v0.33.0

type PreviewContentDraftRequest struct {
	ContentID uuid.UUID
	Version   int
}

PreviewContentDraftRequest captures the information required to preview a content draft.

type ProjectionTranslationMode added in v0.35.0

type ProjectionTranslationMode string

ProjectionTranslationMode controls how projection behaves when translations are not explicitly loaded for reads.

const (
	ProjectionTranslationModeAutoLoad ProjectionTranslationMode = "auto_load"
	ProjectionTranslationModeNoop     ProjectionTranslationMode = "noop"
	ProjectionTranslationModeError    ProjectionTranslationMode = "error"
)

type PublishContentDraftRequest added in v0.33.0

type PublishContentDraftRequest struct {
	ContentID   uuid.UUID
	Version     int
	PublishedBy uuid.UUID
	PublishedAt *time.Time
}

PublishContentDraftRequest captures the information required to publish a content draft.

type RestoreContentVersionRequest added in v0.33.0

type RestoreContentVersionRequest struct {
	ContentID  uuid.UUID
	Version    int
	RestoredBy uuid.UUID
}

RestoreContentVersionRequest captures the request to restore a prior content version.

type ScheduleContentRequest added in v0.33.0

type ScheduleContentRequest struct {
	ContentID   uuid.UUID
	PublishAt   *time.Time
	UnpublishAt *time.Time
	ScheduledBy uuid.UUID
}

ScheduleContentRequest captures details to schedule publish/unpublish events.

type Service added in v0.33.0

type Service interface {
	Create(ctx context.Context, req CreateContentRequest) (*Content, error)
	Get(ctx context.Context, id uuid.UUID, opts ...ContentGetOption) (*Content, error)
	List(ctx context.Context, opts ...ContentListOption) ([]*Content, error)
	CheckTranslations(ctx context.Context, id uuid.UUID, required []string, opts TranslationCheckOptions) ([]string, error)
	AvailableLocales(ctx context.Context, id uuid.UUID, opts TranslationCheckOptions) ([]string, error)
	Update(ctx context.Context, req UpdateContentRequest) (*Content, error)
	Delete(ctx context.Context, req DeleteContentRequest) error
	UpdateTranslation(ctx context.Context, req UpdateContentTranslationRequest) (*ContentTranslation, error)
	DeleteTranslation(ctx context.Context, req DeleteContentTranslationRequest) error
	Schedule(ctx context.Context, req ScheduleContentRequest) (*Content, error)
	CreateDraft(ctx context.Context, req CreateContentDraftRequest) (*ContentVersion, error)
	PublishDraft(ctx context.Context, req PublishContentDraftRequest) (*ContentVersion, error)
	PreviewDraft(ctx context.Context, req PreviewContentDraftRequest) (*ContentPreview, error)
	ListVersions(ctx context.Context, contentID uuid.UUID) ([]*ContentVersion, error)
	RestoreVersion(ctx context.Context, req RestoreContentVersionRequest) (*ContentVersion, error)
}

Service exposes content management use cases.

type SlugConflictError added in v0.36.0

type SlugConflictError struct {
	EntityID     uuid.UUID
	SourceLocale string
	TargetLocale string
	Environment  string
	Slug         string
}

SlugConflictError captures non-translation slug conflicts surfaced by the create-translation command.

func (*SlugConflictError) Error added in v0.36.0

func (e *SlugConflictError) Error() string

func (*SlugConflictError) Unwrap added in v0.36.0

func (e *SlugConflictError) Unwrap() error

type SlugNormalizer added in v0.20.0

type SlugNormalizer = slug.Normalizer

SlugNormalizer exposes the slug normalizer interface.

func DefaultSlugNormalizer added in v0.20.0

func DefaultSlugNormalizer() SlugNormalizer

DefaultSlugNormalizer returns the default slug normalizer.

type SourceNotFoundError added in v0.36.0

type SourceNotFoundError struct {
	EntityID    uuid.UUID
	Environment string
}

SourceNotFoundError captures missing source entity lookups for translation creation.

func (*SourceNotFoundError) Error added in v0.36.0

func (e *SourceNotFoundError) Error() string

func (*SourceNotFoundError) Unwrap added in v0.36.0

func (e *SourceNotFoundError) Unwrap() error

type TranslationAlreadyExistsError added in v0.36.0

type TranslationAlreadyExistsError struct {
	EntityID     uuid.UUID
	SourceLocale string
	TargetLocale string
	FamilyID     *uuid.UUID
	ExistingID   uuid.UUID
	Environment  string
}

TranslationAlreadyExistsError captures duplicate translation conflicts.

func (*TranslationAlreadyExistsError) Error added in v0.36.0

func (*TranslationAlreadyExistsError) Unwrap added in v0.36.0

type TranslationCheckOptions added in v0.33.0

type TranslationCheckOptions = interfaces.TranslationCheckOptions

TranslationCheckOptions configures translation completeness checks.

type TranslationConflictStrategy added in v0.36.0

type TranslationConflictStrategy string

TranslationConflictStrategy controls duplicate handling when creating translations.

const (
	TranslationConflictStrict TranslationConflictStrategy = "strict"
)

type TranslationCreator added in v0.36.0

type TranslationCreator interface {
	CreateTranslation(ctx context.Context, req CreateContentTranslationRequest) (*Content, error)
}

TranslationCreator exposes first-class translation creation without forcing consumers to depend on concrete service implementations.

type TranslationInvariantViolationError added in v0.36.0

type TranslationInvariantViolationError struct {
	EntityID     uuid.UUID
	SourceLocale string
	TargetLocale string
	FamilyID     *uuid.UUID
	Environment  string
	Message      string
}

TranslationInvariantViolationError captures invariant failures in translation grouping operations.

func (*TranslationInvariantViolationError) Error added in v0.36.0

func (*TranslationInvariantViolationError) Unwrap added in v0.36.0

type UpdateContentRequest added in v0.33.0

type UpdateContentRequest struct {
	ID                       uuid.UUID
	Status                   string
	EnvironmentKey           string
	UpdatedBy                uuid.UUID
	Translations             []ContentTranslationInput
	Metadata                 map[string]any
	AllowMissingTranslations bool
}

UpdateContentRequest captures mutable fields for an existing content entry.

type UpdateContentTranslationRequest added in v0.33.0

type UpdateContentTranslationRequest struct {
	ContentID uuid.UUID
	Locale    string
	Title     string
	Summary   *string
	Content   map[string]any
	Blocks    []map[string]any
	UpdatedBy uuid.UUID
}

UpdateContentTranslationRequest captures the payload required to mutate a single translation.

type UpdateContentTypeRequest added in v0.33.0

type UpdateContentTypeRequest struct {
	ID                   uuid.UUID
	Name                 *string
	Slug                 *string
	Description          *string
	Schema               map[string]any
	UISchema             map[string]any
	Capabilities         map[string]any
	Icon                 *string
	Status               *string
	EnvironmentKey       string
	UpdatedBy            uuid.UUID
	AllowBreakingChanges bool
}

UpdateContentTypeRequest captures mutable fields for a content type.

Jump to

Keyboard shortcuts

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