Documentation
¶
Overview ¶
Package javascript evaluates Spectre payload normaliser scripts.
Index ¶
- type Evaluator
- func (e *Evaluator) Close()
- func (e *Evaluator) NormaliseField(target string, value any, present bool) (normalised any, normalisedPresent bool, err error)
- func (e *Evaluator) NormaliseMessage(target string, value any, present bool) (normalised any, normalisedPresent bool, err error)
- func (e *Evaluator) NormaliseRPC(target string, value any, present bool) (normalised any, normalisedPresent bool, err error)
- type Program
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Evaluator ¶
type Evaluator struct {
// contains filtered or unexported fields
}
Evaluator owns the JavaScript runtime for one payload normalisation. It is confined to its caller because Sobek runtime access is not synchronized.
func (*Evaluator) Close ¶
func (e *Evaluator) Close()
Close releases the evaluator's context watcher.
func (*Evaluator) NormaliseField ¶ added in v0.11.0
func (e *Evaluator) NormaliseField( target string, value any, present bool, ) (normalised any, normalisedPresent bool, err error)
NormaliseField invokes the normaliser registered for a protobuf field.
type Program ¶
type Program struct {
// contains filtered or unexported fields
}
Program is an immutable script shared by all payload normalisations. It retains no runtime-local callback state.
func NewProgram ¶
NewProgram parses and links a script, then evaluates it once to validate registrations.
func (*Program) NewEvaluator ¶
NewEvaluator creates an isolated evaluator for one payload normalisation. Re-evaluation must reproduce the registrations used to build the schema plan.