Documentation
¶
Overview ¶
Package core owns Ridu's application contracts and runtime.
Most applications should import the root ridu package, which re-exports the stable authoring surface. Extensions that need the underlying application contract may import core directly, following the same launcher/core split as PocketBase.
Index ¶
- Constants
- func AbortTask(code string, cause error) error
- func Execute(applicationConfig Config, supplied ...ExecuteOption) (result error)
- func Resolve(applicationConfig Config) (schema.Manifest, error)
- func RetryTask(code string, cause error) error
- func RetryTaskAfter(code string, cause error, delay time.Duration) error
- type APIKey
- type APIKeyInfo
- type AccessCapabilities
- type AccessContext
- type AccessDecision
- type AccessDecisionKind
- type AccessRule
- type AdminConfig
- type AdminLanguage
- type AdminLocalizationConfig
- type AdminPluginMetadata
- type AdminTimeZone
- type AfterCommitDispatcher
- type AfterCommitEffect
- type App
- func (application *App) APIKeys(ctx context.Context, sessionToken string) ([]APIKeyInfo, error)
- func (application *App) AcquireDocumentLock(ctx context.Context, collection, documentID string, takeover bool, ...) (DocumentLockState, error)
- func (application *App) AuthBootstrapAvailable(ctx context.Context, collection string) (bool, error)
- func (application *App) AuthInitialized(ctx context.Context, collection string) (initialized bool, err error)
- func (application *App) AuthenticateAPIKey(ctx context.Context, raw string) (store.Document, error)
- func (application *App) AuthenticateAPIKeyIdentity(ctx context.Context, raw string) (AuthIdentity, error)
- func (application *App) AuthenticateExternal(ctx context.Context, headers map[string][]string) (store.Document, error)
- func (application *App) AuthenticateExternalIdentity(ctx context.Context, headers map[string][]string) (AuthIdentity, error)
- func (application *App) CancelScheduledPublish(ctx context.Context, collection, documentID, jobID string, ...) error
- func (application *App) ChangePassword(ctx context.Context, sessionToken, currentPassword, nextPassword string) error
- func (application *App) CleanupUploads(ctx context.Context, olderThan time.Duration) (ReconcileResult, error)
- func (application *App) CreateAPIKey(ctx context.Context, sessionToken, name string, expiresAt time.Time) (APIKey, error)
- func (application *App) CreateAuthUser(ctx context.Context, collection string, values store.Values, password string, ...) (store.Document, error)
- func (application *App) CreateAuthUserForTransport(ctx context.Context, collection string, values store.Values, password string, ...) (store.Document, error)
- func (application *App) CreateAuthUserForTransportWithOptions(ctx context.Context, collection string, values store.Values, password string, ...) (store.Document, error)
- func (application *App) CreateAuthUserWithOptions(ctx context.Context, collection string, values store.Values, password string, ...) (store.Document, error)
- func (application *App) CreateCollectionPreviewToken(ctx context.Context, collection, documentID string, identity *AuthIdentity) (PreviewToken, error)
- func (application *App) CreateGlobalPreviewToken(ctx context.Context, slug string, identity *AuthIdentity) (PreviewToken, error)
- func (application *App) DeletePreference(ctx context.Context, identity *AuthIdentity, key string) error
- func (application *App) DocumentLock(ctx context.Context, collection, documentID string, identity *AuthIdentity) (DocumentLockState, error)
- func (application *App) Duplicate(ctx context.Context, collection, id string, overrides store.Values, ...) (store.Document, error)
- func (application *App) DuplicateForIdentity(ctx context.Context, collection, id string, overrides store.Values, ...) (store.Document, error)
- func (application *App) DuplicateWithOptions(ctx context.Context, collection, id string, overrides store.Values, ...) (store.Document, error)
- func (application *App) FindCollectionPreview(ctx context.Context, token, collection, documentID string) (store.Document, error)
- func (application *App) FindGlobalPreview(ctx context.Context, token, slug string) (store.Document, error)
- func (application *App) ForceUnlock(ctx context.Context, collection, id string, identity *AuthIdentity) error
- func (application *App) Handler(options HandlerOptions) http.Handler
- func (application *App) Local() *LocalAPI
- func (application *App) Login(ctx context.Context, collection, email, password string) (AuthSession, error)
- func (application *App) LoginWithOptions(ctx context.Context, collection, email, password string, options LoginOptions) (AuthSession, error)
- func (application *App) Logout(ctx context.Context, token string) error
- func (application *App) LogoutAll(ctx context.Context, token string) error
- func (application *App) Manifest() schema.Manifest
- func (application *App) OpenUpload(ctx context.Context, collection, key string, actor *store.Document) (io.ReadCloser, storage.Object, error)
- func (application *App) OpenUploadForIdentity(ctx context.Context, collection, key string, identity *AuthIdentity) (io.ReadCloser, storage.Object, error)
- func (application *App) OpenUploadWithOptions(ctx context.Context, collection, key string, options FindOptions) (io.ReadCloser, storage.Object, error)
- func (application *App) Preference(ctx context.Context, identity *AuthIdentity, key string) (json.RawMessage, error)
- func (application *App) PruneExpiredAuth(ctx context.Context, limit int) (store.AuthPruneResult, error)
- func (application *App) ReconcileUploads(ctx context.Context, olderThan time.Duration) (ReconcileResult, error)
- func (application *App) ReleaseDocumentLock(ctx context.Context, collection, documentID string, identity *AuthIdentity) error
- func (application *App) RequestPasswordReset(ctx context.Context, collection, identity string) error
- func (application *App) RequestVerification(ctx context.Context, collection, identity string) error
- func (application *App) ResetPassword(ctx context.Context, collection, token, password string) error
- func (application *App) ResetPreferences(ctx context.Context, identity *AuthIdentity) error
- func (application *App) RevokeAPIKey(ctx context.Context, sessionToken, id string) error
- func (application *App) RevokePreviewToken(ctx context.Context, raw string, identity *AuthIdentity) error
- func (application *App) RevokeSession(ctx context.Context, token, sessionID string) error
- func (application *App) RotateSession(ctx context.Context, token string) (AuthSession, error)
- func (application *App) RunScheduledPublishes(ctx context.Context, limit int, actor *store.Document) (int, error)
- func (application *App) RunTasks(ctx context.Context, limit int) (TaskRunSummary, error)
- func (application *App) SchedulePublish(ctx context.Context, collection, documentID string, runAt time.Time, ...) (store.ScheduledPublish, error)
- func (application *App) ScheduledPublishes(ctx context.Context, collection, documentID string, identity *AuthIdentity) ([]store.ScheduledPublish, error)
- func (application *App) Session(ctx context.Context, token string) (AuthSession, error)
- func (application *App) Sessions(ctx context.Context, token string) ([]AuthSessionInfo, error)
- func (application *App) SetPassword(ctx context.Context, collection, userID, password string) error
- func (application *App) SetPreference(ctx context.Context, identity *AuthIdentity, key string, value json.RawMessage) (json.RawMessage, error)
- func (application *App) UnlockAuthUser(ctx context.Context, collection, identity string, actorIdentity *AuthIdentity) error
- func (application *App) UpdateUploadImage(ctx context.Context, collection, id string, input UpdateUploadImageInput) (store.Document, error)
- func (application *App) UpdateUploadImageForIdentity(ctx context.Context, collection, id string, input UpdateUploadImageInput, ...) (store.Document, error)
- func (application *App) Upload(ctx context.Context, collection string, input UploadInput) (store.Document, error)
- func (application *App) UploadForIdentity(ctx context.Context, collection string, input UploadInput, ...) (store.Document, error)
- func (application *App) UploadFromURL(ctx context.Context, collection string, input RemoteUploadInput) (store.Document, error)
- func (application *App) UploadFromURLForIdentity(ctx context.Context, collection string, input RemoteUploadInput, ...) (store.Document, error)
- func (application *App) VerifyEmail(ctx context.Context, collection, token string) error
- type AuditEvent
- type AuthAccess
- type AuthAccessRule
- type AuthConfig
- type AuthContext
- type AuthHook
- type AuthHooks
- type AuthIdentity
- type AuthOperation
- type AuthSession
- type AuthSessionInfo
- type AuthStrategy
- type AuthStrategyContext
- type AuthStrategyResult
- type BoundTypedAllLocalesCollection
- type BoundTypedAllLocalesGlobal
- type BoundTypedCollection
- func (collection BoundTypedCollection[Document, Create, Update]) Create(ctx context.Context, input Create, actor *store.Document, ...) (Document, error)
- func (collection BoundTypedCollection[Document, Create, Update]) Delete(ctx context.Context, id string, actor *store.Document) (Document, error)
- func (collection BoundTypedCollection[Document, Create, Update]) Find(ctx context.Context, id string, options TypedReadOptions) (Document, error)
- func (collection BoundTypedCollection[Document, Create, Update]) Import(ctx context.Context, input Create, options ImportOptions, ...) (Document, error)
- func (collection BoundTypedCollection[Document, Create, Update]) List(ctx context.Context, options TypedListOptions) (TypedPage[Document], error)
- func (collection BoundTypedCollection[Document, Create, Update]) Update(ctx context.Context, id string, input Update, actor *store.Document, ...) (Document, error)
- func (collection BoundTypedCollection[Document, Create, Update]) UpdateRevision(ctx context.Context, id string, input Update, expectedRevision int, ...) (Document, error)
- type BoundTypedGlobal
- func (global BoundTypedGlobal[Document, Update]) Find(ctx context.Context, options TypedReadOptions) (Document, error)
- func (global BoundTypedGlobal[Document, Update]) Publish(ctx context.Context, expectedRevision int, actor *store.Document) (Document, error)
- func (global BoundTypedGlobal[Document, Update]) Restore(ctx context.Context, revision, expectedRevision int, actor *store.Document) (Document, error)
- func (global BoundTypedGlobal[Document, Update]) RestoreAsDraft(ctx context.Context, revision, expectedRevision int, actor *store.Document) (Document, error)
- func (global BoundTypedGlobal[Document, Update]) Unpublish(ctx context.Context, expectedRevision int, actor *store.Document) (Document, error)
- func (global BoundTypedGlobal[Document, Update]) Update(ctx context.Context, input Update, expectedRevision int, actor *store.Document, ...) (Document, error)
- type CapabilityOptions
- type Collection
- type CollectionAccess
- type CollectionAdmin
- type CollectionHooks
- type CollectionIndex
- type CollectionLabels
- type Config
- type ConfigTransformer
- type DescriptorProvider
- type DistinctOptions
- type DocumentLockConfig
- type DocumentLockState
- type Endpoint
- type EndpointContext
- type EndpointHandler
- type EndpointProvider
- type ExecuteOption
- func WithAddress(address string) ExecuteOption
- func WithHandlerOptions(handler HandlerOptions) ExecuteOption
- func WithProjectMigrations(driver migration.ProjectDriver) ExecuteOption
- func WithServerOptions(server ServerOptions) ExecuteOption
- func WithStore(factory StoreFactory) ExecuteOption
- func WithUploadStorage(factory StorageFactory) ExecuteOption
- type FieldCapabilities
- type FieldGraphContext
- type FieldGraphTransformer
- type FieldGraphValidator
- type FieldValidatorProvider
- type FindOptions
- type GenerationProvider
- type Global
- type GlobalAccess
- type GlobalAdmin
- type HandlerOptions
- type Hook
- type HookContext
- type HookProvider
- type ImageSize
- type ImportOptions
- type Input
- type JoinMutationResult
- type ListOptions
- type ListWindowOptions
- type LivePreviewConfig
- type LocalAPI
- func (local *LocalAPI) BulkDelete(ctx context.Context, collection string, ids []string, actor *store.Document, ...) ([]store.Document, error)
- func (local *LocalAPI) BulkDeletePermanent(ctx context.Context, collection string, ids []string, actor *store.Document, ...) ([]store.Document, error)
- func (local *LocalAPI) BulkPublish(ctx context.Context, collection string, ids []string, actor *store.Document, ...) ([]store.Document, error)
- func (local *LocalAPI) BulkRestoreDeleted(ctx context.Context, collection string, ids []string, actor *store.Document, ...) ([]store.Document, error)
- func (local *LocalAPI) BulkUnpublish(ctx context.Context, collection string, ids []string, actor *store.Document, ...) ([]store.Document, error)
- func (local *LocalAPI) BulkUpdate(ctx context.Context, collection string, ids []string, values store.Values, ...) ([]store.Document, error)
- func (local *LocalAPI) Capabilities(ctx context.Context, collection, id string, options CapabilityOptions) (AccessCapabilities, error)
- func (local *LocalAPI) CopyGlobalLocale(ctx context.Context, slug string, source, target schema.LocaleCode, ...) (store.Document, error)
- func (local *LocalAPI) CopyGlobalLocaleWithOptions(ctx context.Context, slug string, source, target schema.LocaleCode, ...) (store.Document, error)
- func (local *LocalAPI) CopyLocale(ctx context.Context, collection, id string, source, target schema.LocaleCode, ...) (store.Document, error)
- func (local *LocalAPI) CopyLocaleWithOptions(ctx context.Context, collection, id string, source, target schema.LocaleCode, ...) (store.Document, error)
- func (local *LocalAPI) Create(ctx context.Context, collection string, values store.Values, ...) (store.Document, error)
- func (local *LocalAPI) CreateWithOptions(ctx context.Context, collection string, values store.Values, ...) (store.Document, error)
- func (local *LocalAPI) Delete(ctx context.Context, collection, id string, actor *store.Document, ...) (store.Document, error)
- func (local *LocalAPI) DeletePermanent(ctx context.Context, collection, id string, actor *store.Document, ...) (store.Document, error)
- func (local *LocalAPI) DeletePermanentWithOptions(ctx context.Context, collection, id string, options MutationOptions) (store.Document, error)
- func (local *LocalAPI) DeleteWithOptions(ctx context.Context, collection, id string, options MutationOptions) (store.Document, error)
- func (local *LocalAPI) Distinct(ctx context.Context, collection string, options DistinctOptions) (store.DistinctPage, error)
- func (local *LocalAPI) Duplicate(ctx context.Context, collection, id string, overrides store.Values, ...) (store.Document, error)
- func (local *LocalAPI) DuplicateWithOptions(ctx context.Context, collection, id string, overrides store.Values, ...) (store.Document, error)
- func (local *LocalAPI) EmptyTrash(ctx context.Context, collection string, actor *store.Document, ...) ([]store.Document, error)
- func (local *LocalAPI) Find(ctx context.Context, collection, id string, actor *store.Document, ...) (store.Document, error)
- func (local *LocalAPI) FindWithOptions(ctx context.Context, collection, id string, options FindOptions) (store.Document, error)
- func (local *LocalAPI) Global(ctx context.Context, slug string, actor *store.Document, ...) (store.Document, error)
- func (local *LocalAPI) GlobalVersion(ctx context.Context, slug string, revision int, actor *store.Document, ...) (store.Version, error)
- func (local *LocalAPI) GlobalVersionWithOptions(ctx context.Context, slug string, revision int, options FindOptions) (store.Version, error)
- func (local *LocalAPI) GlobalVersions(ctx context.Context, slug string, actor *store.Document, ...) ([]store.Version, error)
- func (local *LocalAPI) GlobalVersionsWithOptions(ctx context.Context, slug string, options FindOptions) ([]store.Version, error)
- func (local *LocalAPI) GlobalWithOptions(ctx context.Context, slug string, options FindOptions) (store.Document, error)
- func (local *LocalAPI) Import(ctx context.Context, collection string, values store.Values, ...) (store.Document, error)
- func (local *LocalAPI) List(ctx context.Context, collection string, options ListOptions) (store.Page, error)
- func (local *LocalAPI) ListJoin(ctx context.Context, collection, id, field string, options ListOptions) (store.Page, error)
- func (local *LocalAPI) ListWindow(ctx context.Context, collection string, options ListWindowOptions) (store.Window, error)
- func (local *LocalAPI) MutateJoin(ctx context.Context, collection, id, field string, ...) (JoinMutationResult, error)
- func (local *LocalAPI) MutateJoinWithOptions(ctx context.Context, collection, id, field string, ...) (JoinMutationResult, error)
- func (local *LocalAPI) Publish(ctx context.Context, collection, id string, expectedRevision int, ...) (store.Document, error)
- func (local *LocalAPI) PublishChanges(ctx context.Context, collection, id string, values store.Values, ...) (store.Document, error)
- func (local *LocalAPI) PublishChangesWithOptions(ctx context.Context, collection, id string, values store.Values, ...) (store.Document, error)
- func (local *LocalAPI) PublishGlobal(ctx context.Context, slug string, expectedRevision int, actor *store.Document, ...) (store.Document, error)
- func (local *LocalAPI) PublishGlobalChanges(ctx context.Context, slug string, values store.Values, expectedRevision int, ...) (store.Document, error)
- func (local *LocalAPI) PublishGlobalChangesWithOptions(ctx context.Context, slug string, values store.Values, options MutationOptions) (store.Document, error)
- func (local *LocalAPI) PublishGlobalWithOptions(ctx context.Context, slug string, options MutationOptions) (store.Document, error)
- func (local *LocalAPI) PublishWithOptions(ctx context.Context, collection, id string, options MutationOptions) (store.Document, error)
- func (local *LocalAPI) Restore(ctx context.Context, collection, id string, revision, expectedRevision int, ...) (store.Document, error)
- func (local *LocalAPI) RestoreAsDraft(ctx context.Context, collection, id string, revision, expectedRevision int, ...) (store.Document, error)
- func (local *LocalAPI) RestoreDeleted(ctx context.Context, collection, id string, actor *store.Document, ...) (store.Document, error)
- func (local *LocalAPI) RestoreDeletedWithOptions(ctx context.Context, collection, id string, options MutationOptions) (store.Document, error)
- func (local *LocalAPI) RestoreGlobal(ctx context.Context, slug string, revision, expectedRevision int, ...) (store.Document, error)
- func (local *LocalAPI) RestoreGlobalAsDraft(ctx context.Context, slug string, revision, expectedRevision int, ...) (store.Document, error)
- func (local *LocalAPI) RestoreGlobalVersionWithOptions(ctx context.Context, slug string, revision int, draft bool, ...) (store.Document, error)
- func (local *LocalAPI) RestoreVersionWithOptions(ctx context.Context, collection, id string, revision int, draft bool, ...) (store.Document, error)
- func (local *LocalAPI) Unpublish(ctx context.Context, collection, id string, expectedRevision int, ...) (store.Document, error)
- func (local *LocalAPI) UnpublishGlobal(ctx context.Context, slug string, expectedRevision int, actor *store.Document, ...) (store.Document, error)
- func (local *LocalAPI) UnpublishGlobalWithOptions(ctx context.Context, slug string, options MutationOptions) (store.Document, error)
- func (local *LocalAPI) UnpublishWithOptions(ctx context.Context, collection, id string, options MutationOptions) (store.Document, error)
- func (local *LocalAPI) Update(ctx context.Context, collection, id string, values store.Values, ...) (store.Document, error)
- func (local *LocalAPI) UpdateGlobal(ctx context.Context, slug string, values store.Values, expectedRevision int, ...) (store.Document, error)
- func (local *LocalAPI) UpdateGlobalWithOptions(ctx context.Context, slug string, values store.Values, options MutationOptions) (store.Document, error)
- func (local *LocalAPI) UpdateRevision(ctx context.Context, collection, id string, values store.Values, ...) (store.Document, error)
- func (local *LocalAPI) UpdateWithOptions(ctx context.Context, collection, id string, values store.Values, ...) (store.Document, error)
- func (local *LocalAPI) Version(ctx context.Context, collection, id string, revision int, ...) (store.Version, error)
- func (local *LocalAPI) VersionWithOptions(ctx context.Context, collection, id string, revision int, options FindOptions) (store.Version, error)
- func (local *LocalAPI) Versions(ctx context.Context, collection, id string, actor *store.Document, ...) ([]store.Version, error)
- func (local *LocalAPI) VersionsWithOptions(ctx context.Context, collection, id string, options FindOptions) ([]store.Version, error)
- type Locale
- type LocaleAvailability
- type LocaleAvailabilityContext
- type LocaleOptions
- type LocalizationConfig
- type LoginOptions
- type MutationOptions
- type NonNullInput
- type OperationCapabilities
- type OperationError
- type PasswordPolicy
- type PasswordResetConfig
- type PasswordResetNotification
- type Plugin
- type PluginDatabaseAdapter
- type PluginDatabaseContribution
- type PluginDescriptor
- type PluginEndpoint
- type PluginEndpointContext
- type PluginEndpointHandler
- type PluginFieldType
- type PluginFieldValidationContext
- type PluginFieldValidator
- type PluginGeneratedArtifact
- type PluginGenerationContext
- type PluginHookContribution
- type PluginMigration
- type PluginTransport
- type PluginTransportContext
- type PreviewBreakpoint
- type PreviewToken
- type ReadinessCheck
- type ReconcileResult
- type RemoteUploadInput
- type RequestErrorEvent
- type RequestObservation
- type RiduCompatibility
- type RootHooks
- type ServerOptions
- type StorageFactory
- type StoreFactory
- type TaskBackoff
- type TaskContext
- type TaskDefinition
- type TaskEnqueueOptions
- type TaskError
- type TaskErrorCode
- type TaskHandler
- type TaskOption
- func TaskAdmissionReconciler(reconcile TaskReconciler) TaskOption
- func TaskQueue(queue string) TaskOption
- func TaskRetention(retention time.Duration) TaskOption
- func TaskRetries(maxAttempts int, delay, maxDelay time.Duration, backoff TaskBackoff) TaskOption
- func TaskTimeout(timeout time.Duration) TaskOption
- type TaskReceipt
- type TaskReconciler
- type TaskResult
- type TaskRunSummary
- type TransportProvider
- type TypedAllLocalesCollection
- type TypedAllLocalesGlobal
- type TypedCollection
- type TypedGlobal
- type TypedListOptions
- type TypedLocaleOptions
- type TypedPage
- type TypedReadOptions
- type TypedTask
- func (task TypedTask[Input, Output]) Cancel(ctx context.Context, application *App, id string) error
- func (task TypedTask[Input, Output]) Enqueue(ctx context.Context, application *App, input Input, options TaskEnqueueOptions) (TaskReceipt[Output], error)
- func (task TypedTask[Input, Output]) Result(ctx context.Context, application *App, id string) (TaskResult[Output], error)
- func (task TypedTask[Input, Output]) TaskSlug() string
- type UpdateUploadImageInput
- type UploadConfig
- type UploadInput
- type VerifyEmailConfig
- type VerifyEmailNotification
- type VersionConfig
Constants ¶
const ( // PluginDatabaseAdapterPostgres selects PostgreSQL-specific SQL. PluginDatabaseAdapterPostgres = schema.PluginDatabaseAdapterPostgres // PluginDatabaseAdapterSQLite selects SQLite-specific SQL. PluginDatabaseAdapterSQLite = schema.PluginDatabaseAdapterSQLite )
const ( TaskBackoffFixed = store.TaskBackoffFixed TaskBackoffLinear = store.TaskBackoffLinear TaskBackoffExponential = store.TaskBackoffExponential )
const AdminPluginAPIVersion = schema.CurrentAdminPluginAPIVersion
AdminPluginAPIVersion is the build-time contract understood by this Ridu release. Admin packages declare the same value so generated registries can reject incompatible packages before the application is used.
const FrameworkVersion = "0.2.0"
FrameworkVersion identifies the public Go framework and project-command contract compiled into an application. It is independent from schema manifest and machine protocol versions.
const ( // MaxTaskPayloadBytes bounds both durable input and output. Large files and // exports belong in object storage with a small durable task reference. MaxTaskPayloadBytes = store.MaxTaskPayloadBytes )
const PluginAPIVersion = schema.CurrentPluginAPIVersion
PluginAPIVersion is the compiled backend extension contract understood by this Ridu release. It changes only when public plugin capability interfaces become incompatible.
Variables ¶
This section is empty.
Functions ¶
func AbortTask ¶
AbortTask marks a handler error terminal. It is retained as a dead-letter result until the task's configured retention expires.
func Execute ¶
func Execute(applicationConfig Config, supplied ...ExecuteOption) (result error)
Execute runs the framework-owned project command driver for a generated application. Project commands resolve config without invoking the lazy runtime store factory; the no-argument branch starts the HTTP server.
func Resolve ¶
Resolve applies config transforms in declared plugin order, validates and normalizes the result, and returns an immutable canonical manifest.
Types ¶
type APIKey ¶
APIKey is returned only when a new key is created. Key is the bearer secret and cannot be recovered later.
type APIKeyInfo ¶
type APIKeyInfo struct {
ID string
Name string
CreatedAt time.Time
LastUsedAt time.Time
ExpiresAt time.Time
}
APIKeyInfo is safe API-key metadata suitable for account settings UIs.
type AccessCapabilities ¶
type AccessCapabilities struct {
Operations OperationCapabilities
Fields map[string]FieldCapabilities
}
type AccessContext ¶
type AccessContext struct {
// Context is the request-scoped cancellation and deadline context.
Context context.Context
// Operation is the collection operation being evaluated.
Operation operation.Kind
// CollectionID is the stable identity of the target collection.
CollectionID schema.StableID
// GlobalID is the stable identity of the target global, when applicable.
GlobalID schema.StableID
// ID is the requested document ID. It is empty for creates and list reads.
ID string
// Actor is the authenticated document, or nil for an anonymous request.
Actor *store.Document
// ActorCollection identifies the exact auth collection that owns Actor.
ActorCollection schema.CollectionSlug
// Data is a detached snapshot of incoming create or update values.
Data store.Values
// Local exposes nested operations through the same transaction and access
// pipeline. Rules must avoid recursively invoking themselves without a guard.
Local *LocalAPI
// Locale is the exact content locale currently being authorized.
Locale schema.LocaleCode
// AllLocales reports that the caller requested every locale. Such a request
// may evaluate the rule once for each configured Locale and requires
// compatible decisions across them.
AllLocales bool
}
AccessContext gives an AccessRule the operation being authorized, the current actor, submitted data, locale, and access-controlled Local API. It belongs to one operation; nested Local calls can share that operation's transaction when they use Context.
type AccessDecision ¶
type AccessDecision struct {
// contains filtered or unexported fields
}
AccessDecision is the outcome returned by an AccessRule. Construct decisions with Allow, Deny, or Where; authors normally inspect them only in tests. The decision is immutable, and Filter returns a detached query expression snapshot.
func Allow ¶
func Allow() AccessDecision
Allow authorizes an operation without a document predicate.
func Where ¶
func Where(expression query.Expression) AccessDecision
Where requires the supplied predicate to remain attached to the atomic store operation.
func (AccessDecision) Filter ¶
func (decision AccessDecision) Filter() (query.Node, bool)
Filter returns a detached predicate for a filtered decision.
func (AccessDecision) Kind ¶
func (decision AccessDecision) Kind() AccessDecisionKind
Kind reports whether the decision allows, denies, or filters the operation.
type AccessDecisionKind ¶
type AccessDecisionKind string
AccessDecisionKind identifies the result of an access rule.
const ( AccessAllow AccessDecisionKind = "allow" AccessDeny AccessDecisionKind = "deny" AccessWhere AccessDecisionKind = "where" )
type AccessRule ¶
type AccessRule func(AccessContext) (AccessDecision, error)
AccessRule authorizes one collection or global operation. Assign a rule to Collection.Access or Global.Access and return Allow, Deny, or Where. A returned error stops the operation.
type AdminConfig ¶
type AdminConfig struct {
// User is the slug of the auth-enabled collection whose sessions may access
// the admin. It is required when the application has any auth collection.
User schema.CollectionSlug
// Localization configures the language and timezone choices for the
// framework-owned interface. It is independent from content localization.
Localization AdminLocalizationConfig
}
AdminConfig controls application-level behavior of the framework-owned admin.
type AdminLanguage ¶
AdminLanguage is one translated admin interface available to editors.
type AdminLocalizationConfig ¶
type AdminLocalizationConfig struct {
Languages []AdminLanguage
DefaultLanguage string
TimeZones []AdminTimeZone
DefaultTimeZone string
}
AdminLocalizationConfig declares interface languages and editor timezones. Translation catalogs remain statically imported TypeScript modules and are never serialized into the schema manifest.
type AdminPluginMetadata ¶
type AdminPluginMetadata struct {
// Package is an installed bare JavaScript package specifier.
Package string
// Export is the named AdminPlugin export in Package.
Export string
// APIVersion must equal AdminPluginAPIVersion.
APIVersion uint32
// PairingVersion changes when backend and admin halves cease to match.
PairingVersion uint32
// Routes lists authenticated admin route paths in exact registration order.
Routes []string
// Assets lists package-relative static assets in exact registration order.
Assets []string
}
AdminPluginMetadata describes the statically imported admin half of a compiled backend plugin. Package must be an installed JavaScript package specifier, Export must be its named AdminPlugin export, and PairingVersion must match the admin export. Increment PairingVersion when the backend and admin halves stop being mutually compatible.
type AdminTimeZone ¶
AdminTimeZone is one IANA timezone offered by the admin interface.
type AfterCommitDispatcher ¶
type AfterCommitDispatcher interface {
Dispatch(context.Context, AfterCommitEffect) error
}
AfterCommitDispatcher controls delivery of committed effects. Without a custom dispatcher, hooks run synchronously after commit. A dispatcher error is reported as a committed hook failure and cannot roll back the document.
type AfterCommitEffect ¶
type AfterCommitEffect struct {
// Operation identifies the committed operation.
Operation operation.Kind
// CollectionID identifies the affected collection.
CollectionID schema.StableID
// GlobalID identifies the affected global, when applicable.
GlobalID schema.StableID
// DocumentID identifies the affected document; it is empty for an effect
// without a single document, such as a list read.
DocumentID string
// Run calls the hook outside its original transaction. Pass the effect's
// execution context to control cancellation and deadlines.
Run func(context.Context) error
}
AfterCommitEffect describes work whose document transaction has committed. A dispatcher calls Run to perform it. The function itself is not a durable job; use a registered task with serializable input for retryable background work.
type App ¶
type App struct {
// contains filtered or unexported fields
}
App is a resolved Ridu application bound to one document store.
func (*App) AcquireDocumentLock ¶
func (application *App) AcquireDocumentLock(ctx context.Context, collection, documentID string, takeover bool, identity *AuthIdentity) (DocumentLockState, error)
AcquireDocumentLock creates or refreshes a lease for one exact identity. Takeover replaces another active owner.
func (*App) AuthBootstrapAvailable ¶
func (application *App) AuthBootstrapAvailable(ctx context.Context, collection string) (bool, error)
AuthBootstrapAvailable reports whether the configured admin-user collection still permits Ridu's omitted-policy, one-time anonymous bootstrap. Explicit Create policies and secondary auth collections never use this setup path.
func (*App) AuthInitialized ¶
func (application *App) AuthInitialized(ctx context.Context, collection string) (initialized bool, err error)
AuthInitialized reports whether an active document exists in an auth collection. It intentionally bypasses collection read access so first-run setup can decide whether bootstrap UI is still appropriate without exposing any document data.
func (*App) AuthenticateAPIKey ¶
AuthenticateAPIKey resolves a bearer API key to its user without creating a browser session. Every failure intentionally shares one response.
func (*App) AuthenticateAPIKeyIdentity ¶
func (application *App) AuthenticateAPIKeyIdentity(ctx context.Context, raw string) (AuthIdentity, error)
AuthenticateAPIKeyIdentity resolves a bearer API key to its exact auth collection and current actor document.
func (*App) AuthenticateExternal ¶
func (application *App) AuthenticateExternal(ctx context.Context, headers map[string][]string) (store.Document, error)
AuthenticateExternal runs configured request strategies in deterministic collection and declaration order.
func (*App) AuthenticateExternalIdentity ¶
func (application *App) AuthenticateExternalIdentity(ctx context.Context, headers map[string][]string) (AuthIdentity, error)
AuthenticateExternalIdentity runs configured request strategies and retains the exact auth collection that recognized the request.
func (*App) CancelScheduledPublish ¶
func (application *App) CancelScheduledPublish(ctx context.Context, collection, documentID, jobID string, identity *AuthIdentity) error
CancelScheduledPublish removes a scheduled publish using one exact identity.
func (*App) ChangePassword ¶
func (application *App) ChangePassword(ctx context.Context, sessionToken, currentPassword, nextPassword string) error
ChangePassword verifies the current password, validates the replacement, then atomically replaces the hash and revokes every session and API key.
func (*App) CleanupUploads ¶
func (application *App) CleanupUploads(ctx context.Context, olderThan time.Duration) (ReconcileResult, error)
CleanupUploads deletes the candidates reported by ReconcileUploads. A positive grace period prevents in-flight storage preparation from being mistaken for an orphan before its document transaction commits.
func (*App) CreateAPIKey ¶
func (application *App) CreateAPIKey(ctx context.Context, sessionToken, name string, expiresAt time.Time) (APIKey, error)
CreateAPIKey mints a high-entropy bearer secret for the current identity. The returned Key is available only from this call.
func (*App) CreateAuthUser ¶
func (application *App) CreateAuthUser(ctx context.Context, collection string, values store.Values, password string, actor *store.Document, localeOptions ...LocaleOptions) (store.Document, error)
CreateAuthUser creates an auth document and its private password credential atomically through the ordinary create operation pipeline.
func (*App) CreateAuthUserForTransport ¶
func (application *App) CreateAuthUserForTransport(ctx context.Context, collection string, values store.Values, password string, actor *store.Document, localeOptions ...LocaleOptions) (store.Document, error)
CreateAuthUserForTransport applies the safe anonymous first-user default used by framework transports. When Create access is omitted, exactly one anonymous caller may initialize the configured admin-user collection; other auth collections remain closed. Authenticated callers and collections with an explicit Create rule retain ordinary authored access behavior, including intentional public registration.
func (*App) CreateAuthUserForTransportWithOptions ¶
func (application *App) CreateAuthUserForTransportWithOptions(ctx context.Context, collection string, values store.Values, password string, options MutationOptions) (store.Document, error)
CreateAuthUserForTransportWithOptions is the selection-aware transport form of CreateAuthUserForTransport.
func (*App) CreateAuthUserWithOptions ¶
func (application *App) CreateAuthUserWithOptions(ctx context.Context, collection string, values store.Values, password string, options MutationOptions) (store.Document, error)
CreateAuthUserWithOptions creates an auth document and credential atomically while allowing a transport to populate the returned user safely.
func (*App) CreateCollectionPreviewToken ¶
func (application *App) CreateCollectionPreviewToken(ctx context.Context, collection, documentID string, identity *AuthIdentity) (PreviewToken, error)
CreateCollectionPreviewToken mints a short-lived capability after proving the exact authenticated actor can read the configured preview document.
func (*App) CreateGlobalPreviewToken ¶
func (application *App) CreateGlobalPreviewToken(ctx context.Context, slug string, identity *AuthIdentity) (PreviewToken, error)
CreateGlobalPreviewToken mints a short-lived capability for one configured draft global and one exact authenticated actor.
func (*App) DeletePreference ¶
func (application *App) DeletePreference(ctx context.Context, identity *AuthIdentity, key string) error
DeletePreference removes one preference owned by the exact authenticated identity.
func (*App) DocumentLock ¶
func (application *App) DocumentLock(ctx context.Context, collection, documentID string, identity *AuthIdentity) (DocumentLockState, error)
DocumentLock returns an access-checked current lock for one exact identity.
func (*App) Duplicate ¶
func (application *App) Duplicate(ctx context.Context, collection, id string, overrides store.Values, actor *store.Document, localeOptions ...LocaleOptions) (store.Document, error)
Duplicate creates an access-checked document copy. Upload collections also receive fresh storage keys for the original object and every derived image size so either document can later be deleted independently.
func (*App) DuplicateForIdentity ¶
func (application *App) DuplicateForIdentity(ctx context.Context, collection, id string, overrides store.Values, identity *AuthIdentity, localeOptions ...LocaleOptions) (store.Document, error)
DuplicateForIdentity duplicates through one exact authenticated collection identity. A nil identity remains anonymous.
func (*App) DuplicateWithOptions ¶
func (application *App) DuplicateWithOptions(ctx context.Context, collection, id string, overrides store.Values, options MutationOptions) (store.Document, error)
DuplicateWithOptions preserves exact actor identity and response selection while duplicating ordinary or upload documents.
func (*App) FindCollectionPreview ¶
func (application *App) FindCollectionPreview(ctx context.Context, token, collection, documentID string) (store.Document, error)
FindCollectionPreview resolves a scoped token and re-runs the ordinary read operation so current access predicates, field redaction, and hooks still apply.
func (*App) FindGlobalPreview ¶
func (application *App) FindGlobalPreview(ctx context.Context, token, slug string) (store.Document, error)
FindGlobalPreview resolves a scoped token through the same global read engine.
func (*App) ForceUnlock ¶
func (application *App) ForceUnlock(ctx context.Context, collection, id string, identity *AuthIdentity) error
ForceUnlock clears an account lock for an exact authenticated identity.
func (*App) Handler ¶
func (application *App) Handler(options HandlerOptions) http.Handler
Handler returns the application HTTP API and embedded admin handler.
func (*App) Login ¶
func (application *App) Login(ctx context.Context, collection, email, password string) (AuthSession, error)
Login authenticates with the built-in local strategy.
func (*App) LoginWithOptions ¶
func (application *App) LoginWithOptions(ctx context.Context, collection, email, password string, options LoginOptions) (AuthSession, error)
LoginWithOptions authenticates and records safe client metadata with the resulting session. Credential failures intentionally share one response.
func (*App) OpenUpload ¶
func (*App) OpenUploadForIdentity ¶
func (application *App) OpenUploadForIdentity(ctx context.Context, collection, key string, identity *AuthIdentity) (io.ReadCloser, storage.Object, error)
OpenUploadForIdentity opens an upload through one exact authenticated collection identity. A nil identity remains anonymous.
func (*App) OpenUploadWithOptions ¶
func (application *App) OpenUploadWithOptions(ctx context.Context, collection, key string, options FindOptions) (io.ReadCloser, storage.Object, error)
OpenUploadWithOptions preserves exact actor identity while proving that the requested object belongs to an access-visible upload document.
func (*App) Preference ¶
func (application *App) Preference(ctx context.Context, identity *AuthIdentity, key string) (json.RawMessage, error)
Preference reads one preference owned by the exact authenticated identity.
func (*App) PruneExpiredAuth ¶
func (application *App) PruneExpiredAuth(ctx context.Context, limit int) (store.AuthPruneResult, error)
PruneExpiredAuth removes one bounded batch of expired sessions and API keys. Production Execute workers call this automatically for stores that implement store.AuthMaintenanceStore; the explicit method is useful to dedicated worker processes and adapter conformance tests.
func (*App) ReconcileUploads ¶
func (application *App) ReconcileUploads(ctx context.Context, olderThan time.Duration) (ReconcileResult, error)
ReconcileUploads reports unreferenced application-owned objects older than the safety window without deleting them. Reconciliation uses an ACL-independent store snapshot.
func (*App) ReleaseDocumentLock ¶
func (application *App) ReleaseDocumentLock(ctx context.Context, collection, documentID string, identity *AuthIdentity) error
ReleaseDocumentLock removes only the exact authenticated identity's lease.
func (*App) RequestPasswordReset ¶
func (application *App) RequestPasswordReset(ctx context.Context, collection, identity string) error
RequestPasswordReset issues a single-use token and passes it to the application-owned delivery callback. Unknown identities are intentionally a successful no-op so callers cannot enumerate accounts.
func (*App) RequestVerification ¶
RequestVerification replaces any outstanding verification token and sends a new one. Unknown and already-verified identities are successful no-ops.
func (*App) ResetPassword ¶
func (application *App) ResetPassword(ctx context.Context, collection, token, password string) error
ResetPassword consumes a password-reset token exactly once, replaces the hash, clears lockout state, and revokes every session and API key in one store transaction.
func (*App) ResetPreferences ¶
func (application *App) ResetPreferences(ctx context.Context, identity *AuthIdentity) error
ResetPreferences deletes every preference owned by the exact authenticated identity.
func (*App) RevokeAPIKey ¶
RevokeAPIKey deletes one key only when it belongs to the current identity.
func (*App) RevokePreviewToken ¶
func (application *App) RevokePreviewToken(ctx context.Context, raw string, identity *AuthIdentity) error
RevokePreviewToken removes one capability only when it belongs to the exact currently authenticated collection actor. Missing or expired tokens are treated as already revoked.
func (*App) RevokeSession ¶
RevokeSession revokes one session only when it belongs to the current user.
func (*App) RotateSession ¶
RotateSession atomically replaces a session bearer token without extending its absolute lifetime. The old token is invalid as soon as this returns.
func (*App) RunScheduledPublishes ¶
func (*App) RunTasks ¶
RunTasks claims and executes one bounded batch. Concurrent callers are safe; the store lease is the authority and handlers remain at-least-once.
func (*App) SchedulePublish ¶
func (application *App) SchedulePublish(ctx context.Context, collection, documentID string, runAt time.Time, expectedRevision int, identity *AuthIdentity) (store.ScheduledPublish, error)
SchedulePublish queues a publish for one exact authenticated identity. A nil identity preserves anonymous scheduling when collection access allows it.
func (*App) ScheduledPublishes ¶
func (application *App) ScheduledPublishes(ctx context.Context, collection, documentID string, identity *AuthIdentity) ([]store.ScheduledPublish, error)
ScheduledPublishes lists scheduled publishes using one exact identity.
func (*App) SetPassword ¶
SetPassword validates and replaces a local password. Every existing session is revoked after the new hash is durably stored.
func (*App) SetPreference ¶
func (application *App) SetPreference(ctx context.Context, identity *AuthIdentity, key string, value json.RawMessage) (json.RawMessage, error)
SetPreference writes one preference owned by the exact authenticated identity.
func (*App) UnlockAuthUser ¶
func (application *App) UnlockAuthUser(ctx context.Context, collection, identity string, actorIdentity *AuthIdentity) error
UnlockAuthUser selects an account by its configured identity and unlocks it for an exact authenticated identity. Missing users remain indistinguishable from denied access.
func (*App) UpdateUploadImage ¶
func (application *App) UpdateUploadImage(ctx context.Context, collection, id string, input UpdateUploadImageInput) (store.Document, error)
UpdateUploadImage regenerates configured image sizes around a new focal point, then commits their metadata through the ordinary operation engine.
func (*App) UpdateUploadImageForIdentity ¶
func (application *App) UpdateUploadImageForIdentity(ctx context.Context, collection, id string, input UpdateUploadImageInput, identity *AuthIdentity) (store.Document, error)
UpdateUploadImageForIdentity regenerates image variants for one exact authenticated collection identity. A nil identity remains anonymous.
func (*App) UploadForIdentity ¶
func (application *App) UploadForIdentity(ctx context.Context, collection string, input UploadInput, identity *AuthIdentity) (store.Document, error)
UploadForIdentity stores a file for one exact authenticated collection identity. A nil identity remains anonymous.
func (*App) UploadFromURL ¶
func (application *App) UploadFromURL(ctx context.Context, collection string, input RemoteUploadInput) (store.Document, error)
UploadFromURL safely downloads a public HTTP(S) asset before passing it through the same MIME, size, storage, access, validation, and hook pipeline as a multipart upload.
func (*App) UploadFromURLForIdentity ¶
func (application *App) UploadFromURLForIdentity(ctx context.Context, collection string, input RemoteUploadInput, identity *AuthIdentity) (store.Document, error)
UploadFromURLForIdentity fetches and stores a remote file for one exact authenticated collection identity. Identity is rechecked before networking.
type AuditEvent ¶
type AuditEvent struct {
// Time is when the event occurred.
Time time.Time
// RequestID correlates the event with logs and observations.
RequestID string
// ClientIP is the resolved direct or trusted-forwarded client address.
ClientIP string
// Action names the operation, such as login, create, or delete.
Action string
// Collection is the affected collection slug when applicable.
Collection string
// DocumentID is the affected document identity when applicable.
DocumentID string
// ActorID is the authenticated document identity when available.
ActorID string
// ActorCollection disambiguates ActorID across auth collections.
ActorCollection schema.CollectionSlug
}
AuditEvent describes one security-relevant action handled by the API.
type AuthAccess ¶
type AuthAccess struct {
Login AuthAccessRule
PasswordReset AuthAccessRule
Verification AuthAccessRule
APIKey AuthAccessRule
Session AuthAccessRule
}
AuthAccess defines authorization that is specific to authentication rather than document CRUD. Nil rules allow the operation.
type AuthAccessRule ¶
type AuthAccessRule func(AuthContext) (bool, error)
AuthAccessRule allows or denies one auth operation.
type AuthConfig ¶
type AuthConfig struct {
// SessionDuration is how long a login remains valid. Zero defaults to 24 hours.
SessionDuration time.Duration
// Password controls local password validation and hashing. Zero values use
// the secure framework defaults documented on PasswordPolicy.
Password PasswordPolicy
// MaxLoginAttempts is the number of consecutive credential failures allowed
// before the account is temporarily locked. Zero defaults to 5; a negative
// value disables account lockout.
MaxLoginAttempts int
// LockDuration is how long an account remains locked after MaxLoginAttempts.
// Zero defaults to 10 minutes.
LockDuration time.Duration
// PasswordReset enables the forgot/reset-password flow when Send is set.
// The raw single-use token is delivered only to this trusted callback.
PasswordReset PasswordResetConfig
// Verify enables email verification. When non-nil, newly provisioned
// credentials cannot log in until a verification token is consumed.
Verify *VerifyEmailConfig
// APIKeys allows users to mint revocable, session-independent bearer
// credentials. API keys are disabled by default.
APIKeys bool
// Access contains authorization rules for auth operations that are not CRUD.
Access AuthAccess
// Hooks contains authentication lifecycle callbacks.
Hooks AuthHooks
// Strategies adds application-owned request authentication in declaration order.
Strategies []AuthStrategy
}
AuthConfig controls session behavior for an auth-enabled collection.
type AuthContext ¶
type AuthContext struct {
Context context.Context
Operation AuthOperation
CollectionID schema.StableID
User *store.Document
Identity string
IPAddress string
UserAgent string
Local *LocalAPI
}
AuthContext is passed to auth-specific access rules and hooks. Secrets such as passwords, session tokens, reset tokens, and API keys are never included.
type AuthHook ¶
type AuthHook func(AuthContext) error
AuthHook runs at a documented authentication lifecycle boundary.
type AuthHooks ¶
type AuthHooks struct {
BeforeLogin []AuthHook
AfterLogin []AuthHook
AfterMe []AuthHook
BeforeLogout []AuthHook
AfterLogout []AuthHook
BeforeRefresh []AuthHook
AfterRefresh []AuthHook
BeforeForgotPassword []AuthHook
AfterForgotPassword []AuthHook
BeforePasswordReset []AuthHook
AfterPasswordReset []AuthHook
BeforeVerification []AuthHook
AfterVerification []AuthHook
BeforeAPIKey []AuthHook
AfterAPIKey []AuthHook
}
AuthHooks defines auth-specific lifecycle callbacks. Before hooks can reject an operation; if an after-login or after-refresh hook fails, the newly issued credential is revoked before the error is returned.
type AuthIdentity ¶
type AuthIdentity struct {
Collection schema.CollectionSlug
Actor store.Document
// PreviewEpoch is an opaque lifecycle snapshot captured before transport
// authentication. Zero lets direct Go callers snapshot at mint entry.
PreviewEpoch uint64
}
AuthIdentity identifies one authenticated document without relying on a document ID being globally unique across auth-enabled collections.
type AuthOperation ¶
type AuthOperation string
AuthOperation identifies an authentication lifecycle boundary.
const ( AuthOperationLogin AuthOperation = "login" AuthOperationMe AuthOperation = "me" AuthOperationLogout AuthOperation = "logout" AuthOperationRefresh AuthOperation = "refresh" AuthOperationPasswordReset AuthOperation = "password_reset" AuthOperationForgotPassword AuthOperation = "forgot_password" AuthOperationEmailVerification AuthOperation = "email_verification" AuthOperationAPIKey AuthOperation = "api_key" AuthOperationExternalStrategy AuthOperation = "external_strategy" )
type AuthSession ¶
type AuthSession struct {
// ID is the non-secret identifier used to manage this session.
ID string
// Token is the opaque credential accepted by session-aware transports.
Token string
// Collection is the auth-enabled collection that owns the identity.
Collection schema.CollectionSlug
// User is the current document from Collection.
User store.Document
// ExpiresAt is the absolute UTC expiry time.
ExpiresAt time.Time
}
AuthSession is one authenticated identity and its session metadata.
type AuthSessionInfo ¶
type AuthSessionInfo struct {
ID string
CreatedAt time.Time
LastSeenAt time.Time
ExpiresAt time.Time
IPAddress string
UserAgent string
Current bool
}
AuthSessionInfo is safe session metadata shown to an authenticated user. It never contains the bearer token or its digest.
type AuthStrategy ¶
type AuthStrategy struct {
// Name is a stable lowercase kebab-case identifier used in diagnostics.
Name string
// Authenticate returns Authenticated false when the request does not belong
// to this strategy. It must not return raw credentials or untrusted user data.
Authenticate func(AuthStrategyContext) (AuthStrategyResult, error)
}
AuthStrategy integrates an application-owned identity provider. Strategies run in declaration order after built-in session and API-key authentication.
type AuthStrategyContext ¶
type AuthStrategyContext struct {
Context context.Context
CollectionID schema.StableID
Headers map[string][]string
Local *LocalAPI
}
AuthStrategyContext contains normalized request headers for a custom authentication strategy. Header names are canonicalized by net/http.
type AuthStrategyResult ¶
AuthStrategyResult reports whether a strategy recognized the request. A matched result must identify a user in the strategy's auth collection.
type BoundTypedAllLocalesCollection ¶ added in v0.2.0
type BoundTypedAllLocalesCollection[Document any] struct { // contains filtered or unexported fields }
BoundTypedAllLocalesCollection reads documents with locale maps in localized fields.
func (BoundTypedAllLocalesCollection[Document]) Find ¶ added in v0.2.0
func (collection BoundTypedAllLocalesCollection[Document]) Find(ctx context.Context, id string, options TypedReadOptions) (Document, error)
Find reads with the locale shape chosen by the generated definition.
func (BoundTypedAllLocalesCollection[Document]) List ¶ added in v0.2.0
func (collection BoundTypedAllLocalesCollection[Document]) List(ctx context.Context, options TypedListOptions) (TypedPage[Document], error)
List filters and populates documents through the operation engine, using the same response shape as Find. A failed document decode returns no partial page.
type BoundTypedAllLocalesGlobal ¶ added in v0.2.0
type BoundTypedAllLocalesGlobal[Document any] struct { // contains filtered or unexported fields }
BoundTypedAllLocalesGlobal reads a singleton with locale maps in localized fields.
func (BoundTypedAllLocalesGlobal[Document]) Find ¶ added in v0.2.0
func (global BoundTypedAllLocalesGlobal[Document]) Find(ctx context.Context, options TypedReadOptions) (Document, error)
Find reads the global with all translations and optional population/projection.
type BoundTypedCollection ¶
type BoundTypedCollection[Document, Create, Update any] struct { // contains filtered or unexported fields }
BoundTypedCollection is a typed view of one collection on a LocalAPI.
func (BoundTypedCollection[Document, Create, Update]) Create ¶
func (collection BoundTypedCollection[Document, Create, Update]) Create(ctx context.Context, input Create, actor *store.Document, localeOptions ...TypedLocaleOptions) (Document, error)
func (BoundTypedCollection[Document, Create, Update]) Find ¶
func (collection BoundTypedCollection[Document, Create, Update]) Find(ctx context.Context, id string, options TypedReadOptions) (Document, error)
Find reads one locale with optional population and projection.
func (BoundTypedCollection[Document, Create, Update]) Import ¶
func (collection BoundTypedCollection[Document, Create, Update]) Import(ctx context.Context, input Create, options ImportOptions, actor *store.Document) (Document, error)
func (BoundTypedCollection[Document, Create, Update]) List ¶
func (collection BoundTypedCollection[Document, Create, Update]) List(ctx context.Context, options TypedListOptions) (TypedPage[Document], error)
List filters, paginates and populates one locale through the operation engine. A failed decode returns an error and no partial page.
func (BoundTypedCollection[Document, Create, Update]) Update ¶
func (collection BoundTypedCollection[Document, Create, Update]) Update(ctx context.Context, id string, input Update, actor *store.Document, localeOptions ...TypedLocaleOptions) (Document, error)
func (BoundTypedCollection[Document, Create, Update]) UpdateRevision ¶
func (collection BoundTypedCollection[Document, Create, Update]) UpdateRevision(ctx context.Context, id string, input Update, expectedRevision int, actor *store.Document, localeOptions ...TypedLocaleOptions) (Document, error)
type BoundTypedGlobal ¶
type BoundTypedGlobal[Document, Update any] struct { // contains filtered or unexported fields }
BoundTypedGlobal is a typed view of one singleton on a LocalAPI.
func (BoundTypedGlobal[Document, Update]) Find ¶
func (global BoundTypedGlobal[Document, Update]) Find(ctx context.Context, options TypedReadOptions) (Document, error)
func (BoundTypedGlobal[Document, Update]) RestoreAsDraft ¶
func (BoundTypedGlobal[Document, Update]) Update ¶
func (global BoundTypedGlobal[Document, Update]) Update(ctx context.Context, input Update, expectedRevision int, actor *store.Document, localeOptions ...TypedLocaleOptions) (Document, error)
type CapabilityOptions ¶
type CapabilityOptions struct {
Data store.Values
Actor *store.Document
ActorCollection schema.CollectionSlug
TrashOnly bool
Locale schema.LocaleCode
FallbackLocales []schema.LocaleCode
DisableFallback bool
AllLocales bool
}
CapabilityOptions describes one side-effect-free access evaluation.
type Collection ¶
type Collection struct {
// Slug is the URL-safe collection name used by APIs, relationships, and the admin.
Slug schema.CollectionSlug
// Labels override the singular and plural names shown to authors.
Labels CollectionLabels
// Admin configures collection presentation and editorial organization.
Admin CollectionAdmin
// Fields owns the collection's immutable field shape, behavior, and presentation.
Fields field.Fields
// Indexes defines ordered multi-field indexes. Unique indexes enforce tuple
// uniqueness while allowing multiple rows containing null.
Indexes []CollectionIndex
// Auth enables identities, passwords, and sessions for this collection.
Auth bool
// AuthConfig customizes behavior that applies when Auth is enabled.
AuthConfig AuthConfig
// Upload enables file metadata and storage behavior for this collection.
Upload bool
// UploadConfig customizes validation, privacy, and image variants for uploads.
UploadConfig UploadConfig
// Versions enables document revisions for this collection.
Versions bool
// Trash keeps deleted documents recoverable until they are permanently deleted.
Trash bool
// LockDocuments coordinates exclusive document editing with timeout and takeover.
LockDocuments bool
// DocumentLockConfig customizes lock expiry when LockDocuments is enabled.
DocumentLockConfig DocumentLockConfig
// VersionConfig customizes drafts, retention, and autosave behavior.
VersionConfig VersionConfig
// Access defines collection-level authorization for each operation.
Access CollectionAccess
// Hooks defines collection-wide lifecycle behavior.
Hooks CollectionHooks
// Endpoints declares custom HTTP endpoints below
// /api/collections/<slug>. They run before matching built-in collection
// routes for the same method.
Endpoints []Endpoint
}
Collection defines one document collection in authoring configuration.
type CollectionAccess ¶
type CollectionAccess struct {
// Admin controls whether an authenticated user from this auth collection may
// enter the framework admin. It accepts only Allow or Deny and defaults to
// Allow when omitted.
Admin AccessRule
// Create controls document creation.
Create AccessRule
// Read controls individual and list reads and may return a Where decision.
Read AccessRule
// ReadVersions controls version-history reads and may return a Where
// decision. When omitted, Read is used.
ReadVersions AccessRule
// Update controls document updates and may return a Where decision.
Update AccessRule
// Publish controls publishing and atomic published-document edits. When
// omitted, Update is used so existing policies remain coherent.
Publish AccessRule
// Unpublish controls moving a published document back to draft. When
// omitted, Update is used.
Unpublish AccessRule
// Delete controls document deletion and may return a Where decision.
Delete AccessRule
// Unlock controls takeover of another editor's active document lock. When
// omitted, Update is used so existing collection policies remain coherent.
Unlock AccessRule
}
CollectionAccess configures authorization for each operation on a Collection. Assign it to Collection.Access. Omitted rules allow the operation unless the member below documents a fallback to another rule.
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
}
CollectionAdmin is serializable presentation metadata consumed by the framework admin.
type CollectionHooks ¶
type CollectionHooks struct {
// BeforeDuplicate runs after the source is access-checked and copied but before validation.
BeforeDuplicate []Hook
// BeforeValidate runs before field hooks and built-in checks. On updates,
// Data may contain only the submitted fields. This shared phase also runs for
// reads and deletes; check Operation when changing write input.
BeforeValidate []Hook
// BeforeChange runs after initial built-in validation for create, duplicate,
// update, publish, and unpublish. Changes to Data are checked again afterward;
// custom field validators run after the write hooks finish.
BeforeChange []Hook
// BeforeOperation runs before the store operation, including reads and deletes.
// On writes it follows BeforeChange; changed values are validated before saving.
BeforeOperation []Hook
// BeforeRead runs before one or many documents are read.
BeforeRead []Hook
// BeforeDelete runs after the original document is loaded but before deletion.
BeforeDelete []Hook
// AfterChange runs after create, duplicate, update, publish, or unpublish has
// saved the document, but before commit. Returning an error rolls back the save.
AfterChange []Hook
// AfterRead runs for each response document, including mutation responses,
// after computed fields resolve and before field read access removes values.
AfterRead []Hook
// AfterDelete runs inside the transaction after deletion or trashing.
AfterDelete []Hook
// AfterOperation runs after the store operation, including reads and deletes,
// but before response processing and commit. Errors can still roll back writes.
AfterOperation []Hook
// AfterError observes a failure in this resource through Error. It cannot
// suppress that failure; its own error is added to the returned error.
AfterError []Hook
// AfterCommit runs after a successful commit, including read transactions.
// Guard write-only effects with Operation. It runs outside the transaction;
// failures cannot roll back saved data, and later effects still run.
AfterCommit []Hook
}
CollectionHooks configures resource-level callbacks through Collection.Hooks or Global.Hooks. Use BeforeChange to change values before a save, AfterRead to change a response without changing storage, and AfterCommit for effects that must run only after a successful commit. Each list runs in declaration order. Resource hooks run before field hooks in the same phase, except AfterCommit, where field hooks run first. Globals do not support BeforeDuplicate, BeforeDelete, or AfterDelete.
type CollectionIndex ¶
CollectionIndex defines one ordered compound database index. Fields are dot-separated paths through non-repeated groups.
type CollectionLabels ¶
type CollectionLabels struct {
// Singular is used when referring to one document.
Singular string
// SingularTranslations overrides Singular for configured admin languages.
SingularTranslations map[string]string
// Plural is used in navigation and collection lists.
Plural string
// PluralTranslations overrides Plural for configured admin languages.
PluralTranslations map[string]string
}
CollectionLabels overrides author-facing collection names.
type Config ¶
type Config struct {
// Name is the author-facing application name shown by framework tooling.
Name string
// NameTranslations overrides Name for configured admin interface languages.
NameTranslations map[string]string
// Admin configures the framework-owned administration interface.
Admin AdminConfig
// Localization configures content locales. The zero value disables content
// localization without affecting admin interface language.
Localization LocalizationConfig
// AllowIDOnCreate lets ordinary create operations accept a caller-supplied
// canonical string ID. It is disabled by default; migration imports retain
// their separate identity-preserving path regardless of this setting.
AllowIDOnCreate bool
// Blocks declares shared immutable definitions selected by field and embedded references.
Blocks []field.Block
// Collections declares every document collection owned by the application.
Collections []Collection
// Globals declares singleton documents with their own API and admin routes.
Globals []Global
// Endpoints declares application-level custom HTTP endpoints below /api.
// Handlers are anonymous by default and must enforce their own policy.
Endpoints []Endpoint
// Tasks registers compiled durable task handlers. Executable handlers are
// runtime-only and are intentionally excluded from the schema manifest.
Tasks []TaskDefinition
// Hooks observes application-wide lifecycle failures.
Hooks RootHooks
// Plugins lists compiled extensions in deterministic execution order.
Plugins []Plugin
// AfterCommit dispatches effects only after a successful transaction commits.
AfterCommit AfterCommitDispatcher
// Storage provides the application-wide object-storage adapter when App is
// constructed directly with New. Applications run through Execute should
// prefer WithUploadStorage so external clients are opened only at runtime.
// Storage is never serialized into the schema manifest.
Storage storage.Backend
// StorageNamespace is the stable, deployment-owned prefix for upload objects.
// It must remain unchanged when the display Name changes and must be unique
// among applications sharing one backend.
StorageNamespace string
// contains filtered or unexported fields
}
Config is executable application-owned Ridu configuration. Resolve applies compiled plugin transforms to a defensive copy before final validation.
type ConfigTransformer ¶
ConfigTransformer is the Phase 1 plugin capability for contributing or transforming authoring config before final validation. Implementations receive and return defensive copies; transform order is the Config.Plugins declaration order.
type DescriptorProvider ¶
type DescriptorProvider interface {
Plugin
Descriptor() PluginDescriptor
}
DescriptorProvider opts a plugin into versioned generation, migration, and compatibility tooling. Plugins exposing any advanced capability must provide a descriptor; key-only plugins remain supported for config transforms and validators that need no build metadata.
type DistinctOptions ¶
type DistinctOptions struct {
// Field names the authored scalar, singular relationship, singular upload,
// or document ID whose unique values should be returned.
Field query.Path
// Where remains atomic with the collection read-access predicate.
Where query.Expression
// Page is one-based. Zero selects the first page.
Page int
// Limit follows ordinary Ridu list bounds and defaults.
Limit int
Actor *store.Document
// ActorCollection identifies the exact auth collection that owns Actor.
ActorCollection schema.CollectionSlug
// Draft follows List semantics for versioned collections.
Draft *bool
// TrashOnly returns values from deleted documents and requires trash support.
TrashOnly bool
Locale schema.LocaleCode
FallbackLocales []schema.LocaleCode
DisableFallback bool
}
DistinctOptions controls one access-checked unique-value read. The initial contract intentionally supports one direct singular stored field and normal ascending field order; it is not a general aggregation API.
type DocumentLockConfig ¶
DocumentLockConfig controls persisted authoring locks.
type DocumentLockState ¶
type DocumentLockState struct {
Lock *store.DocumentLock
Owned bool
Acquired bool
CanTakeOver bool
}
DocumentLockState describes the current authoring lease for one document.
type Endpoint ¶
type Endpoint struct {
// Method is one supported HTTP method. Matching is case-insensitive during
// config resolution and the manifest stores its uppercase form.
Method string
// Path begins with / and may contain named :parameter segments.
Path string
// Summary appears in the generated OpenAPI operation. When empty, Ridu
// supplies a deterministic generic summary.
Summary string
// MaxBodyBytes bounds the raw request body before Handler receives it. Zero
// inherits HandlerOptions.MaxBodyBytes; a negative value opts trusted
// streaming code out of that bound.
MaxBodyBytes int64
// Handler is trusted compiled application code and is never serialized.
Handler EndpointHandler
}
Endpoint is one application-authored, method-specific HTTP endpoint. Root endpoints are mounted below /api; collection and global endpoints are mounted below their resource route. Path uses Payload-familiar named segments such as /:id/tracking.
Custom endpoints are not authorized automatically. Handler must enforce any endpoint-specific policy before performing work. Local remains access-controlled unless the application explicitly chooses an override on an individual local operation.
type EndpointContext ¶
type EndpointContext struct {
// Writer receives the status, headers, and body chosen by the handler.
Writer http.ResponseWriter
// Request is the matched HTTP request. Use its Context for cancellation,
// deadlines, and dependent work.
Request *http.Request
// RequestID is the framework request ID also returned in X-Request-ID.
RequestID string
// ClientIP is resolved through the configured trusted-proxy policy.
ClientIP string
// RouteParams contains decoded named path parameters.
RouteParams map[string]string
// Collection identifies the owning collection endpoint, when applicable.
Collection schema.CollectionSlug
// Global identifies the owning global endpoint, when applicable.
Global schema.CollectionSlug
// Actor is the authenticated user, or nil for an anonymous request.
Actor *store.Document
// ActorCollection identifies the auth collection that owns Actor.
ActorCollection schema.CollectionSlug
// Local enters the same access-controlled operation engine as REST and the
// generated SDK.
Local *LocalAPI
// AdmitAuthAttempt applies the distributed authentication-attempt policy for
// endpoints implementing an authentication flow.
AdmitAuthAttempt func(context.Context, string, string) error
// ReportError records a stable code and sends trusted detail to
// HandlerOptions.RequestError without exposing it to the client.
ReportError func(error, string)
}
EndpointContext gives an EndpointHandler the matched request, response writer, route metadata, authenticated actor, and access-controlled Local API.
type EndpointHandler ¶
type EndpointHandler func(EndpointContext)
EndpointHandler serves one trusted compiled custom route. It writes the endpoint-owned response through EndpointContext.Writer and must enforce any endpoint-specific authorization before performing protected work.
type EndpointProvider ¶
type EndpointProvider interface {
Plugin
Endpoints() []PluginEndpoint
}
EndpointProvider contributes exact REST endpoints under the provider's namespaced /api/plugins/<key>/ prefix.
type ExecuteOption ¶
type ExecuteOption func(*executeOptions)
func WithAddress ¶
func WithAddress(address string) ExecuteOption
WithAddress configures the HTTP listen address independently from the document-store adapter. The default is :8080.
func WithHandlerOptions ¶
func WithHandlerOptions(handler HandlerOptions) ExecuteOption
WithHandlerOptions customizes the framework HTTP handler, including the generated application's embedded admin assets.
func WithProjectMigrations ¶
func WithProjectMigrations(driver migration.ProjectDriver) ExecuteOption
WithProjectMigrations registers the selected adapter's compiled migration callbacks for the private project-command path. The driver is never used by manifest generation or the ordinary HTTP runtime.
func WithServerOptions ¶
func WithServerOptions(server ServerOptions) ExecuteOption
WithServerOptions customizes production socket and drain bounds without replacing Ridu's framework-owned http.Server lifecycle.
func WithStore ¶
func WithStore(factory StoreFactory) ExecuteOption
WithStore configures the singular document-store adapter used by the operation engine. The factory is invoked only by the server runtime.
func WithUploadStorage ¶
func WithUploadStorage(factory StorageFactory) ExecuteOption
WithUploadStorage configures upload bytes lazily so manifest generation never touches the filesystem or network.
type FieldCapabilities ¶
type FieldGraphContext ¶ added in v0.2.0
type FieldGraphContext struct {
ResourceKind string
Slug schema.CollectionSlug
}
FieldGraphContext identifies the resource a graph plugin is editing. Resource transforms complete first; graph transforms then run once in Plugins order. Resource hooks, endpoints and domain capabilities retain their own contracts.
type FieldGraphTransformer ¶ added in v0.2.0
type FieldGraphTransformer interface {
Plugin
TransformFields(FieldGraphContext, field.Fields) (field.Fields, error)
}
FieldGraphTransformer edits immutable fields through public graph operations. The input and result are snapshotted. Plugins should return deterministic edits; closure captures and other plugin-owned external state remain their responsibility. Duplicate plugin keys are rejected before any transform runs.
type FieldGraphValidator ¶ added in v0.2.0
type FieldGraphValidator interface {
Plugin
ValidateFields(FieldGraphContext, field.Fields) error
}
FieldGraphValidator checks a resource's final immutable field configuration after every graph transformer has completed. It cannot publish graph edits. Use this for plugin-owned schema and host settings, not document validation; runtime value validators belong to the field or plugin value contract.
type FieldValidatorProvider ¶
type FieldValidatorProvider interface {
Plugin
FieldValidators() map[string]PluginFieldValidator
}
FieldValidatorProvider is a focused runtime capability for plugin-owned value contracts. Keys must match manifest plugin field keys.
type FindOptions ¶
type FindOptions struct {
// Select is nil for all authored fields. A non-nil empty slice returns only
// document metadata.
Select []query.Path
Populate []query.Population
// OutputFields limits computed and inverse-join resolution independently
// from Select. Nil resolves all; a non-nil empty slice resolves none.
OutputFields []query.Path
// Draft explicitly includes draft documents when true or restricts reads to
// published documents when false. Nil preserves the Local API default.
Draft *bool
Actor *store.Document
ActorCollection schema.CollectionSlug
TrashOnly bool
Locale schema.LocaleCode
FallbackLocales []schema.LocaleCode
DisableFallback bool
AllLocales bool
}
FindOptions controls projection, relationship population, localization, and authorization for one document read.
type GenerationProvider ¶
type GenerationProvider interface {
Plugin
GeneratedArtifacts(PluginGenerationContext) ([]PluginGeneratedArtifact, error)
}
GenerationProvider contributes requested deterministic build artifacts that require executable plugin configuration and therefore cannot be reconstructed from the serializable manifest alone. Providers do not run unless ridu.toml maps one of their artifacts to a destination.
type Global ¶
type Global struct {
// Slug is the URL-safe global name used by APIs and the admin.
Slug schema.CollectionSlug
// Label overrides the author-facing name shown in navigation and headings.
Label string
// LabelTranslations overrides Label for configured admin interface languages.
LabelTranslations map[string]string
// Admin is serializable presentation metadata consumed by the framework admin.
Admin GlobalAdmin
// Fields owns the global's immutable field shape, behavior, and presentation.
Fields field.Fields
// Versions enables revisions for this global.
Versions bool
// VersionConfig customizes drafts, retention, and autosave behavior.
VersionConfig VersionConfig
// Access defines read and update authorization.
Access GlobalAccess
// Hooks defines global-wide lifecycle behavior.
Hooks CollectionHooks
// Endpoints declares custom HTTP endpoints below /api/globals/<slug>.
// They run before matching built-in global routes for the same method.
Endpoints []Endpoint
}
Global defines one singleton document in authoring configuration.
type GlobalAccess ¶
type GlobalAccess struct {
// Read controls global reads and may return a Where decision.
Read AccessRule
// ReadVersions controls version-history reads and may return a Where decision.
// When omitted, Read is used.
ReadVersions AccessRule
// Update controls global updates and may return a Where decision for an
// existing singleton.
Update AccessRule
// Publish controls publishing and atomic published-global edits. When
// omitted, Update is used.
Publish AccessRule
// Unpublish controls moving a published global back to draft. When omitted,
// Update is used.
Unpublish AccessRule
}
GlobalAccess configures read and write authorization for a Global. Assign it to Global.Access. Omitted rules allow the operation unless the member below documents a fallback. Where decisions are applied atomically to a persisted singleton or version; the singleton's first update requires Allow because no row exists for a filter to authorize.
type GlobalAdmin ¶
type GlobalAdmin struct {
Group string
GroupTranslations map[string]string
Description string
DescriptionTranslations map[string]string
LivePreview LivePreviewConfig
}
GlobalAdmin customizes global presentation without affecting authorization.
type HandlerOptions ¶
type HandlerOptions struct {
// AdminAssets overrides the framework's embedded admin asset filesystem.
AdminAssets fs.FS
// MaxBodyBytes limits decoded request bodies. Zero uses the framework default.
MaxBodyBytes int64
// SecureCookies restricts auth cookies to HTTPS requests.
SecureCookies bool
// AllowedOrigins lists browser origins permitted by CORS.
AllowedOrigins []string
// AllowedRequestHeaders appends application-owned CORS request headers to
// Ridu's SDK headers. Invalid HTTP token names are ignored.
AllowedRequestHeaders []string
// AllowedHosts restricts the HTTP Host header. Entries are exact hostnames
// with an optional port; an entry without a port accepts any port. Empty
// accepts every syntactically valid host for development. Production
// deployments should set their public hostnames.
AllowedHosts []string
// TrustedProxyCIDRs lists proxies whose forwarded client addresses are trusted.
TrustedProxyCIDRs []string
// AuthRateLimit is the maximum auth attempts per identity and client window.
AuthRateLimit int
// AuthRateWindow is the duration over which AuthRateLimit is enforced.
AuthRateWindow time.Duration
// Audit receives security-relevant application events.
Audit func(AuditEvent)
// Observe receives timing and status metadata for completed requests.
Observe func(RequestObservation)
// RequestError receives trusted diagnostic detail for internal failures and
// recovered panics. The HTTP response remains redacted.
RequestError func(RequestErrorEvent)
// RequestTimeout limits request execution. Zero uses the framework default;
// a negative duration disables the handler deadline for streaming plugins.
RequestTimeout time.Duration
// ReadinessChecks add application/plugin dependencies to /readyz. Checks
// must be read-only, repeatable, and honor Context cancellation.
ReadinessChecks []ReadinessCheck
// ReadinessTimeout bounds the complete database, storage, and custom
// readiness probe. Zero uses five seconds; a negative duration disables it.
ReadinessTimeout time.Duration
// ContentSecurityPolicy overrides the framework admin policy. Empty uses a
// conservative default compatible with live-preview frames.
ContentSecurityPolicy string
// DisableContentSecurityPolicy explicitly disables the admin CSP when an
// upstream gateway owns it.
DisableContentSecurityPolicy bool
// StrictTransportSecurity is emitted verbatim when non-empty. Configure it
// only when every public request is HTTPS, normally at the TLS terminator.
StrictTransportSecurity string
// TaskInterval controls how often the durable task queues are polled. Zero
// uses the framework default.
TaskInterval time.Duration
// TaskBatch limits durable task leases claimed during one polling cycle.
TaskBatch int
// TaskQueues optionally restricts this process to named queues. An empty
// list consumes every queue, including unknown task slugs so they can be
// moved to a stable terminal failure.
TaskQueues []string
// TaskLeaseDuration is extended by heartbeats while a handler is running.
TaskLeaseDuration time.Duration
// TaskHeartbeatInterval must remain shorter than TaskLeaseDuration.
TaskHeartbeatInterval time.Duration
// TaskPruneBatch bounds terminal records removed after their retention.
TaskPruneBatch int
// AuthPruneBatch bounds expired sessions and API keys removed from each
// durable credential family during one background maintenance cycle.
AuthPruneBatch int
// JobError receives failures from scheduled background work.
JobError func(error)
// contains filtered or unexported fields
}
HandlerOptions configures the HTTP API, embedded admin, and background job runner.
type Hook ¶
type Hook func(HookContext) error
Hook runs during a collection or global lifecycle phase. Its context supplies the values and local API for that phase. Return nil to continue or an error to stop; an error before commit rolls back the transaction. AfterCommit errors report a failed side effect after the document has already committed.
type HookContext ¶
type HookContext struct {
// Context carries cancellation, deadlines, and the active transaction.
// Pass it to Local calls that must succeed or roll back with this operation.
Context context.Context
// Operation names the document operation, such as Create, Update, or Read,
// not the hook phase. Shared hooks should check it before running write-only work.
Operation operation.Kind
// CollectionID is the collection's stable resource ID, not its slug.
// It is empty for a global operation.
CollectionID schema.StableID
// GlobalID is the global's stable resource ID, not its slug.
// It is empty for a collection operation.
GlobalID schema.StableID
// Actor is the authenticated document, or nil for an anonymous operation.
Actor *store.Document
// ActorCollection identifies the exact auth collection that owns Actor.
ActorCollection schema.CollectionSlug
// Data contains values at this phase: submitted input in BeforeValidate,
// then the completed document in BeforeChange and BeforeOperation on writes.
// Change map entries to change stored values; assigning a new map to Data
// does not replace the engine's values. Changes after saving are not persisted.
Data store.Values
// Document is the response document when available. AfterRead receives each
// document in a list separately. Changes to Document.Values affect the response,
// not stored data, and remain subject to field read access rules.
Document *store.Document
// Original is a detached copy of the saved document before an update, delete,
// or duplication. Changing it does not change storage.
Original *store.Document
// Local performs nested reads and writes through the normal operation engine.
// Pass Context to reuse the transaction, and pass Actor, ActorCollection, and
// locale options explicitly when the nested operation represents the same user.
// Standalone reads reject nested writes; AfterCommit starts new transactions.
Local *LocalAPI
// Error is set only for after-error hooks and preserves the original failure.
// Returning nil from AfterError does not make the failed operation succeed.
Error error
// Locale is the selected content language. Write hooks use the write locale;
// AfterRead uses the response locale, whose values may include fallback text.
Locale schema.LocaleCode
// AllLocales reports whether localized values contain maps keyed by locale.
// It describes this hook's values, which may differ from the requested response.
AllLocales bool
}
HookContext supplies the request, values, and local API to a collection or global hook. Change entries in Data before saving, or values in Document to change the response after saving. A Hook returns only an error.
type HookProvider ¶
type HookProvider interface {
Plugin
Hooks() []PluginHookContribution
}
HookProvider contributes compiled lifecycle hooks without mutating authoring config through a generic transformer.
type ImageSize ¶
type ImageSize struct {
// Name is the stable key used to address the generated variant.
Name string
// Width is the target width in pixels.
Width int
// Height is the target height in pixels.
Height int
// Fit controls resizing and must be either "cover" or "contain".
Fit string
}
ImageSize describes one derived image variant for an upload collection.
type ImportOptions ¶
type ImportOptions struct {
// ID preserves the source document identity.
ID string
// Status preserves the source draft or published status.
Status store.Status
// CreatedAt preserves the source creation timestamp.
CreatedAt time.Time
// UpdatedAt preserves the source modification timestamp.
UpdatedAt time.Time
}
ImportOptions preserves source identity and timestamps during a migration.
type Input ¶
type Input[T any] struct { // contains filtered or unexported fields }
Input is an outbound presence marker for nullable generated mutation fields. A nil *Input omits the field, Set sends a concrete value, and Null sends explicit JSON null when the generated typed local API converts its input to store values. Generated block codecs also decode these wrappers to preserve explicit nulls.
func (*Input[T]) Get ¶ added in v0.2.0
Get returns the concrete value, or the zero value and false for omission or explicit null. A non-nil input with no concrete value represents explicit null.
func (Input[T]) MarshalJSON ¶
MarshalJSON implements json.Marshaler. Nil *Input fields are omitted by the generated parent struct's omitempty tag before this method is called.
func (*Input[T]) UnmarshalJSON ¶ added in v0.2.0
UnmarshalJSON preserves a concrete or explicit-null mutation value.
type JoinMutationResult ¶
JoinMutationResult reports the refreshed source document and applied deltas from one atomic inverse relationship mutation.
type ListOptions ¶
type ListOptions struct {
// Where filters documents before pagination and remains atomic with access predicates.
// Paths with a Read rule on the field or an ancestor are not queryable.
Where query.Expression
// Page is the one-based result page. Zero selects the first page.
Page int
// Limit is the maximum documents returned per page.
Limit int
// Sort orders results by authored field paths without Read rules on the field or ancestors.
// Container sorts also require all descendants to have no Read rules.
Sort []query.Sort
// Select restricts returned document fields.
Select []query.Path
// Populate expands configured relationship paths.
Populate []query.Population
// OutputFields limits computed and inverse-join resolution without
// projecting away stored fields. Nil resolves all output fields; a non-nil
// empty slice resolves none.
OutputFields []query.Path
// Draft explicitly includes draft documents when true or restricts reads to
// published documents when false. Nil preserves the Local API default.
Draft *bool
// Actor is the authenticated document used by access rules.
Actor *store.Document
// ActorCollection identifies the exact auth collection that owns Actor.
ActorCollection schema.CollectionSlug
// TrashOnly returns deleted documents and is valid only for trash-enabled collections.
TrashOnly bool
// Locale selects one configured content locale. Empty uses the application default.
Locale schema.LocaleCode
// FallbackLocales replaces the locale's configured fallback chain when non-nil.
FallbackLocales []schema.LocaleCode
// DisableFallback requires an exact value in Locale.
DisableFallback bool
// AllLocales returns locale-keyed values for localized fields.
AllLocales bool
}
ListOptions controls filtering, pagination, projection, and authorization for a list read.
type ListWindowOptions ¶
type ListWindowOptions struct {
Index query.Path
LowerBound string
UpperBound string
Limit int
Select []query.Path
Actor *store.Document
ActorCollection schema.CollectionSlug
Locale schema.LocaleCode
FallbackLocales []schema.LocaleCode
DisableFallback bool
AllLocales bool
}
ListWindowOptions controls a count-free bounded unique-index range read for background work. Index must name one direct, unique, indexed text field. LowerBound is inclusive and UpperBound is exclusive. Unlike ListOptions it has no arbitrary filter, access predicate, page offset, or relationship population. Production adapters use the unique index to fetch only Limit plus one overflow sentinel and do not compute a total.
type LivePreviewConfig ¶
type LivePreviewConfig struct {
URL string
Breakpoints []PreviewBreakpoint
}
LivePreviewConfig exposes a same- or cross-origin frontend inside the document editor. URL is a serializable template and may contain {id}, {collection}, and {field:path.to.value} placeholders that the admin resolves from the current draft.
type LocalAPI ¶
type LocalAPI struct {
// contains filtered or unexported fields
}
LocalAPI enters the same operation engine used by HTTP and jobs.
func (*LocalAPI) BulkDelete ¶
func (local *LocalAPI) BulkDelete(ctx context.Context, collection string, ids []string, actor *store.Document, localeOptions ...LocaleOptions) ([]store.Document, error)
BulkDelete atomically deletes or trashes every selected document.
func (*LocalAPI) BulkDeletePermanent ¶
func (local *LocalAPI) BulkDeletePermanent(ctx context.Context, collection string, ids []string, actor *store.Document, localeOptions ...LocaleOptions) ([]store.Document, error)
BulkDeletePermanent atomically permanently deletes selected trashed documents.
func (*LocalAPI) BulkPublish ¶
func (local *LocalAPI) BulkPublish(ctx context.Context, collection string, ids []string, actor *store.Document, localeOptions ...LocaleOptions) ([]store.Document, error)
BulkPublish atomically publishes every selected versioned document.
func (*LocalAPI) BulkRestoreDeleted ¶
func (local *LocalAPI) BulkRestoreDeleted(ctx context.Context, collection string, ids []string, actor *store.Document, localeOptions ...LocaleOptions) ([]store.Document, error)
BulkRestoreDeleted atomically restores selected documents from trash.
func (*LocalAPI) BulkUnpublish ¶
func (local *LocalAPI) BulkUnpublish(ctx context.Context, collection string, ids []string, actor *store.Document, localeOptions ...LocaleOptions) ([]store.Document, error)
BulkUnpublish atomically returns every selected versioned document to draft.
func (*LocalAPI) BulkUpdate ¶
func (local *LocalAPI) BulkUpdate(ctx context.Context, collection string, ids []string, values store.Values, actor *store.Document, localeOptions ...LocaleOptions) ([]store.Document, error)
BulkUpdate atomically applies the same partial values to every document.
func (*LocalAPI) Capabilities ¶
func (local *LocalAPI) Capabilities(ctx context.Context, collection, id string, options CapabilityOptions) (AccessCapabilities, error)
Capabilities evaluates collection, document, and field access without running hooks, validation, or a mutation.
func (*LocalAPI) CopyGlobalLocale ¶
func (local *LocalAPI) CopyGlobalLocale(ctx context.Context, slug string, source, target schema.LocaleCode, expectedRevision int, actor *store.Document) (store.Document, error)
CopyGlobalLocale copies readable localized singleton values between locales.
func (*LocalAPI) CopyGlobalLocaleWithOptions ¶
func (local *LocalAPI) CopyGlobalLocaleWithOptions(ctx context.Context, slug string, source, target schema.LocaleCode, options MutationOptions) (store.Document, error)
func (*LocalAPI) CopyLocale ¶
func (local *LocalAPI) CopyLocale(ctx context.Context, collection, id string, source, target schema.LocaleCode, expectedRevision int, actor *store.Document) (store.Document, error)
CopyLocale copies readable localized values between two locales while enforcing source read and destination update access independently. A copy into published content also requires and runs the publish lifecycle.
func (*LocalAPI) CopyLocaleWithOptions ¶
func (local *LocalAPI) CopyLocaleWithOptions(ctx context.Context, collection, id string, source, target schema.LocaleCode, options MutationOptions) (store.Document, error)
CopyLocaleWithOptions preserves the exact authenticated collection identity for both the source read and destination mutation lifecycle.
func (*LocalAPI) CreateWithOptions ¶
func (local *LocalAPI) CreateWithOptions(ctx context.Context, collection string, values store.Values, options MutationOptions) (store.Document, error)
CreateWithOptions creates a document and applies the requested bounded population plan to the response inside the write transaction.
func (*LocalAPI) DeletePermanent ¶
func (local *LocalAPI) DeletePermanent(ctx context.Context, collection, id string, actor *store.Document, localeOptions ...LocaleOptions) (store.Document, error)
DeletePermanent irreversibly removes a document that is already in trash.
func (*LocalAPI) DeletePermanentWithOptions ¶
func (*LocalAPI) DeleteWithOptions ¶
func (*LocalAPI) Distinct ¶
func (local *LocalAPI) Distinct(ctx context.Context, collection string, options DistinctOptions) (store.DistinctPage, error)
Distinct returns paginated unique values for one direct field. Collection access and Where are composed in the adapter query, and field read access is checked before any value is selected.
func (*LocalAPI) Duplicate ¶
func (local *LocalAPI) Duplicate(ctx context.Context, collection, id string, overrides store.Values, actor *store.Document, localeOptions ...LocaleOptions) (store.Document, error)
Duplicate creates a new document from an access-checked source. Overrides are applied before create validation and duplicate-aware hooks run.
func (*LocalAPI) DuplicateWithOptions ¶
func (local *LocalAPI) DuplicateWithOptions(ctx context.Context, collection, id string, overrides store.Values, options MutationOptions) (store.Document, error)
DuplicateWithOptions duplicates a document and populates the returned copy inside the write transaction.
func (*LocalAPI) EmptyTrash ¶
func (local *LocalAPI) EmptyTrash(ctx context.Context, collection string, actor *store.Document, localeOptions ...LocaleOptions) ([]store.Document, error)
EmptyTrash permanently deletes every accessible trashed document in one bounded atomic batch.
func (*LocalAPI) FindWithOptions ¶
func (local *LocalAPI) FindWithOptions(ctx context.Context, collection, id string, options FindOptions) (store.Document, error)
FindWithOptions reads one document through the operation engine with a transport-owned projection and population plan.
func (*LocalAPI) Global ¶
func (local *LocalAPI) Global(ctx context.Context, slug string, actor *store.Document, localeOptions ...LocaleOptions) (store.Document, error)
Global reads one singleton through the same access, hook, validation, and transaction engine used by collections.
func (*LocalAPI) GlobalVersion ¶
func (local *LocalAPI) GlobalVersion(ctx context.Context, slug string, revision int, actor *store.Document, localeOptions ...LocaleOptions) (store.Version, error)
GlobalVersion returns one authorized retained singleton revision.
func (*LocalAPI) GlobalVersionWithOptions ¶
func (*LocalAPI) GlobalVersions ¶
func (local *LocalAPI) GlobalVersions(ctx context.Context, slug string, actor *store.Document, localeOptions ...LocaleOptions) ([]store.Version, error)
GlobalVersions returns retained revisions for a versioned global.
func (*LocalAPI) GlobalVersionsWithOptions ¶
func (*LocalAPI) GlobalWithOptions ¶
func (local *LocalAPI) GlobalWithOptions(ctx context.Context, slug string, options FindOptions) (store.Document, error)
GlobalWithOptions reads a singleton with transport-owned projection and population through the ordinary operation engine.
func (*LocalAPI) Import ¶
func (local *LocalAPI) Import(ctx context.Context, collection string, values store.Values, options ImportOptions, actor *store.Document) (store.Document, error)
Import creates a document with a migration-owned stable ID while still running ordinary access, validation, hooks, transaction, and version logic.
func (*LocalAPI) ListJoin ¶ added in v0.2.0
func (local *LocalAPI) ListJoin(ctx context.Context, collection, id, field string, options ListOptions) (store.Page, error)
ListJoin reads a configured inverse join through source and target read access. Only the engine derives the membership predicate; caller Where and Sort keep ordinary List field-query restrictions even when the backing relation is private.
func (*LocalAPI) ListWindow ¶
func (local *LocalAPI) ListWindow(ctx context.Context, collection string, options ListWindowOptions) (store.Window, error)
ListWindow reads at most Limit documents from one unique-index range without a total count or offset. Collection read access must resolve to Allow so an adapter can preserve the physical index bound. The configured store must implement the optional store.WindowTransaction capability.
func (*LocalAPI) MutateJoin ¶
func (local *LocalAPI) MutateJoin(ctx context.Context, collection, id, field string, additions, removals []string, actor *store.Document, localeOptions ...LocaleOptions) (JoinMutationResult, error)
MutateJoin atomically applies explicit additions and removals to one configured inverse relationship. Deltas avoid treating a limited join view as the complete relation set.
func (*LocalAPI) MutateJoinWithOptions ¶
func (local *LocalAPI) MutateJoinWithOptions(ctx context.Context, collection, id, field string, additions, removals []string, options MutationOptions) (JoinMutationResult, error)
MutateJoinWithOptions preserves the exact authenticated collection identity while applying inverse relationship deltas.
func (*LocalAPI) PublishChanges ¶
func (local *LocalAPI) PublishChanges(ctx context.Context, collection, id string, values store.Values, expectedRevision int, actor *store.Document, localeOptions ...LocaleOptions) (store.Document, error)
PublishChanges atomically applies values and publishes the resulting document through both update access and the publish access rule and lifecycle.
func (*LocalAPI) PublishChangesWithOptions ¶
func (*LocalAPI) PublishGlobal ¶
func (local *LocalAPI) PublishGlobal(ctx context.Context, slug string, expectedRevision int, actor *store.Document, localeOptions ...LocaleOptions) (store.Document, error)
PublishGlobal publishes a versioned global.
func (*LocalAPI) PublishGlobalChanges ¶
func (local *LocalAPI) PublishGlobalChanges(ctx context.Context, slug string, values store.Values, expectedRevision int, actor *store.Document, localeOptions ...LocaleOptions) (store.Document, error)
PublishGlobalChanges atomically applies values and publishes the resulting global through both update access and the publish access rule and lifecycle.
func (*LocalAPI) PublishGlobalChangesWithOptions ¶
func (*LocalAPI) PublishGlobalWithOptions ¶
func (*LocalAPI) PublishWithOptions ¶
func (*LocalAPI) RestoreAsDraft ¶
func (local *LocalAPI) RestoreAsDraft(ctx context.Context, collection, id string, revision, expectedRevision int, actor *store.Document, localeOptions ...LocaleOptions) (store.Document, error)
RestoreAsDraft restores a retained revision while explicitly keeping the current document unpublished.
func (*LocalAPI) RestoreDeleted ¶
func (local *LocalAPI) RestoreDeleted(ctx context.Context, collection, id string, actor *store.Document, localeOptions ...LocaleOptions) (store.Document, error)
RestoreDeleted moves a trashed document back into ordinary collection reads.
func (*LocalAPI) RestoreDeletedWithOptions ¶
func (*LocalAPI) RestoreGlobal ¶
func (local *LocalAPI) RestoreGlobal(ctx context.Context, slug string, revision, expectedRevision int, actor *store.Document, localeOptions ...LocaleOptions) (store.Document, error)
RestoreGlobal restores a retained global revision.
func (*LocalAPI) RestoreGlobalAsDraft ¶
func (local *LocalAPI) RestoreGlobalAsDraft(ctx context.Context, slug string, revision, expectedRevision int, actor *store.Document, localeOptions ...LocaleOptions) (store.Document, error)
RestoreGlobalAsDraft restores a retained global revision without publishing it.
func (*LocalAPI) RestoreGlobalVersionWithOptions ¶
func (*LocalAPI) RestoreVersionWithOptions ¶
func (local *LocalAPI) RestoreVersionWithOptions(ctx context.Context, collection, id string, revision int, draft bool, options MutationOptions) (store.Document, error)
RestoreVersionWithOptions restores a retained revision and populates the returned document in the update transaction.
func (*LocalAPI) UnpublishGlobal ¶
func (local *LocalAPI) UnpublishGlobal(ctx context.Context, slug string, expectedRevision int, actor *store.Document, localeOptions ...LocaleOptions) (store.Document, error)
UnpublishGlobal moves a versioned global back to draft status.
func (*LocalAPI) UnpublishGlobalWithOptions ¶
func (*LocalAPI) UnpublishWithOptions ¶
func (*LocalAPI) UpdateGlobal ¶
func (local *LocalAPI) UpdateGlobal(ctx context.Context, slug string, values store.Values, expectedRevision int, actor *store.Document, localeOptions ...LocaleOptions) (store.Document, error)
UpdateGlobal creates the singleton on its first update and updates it thereafter.
func (*LocalAPI) UpdateGlobalWithOptions ¶
func (local *LocalAPI) UpdateGlobalWithOptions(ctx context.Context, slug string, values store.Values, options MutationOptions) (store.Document, error)
UpdateGlobalWithOptions updates a singleton and populates its response in the same write transaction.
func (*LocalAPI) UpdateRevision ¶
func (*LocalAPI) UpdateWithOptions ¶
func (local *LocalAPI) UpdateWithOptions(ctx context.Context, collection, id string, values store.Values, options MutationOptions) (store.Document, error)
UpdateWithOptions updates a document and applies the requested bounded population plan to the response inside the write transaction.
func (*LocalAPI) Version ¶
func (local *LocalAPI) Version(ctx context.Context, collection, id string, revision int, actor *store.Document, localeOptions ...LocaleOptions) (store.Version, error)
Version returns one authorized retained revision.
func (*LocalAPI) VersionWithOptions ¶
func (local *LocalAPI) VersionWithOptions(ctx context.Context, collection, id string, revision int, options FindOptions) (store.Version, error)
VersionWithOptions preserves the exact authenticated collection identity while reading one retained revision.
func (*LocalAPI) VersionsWithOptions ¶
func (local *LocalAPI) VersionsWithOptions(ctx context.Context, collection, id string, options FindOptions) ([]store.Version, error)
VersionsWithOptions preserves the exact authenticated collection identity while reading retained revisions.
type Locale ¶
type Locale struct {
Code schema.LocaleCode
Label string
RTL bool
FallbackLocales []schema.LocaleCode
}
Locale declares one content locale and its ordered fallback chain.
type LocaleAvailability ¶
type LocaleAvailability func(LocaleAvailabilityContext) ([]schema.LocaleCode, error)
LocaleAvailability dynamically limits content locales shown to one author.
type LocaleAvailabilityContext ¶
type LocaleAvailabilityContext struct {
Context context.Context
Actor *store.Document
ActorCollection schema.CollectionSlug
Local *LocalAPI
}
LocaleAvailabilityContext is the request-scoped input to AvailableLocales.
type LocaleOptions ¶
type LocaleOptions struct {
Locale schema.LocaleCode
FallbackLocales []schema.LocaleCode
DisableFallback bool
AllLocales bool
}
LocaleOptions selects localized content for single-document operations.
type LocalizationConfig ¶
type LocalizationConfig struct {
Locales []Locale
DefaultLocale schema.LocaleCode
DisableFallback bool
// AvailableLocales may reduce the locale list exposed to an admin request.
// It does not weaken API validation or authorization and is never serialized.
AvailableLocales LocaleAvailability
}
LocalizationConfig declares the application's content locales. Fallback is enabled by default; set DisableFallback to require exact locale values.
type LoginOptions ¶
type LoginOptions struct {
// IPAddress is the direct or trusted-forwarded client address.
IPAddress string
// UserAgent is the untrusted client user-agent string.
UserAgent string
}
LoginOptions carries transport metadata recorded with a new session.
type MutationOptions ¶
type MutationOptions struct {
// ID supplies a caller-owned document ID for create operations when
// Config.AllowIDOnCreate is enabled. Other mutations ignore it.
ID string
Actor *store.Document
ActorCollection schema.CollectionSlug
ExpectedRevision int
Populate []query.Population
// OutputFields limits computed and inverse-join resolution in the returned
// document. Nil resolves all; a non-nil empty slice resolves none.
OutputFields []query.Path
// Draft selects draft (true) or published (false) status for versioned
// creates. Updates preserve status so publish and unpublish hooks cannot be bypassed.
Draft *bool
Locale schema.LocaleCode
FallbackLocales []schema.LocaleCode
DisableFallback bool
AllLocales bool
}
MutationOptions controls authorization, optimistic concurrency, localization, and selection-driven population for one document write. Populate affects only the returned document; it never changes validation or storage behavior.
type NonNullInput ¶
type NonNullInput[T any] struct { // contains filtered or unexported fields }
NonNullInput is an outbound value marker for generated mutation fields whose Go representation can otherwise encode JSON null even though the schema does not allow null. NonNull constructs a required value and SetNonNull constructs an omittable present value. JSON encoding fails instead of emitting null for a nil slice, nil map, nil interface, or null json.RawMessage.
Decoding rejects explicit null just as encoding does.
func NonNull ¶
func NonNull[T any](value T) NonNullInput[T]
NonNull constructs a non-omittable generated mutation value.
func SetNonNull ¶
func SetNonNull[T any](value T) *NonNullInput[T]
SetNonNull constructs an omittable generated mutation value that is present.
func (*NonNullInput[T]) Get ¶ added in v0.2.0
func (input *NonNullInput[T]) Get() (T, bool)
Get returns the supplied value, or the zero value and false for an omitted input. Encoding still validates that the value does not encode as JSON null.
func (NonNullInput[T]) MarshalJSON ¶
func (input NonNullInput[T]) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler and rejects an encoded JSON null.
func (*NonNullInput[T]) UnmarshalJSON ¶ added in v0.2.0
func (input *NonNullInput[T]) UnmarshalJSON(data []byte) error
UnmarshalJSON rejects null for a non-null mutation value.
type OperationCapabilities ¶
type OperationCapabilities struct {
Admin bool
Create bool
Read bool
ReadVersions bool
Update bool
Delete bool
Duplicate bool
Publish bool
Unpublish bool
RestoreDeleted bool
DeletePermanent bool
SelectAll bool
Unlock bool
}
OperationCapabilities is a non-secret permission summary. It deliberately excludes executable rules and filtered-access predicates.
type OperationError ¶
type OperationError = operationengine.Error
type PasswordPolicy ¶
type PasswordPolicy struct {
// MinLength is the minimum password length in Unicode code points. Zero
// defaults to 8.
MinLength int
// MaxBytes is the maximum UTF-8 encoded password length. Zero defaults to 72,
// bcrypt's safe input limit.
MaxBytes int
// BcryptCost controls bcrypt work. Zero uses bcrypt.DefaultCost. Increasing
// it transparently upgrades older hashes after a successful login. Values
// above 16 are rejected because they can make startup and login impractical.
BcryptCost int
// Validate adds application-specific password rules. Return a user-safe error
// explaining how the candidate must change.
Validate func(password string) error
}
PasswordPolicy controls the built-in local password strategy.
Ridu deliberately defaults to length-based validation instead of mandatory character classes. Applications needing breached-password checks or other product-specific rules can provide Validate; it executes only in the trusted Go runtime and is never serialized into the schema manifest.
type PasswordResetConfig ¶
type PasswordResetConfig struct {
// TokenDuration is the lifetime of a reset token. Zero defaults to one hour.
TokenDuration time.Duration
// Send delivers a newly issued token. It should enqueue or send the message
// before returning; returning an error prevents a success response.
Send func(context.Context, PasswordResetNotification) error
}
PasswordResetConfig configures password-recovery delivery.
type PasswordResetNotification ¶
type PasswordResetNotification struct {
Collection schema.CollectionSlug
User store.Document
Token string
ExpiresAt time.Time
}
PasswordResetNotification contains the secret needed to construct an application-owned reset link. Token is shown once and must never be logged.
type Plugin ¶
type Plugin interface {
Key() string
}
Plugin is compiled, trusted application code with a stable manifest key. Focused capability interfaces extend it without growing one universal bag of optional methods.
type PluginDatabaseAdapter ¶
type PluginDatabaseAdapter = schema.PluginDatabaseAdapter
PluginDatabaseAdapter identifies one database dialect supported by a plugin's exceptional private-schema contribution.
type PluginDatabaseContribution ¶
type PluginDatabaseContribution struct {
Adapter PluginDatabaseAdapter
Migrations []PluginMigration
Tables []string
}
PluginDatabaseContribution is one explicitly adapter-scoped private-schema bundle. It is an escape hatch for database features that cannot be modeled as ordinary Ridu collections or fields; its SQL is never treated as portable.
type PluginDescriptor ¶
type PluginDescriptor struct {
// Version is the plugin's complete semantic release without a leading v.
Version string
// GoPackage is the canonical import path that provides the plugin.
GoPackage string
// APIVersion must equal PluginAPIVersion for this Ridu release.
APIVersion uint32
// Ridu limits the framework releases allowed to compile this plugin.
Ridu RiduCompatibility
// Admin describes the optional statically bundled admin half.
Admin *AdminPluginMetadata
// FieldTypes maps every reusable plugin field to generated public types.
FieldTypes []PluginFieldType
// DatabaseContributions contains exceptional, adapter-specific private
// database state. Ordinary plugin data should be added as collections or
// fields through ConfigTransformer instead.
DatabaseContributions []PluginDatabaseContribution
}
PluginDescriptor is deterministic public metadata for one compiled plugin. It is copied into the canonical manifest so generators, migration planning, the admin build, and compatibility tooling all inspect the same declaration. Executable hooks, handlers, validators, and secrets never belong here.
type PluginEndpoint ¶
type PluginEndpoint struct {
// Method is an exact supported HTTP method such as GET or POST.
Method string
// Path is relative to the plugin's namespaced API prefix.
Path string
// Summary appears in generated OpenAPI.
Summary string
// MaxBodyBytes bounds the raw request body before Handler receives it. Zero
// inherits HandlerOptions.MaxBodyBytes; a negative value explicitly opts a
// trusted streaming endpoint out of that byte bound.
MaxBodyBytes int64
// Handler is trusted compiled endpoint code.
Handler PluginEndpointHandler
}
PluginEndpoint is one exact, method-specific HTTP endpoint. Path is relative to /api/plugins/<plugin-key>/ and must not contain traversal segments.
type PluginEndpointContext ¶
type PluginEndpointContext struct {
// Writer receives the endpoint response.
Writer http.ResponseWriter
// Request is the original namespaced HTTP request.
Request *http.Request
// ClientIP is the direct or trusted-forwarded client address resolved by
// the framework HTTP boundary. Authentication transports should use this
// value instead of interpreting forwarding headers independently.
ClientIP string
// Actor is the authenticated user, or nil for an anonymous request.
Actor *store.Document
// ActorCollection identifies the auth collection that owns Actor.
ActorCollection schema.CollectionSlug
// Local enters the same access-controlled operation engine as other APIs.
Local *LocalAPI
// AdmitAuthAttempt applies the application's distributed IP and identity
// admission policy. Authentication transports must call it before work that
// can be amplified by aliases or repeated requests.
AdmitAuthAttempt func(context.Context, string, string) error
// ReportError records a stable transport error code and sends trusted error
// detail to HandlerOptions.RequestError without exposing it to the client.
// Plugins that implement their own error envelopes should call this for
// internal failures. Passing nil records only Code in request observations.
ReportError func(error, string)
}
PluginEndpointContext exposes the authenticated actor and access-controlled local API while retaining ordinary net/http request and response contracts.
type PluginEndpointHandler ¶
type PluginEndpointHandler func(PluginEndpointContext)
PluginEndpointHandler handles one trusted compiled plugin endpoint.
type PluginFieldType ¶
type PluginFieldType struct {
// EmbeddedTypes lists tree.case selectors supplying ordered generic payload type arguments.
EmbeddedTypes []string `json:"embeddedTypes,omitempty"`
// Key matches the PluginField key stored in the schema manifest.
Key string
// TypeScriptPackage is the static import specifier exporting the named output,
// input, and where types. It may select a package export subpath.
TypeScriptPackage string
// TypeScriptOutput is the stored document value type export.
TypeScriptOutput string
// TypeScriptInput is the create and update value type export.
TypeScriptInput string
// TypeScriptWhere is the optional query operand type export.
TypeScriptWhere string
// GoPackage and GoType optionally name the generated Go model type.
GoPackage string
// GoType is an exported type in GoPackage; both Go fields are optional together.
GoType string
// JSONSchema is the deterministic OpenAPI 3.1 schema for one field value.
JSONSchema []byte
}
PluginFieldType gives generated contracts exact types for a plugin-owned field. TypeScript names are imported with `import type`; GoPackage and GoType are optional and fall back to encoding/json.RawMessage when omitted.
type PluginFieldValidationContext ¶
type PluginFieldValidationContext struct {
// Field is the resolved manifest definition owned by the plugin.
Field schema.Field
// RuntimePath identifies this concrete value occurrence. Unlike Field.Path,
// it includes array and block indexes and omits block schema discriminators.
RuntimePath string
// Value is the candidate document value to validate.
Value store.Value
}
PluginFieldValidationContext supplies a resolved plugin field and candidate value.
type PluginFieldValidator ¶
type PluginFieldValidator func(PluginFieldValidationContext) []schema.Issue
PluginFieldValidator returns path-aware issues for a plugin-owned value.
type PluginGeneratedArtifact ¶
PluginGeneratedArtifact is one deterministic, plugin-owned generated file. Name is scoped beneath the provider's plugin key; the portable CLI owns the project-relative destination and atomic installation of Content.
type PluginGenerationContext ¶
PluginGenerationContext supplies immutable schema state to a compiled plugin while the application project command is producing generated files. Generation runs without a store, storage backend, or network listener.
type PluginHookContribution ¶
type PluginHookContribution struct {
// Collection identifies the collection receiving Hooks.
Collection schema.CollectionSlug
// Hooks are appended after application-authored hooks.
Hooks CollectionHooks
}
PluginHookContribution appends resource hooks to one resolved collection. Contributions run in Config.Plugins order after application-authored hooks.
type PluginMigration ¶
type PluginMigration struct {
// Version starts at 1 and increments without gaps.
Version uint32
// Name is a stable lowercase kebab-case review label.
Name string
// UpSQL executes in order when entering Version.
UpSQL []string
// DownSQL executes in order when leaving Version.
DownSQL []string
}
PluginMigration is one contiguous, reversible adapter-specific transition. Version migrates from Version-1 to Version. Statements are copied into the immutable migration artifact and checksum-verified before execution.
type PluginTransport ¶
type PluginTransport struct {
Method string
Path string
Summary string
MaxBodyBytes int64
Handler PluginEndpointHandler
}
PluginTransport is one exact application-level HTTP transport. Unlike PluginEndpoint, Path is absolute and is not placed below a plugin namespace. It exists for established protocol locations such as /api/graphql, not for ordinary plugin REST endpoints.
type PluginTransportContext ¶
type PluginTransportContext struct {
Manifest schema.Manifest
Local *LocalAPI
// App exposes public authentication and other application-owned operations
// that do not belong to LocalAPI. It is fully initialized before binding.
App *App
}
PluginTransportContext binds one protocol transport to the fully resolved application runtime. The manifest is immutable and Local enters the same access-controlled operation engine as REST and jobs.
type PreviewBreakpoint ¶
type PreviewBreakpoint struct {
Name string
Label string
LabelTranslations map[string]string
Width int
Height int
}
PreviewBreakpoint is one named authoring viewport offered by live preview.
type PreviewToken ¶
type PreviewToken struct {
Token string
Resource string
Slug string
DocumentID string
ExpiresAt time.Time
}
PreviewToken is a short-lived, read-only credential scoped to one preview target. It is safe to hand to a separately deployed preview frontend instead of an admin session.
type ReadinessCheck ¶
ReadinessCheck verifies one required production dependency.
type ReconcileResult ¶
type ReconcileResult struct {
// Scanned is the number of stored objects inspected.
Scanned int
// Candidates is the number of unreferenced objects older than the safety window.
Candidates int
// Deleted is the number of unreferenced objects removed.
Deleted int
}
ReconcileResult summarizes an upload-storage reconciliation pass.
type RemoteUploadInput ¶
type RemoteUploadInput struct {
URL string
Data store.Values
Actor *store.Document
ActorCollection schema.CollectionSlug
Locale LocaleOptions
}
RemoteUploadInput identifies an HTTP(S) asset and its document metadata.
type RequestErrorEvent ¶
type RequestErrorEvent struct {
Time time.Time
RequestID string
Method string
Path string
Error error
Panic bool
Stack string
}
RequestErrorEvent carries trusted internal diagnostics. Error may contain dependency detail and must not be forwarded to an untrusted client.
type RequestObservation ¶
type RequestObservation struct {
// Time is when the observation was recorded.
Time time.Time
// RequestID correlates the observation with audit events and logs.
RequestID string
// Method is the HTTP request method.
Method string
// Path is the requested URL path.
Path string
// Status is the HTTP response status code.
Status int
// ErrorCode is the stable public Ridu code for a failed request.
ErrorCode string
// ResponseBytes is the number of response-body bytes written.
ResponseBytes int64
// Duration is the total handler execution time.
Duration time.Duration
}
RequestObservation contains transport-level timing and response metadata.
type RiduCompatibility ¶
type RiduCompatibility struct {
// Minimum is the oldest supported Ridu semantic version, inclusive.
Minimum string
// MaximumExclusive is the optional first unsupported Ridu version.
MaximumExclusive string
}
RiduCompatibility declares the supported framework-version interval. MaximumExclusive is optional; an empty maximum leaves the upper bound open.
type RootHooks ¶
type RootHooks struct {
// AfterError observes failures after resource error hooks, including failures
// before a collection or global could be identified. It cannot suppress them.
AfterError []Hook
}
RootHooks observes application-wide failures that may happen before a resource resolves.
type ServerOptions ¶
type ServerOptions struct {
ReadHeaderTimeout time.Duration
ReadTimeout time.Duration
WriteTimeout time.Duration
IdleTimeout time.Duration
MaxHeaderBytes int
ShutdownTimeout time.Duration
WorkerDrainTimeout time.Duration
ReadinessDrainDelay time.Duration
// AllowUnverifiableReadiness permits Execute with custom database or upload
// adapters that cannot prove readiness. It is an explicit production safety
// escape hatch; official adapters do not require it.
AllowUnverifiableReadiness bool
// SkipReadinessPreflight lets a development server bind before dependency
// verification. Its /readyz probe still checks database connectivity,
// storage, and custom checks, but permits an unapplied migration ledger
// while ridu dev owns non-destructive schema synchronization.
SkipReadinessPreflight bool
}
ServerOptions configures production socket bounds and graceful drain. Zero values use Ridu's conservative defaults; a negative timeout explicitly disables that individual bound for a known streaming requirement.
type StorageFactory ¶
StorageFactory lazily opens an object-storage adapter for upload bytes. It is runtime infrastructure, not a Plugin and never contributes secrets to the schema manifest. Execute closes a returned adapter before the document store when it implements Close() or Close() error.
type StoreFactory ¶
StoreFactory lazily opens the application's singular document-store adapter. Project commands never call it, which keeps schema discovery and generation independent from database connectivity. Execute closes a returned adapter at shutdown when it implements Close() or Close() error.
type TaskBackoff ¶
type TaskBackoff = store.TaskBackoff
type TaskContext ¶
type TaskContext struct {
Context context.Context
ID string
Attempt int
Local *LocalAPI
// contains filtered or unexported fields
}
TaskContext describes one leased attempt. Local is the same access, validation, hook, and transaction entry point used by HTTP and application code; tasks do not receive a privileged document path.
type TaskDefinition ¶
type TaskDefinition interface {
TaskSlug() string
// contains filtered or unexported methods
}
TaskDefinition is the non-generic configuration boundary used by Config. Only values returned by NewTask can implement it, so serialized input can never select or supply executable code.
type TaskEnqueueOptions ¶
type TaskEnqueueOptions struct {
RunAt time.Time
Queue string
ConcurrencyKey string
Target *store.DocumentReference
RequestedBy *store.DocumentReference
}
TaskEnqueueOptions schedules one future execution and optionally supplies a queue, concurrency key, target, and requesting identity. A concurrency key serializes active leases within its queue. Target/requester references are lifecycle-safe and are removed if either owning document is hard-deleted.
type TaskError ¶
type TaskError struct {
Code TaskErrorCode
Message string
Cause error
}
TaskError is a stable local boundary error.
type TaskErrorCode ¶
type TaskErrorCode string
TaskErrorCode is stable for local callers and persisted task failures.
const ( TaskErrorNotRegistered TaskErrorCode = "task_not_registered" TaskErrorInvalidInput TaskErrorCode = "task_input_invalid" TaskErrorInvalidOutput TaskErrorCode = "task_output_invalid" TaskErrorNotFound TaskErrorCode = "task_not_found" TaskErrorStoreFailed TaskErrorCode = "task_store_failed" TaskErrorLeaseLost TaskErrorCode = "task_lease_lost" )
type TaskHandler ¶
type TaskHandler[Input, Output any] func(TaskContext, Input) (Output, error)
TaskHandler receives typed data and a request-scoped view of the ordinary local operation engine. Handlers must honor Context cancellation. They may be invoked more than once after a process crash or lease expiry and must therefore make external side effects idempotent.
type TaskOption ¶
type TaskOption func(*taskConfig)
TaskOption configures persisted execution policy or runtime-only admission recovery for one compiled task definition.
func TaskAdmissionReconciler ¶
func TaskAdmissionReconciler(reconcile TaskReconciler) TaskOption
TaskAdmissionReconciler registers recovery for a domain commit-to-enqueue gap. It is runtime-only and is never serialized into the schema manifest or persisted task records.
func TaskQueue ¶
func TaskQueue(queue string) TaskOption
TaskQueue selects the default worker queue for this task definition.
func TaskRetention ¶
func TaskRetention(retention time.Duration) TaskOption
TaskRetention controls how long terminal task status/output remains inspectable before bounded worker pruning removes it.
func TaskRetries ¶
func TaskRetries(maxAttempts int, delay, maxDelay time.Duration, backoff TaskBackoff) TaskOption
TaskRetries configures total attempts and deterministic retry delay. The first attempt counts toward maxAttempts. maxDelay caps linear/exponential growth and must be at least delay.
func TaskTimeout ¶
func TaskTimeout(timeout time.Duration) TaskOption
TaskTimeout limits one handler attempt. Cancellation is cooperative, as it is for ordinary Go contexts; a handler that ignores Context can delay drain.
type TaskReceipt ¶
TaskReceipt is the stable typed handle returned after durable admission.
type TaskReconciler ¶
TaskReconciler repairs durable application state that should have admitted a task but may have missed enqueueing it because the process stopped after the state commit. It runs before every task claim cycle, including Execute's first worker cycle. Implementations must be bounded, idempotent, and safe to run concurrently in multiple application instances.
type TaskResult ¶
type TaskResult[Output any] struct { ID string Slug string Queue string State store.TaskState Attempts int MaxAttempts int LastErrorCode string LastError string CreatedAt time.Time UpdatedAt time.Time CompletedAt *time.Time Output Output HasOutput bool }
TaskResult is a typed local status view. HasOutput distinguishes a valid zero/null output from a task that has not succeeded.
type TaskRunSummary ¶
type TaskRunSummary struct {
Claimed int
Succeeded int
Retried int
Failed int
Released int
Pruned int
}
TaskRunSummary describes one bounded claim cycle. Handler failures are persisted as retry/dead-letter state and do not become infrastructure errors.
type TransportProvider ¶
type TransportProvider interface {
Plugin
BindTransports(PluginTransportContext) ([]PluginTransport, error)
}
TransportProvider binds an optional compiled protocol after the manifest and operation engine are ready. Binding happens once during New; transports must not lazily rebuild schema state per request.
type TypedAllLocalesCollection ¶ added in v0.2.0
type TypedAllLocalesCollection[Document any] struct { // contains filtered or unexported fields }
TypedAllLocalesCollection binds the generated all-locales output model. Ordinary single-locale reads and writes use TypedCollection.
func NewTypedAllLocalesCollection ¶ added in v0.2.0
func NewTypedAllLocalesCollection[Document any](slug string) TypedAllLocalesCollection[Document]
NewTypedAllLocalesCollection constructs an all-locales generated read definition.
func (TypedAllLocalesCollection[Document]) With ¶ added in v0.2.0
func (definition TypedAllLocalesCollection[Document]) With(local *LocalAPI) BoundTypedAllLocalesCollection[Document]
With binds the generated all-locales definition to the operation engine.
type TypedAllLocalesGlobal ¶ added in v0.2.0
type TypedAllLocalesGlobal[Document any] struct { // contains filtered or unexported fields }
TypedAllLocalesGlobal binds a generated global model with localized value maps. Ordinary single-locale reads and writes use TypedGlobal.
func NewTypedAllLocalesGlobal ¶ added in v0.2.0
func NewTypedAllLocalesGlobal[Document any](slug string) TypedAllLocalesGlobal[Document]
NewTypedAllLocalesGlobal constructs an all-locales generated global definition.
func (TypedAllLocalesGlobal[Document]) With ¶ added in v0.2.0
func (definition TypedAllLocalesGlobal[Document]) With(local *LocalAPI) BoundTypedAllLocalesGlobal[Document]
With binds the generated all-locales global definition to the operation engine.
type TypedCollection ¶
type TypedCollection[Document, Create, Update any] struct { // contains filtered or unexported fields }
TypedCollection is a generated collection definition that can be bound to an application's LocalAPI. It adds compile-time application models without creating a privileged data path.
func NewTypedCollection ¶
func NewTypedCollection[Document, Create, Update any](slug string) TypedCollection[Document, Create, Update]
NewTypedCollection constructs a generated typed collection definition.
func (TypedCollection[Document, Create, Update]) Slug ¶
func (collection TypedCollection[Document, Create, Update]) Slug() string
Slug returns the collection's public API address.
func (TypedCollection[Document, Create, Update]) With ¶
func (collection TypedCollection[Document, Create, Update]) With(local *LocalAPI) BoundTypedCollection[Document, Create, Update]
With binds a generated collection definition to a running application.
type TypedGlobal ¶
type TypedGlobal[Document, Update any] struct { // contains filtered or unexported fields }
TypedGlobal is a generated singleton definition that can be bound to an application's LocalAPI without creating a privileged data path.
func NewTypedGlobal ¶
func NewTypedGlobal[Document, Update any](slug string) TypedGlobal[Document, Update]
NewTypedGlobal constructs a generated typed global definition.
func (TypedGlobal[Document, Update]) Slug ¶
func (global TypedGlobal[Document, Update]) Slug() string
Slug returns the global's public API address.
func (TypedGlobal[Document, Update]) With ¶
func (global TypedGlobal[Document, Update]) With(local *LocalAPI) BoundTypedGlobal[Document, Update]
With binds a generated global definition to a running application.
type TypedListOptions ¶
type TypedListOptions struct {
// Where filters documents before pagination and remains atomic with access predicates.
Where query.Expression
// Page is the one-based result page. Zero selects the first page.
Page int
// Limit is the maximum documents returned per page.
Limit int
// Sort orders results by authored field paths.
Sort []query.Sort
// TrashOnly returns deleted documents and is valid only for trash-enabled collections.
TrashOnly bool
// Draft explicitly includes draft documents when true or restricts reads to
// published documents when false. Nil preserves the Local API default.
Draft *bool
// Select restricts returned document fields.
Select []query.Path
// Populate expands configured relationship paths.
Populate []query.Population
// OutputFields limits computed and inverse-join resolution without
// projecting away stored fields. Nil resolves all output fields; a non-nil
// empty slice resolves none.
OutputFields []query.Path
// Actor is the authenticated document used by access rules.
Actor *store.Document
// ActorCollection identifies the exact auth collection that owns Actor.
ActorCollection schema.CollectionSlug
// Locale selects one configured content locale. Empty uses the application default.
Locale schema.LocaleCode
// FallbackLocales replaces the locale's configured fallback chain when non-nil.
FallbackLocales []schema.LocaleCode
// DisableFallback requires an exact value in Locale.
DisableFallback bool
}
TypedListOptions controls a populated list without changing the binding's single-locale or all-locales document shape. Nil Select preserves all fields; an explicitly empty Select returns only document metadata.
type TypedLocaleOptions ¶ added in v0.2.0
type TypedLocaleOptions struct {
Locale schema.LocaleCode
FallbackLocales []schema.LocaleCode
DisableFallback bool
}
TypedLocaleOptions selects one authoring locale without changing the generated write response into an all-locales document.
type TypedReadOptions ¶ added in v0.2.0
type TypedReadOptions struct {
// Draft explicitly includes draft documents when true or restricts reads to
// published documents when false. Nil preserves the Local API default.
Draft *bool
// Select restricts returned document fields.
Select []query.Path
// Populate expands configured relationship paths.
Populate []query.Population
// OutputFields limits computed and inverse-join resolution without
// projecting away stored fields. Nil resolves all output fields; a non-nil
// empty slice resolves none.
OutputFields []query.Path
// Actor is the authenticated document used by access rules.
Actor *store.Document
// ActorCollection identifies the exact auth collection that owns Actor.
ActorCollection schema.CollectionSlug
// Locale selects one configured content locale. Empty uses the application default.
Locale schema.LocaleCode
// FallbackLocales replaces the locale's configured fallback chain when non-nil.
FallbackLocales []schema.LocaleCode
// DisableFallback requires an exact value in Locale.
DisableFallback bool
}
TypedReadOptions controls population/projection without changing the generated definition's single-locale or all-locales output shape.
type TypedTask ¶
type TypedTask[Input, Output any] struct { // contains filtered or unexported fields }
TypedTask is one compiled, typed task definition. Add it to Config.Tasks, then use Enqueue, Result, and Cancel from trusted application code.
func NewTask ¶
func NewTask[Input, Output any](slug string, handler TaskHandler[Input, Output], options ...TaskOption) TypedTask[Input, Output]
NewTask defines a compiled task handler. Validation is deterministic during Resolve/New so the constructor remains convenient in ordinary Go config.
func (TypedTask[Input, Output]) Cancel ¶
Cancel atomically prevents a queued task from starting and fences a running attempt so its later heartbeat/completion cannot win.
func (TypedTask[Input, Output]) Enqueue ¶
func (task TypedTask[Input, Output]) Enqueue(ctx context.Context, application *App, input Input, options TaskEnqueueOptions) (TaskReceipt[Output], error)
Enqueue validates and durably stores typed input. The task must be the same slug/type contract registered in the running application's Config.Tasks.
type UpdateUploadImageInput ¶
type UpdateUploadImageInput struct {
// FocalX is the horizontal focal coordinate from 0 (left) to 100 (right).
FocalX float64
// FocalY is the vertical focal coordinate from 0 (top) to 100 (bottom).
FocalY float64
// CropX and CropY are the top-left of an optional normalized crop rectangle.
CropX float64
CropY float64
// CropWidth and CropHeight are zero to clear the crop, otherwise each must
// be positive and the rectangle must remain within the original image.
CropWidth float64
CropHeight float64
// ExpectedRevision rejects changes based on a stale document revision.
ExpectedRevision int
// Actor is the authenticated document used by read and update access rules.
Actor *store.Document
// ActorCollection identifies the exact auth collection that owns Actor.
ActorCollection schema.CollectionSlug
}
UpdateUploadImageInput controls focal-point-aware regeneration of an image upload's configured variants.
type UploadConfig ¶
type UploadConfig struct {
// MaxFileSize is the maximum accepted upload size in bytes. Zero uses the
// framework default; values above 256 MiB are rejected so one request cannot
// bypass the process-wide upload work budget.
MaxFileSize int64
// MimeTypes restricts uploads to the listed media types. Empty accepts any supported type.
MimeTypes []string
// Private requires authorized delivery instead of exposing storage objects publicly.
Private bool
// ImageSizes declares derived image variants generated from supported image uploads.
ImageSizes []ImageSize
}
UploadConfig controls validation and storage behavior for an upload collection.
type UploadInput ¶
type UploadInput struct {
// Filename is the original client-supplied file name.
Filename string
// Reader provides the uploaded bytes.
Reader io.Reader
// Data contains application-owned upload document fields.
Data store.Values
// Actor is the authenticated document used by access rules.
Actor *store.Document
// ActorCollection identifies the exact auth collection that owns Actor.
ActorCollection schema.CollectionSlug
// Locale selects the content locale for application-owned upload metadata.
Locale LocaleOptions
}
UploadInput contains a file and document metadata for an upload operation.
type VerifyEmailConfig ¶
type VerifyEmailConfig struct {
// TokenDuration is the lifetime of a verification token. Zero defaults to 24 hours.
TokenDuration time.Duration
// Send delivers a newly issued verification token.
Send func(context.Context, VerifyEmailNotification) error
}
VerifyEmailConfig configures mandatory identity verification.
type VerifyEmailNotification ¶
type VerifyEmailNotification struct {
Collection schema.CollectionSlug
User store.Document
Token string
ExpiresAt time.Time
}
VerifyEmailNotification contains the secret needed to construct an application-owned verification link. Token is shown once and must not be logged.
type VersionConfig ¶
type VersionConfig struct {
// Drafts allows unpublished document states.
Drafts bool
// MaxPerDocument limits retained revisions per document. Zero uses the framework default.
MaxPerDocument int
// AutosaveInterval controls draft autosave frequency. Zero disables autosave.
AutosaveInterval time.Duration
}
VersionConfig controls revision and draft behavior for a versioned collection.
Source Files
¶
- access.go
- account.go
- adapters.go
- app.go
- auth.go
- auth_contract.go
- auth_maintenance.go
- block_registry.go
- config.go
- doc.go
- endpoint.go
- execute.go
- field_graph.go
- field_graph_runtime.go
- generation.go
- hook.go
- http.go
- input.go
- local.go
- localization.go
- locks.go
- password_work.go
- plugin.go
- preferences.go
- preview.go
- publishing.go
- resource_hook_validation.go
- task.go
- transaction_cleanup.go
- typed_global.go
- typed_local.go
- typed_read.go
- uploads.go
- version.go