module Hasura.Backends.DataConnector.IR.Function ( Name (..), ) where import Data.Aeson (FromJSON, ToJSON, ToJSONKey (..)) import Data.Aeson.Types (toJSONKeyText) import Data.List.NonEmpty qualified as NonEmpty import Data.Text qualified as Text import Data.Text.Extended (ToTxt (..)) import Hasura.Base.ErrorValue qualified as ErrorValue import Hasura.Base.ToErrorValue import Hasura.Incremental (Cacheable) import Hasura.Prelude newtype Name = Name {Name -> NonEmpty Text unName :: NonEmpty Text} deriving stock (Typeable Name DataType Constr Typeable Name -> (forall (c :: * -> *). (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Name -> c Name) -> (forall (c :: * -> *). (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Name) -> (Name -> Constr) -> (Name -> DataType) -> (forall (t :: * -> *) (c :: * -> *). Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Name)) -> (forall (t :: * -> * -> *) (c :: * -> *). Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Name)) -> ((forall b. Data b => b -> b) -> Name -> Name) -> (forall r r'. (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Name -> r) -> (forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Name -> r) -> (forall u. (forall d. Data d => d -> u) -> Name -> [u]) -> (forall u. Int -> (forall d. Data d => d -> u) -> Name -> u) -> (forall (m :: * -> *). Monad m => (forall d. Data d => d -> m d) -> Name -> m Name) -> (forall (m :: * -> *). MonadPlus m => (forall d. Data d => d -> m d) -> Name -> m Name) -> (forall (m :: * -> *). MonadPlus m => (forall d. Data d => d -> m d) -> Name -> m Name) -> Data Name Name -> DataType Name -> Constr (forall b. Data b => b -> b) -> Name -> Name (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Name -> c Name (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Name forall a. Typeable a -> (forall (c :: * -> *). (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> a -> c a) -> (forall (c :: * -> *). (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c a) -> (a -> Constr) -> (a -> DataType) -> (forall (t :: * -> *) (c :: * -> *). Typeable t => (forall d. Data d => c (t d)) -> Maybe (c a)) -> (forall (t :: * -> * -> *) (c :: * -> *). Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a)) -> ((forall b. Data b => b -> b) -> a -> a) -> (forall r r'. (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r) -> (forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r) -> (forall u. (forall d. Data d => d -> u) -> a -> [u]) -> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u) -> (forall (m :: * -> *). Monad m => (forall d. Data d => d -> m d) -> a -> m a) -> (forall (m :: * -> *). MonadPlus m => (forall d. Data d => d -> m d) -> a -> m a) -> (forall (m :: * -> *). MonadPlus m => (forall d. Data d => d -> m d) -> a -> m a) -> Data a forall u. Int -> (forall d. Data d => d -> u) -> Name -> u forall u. (forall d. Data d => d -> u) -> Name -> [u] forall r r'. (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Name -> r forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Name -> r forall (m :: * -> *). Monad m => (forall d. Data d => d -> m d) -> Name -> m Name forall (m :: * -> *). MonadPlus m => (forall d. Data d => d -> m d) -> Name -> m Name forall (c :: * -> *). (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Name forall (c :: * -> *). (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Name -> c Name forall (t :: * -> *) (c :: * -> *). Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Name) forall (t :: * -> * -> *) (c :: * -> *). Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Name) $cName :: Constr $tName :: DataType gmapMo :: (forall d. Data d => d -> m d) -> Name -> m Name $cgmapMo :: forall (m :: * -> *). MonadPlus m => (forall d. Data d => d -> m d) -> Name -> m Name gmapMp :: (forall d. Data d => d -> m d) -> Name -> m Name $cgmapMp :: forall (m :: * -> *). MonadPlus m => (forall d. Data d => d -> m d) -> Name -> m Name gmapM :: (forall d. Data d => d -> m d) -> Name -> m Name $cgmapM :: forall (m :: * -> *). Monad m => (forall d. Data d => d -> m d) -> Name -> m Name gmapQi :: Int -> (forall d. Data d => d -> u) -> Name -> u $cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Name -> u gmapQ :: (forall d. Data d => d -> u) -> Name -> [u] $cgmapQ :: forall u. (forall d. Data d => d -> u) -> Name -> [u] gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Name -> r $cgmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Name -> r gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Name -> r $cgmapQl :: forall r r'. (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Name -> r gmapT :: (forall b. Data b => b -> b) -> Name -> Name $cgmapT :: (forall b. Data b => b -> b) -> Name -> Name dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Name) $cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *). Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Name) dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Name) $cdataCast1 :: forall (t :: * -> *) (c :: * -> *). Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Name) dataTypeOf :: Name -> DataType $cdataTypeOf :: Name -> DataType toConstr :: Name -> Constr $ctoConstr :: Name -> Constr gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Name $cgunfold :: forall (c :: * -> *). (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Name gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Name -> c Name $cgfoldl :: forall (c :: * -> *). (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Name -> c Name $cp1Data :: Typeable Name Data, Name -> Name -> Bool (Name -> Name -> Bool) -> (Name -> Name -> Bool) -> Eq Name forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a /= :: Name -> Name -> Bool $c/= :: Name -> Name -> Bool == :: Name -> Name -> Bool $c== :: Name -> Name -> Bool Eq, (forall x. Name -> Rep Name x) -> (forall x. Rep Name x -> Name) -> Generic Name forall x. Rep Name x -> Name forall x. Name -> Rep Name x forall a. (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a $cto :: forall x. Rep Name x -> Name $cfrom :: forall x. Name -> Rep Name x Generic, Eq Name Eq Name -> (Name -> Name -> Ordering) -> (Name -> Name -> Bool) -> (Name -> Name -> Bool) -> (Name -> Name -> Bool) -> (Name -> Name -> Bool) -> (Name -> Name -> Name) -> (Name -> Name -> Name) -> Ord Name Name -> Name -> Bool Name -> Name -> Ordering Name -> Name -> Name forall a. Eq a -> (a -> a -> Ordering) -> (a -> a -> Bool) -> (a -> a -> Bool) -> (a -> a -> Bool) -> (a -> a -> Bool) -> (a -> a -> a) -> (a -> a -> a) -> Ord a min :: Name -> Name -> Name $cmin :: Name -> Name -> Name max :: Name -> Name -> Name $cmax :: Name -> Name -> Name >= :: Name -> Name -> Bool $c>= :: Name -> Name -> Bool > :: Name -> Name -> Bool $c> :: Name -> Name -> Bool <= :: Name -> Name -> Bool $c<= :: Name -> Name -> Bool < :: Name -> Name -> Bool $c< :: Name -> Name -> Bool compare :: Name -> Name -> Ordering $ccompare :: Name -> Name -> Ordering $cp1Ord :: Eq Name Ord, Int -> Name -> ShowS [Name] -> ShowS Name -> String (Int -> Name -> ShowS) -> (Name -> String) -> ([Name] -> ShowS) -> Show Name forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a showList :: [Name] -> ShowS $cshowList :: [Name] -> ShowS show :: Name -> String $cshow :: Name -> String showsPrec :: Int -> Name -> ShowS $cshowsPrec :: Int -> Name -> ShowS Show) deriving newtype ( Eq Name Eq Name -> (Accesses -> Name -> Name -> Bool) -> Cacheable Name Accesses -> Name -> Name -> Bool forall a. Eq a -> (Accesses -> a -> a -> Bool) -> Cacheable a unchanged :: Accesses -> Name -> Name -> Bool $cunchanged :: Accesses -> Name -> Name -> Bool $cp1Cacheable :: Eq Name Cacheable, Value -> Parser [Name] Value -> Parser Name (Value -> Parser Name) -> (Value -> Parser [Name]) -> FromJSON Name forall a. (Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a parseJSONList :: Value -> Parser [Name] $cparseJSONList :: Value -> Parser [Name] parseJSON :: Value -> Parser Name $cparseJSON :: Value -> Parser Name FromJSON, Int -> Name -> Int Name -> Int (Int -> Name -> Int) -> (Name -> Int) -> Hashable Name forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a hash :: Name -> Int $chash :: Name -> Int hashWithSalt :: Int -> Name -> Int $chashWithSalt :: Int -> Name -> Int Hashable, Name -> () (Name -> ()) -> NFData Name forall a. (a -> ()) -> NFData a rnf :: Name -> () $crnf :: Name -> () NFData, [Name] -> Value [Name] -> Encoding Name -> Value Name -> Encoding (Name -> Value) -> (Name -> Encoding) -> ([Name] -> Value) -> ([Name] -> Encoding) -> ToJSON Name forall a. (a -> Value) -> (a -> Encoding) -> ([a] -> Value) -> ([a] -> Encoding) -> ToJSON a toEncodingList :: [Name] -> Encoding $ctoEncodingList :: [Name] -> Encoding toJSONList :: [Name] -> Value $ctoJSONList :: [Name] -> Value toEncoding :: Name -> Encoding $ctoEncoding :: Name -> Encoding toJSON :: Name -> Value $ctoJSON :: Name -> Value ToJSON ) instance ToJSONKey Name where toJSONKey :: ToJSONKeyFunction Name toJSONKey = (Name -> Text) -> ToJSONKeyFunction Name forall a. (a -> Text) -> ToJSONKeyFunction a toJSONKeyText Name -> Text forall a. ToTxt a => a -> Text toTxt instance ToTxt Name where toTxt :: Name -> Text toTxt = Text -> [Text] -> Text Text.intercalate Text "." ([Text] -> Text) -> (Name -> [Text]) -> Name -> Text forall b c a. (b -> c) -> (a -> b) -> a -> c . NonEmpty Text -> [Text] forall a. NonEmpty a -> [a] NonEmpty.toList (NonEmpty Text -> [Text]) -> (Name -> NonEmpty Text) -> Name -> [Text] forall b c a. (b -> c) -> (a -> b) -> a -> c . Name -> NonEmpty Text unName instance ToErrorValue Name where toErrorValue :: Name -> ErrorMessage toErrorValue = Text -> ErrorMessage ErrorValue.squote (Text -> ErrorMessage) -> (Name -> Text) -> Name -> ErrorMessage forall b c a. (b -> c) -> (a -> b) -> a -> c . Name -> Text forall a. ToTxt a => a -> Text toTxt