diff --git a/src/Exerciser.js b/src/Exerciser.js index 4e0cc99..927aca0 100644 --- a/src/Exerciser.js +++ b/src/Exerciser.js @@ -466,6 +466,7 @@ class Exerciser extends React.Component { + diff --git a/src/sample.js b/src/sample.js index da0c308..0920581 100644 --- a/src/sample.js +++ b/src/sample.js @@ -365,5 +365,78 @@ export default { 'book': $B.title, 'due': $L.return }` + }, + Posts: { + json: { + posts : { + byId : { + "post1" : { + id : "post1", + author : "user1", + body : "... user 1 ...", + comments : ["comment1", "comment2"] + }, + "post2" : { + id : "post2", + author : "user2", + body : "... user 2 ...", + comments : ["comment3", "comment4", "comment5"] + } + }, + allIds : ["post1", "post2"] + }, + comments : { + byId : { + "comment1" : { + id : "comment1", + author : "user2", + comment : "... comment 1 ...", + }, + "comment2" : { + id : "comment2", + author : "user3", + comment : "... comment 2 ...", + }, + "comment3" : { + id : "comment3", + author : "user3", + comment : "... comment 3 ...", + }, + "comment4" : { + id : "comment4", + author : "user1", + comment : "... comment 4 ...", + }, + "comment5" : { + id : "comment5", + author : "user3", + comment : "... comment 5 ...", + }, + }, + allIds : ["comment1", "comment2", "comment3", "commment4", "comment5"] + }, + users : { + byId : { + "user1" : { + username : "user1", + name : "User 1", + }, + "user2" : { + username : "user2", + name : "User 2", + }, + "user3" : { + username : "user3", + name : "User 3", + } + }, + allIds : ["user1", "user2", "user3"] + } + }, + jsonata: `( + $comment := function($cid) {( comments.byId.$lookup($cid) )}; + $post := function($pid) {( posts.byId.$lookup($pid) )}; + posts.allIds{$: $post($).comments.$comment($)} +)` } } \ No newline at end of file