{"action":"created","comment":{"url":"https://api.github.com/repos/vtex/toolbelt/pulls/comments/87471178","pull_request_review_id":8083640,"id":87471178,"diff_hunk":"@@ -63,38 +71,67 @@ const logToConsole = (level, origin, message) => {\n   levelFormat[level](`[${time}] ${text}`)\n }\n \n-const originMatch = (origin) => {\n-  const {vendor, name, version} = manifest\n-  const local = `${vendor}.${name}@${version.substring(0, 0)}`\n-  return local === origin.substring(0, origin.indexOf('@') + 1)\n+const appByMajor = (app) => {\n+  const versionIndex = app.indexOf('@')\n+  return versionIndex > -1\n+    ? app.substring(0, versionIndex + 2) : app\n }\n \n-const listen = (account, workspace, authToken) => {\n-  let es = new EventSource(`${courierHost}/${account}/${workspace}/app-events?level=${log.level}`, {\n+const getOriginByManifest = () => {\n+  const {name, vendor, version} = manifest.name\n+  return `${vendor}.${name}@${version}`\n+}\n+\n+const originMatch = (msgOrigin, origin = []) => {\n+  const msgOriginByMajor = appByMajor(msgOrigin)\n+  if (origin.length === 0) {\n+    origin.push(getOriginByManifest())\n+  }\n+  return any(app => msgOriginByMajor.indexOf(app) > -1, map(appByMajor, origin))\n+}\n+\n+const listen = (account, workspace, authToken, {timeout: {duration, action}, origin, callback}) => {","path":"src/courier.js","position":72,"original_position":72,"commit_id":"e3f19a424e8730ccc016282cf2d4d05ea26cf253","original_commit_id":"e3f19a424e8730ccc016282cf2d4d05ea26cf253","user":{"login":"firstdoit","id":1633518,"avatar_url":"https://avatars.githubusercontent.com/u/1633518?v=3","gravatar_id":"","url":"https://api.github.com/users/firstdoit","html_url":"https://github.com/firstdoit","followers_url":"https://api.github.com/users/firstdoit/followers","following_url":"https://api.github.com/users/firstdoit/following{/other_user}","gists_url":"https://api.github.com/users/firstdoit/gists{/gist_id}","starred_url":"https://api.github.com/users/firstdoit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/firstdoit/subscriptions","organizations_url":"https://api.github.com/users/firstdoit/orgs","repos_url":"https://api.github.com/users/firstdoit/repos","events_url":"https://api.github.com/users/firstdoit/events{/privacy}","received_events_url":"https://api.github.com/users/firstdoit/received_events","type":"User","site_admin":false},"body":"OK. Nevertheless, the feedback remains: I would not easily imagine the difference between them.","created_at":"2016-11-10T19:45:12Z","updated_at":"2016-11-10T19:45:12Z","html_url":"https://github.com/vtex/toolbelt/pull/225#discussion_r87471178","pull_request_url":"https://api.github.com/repos/vtex/toolbelt/pulls/225","_links":{"self":{"href":"https://api.github.com/repos/vtex/toolbelt/pulls/comments/87471178"},"html":{"href":"https://github.com/vtex/toolbelt/pull/225#discussion_r87471178"},"pull_request":{"href":"https://api.github.com/repos/vtex/toolbelt/pulls/225"}}},"pull_request":{"url":"https://api.github.com/repos/vtex/toolbelt/pulls/225","id":93014904,"html_url":"https://github.com/vtex/toolbelt/pull/225","diff_url":"https://github.com/vtex/toolbelt/pull/225.diff","patch_url":"https://github.com/vtex/toolbelt/pull/225.patch","issue_url":"https://api.github.com/repos/vtex/toolbelt/issues/225","number":225,"state":"open","locked":false,"title":"Add loaders for install and uninstall commands","user":{"login":"tamorim","id":5040487,"avatar_url":"https://avatars.githubusercontent.com/u/5040487?v=3","gravatar_id":"","url":"https://api.github.com/users/tamorim","html_url":"https://github.com/tamorim","followers_url":"https://api.github.com/users/tamorim/followers","following_url":"https://api.github.com/users/tamorim/following{/other_user}","gists_url":"https://api.github.com/users/tamorim/gists{/gist_id}","starred_url":"https://api.github.com/users/tamorim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tamorim/subscriptions","organizations_url":"https://api.github.com/users/tamorim/orgs","repos_url":"https://api.github.com/users/tamorim/repos","events_url":"https://api.github.com/users/tamorim/events{/privacy}","received_events_url":"https://api.github.com/users/tamorim/received_events","type":"User","site_admin":false},"body":"#### What is the purpose of this pull request?\r\nWhen you install or uninstall an app the VTEX Apps response is just a part of what actually happens on the background.\r\n\r\nIf you install a render app, for example, after the VTEX Apps response the render service still have to pick up the installed app and build a bundle with it.\r\n\r\nIf you install and switch directly to the page, you won't see what you wanted because render is still working it's magic.\r\n\r\nThis PR aims to fix that by adding loaders and connecting with the courier service to receive the messages that other systems may pass when working with the install or uninstall of an app.\r\n\r\n#### What problem is this solving?\r\ninstall/uninstall commands being too simple on it's success.\r\n\r\n#### How should this be manually tested?\r\nJust try to install or uninstall any app on your workspace :smiley: \r\n\r\n#### Screenshots or example usage\r\nn/a\r\n\r\n#### Types of changes\r\n- [ ] Bug fix (non-breaking change which fixes an issue)\r\n- [x] New feature (non-breaking change which adds functionality)\r\n- [ ] Breaking change (fix or feature that would cause existing functionality to change)\r\n- [ ] Requires change to documentation, which has been updated accordingly.\r\n","created_at":"2016-11-09T18:33:27Z","updated_at":"2016-11-10T19:45:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e415c90ea568ef31d44b96fe06144a23a49034ac","assignee":{"login":"firstdoit","id":1633518,"avatar_url":"https://avatars.githubusercontent.com/u/1633518?v=3","gravatar_id":"","url":"https://api.github.com/users/firstdoit","html_url":"https://github.com/firstdoit","followers_url":"https://api.github.com/users/firstdoit/followers","following_url":"https://api.github.com/users/firstdoit/following{/other_user}","gists_url":"https://api.github.com/users/firstdoit/gists{/gist_id}","starred_url":"https://api.github.com/users/firstdoit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/firstdoit/subscriptions","organizations_url":"https://api.github.com/users/firstdoit/orgs","repos_url":"https://api.github.com/users/firstdoit/repos","events_url":"https://api.github.com/users/firstdoit/events{/privacy}","received_events_url":"https://api.github.com/users/firstdoit/received_events","type":"User","site_admin":false},"assignees":[{"login":"firstdoit","id":1633518,"avatar_url":"https://avatars.githubusercontent.com/u/1633518?v=3","gravatar_id":"","url":"https://api.github.com/users/firstdoit","html_url":"https://github.com/firstdoit","followers_url":"https://api.github.com/users/firstdoit/followers","following_url":"https://api.github.com/users/firstdoit/following{/other_user}","gists_url":"https://api.github.com/users/firstdoit/gists{/gist_id}","starred_url":"https://api.github.com/users/firstdoit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/firstdoit/subscriptions","organizations_url":"https://api.github.com/users/firstdoit/orgs","repos_url":"https://api.github.com/users/firstdoit/repos","events_url":"https://api.github.com/users/firstdoit/events{/privacy}","received_events_url":"https://api.github.com/users/firstdoit/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/vtex/toolbelt/pulls/225/commits","review_comments_url":"https://api.github.com/repos/vtex/toolbelt/pulls/225/comments","review_comment_url":"https://api.github.com/repos/vtex/toolbelt/pulls/comments{/number}","comments_url":"https://api.github.com/repos/vtex/toolbelt/issues/225/comments","statuses_url":"https://api.github.com/repos/vtex/toolbelt/statuses/e3f19a424e8730ccc016282cf2d4d05ea26cf253","head":{"label":"vtex:feature/install-loader","ref":"feature/install-loader","sha":"e3f19a424e8730ccc016282cf2d4d05ea26cf253","user":{"login":"vtex","id":1288938,"avatar_url":"https://avatars.githubusercontent.com/u/1288938?v=3","gravatar_id":"","url":"https://api.github.com/users/vtex","html_url":"https://github.com/vtex","followers_url":"https://api.github.com/users/vtex/followers","following_url":"https://api.github.com/users/vtex/following{/other_user}","gists_url":"https://api.github.com/users/vtex/gists{/gist_id}","starred_url":"https://api.github.com/users/vtex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vtex/subscriptions","organizations_url":"https://api.github.com/users/vtex/orgs","repos_url":"https://api.github.com/users/vtex/repos","events_url":"https://api.github.com/users/vtex/events{/privacy}","received_events_url":"https://api.github.com/users/vtex/received_events","type":"Organization","site_admin":false},"repo":{"id":31599241,"name":"toolbelt","full_name":"vtex/toolbelt","owner":{"login":"vtex","id":1288938,"avatar_url":"https://avatars.githubusercontent.com/u/1288938?v=3","gravatar_id":"","url":"https://api.github.com/users/vtex","html_url":"https://github.com/vtex","followers_url":"https://api.github.com/users/vtex/followers","following_url":"https://api.github.com/users/vtex/following{/other_user}","gists_url":"https://api.github.com/users/vtex/gists{/gist_id}","starred_url":"https://api.github.com/users/vtex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vtex/subscriptions","organizations_url":"https://api.github.com/users/vtex/orgs","repos_url":"https://api.github.com/users/vtex/repos","events_url":"https://api.github.com/users/vtex/events{/privacy}","received_events_url":"https://api.github.com/users/vtex/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/vtex/toolbelt","description":"CLI tool for creating and managing VTEX apps","fork":false,"url":"https://api.github.com/repos/vtex/toolbelt","forks_url":"https://api.github.com/repos/vtex/toolbelt/forks","keys_url":"https://api.github.com/repos/vtex/toolbelt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vtex/toolbelt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vtex/toolbelt/teams","hooks_url":"https://api.github.com/repos/vtex/toolbelt/hooks","issue_events_url":"https://api.github.com/repos/vtex/toolbelt/issues/events{/number}","events_url":"https://api.github.com/repos/vtex/toolbelt/events","assignees_url":"https://api.github.com/repos/vtex/toolbelt/assignees{/user}","branches_url":"https://api.github.com/repos/vtex/toolbelt/branches{/branch}","tags_url":"https://api.github.com/repos/vtex/toolbelt/tags","blobs_url":"https://api.github.com/repos/vtex/toolbelt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vtex/toolbelt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vtex/toolbelt/git/refs{/sha}","trees_url":"https://api.github.com/repos/vtex/toolbelt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vtex/toolbelt/statuses/{sha}","languages_url":"https://api.github.com/repos/vtex/toolbelt/languages","stargazers_url":"https://api.github.com/repos/vtex/toolbelt/stargazers","contributors_url":"https://api.github.com/repos/vtex/toolbelt/contributors","subscribers_url":"https://api.github.com/repos/vtex/toolbelt/subscribers","subscription_url":"https://api.github.com/repos/vtex/toolbelt/subscription","commits_url":"https://api.github.com/repos/vtex/toolbelt/commits{/sha}","git_commits_url":"https://api.github.com/repos/vtex/toolbelt/git/commits{/sha}","comments_url":"https://api.github.com/repos/vtex/toolbelt/comments{/number}","issue_comment_url":"https://api.github.com/repos/vtex/toolbelt/issues/comments{/number}","contents_url":"https://api.github.com/repos/vtex/toolbelt/contents/{+path}","compare_url":"https://api.github.com/repos/vtex/toolbelt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vtex/toolbelt/merges","archive_url":"https://api.github.com/repos/vtex/toolbelt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vtex/toolbelt/downloads","issues_url":"https://api.github.com/repos/vtex/toolbelt/issues{/number}","pulls_url":"https://api.github.com/repos/vtex/toolbelt/pulls{/number}","milestones_url":"https://api.github.com/repos/vtex/toolbelt/milestones{/number}","notifications_url":"https://api.github.com/repos/vtex/toolbelt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vtex/toolbelt/labels{/name}","releases_url":"https://api.github.com/repos/vtex/toolbelt/releases{/id}","deployments_url":"https://api.github.com/repos/vtex/toolbelt/deployments","created_at":"2015-03-03T13:18:10Z","updated_at":"2016-11-03T19:33:51Z","pushed_at":"2016-11-10T17:21:38Z","git_url":"git://github.com/vtex/toolbelt.git","ssh_url":"git@github.com:vtex/toolbelt.git","clone_url":"https://github.com/vtex/toolbelt.git","svn_url":"https://github.com/vtex/toolbelt","homepage":"","size":587,"stargazers_count":9,"watchers_count":9,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":10,"forks":2,"open_issues":10,"watchers":9,"default_branch":"master"}},"base":{"label":"vtex:master","ref":"master","sha":"5e26a5d4b1edf6ccc540c7199be36deed57d3d62","user":{"login":"vtex","id":1288938,"avatar_url":"https://avatars.githubusercontent.com/u/1288938?v=3","gravatar_id":"","url":"https://api.github.com/users/vtex","html_url":"https://github.com/vtex","followers_url":"https://api.github.com/users/vtex/followers","following_url":"https://api.github.com/users/vtex/following{/other_user}","gists_url":"https://api.github.com/users/vtex/gists{/gist_id}","starred_url":"https://api.github.com/users/vtex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vtex/subscriptions","organizations_url":"https://api.github.com/users/vtex/orgs","repos_url":"https://api.github.com/users/vtex/repos","events_url":"https://api.github.com/users/vtex/events{/privacy}","received_events_url":"https://api.github.com/users/vtex/received_events","type":"Organization","site_admin":false},"repo":{"id":31599241,"name":"toolbelt","full_name":"vtex/toolbelt","owner":{"login":"vtex","id":1288938,"avatar_url":"https://avatars.githubusercontent.com/u/1288938?v=3","gravatar_id":"","url":"https://api.github.com/users/vtex","html_url":"https://github.com/vtex","followers_url":"https://api.github.com/users/vtex/followers","following_url":"https://api.github.com/users/vtex/following{/other_user}","gists_url":"https://api.github.com/users/vtex/gists{/gist_id}","starred_url":"https://api.github.com/users/vtex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vtex/subscriptions","organizations_url":"https://api.github.com/users/vtex/orgs","repos_url":"https://api.github.com/users/vtex/repos","events_url":"https://api.github.com/users/vtex/events{/privacy}","received_events_url":"https://api.github.com/users/vtex/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/vtex/toolbelt","description":"CLI tool for creating and managing VTEX apps","fork":false,"url":"https://api.github.com/repos/vtex/toolbelt","forks_url":"https://api.github.com/repos/vtex/toolbelt/forks","keys_url":"https://api.github.com/repos/vtex/toolbelt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vtex/toolbelt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vtex/toolbelt/teams","hooks_url":"https://api.github.com/repos/vtex/toolbelt/hooks","issue_events_url":"https://api.github.com/repos/vtex/toolbelt/issues/events{/number}","events_url":"https://api.github.com/repos/vtex/toolbelt/events","assignees_url":"https://api.github.com/repos/vtex/toolbelt/assignees{/user}","branches_url":"https://api.github.com/repos/vtex/toolbelt/branches{/branch}","tags_url":"https://api.github.com/repos/vtex/toolbelt/tags","blobs_url":"https://api.github.com/repos/vtex/toolbelt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vtex/toolbelt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vtex/toolbelt/git/refs{/sha}","trees_url":"https://api.github.com/repos/vtex/toolbelt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vtex/toolbelt/statuses/{sha}","languages_url":"https://api.github.com/repos/vtex/toolbelt/languages","stargazers_url":"https://api.github.com/repos/vtex/toolbelt/stargazers","contributors_url":"https://api.github.com/repos/vtex/toolbelt/contributors","subscribers_url":"https://api.github.com/repos/vtex/toolbelt/subscribers","subscription_url":"https://api.github.com/repos/vtex/toolbelt/subscription","commits_url":"https://api.github.com/repos/vtex/toolbelt/commits{/sha}","git_commits_url":"https://api.github.com/repos/vtex/toolbelt/git/commits{/sha}","comments_url":"https://api.github.com/repos/vtex/toolbelt/comments{/number}","issue_comment_url":"https://api.github.com/repos/vtex/toolbelt/issues/comments{/number}","contents_url":"https://api.github.com/repos/vtex/toolbelt/contents/{+path}","compare_url":"https://api.github.com/repos/vtex/toolbelt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vtex/toolbelt/merges","archive_url":"https://api.github.com/repos/vtex/toolbelt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vtex/toolbelt/downloads","issues_url":"https://api.github.com/repos/vtex/toolbelt/issues{/number}","pulls_url":"https://api.github.com/repos/vtex/toolbelt/pulls{/number}","milestones_url":"https://api.github.com/repos/vtex/toolbelt/milestones{/number}","notifications_url":"https://api.github.com/repos/vtex/toolbelt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vtex/toolbelt/labels{/name}","releases_url":"https://api.github.com/repos/vtex/toolbelt/releases{/id}","deployments_url":"https://api.github.com/repos/vtex/toolbelt/deployments","created_at":"2015-03-03T13:18:10Z","updated_at":"2016-11-03T19:33:51Z","pushed_at":"2016-11-10T17:21:38Z","git_url":"git://github.com/vtex/toolbelt.git","ssh_url":"git@github.com:vtex/toolbelt.git","clone_url":"https://github.com/vtex/toolbelt.git","svn_url":"https://github.com/vtex/toolbelt","homepage":"","size":587,"stargazers_count":9,"watchers_count":9,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":10,"forks":2,"open_issues":10,"watchers":9,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/vtex/toolbelt/pulls/225"},"html":{"href":"https://github.com/vtex/toolbelt/pull/225"},"issue":{"href":"https://api.github.com/repos/vtex/toolbelt/issues/225"},"comments":{"href":"https://api.github.com/repos/vtex/toolbelt/issues/225/comments"},"review_comments":{"href":"https://api.github.com/repos/vtex/toolbelt/pulls/225/comments"},"review_comment":{"href":"https://api.github.com/repos/vtex/toolbelt/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/vtex/toolbelt/pulls/225/commits"},"statuses":{"href":"https://api.github.com/repos/vtex/toolbelt/statuses/e3f19a424e8730ccc016282cf2d4d05ea26cf253"}}}}
{"actor":{"display_login":"firstdoit"}}