From 42817af9582ab921ae4ffe4ea4ec6b1e5f150a63 Mon Sep 17 00:00:00 2001 From: Daniel Harvey Date: Wed, 17 May 2023 15:02:09 +0100 Subject: [PATCH] chore(server): split NamingCase type from functions PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9184 GitOrigin-RevId: caf36bdaa6c739855153b33a0f130b3f2dda6c0a --- server/graphql-engine.cabal | 1 + server/src-lib/Hasura/App/State.hs | 4 +- .../src-lib/Hasura/Backends/BigQuery/DDL.hs | 2 +- .../Backends/BigQuery/Instances/Schema.hs | 2 +- .../Backends/DataConnector/Adapter/Schema.hs | 2 +- server/src-lib/Hasura/Backends/MSSQL/DDL.hs | 2 +- .../Hasura/Backends/MSSQL/Instances/Schema.hs | 16 ++--- .../Hasura/Backends/Postgres/DDL/Function.hs | 2 +- .../Backends/Postgres/Execute/Insert.hs | 6 +- .../Backends/Postgres/Execute/Mutation.hs | 6 +- .../Backends/Postgres/Instances/Schema.hs | 2 +- .../Backends/Postgres/Translate/Column.hs | 1 + .../Backends/Postgres/Translate/Returning.hs | 2 +- .../Translate/Select/Internal/Process.hs | 2 +- .../Hasura/GraphQL/ApolloFederation.hs | 2 +- .../src-lib/Hasura/GraphQL/Schema/Backend.hs | 68 +++++++++---------- .../src-lib/Hasura/GraphQL/Schema/BoolExp.hs | 2 +- .../Schema/BoolExp/AggregationPredicates.hs | 2 +- .../src-lib/Hasura/GraphQL/Schema/Mutation.hs | 2 +- .../Hasura/GraphQL/Schema/NamingCase.hs | 34 +--------- .../src-lib/Hasura/GraphQL/Schema/OrderBy.hs | 2 +- .../src-lib/Hasura/GraphQL/Schema/Select.hs | 2 +- .../GraphQL/Schema/SubscriptionStream.hs | 2 +- .../Hasura/GraphQL/Schema/Update/Batch.hs | 2 +- .../GraphQL/Transport/WebSocket/Server.hs | 11 +-- server/src-lib/Hasura/RQL/DDL/Schema/Cache.hs | 2 +- .../Hasura/RQL/DDL/Schema/Cache/Config.hs | 10 +-- server/src-lib/Hasura/RQL/IR/Delete.hs | 2 +- server/src-lib/Hasura/RQL/IR/Insert.hs | 2 +- .../Hasura/RQL/IR/Select/AnnSelectG.hs | 2 +- server/src-lib/Hasura/RQL/IR/Update.hs | 2 +- .../Hasura/RQL/Types/Metadata/Backend.hs | 2 +- server/src-lib/Hasura/RQL/Types/NamingCase.hs | 36 ++++++++++ .../Hasura/RQL/Types/SourceCustomization.hs | 2 +- server/src-lib/Hasura/Server/API/Config.hs | 2 +- .../Hasura/Server/Init/Arg/Command/Serve.hs | 8 +-- server/src-lib/Hasura/Server/Init/Config.hs | 2 +- server/src-lib/Hasura/Server/Init/Env.hs | 12 ++-- server/src-lib/Hasura/Table/API.hs | 2 +- .../BoolExp/AggregationPredicatesSpec.hs | 2 +- server/src-test/Hasura/Server/Init/ArgSpec.hs | 2 +- server/src-test/Hasura/Server/InitSpec.hs | 2 +- server/src-test/Test/Parser/Expectation.hs | 2 +- server/src-test/Test/Parser/Monad.hs | 4 +- 44 files changed, 143 insertions(+), 134 deletions(-) create mode 100644 server/src-lib/Hasura/RQL/Types/NamingCase.hs diff --git a/server/graphql-engine.cabal b/server/graphql-engine.cabal index ca8f80398a9..0cea0c6dd04 100644 --- a/server/graphql-engine.cabal +++ b/server/graphql-engine.cabal @@ -810,6 +810,7 @@ library , Hasura.RQL.Types.Metadata.Instances , Hasura.RQL.Types.Metadata.Object , Hasura.RQL.Types.Metadata.Serialization + , Hasura.RQL.Types.NamingCase , Hasura.RQL.Types.OpenTelemetry , Hasura.RQL.Types.Permission , Hasura.RQL.Types.QueryCollection diff --git a/server/src-lib/Hasura/App/State.hs b/server/src-lib/Hasura/App/State.hs index bd8ffc62c2a..384e3edd7ab 100644 --- a/server/src-lib/Hasura/App/State.hs +++ b/server/src-lib/Hasura/App/State.hs @@ -34,13 +34,13 @@ import Hasura.Eventing.Common (LockedEventsCtx) import Hasura.Eventing.EventTrigger import Hasura.GraphQL.Execute.Subscription.Options import Hasura.GraphQL.Execute.Subscription.State qualified as ES -import Hasura.GraphQL.Schema.NamingCase import Hasura.Incremental qualified as Inc import Hasura.Logging qualified as L import Hasura.Prelude import Hasura.RQL.DDL.Schema.Cache.Config import Hasura.RQL.Types.Common import Hasura.RQL.Types.Metadata +import Hasura.RQL.Types.NamingCase import Hasura.RQL.Types.Roles (RoleName) import Hasura.RQL.Types.Schema.Options qualified as Options import Hasura.RQL.Types.SchemaCache (MetadataResourceVersion) @@ -187,7 +187,7 @@ data InvalidationKeys = InvalidationKeys -- subset of the environment, exposed by small, local typeclasses. For instance, -- at time of writing, this can be used to implement 'HasServerConfigCtx', as a -- first step towards breaking it down. -class Monad m => HasAppEnv m where +class (Monad m) => HasAppEnv m where askAppEnv :: m AppEnv instance (HasAppEnv m) => HasAppEnv (ReaderT r m) where diff --git a/server/src-lib/Hasura/Backends/BigQuery/DDL.hs b/server/src-lib/Hasura/Backends/BigQuery/DDL.hs index ed28d6e1fad..a2deb51368b 100644 --- a/server/src-lib/Hasura/Backends/BigQuery/DDL.hs +++ b/server/src-lib/Hasura/Backends/BigQuery/DDL.hs @@ -15,7 +15,6 @@ import Hasura.Backends.BigQuery.DDL.Source as M import Hasura.Backends.BigQuery.Types qualified as BigQuery import Hasura.Base.Error import Hasura.Function.Cache -import Hasura.GraphQL.Schema.NamingCase import Hasura.Prelude import Hasura.RQL.IR.BoolExp import Hasura.RQL.Types.Backend @@ -23,6 +22,7 @@ import Hasura.RQL.Types.BackendType import Hasura.RQL.Types.Column import Hasura.RQL.Types.Common import Hasura.RQL.Types.EventTrigger +import Hasura.RQL.Types.NamingCase import Hasura.RQL.Types.SchemaCache import Hasura.SQL.Types import Hasura.Server.Utils diff --git a/server/src-lib/Hasura/Backends/BigQuery/Instances/Schema.hs b/server/src-lib/Hasura/Backends/BigQuery/Instances/Schema.hs index 036449857df..f44d25f98bf 100644 --- a/server/src-lib/Hasura/Backends/BigQuery/Instances/Schema.hs +++ b/server/src-lib/Hasura/Backends/BigQuery/Instances/Schema.hs @@ -21,7 +21,6 @@ import Hasura.GraphQL.Schema.Backend import Hasura.GraphQL.Schema.BoolExp import Hasura.GraphQL.Schema.Build qualified as GSB import Hasura.GraphQL.Schema.Common -import Hasura.GraphQL.Schema.NamingCase import Hasura.GraphQL.Schema.Parser ( FieldParser, InputFieldsParser, @@ -45,6 +44,7 @@ import Hasura.RQL.Types.BackendType import Hasura.RQL.Types.Column import Hasura.RQL.Types.Common import Hasura.RQL.Types.ComputedField +import Hasura.RQL.Types.NamingCase import Hasura.RQL.Types.Schema.Options qualified as Options import Hasura.RQL.Types.Source import Hasura.RQL.Types.SourceCustomization diff --git a/server/src-lib/Hasura/Backends/DataConnector/Adapter/Schema.hs b/server/src-lib/Hasura/Backends/DataConnector/Adapter/Schema.hs index df8f1cd37ea..99e4febdab7 100644 --- a/server/src-lib/Hasura/Backends/DataConnector/Adapter/Schema.hs +++ b/server/src-lib/Hasura/Backends/DataConnector/Adapter/Schema.hs @@ -23,7 +23,6 @@ import Hasura.GraphQL.Schema.Backend (BackendSchema (..), BackendTableSelectSche import Hasura.GraphQL.Schema.BoolExp qualified as GS.BE import Hasura.GraphQL.Schema.Build qualified as GS.B import Hasura.GraphQL.Schema.Common qualified as GS.C -import Hasura.GraphQL.Schema.NamingCase import Hasura.GraphQL.Schema.Parser qualified as P import Hasura.GraphQL.Schema.Select qualified as GS.S import Hasura.GraphQL.Schema.Update qualified as GS.U @@ -40,6 +39,7 @@ import Hasura.RQL.IR.Value qualified as IR import Hasura.RQL.Types.Backend qualified as RQL import Hasura.RQL.Types.BackendType (BackendType (..)) import Hasura.RQL.Types.Column qualified as RQL +import Hasura.RQL.Types.NamingCase import Hasura.RQL.Types.Schema.Options qualified as Options import Hasura.RQL.Types.Source qualified as RQL import Hasura.RQL.Types.SourceCustomization qualified as RQL diff --git a/server/src-lib/Hasura/Backends/MSSQL/DDL.hs b/server/src-lib/Hasura/Backends/MSSQL/DDL.hs index e9d70ee5b6a..ebfd0ff77ec 100644 --- a/server/src-lib/Hasura/Backends/MSSQL/DDL.hs +++ b/server/src-lib/Hasura/Backends/MSSQL/DDL.hs @@ -23,7 +23,6 @@ import Hasura.Backends.MSSQL.DDL.Source as M import Hasura.Backends.MSSQL.Types.Internal qualified as MT import Hasura.Base.Error import Hasura.Function.Cache -import Hasura.GraphQL.Schema.NamingCase import Hasura.Prelude import Hasura.RQL.IR.BoolExp import Hasura.RQL.Types.Backend @@ -32,6 +31,7 @@ import Hasura.RQL.Types.Column import Hasura.RQL.Types.Common import Hasura.RQL.Types.ComputedField import Hasura.RQL.Types.EventTrigger +import Hasura.RQL.Types.NamingCase import Hasura.RQL.Types.SchemaCache import Hasura.SQL.Types import Hasura.Server.Utils diff --git a/server/src-lib/Hasura/Backends/MSSQL/Instances/Schema.hs b/server/src-lib/Hasura/Backends/MSSQL/Instances/Schema.hs index 37b417d3c5f..9eb9b8591bb 100644 --- a/server/src-lib/Hasura/Backends/MSSQL/Instances/Schema.hs +++ b/server/src-lib/Hasura/Backends/MSSQL/Instances/Schema.hs @@ -24,7 +24,6 @@ import Hasura.GraphQL.Schema.Backend import Hasura.GraphQL.Schema.BoolExp import Hasura.GraphQL.Schema.Build qualified as GSB import Hasura.GraphQL.Schema.Common -import Hasura.GraphQL.Schema.NamingCase import Hasura.GraphQL.Schema.Parser ( InputFieldsParser, Kind (..), @@ -42,6 +41,7 @@ import Hasura.RQL.IR.Select qualified as IR import Hasura.RQL.Types.Backend hiding (BackendInsert) import Hasura.RQL.Types.BackendType import Hasura.RQL.Types.Column +import Hasura.RQL.Types.NamingCase import Hasura.RQL.Types.Schema.Options qualified as Options import Hasura.RQL.Types.SchemaCache import Hasura.RQL.Types.Source @@ -120,7 +120,7 @@ instance BackendUpdateOperatorsSchema 'MSSQL where backendInsertParser :: forall m r n. - MonadBuildSchema 'MSSQL r m n => + (MonadBuildSchema 'MSSQL r m n) => TableInfo 'MSSQL -> SchemaT r m (InputFieldsParser n (BackendInsert (UnpreparedValue 'MSSQL))) backendInsertParser tableInfo = do @@ -136,7 +136,7 @@ backendInsertParser tableInfo = do msTableArgs :: forall r m n. - MonadBuildSchema 'MSSQL r m n => + (MonadBuildSchema 'MSSQL r m n) => TableInfo 'MSSQL -> SchemaT r m (InputFieldsParser n (IR.SelectArgsG 'MSSQL (UnpreparedValue 'MSSQL))) msTableArgs tableInfo = do @@ -162,7 +162,7 @@ msTableArgs tableInfo = do -- * Individual components msColumnParser :: - MonadBuildSchema 'MSSQL r m n => + (MonadBuildSchema 'MSSQL r m n) => ColumnType 'MSSQL -> G.Nullability -> SchemaT r m (Parser 'Both n (ValueWithOrigin (ColumnValue 'MSSQL))) @@ -234,7 +234,7 @@ msColumnParser columnType nullability = case columnType of else ODBC.TextValue txt -- an ODBC.TextValue becomes an NVARCHAR msEnumParser :: - MonadBuildSchema 'MSSQL r m n => + (MonadBuildSchema 'MSSQL r m n) => TableName 'MSSQL -> NonEmpty (EnumValue, EnumValueInfo) -> Maybe G.Name -> @@ -296,7 +296,7 @@ msOrderByOperators _tCase = msComparisonExps :: forall m n r. - MonadBuildSchema 'MSSQL r m n => + (MonadBuildSchema 'MSSQL r m n) => ColumnType 'MSSQL -> SchemaT r m (Parser 'Input n [ComparisonExp 'MSSQL]) msComparisonExps = P.memoize 'comparisonExps \columnType -> do @@ -385,7 +385,7 @@ msComparisonExps = P.memoize 'comparisonExps \columnType -> do UVLiteral . MSSQL.ListExpression . fmap (MSSQL.ValueExpression . cvValue) msCountTypeInput :: - MonadParse n => + (MonadParse n) => Maybe (Parser 'Both n (Column 'MSSQL)) -> InputFieldsParser n (IR.CountDistinct -> CountType 'MSSQL) msCountTypeInput = \case @@ -401,7 +401,7 @@ msCountTypeInput = \case msParseUpdateOperators :: forall m n r. - MonadBuildSchema 'MSSQL r m n => + (MonadBuildSchema 'MSSQL r m n) => TableInfo 'MSSQL -> UpdPermInfo 'MSSQL -> SchemaT r m (InputFieldsParser n (HashMap (Column 'MSSQL) (UpdateOperators 'MSSQL (UnpreparedValue 'MSSQL)))) diff --git a/server/src-lib/Hasura/Backends/Postgres/DDL/Function.hs b/server/src-lib/Hasura/Backends/Postgres/DDL/Function.hs index 006c39b7023..b182f641945 100644 --- a/server/src-lib/Hasura/Backends/Postgres/DDL/Function.hs +++ b/server/src-lib/Hasura/Backends/Postgres/DDL/Function.hs @@ -20,11 +20,11 @@ import Hasura.Backends.Postgres.Types.Function import Hasura.Base.Error import Hasura.Function.Cache import Hasura.Function.Common (getFunctionAggregateGQLName, getFunctionArgsGQLName, getFunctionGQLName) -import Hasura.GraphQL.Schema.NamingCase import Hasura.Prelude import Hasura.RQL.Types.Backend import Hasura.RQL.Types.BackendType import Hasura.RQL.Types.Common +import Hasura.RQL.Types.NamingCase import Hasura.RQL.Types.SchemaCache import Hasura.RQL.Types.SchemaCacheTypes import Hasura.RQL.Types.SourceCustomization (applyFieldNameCaseCust) diff --git a/server/src-lib/Hasura/Backends/Postgres/Execute/Insert.hs b/server/src-lib/Hasura/Backends/Postgres/Execute/Insert.hs index 0167f444df8..ac86c9076c1 100644 --- a/server/src-lib/Hasura/Backends/Postgres/Execute/Insert.hs +++ b/server/src-lib/Hasura/Backends/Postgres/Execute/Insert.hs @@ -28,7 +28,6 @@ import Hasura.Backends.Postgres.Translate.Select (PostgresAnnotatedFieldJSON) import Hasura.Backends.Postgres.Types.Insert import Hasura.Base.Error import Hasura.EncJSON -import Hasura.GraphQL.Schema.NamingCase (NamingCase) import Hasura.Prelude import Hasura.QueryTags import Hasura.RQL.IR.BoolExp @@ -38,6 +37,7 @@ import Hasura.RQL.Types.Backend import Hasura.RQL.Types.BackendType import Hasura.RQL.Types.Column import Hasura.RQL.Types.Common +import Hasura.RQL.Types.NamingCase (NamingCase) import Hasura.RQL.Types.Relationships.Local import Hasura.RQL.Types.Schema.Options qualified as Options import Hasura.Session @@ -327,7 +327,7 @@ validateInsert insCols objRels addCols = do insConflictCols = insCols `intersect` addCols mkInsertQ :: - Backend ('Postgres pgKind) => + (Backend ('Postgres pgKind)) => QualifiedTable -> Maybe (IR.OnConflictClause ('Postgres pgKind) Postgres.SQLExp) -> HashMap.HashMap PGCol Postgres.SQLExp -> @@ -352,7 +352,7 @@ mkInsertQ table onConflictM insertRow (insCheck, updCheck) = in Postgres.CTEInsert sqlInsert fetchFromColVals :: - MonadError QErr m => + (MonadError QErr m) => ColumnValues ('Postgres pgKind) TxtEncodedVal -> [ColumnInfo ('Postgres pgKind)] -> m [(PGCol, Postgres.SQLExp)] diff --git a/server/src-lib/Hasura/Backends/Postgres/Execute/Mutation.hs b/server/src-lib/Hasura/Backends/Postgres/Execute/Mutation.hs index 7a63f8dd119..36fc30af781 100644 --- a/server/src-lib/Hasura/Backends/Postgres/Execute/Mutation.hs +++ b/server/src-lib/Hasura/Backends/Postgres/Execute/Mutation.hs @@ -33,7 +33,6 @@ import Hasura.Backends.Postgres.Translate.Select.Internal.Helpers (customSQLToTo import Hasura.Backends.Postgres.Translate.Update import Hasura.Base.Error import Hasura.EncJSON -import Hasura.GraphQL.Schema.NamingCase (NamingCase) import Hasura.Prelude import Hasura.QueryTags import Hasura.RQL.IR.BoolExp @@ -46,6 +45,7 @@ import Hasura.RQL.Types.Backend import Hasura.RQL.Types.BackendType import Hasura.RQL.Types.Column import Hasura.RQL.Types.Common +import Hasura.RQL.Types.NamingCase (NamingCase) import Hasura.RQL.Types.Schema.Options qualified as Options import Hasura.Session @@ -235,7 +235,7 @@ executeMutationOutputQuery :: m EncJSON executeMutationOutputQuery qt allCols preCalAffRows cte mutOutput strfyNum tCase prepArgs = do queryTags <- ask - let queryTx :: PG.FromRes a => m a + let queryTx :: (PG.FromRes a) => m a queryTx = do let selectWith = mkMutationOutputExp qt allCols preCalAffRows cte mutOutput strfyNum tCase query = toQuery selectWith @@ -257,7 +257,7 @@ mutateAndFetchCols :: Maybe NamingCase -> PG.TxE QErr (MutateResp ('Postgres pgKind) TxtEncodedVal) mutateAndFetchCols qt cols (cte, p) strfyNum tCase = do - let mutationTx :: PG.FromRes a => PG.TxE QErr a + let mutationTx :: (PG.FromRes a) => PG.TxE QErr a mutationTx = -- See Note [Prepared statements in Mutations] PG.rawQE dmlTxErrorHandler sqlText (toList p) False diff --git a/server/src-lib/Hasura/Backends/Postgres/Instances/Schema.hs b/server/src-lib/Hasura/Backends/Postgres/Instances/Schema.hs index cb895d0d63e..a652fc3a801 100644 --- a/server/src-lib/Hasura/Backends/Postgres/Instances/Schema.hs +++ b/server/src-lib/Hasura/Backends/Postgres/Instances/Schema.hs @@ -48,7 +48,6 @@ import Hasura.GraphQL.Schema.BoolExp.AggregationPredicates as Agg import Hasura.GraphQL.Schema.Build qualified as GSB import Hasura.GraphQL.Schema.Common import Hasura.GraphQL.Schema.Mutation qualified as GSB -import Hasura.GraphQL.Schema.NamingCase import Hasura.GraphQL.Schema.Parser ( Definition, FieldParser, @@ -79,6 +78,7 @@ import Hasura.RQL.IR.Value qualified as IR import Hasura.RQL.Types.Backend (Backend (..)) import Hasura.RQL.Types.BackendType (BackendType (Postgres), PostgresKind (Citus, Cockroach, Vanilla)) import Hasura.RQL.Types.Column +import Hasura.RQL.Types.NamingCase import Hasura.RQL.Types.Schema.Options qualified as Options import Hasura.RQL.Types.Source import Hasura.RQL.Types.SourceCustomization diff --git a/server/src-lib/Hasura/Backends/Postgres/Translate/Column.hs b/server/src-lib/Hasura/Backends/Postgres/Translate/Column.hs index eca756f3ea9..5b67a9427a0 100644 --- a/server/src-lib/Hasura/Backends/Postgres/Translate/Column.hs +++ b/server/src-lib/Hasura/Backends/Postgres/Translate/Column.hs @@ -15,6 +15,7 @@ import Hasura.GraphQL.Schema.NamingCase import Hasura.Prelude import Hasura.RQL.Types.BackendType import Hasura.RQL.Types.Column +import Hasura.RQL.Types.NamingCase import Hasura.RQL.Types.Schema.Options qualified as Options toTxtValue :: ColumnValue ('Postgres pgKind) -> SQLExp diff --git a/server/src-lib/Hasura/Backends/Postgres/Translate/Returning.hs b/server/src-lib/Hasura/Backends/Postgres/Translate/Returning.hs index efd068f2cdd..2f8bdb535c2 100644 --- a/server/src-lib/Hasura/Backends/Postgres/Translate/Returning.hs +++ b/server/src-lib/Hasura/Backends/Postgres/Translate/Returning.hs @@ -21,7 +21,6 @@ import Hasura.Backends.Postgres.SQL.Types import Hasura.Backends.Postgres.Translate.Select import Hasura.Backends.Postgres.Translate.Select.Internal.Helpers (customSQLToTopLevelCTEs) import Hasura.Backends.Postgres.Translate.Types (CustomSQLCTEs) -import Hasura.GraphQL.Schema.NamingCase (NamingCase) import Hasura.Prelude import Hasura.RQL.IR.BoolExp import Hasura.RQL.IR.Returning @@ -30,6 +29,7 @@ import Hasura.RQL.Types.Backend import Hasura.RQL.Types.BackendType import Hasura.RQL.Types.Column import Hasura.RQL.Types.Common +import Hasura.RQL.Types.NamingCase (NamingCase) import Hasura.RQL.Types.Schema.Options qualified as Options import Hasura.Table.Cache diff --git a/server/src-lib/Hasura/Backends/Postgres/Translate/Select/Internal/Process.hs b/server/src-lib/Hasura/Backends/Postgres/Translate/Select/Internal/Process.hs index 728cc2d33ea..3340a44fb9d 100644 --- a/server/src-lib/Hasura/Backends/Postgres/Translate/Select/Internal/Process.hs +++ b/server/src-lib/Hasura/Backends/Postgres/Translate/Select/Internal/Process.hs @@ -78,7 +78,6 @@ import Hasura.Backends.Postgres.Translate.Select.Internal.JoinTree ) import Hasura.Backends.Postgres.Translate.Select.Internal.OrderBy (processOrderByItems) import Hasura.Backends.Postgres.Translate.Types -import Hasura.GraphQL.Schema.NamingCase (NamingCase) import Hasura.GraphQL.Schema.Node (currentNodeIdVersion, nodeIdVersionInt) import Hasura.NativeQuery.IR (NativeQuery (..)) import Hasura.Prelude @@ -89,6 +88,7 @@ import Hasura.RQL.Types.Backend import Hasura.RQL.Types.BackendType import Hasura.RQL.Types.Column import Hasura.RQL.Types.Common +import Hasura.RQL.Types.NamingCase (NamingCase) import Hasura.RQL.Types.Relationships.Local import Hasura.RQL.Types.Schema.Options qualified as Options diff --git a/server/src-lib/Hasura/GraphQL/ApolloFederation.hs b/server/src-lib/Hasura/GraphQL/ApolloFederation.hs index 1aa4e0bf2b9..ef16cf1c1f2 100644 --- a/server/src-lib/Hasura/GraphQL/ApolloFederation.hs +++ b/server/src-lib/Hasura/GraphQL/ApolloFederation.hs @@ -21,7 +21,6 @@ import Hasura.Base.Error import Hasura.Base.ErrorMessage (toErrorMessage) import Hasura.GraphQL.Parser qualified as P import Hasura.GraphQL.Schema.Common -import Hasura.GraphQL.Schema.NamingCase import Hasura.GraphQL.Schema.Parser import Hasura.Name qualified as Name import Hasura.Prelude @@ -31,6 +30,7 @@ import Hasura.RQL.IR.Select import Hasura.RQL.IR.Value (UnpreparedValue, ValueWithOrigin (ValueNoOrigin)) import Hasura.RQL.Types.Backend import Hasura.RQL.Types.Column +import Hasura.RQL.Types.NamingCase import Hasura.RQL.Types.Schema.Options (StringifyNumbers) import Hasura.RQL.Types.Source import Hasura.SQL.AnyBackend qualified as AB diff --git a/server/src-lib/Hasura/GraphQL/Schema/Backend.hs b/server/src-lib/Hasura/GraphQL/Schema/Backend.hs index e258e2587c9..64a65bd376a 100644 --- a/server/src-lib/Hasura/GraphQL/Schema/Backend.hs +++ b/server/src-lib/Hasura/GraphQL/Schema/Backend.hs @@ -44,7 +44,6 @@ import Data.Text.Casing (GQLNameIdentifier) import Hasura.Function.Cache import Hasura.GraphQL.ApolloFederation (ApolloFederationParserFunction) import Hasura.GraphQL.Schema.Common -import Hasura.GraphQL.Schema.NamingCase import Hasura.GraphQL.Schema.Parser hiding (Type) import Hasura.LogicalModel.Cache (LogicalModelInfo) import Hasura.NativeQuery.Cache (NativeQueryInfo) @@ -58,6 +57,7 @@ import Hasura.RQL.Types.Column hiding (EnumValueInfo) import Hasura.RQL.Types.Column qualified as Column import Hasura.RQL.Types.Common (RelName) import Hasura.RQL.Types.ComputedField +import Hasura.RQL.Types.NamingCase import Hasura.RQL.Types.Relationships.Local import Hasura.RQL.Types.SchemaCache import Hasura.RQL.Types.Source @@ -96,12 +96,12 @@ type MonadBuildSchema b r m n = -- -- See <#modelling Note BackendSchema modelling principles>. class - Backend b => + (Backend b) => BackendSchema (b :: BackendType) where -- top level parsers buildTableQueryAndSubscriptionFields :: - MonadBuildSchema b r m n => + (MonadBuildSchema b r m n) => MkRootFieldName -> TableName b -> TableInfo b -> @@ -114,14 +114,14 @@ class Maybe (G.Name, Parser 'Output n (ApolloFederationParserFunction n)) ) buildTableStreamingSubscriptionFields :: - MonadBuildSchema b r m n => + (MonadBuildSchema b r m n) => MkRootFieldName -> TableName b -> TableInfo b -> GQLNameIdentifier -> SchemaT r m [FieldParser n (QueryDB b (RemoteRelationshipField UnpreparedValue) (UnpreparedValue b))] buildTableRelayQueryFields :: - MonadBuildSchema b r m n => + (MonadBuildSchema b r m n) => MkRootFieldName -> TableName b -> TableInfo b -> @@ -129,7 +129,7 @@ class NESeq (ColumnInfo b) -> SchemaT r m [FieldParser n (QueryDB b (RemoteRelationshipField UnpreparedValue) (UnpreparedValue b))] buildTableInsertMutationFields :: - MonadBuildSchema b r m n => + (MonadBuildSchema b r m n) => MkRootFieldName -> Scenario -> TableName b -> @@ -144,7 +144,7 @@ class -- The suggested way to implement this is using building blocks in GSB, c.f. -- its namesake @GSB.@'Hasura.GraphQL.Schema.Build.buildTableUpdateMutationFields'. buildTableUpdateMutationFields :: - MonadBuildSchema b r m n => + (MonadBuildSchema b r m n) => Scenario -> -- | table info TableInfo b -> @@ -153,7 +153,7 @@ class SchemaT r m [FieldParser n (AnnotatedUpdateG b (RemoteRelationshipField UnpreparedValue) (UnpreparedValue b))] buildTableDeleteMutationFields :: - MonadBuildSchema b r m n => + (MonadBuildSchema b r m n) => MkRootFieldName -> Scenario -> TableName b -> @@ -162,7 +162,7 @@ class SchemaT r m [FieldParser n (AnnDelG b (RemoteRelationshipField UnpreparedValue) (UnpreparedValue b))] buildFunctionQueryFields :: - MonadBuildSchema b r m n => + (MonadBuildSchema b r m n) => MkRootFieldName -> FunctionName b -> FunctionInfo b -> @@ -170,7 +170,7 @@ class SchemaT r m [FieldParser n (QueryDB b (RemoteRelationshipField UnpreparedValue) (UnpreparedValue b))] buildFunctionRelayQueryFields :: - MonadBuildSchema b r m n => + (MonadBuildSchema b r m n) => MkRootFieldName -> FunctionName b -> FunctionInfo b -> @@ -179,7 +179,7 @@ class SchemaT r m [FieldParser n (QueryDB b (RemoteRelationshipField UnpreparedValue) (UnpreparedValue b))] buildFunctionMutationFields :: - MonadBuildSchema b r m n => + (MonadBuildSchema b r m n) => MkRootFieldName -> FunctionName b -> FunctionInfo b -> @@ -187,7 +187,7 @@ class SchemaT r m [FieldParser n (MutationDB b (RemoteRelationshipField UnpreparedValue) (UnpreparedValue b))] buildNativeQueryRootFields :: - MonadBuildSchema b r m n => + (MonadBuildSchema b r m n) => NativeQueryInfo b -> SchemaT r @@ -196,7 +196,7 @@ class buildNativeQueryRootFields _ = pure Nothing buildStoredProcedureRootFields :: - MonadBuildSchema b r m n => + (MonadBuildSchema b r m n) => StoredProcedureInfo b -> SchemaT r @@ -207,7 +207,7 @@ class -- | Make a parser for relationships. Default implementaton elides -- relationships altogether. mkRelationshipParser :: - MonadBuildSchema b r m n => + (MonadBuildSchema b r m n) => RelInfo b -> SchemaT r m (Maybe (InputFieldsParser n (Maybe (IR.AnnotatedInsertField b (UnpreparedValue b))))) mkRelationshipParser _ = pure Nothing @@ -219,19 +219,19 @@ class -- individual components columnParser :: - MonadBuildSchema b r m n => + (MonadBuildSchema b r m n) => ColumnType b -> G.Nullability -> -- TODO maybe use Hasura.GraphQL.Parser.Schema.Nullability instead? SchemaT r m (Parser 'Both n (ValueWithOrigin (ColumnValue b))) enumParser :: - MonadBuildSchema b r m n => + (MonadBuildSchema b r m n) => TableName b -> NonEmpty (EnumValue, Column.EnumValueInfo) -> Maybe G.Name -> G.Nullability -> SchemaT r m (Parser 'Both n (ScalarValue b)) possiblyNullable :: - MonadParse m => + (MonadParse m) => ScalarType b -> G.Nullability -> Parser 'Both m (ScalarValue b) -> @@ -239,7 +239,7 @@ class -- | Parser for arguments on scalar fields in a selection set scalarSelectionArgumentsParser :: - MonadParse n => + (MonadParse n) => ColumnType b -> InputFieldsParser n (Maybe (ScalarSelectionArguments b)) @@ -249,14 +249,14 @@ class (G.Name, NonEmpty (Definition EnumValueInfo, (BasicOrderType b, NullsOrderType b))) comparisonExps :: - MonadBuildSchema b r m n => + (MonadBuildSchema b r m n) => ColumnType b -> SchemaT r m (Parser 'Input n [ComparisonExp b]) -- | The input fields parser, for "count" aggregate field, yielding a function -- which generates @'CountType b' from optional "distinct" field value countTypeInput :: - MonadParse n => + (MonadParse n) => Maybe (Parser 'Both n (Column b)) -> InputFieldsParser n (CountDistinct -> CountType b) @@ -264,7 +264,7 @@ class -- | Computed field parser computedField :: - MonadBuildSchema b r m n => + (MonadBuildSchema b r m n) => ComputedFieldInfo b -> TableName b -> TableInfo b -> @@ -281,19 +281,19 @@ class -- -- Default implementations exist for all of these in -- 'Hasura.GraphQL.Schema.Select'. -class Backend b => BackendTableSelectSchema (b :: BackendType) where +class (Backend b) => BackendTableSelectSchema (b :: BackendType) where tableArguments :: - MonadBuildSourceSchema b r m n => + (MonadBuildSourceSchema b r m n) => TableInfo b -> SchemaT r m (InputFieldsParser n (IR.SelectArgsG b (UnpreparedValue b))) tableSelectionSet :: - MonadBuildSourceSchema b r m n => + (MonadBuildSourceSchema b r m n) => TableInfo b -> SchemaT r m (Maybe (Parser 'Output n (AnnotatedFields b))) selectTable :: - MonadBuildSourceSchema b r m n => + (MonadBuildSourceSchema b r m n) => -- | table info TableInfo b -> -- | field display name @@ -303,7 +303,7 @@ class Backend b => BackendTableSelectSchema (b :: BackendType) where SchemaT r m (Maybe (FieldParser n (SelectExp b))) selectTableAggregate :: - MonadBuildSourceSchema b r m n => + (MonadBuildSourceSchema b r m n) => -- | table info TableInfo b -> -- | field display name @@ -314,21 +314,21 @@ class Backend b => BackendTableSelectSchema (b :: BackendType) where type ComparisonExp b = OpExpG b (UnpreparedValue b) -class Backend b => BackendLogicalModelSelectSchema (b :: BackendType) where +class (Backend b) => BackendLogicalModelSelectSchema (b :: BackendType) where logicalModelArguments :: - MonadBuildSourceSchema b r m n => + (MonadBuildSourceSchema b r m n) => LogicalModelInfo b -> SchemaT r m (InputFieldsParser n (IR.SelectArgsG b (UnpreparedValue b))) logicalModelSelectionSet :: - MonadBuildSourceSchema b r m n => + (MonadBuildSourceSchema b r m n) => InsOrdHashMap RelName (RelInfo b) -> LogicalModelInfo b -> SchemaT r m (Maybe (Parser 'Output n (AnnotatedFields b))) -class BackendLogicalModelSelectSchema b => BackendNativeQuerySelectSchema (b :: BackendType) where +class (BackendLogicalModelSelectSchema b) => BackendNativeQuerySelectSchema (b :: BackendType) where selectNativeQuery :: - MonadBuildSourceSchema b r m n => + (MonadBuildSourceSchema b r m n) => NativeQueryInfo b -> G.Name -> Maybe G.Description -> @@ -336,7 +336,7 @@ class BackendLogicalModelSelectSchema b => BackendNativeQuerySelectSchema (b :: selectNativeQuery _ _ _ = pure Nothing selectNativeQueryObject :: - MonadBuildSchema b r m n => + (MonadBuildSchema b r m n) => NativeQueryInfo b -> G.Name -> Maybe G.Description -> @@ -346,7 +346,7 @@ class BackendLogicalModelSelectSchema b => BackendNativeQuerySelectSchema (b :: (Maybe (FieldParser n (AnnObjectSelectG b (RemoteRelationshipField UnpreparedValue) (UnpreparedValue b)))) selectNativeQueryObject _ _ _ = pure Nothing -class Backend b => BackendUpdateOperatorsSchema (b :: BackendType) where +class (Backend b) => BackendUpdateOperatorsSchema (b :: BackendType) where -- | Intermediate Representation of the set of update operators that act -- upon table fields during an update mutation. (For example, _set and _inc) -- @@ -356,7 +356,7 @@ class Backend b => BackendUpdateOperatorsSchema (b :: BackendType) where parseUpdateOperators :: forall m n r. - MonadBuildSchema b r m n => + (MonadBuildSchema b r m n) => TableInfo b -> UpdPermInfo b -> SchemaT r m (InputFieldsParser n (HashMap (Column b) (UpdateOperators b (UnpreparedValue b)))) diff --git a/server/src-lib/Hasura/GraphQL/Schema/BoolExp.hs b/server/src-lib/Hasura/GraphQL/Schema/BoolExp.hs index eab8eb4f2e4..343b879fa0d 100644 --- a/server/src-lib/Hasura/GraphQL/Schema/BoolExp.hs +++ b/server/src-lib/Hasura/GraphQL/Schema/BoolExp.hs @@ -20,7 +20,6 @@ import Hasura.Function.Cache import Hasura.GraphQL.Parser.Class import Hasura.GraphQL.Schema.Backend import Hasura.GraphQL.Schema.Common -import Hasura.GraphQL.Schema.NamingCase import Hasura.GraphQL.Schema.Parser ( InputFieldsParser, Kind (..), @@ -40,6 +39,7 @@ import Hasura.RQL.Types.Backend import Hasura.RQL.Types.BackendType (BackendType) import Hasura.RQL.Types.Column import Hasura.RQL.Types.ComputedField +import Hasura.RQL.Types.NamingCase import Hasura.RQL.Types.Relationships.Local import Hasura.RQL.Types.Schema.Options qualified as Options import Hasura.RQL.Types.SchemaCache hiding (askTableInfo) diff --git a/server/src-lib/Hasura/GraphQL/Schema/BoolExp/AggregationPredicates.hs b/server/src-lib/Hasura/GraphQL/Schema/BoolExp/AggregationPredicates.hs index 9b623e038c1..99bfa272677 100644 --- a/server/src-lib/Hasura/GraphQL/Schema/BoolExp/AggregationPredicates.hs +++ b/server/src-lib/Hasura/GraphQL/Schema/BoolExp/AggregationPredicates.hs @@ -20,7 +20,6 @@ import Hasura.GraphQL.Parser qualified as P import Hasura.GraphQL.Schema.Backend import Hasura.GraphQL.Schema.BoolExp import Hasura.GraphQL.Schema.Common -import Hasura.GraphQL.Schema.NamingCase import Hasura.GraphQL.Schema.Parser ( InputFieldsParser, Kind (..), @@ -36,6 +35,7 @@ import Hasura.RQL.Types.Backend qualified as B import Hasura.RQL.Types.BackendType (BackendType) import Hasura.RQL.Types.Column import Hasura.RQL.Types.Common (relNameToTxt) +import Hasura.RQL.Types.NamingCase import Hasura.RQL.Types.Relationships.Local import Hasura.RQL.Types.Schema.Options (IncludeAggregationPredicates (..)) import Hasura.RQL.Types.Schema.Options qualified as Options diff --git a/server/src-lib/Hasura/GraphQL/Schema/Mutation.hs b/server/src-lib/Hasura/GraphQL/Schema/Mutation.hs index 3dee3e28b60..c506fb12db1 100644 --- a/server/src-lib/Hasura/GraphQL/Schema/Mutation.hs +++ b/server/src-lib/Hasura/GraphQL/Schema/Mutation.hs @@ -20,7 +20,6 @@ import Data.Text.Extended import Hasura.GraphQL.Schema.Backend import Hasura.GraphQL.Schema.BoolExp import Hasura.GraphQL.Schema.Common -import Hasura.GraphQL.Schema.NamingCase (NamingCase) import Hasura.GraphQL.Schema.Parser ( FieldParser, InputFieldsParser, @@ -43,6 +42,7 @@ import Hasura.RQL.Types.Backend import Hasura.RQL.Types.Column import Hasura.RQL.Types.Common import Hasura.RQL.Types.Metadata.Object +import Hasura.RQL.Types.NamingCase (NamingCase) import Hasura.RQL.Types.Relationships.Local import Hasura.RQL.Types.SchemaCache hiding (askTableInfo) import Hasura.RQL.Types.Source diff --git a/server/src-lib/Hasura/GraphQL/Schema/NamingCase.hs b/server/src-lib/Hasura/GraphQL/Schema/NamingCase.hs index 4ad00a2d95b..763dae9cbe3 100644 --- a/server/src-lib/Hasura/GraphQL/Schema/NamingCase.hs +++ b/server/src-lib/Hasura/GraphQL/Schema/NamingCase.hs @@ -1,44 +1,14 @@ -{-# LANGUAGE OverloadedLists #-} - module Hasura.GraphQL.Schema.NamingCase - ( NamingCase (..), - isGraphqlCase, - parseNamingConventionFromText, + ( isGraphqlCase, hasNamingConventionChanged, ) where -import Autodocodec qualified as AC -import Data.Aeson qualified as J import Data.HashSet qualified as Set import Hasura.Prelude +import Hasura.RQL.Types.NamingCase import Hasura.Server.Types (ExperimentalFeature (..)) --- | Represents the different possible type cases for fields and types, i.e. --- @HasuraCase@ and @GraphqlCase@ (@CamelCase@ fields and @PascalCase@ types). -data NamingCase = HasuraCase | GraphqlCase - deriving (Eq, Show, Generic) - -instance AC.HasCodec NamingCase where - codec = - AC.named "NamingCase" $ - AC.stringConstCodec [(HasuraCase, "hasura-default"), (GraphqlCase, "graphql-default")] - -instance J.ToJSON NamingCase where - toJSON HasuraCase = J.String "hasura-default" - toJSON GraphqlCase = J.String "graphql-default" - -instance J.FromJSON NamingCase where - parseJSON = J.withText "NamingCase" $ \s -> case parseNamingConventionFromText s of - (Right nc) -> pure nc - (Left err) -> fail err - --- Used for both the environment variable and JSON. -parseNamingConventionFromText :: Text -> Either String NamingCase -parseNamingConventionFromText "hasura-default" = Right HasuraCase -parseNamingConventionFromText "graphql-default" = Right GraphqlCase -parseNamingConventionFromText _ = Left "naming_convention can either be \"hasura-default\" or \"graphql-default\"" - isGraphqlCase :: NamingCase -> Bool isGraphqlCase GraphqlCase = True isGraphqlCase _ = False diff --git a/server/src-lib/Hasura/GraphQL/Schema/OrderBy.hs b/server/src-lib/Hasura/GraphQL/Schema/OrderBy.hs index c2c44f6a173..9df8edb9b0d 100644 --- a/server/src-lib/Hasura/GraphQL/Schema/OrderBy.hs +++ b/server/src-lib/Hasura/GraphQL/Schema/OrderBy.hs @@ -16,7 +16,6 @@ import Hasura.Function.Cache import Hasura.GraphQL.Parser.Class import Hasura.GraphQL.Schema.Backend import Hasura.GraphQL.Schema.Common -import Hasura.GraphQL.Schema.NamingCase import Hasura.GraphQL.Schema.Parser ( InputFieldsParser, Kind (..), @@ -37,6 +36,7 @@ import Hasura.RQL.Types.Backend import Hasura.RQL.Types.Column import Hasura.RQL.Types.Common import Hasura.RQL.Types.ComputedField +import Hasura.RQL.Types.NamingCase import Hasura.RQL.Types.Relationships.Local import Hasura.RQL.Types.SchemaCache hiding (askTableInfo) import Hasura.RQL.Types.Source diff --git a/server/src-lib/Hasura/GraphQL/Schema/Select.hs b/server/src-lib/Hasura/GraphQL/Schema/Select.hs index 6b2532b8829..d4e3122f71d 100644 --- a/server/src-lib/Hasura/GraphQL/Schema/Select.hs +++ b/server/src-lib/Hasura/GraphQL/Schema/Select.hs @@ -52,7 +52,6 @@ import Hasura.GraphQL.Parser.Internal.Parser qualified as IP import Hasura.GraphQL.Schema.Backend import Hasura.GraphQL.Schema.BoolExp import Hasura.GraphQL.Schema.Common -import Hasura.GraphQL.Schema.NamingCase import Hasura.GraphQL.Schema.OrderBy import Hasura.GraphQL.Schema.Parser ( FieldParser, @@ -76,6 +75,7 @@ import Hasura.RQL.Types.Common import Hasura.RQL.Types.ComputedField import Hasura.RQL.Types.CustomTypes import Hasura.RQL.Types.Metadata.Object +import Hasura.RQL.Types.NamingCase import Hasura.RQL.Types.Permission qualified as Permission import Hasura.RQL.Types.Relationships.Local import Hasura.RQL.Types.Relationships.Remote diff --git a/server/src-lib/Hasura/GraphQL/Schema/SubscriptionStream.hs b/server/src-lib/Hasura/GraphQL/Schema/SubscriptionStream.hs index 174a14f6462..3a78170bdff 100644 --- a/server/src-lib/Hasura/GraphQL/Schema/SubscriptionStream.hs +++ b/server/src-lib/Hasura/GraphQL/Schema/SubscriptionStream.hs @@ -16,7 +16,6 @@ import Hasura.GraphQL.Parser.Class import Hasura.GraphQL.Schema.Backend import Hasura.GraphQL.Schema.BoolExp (AggregationPredicatesSchema) import Hasura.GraphQL.Schema.Common -import Hasura.GraphQL.Schema.NamingCase import Hasura.GraphQL.Schema.Parser ( InputFieldsParser, Kind (..), @@ -32,6 +31,7 @@ import Hasura.RQL.IR.Select qualified as IR import Hasura.RQL.IR.Value qualified as IR import Hasura.RQL.Types.Column import Hasura.RQL.Types.Metadata.Object +import Hasura.RQL.Types.NamingCase import Hasura.RQL.Types.Schema.Options qualified as Options import Hasura.RQL.Types.SchemaCache import Hasura.RQL.Types.Source diff --git a/server/src-lib/Hasura/GraphQL/Schema/Update/Batch.hs b/server/src-lib/Hasura/GraphQL/Schema/Update/Batch.hs index 219620283a8..3e5ea44d1fa 100644 --- a/server/src-lib/Hasura/GraphQL/Schema/Update/Batch.hs +++ b/server/src-lib/Hasura/GraphQL/Schema/Update/Batch.hs @@ -12,7 +12,6 @@ import Hasura.GraphQL.Schema.Backend (BackendTableSelectSchema (..), BackendUpda import Hasura.GraphQL.Schema.BoolExp (AggregationPredicatesSchema, tableBoolExp) import Hasura.GraphQL.Schema.Common import Hasura.GraphQL.Schema.Mutation (mutationSelectionSet, primaryKeysArguments) -import Hasura.GraphQL.Schema.NamingCase import Hasura.GraphQL.Schema.Parser qualified as P import Hasura.GraphQL.Schema.Table (tableColumns) import Hasura.GraphQL.Schema.Typename @@ -28,6 +27,7 @@ import Hasura.RQL.Types.Backend (Backend (..)) import Hasura.RQL.Types.Column (ColumnInfo (..)) import Hasura.RQL.Types.Common (Comment (..)) import Hasura.RQL.Types.Metadata.Object +import Hasura.RQL.Types.NamingCase import Hasura.RQL.Types.Schema.Options qualified as Options import Hasura.RQL.Types.Source import Hasura.RQL.Types.SourceCustomization diff --git a/server/src-lib/Hasura/GraphQL/Transport/WebSocket/Server.hs b/server/src-lib/Hasura/GraphQL/Transport/WebSocket/Server.hs index d9712033bd6..715e12713dc 100644 --- a/server/src-lib/Hasura/GraphQL/Transport/WebSocket/Server.hs +++ b/server/src-lib/Hasura/GraphQL/Transport/WebSocket/Server.hs @@ -59,12 +59,13 @@ import Data.Word (Word16) import GHC.AssertNF.CPP import GHC.Int (Int64) import Hasura.GraphQL.ParameterizedQueryHash (ParameterizedQueryHash) -import Hasura.GraphQL.Schema.NamingCase (NamingCase (..), hasNamingConventionChanged) +import Hasura.GraphQL.Schema.NamingCase (hasNamingConventionChanged) import Hasura.GraphQL.Transport.HTTP.Protocol import Hasura.GraphQL.Transport.WebSocket.Protocol import Hasura.Logging qualified as L import Hasura.Prelude import Hasura.RQL.Types.Common (MetricsConfig (..), SQLGenCtx (..)) +import Hasura.RQL.Types.NamingCase (NamingCase (..)) import Hasura.RQL.Types.SchemaCache import Hasura.Server.Auth (AuthMode, compareAuthMode) import Hasura.Server.Cors (CorsPolicy) @@ -157,15 +158,15 @@ $( J.deriveToJSON ''WSLog ) -class Monad m => MonadWSLog m where +class (Monad m) => MonadWSLog m where -- | Takes WS server log data and logs it -- logWSServer logWSLog :: L.Logger L.Hasura -> WSLog -> m () -instance MonadWSLog m => MonadWSLog (ExceptT e m) where +instance (MonadWSLog m) => MonadWSLog (ExceptT e m) where logWSLog l ws = lift $ logWSLog l ws -instance MonadWSLog m => MonadWSLog (ReaderT r m) where +instance (MonadWSLog m) => MonadWSLog (ReaderT r m) where logWSLog l ws = lift $ logWSLog l ws instance L.ToEngineLog WSLog L.Hasura where @@ -213,7 +214,7 @@ closeConn wsConn = closeConnWithCode wsConn 1000 -- 1000 is "normal close" -- | Closes a connection with code 1012, which means "Server is restarting" -- good clients will implement a retry logic with a backoff of a few seconds -forceConnReconnect :: MonadIO m => WSConn a -> BL.ByteString -> m () +forceConnReconnect :: (MonadIO m) => WSConn a -> BL.ByteString -> m () forceConnReconnect wsConn bs = liftIO $ closeConnWithCode wsConn 1012 bs closeConnWithCode :: WSConn a -> Word16 -> BL.ByteString -> IO () diff --git a/server/src-lib/Hasura/RQL/DDL/Schema/Cache.hs b/server/src-lib/Hasura/RQL/DDL/Schema/Cache.hs index 1467beee62c..27469b5f4b7 100644 --- a/server/src-lib/Hasura/RQL/DDL/Schema/Cache.hs +++ b/server/src-lib/Hasura/RQL/DDL/Schema/Cache.hs @@ -45,7 +45,6 @@ import Hasura.Function.API import Hasura.Function.Cache import Hasura.Function.Metadata (FunctionMetadata (..)) import Hasura.GraphQL.Schema (buildGQLContext) -import Hasura.GraphQL.Schema.NamingCase import Hasura.Incremental qualified as Inc import Hasura.Logging import Hasura.LogicalModel.Cache (LogicalModelCache, LogicalModelInfo (..)) @@ -81,6 +80,7 @@ import Hasura.RQL.Types.EventTrigger import Hasura.RQL.Types.Metadata import Hasura.RQL.Types.Metadata.Backend import Hasura.RQL.Types.Metadata.Object +import Hasura.RQL.Types.NamingCase import Hasura.RQL.Types.OpenTelemetry import Hasura.RQL.Types.QueryCollection import Hasura.RQL.Types.Relationships.Remote diff --git a/server/src-lib/Hasura/RQL/DDL/Schema/Cache/Config.hs b/server/src-lib/Hasura/RQL/DDL/Schema/Cache/Config.hs index 9b21ec76804..3ec6b7f9763 100644 --- a/server/src-lib/Hasura/RQL/DDL/Schema/Cache/Config.hs +++ b/server/src-lib/Hasura/RQL/DDL/Schema/Cache/Config.hs @@ -8,10 +8,10 @@ module Hasura.RQL.DDL.Schema.Cache.Config ) where -import Hasura.GraphQL.Schema.NamingCase (NamingCase) import Hasura.Prelude import Hasura.RQL.Types.Common (SQLGenCtx) import Hasura.RQL.Types.Metadata (MetadataDefaults) +import Hasura.RQL.Types.NamingCase (NamingCase) import Hasura.RQL.Types.Schema.Options qualified as Options import Hasura.Server.Types @@ -39,16 +39,16 @@ data CacheStaticConfig = CacheStaticConfig _cscAreStoredProceduresEnabled :: Bool } -class Monad m => HasCacheStaticConfig m where +class (Monad m) => HasCacheStaticConfig m where askCacheStaticConfig :: m CacheStaticConfig -instance HasCacheStaticConfig m => HasCacheStaticConfig (ReaderT r m) where +instance (HasCacheStaticConfig m) => HasCacheStaticConfig (ReaderT r m) where askCacheStaticConfig = lift askCacheStaticConfig -instance HasCacheStaticConfig m => HasCacheStaticConfig (ExceptT e m) where +instance (HasCacheStaticConfig m) => HasCacheStaticConfig (ExceptT e m) where askCacheStaticConfig = lift askCacheStaticConfig -instance HasCacheStaticConfig m => HasCacheStaticConfig (StateT s m) where +instance (HasCacheStaticConfig m) => HasCacheStaticConfig (StateT s m) where askCacheStaticConfig = lift askCacheStaticConfig -------------------------------------------------------------------------------- diff --git a/server/src-lib/Hasura/RQL/IR/Delete.hs b/server/src-lib/Hasura/RQL/IR/Delete.hs index 8e202eb3f7b..b77cd23183a 100644 --- a/server/src-lib/Hasura/RQL/IR/Delete.hs +++ b/server/src-lib/Hasura/RQL/IR/Delete.hs @@ -14,13 +14,13 @@ where import Control.Lens.TH (makeLenses) import Data.Kind (Type) -import Hasura.GraphQL.Schema.NamingCase (NamingCase) import Hasura.Prelude import Hasura.RQL.IR.BoolExp import Hasura.RQL.IR.Returning import Hasura.RQL.Types.Backend import Hasura.RQL.Types.BackendType import Hasura.RQL.Types.Column +import Hasura.RQL.Types.NamingCase (NamingCase) data AnnDelG (b :: BackendType) (r :: Type) v = AnnDel { _adTable :: TableName b, diff --git a/server/src-lib/Hasura/RQL/IR/Insert.hs b/server/src-lib/Hasura/RQL/IR/Insert.hs index be3fe59de02..95398ed25b4 100644 --- a/server/src-lib/Hasura/RQL/IR/Insert.hs +++ b/server/src-lib/Hasura/RQL/IR/Insert.hs @@ -43,7 +43,6 @@ where import Control.Lens ((^?)) import Control.Lens.TH (makeLenses, makePrisms) import Data.Kind (Type) -import Hasura.GraphQL.Schema.NamingCase (NamingCase) import Hasura.Prelude import Hasura.RQL.IR.BoolExp import Hasura.RQL.IR.Conflict @@ -51,6 +50,7 @@ import Hasura.RQL.IR.Returning import Hasura.RQL.Types.Backend import Hasura.RQL.Types.BackendType import Hasura.RQL.Types.Column +import Hasura.RQL.Types.NamingCase (NamingCase) import Hasura.RQL.Types.Relationships.Local -- | Overall representation of an insert mutation, corresponding to one root diff --git a/server/src-lib/Hasura/RQL/IR/Select/AnnSelectG.hs b/server/src-lib/Hasura/RQL/IR/Select/AnnSelectG.hs index 652379039bd..17f591a5bf0 100644 --- a/server/src-lib/Hasura/RQL/IR/Select/AnnSelectG.hs +++ b/server/src-lib/Hasura/RQL/IR/Select/AnnSelectG.hs @@ -12,7 +12,6 @@ where import Data.Bifoldable import Data.Kind (Type) -import Hasura.GraphQL.Schema.NamingCase (NamingCase) import Hasura.Prelude import Hasura.RQL.IR.Select.Args import Hasura.RQL.IR.Select.From @@ -20,6 +19,7 @@ import Hasura.RQL.IR.Select.TablePerm import Hasura.RQL.Types.Backend import Hasura.RQL.Types.BackendType import Hasura.RQL.Types.Common +import Hasura.RQL.Types.NamingCase (NamingCase) import Hasura.RQL.Types.Schema.Options (StringifyNumbers) -- Select diff --git a/server/src-lib/Hasura/RQL/IR/Update.hs b/server/src-lib/Hasura/RQL/IR/Update.hs index 2463e06c4fa..af4a6c2f183 100644 --- a/server/src-lib/Hasura/RQL/IR/Update.hs +++ b/server/src-lib/Hasura/RQL/IR/Update.hs @@ -16,13 +16,13 @@ where import Control.Lens.TH (makeLenses) import Data.Kind (Type) -import Hasura.GraphQL.Schema.NamingCase (NamingCase) import Hasura.Prelude import Hasura.RQL.IR.BoolExp import Hasura.RQL.IR.Returning import Hasura.RQL.Types.Backend import Hasura.RQL.Types.BackendType import Hasura.RQL.Types.Column +import Hasura.RQL.Types.NamingCase (NamingCase) -------------------------------------------------------------------------------- diff --git a/server/src-lib/Hasura/RQL/Types/Metadata/Backend.hs b/server/src-lib/Hasura/RQL/Types/Metadata/Backend.hs index 689ace7247a..fa5394341eb 100644 --- a/server/src-lib/Hasura/RQL/Types/Metadata/Backend.hs +++ b/server/src-lib/Hasura/RQL/Types/Metadata/Backend.hs @@ -10,7 +10,6 @@ import Data.Environment qualified as Env import Data.Has (Has) import Hasura.Base.Error import Hasura.Function.Cache -import Hasura.GraphQL.Schema.NamingCase import Hasura.Incremental qualified as Inc import Hasura.Logging (Hasura, Logger) import Hasura.LogicalModel.Metadata (LogicalModelMetadata) @@ -26,6 +25,7 @@ import Hasura.RQL.Types.ComputedField import Hasura.RQL.Types.EventTrigger import Hasura.RQL.Types.Metadata import Hasura.RQL.Types.Metadata.Object +import Hasura.RQL.Types.NamingCase (NamingCase) import Hasura.RQL.Types.Relationships.Local import Hasura.RQL.Types.SchemaCache import Hasura.RQL.Types.SchemaCache.Build diff --git a/server/src-lib/Hasura/RQL/Types/NamingCase.hs b/server/src-lib/Hasura/RQL/Types/NamingCase.hs new file mode 100644 index 00000000000..be5c276d022 --- /dev/null +++ b/server/src-lib/Hasura/RQL/Types/NamingCase.hs @@ -0,0 +1,36 @@ +{-# LANGUAGE OverloadedLists #-} + +module Hasura.RQL.Types.NamingCase + ( NamingCase (..), + parseNamingConventionFromText, + ) +where + +import Autodocodec qualified as AC +import Data.Aeson qualified as J +import Hasura.Prelude + +-- | Represents the different possible type cases for fields and types, i.e. +-- @HasuraCase@ and @GraphqlCase@ (@CamelCase@ fields and @PascalCase@ types). +data NamingCase = HasuraCase | GraphqlCase + deriving (Eq, Show, Generic) + +instance AC.HasCodec NamingCase where + codec = + AC.named "NamingCase" $ + AC.stringConstCodec [(HasuraCase, "hasura-default"), (GraphqlCase, "graphql-default")] + +instance J.ToJSON NamingCase where + toJSON HasuraCase = J.String "hasura-default" + toJSON GraphqlCase = J.String "graphql-default" + +instance J.FromJSON NamingCase where + parseJSON = J.withText "NamingCase" $ \s -> case parseNamingConventionFromText s of + (Right nc) -> pure nc + (Left err) -> fail err + +-- Used for both the environment variable and JSON. +parseNamingConventionFromText :: Text -> Either String NamingCase +parseNamingConventionFromText "hasura-default" = Right HasuraCase +parseNamingConventionFromText "graphql-default" = Right GraphqlCase +parseNamingConventionFromText _ = Left "naming_convention can either be \"hasura-default\" or \"graphql-default\"" diff --git a/server/src-lib/Hasura/RQL/Types/SourceCustomization.hs b/server/src-lib/Hasura/RQL/Types/SourceCustomization.hs index 8c2cfd065c1..0abcae6fe42 100644 --- a/server/src-lib/Hasura/RQL/Types/SourceCustomization.hs +++ b/server/src-lib/Hasura/RQL/Types/SourceCustomization.hs @@ -86,11 +86,11 @@ import Data.Text qualified as T import Data.Text.Casing (GQLNameIdentifier (..)) import Data.Text.Casing qualified as C import Hasura.Base.Error (Code (NotSupported), QErr, throw400) -import Hasura.GraphQL.Schema.NamingCase import Hasura.GraphQL.Schema.Typename import Hasura.Name qualified as Name import Hasura.Prelude import Hasura.RQL.Types.Backend (SupportedNamingCase (..)) +import Hasura.RQL.Types.NamingCase (NamingCase (..)) import Hasura.Table.Cache (CustomRootField (..), TableConfig (..), TableCoreInfoG (..), TableInfo (..)) import Language.GraphQL.Draft.Syntax qualified as G diff --git a/server/src-lib/Hasura/Server/API/Config.hs b/server/src-lib/Hasura/Server/API/Config.hs index 1ea3bf6361e..216d64ec445 100644 --- a/server/src-lib/Hasura/Server/API/Config.hs +++ b/server/src-lib/Hasura/Server/API/Config.hs @@ -12,8 +12,8 @@ where import Data.Aeson.TH import Data.HashSet qualified as Set import Hasura.GraphQL.Execute.Subscription.Options qualified as ES -import Hasura.GraphQL.Schema.NamingCase import Hasura.Prelude +import Hasura.RQL.Types.NamingCase import Hasura.RQL.Types.Schema.Options qualified as Options import Hasura.Server.Auth import Hasura.Server.Auth.JWT diff --git a/server/src-lib/Hasura/Server/Init/Arg/Command/Serve.hs b/server/src-lib/Hasura/Server/Init/Arg/Command/Serve.hs index 367fa6609a5..04160503ca0 100644 --- a/server/src-lib/Hasura/Server/Init/Arg/Command/Serve.hs +++ b/server/src-lib/Hasura/Server/Init/Arg/Command/Serve.hs @@ -75,10 +75,10 @@ import Database.PG.Query qualified as Query import Hasura.Backends.Postgres.Connection.MonadTx qualified as MonadTx import Hasura.Cache.Bounded qualified as Bounded import Hasura.GraphQL.Execute.Subscription.Options qualified as Subscription.Options -import Hasura.GraphQL.Schema.NamingCase qualified as NC import Hasura.Logging qualified as Logging import Hasura.Prelude import Hasura.RQL.Types.Metadata (MetadataDefaults, emptyMetadataDefaults) +import Hasura.RQL.Types.NamingCase qualified as NC import Hasura.RQL.Types.Roles (RoleName) import Hasura.RQL.Types.Roles qualified as Roles import Hasura.RQL.Types.Schema.Options qualified as Options @@ -98,7 +98,7 @@ import Witch qualified -------------------------------------------------------------------------------- -- Serve Command -serveCommandParser :: Logging.EnabledLogTypes impl => Opt.Parser (Config.ServeOptionsRaw impl) +serveCommandParser :: (Logging.EnabledLogTypes impl) => Opt.Parser (Config.ServeOptionsRaw impl) serveCommandParser = Config.ServeOptionsRaw <$> parseServerPort @@ -737,7 +737,7 @@ enableAllowlistOption = Config._helpMessage = "Only accept allowed GraphQL queries" } -parseEnabledLogs :: forall impl. Logging.EnabledLogTypes impl => Opt.Parser (Maybe (HashSet (Logging.EngineLogType impl))) +parseEnabledLogs :: forall impl. (Logging.EnabledLogTypes impl) => Opt.Parser (Maybe (HashSet (Logging.EngineLogType impl))) parseEnabledLogs = Opt.optional $ Opt.option @@ -746,7 +746,7 @@ parseEnabledLogs = <> Opt.help (Config._helpMessage (enabledLogsOption @impl)) ) -enabledLogsOption :: Logging.EnabledLogTypes impl => Config.Option (HashSet (Logging.EngineLogType impl)) +enabledLogsOption :: (Logging.EnabledLogTypes impl) => Config.Option (HashSet (Logging.EngineLogType impl)) enabledLogsOption = Config.Option { Config._default = Logging.defaultEnabledLogTypes, diff --git a/server/src-lib/Hasura/Server/Init/Config.hs b/server/src-lib/Hasura/Server/Init/Config.hs index 2f171529916..250dfd092ed 100644 --- a/server/src-lib/Hasura/Server/Init/Config.hs +++ b/server/src-lib/Hasura/Server/Init/Config.hs @@ -88,11 +88,11 @@ import Data.URL.Template qualified as Template import Database.PG.Query qualified as Query import Hasura.Backends.Postgres.Connection.MonadTx qualified as MonadTx import Hasura.GraphQL.Execute.Subscription.Options qualified as Subscription.Options -import Hasura.GraphQL.Schema.NamingCase (NamingCase) import Hasura.Logging qualified as Logging import Hasura.Prelude import Hasura.RQL.Types.Common qualified as Common import Hasura.RQL.Types.Metadata (MetadataDefaults) +import Hasura.RQL.Types.NamingCase (NamingCase) import Hasura.RQL.Types.Roles (RoleName, adminRoleName) import Hasura.RQL.Types.Schema.Options qualified as Schema.Options import Hasura.Server.Auth qualified as Auth diff --git a/server/src-lib/Hasura/Server/Init/Env.hs b/server/src-lib/Hasura/Server/Init/Env.hs index db6c8557b11..dd4e9c87fb8 100644 --- a/server/src-lib/Hasura/Server/Init/Env.hs +++ b/server/src-lib/Hasura/Server/Init/Env.hs @@ -34,11 +34,11 @@ import Hasura.Backends.Postgres.Connection.MonadTx (ExtensionsSchema) import Hasura.Backends.Postgres.Connection.MonadTx qualified as MonadTx import Hasura.Cache.Bounded qualified as Cache import Hasura.GraphQL.Execute.Subscription.Options qualified as Subscription.Options -import Hasura.GraphQL.Schema.NamingCase (NamingCase) -import Hasura.GraphQL.Schema.NamingCase qualified as NamingCase import Hasura.Logging qualified as Logging import Hasura.Prelude import Hasura.RQL.Types.Metadata (Metadata, MetadataDefaults (..)) +import Hasura.RQL.Types.NamingCase (NamingCase) +import Hasura.RQL.Types.NamingCase qualified as NamingCase import Hasura.RQL.Types.Roles (RoleName, mkRoleName) import Hasura.RQL.Types.Schema.Options qualified as Options import Hasura.Server.Auth qualified as Auth @@ -111,12 +111,12 @@ withOptionDefault parsed Config.Option {..} = -- -- A 'Monoid' instance would be super valuable to cleanup arg/env -- parsing but this solution feels somewhat unsatisfying. -withOptionSwitch :: Monad m => Bool -> Config.Option Bool -> WithEnvT m Bool +withOptionSwitch :: (Monad m) => Bool -> Config.Option Bool -> WithEnvT m Bool withOptionSwitch parsed option = withOptionSwitch' parsed (id, id) option -- | Given an 'Iso a Bool' we can apply the same boolean env merging -- semantics as we do for 'Bool' in `withOptionsSwitch' to @a@. -withOptionSwitch' :: Monad m => a -> (a -> Bool, Bool -> a) -> Config.Option a -> WithEnvT m a +withOptionSwitch' :: (Monad m) => a -> (a -> Bool, Bool -> a) -> Config.Option a -> WithEnvT m a withOptionSwitch' parsed (fwd, bwd) option = if fwd parsed then pure (bwd True) @@ -177,7 +177,7 @@ instance FromEnv Warp.HostPreference where instance FromEnv Text where fromEnv = Right . Text.pack -instance FromEnv a => FromEnv (Maybe a) where +instance (FromEnv a) => FromEnv (Maybe a) where fromEnv = fmap Just . fromEnv instance FromEnv Auth.AuthHookType where @@ -332,7 +332,7 @@ instance FromEnv Auth.JWTConfig where instance FromEnv [Auth.JWTConfig] where fromEnv = readJson -instance Logging.EnabledLogTypes impl => FromEnv (HashSet (Logging.EngineLogType impl)) where +instance (Logging.EnabledLogTypes impl) => FromEnv (HashSet (Logging.EngineLogType impl)) where fromEnv = fmap HashSet.fromList . Logging.parseEnabledLogTypes instance FromEnv Logging.LogLevel where diff --git a/server/src-lib/Hasura/Table/API.hs b/server/src-lib/Hasura/Table/API.hs index 52c4dce5df5..dabb9acba8a 100644 --- a/server/src-lib/Hasura/Table/API.hs +++ b/server/src-lib/Hasura/Table/API.hs @@ -48,7 +48,6 @@ import Hasura.GraphQL.Context import Hasura.GraphQL.Namespace import Hasura.GraphQL.Parser.Name qualified as GName import Hasura.GraphQL.Schema.Common (textToGQLIdentifier) -import Hasura.GraphQL.Schema.NamingCase import Hasura.Incremental qualified as Inc import Hasura.Prelude import Hasura.RQL.DDL.Schema.Cache.Common @@ -62,6 +61,7 @@ import Hasura.RQL.Types.Common import Hasura.RQL.Types.Metadata import Hasura.RQL.Types.Metadata.Backend import Hasura.RQL.Types.Metadata.Object +import Hasura.RQL.Types.NamingCase import Hasura.RQL.Types.SchemaCache import Hasura.RQL.Types.SchemaCache.Build import Hasura.RQL.Types.SchemaCacheTypes diff --git a/server/src-test/Hasura/GraphQL/Schema/BoolExp/AggregationPredicatesSpec.hs b/server/src-test/Hasura/GraphQL/Schema/BoolExp/AggregationPredicatesSpec.hs index 64950b836c6..aef1d966c50 100644 --- a/server/src-test/Hasura/GraphQL/Schema/BoolExp/AggregationPredicatesSpec.hs +++ b/server/src-test/Hasura/GraphQL/Schema/BoolExp/AggregationPredicatesSpec.hs @@ -21,7 +21,6 @@ import Hasura.GraphQL.Schema.BoolExp.AggregationPredicates defaultAggregationPredicatesParser, ) import Hasura.GraphQL.Schema.Introspection (queryInputFieldsParserIntrospection) -import Hasura.GraphQL.Schema.NamingCase (NamingCase (..)) import Hasura.Prelude import Hasura.RQL.IR.BoolExp (GBoolExp (..), OpExpG (AEQ)) import Hasura.RQL.IR.BoolExp.AggregationPredicates @@ -29,6 +28,7 @@ import Hasura.RQL.IR.Value (Provenance (Unknown), UnpreparedValue (UVParameter)) import Hasura.RQL.Types.BackendType (BackendSourceKind (PostgresVanillaKind), BackendType (Postgres), PostgresKind (Vanilla)) import Hasura.RQL.Types.Column (ColumnType (ColumnScalar), ColumnValue (..)) import Hasura.RQL.Types.Common (InsertOrder (..), RelName (..), RelType (..), SourceName (..)) +import Hasura.RQL.Types.NamingCase (NamingCase (..)) import Hasura.RQL.Types.Relationships.Local (RelInfo (..), RelTarget (..)) import Hasura.RQL.Types.Schema.Options qualified as Options import Hasura.RQL.Types.Source (DBObjectsIntrospection (..), SourceInfo (..)) diff --git a/server/src-test/Hasura/Server/Init/ArgSpec.hs b/server/src-test/Hasura/Server/Init/ArgSpec.hs index afcf60e4a5a..ffce1d98bfa 100644 --- a/server/src-test/Hasura/Server/Init/ArgSpec.hs +++ b/server/src-test/Hasura/Server/Init/ArgSpec.hs @@ -15,10 +15,10 @@ import Data.Time (NominalDiffTime) import Data.URL.Template qualified as Template import Database.PG.Query qualified as PG import Hasura.GraphQL.Execute.Subscription.Options qualified as ES -import Hasura.GraphQL.Schema.NamingCase qualified as NC import Hasura.Logging qualified as Logging import Hasura.Prelude import Hasura.RQL.Types.Metadata (Metadata, MetadataDefaults (..), overrideMetadataDefaults, _metaBackendConfigs) +import Hasura.RQL.Types.NamingCase qualified as NC import Hasura.RQL.Types.Roles qualified as Roles import Hasura.RQL.Types.Schema.Options qualified as Options import Hasura.SQL.BackendMap qualified as BackendMap diff --git a/server/src-test/Hasura/Server/InitSpec.hs b/server/src-test/Hasura/Server/InitSpec.hs index 050c981c9a8..1ff9f3f5ffb 100644 --- a/server/src-test/Hasura/Server/InitSpec.hs +++ b/server/src-test/Hasura/Server/InitSpec.hs @@ -11,10 +11,10 @@ import Data.HashSet qualified as Set import Data.Time (NominalDiffTime) import Database.PG.Query qualified as Query import Hasura.GraphQL.Execute.Subscription.Options qualified as Subscription.Options -import Hasura.GraphQL.Schema.NamingCase qualified as NamingCase import Hasura.Logging (Hasura) import Hasura.Logging qualified as Logging import Hasura.Prelude +import Hasura.RQL.Types.NamingCase qualified as NamingCase import Hasura.RQL.Types.Roles qualified as Roles import Hasura.RQL.Types.Schema.Options qualified as Options import Hasura.SQL.Types qualified as MonadTx diff --git a/server/src-test/Test/Parser/Expectation.hs b/server/src-test/Test/Parser/Expectation.hs index f0c704a8a6f..da99cdda386 100644 --- a/server/src-test/Test/Parser/Expectation.hs +++ b/server/src-test/Test/Parser/Expectation.hs @@ -21,7 +21,6 @@ import Hasura.Backends.Postgres.Types.Update (PgUpdateVariant (..), UpdateOpExpr import Hasura.GraphQL.Parser.Internal.Parser (FieldParser (..)) import Hasura.GraphQL.Parser.Schema (Definition (..)) import Hasura.GraphQL.Parser.Variable (Variable (..)) -import Hasura.GraphQL.Schema.NamingCase import Hasura.Prelude import Hasura.RQL.IR.BoolExp (AnnBoolExpFld (..), GBoolExp (..), OpExpG (..)) import Hasura.RQL.IR.Returning (MutationOutputG (..)) @@ -32,6 +31,7 @@ import Hasura.RQL.IR.Value (UnpreparedValue) import Hasura.RQL.Types.BackendType (BackendSourceKind (PostgresVanillaKind), BackendType (Postgres), PostgresKind (Vanilla)) import Hasura.RQL.Types.Column (ColumnInfo (..)) import Hasura.RQL.Types.Common (SourceName (..)) +import Hasura.RQL.Types.NamingCase import Hasura.RQL.Types.Source (DBObjectsIntrospection (..), SourceInfo (..)) import Hasura.RQL.Types.SourceCustomization (ResolvedSourceCustomization (..)) import Hasura.Table.Cache (TableInfo (..)) diff --git a/server/src-test/Test/Parser/Monad.hs b/server/src-test/Test/Parser/Monad.hs index bdd15092322..37301c88aa6 100644 --- a/server/src-test/Test/Parser/Monad.hs +++ b/server/src-test/Test/Parser/Monad.hs @@ -21,10 +21,10 @@ import Hasura.Base.ErrorMessage import Hasura.GraphQL.Parser.Class import Hasura.GraphQL.Parser.ErrorCode import Hasura.GraphQL.Schema.Common -import Hasura.GraphQL.Schema.NamingCase import Hasura.GraphQL.Schema.Typename import Hasura.Prelude import Hasura.RQL.Types.BackendType +import Hasura.RQL.Types.NamingCase import Hasura.RQL.Types.Roles (adminRoleName) import Hasura.RQL.Types.Schema.Options (SchemaOptions (..)) import Hasura.RQL.Types.Schema.Options qualified as Options @@ -35,7 +35,7 @@ import Language.Haskell.TH.Syntax qualified as TH import Test.HUnit.Lang (assertFailure) -- | Placeholder value for test inputs that are not relevant yet. -notImplementedYet :: HasCallStack => String -> a +notImplementedYet :: (HasCallStack) => String -> a notImplementedYet thing = withFrozenCallStack $ error $