Documentation
¶
Overview ¶
Package gobeyond defines the public request-time contracts used by GoBeyond page loaders, actions, API handlers, middleware, and durable workers.
Index ¶
- Constants
- func NormalizeEnvironment(env string) (string, error)
- func NormalizeWorkerID(id string) (string, error)
- func TaskQueueName(workerID, environment string) (string, error)
- type ActionContext
- type ActionResult
- type Alternate
- type CacheMode
- type CachePolicy
- type DeadlinePolicy
- type Handler
- type Icons
- type JSONLD
- type Metadata
- type Middleware
- type MiddlewareConfig
- type OpenGraph
- type OpenGraphImage
- type PageConfig
- type PageContext
- type PageResult
- type RequestContext
- type Response
- type ResultKind
- type TaskConfig
- type Twitter
- type WorkflowConfig
Constants ¶
const ( MaxWorkerIDBytes = 48 MaxEnvironmentBytes = 32 MaxTaskQueueBytes = 82 // workerId + "__" + environment TaskQueueSeparator = "__" DefaultWorkerID = "default" LocalEnvironment = "local" PreviewEnvironment = "preview" )
Durable length budgets (ADR 006). Stricter than Temporal's 1000-byte ID limit.
const RenderAPIVersion = "gobeyond.render/v1alpha1"
Variables ¶
This section is empty.
Functions ¶
func NormalizeEnvironment ¶
NormalizeEnvironment validates an environment slug used in task queue names.
func NormalizeWorkerID ¶
NormalizeWorkerID validates and returns a worker id suitable for queue names. Empty becomes "default".
func TaskQueueName ¶
TaskQueueName returns {workerId}__{environment}.
Types ¶
type ActionContext ¶
type ActionResult ¶
type ActionResult[T any] struct { Data T `json:"data,omitempty"` FieldErrors map[string]string `json:"fieldErrors,omitempty"` RedirectTo string `json:"redirectTo,omitempty"` // Deprecated: RefreshRoutes was never read by the runtime. Actions that // need the client to refresh routes after a mutation should call // cache.RevalidatePath / cache.RevalidateTag; the runtime emits recorded // paths and tags in cache.ActionEnvelope.Refresh. RefreshRoutes []string `json:"refreshRoutes,omitempty"` }
type CachePolicy ¶
type CachePolicy struct {
Mode CacheMode `json:"mode"`
MaxAge int `json:"maxAge,omitempty"`
StaleWhileRevalidate int `json:"staleWhileRevalidate,omitempty"`
StaleIfError int `json:"staleIfError,omitempty"`
}
func PublicRevalidate ¶
func PublicRevalidate(fresh, stale, staleIfError time.Duration) CachePolicy
PublicRevalidate returns a public policy that keeps browser responses stale while allowing shared caches to retain and asynchronously refresh them. Non-positive durations disable their corresponding directive.
func (CachePolicy) HeaderValue ¶
func (p CachePolicy) HeaderValue() string
type DeadlinePolicy ¶
type Handler ¶
type Handler func(*RequestContext) (Response, error)
type JSONLD ¶
JSONLD is serialized by the document renderer with script-safe escaping. Values must be composed solely of JSON-compatible primitives, arrays, and maps.
type Metadata ¶
type Metadata struct {
Lang string `json:"lang"`
Title string `json:"title"`
Description string `json:"description,omitempty"`
Canonical string `json:"canonical,omitempty"`
Robots string `json:"robots,omitempty"`
OpenGraph OpenGraph `json:"openGraph,omitempty"`
Twitter Twitter `json:"twitter,omitempty"`
Icons Icons `json:"icons,omitempty"`
Alternates []Alternate `json:"alternates,omitempty"`
JSONLD []JSONLD `json:"jsonLd,omitempty"`
}
type Middleware ¶
type MiddlewareConfig ¶
type OpenGraph ¶
type OpenGraph struct {
Type string `json:"type,omitempty"`
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
URL string `json:"url,omitempty"`
SiteName string `json:"siteName,omitempty"`
Locale string `json:"locale,omitempty"`
Image *OpenGraphImage `json:"image,omitempty"`
// Images is retained for compatibility. Prefer Image when dimensions and
// descriptive metadata are available.
Images []string `json:"images,omitempty"`
}
type OpenGraphImage ¶
type PageConfig ¶
PageConfig declares the compiler-visible cache contract for a Go-owned page payload. GoBeyond generates the sibling page.schema.ts from this value and the page's Props type.
type PageContext ¶
type PageResult ¶
type PageResult[T any] struct { Kind ResultKind `json:"kind"` Props T `json:"props,omitempty"` Metadata Metadata `json:"metadata,omitempty"` Status int `json:"status,omitempty"` Headers map[string]string `json:"headers,omitempty"` Cache CachePolicy `json:"cache"` RedirectTo string `json:"redirectTo,omitempty"` ErrorCode string `json:"errorCode,omitempty"` Message string `json:"message,omitempty"` }
func NotFound ¶
func NotFound[T any](props T, metadata Metadata) PageResult[T]
func OK ¶
func OK[T any](props T, metadata Metadata) PageResult[T]
type RequestContext ¶
type ResultKind ¶
type ResultKind string
const ( ResultOK ResultKind = "ok" ResultRedirect ResultKind = "redirect" ResultNotFound ResultKind = "not_found" ResultPublicError ResultKind = "public_error" ResultInternalError ResultKind = "internal_error" )
type TaskConfig ¶
TaskConfig declares compiler-visible metadata for a standalone durable task (Temporal activity in the Temporal adapter). Authors do not set a full task queue name; the platform resolves {workerId}__{environment}.
type WorkflowConfig ¶
WorkflowConfig declares compiler-visible metadata for a durable workflow.
Directories
¶
| Path | Synopsis |
|---|---|
|
adapters
|
|
|
lambda
Package lambdaurl adapts an http.Handler to an AWS Lambda Function URL (payload format 2.0) entrypoint.
|
Package lambdaurl adapts an http.Handler to an AWS Lambda Function URL (payload format 2.0) entrypoint. |
|
listen
Package listen implements the hosted supervisor <-> tenant listen contract (gobeyond-internal data-plane contracts §6).
|
Package listen implements the hosted supervisor <-> tenant listen contract (gobeyond-internal data-plane contracts §6). |
|
temporal
Package temporal implements the process lifecycle for a GoBeyond worker binary that polls one Temporal task queue (ADR 006 / ADR 007).
|
Package temporal implements the process lifecycle for a GoBeyond worker binary that polls one Temporal task queue (ADR 006 / ADR 007). |
|
Package browserassets defines the versioned browser bundle manifest emitted by gobeyond build.
|
Package browserassets defines the versioned browser bundle manifest emitted by gobeyond build. |
|
Package buildpaths centralizes the gobeyond.builds/v1 asset layout: the on-disk locations gobeyond build writes and the public URLs the runtime and CDN serve them from.
|
Package buildpaths centralizes the gobeyond.builds/v1 asset layout: the on-disk locations gobeyond build writes and the public URLs the runtime and CDN serve them from. |
|
Package cache implements GoBeyond's request-time caching primitives: per-request memoization (cache.Memo), the data cache (cache.Load), the route props cache (cache.LoadRoute), their invalidation entry points (RevalidateTag / RevalidatePath), the byte Store tiers those sit on, the shared privacy predicate that gates every cache layer, and the key/envelope contracts the action-refresh client is built against.
|
Package cache implements GoBeyond's request-time caching primitives: per-request memoization (cache.Memo), the data cache (cache.Load), the route props cache (cache.LoadRoute), their invalidation entry points (RevalidateTag / RevalidatePath), the byte Store tiers those sit on, the shared privacy predicate that gates every cache layer, and the key/envelope contracts the action-refresh client is built against. |
|
memstore
Package memstore implements GoBeyond's in-process L1 cache tier: a bounded TTL + LRU byte store with synchronous writes.
|
Package memstore implements GoBeyond's in-process L1 cache tier: a bounded TTL + LRU byte store with synchronous writes. |
|
openfromenv
Package openfromenv provides the supported cache constructor: a bounded in-process L1, an optional Redis L2 when GOBEYOND_CACHE_* is set, and the tag-bump watcher that drops local copies early when L2 is present.
|
Package openfromenv provides the supported cache constructor: a bounded in-process L1, an optional Redis L2 when GOBEYOND_CACHE_* is set, and the tag-bump watcher that drops local copies early when L2 is present. |
|
redisstore
Package redisstore implements GoBeyond's shared L2 cache tier on top of Redis (ElastiCache Serverless in the reference deployment): a cache.Store/cache.Leaser/cache.TagBumpPublisher backed by one Redis endpoint, shared across every instance behind a deploy.
|
Package redisstore implements GoBeyond's shared L2 cache tier on top of Redis (ElastiCache Serverless in the reference deployment): a cache.Store/cache.Leaser/cache.TagBumpPublisher backed by one Redis endpoint, shared across every instance behind a deploy. |
|
cmd
|
|
|
gobeyond
command
|
|
|
render-fixture
command
Command render-fixture is a test-only bridge used by cross-language hydration conformance tests.
|
Command render-fixture is a test-only bridge used by cross-language hydration conformance tests. |
|
Package codegen decodes GoBeyond value-contract documents and generates the Go types shared by page loaders and actions.
|
Package codegen decodes GoBeyond value-contract documents and generates the Go types shared by page loaders and actions. |
|
Package document renders the complete SEO and hydration document around a body produced by GoBeyond's portable renderer.
|
Package document renders the complete SEO and hydration document around a body produced by GoBeyond's portable renderer. |
|
examples
|
|
|
durables-site/app
Package home supplies request-time props for app/page.tsx.
|
Package home supplies request-time props for app/page.tsx. |
|
durables-site/app/durables
Package durables implements actions declared by the /durables route.
|
Package durables implements actions declared by the /durables route. |
|
durables-site/generated/routes
Code generated by gobeyond generate; DO NOT EDIT.
|
Code generated by gobeyond generate; DO NOT EDIT. |
|
seo-site
Optional request middleware for the generated site registry.
|
Optional request middleware for the generated site registry. |
|
seo-site/app/account
Package account owns request-time props for /account.
|
Package account owns request-time props for /account. |
|
seo-site/app/api/time
Package apitime owns the fixture's public /api/time endpoint.
|
Package apitime owns the fixture's public /api/time endpoint. |
|
seo-site/generated/routes
Code generated by gobeyond generate; DO NOT EDIT.
|
Code generated by gobeyond generate; DO NOT EDIT. |
|
seo-site/internal/site
Package shared holds app helpers used by typed page loaders.
|
Package shared holds app helpers used by typed page loaders. |
|
Package imageopt provides the Node-free GoBeyond runtime image optimizer.
|
Package imageopt provides the Node-free GoBeyond runtime image optimizer. |
|
s3
module
|
|
|
internal
|
|
|
jsvalue
Package jsvalue validates values before Go renders and JSON serializes them for the pinned JavaScript runtime.
|
Package jsvalue validates values before Go renders and JSON serializes them for the pinned JavaScript runtime. |
|
Package middleware composes statically discoverable GoBeyond middleware.
|
Package middleware composes statically discoverable GoBeyond middleware. |
|
proxy
Package proxy implements the gobeyond.builds/v2 middleware artifact: a separately-runnable reverse proxy that sits between the hosting supervisor and the app server (gobeyond-internal data-plane contracts §7).
|
Package proxy implements the gobeyond.builds/v2 middleware artifact: a separately-runnable reverse proxy that sits between the hosting supervisor and the app server (gobeyond-internal data-plane contracts §7). |
|
Package oidc provides GoBeyond workload identity token access.
|
Package oidc provides GoBeyond workload identity token access. |
|
Package pack implements the immutable binary container that carries GoBeyond's pack-only runtime artifacts: render plans (.gbp) and packaged static entries (.gbs).
|
Package pack implements the immutable binary container that carries GoBeyond's pack-only runtime artifacts: render plans (.gbp) and packaged static entries (.gbs). |
|
Package renderer evaluates GoBeyond rendering plans and emits deterministic HTML without executing JavaScript.
|
Package renderer evaluates GoBeyond rendering plans and emits deterministic HTML without executing JavaScript. |
|
Package renderplan defines the versioned, language-neutral rendering plan consumed by GoBeyond's production renderer.
|
Package renderplan defines the versioned, language-neutral rendering plan consumed by GoBeyond's production renderer. |
|
Package residency implements the bounded in-process residency cache from ADR 004 (lazy route residency).
|
Package residency implements the bounded in-process residency cache from ADR 004 (lazy route residency). |
|
Package router implements GoBeyond's deterministic route-pattern matching.
|
Package router implements GoBeyond's deterministic route-pattern matching. |
|
Package runtime provides GoBeyond's Node-free production HTTP server.
|
Package runtime provides GoBeyond's Node-free production HTTP server. |
|
Package security contains framework-enforced HTTP boundary protections.
|
Package security contains framework-enforced HTTP boundary protections. |