File tree Expand file tree Collapse file tree 1 file changed +24
-8
lines changed
marklogic-data-hub/src/main/resources/ml-modules/root/com.marklogic.hub/lib Expand file tree Collapse file tree 1 file changed +24
-8
lines changed Original file line number Diff line number Diff line change @@ -612,16 +612,32 @@ declare function flow:validate-entities()
612612 let $_ :=
613613 for $plugin in $flow/hub:plugins/hub:plugin
614614 let $destination := $plugin/@dest
615+ let $module-uri := $plugin/@module
616+ let $module-name := hul:get-module-name ($module-uri)
617+ let $filename as xs:string := hul:get-file-from-uri ($module-uri)
618+ let $type := flow:get-type ($filename)
619+ let $ns :=
620+ if ($type eq $flow:TYPE-JAVASCRIPT) then ()
621+ else
622+ $flow:PLUGIN-NS || fn:lower-case ($module-name)
623+ let $func-name :=
624+ if ($type eq $flow:TYPE-JAVASCRIPT) then
625+ "create" || functx:capitalize-first ($destination)
626+ else
627+ "create-" || $destination
615628 return
616629 try {
617- flow:run-plugin (
618- $plugin,
619- $data-format,
620- "123" ,
621- (),
622- (),
623- (),
624- $options)
630+ if ($type eq $flow:TYPE-XQUERY) then
631+ xdmp:eval (
632+ 'import module namespace x = "' || $ns || '" at "' || $module-uri || '"; ' ||
633+ '()' ,
634+ map:new (map:entry ("staticCheck" , fn:true ()))
635+ )
636+ else
637+ xdmp:javascript-eval (
638+ 'var x = require("' || $module-uri || '");' ,
639+ map:new (map:entry ("staticCheck" , fn:true ()))
640+ )
625641 }
626642 catch ($ex) {
627643 json:array-push ($errors, flow:make-error-json ($ex))
You can’t perform that action at this time.
0 commit comments