Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data HTML = HTML
- newtype RawHtml = RawHtml {
- unRaw :: ByteString
- type OpenApiJSON = "openapi.json" :> Get '[JSON] OpenApi
- type UnisonAndDocsAPI = UnisonLocalAPI :<|> (OpenApiJSON :<|> Raw)
- type UnisonLocalAPI = ("projects" :> ProjectsAPI) :<|> ("ucm" :> UCMAPI)
- type CodebaseServerAPI = NamespaceListingAPI :<|> (NamespaceDetailsAPI :<|> (DefinitionsAPI :<|> (FuzzyFindAPI :<|> (TermSummaryAPI :<|> TypeSummaryAPI))))
- type ProjectsAPI = ListProjectsEndpoint :<|> (Capture "project-name" ProjectName :> (("branches" :> (ListProjectBranchesEndpoint :<|> (Capture "branch-name" ProjectBranchName :> CodebaseServerAPI))) :<|> ("diff" :> (("terms" :> ProjectDiffTermsEndpoint) :<|> ("types" :> ProjectDiffTypesEndpoint)))))
- type ProjectDiffTermsEndpoint = RequiredQueryParam "oldBranchRef" ProjectBranchName :> (RequiredQueryParam "newBranchRef" ProjectBranchName :> (RequiredQueryParam "oldTerm" Name :> (RequiredQueryParam "newTerm" Name :> Get '[JSON] TermDiffResponse)))
- type ProjectDiffTypesEndpoint = RequiredQueryParam "oldBranchRef" ProjectBranchName :> (RequiredQueryParam "newBranchRef" ProjectBranchName :> (RequiredQueryParam "oldType" Name :> (RequiredQueryParam "newType" Name :> Get '[JSON] TypeDiffResponse)))
- type WebUI = CaptureAll "route" Text :> Get '[HTML] RawHtml
- type ServerAPI = ("ui" :> WebUI) :<|> ("api" :> UnisonAndDocsAPI)
- type StaticAPI = "static" :> Raw
- type Authed api = Capture "token" Text :> api
- type AppAPI = StaticAPI :<|> Authed ServerAPI
- data BaseUrl = BaseUrl {}
- data DefinitionReference
- data Service
- data URISegment
- urlFor :: Service -> BaseUrl -> Text
- handleAuth :: ByteString -> Text -> Handler ()
- openAPI :: OpenApi
- infoObject :: Info
- docsBS :: ByteString
- unisonAndDocsAPI :: Proxy UnisonAndDocsAPI
- api :: Proxy UnisonLocalAPI
- serverAPI :: Proxy ServerAPI
- appAPI :: Proxy AppAPI
- app :: BackendEnv -> Runtime Symbol -> Codebase IO Symbol Ann -> FilePath -> ByteString -> Maybe String -> Application
- data Waiter a = Waiter {}
- mkWaiter :: IO (Waiter a)
- ucmUIVar :: String
- ucmPortVar :: String
- ucmHostVar :: String
- ucmAllowCorsHost :: String
- ucmTokenVar :: String
- data CodebaseServerOpts = CodebaseServerOpts {}
- defaultCodebaseServerOpts :: CodebaseServerOpts
- startServer :: BackendEnv -> CodebaseServerOpts -> Runtime Symbol -> Codebase IO Symbol Ann -> (BaseUrl -> IO a) -> IO a
- serveIndex :: FilePath -> Handler RawHtml
- serveUI :: FilePath -> Server WebUI
- corsPolicy :: Maybe String -> Middleware
- server :: BackendEnv -> Runtime Symbol -> Codebase IO Symbol Ann -> FilePath -> ByteString -> Server AppAPI
- serveUnisonAndDocs :: BackendEnv -> Runtime Symbol -> Codebase IO Symbol Ann -> Server UnisonAndDocsAPI
- serveDocs :: Application
- serveOpenAPI :: Handler OpenApi
- hoistWithAuth :: forall api. HasServer api '[] => Proxy api -> ByteString -> ServerT api Handler -> ServerT (Authed api) Handler
- serveProjectsCodebaseServerAPI :: Codebase IO Symbol Ann -> Runtime Symbol -> ProjectName -> ProjectBranchName -> ServerT CodebaseServerAPI (Backend IO)
- resolveProjectRoot :: Codebase IO v a -> ProjectAndBranch ProjectName ProjectBranchName -> Backend IO (CausalBranch Transaction)
- resolveProjectRootHash :: Codebase IO v a -> ProjectAndBranch ProjectName ProjectBranchName -> Backend IO CausalHash
- serveProjectDiffTermsEndpoint :: Codebase IO Symbol Ann -> Runtime Symbol -> ProjectName -> ProjectBranchName -> ProjectBranchName -> Name -> Name -> Backend IO TermDiffResponse
- contextForProjectBranch :: Codebase IO v a -> ProjectName -> ProjectBranchName -> Backend IO (PrettyPrintEnvDecl, NameSearch Transaction)
- serveProjectDiffTypesEndpoint :: Codebase IO Symbol Ann -> Runtime Symbol -> ProjectName -> ProjectBranchName -> ProjectBranchName -> Name -> Name -> Backend IO TypeDiffResponse
- serveProjectsAPI :: Codebase IO Symbol Ann -> Runtime Symbol -> ServerT ProjectsAPI (Backend IO)
- serveUnisonLocal :: BackendEnv -> Codebase IO Symbol Ann -> Runtime Symbol -> Server UnisonLocalAPI
- backendHandler :: BackendEnv -> Backend IO a -> Handler a
Documentation
Instances
Accept HTML Source # | |
Defined in Unison.Server.CodebaseServer | |
MimeRender HTML RawHtml Source # | |
Defined in Unison.Server.CodebaseServer mimeRender :: Proxy HTML -> RawHtml -> ByteString # |
Instances
MimeRender HTML RawHtml Source # | |
Defined in Unison.Server.CodebaseServer mimeRender :: Proxy HTML -> RawHtml -> ByteString # |
type UnisonAndDocsAPI = UnisonLocalAPI :<|> (OpenApiJSON :<|> Raw) Source #
type UnisonLocalAPI = ("projects" :> ProjectsAPI) :<|> ("ucm" :> UCMAPI) Source #
type CodebaseServerAPI = NamespaceListingAPI :<|> (NamespaceDetailsAPI :<|> (DefinitionsAPI :<|> (FuzzyFindAPI :<|> (TermSummaryAPI :<|> TypeSummaryAPI)))) Source #
type ProjectsAPI = ListProjectsEndpoint :<|> (Capture "project-name" ProjectName :> (("branches" :> (ListProjectBranchesEndpoint :<|> (Capture "branch-name" ProjectBranchName :> CodebaseServerAPI))) :<|> ("diff" :> (("terms" :> ProjectDiffTermsEndpoint) :<|> ("types" :> ProjectDiffTypesEndpoint))))) Source #
type ProjectDiffTermsEndpoint = RequiredQueryParam "oldBranchRef" ProjectBranchName :> (RequiredQueryParam "newBranchRef" ProjectBranchName :> (RequiredQueryParam "oldTerm" Name :> (RequiredQueryParam "newTerm" Name :> Get '[JSON] TermDiffResponse))) Source #
type ProjectDiffTypesEndpoint = RequiredQueryParam "oldBranchRef" ProjectBranchName :> (RequiredQueryParam "newBranchRef" ProjectBranchName :> (RequiredQueryParam "oldType" Name :> (RequiredQueryParam "newType" Name :> Get '[JSON] TypeDiffResponse))) Source #
data DefinitionReference Source #
TermReference (HashQualified Name) | |
TypeReference (HashQualified Name) | |
AbilityConstructorReference (HashQualified Name) | |
DataConstructorReference (HashQualified Name) |
Instances
Show DefinitionReference Source # | |
Defined in Unison.Server.CodebaseServer showsPrec :: Int -> DefinitionReference -> ShowS # show :: DefinitionReference -> String # showList :: [DefinitionReference] -> ShowS # |
data URISegment Source #
Instances
Show URISegment Source # | |
Defined in Unison.Server.CodebaseServer showsPrec :: Int -> URISegment -> ShowS # show :: URISegment -> String # showList :: [URISegment] -> ShowS # |
urlFor :: Service -> BaseUrl -> Text Source #
Create a Service URL, either for the UI or the API
Examples:
>>>
urlFor Api (BaseUrl{ urlHost = "http://localhost", urlToken = "asdf", urlPort = 1234 })
"http://localhost:1234/asdf/api"
Loose code with definition but no perspective >>> import qualified Unison.Syntax.Name as Name >>> let service = LooseCodeUI (Path.absoluteEmpty) (Just (TermReference (NameOnly (Name.unsafeFromText "base.data.List.map")))) >>> let baseUrl = (BaseUrl{ urlHost = "http://localhost", urlToken = "asdf", urlPort = 1234 }) >>> urlFor service baseUrl "http://localhost:1234/asdf/ui/non-project-code/latest/terms/base/data/List/map"
Loose code with definition and perspective >>> import qualified Unison.Syntax.Name as Name >>> let service = LooseCodeUI (Path.Absolute (Path.fromText "base.data")) (Just (TermReference (NameOnly (Name.unsafeFromText "List.map")))) >>> let baseUrl = (BaseUrl{ urlHost = "http://localhost", urlToken = "asdf", urlPort = 1234 }) >>> urlFor service baseUrl "http://localhost:1234/asdf/ui/non-project-code/latest/namespaces/base/data/;/terms/List/map"
Project with definition but no perspective >>> import qualified Unison.Syntax.Name as Name >>> import Unison.Core.Project (ProjectName (..), ProjectBranchName (..), ProjectAndBranch (..)) >>> let service = ProjectBranchUI (ProjectAndBranch (UnsafeProjectName "base") (UnsafeProjectBranchName "main")) (Path.empty) (Just (TermReference (NameOnly (Name.unsafeFromText "List.map")))) >>> let baseUrl = (BaseUrl{ urlHost = "http://localhost", urlToken = "asdf", urlPort = 1234 }) >>> urlFor service baseUrl "http://localhost:1234/asdf/ui/projects/base/main/latest/terms/List/map"
Project with definition but no perspective, contributor branch
>>> import qualified Unison.Syntax.Name as Name
>>> import Unison.Core.Project (ProjectName (..), ProjectBranchName (..), ProjectAndBranch (..))
>>> let service = ProjectBranchUI (ProjectAndBranch (UnsafeProjectName "unison/base") (UnsafeProjectBranchName "
runarorama/contribution")) (Path.empty) (Just (TermReference (NameOnly (Name.unsafeFromText "List.map"))))
>>> let baseUrl = (BaseUrl{ urlHost = "http://localhost", urlToken = "asdf", urlPort = 1234 })
>>> urlFor service baseUrl
"http://localhost:1234/asdf/ui/projects/@unison/base/@runarorama/contribution/latest/terms/List/map"
Project with definition and perspective
>>> import qualified Unison.Syntax.Name as Name
>>> import Unison.Core.Project (ProjectName (..), ProjectBranchName (..), ProjectAndBranch (..))
>>> let service = ProjectBranchUI (ProjectAndBranch (UnsafeProjectName "unison/base") (UnsafeProjectBranchName "
runarorama/contribution")) (Path.fromList ["data"]) (Just (TermReference (NameOnly (Name.unsafeFromText "List.map"))))
>>> let baseUrl = (BaseUrl{ urlHost = "http://localhost", urlToken = "asdf", urlPort = 1234 })
>>> urlFor service baseUrl
"http://localhost:1234/asdf/ui/projects/@unison/base/@runarorama/contribution/latest/namespaces/data/;/terms/List/map"
handleAuth :: ByteString -> Text -> Handler () Source #
infoObject :: Info Source #
docsBS :: ByteString Source #
app :: BackendEnv -> Runtime Symbol -> Codebase IO Symbol Ann -> FilePath -> ByteString -> Maybe String -> Application Source #
ucmPortVar :: String Source #
ucmHostVar :: String Source #
ucmTokenVar :: String Source #
data CodebaseServerOpts Source #
Instances
Show CodebaseServerOpts Source # | |
Defined in Unison.Server.CodebaseServer showsPrec :: Int -> CodebaseServerOpts -> ShowS # show :: CodebaseServerOpts -> String # showList :: [CodebaseServerOpts] -> ShowS # | |
Eq CodebaseServerOpts Source # | |
Defined in Unison.Server.CodebaseServer (==) :: CodebaseServerOpts -> CodebaseServerOpts -> Bool # (/=) :: CodebaseServerOpts -> CodebaseServerOpts -> Bool # |
startServer :: BackendEnv -> CodebaseServerOpts -> Runtime Symbol -> Codebase IO Symbol Ann -> (BaseUrl -> IO a) -> IO a Source #
corsPolicy :: Maybe String -> Middleware Source #
server :: BackendEnv -> Runtime Symbol -> Codebase IO Symbol Ann -> FilePath -> ByteString -> Server AppAPI Source #
serveUnisonAndDocs :: BackendEnv -> Runtime Symbol -> Codebase IO Symbol Ann -> Server UnisonAndDocsAPI Source #
hoistWithAuth :: forall api. HasServer api '[] => Proxy api -> ByteString -> ServerT api Handler -> ServerT (Authed api) Handler Source #
serveProjectsCodebaseServerAPI :: Codebase IO Symbol Ann -> Runtime Symbol -> ProjectName -> ProjectBranchName -> ServerT CodebaseServerAPI (Backend IO) Source #
resolveProjectRoot :: Codebase IO v a -> ProjectAndBranch ProjectName ProjectBranchName -> Backend IO (CausalBranch Transaction) Source #
resolveProjectRootHash :: Codebase IO v a -> ProjectAndBranch ProjectName ProjectBranchName -> Backend IO CausalHash Source #
serveProjectDiffTermsEndpoint :: Codebase IO Symbol Ann -> Runtime Symbol -> ProjectName -> ProjectBranchName -> ProjectBranchName -> Name -> Name -> Backend IO TermDiffResponse Source #
contextForProjectBranch :: Codebase IO v a -> ProjectName -> ProjectBranchName -> Backend IO (PrettyPrintEnvDecl, NameSearch Transaction) Source #
serveProjectDiffTypesEndpoint :: Codebase IO Symbol Ann -> Runtime Symbol -> ProjectName -> ProjectBranchName -> ProjectBranchName -> Name -> Name -> Backend IO TypeDiffResponse Source #
serveProjectsAPI :: Codebase IO Symbol Ann -> Runtime Symbol -> ServerT ProjectsAPI (Backend IO) Source #
serveUnisonLocal :: BackendEnv -> Codebase IO Symbol Ann -> Runtime Symbol -> Server UnisonLocalAPI Source #
backendHandler :: BackendEnv -> Backend IO a -> Handler a Source #
Orphan instances
ToSample Char Source # | |
ToParam (QueryParam' mods "newBranchRef" a :: Type) Source # | |
toParam :: Proxy (QueryParam' mods "newBranchRef" a) -> DocQueryParam # | |
ToParam (QueryParam' mods "newTerm" a :: Type) Source # | |
toParam :: Proxy (QueryParam' mods "newTerm" a) -> DocQueryParam # | |
ToParam (QueryParam' mods "newType" a :: Type) Source # | |
toParam :: Proxy (QueryParam' mods "newType" a) -> DocQueryParam # | |
ToParam (QueryParam' mods "oldBranchRef" a :: Type) Source # | |
toParam :: Proxy (QueryParam' mods "oldBranchRef" a) -> DocQueryParam # | |
ToParam (QueryParam' mods "oldTerm" a :: Type) Source # | |
toParam :: Proxy (QueryParam' mods "oldTerm" a) -> DocQueryParam # | |
ToParam (QueryParam' mods "oldType" a :: Type) Source # | |
toParam :: Proxy (QueryParam' mods "oldType" a) -> DocQueryParam # |