Documentation
¶
Overview ¶
Paths such as response.users[*].id are evaluated in Go. They are not JavaScript. Object literals and #? predicates run in Sobek.
Index ¶
- func JSONPath(data any, path string) (any, error)
- type Bindings
- type Call
- type Configuration
- type Element
- type FailureDecision
- type VM
- func (v *VM) ApplyConfiguration(c Configuration) error
- func (v *VM) Bind(b Bindings) error
- func (v *VM) Bridge(methods map[string]func([]any) (any, error)) sobek.Value
- func (v *VM) Bytes(ref string) ([]byte, error)
- func (v *VM) CallFile(ref string, arg any) (any, error)
- func (v *VM) CallHook(name string) (bool, error)
- func (v *VM) Configuration() Configuration
- func (v *VM) ConfigureHeaders(expr string) error
- func (v *VM) ConfigureHook(name, expr string) error
- func (v *VM) ConfigureRetry(val any) error
- func (v *VM) Eval(expr string) (out any, err error)
- func (v *VM) EvalConfig(src string) error
- func (v *VM) Get(name string) (any, bool)
- func (v *VM) HeaderOverlay() (map[string]any, error)
- func (v *VM) Invoke(expr string, arg any) (any, error)
- func (v *VM) IsFunction(expr string) bool
- func (v *VM) Isolated(ctx context.Context) (*VM, func(), error)
- func (v *VM) Park(step func(wake <-chan struct{}) (bool, error)) error
- func (v *VM) RemovePath(path string) error
- func (v *VM) Seal(val any) any
- func (v *VM) SealConfiguration(c Configuration) Configuration
- func (v *VM) Set(name string, val any)
- func (v *VM) SetFunction(name string, fn func(call sobek.FunctionCall) sobek.Value)
- func (v *VM) SetPath(path string, val any) error
- func (v *VM) SetRetryUntil(expr string)
- func (v *VM) SharedScope() func()
- func (v *VM) StepFailure(info map[string]any) (FailureDecision, error)
- func (v *VM) TakeRetryUntil() (expr string, count int, every time.Duration)
- func (v *VM) ToValue(val any) sobek.Value
- func (v *VM) Truthy(expr string, self, root any) (bool, error)
- func (v *VM) Try(fn func() error) error
- func (v *VM) Vars() map[string]any
- func (v *VM) Watch(ctx context.Context) (func(), error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Bindings ¶
type Bindings struct {
Config func() map[string]any
Driver func(string, []any) (any, error)
Call func(Call) (any, error)
Env string
Root string
FeatureDir string
Configure func(key string, val any) error
CallSingle func(path string, arg any) (any, error)
Setup func(name string, once bool) (any, error)
Channel func(kind string, spec map[string]any) (any, error)
PageText func(selector string) (string, error)
Abort func()
Sleep func(time.Duration, <-chan struct{}) error
Log func(string) error
Info func() map[string]any
Scenario func() map[string]any
Feature func() map[string]any
Write func(any, string) (string, error)
WaitHTTP func(string, time.Duration, time.Duration, <-chan struct{}) error
WaitPort func(string, int, time.Duration, time.Duration, <-chan struct{}) error
Signal func(any) error
Listen func(time.Duration, <-chan struct{}) (any, error)
Embed func(any, string, string) error
Helpers map[string]func([]any) (any, error)
}
type Configuration ¶
type Configuration struct {
// contains filtered or unexported fields
}
Configuration keeps live callbacks within their owning scenario runtime. A cache keeps a sealed function, which still calls that runtime.
func (Configuration) Portable ¶
func (c Configuration) Portable() (Configuration, error)
Portable copies data and sealed callbacks. A sealed callback keeps the runtime and lexical bindings it closed over. Source is only the fallback.
type Element ¶
type Element struct{ Locator string }
Element is a locator, not a DOM node or a cross-runtime browser handle.
type FailureDecision ¶
type VM ¶
type VM struct {
// contains filtered or unexported fields
}
func (*VM) ApplyConfiguration ¶
func (v *VM) ApplyConfiguration(c Configuration) error
func (*VM) CallFile ¶
CallFile evaluates a JS helper once, invoking it if it returns a function. An object-valued helper is returned as data.
func (*VM) Configuration ¶
func (v *VM) Configuration() Configuration
func (*VM) ConfigureHeaders ¶
func (*VM) ConfigureHook ¶
func (*VM) ConfigureRetry ¶
func (*VM) EvalConfig ¶
func (*VM) IsFunction ¶
func (*VM) Isolated ¶ added in v0.3.0
Isolated seeds a new realm with this VM's variables and callbacks. Declarations and built-in changes in the child stay there. stop ends its lease.
func (*VM) Park ¶
Park lets other retained calls run on this goroutine while it is blocked in listen or pause. Sobek cannot execute on two goroutines at once.
func (*VM) RemovePath ¶
func (*VM) Seal ¶
Seal captures callable and null bindings along with data, retaining their native values so sibling functions and object identity survive scope restore.
func (*VM) SealConfiguration ¶
func (v *VM) SealConfiguration(c Configuration) Configuration
func (*VM) SetFunction ¶
func (*VM) SetRetryUntil ¶
func (*VM) SharedScope ¶ added in v0.3.0
func (v *VM) SharedScope() func()
SharedScope restores call arguments and helpers while preserving shared variables.
func (*VM) StepFailure ¶
func (v *VM) StepFailure(info map[string]any) (FailureDecision, error)