Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed #140 - vet plugins not working correctly #141

Merged
merged 2 commits into from
Mar 21, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -612,16 +612,32 @@ declare function flow:validate-entities()
let $_ :=
for $plugin in $flow/hub:plugins/hub:plugin
let $destination := $plugin/@dest
let $module-uri := $plugin/@module
let $module-name := hul:get-module-name($module-uri)
let $filename as xs:string := hul:get-file-from-uri($module-uri)
let $type := flow:get-type($filename)
let $ns :=
if ($type eq $flow:TYPE-JAVASCRIPT) then ()
else
$flow:PLUGIN-NS || fn:lower-case($module-name)
let $func-name :=
if ($type eq $flow:TYPE-JAVASCRIPT) then
"create" || functx:capitalize-first($destination)
else
"create-" || $destination
return
try {
flow:run-plugin(
$plugin,
$data-format,
"123",
(),
(),
(),
$options)
if ($type eq $flow:TYPE-XQUERY) then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this section needs a comment or two for the developer who looks at this somewhere down the road. State what kind of errors are being looked for, note that the JS check won't find much, and mention that the open nature of the input prevents more interesting checks.

xdmp:eval(
'import module namespace x = "' || $ns || '" at "' || $module-uri || '"; ' ||
'()',
map:new(map:entry("staticCheck", fn:true()))
)
else
xdmp:javascript-eval(
'var x = require("' || $module-uri || '");',
map:new(map:entry("staticCheck", fn:true()))
)
}
catch($ex) {
json:array-push($errors, flow:make-error-json($ex))
Expand Down