Skip to content

Commit 8959440

Browse files
committed
Merge branch 'master' into 75-SwaggerUIForHubAPIs
* master: fixed #158 fixed #159
2 parents 1333d57 + 5dade4c commit 8959440

File tree

6 files changed

+28
-7
lines changed

6 files changed

+28
-7
lines changed

marklogic-data-hub/src/main/resources/ml-modules/root/com.marklogic.hub/lib/flow-lib.xqy

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,9 +486,16 @@ declare function flow:run-flow(
486486
:)
487487
declare function flow:make-envelope($map as map:map, $data-format as xs:string)
488488
{
489-
xdmp:log(("map:", $map)),
490489
if ($data-format eq "application/json") then
491-
xdmp:to-json($map)/node()
490+
let $headers := fn:head((map:get($map, "headers"), json:array()))
491+
let $triples := fn:head((map:get($map, "triples"), json:array()))
492+
let $content := fn:head((map:get($map, "content"), json:object()))
493+
return
494+
xdmp:to-json(map:new((
495+
map:entry("headers", $headers),
496+
map:entry("triples", $triples),
497+
map:entry("content", $content)
498+
)))/node()
492499
else
493500
<envelope xmlns="http://marklogic.com/data-hub/envelope">
494501
<headers>{map:get($map, "headers")}</headers>

marklogic-data-hub/src/main/resources/scaffolding/conformance/sjs/content.sjs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,16 @@
1010
* @return - your content
1111
*/
1212
function createContent(id, content, headers, triples, options) {
13-
return cts.doc(id).xpath('/*:envelope/*:content/node()');
13+
var root = cts.doc(id).root;
14+
15+
// for xml we need to use xpath
16+
if (xdmp.nodeKind(root) === 'element') {
17+
return root.xpath('/*:envelope/*:content/node()');
18+
}
19+
// for json we need to return the content
20+
else {
21+
return root.content;
22+
}
1423
}
1524

1625
module.exports = {

marklogic-data-hub/src/main/resources/scaffolding/conformance/sjs/headers.sjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* @return - an array of header objects
1111
*/
1212
function createHeaders(id, content, headers, triples, options) {
13-
return null;
13+
return [];
1414
}
1515

1616
module.exports = {

marklogic-data-hub/src/main/resources/scaffolding/conformance/sjs/triples.sjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* @return - an array of triples
1111
*/
1212
function createTriples(id, content, headers, triples, options) {
13-
return null;
13+
return [];
1414
}
1515

1616
module.exports = {

marklogic-data-hub/src/main/resources/scaffolding/conformance/xqy/content.xqy

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,10 @@ declare function plugin:create-content(
2424
$triples as sem:triple*,
2525
$options as map:map) as node()?
2626
{
27-
fn:doc($id)/envelope:envelope/envelope:content/node()
27+
let $doc := fn:doc($id)
28+
return
29+
if ($doc/envelope:envelope) then
30+
$doc/envelope:envelope/envelope:content/node()
31+
else
32+
$doc/content
2833
};

quick-start/src/main/resources/static/app/services/dataHubService.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
self.status = data;
4040
if (!self.status.installed) {
4141
self.action.type = 'Install';
42-
self.action.message = 'Install is in progress...';
42+
self.action.message = 'Installing the Data Hub into MarkLogic...';
4343
self.action.progressType = 'success';
4444
}
4545
})

0 commit comments

Comments
 (0)