{"action":"created","comment":{"url":"https://api.github.com/repos/slamdata/slamdata/pulls/comments/60596356","id":60596356,"diff_hunk":"@@ -61,72 +59,136 @@ import Control.Monad.Eff.Class (liftEff)\n import Control.Monad.Eff.Exception as Exn\n import Control.Monad.Eff.Ref as Ref\n import Control.Monad.Error.Class as Err\n-import Control.UI.Browser (encodeURIComponent)\n+import Control.Monad.Except.Trans (ExceptT(..), runExceptT)\n+import Control.Monad.Reader.Trans (runReaderT)\n \n-import Data.Argonaut ((~>), (:=), (.?))\n+import Data.Argonaut ((~>), (:=))\n import Data.Argonaut as JS\n import Data.Array as Arr\n import Data.Date as Date\n-import Data.Foreign (F, parseJSON)\n-import Data.Foreign.Class (class IsForeign, readProp, read)\n-import Data.Foreign.Index (prop)\n-import Data.Foreign.NullOrUndefined (runNullOrUndefined)\n-import Data.HTTP.Method (Method(..))\n import Data.Lens ((.~), (^.))\n import Data.List as L\n import Data.MediaType (MediaType(..), mediaTypeToString)\n-import Data.MediaType.Common (applicationJSON)\n import Data.Path.Pathy ((</>))\n import Data.Path.Pathy as P\n import Data.Set as Set\n import Data.String as S\n import Data.StrMap as SM\n-import Data.Time as Time\n-import Data.URI (runParseAbsoluteURI) as URI\n-import Data.URI.Types (AbsoluteURI(..), Query(..), URIScheme(..)) as URI\n \n import DOM (DOM)\n \n+import Global (encodeURIComponent)\n+\n import Network.HTTP.Affjax as AX\n-import Network.HTTP.Affjax.Request (class Requestable)\n-import Network.HTTP.Affjax.Response (class Respondable, ResponseType(..))\n import Network.HTTP.RequestHeader (RequestHeader(..))\n-import Network.HTTP.StatusCode (StatusCode(..))\n \n-import Quasar.Paths as Paths\n-import Quasar.Auth (IdToken, authHeader) as Auth\n-import Quasar.Auth.Permission as Perm\n-import Quasar.Auth.Provider (Provider) as Auth\n+import OIDCCryptUtils.Types as OIDC\n \n--- TODO: split out a core Quasar module that only deals with the API, and\n--- doesn't know about SlamData specific things.\n import SlamData.Config as Config\n import SlamData.FileSystem.Resource as R\n \n import Utils.Completions (memoizeCompletionStrs)\n import Utils.Path as PU\n \n-successStatus ∷ StatusCode\n-successStatus = StatusCode 200\n+-- -------------------------------------------------------------------------- --\n+\n+import Quasar.Advanced.Auth (PermissionToken) as Auth\n+import Quasar.Advanced.Auth.Provider (Provider) as Auth\n+import Quasar.Advanced.QuasarAF as QF\n+import Quasar.Advanced.QuasarAF.Interpreter.Aff as QFA\n+import Quasar.Data (QData(..), JSONMode(..))\n+import Quasar.Error (lowerQError)\n+import Quasar.FS as QFS\n+import Quasar.Mount as QM\n+import Quasar.Mount.MongoDB as QMountMDB\n+import Quasar.Mount.View as QMountV\n+\n+rqf'\n+  ∷ ∀ eff a\n+  . Maybe OIDC.IdToken\n+  → Array Auth.PermissionToken\n+  → QF.QuasarAFP (Either QF.QError a)\n+  → Aff (ajax ∷ AX.AJAX | eff) (Either QF.QError a)\n+rqf' idToken permissions qf =\n+  runReaderT (QFA.eval qf) { basePath: \"\", idToken, permissions }\n+\n+rqf\n+  ∷ ∀ eff a\n+  . Maybe OIDC.IdToken\n+  → Array Auth.PermissionToken\n+  → QF.QuasarAFP (Either QF.QError a)\n+  → Aff (ajax ∷ AX.AJAX | eff) (Either Exn.Error a)\n+rqf idToken permissions qf = lmap lowerQError <$> rqf' idToken permissions qf\n+\n+qfError ∷ ∀ a. String → Either QF.QError a\n+qfError = Left <<< QF.Error <<< Exn.error\n+\n+raiseError ∷ ∀ m a. Applicative m ⇒ String → m (Either QF.QError a)\n+raiseError = pure <<< qfError\n+\n+unattempt ∷ ∀ eff a. Aff eff (Either QF.QError a) → Aff eff a\n+unattempt aff = aff >>= \\x → case x of\n+  Left QF.NotFound → Err.throwError (Exn.error \"Resource not found\")\n+  Left (QF.Error err) → Err.throwError err\n+  Right x' → pure x'","path":"src/Quasar/Aff.purs","position":125,"original_position":125,"commit_id":"65f1c28b8878c359405d77530a48c633f2b9a9f8","original_commit_id":"65f1c28b8878c359405d77530a48c633f2b9a9f8","user":{"login":"garyb","id":693642,"avatar_url":"https://avatars.githubusercontent.com/u/693642?v=3","gravatar_id":"","url":"https://api.github.com/users/garyb","html_url":"https://github.com/garyb","followers_url":"https://api.github.com/users/garyb/followers","following_url":"https://api.github.com/users/garyb/following{/other_user}","gists_url":"https://api.github.com/users/garyb/gists{/gist_id}","starred_url":"https://api.github.com/users/garyb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garyb/subscriptions","organizations_url":"https://api.github.com/users/garyb/orgs","repos_url":"https://api.github.com/users/garyb/repos","events_url":"https://api.github.com/users/garyb/events{/privacy}","received_events_url":"https://api.github.com/users/garyb/received_events","type":"User","site_admin":false},"body":"`unattempt` is dead code, I just removed it locally - it was used while I was transitioning over to everything using `Either`.","created_at":"2016-04-21T15:02:17Z","updated_at":"2016-04-21T15:02:17Z","html_url":"https://github.com/slamdata/slamdata/pull/708#discussion_r60596356","pull_request_url":"https://api.github.com/repos/slamdata/slamdata/pulls/708","_links":{"self":{"href":"https://api.github.com/repos/slamdata/slamdata/pulls/comments/60596356"},"html":{"href":"https://github.com/slamdata/slamdata/pull/708#discussion_r60596356"},"pull_request":{"href":"https://api.github.com/repos/slamdata/slamdata/pulls/708"}}},"pull_request":{"url":"https://api.github.com/repos/slamdata/slamdata/pulls/708","id":66054575,"html_url":"https://github.com/slamdata/slamdata/pull/708","diff_url":"https://github.com/slamdata/slamdata/pull/708.diff","patch_url":"https://github.com/slamdata/slamdata/pull/708.patch","issue_url":"https://api.github.com/repos/slamdata/slamdata/issues/708","number":708,"state":"open","locked":false,"title":"SD-1489 Initial changes for QuasarF","user":{"login":"garyb","id":693642,"avatar_url":"https://avatars.githubusercontent.com/u/693642?v=3","gravatar_id":"","url":"https://api.github.com/users/garyb","html_url":"https://github.com/garyb","followers_url":"https://api.github.com/users/garyb/followers","following_url":"https://api.github.com/users/garyb/following{/other_user}","gists_url":"https://api.github.com/users/garyb/gists{/gist_id}","starred_url":"https://api.github.com/users/garyb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garyb/subscriptions","organizations_url":"https://api.github.com/users/garyb/orgs","repos_url":"https://api.github.com/users/garyb/repos","events_url":"https://api.github.com/users/garyb/events{/privacy}","received_events_url":"https://api.github.com/users/garyb/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-04-11T20:12:35Z","updated_at":"2016-04-21T15:02:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"96eb4b0ee7df95a07801ed415a4acf9674677e68","assignee":{"login":"garyb","id":693642,"avatar_url":"https://avatars.githubusercontent.com/u/693642?v=3","gravatar_id":"","url":"https://api.github.com/users/garyb","html_url":"https://github.com/garyb","followers_url":"https://api.github.com/users/garyb/followers","following_url":"https://api.github.com/users/garyb/following{/other_user}","gists_url":"https://api.github.com/users/garyb/gists{/gist_id}","starred_url":"https://api.github.com/users/garyb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garyb/subscriptions","organizations_url":"https://api.github.com/users/garyb/orgs","repos_url":"https://api.github.com/users/garyb/repos","events_url":"https://api.github.com/users/garyb/events{/privacy}","received_events_url":"https://api.github.com/users/garyb/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/slamdata/slamdata/pulls/708/commits","review_comments_url":"https://api.github.com/repos/slamdata/slamdata/pulls/708/comments","review_comment_url":"https://api.github.com/repos/slamdata/slamdata/pulls/comments{/number}","comments_url":"https://api.github.com/repos/slamdata/slamdata/issues/708/comments","statuses_url":"https://api.github.com/repos/slamdata/slamdata/statuses/65f1c28b8878c359405d77530a48c633f2b9a9f8","head":{"label":"garyb:quasarf","ref":"quasarf","sha":"65f1c28b8878c359405d77530a48c633f2b9a9f8","user":{"login":"garyb","id":693642,"avatar_url":"https://avatars.githubusercontent.com/u/693642?v=3","gravatar_id":"","url":"https://api.github.com/users/garyb","html_url":"https://github.com/garyb","followers_url":"https://api.github.com/users/garyb/followers","following_url":"https://api.github.com/users/garyb/following{/other_user}","gists_url":"https://api.github.com/users/garyb/gists{/gist_id}","starred_url":"https://api.github.com/users/garyb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garyb/subscriptions","organizations_url":"https://api.github.com/users/garyb/orgs","repos_url":"https://api.github.com/users/garyb/repos","events_url":"https://api.github.com/users/garyb/events{/privacy}","received_events_url":"https://api.github.com/users/garyb/received_events","type":"User","site_admin":false},"repo":{"id":37668101,"name":"slamdata","full_name":"garyb/slamdata","owner":{"login":"garyb","id":693642,"avatar_url":"https://avatars.githubusercontent.com/u/693642?v=3","gravatar_id":"","url":"https://api.github.com/users/garyb","html_url":"https://github.com/garyb","followers_url":"https://api.github.com/users/garyb/followers","following_url":"https://api.github.com/users/garyb/following{/other_user}","gists_url":"https://api.github.com/users/garyb/gists{/gist_id}","starred_url":"https://api.github.com/users/garyb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garyb/subscriptions","organizations_url":"https://api.github.com/users/garyb/orgs","repos_url":"https://api.github.com/users/garyb/repos","events_url":"https://api.github.com/users/garyb/events{/privacy}","received_events_url":"https://api.github.com/users/garyb/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/garyb/slamdata","description":"The web-based front-end for SlamData.","fork":true,"url":"https://api.github.com/repos/garyb/slamdata","forks_url":"https://api.github.com/repos/garyb/slamdata/forks","keys_url":"https://api.github.com/repos/garyb/slamdata/keys{/key_id}","collaborators_url":"https://api.github.com/repos/garyb/slamdata/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/garyb/slamdata/teams","hooks_url":"https://api.github.com/repos/garyb/slamdata/hooks","issue_events_url":"https://api.github.com/repos/garyb/slamdata/issues/events{/number}","events_url":"https://api.github.com/repos/garyb/slamdata/events","assignees_url":"https://api.github.com/repos/garyb/slamdata/assignees{/user}","branches_url":"https://api.github.com/repos/garyb/slamdata/branches{/branch}","tags_url":"https://api.github.com/repos/garyb/slamdata/tags","blobs_url":"https://api.github.com/repos/garyb/slamdata/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/garyb/slamdata/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/garyb/slamdata/git/refs{/sha}","trees_url":"https://api.github.com/repos/garyb/slamdata/git/trees{/sha}","statuses_url":"https://api.github.com/repos/garyb/slamdata/statuses/{sha}","languages_url":"https://api.github.com/repos/garyb/slamdata/languages","stargazers_url":"https://api.github.com/repos/garyb/slamdata/stargazers","contributors_url":"https://api.github.com/repos/garyb/slamdata/contributors","subscribers_url":"https://api.github.com/repos/garyb/slamdata/subscribers","subscription_url":"https://api.github.com/repos/garyb/slamdata/subscription","commits_url":"https://api.github.com/repos/garyb/slamdata/commits{/sha}","git_commits_url":"https://api.github.com/repos/garyb/slamdata/git/commits{/sha}","comments_url":"https://api.github.com/repos/garyb/slamdata/comments{/number}","issue_comment_url":"https://api.github.com/repos/garyb/slamdata/issues/comments{/number}","contents_url":"https://api.github.com/repos/garyb/slamdata/contents/{+path}","compare_url":"https://api.github.com/repos/garyb/slamdata/compare/{base}...{head}","merges_url":"https://api.github.com/repos/garyb/slamdata/merges","archive_url":"https://api.github.com/repos/garyb/slamdata/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/garyb/slamdata/downloads","issues_url":"https://api.github.com/repos/garyb/slamdata/issues{/number}","pulls_url":"https://api.github.com/repos/garyb/slamdata/pulls{/number}","milestones_url":"https://api.github.com/repos/garyb/slamdata/milestones{/number}","notifications_url":"https://api.github.com/repos/garyb/slamdata/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/garyb/slamdata/labels{/name}","releases_url":"https://api.github.com/repos/garyb/slamdata/releases{/id}","deployments_url":"https://api.github.com/repos/garyb/slamdata/deployments","created_at":"2015-06-18T15:32:12Z","updated_at":"2016-02-02T16:26:28Z","pushed_at":"2016-04-21T14:37:43Z","git_url":"git://github.com/garyb/slamdata.git","ssh_url":"git@github.com:garyb/slamdata.git","clone_url":"https://github.com/garyb/slamdata.git","svn_url":"https://github.com/garyb/slamdata","homepage":null,"size":334086,"stargazers_count":0,"watchers_count":0,"language":"PureScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"slamdata:master","ref":"master","sha":"e7be41692f0347435dcb6aa216fcbbd8ba209b00","user":{"login":"slamdata","id":5385602,"avatar_url":"https://avatars.githubusercontent.com/u/5385602?v=3","gravatar_id":"","url":"https://api.github.com/users/slamdata","html_url":"https://github.com/slamdata","followers_url":"https://api.github.com/users/slamdata/followers","following_url":"https://api.github.com/users/slamdata/following{/other_user}","gists_url":"https://api.github.com/users/slamdata/gists{/gist_id}","starred_url":"https://api.github.com/users/slamdata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slamdata/subscriptions","organizations_url":"https://api.github.com/users/slamdata/orgs","repos_url":"https://api.github.com/users/slamdata/repos","events_url":"https://api.github.com/users/slamdata/events{/privacy}","received_events_url":"https://api.github.com/users/slamdata/received_events","type":"Organization","site_admin":false},"repo":{"id":30566154,"name":"slamdata","full_name":"slamdata/slamdata","owner":{"login":"slamdata","id":5385602,"avatar_url":"https://avatars.githubusercontent.com/u/5385602?v=3","gravatar_id":"","url":"https://api.github.com/users/slamdata","html_url":"https://github.com/slamdata","followers_url":"https://api.github.com/users/slamdata/followers","following_url":"https://api.github.com/users/slamdata/following{/other_user}","gists_url":"https://api.github.com/users/slamdata/gists{/gist_id}","starred_url":"https://api.github.com/users/slamdata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slamdata/subscriptions","organizations_url":"https://api.github.com/users/slamdata/orgs","repos_url":"https://api.github.com/users/slamdata/repos","events_url":"https://api.github.com/users/slamdata/events{/privacy}","received_events_url":"https://api.github.com/users/slamdata/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/slamdata/slamdata","description":"The web-based front-end for SlamData.","fork":false,"url":"https://api.github.com/repos/slamdata/slamdata","forks_url":"https://api.github.com/repos/slamdata/slamdata/forks","keys_url":"https://api.github.com/repos/slamdata/slamdata/keys{/key_id}","collaborators_url":"https://api.github.com/repos/slamdata/slamdata/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/slamdata/slamdata/teams","hooks_url":"https://api.github.com/repos/slamdata/slamdata/hooks","issue_events_url":"https://api.github.com/repos/slamdata/slamdata/issues/events{/number}","events_url":"https://api.github.com/repos/slamdata/slamdata/events","assignees_url":"https://api.github.com/repos/slamdata/slamdata/assignees{/user}","branches_url":"https://api.github.com/repos/slamdata/slamdata/branches{/branch}","tags_url":"https://api.github.com/repos/slamdata/slamdata/tags","blobs_url":"https://api.github.com/repos/slamdata/slamdata/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/slamdata/slamdata/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/slamdata/slamdata/git/refs{/sha}","trees_url":"https://api.github.com/repos/slamdata/slamdata/git/trees{/sha}","statuses_url":"https://api.github.com/repos/slamdata/slamdata/statuses/{sha}","languages_url":"https://api.github.com/repos/slamdata/slamdata/languages","stargazers_url":"https://api.github.com/repos/slamdata/slamdata/stargazers","contributors_url":"https://api.github.com/repos/slamdata/slamdata/contributors","subscribers_url":"https://api.github.com/repos/slamdata/slamdata/subscribers","subscription_url":"https://api.github.com/repos/slamdata/slamdata/subscription","commits_url":"https://api.github.com/repos/slamdata/slamdata/commits{/sha}","git_commits_url":"https://api.github.com/repos/slamdata/slamdata/git/commits{/sha}","comments_url":"https://api.github.com/repos/slamdata/slamdata/comments{/number}","issue_comment_url":"https://api.github.com/repos/slamdata/slamdata/issues/comments{/number}","contents_url":"https://api.github.com/repos/slamdata/slamdata/contents/{+path}","compare_url":"https://api.github.com/repos/slamdata/slamdata/compare/{base}...{head}","merges_url":"https://api.github.com/repos/slamdata/slamdata/merges","archive_url":"https://api.github.com/repos/slamdata/slamdata/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/slamdata/slamdata/downloads","issues_url":"https://api.github.com/repos/slamdata/slamdata/issues{/number}","pulls_url":"https://api.github.com/repos/slamdata/slamdata/pulls{/number}","milestones_url":"https://api.github.com/repos/slamdata/slamdata/milestones{/number}","notifications_url":"https://api.github.com/repos/slamdata/slamdata/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/slamdata/slamdata/labels{/name}","releases_url":"https://api.github.com/repos/slamdata/slamdata/releases{/id}","deployments_url":"https://api.github.com/repos/slamdata/slamdata/deployments","created_at":"2015-02-10T00:14:37Z","updated_at":"2016-04-20T09:07:41Z","pushed_at":"2016-04-21T14:37:43Z","git_url":"git://github.com/slamdata/slamdata.git","ssh_url":"git@github.com:slamdata/slamdata.git","clone_url":"https://github.com/slamdata/slamdata.git","svn_url":"https://github.com/slamdata/slamdata","homepage":null,"size":345081,"stargazers_count":119,"watchers_count":119,"language":"PureScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":29,"mirror_url":null,"open_issues_count":26,"forks":29,"open_issues":26,"watchers":119,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/slamdata/slamdata/pulls/708"},"html":{"href":"https://github.com/slamdata/slamdata/pull/708"},"issue":{"href":"https://api.github.com/repos/slamdata/slamdata/issues/708"},"comments":{"href":"https://api.github.com/repos/slamdata/slamdata/issues/708/comments"},"review_comments":{"href":"https://api.github.com/repos/slamdata/slamdata/pulls/708/comments"},"review_comment":{"href":"https://api.github.com/repos/slamdata/slamdata/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/slamdata/slamdata/pulls/708/commits"},"statuses":{"href":"https://api.github.com/repos/slamdata/slamdata/statuses/65f1c28b8878c359405d77530a48c633f2b9a9f8"}}}}