protocol

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package protocol defines stable JSON envelopes shared by Ridu's HTTP API, generated TypeScript contracts, Fetch SDK, and admin.

Index

Constants

View Source
const AdminPreparedRouteStateMediaType = "application/vnd.ridu.admin-route-state+json"
View Source
const AdminPreparedRouteStateVersion uint32 = 1

AdminPreparedRouteStateVersion is the browser bootstrap snapshot contract.

View Source
const CurrentVersion uint32 = 1

CurrentVersion is the framework wire-protocol version. It changes independently from the schema manifest and project-command protocols.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIKey

type APIKey struct {
	ID        string `json:"id"`
	Name      string `json:"name"`
	Key       string `json:"key"`
	CreatedAt string `json:"createdAt"`
	ExpiresAt string `json:"expiresAt,omitempty"`
}

APIKey contains a newly generated bearer secret. Key is emitted only once.

type APIKeyEnvelope

type APIKeyEnvelope struct {
	APIKey APIKey `json:"apiKey"`
}

APIKeyEnvelope returns a newly minted API key.

type APIKeyInfo

type APIKeyInfo struct {
	ID         string `json:"id"`
	Name       string `json:"name"`
	CreatedAt  string `json:"createdAt"`
	LastUsedAt string `json:"lastUsedAt,omitempty"`
	ExpiresAt  string `json:"expiresAt,omitempty"`
}

APIKeyInfo is safe metadata for an existing API key.

type APIKeysEnvelope

type APIKeysEnvelope struct {
	APIKeys []APIKeyInfo `json:"apiKeys"`
}

APIKeysEnvelope lists safe API key metadata.

type AccessCapabilitiesEnvelope

type AccessCapabilitiesEnvelope struct {
	Operations  OperationCapabilities                   `json:"operations"`
	Fields      map[string]FieldCapabilities            `json:"fields"`
	BlockFields map[string]map[string]FieldCapabilities `json:"blockFields,omitempty"`
}

AccessCapabilitiesEnvelope carries the evaluated access state for the current actor and optional document/input snapshot. A field of a block definition has Fields entries at its located values and at each placement holding them; at any other placement, such as a row the client has yet to add, BlockFields gives its capabilities by block slug and definition-relative path.

type AdminCollectionListCountV1 added in v0.3.0

type AdminCollectionListCountV1 struct {
	Value *int          `json:"value,omitempty"`
	Error *ErrorPayload `json:"error,omitempty"`
}

type AdminCollectionListDataV1 added in v0.3.0

type AdminCollectionListDataV1 struct {
	Query       AdminCollectionListQueryV1            `json:"query"`
	Page        *AdminCollectionListPageV1            `json:"page,omitempty"`
	Counts      map[string]AdminCollectionListCountV1 `json:"counts"`
	Preferences *AdminCollectionListPreferencesV1     `json:"preferences,omitempty"`
}

AdminCollectionListDataV1 is the list read model, independent of SDK method names. Counts contains only the status counts read by this response.

type AdminCollectionListPageV1 added in v0.3.0

type AdminCollectionListPageV1 struct {
	Value *CollectionPageEnvelope[json.RawMessage] `json:"value,omitempty"`
	Error *ErrorPayload                            `json:"error,omitempty"`
}

type AdminCollectionListPreferenceV1 added in v0.3.0

type AdminCollectionListPreferenceV1 struct {
	Value json.RawMessage `json:"value,omitempty"`
	Error *ErrorPayload   `json:"error,omitempty"`
}

type AdminCollectionListPreferencesV1 added in v0.3.0

type AdminCollectionListPreferencesV1 struct {
	Workspace AdminCollectionListPreferenceV1 `json:"workspace"`
	Presets   AdminCollectionListPreferenceV1 `json:"presets"`
}

type AdminCollectionListQueryV1 added in v0.3.0

type AdminCollectionListQueryV1 struct {
	Where      json.RawMessage `json:"where,omitempty"`
	CountWhere json.RawMessage `json:"countWhere,omitempty"`
	Locale     string          `json:"locale,omitempty"`
	Trash      bool            `json:"trash"`
}

type AdminCreateDataV1 added in v0.3.0

type AdminCreateDataV1 struct {
	Values map[string]any                                `json:"values"`
	Access AdminReadResultV1[AccessCapabilitiesEnvelope] `json:"access"`
}

type AdminDocumentDataV1 added in v0.3.0

type AdminDocumentDataV1 struct {
	Document AdminReadResultV1[json.RawMessage]            `json:"document"`
	Access   AdminReadResultV1[AccessCapabilitiesEnvelope] `json:"access"`
}

type AdminPreparedNavigationV1 added in v0.3.0

type AdminPreparedNavigationV1 struct {
	CollectionOperations map[string]OperationCapabilities `json:"collectionOperations"`
	GlobalOperations     map[string]OperationCapabilities `json:"globalOperations"`
	ContentLocale        string                           `json:"contentLocale,omitempty"`
}

AdminPreparedNavigationV1 contains the runtime values resolved for each route. Locale and capabilities can change without changing the identity context.

type AdminPreparedRouteDataV1 added in v0.3.0

type AdminPreparedRouteDataV1 struct {
	Kind     AdminPreparedRouteKindV1                       `json:"kind"`
	Data     *AdminCollectionListDataV1                     `json:"data,omitempty"`
	Document *AdminDocumentDataV1                           `json:"document,omitempty"`
	Create   *AdminCreateDataV1                             `json:"create,omitempty"`
	Versions *AdminVersionsDataV1                           `json:"versions,omitempty"`
	Access   *AdminReadResultV1[AccessCapabilitiesEnvelope] `json:"access,omitempty"`
	Security *AdminSecurityDataV1                           `json:"security,omitempty"`
}

type AdminPreparedRouteDiagnosticV1 added in v0.3.0

type AdminPreparedRouteDiagnosticV1 struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

type AdminPreparedRouteKindV1 added in v0.3.0

type AdminPreparedRouteKindV1 string
const (
	AdminPreparedRouteLogin              AdminPreparedRouteKindV1 = "login"
	AdminPreparedRouteSetup              AdminPreparedRouteKindV1 = "setup"
	AdminPreparedRouteDashboard          AdminPreparedRouteKindV1 = "dashboard"
	AdminPreparedRouteCustom             AdminPreparedRouteKindV1 = "custom"
	AdminPreparedRouteCollectionList     AdminPreparedRouteKindV1 = "collection-list"
	AdminPreparedRouteCollectionTrash    AdminPreparedRouteKindV1 = "collection-trash"
	AdminPreparedRouteCollectionCreate   AdminPreparedRouteKindV1 = "collection-create"
	AdminPreparedRouteCollectionDocument AdminPreparedRouteKindV1 = "collection-document"
	AdminPreparedRouteCollectionAPI      AdminPreparedRouteKindV1 = "collection-api"
	AdminPreparedRouteCollectionVersions AdminPreparedRouteKindV1 = "collection-versions"
	AdminPreparedRouteGlobalVersions     AdminPreparedRouteKindV1 = "global-versions"
	AdminPreparedRouteUpload             AdminPreparedRouteKindV1 = "upload"
	AdminPreparedRouteGlobalDocument     AdminPreparedRouteKindV1 = "global-document"
	AdminPreparedRouteGlobalAPI          AdminPreparedRouteKindV1 = "global-api"
	AdminPreparedRouteAccount            AdminPreparedRouteKindV1 = "account"
	AdminPreparedRouteSecurity           AdminPreparedRouteKindV1 = "security"
	AdminPreparedRouteNotFound           AdminPreparedRouteKindV1 = "not-found"
	AdminPreparedRouteError              AdminPreparedRouteKindV1 = "error"
)

type AdminPreparedRouteOutcomeV1 added in v0.3.0

type AdminPreparedRouteOutcomeV1 string
const (
	AdminPreparedRoutePrepared AdminPreparedRouteOutcomeV1 = "prepared"
	AdminPreparedRouteRedirect AdminPreparedRouteOutcomeV1 = "redirect"
	AdminPreparedRouteReload   AdminPreparedRouteOutcomeV1 = "reload"
	AdminPreparedRouteFallback AdminPreparedRouteOutcomeV1 = "fallback"
)

type AdminPreparedRouteStateV1 added in v0.3.0

type AdminPreparedRouteStateV1 struct {
	Version  uint32                      `json:"version"`
	Outcome  AdminPreparedRouteOutcomeV1 `json:"outcome"`
	Pathname string                      `json:"pathname"`
	Search   string                      `json:"search"`
	// ContextKey binds reusable runtime state to the resolved identity, manifest,
	// session and admin build. Fingerprint additionally binds it to this route.
	ContextKey  string `json:"contextKey"`
	Fingerprint string `json:"fingerprint"`
	// BuildID identifies the static bootstrap contract used to prepare this response.
	BuildID      string                                        `json:"buildId"`
	ModuleGroups []string                                      `json:"moduleGroups"`
	Runtime      *AdminPreparedRuntimeV1                       `json:"runtime,omitempty"`
	Navigation   *AdminPreparedNavigationV1                    `json:"navigation,omitempty"`
	Route        *AdminPreparedRouteDataV1                     `json:"route,omitempty"`
	Loaders      map[string]AdminReadResultV1[json.RawMessage] `json:"loaders,omitempty"`
	Location     string                                        `json:"location,omitempty"`
	Diagnostic   *AdminPreparedRouteDiagnosticV1               `json:"diagnostic,omitempty"`
}

type AdminPreparedRuntimeV1 added in v0.3.0

type AdminPreparedRuntimeV1 struct {
	AdminPreparedNavigationV1
	Session       *AuthSession[json.RawMessage] `json:"session,omitempty"`
	AuthBootstrap bool                          `json:"authBootstrapAvailable"`
	Theme         string                        `json:"theme"`
	AdminLanguage string                        `json:"adminLanguage,omitempty"`
	AdminTimeZone string                        `json:"adminTimeZone,omitempty"`
	Preferences   map[string]json.RawMessage    `json:"preferences"`
	Manifest      schema.Snapshot               `json:"manifest"`
	// EncodedManifest optionally carries the canonical encoding of Manifest. A
	// server presenting an immutable manifest encodes it once and reuses the
	// bytes for every response; it is never decoded and must encode Manifest.
	EncodedManifest json.RawMessage `json:"-"`
}

AdminPreparedRuntimeV1 is the complete safe global admin bootstrap. It never contains credentials, access predicates, executable hooks, or lock state.

func (AdminPreparedRuntimeV1) MarshalJSON added in v0.15.0

func (runtime AdminPreparedRuntimeV1) MarshalJSON() ([]byte, error)

MarshalJSON writes EncodedManifest in place of encoding Manifest again.

type AdminReadResultV1 added in v0.3.0

type AdminReadResultV1[Value any] struct {
	Value *Value        `json:"value,omitempty"`
	Error *ErrorPayload `json:"error,omitempty"`
}

AdminReadResultV1 preserves independent read failures inside a prepared page. Exactly one of Value or Error is present; it is not an SDK request transcript.

type AdminSecurityDataV1 added in v0.3.0

type AdminSecurityDataV1 struct {
	Sessions AdminReadResultV1[[]AuthSessionInfo] `json:"sessions"`
	APIKeys  AdminReadResultV1[[]APIKeyInfo]      `json:"apiKeys"`
}

type AdminVersionsDataV1 added in v0.3.0

type AdminVersionsDataV1 struct {
	History  AdminReadResultV1[[]DocumentVersion[json.RawMessage]] `json:"history"`
	Detail   *AdminReadResultV1[DocumentVersion[json.RawMessage]]  `json:"detail,omitempty"`
	Document AdminDocumentDataV1                                   `json:"document"`
}

type AuthActionEnvelope

type AuthActionEnvelope struct {
	Success bool `json:"success"`
}

AuthActionEnvelope acknowledges a recovery or verification operation without disclosing whether an identity exists.

type AuthBootstrapEnvelope

type AuthBootstrapEnvelope struct {
	Available bool `json:"available"`
}

AuthBootstrapEnvelope reports whether the configured admin-user collection can still accept its one anonymous first-user initialization.

type AuthSession

type AuthSession[User any] struct {
	// ID is the safe, non-secret identifier used for session management.
	ID string `json:"id"`
	// Collection is the auth-enabled collection that owns the user identity.
	Collection string `json:"collection"`
	// User is the current authenticated document.
	User User `json:"user"`
	// ExpiresAt is the session's RFC 3339 expiry timestamp.
	ExpiresAt string `json:"expiresAt"`
}

AuthSession contains framework-level session metadata and a typed user.

type AuthSessionInfo

type AuthSessionInfo struct {
	ID         string `json:"id"`
	CreatedAt  string `json:"createdAt"`
	LastSeenAt string `json:"lastSeenAt"`
	ExpiresAt  string `json:"expiresAt"`
	IPAddress  string `json:"ipAddress,omitempty"`
	UserAgent  string `json:"userAgent,omitempty"`
	Current    bool   `json:"current"`
}

AuthSessionInfo is safe device/session metadata. It never exposes a bearer token or token digest.

type AuthSessionsEnvelope

type AuthSessionsEnvelope struct {
	Sessions []AuthSessionInfo `json:"sessions"`
}

AuthSessionsEnvelope lists the current user's active sessions.

type BulkEnvelope

type BulkEnvelope[Document any] struct {
	Docs []Document `json:"docs"`
}

BulkEnvelope contains the documents changed by one atomic bulk operation.

type CollectionPageAccess added in v0.3.0

type CollectionPageAccess struct {
	Collection AccessCapabilitiesEnvelope            `json:"collection"`
	Documents  map[string]AccessCapabilitiesEnvelope `json:"documents"`
}

CollectionPageAccess carries list-scoped access capabilities for the collection and every document returned in the page.

type CollectionPageEnvelope added in v0.3.0

type CollectionPageEnvelope[Document any] struct {
	Docs       []Document           `json:"docs"`
	Pagination Pagination           `json:"pagination"`
	Access     CollectionPageAccess `json:"access"`
}

CollectionPageEnvelope enriches one collection page with access metadata when the caller explicitly requests it.

type CollectionSelectionEnvelope

type CollectionSelectionEnvelope struct {
	Items     []CollectionSelectionItem `json:"items"`
	TotalDocs int                       `json:"totalDocs"`
}

CollectionSelectionEnvelope contains one complete bounded selection.

type CollectionSelectionInput

type CollectionSelectionInput struct {
	Where json.RawMessage `json:"where,omitempty"`
	Trash bool            `json:"trash,omitempty"`
}

CollectionSelectionInput carries the active list predicate to the bounded server-owned selection resolver.

type CollectionSelectionItem

type CollectionSelectionItem struct {
	ID     string                     `json:"id"`
	Access AccessCapabilitiesEnvelope `json:"access"`
}

CollectionSelectionItem freezes one read-visible ID and the capabilities used only to present its available authoring actions.

type CountEnvelope

type CountEnvelope struct {
	TotalDocs int `json:"totalDocs"`
}

CountEnvelope is the exact cardinality after caller and access filters.

type DeleteEnvelope

type DeleteEnvelope struct {
	ID      string `json:"id"`
	Deleted bool   `json:"deleted"`
}

DeleteEnvelope confirms a document deletion.

type DocumentEnvelope

type DocumentEnvelope[Document any] struct {
	Doc Document `json:"doc"`
}

DocumentEnvelope contains one typed document.

type DocumentLock

type DocumentLock struct {
	DocumentID string `json:"documentId"`
	OwnerID    string `json:"ownerId"`
	OwnerLabel string `json:"ownerLabel"`
	CreatedAt  string `json:"createdAt"`
	UpdatedAt  string `json:"updatedAt"`
	ExpiresAt  string `json:"expiresAt"`
}

DocumentLock is the safe author identity and lease metadata shown in the admin.

type DocumentLockEnvelope

type DocumentLockEnvelope struct {
	Lock        *DocumentLock `json:"lock"`
	Owned       bool          `json:"owned"`
	Acquired    bool          `json:"acquired"`
	CanTakeOver bool          `json:"canTakeOver"`
}

DocumentLockEnvelope carries the current lock and current-actor capabilities.

type DocumentVersion added in v0.3.0

type DocumentVersion[Document any] struct {
	ID         string
	DocumentID string
	Revision   int
	Status     string
	Snapshot   Document
	CreatedAt  string
}

type ErrorCode

type ErrorCode string

ErrorCode is a stable machine-readable failure category.

const (
	ErrorValidation          ErrorCode = "validation"
	ErrorAccess              ErrorCode = "access_denied"
	ErrorNotFound            ErrorCode = "not_found"
	ErrorConflict            ErrorCode = "conflict"
	ErrorDeleteRestricted    ErrorCode = "delete_restricted"
	ErrorBadRequest          ErrorCode = "bad_request"
	ErrorInternal            ErrorCode = "internal"
	ErrorRateLimited         ErrorCode = "rate_limited"
	ErrorEmailNotVerified    ErrorCode = "email_not_verified"
	ErrorAuthFeatureDisabled ErrorCode = "auth_feature_disabled"
	ErrorInvalidAuthToken    ErrorCode = "invalid_auth_token"
	// ErrorInvalidCredential rejects an explicit Authorization credential. It is
	// distinct from access_denied so clients can discard a stored token without
	// mistaking an ordinary authorization failure for a lost session.
	ErrorInvalidCredential ErrorCode = "invalid_credential"
	// ErrorRejected reports a hook's deliberate refusal. Its message is written
	// for the person who made the request.
	ErrorRejected            ErrorCode = "rejected"
	ErrorInvalidPreviewToken ErrorCode = "invalid_preview_token"
	ErrorSelectionTooLarge   ErrorCode = "selection_too_large"
)

type ErrorEnvelope

type ErrorEnvelope struct {
	Error ErrorPayload `json:"error"`
}

ErrorEnvelope is returned for every failed HTTP operation.

type ErrorPayload

type ErrorPayload struct {
	Code      ErrorCode         `json:"code"`
	Status    int               `json:"status"`
	Message   string            `json:"message"`
	RequestID string            `json:"requestId,omitempty"`
	Issues    []ValidationIssue `json:"issues"`
	Details   json.RawMessage   `json:"details,omitempty"`
}

ErrorPayload is the stable structured error carried by ErrorEnvelope.

type FieldCapabilities

type FieldCapabilities struct {
	Read   bool `json:"read"`
	Create bool `json:"create"`
	Update bool `json:"update"`
}

FieldCapabilities summarizes field visibility and write access. Keys in an AccessCapabilitiesEnvelope's Fields are canonical or concrete runtime field paths.

type JoinMutationEnvelope

type JoinMutationEnvelope[Document any] struct {
	Doc     Document `json:"doc"`
	Added   int      `json:"added"`
	Removed int      `json:"removed"`
}

JoinMutationEnvelope reports the refreshed source and applied target deltas.

type JoinMutationInput

type JoinMutationInput struct {
	Additions []string `json:"additions"`
	Removals  []string `json:"removals"`
}

JoinMutationInput carries explicit inverse-relation deltas. It deliberately does not imply that the caller loaded the complete relationship set.

type LiveValidationEmbeddedScope added in v0.2.0

type LiveValidationEmbeddedScope struct {
	Field       string       `json:"field"`
	TreeKey     string       `json:"treeKey"`
	CaseTag     string       `json:"caseTag"`
	VariantSlug string       `json:"variantSlug"`
	Identity    string       `json:"identity"`
	Data        store.Values `json:"data"`
}

LiveValidationEmbeddedScope selects a declared plugin payload being edited before Apply. Chained field paths are relative to the previous payload. Identity is the item's ordinary stable key, never an internal occurrence ID.

type LiveValidationEnvelope added in v0.2.0

type LiveValidationEnvelope struct {
	Evaluations []LiveValidationEvaluation `json:"evaluations"`
}

LiveValidationEnvelope carries advisory feedback, not authorization or a promise that a future save will pass authoritative validation.

type LiveValidationEvaluation added in v0.2.0

type LiveValidationEvaluation struct {
	Path   string            `json:"path"`
	Target string            `json:"target,omitempty"`
	Status string            `json:"status"`
	Issues []ValidationIssue `json:"issues"`
}

LiveValidationEvaluation distinguishes a completed check from unavailable typed input. A skipped check makes no claim that the input is valid.

type LiveValidationRequest added in v0.2.0

type LiveValidationRequest struct {
	// ID selects an existing collection document. Global requests must omit it.
	ID string `json:"id,omitempty"`
	// Draft defers editorial completeness checks, never structural validation.
	Draft    *bool                         `json:"draft,omitempty"`
	Data     store.Values                  `json:"data"`
	Fields   []string                      `json:"fields"`
	Embedded []LiveValidationEmbeddedScope `json:"embedded,omitempty"`
}

LiveValidationRequest asks for explicitly enabled advisory checks of an unsaved snapshot. It cannot save, initialize defaults or run mutation hooks. Field paths refer to the submitted snapshot and are validated by the server.

type LoginRequest added in v0.4.0

type LoginRequest struct {
	Email     string           `json:"email"`
	Password  string           `json:"password"`
	Transport SessionTransport `json:"transport,omitempty"`
}

LoginRequest authenticates one auth-collection identity.

type LogoutEnvelope

type LogoutEnvelope struct {
	LoggedOut bool `json:"loggedOut"`
}

LogoutEnvelope confirms that the current session was cleared.

type OperationCapabilities

type OperationCapabilities struct {
	Admin           bool `json:"admin"`
	Create          bool `json:"create"`
	Read            bool `json:"read"`
	ReadVersions    bool `json:"readVersions"`
	Update          bool `json:"update"`
	Delete          bool `json:"delete"`
	Duplicate       bool `json:"duplicate"`
	Publish         bool `json:"publish"`
	Unpublish       bool `json:"unpublish"`
	RestoreDeleted  bool `json:"restoreDeleted"`
	DeletePermanent bool `json:"deletePermanent"`
	SelectAll       bool `json:"selectAll"`
}

OperationCapabilities is a non-secret summary of operations the current actor may attempt for one resource or document. It never contains access predicates or executable authorization rules.

type PageEnvelope

type PageEnvelope[Document any] struct {
	Docs       []Document `json:"docs"`
	Pagination Pagination `json:"pagination"`
}

PageEnvelope contains one page of typed documents.

type Pagination

type Pagination struct {
	Page        int  `json:"page"`
	Limit       int  `json:"limit"`
	TotalDocs   *int `json:"totalDocs,omitempty"`
	TotalPages  *int `json:"totalPages,omitempty"`
	HasNextPage bool `json:"hasNextPage"`
	HasPrevPage bool `json:"hasPrevPage"`
}

Pagination contains stable page metadata independent of a document type. HasNextPage is always exact. TotalDocs and TotalPages are present exactly when the list counted every match; a list read with pagination=false omits both instead of estimating them.

type PreferenceEnvelope

type PreferenceEnvelope[Value any] struct {
	Value Value `json:"value"`
}

PreferenceEnvelope carries one opaque user-owned preference value.

type PreviewToken

type PreviewToken struct {
	Token      string `json:"token"`
	Resource   string `json:"resource"`
	Slug       string `json:"slug"`
	DocumentID string `json:"documentId"`
	ExpiresAt  string `json:"expiresAt"`
}

PreviewToken is a short-lived read-only capability scoped to one resource.

type PreviewTokenEnvelope

type PreviewTokenEnvelope struct {
	PreviewToken PreviewToken `json:"previewToken"`
}

PreviewTokenEnvelope carries a newly minted preview capability exactly once.

type ScheduledPublication added in v0.3.0

type ScheduledPublication struct {
	TimeZone         string `json:"timeZone,omitempty"`
	ID               string `json:"id"`
	Action           string `json:"action"`
	DocumentID       string `json:"documentId"`
	ExpectedRevision int    `json:"expectedRevision"`
	RunAt            string `json:"runAt"`
	Attempts         int    `json:"attempts"`
	LastError        string `json:"lastError,omitempty"`
	CreatedAt        string `json:"createdAt"`
}

ScheduledPublication is the safe public representation of one actionable publication change. Requesting auth identities are deliberately not exposed.

type ScheduledPublicationEnvelope added in v0.3.0

type ScheduledPublicationEnvelope struct {
	ScheduledPublication ScheduledPublication `json:"scheduledPublication"`
}

type ScheduledPublicationsEnvelope added in v0.3.0

type ScheduledPublicationsEnvelope struct {
	ScheduledPublications []ScheduledPublication `json:"scheduledPublications"`
}

type SchemaEnvelope

type SchemaEnvelope struct {
	Schema schema.Snapshot `json:"schema"`
}

SchemaEnvelope exposes the resolved declarative schema to trusted tooling and the admin. It never contains executable authorization or secrets.

type SessionEnvelope

type SessionEnvelope[User any] struct {
	Session AuthSession[User] `json:"session"`
}

SessionEnvelope contains the current typed auth session.

type SessionTokenEnvelope added in v0.4.0

type SessionTokenEnvelope[User any] struct {
	Session AuthSession[User] `json:"session"`
	Token   string            `json:"token"`
}

SessionTokenEnvelope is returned to token-transport clients after login or rotation. Session is safe to serialize into rendered pages; Token is the bearer secret and must not be.

type SessionTransport added in v0.4.0

type SessionTransport string

SessionTransport selects how a login delivers its opaque session token.

const (
	// SessionTransportCookie stores the token in Ridu's HttpOnly session cookie.
	SessionTransportCookie SessionTransport = "cookie"
	// SessionTransportToken returns the token to the client, which presents it as
	// Authorization: Session <token>.
	SessionTransportToken SessionTransport = "token"
)

type UploadGrant added in v0.4.0

type UploadGrant struct {
	ID        string `json:"id"`
	Size      string `json:"size,omitempty"`
	URL       string `json:"url"`
	ExpiresAt string `json:"expiresAt"`
}

UploadGrant is a delivery URL that authorizes one object without carrying the session token.

type UploadGrantRequestItem added in v0.4.0

type UploadGrantRequestItem struct {
	ID   string `json:"id"`
	Size string `json:"size,omitempty"`
}

UploadGrantRequestItem names one upload document and optional image size.

type UploadGrantsEnvelope added in v0.4.0

type UploadGrantsEnvelope struct {
	Grants []UploadGrant `json:"grants"`
}

UploadGrantsEnvelope returns grants in request order.

type UploadGrantsRequest added in v0.4.0

type UploadGrantsRequest struct {
	Items     []UploadGrantRequestItem `json:"items"`
	ExpiresIn int                      `json:"expiresIn,omitempty"`
}

UploadGrantsRequest asks for short-lived delivery URLs. ExpiresIn is in seconds; zero selects the server default.

type UploadImageEdit added in v0.3.0

type UploadImageEdit struct {
	FocalX     float64 `json:"focalX"`
	FocalY     float64 `json:"focalY"`
	CropX      float64 `json:"cropX"`
	CropY      float64 `json:"cropY"`
	CropWidth  float64 `json:"cropWidth"`
	CropHeight float64 `json:"cropHeight"`
}

UploadImageEdit describes a reversible crop and focal point on the oriented source image. Coordinates are percentages of that source, not the rendition. A zero width and height clear the crop.

type ValidationIssue

type ValidationIssue struct {
	Code    string `json:"code"`
	Path    string `json:"path"`
	Message string `json:"message"`
	// Target is an opaque schema/stable-occurrence correlation token for structured field issues.
	Target       string            `json:"target,omitempty"`
	FieldID      schema.StableID   `json:"fieldId,omitempty"`
	CollectionID schema.StableID   `json:"collectionId,omitempty"`
	GlobalID     schema.StableID   `json:"globalId,omitempty"`
	Locale       schema.LocaleCode `json:"locale,omitempty"`
}

ValidationIssue identifies one invalid input path.

Jump to

Keyboard shortcuts

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