mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-09-20 15:09:02 +03:00
Yeet some default-extensions
Manually enables: * EmptyCase * ExistentialQuantification * QuantifiedConstraints * QuasiQuotes * TemplateHaskell * TypeFamilyDependencies ...in the following components: * 'graphql-engine' library * 'graphql-engine' 'src-test' * 'graphql-engine' 'tests/integration' * 'graphql-engine' tests-hspec' Additionally, performs some light refactoring and documentation. PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3991 GitOrigin-RevId: 514477d3466b01f60eca8935d0fef60dd0756838
This commit is contained in:
parent
c9e80cbfaf
commit
647231b685
@ -67,8 +67,6 @@ common common-all
|
||||
DeriveLift
|
||||
DeriveTraversable
|
||||
DerivingVia
|
||||
EmptyCase
|
||||
ExistentialQuantification
|
||||
FlexibleContexts
|
||||
FlexibleInstances
|
||||
FunctionalDependencies
|
||||
@ -82,19 +80,15 @@ common common-all
|
||||
NamedFieldPuns
|
||||
NoImplicitPrelude
|
||||
OverloadedStrings
|
||||
QuantifiedConstraints
|
||||
QuasiQuotes
|
||||
RankNTypes
|
||||
RecordWildCards
|
||||
RoleAnnotations
|
||||
ScopedTypeVariables
|
||||
StandaloneDeriving
|
||||
StrictData
|
||||
TemplateHaskell
|
||||
TupleSections
|
||||
TypeApplications
|
||||
TypeFamilies
|
||||
TypeFamilyDependencies
|
||||
TypeOperators
|
||||
|
||||
common common-exe
|
||||
|
@ -1,4 +1,7 @@
|
||||
module Main (main) where
|
||||
module Main
|
||||
( main,
|
||||
)
|
||||
where
|
||||
|
||||
import Control.Concurrent.Extended qualified as C
|
||||
import Control.Exception
|
||||
|
@ -1,3 +1,4 @@
|
||||
{-# LANGUAGE QuantifiedConstraints #-}
|
||||
{-# LANGUAGE UndecidableInstances #-}
|
||||
|
||||
module Control.Monad.Stateless
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Data.Text.NonEmpty
|
||||
( NonEmptyText,
|
||||
mkNonEmptyTextUnsafe,
|
||||
|
@ -1,3 +1,4 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
-- | A convenience wrapper around "GHC.Stats", which makes RTS stats available
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE QuasiQuotes #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE UndecidableInstances #-}
|
||||
|
||||
module Hasura.App
|
||||
|
@ -1,4 +1,5 @@
|
||||
{-# LANGUAGE NumericUnderscores #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Hasura.Backends.BigQuery.Connection
|
||||
( BigQueryProblem,
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
-- |
|
||||
-- Working example:
|
||||
--
|
||||
|
@ -1,4 +1,5 @@
|
||||
{-# LANGUAGE ApplicativeDo #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
module Hasura.Backends.BigQuery.Instances.Schema () where
|
||||
|
@ -1,4 +1,5 @@
|
||||
{-# LANGUAGE DeriveAnyClass #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE NoGeneralisedNewtypeDeriving #-}
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
-- | MSSQL Connection
|
||||
|
@ -1,4 +1,10 @@
|
||||
module Hasura.Backends.MSSQL.DDL.EventTrigger (createTableEventTrigger) where
|
||||
{-# LANGUAGE QuasiQuotes #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Hasura.Backends.MSSQL.DDL.EventTrigger
|
||||
( createTableEventTrigger,
|
||||
)
|
||||
where
|
||||
|
||||
import Data.FileEmbed (makeRelativeToProject)
|
||||
import Data.Text qualified as T
|
||||
|
@ -1,3 +1,4 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE ViewPatterns #-}
|
||||
|
||||
-- | MSSQL DDL RunSQL
|
||||
|
@ -1,3 +1,6 @@
|
||||
{-# LANGUAGE QuasiQuotes #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
-- | MSSQL Source
|
||||
--
|
||||
-- Implements the Source related methods of the
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE QuasiQuotes #-}
|
||||
|
||||
module Hasura.Backends.MSSQL.DDL.Source.Version
|
||||
( latestSourceCatalogVersion,
|
||||
setSourceCatalogVersion,
|
||||
|
@ -1,4 +1,5 @@
|
||||
{-# LANGUAGE ApplicativeDo #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
-- | MSSQL Instances Schema
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
-- | Metadata related types, functions and helpers.
|
||||
--
|
||||
-- Provides a single function which loads the MSSQL database metadata.
|
||||
|
@ -1,4 +1,5 @@
|
||||
{-# LANGUAGE ApplicativeDo #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
-- | MSSQL Schema IfMatched
|
||||
--
|
||||
|
@ -1,3 +1,4 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
-- | MSSQL Types Instances
|
||||
|
@ -1,4 +1,5 @@
|
||||
{-# LANGUAGE ApplicativeDo #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
module Hasura.Backends.MySQL.Instances.Schema () where
|
||||
|
@ -1,4 +1,9 @@
|
||||
module Hasura.Backends.MySQL.Meta (getMetadata) where
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Hasura.Backends.MySQL.Meta
|
||||
( getMetadata,
|
||||
)
|
||||
where
|
||||
|
||||
import Control.Exception (throw)
|
||||
import Data.ByteString.Char8 qualified as B8
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Hasura.Backends.MySQL.SQL
|
||||
( runSQL,
|
||||
RunSQL (..),
|
||||
|
@ -1,4 +1,5 @@
|
||||
{-# LANGUAGE DeriveAnyClass #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
-- | Instances that're slow to compile.
|
||||
|
@ -1,3 +1,4 @@
|
||||
{-# LANGUAGE QuasiQuotes #-}
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
-- | Postgres Connection MonadTx
|
||||
|
@ -1,3 +1,4 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
-- | Postgres Connection Settings
|
||||
@ -189,15 +190,24 @@ $(deriveFromJSON (aesonDrop 3 (fmap toLower)) ''PGClientCerts)
|
||||
$(deriveToJSON (aesonDrop 3 (fmap toLower)) ''PGClientCerts)
|
||||
|
||||
instance Bifunctor PGClientCerts where
|
||||
bimap f g pgCerts = g <$> pgCerts {pgcSslPassword = f <$> (pgcSslPassword pgCerts)}
|
||||
bimap f g oldCerts@(PGClientCerts {pgcSslPassword}) =
|
||||
let certs = oldCerts {pgcSslPassword = f <$> pgcSslPassword}
|
||||
in g <$> certs
|
||||
|
||||
instance Bifoldable PGClientCerts where
|
||||
bifoldMap f g PGClientCerts {..} =
|
||||
fold $ fmap g [pgcSslCert, pgcSslKey, pgcSslRootCert] <> maybe [] (pure . f) pgcSslPassword
|
||||
let gs = foldMap g [pgcSslCert, pgcSslKey, pgcSslRootCert]
|
||||
fs = foldMap f pgcSslPassword
|
||||
in gs <> fs
|
||||
|
||||
instance Bitraversable PGClientCerts where
|
||||
bitraverse f g PGClientCerts {..} =
|
||||
PGClientCerts <$> g pgcSslCert <*> g pgcSslKey <*> g pgcSslRootCert <*> pure pgcSslMode <*> traverse f pgcSslPassword
|
||||
PGClientCerts
|
||||
<$> g pgcSslCert
|
||||
<*> g pgcSslKey
|
||||
<*> g pgcSslRootCert
|
||||
<*> pure pgcSslMode
|
||||
<*> traverse f pgcSslPassword
|
||||
|
||||
instance (Cacheable p, Cacheable a) => Cacheable (PGClientCerts p a)
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
{-# LANGUAGE QuasiQuotes #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
-- | Postgres DDL EventTrigger
|
||||
--
|
||||
-- Used for creating event triggers for metadata changes.
|
||||
|
@ -1,3 +1,6 @@
|
||||
{-# LANGUAGE QuasiQuotes #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
-- | Postgres DDL RunSQL
|
||||
--
|
||||
-- Escape hatch for running raw SQL against a postgres database.
|
||||
|
@ -1,3 +1,6 @@
|
||||
{-# LANGUAGE QuasiQuotes #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
-- | Postgres DDL Source
|
||||
--
|
||||
-- A Source is a connected database. One can have multiple sources of the same
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE QuasiQuotes #-}
|
||||
|
||||
-- | Postgres DDL Source Version
|
||||
--
|
||||
-- Deals with catalog version - used by 'Hasura.Backends.Postgres.DDL.Source'.
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
-- | Postgres Execute LiveQuery
|
||||
--
|
||||
-- Multiplex is an optimization which allows us to group similar queries into a
|
||||
|
@ -1,4 +1,5 @@
|
||||
{-# LANGUAGE ApplicativeDo #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE UndecidableInstances #-}
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE UndecidableInstances #-}
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
-- | Postgres SQL Error
|
||||
--
|
||||
-- Functions and datatypes for interpreting Postgres errors.
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
-- | Postgres SQL Types
|
||||
--
|
||||
-- Combinators and helpers for dealing with Postgres types such as strings, numerals,
|
||||
|
@ -1,4 +1,5 @@
|
||||
{-# LANGUAGE ApplicativeDo #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
-- | Postgres Schema OnConflict
|
||||
--
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
-- | Postgres Types CitusExtraTableMetadata
|
||||
--
|
||||
-- Additional metadata information for Citus tables.
|
||||
|
@ -1,4 +1,5 @@
|
||||
{-# LANGUAGE CPP #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
|
||||
-- | This module defines all missing instances of third party libraries.
|
||||
|
@ -1,4 +1,5 @@
|
||||
{-# LANGUAGE PatternSynonyms #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
-- |
|
||||
-- = Event Triggers
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
-- |
|
||||
-- = Hasura.Eventing.HTTP
|
||||
--
|
||||
|
@ -1,4 +1,5 @@
|
||||
{-# LANGUAGE PatternSynonyms #-}
|
||||
{-# LANGUAGE QuasiQuotes #-}
|
||||
|
||||
-- |
|
||||
-- = Scheduled Triggers
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Hasura.Eventing.ScheduledTrigger.Types
|
||||
( CronTriggerStats (CronTriggerStats, ctsMaxScheduledTime, ctsName),
|
||||
RetryContext (RetryContext, _rctxConf),
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Hasura.GraphQL.Analyse
|
||||
( Analysis (..),
|
||||
FieldAnalysis (..),
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Hasura.GraphQL.Context
|
||||
( RoleContext (..),
|
||||
GQLContext (..),
|
||||
|
@ -1,3 +1,6 @@
|
||||
{-# LANGUAGE QuasiQuotes #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Hasura.GraphQL.Execute.Action
|
||||
( fetchActionLogResponses,
|
||||
runActionExecution,
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Hasura.GraphQL.Execute.Action.Types
|
||||
( ActionContext (..),
|
||||
ActionExecution (..),
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
-- | This module implements /fragment inlining/, which converts all fragment
|
||||
-- spreads in a GraphQL query to inline fragments. For example, given a query like
|
||||
--
|
||||
|
@ -1,3 +1,4 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE UndecidableInstances #-}
|
||||
|
||||
-- |
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
-- | Multiplexed live query poller threads; see "Hasura.GraphQL.Execute.LiveQuery" for details.
|
||||
module Hasura.GraphQL.Execute.LiveQuery.Poll
|
||||
( -- * Pollers
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
-- | Top-level management of live query poller threads. The implementation of the polling itself is
|
||||
-- in "Hasura.GraphQL.Execute.LiveQuery.Poll". See "Hasura.GraphQL.Execute.LiveQuery" for high-level
|
||||
-- details.
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Hasura.GraphQL.Execute.RemoteJoin.Collect
|
||||
( getRemoteJoinsQueryDB,
|
||||
getRemoteJoinsMutationDB,
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Hasura.GraphQL.Explain
|
||||
( explainGQLQuery,
|
||||
GQLExplain,
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
-- | Definition of all supported GraphQL directives.
|
||||
module Hasura.GraphQL.Parser.Directives
|
||||
( -- list of directives, for the schema
|
||||
|
@ -1,3 +1,4 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# OPTIONS_HADDOCK not-home #-}
|
||||
|
||||
-- | Defines the 'Parser' type and its primitive combinators.
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
-- | This module defines all backend-agnostic scalars we use throughout the
|
||||
-- schema. This includes GraphQL scalars, and several other custom ones.
|
||||
module Hasura.GraphQL.Parser.Internal.Scalars
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Hasura.GraphQL.RemoteServer
|
||||
( fetchRemoteSchema,
|
||||
getSchemaIntrospection,
|
||||
|
@ -1,3 +1,4 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE ViewPatterns #-}
|
||||
|
||||
module Hasura.GraphQL.Schema
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Hasura.GraphQL.Schema.Action
|
||||
( actionExecute,
|
||||
actionAsyncMutation,
|
||||
|
@ -1,4 +1,5 @@
|
||||
{-# LANGUAGE ApplicativeDo #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Hasura.GraphQL.Schema.BoolExp
|
||||
( boolExp,
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
-- | This module provides building blocks for the GraphQL Schema that the
|
||||
-- GraphQL Engine presents.
|
||||
--
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Hasura.GraphQL.Schema.Common
|
||||
( MonadBuildSchemaBase,
|
||||
AggSelectExp,
|
||||
|
@ -1,4 +1,5 @@
|
||||
{-# LANGUAGE ApplicativeDo #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Hasura.GraphQL.Schema.Introspect
|
||||
( buildIntrospectionSchema,
|
||||
|
@ -1,4 +1,5 @@
|
||||
{-# LANGUAGE ApplicativeDo #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Hasura.GraphQL.Schema.Mutation
|
||||
( insertIntoTable,
|
||||
|
@ -1,4 +1,5 @@
|
||||
{-# LANGUAGE ApplicativeDo #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Hasura.GraphQL.Schema.OrderBy
|
||||
( orderByExp,
|
||||
|
@ -1,4 +1,5 @@
|
||||
{-# LANGUAGE RecursiveDo #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE ViewPatterns #-}
|
||||
|
||||
module Hasura.GraphQL.Schema.Remote
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Hasura.GraphQL.Schema.RemoteRelationship
|
||||
( remoteRelationshipField,
|
||||
)
|
||||
|
@ -1,4 +1,5 @@
|
||||
{-# LANGUAGE ApplicativeDo #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE ViewPatterns #-}
|
||||
|
||||
-- | Generate table selection schema both for ordinary Hasura-type and
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
-- | Helper functions for generating the schema of database tables
|
||||
module Hasura.GraphQL.Schema.Table
|
||||
( getTableGQLName,
|
||||
|
@ -1,4 +1,5 @@
|
||||
{-# LANGUAGE ApplicativeDo #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
-- | This module provides common building blocks for composing Schema Parsers
|
||||
-- used in the schema of Update Mutations.
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Hasura.GraphQL.Transport.HTTP.Protocol
|
||||
( GQLReq (..),
|
||||
GQLBatchedReqs (..),
|
||||
|
@ -1,4 +1,5 @@
|
||||
{-# LANGUAGE CPP #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
-- | This file contains the handlers that are used within websocket server.
|
||||
--
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
-- | This file contains types for both the websocket protocols (Apollo) and (graphql-ws)
|
||||
-- | See Apollo: https://github.com/apollographql/subscriptions-transport-ws/blob/master/PROTOCOL.md
|
||||
-- | See graphql-ws: https://github.com/enisdenjo/graphql-ws/blob/master/PROTOCOL.md
|
||||
|
@ -1,4 +1,5 @@
|
||||
{-# LANGUAGE NondecreasingIndentation #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Hasura.GraphQL.Transport.WebSocket.Server
|
||||
( AcceptWith (AcceptWith),
|
||||
@ -208,13 +209,6 @@ createWSServer logger = do
|
||||
serverStatus <- STM.newTVar (AcceptingConns connMap)
|
||||
return $ WSServer logger serverStatus
|
||||
|
||||
-- -- UNUSED
|
||||
-- closeAll :: WSServer a -> BL.ByteString -> IO ()
|
||||
-- closeAll (WSServer (L.Logger writeLog) serverStatus) msg = do
|
||||
-- writeLog $ L.debugT "closing all connections"
|
||||
-- conns <- STM.atomically $ flushConnMap serverStatus
|
||||
-- closeAllWith (flip closeConn) msg conns
|
||||
|
||||
closeAllWith ::
|
||||
(BL.ByteString -> WSConn a -> IO ()) ->
|
||||
BL.ByteString ->
|
||||
|
@ -1,3 +1,4 @@
|
||||
{-# LANGUAGE EmptyCase #-}
|
||||
{-# OPTIONS_HADDOCK not-home #-}
|
||||
|
||||
-- | Supporting functionality for fine-grained dependency tracking.
|
||||
|
@ -1,3 +1,4 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE UndecidableInstances #-}
|
||||
|
||||
module Hasura.Logging
|
||||
@ -191,7 +192,9 @@ deriving instance Show (EngineLogType impl) => Show (EngineLog impl)
|
||||
|
||||
deriving instance Eq (EngineLogType impl) => Eq (EngineLog impl)
|
||||
|
||||
-- empty splice to bring all the above definitions in scope
|
||||
-- Empty splice to bring all the above definitions in scope.
|
||||
--
|
||||
-- TODO: Restructure the code so that we can avoid this.
|
||||
$(pure [])
|
||||
|
||||
instance J.ToJSON (EngineLogType impl) => J.ToJSON (EngineLog impl) where
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Hasura.RQL.DDL.Action
|
||||
( CreateAction (..),
|
||||
runCreateAction,
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Hasura.RQL.DDL.EventTrigger
|
||||
( CreateEventTriggerQuery,
|
||||
runCreateEventTriggerQuery,
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
-- | Types related to metadata management API
|
||||
module Hasura.RQL.DDL.Metadata.Types
|
||||
( currentMetadataVersion,
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE TypeFamilyDependencies #-}
|
||||
|
||||
module Hasura.RQL.DDL.Permission
|
||||
( CreatePerm,
|
||||
runCreatePerm,
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Hasura.RQL.DDL.QueryTags
|
||||
( SetQueryTagsConfig,
|
||||
runSetQueryTagsConfig,
|
||||
|
@ -1,3 +1,4 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE UndecidableInstances #-}
|
||||
|
||||
module Hasura.RQL.DDL.RemoteRelationship
|
||||
|
@ -1,3 +1,4 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE ViewPatterns #-}
|
||||
|
||||
-- | Validate input queries against remote schemas.
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
-- |
|
||||
-- = Remote Schema Permissions Validation
|
||||
--
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
-- | This module (along with the various @Hasura.RQL.DDL.Schema.*@ modules) provides operations to
|
||||
-- load and modify the Hasura catalog and schema cache.
|
||||
--
|
||||
@ -26,7 +28,7 @@ module Hasura.RQL.DDL.Schema
|
||||
where
|
||||
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Data.Aeson.TH (deriveJSON)
|
||||
import Data.Text.Encoding qualified as TE
|
||||
import Database.PG.Query qualified as Q
|
||||
import Database.PostgreSQL.LibPQ qualified as PQ
|
||||
|
@ -1,4 +1,5 @@
|
||||
{-# LANGUAGE Arrows #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE UndecidableInstances #-}
|
||||
|
||||
-- | Types/functions shared between modules that implement "Hasura.RQL.DDL.Schema.Cache". Other
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE QuasiQuotes #-}
|
||||
|
||||
-- | Functions for fetching and updating @'Metadata' in the catalog.
|
||||
module Hasura.RQL.DDL.Schema.Catalog
|
||||
( fetchMetadataFromCatalog,
|
||||
|
@ -1,3 +1,6 @@
|
||||
{-# LANGUAGE QuasiQuotes #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
-- | Funtions related to @hdb_catalog@ schema prior to metadata separation (catalog version < 43).
|
||||
module Hasura.RQL.DDL.Schema.LegacyCatalog
|
||||
( saveMetadataToHdbTables,
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Hasura.RQL.DDL.Schema.Source
|
||||
( AddSource,
|
||||
DropSource,
|
||||
|
@ -1,4 +1,5 @@
|
||||
{-# LANGUAGE Arrows #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
-- | Description: Create/delete SQL tables to/from Hasura metadata.
|
||||
module Hasura.RQL.DDL.Schema.Table
|
||||
|
@ -203,6 +203,10 @@ instance ToJSON RequestTransformFn where
|
||||
-- TODO(SOLOMON): Add lens law unit tests
|
||||
|
||||
-- | A lens for mapping from an actual 'HTTP.Request' term to our HKD.
|
||||
--
|
||||
-- XXX: This function makes internal usage of 'TE.decodeUtf8', which throws an
|
||||
-- impure exception when the supplied 'ByteString' cannot be decoded into valid
|
||||
-- UTF8 text!
|
||||
request :: Lens' HTTP.Request RequestData
|
||||
request = lens getter setter
|
||||
where
|
||||
@ -346,6 +350,10 @@ buildRespTransformCtx reqCtx sessionVars engine respBody =
|
||||
_ -> Left $ Kriti.CustomFunctionError "Session variable name should be a string"
|
||||
|
||||
-- | Construct a Template Transformation function for Responses
|
||||
--
|
||||
-- XXX: This function makes internal usage of 'TE.decodeUtf8', which throws an
|
||||
-- impure exception when the supplied 'ByteString' cannot be decoded into valid
|
||||
-- UTF8 text!
|
||||
mkRespTemplateTransform :: TemplatingEngine -> BodyTransformAction -> ResponseTransformCtx -> Either TransformErrorBundle J.Value
|
||||
mkRespTemplateTransform _ RemoveBody _ = pure J.Null
|
||||
mkRespTemplateTransform engine (ModifyBody (Template template)) ResponseTransformCtx {..} =
|
||||
|
@ -49,7 +49,6 @@ import Data.ByteString.Builder.Scientific (scientificBuilder)
|
||||
import Data.ByteString.Lazy qualified as LBS
|
||||
import Data.HashMap.Strict qualified as M
|
||||
import Data.Kind (Constraint, Type)
|
||||
import Data.Text qualified as T
|
||||
import Data.Text.Encoding (encodeUtf8)
|
||||
import Data.Text.Encoding qualified as TE
|
||||
import Data.Validation (Validation, fromEither)
|
||||
@ -129,7 +128,7 @@ data RequestTransformCtx = RequestTransformCtx
|
||||
rtcSessionVariables :: J.Value,
|
||||
rtcQueryParams :: Maybe J.Value,
|
||||
rtcEngine :: TemplatingEngine,
|
||||
rtcFunctions :: M.HashMap T.Text (J.Value -> Either Kriti.CustomFunctionError J.Value)
|
||||
rtcFunctions :: M.HashMap Text (J.Value -> Either Kriti.CustomFunctionError J.Value)
|
||||
}
|
||||
|
||||
instance ToJSON RequestTransformCtx where
|
||||
@ -145,16 +144,36 @@ instance ToJSON RequestTransformCtx where
|
||||
in J.object (required <> catMaybes optional)
|
||||
|
||||
-- | A smart constructor for constructing the 'RequestTransformCtx'
|
||||
mkReqTransformCtx :: T.Text -> Maybe SessionVariables -> TemplatingEngine -> HTTP.Request -> RequestTransformCtx
|
||||
mkReqTransformCtx url sessionVars engine reqData =
|
||||
--
|
||||
-- XXX: This function makes internal usage of 'TE.decodeUtf8', which throws an
|
||||
-- impure exception when the supplied 'ByteString' cannot be decoded into valid
|
||||
-- UTF8 text!
|
||||
mkReqTransformCtx ::
|
||||
Text ->
|
||||
Maybe SessionVariables ->
|
||||
TemplatingEngine ->
|
||||
HTTP.Request ->
|
||||
RequestTransformCtx
|
||||
{ rtcBaseUrl = Just $ J.toJSON url,
|
||||
rtcBody = fromMaybe J.Null $ J.decode @J.Value =<< view HTTP.body reqData,
|
||||
rtcSessionVariables = J.toJSON sessionVars,
|
||||
rtcQueryParams = Just $ J.toJSON $ bimap TE.decodeUtf8 (fmap TE.decodeUtf8) <$> view HTTP.queryParams reqData,
|
||||
rtcEngine = engine,
|
||||
mkReqTransformCtx url sessionVars rtcEngine reqData =
|
||||
let rtcBaseUrl = Just $ J.toJSON url
|
||||
rtcBody =
|
||||
let mBody = view HTTP.body reqData >>= J.decode @J.Value
|
||||
in fromMaybe J.Null mBody
|
||||
rtcSessionVariables = J.toJSON sessionVars
|
||||
rtcQueryParams =
|
||||
let queryParams =
|
||||
view HTTP.queryParams reqData & fmap \(key, val) ->
|
||||
(TE.decodeUtf8 key, fmap TE.decodeUtf8 val)
|
||||
in Just $ J.toJSON queryParams
|
||||
rtcFunctions = M.singleton "getSessionVariable" getSessionVar
|
||||
}
|
||||
in RequestTransformCtx
|
||||
{ rtcBaseUrl,
|
||||
rtcBody,
|
||||
rtcSessionVariables,
|
||||
rtcQueryParams,
|
||||
rtcEngine,
|
||||
rtcFunctions
|
||||
}
|
||||
where
|
||||
getSessionVar :: J.Value -> Either Kriti.CustomFunctionError J.Value
|
||||
getSessionVar inp = case inp of
|
||||
@ -170,7 +189,7 @@ mkReqTransformCtx url sessionVars engine reqData =
|
||||
data ResponseTransformCtx = ResponseTransformCtx
|
||||
{ responseTransformBody :: J.Value,
|
||||
responseTransformReqCtx :: J.Value,
|
||||
responseTransformFunctions :: M.HashMap T.Text (J.Value -> Either Kriti.CustomFunctionError J.Value),
|
||||
responseTransformFunctions :: M.HashMap Text (J.Value -> Either Kriti.CustomFunctionError J.Value),
|
||||
responseTransformEngine :: TemplatingEngine
|
||||
}
|
||||
|
||||
|
@ -60,8 +60,6 @@ instance Transform Headers where
|
||||
transform (HeadersTransform transformation) context (Headers originalHeaders) =
|
||||
case transformation of
|
||||
ReplaceHeaders ReplaceHeaderFields {rhf_addHeaders, rhf_removeHeaders} -> do
|
||||
-- NOTE: 'TE.decodeUtf8' can fail with an impure exception; conversion
|
||||
-- to bytes is infallible.
|
||||
let removeHeadersBytes = fmap (CI.map TE.encodeUtf8) rhf_removeHeaders
|
||||
filteredHeaders =
|
||||
originalHeaders & filter \(key, _val) ->
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Hasura.RQL.DML.Types
|
||||
( OrderByExp (..),
|
||||
DMLQuery (..),
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Hasura.RQL.IR.Action
|
||||
( ActionFieldG (..),
|
||||
ActionFieldsG,
|
||||
|
@ -1,3 +1,4 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE UndecidableInstances #-}
|
||||
|
||||
module Hasura.RQL.IR.BoolExp
|
||||
|
@ -1,3 +1,4 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE UndecidableInstances #-}
|
||||
|
||||
module Hasura.RQL.IR.Delete
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
-- | Internal representation of an insertion in a database table.
|
||||
--
|
||||
-- What makes this specific mutation tricky is that we support recursive
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
-- | Representation for queries going to remote schemas. Due to the existence of
|
||||
-- remote relationships from remote schemas, we can't simply reuse the GraphQL
|
||||
-- document AST we define in graphql-parser-hs, and instead redefine a custom
|
||||
|
@ -1,3 +1,4 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE UndecidableInstances #-}
|
||||
|
||||
module Hasura.RQL.IR.Returning
|
||||
|
@ -1,4 +1,5 @@
|
||||
{-# LANGUAGE DeriveAnyClass #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE UndecidableInstances #-}
|
||||
|
||||
-- | This modules defines the tree of Select types: how we represent a query internally, from its top
|
||||
|
@ -1,3 +1,5 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Hasura.RQL.IR.Update
|
||||
( AnnotatedUpdate,
|
||||
AnnotatedUpdateG (..),
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user