Documentation
¶
Index ¶
- func CleanupScriptlet(scriptlet string) string
- func GetScriptlet(name string, clout *cloutpkg.Clout) (string, error)
- func GetScriptletNamesInSection(baseName string, clout *cloutpkg.Clout) ([]string, error)
- func GetScriptletsMetadata(clout *cloutpkg.Clout) (ard.StringMap, error)
- func GetScriptletsMetadataSection(name string, clout *cloutpkg.Clout) (ard.Value, error)
- func IsScriptletNotFoundError(err error) bool
- func SetScriptlet(name string, scriptlet string, clout *cloutpkg.Clout) error
- type CloutAPI
- func (self *CloutAPI) Call(scriptletName string, functionName string, arguments []any) (any, error)
- func (self *CloutAPI) CallAll(function goja.FunctionCall) goja.Value
- func (self *CloutAPI) Coerce(value any) (any, error)
- func (self *CloutAPI) Define(scriptletName string, scriptlet string) error
- func (self *CloutAPI) Load(context contextpkg.Context, data any, forceFormat string) (*CloutAPI, error)
- func (self *CloutAPI) MarshalCBOR() ([]byte, error)
- func (self *CloutAPI) MarshalJSON() ([]byte, error)
- func (self *CloutAPI) MarshalMsgpack() ([]byte, error)
- func (self *CloutAPI) MarshalYAML() (any, error)
- func (self *CloutAPI) NewCoercible(value goja.Value, site any, source any, target any) (Coercible, error)
- func (self *CloutAPI) NewKey() string
- func (self *CloutAPI) NewValidators(value goja.Value, site any, source any, target any) (Validators, error)
- func (self *CloutAPI) Unwrap(value any) any
- type CloutContext
- type Coercible
- type Environment
- func (self *Environment) CreateCloutExtension(clout *cloutpkg.Clout) commonjs.CreateExtensionFunc
- func (self *Environment) CreateTranscribeExtension(jsContext *commonjs.Context) any
- func (self *Environment) NewCloutAPI(clout *cloutpkg.Clout, jsContext *commonjs.Context) *CloutAPI
- func (self *Environment) NewCloutContext(clout *cloutpkg.Clout, jsContext *commonjs.Context) *CloutContext
- func (self *Environment) NewJsEnvironment(clout *cloutpkg.Clout, extensions map[string]commonjs.CreateExtensionFunc) *commonjs.Environment
- func (self *Environment) NewTranscribeAPI() *TranscribeAPI
- func (self *Environment) Require(clout *cloutpkg.Clout, scriptletName string, ...) (*goja.Object, error)
- type Error
- type ExecContext
- func (self *ExecContext) Coerce()
- func (self *ExecContext) Exec(scriptletName string, arguments map[string]string) *goja.Object
- func (self *ExecContext) ExecWithHistory(scriptletName string) *goja.Object
- func (self *ExecContext) NewEnvironment(scriptletName string, arguments map[string]string) *Environment
- func (self *ExecContext) Outputs() *goja.Object
- func (self *ExecContext) Resolve()
- type ExecutionContext
- func (self *ExecutionContext) Call(scriptletName string, functionName string, arguments ...any) (any, error)
- func (self *ExecutionContext) NewCoercible(data ard.Value, meta ard.StringMap) (Coercible, error)
- func (self *ExecutionContext) NewConverter(meta ard.StringMap) (*FunctionCall, error)
- func (self *ExecutionContext) NewFunctionCall(map_ ard.StringMap, notation ard.StringMap, meta ard.StringMap) (*FunctionCall, error)
- func (self *ExecutionContext) NewList(list ard.List, elementMeta ard.StringMap) (List, error)
- func (self *ExecutionContext) NewListValue(list ard.List, notation ard.StringMap, meta ard.StringMap) (*Value, error)
- func (self *ExecutionContext) NewMap(list ard.List, keyMeta ard.StringMap, valueMeta ard.StringMap, ...) (Map, error)
- func (self *ExecutionContext) NewMapEntry(data any, keyMeta ard.StringMap, valueMeta ard.StringMap, ...) (MapEntry, error)
- func (self *ExecutionContext) NewMapValue(list ard.List, notation ard.StringMap, meta ard.StringMap) (*Value, error)
- func (self *ExecutionContext) NewValidators(list ard.List, meta ard.StringMap) (Validators, error)
- func (self *ExecutionContext) NewValidatorsFromMeta(meta ard.StringMap) (Validators, error)
- func (self *ExecutionContext) NewValue(data ard.Value, notation ard.StringMap, meta ard.StringMap) (*Value, error)
- type FunctionCall
- func (self *FunctionCall) AddValidators(validators Validators)
- func (self *FunctionCall) Coerce() (ard.Value, error)
- func (self *FunctionCall) CoerceArguments() ([]ard.Value, error)
- func (self *FunctionCall) Convert(value ard.Value) (ard.Value, error)
- func (self *FunctionCall) NewError(arguments []any, message string, cause error) *Error
- func (self *FunctionCall) NewErrorf(arguments []any, format string, arg ...any) *Error
- func (self *FunctionCall) Signature(arguments []ard.Value) string
- func (self *FunctionCall) Unwrap() ard.Value
- func (self *FunctionCall) Validate(value ard.Value, errorWhenInvalid bool) (bool, error)
- func (self *FunctionCall) WrapError(arguments []any, err error) *Error
- type List
- type Map
- type MapEntry
- type ScriptletNotFoundError
- type TranscribeAPI
- type Validators
- type Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanupScriptlet ¶
func CleanupScriptlet(scriptlet string) string
func GetScriptlet ¶
func GetScriptlet(name string, clout *cloutpkg.Clout) (string, error)
func GetScriptletNamesInSection ¶ added in v0.15.0
func GetScriptletNamesInSection(baseName string, clout *cloutpkg.Clout) ([]string, error)
func GetScriptletsMetadata ¶ added in v0.15.0
func GetScriptletsMetadata(clout *cloutpkg.Clout) (ard.StringMap, error)
func GetScriptletsMetadataSection ¶ added in v0.15.0
func GetScriptletsMetadataSection(name string, clout *cloutpkg.Clout) (ard.Value, error)
func IsScriptletNotFoundError ¶ added in v0.15.0
func IsScriptletNotFoundError(err error) bool
func SetScriptlet ¶
func SetScriptlet(name string, scriptlet string, clout *cloutpkg.Clout) error
Types ¶
type CloutAPI ¶
type CloutAPI struct {
*cloutpkg.Clout
// contains filtered or unexported fields
}
func (*CloutAPI) Call ¶
func (self *CloutAPI) Call(scriptletName string, functionName string, arguments []any) (any, error)
func (*CloutAPI) CallAll ¶ added in v0.19.0
func (self *CloutAPI) CallAll(function goja.FunctionCall) goja.Value
TODO: unused?
func (*CloutAPI) Define ¶ added in v0.14.0
func (self *CloutAPI) Define(scriptletName string, scriptlet string) error
func (*CloutAPI) Load ¶ added in v0.18.0
func (self *CloutAPI) Load(context contextpkg.Context, data any, forceFormat string) (*CloutAPI, error)
func (*CloutAPI) MarshalCBOR ¶ added in v0.18.0
func (self *CloutAPI) MarshalCBOR() ([]byte, error)
(cbor.Marshaler interface)
func (*CloutAPI) MarshalJSON ¶
func (self *CloutAPI) MarshalJSON() ([]byte, error)
(json.Marshaler interface)
func (*CloutAPI) MarshalMsgpack ¶ added in v0.21.0
func (self *CloutAPI) MarshalMsgpack() ([]byte, error)
(msgpack.Marshaler interface)
func (*CloutAPI) MarshalYAML ¶
func (self *CloutAPI) MarshalYAML() (any, error)
([yaml.Marshaler] interface)
func (*CloutAPI) NewCoercible ¶
func (self *CloutAPI) NewCoercible(value goja.Value, site any, source any, target any) (Coercible, error)
func (*CloutAPI) NewValidators ¶ added in v0.21.0
func (self *CloutAPI) NewValidators(value goja.Value, site any, source any, target any) (Validators, error)
type CloutContext ¶
type CloutContext struct {
Context *Environment
Clout *cloutpkg.Clout
JSContext *commonjs.Context
}
func (*CloutContext) NewExecutionContext ¶ added in v0.21.0
func (self *CloutContext) NewExecutionContext(site any, source any, target any) *ExecutionContext
type Coercible ¶
type Coercible interface {
Coerce() (ard.Value, error)
AddValidators(Validators)
Unwrap() ard.Value
}
type Environment ¶ added in v0.22.4
type Environment struct {
Arguments map[string]string
Quiet bool
Format string
Strict bool
Pretty bool
Base64 bool
FilePath string
Log commonlog.Logger
Stdout io.Writer
Stderr io.Writer
Stdin io.Writer
StdoutStylist *terminal.Stylist
URLContext *exturl.Context
// contains filtered or unexported fields
}
func NewEnvironment ¶ added in v0.22.4
func NewEnvironment(name string, log commonlog.Logger, arguments map[string]string, quiet bool, format string, strict bool, pretty bool, base64 bool, filePath string, urlContext *exturl.Context) *Environment
func (*Environment) CreateCloutExtension ¶ added in v0.22.4
func (self *Environment) CreateCloutExtension(clout *cloutpkg.Clout) commonjs.CreateExtensionFunc
func (*Environment) CreateTranscribeExtension ¶ added in v0.22.4
func (self *Environment) CreateTranscribeExtension(jsContext *commonjs.Context) any
(commonjs.CreateExtensionFunc signature)
func (*Environment) NewCloutAPI ¶ added in v0.22.4
func (self *Environment) NewCloutAPI(clout *cloutpkg.Clout, jsContext *commonjs.Context) *CloutAPI
func (*Environment) NewCloutContext ¶ added in v0.22.4
func (self *Environment) NewCloutContext(clout *cloutpkg.Clout, jsContext *commonjs.Context) *CloutContext
func (*Environment) NewJsEnvironment ¶ added in v0.22.4
func (self *Environment) NewJsEnvironment(clout *cloutpkg.Clout, extensions map[string]commonjs.CreateExtensionFunc) *commonjs.Environment
func (*Environment) NewTranscribeAPI ¶ added in v0.22.4
func (self *Environment) NewTranscribeAPI() *TranscribeAPI
type Error ¶
type Error struct {
FunctionCall *FunctionCall
Arguments []any
Message string
Cause error
}
type ExecContext ¶ added in v0.22.3
type ExecContext struct {
Clout *cloutpkg.Clout
Problems *problemspkg.Problems
URLContext *exturl.Context
History bool
Format string
Strict bool
Pretty bool
Base64 bool
}
func (*ExecContext) Exec ¶ added in v0.22.3
func (self *ExecContext) Exec(scriptletName string, arguments map[string]string) *goja.Object
func (*ExecContext) ExecWithHistory ¶ added in v0.22.3
func (self *ExecContext) ExecWithHistory(scriptletName string) *goja.Object
func (*ExecContext) NewEnvironment ¶ added in v0.22.4
func (self *ExecContext) NewEnvironment(scriptletName string, arguments map[string]string) *Environment
type ExecutionContext ¶ added in v0.21.0
type ExecutionContext struct {
CloutContext *CloutContext
Site any
Source any
Target any
}
func (*ExecutionContext) Call ¶ added in v0.21.0
func (self *ExecutionContext) Call(scriptletName string, functionName string, arguments ...any) (any, error)
func (*ExecutionContext) NewCoercible ¶ added in v0.21.0
func (self *ExecutionContext) NewCoercible(data ard.Value, meta ard.StringMap) (Coercible, error)
func (*ExecutionContext) NewConverter ¶ added in v0.21.0
func (self *ExecutionContext) NewConverter(meta ard.StringMap) (*FunctionCall, error)
func (*ExecutionContext) NewFunctionCall ¶ added in v0.21.0
func (self *ExecutionContext) NewFunctionCall(map_ ard.StringMap, notation ard.StringMap, meta ard.StringMap) (*FunctionCall, error)
func (*ExecutionContext) NewList ¶ added in v0.21.0
func (self *ExecutionContext) NewList(list ard.List, elementMeta ard.StringMap) (List, error)
func (*ExecutionContext) NewListValue ¶ added in v0.21.0
func (self *ExecutionContext) NewListValue(list ard.List, notation ard.StringMap, meta ard.StringMap) (*Value, error)
func (*ExecutionContext) NewMap ¶ added in v0.21.0
func (self *ExecutionContext) NewMap(list ard.List, keyMeta ard.StringMap, valueMeta ard.StringMap, fieldsMeta ard.StringMap) (Map, error)
func (*ExecutionContext) NewMapEntry ¶ added in v0.21.0
func (self *ExecutionContext) NewMapEntry(data any, keyMeta ard.StringMap, valueMeta ard.StringMap, fieldsMeta ard.StringMap) (MapEntry, error)
func (*ExecutionContext) NewMapValue ¶ added in v0.21.0
func (self *ExecutionContext) NewMapValue(list ard.List, notation ard.StringMap, meta ard.StringMap) (*Value, error)
func (*ExecutionContext) NewValidators ¶ added in v0.21.0
func (self *ExecutionContext) NewValidators(list ard.List, meta ard.StringMap) (Validators, error)
func (*ExecutionContext) NewValidatorsFromMeta ¶ added in v0.21.0
func (self *ExecutionContext) NewValidatorsFromMeta(meta ard.StringMap) (Validators, error)
type FunctionCall ¶
type FunctionCall struct {
Name string `json:"name" yaml:"name"`
Arguments []Coercible `json:"arguments" yaml:"arguments"`
Path string `json:"path,omitempty" yaml:"path,omitempty"`
URL string `json:"url,omitempty" yaml:"url,omitempty"`
Row int `json:"row" yaml:"row"`
Column int `json:"column" yaml:"column"`
Validators Validators `json:"validators,omitempty" yaml:"validators,omitempty"`
Converter *FunctionCall `json:"converter,omitempty" yaml:"converter,omitempty"`
Notation ard.StringMap `json:"-" yaml:"-"`
ExecutionContext *ExecutionContext `json:"-" yaml:"-"`
}
func (*FunctionCall) AddValidators ¶ added in v0.21.0
func (self *FunctionCall) AddValidators(validators Validators)
(Coercible interface)
func (*FunctionCall) Coerce ¶
func (self *FunctionCall) Coerce() (ard.Value, error)
(Coercible interface)
func (*FunctionCall) CoerceArguments ¶
func (self *FunctionCall) CoerceArguments() ([]ard.Value, error)
func (*FunctionCall) Convert ¶ added in v0.19.0
func (self *FunctionCall) Convert(value ard.Value) (ard.Value, error)
func (*FunctionCall) NewError ¶
func (self *FunctionCall) NewError(arguments []any, message string, cause error) *Error
func (*FunctionCall) NewErrorf ¶
func (self *FunctionCall) NewErrorf(arguments []any, format string, arg ...any) *Error
type MapEntry ¶
type MapEntry struct {
Key Coercible `json:"key" yaml:"key"`
Value Coercible `json:"value" yaml:"value"`
}
type ScriptletNotFoundError ¶ added in v0.15.0
type ScriptletNotFoundError struct {
// contains filtered or unexported fields
}
func NewScriptletNotFoundError ¶ added in v0.15.0
func NewScriptletNotFoundError(format string, args ...any) *ScriptletNotFoundError
type TranscribeAPI ¶ added in v0.22.4
type TranscribeAPI struct {
*api.Transcribe
Stdout io.Writer
Stderr io.Writer
Stdin io.Writer
StdoutStylist *terminal.Stylist
FilePath string
Format string
Strict bool
Pretty bool
Base64 bool
// contains filtered or unexported fields
}
type Validators ¶ added in v0.21.0
type Validators []*FunctionCall
type Value ¶
type Value struct {
Data any `json:"data" yaml:"data"` // List, Map, or ard.Value
Validators Validators `json:"validators,omitempty" yaml:"validators,omitempty"`
Converter *FunctionCall `json:"converter,omitempty" yaml:"converter,omitempty"`
Notation ard.StringMap `json:"-" yaml:"-"`
}
func (*Value) AddValidators ¶ added in v0.21.0
func (self *Value) AddValidators(validators Validators)
(Coercible interface)
Click to show internal directories.
Click to hide internal directories.