Documentation
¶
Index ¶
Constants ¶
const DefaultHTTPTimeout = 5 * time.Minute
DefaultHTTPTimeout matches the product runtime's read, write, and call limit.
Variables ¶
Functions ¶
func HasInterpolationExpression ¶
HasInterpolationExpression reports whether Interpolate will recognize at least one complete expression token under its single-pass dollar grammar.
Types ¶
type Config ¶
type Config struct {
Random RandomSource
Platform string
// CopiedText is nil until something copies. `flowbaton.copiedText` is then
// undefined, preserving the distinction between "nothing has been copied"
// and "an empty string was copied".
CopiedText *string
LogSink func(message string)
HTTPClient *http.Client
}
Config contains host services copied into each runtime created by a Factory.
type EvalRequest ¶
type EvalRequest struct {
Script string
SourceName string
ScriptDir string
Env map[string]any
RunInSubScope bool
}
EvalRequest describes one IIFE-scoped evaluation and its environment overlay.
type EvaluationError ¶
EvaluationError reports script failures without exposing goja error types.
func (*EvaluationError) Error ¶
func (e *EvaluationError) Error() string
type Factory ¶
Factory creates one isolated shared-context runtime per root flow.
func NewFactory ¶
NewFactory validates host services and returns a reusable runtime factory.
type MissingEnvValueError ¶
type MissingEnvValueError struct {
Name string
}
MissingEnvValueError identifies an environment key whose value was null.
func (*MissingEnvValueError) Error ¶
func (e *MissingEnvValueError) Error() string
type OpaqueValue ¶
type OpaqueValue struct {
Kind string
}
OpaqueValue represents a JavaScript value that cannot cross the Go-native runtime contract without exposing an engine-specific type.
type RandomSource ¶
RandomSource supplies deterministic data to the JavaScript faker binding.
type Runtime ¶
type Runtime interface {
Evaluate(ctx context.Context, request EvalRequest) (Result, error)
Interpolate(ctx context.Context, input string, env map[string]any) (string, error)
PushEnv() error
PopEnv() error
PutEnv(name string, value any) error
SetCopiedText(value string) error
SetPlatform(value string) error
SetLogSink(sink func(message string))
PushLogSink(sink func(message string)) (restore func())
Close() error
}
Runtime serializes access to one reusable strict JavaScript context.