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 Fetch(ctx context.Context, request *http.Request) (*http.Response, error)
- func NormalizeEnvironment(env string) (string, error)
- func NormalizeTaskQueueID(id string) (string, error)
- func TaskQueueName(taskQueueID, environment string) (string, error)
- func WithFetcher(ctx context.Context, fetcher Fetcher) context.Context
- type ActionContext
- type ActionResult
- type Alternate
- type CacheMode
- type CachePolicy
- type DeadlinePolicy
- type Fetcher
- type FetcherFunc
- type Handler
- type Icons
- type JSONLD
- type Metadata
- type Middleware
- type MiddlewareConfigdeprecated
- type OpenGraph
- type OpenGraphImage
- type PageConfig
- type PageContext
- type PagePrefetchConfig
- type PagePrefetchImage
- type PageResult
- type ProxyPolicy
- type RequestContext
- type Response
- type ResultKind
- type Twitter
Constants ¶
const ( MaxTaskQueueIDBytes = 48 MaxEnvironmentBytes = 32 MaxTaskQueueBytes = 82 // taskQueueId + "__" + environment TaskQueueSeparator = "__" DefaultTaskQueueID = "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 Fetch ¶
Fetch dispatches a GoBeyond application request. The runtime first attempts same-slot dispatch and transparently uses the trusted platform-origin path only when the current build has no matching route. Application responses and errors are never replayed through the fallback.
func NormalizeEnvironment ¶
NormalizeEnvironment validates an environment slug used in task queue names.
func NormalizeTaskQueueID ¶
NormalizeTaskQueueID validates and returns a logical task queue id. Empty becomes "default".
func TaskQueueName ¶
TaskQueueName returns {taskQueueId}__{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 Fetcher ¶
Fetcher is the runtime-bound implementation used by Fetch. Hosted runtimes install one on the request context; application code only calls Fetch and does not need to know whether the target is handled in-process or by the platform origin.
type FetcherFunc ¶
FetcherFunc adapts a function to Fetcher.
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 ¶
Middleware is the one application request hook. A root middleware.go exports a function with this shape; the generated server invokes the resulting handler in the same process and execution slot as the application.
type MiddlewareConfig
deprecated
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 ¶
type PageConfig struct {
Revalidate int
Tags []string
Prefetch PagePrefetchConfig
}
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 PagePrefetchConfig ¶
type PagePrefetchConfig struct {
Data bool
Images []PagePrefetchImage
}
PagePrefetchConfig opts a route into private, in-tab data warming and explicit image variants after the runtime payload arrives.
type PagePrefetchImage ¶
PagePrefetchImage identifies a string prop and the exact imageSrc variant to warm. Path is dot-separated from the page props root.
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 ProxyPolicy ¶
ProxyPolicy is the validated build-scoped policy shared by the origin runtime and the platform edge. It is an alias so generated applications can expose the policy without importing an implementation package in their authored middleware contract.
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" )
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 agents is the public Go authoring surface for GoBeyond agents.
|
Package agents is the public Go authoring surface for GoBeyond agents. |
|
httpruntime
Package httpruntime provides the local HTTP transport for GoBeyond agents.
|
Package httpruntime provides the local HTTP transport for GoBeyond agents. |
|
temporalruntime
Package temporalruntime dispatches durable agent runs to compiler-generated Temporal workflows.
|
Package temporalruntime dispatches durable agent runs to compiler-generated Temporal workflows. |
|
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/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 GoBeyond's low-level Go runtime middleware hook.
|
Package middleware composes GoBeyond's low-level Go runtime middleware hook. |
|
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 policy implements the build-scoped proxy policy shared by the GoBeyond origin runtime and the platform edge evaluator.
|
Package policy implements the build-scoped proxy policy shared by the GoBeyond origin runtime and the platform edge evaluator. |
|
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 a bounded in-process cache for lazily decoded, immutable build artifacts — render plans and packaged static entries — resident between requests, bounded by entry count and by estimated decoded bytes.
|
Package residency implements a bounded in-process cache for lazily decoded, immutable build artifacts — render plans and packaged static entries — resident between requests, bounded by entry count and by estimated decoded bytes. |
|
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. |
|
Package workflows provides the Go-native authoring surface for durable workflows and activities.
|
Package workflows provides the Go-native authoring surface for durable workflows and activities. |