{"action":"created","comment":{"url":"https://api.github.com/repos/foam-framework/foam2/pulls/comments/107984796","pull_request_review_id":28994216,"id":107984796,"diff_hunk":"@@ -87,6 +88,17 @@ foam.CLASS({\n        * Each key's value is network-foam-jsonified.\n        */\n       var query = [];\n+\n+      // Proxy non-serializable sinks (with either \"sink\" or an ArraySink).\n+      // When \"sink\" is serializable, make \"proxySink\" falsey as a signal to:\n+      // (1) Send the serializable sink (\" ! proxySink\" below);\n+      // (2) Signal to \"onSelectResponse\" that sink in payload should be passed\n+      //     back to caller.\n+      var proxySink = this.Serializable.isInstance(sink) ? null :","path":"src/foam/dao/RestDAO.js","position":18,"original_position":18,"commit_id":"c51af3d5ae8e187452a3274988574ab11159113d","original_commit_id":"c51af3d5ae8e187452a3274988574ab11159113d","user":{"login":"kgrgreer","id":7460787,"avatar_url":"https://avatars0.githubusercontent.com/u/7460787?v=3","gravatar_id":"","url":"https://api.github.com/users/kgrgreer","html_url":"https://github.com/kgrgreer","followers_url":"https://api.github.com/users/kgrgreer/followers","following_url":"https://api.github.com/users/kgrgreer/following{/other_user}","gists_url":"https://api.github.com/users/kgrgreer/gists{/gist_id}","starred_url":"https://api.github.com/users/kgrgreer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kgrgreer/subscriptions","organizations_url":"https://api.github.com/users/kgrgreer/orgs","repos_url":"https://api.github.com/users/kgrgreer/repos","events_url":"https://api.github.com/users/kgrgreer/events{/privacy}","received_events_url":"https://api.github.com/users/kgrgreer/received_events","type":"User","site_admin":false},"body":"Isn't this design simpler and more direct:\r\n\r\n var networkSink = this.Serializable.isInstance(sink) && sink;\r\n      if ( networkSink )\r\n        query.push('sink=' + encodeURIComponent(this.jsonify_(networkSink)));\r\n\r\n...\r\n\r\n     .then(this.onSelectResponse);\r\n\r\n\r\n function onSelectResponse(localSink, payload) {\r\n      var wasSerializable =  this.Serializable.isInstance(localSink);\r\n      var remoteSink = foam.json.parse(payload);\r\n\r\n      // If not proxying a local unserializable sink, just return the remote.\r\n      if ( wasSerializable ) return remoteSink; // Or could have been passed as a parameter\r\n\r\n      var array = remoteSink.a;\r\n      if ( ! array )\r\n        throw new Error('Expected ArraySink from REST endpoint when proxying local sink');\r\n\r\n      if ( localSink.put ) {\r\n        for ( var i = 0; i < array.length; i++ ) {\r\n          localSink.put(array[i]);\r\n        }\r\n      }\r\n      if ( localSink.eof ) localSink.eof();\r\n\r\n      return localSink;\r\n    },","created_at":"2017-03-24T19:41:43Z","updated_at":"2017-03-24T19:41:43Z","html_url":"https://github.com/foam-framework/foam2/pull/274#discussion_r107984796","pull_request_url":"https://api.github.com/repos/foam-framework/foam2/pulls/274","_links":{"self":{"href":"https://api.github.com/repos/foam-framework/foam2/pulls/comments/107984796"},"html":{"href":"https://github.com/foam-framework/foam2/pull/274#discussion_r107984796"},"pull_request":{"href":"https://api.github.com/repos/foam-framework/foam2/pulls/274"}}},"pull_request":{"url":"https://api.github.com/repos/foam-framework/foam2/pulls/274","id":112274655,"html_url":"https://github.com/foam-framework/foam2/pull/274","diff_url":"https://github.com/foam-framework/foam2/pull/274.diff","patch_url":"https://github.com/foam-framework/foam2/pull/274.patch","issue_url":"https://api.github.com/repos/foam-framework/foam2/issues/274","number":274,"state":"open","locked":false,"title":"Rest dao remote sink","user":{"login":"mdittmer","id":1775176,"avatar_url":"https://avatars0.githubusercontent.com/u/1775176?v=3","gravatar_id":"","url":"https://api.github.com/users/mdittmer","html_url":"https://github.com/mdittmer","followers_url":"https://api.github.com/users/mdittmer/followers","following_url":"https://api.github.com/users/mdittmer/following{/other_user}","gists_url":"https://api.github.com/users/mdittmer/gists{/gist_id}","starred_url":"https://api.github.com/users/mdittmer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdittmer/subscriptions","organizations_url":"https://api.github.com/users/mdittmer/orgs","repos_url":"https://api.github.com/users/mdittmer/repos","events_url":"https://api.github.com/users/mdittmer/events{/privacy}","received_events_url":"https://api.github.com/users/mdittmer/received_events","type":"User","site_admin":false},"body":"@jingt06 FYI","created_at":"2017-03-23T16:02:15Z","updated_at":"2017-03-24T19:41:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f9ab67a69bcc40d8156d055812f38d0f319394fa","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/foam-framework/foam2/pulls/274/commits","review_comments_url":"https://api.github.com/repos/foam-framework/foam2/pulls/274/comments","review_comment_url":"https://api.github.com/repos/foam-framework/foam2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/foam-framework/foam2/issues/274/comments","statuses_url":"https://api.github.com/repos/foam-framework/foam2/statuses/c51af3d5ae8e187452a3274988574ab11159113d","head":{"label":"foam-framework:rest-dao-remote-sink","ref":"rest-dao-remote-sink","sha":"c51af3d5ae8e187452a3274988574ab11159113d","user":{"login":"foam-framework","id":7460756,"avatar_url":"https://avatars2.githubusercontent.com/u/7460756?v=3","gravatar_id":"","url":"https://api.github.com/users/foam-framework","html_url":"https://github.com/foam-framework","followers_url":"https://api.github.com/users/foam-framework/followers","following_url":"https://api.github.com/users/foam-framework/following{/other_user}","gists_url":"https://api.github.com/users/foam-framework/gists{/gist_id}","starred_url":"https://api.github.com/users/foam-framework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/foam-framework/subscriptions","organizations_url":"https://api.github.com/users/foam-framework/orgs","repos_url":"https://api.github.com/users/foam-framework/repos","events_url":"https://api.github.com/users/foam-framework/events{/privacy}","received_events_url":"https://api.github.com/users/foam-framework/received_events","type":"Organization","site_admin":false},"repo":{"id":50441060,"name":"foam2","full_name":"foam-framework/foam2","owner":{"login":"foam-framework","id":7460756,"avatar_url":"https://avatars2.githubusercontent.com/u/7460756?v=3","gravatar_id":"","url":"https://api.github.com/users/foam-framework","html_url":"https://github.com/foam-framework","followers_url":"https://api.github.com/users/foam-framework/followers","following_url":"https://api.github.com/users/foam-framework/following{/other_user}","gists_url":"https://api.github.com/users/foam-framework/gists{/gist_id}","starred_url":"https://api.github.com/users/foam-framework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/foam-framework/subscriptions","organizations_url":"https://api.github.com/users/foam-framework/orgs","repos_url":"https://api.github.com/users/foam-framework/repos","events_url":"https://api.github.com/users/foam-framework/events{/privacy}","received_events_url":"https://api.github.com/users/foam-framework/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/foam-framework/foam2","description":"FOAM: Feature-Oriented Active Modeller, Version 2","fork":false,"url":"https://api.github.com/repos/foam-framework/foam2","forks_url":"https://api.github.com/repos/foam-framework/foam2/forks","keys_url":"https://api.github.com/repos/foam-framework/foam2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/foam-framework/foam2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/foam-framework/foam2/teams","hooks_url":"https://api.github.com/repos/foam-framework/foam2/hooks","issue_events_url":"https://api.github.com/repos/foam-framework/foam2/issues/events{/number}","events_url":"https://api.github.com/repos/foam-framework/foam2/events","assignees_url":"https://api.github.com/repos/foam-framework/foam2/assignees{/user}","branches_url":"https://api.github.com/repos/foam-framework/foam2/branches{/branch}","tags_url":"https://api.github.com/repos/foam-framework/foam2/tags","blobs_url":"https://api.github.com/repos/foam-framework/foam2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/foam-framework/foam2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/foam-framework/foam2/git/refs{/sha}","trees_url":"https://api.github.com/repos/foam-framework/foam2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/foam-framework/foam2/statuses/{sha}","languages_url":"https://api.github.com/repos/foam-framework/foam2/languages","stargazers_url":"https://api.github.com/repos/foam-framework/foam2/stargazers","contributors_url":"https://api.github.com/repos/foam-framework/foam2/contributors","subscribers_url":"https://api.github.com/repos/foam-framework/foam2/subscribers","subscription_url":"https://api.github.com/repos/foam-framework/foam2/subscription","commits_url":"https://api.github.com/repos/foam-framework/foam2/commits{/sha}","git_commits_url":"https://api.github.com/repos/foam-framework/foam2/git/commits{/sha}","comments_url":"https://api.github.com/repos/foam-framework/foam2/comments{/number}","issue_comment_url":"https://api.github.com/repos/foam-framework/foam2/issues/comments{/number}","contents_url":"https://api.github.com/repos/foam-framework/foam2/contents/{+path}","compare_url":"https://api.github.com/repos/foam-framework/foam2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/foam-framework/foam2/merges","archive_url":"https://api.github.com/repos/foam-framework/foam2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/foam-framework/foam2/downloads","issues_url":"https://api.github.com/repos/foam-framework/foam2/issues{/number}","pulls_url":"https://api.github.com/repos/foam-framework/foam2/pulls{/number}","milestones_url":"https://api.github.com/repos/foam-framework/foam2/milestones{/number}","notifications_url":"https://api.github.com/repos/foam-framework/foam2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/foam-framework/foam2/labels{/name}","releases_url":"https://api.github.com/repos/foam-framework/foam2/releases{/id}","deployments_url":"https://api.github.com/repos/foam-framework/foam2/deployments","created_at":"2016-01-26T16:13:38Z","updated_at":"2017-03-24T15:14:28Z","pushed_at":"2017-03-24T19:02:42Z","git_url":"git://github.com/foam-framework/foam2.git","ssh_url":"git@github.com:foam-framework/foam2.git","clone_url":"https://github.com/foam-framework/foam2.git","svn_url":"https://github.com/foam-framework/foam2","homepage":"","size":7772,"stargazers_count":6,"watchers_count":6,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":8,"mirror_url":null,"open_issues_count":107,"forks":8,"open_issues":107,"watchers":6,"default_branch":"master"}},"base":{"label":"foam-framework:master","ref":"master","sha":"be704d97428df70824fcdffa2b81e5631c567438","user":{"login":"foam-framework","id":7460756,"avatar_url":"https://avatars2.githubusercontent.com/u/7460756?v=3","gravatar_id":"","url":"https://api.github.com/users/foam-framework","html_url":"https://github.com/foam-framework","followers_url":"https://api.github.com/users/foam-framework/followers","following_url":"https://api.github.com/users/foam-framework/following{/other_user}","gists_url":"https://api.github.com/users/foam-framework/gists{/gist_id}","starred_url":"https://api.github.com/users/foam-framework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/foam-framework/subscriptions","organizations_url":"https://api.github.com/users/foam-framework/orgs","repos_url":"https://api.github.com/users/foam-framework/repos","events_url":"https://api.github.com/users/foam-framework/events{/privacy}","received_events_url":"https://api.github.com/users/foam-framework/received_events","type":"Organization","site_admin":false},"repo":{"id":50441060,"name":"foam2","full_name":"foam-framework/foam2","owner":{"login":"foam-framework","id":7460756,"avatar_url":"https://avatars2.githubusercontent.com/u/7460756?v=3","gravatar_id":"","url":"https://api.github.com/users/foam-framework","html_url":"https://github.com/foam-framework","followers_url":"https://api.github.com/users/foam-framework/followers","following_url":"https://api.github.com/users/foam-framework/following{/other_user}","gists_url":"https://api.github.com/users/foam-framework/gists{/gist_id}","starred_url":"https://api.github.com/users/foam-framework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/foam-framework/subscriptions","organizations_url":"https://api.github.com/users/foam-framework/orgs","repos_url":"https://api.github.com/users/foam-framework/repos","events_url":"https://api.github.com/users/foam-framework/events{/privacy}","received_events_url":"https://api.github.com/users/foam-framework/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/foam-framework/foam2","description":"FOAM: Feature-Oriented Active Modeller, Version 2","fork":false,"url":"https://api.github.com/repos/foam-framework/foam2","forks_url":"https://api.github.com/repos/foam-framework/foam2/forks","keys_url":"https://api.github.com/repos/foam-framework/foam2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/foam-framework/foam2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/foam-framework/foam2/teams","hooks_url":"https://api.github.com/repos/foam-framework/foam2/hooks","issue_events_url":"https://api.github.com/repos/foam-framework/foam2/issues/events{/number}","events_url":"https://api.github.com/repos/foam-framework/foam2/events","assignees_url":"https://api.github.com/repos/foam-framework/foam2/assignees{/user}","branches_url":"https://api.github.com/repos/foam-framework/foam2/branches{/branch}","tags_url":"https://api.github.com/repos/foam-framework/foam2/tags","blobs_url":"https://api.github.com/repos/foam-framework/foam2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/foam-framework/foam2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/foam-framework/foam2/git/refs{/sha}","trees_url":"https://api.github.com/repos/foam-framework/foam2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/foam-framework/foam2/statuses/{sha}","languages_url":"https://api.github.com/repos/foam-framework/foam2/languages","stargazers_url":"https://api.github.com/repos/foam-framework/foam2/stargazers","contributors_url":"https://api.github.com/repos/foam-framework/foam2/contributors","subscribers_url":"https://api.github.com/repos/foam-framework/foam2/subscribers","subscription_url":"https://api.github.com/repos/foam-framework/foam2/subscription","commits_url":"https://api.github.com/repos/foam-framework/foam2/commits{/sha}","git_commits_url":"https://api.github.com/repos/foam-framework/foam2/git/commits{/sha}","comments_url":"https://api.github.com/repos/foam-framework/foam2/comments{/number}","issue_comment_url":"https://api.github.com/repos/foam-framework/foam2/issues/comments{/number}","contents_url":"https://api.github.com/repos/foam-framework/foam2/contents/{+path}","compare_url":"https://api.github.com/repos/foam-framework/foam2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/foam-framework/foam2/merges","archive_url":"https://api.github.com/repos/foam-framework/foam2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/foam-framework/foam2/downloads","issues_url":"https://api.github.com/repos/foam-framework/foam2/issues{/number}","pulls_url":"https://api.github.com/repos/foam-framework/foam2/pulls{/number}","milestones_url":"https://api.github.com/repos/foam-framework/foam2/milestones{/number}","notifications_url":"https://api.github.com/repos/foam-framework/foam2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/foam-framework/foam2/labels{/name}","releases_url":"https://api.github.com/repos/foam-framework/foam2/releases{/id}","deployments_url":"https://api.github.com/repos/foam-framework/foam2/deployments","created_at":"2016-01-26T16:13:38Z","updated_at":"2017-03-24T15:14:28Z","pushed_at":"2017-03-24T19:02:42Z","git_url":"git://github.com/foam-framework/foam2.git","ssh_url":"git@github.com:foam-framework/foam2.git","clone_url":"https://github.com/foam-framework/foam2.git","svn_url":"https://github.com/foam-framework/foam2","homepage":"","size":7772,"stargazers_count":6,"watchers_count":6,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":8,"mirror_url":null,"open_issues_count":107,"forks":8,"open_issues":107,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/foam-framework/foam2/pulls/274"},"html":{"href":"https://github.com/foam-framework/foam2/pull/274"},"issue":{"href":"https://api.github.com/repos/foam-framework/foam2/issues/274"},"comments":{"href":"https://api.github.com/repos/foam-framework/foam2/issues/274/comments"},"review_comments":{"href":"https://api.github.com/repos/foam-framework/foam2/pulls/274/comments"},"review_comment":{"href":"https://api.github.com/repos/foam-framework/foam2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/foam-framework/foam2/pulls/274/commits"},"statuses":{"href":"https://api.github.com/repos/foam-framework/foam2/statuses/c51af3d5ae8e187452a3274988574ab11159113d"}}}}
{"actor":{"display_login":"kgrgreer"}}