JavaScript Action
Rules:
use a variable to pass data in, by defaul we want the whole in_context
use $. global variable to refer to data (in_context)
use return to return the result in JavaScript
returned result goes straign to task result (like usual)
publish, like usual.
task_simple
action: javascript in_context=
task0:
action: std.javascript
input:
in_context: $ // the $ in the script will be pointing to this
script: |
x = $.foo.bar // prev published var
y = $.task_
return {'x': x, 'y': y } # this becomes result
publish:
xxx: {$.task0.x.foo.bar}
task_1:
action: foo.bar par={$.task0.y} # when we eventually can refer to tasks
JavaScript to evaluate :
$=context // copy the in_context value here
function f () {
>> body of the script <<
}
f()
2. To automatically send in_context, use __env
__env = {
'__action' {
},
...
3. Leverage default variables for action inputs.
Default variables shall be evaluated; if they contain YAQL, resolved
to actual values before passing to executors. Hm.. assume we get the signature meta data
availabe on the engine... Think about it.
When this is done, javascript action will look like:
def __init__(self, in_context="{$}", script)
Blueprint information
- Status:
- Complete
- Approver:
- Renat Akhmerov
- Priority:
- High
- Drafter:
- Renat Akhmerov
- Direction:
- Approved
- Assignee:
- Nikolay Makhotkin
- Definition:
- Approved
- Series goal:
- Accepted for kilo
- Implementation:
- Implemented
- Milestone target:
- 2015.1
- Started by
- Nikolay Makhotkin
- Completed by
- Renat Akhmerov
Related branches
Related bugs
Sprints
Whiteboard
Gerrit topic: https:/
Addressed by: https:/
JavaScript action: part 1
Addressed by: https:/
JavaScript action: part 2