Verified Commit 9195326c authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

Merge branch '304-dev-toml-config-rewrite-and-update-deps' into 238-dev-async-job-worker

parents 890a8076 177173ea
...@@ -75,10 +75,16 @@ convertConfigs ini@(Ini.GargConfig { .. }) iniMail nlpConfig connInfo = ...@@ -75,10 +75,16 @@ convertConfigs ini@(Ini.GargConfig { .. }) iniMail nlpConfig connInfo =
, _jc_js_job_timeout = _gc_js_job_timeout , _jc_js_job_timeout = _gc_js_job_timeout
, _jc_js_id_timeout = _gc_js_id_timeout } , _jc_js_id_timeout = _gc_js_id_timeout }
, _gc_apis = CTypes.APIsConfig { _ac_pubmed_api_key = _gc_pubmed_api_key , _gc_apis = CTypes.APIsConfig { _ac_pubmed_api_key = _gc_pubmed_api_key
, _ac_epo_api_url = _gc_epo_api_url } , _ac_epo_api_url = _gc_epo_api_url
, _ac_scrapyd_url }
, _gc_worker = WorkerSettings { _wsDefinitions = [] } , _gc_worker = WorkerSettings { _wsDefinitions = [] }
, _gc_log_level = LevelDebug , _gc_log_level = LevelDebug
} }
where
_ac_scrapyd_url =
case parseBaseUrl "http://localhost:6800" of
Nothing -> panicTrace "Cannot parse base url for scrapyd"
Just b -> b
mkFrontendConfig :: Ini.GargConfig -> CTypes.FrontendConfig mkFrontendConfig :: Ini.GargConfig -> CTypes.FrontendConfig
mkFrontendConfig (Ini.GargConfig { .. }) = mkFrontendConfig (Ini.GargConfig { .. }) =
...@@ -87,7 +93,8 @@ mkFrontendConfig (Ini.GargConfig { .. }) = ...@@ -87,7 +93,8 @@ mkFrontendConfig (Ini.GargConfig { .. }) =
, _fc_url_backend_api = _gc_url_backend_api , _fc_url_backend_api = _gc_url_backend_api
, _fc_cors , _fc_cors
, _fc_microservices , _fc_microservices
, _fc_appPort = 3000 } , _fc_appPort = 3000
, _fc_cookie_settings = CTypes.defaultCookieSettings }
where where
_fc_cors = CTypes.CORSSettings { _corsAllowedOrigins = [ _fc_cors = CTypes.CORSSettings { _corsAllowedOrigins = [
toCORSOrigin "https://demo.gargantext.org" toCORSOrigin "https://demo.gargantext.org"
......
...@@ -18,7 +18,6 @@ module CLI.Init where ...@@ -18,7 +18,6 @@ module CLI.Init where
import CLI.Parsers import CLI.Parsers
import CLI.Types import CLI.Types
import Data.List.NonEmpty qualified as NE import Data.List.NonEmpty qualified as NE
import Gargantext.API.Admin.Types
import Gargantext.API.Dev (withDevEnv, runCmdDev) import Gargantext.API.Dev (withDevEnv, runCmdDev)
import Gargantext.API.Errors.Types import Gargantext.API.Errors.Types
import Gargantext.API.Node () -- instances only import Gargantext.API.Node () -- instances only
...@@ -50,18 +49,18 @@ initCLI (InitArgs settingsPath) = do ...@@ -50,18 +49,18 @@ initCLI (InitArgs settingsPath) = do
cfg <- readConfig settingsPath cfg <- readConfig settingsPath
let secret = _s_secret_key $ _gc_secrets cfg let secret = _s_secret_key $ _gc_secrets cfg
let createUsers :: forall env. HasSettings env => DBCmd' env BackendInternalError Int64 let createUsers :: forall env. DBCmd' env BackendInternalError Int64
createUsers = insertNewUsers (NewUser "gargantua" (cs email) (GargPassword $ cs password) createUsers = insertNewUsers (NewUser "gargantua" (cs email) (GargPassword $ cs password)
NE.:| arbitraryNewUsers NE.:| arbitraryNewUsers
) )
let let
mkRoots :: forall env. HasSettings env => DBCmd' env BackendInternalError [(UserId, RootId)] mkRoots :: forall env. DBCmd' env BackendInternalError [(UserId, RootId)]
mkRoots = mapM getOrMkRoot $ map UserName ("gargantua" : arbitraryUsername) mkRoots = mapM getOrMkRoot $ map UserName ("gargantua" : arbitraryUsername)
-- TODO create all users roots -- TODO create all users roots
let let
initMaster :: forall env. HasSettings env => DBCmd' env BackendInternalError (UserId, RootId, CorpusId, ListId) initMaster :: forall env. DBCmd' env BackendInternalError (UserId, RootId, CorpusId, ListId)
initMaster = do initMaster = do
(masterUserId, masterRootId, masterCorpusId) (masterUserId, masterRootId, masterCorpusId)
<- getOrMkRootWithCorpus MkCorpusUserMaster <- getOrMkRootWithCorpus MkCorpusUserMaster
......
...@@ -16,7 +16,6 @@ module CLI.Invitations where ...@@ -16,7 +16,6 @@ module CLI.Invitations where
import CLI.Parsers import CLI.Parsers
import CLI.Types import CLI.Types
import Gargantext.API.Admin.Types
import Gargantext.API.Dev (withDevEnv, runCmdDev) import Gargantext.API.Dev (withDevEnv, runCmdDev)
import Gargantext.API.Errors.Types import Gargantext.API.Errors.Types
import Gargantext.API.Node () -- instances only import Gargantext.API.Node () -- instances only
...@@ -35,8 +34,7 @@ invitationsCLI :: InvitationsArgs -> IO () ...@@ -35,8 +34,7 @@ invitationsCLI :: InvitationsArgs -> IO ()
invitationsCLI (InvitationsArgs settingsPath user node_id email) = do invitationsCLI (InvitationsArgs settingsPath user node_id email) = do
-- _cfg <- readConfig settingsPath -- _cfg <- readConfig settingsPath
let invite :: ( HasSettings env let invite :: ( CmdRandom env BackendInternalError m
, CmdRandom env BackendInternalError m
, HasNLPServer env , HasNLPServer env
, CET.HasCentralExchangeNotification env ) => m Int , CET.HasCentralExchangeNotification env ) => m Int
invite = Share.api (UserName $ cs user) node_id (Share.ShareTeamParams $ cs email) invite = Share.api (UserName $ cs user) node_id (Share.ShareTeamParams $ cs email)
......
...@@ -65,6 +65,9 @@ api_key = ENTER_PUBMED_API_KEY ...@@ -65,6 +65,9 @@ api_key = ENTER_PUBMED_API_KEY
[apis.epo] [apis.epo]
api_url = EPO_API_URL api_url = EPO_API_URL
[apis.scrapyd]
url = "http://localhost:6800"
[external] [external]
......
...@@ -108,7 +108,6 @@ library ...@@ -108,7 +108,6 @@ library
Gargantext.API.Admin.EnvTypes Gargantext.API.Admin.EnvTypes
Gargantext.API.Admin.Orchestrator.Types Gargantext.API.Admin.Orchestrator.Types
Gargantext.API.Admin.Settings Gargantext.API.Admin.Settings
Gargantext.API.Admin.Types
Gargantext.API.Auth.PolicyCheck Gargantext.API.Auth.PolicyCheck
Gargantext.API.Count.Types Gargantext.API.Count.Types
Gargantext.API.Dev Gargantext.API.Dev
......
...@@ -44,15 +44,14 @@ import Data.Text.Encoding qualified as TE ...@@ -44,15 +44,14 @@ import Data.Text.Encoding qualified as TE
import Data.Text.IO (putStrLn) import Data.Text.IO (putStrLn)
import Data.Validity import Data.Validity
import Gargantext.API.Admin.Auth.Types (AuthContext) import Gargantext.API.Admin.Auth.Types (AuthContext)
import Gargantext.API.Admin.EnvTypes (Env, Mode(..), env_config, env_jwt_settings) import Gargantext.API.Admin.EnvTypes (Env, FireWall(..), Mode(..), env_config, env_jwt_settings)
import Gargantext.API.Admin.Settings (newEnv) import Gargantext.API.Admin.Settings (newEnv)
import Gargantext.API.Admin.Types (FireWall(..), cookieSettings, settings)
import Gargantext.API.Middleware (logStdoutDevSanitised) import Gargantext.API.Middleware (logStdoutDevSanitised)
import Gargantext.API.Routes.Named (API) import Gargantext.API.Routes.Named (API)
import Gargantext.API.Routes.Named.EKG import Gargantext.API.Routes.Named.EKG
import Gargantext.API.Server.Named (server) import Gargantext.API.Server.Named (server)
import Gargantext.Core.Config (gc_notifications_config, gc_frontend_config) import Gargantext.Core.Config (gc_notifications_config, gc_frontend_config)
import Gargantext.Core.Config.Types (CORSOrigin(..), CORSSettings, MicroServicesProxyStatus(..), NotificationsConfig(..), PortNumber, SettingsFile(..), corsAllowedOrigins, fc_cors, microServicesProxyStatus) import Gargantext.Core.Config.Types (CORSOrigin(..), CORSSettings, MicroServicesProxyStatus(..), NotificationsConfig(..), PortNumber, SettingsFile(..), corsAllowedOrigins, fc_cors, fc_cookie_settings, microServicesProxyStatus)
import Gargantext.Database.Prelude qualified as DB import Gargantext.Database.Prelude qualified as DB
import Gargantext.MicroServices.ReverseProxy (microServicesProxyApp) import Gargantext.MicroServices.ReverseProxy (microServicesProxyApp)
import Gargantext.Prelude hiding (putStrLn, to) import Gargantext.Prelude hiding (putStrLn, to)
...@@ -132,7 +131,7 @@ stopGargantext scheduledPeriodicActions = do ...@@ -132,7 +131,7 @@ stopGargantext scheduledPeriodicActions = do
-- | Schedules all sorts of useful periodic actions to be run while -- | Schedules all sorts of useful periodic actions to be run while
-- the server is alive accepting requests. -- the server is alive accepting requests.
schedulePeriodicActions :: DB.CmdCommon env => env -> IO [ThreadId] schedulePeriodicActions :: env -> IO [ThreadId]
schedulePeriodicActions _env = schedulePeriodicActions _env =
-- Add your scheduled actions here. -- Add your scheduled actions here.
let actions = [ let actions = [
...@@ -205,7 +204,7 @@ makeApp env = do ...@@ -205,7 +204,7 @@ makeApp env = do
where where
cfg :: Servant.Context AuthContext cfg :: Servant.Context AuthContext
cfg = env ^. env_jwt_settings cfg = env ^. env_jwt_settings
:. env ^. settings . cookieSettings :. env ^. env_config . gc_frontend_config . fc_cookie_settings
:. EmptyContext :. EmptyContext
--------------------------------------------------------------------- ---------------------------------------------------------------------
......
...@@ -52,7 +52,6 @@ import Data.UUID.V4 (nextRandom) ...@@ -52,7 +52,6 @@ import Data.UUID.V4 (nextRandom)
import Gargantext.API.Admin.Auth.Types import Gargantext.API.Admin.Auth.Types
import Gargantext.API.Admin.EnvTypes (GargJob(..), Env) import Gargantext.API.Admin.EnvTypes (GargJob(..), Env)
import Gargantext.API.Admin.Orchestrator.Types (AsyncJobs(..)) import Gargantext.API.Admin.Orchestrator.Types (AsyncJobs(..))
import Gargantext.API.Admin.Types
import Gargantext.API.Auth.PolicyCheck import Gargantext.API.Auth.PolicyCheck
import Gargantext.API.Errors import Gargantext.API.Errors
import Gargantext.API.Prelude (authenticationError, HasServerError, GargServerC, _ServerError, GargM, IsGargServer) import Gargantext.API.Prelude (authenticationError, HasServerError, GargServerC, _ServerError, GargM, IsGargServer)
...@@ -241,12 +240,12 @@ forgotPassword = Named.ForgotPasswordAPI ...@@ -241,12 +240,12 @@ forgotPassword = Named.ForgotPasswordAPI
, forgotPasswordGetEp = forgotPasswordGet , forgotPasswordGetEp = forgotPasswordGet
} }
forgotPasswordPost :: (CmdCommon env, HasSettings env) forgotPasswordPost :: (CmdCommon env)
=> ForgotPasswordRequest -> Cmd' env err ForgotPasswordResponse => ForgotPasswordRequest -> Cmd' env err ForgotPasswordResponse
forgotPasswordPost (ForgotPasswordRequest _email) = do forgotPasswordPost (ForgotPasswordRequest _email) = do
pure $ ForgotPasswordResponse "ok" pure $ ForgotPasswordResponse "ok"
forgotPasswordGet :: (HasSettings env, CmdCommon env, HasAuthenticationError err, HasServerError err) forgotPasswordGet :: (CmdCommon env, HasServerError err)
=> Maybe Text -> Cmd' env err ForgotPasswordGet => Maybe Text -> Cmd' env err ForgotPasswordGet
forgotPasswordGet Nothing = pure $ ForgotPasswordGet "" forgotPasswordGet Nothing = pure $ ForgotPasswordGet ""
forgotPasswordGet (Just uuid) = do forgotPasswordGet (Just uuid) = do
...@@ -263,7 +262,7 @@ forgotPasswordGet (Just uuid) = do ...@@ -263,7 +262,7 @@ forgotPasswordGet (Just uuid) = do
--------------------- ---------------------
forgotPasswordGetUser :: ( HasSettings env, CmdCommon env, HasAuthenticationError err, HasServerError err) forgotPasswordGetUser :: ( CmdCommon env)
=> UserLight -> Cmd' env err ForgotPasswordGet => UserLight -> Cmd' env err ForgotPasswordGet
forgotPasswordGetUser (UserLight { .. }) = do forgotPasswordGetUser (UserLight { .. }) = do
-- pick some random password -- pick some random password
......
...@@ -14,7 +14,6 @@ module Gargantext.API.Admin.EnvTypes ( ...@@ -14,7 +14,6 @@ module Gargantext.API.Admin.EnvTypes (
, env_config , env_config
, env_logger , env_logger
, env_manager , env_manager
, env_settings
, env_self_url , env_self_url
, env_central_exchange , env_central_exchange
, env_dispatcher , env_dispatcher
...@@ -23,6 +22,7 @@ module Gargantext.API.Admin.EnvTypes ( ...@@ -23,6 +22,7 @@ module Gargantext.API.Admin.EnvTypes (
, menv_firewall , menv_firewall
, dev_env_logger , dev_env_logger
, FireWall(..)
, MockEnv(..) , MockEnv(..)
, DevEnv(..) , DevEnv(..)
, DevJobHandle(..) , DevJobHandle(..)
...@@ -41,7 +41,6 @@ import Data.Sequence (ViewL(..), viewl) ...@@ -41,7 +41,6 @@ import Data.Sequence (ViewL(..), viewl)
import Data.Text qualified as T import Data.Text qualified as T
import Database.PostgreSQL.Simple (Connection) import Database.PostgreSQL.Simple (Connection)
import Gargantext.API.Admin.Orchestrator.Types import Gargantext.API.Admin.Orchestrator.Types
import Gargantext.API.Admin.Types
import Gargantext.API.Errors.Types import Gargantext.API.Errors.Types
import Gargantext.API.Job import Gargantext.API.Job
import Gargantext.API.Prelude (GargM, IsGargServer) import Gargantext.API.Prelude (GargM, IsGargServer)
...@@ -172,8 +171,7 @@ instance ToJSON GargJob where ...@@ -172,8 +171,7 @@ instance ToJSON GargJob where
-- having to specify /everything/. This means that when we /construct/ an 'Env', -- having to specify /everything/. This means that when we /construct/ an 'Env',
-- we need to remember to force the fields to WHNF at that point. -- we need to remember to force the fields to WHNF at that point.
data Env = Env data Env = Env
{ _env_settings :: ~Settings { _env_logger :: ~(Logger (GargM Env BackendInternalError))
, _env_logger :: ~(Logger (GargM Env BackendInternalError))
, _env_pool :: ~(Pool Connection) , _env_pool :: ~(Pool Connection)
, _env_nodeStory :: ~NodeStoryEnv , _env_nodeStory :: ~NodeStoryEnv
, _env_manager :: ~Manager , _env_manager :: ~Manager
...@@ -204,9 +202,6 @@ instance HasNodeStoryImmediateSaver Env where ...@@ -204,9 +202,6 @@ instance HasNodeStoryImmediateSaver Env where
instance HasNodeArchiveStoryImmediateSaver Env where instance HasNodeArchiveStoryImmediateSaver Env where
hasNodeArchiveStoryImmediateSaver = hasNodeStory . nse_archive_saver_immediate hasNodeArchiveStoryImmediateSaver = hasNodeStory . nse_archive_saver_immediate
instance HasSettings Env where
settings = env_settings
instance HasJWTSettings Env where instance HasJWTSettings Env where
jwtSettings = env_jwt_settings jwtSettings = env_jwt_settings
...@@ -313,6 +308,8 @@ instance Jobs.MonadJobStatus (GargM Env err) where ...@@ -313,6 +308,8 @@ instance Jobs.MonadJobStatus (GargM Env err) where
addMoreSteps steps jh = updateJobProgress jh (jobLogAddMore steps) addMoreSteps steps jh = updateJobProgress jh (jobLogAddMore steps)
data FireWall = FireWall { unFireWall :: Bool }
data MockEnv = MockEnv data MockEnv = MockEnv
{ _menv_firewall :: !FireWall { _menv_firewall :: !FireWall
} }
...@@ -342,8 +339,7 @@ instance HasLogger (GargM DevEnv BackendInternalError) where ...@@ -342,8 +339,7 @@ instance HasLogger (GargM DevEnv BackendInternalError) where
logTxt lgr lvl msg = logMsg lgr lvl (FL.toLogStr $ T.unpack msg) logTxt lgr lvl msg = logMsg lgr lvl (FL.toLogStr $ T.unpack msg)
data DevEnv = DevEnv data DevEnv = DevEnv
{ _dev_env_settings :: !Settings { _dev_env_config :: !GargConfig
, _dev_env_config :: !GargConfig
, _dev_env_logger :: !(Logger (GargM DevEnv BackendInternalError)) , _dev_env_logger :: !(Logger (GargM DevEnv BackendInternalError))
, _dev_env_pool :: !(Pool Connection) , _dev_env_pool :: !(Pool Connection)
, _dev_env_nodeStory :: !NodeStoryEnv , _dev_env_nodeStory :: !NodeStoryEnv
...@@ -391,9 +387,6 @@ instance HasConfig DevEnv where ...@@ -391,9 +387,6 @@ instance HasConfig DevEnv where
instance HasConnectionPool DevEnv where instance HasConnectionPool DevEnv where
connPool = dev_env_pool connPool = dev_env_pool
instance HasSettings DevEnv where
settings = dev_env_settings
instance HasNodeStoryEnv DevEnv where instance HasNodeStoryEnv DevEnv where
hasNodeStory = dev_env_nodeStory hasNodeStory = dev_env_nodeStory
......
...@@ -26,7 +26,6 @@ import Data.Pool (Pool) ...@@ -26,7 +26,6 @@ import Data.Pool (Pool)
import Data.Pool qualified as Pool import Data.Pool qualified as Pool
import Database.PostgreSQL.Simple (Connection, connect, close, ConnectInfo) import Database.PostgreSQL.Simple (Connection, connect, close, ConnectInfo)
import Gargantext.API.Admin.EnvTypes import Gargantext.API.Admin.EnvTypes
import Gargantext.API.Admin.Types
import Gargantext.API.Errors.Types import Gargantext.API.Errors.Types
import Gargantext.API.Prelude import Gargantext.API.Prelude
import Gargantext.Core.AsyncUpdates.CentralExchange qualified as CE import Gargantext.Core.AsyncUpdates.CentralExchange qualified as CE
...@@ -42,7 +41,6 @@ import Gargantext.Utils.Jobs.Monad qualified as Jobs ...@@ -42,7 +41,6 @@ import Gargantext.Utils.Jobs.Monad qualified as Jobs
import Gargantext.Utils.Jobs.Queue qualified as Jobs import Gargantext.Utils.Jobs.Queue qualified as Jobs
import Gargantext.Utils.Jobs.Settings qualified as Jobs import Gargantext.Utils.Jobs.Settings qualified as Jobs
import Network.HTTP.Client.TLS (newTlsManager) import Network.HTTP.Client.TLS (newTlsManager)
import Servant.Auth.Server (CookieSettings(..), XsrfCookieSettings(..), defaultCookieSettings, defaultXsrfCookieSettings)
import Servant.Client (parseBaseUrl) import Servant.Client (parseBaseUrl)
import Servant.Job.Async (newJobEnv, defaultSettings) import Servant.Job.Async (newJobEnv, defaultSettings)
import System.Directory (renameFile) import System.Directory (renameFile)
...@@ -53,20 +51,6 @@ import System.IO.Temp (withTempFile) ...@@ -53,20 +51,6 @@ import System.IO.Temp (withTempFile)
newtype IniFile = IniFile { _IniFile :: FilePath } newtype IniFile = IniFile { _IniFile :: FilePath }
deriving (Show, Eq, IsString) deriving (Show, Eq, IsString)
devSettings :: Settings
devSettings =
-- GargTomlSettings{..} <- loadGargTomlSettings settingsFile
Settings
{ -- _corsSettings = _gargCorsSettings
-- , _microservicesSettings = _gargMicroServicesSettings
-- , _dbServer = "localhost"
_sendLoginEmails = LogEmailToConsole
, _scrapydUrl = fromMaybe (panicTrace "Invalid scrapy URL") $ parseBaseUrl "http://localhost:6800"
, _cookieSettings = defaultCookieSettings { cookieXsrfSetting = Just xsrfCookieSetting } -- TODO-SECURITY tune
}
where
xsrfCookieSetting = defaultXsrfCookieSettings { xsrfExcludeGet = True }
{- NOT USED YET {- NOT USED YET
import System.Environment (lookupEnv) import System.Environment (lookupEnv)
...@@ -169,7 +153,6 @@ readRepoEnv repoDir = do ...@@ -169,7 +153,6 @@ readRepoEnv repoDir = do
newEnv :: Logger (GargM Env BackendInternalError) -> PortNumber -> SettingsFile -> IO Env newEnv :: Logger (GargM Env BackendInternalError) -> PortNumber -> SettingsFile -> IO Env
newEnv logger port settingsFile@(SettingsFile sf) = do newEnv logger port settingsFile@(SettingsFile sf) = do
!manager_env <- newTlsManager !manager_env <- newTlsManager
let !settings' = devSettings
!config_env <- readConfig settingsFile <&> (gc_frontend_config . fc_appPort) .~ port -- TODO read from 'file' !config_env <- readConfig settingsFile <&> (gc_frontend_config . fc_appPort) .~ port -- TODO read from 'file'
when (port /= config_env ^. gc_frontend_config . fc_appPort) $ when (port /= config_env ^. gc_frontend_config . fc_appPort) $
panicTrace "TODO: conflicting settings of port" panicTrace "TODO: conflicting settings of port"
...@@ -198,8 +181,7 @@ newEnv logger port settingsFile@(SettingsFile sf) = do ...@@ -198,8 +181,7 @@ newEnv logger port settingsFile@(SettingsFile sf) = do
we want to force them to WHNF to avoid accumulating unnecessary thunks. we want to force them to WHNF to avoid accumulating unnecessary thunks.
-} -}
pure $ Env pure $ Env
{ _env_settings = settings' { _env_logger = logger
, _env_logger = logger
, _env_pool = pool , _env_pool = pool
, _env_nodeStory = nodeStory_env , _env_nodeStory = nodeStory_env
, _env_manager = manager_env , _env_manager = manager_env
......
{-# LANGUAGE TemplateHaskell #-}
module Gargantext.API.Admin.Types where
import Control.Lens
import GHC.Enum
import Gargantext.Prelude
import Servant.Auth.Server (CookieSettings(..))
import Servant.Client (BaseUrl)
data SendEmailType = SendEmailViaAws
| LogEmailToConsole
| WriteEmailToFile
deriving (Show, Read, Enum, Bounded, Generic)
data Settings = Settings
{
-- , _dbServer :: Text
-- ^ this is not used yet
_cookieSettings :: !CookieSettings
, _sendLoginEmails :: !SendEmailType
, _scrapydUrl :: !BaseUrl
}
makeLenses ''Settings
class HasSettings env where
settings :: Getter env Settings
instance HasSettings Settings where
settings = identity
data FireWall = FireWall { unFireWall :: Bool }
...@@ -29,5 +29,5 @@ import Servant.Server.Generic (AsServerT) ...@@ -29,5 +29,5 @@ import Servant.Server.Generic (AsServerT)
-- TODO-ACCESS: CanCount -- TODO-ACCESS: CanCount
-- TODO-EVENTS: No events as this is a read only query. -- TODO-EVENTS: No events as this is a read only query.
----------------------------------------------------------------------- -----------------------------------------------------------------------
countAPI :: Monad m => Query -> Named.CountAPI (AsServerT m) countAPI :: Query -> Named.CountAPI (AsServerT m)
countAPI _ = Named.CountAPI undefined countAPI _ = Named.CountAPI undefined
...@@ -17,7 +17,7 @@ import Control.Monad (fail) ...@@ -17,7 +17,7 @@ import Control.Monad (fail)
import Data.Pool (withResource) import Data.Pool (withResource)
import Database.PostgreSQL.Simple qualified as PGS import Database.PostgreSQL.Simple qualified as PGS
import Gargantext.API.Admin.EnvTypes ( DevEnv(..), Mode(Dev) ) import Gargantext.API.Admin.EnvTypes ( DevEnv(..), Mode(Dev) )
import Gargantext.API.Admin.Settings ( devSettings, newPool ) import Gargantext.API.Admin.Settings ( newPool )
import Gargantext.API.Errors.Types ( BackendInternalError ) import Gargantext.API.Errors.Types ( BackendInternalError )
import Gargantext.API.Prelude ( GargM ) import Gargantext.API.Prelude ( GargM )
import Gargantext.Core.Config (_gc_database_config) import Gargantext.Core.Config (_gc_database_config)
...@@ -41,12 +41,10 @@ withDevEnv settingsFile k = withLoggerHoisted Dev $ \logger -> do ...@@ -41,12 +41,10 @@ withDevEnv settingsFile k = withLoggerHoisted Dev $ \logger -> do
--nodeStory_env <- fromDBNodeStoryEnv (_gc_repofilepath cfg) --nodeStory_env <- fromDBNodeStoryEnv (_gc_repofilepath cfg)
pool <- newPool (_gc_database_config cfg) pool <- newPool (_gc_database_config cfg)
nodeStory_env <- fromDBNodeStoryEnv pool nodeStory_env <- fromDBNodeStoryEnv pool
let setts = devSettings
pure $ DevEnv pure $ DevEnv
{ _dev_env_pool = pool { _dev_env_pool = pool
, _dev_env_logger = logger , _dev_env_logger = logger
, _dev_env_nodeStory = nodeStory_env , _dev_env_nodeStory = nodeStory_env
, _dev_env_settings = setts
, _dev_env_config = cfg , _dev_env_config = cfg
} }
......
...@@ -8,6 +8,7 @@ Stability : experimental ...@@ -8,6 +8,7 @@ Stability : experimental
Portability : POSIX Portability : POSIX
-} -}
{-# OPTIONS_GHC -Wredundant-constraints #-}
{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE LambdaCase #-} {-# LANGUAGE LambdaCase #-}
...@@ -39,9 +40,6 @@ module Gargantext.API.Errors.Types ( ...@@ -39,9 +40,6 @@ module Gargantext.API.Errors.Types (
-- * Evidence carrying -- * Evidence carrying
, Dict(..) , Dict(..)
, IsFrontendErrorData(..) , IsFrontendErrorData(..)
-- * Generating test cases
, genFrontendErr
) where ) where
import Control.Lens (makePrisms) import Control.Lens (makePrisms)
...@@ -51,7 +49,7 @@ import Data.Aeson.Types (typeMismatch, emptyArray) ...@@ -51,7 +49,7 @@ import Data.Aeson.Types (typeMismatch, emptyArray)
import Data.List.NonEmpty qualified as NE import Data.List.NonEmpty qualified as NE
import Data.Singletons.TH ( SingI(sing), SingKind(fromSing) ) import Data.Singletons.TH ( SingI(sing), SingKind(fromSing) )
import Data.Text qualified as T import Data.Text qualified as T
import Data.Validity (Validation(..), ValidationChain (..), prettyValidation) import Data.Validity (Validation(..))
import Gargantext.API.Admin.Auth.Types (AuthenticationError) import Gargantext.API.Admin.Auth.Types (AuthenticationError)
import Gargantext.API.Errors.Class (HasAuthenticationError(..)) import Gargantext.API.Errors.Class (HasAuthenticationError(..))
import Gargantext.API.Errors.TH ( deriveIsFrontendErrorData ) import Gargantext.API.Errors.TH ( deriveIsFrontendErrorData )
...@@ -67,8 +65,6 @@ import Gargantext.Utils.Jobs.Monad qualified as Jobs ...@@ -67,8 +65,6 @@ import Gargantext.Utils.Jobs.Monad qualified as Jobs
import Servant (ServerError) import Servant (ServerError)
import Servant.Job.Core ( HasServerError(..) ) import Servant.Job.Core ( HasServerError(..) )
import Servant.Job.Types qualified as SJ import Servant.Job.Types qualified as SJ
import Test.QuickCheck
import Test.QuickCheck.Instances.Text ()
-- | A 'WithStacktrace' carries an error alongside its -- | A 'WithStacktrace' carries an error alongside its
-- 'CallStack', to be able to print the correct source location -- 'CallStack', to be able to print the correct source location
...@@ -574,121 +570,6 @@ instance FromJSON (ToFrontendErrorData 'EC_500__job_generic_exception) where ...@@ -574,121 +570,6 @@ instance FromJSON (ToFrontendErrorData 'EC_500__job_generic_exception) where
jege_error <- o .: "error" jege_error <- o .: "error"
pure FE_job_generic_exception{..} pure FE_job_generic_exception{..}
----------------------------------------------------------------------------
-- Arbitrary instances and test data generation
----------------------------------------------------------------------------
instance Arbitrary BackendErrorCode where
arbitrary = arbitraryBoundedEnum
genFrontendErr :: BackendErrorCode -> Gen FrontendError
genFrontendErr be = do
txt <- arbitrary
case be of
-- node errors
EC_404__node_list_not_found
-> arbitrary >>= \lid -> pure $ mkFrontendErr' txt $ FE_node_list_not_found lid
EC_404__node_root_not_found
-> pure $ mkFrontendErr' txt FE_node_root_not_found
EC_404__node_corpus_not_found
-> pure $ mkFrontendErr' txt FE_node_corpus_not_found
EC_500__node_not_implemented_yet
-> pure $ mkFrontendErr' txt FE_node_not_implemented_yet
EC_404__node_lookup_failed_not_found
-> do nodeId <- arbitrary
pure $ mkFrontendErr' txt (FE_node_lookup_failed_not_found nodeId)
EC_404__node_lookup_failed_parent_not_found
-> do nodeId <- arbitrary
pure $ mkFrontendErr' txt (FE_node_lookup_failed_parent_not_found nodeId)
EC_404__node_lookup_failed_user_not_found
-> do userId <- arbitrary
pure $ mkFrontendErr' txt (FE_node_lookup_failed_user_not_found userId)
EC_404__node_lookup_failed_username_not_found
-> do username <- arbitrary
pure $ mkFrontendErr' txt (FE_node_lookup_failed_username_not_found username)
EC_400__node_lookup_failed_user_too_many_roots
-> do userId <- arbitrary
roots <- arbitrary
pure $ mkFrontendErr' txt (FE_node_lookup_failed_user_too_many_roots userId roots)
EC_404__node_context_not_found
-> do contextId <- arbitrary
pure $ mkFrontendErr' txt (FE_node_context_not_found contextId)
EC_400__node_creation_failed_no_parent
-> do userId <- arbitrary
pure $ mkFrontendErr' txt (FE_node_creation_failed_no_parent userId)
EC_400__node_creation_failed_parent_exists
-> do userId <- arbitrary
parentId <- arbitrary
pure $ mkFrontendErr' txt (FE_node_creation_failed_parent_exists userId parentId)
EC_400__node_creation_failed_insert_node
-> do userId <- arbitrary
parentId <- arbitrary
pure $ mkFrontendErr' txt $ FE_node_creation_failed_insert_node parentId userId
EC_400__node_creation_failed_user_negative_id
-> pure $ mkFrontendErr' txt (FE_node_creation_failed_user_negative_id (UnsafeMkUserId (-42)))
EC_500__node_generic_exception
-> do err <- arbitrary
pure $ mkFrontendErr' txt $ FE_node_generic_exception err
EC_400__node_needs_configuration
-> pure $ mkFrontendErr' txt $ FE_node_needs_configuration
-- validation error
EC_400__validation_error
-> do let genValChain = oneof [ Violated <$> arbitrary, Location <$> arbitrary <*> genValChain ]
chain <- listOf1 genValChain
pure $ mkFrontendErr' txt $ FE_validation_error (T.pack $ fromMaybe "unknown_validation_error" $ prettyValidation $ Validation chain)
-- authentication error
EC_403__login_failed_error
-> do nid <- arbitrary
uid <- arbitrary
pure $ mkFrontendErr' txt $ FE_login_failed_error nid uid
EC_403__login_failed_invalid_username_or_password
-> do
pure $ mkFrontendErr' txt $ FE_login_failed_invalid_username_or_password
EC_403__user_not_authorized
-> do
uid <- arbitrary
msg <- arbitrary
pure $ mkFrontendErr' txt $ FE_user_not_authorized uid msg
-- internal error
EC_500__internal_server_error
-> do err <- arbitrary
pure $ mkFrontendErr' txt $ FE_internal_server_error err
EC_405__not_allowed
-> do err <- arbitrary
pure $ mkFrontendErr' txt $ FE_not_allowed err
-- tree errors
EC_404__tree_root_not_found
-> pure $ mkFrontendErr' txt $ FE_tree_root_not_found
EC_404__tree_empty_root
-> pure $ mkFrontendErr' txt $ FE_tree_empty_root
EC_500__tree_too_many_roots
-> do nodes <- getNonEmpty <$> arbitrary
pure $ mkFrontendErr' txt $ FE_tree_too_many_roots (NE.fromList nodes)
-- job errors
EC_500__job_invalid_id_type
-> do idTy <- arbitrary
pure $ mkFrontendErr' txt $ FE_job_invalid_id_type idTy
EC_500__job_expired
-> do jobId <- getPositive <$> arbitrary
pure $ mkFrontendErr' txt $ FE_job_expired jobId
EC_500__job_invalid_mac
-> do macId <- arbitrary
pure $ mkFrontendErr' txt $ FE_job_expired macId
EC_500__job_unknown_job
-> do jobId <- getPositive <$> arbitrary
pure $ mkFrontendErr' txt $ FE_job_unknown_job jobId
EC_500__job_generic_exception
-> do err <- arbitrary
pure $ mkFrontendErr' txt $ FE_job_generic_exception err
instance ToJSON BackendErrorCode where instance ToJSON BackendErrorCode where
toJSON = String . T.pack . show toJSON = String . T.pack . show
......
...@@ -260,7 +260,7 @@ updatePie cId maybeListId tabType maybeLimit = do ...@@ -260,7 +260,7 @@ updatePie cId maybeListId tabType maybeLimit = do
_ <- updatePie' cId listId tabType maybeLimit _ <- updatePie' cId listId tabType maybeLimit
pure () pure ()
updatePie' :: (HasNodeStory env err m, HasNodeError err) updatePie' :: (HasNodeStory env err m)
=> CorpusId => CorpusId
-> ListId -> ListId
-> TabType -> TabType
......
...@@ -99,7 +99,6 @@ import Gargantext.Core.Types (ListType(..), NodeId, ListId, TODO, assertValid, H ...@@ -99,7 +99,6 @@ import Gargantext.Core.Types (ListType(..), NodeId, ListId, TODO, assertValid, H
import Gargantext.Core.Types.Query (Limit(..), Offset(..), MinSize(..), MaxSize(..)) import Gargantext.Core.Types.Query (Limit(..), Offset(..), MinSize(..), MaxSize(..))
import Gargantext.Database.Action.Metrics.NgramsByContext (getOccByNgramsOnlyFast) import Gargantext.Database.Action.Metrics.NgramsByContext (getOccByNgramsOnlyFast)
import Gargantext.Database.Query.Table.Ngrams ( text2ngrams, insertNgrams ) import Gargantext.Database.Query.Table.Ngrams ( text2ngrams, insertNgrams )
import Gargantext.Database.Query.Table.Node.Error (HasNodeError)
import Gargantext.Prelude hiding (log, to, toLower, (%), isInfixOf) import Gargantext.Prelude hiding (log, to, toLower, (%), isInfixOf)
import Gargantext.Prelude.Clock (hasTime, getTime) import Gargantext.Prelude.Clock (hasTime, getTime)
import Text.Collate qualified as Unicode import Text.Collate qualified as Unicode
...@@ -256,7 +255,6 @@ newNgramsFromNgramsStatePatch p = ...@@ -256,7 +255,6 @@ newNgramsFromNgramsStatePatch p =
commitStatePatch :: ( HasNodeStory env err m commitStatePatch :: ( HasNodeStory env err m
, HasNodeStoryImmediateSaver env
, HasNodeArchiveStoryImmediateSaver env ) , HasNodeArchiveStoryImmediateSaver env )
=> ListId => ListId
-> Versioned NgramsStatePatch' -> Versioned NgramsStatePatch'
...@@ -364,7 +362,6 @@ tableNgramsPull listId ngramsType p_version = do ...@@ -364,7 +362,6 @@ tableNgramsPull listId ngramsType p_version = do
-- client. -- client.
-- TODO-ACCESS check -- TODO-ACCESS check
tableNgramsPut :: ( HasNodeStory env err m tableNgramsPut :: ( HasNodeStory env err m
, HasNodeStoryImmediateSaver env
, HasNodeArchiveStoryImmediateSaver env , HasNodeArchiveStoryImmediateSaver env
, HasValidationError err , HasValidationError err
) )
...@@ -520,8 +517,7 @@ unicodeDUCETSorter :: Text -> Text -> Ordering ...@@ -520,8 +517,7 @@ unicodeDUCETSorter :: Text -> Text -> Ordering
unicodeDUCETSorter = Unicode.collate Unicode.rootCollator unicodeDUCETSorter = Unicode.collate Unicode.rootCollator
getTableNgrams :: forall env err m. getTableNgrams :: forall env err m.
( HasNodeStory env err m ( HasNodeStory env err m )
, HasNodeError err )
=> NodeId => NodeId
-> ListId -> ListId
-> TabType -> TabType
...@@ -535,8 +531,7 @@ getTableNgrams nodeId listId tabType searchQuery = do ...@@ -535,8 +531,7 @@ getTableNgrams nodeId listId tabType searchQuery = do
-- | Helper function to get the ngrams table with scores. -- | Helper function to get the ngrams table with scores.
getNgramsTable' :: forall env err m. getNgramsTable' :: forall env err m.
( HasNodeStory env err m ( HasNodeStory env err m )
, HasNodeError err )
=> NodeId => NodeId
-> ListId -> ListId
-> NgramsType -> NgramsType
...@@ -549,8 +544,7 @@ getNgramsTable' nId listId ngramsType = do ...@@ -549,8 +544,7 @@ getNgramsTable' nId listId ngramsType = do
-- | Helper function to set scores on an `NgramsTable`. -- | Helper function to set scores on an `NgramsTable`.
setNgramsTableScores :: forall env err m t. setNgramsTableScores :: forall env err m t.
( Each t t NgramsElement NgramsElement ( Each t t NgramsElement NgramsElement
, HasNodeStory env err m , HasNodeStory env err m )
, HasNodeError err )
=> NodeId => NodeId
-> ListId -> ListId
-> NgramsType -> NgramsType
...@@ -586,8 +580,7 @@ needsScores (Just ScoreAsc) = True ...@@ -586,8 +580,7 @@ needsScores (Just ScoreAsc) = True
needsScores (Just ScoreDesc) = True needsScores (Just ScoreDesc) = True
needsScores _ = False needsScores _ = False
getTableNgramsCorpus :: ( HasNodeStory env err m getTableNgramsCorpus :: ( HasNodeStory env err m )
, HasNodeError err )
=> NodeId => NodeId
-> TabType -> TabType
-> ListId -> ListId
......
...@@ -15,7 +15,7 @@ Portability : POSIX ...@@ -15,7 +15,7 @@ Portability : POSIX
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeOperators #-} {-# LANGUAGE TypeOperators #-}
{-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeFamilies #-}
{-# OPTIONS -fno-warn-orphans #-} {-# OPTIONS -fno-warn-orphans #-} -- some instances are orphaned here
module Gargantext.API.Ngrams.Types where module Gargantext.API.Ngrams.Types where
...@@ -52,8 +52,6 @@ import Gargantext.Utils.Servant (TSV, ZIP) ...@@ -52,8 +52,6 @@ import Gargantext.Utils.Servant (TSV, ZIP)
import Gargantext.Utils.Zip (zipContentsPure) import Gargantext.Utils.Zip (zipContentsPure)
import Servant ( FromHttpApiData(parseUrlPiece), ToHttpApiData(toUrlPiece), Required, Strict, QueryParam', MimeRender(.. ), MimeUnrender(..)) import Servant ( FromHttpApiData(parseUrlPiece), ToHttpApiData(toUrlPiece), Required, Strict, QueryParam', MimeRender(.. ), MimeUnrender(..))
import Servant.Job.Utils (jsonOptions) import Servant.Job.Utils (jsonOptions)
import Test.QuickCheck (elements, frequency)
import Test.QuickCheck.Arbitrary (Arbitrary, arbitrary)
------------------------------------------------------------------------ ------------------------------------------------------------------------
...@@ -96,7 +94,7 @@ instance ToJSONKey TabType where ...@@ -96,7 +94,7 @@ instance ToJSONKey TabType where
newtype MSet a = MSet (Map a ()) newtype MSet a = MSet (Map a ())
deriving stock (Eq, Ord, Show, Read, Generic) deriving stock (Eq, Ord, Show, Read, Generic)
deriving newtype (Arbitrary, Semigroup, Monoid) deriving newtype (Semigroup, Monoid)
deriving anyclass (ToExpr) deriving anyclass (ToExpr)
instance ToJSON a => ToJSON (MSet a) where instance ToJSON a => ToJSON (MSet a) where
...@@ -123,14 +121,14 @@ instance Foldable MSet where ...@@ -123,14 +121,14 @@ instance Foldable MSet where
instance (Ord a, FromJSON a) => FromJSON (MSet a) where instance (Ord a, FromJSON a) => FromJSON (MSet a) where
parseJSON = fmap mSetFromList . parseJSON parseJSON = fmap mSetFromList . parseJSON
instance (ToJSONKey a, ToSchema a) => ToSchema (MSet a) where instance ToSchema (MSet a) where
-- TODO -- TODO
declareNamedSchema _ = wellNamedSchema "" (Proxy :: Proxy TODO) declareNamedSchema _ = wellNamedSchema "" (Proxy :: Proxy TODO)
------------------------------------------------------------------------ ------------------------------------------------------------------------
newtype NgramsTerm = NgramsTerm { unNgramsTerm :: Text } newtype NgramsTerm = NgramsTerm { unNgramsTerm :: Text }
deriving (Ord, Eq, Show, Read, Generic) deriving (Ord, Eq, Show, Read, Generic)
deriving newtype (ToJSONKey, ToJSON, FromJSON, Semigroup, Arbitrary, Serialise, ToSchema, Hashable, NFData, FromField, ToField) deriving newtype (ToJSONKey, ToJSON, FromJSON, Semigroup, Serialise, ToSchema, Hashable, NFData, FromField, ToField)
deriving anyclass (ToExpr) deriving anyclass (ToExpr)
instance IsHashable NgramsTerm where instance IsHashable NgramsTerm where
hash (NgramsTerm t) = hash t hash (NgramsTerm t) = hash t
...@@ -243,24 +241,6 @@ toNgramsElement ns = map toNgramsElement' ns ...@@ -243,24 +241,6 @@ toNgramsElement ns = map toNgramsElement' ns
$ map (\(NgramsTableData _ p t _ _ _) -> (p, Set.singleton t)) ns $ map (\(NgramsTableData _ p t _ _ _) -> (p, Set.singleton t)) ns
-} -}
mockTable :: NgramsTable
mockTable = NgramsTable
[ mkNgramsElement "animal" MapTerm Nothing (mSetFromList ["dog", "cat"])
, mkNgramsElement "cat" MapTerm (rp "animal") mempty
, mkNgramsElement "cats" StopTerm Nothing mempty
, mkNgramsElement "dog" MapTerm (rp "animal") (mSetFromList ["dogs"])
, mkNgramsElement "dogs" StopTerm (rp "dog") mempty
, mkNgramsElement "fox" MapTerm Nothing mempty
, mkNgramsElement "object" CandidateTerm Nothing mempty
, mkNgramsElement "nothing" StopTerm Nothing mempty
, mkNgramsElement "organic" MapTerm Nothing (mSetFromList ["flower"])
, mkNgramsElement "flower" MapTerm (rp "organic") mempty
, mkNgramsElement "moon" CandidateTerm Nothing mempty
, mkNgramsElement "sky" StopTerm Nothing mempty
]
where
rp n = Just $ RootParent n n
instance ToSchema NgramsTable instance ToSchema NgramsTable
------------------------------------------------------------------------ ------------------------------------------------------------------------
...@@ -412,7 +392,7 @@ makePrisms ''PatchMSet ...@@ -412,7 +392,7 @@ makePrisms ''PatchMSet
_PatchMSetIso :: Ord a => Iso' (PatchMSet a) (PatchSet a) _PatchMSetIso :: Ord a => Iso' (PatchMSet a) (PatchSet a)
_PatchMSetIso = _PatchMSet . _PatchMap . iso f g . from _PatchSet _PatchMSetIso = _PatchMSet . _PatchMap . iso f g . from _PatchSet
where where
f :: Ord a => Map a (Replace (Maybe ())) -> (Set a, Set a) f :: Map a (Replace (Maybe ())) -> (Set a, Set a)
f = Map.partition isRem >>> both %~ Map.keysSet f = Map.partition isRem >>> both %~ Map.keysSet
g :: Ord a => (Set a, Set a) -> Map a (Replace (Maybe ())) g :: Ord a => (Set a, Set a) -> Map a (Replace (Maybe ()))
...@@ -432,7 +412,7 @@ instance (Ord a, ToJSON a) => ToJSON (PatchMSet a) where ...@@ -432,7 +412,7 @@ instance (Ord a, ToJSON a) => ToJSON (PatchMSet a) where
instance (Ord a, FromJSON a) => FromJSON (PatchMSet a) where instance (Ord a, FromJSON a) => FromJSON (PatchMSet a) where
parseJSON = fmap (_PatchMSetIso #) . parseJSON parseJSON = fmap (_PatchMSetIso #) . parseJSON
instance ToSchema a => ToSchema (PatchMSet a) where instance ToSchema (PatchMSet a) where
-- TODO -- TODO
declareNamedSchema _ = wellNamedSchema "" (Proxy :: Proxy TODO) declareNamedSchema _ = wellNamedSchema "" (Proxy :: Proxy TODO)
...@@ -833,37 +813,6 @@ instance (Serialise a, Ord a) => Serialise (PatchMap a AddRem) ...@@ -833,37 +813,6 @@ instance (Serialise a, Ord a) => Serialise (PatchMap a AddRem)
instance (Serialise a, Ord a) => Serialise (PatchMSet a) instance (Serialise a, Ord a) => Serialise (PatchMSet a)
instance (Serialise s, Serialise p) => Serialise (Repo s p) instance (Serialise s, Serialise p) => Serialise (Repo s p)
--
-- Arbitrary instances
--
instance Arbitrary TabType where
arbitrary = elements [minBound .. maxBound]
instance Arbitrary NgramsElement where
arbitrary = elements [newNgramsElement Nothing "sport"]
instance Arbitrary NgramsTable where
arbitrary = pure mockTable
instance Arbitrary OrderBy
where
arbitrary = elements [minBound..maxBound]
instance (Ord a, Arbitrary a) => Arbitrary (PatchMSet a) where
arbitrary = (PatchMSet . PM.fromMap) <$> arbitrary
instance (Eq a, Arbitrary a) => Arbitrary (Replace a) where
arbitrary = uncurry replace <$> arbitrary
-- If they happen to be equal then the patch is Keep.
instance Arbitrary NgramsPatch where
arbitrary = frequency [ (9, NgramsPatch <$> arbitrary <*> (replace <$> arbitrary <*> arbitrary))
, (1, NgramsReplace <$> arbitrary <*> arbitrary)
]
instance Arbitrary NgramsTablePatch where
arbitrary = NgramsTablePatch <$> PM.fromMap <$> arbitrary
instance Arbitrary a => Arbitrary (Versioned a) where
arbitrary = Versioned 1 <$> arbitrary -- TODO 1 is constant so far
instance Arbitrary a => Arbitrary (VersionedWithCount a) where
arbitrary = VersionedWithCount 1 1 <$> arbitrary -- TODO 1 is constant so far
instance Arbitrary NgramsRepoElement where
arbitrary = elements $ map ngramsElementToRepo ns
where
NgramsTable ns = mockTable
toNgramsPatch :: [NgramsTerm] -> NgramsPatch toNgramsPatch :: [NgramsTerm] -> NgramsPatch
......
...@@ -61,7 +61,6 @@ import Gargantext.Database.Admin.Types.Node ...@@ -61,7 +61,6 @@ import Gargantext.Database.Admin.Types.Node
import Gargantext.Database.Prelude (Cmd, JSONB) import Gargantext.Database.Prelude (Cmd, JSONB)
import Gargantext.Database.Query.Table.Node import Gargantext.Database.Query.Table.Node
import Gargantext.Database.Query.Table.Node.Children (getChildren) import Gargantext.Database.Query.Table.Node.Children (getChildren)
import Gargantext.Database.Query.Table.Node.Error (HasNodeError(..))
import Gargantext.Database.Query.Table.Node.Update (Update(..), update) import Gargantext.Database.Query.Table.Node.Update (Update(..), update)
import Gargantext.Database.Query.Table.Node.Update qualified as U (update, Update(..)) import Gargantext.Database.Query.Table.Node.Update qualified as U (update, Update(..))
import Gargantext.Database.Query.Table.Node.UpdateOpaleye (updateHyperdata) import Gargantext.Database.Query.Table.Node.UpdateOpaleye (updateHyperdata)
...@@ -187,7 +186,7 @@ treeFlatAPI authenticatedUser rootId = ...@@ -187,7 +186,7 @@ treeFlatAPI authenticatedUser rootId =
rename :: NodeId -> RenameNode -> Cmd err [Int] rename :: NodeId -> RenameNode -> Cmd err [Int]
rename nId (RenameNode name') = U.update (U.Rename nId name') rename nId (RenameNode name') = U.update (U.Rename nId name')
putNode :: forall err a. (HasNodeError err, HyperdataC a) putNode :: forall err a. (HyperdataC a)
=> NodeId => NodeId
-> a -> a
-> Cmd err Int -> Cmd err Int
...@@ -223,7 +222,7 @@ nodeAPI authenticatedUser = Named.NodeAPIEndpoint $ \targetNode -> ...@@ -223,7 +222,7 @@ nodeAPI authenticatedUser = Named.NodeAPIEndpoint $ \targetNode ->
concreteAPI = genericNodeAPI' (Proxy :: Proxy HyperdataAny) authenticatedUser concreteAPI = genericNodeAPI' (Proxy :: Proxy HyperdataAny) authenticatedUser
-- | The /actual/ (generic) node API, instantiated depending on the concrete type of node. -- | The /actual/ (generic) node API, instantiated depending on the concrete type of node.
genericNodeAPI' :: forall a proxy. ( HyperdataC a, Show a, MimeUnrender JSON a, Named.IsGenericNodeRoute a ) genericNodeAPI' :: forall a proxy. ( HyperdataC a )
=> proxy a => proxy a
-> AuthenticatedUser -> AuthenticatedUser
-> NodeId -> NodeId
......
...@@ -22,7 +22,6 @@ import Conduit ( yield ) ...@@ -22,7 +22,6 @@ import Conduit ( yield )
import Gargantext.API.Admin.Auth.Types ( AuthenticatedUser(AuthenticatedUser) ) import Gargantext.API.Admin.Auth.Types ( AuthenticatedUser(AuthenticatedUser) )
import Gargantext.API.Admin.EnvTypes (Env, GargJob(..)) import Gargantext.API.Admin.EnvTypes (Env, GargJob(..))
import Gargantext.API.Admin.Orchestrator.Types (AsyncJobs(..)) import Gargantext.API.Admin.Orchestrator.Types (AsyncJobs(..))
import Gargantext.API.Admin.Types (HasSettings)
import Gargantext.API.Errors.Types ( BackendInternalError ) import Gargantext.API.Errors.Types ( BackendInternalError )
import Gargantext.API.Node ( nodeNodeAPI ) import Gargantext.API.Node ( nodeNodeAPI )
import Gargantext.API.Node.Contact.Types import Gargantext.API.Node.Contact.Types
...@@ -54,7 +53,7 @@ api_async u nId = Named.ContactAsyncAPI $ AsyncJobs $ ...@@ -54,7 +53,7 @@ api_async u nId = Named.ContactAsyncAPI $ AsyncJobs $
serveJobsAPI AddContactJob $ \jHandle p -> serveJobsAPI AddContactJob $ \jHandle p ->
addContact u nId p jHandle addContact u nId p jHandle
addContact :: (HasSettings env, FlowCmdM env err m, MonadJobStatus m) addContact :: (FlowCmdM env err m, MonadJobStatus m)
=> User => User
-> NodeId -> NodeId
-> AddContactParams -> AddContactParams
......
...@@ -29,7 +29,6 @@ import Data.Text qualified as T ...@@ -29,7 +29,6 @@ import Data.Text qualified as T
import Data.Text.Encoding qualified as TE import Data.Text.Encoding qualified as TE
import EPO.API.Client.Types qualified as EPO import EPO.API.Client.Types qualified as EPO
import Gargantext.API.Admin.Orchestrator.Types qualified as API import Gargantext.API.Admin.Orchestrator.Types qualified as API
import Gargantext.API.Admin.Types (HasSettings)
import Gargantext.API.Ngrams (commitStatePatch, Versioned(..)) import Gargantext.API.Ngrams (commitStatePatch, Versioned(..))
import Gargantext.API.Node.Corpus.New.Types ( FileFormat(..), FileType(..) ) import Gargantext.API.Node.Corpus.New.Types ( FileFormat(..), FileType(..) )
import Gargantext.API.Node.Corpus.Searx ( triggerSearxSearch ) import Gargantext.API.Node.Corpus.Searx ( triggerSearxSearch )
...@@ -148,7 +147,6 @@ addToCorpusWithQuery :: ( FlowCmdM env err m ...@@ -148,7 +147,6 @@ addToCorpusWithQuery :: ( FlowCmdM env err m
, MonadJobStatus m , MonadJobStatus m
, HasNodeStoryImmediateSaver env , HasNodeStoryImmediateSaver env
, HasNodeArchiveStoryImmediateSaver env , HasNodeArchiveStoryImmediateSaver env
, HasSettings env
) )
=> User => User
-> CorpusId -> CorpusId
...@@ -222,7 +220,6 @@ addToCorpusWithForm :: ( FlowCmdM env err m ...@@ -222,7 +220,6 @@ addToCorpusWithForm :: ( FlowCmdM env err m
, MonadJobStatus m , MonadJobStatus m
, HasNodeStoryImmediateSaver env , HasNodeStoryImmediateSaver env
, HasNodeArchiveStoryImmediateSaver env , HasNodeArchiveStoryImmediateSaver env
, HasSettings env
) )
=> User => User
-> CorpusId -> CorpusId
...@@ -326,7 +323,7 @@ addToCorpusWithFile cid input filetype logStatus = do ...@@ -326,7 +323,7 @@ addToCorpusWithFile cid input filetype logStatus = do
} }
-} -}
addToCorpusWithFile :: (HasSettings env, FlowCmdM env err m, MonadJobStatus m) addToCorpusWithFile :: (FlowCmdM env err m, MonadJobStatus m)
=> User => User
-> CorpusId -> CorpusId
-> NewWithFile -> NewWithFile
......
...@@ -21,7 +21,6 @@ import Data.Text qualified as Text ...@@ -21,7 +21,6 @@ import Data.Text qualified as Text
import Data.Time.Calendar (Day, toGregorian) import Data.Time.Calendar (Day, toGregorian)
import Data.Time.Format (defaultTimeLocale, formatTime, parseTimeM) import Data.Time.Format (defaultTimeLocale, formatTime, parseTimeM)
import Data.Tuple.Select (sel1, sel2, sel3) import Data.Tuple.Select (sel1, sel2, sel3)
import Gargantext.API.Admin.Types (HasSettings)
import Gargantext.Core (Lang(..)) import Gargantext.Core (Lang(..))
import Gargantext.Core.Config (GargConfig(..), hasConfig) import Gargantext.Core.Config (GargConfig(..), hasConfig)
import Gargantext.Core.Config.Types (FramesConfig(..)) import Gargantext.Core.Config.Types (FramesConfig(..))
...@@ -123,7 +122,6 @@ insertSearxResponse :: ( MonadBase IO m ...@@ -123,7 +122,6 @@ insertSearxResponse :: ( MonadBase IO m
, HasNodeError err , HasNodeError err
, HasTreeError err , HasTreeError err
, HasValidationError err , HasValidationError err
, HasSettings env
) )
=> User => User
-> CorpusId -> CorpusId
...@@ -168,7 +166,6 @@ triggerSearxSearch :: ( MonadBase IO m ...@@ -168,7 +166,6 @@ triggerSearxSearch :: ( MonadBase IO m
, HasTreeError err , HasTreeError err
, HasValidationError err , HasValidationError err
, MonadJobStatus m , MonadJobStatus m
, HasSettings env
) )
=> User => User
-> CorpusId -> CorpusId
......
...@@ -20,7 +20,6 @@ import Control.Lens (view) ...@@ -20,7 +20,6 @@ import Control.Lens (view)
import Data.Text qualified as T import Data.Text qualified as T
import Gargantext.API.Admin.EnvTypes (GargJob(..), Env) import Gargantext.API.Admin.EnvTypes (GargJob(..), Env)
import Gargantext.API.Admin.Orchestrator.Types import Gargantext.API.Admin.Orchestrator.Types
import Gargantext.API.Admin.Types (HasSettings)
import Gargantext.API.Errors.Types ( BackendInternalError ) import Gargantext.API.Errors.Types ( BackendInternalError )
import Gargantext.API.Node.DocumentUpload.Types import Gargantext.API.Node.DocumentUpload.Types
import Gargantext.API.Prelude ( GargM ) import Gargantext.API.Prelude ( GargM )
...@@ -45,7 +44,7 @@ api nId = Named.DocumentUploadAPI $ AsyncJobs $ ...@@ -45,7 +44,7 @@ api nId = Named.DocumentUploadAPI $ AsyncJobs $
serveJobsAPI UploadDocumentJob $ \jHandle q -> do serveJobsAPI UploadDocumentJob $ \jHandle q -> do
documentUploadAsync nId q jHandle documentUploadAsync nId q jHandle
documentUploadAsync :: (FlowCmdM env err m, MonadJobStatus m, HasSettings env) documentUploadAsync :: (FlowCmdM env err m, MonadJobStatus m)
=> NodeId => NodeId
-> DocumentUpload -> DocumentUpload
-> JobHandle m -> JobHandle m
...@@ -56,7 +55,7 @@ documentUploadAsync nId doc jobHandle = do ...@@ -56,7 +55,7 @@ documentUploadAsync nId doc jobHandle = do
-- printDebug "documentUploadAsync" docIds -- printDebug "documentUploadAsync" docIds
markComplete jobHandle markComplete jobHandle
documentUpload :: (FlowCmdM env err m, HasSettings env) documentUpload :: (FlowCmdM env err m)
=> NodeId => NodeId
-> DocumentUpload -> DocumentUpload
-> m [DocId] -> m [DocId]
......
...@@ -22,7 +22,6 @@ import Data.Text qualified as T ...@@ -22,7 +22,6 @@ import Data.Text qualified as T
import Gargantext.API.Admin.Auth.Types ( AuthenticatedUser, auth_node_id, auth_user_id ) import Gargantext.API.Admin.Auth.Types ( AuthenticatedUser, auth_node_id, auth_user_id )
import Gargantext.API.Admin.EnvTypes (Env, GargJob(..)) import Gargantext.API.Admin.EnvTypes (Env, GargJob(..))
import Gargantext.API.Admin.Orchestrator.Types import Gargantext.API.Admin.Orchestrator.Types
import Gargantext.API.Admin.Types (HasSettings)
import Gargantext.API.Errors.Types ( BackendInternalError ) import Gargantext.API.Errors.Types ( BackendInternalError )
import Gargantext.API.Ngrams (commitStatePatch, Versioned(..)) import Gargantext.API.Ngrams (commitStatePatch, Versioned(..))
import Gargantext.API.Node.DocumentsFromWriteNodes.Types import Gargantext.API.Node.DocumentsFromWriteNodes.Types
...@@ -55,8 +54,7 @@ api authenticatedUser nId = Named.DocumentsFromWriteNodesAPI $ AsyncJobs $ ...@@ -55,8 +54,7 @@ api authenticatedUser nId = Named.DocumentsFromWriteNodesAPI $ AsyncJobs $
serveJobsAPI DocumentFromWriteNodeJob $ \jHandle p -> serveJobsAPI DocumentFromWriteNodeJob $ \jHandle p ->
documentsFromWriteNodes authenticatedUser nId p jHandle documentsFromWriteNodes authenticatedUser nId p jHandle
documentsFromWriteNodes :: ( HasSettings env documentsFromWriteNodes :: ( FlowCmdM env err m
, FlowCmdM env err m
, MonadJobStatus m , MonadJobStatus m
, HasNodeStoryImmediateSaver env , HasNodeStoryImmediateSaver env
, HasNodeArchiveStoryImmediateSaver env ) , HasNodeArchiveStoryImmediateSaver env )
......
...@@ -22,7 +22,6 @@ import Data.Text qualified as T ...@@ -22,7 +22,6 @@ import Data.Text qualified as T
import Gargantext.API.Admin.Auth.Types ( AuthenticatedUser, auth_user_id ) import Gargantext.API.Admin.Auth.Types ( AuthenticatedUser, auth_user_id )
import Gargantext.API.Admin.EnvTypes (GargJob(..), Env) import Gargantext.API.Admin.EnvTypes (GargJob(..), Env)
import Gargantext.API.Admin.Orchestrator.Types (AsyncJobs(..)) import Gargantext.API.Admin.Orchestrator.Types (AsyncJobs(..))
import Gargantext.API.Admin.Types (HasSettings)
import Gargantext.API.Errors.Types ( BackendInternalError ) import Gargantext.API.Errors.Types ( BackendInternalError )
import Gargantext.API.Node.File.Types import Gargantext.API.Node.File.Types
import Gargantext.API.Node.Types ( NewWithFile(NewWithFile) ) import Gargantext.API.Node.Types ( NewWithFile(NewWithFile) )
...@@ -41,12 +40,12 @@ import Gargantext.Utils.Jobs (serveJobsAPI, MonadJobStatus(..)) ...@@ -41,12 +40,12 @@ import Gargantext.Utils.Jobs (serveJobsAPI, MonadJobStatus(..))
import Servant import Servant
import Servant.Server.Generic (AsServerT) import Servant.Server.Generic (AsServerT)
fileApi :: (HasSettings env, FlowCmdM env err m) fileApi :: (FlowCmdM env err m)
=> NodeId => NodeId
-> m (Headers '[Servant.Header "Content-Type" Text] BSResponse) -> m (Headers '[Servant.Header "Content-Type" Text] BSResponse)
fileApi nId = fileDownload nId fileApi nId = fileDownload nId
fileDownload :: (HasSettings env, FlowCmdM env err m) fileDownload :: (FlowCmdM env err m)
=> NodeId => NodeId
-> m (Headers '[Servant.Header "Content-Type" Text] BSResponse) -> m (Headers '[Servant.Header "Content-Type" Text] BSResponse)
fileDownload nId = do fileDownload nId = do
...@@ -83,7 +82,7 @@ fileAsyncApi authenticatedUser nId = Named.FileAsyncAPI $ AsyncJobs $ ...@@ -83,7 +82,7 @@ fileAsyncApi authenticatedUser nId = Named.FileAsyncAPI $ AsyncJobs $
addWithFile authenticatedUser nId i jHandle addWithFile authenticatedUser nId i jHandle
addWithFile :: (HasSettings env, FlowCmdM env err m, MonadJobStatus m) addWithFile :: (FlowCmdM env err m, MonadJobStatus m)
=> AuthenticatedUser => AuthenticatedUser
-- ^ The logged-in user -- ^ The logged-in user
-> NodeId -> NodeId
......
...@@ -21,7 +21,6 @@ import Data.Text qualified as T ...@@ -21,7 +21,6 @@ import Data.Text qualified as T
import Gargantext.API.Admin.Auth.Types ( auth_node_id, AuthenticatedUser ) import Gargantext.API.Admin.Auth.Types ( auth_node_id, AuthenticatedUser )
import Gargantext.API.Admin.EnvTypes (GargJob(..), Env) import Gargantext.API.Admin.EnvTypes (GargJob(..), Env)
import Gargantext.API.Admin.Orchestrator.Types (AsyncJobs(..)) import Gargantext.API.Admin.Orchestrator.Types (AsyncJobs(..))
import Gargantext.API.Admin.Types (HasSettings)
import Gargantext.API.Errors.Types ( BackendInternalError ) import Gargantext.API.Errors.Types ( BackendInternalError )
import Gargantext.API.Node.Corpus.New (addToCorpusWithForm) import Gargantext.API.Node.Corpus.New (addToCorpusWithForm)
import Gargantext.API.Node.Corpus.New.Types (FileFormat(..), FileType(..)) import Gargantext.API.Node.Corpus.New.Types (FileFormat(..), FileType(..))
...@@ -55,7 +54,6 @@ frameCalcUploadAsync :: ( HasConfig env ...@@ -55,7 +54,6 @@ frameCalcUploadAsync :: ( HasConfig env
, FlowCmdM env err m , FlowCmdM env err m
, MonadJobStatus m , MonadJobStatus m
, HasNodeArchiveStoryImmediateSaver env , HasNodeArchiveStoryImmediateSaver env
, HasSettings env
) )
=> AuthenticatedUser => AuthenticatedUser
-- ^ The logged-in user -- ^ The logged-in user
......
...@@ -23,7 +23,6 @@ import Control.Lens hiding (elements, Empty) ...@@ -23,7 +23,6 @@ import Control.Lens hiding (elements, Empty)
import Gargantext.API.Admin.Auth.Types import Gargantext.API.Admin.Auth.Types
import Gargantext.API.Admin.EnvTypes (GargJob(..), Env) import Gargantext.API.Admin.EnvTypes (GargJob(..), Env)
import Gargantext.API.Admin.Orchestrator.Types (AsyncJobs (..)) import Gargantext.API.Admin.Orchestrator.Types (AsyncJobs (..))
import Gargantext.API.Admin.Types (HasSettings)
import Gargantext.API.Errors.Types import Gargantext.API.Errors.Types
import Gargantext.API.Node.New.Types import Gargantext.API.Node.New.Types
import Gargantext.API.Prelude import Gargantext.API.Prelude
...@@ -44,9 +43,8 @@ import Servant.Server.Generic (AsServerT) ...@@ -44,9 +43,8 @@ import Servant.Server.Generic (AsServerT)
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- postNode :: (CmdM env err m, HasNodeError err, HasSettings env) -- postNode :: (CmdM env err m, HasNodeError err, HasSettings env)
postNode :: ( HasMail env postNode :: ( HasMail env
, HasNLPServer env
, HasNodeError err , HasNodeError err
, HasSettings env , HasNLPServer env
, CE.HasCentralExchangeNotification env) , CE.HasCentralExchangeNotification env)
=> AuthenticatedUser => AuthenticatedUser
-- ^ The logged-in user -- ^ The logged-in user
...@@ -79,10 +77,8 @@ postNodeAsyncAPI authenticatedUser nId = Named.PostNodeAsyncAPI $ AsyncJobs $ ...@@ -79,10 +77,8 @@ postNodeAsyncAPI authenticatedUser nId = Named.PostNodeAsyncAPI $ AsyncJobs $
-- -> m [NodeId] -- -> m [NodeId]
-- postNode' authenticatedUser pId (PostNode nodeName nt) = do -- postNode' authenticatedUser pId (PostNode nodeName nt) = do
postNode' :: ( CmdM env err m postNode' :: ( CmdM env err m
, HasMail env
, HasNLPServer env
, HasNodeError err , HasNodeError err
, HasSettings env , HasMail env
, CE.HasCentralExchangeNotification env) , CE.HasCentralExchangeNotification env)
=> AuthenticatedUser => AuthenticatedUser
-- ^ The logged in user -- ^ The logged in user
......
...@@ -33,7 +33,6 @@ import Gargantext.Database.Query.Table.Node.Error (HasNodeError(..)) ...@@ -33,7 +33,6 @@ import Gargantext.Database.Query.Table.Node.Error (HasNodeError(..))
import Gargantext.Database.Query.Tree (findNodesWithType) import Gargantext.Database.Query.Tree (findNodesWithType)
import Gargantext.Prelude import Gargantext.Prelude
import Servant.Server.Generic (AsServerT) import Servant.Server.Generic (AsServerT)
import Gargantext.API.Admin.Types (HasSettings)
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- TODO permission -- TODO permission
...@@ -42,7 +41,6 @@ import Gargantext.API.Admin.Types (HasSettings) ...@@ -42,7 +41,6 @@ import Gargantext.API.Admin.Types (HasSettings)
api :: ( HasNodeError err api :: ( HasNodeError err
, HasNLPServer env , HasNLPServer env
, CmdRandom env err m , CmdRandom env err m
, HasSettings env
, HasCentralExchangeNotification env ) , HasCentralExchangeNotification env )
=> User => User
-> NodeId -> NodeId
......
...@@ -18,7 +18,6 @@ import Control.Lens (view) ...@@ -18,7 +18,6 @@ import Control.Lens (view)
import Data.Set qualified as Set import Data.Set qualified as Set
import Gargantext.API.Admin.EnvTypes (GargJob(..), Env) import Gargantext.API.Admin.EnvTypes (GargJob(..), Env)
import Gargantext.API.Admin.Orchestrator.Types (AsyncJobs(..)) import Gargantext.API.Admin.Orchestrator.Types (AsyncJobs(..))
import Gargantext.API.Admin.Types (HasSettings)
import Gargantext.API.Errors.Types ( BackendInternalError ) import Gargantext.API.Errors.Types ( BackendInternalError )
import Gargantext.API.Metrics qualified as Metrics import Gargantext.API.Metrics qualified as Metrics
import Gargantext.API.Ngrams.Types qualified as NgramsTypes import Gargantext.API.Ngrams.Types qualified as NgramsTypes
...@@ -52,7 +51,6 @@ api nId = Named.UpdateAPI $ AsyncJobs $ ...@@ -52,7 +51,6 @@ api nId = Named.UpdateAPI $ AsyncJobs $
updateNode nId p jHandle updateNode nId p jHandle
updateNode :: (HasNodeStory env err m updateNode :: (HasNodeStory env err m
, HasSettings env
, MonadJobStatus m , MonadJobStatus m
, MonadLogger m , MonadLogger m
) )
......
...@@ -24,7 +24,6 @@ import Control.Lens ((#)) ...@@ -24,7 +24,6 @@ import Control.Lens ((#))
import Data.Aeson.Types import Data.Aeson.Types
import Gargantext.API.Admin.Auth.Types (AuthenticationError) import Gargantext.API.Admin.Auth.Types (AuthenticationError)
import Gargantext.API.Admin.Orchestrator.Types import Gargantext.API.Admin.Orchestrator.Types
import Gargantext.API.Admin.Types
import Gargantext.API.Errors.Class import Gargantext.API.Errors.Class
import Gargantext.Core.AsyncUpdates.CentralExchange.Types (HasCentralExchangeNotification) import Gargantext.Core.AsyncUpdates.CentralExchange.Types (HasCentralExchangeNotification)
import Gargantext.Core.Config (HasConfig) import Gargantext.Core.Config (HasConfig)
...@@ -49,7 +48,6 @@ type HasJobEnv' env = HasJobEnv env JobLog JobLog ...@@ -49,7 +48,6 @@ type HasJobEnv' env = HasJobEnv env JobLog JobLog
type EnvC env = type EnvC env =
( HasConnectionPool env ( HasConnectionPool env
, HasSettings env -- TODO rename HasDbSettings
, HasJobEnv env JobLog JobLog , HasJobEnv env JobLog JobLog
, HasConfig env , HasConfig env
, HasNodeStoryEnv env , HasNodeStoryEnv env
...@@ -97,7 +95,6 @@ type GargNoServer t = ...@@ -97,7 +95,6 @@ type GargNoServer t =
type GargNoServer' env err m = type GargNoServer' env err m =
( CmdM env err m ( CmdM env err m
, HasNodeStory env err m , HasNodeStory env err m
, HasSettings env
, HasNodeError err , HasNodeError err
) )
......
...@@ -12,7 +12,6 @@ import Gargantext.API.Admin.Auth (withNamedAccess) ...@@ -12,7 +12,6 @@ import Gargantext.API.Admin.Auth (withNamedAccess)
import Gargantext.API.Admin.Auth.Types (AuthenticatedUser, PathId (..)) import Gargantext.API.Admin.Auth.Types (AuthenticatedUser, PathId (..))
import Gargantext.API.Admin.EnvTypes import Gargantext.API.Admin.EnvTypes
import Gargantext.API.Admin.Orchestrator.Types (AsyncJobs(..)) import Gargantext.API.Admin.Orchestrator.Types (AsyncJobs(..))
import Gargantext.API.Admin.Types (HasSettings)
import Gargantext.API.Errors.Types (BackendInternalError) import Gargantext.API.Errors.Types (BackendInternalError)
import Gargantext.API.Metrics qualified as Metrics import Gargantext.API.Metrics qualified as Metrics
import Gargantext.API.Ngrams import Gargantext.API.Ngrams
...@@ -72,7 +71,6 @@ apiNgramsAsync _dId = Named.TableNgramsAsyncAPI $ AsyncJobs $ ...@@ -72,7 +71,6 @@ apiNgramsAsync _dId = Named.TableNgramsAsyncAPI $ AsyncJobs $
tableNgramsPostChartsAsync :: ( HasNodeStory env err m tableNgramsPostChartsAsync :: ( HasNodeStory env err m
, HasSettings env
, MonadJobStatus m ) , MonadJobStatus m )
=> UpdateTableNgramsCharts => UpdateTableNgramsCharts
-> JobHandle m -> JobHandle m
......
...@@ -31,7 +31,6 @@ import DeferredFolds.UnfoldlM qualified as UnfoldlM ...@@ -31,7 +31,6 @@ import DeferredFolds.UnfoldlM qualified as UnfoldlM
import Data.UUID.V4 as UUID import Data.UUID.V4 as UUID
import Gargantext.API.Admin.Auth.Types (AuthenticatedUser(_auth_user_id)) import Gargantext.API.Admin.Auth.Types (AuthenticatedUser(_auth_user_id))
import Gargantext.API.Admin.Orchestrator.Types (JobLog) import Gargantext.API.Admin.Orchestrator.Types (JobLog)
import Gargantext.API.Admin.Types (Settings)
import Gargantext.API.Prelude (IsGargServer) import Gargantext.API.Prelude (IsGargServer)
import Gargantext.Core.AsyncUpdates.CentralExchange.Types qualified as CETypes import Gargantext.Core.AsyncUpdates.CentralExchange.Types qualified as CETypes
import Gargantext.Core.Types (NodeId, UserId) import Gargantext.Core.Types (NodeId, UserId)
......
...@@ -9,8 +9,6 @@ Portability : POSIX ...@@ -9,8 +9,6 @@ Portability : POSIX
-} -}
{-# LANGUAGE TemplateHaskell #-}
module Gargantext.Core.Config.Ini.Mail ( module Gargantext.Core.Config.Ini.Mail (
-- * Types -- * Types
GargMail(..) GargMail(..)
...@@ -20,21 +18,13 @@ module Gargantext.Core.Config.Ini.Mail ( ...@@ -20,21 +18,13 @@ module Gargantext.Core.Config.Ini.Mail (
-- * Utility functions -- * Utility functions
, gargMail , gargMail
, readConfig , readConfig
-- * Lenses
, mc_mail_from
, mc_mail_host
, mc_mail_login_type
, mc_mail_password
, mc_mail_port
, mc_mail_user
) )
where where
import Data.Maybe import Data.Maybe
import Data.Text (unpack) import Data.Text (unpack)
import Gargantext.Core.Config.Ini.Ini (readIniFile', val) import Gargantext.Core.Config.Ini.Ini (readIniFile', val)
import Gargantext.Core.Config.Mail (LoginType(..), MailConfig(..)) import Gargantext.Core.Config.Mail (LoginType(..), MailConfig(..), SendEmailType(LogEmailToConsole))
import Gargantext.Prelude import Gargantext.Prelude
import Network.Mail.Mime (plainPart) import Network.Mail.Mime (plainPart)
import Network.Mail.SMTP hiding (htmlPart, STARTTLS) import Network.Mail.SMTP hiding (htmlPart, STARTTLS)
...@@ -55,6 +45,7 @@ readConfig fp = do ...@@ -55,6 +45,7 @@ readConfig fp = do
, _mc_mail_from = cs $ val' "MAIL_FROM" , _mc_mail_from = cs $ val' "MAIL_FROM"
, _mc_mail_password = cs $ val' "MAIL_PASSWORD" , _mc_mail_password = cs $ val' "MAIL_PASSWORD"
, _mc_mail_login_type = read $ cs $ val' "MAIL_LOGIN_TYPE" , _mc_mail_login_type = read $ cs $ val' "MAIL_LOGIN_TYPE"
, _mc_send_login_emails = LogEmailToConsole
} }
...@@ -84,4 +75,3 @@ gargMail (MailConfig {..}) (GargMail { .. }) = do ...@@ -84,4 +75,3 @@ gargMail (MailConfig {..}) (GargMail { .. }) = do
cc = [] cc = []
bcc = [] bcc = []
makeLenses ''MailConfig
...@@ -15,6 +15,7 @@ module Gargantext.Core.Config.Mail ( ...@@ -15,6 +15,7 @@ module Gargantext.Core.Config.Mail (
-- * Types -- * Types
GargMail(..) GargMail(..)
, LoginType(..) , LoginType(..)
, SendEmailType(..)
, MailConfig(..) , MailConfig(..)
-- * Utility functions -- * Utility functions
...@@ -27,6 +28,7 @@ module Gargantext.Core.Config.Mail ( ...@@ -27,6 +28,7 @@ module Gargantext.Core.Config.Mail (
, mc_mail_password , mc_mail_password
, mc_mail_port , mc_mail_port
, mc_mail_user , mc_mail_user
, mc_send_login_emails
) )
where where
...@@ -47,7 +49,6 @@ type Name = Text ...@@ -47,7 +49,6 @@ type Name = Text
data LoginType = NoAuth | Normal | SSL | TLS | STARTTLS data LoginType = NoAuth | Normal | SSL | TLS | STARTTLS
deriving (Generic, Eq, Show, Read) deriving (Generic, Eq, Show, Read)
instance FromValue LoginType where instance FromValue LoginType where
fromValue (Toml.Text' _ t) = fromValue (Toml.Text' _ t) =
case t of case t of
...@@ -61,12 +62,20 @@ instance FromValue LoginType where ...@@ -61,12 +62,20 @@ instance FromValue LoginType where
instance ToValue LoginType where instance ToValue LoginType where
toValue v = toValue (show v :: Text) toValue v = toValue (show v :: Text)
data SendEmailType = SendEmailViaAws
| LogEmailToConsole
| WriteEmailToFile
deriving (Show, Read, Enum, Bounded, Generic)
data MailConfig = MailConfig { _mc_mail_host :: !T.Text data MailConfig = MailConfig { _mc_mail_host :: !T.Text
, _mc_mail_port :: !PortNumber , _mc_mail_port :: !PortNumber
, _mc_mail_user :: !T.Text , _mc_mail_user :: !T.Text
, _mc_mail_password :: !T.Text , _mc_mail_password :: !T.Text
, _mc_mail_login_type :: !LoginType , _mc_mail_login_type :: !LoginType
, _mc_mail_from :: !T.Text , _mc_mail_from :: !T.Text
, _mc_send_login_emails :: !SendEmailType
} }
deriving (Generic, Show) deriving (Generic, Show)
instance FromValue MailConfig where instance FromValue MailConfig where
...@@ -77,6 +86,7 @@ instance FromValue MailConfig where ...@@ -77,6 +86,7 @@ instance FromValue MailConfig where
_mc_mail_password <- reqKey "password" _mc_mail_password <- reqKey "password"
_mc_mail_login_type <- reqKey "login_type" _mc_mail_login_type <- reqKey "login_type"
_mc_mail_from <- reqKey "from" _mc_mail_from <- reqKey "from"
let _mc_send_login_emails = LogEmailToConsole
return $ MailConfig { _mc_mail_port = fromIntegral port, .. } return $ MailConfig { _mc_mail_port = fromIntegral port, .. }
instance ToValue MailConfig where instance ToValue MailConfig where
toValue = defaultTableToValue toValue = defaultTableToValue
......
...@@ -56,7 +56,9 @@ instance ToValue NLPConfig where ...@@ -56,7 +56,9 @@ instance ToValue NLPConfig where
toValue = defaultTableToValue toValue = defaultTableToValue
instance ToTable NLPConfig where instance ToTable NLPConfig where
toTable (NLPConfig { .. }) = toTable (NLPConfig { .. }) =
table [ k .= v | (k, v) <- Map.toList _nlp_languages ] table ([ k .= v | (k, v) <- Map.toList _nlp_languages ]
-- output the default "EN" language as well
<> [ ("EN" :: Text) .= _nlp_default ])
-- readConfig :: SettingsFile -> IO NLPConfig -- readConfig :: SettingsFile -> IO NLPConfig
......
...@@ -17,6 +17,7 @@ module Gargantext.Core.Config.Types ...@@ -17,6 +17,7 @@ module Gargantext.Core.Config.Types
( APIsConfig(..) ( APIsConfig(..)
, ac_pubmed_api_key , ac_pubmed_api_key
, ac_epo_api_url , ac_epo_api_url
, ac_scrapyd_url
, CORSOrigin(..) , CORSOrigin(..)
, CORSSettings(..) , CORSSettings(..)
, FramesConfig(..) , FramesConfig(..)
...@@ -33,6 +34,8 @@ module Gargantext.Core.Config.Types ...@@ -33,6 +34,8 @@ module Gargantext.Core.Config.Types
, fc_cors , fc_cors
, fc_microservices , fc_microservices
, fc_appPort , fc_appPort
, fc_cookie_settings
, defaultCookieSettings
, MicroServicesProxyStatus(..) , MicroServicesProxyStatus(..)
, microServicesProxyStatus , microServicesProxyStatus
, JobsConfig(..) , JobsConfig(..)
...@@ -59,7 +62,8 @@ import Control.Monad.Fail (fail) ...@@ -59,7 +62,8 @@ import Control.Monad.Fail (fail)
import Data.Text qualified as T import Data.Text qualified as T
import Database.PostgreSQL.Simple qualified as PGS import Database.PostgreSQL.Simple qualified as PGS
import Gargantext.Prelude import Gargantext.Prelude
import Servant.Auth.Server (JWTSettings, defaultJWTSettings, readKey, writeKey) import Servant.Auth.Server (CookieSettings(..), JWTSettings, XsrfCookieSettings(..), defaultJWTSettings, readKey, writeKey)
import Servant.Auth.Server qualified as SAuth
import Servant.Client.Core (BaseUrl, parseBaseUrl, showBaseUrl) import Servant.Client.Core (BaseUrl, parseBaseUrl, showBaseUrl)
import System.Directory (doesFileExist) import System.Directory (doesFileExist)
import Toml import Toml
...@@ -189,14 +193,20 @@ makeLenses ''FramesConfig ...@@ -189,14 +193,20 @@ makeLenses ''FramesConfig
type PortNumber = Int type PortNumber = Int
defaultCookieSettings :: CookieSettings
defaultCookieSettings = SAuth.defaultCookieSettings { cookieXsrfSetting = Just xsrfCookieSetting } -- TODO-SECURITY tune
where
xsrfCookieSetting = SAuth.defaultXsrfCookieSettings { xsrfExcludeGet = True }
-- TODO jwtSettings = defaultJWTSettings -- TODO jwtSettings = defaultJWTSettings
data FrontendConfig = data FrontendConfig =
FrontendConfig { _fc_url :: !Text FrontendConfig { _fc_url :: !Text
, _fc_backend_name :: !Text , _fc_backend_name :: !Text
, _fc_url_backend_api :: !Text , _fc_url_backend_api :: !Text
, _fc_cors :: !CORSSettings , _fc_cors :: !CORSSettings
, _fc_microservices :: !MicroServicesSettings , _fc_microservices :: !MicroServicesSettings
, _fc_appPort :: !PortNumber , _fc_appPort :: !PortNumber
, _fc_cookie_settings :: !CookieSettings
} }
deriving (Generic, Show) deriving (Generic, Show)
instance FromValue FrontendConfig where instance FromValue FrontendConfig where
...@@ -207,7 +217,7 @@ instance FromValue FrontendConfig where ...@@ -207,7 +217,7 @@ instance FromValue FrontendConfig where
_fc_cors <- reqKey "cors" _fc_cors <- reqKey "cors"
_fc_microservices <- reqKey "microservices" _fc_microservices <- reqKey "microservices"
let _fc_appPort = 3000 let _fc_appPort = 3000
return $ FrontendConfig { .. } return $ FrontendConfig { _fc_cookie_settings = defaultCookieSettings, .. }
instance ToValue FrontendConfig where instance ToValue FrontendConfig where
toValue = defaultTableToValue toValue = defaultTableToValue
instance ToTable FrontendConfig where instance ToTable FrontendConfig where
...@@ -290,18 +300,25 @@ makeLenses ''JobsConfig ...@@ -290,18 +300,25 @@ makeLenses ''JobsConfig
data APIsConfig = data APIsConfig =
APIsConfig { _ac_pubmed_api_key :: !Text APIsConfig { _ac_pubmed_api_key :: !Text
, _ac_epo_api_url :: !Text } , _ac_epo_api_url :: !Text
, _ac_scrapyd_url :: !BaseUrl }
deriving (Generic, Show) deriving (Generic, Show)
instance FromValue APIsConfig where instance FromValue APIsConfig where
fromValue = parseTableFromValue $ do fromValue = parseTableFromValue $ do
_ac_pubmed_api_key <- reqKeyOf "pubmed" $ parseTableFromValue $ reqKey "api_key" _ac_pubmed_api_key <- reqKeyOf "pubmed" $ parseTableFromValue $ reqKey "api_key"
_ac_epo_api_url <- reqKeyOf "epo" $ parseTableFromValue $ reqKey "api_url" _ac_epo_api_url <- reqKeyOf "epo" $ parseTableFromValue $ reqKey "api_url"
scrapyd_url <- reqKeyOf "scrapyd" $ parseTableFromValue $ reqKey "url"
_ac_scrapyd_url <-
case parseBaseUrl (T.unpack scrapyd_url) of
Nothing -> fail $ "Cannot parse scrapyd base url for: " <> T.unpack scrapyd_url
Just b -> return b
return $ APIsConfig { .. } return $ APIsConfig { .. }
instance ToValue APIsConfig where instance ToValue APIsConfig where
toValue = defaultTableToValue toValue = defaultTableToValue
instance ToTable APIsConfig where instance ToTable APIsConfig where
toTable (APIsConfig { .. }) = table [ "pubmed" .= table [ "api_key" .= _ac_pubmed_api_key ] toTable (APIsConfig { .. }) = table [ "pubmed" .= table [ "api_key" .= _ac_pubmed_api_key ]
, "epo" .= table [ "api_url" .= _ac_epo_api_url ] , "epo" .= table [ "api_url" .= _ac_epo_api_url ]
, "scrapyd" .= table [ "url" .= showBaseUrl _ac_scrapyd_url ]
] ]
makeLenses ''APIsConfig makeLenses ''APIsConfig
......
...@@ -22,7 +22,7 @@ Implementation use Accelerate library which enables GPU and CPU computation: ...@@ -22,7 +22,7 @@ Implementation use Accelerate library which enables GPU and CPU computation:
-} -}
{-# OPTIONS_GHC -fno-warn-deprecations #-} {-# OPTIONS_GHC -fno-warn-deprecations -fno-warn-redundant-constraints #-}
{-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-} {-# LANGUAGE TypeOperators #-}
......
...@@ -81,6 +81,8 @@ where $n_{ij}$ is the cooccurrence between term $i$ and term $j$ ...@@ -81,6 +81,8 @@ where $n_{ij}$ is the cooccurrence between term $i$ and term $j$
) )
-} -}
{-# OPTIONS_GHC -fno-warn-redundant-constraints #-}
{-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-} {-# LANGUAGE TypeOperators #-}
{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE ScopedTypeVariables #-}
......
...@@ -26,7 +26,6 @@ module Gargantext.Core.NodeStory.Types ...@@ -26,7 +26,6 @@ module Gargantext.Core.NodeStory.Types
, NgramsStatePatch' , NgramsStatePatch'
, NodeListStory , NodeListStory
, ArchiveList , ArchiveList
, initNodeListStoryMock
, NodeStoryEnv(..) , NodeStoryEnv(..)
, initNodeStory , initNodeStory
, nse_getter , nse_getter
...@@ -160,19 +159,6 @@ initArchive = Archive { _a_version = 0 ...@@ -160,19 +159,6 @@ initArchive = Archive { _a_version = 0
, _a_state = mempty , _a_state = mempty
, _a_history = [] } , _a_history = [] }
initNodeListStoryMock :: NodeListStory
initNodeListStoryMock = NodeStory $ Map.singleton nodeListId archive
where
nodeListId = 0
archive = Archive { _a_version = 0
, _a_state = ngramsTableMap
, _a_history = [] }
ngramsTableMap = Map.singleton Ngrams.NgramsTerms
$ Map.fromList
[ (n ^. ne_ngrams, ngramsElementToRepo n)
| n <- mockTable ^. _NgramsTable
]
---------------------------------------------------------------------- ----------------------------------------------------------------------
data NodeStoryPoly nid v ngtid ngid nre = data NodeStoryPoly nid v ngtid ngid nre =
NodeStoryDB { node_id :: !nid NodeStoryDB { node_id :: !nid
......
...@@ -95,7 +95,7 @@ makeLenses ''I ...@@ -95,7 +95,7 @@ makeLenses ''I
type ModEntropy i o e = (e -> e) -> i -> o type ModEntropy i o e = (e -> e) -> i -> o
set_autonomy :: Entropy e => ModEntropy (I e) (I e) e set_autonomy :: ModEntropy (I e) (I e) e
set_autonomy fe i = i & info_autonomy .~ fe (i ^. info_entropy_var) set_autonomy fe i = i & info_autonomy .~ fe (i ^. info_entropy_var)
set_entropy_var :: Entropy e => Setter e (I e) e e set_entropy_var :: Entropy e => Setter e (I e) e e
......
...@@ -61,7 +61,7 @@ randomString num = do ...@@ -61,7 +61,7 @@ randomString num = do
-- | Given a list of items of type 'a', return list with unique items -- | Given a list of items of type 'a', return list with unique items
-- (like List.nub) but tuple-d with their counts in the original list -- (like List.nub) but tuple-d with their counts in the original list
groupWithCounts :: (Ord a, Eq a) => [a] -> [(a, Int)] groupWithCounts :: (Eq a, Ord a) => [a] -> [(a, Int)]
groupWithCounts = map f groupWithCounts = map f
. List.group . List.group
. List.sort . List.sort
......
...@@ -21,7 +21,6 @@ module Gargantext.Core.Viz.Graph.API ...@@ -21,7 +21,6 @@ module Gargantext.Core.Viz.Graph.API
import Control.Lens (set, _Just, (^?), at) import Control.Lens (set, _Just, (^?), at)
import Data.HashMap.Strict qualified as HashMap import Data.HashMap.Strict qualified as HashMap
import Gargantext.API.Admin.EnvTypes (GargJob(..), Env) import Gargantext.API.Admin.EnvTypes (GargJob(..), Env)
import Gargantext.API.Admin.Types (HasSettings)
import Gargantext.API.Errors.Types ( BackendInternalError ) import Gargantext.API.Errors.Types ( BackendInternalError )
import Gargantext.API.Ngrams.Tools import Gargantext.API.Ngrams.Tools
import Gargantext.API.Prelude (GargM) import Gargantext.API.Prelude (GargM)
...@@ -267,7 +266,7 @@ recomputeVersions :: HasNodeStory env err m ...@@ -267,7 +266,7 @@ recomputeVersions :: HasNodeStory env err m
recomputeVersions nId = recomputeGraph nId Spinglass BridgenessMethod_Basic Nothing Nothing NgramsTerms NgramsTerms False recomputeVersions nId = recomputeGraph nId Spinglass BridgenessMethod_Basic Nothing Nothing NgramsTerms NgramsTerms False
------------------------------------------------------------ ------------------------------------------------------------
graphClone :: (HasNodeError err, HasSettings env) graphClone :: (HasNodeError err)
=> UserId => UserId
-> NodeId -> NodeId
-> HyperdataGraphAPI -> HyperdataGraphAPI
......
...@@ -24,8 +24,7 @@ import Data.Text qualified as T ...@@ -24,8 +24,7 @@ import Data.Text qualified as T
import Database.PostgreSQL.Simple (Connection) import Database.PostgreSQL.Simple (Connection)
import Gargantext.API.Admin.EnvTypes (ConcreteJobHandle, GargJob, Mode(Dev), modeToLoggingLevels) import Gargantext.API.Admin.EnvTypes (ConcreteJobHandle, GargJob, Mode(Dev), modeToLoggingLevels)
import Gargantext.API.Admin.Orchestrator.Types (JobLog, noJobLog) import Gargantext.API.Admin.Orchestrator.Types (JobLog, noJobLog)
import Gargantext.API.Admin.Settings ( devSettings, newPool ) import Gargantext.API.Admin.Settings ( newPool )
import Gargantext.API.Admin.Types (HasSettings(..), Settings(..))
import Gargantext.API.Prelude (GargM) import Gargantext.API.Prelude (GargM)
import Gargantext.Core.AsyncUpdates.CentralExchange qualified as CE import Gargantext.Core.AsyncUpdates.CentralExchange qualified as CE
import Gargantext.Core.AsyncUpdates.CentralExchange.Types qualified as CET import Gargantext.Core.AsyncUpdates.CentralExchange.Types qualified as CET
...@@ -49,8 +48,7 @@ import System.Log.FastLogger qualified as FL ...@@ -49,8 +48,7 @@ import System.Log.FastLogger qualified as FL
data WorkerEnv = WorkerEnv data WorkerEnv = WorkerEnv
{ _w_env_settings :: !Settings { _w_env_config :: !GargConfig
, _w_env_config :: !GargConfig
, _w_env_logger :: !(Logger (GargM WorkerEnv IOException)) , _w_env_logger :: !(Logger (GargM WorkerEnv IOException))
, _w_env_pool :: !(Pool Connection) , _w_env_pool :: !(Pool Connection)
, _w_env_nodeStory :: !NodeStoryEnv , _w_env_nodeStory :: !NodeStoryEnv
...@@ -70,12 +68,10 @@ withWorkerEnv settingsFile k = withLoggerHoisted Dev $ \logger -> do ...@@ -70,12 +68,10 @@ withWorkerEnv settingsFile k = withLoggerHoisted Dev $ \logger -> do
--nodeStory_env <- fromDBNodeStoryEnv (_gc_repofilepath cfg) --nodeStory_env <- fromDBNodeStoryEnv (_gc_repofilepath cfg)
pool <- newPool $ _gc_database_config cfg pool <- newPool $ _gc_database_config cfg
nodeStory_env <- fromDBNodeStoryEnv pool nodeStory_env <- fromDBNodeStoryEnv pool
let setts = devSettings
pure $ WorkerEnv pure $ WorkerEnv
{ _w_env_pool = pool { _w_env_pool = pool
, _w_env_logger = logger , _w_env_logger = logger
, _w_env_nodeStory = nodeStory_env , _w_env_nodeStory = nodeStory_env
, _w_env_settings = setts
, _w_env_config = cfg , _w_env_config = cfg
, _w_env_mail = _gc_mail_config cfg , _w_env_mail = _gc_mail_config cfg
, _w_env_nlp = nlpServerMap $ _gc_nlp_config cfg , _w_env_nlp = nlpServerMap $ _gc_nlp_config cfg
...@@ -84,9 +80,6 @@ withWorkerEnv settingsFile k = withLoggerHoisted Dev $ \logger -> do ...@@ -84,9 +80,6 @@ withWorkerEnv settingsFile k = withLoggerHoisted Dev $ \logger -> do
instance HasConfig WorkerEnv where instance HasConfig WorkerEnv where
hasConfig = to _w_env_config hasConfig = to _w_env_config
instance HasSettings WorkerEnv where
settings = to _w_env_settings
instance HasLogger (GargM WorkerEnv IOException) where instance HasLogger (GargM WorkerEnv IOException) where
data instance Logger (GargM WorkerEnv IOException) = data instance Logger (GargM WorkerEnv IOException) =
GargWorkerLogger { GargWorkerLogger {
......
...@@ -112,7 +112,6 @@ import PUBMED.Types qualified as PUBMED ...@@ -112,7 +112,6 @@ import PUBMED.Types qualified as PUBMED
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- Imports for upgrade function -- Imports for upgrade function
import Gargantext.Database.Query.Tree.Error ( HasTreeError ) import Gargantext.Database.Query.Tree.Error ( HasTreeError )
import Gargantext.API.Admin.Types (HasSettings)
------------------------------------------------------------------------ ------------------------------------------------------------------------
...@@ -129,7 +128,7 @@ printDataText (DataNew (maybeInt, conduitData)) = do ...@@ -129,7 +128,7 @@ printDataText (DataNew (maybeInt, conduitData)) = do
putText $ show (maybeInt, res) putText $ show (maybeInt, res)
-- TODO use the split parameter in config file -- TODO use the split parameter in config file
getDataText :: (HasNodeError err, HasSettings env) getDataText :: (HasNodeError err)
=> DataOrigin => DataOrigin
-> TermType Lang -> TermType Lang
-> API.RawQuery -> API.RawQuery
...@@ -146,7 +145,7 @@ getDataText (InternalOrigin _) la q _ _ _li = do ...@@ -146,7 +145,7 @@ getDataText (InternalOrigin _) la q _ _ _li = do
ids <- map fst <$> searchDocInDatabase cId (stem (_tt_lang la) GargPorterAlgorithm $ API.getRawQuery q) ids <- map fst <$> searchDocInDatabase cId (stem (_tt_lang la) GargPorterAlgorithm $ API.getRawQuery q)
pure $ Right $ DataOld ids pure $ Right $ DataOld ids
getDataText_Debug :: (HasNodeError err, HasSettings env) getDataText_Debug :: (HasNodeError err)
=> DataOrigin => DataOrigin
-> TermType Lang -> TermType Lang
-> API.RawQuery -> API.RawQuery
...@@ -168,7 +167,6 @@ flowDataText :: forall env err m. ...@@ -168,7 +167,6 @@ flowDataText :: forall env err m.
, HasTreeError err , HasTreeError err
, HasValidationError err , HasValidationError err
, MonadJobStatus m , MonadJobStatus m
, HasSettings env
, HasCentralExchangeNotification env , HasCentralExchangeNotification env
) )
=> User => User
...@@ -199,7 +197,6 @@ flowAnnuaire :: ( DbCmd' env err m ...@@ -199,7 +197,6 @@ flowAnnuaire :: ( DbCmd' env err m
, HasTreeError err , HasTreeError err
, HasValidationError err , HasValidationError err
, MonadJobStatus m , MonadJobStatus m
, HasSettings env
, HasCentralExchangeNotification env ) , HasCentralExchangeNotification env )
=> MkCorpusUser => MkCorpusUser
-> TermType Lang -> TermType Lang
...@@ -219,7 +216,6 @@ flowCorpusFile :: ( DbCmd' env err m ...@@ -219,7 +216,6 @@ flowCorpusFile :: ( DbCmd' env err m
, HasTreeError err , HasTreeError err
, HasValidationError err , HasValidationError err
, MonadJobStatus m , MonadJobStatus m
, HasSettings env
, HasCentralExchangeNotification env ) , HasCentralExchangeNotification env )
=> MkCorpusUser => MkCorpusUser
-> Limit -- Limit the number of docs (for dev purpose) -> Limit -- Limit the number of docs (for dev purpose)
...@@ -250,7 +246,6 @@ flowCorpus :: ( DbCmd' env err m ...@@ -250,7 +246,6 @@ flowCorpus :: ( DbCmd' env err m
, HasValidationError err , HasValidationError err
, FlowCorpus a , FlowCorpus a
, MonadJobStatus m , MonadJobStatus m
, HasSettings env
, HasCentralExchangeNotification env ) , HasCentralExchangeNotification env )
=> MkCorpusUser => MkCorpusUser
-> TermType Lang -> TermType Lang
...@@ -271,7 +266,6 @@ flow :: forall env err m a c. ...@@ -271,7 +266,6 @@ flow :: forall env err m a c.
, FlowCorpus a , FlowCorpus a
, MkCorpus c , MkCorpus c
, MonadJobStatus m , MonadJobStatus m
, HasSettings env
, HasCentralExchangeNotification env , HasCentralExchangeNotification env
) )
=> Maybe c => Maybe c
...@@ -309,7 +303,6 @@ addDocumentsToHyperCorpus :: ( DbCmd' env err m ...@@ -309,7 +303,6 @@ addDocumentsToHyperCorpus :: ( DbCmd' env err m
, HasNodeError err , HasNodeError err
, FlowCorpus document , FlowCorpus document
, MkCorpus corpus , MkCorpus corpus
, HasSettings env
) )
=> NLPServerConfig => NLPServerConfig
-> Maybe corpus -> Maybe corpus
...@@ -323,7 +316,7 @@ addDocumentsToHyperCorpus ncs mb_hyper la corpusId docs = do ...@@ -323,7 +316,7 @@ addDocumentsToHyperCorpus ncs mb_hyper la corpusId docs = do
pure ids pure ids
------------------------------------------------------------------------ ------------------------------------------------------------------------
createNodes :: ( DbCmd' env err m, HasNodeError err, HasSettings env createNodes :: ( DbCmd' env err m, HasNodeError err
, MkCorpus c , MkCorpus c
, HasCentralExchangeNotification env , HasCentralExchangeNotification env
) )
...@@ -356,7 +349,6 @@ flowCorpusUser :: ( HasNodeError err ...@@ -356,7 +349,6 @@ flowCorpusUser :: ( HasNodeError err
, HasTreeError err , HasTreeError err
, HasNodeStory env err m , HasNodeStory env err m
, MkCorpus c , MkCorpus c
, HasSettings env
) )
=> Lang => Lang
-> User -> User
...@@ -386,7 +378,6 @@ buildSocialList :: ( HasNodeError err ...@@ -386,7 +378,6 @@ buildSocialList :: ( HasNodeError err
, HasTreeError err , HasTreeError err
, HasNodeStory env err m , HasNodeStory env err m
, MkCorpus c , MkCorpus c
, HasSettings env
) )
=> Lang => Lang
-> User -> User
...@@ -422,7 +413,6 @@ insertMasterDocs :: ( DbCmd' env err m ...@@ -422,7 +413,6 @@ insertMasterDocs :: ( DbCmd' env err m
, HasNodeError err , HasNodeError err
, FlowCorpus a , FlowCorpus a
, MkCorpus c , MkCorpus c
, HasSettings env
) )
=> NLPServerConfig => NLPServerConfig
-> Maybe c -> Maybe c
......
...@@ -29,7 +29,6 @@ import Control.Lens (view) ...@@ -29,7 +29,6 @@ import Control.Lens (view)
import Control.Monad.Random import Control.Monad.Random
import Data.Text (splitOn) import Data.Text (splitOn)
import Data.Text qualified as Text import Data.Text qualified as Text
import Gargantext.API.Admin.Types (HasSettings)
import Gargantext.Core.Mail import Gargantext.Core.Mail
import Gargantext.Core.Mail.Types (HasMail, mailSettings) import Gargantext.Core.Mail.Types (HasMail, mailSettings)
import Gargantext.Core.Types.Individu import Gargantext.Core.Types.Individu
...@@ -46,7 +45,7 @@ import qualified Data.List.NonEmpty as NE ...@@ -46,7 +45,7 @@ import qualified Data.List.NonEmpty as NE
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- | Creates a new 'User' from the input 'EmailAddress', which needs to -- | Creates a new 'User' from the input 'EmailAddress', which needs to
-- be valid (i.e. a valid username needs to be inferred via 'guessUsername'). -- be valid (i.e. a valid username needs to be inferred via 'guessUsername').
newUser :: (CmdM env err m, MonadRandom m, HasNodeError err, HasMail env, HasSettings env) newUser :: (CmdM env err m, MonadRandom m, HasNodeError err, HasMail env)
=> EmailAddress => EmailAddress
-> m UserId -> m UserId
newUser emailAddress = do newUser emailAddress = do
...@@ -61,7 +60,7 @@ newUser emailAddress = do ...@@ -61,7 +60,7 @@ newUser emailAddress = do
-- This is an internal function and as such it /doesn't/ send out any email -- This is an internal function and as such it /doesn't/ send out any email
-- notification, and thus lives in the 'DbCmd' effect stack. You may want to -- notification, and thus lives in the 'DbCmd' effect stack. You may want to
-- use 'newUser' instead for standard Gargantext code. -- use 'newUser' instead for standard Gargantext code.
new_user :: (HasNodeError err, HasSettings env) new_user :: (HasNodeError err)
=> NewUser GargPassword => NewUser GargPassword
-> DBCmd' env err UserId -> DBCmd' env err UserId
new_user rq = do new_user rq = do
...@@ -73,7 +72,7 @@ new_user rq = do ...@@ -73,7 +72,7 @@ new_user rq = do
-- This is an internal function and as such it /doesn't/ send out any email -- This is an internal function and as such it /doesn't/ send out any email
-- notification, and thus lives in the 'DbCmd' effect stack. You may want to -- notification, and thus lives in the 'DbCmd' effect stack. You may want to
-- use 'newUsers' instead for standard Gargantext code. -- use 'newUsers' instead for standard Gargantext code.
new_users :: (HasNodeError err, HasSettings env) new_users :: (HasNodeError err)
=> NonEmpty (NewUser GargPassword) => NonEmpty (NewUser GargPassword)
-- ^ A list of users to create. -- ^ A list of users to create.
-> DBCmd' env err (NonEmpty UserId) -> DBCmd' env err (NonEmpty UserId)
...@@ -83,7 +82,7 @@ new_users us = do ...@@ -83,7 +82,7 @@ new_users us = do
mapM (fmap fst . getOrMkRoot) $ NE.map (\u -> UserName (_nu_username u)) us mapM (fmap fst . getOrMkRoot) $ NE.map (\u -> UserName (_nu_username u)) us
------------------------------------------------------------------------ ------------------------------------------------------------------------
newUsers :: (CmdM env err m, MonadRandom m, HasNodeError err, HasMail env, HasSettings env) newUsers :: (CmdM env err m, MonadRandom m, HasNodeError err, HasMail env)
=> NonEmpty EmailAddress => NonEmpty EmailAddress
-> m (NonEmpty UserId) -> m (NonEmpty UserId)
newUsers us = do newUsers us = do
...@@ -109,7 +108,7 @@ guessUserName n = case splitOn "@" n of ...@@ -109,7 +108,7 @@ guessUserName n = case splitOn "@" n of
_ -> Nothing _ -> Nothing
------------------------------------------------------------------------ ------------------------------------------------------------------------
newUsers' :: (HasNodeError err, HasSettings env) newUsers' :: (HasNodeError err)
=> MailConfig -> NonEmpty (NewUser GargPassword) -> DBCmd' env err (NonEmpty UserId) => MailConfig -> NonEmpty (NewUser GargPassword) -> DBCmd' env err (NonEmpty UserId)
newUsers' cfg us = do newUsers' cfg us = do
us' <- liftBase $ mapM toUserHash us us' <- liftBase $ mapM toUserHash us
......
...@@ -14,7 +14,6 @@ module Gargantext.Database.Query.Tree.Root ...@@ -14,7 +14,6 @@ module Gargantext.Database.Query.Tree.Root
where where
import Control.Arrow (returnA) import Control.Arrow (returnA)
import Gargantext.API.Admin.Types (HasSettings)
import Gargantext.Core (HasDBid(..)) import Gargantext.Core (HasDBid(..))
import Gargantext.Core.Types.Individu (User(..)) import Gargantext.Core.Types.Individu (User(..))
import Gargantext.Core.Types.Main (CorpusName) import Gargantext.Core.Types.Main (CorpusName)
...@@ -43,7 +42,7 @@ getRootId u = do ...@@ -43,7 +42,7 @@ getRootId u = do
getRoot :: User -> DBCmd err [Node HyperdataUser] getRoot :: User -> DBCmd err [Node HyperdataUser]
getRoot = runOpaQuery . selectRoot getRoot = runOpaQuery . selectRoot
getOrMkRoot :: (HasNodeError err, HasSettings env) getOrMkRoot :: (HasNodeError err)
=> User => User
-> DBCmd' env err (UserId, RootId) -> DBCmd' env err (UserId, RootId)
getOrMkRoot user = do getOrMkRoot user = do
...@@ -78,7 +77,7 @@ userFromMkCorpusUser (MkCorpusUserNormalCorpusIds u _cids) = u ...@@ -78,7 +77,7 @@ userFromMkCorpusUser (MkCorpusUserNormalCorpusIds u _cids) = u
userFromMkCorpusUser (MkCorpusUserNormalCorpusName u _cname) = u userFromMkCorpusUser (MkCorpusUserNormalCorpusName u _cname) = u
getOrMkRootWithCorpus :: (HasNodeError err, MkCorpus a, HasSettings env) getOrMkRootWithCorpus :: (HasNodeError err, MkCorpus a)
=> MkCorpusUser => MkCorpusUser
-> Maybe a -> Maybe a
-> DBCmd' env err (UserId, RootId, CorpusId) -> DBCmd' env err (UserId, RootId, CorpusId)
...@@ -120,7 +119,7 @@ mkCorpus cName c rootId userId = do ...@@ -120,7 +119,7 @@ mkCorpus cName c rootId userId = do
pure (userId, rootId, corpusId) pure (userId, rootId, corpusId)
mkRoot :: (HasNodeError err, HasSettings env) mkRoot :: (HasNodeError err)
=> User => User
-> DBCmd' env err [RootId] -> DBCmd' env err [RootId]
mkRoot user = do mkRoot user = do
......
...@@ -30,13 +30,12 @@ import Data.Text.Encoding qualified as TE ...@@ -30,13 +30,12 @@ import Data.Text.Encoding qualified as TE
import GHC.Generics import GHC.Generics
import Gargantext.API.Admin.Auth.Types (AuthContext) import Gargantext.API.Admin.Auth.Types (AuthContext)
import Gargantext.API.Admin.EnvTypes import Gargantext.API.Admin.EnvTypes
import Gargantext.API.Admin.Types
import Gargantext.API.Node.ShareURL qualified as Share import Gargantext.API.Node.ShareURL qualified as Share
import Gargantext.API.Routes.Named.Private import Gargantext.API.Routes.Named.Private
import Gargantext.API.Routes.Named.Share (ShareLink(..)) import Gargantext.API.Routes.Named.Share (ShareLink(..))
import Gargantext.API.ThrowAll (throwAllRoutes) import Gargantext.API.ThrowAll (throwAllRoutes)
import Gargantext.Core.Config (gc_frames, mkProxyUrl, hasConfig) import Gargantext.Core.Config (gc_frames, gc_frontend_config, mkProxyUrl, hasConfig)
import Gargantext.Core.Config.Types (f_write_url) import Gargantext.Core.Config.Types (f_write_url, fc_cookie_settings)
import Gargantext.Database.Admin.Types.Node (NodeType(..), NodeId (..)) import Gargantext.Database.Admin.Types.Node (NodeType(..), NodeId (..))
import Gargantext.Prelude hiding (Handler) import Gargantext.Prelude hiding (Handler)
import Network.HTTP.ReverseProxy import Network.HTTP.ReverseProxy
...@@ -158,7 +157,7 @@ microServicesProxyApp cache env = genericServeTWithContext identity (server cach ...@@ -158,7 +157,7 @@ microServicesProxyApp cache env = genericServeTWithContext identity (server cach
where where
cfg :: Context AuthContext cfg :: Context AuthContext
cfg = env ^. env_jwt_settings cfg = env ^. env_jwt_settings
:. env ^. settings . cookieSettings :. env ^. env_config . gc_frontend_config . fc_cookie_settings
:. EmptyContext :. EmptyContext
server :: ProxyCache -> Env -> ReverseProxyAPI (AsServerT Handler) server :: ProxyCache -> Env -> ReverseProxyAPI (AsServerT Handler)
......
...@@ -28,6 +28,10 @@ api_key = "no_key" ...@@ -28,6 +28,10 @@ api_key = "no_key"
[apis.epo] [apis.epo]
api_url = "" api_url = ""
[apis.scrapyd]
url = "http://localhost:6800"
[external] [external]
[external.frames] [external.frames]
write_url = "URL_TO_CHANGE" write_url = "URL_TO_CHANGE"
......
...@@ -54,7 +54,6 @@ newTestEnv :: TestEnv -> Logger (GargM Env BackendInternalError) -> Warp.Port -> ...@@ -54,7 +54,6 @@ newTestEnv :: TestEnv -> Logger (GargM Env BackendInternalError) -> Warp.Port ->
newTestEnv testEnv logger port = do newTestEnv testEnv logger port = do
tomlFile@(SettingsFile sf) <- fakeTomlPath tomlFile@(SettingsFile sf) <- fakeTomlPath
!manager_env <- newTlsManager !manager_env <- newTlsManager
let !settings' = devSettings
!config_env <- readConfig tomlFile <&> (gc_frontend_config . fc_appPort) .~ port !config_env <- readConfig tomlFile <&> (gc_frontend_config . fc_appPort) .~ port
prios <- withLogger () $ \ioLogger -> Jobs.readPrios ioLogger (sf <> ".jobs") prios <- withLogger () $ \ioLogger -> Jobs.readPrios ioLogger (sf <> ".jobs")
...@@ -77,8 +76,7 @@ newTestEnv testEnv logger port = do ...@@ -77,8 +76,7 @@ newTestEnv testEnv logger port = do
-- !dispatcher <- D.dispatcher -- !dispatcher <- D.dispatcher
pure $ Env pure $ Env
{ _env_settings = settings' { _env_logger = logger
, _env_logger = logger
, _env_pool = pool , _env_pool = pool
, _env_nodeStory = nodeStory_env , _env_nodeStory = nodeStory_env
, _env_manager = manager_env , _env_manager = manager_env
......
...@@ -76,14 +76,12 @@ setup = do ...@@ -76,14 +76,12 @@ setup = do
bootstrapDB db pool gargConfig bootstrapDB db pool gargConfig
ugen <- emptyCounter ugen <- emptyCounter
test_nodeStory <- fromDBNodeStoryEnv pool test_nodeStory <- fromDBNodeStoryEnv pool
let stgs = devSettings
withLoggerHoisted Mock $ \logger -> do withLoggerHoisted Mock $ \logger -> do
pure $ TestEnv { test_db = DBHandle pool db pure $ TestEnv { test_db = DBHandle pool db
, test_config = gargConfig , test_config = gargConfig
, test_nodeStory , test_nodeStory
, test_usernameGen = ugen , test_usernameGen = ugen
, test_logger = logger , test_logger = logger
, test_settings = stgs
} }
withTestDB :: (TestEnv -> IO ()) -> IO () withTestDB :: (TestEnv -> IO ()) -> IO ()
......
...@@ -28,7 +28,6 @@ import Database.Postgres.Temp qualified as Tmp ...@@ -28,7 +28,6 @@ import Database.Postgres.Temp qualified as Tmp
import Gargantext hiding (to) import Gargantext hiding (to)
import Gargantext.API.Admin.EnvTypes import Gargantext.API.Admin.EnvTypes
import Gargantext.API.Admin.Orchestrator.Types import Gargantext.API.Admin.Orchestrator.Types
import Gargantext.API.Admin.Types
import Gargantext.API.Errors.Types import Gargantext.API.Errors.Types
import Gargantext.API.Prelude import Gargantext.API.Prelude
import Gargantext.Core.Config (HasConfig(..)) import Gargantext.Core.Config (HasConfig(..))
...@@ -38,7 +37,7 @@ import Gargantext.Core.NodeStory ...@@ -38,7 +37,7 @@ import Gargantext.Core.NodeStory
import Gargantext.Database.Prelude (HasConnectionPool(..)) import Gargantext.Database.Prelude (HasConnectionPool(..))
import Gargantext.Database.Query.Table.Node.Error import Gargantext.Database.Query.Table.Node.Error
import Gargantext.Core.Config import Gargantext.Core.Config
import Gargantext.Core.Config.Mail (MailConfig(..), LoginType(NoAuth)) import Gargantext.Core.Config.Mail (MailConfig(..), LoginType(NoAuth), SendEmailType(LogEmailToConsole))
import Gargantext.System.Logging (HasLogger(..), Logger, MonadLogger(..)) import Gargantext.System.Logging (HasLogger(..), Logger, MonadLogger(..))
import Gargantext.Utils.Jobs import Gargantext.Utils.Jobs
import Network.URI (parseURI) import Network.URI (parseURI)
...@@ -63,7 +62,6 @@ data TestEnv = TestEnv { ...@@ -63,7 +62,6 @@ data TestEnv = TestEnv {
, test_nodeStory :: !NodeStoryEnv , test_nodeStory :: !NodeStoryEnv
, test_usernameGen :: !Counter , test_usernameGen :: !Counter
, test_logger :: !(Logger (GargM TestEnv BackendInternalError)) , test_logger :: !(Logger (GargM TestEnv BackendInternalError))
, test_settings :: !Settings
} }
newtype TestMonad a = TestMonad { runTestMonad :: ReaderT TestEnv IO a } newtype TestMonad a = TestMonad { runTestMonad :: ReaderT TestEnv IO a }
...@@ -107,16 +105,14 @@ instance HasConnectionPool TestEnv where ...@@ -107,16 +105,14 @@ instance HasConnectionPool TestEnv where
instance HasConfig TestEnv where instance HasConfig TestEnv where
hasConfig = to test_config hasConfig = to test_config
instance HasSettings TestEnv where
settings = to test_settings
instance HasMail TestEnv where instance HasMail TestEnv where
mailSettings = to $ const (MailConfig { _mc_mail_host = "localhost" mailSettings = to $ const (MailConfig { _mc_mail_host = "localhost"
, _mc_mail_port = 25 , _mc_mail_port = 25
, _mc_mail_user = "test" , _mc_mail_user = "test"
, _mc_mail_from = "test@localhost" , _mc_mail_from = "test@localhost"
, _mc_mail_password = "test" , _mc_mail_password = "test"
, _mc_mail_login_type = NoAuth }) , _mc_mail_login_type = NoAuth
, _mc_send_login_emails = LogEmailToConsole })
instance HasNodeStoryEnv TestEnv where instance HasNodeStoryEnv TestEnv where
hasNodeStory = to test_nodeStory hasNodeStory = to test_nodeStory
......
This diff is collapsed.
...@@ -17,7 +17,7 @@ import Gargantext.Core.Types.Phylo ...@@ -17,7 +17,7 @@ import Gargantext.Core.Types.Phylo
import Gargantext.Database.Admin.Types.Node import Gargantext.Database.Admin.Types.Node
import Paths_gargantext import Paths_gargantext
import Prelude import Prelude
import Test.Instances () import Test.Instances (genFrontendErr)
import Test.Tasty import Test.Tasty
import Test.Tasty.HUnit import Test.Tasty.HUnit
import Test.Tasty.QuickCheck import Test.Tasty.QuickCheck
......
...@@ -292,10 +292,10 @@ newTestEnv = do ...@@ -292,10 +292,10 @@ newTestEnv = do
, _gc_jobs = Prelude.error "gc_jobs not needed, but forced somewhere (check StrictData)" , _gc_jobs = Prelude.error "gc_jobs not needed, but forced somewhere (check StrictData)"
, _gc_secrets = Prelude.error "gc_secrets not needed, but forced somewhere (check StrictData)" , _gc_secrets = Prelude.error "gc_secrets not needed, but forced somewhere (check StrictData)"
, _gc_apis = Prelude.error "gc_apis not needed, but forced somewhere (check StrictData)" , _gc_apis = Prelude.error "gc_apis not needed, but forced somewhere (check StrictData)"
, _gc_log_level = Prelude.error "gc_log_level not needed, but forced somewhere (check StrictData)"
} }
pure $ Env pure $ Env
{ _env_settings = Prelude.error "env_settings not needed, but forced somewhere (check StrictData)" { _env_logger = Prelude.error "env_logger not needed, but forced somewhere (check StrictData)"
, _env_logger = Prelude.error "env_logger not needed, but forced somewhere (check StrictData)"
, _env_pool = Prelude.error "env_pool not needed, but forced somewhere (check StrictData)" , _env_pool = Prelude.error "env_pool not needed, but forced somewhere (check StrictData)"
, _env_nodeStory = Prelude.error "env_nodeStory not needed, but forced somewhere (check StrictData)" , _env_nodeStory = Prelude.error "env_nodeStory not needed, but forced somewhere (check StrictData)"
, _env_manager = testTlsManager , _env_manager = testTlsManager
...@@ -305,6 +305,7 @@ newTestEnv = do ...@@ -305,6 +305,7 @@ newTestEnv = do
, _env_config , _env_config
, _env_central_exchange = Prelude.error "central exchange not needed, but forced somewhere (check StrictData)" , _env_central_exchange = Prelude.error "central exchange not needed, but forced somewhere (check StrictData)"
, _env_dispatcher = Prelude.error "dispatcher not needed, but forced somewhere (check StrictData)" , _env_dispatcher = Prelude.error "dispatcher not needed, but forced somewhere (check StrictData)"
, _env_jwt_settings = Prelude.error "jwt_settings not needed, but forced somewherer (check StrictData)"
} }
testFetchJobStatus :: IO () testFetchJobStatus :: IO ()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment