|
|
|
|
@ -79,7 +79,26 @@ executeScript = (integration, method, params) -> |
|
|
|
|
return |
|
|
|
|
|
|
|
|
|
try |
|
|
|
|
result = script[method](params) |
|
|
|
|
sandbox = |
|
|
|
|
_: _ |
|
|
|
|
s: s |
|
|
|
|
console: console |
|
|
|
|
Store: |
|
|
|
|
set: (key, val) -> |
|
|
|
|
return store[key] = val |
|
|
|
|
get: (key) -> |
|
|
|
|
return store[key] |
|
|
|
|
HTTP: (method, url, options) -> |
|
|
|
|
try |
|
|
|
|
return {} = |
|
|
|
|
result: HTTP.call method, url, options |
|
|
|
|
catch e |
|
|
|
|
return {} = |
|
|
|
|
error: e |
|
|
|
|
script: script |
|
|
|
|
method: method |
|
|
|
|
params: params |
|
|
|
|
result = vm.runInNewContext('script[method](params)', sandbox, { timeout: 3000 }) |
|
|
|
|
|
|
|
|
|
logger.outgoing.debug '[Script method [', method, '] result of Trigger', integration.name, ':]' |
|
|
|
|
logger.outgoing.debug result |
|
|
|
|
|