diff options
| author | Gregor Kleen <gkleen@yggdrasil.li> | 2025-11-21 14:51:23 +0100 |
|---|---|---|
| committer | Gregor Kleen <gkleen@yggdrasil.li> | 2025-11-21 14:51:23 +0100 |
| commit | 4c46e82769847177f6582447f027a56f9b555fd0 (patch) | |
| tree | c797e1ecf691e8e05399d83ad3042c52ac08111e /overlays/spm/lib | |
| parent | 4341d2d9b0e5d57adf676bfad3d39cefdf7eca6f (diff) | |
| download | nixos-4c46e82769847177f6582447f027a56f9b555fd0.tar nixos-4c46e82769847177f6582447f027a56f9b555fd0.tar.gz nixos-4c46e82769847177f6582447f027a56f9b555fd0.tar.bz2 nixos-4c46e82769847177f6582447f027a56f9b555fd0.tar.xz nixos-4c46e82769847177f6582447f027a56f9b555fd0.zip | |
...
Diffstat (limited to 'overlays/spm/lib')
| -rw-r--r-- | overlays/spm/lib/Spm/Api.hs | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/overlays/spm/lib/Spm/Api.hs b/overlays/spm/lib/Spm/Api.hs index 8285cc55..3c22bfb6 100644 --- a/overlays/spm/lib/Spm/Api.hs +++ b/overlays/spm/lib/Spm/Api.hs | |||
| @@ -21,7 +21,6 @@ import Data.Text (Text) | |||
| 21 | import qualified Data.Text as Text | 21 | import qualified Data.Text as Text |
| 22 | 22 | ||
| 23 | import GHC.Generics (Generic) | 23 | import GHC.Generics (Generic) |
| 24 | import Type.Reflection (Typeable) | ||
| 25 | 24 | ||
| 26 | import Control.Lens | 25 | import Control.Lens |
| 27 | 26 | ||
| @@ -62,7 +61,7 @@ instance FromHttpApiData SpmStyle where | |||
| 62 | 61 | ||
| 63 | 62 | ||
| 64 | newtype SpmMailbox = SpmMailbox { unSpmMailbox :: CI Text } | 63 | newtype SpmMailbox = SpmMailbox { unSpmMailbox :: CI Text } |
| 65 | deriving stock (Eq, Ord, Read, Show, Generic, Typeable) | 64 | deriving stock (Eq, Ord, Read, Show, Generic) |
| 66 | deriving newtype (MimeRender PlainText) | 65 | deriving newtype (MimeRender PlainText) |
| 67 | makeWrapped ''SpmMailbox | 66 | makeWrapped ''SpmMailbox |
| 68 | 67 | ||
| @@ -70,7 +69,7 @@ instance MimeRender JSON SpmMailbox where | |||
| 70 | mimeRender p mbox = mimeRender p $ JSON.object [ "mailbox" JSON..= unSpmMailbox mbox ] | 69 | mimeRender p mbox = mimeRender p $ JSON.object [ "mailbox" JSON..= unSpmMailbox mbox ] |
| 71 | 70 | ||
| 72 | newtype SpmDomain = SpmDomain { unSpmDomain :: CI Text } | 71 | newtype SpmDomain = SpmDomain { unSpmDomain :: CI Text } |
| 73 | deriving stock (Eq, Ord, Read, Show, Generic, Typeable) | 72 | deriving stock (Eq, Ord, Read, Show, Generic) |
| 74 | deriving newtype (MimeRender PlainText) | 73 | deriving newtype (MimeRender PlainText) |
| 75 | makeWrapped ''SpmDomain | 74 | makeWrapped ''SpmDomain |
| 76 | 75 | ||
| @@ -79,17 +78,17 @@ instance MimeRender JSON SpmDomain where | |||
| 79 | 78 | ||
| 80 | newtype SpmLocal = SpmLocal | 79 | newtype SpmLocal = SpmLocal |
| 81 | { unSpmLocal :: CI Text | 80 | { unSpmLocal :: CI Text |
| 82 | } deriving stock (Eq, Ord, Read, Show, Generic, Typeable) | 81 | } deriving stock (Eq, Ord, Read, Show, Generic) |
| 83 | deriving newtype (ToJSON, FromJSON) | 82 | deriving newtype (ToJSON, FromJSON) |
| 84 | makeWrapped ''SpmLocal | 83 | makeWrapped ''SpmLocal |
| 85 | newtype SpmExtension = SpmExtension | 84 | newtype SpmExtension = SpmExtension |
| 86 | { unSpmExtension :: CI Text | 85 | { unSpmExtension :: CI Text |
| 87 | } deriving stock (Eq, Ord, Read, Show, Generic, Typeable) | 86 | } deriving stock (Eq, Ord, Read, Show, Generic) |
| 88 | deriving newtype (ToJSON, FromJSON) | 87 | deriving newtype (ToJSON, FromJSON) |
| 89 | makeWrapped ''SpmExtension | 88 | makeWrapped ''SpmExtension |
| 90 | 89 | ||
| 91 | data SpmMappingState = Valid | Reject | 90 | data SpmMappingState = Valid | Reject |
| 92 | deriving (Eq, Ord, Read, Show, Enum, Bounded, Generic, Typeable) | 91 | deriving (Eq, Ord, Read, Show, Enum, Bounded, Generic) |
| 93 | instance MimeRender PlainText SpmMappingState where | 92 | instance MimeRender PlainText SpmMappingState where |
| 94 | mimeRender p = mimeRender @_ @Text p . \case | 93 | mimeRender p = mimeRender @_ @Text p . \case |
| 95 | Valid -> "valid" | 94 | Valid -> "valid" |
| @@ -109,15 +108,15 @@ _SpmMappingStateReject = iso toReject fromReject | |||
| 109 | data SpmMappingListingItem = SpmMappingListingItem | 108 | data SpmMappingListingItem = SpmMappingListingItem |
| 110 | { smlMapping :: SpmMapping | 109 | { smlMapping :: SpmMapping |
| 111 | , smlState :: SpmMappingState | 110 | , smlState :: SpmMappingState |
| 112 | } deriving (Eq, Ord, Read, Show, Generic, Typeable) | 111 | } deriving (Eq, Ord, Read, Show, Generic) |
| 113 | 112 | ||
| 114 | newtype SpmMappingListing = SpmMappingListing { unSpmMappingListing :: [SpmMappingListingItem] } | 113 | newtype SpmMappingListing = SpmMappingListing { unSpmMappingListing :: [SpmMappingListingItem] } |
| 115 | deriving stock (Eq, Ord, Read, Show, Generic, Typeable) | 114 | deriving stock (Eq, Ord, Read, Show, Generic) |
| 116 | 115 | ||
| 117 | data SpmMapping = SpmMapping | 116 | data SpmMapping = SpmMapping |
| 118 | { spmMappingLocal :: Maybe SpmLocal | 117 | { spmMappingLocal :: Maybe SpmLocal |
| 119 | , spmMappingExtension :: Maybe SpmExtension | 118 | , spmMappingExtension :: Maybe SpmExtension |
| 120 | } deriving stock (Eq, Ord, Read, Show, Generic, Typeable) | 119 | } deriving stock (Eq, Ord, Read, Show, Generic) |
| 121 | 120 | ||
| 122 | _SpmMappingText :: Iso' SpmMapping Text | 121 | _SpmMappingText :: Iso' SpmMapping Text |
| 123 | _SpmMappingText = iso toText fromText | 122 | _SpmMappingText = iso toText fromText |
| @@ -170,7 +169,7 @@ instance ToJSON SpmMappingListing where | |||
| 170 | data SpmJWTClaims = SpmJWTClaims | 169 | data SpmJWTClaims = SpmJWTClaims |
| 171 | { spmjwtStdClaims :: ClaimsSet | 170 | { spmjwtStdClaims :: ClaimsSet |
| 172 | , spmjwtLocal :: SpmLocal | 171 | , spmjwtLocal :: SpmLocal |
| 173 | } deriving stock (Eq, Show, Generic, Typeable) | 172 | } deriving stock (Eq, Show, Generic) |
| 174 | 173 | ||
| 175 | makeLensesFor [("spmjwtStdClaims", "_stdClaims"), ("spmjwtLocal", "_spmjwtLocal")] ''SpmJWTClaims | 174 | makeLensesFor [("spmjwtStdClaims", "_stdClaims"), ("spmjwtLocal", "_spmjwtLocal")] ''SpmJWTClaims |
| 176 | 175 | ||
